Module Name:    src
Committed By:   tsutsui
Date:           Mon May  3 12:16:04 UTC 2010

Modified Files:
        src/sys/arch/hpcsh/conf: files.hpcsh
        src/sys/arch/hpcsh/hpcsh: machdep.c

Log Message:
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).


To generate a diff of this commit:
cvs rdiff -u -r1.51 -r1.52 src/sys/arch/hpcsh/conf/files.hpcsh
cvs rdiff -u -r1.72 -r1.73 src/sys/arch/hpcsh/hpcsh/machdep.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/hpcsh/conf/files.hpcsh
diff -u src/sys/arch/hpcsh/conf/files.hpcsh:1.51 src/sys/arch/hpcsh/conf/files.hpcsh:1.52
--- src/sys/arch/hpcsh/conf/files.hpcsh:1.51	Wed Feb 20 21:43:34 2008
+++ src/sys/arch/hpcsh/conf/files.hpcsh	Mon May  3 12:16:04 2010
@@ -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_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"

Index: src/sys/arch/hpcsh/hpcsh/machdep.c
diff -u src/sys/arch/hpcsh/hpcsh/machdep.c:1.72 src/sys/arch/hpcsh/hpcsh/machdep.c:1.73
--- src/sys/arch/hpcsh/hpcsh/machdep.c:1.72	Tue Mar  2 21:17:31 2010
+++ src/sys/arch/hpcsh/hpcsh/machdep.c	Mon May  3 12:16:04 2010
@@ -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 @@
 #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 @@
 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 @@
 	}
 
 #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 @@
 	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();

Reply via email to