summaryrefslogtreecommitdiffstats
path: root/sys/ia64
diff options
context:
space:
mode:
authorjhb <jhb@FreeBSD.org>2007-03-21 15:36:38 +0000
committerjhb <jhb@FreeBSD.org>2007-03-21 15:36:38 +0000
commit8b3222b80b1b006b9bacb8e89d7e3ade8b0ab19a (patch)
tree4989128fac6d15df8be136f9b5a8497fa5929014 /sys/ia64
parentc1dbcc361480cbe72d41e4f8bddb8a7e4fa0f54f (diff)
downloadFreeBSD-src-8b3222b80b1b006b9bacb8e89d7e3ade8b0ab19a.zip
FreeBSD-src-8b3222b80b1b006b9bacb8e89d7e3ade8b0ab19a.tar.gz
Change the amd64, i386, and ia64 nexus drivers to setup bus space tags and
handles when activating a resource via bus_activate_resource() rather than doing some of the work in bus_alloc_resource() and some of it in bus_activate_resource(). One note is that when using isa_alloc_resourcev() on PC-98, drivers now need to just use bus_release_resource() without explicitly calling bus_deactivate_resource() first. nyan@ has already fixed all of the PC-98 drivers.
Diffstat (limited to 'sys/ia64')
-rw-r--r--sys/ia64/ia64/nexus.c26
1 files changed, 13 insertions, 13 deletions
diff --git a/sys/ia64/ia64/nexus.c b/sys/ia64/ia64/nexus.c
index 166a3ba..38c56bf 100644
--- a/sys/ia64/ia64/nexus.c
+++ b/sys/ia64/ia64/nexus.c
@@ -356,15 +356,7 @@ nexus_alloc_resource(device_t bus, device_t child, int type, int *rid,
rv = rman_reserve_resource(rm, start, end, count, flags, child);
if (rv == 0)
return 0;
-
rman_set_rid(rv, *rid);
- if (type == SYS_RES_MEMORY) {
- rman_set_bustag(rv, IA64_BUS_SPACE_MEM);
- } else if (type == SYS_RES_IOPORT) {
- rman_set_bustag(rv, IA64_BUS_SPACE_IO);
- /* IBM-PC: the type of bus_space_handle_t is u_int */
- rman_set_bushandle(rv, rman_get_start(rv));
- }
if (needactivate) {
if (bus_activate_resource(child, type, *rid, rv)) {
@@ -380,17 +372,25 @@ static int
nexus_activate_resource(device_t bus, device_t child, int type, int rid,
struct resource *r)
{
+ vm_paddr_t paddr, psize;
+ void *vaddr;
+
/*
* If this is a memory resource, map it into the kernel.
*/
- if (rman_get_bustag(r) == IA64_BUS_SPACE_MEM) {
- vm_offset_t paddr = rman_get_start(r);
- vm_offset_t psize = rman_get_size(r);
- caddr_t vaddr = 0;
-
+ switch (type) {
+ case SYS_RES_IOPORT:
+ rman_set_bustag(r, IA64_BUS_SPACE_IO);
+ rman_set_bushandle(r, rman_get_start(r));
+ break;
+ case SYS_RES_MEMORY:
+ paddr = rman_get_start(r);
+ psize = rman_get_size(r);
vaddr = pmap_mapdev(paddr, psize);
rman_set_virtual(r, vaddr);
+ rman_set_bustag(r, IA64_BUS_SPACE_MEM);
rman_set_bushandle(r, (bus_space_handle_t) paddr);
+ break;
}
return (rman_activate_resource(r));
}
OpenPOWER on IntegriCloud