I don't think we should substract the 256 upperbound from realmem_bytes
if our current available memory is less than that.

The following diff attempts to fix that. Comments, okays?


Index: arch/octeon/octeon/machdep.c
===================================================================
RCS file: /cvs/src/sys/arch/octeon/octeon/machdep.c,v
retrieving revision 1.39
diff -u -p -r1.39 machdep.c
--- arch/octeon/octeon/machdep.c        21 Aug 2013 11:25:33 -0000      1.39
+++ arch/octeon/octeon/machdep.c        21 Aug 2013 11:27:10 -0000
@@ -168,12 +168,13 @@ octeon_memory_init(struct boot_info *boo
        if (boot_info->board_type == BOARD_TYPE_SIM) {
                phys_avail[1] = (96 << 20);
        } else {
-               if (realmem_bytes > OCTEON_DRAM_FIRST_256_END)
+               if (realmem_bytes > OCTEON_DRAM_FIRST_256_END) {
                        phys_avail[1] = OCTEON_DRAM_FIRST_256_END;
-               else
+                       realmem_bytes -= OCTEON_DRAM_FIRST_256_END;
+                       realmem_bytes &= ~(PAGE_SIZE - 1);
+               } else
                        phys_avail[1] = realmem_bytes;
-               realmem_bytes -= OCTEON_DRAM_FIRST_256_END;
-               realmem_bytes &= ~(PAGE_SIZE - 1);
+
                mem_layout[0].mem_last_page = atop(phys_avail[1]);
        }
 

Reply via email to