Mon Jan 21 11:58:12 2013 UTC ()
Add support for "await key" to abort autoboot and get boot menu.
Also add command help.  Bump version.


(tsutsui)
diff -r1.7 -r1.8 src/sys/arch/luna68k/stand/boot/Makefile
diff -r1.7 -r1.8 src/sys/arch/luna68k/stand/boot/locore.S
diff -r1.7 -r1.8 src/sys/arch/luna68k/stand/boot/samachdep.h
diff -r0 -r1.1 src/sys/arch/luna68k/stand/boot/awaitkey.c
diff -r1.3 -r1.4 src/sys/arch/luna68k/stand/boot/bmc.c
diff -r1.1 -r1.2 src/sys/arch/luna68k/stand/boot/boot.c
diff -r1.1 -r1.2 src/sys/arch/luna68k/stand/boot/prf.c
diff -r1.4 -r1.5 src/sys/arch/luna68k/stand/boot/init_main.c
diff -r1.4 -r1.5 src/sys/arch/luna68k/stand/boot/version
diff -r1.2 -r1.3 src/sys/arch/luna68k/stand/boot/parse.c
diff -r1.2 -r1.3 src/sys/arch/luna68k/stand/boot/sio.c

cvs diff -r1.7 -r1.8 src/sys/arch/luna68k/stand/boot/Makefile (expand / switch to unified diff)

--- src/sys/arch/luna68k/stand/boot/Makefile 2013/01/20 02:35:13 1.7
+++ src/sys/arch/luna68k/stand/boot/Makefile 2013/01/21 11:58:12 1.8
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1# $NetBSD: Makefile,v 1.7 2013/01/20 02:35:13 tsutsui Exp $ 1# $NetBSD: Makefile,v 1.8 2013/01/21 11:58:12 tsutsui Exp $
2# @(#)Makefile 8.2 (Berkeley) 8/15/93 2# @(#)Makefile 8.2 (Berkeley) 8/15/93
3 3
4NOMAN= # defined 4NOMAN= # defined
5 5
6.include <bsd.own.mk> 6.include <bsd.own.mk>
7.include <bsd.sys.mk> 7.include <bsd.sys.mk>
8 8
9S= ${.CURDIR}/../../../.. 9S= ${.CURDIR}/../../../..
10LIBSADIR= ${S}/lib/libsa 10LIBSADIR= ${S}/lib/libsa
11 11
12CPPFLAGS+= -nostdinc -D_STANDALONE 12CPPFLAGS+= -nostdinc -D_STANDALONE
13CPPFLAGS+= -I${.CURDIR} -I${.OBJDIR} -I${S} -I${S}/arch 13CPPFLAGS+= -I${.CURDIR} -I${.OBJDIR} -I${S} -I${S}/arch
14 14
@@ -29,27 +29,27 @@ CFLAGS+= -Wno-pointer-sign @@ -29,27 +29,27 @@ CFLAGS+= -Wno-pointer-sign
29 29
30TEXTADDR= 700000 30TEXTADDR= 700000
31LDSCRIPT= ${.CURDIR}/boot.ldscript 31LDSCRIPT= ${.CURDIR}/boot.ldscript
32LINKFORMAT= -static -N -Ttext ${TEXTADDR} -T ${LDSCRIPT} 32LINKFORMAT= -static -N -Ttext ${TEXTADDR} -T ${LDSCRIPT}
33 33
34SRCS= locore.S 34SRCS= locore.S
35SRCS+= init_main.c autoconf.c ioconf.c 35SRCS+= init_main.c autoconf.c ioconf.c
36SRCS+= trap.c 36SRCS+= trap.c
37SRCS+= devopen.c 37SRCS+= devopen.c
38SRCS+= conf.c 38SRCS+= conf.c
39SRCS+= machdep.c 39SRCS+= machdep.c
40SRCS+= getline.c parse.c  40SRCS+= getline.c parse.c
41SRCS+= boot.c 41SRCS+= boot.c
42SRCS+= cons.c prf.c 42SRCS+= cons.c prf.c awaitkey.c
43SRCS+= romcons.c 43SRCS+= romcons.c
44SRCS+= sio.c 44SRCS+= sio.c
45SRCS+= bmc.c bmd.c screen.c font.c kbd.c 45SRCS+= bmc.c bmd.c screen.c font.c kbd.c
46SRCS+= scsi.c sc.c sd.c 46SRCS+= scsi.c sc.c sd.c
47#SRCS+= st.c tape.c 47#SRCS+= st.c tape.c
48SRCS+= disklabel.c 48SRCS+= disklabel.c
49#SRCS+= fsdump.c 49#SRCS+= fsdump.c
50SRCS+= ufs_disksubr.c 50SRCS+= ufs_disksubr.c
51SRCS+= ls.c 51SRCS+= ls.c
52 52
53# netboot support 53# netboot support
54SRCS+= if_le.c lance.c getsecs.c 54SRCS+= if_le.c lance.c getsecs.c
55.PATH: ${LIBSADIR} 55.PATH: ${LIBSADIR}

cvs diff -r1.7 -r1.8 src/sys/arch/luna68k/stand/boot/locore.S (expand / switch to unified diff)

--- src/sys/arch/luna68k/stand/boot/locore.S 2013/01/20 03:40:55 1.7
+++ src/sys/arch/luna68k/stand/boot/locore.S 2013/01/21 11:58:12 1.8
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: locore.S,v 1.7 2013/01/20 03:40:55 tsutsui Exp $ */ 1/* $NetBSD: locore.S,v 1.8 2013/01/21 11:58:12 tsutsui Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 1992 OMRON Corporation. 4 * Copyright (c) 1992 OMRON Corporation.
5 * 5 *
6 * This code is derived from software contributed to Berkeley by 6 * This code is derived from software contributed to Berkeley by
7 * OMRON Corporation. 7 * OMRON Corporation.
8 * 8 *
9 * Redistribution and use in source and binary forms, with or without 9 * Redistribution and use in source and binary forms, with or without
10 * modification, are permitted provided that the following conditions 10 * modification, are permitted provided that the following conditions
11 * are met: 11 * are met:
12 * 1. Redistributions of source code must retain the above copyright 12 * 1. Redistributions of source code must retain the above copyright
13 * notice, this list of conditions and the following disclaimer. 13 * notice, this list of conditions and the following disclaimer.
14 * 2. Redistributions in binary form must reproduce the above copyright 14 * 2. Redistributions in binary form must reproduce the above copyright
@@ -525,29 +525,33 @@ ENTRY_NOPROFILE(lev3intr) @@ -525,29 +525,33 @@ ENTRY_NOPROFILE(lev3intr)
525ENTRY_NOPROFILE(lev5intr) 525ENTRY_NOPROFILE(lev5intr)
526 clrw %sp@- | push pad word 526 clrw %sp@- | push pad word
527 moveml #0xC0C0,%sp@- | save scratch regs 527 moveml #0xC0C0,%sp@- | save scratch regs
528 movl #CLOCK_REG,%a0 | get clock CR addr 528 movl #CLOCK_REG,%a0 | get clock CR addr
529 movb #CLK_CLR,%a0@ | reset system clock 529 movb #CLK_CLR,%a0@ | reset system clock
530 lea %sp@(16),%a1 | get pointer to PS 530 lea %sp@(16),%a1 | get pointer to PS
531 movl %a1@,%sp@- | push padded PS 531 movl %a1@,%sp@- | push padded PS
532 movl %a1@(4),%sp@- | push PC 532 movl %a1@(4),%sp@- | push PC
533 jbsr _C_LABEL(hardclock) | call generic clock int routine 533 jbsr _C_LABEL(hardclock) | call generic clock int routine
534 addql #8,%sp | pop params 534 addql #8,%sp | pop params
535 moveml %sp@+,#0x0303 | restore scratch regs 535 moveml %sp@+,#0x0303 | restore scratch regs
536 addql #2,%sp | pop pad word 536 addql #2,%sp | pop pad word
537 jra _ASM_LABEL(rei) | all done 537 jra _ASM_LABEL(rei) | all done
 538
538ENTRY_NOPROFILE(hardclock) 539ENTRY_NOPROFILE(hardclock)
 540 addql #1,_C_LABEL(tick)
539 rts 541 rts
540 542
 543BSS(tick,4)
 544
541ENTRY_NOPROFILE(lev6intr) 545ENTRY_NOPROFILE(lev6intr)
542 clrw %sp@- 546 clrw %sp@-
543 moveml #0xC0C0,%sp@- 547 moveml #0xC0C0,%sp@-
544 jbsr _C_LABEL(_siointr) 548 jbsr _C_LABEL(_siointr)
545 moveml %sp@+,#0x0303 549 moveml %sp@+,#0x0303
546 addql #2,%sp 550 addql #2,%sp
547 jra _ASM_LABEL(rei) 551 jra _ASM_LABEL(rei)
548 552
549 553
550/* 554/*
551 * Emulation of VAX REI instruction. 555 * Emulation of VAX REI instruction.
552 * 556 *
553 * This code deals with checking for and servicing ASTs 557 * This code deals with checking for and servicing ASTs

cvs diff -r1.7 -r1.8 src/sys/arch/luna68k/stand/boot/samachdep.h (expand / switch to unified diff)

--- src/sys/arch/luna68k/stand/boot/samachdep.h 2013/01/20 14:03:40 1.7
+++ src/sys/arch/luna68k/stand/boot/samachdep.h 2013/01/21 11:58:12 1.8
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: samachdep.h,v 1.7 2013/01/20 14:03:40 tsutsui Exp $ */ 1/* $NetBSD: samachdep.h,v 1.8 2013/01/21 11:58:12 tsutsui Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 1982, 1990, 1993 4 * Copyright (c) 1982, 1990, 1993
5 * The Regents of the University of California. All rights reserved. 5 * The Regents of the University of California. All rights reserved.
6 * 6 *
7 * Redistribution and use in source and binary forms, with or without 7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions 8 * modification, are permitted provided that the following conditions
9 * are met: 9 * are met:
10 * 1. Redistributions of source code must retain the above copyright 10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer. 11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright 12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the 13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution. 14 * documentation and/or other materials provided with the distribution.
@@ -44,30 +44,32 @@ @@ -44,30 +44,32 @@
44#define MHZ_25 3 44#define MHZ_25 3
45#define MHZ_33 4 45#define MHZ_33 4
46#define MHZ_50 6 46#define MHZ_50 6
47 47
48#define MAXDEVNAME 16 48#define MAXDEVNAME 16
49 49
50struct consdev; 50struct consdev;
51struct frame; 51struct frame;
52typedef struct label_t { 52typedef struct label_t {
53 int val[15]; 53 int val[15];
54} label_t; 54} label_t;
55 55
56/* autoconf.c */ 56/* autoconf.c */
57extern int cpuspeed; 
58void configure(void); 57void configure(void);
59void find_devs(void); 58void find_devs(void);
60 59
 60/* awaitkey.c */
 61char awaitkey(const char *, int, bool);
 62
61/* bmc.c */ 63/* bmc.c */
62void bmccnprobe(struct consdev *); 64void bmccnprobe(struct consdev *);
63void bmccninit(struct consdev *); 65void bmccninit(struct consdev *);
64int bmccngetc(dev_t); 66int bmccngetc(dev_t);
65void bmccnputc(dev_t, int); 67void bmccnputc(dev_t, int);
66 68
67/* bmd.c */ 69/* bmd.c */
68void bmdinit(void); 70void bmdinit(void);
69int bmdputc(int); 71int bmdputc(int);
70void bmdadjust(short, short); 72void bmdadjust(short, short);
71void bmdclear(void); 73void bmdclear(void);
72 74
73/* boot.c */ 75/* boot.c */
@@ -100,72 +102,73 @@ void exec_hp300(char *, u_long, int); @@ -100,72 +102,73 @@ void exec_hp300(char *, u_long, int);
100extern u_short bmdfont[][20]; 102extern u_short bmdfont[][20];
101 103
102/* fsdump.c */ 104/* fsdump.c */
103int fsdump(int, char **); 105int fsdump(int, char **);
104int fsrestore(int, char **); 106int fsrestore(int, char **);
105 107
106/* getline.c */ 108/* getline.c */
107int getline(char *, char *); 109int getline(char *, char *);
108 110
109/* if_le.c */ 111/* if_le.c */
110int leinit(void *); 112int leinit(void *);
111 113
112/* init_main.c */ 114/* init_main.c */
 115extern int cpuspeed;
 116extern int hz;
113extern int nplane; 117extern int nplane;
114extern int machtype; 118extern int machtype;
115 119
116/* kbd.c */ 120/* kbd.c */
117int kbd_decode(u_char); 121int kbd_decode(u_char);
118 122
119/* lance.c */ 123/* lance.c */
120void *lance_attach(int, void *, void *, uint8_t *); 124void *lance_attach(int, void *, void *, uint8_t *);
121void *lance_cookie(int); 125void *lance_cookie(int);
122uint8_t *lance_eaddr(void *); 126uint8_t *lance_eaddr(void *);
123bool lance_init(void *); 127bool lance_init(void *);
124int lance_get(void *, void *, size_t); 128int lance_get(void *, void *, size_t);
125bool lance_put(void *, void *, size_t); 129bool lance_put(void *, void *, size_t);
126bool lance_end(void *);  130bool lance_end(void *);
127int lance_intr(void); 131int lance_intr(void);
128 132
129/* locore.S */ 133/* locore.S */
130extern u_int bootdev; 134extern u_int bootdev;
131extern int dipsw1, dipsw2; 135extern int dipsw1, dipsw2;
132extern int cputype; 136extern int cputype;
 137extern volatile uint32_t tick;
133int setjmp(label_t *); 138int setjmp(label_t *);
134int splhigh(void); 139int splhigh(void);
135void splx(int); 140void splx(int);
136int getsfc(void); 141int getsfc(void);
137int getdfc(void); 142int getdfc(void);
138int spl0(void); 143int spl0(void);
139int spl1(void); 144int spl1(void);
140int spl2(void); 145int spl2(void);
141int spl3(void); 146int spl3(void);
142int spl4(void); 147int spl4(void);
143int spl5(void); 148int spl5(void);
144int spl6(void); 149int spl6(void);
145 150
146/* ls.c */ 151/* ls.c */
147int cmd_ls(int, char **); 152int cmd_ls(int, char **);
148 153
149/* machdep.c */ 154/* machdep.c */
150void straytrap(int); 155void straytrap(int);
151int badaddr(volatile void *); 156int badaddr(volatile void *);
152void regdump(int *, int); 157void regdump(int *, int);
153char *hexstr(int, int); 158char *hexstr(int, int);
154 159
155/* prf.c */ 160/* prf.c */
156#if 0 
157int tgetchar(void); 161int tgetchar(void);
158#endif 
159 162
160/* parse.c */ 163/* parse.c */
161int check_args(int, char **); 164int check_args(int, char **);
162int exit_program(int, char **); 165int exit_program(int, char **);
163int parse(int, char **); 166int parse(int, char **);
164int getargs(char *, char **, int); 167int getargs(char *, char **, int);
165 168
166/* romcons.c */ 169/* romcons.c */
167void romcnprobe(struct consdev *); 170void romcnprobe(struct consdev *);
168void romcninit(struct consdev *); 171void romcninit(struct consdev *);
169int romcngetc(dev_t); 172int romcngetc(dev_t);
170void romcnputc(dev_t, int); 173void romcnputc(dev_t, int);
171 174

File Added: src/sys/arch/luna68k/stand/boot/awaitkey.c
/*	$NetBSD: awaitkey.c,v 1.1 2013/01/21 11:58:12 tsutsui Exp $	*/

/*-
 * Copyright (c) 2013 Izumi Tsutsui.  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 <lib/libkern/libkern.h>
#include <luna68k/stand/boot/samachdep.h>

static void print_countdown(const char *, int);

#define FMTLEN	40

static void
print_countdown(const char *pfmt, int n)
{
	int len, i;
	char fmtbuf[FMTLEN];

	len = snprintf(fmtbuf, FMTLEN, pfmt, n);
	printf("%s", fmtbuf);
	for (i = 0; i < len; i++)
		putchar('\b');
}

/*
 * awaitkey(const char *pfmt, int timeout, bool tell)
 *
 * Wait timeout seconds until any input from stdin.
 * print countdown message using "pfmt" if tell is true.
 * Requires tgetchar(), which returns 0 if there is no input.
 */
char
awaitkey(const char *pfmt, int timeout, bool tell)
{
	uint32_t otick;
	char c = 0;

	if (timeout <= 0)
		goto out;

	if (tell)
		print_countdown(pfmt, timeout);

	otick = tick;

	for (;;) {
		c = tgetchar();
		if (c != 0)
			break;
		if (tick - otick >= hz) {
			otick = tick;
			if (--timeout == 0)
				break;
			if (tell)
				print_countdown(pfmt, timeout);
		}
	}

 out:
	if (tell) {
		printf(pfmt, 0);
		printf("\n");
	}
	return c;
}

cvs diff -r1.3 -r1.4 src/sys/arch/luna68k/stand/boot/bmc.c (expand / switch to unified diff)

--- src/sys/arch/luna68k/stand/boot/bmc.c 2013/01/20 14:03:40 1.3
+++ src/sys/arch/luna68k/stand/boot/bmc.c 2013/01/21 11:58:12 1.4
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: bmc.c,v 1.3 2013/01/20 14:03:40 tsutsui Exp $ */ 1/* $NetBSD: bmc.c,v 1.4 2013/01/21 11:58:12 tsutsui Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 1992 OMRON Corporation. 4 * Copyright (c) 1992 OMRON Corporation.
5 * 5 *
6 * This code is derived from software contributed to Berkeley by 6 * This code is derived from software contributed to Berkeley by
7 * OMRON Corporation. 7 * OMRON Corporation.
8 * 8 *
9 * Redistribution and use in source and binary forms, with or without 9 * Redistribution and use in source and binary forms, with or without
10 * modification, are permitted provided that the following conditions 10 * modification, are permitted provided that the following conditions
11 * are met: 11 * are met:
12 * 1. Redistributions of source code must retain the above copyright 12 * 1. Redistributions of source code must retain the above copyright
13 * notice, this list of conditions and the following disclaimer. 13 * notice, this list of conditions and the following disclaimer.
14 * 2. Redistributions in binary form must reproduce the above copyright 14 * 2. Redistributions in binary form must reproduce the above copyright
@@ -106,29 +106,28 @@ bmccnprobe(struct consdev *cp) @@ -106,29 +106,28 @@ bmccnprobe(struct consdev *cp)
106void 106void
107bmccninit(struct consdev *cp) 107bmccninit(struct consdev *cp)
108{ 108{
109 sioinit(); 109 sioinit();
110 bmdinit(); 110 bmdinit();
111} 111}
112 112
113int 113int
114bmccngetc(dev_t dev) 114bmccngetc(dev_t dev)
115{ 115{
116 int c; 116 int c;
117 int unit = 1; 117 int unit = 1;
118 118
119 while (RBUF_EMPTY(unit)) { 119 if (RBUF_EMPTY(unit))
120 DELAY(10); 120 return 0;
121 } 
122 121
123 POP_RBUF(unit, c); 122 POP_RBUF(unit, c);
124 123
125 return(c); 124 return(c);
126/* 125/*
127 return(siocngetc(dev)); 126 return(siocngetc(dev));
128 */ 127 */
129} 128}
130 129
131void 130void
132bmccnputc(dev_t dev, int c) 131bmccnputc(dev_t dev, int c)
133{ 132{
134 bmdputc(c); 133 bmdputc(c);

cvs diff -r1.1 -r1.2 src/sys/arch/luna68k/stand/boot/boot.c (expand / switch to unified diff)

--- src/sys/arch/luna68k/stand/boot/boot.c 2013/01/05 17:44:24 1.1
+++ src/sys/arch/luna68k/stand/boot/boot.c 2013/01/21 11:58:12 1.2
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: boot.c,v 1.1 2013/01/05 17:44:24 tsutsui Exp $ */ 1/* $NetBSD: boot.c,v 1.2 2013/01/21 11:58:12 tsutsui Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 1992 OMRON Corporation. 4 * Copyright (c) 1992 OMRON Corporation.
5 * 5 *
6 * This code is derived from software contributed to Berkeley by 6 * This code is derived from software contributed to Berkeley by
7 * OMRON Corporation. 7 * OMRON Corporation.
8 * 8 *
9 * Redistribution and use in source and binary forms, with or without 9 * Redistribution and use in source and binary forms, with or without
10 * modification, are permitted provided that the following conditions 10 * modification, are permitted provided that the following conditions
11 * are met: 11 * are met:
12 * 1. Redistributions of source code must retain the above copyright 12 * 1. Redistributions of source code must retain the above copyright
13 * notice, this list of conditions and the following disclaimer. 13 * notice, this list of conditions and the following disclaimer.
14 * 2. Redistributions in binary form must reproduce the above copyright 14 * 2. Redistributions in binary form must reproduce the above copyright
@@ -197,16 +197,17 @@ bootnetbsd(char *line) @@ -197,16 +197,17 @@ bootnetbsd(char *line)
197 printf("entry = 0x%lx\n", marks[MARK_ENTRY]); 197 printf("entry = 0x%lx\n", marks[MARK_ENTRY]);
198 printf("ssym = 0x%lx\n", marks[MARK_SYM]); 198 printf("ssym = 0x%lx\n", marks[MARK_SYM]);
199 printf("esym = 0x%lx\n", marks[MARK_END]); 199 printf("esym = 0x%lx\n", marks[MARK_END]);
200#endif 200#endif
201 201
202 /* 202 /*
203 * XXX TODO: fill bootinfo about symbols, boot device etc. 203 * XXX TODO: fill bootinfo about symbols, boot device etc.
204 */ 204 */
205 205
206 entry = (void *)marks[MARK_ENTRY]; 206 entry = (void *)marks[MARK_ENTRY];
207 207
208 (*entry)(); 208 (*entry)();
209 } 209 }
 210 printf("Booting kernel failed. (%s)\n", strerror(errno));
210 211
211 return ST_ERROR; 212 return ST_ERROR;
212} 213}

cvs diff -r1.1 -r1.2 src/sys/arch/luna68k/stand/boot/prf.c (expand / switch to unified diff)

--- src/sys/arch/luna68k/stand/boot/prf.c 2013/01/05 17:44:24 1.1
+++ src/sys/arch/luna68k/stand/boot/prf.c 2013/01/21 11:58:12 1.2
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: prf.c,v 1.1 2013/01/05 17:44:24 tsutsui Exp $ */ 1/* $NetBSD: prf.c,v 1.2 2013/01/21 11:58:12 tsutsui Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 1982, 1986, 1990, 1993 4 * Copyright (c) 1982, 1986, 1990, 1993
5 * The Regents of the University of California. All rights reserved. 5 * The Regents of the University of California. All rights reserved.
6 * 6 *
7 * Redistribution and use in source and binary forms, with or without 7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions 8 * modification, are permitted provided that the following conditions
9 * are met: 9 * are met:
10 * 1. Redistributions of source code must retain the above copyright 10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer. 11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright 12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the 13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution. 14 * documentation and/or other materials provided with the distribution.
@@ -40,39 +40,37 @@ getchar(void) @@ -40,39 +40,37 @@ getchar(void)
40 int c; 40 int c;
41 41
42 while ((c = cngetc()) == 0) 42 while ((c = cngetc()) == 0)
43 ; 43 ;
44 if (c == '\r') 44 if (c == '\r')
45 c = '\n'; 45 c = '\n';
46 else if (c == ('c'&037)) { 46 else if (c == ('c'&037)) {
47 panic("^C"); 47 panic("^C");
48 /* NOTREACHED */ 48 /* NOTREACHED */
49 } 49 }
50 return c; 50 return c;
51} 51}
52 52
53#if 0 
54int 53int
55tgetchar(void) 54tgetchar(void)
56{ 55{
57 int c; 56 int c;
58 57
59 if ((c = cnscan()) == -1) 58 if ((c = cngetc()) == 0)
60 return -1; 59 return 0;
61  60
62 if (c == '\r') 61 if (c == '\r')
63 c = '\n'; 62 c = '\n';
64 else if (c == ('c'&037)) { 63 else if (c == ('c'&037)) {
65 panic("^C"); 64 panic("^C");
66 /* NOTREACHED */ 65 /* NOTREACHED */
67 } 66 }
68 return c; 67 return c;
69} 68}
70#endif 
71 69
72void 70void
73putchar(int c) 71putchar(int c)
74{ 72{
75 cnputc(c); 73 cnputc(c);
76 if (c == '\n') 74 if (c == '\n')
77 cnputc('\r'); 75 cnputc('\r');
78} 76}

cvs diff -r1.4 -r1.5 src/sys/arch/luna68k/stand/boot/init_main.c (expand / switch to unified diff)

--- src/sys/arch/luna68k/stand/boot/init_main.c 2013/01/20 13:35:43 1.4
+++ src/sys/arch/luna68k/stand/boot/init_main.c 2013/01/21 11:58:12 1.5
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: init_main.c,v 1.4 2013/01/20 13:35:43 tsutsui Exp $ */ 1/* $NetBSD: init_main.c,v 1.5 2013/01/21 11:58:12 tsutsui Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 1992 OMRON Corporation. 4 * Copyright (c) 1992 OMRON Corporation.
5 * 5 *
6 * This code is derived from software contributed to Berkeley by 6 * This code is derived from software contributed to Berkeley by
7 * OMRON Corporation. 7 * OMRON Corporation.
8 * 8 *
9 * Redistribution and use in source and binary forms, with or without 9 * Redistribution and use in source and binary forms, with or without
10 * modification, are permitted provided that the following conditions 10 * modification, are permitted provided that the following conditions
11 * are met: 11 * are met:
12 * 1. Redistributions of source code must retain the above copyright 12 * 1. Redistributions of source code must retain the above copyright
13 * notice, this list of conditions and the following disclaimer. 13 * notice, this list of conditions and the following disclaimer.
14 * 2. Redistributions in binary form must reproduce the above copyright 14 * 2. Redistributions in binary form must reproduce the above copyright
@@ -75,66 +75,72 @@ @@ -75,66 +75,72 @@
75#include <luna68k/stand/boot/samachdep.h> 75#include <luna68k/stand/boot/samachdep.h>
76#include <luna68k/stand/boot/stinger.h> 76#include <luna68k/stand/boot/stinger.h>
77#include <luna68k/stand/boot/romvec.h> 77#include <luna68k/stand/boot/romvec.h>
78#include <luna68k/stand/boot/status.h> 78#include <luna68k/stand/boot/status.h>
79#include <lib/libsa/loadfile.h> 79#include <lib/libsa/loadfile.h>
80#ifdef SUPPORT_ETHERNET 80#ifdef SUPPORT_ETHERNET
81#include <lib/libsa/dev_net.h> 81#include <lib/libsa/dev_net.h>
82#endif 82#endif
83 83
84static int get_plane_numbers(void); 84static int get_plane_numbers(void);
85static int reorder_dipsw(int); 85static int reorder_dipsw(int);
86 86
87int cpuspeed; /* for DELAY() macro */ 87int cpuspeed; /* for DELAY() macro */
 88int hz = 60;
88int machtype; 89int machtype;
89 90
90#define VERS_LOCAL "Phase-31" 91#define VERS_LOCAL "Phase-31"
91 92
92int nplane; 93int nplane;
93 94
94/* KIFF */ 95/* KIFF */
95 96
96struct KernInter KIFF; 97struct KernInter KIFF;
97struct KernInter *kiff = &KIFF; 98struct KernInter *kiff = &KIFF;
98 99
99/* for command parser */ 100/* for command parser */
100 101
101#define BUFFSIZE 100 102#define BUFFSIZE 100
102#define MAXARGS 30 103#define MAXARGS 30
103 104
104char buffer[BUFFSIZE]; 105char buffer[BUFFSIZE];
105 106
106int argc; 107int argc;
107char *argv[MAXARGS]; 108char *argv[MAXARGS];
108 109
 110#define BOOT_TIMEOUT 10
 111int boot_timeout = BOOT_TIMEOUT;
 112
109char prompt[16] = "boot> "; 113char prompt[16] = "boot> ";
110 114
111void 115void
112main(void) 116main(void)
113{ 117{
114 int i, status = 0; 118 int i, status = 0;
115 const char *machstr; 119 const char *machstr;
116 120
117 /* 121 /*
118 * Initialize the console before we print anything out. 122 * Initialize the console before we print anything out.
119 */ 123 */
120 if (cputype == CPU_68030) { 124 if (cputype == CPU_68030) {
121 machtype = LUNA_I; 125 machtype = LUNA_I;
122 machstr = "LUNA-I"; 126 machstr = "LUNA-I";
123 cpuspeed = MHZ_25; 127 cpuspeed = MHZ_25;
 128 hz = 60;
124 } else { 129 } else {
125 machtype = LUNA_II; 130 machtype = LUNA_II;
126 machstr = "LUNA-II"; 131 machstr = "LUNA-II";
127 cpuspeed = MHZ_25 * 2; /* XXX */ 132 cpuspeed = MHZ_25 * 2; /* XXX */
 133 hz = 100;
128 } 134 }
129 135
130 nplane = get_plane_numbers(); 136 nplane = get_plane_numbers();
131 137
132 cninit(); 138 cninit();
133 139
134 printf("\n"); 140 printf("\n");
135 printf(">> %s, Revision %s\n", bootprog_name, bootprog_rev); 141 printf(">> %s, Revision %s\n", bootprog_name, bootprog_rev);
136 printf(">> (based on Stinger ver 0.0 [%s])\n", VERS_LOCAL); 142 printf(">> (based on Stinger ver 0.0 [%s])\n", VERS_LOCAL);
137 printf("\n"); 143 printf("\n");
138 144
139 kiff->maxaddr = (void *) (ROM_memsize -1); 145 kiff->maxaddr = (void *) (ROM_memsize -1);
140 kiff->dipsw = ~((dipsw2 << 8) | dipsw1) & 0xFFFF; 146 kiff->dipsw = ~((dipsw2 << 8) | dipsw1) & 0xFFFF;
@@ -152,34 +158,44 @@ main(void) @@ -152,34 +158,44 @@ main(void)
152 */ 158 */
153 159
154#ifdef SUPPORT_ETHERNET 160#ifdef SUPPORT_ETHERNET
155 try_bootp = 1; 161 try_bootp = 1;
156#endif 162#endif
157 163
158 find_devs(); 164 find_devs();
159 configure(); 165 configure();
160 printf("\n"); 166 printf("\n");
161 167
162 howto = reorder_dipsw(dipsw2); 168 howto = reorder_dipsw(dipsw2);
163 169
164 if ((howto & 0xFE) == 0) { 170 if ((howto & 0xFE) == 0) {
165 printf("auto-boot %s\n", default_file); 171 char c;
166 bootnetbsd(default_file); 172
 173 printf("Press return to boot now,"
 174 " any other key for boot menu\n");
 175 printf("booting %s - starting in ", default_file);
 176 c = awaitkey("%d seconds. ", boot_timeout, true);
 177 if (c == '\r' || c == '\n' || c == 0) {
 178 printf("auto-boot %s\n", default_file);
 179 bootnetbsd(default_file);
 180 }
167 } 181 }
168 182
169 /* 183 /*
170 * Main Loop 184 * Main Loop
171 */ 185 */
172 186
 187 printf("type \"help\" for help.\n");
 188
173 do { 189 do {
174 memset(buffer, 0, BUFFSIZE); 190 memset(buffer, 0, BUFFSIZE);
175 if (getline(prompt, buffer) > 0) { 191 if (getline(prompt, buffer) > 0) {
176 argc = getargs(buffer, argv, sizeof(argv)/sizeof(char *)); 192 argc = getargs(buffer, argv, sizeof(argv)/sizeof(char *));
177 193
178 status = parse(argc, argv); 194 status = parse(argc, argv);
179 if (status == ST_NOTFOUND) 195 if (status == ST_NOTFOUND)
180 printf("Command \"%s\" is not found !!\n", argv[0]); 196 printf("Command \"%s\" is not found !!\n", argv[0]);
181 } 197 }
182 } while(status != ST_EXIT); 198 } while(status != ST_EXIT);
183 199
184 exit(0); 200 exit(0);
185} 201}

cvs diff -r1.4 -r1.5 src/sys/arch/luna68k/stand/boot/version (expand / switch to unified diff)

--- src/sys/arch/luna68k/stand/boot/version 2013/01/16 15:46:20 1.4
+++ src/sys/arch/luna68k/stand/boot/version 2013/01/21 11:58:12 1.5
@@ -1,10 +1,11 @@ @@ -1,10 +1,11 @@
1$NetBSD: version,v 1.4 2013/01/16 15:46:20 tsutsui Exp $ 1$NetBSD: version,v 1.5 2013/01/21 11:58:12 tsutsui Exp $
2 2
3NOTE ANY CHANGES YOU MAKE TO THE BOOTBLOCKS HERE. The format of this 3NOTE ANY CHANGES YOU MAKE TO THE BOOTBLOCKS HERE. The format of this
4file is important - make sure the entries are appended on end, last item 4file is important - make sure the entries are appended on end, last item
5is taken as the current. 5is taken as the current.
6 6
71.0: Initial revision, based on 4.4BSD-Lite2/luna68k and NetBSD/hp300 71.0: Initial revision, based on 4.4BSD-Lite2/luna68k and NetBSD/hp300
81.1: Add netboot support. 81.1: Add netboot support.
91.2: Add support for secondary SPC SCSI on LUNA-II. 91.2: Add support for secondary SPC SCSI on LUNA-II.
101.3: Add UFS2 support. 101.3: Add UFS2 support.
 111.4: Add support for "awaiting key" to abort autoboot and get boot menu.

cvs diff -r1.2 -r1.3 src/sys/arch/luna68k/stand/boot/parse.c (expand / switch to unified diff)

--- src/sys/arch/luna68k/stand/boot/parse.c 2013/01/16 15:15:01 1.2
+++ src/sys/arch/luna68k/stand/boot/parse.c 2013/01/21 11:58:12 1.3
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: parse.c,v 1.2 2013/01/16 15:15:01 tsutsui Exp $ */ 1/* $NetBSD: parse.c,v 1.3 2013/01/21 11:58:12 tsutsui Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 1992 OMRON Corporation. 4 * Copyright (c) 1992 OMRON Corporation.
5 * 5 *
6 * This code is derived from software contributed to Berkeley by 6 * This code is derived from software contributed to Berkeley by
7 * OMRON Corporation. 7 * OMRON Corporation.
8 * 8 *
9 * Redistribution and use in source and binary forms, with or without 9 * Redistribution and use in source and binary forms, with or without
10 * modification, are permitted provided that the following conditions 10 * modification, are permitted provided that the following conditions
11 * are met: 11 * are met:
12 * 1. Redistributions of source code must retain the above copyright 12 * 1. Redistributions of source code must retain the above copyright
13 * notice, this list of conditions and the following disclaimer. 13 * notice, this list of conditions and the following disclaimer.
14 * 2. Redistributions in binary form must reproduce the above copyright 14 * 2. Redistributions in binary form must reproduce the above copyright
@@ -69,58 +69,86 @@ @@ -69,58 +69,86 @@
69 * 69 *
70 * @(#)parse.c 8.1 (Berkeley) 6/10/93 70 * @(#)parse.c 8.1 (Berkeley) 6/10/93
71 */ 71 */
72 72
73/* 73/*
74 * parse.c -- command parser 74 * parse.c -- command parser
75 * by A.Fujita, JAN-30-1992 75 * by A.Fujita, JAN-30-1992
76 */ 76 */
77 77
78#include <lib/libkern/libkern.h> 78#include <lib/libkern/libkern.h>
79#include <luna68k/stand/boot/samachdep.h> 79#include <luna68k/stand/boot/samachdep.h>
80#include <luna68k/stand/boot/status.h> 80#include <luna68k/stand/boot/status.h>
81 81
 82static int cmd_help(int, char *[]);
 83
82int 84int
83check_args(int argc, char *argv[]) 85check_args(int argc, char *argv[])
84{ 86{
85 int i; 87 int i;
86 88
87 for ( i = 0; i < argc; i++) 89 for ( i = 0; i < argc; i++)
88 printf("argv[%d] = \"%s\"\n", i, argv[i]); 90 printf("argv[%d] = \"%s\"\n", i, argv[i]);
89 91
90 return(ST_NORMAL); 92 return(ST_NORMAL);
91} 93}
92 94
93int 95int
94exit_program(int argc, char *argv[]) 96exit_program(int argc, char *argv[])
95{ 97{
96 return(ST_EXIT); 98 return(ST_EXIT);
97} 99}
98 100
 101static const char helpmsg[] =
 102 "commands are:\n"
 103 "boot [device(unit,part)filename]\n"
 104 " (ex. \"boot sd(0,0)netbsd\", \"boot le(0,0)netbsd.old\" etc.)\n"
 105 "ls [device(unit, part)[path]]\n"
 106 " (ex. \"ls sd(0,0)/bin\")\n"
 107 "help\n"
 108 "exit\n"
 109#if 0 /* debug commands */
 110 "checkargs\n"
 111 "disklabel\n"
 112 "howto\n"
 113 "screen\n"
 114 "scsi\n"
 115#endif
 116;
 117
 118static int
 119cmd_help(int argc, char *argv[])
 120{
 121
 122 printf(helpmsg);
 123 return ST_NORMAL;
 124}
 125
99struct command_entry { 126struct command_entry {
100 char *name; 127 char *name;
101 int (*func)(int, char **); 128 int (*func)(int, char **);
102}; 129};
103 130
104struct command_entry entries[] = { 131struct command_entry entries[] = {
105 { "b", boot }, 132 { "b", boot },
106 { "boot", boot }, 133 { "boot", boot },
107 { "chkargs", check_args }, 134 { "chkargs", check_args },
108 { "disklabel", disklabel }, 135 { "disklabel", disklabel },
109 { "exit", exit_program }, 136 { "exit", exit_program },
110#ifdef notyet 137#ifdef notyet
111 { "fsdump", fsdump }, 138 { "fsdump", fsdump },
112 { "fsrestore", fsrestore }, 139 { "fsrestore", fsrestore },
113#endif 140#endif
 141 { "help", cmd_help },
114 { "howto", how_to_boot }, 142 { "howto", how_to_boot },
115 { "ls", cmd_ls }, 143 { "ls", cmd_ls },
116 { "screen", screen }, 144 { "screen", screen },
117#ifdef notyet 145#ifdef notyet
118 { "tape", tape }, 146 { "tape", tape },
119 { "tp", tape }, 147 { "tp", tape },
120#endif 148#endif
121 { "scsi", scsi }, 149 { "scsi", scsi },
122 { "quit", exit_program }, 150 { "quit", exit_program },
123 { 0, 0 } 151 { 0, 0 }
124}; 152};
125 153
126 154

cvs diff -r1.2 -r1.3 src/sys/arch/luna68k/stand/boot/sio.c (expand / switch to unified diff)

--- src/sys/arch/luna68k/stand/boot/sio.c 2013/01/12 07:04:57 1.2
+++ src/sys/arch/luna68k/stand/boot/sio.c 2013/01/21 11:58:12 1.3
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: sio.c,v 1.2 2013/01/12 07:04:57 tsutsui Exp $ */ 1/* $NetBSD: sio.c,v 1.3 2013/01/21 11:58:12 tsutsui Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 1992 OMRON Corporation. 4 * Copyright (c) 1992 OMRON Corporation.
5 * 5 *
6 * This code is derived from software contributed to Berkeley by 6 * This code is derived from software contributed to Berkeley by
7 * OMRON Corporation. 7 * OMRON Corporation.
8 * 8 *
9 * Redistribution and use in source and binary forms, with or without 9 * Redistribution and use in source and binary forms, with or without
10 * modification, are permitted provided that the following conditions 10 * modification, are permitted provided that the following conditions
11 * are met: 11 * are met:
12 * 1. Redistributions of source code must retain the above copyright 12 * 1. Redistributions of source code must retain the above copyright
13 * notice, this list of conditions and the following disclaimer. 13 * notice, this list of conditions and the following disclaimer.
14 * 2. Redistributions in binary form must reproduce the above copyright 14 * 2. Redistributions in binary form must reproduce the above copyright
@@ -157,29 +157,28 @@ void @@ -157,29 +157,28 @@ void
157siocninit(struct consdev *cp) 157siocninit(struct consdev *cp)
158{ 158{
159 int unit = siounit(cp->cn_dev); 159 int unit = siounit(cp->cn_dev);
160 160
161 sioinit(); 161 sioinit();
162 sioconsole = unit; 162 sioconsole = unit;
163} 163}
164 164
165int 165int
166siocngetc(dev_t dev) 166siocngetc(dev_t dev)
167{ 167{
168 int c, unit = siounit(dev); 168 int c, unit = siounit(dev);
169 169
170 while (RBUF_EMPTY(unit)) { 170 if (RBUF_EMPTY(unit))
171 DELAY(10); 171 return 0;
172 } 
173 172
174 POP_RBUF(unit, c); 173 POP_RBUF(unit, c);
175 174
176 return(c); 175 return(c);
177} 176}
178 177
179void 178void
180siocnputc(dev_t dev, int c) 179siocnputc(dev_t dev, int c)
181{ 180{
182 int unit = siounit(dev); 181 int unit = siounit(dev);
183 int s; 182 int s;
184 183
185 if (sioconsole == -1) { 184 if (sioconsole == -1) {