diff options
author | nwhitehorn <nwhitehorn@FreeBSD.org> | 2013-11-17 18:27:07 +0000 |
---|---|---|
committer | nwhitehorn <nwhitehorn@FreeBSD.org> | 2013-11-17 18:27:07 +0000 |
commit | 7b594c7f807213da263bda3088a9016902c7f891 (patch) | |
tree | 6eb970ce5db9db5b99f283ae06ad37c5e8c85401 /sys/powerpc/powermac | |
parent | 28924c970f3d339166eaf1bb4ca0e0e74594b887 (diff) | |
download | FreeBSD-src-7b594c7f807213da263bda3088a9016902c7f891.zip FreeBSD-src-7b594c7f807213da263bda3088a9016902c7f891.tar.gz |
Actually look up #address-cells instead of assuming it is correlated with
the Uninorth version number.
MFC after: 2 weeks
Diffstat (limited to 'sys/powerpc/powermac')
-rw-r--r-- | sys/powerpc/powermac/uninorthpci.c | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/sys/powerpc/powermac/uninorthpci.c b/sys/powerpc/powermac/uninorthpci.c index f55fb72..5cf7a79 100644 --- a/sys/powerpc/powermac/uninorthpci.c +++ b/sys/powerpc/powermac/uninorthpci.c @@ -134,7 +134,9 @@ uninorth_attach(device_t dev) struct uninorth_softc *sc; const char *compatible; phandle_t node; - u_int32_t reg[3]; + uint32_t reg[3]; + uint64_t regbase; + cell_t acells; node = ofw_bus_get_node(dev); sc = device_get_softc(dev); @@ -149,14 +151,18 @@ uninorth_attach(device_t dev) if (strcmp(compatible, "u4-pcie") == 0) sc->sc_ver = 4; - if (sc->sc_ver >= 3) { - sc->sc_addr = (vm_offset_t)pmap_mapdev(reg[1] + 0x800000, PAGE_SIZE); - sc->sc_data = (vm_offset_t)pmap_mapdev(reg[1] + 0xc00000, PAGE_SIZE); - } else { - sc->sc_addr = (vm_offset_t)pmap_mapdev(reg[0] + 0x800000, PAGE_SIZE); - sc->sc_data = (vm_offset_t)pmap_mapdev(reg[0] + 0xc00000, PAGE_SIZE); + acells = 1; + OF_getprop(OF_parent(node), "#address-cells", &acells, sizeof(acells)); + + regbase = reg[0]; + if (acells == 2) { + regbase <<= 32; + regbase |= reg[1]; } + sc->sc_addr = (vm_offset_t)pmap_mapdev(regbase + 0x800000, PAGE_SIZE); + sc->sc_data = (vm_offset_t)pmap_mapdev(regbase + 0xc00000, PAGE_SIZE); + return (ofw_pci_attach(dev)); } |