Add support for "await key" to abort autoboot and get boot menu. Also add command help. Bump version.diff -r1.7 -r1.8 src/sys/arch/luna68k/stand/boot/Makefile
(tsutsui)
--- 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 | |||
4 | NOMAN= # defined | 4 | NOMAN= # 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 | |||
9 | S= ${.CURDIR}/../../../.. | 9 | S= ${.CURDIR}/../../../.. | |
10 | LIBSADIR= ${S}/lib/libsa | 10 | LIBSADIR= ${S}/lib/libsa | |
11 | 11 | |||
12 | CPPFLAGS+= -nostdinc -D_STANDALONE | 12 | CPPFLAGS+= -nostdinc -D_STANDALONE | |
13 | CPPFLAGS+= -I${.CURDIR} -I${.OBJDIR} -I${S} -I${S}/arch | 13 | CPPFLAGS+= -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 | |||
30 | TEXTADDR= 700000 | 30 | TEXTADDR= 700000 | |
31 | LDSCRIPT= ${.CURDIR}/boot.ldscript | 31 | LDSCRIPT= ${.CURDIR}/boot.ldscript | |
32 | LINKFORMAT= -static -N -Ttext ${TEXTADDR} -T ${LDSCRIPT} | 32 | LINKFORMAT= -static -N -Ttext ${TEXTADDR} -T ${LDSCRIPT} | |
33 | 33 | |||
34 | SRCS= locore.S | 34 | SRCS= locore.S | |
35 | SRCS+= init_main.c autoconf.c ioconf.c | 35 | SRCS+= init_main.c autoconf.c ioconf.c | |
36 | SRCS+= trap.c | 36 | SRCS+= trap.c | |
37 | SRCS+= devopen.c | 37 | SRCS+= devopen.c | |
38 | SRCS+= conf.c | 38 | SRCS+= conf.c | |
39 | SRCS+= machdep.c | 39 | SRCS+= machdep.c | |
40 | SRCS+= getline.c parse.c | 40 | SRCS+= getline.c parse.c | |
41 | SRCS+= boot.c | 41 | SRCS+= boot.c | |
42 | SRCS+= cons.c prf.c | 42 | SRCS+= cons.c prf.c awaitkey.c | |
43 | SRCS+= romcons.c | 43 | SRCS+= romcons.c | |
44 | SRCS+= sio.c | 44 | SRCS+= sio.c | |
45 | SRCS+= bmc.c bmd.c screen.c font.c kbd.c | 45 | SRCS+= bmc.c bmd.c screen.c font.c kbd.c | |
46 | SRCS+= scsi.c sc.c sd.c | 46 | SRCS+= scsi.c sc.c sd.c | |
47 | #SRCS+= st.c tape.c | 47 | #SRCS+= st.c tape.c | |
48 | SRCS+= disklabel.c | 48 | SRCS+= disklabel.c | |
49 | #SRCS+= fsdump.c | 49 | #SRCS+= fsdump.c | |
50 | SRCS+= ufs_disksubr.c | 50 | SRCS+= ufs_disksubr.c | |
51 | SRCS+= ls.c | 51 | SRCS+= ls.c | |
52 | 52 | |||
53 | # netboot support | 53 | # netboot support | |
54 | SRCS+= if_le.c lance.c getsecs.c | 54 | SRCS+= if_le.c lance.c getsecs.c | |
55 | .PATH: ${LIBSADIR} | 55 | .PATH: ${LIBSADIR} |
--- 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) | |||
525 | ENTRY_NOPROFILE(lev5intr) | 525 | ENTRY_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 | ||||
538 | ENTRY_NOPROFILE(hardclock) | 539 | ENTRY_NOPROFILE(hardclock) | |
540 | addql #1,_C_LABEL(tick) | |||
539 | rts | 541 | rts | |
540 | 542 | |||
543 | BSS(tick,4) | |||
544 | ||||
541 | ENTRY_NOPROFILE(lev6intr) | 545 | ENTRY_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 |
--- 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 | |||
50 | struct consdev; | 50 | struct consdev; | |
51 | struct frame; | 51 | struct frame; | |
52 | typedef struct label_t { | 52 | typedef 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 */ | |
57 | extern int cpuspeed; | |||
58 | void configure(void); | 57 | void configure(void); | |
59 | void find_devs(void); | 58 | void find_devs(void); | |
60 | 59 | |||
60 | /* awaitkey.c */ | |||
61 | char awaitkey(const char *, int, bool); | |||
62 | ||||
61 | /* bmc.c */ | 63 | /* bmc.c */ | |
62 | void bmccnprobe(struct consdev *); | 64 | void bmccnprobe(struct consdev *); | |
63 | void bmccninit(struct consdev *); | 65 | void bmccninit(struct consdev *); | |
64 | int bmccngetc(dev_t); | 66 | int bmccngetc(dev_t); | |
65 | void bmccnputc(dev_t, int); | 67 | void bmccnputc(dev_t, int); | |
66 | 68 | |||
67 | /* bmd.c */ | 69 | /* bmd.c */ | |
68 | void bmdinit(void); | 70 | void bmdinit(void); | |
69 | int bmdputc(int); | 71 | int bmdputc(int); | |
70 | void bmdadjust(short, short); | 72 | void bmdadjust(short, short); | |
71 | void bmdclear(void); | 73 | void 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); | |||
100 | extern u_short bmdfont[][20]; | 102 | extern u_short bmdfont[][20]; | |
101 | 103 | |||
102 | /* fsdump.c */ | 104 | /* fsdump.c */ | |
103 | int fsdump(int, char **); | 105 | int fsdump(int, char **); | |
104 | int fsrestore(int, char **); | 106 | int fsrestore(int, char **); | |
105 | 107 | |||
106 | /* getline.c */ | 108 | /* getline.c */ | |
107 | int getline(char *, char *); | 109 | int getline(char *, char *); | |
108 | 110 | |||
109 | /* if_le.c */ | 111 | /* if_le.c */ | |
110 | int leinit(void *); | 112 | int leinit(void *); | |
111 | 113 | |||
112 | /* init_main.c */ | 114 | /* init_main.c */ | |
115 | extern int cpuspeed; | |||
116 | extern int hz; | |||
113 | extern int nplane; | 117 | extern int nplane; | |
114 | extern int machtype; | 118 | extern int machtype; | |
115 | 119 | |||
116 | /* kbd.c */ | 120 | /* kbd.c */ | |
117 | int kbd_decode(u_char); | 121 | int kbd_decode(u_char); | |
118 | 122 | |||
119 | /* lance.c */ | 123 | /* lance.c */ | |
120 | void *lance_attach(int, void *, void *, uint8_t *); | 124 | void *lance_attach(int, void *, void *, uint8_t *); | |
121 | void *lance_cookie(int); | 125 | void *lance_cookie(int); | |
122 | uint8_t *lance_eaddr(void *); | 126 | uint8_t *lance_eaddr(void *); | |
123 | bool lance_init(void *); | 127 | bool lance_init(void *); | |
124 | int lance_get(void *, void *, size_t); | 128 | int lance_get(void *, void *, size_t); | |
125 | bool lance_put(void *, void *, size_t); | 129 | bool lance_put(void *, void *, size_t); | |
126 | bool lance_end(void *); | 130 | bool lance_end(void *); | |
127 | int lance_intr(void); | 131 | int lance_intr(void); | |
128 | 132 | |||
129 | /* locore.S */ | 133 | /* locore.S */ | |
130 | extern u_int bootdev; | 134 | extern u_int bootdev; | |
131 | extern int dipsw1, dipsw2; | 135 | extern int dipsw1, dipsw2; | |
132 | extern int cputype; | 136 | extern int cputype; | |
137 | extern volatile uint32_t tick; | |||
133 | int setjmp(label_t *); | 138 | int setjmp(label_t *); | |
134 | int splhigh(void); | 139 | int splhigh(void); | |
135 | void splx(int); | 140 | void splx(int); | |
136 | int getsfc(void); | 141 | int getsfc(void); | |
137 | int getdfc(void); | 142 | int getdfc(void); | |
138 | int spl0(void); | 143 | int spl0(void); | |
139 | int spl1(void); | 144 | int spl1(void); | |
140 | int spl2(void); | 145 | int spl2(void); | |
141 | int spl3(void); | 146 | int spl3(void); | |
142 | int spl4(void); | 147 | int spl4(void); | |
143 | int spl5(void); | 148 | int spl5(void); | |
144 | int spl6(void); | 149 | int spl6(void); | |
145 | 150 | |||
146 | /* ls.c */ | 151 | /* ls.c */ | |
147 | int cmd_ls(int, char **); | 152 | int cmd_ls(int, char **); | |
148 | 153 | |||
149 | /* machdep.c */ | 154 | /* machdep.c */ | |
150 | void straytrap(int); | 155 | void straytrap(int); | |
151 | int badaddr(volatile void *); | 156 | int badaddr(volatile void *); | |
152 | void regdump(int *, int); | 157 | void regdump(int *, int); | |
153 | char *hexstr(int, int); | 158 | char *hexstr(int, int); | |
154 | 159 | |||
155 | /* prf.c */ | 160 | /* prf.c */ | |
156 | #if 0 | |||
157 | int tgetchar(void); | 161 | int tgetchar(void); | |
158 | #endif | |||
159 | 162 | |||
160 | /* parse.c */ | 163 | /* parse.c */ | |
161 | int check_args(int, char **); | 164 | int check_args(int, char **); | |
162 | int exit_program(int, char **); | 165 | int exit_program(int, char **); | |
163 | int parse(int, char **); | 166 | int parse(int, char **); | |
164 | int getargs(char *, char **, int); | 167 | int getargs(char *, char **, int); | |
165 | 168 | |||
166 | /* romcons.c */ | 169 | /* romcons.c */ | |
167 | void romcnprobe(struct consdev *); | 170 | void romcnprobe(struct consdev *); | |
168 | void romcninit(struct consdev *); | 171 | void romcninit(struct consdev *); | |
169 | int romcngetc(dev_t); | 172 | int romcngetc(dev_t); | |
170 | void romcnputc(dev_t, int); | 173 | void romcnputc(dev_t, int); | |
171 | 174 |
/* $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;
}
--- 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) | |||
106 | void | 106 | void | |
107 | bmccninit(struct consdev *cp) | 107 | bmccninit(struct consdev *cp) | |
108 | { | 108 | { | |
109 | sioinit(); | 109 | sioinit(); | |
110 | bmdinit(); | 110 | bmdinit(); | |
111 | } | 111 | } | |
112 | 112 | |||
113 | int | 113 | int | |
114 | bmccngetc(dev_t dev) | 114 | bmccngetc(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 | |||
131 | void | 130 | void | |
132 | bmccnputc(dev_t dev, int c) | 131 | bmccnputc(dev_t dev, int c) | |
133 | { | 132 | { | |
134 | bmdputc(c); | 133 | bmdputc(c); |
--- 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 | } |
--- 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 | |||
54 | int | 53 | int | |
55 | tgetchar(void) | 54 | tgetchar(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 | |||
72 | void | 70 | void | |
73 | putchar(int c) | 71 | putchar(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 | } |
--- 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 | |||
84 | static int get_plane_numbers(void); | 84 | static int get_plane_numbers(void); | |
85 | static int reorder_dipsw(int); | 85 | static int reorder_dipsw(int); | |
86 | 86 | |||
87 | int cpuspeed; /* for DELAY() macro */ | 87 | int cpuspeed; /* for DELAY() macro */ | |
88 | int hz = 60; | |||
88 | int machtype; | 89 | int machtype; | |
89 | 90 | |||
90 | #define VERS_LOCAL "Phase-31" | 91 | #define VERS_LOCAL "Phase-31" | |
91 | 92 | |||
92 | int nplane; | 93 | int nplane; | |
93 | 94 | |||
94 | /* KIFF */ | 95 | /* KIFF */ | |
95 | 96 | |||
96 | struct KernInter KIFF; | 97 | struct KernInter KIFF; | |
97 | struct KernInter *kiff = &KIFF; | 98 | struct 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 | |||
104 | char buffer[BUFFSIZE]; | 105 | char buffer[BUFFSIZE]; | |
105 | 106 | |||
106 | int argc; | 107 | int argc; | |
107 | char *argv[MAXARGS]; | 108 | char *argv[MAXARGS]; | |
108 | 109 | |||
110 | #define BOOT_TIMEOUT 10 | |||
111 | int boot_timeout = BOOT_TIMEOUT; | |||
112 | ||||
109 | char prompt[16] = "boot> "; | 113 | char prompt[16] = "boot> "; | |
110 | 114 | |||
111 | void | 115 | void | |
112 | main(void) | 116 | main(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 | } |
--- 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 | |||
3 | NOTE ANY CHANGES YOU MAKE TO THE BOOTBLOCKS HERE. The format of this | 3 | NOTE ANY CHANGES YOU MAKE TO THE BOOTBLOCKS HERE. The format of this | |
4 | file is important - make sure the entries are appended on end, last item | 4 | file is important - make sure the entries are appended on end, last item | |
5 | is taken as the current. | 5 | is taken as the current. | |
6 | 6 | |||
7 | 1.0: Initial revision, based on 4.4BSD-Lite2/luna68k and NetBSD/hp300 | 7 | 1.0: Initial revision, based on 4.4BSD-Lite2/luna68k and NetBSD/hp300 | |
8 | 1.1: Add netboot support. | 8 | 1.1: Add netboot support. | |
9 | 1.2: Add support for secondary SPC SCSI on LUNA-II. | 9 | 1.2: Add support for secondary SPC SCSI on LUNA-II. | |
10 | 1.3: Add UFS2 support. | 10 | 1.3: Add UFS2 support. | |
11 | 1.4: Add support for "awaiting key" to abort autoboot and get boot menu. |
--- 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 | |||
82 | static int cmd_help(int, char *[]); | |||
83 | ||||
82 | int | 84 | int | |
83 | check_args(int argc, char *argv[]) | 85 | check_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 | |||
93 | int | 95 | int | |
94 | exit_program(int argc, char *argv[]) | 96 | exit_program(int argc, char *argv[]) | |
95 | { | 97 | { | |
96 | return(ST_EXIT); | 98 | return(ST_EXIT); | |
97 | } | 99 | } | |
98 | 100 | |||
101 | static 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 | ||||
118 | static int | |||
119 | cmd_help(int argc, char *argv[]) | |||
120 | { | |||
121 | ||||
122 | printf(helpmsg); | |||
123 | return ST_NORMAL; | |||
124 | } | |||
125 | ||||
99 | struct command_entry { | 126 | struct command_entry { | |
100 | char *name; | 127 | char *name; | |
101 | int (*func)(int, char **); | 128 | int (*func)(int, char **); | |
102 | }; | 129 | }; | |
103 | 130 | |||
104 | struct command_entry entries[] = { | 131 | struct 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 |
--- 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 | |||
157 | siocninit(struct consdev *cp) | 157 | siocninit(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 | |||
165 | int | 165 | int | |
166 | siocngetc(dev_t dev) | 166 | siocngetc(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 | |||
179 | void | 178 | void | |
180 | siocnputc(dev_t dev, int c) | 179 | siocnputc(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) { |