Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/evbppc/mpc85xx Add support for MEMSIZE to limit the...



details:   https://anonhg.NetBSD.org/src/rev/685c038d5126
branches:  trunk
changeset: 767629:685c038d5126
user:      matt <matt%NetBSD.org@localhost>
date:      Mon Jul 25 05:46:12 2011 +0000

description:
Add support for MEMSIZE to limit the amount of memory detected.

diffstat:

 sys/arch/evbppc/mpc85xx/machdep.c |  18 +++++++++---------
 1 files changed, 9 insertions(+), 9 deletions(-)

diffs (55 lines):

diff -r aed641058204 -r 685c038d5126 sys/arch/evbppc/mpc85xx/machdep.c
--- a/sys/arch/evbppc/mpc85xx/machdep.c Mon Jul 25 05:45:08 2011 +0000
+++ b/sys/arch/evbppc/mpc85xx/machdep.c Mon Jul 25 05:46:12 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: machdep.c,v 1.19 2011/07/20 13:21:12 matt Exp $        */
+/*     $NetBSD: machdep.c,v 1.20 2011/07/25 05:46:12 matt Exp $        */
 /*-
  * Copyright (c) 2010, 2011 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -38,10 +38,10 @@
 
 __KERNEL_RCSID(0, "$NetSBD$");
 
+#include "opt_altivec.h"
+#include "opt_ddb.h"
 #include "opt_mpc85xx.h"
-#include "opt_altivec.h"
 #include "opt_pci.h"
-#include "opt_ddb.h"
 #include "gpio.h"
 #include "pci.h"
 
@@ -438,7 +438,6 @@
         * to ask the DDR memory controller.
         */
        mr = physmemr;
-#if 1
        for (u_int i = 0; i < 4; i++) {
                uint32_t v = cpu_read_4(DDRC1_BASE + CS_CONFIG(i));
                if (v & CS_CONFIG_EN) {
@@ -447,6 +446,12 @@
                                continue;
                        mr->start = BNDS_SA_GET(v);
                        mr->size  = BNDS_SIZE_GET(v);
+#ifdef MEMSIZE
+                       if (mr->start >= MEMSIZE)
+                               continue;
+                       if (mr->start + mr->size > MEMSIZE)
+                               mr->size = MEMSIZE - mr->start;
+#endif
 #if 0
                        printf(" [%zd]={%#"PRIx64"@%#"PRIx64"}",
                            mr - physmemr, mr->size, mr->start);
@@ -457,11 +462,6 @@
 
        if (mr == physmemr)
                panic("no memory configured!");
-#else
-       mr->start = 0;
-       mr->size = 32 << 20;
-       mr++;
-#endif
 
        /*
         * Sort memory regions from low to high and coalesce adjacent regions



Home | Main Index | Thread Index | Old Index