summaryrefslogtreecommitdiffstats
path: root/sys/i386/isa/isa.c
diff options
context:
space:
mode:
authordfr <dfr@FreeBSD.org>1999-10-12 21:35:51 +0000
committerdfr <dfr@FreeBSD.org>1999-10-12 21:35:51 +0000
commit229cdb91443142db582b7e32098f62f6446c3f3a (patch)
tree8eaacbe4f132a095dfe6be00173bd751633a034d /sys/i386/isa/isa.c
parentb203e98b2b9de39cedbf62c7eb859ade4d60e6bc (diff)
downloadFreeBSD-src-229cdb91443142db582b7e32098f62f6446c3f3a.zip
FreeBSD-src-229cdb91443142db582b7e32098f62f6446c3f3a.tar.gz
* Add struct resource_list* argument to resource_list_alloc and
resource_list_release. This removes the dependancy on the layout of ivars. * Move set_resource, get_resource and delete_resource from isa_if.m to bus_if.m. * Simplify driver code by providing wrappers to those methods: bus_set_resource(dev, type, rid, start, count); bus_get_resource(dev, type, rid, startp, countp); bus_get_resource_start(dev, type, rid); bus_get_resource_count(dev, type, rid); bus_delete_resource(dev, type, rid); * Delete isa_get_rsrc and use bus_get_resource_start instead. * Fix a stupid typo in isa_alloc_resource reported by Takahashi Yoshihiro <nyan@FreeBSD.org>. * Print a diagnostic message if we can't assign resources to a PnP device. * Change device_print_prettyname() so that it doesn't print "(no driver assigned)-1" for anonymous devices.
Diffstat (limited to 'sys/i386/isa/isa.c')
-rw-r--r--sys/i386/isa/isa.c36
1 files changed, 25 insertions, 11 deletions
diff --git a/sys/i386/isa/isa.c b/sys/i386/isa/isa.c
index 538824c..6c4b71a 100644
--- a/sys/i386/isa/isa.c
+++ b/sys/i386/isa/isa.c
@@ -91,28 +91,40 @@ isa_alloc_resource(device_t bus, device_t child, int type, int *rid,
*/
int passthrough = (device_get_parent(child) != bus);
int isdefault = (start == 0UL && end == ~0UL);
- struct resource_list *rl;
+ struct isa_device* idev = DEVTOISA(child);
+ struct resource_list *rl = &idev->id_resources;
struct resource_list_entry *rle;
if (!passthrough && !isdefault) {
- rl = device_get_ivars(child);
rle = resource_list_find(rl, type, *rid);
if (!rle) {
if (*rid < 0)
return 0;
- if (type == SYS_RES_IRQ && *rid >= ISA_NIRQ)
- return 0;
- if (type == SYS_RES_DRQ && *rid >= ISA_NDRQ)
- return 0;
- if (type != SYS_RES_MEMORY && *rid >= ISA_NMEM)
- return 0;
- if (type == SYS_RES_IOPORT && *rid >= ISA_NPORT)
+ switch (type) {
+ case SYS_RES_IRQ:
+ if (*rid >= ISA_NIRQ)
+ return 0;
+ break;
+ case SYS_RES_DRQ:
+ if (*rid >= ISA_NDRQ)
+ return 0;
+ break;
+ case SYS_RES_MEMORY:
+ if (*rid >= ISA_NMEM)
+ return 0;
+ break;
+ case SYS_RES_IOPORT:
+ if (*rid >= ISA_NPORT)
+ return 0;
+ break;
+ default:
return 0;
+ }
resource_list_add(rl, type, *rid, start, end, count);
}
}
- return resource_list_alloc(bus, child, type, rid,
+ return resource_list_alloc(rl, bus, child, type, rid,
start, end, count, flags);
}
@@ -120,7 +132,9 @@ int
isa_release_resource(device_t bus, device_t child, int type, int rid,
struct resource *r)
{
- return resource_list_release(bus, child, type, rid, r);
+ struct isa_device* idev = DEVTOISA(child);
+ struct resource_list *rl = &idev->id_resources;
+ return resource_list_release(rl, bus, child, type, rid, r);
}
/*
OpenPOWER on IntegriCloud