Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F177563510
D60674.1794739693.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Authored By
Unknown
Size
66 KB
Referenced Files
None
Subscribers
None
D60674.1794739693.diff
View Options
diff --git a/share/examples/drivers/make_device_driver.sh b/share/examples/drivers/make_device_driver.sh
--- a/share/examples/drivers/make_device_driver.sh
+++ b/share/examples/drivers/make_device_driver.sh
@@ -333,8 +333,6 @@
printf("${UPPER}: already attached\n");
return;
}
-/* XXX Look at dev/acpica/acpi_isa.c for use of ISA_ADD_CONFIG() macro. */
-/* XXX What is ISA_SET_CONFIG_CALLBACK(parent, child, pnpbios_set_config, 0)? */
for (i = 0; i < MAXHINTS; i++) {
ioport = res[i].ioport;
diff --git a/sys/conf/files b/sys/conf/files
--- a/sys/conf/files
+++ b/sys/conf/files
@@ -3853,8 +3853,6 @@
isa/isa_if.m standard
isa/isa_common.c optional isa
isa/isahint.c optional isa
-isa/pnp.c optional isa isapnp
-isa/pnpparse.c optional isa isapnp
fs/cd9660/cd9660_bmap.c optional cd9660
fs/cd9660/cd9660_lookup.c optional cd9660
fs/cd9660/cd9660_node.c optional cd9660
diff --git a/sys/conf/options b/sys/conf/options
--- a/sys/conf/options
+++ b/sys/conf/options
@@ -722,7 +722,6 @@
# ISA support
DEV_ISA opt_isa.h
-ISAPNP opt_dontuse.h
# various 'device presence' options
DEV_BPF opt_bpf.h
diff --git a/sys/dev/acpica/acpi.c b/sys/dev/acpica/acpi.c
--- a/sys/dev/acpica/acpi.c
+++ b/sys/dev/acpica/acpi.c
@@ -1216,8 +1216,6 @@
*(int *)result = ad->ad_domain;
break;
case ISA_IVAR_VENDORID:
- case ISA_IVAR_SERIAL:
- case ISA_IVAR_COMPATID:
*(int *)result = -1;
break;
case ISA_IVAR_LOGICALID:
diff --git a/sys/isa/isa_common.h b/sys/isa/isa_common.h
--- a/sys/isa/isa_common.h
+++ b/sys/isa/isa_common.h
@@ -33,32 +33,13 @@
* without notice.
*/
-/*
- * PNP configurations are kept in a tailq.
- */
-TAILQ_HEAD(isa_config_list, isa_config_entry);
-struct isa_config_entry {
- TAILQ_ENTRY(isa_config_entry) ice_link;
- int ice_priority;
- struct isa_config ice_config;
-};
-
/*
* The structure used to attach devices to the isa bus.
*/
struct isa_device {
struct resource_list id_resources;
uint32_t id_vendorid; /* pnp vendor id */
- uint32_t id_serial; /* pnp serial */
uint32_t id_logicalid; /* pnp logical device id */
- uint32_t id_compatid; /* pnp compat device id */
- struct isa_config_list id_configs; /* pnp config alternatives */
- isa_config_cb *id_config_cb; /* callback function */
- void *id_config_arg; /* callback argument */
- int id_config_attr; /* pnp config attributes */
- int id_pnpbios_handle; /* pnp handle, if any */
- int id_pnp_csn; /* pnp Card Number */
- int id_pnp_ldn; /* pnp Logical device on card */
int id_order;
};
diff --git a/sys/isa/isa_common.c b/sys/isa/isa_common.c
--- a/sys/isa/isa_common.c
+++ b/sys/isa/isa_common.c
@@ -110,382 +110,6 @@
return (0);
}
-/*
- * Find a working set of memory regions for a child using the ranges
- * in *config and return the regions in *result. Returns non-zero if
- * a set of ranges was found.
- */
-static int
-isa_find_memory(device_t child, struct isa_config *config,
- struct isa_config *result)
-{
- int success, i;
- struct resource *res[ISA_NMEM];
-
- /*
- * First clear out any existing resource definitions.
- */
- for (i = 0; i < ISA_NMEM; i++) {
- bus_delete_resource(child, SYS_RES_MEMORY, i);
- res[i] = NULL;
- }
-
- success = 1;
- result->ic_nmem = config->ic_nmem;
- for (i = 0; i < config->ic_nmem; i++) {
- uint32_t start, end, size, align;
-
- size = config->ic_mem[i].ir_size;
-
- /* the PnP device may have a null resource as filler */
- if (size == 0) {
- result->ic_mem[i].ir_start = 0;
- result->ic_mem[i].ir_end = 0;
- result->ic_mem[i].ir_size = 0;
- result->ic_mem[i].ir_align = 0;
- continue;
- }
-
- for (start = config->ic_mem[i].ir_start,
- end = config->ic_mem[i].ir_end,
- align = config->ic_mem[i].ir_align;
- start + size - 1 <= end && start + size > start;
- start += MAX(align, 1)) {
- bus_set_resource(child, SYS_RES_MEMORY, i,
- start, size);
- res[i] = bus_alloc_resource_any(child,
- SYS_RES_MEMORY, &i,
- rman_make_alignment_flags(align) /* !RF_ACTIVE */);
- if (res[i]) {
- result->ic_mem[i].ir_start = start;
- result->ic_mem[i].ir_end = start + size - 1;
- result->ic_mem[i].ir_size = size;
- result->ic_mem[i].ir_align = align;
- break;
- }
- }
-
- /*
- * If we didn't find a place for memory range i, then
- * give up now.
- */
- if (!res[i]) {
- success = 0;
- break;
- }
- }
-
- for (i = 0; i < ISA_NMEM; i++) {
- if (res[i])
- bus_release_resource(child, SYS_RES_MEMORY,
- i, res[i]);
- }
-
- return (success);
-}
-
-/*
- * Find a working set of port regions for a child using the ranges
- * in *config and return the regions in *result. Returns non-zero if
- * a set of ranges was found.
- */
-static int
-isa_find_port(device_t child, struct isa_config *config,
- struct isa_config *result)
-{
- int success, i;
- struct resource *res[ISA_NPORT];
-
- /*
- * First clear out any existing resource definitions.
- */
- for (i = 0; i < ISA_NPORT; i++) {
- bus_delete_resource(child, SYS_RES_IOPORT, i);
- res[i] = NULL;
- }
-
- success = 1;
- result->ic_nport = config->ic_nport;
- for (i = 0; i < config->ic_nport; i++) {
- uint32_t start, end, size, align;
-
- size = config->ic_port[i].ir_size;
-
- /* the PnP device may have a null resource as filler */
- if (size == 0) {
- result->ic_port[i].ir_start = 0;
- result->ic_port[i].ir_end = 0;
- result->ic_port[i].ir_size = 0;
- result->ic_port[i].ir_align = 0;
- continue;
- }
-
- for (start = config->ic_port[i].ir_start,
- end = config->ic_port[i].ir_end,
- align = config->ic_port[i].ir_align;
- start + size - 1 <= end;
- start += align) {
- bus_set_resource(child, SYS_RES_IOPORT, i,
- start, size);
- res[i] = bus_alloc_resource_any(child,
- SYS_RES_IOPORT, &i,
- rman_make_alignment_flags(align) /* !RF_ACTIVE */);
- if (res[i]) {
- result->ic_port[i].ir_start = start;
- result->ic_port[i].ir_end = start + size - 1;
- result->ic_port[i].ir_size = size;
- result->ic_port[i].ir_align = align;
- break;
- }
- }
-
- /*
- * If we didn't find a place for port range i, then
- * give up now.
- */
- if (!res[i]) {
- success = 0;
- break;
- }
- }
-
- for (i = 0; i < ISA_NPORT; i++) {
- if (res[i])
- bus_release_resource(child, SYS_RES_IOPORT,
- i, res[i]);
- }
-
- return success;
-}
-
-/*
- * Return the index of the first bit in the mask (or -1 if mask is empty.
- */
-static int
-find_first_bit(uint32_t mask)
-{
- return (ffs(mask) - 1);
-}
-
-/*
- * Return the index of the next bit in the mask, or -1 if there are no more.
- */
-static int
-find_next_bit(uint32_t mask, int bit)
-{
- return (find_first_bit(mask & (-2 << bit)));
-}
-
-/*
- * Find a working set of irqs for a child using the masks in *config
- * and return the regions in *result. Returns non-zero if a set of
- * irqs was found.
- */
-static int
-isa_find_irq(device_t child, struct isa_config *config,
- struct isa_config *result)
-{
- int success, i;
- struct resource *res[ISA_NIRQ];
-
- /*
- * First clear out any existing resource definitions.
- */
- for (i = 0; i < ISA_NIRQ; i++) {
- bus_delete_resource(child, SYS_RES_IRQ, i);
- res[i] = NULL;
- }
-
- success = 1;
- result->ic_nirq = config->ic_nirq;
- for (i = 0; i < config->ic_nirq; i++) {
- uint32_t mask = config->ic_irqmask[i];
- int irq;
-
- /* the PnP device may have a null resource as filler */
- if (mask == 0) {
- result->ic_irqmask[i] = 0;
- continue;
- }
-
- for (irq = find_first_bit(mask);
- irq != -1;
- irq = find_next_bit(mask, irq)) {
- bus_set_resource(child, SYS_RES_IRQ, i,
- irq, 1);
- res[i] = bus_alloc_resource_any(child,
- SYS_RES_IRQ, &i,
- 0 /* !RF_ACTIVE */ );
- if (res[i]) {
- result->ic_irqmask[i] = (1 << irq);
- break;
- }
- }
-
- /*
- * If we didn't find a place for irq range i, then
- * give up now.
- */
- if (!res[i]) {
- success = 0;
- break;
- }
- }
-
- for (i = 0; i < ISA_NIRQ; i++) {
- if (res[i])
- bus_release_resource(child, SYS_RES_IRQ,
- i, res[i]);
- }
-
- return (success);
-}
-
-/*
- * Find a working set of drqs for a child using the masks in *config
- * and return the regions in *result. Returns non-zero if a set of
- * drqs was found.
- */
-static int
-isa_find_drq(device_t child, struct isa_config *config,
- struct isa_config *result)
-{
- int success, i;
- struct resource *res[ISA_NDRQ];
-
- /*
- * First clear out any existing resource definitions.
- */
- for (i = 0; i < ISA_NDRQ; i++) {
- bus_delete_resource(child, SYS_RES_DRQ, i);
- res[i] = NULL;
- }
-
- success = 1;
- result->ic_ndrq = config->ic_ndrq;
- for (i = 0; i < config->ic_ndrq; i++) {
- uint32_t mask = config->ic_drqmask[i];
- int drq;
-
- /* the PnP device may have a null resource as filler */
- if (mask == 0) {
- result->ic_drqmask[i] = 0;
- continue;
- }
-
- for (drq = find_first_bit(mask);
- drq != -1;
- drq = find_next_bit(mask, drq)) {
- bus_set_resource(child, SYS_RES_DRQ, i,
- drq, 1);
- res[i] = bus_alloc_resource_any(child,
- SYS_RES_DRQ, &i,
- 0 /* !RF_ACTIVE */);
- if (res[i]) {
- result->ic_drqmask[i] = (1 << drq);
- break;
- }
- }
-
- /*
- * If we didn't find a place for drq range i, then
- * give up now.
- */
- if (!res[i]) {
- success = 0;
- break;
- }
- }
-
- for (i = 0; i < ISA_NDRQ; i++) {
- if (res[i])
- bus_release_resource(child, SYS_RES_DRQ,
- i, res[i]);
- }
-
- return (success);
-}
-
-/*
- * Attempt to find a working set of resources for a device. Return
- * non-zero if a working configuration is found.
- */
-static int
-isa_assign_resources(device_t child)
-{
- struct isa_device *idev = DEVTOISA(child);
- struct isa_config_entry *ice;
- struct isa_config *cfg;
- const char *reason;
-
- reason = "Empty ISA id_configs";
- cfg = malloc(sizeof(struct isa_config), M_TEMP, M_NOWAIT|M_ZERO);
- if (cfg == NULL)
- return(0);
- TAILQ_FOREACH(ice, &idev->id_configs, ice_link) {
- reason = "memory";
- if (!isa_find_memory(child, &ice->ice_config, cfg))
- continue;
- reason = "port";
- if (!isa_find_port(child, &ice->ice_config, cfg))
- continue;
- reason = "irq";
- if (!isa_find_irq(child, &ice->ice_config, cfg))
- continue;
- reason = "drq";
- if (!isa_find_drq(child, &ice->ice_config, cfg))
- continue;
-
- /*
- * A working configuration was found enable the device
- * with this configuration.
- */
- reason = "no callback";
- if (idev->id_config_cb) {
- idev->id_config_cb(idev->id_config_arg,
- cfg, 1);
- free(cfg, M_TEMP);
- return (1);
- }
- }
-
- /*
- * Disable the device.
- */
- bus_print_child_header(device_get_parent(child), child);
- printf(" can't assign resources (%s)\n", reason);
- if (bootverbose)
- isa_print_child(device_get_parent(child), child);
- bzero(cfg, sizeof (*cfg));
- if (idev->id_config_cb)
- idev->id_config_cb(idev->id_config_arg, cfg, 0);
- device_disable(child);
-
- free(cfg, M_TEMP);
- return (0);
-}
-
-/*
- * Claim any unallocated resources to keep other devices from using
- * them.
- */
-static void
-isa_claim_resources(device_t dev, device_t child)
-{
- struct isa_device *idev = DEVTOISA(child);
- struct resource_list *rl = &idev->id_resources;
- struct resource_list_entry *rle;
- int rid;
-
- STAILQ_FOREACH(rle, rl, link) {
- if (!rle->res) {
- rid = rle->rid;
- resource_list_alloc(rl, dev, child, rle->type, rid,
- 0, ~0, 1, 0);
- }
- }
-}
-
/*
* Called after other devices have initialised to probe for isa devices.
*/
@@ -494,8 +118,7 @@
{
struct isa_device *idev;
device_t *children, child;
- struct isa_config *cfg;
- int nchildren, i, err;
+ int nchildren, i;
/*
* Create all the non-hinted children by calling drivers'
@@ -503,97 +126,27 @@
*/
bus_identify_children(dev);
- if (device_get_children(dev, &children, &nchildren))
- return;
-
- /*
- * First disable all pnp devices so that they don't get
- * matched by legacy probes.
- */
- if (bootverbose)
- printf("isa_probe_children: disabling PnP devices\n");
-
- cfg = malloc(sizeof(*cfg), M_TEMP, M_NOWAIT|M_ZERO);
- if (cfg == NULL) {
- free(children, M_TEMP);
- return;
- }
-
- for (i = 0; i < nchildren; i++) {
- idev = DEVTOISA(children[i]);
-
- bzero(cfg, sizeof(*cfg));
- if (idev->id_config_cb)
- idev->id_config_cb(idev->id_config_arg, cfg, 0);
- }
-
- free(cfg, M_TEMP);
-
- /*
- * Next, probe all the PnP BIOS devices so they can subsume any
- * hints.
- */
- for (i = 0; i < nchildren; i++) {
- child = children[i];
- idev = DEVTOISA(child);
-
- if (idev->id_order > ISA_ORDER_PNPBIOS)
- continue;
- if (!TAILQ_EMPTY(&idev->id_configs) &&
- !isa_assign_resources(child))
- continue;
-
- if (device_probe_and_attach(child) == 0)
- isa_claim_resources(dev, child);
- }
- free(children, M_TEMP);
-
- /*
- * Next, enumerate hinted devices and probe all non-pnp devices so
- * that they claim their resources first.
- */
+ /* Next, enumerate hinted devices. */
bus_enumerate_hinted_children(dev);
+
+ bus_attach_children(dev);
+
+ isa_running = 1;
+
+ /* In GENERIC kernels, warn about non-PNP ISA devices. */
+ if (strcmp(kern_ident, "GENERIC") != 0)
+ return;
+
if (device_get_children(dev, &children, &nchildren))
return;
- if (bootverbose)
- printf("isa_probe_children: probing non-PnP devices\n");
for (i = 0; i < nchildren; i++) {
child = children[i];
idev = DEVTOISA(child);
- if (device_is_attached(child) ||
- !TAILQ_EMPTY(&idev->id_configs))
- continue;
-
- err = device_probe_and_attach(child);
- if (err == 0 && idev->id_vendorid == 0 &&
- strcmp(kern_ident, "GENERIC") == 0 &&
- device_is_attached(child))
+ if (idev->id_vendorid == 0 && device_is_attached(child))
device_printf(child,
"non-PNP ISA device will be removed from GENERIC in FreeBSD 16.\n");
}
-
- /*
- * Finally assign resource to pnp devices and probe them.
- */
- if (bootverbose)
- printf("isa_probe_children: probing PnP devices\n");
- for (i = 0; i < nchildren; i++) {
- child = children[i];
- idev = DEVTOISA(child);
-
- if (device_is_attached(child) || TAILQ_EMPTY(&idev->id_configs))
- continue;
-
- if (isa_assign_resources(child)) {
- device_probe_and_attach(child);
- isa_claim_resources(dev, child);
- }
- }
-
- free(children, M_TEMP);
-
- isa_running = 1;
}
/*
@@ -614,7 +167,6 @@
return (0);
resource_list_init(&idev->id_resources);
- TAILQ_INIT(&idev->id_configs);
idev->id_order = order;
device_set_ivars(child, idev);
@@ -783,34 +335,10 @@
*result = idev->id_vendorid;
break;
- case ISA_IVAR_SERIAL:
- *result = idev->id_serial;
- break;
-
case ISA_IVAR_LOGICALID:
*result = idev->id_logicalid;
break;
- case ISA_IVAR_COMPATID:
- *result = idev->id_compatid;
- break;
-
- case ISA_IVAR_CONFIGATTR:
- *result = idev->id_config_attr;
- break;
-
- case ISA_IVAR_PNP_CSN:
- *result = idev->id_pnp_csn;
- break;
-
- case ISA_IVAR_PNP_LDN:
- *result = idev->id_pnp_ldn;
- break;
-
- case ISA_IVAR_PNPBIOS_HANDLE:
- *result = idev->id_pnpbios_handle;
- break;
-
default:
return (ENOENT);
}
@@ -842,22 +370,10 @@
idev->id_vendorid = value;
break;
- case ISA_IVAR_SERIAL:
- idev->id_serial = value;
- break;
-
case ISA_IVAR_LOGICALID:
idev->id_logicalid = value;
break;
- case ISA_IVAR_COMPATID:
- idev->id_compatid = value;
- break;
-
- case ISA_IVAR_CONFIGATTR:
- idev->id_config_attr = value;
- break;
-
default:
return (ENOENT);
}
@@ -865,19 +381,6 @@
return (0);
}
-/*
- * Free any resources which the driver missed or which we were holding for
- * it (see isa_probe_children).
- */
-static void
-isa_child_detached(device_t dev, device_t child)
-{
- struct isa_device* idev = DEVTOISA(child);
-
- if (TAILQ_FIRST(&idev->id_configs))
- isa_claim_resources(dev, child);
-}
-
static void
isa_driver_added(device_t dev, driver_t *driver)
{
@@ -918,14 +421,7 @@
rle->res);
}
- if (TAILQ_FIRST(&idev->id_configs))
- if (!isa_assign_resources(child))
- continue;
-
device_probe_and_attach(child);
-
- if (TAILQ_FIRST(&idev->id_configs))
- isa_claim_resources(dev, child);
}
free(children, M_TEMP);
@@ -969,42 +465,6 @@
return (rl);
}
-static int
-isa_add_config(device_t dev, device_t child, int priority,
- struct isa_config *config)
-{
- struct isa_device* idev = DEVTOISA(child);
- struct isa_config_entry *newice, *ice;
-
- newice = malloc(sizeof *ice, M_DEVBUF, M_NOWAIT);
- if (!newice)
- return (ENOMEM);
-
- newice->ice_priority = priority;
- newice->ice_config = *config;
-
- TAILQ_FOREACH(ice, &idev->id_configs, ice_link) {
- if (ice->ice_priority > priority)
- break;
- }
- if (ice)
- TAILQ_INSERT_BEFORE(ice, newice, ice_link);
- else
- TAILQ_INSERT_TAIL(&idev->id_configs, newice, ice_link);
-
- return (0);
-}
-
-static void
-isa_set_config_callback(device_t dev, device_t child, isa_config_cb *fn,
- void *arg)
-{
- struct isa_device* idev = DEVTOISA(child);
-
- idev->id_config_cb = fn;
- idev->id_config_arg = arg;
-}
-
static int
isa_pnp_probe(device_t dev, device_t child, struct isa_pnp_id *ids)
{
@@ -1014,11 +474,7 @@
return (ENOENT);
while (ids && ids->ip_id) {
- /*
- * Really ought to support >1 compat id per device.
- */
- if (idev->id_logicalid == ids->ip_id
- || idev->id_compatid == ids->ip_id) {
+ if (idev->id_logicalid == ids->ip_id) {
if (ids->ip_desc)
device_set_desc(child, ids->ip_desc);
return (0);
@@ -1069,7 +525,6 @@
DEVMETHOD(bus_probe_nomatch, isa_probe_nomatch),
DEVMETHOD(bus_read_ivar, isa_read_ivar),
DEVMETHOD(bus_write_ivar, isa_write_ivar),
- DEVMETHOD(bus_child_detached, isa_child_detached),
DEVMETHOD(bus_driver_added, isa_driver_added),
DEVMETHOD(bus_setup_intr, bus_generic_setup_intr),
DEVMETHOD(bus_teardown_intr, bus_generic_teardown_intr),
@@ -1088,8 +543,6 @@
DEVMETHOD(bus_hint_device_unit, isa_hint_device_unit),
/* ISA interface */
- DEVMETHOD(isa_add_config, isa_add_config),
- DEVMETHOD(isa_set_config_callback, isa_set_config_callback),
DEVMETHOD(isa_pnp_probe, isa_pnp_probe),
{ 0, 0 }
diff --git a/sys/isa/isa_if.m b/sys/isa/isa_if.m
--- a/sys/isa/isa_if.m
+++ b/sys/isa/isa_if.m
@@ -30,28 +30,8 @@
INTERFACE isa;
-#
-# Add a Plug-and-play configuration to the device. Configurations with
-# a lower priority are preferred.
-#
-METHOD int add_config {
- device_t dev;
- device_t child;
- int priority;
- struct isa_config *config;
-};
-
-#
-# Register a function which can be called to configure a device with
-# a given set of resources. The function will be called with a struct
-# isa_config representing the desired configuration and a flag to
-# state whether the device should be enabled.
-#
-METHOD void set_config_callback {
- device_t dev;
- device_t child;
- isa_config_cb *fn;
- void *arg;
+HEADER {
+ struct isa_pnp_id;
};
#
diff --git a/sys/isa/isahint.c b/sys/isa/isahint.c
--- a/sys/isa/isahint.c
+++ b/sys/isa/isahint.c
@@ -79,8 +79,6 @@
if (resource_disabled(name, unit))
device_disable(child);
-
- isa_set_configattr(child, (isa_get_configattr(child)|ISACFGATTR_HINTS));
}
static int
diff --git a/sys/isa/isavar.h b/sys/isa/isavar.h
--- a/sys/isa/isavar.h
+++ b/sys/isa/isavar.h
@@ -29,10 +29,6 @@
#ifndef _ISA_ISAVAR_H_
#define _ISA_ISAVAR_H_
-struct isa_config;
-struct isa_pnp_id;
-typedef void isa_config_cb(void *arg, struct isa_config *config, int enable);
-
#include "isa_if.h"
#include <isa/pnpvar.h>
@@ -69,30 +65,6 @@
#define ISADMA_READ 0x00100000
#define ISADMA_WRITE 0
#define ISADMA_RAW 0x00080000
-/*
- * Plug and play cards can support a range of resource
- * configurations. This structure is used by the isapnp parser to
- * inform the isa bus about the resource possibilities of the
- * device. Each different alternative should be supplied by calling
- * ISA_ADD_CONFIG().
- */
-struct isa_range {
- uint32_t ir_start;
- uint32_t ir_end;
- uint32_t ir_size;
- uint32_t ir_align;
-};
-
-struct isa_config {
- struct isa_range ic_mem[ISA_NMEM];
- struct isa_range ic_port[ISA_NPORT];
- uint32_t ic_irqmask[ISA_NIRQ];
- uint32_t ic_drqmask[ISA_NDRQ];
- int ic_nmem;
- int ic_nport;
- int ic_nirq;
- int ic_ndrq;
-};
/*
* Used to build lists of IDs and description strings for PnP drivers.
@@ -122,23 +94,10 @@
ISA_IVAR_DRQ_0 = ISA_IVAR_DRQ,
ISA_IVAR_DRQ_1,
ISA_IVAR_VENDORID,
- ISA_IVAR_SERIAL,
ISA_IVAR_LOGICALID,
- ISA_IVAR_COMPATID,
- ISA_IVAR_CONFIGATTR,
- ISA_IVAR_PNP_CSN,
- ISA_IVAR_PNP_LDN,
- ISA_IVAR_PNPBIOS_HANDLE,
ISA_IVAR_LAST
};
-/*
- * ISA_IVAR_CONFIGATTR bits
- */
-#define ISACFGATTR_CANDISABLE (1 << 0) /* can be disabled */
-#define ISACFGATTR_DYNAMIC (1 << 1) /* dynamic configuration */
-#define ISACFGATTR_HINTS (1 << 3) /* source of config is hints */
-
#define ISA_PNP_DESCR "E:pnpid;D:#"
#define ISA_PNP_INFO(t) \
MODULE_PNP_INFO(ISA_PNP_DESCR, isa, t, t, nitems(t) - 1); \
@@ -156,13 +115,7 @@
ISA_ACCESSOR(maddr, MADDR, int)
ISA_ACCESSOR(msize, MEMSIZE, int)
ISA_ACCESSOR(vendorid, VENDORID, int)
-ISA_ACCESSOR(serial, SERIAL, int)
ISA_ACCESSOR(logicalid, LOGICALID, int)
-ISA_ACCESSOR(compatid, COMPATID, int)
-ISA_ACCESSOR(configattr, CONFIGATTR, int)
-ISA_ACCESSOR(pnp_csn, PNP_CSN, int)
-ISA_ACCESSOR(pnp_ldn, PNP_LDN, int)
-ISA_ACCESSOR(pnpbios_handle, PNPBIOS_HANDLE, int)
extern void isa_probe_children(device_t dev);
diff --git a/sys/isa/pnp.c b/sys/isa/pnp.c
deleted file mode 100644
--- a/sys/isa/pnp.c
+++ /dev/null
@@ -1,767 +0,0 @@
-/*
- * SPDX-License-Identifier: BSD-2-Clause
- *
- * Copyright (c) 1996, Sujal M. Patel
- * 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.
- *
- * from: pnp.c,v 1.11 1999/05/06 22:11:19 peter Exp
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/kernel.h>
-#include <sys/module.h>
-#include <sys/bus.h>
-#include <sys/endian.h>
-#include <sys/malloc.h>
-#include <isa/isavar.h>
-#include <isa/pnpreg.h>
-#include <isa/pnpvar.h>
-#include <machine/bus.h>
-
-typedef struct _pnp_id {
- uint32_t vendor_id;
- uint32_t serial;
- u_char checksum;
-} pnp_id;
-
-struct pnp_set_config_arg {
- int csn; /* Card number to configure */
- int ldn; /* Logical device on card */
-};
-
-struct pnp_quirk {
- uint32_t vendor_id; /* Vendor of the card */
- uint32_t logical_id; /* ID of the device with quirk */
- int type;
-#define PNP_QUIRK_WRITE_REG 1 /* Need to write a pnp register */
-#define PNP_QUIRK_EXTRA_IO 2 /* Has extra io ports */
- int arg1;
- int arg2;
-};
-
-struct pnp_quirk pnp_quirks[] = {
- /*
- * The Gravis UltraSound needs register 0xf2 to be set to 0xff
- * to enable power.
- * XXX need to know the logical device id.
- */
- { 0x0100561e /* GRV0001 */, 0,
- PNP_QUIRK_WRITE_REG, 0xf2, 0xff },
- /*
- * An emu8000 does not give us other than the first
- * port.
- */
- { 0x26008c0e /* SB16 */, 0x21008c0e,
- PNP_QUIRK_EXTRA_IO, 0x400, 0x800 },
- { 0x42008c0e /* SB32(CTL0042) */, 0x21008c0e,
- PNP_QUIRK_EXTRA_IO, 0x400, 0x800 },
- { 0x44008c0e /* SB32(CTL0044) */, 0x21008c0e,
- PNP_QUIRK_EXTRA_IO, 0x400, 0x800 },
- { 0x49008c0e /* SB32(CTL0049) */, 0x21008c0e,
- PNP_QUIRK_EXTRA_IO, 0x400, 0x800 },
- { 0xf1008c0e /* SB32(CTL00f1) */, 0x21008c0e,
- PNP_QUIRK_EXTRA_IO, 0x400, 0x800 },
- { 0xc1008c0e /* SB64(CTL00c1) */, 0x22008c0e,
- PNP_QUIRK_EXTRA_IO, 0x400, 0x800 },
- { 0xc5008c0e /* SB64(CTL00c5) */, 0x22008c0e,
- PNP_QUIRK_EXTRA_IO, 0x400, 0x800 },
- { 0xe4008c0e /* SB64(CTL00e4) */, 0x22008c0e,
- PNP_QUIRK_EXTRA_IO, 0x400, 0x800 },
-
- { 0 }
-};
-
-/* The READ_DATA port that we are using currently */
-static int pnp_rd_port;
-
-static void pnp_send_initiation_key(void);
-static int pnp_get_serial(pnp_id *p);
-static int pnp_isolation_protocol(device_t parent);
-
-static void
-pnp_write(int d, u_char r)
-{
- outb (_PNP_ADDRESS, d);
- outb (_PNP_WRITE_DATA, r);
-}
-
-/*
- * Send Initiation LFSR as described in "Plug and Play ISA Specification",
- * Intel May 94.
- */
-static void
-pnp_send_initiation_key(void)
-{
- int cur, i;
-
- /* Reset the LSFR */
- outb(_PNP_ADDRESS, 0);
- outb(_PNP_ADDRESS, 0); /* yes, we do need it twice! */
-
- cur = 0x6a;
- outb(_PNP_ADDRESS, cur);
-
- for (i = 1; i < 32; i++) {
- cur = (cur >> 1) | (((cur ^ (cur >> 1)) << 7) & 0xff);
- outb(_PNP_ADDRESS, cur);
- }
-}
-
-
-/*
- * Get the device's serial number. Returns 1 if the serial is valid.
- */
-static int
-pnp_get_serial(pnp_id *p)
-{
- int i, bit, valid = 0, sum = 0x6a;
- u_char *data = (u_char *)p;
-
- bzero(data, sizeof(char) * 9);
- outb(_PNP_ADDRESS, PNP_SERIAL_ISOLATION);
- for (i = 0; i < 72; i++) {
- bit = inb((pnp_rd_port << 2) | 0x3) == 0x55;
- DELAY(250); /* Delay 250 usec */
-
- /* Can't Short Circuit the next evaluation, so 'and' is last */
- bit = (inb((pnp_rd_port << 2) | 0x3) == 0xaa) && bit;
- DELAY(250); /* Delay 250 usec */
-
- valid = valid || bit;
- if (i < 64)
- sum = (sum >> 1) |
- (((sum ^ (sum >> 1) ^ bit) << 7) & 0xff);
- data[i / 8] = (data[i / 8] >> 1) | (bit ? 0x80 : 0);
- }
-
- valid = valid && (data[8] == sum);
-
- return (valid);
-}
-
-/*
- * Fill's the buffer with resource info from the device.
- * Returns the number of characters read.
- */
-static int
-pnp_get_resource_info(u_char *buffer, int len)
-{
- int i, j, count;
- u_char temp;
-
- count = 0;
- for (i = 0; i < len; i++) {
- outb(_PNP_ADDRESS, PNP_STATUS);
- for (j = 0; j < 100; j++) {
- if ((inb((pnp_rd_port << 2) | 0x3)) & 0x1)
- break;
- DELAY(10);
- }
- if (j == 100) {
- printf("PnP device failed to report resource data\n");
- return (count);
- }
- outb(_PNP_ADDRESS, PNP_RESOURCE_DATA);
- temp = inb((pnp_rd_port << 2) | 0x3);
- if (buffer != NULL)
- buffer[i] = temp;
- count++;
- }
- return (count);
-}
-
-/*
- * This function is called after the bus has assigned resource
- * locations for a logical device.
- */
-static void
-pnp_set_config(void *arg, struct isa_config *config, int enable)
-{
- int csn = ((struct pnp_set_config_arg *) arg)->csn;
- int ldn = ((struct pnp_set_config_arg *) arg)->ldn;
- int i;
-
- /*
- * First put all cards into Sleep state with the initiation
- * key, then put our card into Config state.
- */
- pnp_send_initiation_key();
- pnp_write(PNP_WAKE, csn);
-
- /*
- * Select our logical device so that we can program it.
- */
- pnp_write(PNP_SET_LDN, ldn);
-
- /*
- * Constrain the number of resources we will try to program
- */
- if (config->ic_nmem > ISA_PNP_NMEM) {
- printf("too many ISA memory ranges (%d > %d)\n",
- config->ic_nmem, ISA_PNP_NMEM);
- config->ic_nmem = ISA_PNP_NMEM;
- }
- if (config->ic_nport > ISA_PNP_NPORT) {
- printf("too many ISA I/O ranges (%d > %d)\n", config->ic_nport,
- ISA_PNP_NPORT);
- config->ic_nport = ISA_PNP_NPORT;
- }
- if (config->ic_nirq > ISA_PNP_NIRQ) {
- printf("too many ISA IRQs (%d > %d)\n", config->ic_nirq,
- ISA_PNP_NIRQ);
- config->ic_nirq = ISA_PNP_NIRQ;
- }
- if (config->ic_ndrq > ISA_PNP_NDRQ) {
- printf("too many ISA DRQs (%d > %d)\n", config->ic_ndrq,
- ISA_PNP_NDRQ);
- config->ic_ndrq = ISA_PNP_NDRQ;
- }
-
- /*
- * Now program the resources.
- */
- for (i = 0; i < config->ic_nmem; i++) {
- uint32_t start;
- uint32_t size;
-
- /* XXX: should handle memory control register, 32 bit memory */
- if (config->ic_mem[i].ir_size == 0) {
- pnp_write(PNP_MEM_BASE_HIGH(i), 0);
- pnp_write(PNP_MEM_BASE_LOW(i), 0);
- pnp_write(PNP_MEM_RANGE_HIGH(i), 0);
- pnp_write(PNP_MEM_RANGE_LOW(i), 0);
- } else {
- start = config->ic_mem[i].ir_start;
- size = config->ic_mem[i].ir_size;
- if (start & 0xff)
- panic("pnp_set_config: bogus memory assignment");
- pnp_write(PNP_MEM_BASE_HIGH(i), (start >> 16) & 0xff);
- pnp_write(PNP_MEM_BASE_LOW(i), (start >> 8) & 0xff);
- pnp_write(PNP_MEM_RANGE_HIGH(i), (size >> 16) & 0xff);
- pnp_write(PNP_MEM_RANGE_LOW(i), (size >> 8) & 0xff);
- }
- }
- for (; i < ISA_PNP_NMEM; i++) {
- pnp_write(PNP_MEM_BASE_HIGH(i), 0);
- pnp_write(PNP_MEM_BASE_LOW(i), 0);
- pnp_write(PNP_MEM_RANGE_HIGH(i), 0);
- pnp_write(PNP_MEM_RANGE_LOW(i), 0);
- }
-
- for (i = 0; i < config->ic_nport; i++) {
- uint32_t start;
-
- if (config->ic_port[i].ir_size == 0) {
- pnp_write(PNP_IO_BASE_HIGH(i), 0);
- pnp_write(PNP_IO_BASE_LOW(i), 0);
- } else {
- start = config->ic_port[i].ir_start;
- pnp_write(PNP_IO_BASE_HIGH(i), (start >> 8) & 0xff);
- pnp_write(PNP_IO_BASE_LOW(i), (start >> 0) & 0xff);
- }
- }
- for (; i < ISA_PNP_NPORT; i++) {
- pnp_write(PNP_IO_BASE_HIGH(i), 0);
- pnp_write(PNP_IO_BASE_LOW(i), 0);
- }
-
- for (i = 0; i < config->ic_nirq; i++) {
- int irq;
-
- /* XXX: interrupt type */
- if (config->ic_irqmask[i] == 0) {
- pnp_write(PNP_IRQ_LEVEL(i), 0);
- pnp_write(PNP_IRQ_TYPE(i), 2);
- } else {
- irq = ffs(config->ic_irqmask[i]) - 1;
- pnp_write(PNP_IRQ_LEVEL(i), irq);
- pnp_write(PNP_IRQ_TYPE(i), 2); /* XXX */
- }
- }
- for (; i < ISA_PNP_NIRQ; i++) {
- /*
- * IRQ 0 is not a valid interrupt selection and
- * represents no interrupt selection.
- */
- pnp_write(PNP_IRQ_LEVEL(i), 0);
- pnp_write(PNP_IRQ_TYPE(i), 2);
- }
-
- for (i = 0; i < config->ic_ndrq; i++) {
- int drq;
-
- if (config->ic_drqmask[i] == 0) {
- pnp_write(PNP_DMA_CHANNEL(i), 4);
- } else {
- drq = ffs(config->ic_drqmask[i]) - 1;
- pnp_write(PNP_DMA_CHANNEL(i), drq);
- }
- }
- for (; i < ISA_PNP_NDRQ; i++) {
- /*
- * DMA channel 4, the cascade channel is used to
- * indicate no DMA channel is active.
- */
- pnp_write(PNP_DMA_CHANNEL(i), 4);
- }
-
- pnp_write(PNP_ACTIVATE, enable ? 1 : 0);
-
- /*
- * Wake everyone up again, we are finished.
- */
- pnp_write(PNP_CONFIG_CONTROL, PNP_CONFIG_CONTROL_WAIT_FOR_KEY);
-}
-
-/*
- * Process quirks for a logical device.. The card must be in Config state.
- */
-void
-pnp_check_quirks(uint32_t vendor_id, uint32_t logical_id, int ldn,
- struct isa_config *config)
-{
- struct pnp_quirk *qp;
-
- for (qp = &pnp_quirks[0]; qp->vendor_id; qp++) {
- if (qp->vendor_id == vendor_id
- && (qp->logical_id == 0 || qp->logical_id == logical_id)) {
- switch (qp->type) {
- case PNP_QUIRK_WRITE_REG:
- pnp_write(PNP_SET_LDN, ldn);
- pnp_write(qp->arg1, qp->arg2);
- break;
- case PNP_QUIRK_EXTRA_IO:
- if (config == NULL)
- break;
- if (qp->arg1 != 0) {
- config->ic_nport++;
- config->ic_port[config->ic_nport - 1] = config->ic_port[0];
- config->ic_port[config->ic_nport - 1].ir_start += qp->arg1;
- config->ic_port[config->ic_nport - 1].ir_end += qp->arg1;
- }
- if (qp->arg2 != 0) {
- config->ic_nport++;
- config->ic_port[config->ic_nport - 1] = config->ic_port[0];
- config->ic_port[config->ic_nport - 1].ir_start += qp->arg2;
- config->ic_port[config->ic_nport - 1].ir_end += qp->arg2;
- }
- break;
- }
- }
- }
-}
-
-/*
- * Scan Resource Data for Logical Devices.
- *
- * This function exits as soon as it gets an error reading *ANY*
- * Resource Data or it reaches the end of Resource Data. In the first
- * case the return value will be TRUE, FALSE otherwise.
- */
-static int
-pnp_create_devices(device_t parent, pnp_id *p, int csn,
- u_char *resources, int len)
-{
- u_char tag, *resp, *resinfo, *startres = NULL;
- int large_len, scanning = len, retval = FALSE;
- uint32_t logical_id;
- device_t dev = 0;
- int ldn = 0;
- struct pnp_set_config_arg *csnldn;
- char buf[100];
- char *desc = NULL;
-
- resp = resources;
- while (scanning > 0) {
- tag = *resp++;
- scanning--;
- if (PNP_RES_TYPE(tag) != 0) {
- /* Large resource */
- if (scanning < 2) {
- scanning = 0;
- continue;
- }
- large_len = resp[0] + (resp[1] << 8);
- resp += 2;
-
- if (scanning < large_len) {
- scanning = 0;
- continue;
- }
- resinfo = resp;
- resp += large_len;
- scanning -= large_len;
-
- if (PNP_LRES_NUM(tag) == PNP_TAG_ID_ANSI) {
- if (dev) {
- /*
- * This is an optional device
- * identifier string. Skip it
- * for now.
- */
- continue;
- }
- /* else mandately card identifier string */
- if (large_len > sizeof(buf) - 1)
- large_len = sizeof(buf) - 1;
- bcopy(resinfo, buf, large_len);
-
- /*
- * Trim trailing spaces.
- */
- while (buf[large_len-1] == ' ')
- large_len--;
- buf[large_len] = '\0';
- desc = buf;
- continue;
- }
-
- continue;
- }
-
- /* 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_LOGICAL_DEVICE:
- /*
- * Parse the resources for the previous
- * logical device (if any).
- */
- if (startres) {
- pnp_parse_resources(dev, startres,
- resinfo - startres - 1, ldn);
- dev = 0;
- startres = NULL;
- }
-
- /*
- * A new logical device. Scan for end of
- * resources.
- */
- bcopy(resinfo, &logical_id, 4);
- pnp_check_quirks(p->vendor_id, logical_id, ldn, NULL);
- dev = BUS_ADD_CHILD(parent, ISA_ORDER_PNP, NULL, DEVICE_UNIT_ANY);
- if (desc)
- device_set_desc_copy(dev, desc);
- else
- device_set_desc_copy(dev,
- pnp_eisaformat(logical_id));
- isa_set_vendorid(dev, p->vendor_id);
- isa_set_serial(dev, p->serial);
- isa_set_logicalid(dev, logical_id);
- isa_set_configattr(dev,
- ISACFGATTR_CANDISABLE | ISACFGATTR_DYNAMIC);
- csnldn = malloc(sizeof *csnldn, M_DEVBUF, M_NOWAIT);
- if (!csnldn) {
- device_printf(parent, "out of memory\n");
- scanning = 0;
- break;
- }
- csnldn->csn = csn;
- csnldn->ldn = ldn;
- ISA_SET_CONFIG_CALLBACK(parent, dev, pnp_set_config,
- csnldn);
- isa_set_pnp_csn(dev, csn);
- isa_set_pnp_ldn(dev, ldn);
- ldn++;
- startres = resp;
- break;
-
- case PNP_TAG_END:
- if (!startres) {
- device_printf(parent, "malformed resources\n");
- scanning = 0;
- break;
- }
- pnp_parse_resources(dev, startres,
- resinfo - startres - 1, ldn);
- dev = 0;
- startres = NULL;
- scanning = 0;
- break;
-
- default:
- /* Skip this resource */
- break;
- }
- }
-
- return (retval);
-}
-
-/*
- * Read 'amount' bytes of resources from the card, allocating memory
- * as needed. If a buffer is already available, it should be passed in
- * '*resourcesp' and its length in '*spacep'. The number of resource
- * bytes already in the buffer should be passed in '*lenp'. The memory
- * allocated will be returned in '*resourcesp' with its size and the
- * number of bytes of resources in '*spacep' and '*lenp' respectively.
- *
- * XXX: Multiple problems here, we forget to free() stuff in one
- * XXX: error return, and in another case we free (*resourcesp) but
- * XXX: don't tell the caller.
- */
-static int
-pnp_read_bytes(int amount, u_char **resourcesp, int *spacep, int *lenp)
-{
- u_char *resources = *resourcesp;
- u_char *newres;
- int space = *spacep;
- int len = *lenp;
-
- if (space == 0) {
- space = 1024;
- resources = malloc(space, M_TEMP, M_NOWAIT);
- if (!resources)
- return (ENOMEM);
- }
-
- if (len + amount > space) {
- int extra = 1024;
- while (len + amount > space + extra)
- extra += 1024;
- newres = malloc(space + extra, M_TEMP, M_NOWAIT);
- if (!newres) {
- /* XXX: free resources */
- return (ENOMEM);
- }
- bcopy(resources, newres, len);
- free(resources, M_TEMP);
- resources = newres;
- space += extra;
- }
-
- if (pnp_get_resource_info(resources + len, amount) != amount)
- return (EINVAL);
- len += amount;
-
- *resourcesp = resources;
- *spacep = space;
- *lenp = len;
-
- return (0);
-}
-
-/*
- * Read all resources from the card, allocating memory as needed. If a
- * buffer is already available, it should be passed in '*resourcesp'
- * and its length in '*spacep'. The memory allocated will be returned
- * in '*resourcesp' with its size and the number of bytes of resources
- * in '*spacep' and '*lenp' respectively.
- */
-static int
-pnp_read_resources(u_char **resourcesp, int *spacep, int *lenp)
-{
- u_char *resources = *resourcesp;
- int space = *spacep;
- int len = 0;
- int error, done;
- u_char tag;
-
- error = 0;
- done = 0;
- while (!done) {
- error = pnp_read_bytes(1, &resources, &space, &len);
- if (error)
- goto out;
- tag = resources[len-1];
- if (PNP_RES_TYPE(tag) == 0) {
- /*
- * Small resource, read contents.
- */
- error = pnp_read_bytes(PNP_SRES_LEN(tag),
- &resources, &space, &len);
- if (error)
- goto out;
- if (PNP_SRES_NUM(tag) == PNP_TAG_END)
- done = 1;
- } else {
- /*
- * Large resource, read length and contents.
- */
- error = pnp_read_bytes(2, &resources, &space, &len);
- if (error)
- goto out;
- error = pnp_read_bytes(resources[len-2]
- + (resources[len-1] << 8), &resources, &space,
- &len);
- if (error)
- goto out;
- }
- }
-
- out:
- *resourcesp = resources;
- *spacep = space;
- *lenp = len;
- return (error);
-}
-
-/*
- * Run the isolation protocol. Use pnp_rd_port as the READ_DATA port
- * value (caller should try multiple READ_DATA locations before giving
- * up). Upon exiting, all cards are aware that they should use
- * pnp_rd_port as the READ_DATA port.
- *
- * In the first pass, a csn is assigned to each board and pnp_id's
- * are saved to an array, pnp_devices. In the second pass, each
- * card is woken up and the device configuration is called.
- */
-static int
-pnp_isolation_protocol(device_t parent)
-{
- int csn;
- pnp_id id;
- int found = 0, len;
- u_char *resources = NULL;
- int space = 0;
- int error;
-
- /*
- * Put all cards into the Sleep state so that we can clear
- * their CSNs.
- */
- pnp_send_initiation_key();
-
- /*
- * Clear the CSN for all cards.
- */
- pnp_write(PNP_CONFIG_CONTROL, PNP_CONFIG_CONTROL_RESET_CSN);
-
- /*
- * Move all cards to the Isolation state.
- */
- pnp_write(PNP_WAKE, 0);
-
- /*
- * Tell them where the read point is going to be this time.
- */
- pnp_write(PNP_SET_RD_DATA, pnp_rd_port);
-
- for (csn = 1; csn < PNP_MAX_CARDS; csn++) {
- /*
- * Start the serial isolation protocol.
- */
- outb(_PNP_ADDRESS, PNP_SERIAL_ISOLATION);
- DELAY(1000); /* Delay 1 msec */
-
- if (pnp_get_serial(&id)) {
- /*
- * We have read the id from a card
- * successfully. The card which won the
- * isolation protocol will be in Isolation
- * mode and all others will be in Sleep.
- * Program the CSN of the isolated card
- * (taking it to Config state) and read its
- * resources, creating devices as we find
- * logical devices on the card.
- */
- pnp_write(PNP_SET_CSN, csn);
- if (bootverbose)
- printf("Reading PnP configuration for %s.\n",
- pnp_eisaformat(id.vendor_id));
- error = pnp_read_resources(&resources, &space, &len);
- if (error)
- break;
- pnp_create_devices(parent, &id, csn, resources, len);
- found++;
- } else
- break;
-
- /*
- * Put this card back to the Sleep state and
- * simultaneously move all cards which don't have a
- * CSN yet to Isolation state.
- */
- pnp_write(PNP_WAKE, 0);
- }
-
- /*
- * Unless we have chosen the wrong read port, all cards will
- * be in Sleep state. Put them back into WaitForKey for
- * now. Their resources will be programmed later.
- */
- pnp_write(PNP_CONFIG_CONTROL, PNP_CONFIG_CONTROL_WAIT_FOR_KEY);
-
- /*
- * Cleanup.
- */
- if (resources)
- free(resources, M_TEMP);
-
- return (found);
-}
-
-
-/*
- * pnp_identify()
- *
- * autoconfiguration of pnp devices. This routine just runs the
- * isolation protocol over several ports, until one is successful.
- *
- * may be called more than once ?
- *
- */
-
-static void
-pnp_identify(driver_t *driver, device_t parent)
-{
- int num_pnp_devs;
-
- /* Try various READ_DATA ports from 0x203-0x3ff */
- for (pnp_rd_port = 0x80; (pnp_rd_port < 0xff); pnp_rd_port += 0x10) {
- if (bootverbose)
- printf("pnp_identify: Trying Read_Port at %x\n",
- (pnp_rd_port << 2) | 0x3);
-
- num_pnp_devs = pnp_isolation_protocol(parent);
- if (num_pnp_devs)
- break;
- }
- if (bootverbose)
- printf("PNP Identify complete\n");
-}
-
-static device_method_t pnp_methods[] = {
- /* Device interface */
- DEVMETHOD(device_identify, pnp_identify),
-
- { 0, 0 }
-};
-
-static driver_t pnp_driver = {
- "pnp",
- pnp_methods,
- 1, /* no softc */
-};
-
-DRIVER_MODULE(pnp, isa, pnp_driver, 0, 0);
diff --git a/sys/isa/pnpparse.c b/sys/isa/pnpparse.c
deleted file mode 100644
--- a/sys/isa/pnpparse.c
+++ /dev/null
@@ -1,603 +0,0 @@
-/*-
- * SPDX-License-Identifier: BSD-2-Clause
- *
- * 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.
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/malloc.h>
-#include <sys/module.h>
-#include <sys/bus.h>
-#include <sys/stdarg.h>
-
-#include <isa/isavar.h>
-#include <isa/pnpreg.h>
-#include <isa/pnpvar.h>
-
-#define MAXDEP 8
-
-#define I16(p) ((p)[0] + ((p)[1] << 8))
-#define I32(p) (I16(p) + (I16((p)+2) << 16))
-
-void
-pnp_printf(uint32_t id, char *fmt, ...)
-{
- va_list ap;
-
- va_start(ap, fmt);
- printf("%s: ", pnp_eisaformat(id));
- vprintf(fmt, ap);
- va_end(ap);
-}
-
-/* parse a single descriptor */
-
-static int
-pnp_parse_desc(device_t dev, u_char tag, u_char *res, int len,
- struct isa_config *config, int ldn)
-{
- char buf[100];
- uint32_t id;
- uint32_t compat_id;
- int temp;
-
- id = isa_get_logicalid(dev);
-
- if (PNP_RES_TYPE(tag) == 0) {
-
- /* Small resource */
- switch (PNP_SRES_NUM(tag)) {
-
- case PNP_TAG_VERSION:
- case PNP_TAG_VENDOR:
- /* these descriptors are quietly ignored */
- break;
-
- case PNP_TAG_LOGICAL_DEVICE:
- case PNP_TAG_START_DEPENDANT:
- case PNP_TAG_END_DEPENDANT:
- if (bootverbose)
- pnp_printf(id, "unexpected small tag %d\n",
- PNP_SRES_NUM(tag));
- /* shouldn't happen; quit now */
- return (1);
-
- case PNP_TAG_COMPAT_DEVICE:
- /*
- * Got a compatible device id resource.
- * Should keep a list of compat ids in the device.
- */
- bcopy(res, &compat_id, 4);
- if (isa_get_compatid(dev) == 0)
- isa_set_compatid(dev, compat_id);
- break;
-
- case PNP_TAG_IRQ_FORMAT:
- if (config->ic_nirq == ISA_NIRQ) {
- pnp_printf(id, "too many irqs\n");
- return (1);
- }
- if (I16(res) == 0) {
- /* a null descriptor */
- config->ic_irqmask[config->ic_nirq] = 0;
- config->ic_nirq++;
- break;
- }
- if (bootverbose)
- pnp_printf(id, "adding irq mask %#02x\n",
- I16(res));
- config->ic_irqmask[config->ic_nirq] = I16(res);
- config->ic_nirq++;
- break;
-
- case PNP_TAG_DMA_FORMAT:
- if (config->ic_ndrq == ISA_NDRQ) {
- pnp_printf(id, "too many drqs\n");
- return (1);
- }
- if (res[0] == 0) {
- /* a null descriptor */
- config->ic_drqmask[config->ic_ndrq] = 0;
- config->ic_ndrq++;
- break;
- }
- if (bootverbose)
- pnp_printf(id, "adding dma mask %#02x\n",
- res[0]);
- config->ic_drqmask[config->ic_ndrq] = res[0];
- config->ic_ndrq++;
- break;
-
- case PNP_TAG_IO_RANGE:
- if (config->ic_nport == ISA_NPORT) {
- pnp_printf(id, "too many ports\n");
- return (1);
- }
- if (res[6] == 0) {
- /* a null descriptor */
- config->ic_port[config->ic_nport].ir_start = 0;
- config->ic_port[config->ic_nport].ir_end = 0;
- config->ic_port[config->ic_nport].ir_size = 0;
- config->ic_port[config->ic_nport].ir_align = 0;
- config->ic_nport++;
- break;
- }
- if (bootverbose) {
- pnp_printf(id, "adding io range "
- "%#x-%#x, size=%#x, "
- "align=%#x\n",
- I16(res + 1),
- I16(res + 3) + res[6]-1,
- res[6], res[5]);
- }
- config->ic_port[config->ic_nport].ir_start =
- I16(res + 1);
- config->ic_port[config->ic_nport].ir_end =
- I16(res + 3) + res[6] - 1;
- config->ic_port[config->ic_nport].ir_size = res[6];
- if (res[5] == 0) {
- /* Make sure align is at least one */
- res[5] = 1;
- }
- config->ic_port[config->ic_nport].ir_align = res[5];
- config->ic_nport++;
- pnp_check_quirks(isa_get_vendorid(dev),
- isa_get_logicalid(dev), ldn, config);
- break;
-
- case PNP_TAG_IO_FIXED:
- if (config->ic_nport == ISA_NPORT) {
- pnp_printf(id, "too many ports\n");
- return (1);
- }
- if (res[2] == 0) {
- /* a null descriptor */
- config->ic_port[config->ic_nport].ir_start = 0;
- config->ic_port[config->ic_nport].ir_end = 0;
- config->ic_port[config->ic_nport].ir_size = 0;
- config->ic_port[config->ic_nport].ir_align = 0;
- config->ic_nport++;
- break;
- }
- if (bootverbose) {
- pnp_printf(id, "adding fixed io range "
- "%#x-%#x, size=%#x, "
- "align=%#x\n",
- I16(res),
- I16(res) + res[2] - 1,
- res[2], 1);
- }
- config->ic_port[config->ic_nport].ir_start = I16(res);
- config->ic_port[config->ic_nport].ir_end =
- I16(res) + res[2] - 1;
- config->ic_port[config->ic_nport].ir_size = res[2];
- config->ic_port[config->ic_nport].ir_align = 1;
- config->ic_nport++;
- break;
-
- case PNP_TAG_END:
- if (bootverbose)
- pnp_printf(id, "end config\n");
- return (1);
-
- default:
- /* Skip this resource */
- pnp_printf(id, "unexpected small tag %d\n",
- PNP_SRES_NUM(tag));
- break;
- }
- } else {
- /* Large resource */
- switch (PNP_LRES_NUM(tag)) {
-
- case PNP_TAG_ID_UNICODE:
- case PNP_TAG_LARGE_VENDOR:
- /* these descriptors are quietly ignored */
- break;
-
- case PNP_TAG_ID_ANSI:
- if (len > sizeof(buf) - 1)
- len = sizeof(buf) - 1;
- bcopy(res, buf, len);
-
- /*
- * Trim trailing spaces and garbage.
- */
- while (len > 0 && buf[len - 1] <= ' ')
- len--;
- buf[len] = '\0';
- device_set_desc_copy(dev, buf);
- break;
-
- case PNP_TAG_MEMORY_RANGE:
- if (config->ic_nmem == ISA_NMEM) {
- pnp_printf(id, "too many memory ranges\n");
- return (1);
- }
- if (I16(res + 7) == 0) {
- /* a null descriptor */
- config->ic_mem[config->ic_nmem].ir_start = 0;
- config->ic_mem[config->ic_nmem].ir_end = 0;
- config->ic_mem[config->ic_nmem].ir_size = 0;
- config->ic_mem[config->ic_nmem].ir_align = 0;
- config->ic_nmem++;
- break;
- }
- if (bootverbose) {
- temp = I16(res + 7) << 8;
- pnp_printf(id, "adding memory range "
- "%#x-%#x, size=%#x, "
- "align=%#x\n",
- I16(res + 1) << 8,
- (I16(res + 3) << 8) + temp - 1,
- temp, I16(res + 5));
- }
- config->ic_mem[config->ic_nmem].ir_start =
- I16(res + 1) << 8;
- config->ic_mem[config->ic_nmem].ir_end =
- (I16(res + 3) << 8) + (I16(res + 7) << 8) - 1;
- config->ic_mem[config->ic_nmem].ir_size =
- I16(res + 7) << 8;
- config->ic_mem[config->ic_nmem].ir_align = I16(res + 5);
- if (!config->ic_mem[config->ic_nmem].ir_align)
- config->ic_mem[config->ic_nmem].ir_align =
- 0x10000;
- config->ic_nmem++;
- break;
-
- case PNP_TAG_MEMORY32_RANGE:
- if (config->ic_nmem == ISA_NMEM) {
- pnp_printf(id, "too many memory ranges\n");
- return (1);
- }
- if (I32(res + 13) == 0) {
- /* a null descriptor */
- config->ic_mem[config->ic_nmem].ir_start = 0;
- config->ic_mem[config->ic_nmem].ir_end = 0;
- config->ic_mem[config->ic_nmem].ir_size = 0;
- config->ic_mem[config->ic_nmem].ir_align = 0;
- config->ic_nmem++;
- break;
- }
- if (bootverbose) {
- pnp_printf(id, "adding memory32 range "
- "%#x-%#x, size=%#x, "
- "align=%#x\n",
- I32(res + 1),
- I32(res + 5) + I32(res + 13) - 1,
- I32(res + 13), I32(res + 9));
- }
- config->ic_mem[config->ic_nmem].ir_start = I32(res + 1);
- config->ic_mem[config->ic_nmem].ir_end =
- I32(res + 5) + I32(res + 13) - 1;
- config->ic_mem[config->ic_nmem].ir_size = I32(res + 13);
- config->ic_mem[config->ic_nmem].ir_align = I32(res + 9);
- config->ic_nmem++;
- break;
-
- case PNP_TAG_MEMORY32_FIXED:
- if (config->ic_nmem == ISA_NMEM) {
- pnp_printf(id, "too many memory ranges\n");
- return (1);
- }
- if (I32(res + 5) == 0) {
- /* a null descriptor */
- config->ic_mem[config->ic_nmem].ir_start = 0;
- config->ic_mem[config->ic_nmem].ir_end = 0;
- config->ic_mem[config->ic_nmem].ir_size = 0;
- config->ic_mem[config->ic_nmem].ir_align = 0;
- break;
- }
- if (bootverbose) {
- pnp_printf(id, "adding fixed memory32 range "
- "%#x-%#x, size=%#x\n",
- I32(res + 1),
- I32(res + 1) + I32(res + 5) - 1,
- I32(res + 5));
- }
- config->ic_mem[config->ic_nmem].ir_start = I32(res + 1);
- config->ic_mem[config->ic_nmem].ir_end =
- I32(res + 1) + I32(res + 5) - 1;
- config->ic_mem[config->ic_nmem].ir_size = I32(res + 5);
- config->ic_mem[config->ic_nmem].ir_align = 1;
- config->ic_nmem++;
- break;
-
- default:
- /* Skip this resource */
- pnp_printf(id, "unexpected large tag %d\n",
- PNP_SRES_NUM(tag));
- break;
- }
- }
-
- return (0);
-}
-
-/*
- * Parse a single "dependent" resource combination.
- */
-
-u_char
-*pnp_parse_dependant(device_t dev, u_char *resources, int len,
- struct isa_config *config, int ldn)
-{
-
- return pnp_scan_resources(dev, resources, len, config, ldn,
- pnp_parse_desc);
-}
-
-static void
-pnp_merge_resources(device_t dev, struct isa_config *from,
- struct isa_config *to)
-{
- device_t parent;
- int i;
-
- parent = device_get_parent(dev);
- for (i = 0; i < from->ic_nmem; i++) {
- if (to->ic_nmem == ISA_NMEM) {
- device_printf(parent, "too many memory ranges\n");
- return;
- }
- to->ic_mem[to->ic_nmem] = from->ic_mem[i];
- to->ic_nmem++;
- }
- for (i = 0; i < from->ic_nport; i++) {
- if (to->ic_nport == ISA_NPORT) {
- device_printf(parent, "too many port ranges\n");
- return;
- }
- to->ic_port[to->ic_nport] = from->ic_port[i];
- to->ic_nport++;
- }
- for (i = 0; i < from->ic_nirq; i++) {
- if (to->ic_nirq == ISA_NIRQ) {
- device_printf(parent, "too many irq ranges\n");
- return;
- }
- to->ic_irqmask[to->ic_nirq] = from->ic_irqmask[i];
- to->ic_nirq++;
- }
- for (i = 0; i < from->ic_ndrq; i++) {
- if (to->ic_ndrq == ISA_NDRQ) {
- device_printf(parent, "too many drq ranges\n");
- return;
- }
- to->ic_drqmask[to->ic_ndrq] = from->ic_drqmask[i];
- to->ic_ndrq++;
- }
-}
-
-/*
- * Parse resource data for Logical Devices, make a list of available
- * resource configurations, and add them to the device.
- *
- * This function exits as soon as it gets an error reading *ANY*
- * Resource Data or it reaches the end of Resource Data.
- */
-
-void
-pnp_parse_resources(device_t dev, u_char *resources, int len, int ldn)
-{
- struct isa_config *configs;
- struct isa_config *config;
- device_t parent;
- int priorities[1 + MAXDEP];
- u_char *start;
- u_char *p;
- u_char tag;
- uint32_t id;
- int ncfgs;
- int l;
- int i;
-
- parent = device_get_parent(dev);
- id = isa_get_logicalid(dev);
-
- configs = (struct isa_config *)malloc(sizeof(*configs)*(1 + MAXDEP),
- M_DEVBUF, M_NOWAIT | M_ZERO);
- if (configs == NULL) {
- device_printf(parent, "No memory to parse PNP data\n");
- return;
- }
- config = &configs[0];
- priorities[0] = 0;
- ncfgs = 1;
-
- p = resources;
- start = NULL;
- while (len > 0) {
- tag = *p++;
- len--;
- if (PNP_RES_TYPE(tag) == 0) {
- /* Small resource */
- l = PNP_SRES_LEN(tag);
- if (len < l) {
- len = 0;
- continue;
- }
- len -= l;
-
- switch (PNP_SRES_NUM(tag)) {
-
- case PNP_TAG_START_DEPENDANT:
- if (start != NULL) {
- /*
- * Copy the common resources first,
- * then parse the "dependent" resources.
- */
- pnp_merge_resources(dev, &configs[0],
- config);
- pnp_parse_dependant(dev, start,
- p - start - 1,
- config, ldn);
- }
- start = p + l;
- if (ncfgs > MAXDEP) {
- device_printf(parent, "too many dependent configs (%d)\n", MAXDEP);
- len = 0;
- break;
- }
- config = &configs[ncfgs];
- /*
- * If the priority is not specified,
- * then use the default of 'acceptable'
- */
- if (l > 0)
- priorities[ncfgs] = p[0];
- else
- priorities[ncfgs] = 1;
- if (bootverbose)
- pnp_printf(id, "start dependent (%d)\n",
- priorities[ncfgs]);
- ncfgs++;
- break;
-
- case PNP_TAG_END_DEPENDANT:
- if (start == NULL) {
- device_printf(parent,
- "malformed resources\n");
- len = 0;
- break;
- }
- /*
- * Copy the common resources first,
- * then parse the "dependent" resources.
- */
- pnp_merge_resources(dev, &configs[0], config);
- pnp_parse_dependant(dev, start, p - start - 1,
- config, ldn);
- start = NULL;
- if (bootverbose)
- pnp_printf(id, "end dependent\n");
- /*
- * Back to the common part; clear it
- * as its contents has already been copied
- * to each dependent.
- */
- config = &configs[0];
- bzero(config, sizeof(*config));
- break;
-
- case PNP_TAG_END:
- if (start != NULL) {
- device_printf(parent,
- "malformed resources\n");
- }
- len = 0;
- break;
-
- default:
- if (start != NULL)
- /* defer parsing a dependent section */
- break;
- if (pnp_parse_desc(dev, tag, p, l, config, ldn))
- len = 0;
- break;
- }
- p += l;
- } else {
- /* Large resource */
- if (len < 2) {
- len = 0;
- break;
- }
- l = I16(p);
- p += 2;
- len -= 2;
- if (len < l) {
- len = 0;
- break;
- }
- len -= l;
- if (start == NULL &&
- pnp_parse_desc(dev, tag, p, l, config, ldn)) {
- len = 0;
- break;
- }
- p += l;
- }
- }
-
- if (ncfgs == 1) {
- /* Single config without dependants */
- ISA_ADD_CONFIG(parent, dev, priorities[0], &configs[0]);
- free(configs, M_DEVBUF);
- return;
- }
-
- for (i = 1; i < ncfgs; i++) {
- /*
- * Merge the remaining part of the common resources,
- * if any. Strictly speaking, there shouldn't be common/main
- * resources after the END_DEPENDENT tag.
- */
- pnp_merge_resources(dev, &configs[0], &configs[i]);
- ISA_ADD_CONFIG(parent, dev, priorities[i], &configs[i]);
- }
-
- free(configs, M_DEVBUF);
-}
-
-u_char
-*pnp_scan_resources(device_t dev, u_char *resources, int len,
- struct isa_config *config, int ldn, pnp_scan_cb *cb)
-{
- u_char *p;
- u_char tag;
- int l;
-
- p = resources;
- while (len > 0) {
- tag = *p++;
- len--;
- if (PNP_RES_TYPE(tag) == 0) {
- /* small resource */
- l = PNP_SRES_LEN(tag);
- if (len < l)
- break;
- if ((*cb)(dev, tag, p, l, config, ldn))
- return (p + l);
- if (PNP_SRES_NUM(tag) == PNP_TAG_END)
- return (p + l);
- } else {
- /* large resource */
- if (len < 2)
- break;
- l = I16(p);
- p += 2;
- len -= 2;
- if (len < l)
- break;
- if ((*cb)(dev, tag, p, l, config, ldn))
- return (p + l);
- }
- p += l;
- len -= l;
- }
- return NULL;
-}
diff --git a/sys/isa/pnpreg.h b/sys/isa/pnpreg.h
deleted file mode 100644
--- a/sys/isa/pnpreg.h
+++ /dev/null
@@ -1,245 +0,0 @@
-/*-
- * SPDX-License-Identifier: BSD-4-Clause
- *
- * Copyright (c) 1996, Sujal M. Patel
- * 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.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Sujal M. Patel
- * 4. Neither the name of the author nor the names of any co-contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * 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.
- * from: pnp.h,v 1.7 1998/09/13 22:15:44 eivind Exp
- */
-
-#ifndef _ISA_PNPREG_H_
-#define _ISA_PNPREG_H_
-
-/* Maximum Number of PnP Devices. 8 should be plenty */
-#define PNP_MAX_CARDS 8
-
-/* Static ports to access PnP state machine */
-#define _PNP_ADDRESS 0x279
-#define _PNP_WRITE_DATA 0xa79
-
-/* PnP Registers. Write to ADDRESS and then use WRITE/READ_DATA */
-#define PNP_SET_RD_DATA 0x00
- /***
- Writing to this location modifies the address of the port used for
- reading from the Plug and Play ISA cards. Bits[7:0] become I/O
- read port address bits[9:2]. Reads from this register are ignored.
- ***/
-
-#define PNP_SERIAL_ISOLATION 0x01
- /***
- A read to this register causes a Plug and Play cards in the Isolation
- state to compare one bit of the boards ID.
- This register is read only.
- ***/
-
-#define PNP_CONFIG_CONTROL 0x02
-#define PNP_CONFIG_CONTROL_RESET_CSN 0x04
-#define PNP_CONFIG_CONTROL_WAIT_FOR_KEY 0x02
-#define PNP_CONFIG_CONTROL_RESET 0x01
- /***
- Bit[2] Reset CSN to 0
- Bit[1] Return to the Wait for Key state
- Bit[0] Reset all logical devices and restore configuration
- registers to their power-up values.
-
- A write to bit[0] of this register performs a reset function on
- all logical devices. This resets the contents of configuration
- registers to their default state. All card's logical devices
- enter their default state and the CSN is preserved.
-
- A write to bit[1] of this register causes all cards to enter the
- Wait for Key state but all CSNs are preserved and logical devices
- are not affected.
-
- A write to bit[2] of this register causes all cards to reset their
- CSN to zero .
-
- This register is write-only. The values are not sticky, that is,
- hardware will automatically clear them and there is no need for
- software to clear the bits.
- ***/
-
-#define PNP_WAKE 0x03
- /***
- A write to this port will cause all cards that have a CSN that
- matches the write data[7:0] to go from the Sleep state to the either
- the Isolation state if the write data for this command is zero or
- the Config state if the write data is not zero. Additionally, the
- pointer to the byte-serial device is reset. This register is
- writeonly.
- ***/
-
-#define PNP_RESOURCE_DATA 0x04
- /***
- A read from this address reads the next byte of resource information.
- The Status register must be polled until bit[0] is set before this
- register may be read. This register is read only.
- ***/
-
-#define PNP_STATUS 0x05
- /***
- Bit[0] when set indicates it is okay to read the next data byte
- from the Resource Data register. This register is readonly.
- ***/
-
-#define PNP_SET_CSN 0x06
- /***
- A write to this port sets a card's CSN. The CSN is a value uniquely
- assigned to each ISA card after the serial identification process
- so that each card may be individually selected during a Wake[CSN]
- command. This register is read/write.
- ***/
-
-#define PNP_SET_LDN 0x07
- /***
- Selects the current logical device. All reads and writes of memory,
- I/O, interrupt and DMA configuration information access the registers
- of the logical device written here. In addition, the I/O Range
- Check and Activate commands operate only on the selected logical
- device. This register is read/write. If a card has only 1 logical
- device, this location should be a read-only value of 0x00.
- ***/
-
-/*** addresses 0x08 - 0x1F Card Level Reserved for future use ***/
-/*** addresses 0x20 - 0x2F Card Level, Vendor Defined ***/
-
-#define PNP_ACTIVATE 0x30
- /***
- For each logical device there is one activate register that controls
- whether or not the logical device is active on the ISA bus. Bit[0],
- if set, activates the logical device. Bits[7:1] are reserved and
- must return 0 on reads. This is a read/write register. Before a
- logical device is activated, I/O range check must be disabled.
- ***/
-
-#define PNP_IO_RANGE_CHECK 0x31
-#define PNP_IO_RANGE_CHECK_ENABLE 0x02
-#define PNP_IO_RANGE_CHECK_READ_AS_55 0x01
- /***
- This register is used to perform a conflict check on the I/O port
- range programmed for use by a logical device.
-
- Bit[7:2] Reserved and must return 0 on reads
- Bit[1] Enable I/O Range check, if set then I/O Range Check
- is enabled. I/O range check is only valid when the logical
- device is inactive.
-
- Bit[0], if set, forces the logical device to respond to I/O reads
- of the logical device's assigned I/O range with a 0x55 when I/O
- range check is in operation. If clear, the logical device drives
- 0xAA. This register is read/write.
- ***/
-
-/*** addr 0x32 - 0x37 Logical Device Control Reserved for future use ***/
-/*** addr 0x38 - 0x3F Logical Device Control Vendor Define ***/
-
-#define PNP_MEM_BASE_HIGH(i) (0x40 + 8*(i))
-#define PNP_MEM_BASE_LOW(i) (0x41 + 8*(i))
-#define PNP_MEM_CONTROL(i) (0x42 * 8*(i))
-#define PNP_MEM_CONTROL_16BIT 0x2
-#define PNP_MEM_CONTROL_LIMIT 0x1
-#define PNP_MEM_RANGE_HIGH(i) (0x43 + 8*(i))
-#define PNP_MEM_RANGE_LOW(i) (0x44 + 8*(i))
- /***
- Four memory resource registers per range, four ranges.
- Fill with 0 if no ranges are enabled.
-
- Offset 0: RW Memory base address bits[23:16]
- Offset 1: RW Memory base address bits[15:8]
- Offset 2: Memory control
- Bit[1] specifies 8/16-bit control. This bit is set to indicate
- 16-bit memory, and cleared to indicate 8-bit memory.
- Bit[0], if cleared, indicates the next field can be used as a range
- length for decode (implies range length and base alignment of memory
- descriptor are equal).
- Bit[0], if set, indicates the next field is the upper limit for
- the address. - - Bit[0] is read-only.
- Offset 3: RW upper limit or range len, bits[23:16]
- Offset 4: RW upper limit or range len, bits[15:8]
- Offset 5-Offset 7: filler, unused.
- ***/
-
-#define PNP_IO_BASE_HIGH(i) (0x60 + 2*(i))
-#define PNP_IO_BASE_LOW(i) (0x61 + 2*(i))
- /***
- Eight ranges, two bytes per range.
- Offset 0: I/O port base address bits[15:8]
- Offset 1: I/O port base address bits[7:0]
- ***/
-
-#define PNP_IRQ_LEVEL(i) (0x70 + 2*(i))
-#define PNP_IRQ_TYPE(i) (0x71 + 2*(i))
- /***
- Two entries, two bytes per entry.
- Offset 0: RW interrupt level (1..15, 0=unused).
- Offset 1: Bit[1]: level(1:hi, 0:low),
- Bit[0]: type (1:level, 0:edge)
- byte 1 can be readonly if 1 type of int is used.
- ***/
-
-#define PNP_DMA_CHANNEL(i) (0x74 + 1*(i))
- /***
- Two entries, one byte per entry. Bits[2:0] select
- which DMA channel is in use for DMA 0. Zero selects DMA channel
- 0, seven selects DMA channel 7. DMA channel 4, the cascade channel
- is used to indicate no DMA channel is active.
- ***/
-
-/*** 32-bit memory accesses are at 0x76 ***/
-
-/* Macros to parse Resource IDs */
-#define PNP_RES_TYPE(a) (a >> 7)
-#define PNP_SRES_NUM(a) (a >> 3)
-#define PNP_SRES_LEN(a) (a & 0x07)
-#define PNP_LRES_NUM(a) (a & 0x7f)
-
-/* Small Resource Item names */
-#define PNP_TAG_VERSION 0x1
-#define PNP_TAG_LOGICAL_DEVICE 0x2
-#define PNP_TAG_COMPAT_DEVICE 0x3
-#define PNP_TAG_IRQ_FORMAT 0x4
-#define PNP_TAG_DMA_FORMAT 0x5
-#define PNP_TAG_START_DEPENDANT 0x6
-#define PNP_TAG_END_DEPENDANT 0x7
-#define PNP_TAG_IO_RANGE 0x8
-#define PNP_TAG_IO_FIXED 0x9
-#define PNP_TAG_RESERVED 0xa-0xd
-#define PNP_TAG_VENDOR 0xe
-#define PNP_TAG_END 0xf
-
-/* Large Resource Item names */
-#define PNP_TAG_MEMORY_RANGE 0x1
-#define PNP_TAG_ID_ANSI 0x2
-#define PNP_TAG_ID_UNICODE 0x3
-#define PNP_TAG_LARGE_VENDOR 0x4
-#define PNP_TAG_MEMORY32_RANGE 0x5
-#define PNP_TAG_MEMORY32_FIXED 0x6
-#define PNP_TAG_LARGE_RESERVED 0x7-0x7f
-
-#endif /* !_ISA_PNPREG_H_ */
diff --git a/sys/isa/pnpvar.h b/sys/isa/pnpvar.h
--- a/sys/isa/pnpvar.h
+++ b/sys/isa/pnpvar.h
@@ -47,19 +47,7 @@
| (PNP_HEXTONUM(s[6]) << 24) \
| (PNP_HEXTONUM(s[5]) << 28))
-typedef int pnp_scan_cb(device_t dev, u_char tag, u_char *res, int len,
- struct isa_config *config, int ldn);
-
char *pnp_eisaformat(uint32_t id);
-void pnp_printf(uint32_t id, char *fmt, ...);
-void pnp_parse_resources(device_t dev, u_char *resources, int len, int ldn);
-u_char *pnp_parse_dependant(device_t dev, u_char *resources, int len,
- struct isa_config *config, int ldn);
-u_char *pnp_scan_resources(device_t dev, u_char *resources, int len,
- struct isa_config *config, int ldn, pnp_scan_cb *cb);
-
-void pnp_check_quirks(uint32_t vendor_id, uint32_t logical_id, int ldn,
- struct isa_config *config);
#endif /* _KERNEL */
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Nov 15, 10:48 AM (18 h, 21 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
41741839
Default Alt Text
D60674.1794739693.diff (66 KB)
Attached To
Mode
D60674: isa: Retire the ISAPNP option and related code
Attached
Detach File
Event Timeline