diff options
author | dfr <dfr@FreeBSD.org> | 1999-10-12 21:35:51 +0000 |
---|---|---|
committer | dfr <dfr@FreeBSD.org> | 1999-10-12 21:35:51 +0000 |
commit | 229cdb91443142db582b7e32098f62f6446c3f3a (patch) | |
tree | 8eaacbe4f132a095dfe6be00173bd751633a034d /sys/i386/isa/isa_compat.c | |
parent | b203e98b2b9de39cedbf62c7eb859ade4d60e6bc (diff) | |
download | FreeBSD-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_compat.c')
-rw-r--r-- | sys/i386/isa/isa_compat.c | 28 |
1 files changed, 13 insertions, 15 deletions
diff --git a/sys/i386/isa/isa_compat.c b/sys/i386/isa/isa_compat.c index f5ea9ed..e778e67 100644 --- a/sys/i386/isa/isa_compat.c +++ b/sys/i386/isa/isa_compat.c @@ -64,11 +64,10 @@ isa_compat_nextid(void) static void isa_compat_alloc_resources(device_t dev, struct isa_compat_resources *res) { - device_t parent = device_get_parent(dev); int rid; u_long start, count; - if (ISA_GET_RESOURCE(parent, dev, SYS_RES_IOPORT, 0, + if (bus_get_resource(dev, SYS_RES_IOPORT, 0, &start, &count) == 0) { rid = 0; res->ports = bus_alloc_resource(dev, SYS_RES_IOPORT, @@ -80,7 +79,7 @@ isa_compat_alloc_resources(device_t dev, struct isa_compat_resources *res) } else res->ports = 0; - if (ISA_GET_RESOURCE(parent, dev, SYS_RES_MEMORY, 0, + if (bus_get_resource(dev, SYS_RES_MEMORY, 0, &start, &count) == 0 && start != 0) { rid = 0; @@ -93,7 +92,7 @@ isa_compat_alloc_resources(device_t dev, struct isa_compat_resources *res) } else res->memory = 0; - if (ISA_GET_RESOURCE(parent, dev, SYS_RES_DRQ, 0, + if (bus_get_resource(dev, SYS_RES_DRQ, 0, &start, &count) == 0) { rid = 0; res->drq = bus_alloc_resource(dev, SYS_RES_DRQ, @@ -105,7 +104,7 @@ isa_compat_alloc_resources(device_t dev, struct isa_compat_resources *res) } else res->drq = 0; - if (ISA_GET_RESOURCE(parent, dev, SYS_RES_IRQ, 0, + if (bus_get_resource(dev, SYS_RES_IRQ, 0, &start, &count) == 0) { rid = 0; res->irq = bus_alloc_resource(dev, SYS_RES_IRQ, @@ -144,7 +143,6 @@ isa_compat_release_resources(device_t dev, struct isa_compat_resources *res) static int isa_compat_probe(device_t dev) { - device_t parent = device_get_parent(dev); struct isa_device *dvp = device_get_softc(dev); struct isa_compat_resources res; struct old_isa_driver *op; @@ -161,22 +159,22 @@ isa_compat_probe(device_t dev) op = device_get_driver(dev)->priv; dvp->id_id = isa_compat_nextid(); dvp->id_driver = op->driver; - if (ISA_GET_RESOURCE(parent, dev, SYS_RES_IOPORT, 0, + if (bus_get_resource(dev, SYS_RES_IOPORT, 0, &start, &count) == 0) dvp->id_iobase = start; else dvp->id_iobase = -1; - if (ISA_GET_RESOURCE(parent, dev, SYS_RES_IRQ, 0, + if (bus_get_resource(dev, SYS_RES_IRQ, 0, &start, &count) == 0) dvp->id_irq = irqmask(start); else dvp->id_irq = 0; - if (ISA_GET_RESOURCE(parent, dev, SYS_RES_DRQ, 0, + if (bus_get_resource(dev, SYS_RES_DRQ, 0, &start, &count) == 0) dvp->id_drq = start; else dvp->id_drq = -1; - if (ISA_GET_RESOURCE(parent, dev, SYS_RES_MEMORY, + if (bus_get_resource(dev, SYS_RES_MEMORY, 0, &start, &count) == 0) { dvp->id_maddr = (void *)(uintptr_t)start; dvp->id_msize = count; @@ -208,25 +206,25 @@ isa_compat_probe(device_t dev) isa_compat_release_resources(dev, &res); if (portsize != 0) { if (portsize > 0 || dvp->id_iobase != old.id_iobase) - ISA_SET_RESOURCE(parent, dev, SYS_RES_IOPORT, + bus_set_resource(dev, SYS_RES_IOPORT, 0, dvp->id_iobase, portsize); if (dvp->id_irq != old.id_irq) - ISA_SET_RESOURCE(parent, dev, SYS_RES_IRQ, 0, + bus_set_resource(dev, SYS_RES_IRQ, 0, ffs(dvp->id_irq) - 1, 1); if (dvp->id_drq != old.id_drq) - ISA_SET_RESOURCE(parent, dev, SYS_RES_DRQ, 0, + bus_set_resource(dev, SYS_RES_DRQ, 0, dvp->id_drq, 1); if (dvp->id_maddr != old.id_maddr || dvp->id_msize != old.id_msize) { maddr = dvp->id_maddr; if (maddr != NULL) - ISA_SET_RESOURCE(parent, dev, + bus_set_resource(dev, SYS_RES_MEMORY, 0, kvtop(maddr), dvp->id_msize); else - ISA_DELETE_RESOURCE(parent, dev, + bus_delete_resource(dev, SYS_RES_MEMORY, 0); } |