Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/evbmips/rasoc Get memsize from SYSCTL_CFG0 register.



details:   https://anonhg.NetBSD.org/src/rev/265992e195a4
branches:  trunk
changeset: 767928:265992e195a4
user:      matt <matt%NetBSD.org@localhost>
date:      Wed Aug 03 16:25:02 2011 +0000

description:
Get memsize from SYSCTL_CFG0 register.

diffstat:

 sys/arch/evbmips/rasoc/machdep.c |  21 ++++++++++++---------
 1 files changed, 12 insertions(+), 9 deletions(-)

diffs (46 lines):

diff -r 0f3e3f60fced -r 265992e195a4 sys/arch/evbmips/rasoc/machdep.c
--- a/sys/arch/evbmips/rasoc/machdep.c  Wed Aug 03 16:21:52 2011 +0000
+++ b/sys/arch/evbmips/rasoc/machdep.c  Wed Aug 03 16:25:02 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: machdep.c,v 1.2 2011/07/28 15:50:13 matt Exp $ */
+/*     $NetBSD: machdep.c,v 1.3 2011/08/03 16:25:02 matt Exp $ */
 /*-
  * Copyright (c) 2011 CradlePoint Technology, Inc.
  * All rights reserved.
@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>                 /* RCS ID & Copyright macro defns */
-__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.2 2011/07/28 15:50:13 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.3 2011/08/03 16:25:02 matt Exp $");
 
 #include <sys/param.h>
 #include <sys/boot_flag.h>
@@ -155,17 +155,20 @@
 
        /*
         * Determine the memory size.
-        *
-        * Note: Reserve the first page!  That's where the trap
-        * vectors are located.
         */
-       memsize = RTMEMSIZE * 1024 * 1024;
+       memsize = *(volatile uint32_t *)
+           MIPS_PHYS_TO_KSEG1(RA_SYSCTL_BASE + RA_SYSCTL_CFG0);
+       memsize = __SHIFTOUT(memsize, SYSCTL_CFG0_DRAM_SIZE);
+       if (__predict_false(memsize == 0)) {
+               memsize = 2 << 20;
+       } else {
+               memsize = 4 << (20 + memsize);
+       }
 
        physmem = btoc(memsize);
 
-       mem_clusters[mem_cluster_cnt].start = PAGE_SIZE;
-       mem_clusters[mem_cluster_cnt].size =
-               memsize - mem_clusters[mem_cluster_cnt].start;
+       mem_clusters[mem_cluster_cnt].start = 0;
+       mem_clusters[mem_cluster_cnt].size = memsize;
        mem_cluster_cnt++;
 
        /*



Home | Main Index | Thread Index | Old Index