Source-Changes-HG archive

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

[src/trunk]: src/sys/arch auto-detect RAM size



details:   https://anonhg.NetBSD.org/src/rev/0679a00acb35
branches:  trunk
changeset: 336443:0679a00acb35
user:      jmcneill <jmcneill%NetBSD.org@localhost>
date:      Sun Mar 01 15:37:26 2015 +0000

description:
auto-detect RAM size

diffstat:

 sys/arch/arm/amlogic/amlogic_reg.h        |   4 +++-
 sys/arch/evbarm/amlogic/amlogic_machdep.c |  14 ++++++++++----
 sys/arch/evbarm/conf/ODROID-C1            |   4 ++--
 3 files changed, 15 insertions(+), 7 deletions(-)

diffs (80 lines):

diff -r 50dde99e24ae -r 0679a00acb35 sys/arch/arm/amlogic/amlogic_reg.h
--- a/sys/arch/arm/amlogic/amlogic_reg.h        Sun Mar 01 15:07:49 2015 +0000
+++ b/sys/arch/arm/amlogic/amlogic_reg.h        Sun Mar 01 15:37:26 2015 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: amlogic_reg.h,v 1.4 2015/03/01 15:07:49 jmcneill Exp $ */
+/* $NetBSD: amlogic_reg.h,v 1.5 2015/03/01 15:37:26 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2015 Jared D. McNeill <jmcneill%invisible.ca@localhost>
@@ -58,6 +58,8 @@
 #define AMLOGIC_USB1_OFFSET    0x090c0000
 #define AMLOGIC_USB_SIZE       0x40000
 
+#define AMLOGIC_SRAM_OFFSET    0x19000000
+
 #define AMLOGIC_CPUCONF_OFFSET 0x1901ff80
 
 #define AMLOGIC_CBUS_CPU_CLK_CNTL_REG  0x419c
diff -r 50dde99e24ae -r 0679a00acb35 sys/arch/evbarm/amlogic/amlogic_machdep.c
--- a/sys/arch/evbarm/amlogic/amlogic_machdep.c Sun Mar 01 15:07:49 2015 +0000
+++ b/sys/arch/evbarm/amlogic/amlogic_machdep.c Sun Mar 01 15:37:26 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: amlogic_machdep.c,v 1.9 2015/03/01 15:07:49 jmcneill Exp $ */
+/*     $NetBSD: amlogic_machdep.c,v 1.10 2015/03/01 15:37:26 jmcneill Exp $ */
 
 /*
  * Machine dependent functions for kernel setup for TI OSK5912 board.
@@ -125,7 +125,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: amlogic_machdep.c,v 1.9 2015/03/01 15:07:49 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: amlogic_machdep.c,v 1.10 2015/03/01 15:37:26 jmcneill Exp $");
 
 #include "opt_machdep.h"
 #include "opt_ddb.h"
@@ -301,6 +301,14 @@
        }
 }
 
+static psize_t
+amlogic_get_ram_size(void)
+{
+       const bus_space_handle_t ao_bsh =
+           AMLOGIC_CORE_VBASE + AMLOGIC_SRAM_OFFSET;
+       return bus_space_read_4(&amlogic_bs_tag, ao_bsh, 0) << 20;
+}
+
 /*
  * u_int initarm(...)
  *
@@ -386,9 +394,7 @@
                KERNEL_BASE, KERNEL_VM_BASE, KERNEL_VM_BASE - KERNEL_BASE, KERNEL_BASE_VOFFSET);
 #endif
 
-#if notyet
        ram_size = amlogic_get_ram_size();
-#endif
 
 #ifdef __HAVE_MM_MD_DIRECT_MAPPED_PHYS
        if (ram_size > KERNEL_VM_BASE - KERNEL_BASE) {
diff -r 50dde99e24ae -r 0679a00acb35 sys/arch/evbarm/conf/ODROID-C1
--- a/sys/arch/evbarm/conf/ODROID-C1    Sun Mar 01 15:07:49 2015 +0000
+++ b/sys/arch/evbarm/conf/ODROID-C1    Sun Mar 01 15:37:26 2015 +0000
@@ -1,5 +1,5 @@
 #
-#      $NetBSD: ODROID-C1,v 1.4 2015/03/01 15:07:49 jmcneill Exp $
+#      $NetBSD: ODROID-C1,v 1.5 2015/03/01 15:37:26 jmcneill Exp $
 #
 #      Odroid-C1 (Amlogic S805) based SBC (Single Board Computer)
 #
@@ -166,7 +166,7 @@
 a9wdt0         at armperiph?                           # Watchdog
 
 # Specify the memory size in megabytes.
-options        MEMSIZE=1024
+#options       MEMSIZE=1024
 
 # On-board I/O
 amlogicio0     at mainbus?



Home | Main Index | Thread Index | Old Index