Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/hpcarm Add support kloader(4) for PXA2X0.
details: https://anonhg.NetBSD.org/src/rev/7007b85a335a
branches: trunk
changeset: 778516:7007b85a335a
user: nonaka <nonaka%NetBSD.org@localhost>
date: Sat Mar 31 14:02:54 2012 +0000
description:
Add support kloader(4) for PXA2X0.
diffstat:
sys/arch/hpcarm/conf/INSTALL_WZERO3 | 4 +-
sys/arch/hpcarm/conf/NETBOOKPRO | 9 +-
sys/arch/hpcarm/conf/WZERO3 | 9 +-
sys/arch/hpcarm/conf/files.hpcarm | 9 +-
sys/arch/hpcarm/conf/files.pxa2x0 | 3 +-
sys/arch/hpcarm/hpcarm/hpc_machdep.c | 135 +++++++++++++++++++++++++++-
sys/arch/hpcarm/hpcarm/kloader_machdep.c | 108 ++++++++++++++++++++++
sys/arch/hpcarm/hpcarm/kloader_pxa2x0.S | 135 ++++++++++++++++++++++++++++
sys/arch/hpcarm/hpcarm/locore.S | 34 ++++--
sys/arch/hpcarm/hpcarm/pxa2x0_hpc_machdep.c | 83 +----------------
sys/arch/hpcarm/hpcarm/sa11x0_hpc_machdep.c | 83 +----------------
sys/arch/hpcarm/include/kloader.h | 50 ++++++++++
12 files changed, 485 insertions(+), 177 deletions(-)
diffs (truncated from 998 to 300 lines):
diff -r c4860ba13bad -r 7007b85a335a sys/arch/hpcarm/conf/INSTALL_WZERO3
--- a/sys/arch/hpcarm/conf/INSTALL_WZERO3 Sat Mar 31 11:41:33 2012 +0000
+++ b/sys/arch/hpcarm/conf/INSTALL_WZERO3 Sat Mar 31 14:02:54 2012 +0000
@@ -1,7 +1,7 @@
#
# kernel config file for system install
#
-# $NetBSD: INSTALL_WZERO3,v 1.1 2010/04/17 13:36:21 nonaka Exp $
+# $NetBSD: INSTALL_WZERO3,v 1.2 2012/03/31 14:02:54 nonaka Exp $
#
include "arch/hpcarm/conf/WZERO3"
@@ -11,3 +11,5 @@
options MEMORY_DISK_IS_ROOT # force root on memory disk
options MEMORY_DISK_SERVER=0 # no userspace memory disk support
options MEMORY_DISK_ROOT_SIZE=8704 # size of memory disk, in blocks
+
+no options KLOADER
diff -r c4860ba13bad -r 7007b85a335a sys/arch/hpcarm/conf/NETBOOKPRO
--- a/sys/arch/hpcarm/conf/NETBOOKPRO Sat Mar 31 11:41:33 2012 +0000
+++ b/sys/arch/hpcarm/conf/NETBOOKPRO Sat Mar 31 14:02:54 2012 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: NETBOOKPRO,v 1.4 2012/03/10 21:51:52 joerg Exp $
+# $NetBSD: NETBOOKPRO,v 1.5 2012/03/31 14:02:54 nonaka Exp $
#
# NETBOOKPRO -- Psion Teklogix NETBOOK PRO
#
@@ -8,11 +8,16 @@
#options INCLUDE_CONFIG_FILE # embed config file in kernel binary
-#ident "GENERIC-$Revision: 1.4 $"
+#ident "GENERIC-$Revision: 1.5 $"
# estimated number of users
maxusers 32
+# in-kernel bootloader, see kloader(4)
+options KLOADER
+#options KLOADER_KERNEL_PATH="\"/netbsd\""
+#options KLOADER_DEBUG
+
# Standard system options
#options RTC_OFFSET=0 # hardware clock is this many mins. west of GMT
diff -r c4860ba13bad -r 7007b85a335a sys/arch/hpcarm/conf/WZERO3
--- a/sys/arch/hpcarm/conf/WZERO3 Sat Mar 31 11:41:33 2012 +0000
+++ b/sys/arch/hpcarm/conf/WZERO3 Sat Mar 31 14:02:54 2012 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: WZERO3,v 1.24 2012/03/10 21:51:52 joerg Exp $
+# $NetBSD: WZERO3,v 1.25 2012/03/31 14:02:54 nonaka Exp $
#
# WZERO3 -- Sharp Windows Mobile 5 based PDA
#
@@ -8,11 +8,16 @@
#options INCLUDE_CONFIG_FILE # embed config file in kernel binary
-#ident "GENERIC-$Revision: 1.24 $"
+#ident "GENERIC-$Revision: 1.25 $"
# estimated number of users
maxusers 32
+# in-kernel bootloader, see kloader(4)
+options KLOADER
+#options KLOADER_KERNEL_PATH="\"/netbsd\""
+#options KLOADER_DEBUG
+
# Standard system options
#options RTC_OFFSET=0 # hardware clock is this many mins. west of GMT
diff -r c4860ba13bad -r 7007b85a335a sys/arch/hpcarm/conf/files.hpcarm
--- a/sys/arch/hpcarm/conf/files.hpcarm Sat Mar 31 11:41:33 2012 +0000
+++ b/sys/arch/hpcarm/conf/files.hpcarm Sat Mar 31 14:02:54 2012 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: files.hpcarm,v 1.65 2010/04/17 13:36:21 nonaka Exp $
+# $NetBSD: files.hpcarm,v 1.66 2012/03/31 14:02:54 nonaka Exp $
#
# hpcarm specific configuration info
#
@@ -27,6 +27,13 @@
# HPCARM specific files
file arch/hpcarm/hpcarm/hpc_machdep.c
+# kloader
+defflag opt_kloader.h KLOADER
+defparam opt_kloader.h KLOADER_KERNEL_PATH
+defflag debug_kloader.h KLOADER_DEBUG
+file dev/kloader.c kloader
+file arch/hpcarm/hpcarm/kloader_machdep.c kloader
+
#
# H/PC Platform common files.
#
diff -r c4860ba13bad -r 7007b85a335a sys/arch/hpcarm/conf/files.pxa2x0
--- a/sys/arch/hpcarm/conf/files.pxa2x0 Sat Mar 31 11:41:33 2012 +0000
+++ b/sys/arch/hpcarm/conf/files.pxa2x0 Sat Mar 31 14:02:54 2012 +0000
@@ -1,9 +1,10 @@
-# $NetBSD: files.pxa2x0,v 1.4 2011/06/21 15:23:57 kiyohara Exp $
+# $NetBSD: files.pxa2x0,v 1.5 2012/03/31 14:02:54 nonaka Exp $
#
# PXA2x0 specific configuration info
#
file arch/hpcarm/hpcarm/pxa2x0_hpc_machdep.c
+file arch/hpcarm/hpcarm/kloader_pxa2x0.S kloader
# Include hpcarm/XScale config definitions.
include "arch/arm/xscale/files.pxa2x0"
diff -r c4860ba13bad -r 7007b85a335a sys/arch/hpcarm/hpcarm/hpc_machdep.c
--- a/sys/arch/hpcarm/hpcarm/hpc_machdep.c Sat Mar 31 11:41:33 2012 +0000
+++ b/sys/arch/hpcarm/hpcarm/hpc_machdep.c Sat Mar 31 14:02:54 2012 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: hpc_machdep.c,v 1.99 2010/11/14 03:17:50 uebayasi Exp $ */
+/* $NetBSD: hpc_machdep.c,v 1.100 2012/03/31 14:02:54 nonaka Exp $ */
/*
* Copyright (c) 1994-1998 Mark Brinicombe.
@@ -40,12 +40,20 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: hpc_machdep.c,v 1.99 2010/11/14 03:17:50 uebayasi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: hpc_machdep.c,v 1.100 2012/03/31 14:02:54 nonaka Exp $");
+
+#include "opt_cputypes.h"
+#include "opt_kloader.h"
+#ifndef KLOADER_KERNEL_PATH
+#define KLOADER_KERNEL_PATH "/netbsd"
+#endif
#include <sys/param.h>
#include <sys/kernel.h>
+#include <sys/boot_flag.h>
+#include <sys/mount.h>
+#include <sys/pmf.h>
#include <sys/reboot.h>
-#include <sys/pmf.h>
#include <uvm/uvm.h>
@@ -53,12 +61,20 @@
#include <machine/bootconfig.h>
#include <machine/bootinfo.h>
+#include <machine/platid.h>
#include <machine/pmap.h>
+#ifdef KLOADER
+#include <machine/kloader.h>
+#endif
#include <dev/cons.h>
#include <dev/hpc/apm/apmvar.h>
BootConfig bootconfig; /* Boot config storage */
+#ifdef KLOADER
+struct kloader_bootinfo kbootinfo;
+static char kernel_path[] = KLOADER_KERNEL_PATH;
+#endif
struct bootinfo *bootinfo, bootinfo_storage;
char booted_kernel_storage[80];
char *booted_kernel = booted_kernel_storage;
@@ -92,6 +108,14 @@
void (*__cpu_reset)(void) = cpu_reset;
+u_int initarm(int, char **, struct bootinfo *);
+#if defined(CPU_SA1100) || defined(CPU_SA1110)
+u_int init_sa11x0(int, char **, struct bootinfo *);
+#endif
+#if defined(CPU_XSCALE_PXA250) || defined(CPU_XSCALE_PXA270)
+u_int init_pxa2x0(int, char **, struct bootinfo *);
+#endif
+
#ifdef BOOT_DUMP
void dumppages(char *, int);
#endif
@@ -105,6 +129,7 @@
void
cpu_reboot(int howto, char *bootstr)
{
+
/*
* If we are still cold then hit the air brakes
* and crash to earth fast.
@@ -128,6 +153,16 @@
/* Disable console buffering. */
cnpollc(1);
+#ifdef KLOADER
+ if ((howto & RB_HALT) == 0) {
+ if (howto & RB_STRING) {
+ kloader_reboot_setup(bootstr);
+ } else {
+ kloader_reboot_setup(kernel_path);
+ }
+ }
+#endif
+
/*
* If RB_NOSYNC was not specified sync the discs.
* Note: Unless cold is set to 1 here, syslogd will die during
@@ -157,6 +192,11 @@
printf("The operating system has halted.\n");
printf("Please press any key to reboot.\n\n");
cngetc();
+#ifdef KLOADER
+ } else {
+ kloader_reboot();
+ /* NOTREACHED */
+#endif
}
printf("rebooting...\n");
@@ -177,6 +217,95 @@
{
}
+/*
+ * Initial entry point on startup. This gets called before main() is
+ * entered.
+ * It should be responsible for setting up everything that must be
+ * in place when main is called.
+ * This includes:
+ * Taking a copy of the boot configuration structure.
+ */
+u_int
+initarm(int argc, char **argv, struct bootinfo *bi)
+{
+
+ __sleep_func = NULL;
+ __sleep_ctx = NULL;
+
+ /* parse kernel args */
+ boothowto = 0;
+ boot_file[0] = '\0';
+ if (argc > 0 && argv != NULL) {
+ strncpy(booted_kernel_storage, argv[0],
+ sizeof(booted_kernel_storage));
+ for (int i = 1; i < argc; i++) {
+ char *cp = argv[i];
+
+ switch (*cp) {
+ case 'b':
+ /* boot device: -b=sd0 etc. */
+ cp = cp + 2;
+ if (strcmp(cp, MOUNT_NFS) == 0)
+ rootfstype = MOUNT_NFS;
+ else
+ strncpy(boot_file, cp,
+ sizeof(boot_file));
+ break;
+
+ default:
+ BOOT_FLAG(*cp, boothowto);
+ break;
+ }
+ }
+ }
+
+ /* copy bootinfo into known kernel space */
+ if (bi != NULL)
+ bootinfo_storage = *bi;
+ bootinfo = &bootinfo_storage;
+
+#ifdef BOOTINFO_FB_WIDTH
+ bootinfo->fb_line_bytes = BOOTINFO_FB_LINE_BYTES;
+ bootinfo->fb_width = BOOTINFO_FB_WIDTH;
+ bootinfo->fb_height = BOOTINFO_FB_HEIGHT;
+ bootinfo->fb_type = BOOTINFO_FB_TYPE;
+#endif
+
+ if (bootinfo->magic == BOOTINFO_MAGIC) {
+ platid.dw.dw0 = bootinfo->platid_cpu;
+ platid.dw.dw1 = bootinfo->platid_machine;
+
+#ifndef RTC_OFFSET
+ /*
+ * rtc_offset from bootinfo.timezone set by hpcboot.exe
+ */
+ if (rtc_offset == 0 &&
+ (bootinfo->timezone > (-12 * 60) &&
+ bootinfo->timezone <= (12 * 60)))
+ rtc_offset = bootinfo->timezone;
+#endif
+ }
+
+#ifdef KLOADER
+ /* copy boot parameter for kloader */
+ kloader_bootinfo_set(&kbootinfo, argc, argv, bi, false);
+#endif
+
+ /*
+ * Heads up ... Setup the CPU / MMU / TLB functions.
+ */
+ set_cpufuncs();
+ IRQdisable;
+
+#if defined(CPU_SA1100) || defined(CPU_SA1110)
Home |
Main Index |
Thread Index |
Old Index