Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/evbarm NetWalker kernels boot again.
details: https://anonhg.NetBSD.org/src/rev/8575950650a6
branches: trunk
changeset: 328593:8575950650a6
user: hkenken <hkenken%NetBSD.org@localhost>
date: Wed Apr 09 04:00:50 2014 +0000
description:
NetWalker kernels boot again.
* Enable __HAVE_MM_MD_DIRECT_MAPPED_PHYS
* Change VM layout
* Use common start-up routine
diffstat:
sys/arch/evbarm/conf/mk.netwalker | 4 +-
sys/arch/evbarm/conf/std.netwalker | 5 +-
sys/arch/evbarm/netwalker/netwalker.h | 38 ++++++
sys/arch/evbarm/netwalker/netwalker_machdep.c | 81 ++++++------
sys/arch/evbarm/netwalker/netwalker_start.S | 163 +++++++++----------------
5 files changed, 142 insertions(+), 149 deletions(-)
diffs (truncated from 499 to 300 lines):
diff -r 0ed67e8f87a7 -r 8575950650a6 sys/arch/evbarm/conf/mk.netwalker
--- a/sys/arch/evbarm/conf/mk.netwalker Tue Apr 08 22:04:15 2014 +0000
+++ b/sys/arch/evbarm/conf/mk.netwalker Wed Apr 09 04:00:50 2014 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: mk.netwalker,v 1.3 2014/03/07 12:35:14 hkenken Exp $
+# $NetBSD: mk.netwalker,v 1.4 2014/04/09 04:00:50 hkenken Exp $
CPPFLAGS+= -mcpu=cortex-a8 -mfpu=neon
@@ -6,7 +6,7 @@
SYSTEM_FIRST_SFILE= ${THISARM}/netwalker/netwalker_start.S
KERNEL_BASE_PHYS=0x90100000
-KERNEL_BASE_VIRT=0xc0100000
+KERNEL_BASE_VIRT=0x80100000
SYSTEM_LD_TAIL_EXTRA+=; \
echo ${OBJCOPY} -S -O binary $@ $@.bin; \
diff -r 0ed67e8f87a7 -r 8575950650a6 sys/arch/evbarm/conf/std.netwalker
--- a/sys/arch/evbarm/conf/std.netwalker Tue Apr 08 22:04:15 2014 +0000
+++ b/sys/arch/evbarm/conf/std.netwalker Wed Apr 09 04:00:50 2014 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: std.netwalker,v 1.8 2014/03/07 12:35:14 hkenken Exp $
+# $NetBSD: std.netwalker,v 1.9 2014/04/09 04:00:50 hkenken Exp $
#
# standard NetBSD/evbarm options for Sharp NetWalker
@@ -11,11 +11,12 @@
options MODULAR
options __HAVE_FAST_SOFTINTS # should be in types.h
options __HAVE_CPU_COUNTER
+options __HAVE_MM_MD_DIRECT_MAPPED_PHYS
options ARM_HAS_VBAR
options TPIDRPRW_IS_CURCPU
options CORTEX_PMC
options CORTEX_PMC_CCNT_HZ=800000000
-options KERNEL_BASE_EXT=0xc0000000
+options KERNEL_BASE_EXT=0x80000000
options EVBARM_BOARDTYPE="netwalker"
options FPU_VFP
diff -r 0ed67e8f87a7 -r 8575950650a6 sys/arch/evbarm/netwalker/netwalker.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/arch/evbarm/netwalker/netwalker.h Wed Apr 09 04:00:50 2014 +0000
@@ -0,0 +1,38 @@
+/* $NetBSD: netwalker.h,v 1.1 2014/04/09 04:00:50 hkenken Exp $ */
+
+/*
+ * Copyright (c) 2014 Genetec Corporation. All rights reserved.
+ * Written by Hashimoto Kenichi for Genetec Corporation.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY GENETEC CORPORATION ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL GENETEC CORPORATION
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef _EVBARM_NETWALKER_NETWALKER_H
+#define _EVBARM_NETWALKER_NETWALKER_H
+
+/*
+ * Kernel VM space: 512MB at KERNEL_VM_BASE
+ */
+#define KERNEL_VM_BASE 0xc0000000
+#define KERNEL_VM_SIZE 0x20000000
+
+#endif /* _EVBARM_NETWALKER_NETWALKER_H */
diff -r 0ed67e8f87a7 -r 8575950650a6 sys/arch/evbarm/netwalker/netwalker_machdep.c
--- a/sys/arch/evbarm/netwalker/netwalker_machdep.c Tue Apr 08 22:04:15 2014 +0000
+++ b/sys/arch/evbarm/netwalker/netwalker_machdep.c Wed Apr 09 04:00:50 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: netwalker_machdep.c,v 1.14 2014/03/29 12:00:27 hkenken Exp $ */
+/* $NetBSD: netwalker_machdep.c,v 1.15 2014/04/09 04:00:50 hkenken Exp $ */
/*
* Copyright (c) 2002, 2003, 2005, 2010 Genetec Corporation.
@@ -102,7 +102,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: netwalker_machdep.c,v 1.14 2014/03/29 12:00:27 hkenken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: netwalker_machdep.c,v 1.15 2014/04/09 04:00:50 hkenken Exp $");
#include "opt_evbarm_boardtype.h"
#include "opt_cputypes.h"
@@ -137,7 +137,9 @@
#include <arm/imx/imxuartreg.h>
#include <arm/imx/imxuartvar.h>
#include <arm/imx/imx51_iomuxreg.h>
+
#include <evbarm/netwalker/netwalker_reg.h>
+#include <evbarm/netwalker/netwalker.h>
#include "ukbd.h"
#if (NUKBD > 0)
@@ -146,20 +148,12 @@
/* Kernel text starts 1MB in from the bottom of the kernel address space. */
#define KERNEL_TEXT_BASE (KERNEL_BASE + 0x00100000)
-#define KERNEL_VM_BASE (KERNEL_BASE + 0x01000000)
-
-/*
- * The range 0xc1000000 - 0xccffffff is available for kernel VM space
- * Core-logic registers and I/O mappings occupy 0xfd000000 - 0xffffffff
- */
-#define KERNEL_VM_SIZE 0x0C000000
BootConfig bootconfig; /* Boot config storage */
static char bootargs[MAX_BOOT_STRING];
char *boot_args = NULL;
extern char KERNEL_BASE_phys[];
-extern char KERNEL_BASE_virt[];
extern int cpu_do_powersave;
@@ -167,12 +161,7 @@
* Macros to translate between physical and virtual for a subset of the
* kernel address space. *Not* for general use.
*/
-#define KERNEL_BASE_PHYS ((paddr_t)&KERNEL_BASE_phys)
-#define KERNEL_BASE_VIRT ((vaddr_t)&KERNEL_BASE_virt)
-#define KERN_VTOPHYS(va) \
- ((paddr_t)((vaddr_t)va - KERNEL_BASE_VIRT + KERNEL_BASE_PHYS))
-#define KERN_PHYSTOV(pa) \
- ((vaddr_t)((paddr_t)pa - KERNEL_BASE_PHYS + KERNEL_BASE_VIRT))
+#define KERNEL_BASE_PHYS ((paddr_t)KERNEL_BASE_phys)
/* Prototypes */
@@ -212,14 +201,18 @@
static const struct pmap_devmap netwalker_devmap[] = {
{
/* for UART1, IOMUXC */
- NETWALKER_IO_VBASE0,
- _A(NETWALKER_IO_PBASE0),
- L1_S_SIZE * 4,
- VM_PROT_READ|VM_PROT_WRITE, PTE_NOCACHE
+ .pd_va = _A(NETWALKER_IO_VBASE0),
+ .pd_pa = _A(NETWALKER_IO_PBASE0),
+ .pd_size = _S(L1_S_SIZE * 4),
+ .pd_prot = VM_PROT_READ|VM_PROT_WRITE,
+ .pd_cache = PTE_NOCACHE
},
- {0, 0, 0, 0, 0 }
+ {0}
};
+#undef _A
+#undef _S
+
#ifndef MEMSTART
#define MEMSTART 0x90000000
#endif
@@ -274,6 +267,10 @@
/* Talk to the user */
printf("\nNetBSD/evbarm (" ___STRING(EVBARM_BOARDTYPE) ") booting ...\n");
+#ifdef BOOT_ARGS
+ char mi_bootargs[] = BOOT_ARGS;
+ parse_mi_bootargs(mi_bootargs);
+#endif
bootargs[0] = '\0';
#if defined(VERBOSE_INIT_ARM) || 1
@@ -288,7 +285,7 @@
* Physical Address Range Description
* ----------------------- ----------------------------------
*
- * 0x90000000 - 0x97FFFFFF DDR SDRAM (128MByte)
+ * 0x90000000 - 0xAFFFFFFF DDR SDRAM (512MByte)
*
* The initarm() has the responsibility for creating the kernel
* page tables.
@@ -305,11 +302,29 @@
bootconfig.dram[0].address = MEMSTART;
bootconfig.dram[0].pages = (MEMSIZE * 1024 * 1024) / PAGE_SIZE;
- 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
+
+ arm32_bootmem_init(bootconfig.dram[0].address, ram_size,
+ 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,
- netwalker_devmap, false);
+ netwalker_devmap, mapallmem_p);
/* disable power down counter in watch dog,
This must be done within 16 seconds of start-up. */
@@ -609,22 +624,6 @@
ioreg_write(NETWALKER_IOMUXC_VBASE + p->reg,
p->val);
}
-
-
-#if 0 /* already done by bootloader */
- /* GPIO2[22,23]: input (left/right button)
- GPIO2[21]: input (power button) */
- ioreg_write(NETWALKER_GPIO_VBASE(2) + GPIO_DIR,
- ~__BITS(21,23) &
- ioreg_read(NETWALKER_GPIO_VBASE(2) + GPIO_DIR));
-#endif
-
-#if 0 /* already done by bootloader */
- /* GPIO4[12]: input (cover switch) */
- ioreg_write(NETWALKER_GPIO_VBASE(4) + GPIO_DIR,
- ~__BIT(12) &
- ioreg_read(NETWALKER_GPIO_VBASE(4) + GPIO_DIR));
-#endif
}
diff -r 0ed67e8f87a7 -r 8575950650a6 sys/arch/evbarm/netwalker/netwalker_start.S
--- a/sys/arch/evbarm/netwalker/netwalker_start.S Tue Apr 08 22:04:15 2014 +0000
+++ b/sys/arch/evbarm/netwalker/netwalker_start.S Wed Apr 09 04:00:50 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: netwalker_start.S,v 1.2 2011/01/31 06:28:05 matt Exp $ */
+/* $NetBSD: netwalker_start.S,v 1.3 2014/04/09 04:00:50 hkenken Exp $ */
/*-
* Copyright (c) 2009 SHIMIZU Ryo <ryo%nerv.org@localhost>
@@ -54,8 +54,11 @@
#include "opt_imx.h"
#include "opt_com.h"
+#include "opt_cpuoptions.h"
+#include "opt_cputypes.h"
+#include "opt_arm_debug.h"
-#include <machine/asm.h>
+#include <arm/asm.h>
#include <arm/armreg.h>
#include "assym.h"
@@ -63,19 +66,13 @@
#include <arm/imx/imxuartreg.h>
#include <evbarm/netwalker/netwalker_reg.h>
-RCSID("$NetBSD: netwalker_start.S,v 1.2 2011/01/31 06:28:05 matt Exp $")
-
-#if 0
-#define CPWAIT_BRANCH \
- sub pc, pc, #4
+RCSID("$NetBSD: netwalker_start.S,v 1.3 2014/04/09 04:00:50 hkenken Exp $")
-#define CPWAIT(tmp) \
- mrc p15, 0, tmp, c2, c0, 0 /* arbitrary read of CP15 */ ;\
- mov tmp, tmp /* wait for it to complete */ ;\
- CPWAIT_BRANCH /* branch to next insn */
+#if defined(VERBOSE_INIT_ARM)
+#define DEBUG_STARTUP
+#define XPUTC(n) mov r0, n; bl _C_LABEL(debugputc)
#else
-#define CPWAIT_BRANCH /* nothing to do */
-#define CPWAIT(tmp) /* nothing to do */
+#define XPUTC(n)
#endif
#ifndef SDRAM_START
@@ -83,6 +80,9 @@
#endif
#define KERNEL_TEXT_ADDR (SDRAM_START+0x00100000)
+#define INIT_MEMSIZE 128
+#define TEMP_L1_TABLE (SDRAM_START + INIT_MEMSIZE * 0x100000 - L1_TABLE_SIZE)
+
Home |
Main Index |
Thread Index |
Old Index