Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/evbarm Re-arrange RPI VM layout and enable __HAVE_M...
details: https://anonhg.NetBSD.org/src/rev/7a634846f501
branches: trunk
changeset: 328538:7a634846f501
user: skrll <skrll%NetBSD.org@localhost>
date: Sun Apr 06 12:43:18 2014 +0000
description:
Re-arrange RPI VM layout and enable __HAVE_MM_MD_DIRECT_MAPPED_PHYS. RPI
kernels now boot again.
I'm not admitting defeat in why there are problems with the
non-__HAVE_MM_MD_DIRECT_MAPPED_PHYS case.
diffstat:
sys/arch/evbarm/conf/std.rpi | 3 +-
sys/arch/evbarm/rpi/rpi.h | 4 +-
sys/arch/evbarm/rpi/rpi_machdep.c | 40 ++++++++++++++++++++++++++++++++++----
3 files changed, 39 insertions(+), 8 deletions(-)
diffs (98 lines):
diff -r 1155911df7c4 -r 7a634846f501 sys/arch/evbarm/conf/std.rpi
--- a/sys/arch/evbarm/conf/std.rpi Sun Apr 06 11:24:25 2014 +0000
+++ b/sys/arch/evbarm/conf/std.rpi Sun Apr 06 12:43:18 2014 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: std.rpi,v 1.13 2014/02/25 19:37:30 skrll Exp $
+# $NetBSD: std.rpi,v 1.14 2014/04/06 12:43:18 skrll Exp $
#
# standard NetBSD/evbarm for Raspberry Pi options
@@ -13,6 +13,7 @@
options __HAVE_CPU_COUNTER
options __HAVE_FAST_SOFTINTS # should be in types.h
options __HAVE_CPU_UAREA_ALLOC_IDLELWP
+options __HAVE_MM_MD_DIRECT_MAPPED_PHYS
options TPIDRPRW_IS_CURCPU
options ARM_HAS_VBAR
options KERNEL_BASE_EXT=0xc0000000
diff -r 1155911df7c4 -r 7a634846f501 sys/arch/evbarm/rpi/rpi.h
--- a/sys/arch/evbarm/rpi/rpi.h Sun Apr 06 11:24:25 2014 +0000
+++ b/sys/arch/evbarm/rpi/rpi.h Sun Apr 06 12:43:18 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: rpi.h,v 1.2 2013/09/05 07:09:33 skrll Exp $ */
+/* $NetBSD: rpi.h,v 1.3 2014/04/06 12:43:19 skrll Exp $ */
/*-
* Copyright (c) 2012 The NetBSD Foundation, Inc.
@@ -37,7 +37,7 @@
/*
* Kernel VM space: KERNEL_VM_BASE to 0xf0000000
*/
-#define KERNEL_VM_BASE (KERNEL_BASE + 0x01000000)
+#define KERNEL_VM_BASE (KERNEL_BASE + 0x20000000)
#define KERNEL_VM_SIZE (0xf0000000 - KERNEL_VM_BASE)
/*
diff -r 1155911df7c4 -r 7a634846f501 sys/arch/evbarm/rpi/rpi_machdep.c
--- a/sys/arch/evbarm/rpi/rpi_machdep.c Sun Apr 06 11:24:25 2014 +0000
+++ b/sys/arch/evbarm/rpi/rpi_machdep.c Sun Apr 06 12:43:18 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: rpi_machdep.c,v 1.40 2014/04/01 06:55:29 skrll Exp $ */
+/* $NetBSD: rpi_machdep.c,v 1.41 2014/04/06 12:43:19 skrll Exp $ */
/*-
* Copyright (c) 2012 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rpi_machdep.c,v 1.40 2014/04/01 06:55:29 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rpi_machdep.c,v 1.41 2014/04/06 12:43:19 skrll Exp $");
#include "opt_evbarm_boardtype.h"
#include "opt_ddb.h"
@@ -537,11 +537,41 @@
#ifdef VERBOSE_INIT_ARM
printf("initarm: Configuring system ...\n");
#endif
- arm32_bootmem_init(bootconfig.dram[0].address,
- bootconfig.dram[0].pages * PAGE_SIZE, (uintptr_t)KERNEL_BASE_phys);
+
+ psize_t ram_size = bootconfig.dram[0].pages * PAGE_SIZE;
+
+#ifdef __HAVE_MM_MD_DIRECT_MAPPED_PHYS
+ if (ram_size > KERNEL_VM_BASE - KERNEL_BASE) {
+ printf("%s: dropping RAM size from %luMB to %uMB\n",
+ __func__, (unsigned long) (ram_size >> 20),
+ (KERNEL_VM_BASE - KERNEL_BASE) >> 20);
+ ram_size = KERNEL_VM_BASE - KERNEL_BASE;
+ }
+#endif
+
+ /*
+ * If MEMSIZE specified less than what we really have, limit ourselves
+ * to that.
+ */
+#ifdef MEMSIZE
+ if (ram_size == 0 || ram_size > (unsigned)MEMSIZE * 1024 * 1024)
+ ram_size = (unsigned)MEMSIZE * 1024 * 1024;
+#else
+ KASSERTMSG(ram_size > 0, "RAM size unknown and MEMSIZE undefined");
+#endif
+
+ arm32_bootmem_init(bootconfig.dram[0].address, ram_size,
+ (uintptr_t)KERNEL_BASE_phys);
+
+#ifdef __HAVE_MM_MD_DIRECT_MAPPED_PHYS
+ const bool mapallmem_p = true;
+ KASSERT(ram_size <= KERNEL_VM_BASE - KERNEL_BASE);
+#else
+ const bool mapallmem_p = false;
+#endif
arm32_kernel_vm_init(KERNEL_VM_BASE, ARM_VECTORS_HIGH, 0, rpi_devmap,
- false);
+ mapallmem_p);
cpu_reset_address = bcm2835_system_reset;
Home |
Main Index |
Thread Index |
Old Index