summaryrefslogtreecommitdiffstats
path: root/sys/powerpc/powermac
diff options
context:
space:
mode:
authorgallatin <gallatin@FreeBSD.org>2004-09-26 01:56:20 +0000
committergallatin <gallatin@FreeBSD.org>2004-09-26 01:56:20 +0000
commit00547b7e7dcea1ccff4bfcdd396b75ff58abecac (patch)
tree69d5387f6c0c01d34b6f28ea77e9e97709ced871 /sys/powerpc/powermac
parentfa427e74bdf99eade4b6f7f7f634a10c7f608639 (diff)
downloadFreeBSD-src-00547b7e7dcea1ccff4bfcdd396b75ff58abecac.zip
FreeBSD-src-00547b7e7dcea1ccff4bfcdd396b75ff58abecac.tar.gz
Add support for i/o-ports. This was cut and pasted from grackle.c
Diffstat (limited to 'sys/powerpc/powermac')
-rw-r--r--sys/powerpc/powermac/uninorth.c29
1 files changed, 26 insertions, 3 deletions
diff --git a/sys/powerpc/powermac/uninorth.c b/sys/powerpc/powermac/uninorth.c
index 1eca880..b1d6f05 100644
--- a/sys/powerpc/powermac/uninorth.c
+++ b/sys/powerpc/powermac/uninorth.c
@@ -202,6 +202,7 @@ uninorth_attach(device_t dev)
}
sc->sc_io_rman.rm_type = RMAN_ARRAY;
sc->sc_io_rman.rm_descr = "UniNorth PCI I/O Ports";
+ sc->sc_iostart = io->host;
if (rman_init(&sc->sc_io_rman) != 0 ||
rman_manage_region(&sc->sc_io_rman, io->pci_lo,
io->pci_lo + io->size_lo) != 0) {
@@ -360,6 +361,12 @@ uninorth_alloc_resource(device_t bus, device_t child, int type, int *rid,
rm = &sc->sc_mem_rman;
bt = PPC_BUS_SPACE_MEM;
break;
+
+ case SYS_RES_IOPORT:
+ rm = &sc->sc_io_rman;
+ bt = PPC_BUS_SPACE_IO;
+ break;
+
case SYS_RES_IRQ:
return (bus_alloc_resource(bus, type, rid, start, end, count,
flags));
@@ -398,13 +405,29 @@ uninorth_activate_resource(device_t bus, device_t child, int type, int rid,
struct resource *res)
{
void *p;
+ struct uninorth_softc *sc;
+
+ sc = device_get_softc(bus);
if (type == SYS_RES_IRQ)
return (bus_activate_resource(bus, type, rid, res));
- if (type == SYS_RES_MEMORY) {
- p = pmap_mapdev((vm_offset_t)rman_get_start(res),
- (vm_size_t)rman_get_size(res));
+ if (type == SYS_RES_MEMORY || type == SYS_RES_IOPORT) {
+ vm_offset_t start;
+
+ start = (vm_offset_t)rman_get_start(res);
+ /*
+ * For i/o-ports, convert the start address to the
+ * uninorth PCI i/o window
+ */
+ if (type == SYS_RES_IOPORT)
+ start += sc->sc_iostart;
+
+ if (bootverbose)
+ printf("uninorth mapdev: start %x, len %ld\n", start,
+ rman_get_size(res));
+
+ p = pmap_mapdev(start, (vm_size_t)rman_get_size(res));
if (p == NULL)
return (ENOMEM);
rman_set_virtual(res, p);
OpenPOWER on IntegriCloud