Module Name:    src
Committed By:   tsutsui
Date:           Sat Jul 28 17:33:53 UTC 2012

Modified Files:
        src/sys/arch/luna68k/luna68k: locore.s machdep.c

Log Message:
Handle bootarg strings passed from firmware prompt properly on LUNA-II.
LUNA-II seems to use a different vector from LUNA to pass bootargs.

Now we can specify RB_ASKNAME and RB_SINGLE at boot on LUNA-II.

Should be pulled up to netbsd-6.


To generate a diff of this commit:
cvs rdiff -u -r1.48 -r1.49 src/sys/arch/luna68k/luna68k/locore.s
cvs rdiff -u -r1.90 -r1.91 src/sys/arch/luna68k/luna68k/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/luna68k/luna68k/locore.s
diff -u src/sys/arch/luna68k/luna68k/locore.s:1.48 src/sys/arch/luna68k/luna68k/locore.s:1.49
--- src/sys/arch/luna68k/luna68k/locore.s:1.48	Mon Jul 23 15:10:17 2012
+++ src/sys/arch/luna68k/luna68k/locore.s	Sat Jul 28 17:33:53 2012
@@ -1,4 +1,4 @@
-/* $NetBSD: locore.s,v 1.48 2012/07/23 15:10:17 tsutsui Exp $ */
+/* $NetBSD: locore.s,v 1.49 2012/07/28 17:33:53 tsutsui Exp $ */
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -136,13 +136,6 @@ ASENTRY_NOPROFILE(start)
 	RELOC(hwplanemask,%a0)
 	movl	%d5,%a0@		| save hwplanemask
 
-	movl	#0x41000000,%a0		| argument of 'x' command on boot
-	movl	%a0@(212),%a0		| (char *)base[53]
-	RELOC(bootarg,%a1)
-	movl	#63,%d0
-1:	movb	%a0@+,%a1@+		| copy to bootarg
-	dbra	%d0,1b			| upto 63 characters
-
 	movl	#CACHE_OFF,%d0
 	movc	%d0,%cacr		| clear and disable on-chip cache(s)
 
@@ -169,6 +162,23 @@ Lstart0:
 	movl	%d2,%a0@
 
 	/*
+	 * save argument of 'x' command on boot per machine type
+	 * XXX: assume CPU_68040 is LUNA-II
+	 */
+	movl	#0x41000000,%a0
+	cmpl	#CPU_68040,%d0		| 68040?
+	jne	1f			| no, assume 68030 LUNA
+	movl	%a0@(8),%a0		| arg at (char *)base[2] on LUNA-II
+	jra	Lstart1
+1:
+	movl	%a0@(212),%a0		| arg at (char *)base[53] on LUNA
+Lstart1:
+	RELOC(bootarg,%a1)
+	movl	#63,%d0
+1:	movb	%a0@+,%a1@+		| copy to bootarg
+	dbra	%d0,1b			| upto 63 characters
+
+	/*
 	 * Now that we know what CPU we have, initialize the address error
 	 * and bus error handlers in the vector table:
 	 *

Index: src/sys/arch/luna68k/luna68k/machdep.c
diff -u src/sys/arch/luna68k/luna68k/machdep.c:1.90 src/sys/arch/luna68k/luna68k/machdep.c:1.91
--- src/sys/arch/luna68k/luna68k/machdep.c:1.90	Fri Jul 27 05:36:10 2012
+++ src/sys/arch/luna68k/luna68k/machdep.c	Sat Jul 28 17:33:53 2012
@@ -1,4 +1,4 @@
-/* $NetBSD: machdep.c,v 1.90 2012/07/27 05:36:10 matt Exp $ */
+/* $NetBSD: machdep.c,v 1.91 2012/07/28 17:33:53 tsutsui Exp $ */
 
 /*-
  * Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 #include <sys/cdefs.h>			/* RCS ID & Copyright macro defns */
 
-__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.90 2012/07/27 05:36:10 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.91 2012/07/28 17:33:53 tsutsui Exp $");
 
 #include "opt_ddb.h"
 #include "opt_kgdb.h"
@@ -183,15 +183,17 @@ luna68k_init(void)
 	boothowto = 0;
 	i = 0;
 	/*
-	 * 'bootarg' has;
+	 * 'bootarg' on LUNA has:
 	 *   "<args of x command> ENADDR=<addr> HOST=<host> SERVER=<name>"
 	 * where <addr> is MAC address of which network loader used (not
 	 * necessarily same as one at 0x4101.FFE0), <host> and <name>
-	 * are the values of HOST and SERVER environment variables,
+	 * are the values of HOST and SERVER environment variables.
+	 *
+	 * 'bootarg' on LUNA-II has "<args of x command>" only.
 	 *
 	 * NetBSD/luna68k cares only the first argment; any of "sda".
 	 */
-	for (cp = bootarg; *cp != ' '; cp++) {
+	for (cp = bootarg; *cp != ' ' && *cp != 0; cp++) {
 		BOOT_FLAG(*cp, boothowto);
 		if (i++ >= sizeof(bootarg))
 			break;

Reply via email to