From f952e34eb4f9b90dd167ea83f902d16ad2411c49 Mon Sep 17 00:00:00 2001 From: tsutsui Date: Sat, 28 Jul 2012 17:33:53 +0000 Subject: [PATCH] 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. --- sys/arch/luna68k/luna68k/locore.s | 26 ++++++++++++++++++-------- sys/arch/luna68k/luna68k/machdep.c | 12 +++++++----- 2 files changed, 25 insertions(+), 13 deletions(-) diff --git a/sys/arch/luna68k/luna68k/locore.s b/sys/arch/luna68k/luna68k/locore.s index 1fbbcfcc856c..22fc14536d63 100644 --- a/sys/arch/luna68k/luna68k/locore.s +++ b/sys/arch/luna68k/luna68k/locore.s @@ -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) @@ -168,6 +161,23 @@ Lstart0: RELOC(fputype,%a0) 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: diff --git a/sys/arch/luna68k/luna68k/machdep.c b/sys/arch/luna68k/luna68k/machdep.c index a10477f1a111..98f090e7d75c 100644 --- a/sys/arch/luna68k/luna68k/machdep.c +++ b/sys/arch/luna68k/luna68k/machdep.c @@ -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 /* 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: * " ENADDR= HOST= SERVER=" * where is MAC address of which network loader used (not * necessarily same as one at 0x4101.FFE0), and - * are the values of HOST and SERVER environment variables, + * are the values of HOST and SERVER environment variables. + * + * 'bootarg' on LUNA-II has "" 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;