From 7b594c7f807213da263bda3088a9016902c7f891 Mon Sep 17 00:00:00 2001 From: nwhitehorn Date: Sun, 17 Nov 2013 18:27:07 +0000 Subject: Actually look up #address-cells instead of assuming it is correlated with the Uninorth version number. MFC after: 2 weeks --- sys/powerpc/powermac/uninorthpci.c | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) (limited to 'sys/powerpc/powermac') 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)); } -- cgit v1.1