summaryrefslogtreecommitdiffstats
path: root/sys/sparc64
diff options
context:
space:
mode:
authortmm <tmm@FreeBSD.org>2002-03-24 01:51:29 +0000
committertmm <tmm@FreeBSD.org>2002-03-24 01:51:29 +0000
commit587f263c4d8db119551ac4d9518abee9498ebd04 (patch)
treeb17f35c842ca2c88fca948348b451e516c501ae6 /sys/sparc64
parentb598570f6bcc78cbf54ca77cf084bca342c00c49 (diff)
downloadFreeBSD-src-587f263c4d8db119551ac4d9518abee9498ebd04.zip
FreeBSD-src-587f263c4d8db119551ac4d9518abee9498ebd04.tar.gz
Map the device memory belonging to resources of type SYS_RES_MEMORY into
KVA upon activation so that rman_get_virtual() works as expected.
Diffstat (limited to 'sys/sparc64')
-rw-r--r--sys/sparc64/pci/psycho.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/sys/sparc64/pci/psycho.c b/sys/sparc64/pci/psycho.c
index ff1ba03..54edab5 100644
--- a/sys/sparc64/pci/psycho.c
+++ b/sys/sparc64/pci/psycho.c
@@ -1169,9 +1169,22 @@ static int
psycho_activate_resource(device_t bus, device_t child, int type, int rid,
struct resource *r)
{
+ void *p;
+ int error;
if (type == SYS_RES_IRQ)
return (bus_activate_resource(bus, type, rid, r));
+ if (type == SYS_RES_MEMORY) {
+ /*
+ * Need to memory-map the device space, as some drivers depend
+ * on the virtual address being set and useable.
+ */
+ error = sparc64_bus_mem_map(rman_get_bustag(r),
+ rman_get_bushandle(r), rman_get_size(r), 0, NULL, &p);
+ if (error != 0)
+ return (error);
+ rman_set_virtual(r, p);
+ }
return (rman_activate_resource(r));
}
@@ -1182,6 +1195,10 @@ psycho_deactivate_resource(device_t bus, device_t child, int type, int rid,
if (type == SYS_RES_IRQ)
return (bus_deactivate_resource(bus, type, rid, r));
+ if (type == SYS_RES_MEMORY) {
+ sparc64_bus_mem_unmap(rman_get_virtual(r), rman_get_size(r));
+ rman_set_virtual(r, NULL);
+ }
return (rman_deactivate_resource(r));
}
OpenPOWER on IntegriCloud