summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authornwhitehorn <nwhitehorn@FreeBSD.org>2013-11-17 19:01:13 +0000
committernwhitehorn <nwhitehorn@FreeBSD.org>2013-11-17 19:01:13 +0000
commit3c6cdd40e1fa0aeaaa572b23f8c8554be960fd07 (patch)
treed025d0a75b54e9ec220bfffb1e64333c66460b7d
parent7b594c7f807213da263bda3088a9016902c7f891 (diff)
downloadFreeBSD-src-3c6cdd40e1fa0aeaaa572b23f8c8554be960fd07.zip
FreeBSD-src-3c6cdd40e1fa0aeaaa572b23f8c8554be960fd07.tar.gz
Use #address-cells and #size-cells here too instead of guessing. There is
some comment I wrote about these values "lying" in the negative diff, which referes to an earlier misunderstanding about which node to read them from. This gets at least the PPC64 kernel booting in the mac99 system model in QEMU after bypassing the MacIO ATA driver, which apparently still has problems.
-rw-r--r--sys/powerpc/powermac/uninorth.c20
-rw-r--r--sys/powerpc/powermac/uninorthvar.h4
2 files changed, 17 insertions, 7 deletions
diff --git a/sys/powerpc/powermac/uninorth.c b/sys/powerpc/powermac/uninorth.c
index e9ab291..748148e 100644
--- a/sys/powerpc/powermac/uninorth.c
+++ b/sys/powerpc/powermac/uninorth.c
@@ -264,6 +264,7 @@ unin_chip_attach(device_t dev)
phandle_t child;
phandle_t iparent;
device_t cdev;
+ cell_t acells, scells;
char compat[32];
char name[32];
u_int irq, reg[3];
@@ -275,12 +276,21 @@ unin_chip_attach(device_t dev)
if (OF_getprop(root, "reg", reg, sizeof(reg)) < 8)
return (ENXIO);
- if (strcmp(ofw_bus_get_name(dev), "u3") == 0
- || strcmp(ofw_bus_get_name(dev), "u4") == 0)
- i = 1; /* #address-cells lies */
+ acells = scells = 1;
+ OF_getprop(OF_parent(root), "#address-cells", &acells, sizeof(acells));
+ OF_getprop(OF_parent(root), "#size-cells", &scells, sizeof(scells));
- sc->sc_physaddr = reg[i];
- sc->sc_size = reg[i+1];
+ i = 0;
+ sc->sc_physaddr = reg[i++];
+ if (acells == 2) {
+ sc->sc_physaddr <<= 32;
+ sc->sc_physaddr |= reg[i++];
+ }
+ sc->sc_size = reg[i++];
+ if (scells == 2) {
+ sc->sc_size <<= 32;
+ sc->sc_size |= reg[i++];
+ }
sc->sc_mem_rman.rm_type = RMAN_ARRAY;
sc->sc_mem_rman.rm_descr = "UniNorth Device Memory";
diff --git a/sys/powerpc/powermac/uninorthvar.h b/sys/powerpc/powermac/uninorthvar.h
index 43aa01d..aa834f6 100644
--- a/sys/powerpc/powermac/uninorthvar.h
+++ b/sys/powerpc/powermac/uninorthvar.h
@@ -38,9 +38,9 @@ struct uninorth_softc {
};
struct unin_chip_softc {
- u_int32_t sc_physaddr;
+ uint64_t sc_physaddr;
+ uint64_t sc_size;
vm_offset_t sc_addr;
- u_int32_t sc_size;
struct rman sc_mem_rman;
int sc_version;
};
OpenPOWER on IntegriCloud