Hi again,

I came up with a fix, but not sure if it's correct.  The problem is that the
physical memory here is 32 bits (paddr_t defined in 
arch/powerpc/include/_types.h).
So when we have 4 banks of 1 GB we end up with 2^32 which wraps around to 0 on
the paddr_t so we report as 0MB.  My fix/workaround is simple I steal a page 
upon atop() so that upon wrap-around at 4GB (selfish I know) some pages are 
missing and it ends up below MAX of unsigned long.  

According to wikipedia only the PowerMac11,2 supports up to 16 GB the rest
are all maximum 4GB, and I don't think the PowerMac11,2 is supported.

https://en.wikipedia.org/wiki/Power_Mac_G5

-peter


Index: ofw_machdep.c
===================================================================
RCS file: /cvs/src/sys/arch/macppc/macppc/ofw_machdep.c,v
retrieving revision 1.56
diff -u -p -u -r1.56 ofw_machdep.c
--- ofw_machdep.c       22 Jul 2017 18:33:38 -0000      1.56
+++ ofw_machdep.c       4 Jul 2018 18:05:59 -0000
@@ -173,7 +173,8 @@ ofw_read_mem_regions(int phandle, int ad
                for (i = 0, j = 0; i < nreg; i++) {
                        if (OFmem64[i].size == 0)
                                continue;
-                       physpages += atop(OFmem64[i].size);
+                       /* we steal a page here per memory bank, sorry */
+                       physpages += (atop(OFmem64[i].size) - 1);
                        if (OFmem64[i].start >= 1ULL << 32)
                                continue;
                        OFmem[j].start = OFmem64[i].start;

Reply via email to