1999-10-09 13:11:46 +00:00
|
|
|
/*-
|
|
|
|
* Copyright (c) 1999 Doug Rabson
|
|
|
|
* All rights reserved.
|
|
|
|
*
|
|
|
|
* Redistribution and use in source and binary forms, with or without
|
|
|
|
* modification, are permitted provided that the following conditions
|
|
|
|
* are met:
|
|
|
|
* 1. Redistributions of source code must retain the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer.
|
|
|
|
* 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer in the
|
|
|
|
* documentation and/or other materials provided with the distribution.
|
|
|
|
*
|
|
|
|
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
|
|
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
|
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
|
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
|
|
|
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
|
|
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
|
|
|
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
|
|
|
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
|
|
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
|
|
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
|
|
|
* SUCH DAMAGE.
|
|
|
|
*
|
|
|
|
* $FreeBSD$
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <sys/param.h>
|
|
|
|
#include <sys/systm.h>
|
2000-03-31 19:35:41 +00:00
|
|
|
#include <sys/malloc.h>
|
1999-10-09 13:11:46 +00:00
|
|
|
#include <sys/module.h>
|
|
|
|
#include <sys/bus.h>
|
|
|
|
#include <isa/isavar.h>
|
|
|
|
#include <isa/pnpreg.h>
|
|
|
|
#include <isa/pnpvar.h>
|
|
|
|
|
2000-03-31 07:12:12 +00:00
|
|
|
#define MAXDEP 8
|
|
|
|
|
1999-10-14 21:03:03 +00:00
|
|
|
#define I16(p) ((p)[0] + ((p)[1] << 8))
|
|
|
|
#define I32(p) (I16(p) + (I16(p+2) << 16))
|
|
|
|
|
1999-10-09 13:11:46 +00:00
|
|
|
/*
|
|
|
|
* Parse resource data for Logical Devices.
|
|
|
|
*
|
|
|
|
* This function exits as soon as it gets an error reading *ANY*
|
2000-03-31 07:12:12 +00:00
|
|
|
* Resource Data or it reaches the end of Resource Data.
|
1999-10-09 13:11:46 +00:00
|
|
|
*/
|
|
|
|
void
|
2000-07-11 11:49:33 +00:00
|
|
|
pnp_parse_resources(device_t dev, u_char *resources, int len, u_int32_t vendor_id, u_int32_t logical_id, int ldn)
|
1999-10-09 13:11:46 +00:00
|
|
|
{
|
|
|
|
device_t parent = device_get_parent(dev);
|
|
|
|
u_char tag, *resp, *resinfo;
|
|
|
|
int large_len, scanning = len;
|
1999-10-14 21:03:03 +00:00
|
|
|
u_int32_t id, compat_id;
|
1999-10-09 13:11:46 +00:00
|
|
|
struct isa_config *config;
|
2000-03-31 07:12:12 +00:00
|
|
|
int ncfgs = 1;
|
|
|
|
int priorities[1 + MAXDEP];
|
2000-03-31 19:35:41 +00:00
|
|
|
struct isa_config *configs;
|
1999-10-09 13:11:46 +00:00
|
|
|
char buf[100];
|
2000-03-31 07:12:12 +00:00
|
|
|
int i;
|
1999-10-09 13:11:46 +00:00
|
|
|
|
1999-10-14 21:03:03 +00:00
|
|
|
id = isa_get_logicalid(dev);
|
2000-03-31 19:35:41 +00:00
|
|
|
configs = (struct isa_config *)malloc(sizeof(*configs) * (1 + MAXDEP),
|
2000-12-08 21:51:06 +00:00
|
|
|
M_DEVBUF, M_NOWAIT | M_ZERO);
|
2000-03-31 19:35:41 +00:00
|
|
|
if (configs == NULL) {
|
|
|
|
device_printf(dev, "No memory to parse PNP data\n");
|
|
|
|
return;
|
|
|
|
}
|
2000-03-31 07:12:12 +00:00
|
|
|
config = &configs[0];
|
|
|
|
priorities[0] = 0;
|
1999-10-09 13:11:46 +00:00
|
|
|
resp = resources;
|
|
|
|
while (scanning > 0) {
|
|
|
|
tag = *resp++;
|
|
|
|
scanning--;
|
|
|
|
if (PNP_RES_TYPE(tag) == 0) {
|
|
|
|
/* Small resource */
|
|
|
|
if (scanning < PNP_SRES_LEN(tag)) {
|
|
|
|
scanning = 0;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
resinfo = resp;
|
|
|
|
resp += PNP_SRES_LEN(tag);
|
|
|
|
scanning -= PNP_SRES_LEN(tag);;
|
|
|
|
|
|
|
|
switch (PNP_SRES_NUM(tag)) {
|
|
|
|
case PNP_TAG_COMPAT_DEVICE:
|
|
|
|
/*
|
|
|
|
* Got a compatible device id
|
|
|
|
* resource. Should keep a list of
|
|
|
|
* compat ids in the device.
|
|
|
|
*/
|
|
|
|
bcopy(resinfo, &compat_id, 4);
|
|
|
|
isa_set_compatid(dev, compat_id);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case PNP_TAG_IRQ_FORMAT:
|
2000-06-25 09:19:59 +00:00
|
|
|
if (!I16(resinfo))
|
|
|
|
break;
|
1999-10-14 21:03:03 +00:00
|
|
|
if (bootverbose) {
|
2000-06-25 09:19:59 +00:00
|
|
|
printf("%s: adding irq mask %#02x\n",
|
1999-10-14 21:03:03 +00:00
|
|
|
pnp_eisaformat(id),
|
|
|
|
I16(resinfo));
|
|
|
|
}
|
1999-10-09 13:11:46 +00:00
|
|
|
if (config->ic_nirq == ISA_NIRQ) {
|
2000-03-31 07:12:12 +00:00
|
|
|
device_printf(parent, "too many irqs\n");
|
1999-10-09 13:11:46 +00:00
|
|
|
scanning = 0;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
config->ic_irqmask[config->ic_nirq] =
|
1999-10-14 21:03:03 +00:00
|
|
|
I16(resinfo);
|
1999-10-09 13:11:46 +00:00
|
|
|
config->ic_nirq++;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case PNP_TAG_DMA_FORMAT:
|
1999-10-14 21:03:03 +00:00
|
|
|
if (bootverbose) {
|
|
|
|
printf("%s: adding dma mask %#02x\n",
|
|
|
|
pnp_eisaformat(id),
|
|
|
|
resinfo[0]);
|
|
|
|
}
|
1999-10-09 13:11:46 +00:00
|
|
|
if (config->ic_ndrq == ISA_NDRQ) {
|
2000-03-31 07:12:12 +00:00
|
|
|
device_printf(parent, "too many drqs\n");
|
1999-10-09 13:11:46 +00:00
|
|
|
scanning = 0;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
config->ic_drqmask[config->ic_ndrq] =
|
|
|
|
resinfo[0];
|
|
|
|
config->ic_ndrq++;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case PNP_TAG_START_DEPENDANT:
|
1999-10-14 21:03:03 +00:00
|
|
|
if (bootverbose) {
|
|
|
|
printf("%s: start dependant\n",
|
|
|
|
pnp_eisaformat(id));
|
|
|
|
}
|
2000-04-04 07:48:04 +00:00
|
|
|
if (ncfgs > MAXDEP) {
|
2000-03-31 07:12:12 +00:00
|
|
|
device_printf(parent, "too many dependant configs (%d)\n", MAXDEP);
|
1999-10-09 13:11:46 +00:00
|
|
|
scanning = 0;
|
|
|
|
break;
|
|
|
|
}
|
2000-03-31 07:12:12 +00:00
|
|
|
config = &configs[ncfgs];
|
1999-10-09 13:11:46 +00:00
|
|
|
/*
|
|
|
|
* If the priority is not specified,
|
|
|
|
* then use the default of
|
|
|
|
* 'acceptable'
|
|
|
|
*/
|
|
|
|
if (PNP_SRES_LEN(tag) > 0)
|
2000-03-31 07:12:12 +00:00
|
|
|
priorities[ncfgs] = resinfo[0];
|
1999-10-09 13:11:46 +00:00
|
|
|
else
|
2000-03-31 07:12:12 +00:00
|
|
|
priorities[ncfgs] = 1;
|
|
|
|
ncfgs++;
|
1999-10-09 13:11:46 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case PNP_TAG_END_DEPENDANT:
|
1999-10-14 21:03:03 +00:00
|
|
|
if (bootverbose) {
|
|
|
|
printf("%s: end dependant\n",
|
|
|
|
pnp_eisaformat(id));
|
|
|
|
}
|
2000-03-31 07:12:12 +00:00
|
|
|
config = &configs[0]; /* back to main config */
|
1999-10-09 13:11:46 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case PNP_TAG_IO_RANGE:
|
1999-10-14 21:03:03 +00:00
|
|
|
if (bootverbose) {
|
|
|
|
printf("%s: adding io range "
|
|
|
|
"%#x-%#x, size=%#x, "
|
|
|
|
"align=%#x\n",
|
|
|
|
pnp_eisaformat(id),
|
|
|
|
I16(resinfo + 1),
|
|
|
|
I16(resinfo + 3) + resinfo[6]-1,
|
|
|
|
resinfo[6],
|
|
|
|
resinfo[5]);
|
|
|
|
}
|
1999-10-09 13:11:46 +00:00
|
|
|
if (config->ic_nport == ISA_NPORT) {
|
2000-03-31 07:12:12 +00:00
|
|
|
device_printf(parent, "too many ports\n");
|
1999-10-09 13:11:46 +00:00
|
|
|
scanning = 0;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
config->ic_port[config->ic_nport].ir_start =
|
1999-10-14 21:03:03 +00:00
|
|
|
I16(resinfo + 1);
|
1999-10-09 13:11:46 +00:00
|
|
|
config->ic_port[config->ic_nport].ir_end =
|
1999-10-14 21:03:03 +00:00
|
|
|
I16(resinfo + 3) + resinfo[6] - 1;
|
|
|
|
config->ic_port[config->ic_nport].ir_size =
|
1999-10-09 13:11:46 +00:00
|
|
|
resinfo[6];
|
1999-10-14 21:03:03 +00:00
|
|
|
if (resinfo[5] == 0) {
|
|
|
|
/* Make sure align is at least one */
|
|
|
|
resinfo[5] = 1;
|
|
|
|
}
|
1999-10-09 13:11:46 +00:00
|
|
|
config->ic_port[config->ic_nport].ir_align =
|
|
|
|
resinfo[5];
|
|
|
|
config->ic_nport++;
|
2000-07-11 11:49:33 +00:00
|
|
|
pnp_check_quirks(vendor_id,
|
|
|
|
logical_id,
|
|
|
|
ldn, config);
|
1999-10-09 13:11:46 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case PNP_TAG_IO_FIXED:
|
1999-10-14 21:03:03 +00:00
|
|
|
if (bootverbose) {
|
2000-03-31 07:12:12 +00:00
|
|
|
printf("%s: adding fixed io range "
|
1999-10-14 21:03:03 +00:00
|
|
|
"%#x-%#x, size=%#x, "
|
|
|
|
"align=%#x\n",
|
|
|
|
pnp_eisaformat(id),
|
|
|
|
I16(resinfo),
|
|
|
|
I16(resinfo) + resinfo[2] - 1,
|
|
|
|
resinfo[2],
|
|
|
|
1);
|
|
|
|
}
|
1999-10-09 13:11:46 +00:00
|
|
|
if (config->ic_nport == ISA_NPORT) {
|
2000-03-31 07:12:12 +00:00
|
|
|
device_printf(parent, "too many ports\n");
|
1999-10-09 13:11:46 +00:00
|
|
|
scanning = 0;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
config->ic_port[config->ic_nport].ir_start =
|
1999-10-14 21:03:03 +00:00
|
|
|
I16(resinfo);
|
1999-10-09 13:11:46 +00:00
|
|
|
config->ic_port[config->ic_nport].ir_end =
|
1999-10-14 21:03:03 +00:00
|
|
|
I16(resinfo) + resinfo[2] - 1;
|
1999-10-09 13:11:46 +00:00
|
|
|
config->ic_port[config->ic_nport].ir_size
|
|
|
|
= resinfo[2];
|
|
|
|
config->ic_port[config->ic_nport].ir_align = 1;
|
|
|
|
config->ic_nport++;
|
|
|
|
break;
|
|
|
|
|
1999-10-14 21:03:03 +00:00
|
|
|
case PNP_TAG_END:
|
|
|
|
if (bootverbose) {
|
2000-03-31 07:12:12 +00:00
|
|
|
printf("%s: end config\n",
|
1999-10-14 21:03:03 +00:00
|
|
|
pnp_eisaformat(id));
|
|
|
|
}
|
|
|
|
scanning = 0;
|
|
|
|
break;
|
|
|
|
|
1999-10-09 13:11:46 +00:00
|
|
|
default:
|
|
|
|
/* Skip this resource */
|
2000-03-31 07:12:12 +00:00
|
|
|
device_printf(parent, "unexpected small tag %d\n",
|
1999-10-09 13:11:46 +00:00
|
|
|
PNP_SRES_NUM(tag));
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
/* Large resource */
|
|
|
|
if (scanning < 2) {
|
|
|
|
scanning = 0;
|
|
|
|
continue;
|
|
|
|
}
|
1999-10-14 21:03:03 +00:00
|
|
|
large_len = I16(resp);
|
1999-10-09 13:11:46 +00:00
|
|
|
resp += 2;
|
|
|
|
scanning -= 2;
|
|
|
|
|
|
|
|
if (scanning < large_len) {
|
|
|
|
scanning = 0;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
resinfo = resp;
|
|
|
|
resp += large_len;
|
|
|
|
scanning -= large_len;
|
|
|
|
|
1999-10-14 21:03:03 +00:00
|
|
|
switch (PNP_LRES_NUM(tag)) {
|
|
|
|
case PNP_TAG_ID_ANSI:
|
1999-10-09 13:11:46 +00:00
|
|
|
if (large_len > sizeof(buf) - 1)
|
|
|
|
large_len = sizeof(buf) - 1;
|
|
|
|
bcopy(resinfo, buf, large_len);
|
|
|
|
|
|
|
|
/*
|
2000-03-31 07:12:12 +00:00
|
|
|
* Trim trailing spaces and garbage.
|
1999-10-09 13:11:46 +00:00
|
|
|
*/
|
2000-03-31 07:12:12 +00:00
|
|
|
while (large_len > 0 && buf[large_len - 1] <= ' ')
|
1999-10-09 13:11:46 +00:00
|
|
|
large_len--;
|
|
|
|
buf[large_len] = '\0';
|
|
|
|
device_set_desc_copy(dev, buf);
|
1999-10-14 21:03:03 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case PNP_TAG_MEMORY_RANGE:
|
|
|
|
if (bootverbose) {
|
2000-03-31 07:07:51 +00:00
|
|
|
int temp = I16(resinfo + 7) << 8;
|
|
|
|
|
1999-10-14 21:03:03 +00:00
|
|
|
printf("%s: adding memory range "
|
|
|
|
"%#x-%#x, size=%#x, "
|
|
|
|
"align=%#x\n",
|
|
|
|
pnp_eisaformat(id),
|
|
|
|
I16(resinfo + 1)<<8,
|
2000-03-31 07:07:51 +00:00
|
|
|
(I16(resinfo + 3)<<8) + temp - 1,
|
|
|
|
temp,
|
1999-10-14 21:03:03 +00:00
|
|
|
I16(resinfo + 5));
|
|
|
|
}
|
1999-10-09 13:11:46 +00:00
|
|
|
|
1999-10-14 21:03:03 +00:00
|
|
|
if (config->ic_nmem == ISA_NMEM) {
|
2000-03-31 19:35:41 +00:00
|
|
|
device_printf(parent, "too many memory ranges\n");
|
1999-10-14 21:03:03 +00:00
|
|
|
scanning = 0;
|
|
|
|
break;
|
|
|
|
}
|
1999-10-09 13:11:46 +00:00
|
|
|
|
1999-10-14 21:03:03 +00:00
|
|
|
config->ic_mem[config->ic_nmem].ir_start =
|
|
|
|
I16(resinfo + 1)<<8;
|
|
|
|
config->ic_mem[config->ic_nmem].ir_end =
|
|
|
|
(I16(resinfo + 3)<<8)
|
2000-03-31 07:07:51 +00:00
|
|
|
+ (I16(resinfo + 7) << 8) - 1;
|
1999-10-14 21:03:03 +00:00
|
|
|
config->ic_mem[config->ic_nmem].ir_size =
|
2000-03-31 07:07:51 +00:00
|
|
|
I16(resinfo + 7) << 8;
|
1999-10-14 21:03:03 +00:00
|
|
|
config->ic_mem[config->ic_nmem].ir_align =
|
|
|
|
I16(resinfo + 5);
|
|
|
|
if (!config->ic_mem[config->ic_nmem].ir_align)
|
|
|
|
config->ic_mem[config->ic_nmem]
|
|
|
|
.ir_align = 0x10000;
|
|
|
|
config->ic_nmem++;
|
1999-10-09 13:11:46 +00:00
|
|
|
break;
|
|
|
|
|
1999-10-14 21:03:03 +00:00
|
|
|
case PNP_TAG_MEMORY32_RANGE:
|
2000-11-07 00:03:33 +00:00
|
|
|
if (I32(resinfo + 13) == 0) {
|
|
|
|
if (bootverbose) {
|
|
|
|
printf("%s: skipping empty range\n",
|
|
|
|
pnp_eisaformat(id));
|
|
|
|
}
|
|
|
|
continue;
|
|
|
|
}
|
1999-10-14 21:03:03 +00:00
|
|
|
if (bootverbose) {
|
2000-03-31 07:12:12 +00:00
|
|
|
printf("%s: adding memory32 range "
|
1999-10-14 21:03:03 +00:00
|
|
|
"%#x-%#x, size=%#x, "
|
|
|
|
"align=%#x\n",
|
|
|
|
pnp_eisaformat(id),
|
|
|
|
I32(resinfo + 1),
|
|
|
|
I32(resinfo + 5)
|
|
|
|
+ I32(resinfo + 13) - 1,
|
|
|
|
I32(resinfo + 13),
|
|
|
|
I32(resinfo + 9));
|
|
|
|
}
|
|
|
|
|
|
|
|
if (config->ic_nmem == ISA_NMEM) {
|
2000-03-31 07:12:12 +00:00
|
|
|
device_printf(parent, "too many memory ranges\n");
|
1999-10-14 21:03:03 +00:00
|
|
|
scanning = 0;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
config->ic_mem[config->ic_nmem].ir_start =
|
|
|
|
I32(resinfo + 1);
|
|
|
|
config->ic_mem[config->ic_nmem].ir_end =
|
|
|
|
I32(resinfo + 5)
|
|
|
|
+ I32(resinfo + 13) - 1;
|
|
|
|
config->ic_mem[config->ic_nmem].ir_size =
|
|
|
|
I32(resinfo + 13);
|
1999-10-09 13:11:46 +00:00
|
|
|
config->ic_mem[config->ic_nmem].ir_align =
|
1999-10-14 21:03:03 +00:00
|
|
|
I32(resinfo + 9);
|
|
|
|
config->ic_nmem++;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case PNP_TAG_MEMORY32_FIXED:
|
|
|
|
if (I32(resinfo + 5) == 0) {
|
|
|
|
if (bootverbose) {
|
|
|
|
printf("%s: skipping empty range\n",
|
|
|
|
pnp_eisaformat(id));
|
|
|
|
}
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
if (bootverbose) {
|
2000-03-31 07:12:12 +00:00
|
|
|
printf("%s: adding fixed memory32 range "
|
1999-10-14 21:03:03 +00:00
|
|
|
"%#x-%#x, size=%#x\n",
|
|
|
|
pnp_eisaformat(id),
|
|
|
|
I32(resinfo + 1),
|
|
|
|
I32(resinfo + 1)
|
|
|
|
+ I32(resinfo + 5) - 1,
|
|
|
|
I32(resinfo + 5));
|
|
|
|
}
|
|
|
|
|
|
|
|
if (config->ic_nmem == ISA_NMEM) {
|
2000-03-31 07:12:12 +00:00
|
|
|
device_printf(parent, "too many memory ranges\n");
|
1999-10-14 21:03:03 +00:00
|
|
|
scanning = 0;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
config->ic_mem[config->ic_nmem].ir_start =
|
|
|
|
I32(resinfo + 1);
|
|
|
|
config->ic_mem[config->ic_nmem].ir_end =
|
|
|
|
I32(resinfo + 1)
|
|
|
|
+ I32(resinfo + 5) - 1;
|
|
|
|
config->ic_mem[config->ic_nmem].ir_size =
|
|
|
|
I32(resinfo + 5);
|
|
|
|
config->ic_mem[config->ic_nmem].ir_align = 1;
|
|
|
|
config->ic_nmem++;
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
/* Skip this resource */
|
2000-03-31 07:12:12 +00:00
|
|
|
device_printf(parent, "unexpected large tag %d\n",
|
1999-10-14 21:03:03 +00:00
|
|
|
PNP_SRES_NUM(tag));
|
|
|
|
}
|
1999-10-09 13:11:46 +00:00
|
|
|
}
|
|
|
|
}
|
2000-03-31 07:12:12 +00:00
|
|
|
if(ncfgs == 1) {
|
|
|
|
/* Single config without dependants */
|
|
|
|
(void)ISA_ADD_CONFIG(parent, dev, priorities[0], &configs[0]);
|
2000-03-31 19:35:41 +00:00
|
|
|
free(configs, M_DEVBUF);
|
2000-03-31 07:12:12 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
/* Cycle through dependant configs merging primary details */
|
|
|
|
for(i = 1; i < ncfgs; i++) {
|
|
|
|
int j;
|
|
|
|
config = &configs[i];
|
|
|
|
for(j = 0; j < configs[0].ic_nmem; j++) {
|
|
|
|
if (config->ic_nmem == ISA_NMEM) {
|
|
|
|
device_printf(parent, "too many memory ranges\n");
|
2000-03-31 19:35:41 +00:00
|
|
|
free(configs, M_DEVBUF);
|
2000-03-31 07:12:12 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
config->ic_mem[config->ic_nmem] = configs[0].ic_mem[j];
|
|
|
|
config->ic_nmem++;
|
|
|
|
}
|
|
|
|
for(j = 0; j < configs[0].ic_nport; j++) {
|
|
|
|
if (config->ic_nport == ISA_NPORT) {
|
|
|
|
device_printf(parent, "too many port ranges\n");
|
2000-03-31 19:35:41 +00:00
|
|
|
free(configs, M_DEVBUF);
|
2000-03-31 07:12:12 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
config->ic_port[config->ic_nport] = configs[0].ic_port[j];
|
|
|
|
config->ic_nport++;
|
|
|
|
}
|
|
|
|
for(j = 0; j < configs[0].ic_nirq; j++) {
|
|
|
|
if (config->ic_nirq == ISA_NIRQ) {
|
|
|
|
device_printf(parent, "too many irq ranges\n");
|
2000-03-31 19:35:41 +00:00
|
|
|
free(configs, M_DEVBUF);
|
2000-03-31 07:12:12 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
config->ic_irqmask[config->ic_nirq] = configs[0].ic_irqmask[j];
|
|
|
|
config->ic_nirq++;
|
|
|
|
}
|
|
|
|
for(j = 0; j < configs[0].ic_ndrq; j++) {
|
|
|
|
if (config->ic_ndrq == ISA_NDRQ) {
|
|
|
|
device_printf(parent, "too many drq ranges\n");
|
2000-03-31 19:35:41 +00:00
|
|
|
free(configs, M_DEVBUF);
|
2000-03-31 07:12:12 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
config->ic_drqmask[config->ic_ndrq] = configs[0].ic_drqmask[j];
|
|
|
|
config->ic_ndrq++;
|
|
|
|
}
|
|
|
|
(void)ISA_ADD_CONFIG(parent, dev, priorities[i], &configs[i]);
|
|
|
|
}
|
2000-03-31 19:35:41 +00:00
|
|
|
free(configs, M_DEVBUF);
|
1999-10-09 13:11:46 +00:00
|
|
|
}
|