Sync kloader(4) behavior with hpcmips:

- use bootstr passed via reboot(2) with RB_STRING for the next kernel path
- prepare independent opt_kloader_kernel_path.h for KLOADER_KERNEL_PATH
- some cosmetics to reduce diffs from hpcmips

Tested on HPW-50PA (Hitachi PERSONA).
This commit is contained in:
tsutsui 2010-05-03 12:16:04 +00:00
parent 17b7c13057
commit 3f23c95545
2 changed files with 23 additions and 17 deletions

View File

@ -1,4 +1,4 @@
# $NetBSD: files.hpcsh,v 1.51 2008/02/20 21:43:34 drochner Exp $
# $NetBSD: files.hpcsh,v 1.52 2010/05/03 12:16:04 tsutsui Exp $
#
maxpartitions 8
@ -16,11 +16,11 @@ file arch/hpcsh/hpcsh/bus_space.c
#file arch/hpcsh/hpcsh/bus_dma.c
file arch/hpcsh/hpcsh/clock_machdep.c
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/hpcsh/hpcsh/kloader_machdep.c kloader
defflag opt_kloader.h KLOADER
defflag debug_kloader.h KLOADER_DEBUG
defparam opt_kloader_kernel_path.h KLOADER_KERNEL_PATH
# power management
include "dev/hpc/files.hpcapm"

View File

@ -1,4 +1,4 @@
/* $NetBSD: machdep.c,v 1.72 2010/03/02 21:17:31 pooka Exp $ */
/* $NetBSD: machdep.c,v 1.73 2010/05/03 12:16:04 tsutsui Exp $ */
/*-
* Copyright (c) 2001, 2002, 2004 The NetBSD Foundation, Inc.
@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.72 2010/03/02 21:17:31 pooka Exp $");
__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.73 2010/05/03 12:16:04 tsutsui Exp $");
#include "opt_md.h"
#include "opt_ddb.h"
@ -38,11 +38,7 @@ __KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.72 2010/03/02 21:17:31 pooka Exp $");
#include "hd64465if.h"
#include "opt_kloader.h"
#ifdef KLOADER
#if !defined(KLOADER_KERNEL_PATH)
#define KLOADER_KERNEL_PATH "/netbsd"
#endif
#endif
#include "opt_kloader_kernel_path.h"
#include <sys/param.h>
#include <sys/systm.h>
@ -169,6 +165,12 @@ extern void main(void) __attribute__((__noreturn__));
void machine_startup(int, char *[], struct bootinfo *)
__attribute__((__noreturn__));
#ifdef KLOADER
#if !defined(KLOADER_KERNEL_PATH)
#define KLOADER_KERNEL_PATH "/netbsd"
#endif /* !KLOADER_KERNEL_PATH */
static const char kernel_path[] = KLOADER_KERNEL_PATH;
#endif /* KLOADER */
void
machine_startup(int argc, char *argv[], struct bootinfo *bi)
@ -377,8 +379,12 @@ cpu_reboot(int howto, char *bootstr)
}
#ifdef KLOADER
if ((howto & RB_HALT) == 0)
kloader_reboot_setup(KLOADER_KERNEL_PATH);
if ((howto & RB_HALT) == 0) {
if ((howto & RB_STRING) != 0)
kloader_reboot_setup(bootstr);
else
kloader_reboot_setup(kernel_path);
}
#endif
boothowto = howto;
@ -411,14 +417,14 @@ cpu_reboot(int howto, char *bootstr)
pmf_system_shutdown(boothowto);
/* Finally, halt/reboot the system. */
if ((howto & RB_HALT) != 0) {
printf("halted.\n");
} else {
#ifdef KLOADER
if ((howto & RB_HALT) == 0) {
kloader_reboot();
/* NOTREACHED */
}
#endif
printf("halted.\n");
}
#if NHD64465IF > 0
hd64465_shutdown();