Add support kloader(4) for PXA2X0.
This commit is contained in:
parent
4970a4c570
commit
1e92636e2f
|
@ -1,7 +1,7 @@
|
||||||
#
|
#
|
||||||
# kernel config file for system install
|
# 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"
|
include "arch/hpcarm/conf/WZERO3"
|
||||||
|
@ -11,3 +11,5 @@ options MEMORY_DISK_HOOKS
|
||||||
options MEMORY_DISK_IS_ROOT # force root on memory disk
|
options MEMORY_DISK_IS_ROOT # force root on memory disk
|
||||||
options MEMORY_DISK_SERVER=0 # no userspace memory disk support
|
options MEMORY_DISK_SERVER=0 # no userspace memory disk support
|
||||||
options MEMORY_DISK_ROOT_SIZE=8704 # size of memory disk, in blocks
|
options MEMORY_DISK_ROOT_SIZE=8704 # size of memory disk, in blocks
|
||||||
|
|
||||||
|
no options KLOADER
|
||||||
|
|
|
@ -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
|
# NETBOOKPRO -- Psion Teklogix NETBOOK PRO
|
||||||
#
|
#
|
||||||
|
@ -8,11 +8,16 @@ include "arch/hpcarm/conf/files.netbookpro"
|
||||||
|
|
||||||
#options INCLUDE_CONFIG_FILE # embed config file in kernel binary
|
#options INCLUDE_CONFIG_FILE # embed config file in kernel binary
|
||||||
|
|
||||||
#ident "GENERIC-$Revision: 1.4 $"
|
#ident "GENERIC-$Revision: 1.5 $"
|
||||||
|
|
||||||
# estimated number of users
|
# estimated number of users
|
||||||
maxusers 32
|
maxusers 32
|
||||||
|
|
||||||
|
# in-kernel bootloader, see kloader(4)
|
||||||
|
options KLOADER
|
||||||
|
#options KLOADER_KERNEL_PATH="\"/netbsd\""
|
||||||
|
#options KLOADER_DEBUG
|
||||||
|
|
||||||
# Standard system options
|
# Standard system options
|
||||||
|
|
||||||
#options RTC_OFFSET=0 # hardware clock is this many mins. west of GMT
|
#options RTC_OFFSET=0 # hardware clock is this many mins. west of GMT
|
||||||
|
|
|
@ -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
|
# WZERO3 -- Sharp Windows Mobile 5 based PDA
|
||||||
#
|
#
|
||||||
|
@ -8,11 +8,16 @@ include "arch/hpcarm/conf/files.wzero3"
|
||||||
|
|
||||||
#options INCLUDE_CONFIG_FILE # embed config file in kernel binary
|
#options INCLUDE_CONFIG_FILE # embed config file in kernel binary
|
||||||
|
|
||||||
#ident "GENERIC-$Revision: 1.24 $"
|
#ident "GENERIC-$Revision: 1.25 $"
|
||||||
|
|
||||||
# estimated number of users
|
# estimated number of users
|
||||||
maxusers 32
|
maxusers 32
|
||||||
|
|
||||||
|
# in-kernel bootloader, see kloader(4)
|
||||||
|
options KLOADER
|
||||||
|
#options KLOADER_KERNEL_PATH="\"/netbsd\""
|
||||||
|
#options KLOADER_DEBUG
|
||||||
|
|
||||||
# Standard system options
|
# Standard system options
|
||||||
|
|
||||||
#options RTC_OFFSET=0 # hardware clock is this many mins. west of GMT
|
#options RTC_OFFSET=0 # hardware clock is this many mins. west of GMT
|
||||||
|
|
|
@ -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
|
# hpcarm specific configuration info
|
||||||
#
|
#
|
||||||
|
@ -27,6 +27,13 @@ file arch/hpcarm/hpcarm/autoconf.c
|
||||||
# HPCARM specific files
|
# HPCARM specific files
|
||||||
file arch/hpcarm/hpcarm/hpc_machdep.c
|
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.
|
# H/PC Platform common files.
|
||||||
#
|
#
|
||||||
|
|
|
@ -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
|
# PXA2x0 specific configuration info
|
||||||
#
|
#
|
||||||
|
|
||||||
file arch/hpcarm/hpcarm/pxa2x0_hpc_machdep.c
|
file arch/hpcarm/hpcarm/pxa2x0_hpc_machdep.c
|
||||||
|
file arch/hpcarm/hpcarm/kloader_pxa2x0.S kloader
|
||||||
|
|
||||||
# Include hpcarm/XScale config definitions.
|
# Include hpcarm/XScale config definitions.
|
||||||
include "arch/arm/xscale/files.pxa2x0"
|
include "arch/arm/xscale/files.pxa2x0"
|
||||||
|
|
|
@ -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.
|
* Copyright (c) 1994-1998 Mark Brinicombe.
|
||||||
|
@ -40,12 +40,20 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <sys/cdefs.h>
|
#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/param.h>
|
||||||
#include <sys/kernel.h>
|
#include <sys/kernel.h>
|
||||||
#include <sys/reboot.h>
|
#include <sys/boot_flag.h>
|
||||||
|
#include <sys/mount.h>
|
||||||
#include <sys/pmf.h>
|
#include <sys/pmf.h>
|
||||||
|
#include <sys/reboot.h>
|
||||||
|
|
||||||
#include <uvm/uvm.h>
|
#include <uvm/uvm.h>
|
||||||
|
|
||||||
|
@ -53,12 +61,20 @@ __KERNEL_RCSID(0, "$NetBSD: hpc_machdep.c,v 1.99 2010/11/14 03:17:50 uebayasi Ex
|
||||||
|
|
||||||
#include <machine/bootconfig.h>
|
#include <machine/bootconfig.h>
|
||||||
#include <machine/bootinfo.h>
|
#include <machine/bootinfo.h>
|
||||||
|
#include <machine/platid.h>
|
||||||
#include <machine/pmap.h>
|
#include <machine/pmap.h>
|
||||||
|
#ifdef KLOADER
|
||||||
|
#include <machine/kloader.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <dev/cons.h>
|
#include <dev/cons.h>
|
||||||
#include <dev/hpc/apm/apmvar.h>
|
#include <dev/hpc/apm/apmvar.h>
|
||||||
|
|
||||||
BootConfig bootconfig; /* Boot config storage */
|
BootConfig bootconfig; /* Boot config storage */
|
||||||
|
#ifdef KLOADER
|
||||||
|
struct kloader_bootinfo kbootinfo;
|
||||||
|
static char kernel_path[] = KLOADER_KERNEL_PATH;
|
||||||
|
#endif
|
||||||
struct bootinfo *bootinfo, bootinfo_storage;
|
struct bootinfo *bootinfo, bootinfo_storage;
|
||||||
char booted_kernel_storage[80];
|
char booted_kernel_storage[80];
|
||||||
char *booted_kernel = booted_kernel_storage;
|
char *booted_kernel = booted_kernel_storage;
|
||||||
|
@ -92,6 +108,14 @@ void *__sleep_ctx;
|
||||||
|
|
||||||
void (*__cpu_reset)(void) = cpu_reset;
|
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
|
#ifdef BOOT_DUMP
|
||||||
void dumppages(char *, int);
|
void dumppages(char *, int);
|
||||||
#endif
|
#endif
|
||||||
|
@ -105,6 +129,7 @@ void dumppages(char *, int);
|
||||||
void
|
void
|
||||||
cpu_reboot(int howto, char *bootstr)
|
cpu_reboot(int howto, char *bootstr)
|
||||||
{
|
{
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* If we are still cold then hit the air brakes
|
* If we are still cold then hit the air brakes
|
||||||
* and crash to earth fast.
|
* and crash to earth fast.
|
||||||
|
@ -128,6 +153,16 @@ cpu_reboot(int howto, char *bootstr)
|
||||||
/* Disable console buffering. */
|
/* Disable console buffering. */
|
||||||
cnpollc(1);
|
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.
|
* If RB_NOSYNC was not specified sync the discs.
|
||||||
* Note: Unless cold is set to 1 here, syslogd will die during
|
* Note: Unless cold is set to 1 here, syslogd will die during
|
||||||
|
@ -157,6 +192,11 @@ cpu_reboot(int howto, char *bootstr)
|
||||||
printf("The operating system has halted.\n");
|
printf("The operating system has halted.\n");
|
||||||
printf("Please press any key to reboot.\n\n");
|
printf("Please press any key to reboot.\n\n");
|
||||||
cngetc();
|
cngetc();
|
||||||
|
#ifdef KLOADER
|
||||||
|
} else {
|
||||||
|
kloader_reboot();
|
||||||
|
/* NOTREACHED */
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
printf("rebooting...\n");
|
printf("rebooting...\n");
|
||||||
|
@ -177,6 +217,95 @@ machine_standby(void)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* 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)
|
||||||
|
return init_sa11x0(argc, argv, bi);
|
||||||
|
#elif defined(CPU_XSCALE_PXA250) || defined(CPU_XSCALE_PXA270)
|
||||||
|
return init_pxa2x0(argc, argv, bi);
|
||||||
|
#else
|
||||||
|
#error No CPU support
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef BOOT_DUMP
|
#ifdef BOOT_DUMP
|
||||||
static void
|
static void
|
||||||
dumppages(char *start, int nbytes)
|
dumppages(char *start, int nbytes)
|
||||||
|
|
|
@ -0,0 +1,108 @@
|
||||||
|
/* $NetBSD: kloader_machdep.c,v 1.1 2012/03/31 14:02:54 nonaka Exp $ */
|
||||||
|
|
||||||
|
/*-
|
||||||
|
* Copyright (C) 2012 NONAKA Kimihiro <nonaka@netbsd.org>
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* 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 THE AUTHOR ``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 THE AUTHOR 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <sys/cdefs.h>
|
||||||
|
__KERNEL_RCSID(0, "$NetBSD: kloader_machdep.c,v 1.1 2012/03/31 14:02:54 nonaka Exp $");
|
||||||
|
|
||||||
|
#include "debug_kloader.h"
|
||||||
|
#include "opt_cputypes.h"
|
||||||
|
|
||||||
|
#include <sys/param.h>
|
||||||
|
#include <sys/systm.h>
|
||||||
|
#include <sys/device.h>
|
||||||
|
|
||||||
|
#include <machine/kloader.h>
|
||||||
|
#include <machine/pmap.h>
|
||||||
|
|
||||||
|
#include <arm/cpufunc.h>
|
||||||
|
#if defined(CPU_XSCALE_PXA250) || defined(CPU_XSCALE_PXA270)
|
||||||
|
#include <arm/xscale/pxa2x0reg.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
kloader_jumpfunc_t kloader_hpcarm_jump __attribute__((__noreturn__));
|
||||||
|
void kloader_hpcarm_reset(void);
|
||||||
|
#if defined(CPU_XSCALE_PXA250) || defined(CPU_XSCALE_PXA270)
|
||||||
|
kloader_bootfunc_t kloader_pxa2x0_boot __attribute__((__noreturn__));
|
||||||
|
#endif
|
||||||
|
|
||||||
|
struct kloader_ops kloader_hpcarm_ops = {
|
||||||
|
.jump = kloader_hpcarm_jump,
|
||||||
|
#if defined(CPU_XSCALE_PXA250) || defined(CPU_XSCALE_PXA270)
|
||||||
|
.boot = kloader_pxa2x0_boot,
|
||||||
|
#endif
|
||||||
|
.reset = kloader_hpcarm_reset,
|
||||||
|
};
|
||||||
|
|
||||||
|
void
|
||||||
|
kloader_reboot_setup(const char *filename)
|
||||||
|
{
|
||||||
|
|
||||||
|
__kloader_reboot_setup(&kloader_hpcarm_ops, filename);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
kloader_hpcarm_reset(void)
|
||||||
|
{
|
||||||
|
extern void (*__cpu_reset)(void);
|
||||||
|
|
||||||
|
__cpu_reset();
|
||||||
|
/*NOTREACHED*/
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
kloader_hpcarm_jump(kloader_bootfunc_t func, vaddr_t sp,
|
||||||
|
struct kloader_bootinfo *kbi, struct kloader_page_tag *tag)
|
||||||
|
{
|
||||||
|
|
||||||
|
disable_interrupts(I32_bit|F32_bit);
|
||||||
|
cpu_idcache_wbinv_all();
|
||||||
|
|
||||||
|
/* jump to 2nd boot-loader */
|
||||||
|
(*func)(kbi, tag);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Physcal address to virtual address
|
||||||
|
*/
|
||||||
|
vaddr_t
|
||||||
|
kloader_phystov(paddr_t pa)
|
||||||
|
{
|
||||||
|
vaddr_t va;
|
||||||
|
int error;
|
||||||
|
|
||||||
|
#if defined(CPU_XSCALE_PXA250) || defined(CPU_XSCALE_PXA270)
|
||||||
|
va = KERNEL_BASE + pa - PXA2X0_SDRAM0_START;
|
||||||
|
#else
|
||||||
|
#error No support KLOADER with specific CPU type.
|
||||||
|
#endif
|
||||||
|
error = pmap_enter(pmap_kernel(), va, pa, VM_PROT_ALL, 0);
|
||||||
|
if (error) {
|
||||||
|
printf("%s: map failed: pa=0x%lx, va=0x%lx, error=%d\n",
|
||||||
|
__func__, pa, va, error);
|
||||||
|
}
|
||||||
|
return va;
|
||||||
|
}
|
|
@ -0,0 +1,135 @@
|
||||||
|
/* $NetBSD: kloader_pxa2x0.S,v 1.1 2012/03/31 14:02:54 nonaka Exp $ */
|
||||||
|
|
||||||
|
/*-
|
||||||
|
* Copyright (C) 2012 NONAKA Kimihiro <nonaka@netbsd.org>
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* 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 THE AUTHOR ``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 THE AUTHOR 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <machine/asm.h>
|
||||||
|
|
||||||
|
#include <arm/armreg.h>
|
||||||
|
|
||||||
|
/*
|
||||||
|
* CPWAIT -- Canonical method to wait for CP15 update.
|
||||||
|
* NOTE: Clobbers the specified temp reg.
|
||||||
|
* copied from arm/arm/cpufunc_asm_xscale.S
|
||||||
|
* XXX: better be in a common header file.
|
||||||
|
*/
|
||||||
|
#define CPWAIT_BRANCH \
|
||||||
|
sub pc, pc, #4
|
||||||
|
|
||||||
|
#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 */
|
||||||
|
|
||||||
|
#define VATOPA(reg) \
|
||||||
|
bic reg, reg, #0xff000000 /* clear upper 8 bits */ ;\
|
||||||
|
orr reg, reg, #0xa0000000 /* OR in physical base address */
|
||||||
|
|
||||||
|
.text
|
||||||
|
.align 0
|
||||||
|
/*
|
||||||
|
* void
|
||||||
|
* kloader_pxa2x0_boot(struct kloader_bootinfo *kbi,
|
||||||
|
* struct kloader_page_tag *tag)
|
||||||
|
*
|
||||||
|
* r0: kbi, r1: tag
|
||||||
|
*/
|
||||||
|
.global _C_LABEL(kloader_pxa2x0_boot)
|
||||||
|
_C_LABEL(kloader_pxa2x0_boot):
|
||||||
|
mov lr, r0 /* lr: kbi */
|
||||||
|
VATOPA(lr)
|
||||||
|
|
||||||
|
/* We will go ahead and disable the MMU here. */
|
||||||
|
adr r8, .Lmmuoff
|
||||||
|
VATOPA(r8)
|
||||||
|
|
||||||
|
mrc p15, 0, r2, c1, c0, 0
|
||||||
|
bic r2, r2, #CPU_CONTROL_MMU_ENABLE
|
||||||
|
bic r2, r2, #CPU_CONTROL_DC_ENABLE
|
||||||
|
bic r2, r2, #CPU_CONTROL_IC_ENABLE
|
||||||
|
mcr p15, 0, r2, c1, c0, 0
|
||||||
|
|
||||||
|
nop
|
||||||
|
nop
|
||||||
|
nop
|
||||||
|
|
||||||
|
mov pc, r8 /* Heave-ho! */
|
||||||
|
|
||||||
|
.align 0
|
||||||
|
.Lmmuoff:
|
||||||
|
nop
|
||||||
|
nop
|
||||||
|
nop
|
||||||
|
|
||||||
|
/* Load kernel image */
|
||||||
|
mov r4, r1 /* tag */
|
||||||
|
1: mov r3, r4
|
||||||
|
cmp r3, #0 /* tag == NULL */
|
||||||
|
beq 3f
|
||||||
|
VATOPA(r3)
|
||||||
|
ldmia r3, {r4-r7} /* r4: next, r5: src, r6: dst, r7: sz */
|
||||||
|
VATOPA(r5)
|
||||||
|
VATOPA(r6)
|
||||||
|
add r8, r6, r7 /* r8: dst + sz */
|
||||||
|
2: ldr r9, [r5], #4 /* copy */
|
||||||
|
str r9, [r6], #4
|
||||||
|
cmp r8, r6
|
||||||
|
bne 2b
|
||||||
|
b 1b
|
||||||
|
|
||||||
|
3:
|
||||||
|
/* Set temporary stack pointer */
|
||||||
|
ldr sp, .Lstack_addr
|
||||||
|
|
||||||
|
/* Jump to kernel entry */
|
||||||
|
mov r3, lr /* r3: kbi */
|
||||||
|
ldr lr, [r3] /* kbi->entry */
|
||||||
|
VATOPA(lr)
|
||||||
|
ldr r0, [r3, #4] /* kbi->argc */
|
||||||
|
ldr r1, [r3, #8] /* kbi->argv */
|
||||||
|
add r2, r3, #12 /* &kbi->bootinfo */
|
||||||
|
|
||||||
|
/* Fixup argv[] */
|
||||||
|
cmp r1, #0 /* argv == NULL */
|
||||||
|
beq 5f
|
||||||
|
VATOPA(r1)
|
||||||
|
cmp r0, #0 /* argc == 0 */
|
||||||
|
beq 5f
|
||||||
|
|
||||||
|
mov r3, r0
|
||||||
|
mov r4, r1
|
||||||
|
4: ldr r5, [r4]
|
||||||
|
VATOPA(r5)
|
||||||
|
str r5, [r4], #4
|
||||||
|
subs r3, r3, #1
|
||||||
|
bgt 4b
|
||||||
|
|
||||||
|
5: /* Jump! */
|
||||||
|
mov pc, lr
|
||||||
|
|
||||||
|
99: b 99b
|
||||||
|
|
||||||
|
.Lstack_addr:
|
||||||
|
.word 0xa0004000
|
|
@ -1,4 +1,4 @@
|
||||||
/* $NetBSD: locore.S,v 1.12 2010/04/17 13:36:21 nonaka Exp $ */
|
/* $NetBSD: locore.S,v 1.13 2012/03/31 14:02:54 nonaka Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (C) 1994-1997 Mark Brinicombe
|
* Copyright (C) 1994-1997 Mark Brinicombe
|
||||||
|
@ -122,13 +122,11 @@ ASENTRY_NP(start)
|
||||||
CPWAIT(r9)
|
CPWAIT(r9)
|
||||||
|
|
||||||
/* Jump to kernel code in TRUE VA */
|
/* Jump to kernel code in TRUE VA */
|
||||||
adr r9, .Lstart
|
ldr r9, .Lhpc_start
|
||||||
ldmia r9, {r9, sp} /* and set stack pointer */
|
|
||||||
mov pc, r9
|
mov pc, r9
|
||||||
|
|
||||||
.Lstart:
|
.Lhpc_start:
|
||||||
.word hpc_start
|
.word hpc_start
|
||||||
.word svcstk + INIT_ARM_STACK_SIZE
|
|
||||||
|
|
||||||
#define MMU_INIT(va,pa,n_sec,attr) \
|
#define MMU_INIT(va,pa,n_sec,attr) \
|
||||||
.word (n_sec); \
|
.word (n_sec); \
|
||||||
|
@ -145,17 +143,22 @@ ASENTRY_NP(start)
|
||||||
MMU_INIT(0xa0000000, 0xa0000000, 256, L1_TYPE_S|L1_S_C|L1_S_AP(AP_KRW))
|
MMU_INIT(0xa0000000, 0xa0000000, 256, L1_TYPE_S|L1_S_C|L1_S_AP(AP_KRW))
|
||||||
/* map VA 0xc0000000..0xcfffffff to PA 0xa0000000..0xafffffff */
|
/* map VA 0xc0000000..0xcfffffff to PA 0xa0000000..0xafffffff */
|
||||||
MMU_INIT(0xc0000000, 0xa0000000, 256, L1_TYPE_S|L1_S_C|L1_S_AP(AP_KRW))
|
MMU_INIT(0xc0000000, 0xa0000000, 256, L1_TYPE_S|L1_S_C|L1_S_AP(AP_KRW))
|
||||||
|
|
||||||
.word 0,0,0 /* end of table */
|
.word 0,0,0 /* end of table */
|
||||||
|
|
||||||
.bss
|
|
||||||
svcstk:
|
|
||||||
.space INIT_ARM_STACK_SIZE
|
|
||||||
|
|
||||||
.text
|
.text
|
||||||
.align 0
|
.align 0
|
||||||
ASENTRY_NP(hpc_start)
|
ASENTRY_NP(hpc_start)
|
||||||
#endif
|
#endif /* CPU_XSCALE_PXA250 | CPU_XSCALE_PXA270 */
|
||||||
|
|
||||||
|
adr r5, .Lstart
|
||||||
|
ldmia r5, {r3, r4, sp} /* Set initial stack and */
|
||||||
|
sub r4, r4, r3 /* get zero init data */
|
||||||
|
|
||||||
|
mov r5, #0
|
||||||
|
.L1:
|
||||||
|
str r5, [r3], #4 /* Zero the bss */
|
||||||
|
subs r4, r4, #4
|
||||||
|
bgt .L1
|
||||||
|
|
||||||
mov fp, #0x00000000 /* trace back starts here */
|
mov fp, #0x00000000 /* trace back starts here */
|
||||||
bl _C_LABEL(initarm) /* Off we go */
|
bl _C_LABEL(initarm) /* Off we go */
|
||||||
|
@ -177,6 +180,15 @@ ASENTRY_NP(hpc_start)
|
||||||
/* Never gets here */
|
/* Never gets here */
|
||||||
b .
|
b .
|
||||||
|
|
||||||
|
.Lstart:
|
||||||
|
.word _edata
|
||||||
|
.word _end
|
||||||
|
.word svcstk + INIT_ARM_STACK_SIZE
|
||||||
|
|
||||||
|
.bss
|
||||||
|
svcstk:
|
||||||
|
.space INIT_ARM_STACK_SIZE
|
||||||
|
|
||||||
.text
|
.text
|
||||||
.align 0
|
.align 0
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $NetBSD: pxa2x0_hpc_machdep.c,v 1.14 2012/03/05 12:15:23 nonaka Exp $ */
|
/* $NetBSD: pxa2x0_hpc_machdep.c,v 1.15 2012/03/31 14:02:54 nonaka Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 1994-1998 Mark Brinicombe.
|
* Copyright (c) 1994-1998 Mark Brinicombe.
|
||||||
|
@ -40,7 +40,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <sys/cdefs.h>
|
#include <sys/cdefs.h>
|
||||||
__KERNEL_RCSID(0, "$NetBSD: pxa2x0_hpc_machdep.c,v 1.14 2012/03/05 12:15:23 nonaka Exp $");
|
__KERNEL_RCSID(0, "$NetBSD: pxa2x0_hpc_machdep.c,v 1.15 2012/03/31 14:02:54 nonaka Exp $");
|
||||||
|
|
||||||
#include "opt_ddb.h"
|
#include "opt_ddb.h"
|
||||||
#include "opt_dram_pages.h"
|
#include "opt_dram_pages.h"
|
||||||
|
@ -56,7 +56,6 @@ __KERNEL_RCSID(0, "$NetBSD: pxa2x0_hpc_machdep.c,v 1.14 2012/03/05 12:15:23 nona
|
||||||
#include <sys/msgbuf.h>
|
#include <sys/msgbuf.h>
|
||||||
#include <sys/exec.h>
|
#include <sys/exec.h>
|
||||||
#include <sys/ksyms.h>
|
#include <sys/ksyms.h>
|
||||||
#include <sys/boot_flag.h>
|
|
||||||
#include <sys/conf.h> /* XXX for consinit related hacks */
|
#include <sys/conf.h> /* XXX for consinit related hacks */
|
||||||
#include <sys/device.h>
|
#include <sys/device.h>
|
||||||
#include <sys/bus.h>
|
#include <sys/bus.h>
|
||||||
|
@ -94,12 +93,6 @@ __KERNEL_RCSID(0, "$NetBSD: pxa2x0_hpc_machdep.c,v 1.14 2012/03/05 12:15:23 nona
|
||||||
#include <dev/hpc/apm/apmvar.h>
|
#include <dev/hpc/apm/apmvar.h>
|
||||||
#include <dev/ic/comreg.h>
|
#include <dev/ic/comreg.h>
|
||||||
|
|
||||||
#include <sys/mount.h>
|
|
||||||
#include <nfs/rpcv2.h>
|
|
||||||
#include <nfs/nfsproto.h>
|
|
||||||
#include <nfs/nfs.h>
|
|
||||||
#include <nfs/nfsmount.h>
|
|
||||||
|
|
||||||
/* Kernel text starts 2MB in from the bottom of the kernel address space. */
|
/* Kernel text starts 2MB in from the bottom of the kernel address space. */
|
||||||
#define KERNEL_TEXT_BASE (KERNEL_BASE + 0x00200000)
|
#define KERNEL_TEXT_BASE (KERNEL_BASE + 0x00200000)
|
||||||
#ifndef KERNEL_VM_BASE
|
#ifndef KERNEL_VM_BASE
|
||||||
|
@ -125,9 +118,6 @@ u_int cpu_reset_address = 0;
|
||||||
#define UND_STACK_SIZE 1
|
#define UND_STACK_SIZE 1
|
||||||
|
|
||||||
extern BootConfig bootconfig; /* Boot config storage */
|
extern BootConfig bootconfig; /* Boot config storage */
|
||||||
extern struct bootinfo *bootinfo, bootinfo_storage;
|
|
||||||
extern char booted_kernel_storage[80];
|
|
||||||
extern char *booted_kernel;
|
|
||||||
|
|
||||||
extern paddr_t physical_start;
|
extern paddr_t physical_start;
|
||||||
extern paddr_t physical_freestart;
|
extern paddr_t physical_freestart;
|
||||||
|
@ -141,9 +131,6 @@ extern pv_addr_t undstack;
|
||||||
extern pv_addr_t abtstack;
|
extern pv_addr_t abtstack;
|
||||||
extern pv_addr_t kernelstack;
|
extern pv_addr_t kernelstack;
|
||||||
|
|
||||||
extern char *boot_args;
|
|
||||||
extern char boot_file[16];
|
|
||||||
|
|
||||||
extern vaddr_t msgbufphys;
|
extern vaddr_t msgbufphys;
|
||||||
|
|
||||||
extern u_int data_abort_handler_address;
|
extern u_int data_abort_handler_address;
|
||||||
|
@ -173,7 +160,7 @@ void prefetch_abort_handler(trapframe_t *);
|
||||||
void undefinedinstruction_bounce(trapframe_t *);
|
void undefinedinstruction_bounce(trapframe_t *);
|
||||||
u_int cpu_get_control(void);
|
u_int cpu_get_control(void);
|
||||||
|
|
||||||
u_int initarm(int, char **, struct bootinfo *);
|
u_int init_pxa2x0(int, char **, struct bootinfo *);
|
||||||
|
|
||||||
/* Machine dependent initialize function */
|
/* Machine dependent initialize function */
|
||||||
extern void pxa2x0_machdep_init(void);
|
extern void pxa2x0_machdep_init(void);
|
||||||
|
@ -270,17 +257,14 @@ read_ttb(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Initial entry point on startup. This gets called before main() is
|
|
||||||
* entered.
|
|
||||||
* It should be responsible for setting up everything that must be
|
* It should be responsible for setting up everything that must be
|
||||||
* in place when main is called.
|
* in place when main is called.
|
||||||
* This includes:
|
* This includes:
|
||||||
* Taking a copy of the boot configuration structure.
|
|
||||||
* Initializing the physical console so characters can be printed.
|
* Initializing the physical console so characters can be printed.
|
||||||
* Setting up page tables for the kernel.
|
* Setting up page tables for the kernel.
|
||||||
*/
|
*/
|
||||||
u_int
|
u_int
|
||||||
initarm(int argc, char **argv, struct bootinfo *bi)
|
init_pxa2x0(int argc, char **argv, struct bootinfo *bi)
|
||||||
{
|
{
|
||||||
#ifdef DIAGNOSTIC
|
#ifdef DIAGNOSTIC
|
||||||
extern vsize_t xscale_minidata_clean_size; /* used in KASSERT */
|
extern vsize_t xscale_minidata_clean_size; /* used in KASSERT */
|
||||||
|
@ -290,68 +274,11 @@ initarm(int argc, char **argv, struct bootinfo *bi)
|
||||||
u_int l1pagetable;
|
u_int l1pagetable;
|
||||||
vaddr_t freemempos;
|
vaddr_t freemempos;
|
||||||
vsize_t pt_size;
|
vsize_t pt_size;
|
||||||
int loop, i;
|
int loop;
|
||||||
#if NKSYMS || defined(DDB) || defined(MODULAR)
|
#if NKSYMS || defined(DDB) || defined(MODULAR)
|
||||||
Elf_Shdr *sh;
|
Elf_Shdr *sh;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
__sleep_func = NULL;
|
|
||||||
__sleep_ctx = NULL;
|
|
||||||
|
|
||||||
/* parse kernel args */
|
|
||||||
boothowto = 0;
|
|
||||||
boot_file[0] = '\0';
|
|
||||||
strncpy(booted_kernel_storage, argv[0], sizeof(booted_kernel_storage));
|
|
||||||
for (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 */
|
|
||||||
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
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Heads up ... Setup the CPU / MMU / TLB functions.
|
|
||||||
*/
|
|
||||||
set_cpufuncs();
|
|
||||||
IRQdisable;
|
|
||||||
|
|
||||||
pmap_devmap_bootstrap((vaddr_t)read_ttb(), pxa2x0_devmap);
|
pmap_devmap_bootstrap((vaddr_t)read_ttb(), pxa2x0_devmap);
|
||||||
pxa2x0_memctl_bootstrap(PXA2X0_MEMCTL_VBASE);
|
pxa2x0_memctl_bootstrap(PXA2X0_MEMCTL_VBASE);
|
||||||
pxa2x0_intr_bootstrap(PXA2X0_INTCTL_VBASE);
|
pxa2x0_intr_bootstrap(PXA2X0_INTCTL_VBASE);
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $NetBSD: sa11x0_hpc_machdep.c,v 1.3 2011/07/19 15:37:39 dyoung Exp $ */
|
/* $NetBSD: sa11x0_hpc_machdep.c,v 1.4 2012/03/31 14:02:54 nonaka Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 1994-1998 Mark Brinicombe.
|
* Copyright (c) 1994-1998 Mark Brinicombe.
|
||||||
|
@ -40,7 +40,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <sys/cdefs.h>
|
#include <sys/cdefs.h>
|
||||||
__KERNEL_RCSID(0, "$NetBSD: sa11x0_hpc_machdep.c,v 1.3 2011/07/19 15:37:39 dyoung Exp $");
|
__KERNEL_RCSID(0, "$NetBSD: sa11x0_hpc_machdep.c,v 1.4 2012/03/31 14:02:54 nonaka Exp $");
|
||||||
|
|
||||||
#include "opt_ddb.h"
|
#include "opt_ddb.h"
|
||||||
#include "opt_dram_pages.h"
|
#include "opt_dram_pages.h"
|
||||||
|
@ -56,7 +56,6 @@ __KERNEL_RCSID(0, "$NetBSD: sa11x0_hpc_machdep.c,v 1.3 2011/07/19 15:37:39 dyoun
|
||||||
#include <sys/msgbuf.h>
|
#include <sys/msgbuf.h>
|
||||||
#include <sys/exec.h>
|
#include <sys/exec.h>
|
||||||
#include <sys/ksyms.h>
|
#include <sys/ksyms.h>
|
||||||
#include <sys/boot_flag.h>
|
|
||||||
#include <sys/conf.h> /* XXX for consinit related hacks */
|
#include <sys/conf.h> /* XXX for consinit related hacks */
|
||||||
#include <sys/device.h>
|
#include <sys/device.h>
|
||||||
#include <sys/termios.h>
|
#include <sys/termios.h>
|
||||||
|
@ -94,12 +93,6 @@ __KERNEL_RCSID(0, "$NetBSD: sa11x0_hpc_machdep.c,v 1.3 2011/07/19 15:37:39 dyoun
|
||||||
#include <dev/hpc/apm/apmvar.h>
|
#include <dev/hpc/apm/apmvar.h>
|
||||||
#include <dev/hpc/bicons.h>
|
#include <dev/hpc/bicons.h>
|
||||||
|
|
||||||
#include <sys/mount.h>
|
|
||||||
#include <nfs/rpcv2.h>
|
|
||||||
#include <nfs/nfsproto.h>
|
|
||||||
#include <nfs/nfs.h>
|
|
||||||
#include <nfs/nfsmount.h>
|
|
||||||
|
|
||||||
/* Kernel text starts 256K in from the bottom of the kernel address space. */
|
/* Kernel text starts 256K in from the bottom of the kernel address space. */
|
||||||
#define KERNEL_TEXT_BASE (KERNEL_BASE + 0x00040000)
|
#define KERNEL_TEXT_BASE (KERNEL_BASE + 0x00040000)
|
||||||
#define KERNEL_VM_BASE (KERNEL_BASE + 0x00C00000)
|
#define KERNEL_VM_BASE (KERNEL_BASE + 0x00C00000)
|
||||||
|
@ -118,9 +111,6 @@ u_int cpu_reset_address = 0;
|
||||||
#define UND_STACK_SIZE 1
|
#define UND_STACK_SIZE 1
|
||||||
|
|
||||||
extern BootConfig bootconfig; /* Boot config storage */
|
extern BootConfig bootconfig; /* Boot config storage */
|
||||||
extern struct bootinfo *bootinfo, bootinfo_storage;
|
|
||||||
extern char booted_kernel_storage[80];
|
|
||||||
extern char *booted_kernel;
|
|
||||||
|
|
||||||
extern paddr_t physical_start;
|
extern paddr_t physical_start;
|
||||||
extern paddr_t physical_freestart;
|
extern paddr_t physical_freestart;
|
||||||
|
@ -134,9 +124,6 @@ extern pv_addr_t undstack;
|
||||||
extern pv_addr_t abtstack;
|
extern pv_addr_t abtstack;
|
||||||
extern pv_addr_t kernelstack;
|
extern pv_addr_t kernelstack;
|
||||||
|
|
||||||
extern char *boot_args;
|
|
||||||
extern char boot_file[16];
|
|
||||||
|
|
||||||
extern vaddr_t msgbufphys;
|
extern vaddr_t msgbufphys;
|
||||||
|
|
||||||
extern u_int data_abort_handler_address;
|
extern u_int data_abort_handler_address;
|
||||||
|
@ -174,7 +161,7 @@ void prefetch_abort_handler(trapframe_t *);
|
||||||
void undefinedinstruction_bounce(trapframe_t *);
|
void undefinedinstruction_bounce(trapframe_t *);
|
||||||
u_int cpu_get_control(void);
|
u_int cpu_get_control(void);
|
||||||
|
|
||||||
u_int initarm(int, char **, struct bootinfo *);
|
u_int init_sa11x0(int, char **, struct bootinfo *);
|
||||||
|
|
||||||
#ifdef BOOT_DUMP
|
#ifdef BOOT_DUMP
|
||||||
void dumppages(char *, int);
|
void dumppages(char *, int);
|
||||||
|
@ -208,84 +195,24 @@ static const struct pmap_devmap sa11x0_devmap[] = {
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Initial entry point on startup. This gets called before main() is
|
|
||||||
* entered.
|
|
||||||
* It should be responsible for setting up everything that must be
|
* It should be responsible for setting up everything that must be
|
||||||
* in place when main is called.
|
* in place when main is called.
|
||||||
* This includes:
|
* This includes:
|
||||||
* Taking a copy of the boot configuration structure.
|
|
||||||
* Initializing the physical console so characters can be printed.
|
* Initializing the physical console so characters can be printed.
|
||||||
* Setting up page tables for the kernel.
|
* Setting up page tables for the kernel.
|
||||||
*/
|
*/
|
||||||
u_int
|
u_int
|
||||||
initarm(int argc, char **argv, struct bootinfo *bi)
|
init_sa11x0(int argc, char **argv, struct bootinfo *bi)
|
||||||
{
|
{
|
||||||
u_int kerneldatasize, symbolsize;
|
u_int kerneldatasize, symbolsize;
|
||||||
u_int l1pagetable;
|
u_int l1pagetable;
|
||||||
vaddr_t freemempos;
|
vaddr_t freemempos;
|
||||||
vsize_t pt_size;
|
vsize_t pt_size;
|
||||||
int loop, i;
|
int loop;
|
||||||
#if NKSYMS || defined(DDB) || defined(MODULAR)
|
#if NKSYMS || defined(DDB) || defined(MODULAR)
|
||||||
Elf_Shdr *sh;
|
Elf_Shdr *sh;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
__sleep_func = NULL;
|
|
||||||
__sleep_ctx = NULL;
|
|
||||||
|
|
||||||
/* parse kernel args */
|
|
||||||
boothowto = 0;
|
|
||||||
boot_file[0] = '\0';
|
|
||||||
strncpy(booted_kernel_storage, argv[0], sizeof(booted_kernel_storage));
|
|
||||||
for (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 */
|
|
||||||
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
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Heads up ... Setup the CPU / MMU / TLB functions.
|
|
||||||
*/
|
|
||||||
set_cpufuncs();
|
|
||||||
IRQdisable;
|
|
||||||
|
|
||||||
#ifdef DEBUG_BEFOREMMU
|
#ifdef DEBUG_BEFOREMMU
|
||||||
/*
|
/*
|
||||||
* At this point, we cannot call real consinit().
|
* At this point, we cannot call real consinit().
|
||||||
|
|
|
@ -0,0 +1,50 @@
|
||||||
|
/* $NetBSD: kloader.h,v 1.1 2012/03/31 14:02:54 nonaka Exp $ */
|
||||||
|
|
||||||
|
/*-
|
||||||
|
* Copyright (c) 2002, 2004 The NetBSD Foundation, Inc.
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* 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.
|
||||||
|
* 3. All advertising materials mentioning features or use of this software
|
||||||
|
* must display the following acknowledgement:
|
||||||
|
* This product includes software developed by the NetBSD
|
||||||
|
* Foundation, Inc. and its contributors.
|
||||||
|
* 4. Neither the name of The NetBSD Foundation nor the names of its
|
||||||
|
* contributors may be used to endorse or promote products derived
|
||||||
|
* from this software without specific prior written permission.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
|
||||||
|
* ``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 THE FOUNDATION OR CONTRIBUTORS
|
||||||
|
* 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 _HPCARM_KLOADER_H_
|
||||||
|
#define _HPCARM_KLOADER_H_
|
||||||
|
|
||||||
|
#include <sys/lock.h>
|
||||||
|
|
||||||
|
#include <uvm/uvm.h>
|
||||||
|
|
||||||
|
#include <machine/pmap.h>
|
||||||
|
|
||||||
|
#define PG_VADDR(pg) kloader_phystov(VM_PAGE_TO_PHYS(pg))
|
||||||
|
vaddr_t kloader_phystov(paddr_t pa);
|
||||||
|
|
||||||
|
#include <dev/kloader.h>
|
||||||
|
|
||||||
|
#endif /* _HPCARM_KLOADER_H_ */
|
Loading…
Reference in New Issue