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,98 +1,98 @@ | @@ -1,98 +1,98 @@ | |||
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 | |||
15 | CPPFLAGS+= -DSUPPORT_DISK | 15 | CPPFLAGS+= -DSUPPORT_DISK | |
16 | #CPPFLAGS+= -DSUPPORT_TAPE | 16 | #CPPFLAGS+= -DSUPPORT_TAPE | |
17 | CPPFLAGS+= -DSUPPORT_ETHERNET | 17 | CPPFLAGS+= -DSUPPORT_ETHERNET | |
18 | CPPFLAGS+= -DSUPPORT_DHCP -DSUPPORT_BOOTP | 18 | CPPFLAGS+= -DSUPPORT_DHCP -DSUPPORT_BOOTP | |
19 | #CPPFLAGS+= -DBOOTP_DEBUG -DNETIF_DEBUG -DETHER_DEBUG -DNFS_DEBUG | 19 | #CPPFLAGS+= -DBOOTP_DEBUG -DNETIF_DEBUG -DETHER_DEBUG -DNFS_DEBUG | |
20 | #CPPFLAGS+= -DRPC_DEBUG -DRARP_DEBUG -DNET_DEBUG -DDEBUG -DPARANOID | 20 | #CPPFLAGS+= -DRPC_DEBUG -DRARP_DEBUG -DNET_DEBUG -DDEBUG -DPARANOID | |
21 | CPPFLAGS+= -DLIBSA_ENABLE_LS_OP | 21 | CPPFLAGS+= -DLIBSA_ENABLE_LS_OP | |
22 | CPPFLAGS+= -DLIBSA_PRINTF_WIDTH_SUPPORT | 22 | CPPFLAGS+= -DLIBSA_PRINTF_WIDTH_SUPPORT | |
23 | 23 | |||
24 | CFLAGS= -Os -msoft-float | 24 | CFLAGS= -Os -msoft-float | |
25 | CFLAGS+= -ffreestanding | 25 | CFLAGS+= -ffreestanding | |
26 | CFLAGS+= -Wall -Werror | 26 | CFLAGS+= -Wall -Werror | |
27 | CFLAGS+= -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith | 27 | CFLAGS+= -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith | |
28 | CFLAGS+= -Wno-pointer-sign | 28 | 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} | |
56 | SRCS+= dev_net.c | 56 | SRCS+= dev_net.c | |
57 | 57 | |||
58 | PROG= boot | 58 | PROG= boot | |
59 | 59 | |||
60 | NEWVERSWHAT= "${PROG}" | 60 | NEWVERSWHAT= "${PROG}" | |
61 | 61 | |||
62 | SRCS+= vers.c | 62 | SRCS+= vers.c | |
63 | CLEANFILES+= vers.c | 63 | CLEANFILES+= vers.c | |
64 | 64 | |||
65 | ### find out what to use for libkern | 65 | ### find out what to use for libkern | |
66 | KERN_AS= library | 66 | KERN_AS= library | |
67 | .include "${S}/lib/libkern/Makefile.inc" | 67 | .include "${S}/lib/libkern/Makefile.inc" | |
68 | 68 | |||
69 | ### find out what to use for libz | 69 | ### find out what to use for libz | |
70 | Z_AS= library | 70 | Z_AS= library | |
71 | .include "${S}/lib/libz/Makefile.inc" | 71 | .include "${S}/lib/libz/Makefile.inc" | |
72 | 72 | |||
73 | ### find out what to use for libsa | 73 | ### find out what to use for libsa | |
74 | SA_AS= library | 74 | SA_AS= library | |
75 | SAMISCMAKEFLAGS+=SA_USE_LOADFILE=yes SA_USE_CREAD=yes SA_ENABLE_LS_OP=yes | 75 | SAMISCMAKEFLAGS+=SA_USE_LOADFILE=yes SA_USE_CREAD=yes SA_ENABLE_LS_OP=yes | |
76 | .include "${S}/lib/libsa/Makefile.inc" | 76 | .include "${S}/lib/libsa/Makefile.inc" | |
77 | 77 | |||
78 | LIBS= ${SALIB} ${ZLIB} ${KERNLIB} | 78 | LIBS= ${SALIB} ${ZLIB} ${KERNLIB} | |
79 | 79 | |||
80 | .PHONY: vers.c | 80 | .PHONY: vers.c | |
81 | vers.c: ${.CURDIR}/version | 81 | vers.c: ${.CURDIR}/version | |
82 | ${HOST_SH} ${S}/conf/newvers_stand.sh ${${MKREPRO} == "yes" :?:-D} \ | 82 | ${HOST_SH} ${S}/conf/newvers_stand.sh ${${MKREPRO} == "yes" :?:-D} \ | |
83 | ${.CURDIR}/version ${MACHINE} ${NEWVERSWHAT} | 83 | ${.CURDIR}/version ${MACHINE} ${NEWVERSWHAT} | |
84 | 84 | |||
85 | ${PROG}: ${LDSCRIPT} ${OBJS} ${LIBS} | 85 | ${PROG}: ${LDSCRIPT} ${OBJS} ${LIBS} | |
86 | ${LD} ${LINKFORMAT} -x -o ${PROG}.elf ${OBJS} ${LIBS} | 86 | ${LD} ${LINKFORMAT} -x -o ${PROG}.elf ${OBJS} ${LIBS} | |
87 | ${ELF2AOUT} ${PROG}.elf ${PROG}.aout | 87 | ${ELF2AOUT} ${PROG}.elf ${PROG}.aout | |
88 | mv ${PROG}.aout ${PROG} | 88 | mv ${PROG}.aout ${PROG} | |
89 | 89 | |||
90 | CLEANFILES+= ${PROG}.aout ${PROG}.elf | 90 | CLEANFILES+= ${PROG}.aout ${PROG}.elf | |
91 | 91 | |||
92 | cleandir distclean: .WAIT cleanlibdir | 92 | cleandir distclean: .WAIT cleanlibdir | |
93 | 93 | |||
94 | cleanlibdir: | 94 | cleanlibdir: | |
95 | -rm -rf lib | 95 | -rm -rf lib | |
96 | 96 | |||
97 | .include <bsd.klinks.mk> | 97 | .include <bsd.klinks.mk> | |
98 | .include <bsd.prog.mk> | 98 | .include <bsd.prog.mk> |
--- 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,779 +1,783 @@ | @@ -1,779 +1,783 @@ | |||
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 | |
15 | * notice, this list of conditions and the following disclaimer in the | 15 | * notice, this list of conditions and the following disclaimer in the | |
16 | * documentation and/or other materials provided with the distribution. | 16 | * documentation and/or other materials provided with the distribution. | |
17 | * 3. All advertising materials mentioning features or use of this software | 17 | * 3. All advertising materials mentioning features or use of this software | |
18 | * must display the following acknowledgement: | 18 | * must display the following acknowledgement: | |
19 | * This product includes software developed by the University of | 19 | * This product includes software developed by the University of | |
20 | * California, Berkeley and its contributors. | 20 | * California, Berkeley and its contributors. | |
21 | * 4. Neither the name of the University nor the names of its contributors | 21 | * 4. Neither the name of the University nor the names of its contributors | |
22 | * may be used to endorse or promote products derived from this software | 22 | * may be used to endorse or promote products derived from this software | |
23 | * without specific prior written permission. | 23 | * without specific prior written permission. | |
24 | * | 24 | * | |
25 | * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND | 25 | * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND | |
26 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | 26 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
27 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | 27 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |
28 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE | 28 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE | |
29 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | 29 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
30 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | 30 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | |
31 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | 31 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
32 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | 32 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |
33 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | 33 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
34 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | 34 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
35 | * SUCH DAMAGE. | 35 | * SUCH DAMAGE. | |
36 | * | 36 | * | |
37 | * @(#)locore.s 8.1 (Berkeley) 6/10/93 | 37 | * @(#)locore.s 8.1 (Berkeley) 6/10/93 | |
38 | */ | 38 | */ | |
39 | /* | 39 | /* | |
40 | * Copyright (c) 1990, 1993 | 40 | * Copyright (c) 1990, 1993 | |
41 | * The Regents of the University of California. All rights reserved. | 41 | * The Regents of the University of California. All rights reserved. | |
42 | * | 42 | * | |
43 | * This code is derived from software contributed to Berkeley by | 43 | * This code is derived from software contributed to Berkeley by | |
44 | * OMRON Corporation. | 44 | * OMRON Corporation. | |
45 | * | 45 | * | |
46 | * Redistribution and use in source and binary forms, with or without | 46 | * Redistribution and use in source and binary forms, with or without | |
47 | * modification, are permitted provided that the following conditions | 47 | * modification, are permitted provided that the following conditions | |
48 | * are met: | 48 | * are met: | |
49 | * 1. Redistributions of source code must retain the above copyright | 49 | * 1. Redistributions of source code must retain the above copyright | |
50 | * notice, this list of conditions and the following disclaimer. | 50 | * notice, this list of conditions and the following disclaimer. | |
51 | * 2. Redistributions in binary form must reproduce the above copyright | 51 | * 2. Redistributions in binary form must reproduce the above copyright | |
52 | * notice, this list of conditions and the following disclaimer in the | 52 | * notice, this list of conditions and the following disclaimer in the | |
53 | * documentation and/or other materials provided with the distribution. | 53 | * documentation and/or other materials provided with the distribution. | |
54 | * 3. Neither the name of the University nor the names of its contributors | 54 | * 3. Neither the name of the University nor the names of its contributors | |
55 | * may be used to endorse or promote products derived from this software | 55 | * may be used to endorse or promote products derived from this software | |
56 | * without specific prior written permission. | 56 | * without specific prior written permission. | |
57 | * | 57 | * | |
58 | * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND | 58 | * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND | |
59 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | 59 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
60 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | 60 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |
61 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE | 61 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE | |
62 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | 62 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
63 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | 63 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | |
64 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | 64 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
65 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | 65 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |
66 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | 66 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
67 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | 67 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
68 | * SUCH DAMAGE. | 68 | * SUCH DAMAGE. | |
69 | * | 69 | * | |
70 | * @(#)locore.s 8.1 (Berkeley) 6/10/93 | 70 | * @(#)locore.s 8.1 (Berkeley) 6/10/93 | |
71 | */ | 71 | */ | |
72 | 72 | |||
73 | /* For _C_LABEL() and friends. */ | 73 | /* For _C_LABEL() and friends. */ | |
74 | #include <m68k/asm.h> | 74 | #include <m68k/asm.h> | |
75 | 75 | |||
76 | #define T_BUSERR 0 | 76 | #define T_BUSERR 0 | |
77 | #define T_ADDRERR 1 | 77 | #define T_ADDRERR 1 | |
78 | #define T_ILLINST 2 | 78 | #define T_ILLINST 2 | |
79 | #define T_ZERODIV 3 | 79 | #define T_ZERODIV 3 | |
80 | #define T_CHKINST 4 | 80 | #define T_CHKINST 4 | |
81 | #define T_TRAPVINST 5 | 81 | #define T_TRAPVINST 5 | |
82 | #define T_PRIVINST 6 | 82 | #define T_PRIVINST 6 | |
83 | #define T_MMUFLT 8 | 83 | #define T_MMUFLT 8 | |
84 | #define T_FMTERR 10 | 84 | #define T_FMTERR 10 | |
85 | #define T_FPERR 11 | 85 | #define T_FPERR 11 | |
86 | #define T_COPERR 12 | 86 | #define T_COPERR 12 | |
87 | 87 | |||
88 | #define PSL_LOWIPL 0x2000 /* PSL_S | PSL_IPL0 */ | 88 | #define PSL_LOWIPL 0x2000 /* PSL_S | PSL_IPL0 */ | |
89 | #define PSL_HIGHIPL 0x2700 /* PSL_S | PSL_IPL7 */ | 89 | #define PSL_HIGHIPL 0x2700 /* PSL_S | PSL_IPL7 */ | |
90 | 90 | |||
91 | #define SPL1 0x2100 /* PSL_S | PSL_IPL1 */ | 91 | #define SPL1 0x2100 /* PSL_S | PSL_IPL1 */ | |
92 | #define SPL2 0x2200 /* PSL_S | PSL_IPL2 */ | 92 | #define SPL2 0x2200 /* PSL_S | PSL_IPL2 */ | |
93 | #define SPL3 0x2300 /* PSL_S | PSL_IPL3 */ | 93 | #define SPL3 0x2300 /* PSL_S | PSL_IPL3 */ | |
94 | #define SPL4 0x2400 /* PSL_S | PSL_IPL4 */ | 94 | #define SPL4 0x2400 /* PSL_S | PSL_IPL4 */ | |
95 | #define SPL5 0x2500 /* PSL_S | PSL_IPL5 */ | 95 | #define SPL5 0x2500 /* PSL_S | PSL_IPL5 */ | |
96 | #define SPL6 0x2600 /* PSL_S | PSL_IPL6 */ | 96 | #define SPL6 0x2600 /* PSL_S | PSL_IPL6 */ | |
97 | 97 | |||
98 | #define CLOCK_REG 0x63000000 | 98 | #define CLOCK_REG 0x63000000 | |
99 | #define CLK_CLR 1 | 99 | #define CLK_CLR 1 | |
100 | 100 | |||
101 | #define ILLGINST 16 | 101 | #define ILLGINST 16 | |
102 | #define NMIVEC 124 | 102 | #define NMIVEC 124 | |
103 | #define EVTRAPF 188 | 103 | #define EVTRAPF 188 | |
104 | 104 | |||
105 | .text | 105 | .text | |
106 | 106 | |||
107 | ASENTRY_NOPROFILE(start) | 107 | ASENTRY_NOPROFILE(start) | |
108 | ASGLOBAL(Reset) | 108 | ASGLOBAL(Reset) | |
109 | jmp _C_LABEL(start1) /* 0: NOT USED (reset PC) */ | 109 | jmp _C_LABEL(start1) /* 0: NOT USED (reset PC) */ | |
110 | .word 0 /* 1: NOT USED (reset PC) */ | 110 | .word 0 /* 1: NOT USED (reset PC) */ | |
111 | VECTOR(buserr) /* 2: bus error */ | 111 | VECTOR(buserr) /* 2: bus error */ | |
112 | VECTOR(addrerr) /* 3: address error */ | 112 | VECTOR(addrerr) /* 3: address error */ | |
113 | VECTOR(illinst) /* 4: illegal instruction */ | 113 | VECTOR(illinst) /* 4: illegal instruction */ | |
114 | VECTOR(zerodiv) /* 5: zero divide */ | 114 | VECTOR(zerodiv) /* 5: zero divide */ | |
115 | VECTOR(chkinst) /* 6: CHK instruction */ | 115 | VECTOR(chkinst) /* 6: CHK instruction */ | |
116 | VECTOR(trapvinst) /* 7: TRAPV instruction */ | 116 | VECTOR(trapvinst) /* 7: TRAPV instruction */ | |
117 | VECTOR(privinst) /* 8: privilege violation */ | 117 | VECTOR(privinst) /* 8: privilege violation */ | |
118 | VECTOR(badtrap) /* 9: trace */ | 118 | VECTOR(badtrap) /* 9: trace */ | |
119 | VECTOR(illinst) /* 10: line 1010 emulator */ | 119 | VECTOR(illinst) /* 10: line 1010 emulator */ | |
120 | VECTOR(illinst) /* 11: line 1111 emulator */ | 120 | VECTOR(illinst) /* 11: line 1111 emulator */ | |
121 | VECTOR(badtrap) /* 12: unassigned, reserved */ | 121 | VECTOR(badtrap) /* 12: unassigned, reserved */ | |
122 | VECTOR(coperr) /* 13: coprocessor protocol violation */ | 122 | VECTOR(coperr) /* 13: coprocessor protocol violation */ | |
123 | VECTOR(fmterr) /* 14: format error */ | 123 | VECTOR(fmterr) /* 14: format error */ | |
124 | VECTOR(badtrap) /* 15: uninitialized interrupt vector */ | 124 | VECTOR(badtrap) /* 15: uninitialized interrupt vector */ | |
125 | VECTOR(badtrap) /* 16: unassigned, reserved */ | 125 | VECTOR(badtrap) /* 16: unassigned, reserved */ | |
126 | VECTOR(badtrap) /* 17: unassigned, reserved */ | 126 | VECTOR(badtrap) /* 17: unassigned, reserved */ | |
127 | VECTOR(badtrap) /* 18: unassigned, reserved */ | 127 | VECTOR(badtrap) /* 18: unassigned, reserved */ | |
128 | VECTOR(badtrap) /* 19: unassigned, reserved */ | 128 | VECTOR(badtrap) /* 19: unassigned, reserved */ | |
129 | VECTOR(badtrap) /* 20: unassigned, reserved */ | 129 | VECTOR(badtrap) /* 20: unassigned, reserved */ | |
130 | VECTOR(badtrap) /* 21: unassigned, reserved */ | 130 | VECTOR(badtrap) /* 21: unassigned, reserved */ | |
131 | VECTOR(badtrap) /* 22: unassigned, reserved */ | 131 | VECTOR(badtrap) /* 22: unassigned, reserved */ | |
132 | VECTOR(badtrap) /* 23: unassigned, reserved */ | 132 | VECTOR(badtrap) /* 23: unassigned, reserved */ | |
133 | VECTOR(badtrap) /* 24: unassigned, reserved */ | 133 | VECTOR(badtrap) /* 24: unassigned, reserved */ | |
134 | VECTOR(badtrap) /* 25: unassigned, reserved */ | 134 | VECTOR(badtrap) /* 25: unassigned, reserved */ | |
135 | VECTOR(lev2intr) /* 26: level 2 interrupt autovector */ | 135 | VECTOR(lev2intr) /* 26: level 2 interrupt autovector */ | |
136 | VECTOR(lev3intr) /* 27: level 3 interrupt autovector */ | 136 | VECTOR(lev3intr) /* 27: level 3 interrupt autovector */ | |
137 | VECTOR(badtrap) /* 28: level 4 interrupt autovector */ | 137 | VECTOR(badtrap) /* 28: level 4 interrupt autovector */ | |
138 | VECTOR(lev5intr) /* 29: level 5 interrupt autovector */ | 138 | VECTOR(lev5intr) /* 29: level 5 interrupt autovector */ | |
139 | VECTOR(lev6intr) /* 30: level 6 interrupt autovector */ | 139 | VECTOR(lev6intr) /* 30: level 6 interrupt autovector */ | |
140 | VECTOR(badtrap) /* 31: level 7 interrupt autovector */ | 140 | VECTOR(badtrap) /* 31: level 7 interrupt autovector */ | |
141 | VECTOR(illinst) /* 32: syscalls */ | 141 | VECTOR(illinst) /* 32: syscalls */ | |
142 | VECTOR(illinst) /* 33: sigreturn syscall or breakpoint */ | 142 | VECTOR(illinst) /* 33: sigreturn syscall or breakpoint */ | |
143 | VECTOR(illinst) /* 34: breakpoint or sigreturn syscall */ | 143 | VECTOR(illinst) /* 34: breakpoint or sigreturn syscall */ | |
144 | VECTOR(illinst) /* 35: TRAP instruction vector */ | 144 | VECTOR(illinst) /* 35: TRAP instruction vector */ | |
145 | VECTOR(illinst) /* 36: TRAP instruction vector */ | 145 | VECTOR(illinst) /* 36: TRAP instruction vector */ | |
146 | VECTOR(illinst) /* 37: TRAP instruction vector */ | 146 | VECTOR(illinst) /* 37: TRAP instruction vector */ | |
147 | VECTOR(illinst) /* 38: TRAP instruction vector */ | 147 | VECTOR(illinst) /* 38: TRAP instruction vector */ | |
148 | VECTOR(illinst) /* 39: TRAP instruction vector */ | 148 | VECTOR(illinst) /* 39: TRAP instruction vector */ | |
149 | VECTOR(illinst) /* 40: TRAP instruction vector */ | 149 | VECTOR(illinst) /* 40: TRAP instruction vector */ | |
150 | VECTOR(illinst) /* 41: TRAP instruction vector */ | 150 | VECTOR(illinst) /* 41: TRAP instruction vector */ | |
151 | VECTOR(illinst) /* 42: TRAP instruction vector */ | 151 | VECTOR(illinst) /* 42: TRAP instruction vector */ | |
152 | VECTOR(illinst) /* 43: TRAP instruction vector */ | 152 | VECTOR(illinst) /* 43: TRAP instruction vector */ | |
153 | VECTOR(illinst) /* 44: TRAP instruction vector */ | 153 | VECTOR(illinst) /* 44: TRAP instruction vector */ | |
154 | VECTOR(illinst) /* 45: TRAP instruction vector */ | 154 | VECTOR(illinst) /* 45: TRAP instruction vector */ | |
155 | VECTOR(illinst) /* 45: TRAP instruction vector */ | 155 | VECTOR(illinst) /* 45: TRAP instruction vector */ | |
156 | VECTOR(illinst) /* 47: TRAP instruction vector */ | 156 | VECTOR(illinst) /* 47: TRAP instruction vector */ | |
157 | VECTOR(fptrap) /* 48: FPCP branch/set on unordered cond */ | 157 | VECTOR(fptrap) /* 48: FPCP branch/set on unordered cond */ | |
158 | VECTOR(fptrap) /* 49: FPCP inexact result */ | 158 | VECTOR(fptrap) /* 49: FPCP inexact result */ | |
159 | VECTOR(fptrap) /* 50: FPCP divide by zero */ | 159 | VECTOR(fptrap) /* 50: FPCP divide by zero */ | |
160 | VECTOR(fptrap) /* 51: FPCP underflow */ | 160 | VECTOR(fptrap) /* 51: FPCP underflow */ | |
161 | VECTOR(fptrap) /* 52: FPCP operand error */ | 161 | VECTOR(fptrap) /* 52: FPCP operand error */ | |
162 | VECTOR(fptrap) /* 53: FPCP overflow */ | 162 | VECTOR(fptrap) /* 53: FPCP overflow */ | |
163 | VECTOR(fptrap) /* 54: FPCP signalling NAN */ | 163 | VECTOR(fptrap) /* 54: FPCP signalling NAN */ | |
164 | 164 | |||
165 | VECTOR(badtrap) /* 55: unassigned, reserved */ | 165 | VECTOR(badtrap) /* 55: unassigned, reserved */ | |
166 | VECTOR(badtrap) /* 56: unassigned, reserved */ | 166 | VECTOR(badtrap) /* 56: unassigned, reserved */ | |
167 | VECTOR(badtrap) /* 57: unassigned, reserved */ | 167 | VECTOR(badtrap) /* 57: unassigned, reserved */ | |
168 | VECTOR(badtrap) /* 58: unassigned, reserved */ | 168 | VECTOR(badtrap) /* 58: unassigned, reserved */ | |
169 | VECTOR(badtrap) /* 59: unassigned, reserved */ | 169 | VECTOR(badtrap) /* 59: unassigned, reserved */ | |
170 | VECTOR(badtrap) /* 60: unassigned, reserved */ | 170 | VECTOR(badtrap) /* 60: unassigned, reserved */ | |
171 | VECTOR(badtrap) /* 61: unassigned, reserved */ | 171 | VECTOR(badtrap) /* 61: unassigned, reserved */ | |
172 | VECTOR(badtrap) /* 62: unassigned, reserved */ | 172 | VECTOR(badtrap) /* 62: unassigned, reserved */ | |
173 | VECTOR(badtrap) /* 63: unassigned, reserved */ | 173 | VECTOR(badtrap) /* 63: unassigned, reserved */ | |
174 | #define BADTRAP16 \ | 174 | #define BADTRAP16 \ | |
175 | VECTOR(badtrap) ; VECTOR(badtrap) ; \ | 175 | VECTOR(badtrap) ; VECTOR(badtrap) ; \ | |
176 | VECTOR(badtrap) ; VECTOR(badtrap) ; \ | 176 | VECTOR(badtrap) ; VECTOR(badtrap) ; \ | |
177 | VECTOR(badtrap) ; VECTOR(badtrap) ; \ | 177 | VECTOR(badtrap) ; VECTOR(badtrap) ; \ | |
178 | VECTOR(badtrap) ; VECTOR(badtrap) ; \ | 178 | VECTOR(badtrap) ; VECTOR(badtrap) ; \ | |
179 | VECTOR(badtrap) ; VECTOR(badtrap) ; \ | 179 | VECTOR(badtrap) ; VECTOR(badtrap) ; \ | |
180 | VECTOR(badtrap) ; VECTOR(badtrap) ; \ | 180 | VECTOR(badtrap) ; VECTOR(badtrap) ; \ | |
181 | VECTOR(badtrap) ; VECTOR(badtrap) ; \ | 181 | VECTOR(badtrap) ; VECTOR(badtrap) ; \ | |
182 | VECTOR(badtrap) ; VECTOR(badtrap) | 182 | VECTOR(badtrap) ; VECTOR(badtrap) | |
183 | 183 | |||
184 | BADTRAP16 /* 64-255: user interrupt vectors */ | 184 | BADTRAP16 /* 64-255: user interrupt vectors */ | |
185 | BADTRAP16 /* 64-255: user interrupt vectors */ | 185 | BADTRAP16 /* 64-255: user interrupt vectors */ | |
186 | BADTRAP16 /* 64-255: user interrupt vectors */ | 186 | BADTRAP16 /* 64-255: user interrupt vectors */ | |
187 | BADTRAP16 /* 64-255: user interrupt vectors */ | 187 | BADTRAP16 /* 64-255: user interrupt vectors */ | |
188 | BADTRAP16 /* 64-255: user interrupt vectors */ | 188 | BADTRAP16 /* 64-255: user interrupt vectors */ | |
189 | BADTRAP16 /* 64-255: user interrupt vectors */ | 189 | BADTRAP16 /* 64-255: user interrupt vectors */ | |
190 | BADTRAP16 /* 64-255: user interrupt vectors */ | 190 | BADTRAP16 /* 64-255: user interrupt vectors */ | |
191 | BADTRAP16 /* 64-255: user interrupt vectors */ | 191 | BADTRAP16 /* 64-255: user interrupt vectors */ | |
192 | BADTRAP16 /* 64-255: user interrupt vectors */ | 192 | BADTRAP16 /* 64-255: user interrupt vectors */ | |
193 | BADTRAP16 /* 64-255: user interrupt vectors */ | 193 | BADTRAP16 /* 64-255: user interrupt vectors */ | |
194 | BADTRAP16 /* 64-255: user interrupt vectors */ | 194 | BADTRAP16 /* 64-255: user interrupt vectors */ | |
195 | BADTRAP16 /* 64-255: user interrupt vectors */ | 195 | BADTRAP16 /* 64-255: user interrupt vectors */ | |
196 | 196 | |||
197 | 197 | |||
198 | STACK = 0x800000 | 198 | STACK = 0x800000 | |
199 | DIPSW = 0x49000000 | 199 | DIPSW = 0x49000000 | |
200 | 200 | |||
201 | ASENTRY_NOPROFILE(start1) | 201 | ASENTRY_NOPROFILE(start1) | |
202 | movw #PSL_HIGHIPL,%sr | no interrupts | 202 | movw #PSL_HIGHIPL,%sr | no interrupts | |
203 | movl #STACK,%sp | set SP | 203 | movl #STACK,%sp | set SP | |
204 | 204 | |||
205 | movl #_C_LABEL(prgcore), %a2 | save program address | 205 | movl #_C_LABEL(prgcore), %a2 | save program address | |
206 | movl #_ASM_LABEL(Reset), %a2@+ | save start of core | 206 | movl #_ASM_LABEL(Reset), %a2@+ | save start of core | |
207 | movl #_C_LABEL(end), %a2@+ | save end of core | 207 | movl #_C_LABEL(end), %a2@+ | save end of core | |
208 | movl #STACK, %a2@ | save initial stack addr | 208 | movl #STACK, %a2@ | save initial stack addr | |
209 | 209 | |||
210 | /* clear BSS area */ | 210 | /* clear BSS area */ | |
211 | movl #_C_LABEL(edata),%a2 | start of BSS | 211 | movl #_C_LABEL(edata),%a2 | start of BSS | |
212 | movl #_C_LABEL(end),%a3 | end | 212 | movl #_C_LABEL(end),%a3 | end | |
213 | Lbssclr: | 213 | Lbssclr: | |
214 | clrb %a2@+ | clear BSS | 214 | clrb %a2@+ | clear BSS | |
215 | cmpl %a2,%a3 | done? | 215 | cmpl %a2,%a3 | done? | |
216 | bne Lbssclr | no, keep going | 216 | bne Lbssclr | no, keep going | |
217 | 217 | |||
218 | /* save address to goto ROM monitor */ | 218 | /* save address to goto ROM monitor */ | |
219 | movec %vbr,%a0 | ROM vbr to %a0 | 219 | movec %vbr,%a0 | ROM vbr to %a0 | |
220 | movl %a0@(NMIVEC),%d0 | restore NMIVEC | 220 | movl %a0@(NMIVEC),%d0 | restore NMIVEC | |
221 | movl #_ASM_LABEL(gotoROM),%a0 | save to _gotoROM | 221 | movl #_ASM_LABEL(gotoROM),%a0 | save to _gotoROM | |
222 | movl %d0,%a0@ | | 222 | movl %d0,%a0@ | | |
223 | movl #_ASM_LABEL(Reset),%a0 | BP vbr to %a0 | 223 | movl #_ASM_LABEL(Reset),%a0 | BP vbr to %a0 | |
224 | movl #_C_LABEL(exit),%a0@(NMIVEC) | save address | 224 | movl #_C_LABEL(exit),%a0@(NMIVEC) | save address | |
225 | 225 | |||
226 | 226 | |||
227 | /* switch vector tabel */ | 227 | /* switch vector tabel */ | |
228 | movec %vbr,%a0 | 228 | movec %vbr,%a0 | |
229 | movl %a0@(ILLGINST),%sp@- | save ILLINST vector for BrkPtr | 229 | movl %a0@(ILLGINST),%sp@- | save ILLINST vector for BrkPtr | |
230 | movl %a0@(EVTRAPF),%sp@- | 230 | movl %a0@(EVTRAPF),%sp@- | |
231 | 231 | |||
232 | movl #_ASM_LABEL(Reset),%a0 | 232 | movl #_ASM_LABEL(Reset),%a0 | |
233 | movl %sp@+,%a0@(EVTRAPF) | 233 | movl %sp@+,%a0@(EVTRAPF) | |
234 | movl %sp@+,%a0@(ILLGINST) | restore ILLINST vector | 234 | movl %sp@+,%a0@(ILLGINST) | restore ILLINST vector | |
235 | movec %a0,%vbr | 235 | movec %a0,%vbr | |
236 | 236 | |||
237 | movl #DIPSW,%a0 | 237 | movl #DIPSW,%a0 | |
238 | movw %a0@,%d0 | 238 | movw %a0@,%d0 | |
239 | lsrl #8,%d0 | 239 | lsrl #8,%d0 | |
240 | andl #0xFF,%d0 | 240 | andl #0xFF,%d0 | |
241 | movl %d0,_C_LABEL(dipsw1) | 241 | movl %d0,_C_LABEL(dipsw1) | |
242 | movw %a0@,%d0 | 242 | movw %a0@,%d0 | |
243 | andl #0xFF,%d0 | 243 | andl #0xFF,%d0 | |
244 | movl %d0,_C_LABEL(dipsw2) | 244 | movl %d0,_C_LABEL(dipsw2) | |
245 | 245 | |||
246 | /* determine our CPU */ | 246 | /* determine our CPU */ | |
247 | 247 | |||
248 | /* XXX should be generated via assym.h */ | 248 | /* XXX should be generated via assym.h */ | |
249 | CACHE_OFF = 0x0808 | 249 | CACHE_OFF = 0x0808 | |
250 | DC_FREEZE = 0x0200 | 250 | DC_FREEZE = 0x0200 | |
251 | CPU_68030 = 1 | 251 | CPU_68030 = 1 | |
252 | CPU_68040 = 2 | 252 | CPU_68040 = 2 | |
253 | 253 | |||
254 | movl #CACHE_OFF,%d0 | 254 | movl #CACHE_OFF,%d0 | |
255 | movc %d0,%cacr | clear and disable on-chip cache(s) | 255 | movc %d0,%cacr | clear and disable on-chip cache(s) | |
256 | movl #DC_FREEZE,%d0 | data freeze bit | 256 | movl #DC_FREEZE,%d0 | data freeze bit | |
257 | movc %d0,%cacr | only exists on 68030 | 257 | movc %d0,%cacr | only exists on 68030 | |
258 | movc %cacr,%d0 | read it back | 258 | movc %cacr,%d0 | read it back | |
259 | tstl %d0 | zero? | 259 | tstl %d0 | zero? | |
260 | jeq Lnot68030 | yes, we have 68040 | 260 | jeq Lnot68030 | yes, we have 68040 | |
261 | movl #CPU_68030,%d0 | 261 | movl #CPU_68030,%d0 | |
262 | jra Lstart0 | 262 | jra Lstart0 | |
263 | Lnot68030: | 263 | Lnot68030: | |
264 | movl #CPU_68040,%d0 | 264 | movl #CPU_68040,%d0 | |
265 | Lstart0: | 265 | Lstart0: | |
266 | movl %d0,_C_LABEL(cputype) | 266 | movl %d0,_C_LABEL(cputype) | |
267 | 267 | |||
268 | /* final setup for C code */ | 268 | /* final setup for C code */ | |
269 | movw #PSL_LOWIPL,%sr | no interrupts | 269 | movw #PSL_LOWIPL,%sr | no interrupts | |
270 | jsr _C_LABEL(main) | lets go | 270 | jsr _C_LABEL(main) | lets go | |
271 | jsr start | 271 | jsr start | |
272 | 272 | |||
273 | /* | 273 | /* | |
274 | * exit to ROM monitor | 274 | * exit to ROM monitor | |
275 | */ | 275 | */ | |
276 | 276 | |||
277 | ROM_VBR = 0 | 277 | ROM_VBR = 0 | |
278 | 278 | |||
279 | ENTRY_NOPROFILE(exit) | 279 | ENTRY_NOPROFILE(exit) | |
280 | GLOBAL(_rtt) | 280 | GLOBAL(_rtt) | |
281 | movw #PSL_HIGHIPL,%sr | no interrupts | 281 | movw #PSL_HIGHIPL,%sr | no interrupts | |
282 | movl #ROM_VBR,%a0 | 282 | movl #ROM_VBR,%a0 | |
283 | movec %a0,%vbr | 283 | movec %a0,%vbr | |
284 | movl #_ASM_LABEL(gotoROM),%a0 | 284 | movl #_ASM_LABEL(gotoROM),%a0 | |
285 | movl %a0@,%a1 | 285 | movl %a0@,%a1 | |
286 | jmp %a1@ | 286 | jmp %a1@ | |
287 | 287 | |||
288 | /* | 288 | /* | |
289 | * Trap/interrupt vector routines | 289 | * Trap/interrupt vector routines | |
290 | */ | 290 | */ | |
291 | 291 | |||
292 | ENTRY_NOPROFILE(buserr) | 292 | ENTRY_NOPROFILE(buserr) | |
293 | tstl _C_LABEL(nofault) | device probe? | 293 | tstl _C_LABEL(nofault) | device probe? | |
294 | jeq _C_LABEL(addrerr) | no, handle as usual | 294 | jeq _C_LABEL(addrerr) | no, handle as usual | |
295 | movl _C_LABEL(nofault),%sp@- | yes, | 295 | movl _C_LABEL(nofault),%sp@- | yes, | |
296 | jbsr _C_LABEL(longjmp) | longjmp(nofault) | 296 | jbsr _C_LABEL(longjmp) | longjmp(nofault) | |
297 | ENTRY_NOPROFILE(addrerr) | 297 | ENTRY_NOPROFILE(addrerr) | |
298 | clrw %sp@- | pad SR to longword | 298 | clrw %sp@- | pad SR to longword | |
299 | moveml #0xFFFF,%sp@- | save user registers | 299 | moveml #0xFFFF,%sp@- | save user registers | |
300 | movl %usp,%a0 | save the user SP | 300 | movl %usp,%a0 | save the user SP | |
301 | movl %a0,%sp@(60) | in the savearea | 301 | movl %a0,%sp@(60) | in the savearea | |
302 | lea %sp@(64),%a1 | grab base of HW berr frame | 302 | lea %sp@(64),%a1 | grab base of HW berr frame | |
303 | movw %a1@(12),%d0 | grab SSW for fault processing | 303 | movw %a1@(12),%d0 | grab SSW for fault processing | |
304 | btst #12,%d0 | RB set? | 304 | btst #12,%d0 | RB set? | |
305 | jeq LbeX0 | no, test RC | 305 | jeq LbeX0 | no, test RC | |
306 | bset #14,%d0 | yes, must set FB | 306 | bset #14,%d0 | yes, must set FB | |
307 | movw %d0,%a1@(12) | for hardware too | 307 | movw %d0,%a1@(12) | for hardware too | |
308 | LbeX0: | 308 | LbeX0: | |
309 | btst #13,%d0 | RC set? | 309 | btst #13,%d0 | RC set? | |
310 | jeq LbeX1 | no, skip | 310 | jeq LbeX1 | no, skip | |
311 | bset #15,%d0 | yes, must set FC | 311 | bset #15,%d0 | yes, must set FC | |
312 | movw %d0,%a1@(12) | for hardware too | 312 | movw %d0,%a1@(12) | for hardware too | |
313 | LbeX1: | 313 | LbeX1: | |
314 | btst #8,%d0 | data fault? | 314 | btst #8,%d0 | data fault? | |
315 | jeq Lbe0 | no, check for hard cases | 315 | jeq Lbe0 | no, check for hard cases | |
316 | movl %a1@(18),%d1 | fault address is as given in frame | 316 | movl %a1@(18),%d1 | fault address is as given in frame | |
317 | jra Lbe10 | thats it | 317 | jra Lbe10 | thats it | |
318 | Lbe0: | 318 | Lbe0: | |
319 | btst #4,%a1@(8) | long (type B) stack frame? | 319 | btst #4,%a1@(8) | long (type B) stack frame? | |
320 | jne Lbe4 | yes, go handle | 320 | jne Lbe4 | yes, go handle | |
321 | movl %a1@(4),%d1 | no, can use save PC | 321 | movl %a1@(4),%d1 | no, can use save PC | |
322 | btst #14,%d0 | FB set? | 322 | btst #14,%d0 | FB set? | |
323 | jeq Lbe3 | no, try FC | 323 | jeq Lbe3 | no, try FC | |
324 | addql #4,%d1 | yes, adjust address | 324 | addql #4,%d1 | yes, adjust address | |
325 | jra Lbe10 | done | 325 | jra Lbe10 | done | |
326 | Lbe3: | 326 | Lbe3: | |
327 | btst #15,%d0 | FC set? | 327 | btst #15,%d0 | FC set? | |
328 | jeq Lbe10 | no, done | 328 | jeq Lbe10 | no, done | |
329 | addql #2,%d1 | yes, adjust address | 329 | addql #2,%d1 | yes, adjust address | |
330 | jra Lbe10 | done | 330 | jra Lbe10 | done | |
331 | Lbe4: | 331 | Lbe4: | |
332 | movl %a1@(38),%d1 | long format, use stage B address | 332 | movl %a1@(38),%d1 | long format, use stage B address | |
333 | btst #15,%d0 | FC set? | 333 | btst #15,%d0 | FC set? | |
334 | jeq Lbe10 | no, all done | 334 | jeq Lbe10 | no, all done | |
335 | subql #2,%d1 | yes, adjust address | 335 | subql #2,%d1 | yes, adjust address | |
336 | Lbe10: | 336 | Lbe10: | |
337 | movl %d1,%sp@- | push fault VA | 337 | movl %d1,%sp@- | push fault VA | |
338 | movw %d0,%sp@- | and SSW | 338 | movw %d0,%sp@- | and SSW | |
339 | clrw %sp@- | padded to longword | 339 | clrw %sp@- | padded to longword | |
340 | movw %a1@(8),%d0 | get frame format/vector offset | 340 | movw %a1@(8),%d0 | get frame format/vector offset | |
341 | andw #0x0FFF,%d0 | clear out frame format | 341 | andw #0x0FFF,%d0 | clear out frame format | |
342 | cmpw #12,%d0 | address error vector? | 342 | cmpw #12,%d0 | address error vector? | |
343 | jeq Lisaerr | yes, go to it | 343 | jeq Lisaerr | yes, go to it | |
344 | #if 0 | 344 | #if 0 | |
345 | movl %d1,%a0 | fault address | 345 | movl %d1,%a0 | fault address | |
346 | .long 0xf0109e11 | ptestr #1,%a0@,#7 | 346 | .long 0xf0109e11 | ptestr #1,%a0@,#7 | |
347 | .long 0xf0176200 | pmove %psr,%sp@ | 347 | .long 0xf0176200 | pmove %psr,%sp@ | |
348 | btst #7,%sp@ | bus error bit set? | 348 | btst #7,%sp@ | bus error bit set? | |
349 | jeq Lismerr | no, must be MMU fault | 349 | jeq Lismerr | no, must be MMU fault | |
350 | clrw %sp@ | yes, re-clear pad word | 350 | clrw %sp@ | yes, re-clear pad word | |
351 | #endif | 351 | #endif | |
352 | jra Lisberr | and process as normal bus error | 352 | jra Lisberr | and process as normal bus error | |
353 | Lismerr: | 353 | Lismerr: | |
354 | movl #T_MMUFLT,%sp@- | show that we are an MMU fault | 354 | movl #T_MMUFLT,%sp@- | show that we are an MMU fault | |
355 | jra Lbexit | and deal with it | 355 | jra Lbexit | and deal with it | |
356 | Lisaerr: | 356 | Lisaerr: | |
357 | movl #T_ADDRERR,%sp@- | mark address error | 357 | movl #T_ADDRERR,%sp@- | mark address error | |
358 | jra Lbexit | and deal with it | 358 | jra Lbexit | and deal with it | |
359 | Lisberr: | 359 | Lisberr: | |
360 | movl #T_BUSERR,%sp@- | mark bus error | 360 | movl #T_BUSERR,%sp@- | mark bus error | |
361 | Lbexit: | 361 | Lbexit: | |
362 | jbsr _C_LABEL(trap) | handle the error | 362 | jbsr _C_LABEL(trap) | handle the error | |
363 | lea %sp@(12),%sp | pop value args | 363 | lea %sp@(12),%sp | pop value args | |
364 | movl %sp@(60),%a0 | restore user SP | 364 | movl %sp@(60),%a0 | restore user SP | |
365 | movl %a0,%usp | from save area | 365 | movl %a0,%usp | from save area | |
366 | moveml %sp@+,#0x7FFF | restore most user regs | 366 | moveml %sp@+,#0x7FFF | restore most user regs | |
367 | addql #4,%sp | toss SSP | 367 | addql #4,%sp | toss SSP | |
368 | tstw %sp@+ | do we need to clean up stack? | 368 | tstw %sp@+ | do we need to clean up stack? | |
369 | jeq _ASM_LABEL(rei) | no, just continue | 369 | jeq _ASM_LABEL(rei) | no, just continue | |
370 | btst #7,%sp@(6) | type 9/10/11 frame? | 370 | btst #7,%sp@(6) | type 9/10/11 frame? | |
371 | jeq _ASM_LABEL(rei) | no, nothing to do | 371 | jeq _ASM_LABEL(rei) | no, nothing to do | |
372 | btst #5,%sp@(6) | type 9? | 372 | btst #5,%sp@(6) | type 9? | |
373 | jne Lbex1 | no, skip | 373 | jne Lbex1 | no, skip | |
374 | movw %sp@,%sp@(12) | yes, push down SR | 374 | movw %sp@,%sp@(12) | yes, push down SR | |
375 | movl %sp@(2),%sp@(14) | and PC | 375 | movl %sp@(2),%sp@(14) | and PC | |
376 | clrw %sp@(18) | and mark as type 0 frame | 376 | clrw %sp@(18) | and mark as type 0 frame | |
377 | lea %sp@(12),%sp | clean the excess | 377 | lea %sp@(12),%sp | clean the excess | |
378 | jra _ASM_LABEL(rei) | all done | 378 | jra _ASM_LABEL(rei) | all done | |
379 | Lbex1: | 379 | Lbex1: | |
380 | btst #4,%sp@(6) | type 10? | 380 | btst #4,%sp@(6) | type 10? | |
381 | jne Lbex2 | no, skip | 381 | jne Lbex2 | no, skip | |
382 | movw %sp@,%sp@(24) | yes, push down SR | 382 | movw %sp@,%sp@(24) | yes, push down SR | |
383 | movl %sp@(2),%sp@(26) | and PC | 383 | movl %sp@(2),%sp@(26) | and PC | |
384 | clrw %sp@(30) | and mark as type 0 frame | 384 | clrw %sp@(30) | and mark as type 0 frame | |
385 | lea %sp@(24),%sp | clean the excess | 385 | lea %sp@(24),%sp | clean the excess | |
386 | jra _ASM_LABEL(rei) | all done | 386 | jra _ASM_LABEL(rei) | all done | |
387 | Lbex2: | 387 | Lbex2: | |
388 | movw %sp@,%sp@(84) | type 11, push down SR | 388 | movw %sp@,%sp@(84) | type 11, push down SR | |
389 | movl %sp@(2),%sp@(86) | and PC | 389 | movl %sp@(2),%sp@(86) | and PC | |
390 | clrw %sp@(90) | and mark as type 0 frame | 390 | clrw %sp@(90) | and mark as type 0 frame | |
391 | lea %sp@(84),%sp | clean the excess | 391 | lea %sp@(84),%sp | clean the excess | |
392 | jra _ASM_LABEL(rei) | all done | 392 | jra _ASM_LABEL(rei) | all done | |
393 | 393 | |||
394 | ENTRY_NOPROFILE(illinst) | 394 | ENTRY_NOPROFILE(illinst) | |
395 | clrw %sp@- | 395 | clrw %sp@- | |
396 | moveml #0xFFFF,%sp@- | 396 | moveml #0xFFFF,%sp@- | |
397 | moveq #T_ILLINST,%d0 | 397 | moveq #T_ILLINST,%d0 | |
398 | jra _C_LABEL(fault) | 398 | jra _C_LABEL(fault) | |
399 | 399 | |||
400 | ENTRY_NOPROFILE(zerodiv) | 400 | ENTRY_NOPROFILE(zerodiv) | |
401 | clrw %sp@- | 401 | clrw %sp@- | |
402 | moveml #0xFFFF,%sp@- | 402 | moveml #0xFFFF,%sp@- | |
403 | moveq #T_ZERODIV,%d0 | 403 | moveq #T_ZERODIV,%d0 | |
404 | jra _C_LABEL(fault) | 404 | jra _C_LABEL(fault) | |
405 | 405 | |||
406 | ENTRY_NOPROFILE(chkinst) | 406 | ENTRY_NOPROFILE(chkinst) | |
407 | clrw %sp@- | 407 | clrw %sp@- | |
408 | moveml #0xFFFF,%sp@- | 408 | moveml #0xFFFF,%sp@- | |
409 | moveq #T_CHKINST,%d0 | 409 | moveq #T_CHKINST,%d0 | |
410 | jra _C_LABEL(fault) | 410 | jra _C_LABEL(fault) | |
411 | 411 | |||
412 | ENTRY_NOPROFILE(trapvinst) | 412 | ENTRY_NOPROFILE(trapvinst) | |
413 | clrw %sp@- | 413 | clrw %sp@- | |
414 | moveml #0xFFFF,%sp@- | 414 | moveml #0xFFFF,%sp@- | |
415 | moveq #T_TRAPVINST,%d0 | 415 | moveq #T_TRAPVINST,%d0 | |
416 | jra _C_LABEL(fault) | 416 | jra _C_LABEL(fault) | |
417 | 417 | |||
418 | ENTRY_NOPROFILE(privinst) | 418 | ENTRY_NOPROFILE(privinst) | |
419 | clrw %sp@- | 419 | clrw %sp@- | |
420 | moveml #0xFFFF,%sp@- | 420 | moveml #0xFFFF,%sp@- | |
421 | moveq #T_PRIVINST,%d0 | 421 | moveq #T_PRIVINST,%d0 | |
422 | jra _C_LABEL(fault) | 422 | jra _C_LABEL(fault) | |
423 | 423 | |||
424 | ENTRY_NOPROFILE(coperr) | 424 | ENTRY_NOPROFILE(coperr) | |
425 | clrw %sp@- | 425 | clrw %sp@- | |
426 | moveml #0xFFFF,%sp@- | 426 | moveml #0xFFFF,%sp@- | |
427 | moveq #T_COPERR,%d0 | 427 | moveq #T_COPERR,%d0 | |
428 | jra _C_LABEL(fault) | 428 | jra _C_LABEL(fault) | |
429 | 429 | |||
430 | ENTRY_NOPROFILE(fmterr) | 430 | ENTRY_NOPROFILE(fmterr) | |
431 | clrw %sp@- | 431 | clrw %sp@- | |
432 | moveml #0xFFFF,%sp@- | 432 | moveml #0xFFFF,%sp@- | |
433 | moveq #T_FMTERR,%d0 | 433 | moveq #T_FMTERR,%d0 | |
434 | jra _C_LABEL(fault) | 434 | jra _C_LABEL(fault) | |
435 | 435 | |||
436 | ENTRY_NOPROFILE(fptrap) | 436 | ENTRY_NOPROFILE(fptrap) | |
437 | #ifdef FPCOPROC | 437 | #ifdef FPCOPROC | |
438 | clrw %sp@- | pad SR to longword | 438 | clrw %sp@- | pad SR to longword | |
439 | moveml #0xFFFF,%sp@- | save user registers | 439 | moveml #0xFFFF,%sp@- | save user registers | |
440 | movl %usp,%a0 | and save | 440 | movl %usp,%a0 | and save | |
441 | movl %a0,%sp@(60) | the user stack pointer | 441 | movl %a0,%sp@(60) | the user stack pointer | |
442 | clrl %sp@- | no VA arg | 442 | clrl %sp@- | no VA arg | |
443 | #if 0 | 443 | #if 0 | |
444 | lea _u+PCB_FPCTX,%a0 | address of FP savearea | 444 | lea _u+PCB_FPCTX,%a0 | address of FP savearea | |
445 | .word 0xf310 | fsave %a0@ | 445 | .word 0xf310 | fsave %a0@ | |
446 | tstb %a0@ | null state frame? | 446 | tstb %a0@ | null state frame? | |
447 | jeq Lfptnull | yes, safe | 447 | jeq Lfptnull | yes, safe | |
448 | clrw %d0 | no, need to tweak BIU | 448 | clrw %d0 | no, need to tweak BIU | |
449 | movb a0@(1),d0 | get frame size | 449 | movb a0@(1),d0 | get frame size | |
450 | bset #3,%a0@(0,%d0:w) | set exc_pend bit of BIU | 450 | bset #3,%a0@(0,%d0:w) | set exc_pend bit of BIU | |
451 | Lfptnull: | 451 | Lfptnull: | |
452 | .word 0xf227,0xa800 | fmovem %fpsr,%sp@- (code arg) | 452 | .word 0xf227,0xa800 | fmovem %fpsr,%sp@- (code arg) | |
453 | .word 0xf350 | frestore %a0@ | 453 | .word 0xf350 | frestore %a0@ | |
454 | #else | 454 | #else | |
455 | clrl %sp@- | push dummy FPSR | 455 | clrl %sp@- | push dummy FPSR | |
456 | #endif | 456 | #endif | |
457 | movl #T_FPERR,%sp@- | push type arg | 457 | movl #T_FPERR,%sp@- | push type arg | |
458 | jbsr _C_LABEL(trap) | call trap | 458 | jbsr _C_LABEL(trap) | call trap | |
459 | lea %sp@(12),%sp | pop value args | 459 | lea %sp@(12),%sp | pop value args | |
460 | movl %sp@(60),%a0 | restore | 460 | movl %sp@(60),%a0 | restore | |
461 | movl %a0,%usp | user SP | 461 | movl %a0,%usp | user SP | |
462 | moveml %sp@+,#0x7FFF | and remaining user registers | 462 | moveml %sp@+,#0x7FFF | and remaining user registers | |
463 | addql #6,%sp | pop SSP and align word | 463 | addql #6,%sp | pop SSP and align word | |
464 | jra _ASM_LABEL(rei) | all done | 464 | jra _ASM_LABEL(rei) | all done | |
465 | #else | 465 | #else | |
466 | jra _C_LABEL(badtrap) | treat as an unexpected trap | 466 | jra _C_LABEL(badtrap) | treat as an unexpected trap | |
467 | #endif | 467 | #endif | |
468 | 468 | |||
469 | ENTRY_NOPROFILE(fault) | 469 | ENTRY_NOPROFILE(fault) | |
470 | movl %usp,%a0 | get and save | 470 | movl %usp,%a0 | get and save | |
471 | movl %a0,%sp@(60) | the user stack pointer | 471 | movl %a0,%sp@(60) | the user stack pointer | |
472 | clrl %sp@- | no VA arg | 472 | clrl %sp@- | no VA arg | |
473 | clrl %sp@- | or code arg | 473 | clrl %sp@- | or code arg | |
474 | movl %d0,%sp@- | push trap type | 474 | movl %d0,%sp@- | push trap type | |
475 | jbsr _C_LABEL(trap) | handle trap | 475 | jbsr _C_LABEL(trap) | handle trap | |
476 | lea %sp@(12),%sp | pop value args | 476 | lea %sp@(12),%sp | pop value args | |
477 | movl %sp@(60),%a0 | restore | 477 | movl %sp@(60),%a0 | restore | |
478 | movl %a0,%usp | user SP | 478 | movl %a0,%usp | user SP | |
479 | moveml %sp@+,#0x7FFF | restore most user regs | 479 | moveml %sp@+,#0x7FFF | restore most user regs | |
480 | addql #6,%sp | pop SP and pad word | 480 | addql #6,%sp | pop SP and pad word | |
481 | jra _ASM_LABEL(rei) | all done | 481 | jra _ASM_LABEL(rei) | all done | |
482 | 482 | |||
483 | ENTRY_NOPROFILE(badtrap) | 483 | ENTRY_NOPROFILE(badtrap) | |
484 | clrw %sp@- | 484 | clrw %sp@- | |
485 | moveml #0xC0C0,%sp@- | 485 | moveml #0xC0C0,%sp@- | |
486 | movw %sp@(24),%sp@- | 486 | movw %sp@(24),%sp@- | |
487 | clrw %sp@- | 487 | clrw %sp@- | |
488 | jbsr _C_LABEL(straytrap) | 488 | jbsr _C_LABEL(straytrap) | |
489 | addql #4,%sp | 489 | addql #4,%sp | |
490 | moveml %sp@+,#0x0303 | 490 | moveml %sp@+,#0x0303 | |
491 | addql #2,%sp | 491 | addql #2,%sp | |
492 | jra _ASM_LABEL(rei) | 492 | jra _ASM_LABEL(rei) | |
493 | 493 | |||
494 | /* | 494 | /* | |
495 | * Interrupt handlers. | 495 | * Interrupt handlers. | |
496 | * All device interrupts are auto-vectored. Most can be configured | 496 | * All device interrupts are auto-vectored. Most can be configured | |
497 | * to interrupt in the range IPL2 to IPL6. Here are our assignments: | 497 | * to interrupt in the range IPL2 to IPL6. Here are our assignments: | |
498 | * | 498 | * | |
499 | * Level 0: | 499 | * Level 0: | |
500 | * Level 1: | 500 | * Level 1: | |
501 | * Level 2: SCSI SPC | 501 | * Level 2: SCSI SPC | |
502 | * Level 3: | 502 | * Level 3: | |
503 | * Level 4: | 503 | * Level 4: | |
504 | * Level 5: System Clock | 504 | * Level 5: System Clock | |
505 | * Level 6: Internal SIO used uPD7201A | 505 | * Level 6: Internal SIO used uPD7201A | |
506 | * Level 7: Non-maskable: Abort Key (Dispatched vector to ROM monitor) | 506 | * Level 7: Non-maskable: Abort Key (Dispatched vector to ROM monitor) | |
507 | */ | 507 | */ | |
508 | 508 | |||
509 | ENTRY_NOPROFILE(lev2intr) | 509 | ENTRY_NOPROFILE(lev2intr) | |
510 | clrw %sp@- | 510 | clrw %sp@- | |
511 | moveml #0xC0C0,%sp@- | 511 | moveml #0xC0C0,%sp@- | |
512 | jbsr _C_LABEL(scintr) | 512 | jbsr _C_LABEL(scintr) | |
513 | moveml %sp@+,#0x0303 | 513 | moveml %sp@+,#0x0303 | |
514 | addql #2,%sp | 514 | addql #2,%sp | |
515 | jra _ASM_LABEL(rei) | 515 | jra _ASM_LABEL(rei) | |
516 | 516 | |||
517 | ENTRY_NOPROFILE(lev3intr) | 517 | ENTRY_NOPROFILE(lev3intr) | |
518 | clrw %sp@- | 518 | clrw %sp@- | |
519 | moveml #0xC0C0,%sp@- | 519 | moveml #0xC0C0,%sp@- | |
520 | jbsr _C_LABEL(lance_intr) | 520 | jbsr _C_LABEL(lance_intr) | |
521 | moveml %sp@+,#0x0303 | 521 | moveml %sp@+,#0x0303 | |
522 | addql #2,%sp | 522 | addql #2,%sp | |
523 | jra _ASM_LABEL(rei) | 523 | jra _ASM_LABEL(rei) | |
524 | 524 | |||
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 | |
554 | * (profiling, scheduling) and software interrupts (network, softclock). | 558 | * (profiling, scheduling) and software interrupts (network, softclock). | |
555 | * We check for ASTs first, just like the VAX. To avoid excess overhead | 559 | * We check for ASTs first, just like the VAX. To avoid excess overhead | |
556 | * the T_ASTFLT handling code will also check for software interrupts so we | 560 | * the T_ASTFLT handling code will also check for software interrupts so we | |
557 | * do not have to do it here. | 561 | * do not have to do it here. | |
558 | * | 562 | * | |
559 | * This code is complicated by the fact that sendsig may have been called | 563 | * This code is complicated by the fact that sendsig may have been called | |
560 | * necessitating a stack cleanup. A cleanup should only be needed at this | 564 | * necessitating a stack cleanup. A cleanup should only be needed at this | |
561 | * point for coprocessor mid-instruction frames (type 9), but we also test | 565 | * point for coprocessor mid-instruction frames (type 9), but we also test | |
562 | * for bus error frames (type 10 and 11). | 566 | * for bus error frames (type 10 and 11). | |
563 | */ | 567 | */ | |
564 | #if 0 | 568 | #if 0 | |
565 | .comm _ssir,1 | 569 | .comm _ssir,1 | |
566 | ASENTRY_NOPROFILE(rei) | 570 | ASENTRY_NOPROFILE(rei) | |
567 | #ifdef DEBUG | 571 | #ifdef DEBUG | |
568 | tstl _C_LABEL(panicstr) | have we paniced? | 572 | tstl _C_LABEL(panicstr) | have we paniced? | |
569 | jne Ldorte | yes, do not make matters worse | 573 | jne Ldorte | yes, do not make matters worse | |
570 | #endif | 574 | #endif | |
571 | btst #PCB_ASTB,_u+PCB_FLAGS+1| AST pending? | 575 | btst #PCB_ASTB,_u+PCB_FLAGS+1| AST pending? | |
572 | jeq Lchksir | no, go check for SIR | 576 | jeq Lchksir | no, go check for SIR | |
573 | btst #5,%sp@ | yes, are we returning to user mode? | 577 | btst #5,%sp@ | yes, are we returning to user mode? | |
574 | jne Lchksir | no, go check for SIR | 578 | jne Lchksir | no, go check for SIR | |
575 | clrw %sp@- | pad SR to longword | 579 | clrw %sp@- | pad SR to longword | |
576 | moveml #0xFFFF,%sp@- | save all registers | 580 | moveml #0xFFFF,%sp@- | save all registers | |
577 | movl %usp,%a1 | including | 581 | movl %usp,%a1 | including | |
578 | movl %a1,%sp@(60) | the users SP | 582 | movl %a1,%sp@(60) | the users SP | |
579 | clrl %sp@- | VA == none | 583 | clrl %sp@- | VA == none | |
580 | clrl %sp@- | code == none | 584 | clrl %sp@- | code == none | |
581 | movl #T_ASTFLT,%sp@- | type == async system trap | 585 | movl #T_ASTFLT,%sp@- | type == async system trap | |
582 | jbsr _C_LABEL(trap) | go handle it | 586 | jbsr _C_LABEL(trap) | go handle it | |
583 | lea %sp@(12),%sp | pop value args | 587 | lea %sp@(12),%sp | pop value args | |
584 | movl %sp@(60),%a0 | restore | 588 | movl %sp@(60),%a0 | restore | |
585 | movl %a0,%usp | user SP | 589 | movl %a0,%usp | user SP | |
586 | moveml %sp@+,#0x7FFF | and all remaining registers | 590 | moveml %sp@+,#0x7FFF | and all remaining registers | |
587 | addql #4,%sp | toss SSP | 591 | addql #4,%sp | toss SSP | |
588 | tstw %sp@+ | do we need to clean up stack? | 592 | tstw %sp@+ | do we need to clean up stack? | |
589 | jeq Ldorte | no, just continue | 593 | jeq Ldorte | no, just continue | |
590 | btst #7,%sp@(6) | type 9/10/11 frame? | 594 | btst #7,%sp@(6) | type 9/10/11 frame? | |
591 | jeq Ldorte | no, nothing to do | 595 | jeq Ldorte | no, nothing to do | |
592 | btst #5,%sp@(6) | type 9? | 596 | btst #5,%sp@(6) | type 9? | |
593 | jne Last1 | no, skip | 597 | jne Last1 | no, skip | |
594 | movw %sp@,%sp@(12) | yes, push down SR | 598 | movw %sp@,%sp@(12) | yes, push down SR | |
595 | movl %sp@(2),%sp@(14) | and PC | 599 | movl %sp@(2),%sp@(14) | and PC | |
596 | clrw %sp@(18) | and mark as type 0 frame | 600 | clrw %sp@(18) | and mark as type 0 frame | |
597 | lea %sp@(12),%sp | clean the excess | 601 | lea %sp@(12),%sp | clean the excess | |
598 | jra Ldorte | all done | 602 | jra Ldorte | all done | |
599 | Last1: | 603 | Last1: | |
600 | btst #4,%sp@(6) | type 10? | 604 | btst #4,%sp@(6) | type 10? | |
601 | jne Last2 | no, skip | 605 | jne Last2 | no, skip | |
602 | movw %sp@,%sp@(24) | yes, push down SR | 606 | movw %sp@,%sp@(24) | yes, push down SR | |
603 | movl %sp@(2),%sp@(26) | and PC | 607 | movl %sp@(2),%sp@(26) | and PC | |
604 | clrw %sp@(30) | and mark as type 0 frame | 608 | clrw %sp@(30) | and mark as type 0 frame | |
605 | lea %sp@(24),%sp | clean the excess | 609 | lea %sp@(24),%sp | clean the excess | |
606 | jra Ldorte | all done | 610 | jra Ldorte | all done | |
607 | Last2: | 611 | Last2: | |
608 | movw %sp@,%sp@(84) | type 11, push down SR | 612 | movw %sp@,%sp@(84) | type 11, push down SR | |
609 | movl %sp@(2),%sp@(86) | and PC | 613 | movl %sp@(2),%sp@(86) | and PC | |
610 | clrw %sp@(90) | and mark as type 0 frame | 614 | clrw %sp@(90) | and mark as type 0 frame | |
611 | lea %sp@(84),%sp | clean the excess | 615 | lea %sp@(84),%sp | clean the excess | |
612 | jra Ldorte | all done | 616 | jra Ldorte | all done | |
613 | Lchksir: | 617 | Lchksir: | |
614 | tstb _ssir | SIR pending? | 618 | tstb _ssir | SIR pending? | |
615 | jeq Ldorte | no, all done | 619 | jeq Ldorte | no, all done | |
616 | movl %d0,%sp@- | need a scratch register | 620 | movl %d0,%sp@- | need a scratch register | |
617 | movw %sp@(4),%d0 | get SR | 621 | movw %sp@(4),%d0 | get SR | |
618 | andw #PSL_IPL7,%d0 | mask all but IPL | 622 | andw #PSL_IPL7,%d0 | mask all but IPL | |
619 | jne Lnosir | came from interrupt, no can do | 623 | jne Lnosir | came from interrupt, no can do | |
620 | movl %sp@+,%d0 | restore scratch register | 624 | movl %sp@+,%d0 | restore scratch register | |
621 | Lgotsir: | 625 | Lgotsir: | |
622 | movw #SPL1,%sr | prevent others from servicing int | 626 | movw #SPL1,%sr | prevent others from servicing int | |
623 | tstb _ssir | too late? | 627 | tstb _ssir | too late? | |
624 | jeq Ldorte | yes, oh well... | 628 | jeq Ldorte | yes, oh well... | |
625 | clrw %sp@- | pad SR to longword | 629 | clrw %sp@- | pad SR to longword | |
626 | moveml #0xFFFF,%sp@- | save all registers | 630 | moveml #0xFFFF,%sp@- | save all registers | |
627 | movl %usp,%a1 | including | 631 | movl %usp,%a1 | including | |
628 | movl %a1,%sp@(60) | the users SP | 632 | movl %a1,%sp@(60) | the users SP | |
629 | clrl %sp@- | VA == none | 633 | clrl %sp@- | VA == none | |
630 | clrl %sp@- | code == none | 634 | clrl %sp@- | code == none | |
631 | movl #T_SSIR,%sp@- | type == software interrupt | 635 | movl #T_SSIR,%sp@- | type == software interrupt | |
632 | jbsr _trap | go handle it | 636 | jbsr _trap | go handle it | |
633 | lea %sp@(12),%sp | pop value args | 637 | lea %sp@(12),%sp | pop value args | |
634 | movl %sp@(60),%a0 | restore | 638 | movl %sp@(60),%a0 | restore | |
635 | movl %a0,%usp | user SP | 639 | movl %a0,%usp | user SP | |
636 | moveml %sp@+,#0x7FFF | and all remaining registers | 640 | moveml %sp@+,#0x7FFF | and all remaining registers | |
637 | addql #6,%sp | pop SSP and align word | 641 | addql #6,%sp | pop SSP and align word | |
638 | rte | 642 | rte | |
639 | Lnosir: | 643 | Lnosir: | |
640 | movl %sp@+,%d0 | restore scratch register | 644 | movl %sp@+,%d0 | restore scratch register | |
641 | Ldorte: | 645 | Ldorte: | |
642 | #else | 646 | #else | |
643 | ASENTRY_NOPROFILE(rei) | dummy Entry of rei | 647 | ASENTRY_NOPROFILE(rei) | dummy Entry of rei | |
644 | #endif | 648 | #endif | |
645 | rte | real return | 649 | rte | real return | |
646 | 650 | |||
647 | /* | 651 | /* | |
648 | * non-local gotos | 652 | * non-local gotos | |
649 | */ | 653 | */ | |
650 | ALTENTRY(savectx, _setjmp) | 654 | ALTENTRY(savectx, _setjmp) | |
651 | ENTRY(setjmp) | 655 | ENTRY(setjmp) | |
652 | movl %sp@(4),%a0 | savearea pointer | 656 | movl %sp@(4),%a0 | savearea pointer | |
653 | moveml #0xFCFC,%a0@ | save d2-d7/a2-a7 | 657 | moveml #0xFCFC,%a0@ | save d2-d7/a2-a7 | |
654 | movl %sp@,%a0@(48) | and return address | 658 | movl %sp@,%a0@(48) | and return address | |
655 | moveq #0,%d0 | return 0 | 659 | moveq #0,%d0 | return 0 | |
656 | rts | 660 | rts | |
657 | 661 | |||
658 | ENTRY(qsetjmp) | 662 | ENTRY(qsetjmp) | |
659 | movl %sp@(4),%a0 | savearea pointer | 663 | movl %sp@(4),%a0 | savearea pointer | |
660 | lea %a0@(40),%a0 | skip regs we do not save | 664 | lea %a0@(40),%a0 | skip regs we do not save | |
661 | movl %a6,%a0@+ | save FP | 665 | movl %a6,%a0@+ | save FP | |
662 | movl %sp,%a0@+ | save SP | 666 | movl %sp,%a0@+ | save SP | |
663 | movl %sp@,%a0@ | and return address | 667 | movl %sp@,%a0@ | and return address | |
664 | moveq #0,%d0 | return 0 | 668 | moveq #0,%d0 | return 0 | |
665 | rts | 669 | rts | |
666 | 670 | |||
667 | ENTRY(longjmp) | 671 | ENTRY(longjmp) | |
668 | movl %sp@(4),%a0 | 672 | movl %sp@(4),%a0 | |
669 | moveml %a0@+,#0xFCFC | 673 | moveml %a0@+,#0xFCFC | |
670 | movl %a0@,%sp@ | 674 | movl %a0@,%sp@ | |
671 | moveq #1,%d0 | 675 | moveq #1,%d0 | |
672 | rts | 676 | rts | |
673 | 677 | |||
674 | ENTRY_NOPROFILE(getsfc) | 678 | ENTRY_NOPROFILE(getsfc) | |
675 | movc %sfc,%d0 | 679 | movc %sfc,%d0 | |
676 | rts | 680 | rts | |
677 | ENTRY_NOPROFILE(getdfc) | 681 | ENTRY_NOPROFILE(getdfc) | |
678 | movc %dfc,%d0 | 682 | movc %dfc,%d0 | |
679 | rts | 683 | rts | |
680 | 684 | |||
681 | /* | 685 | /* | |
682 | * Set processor priority level calls. Most could (should) be replaced | 686 | * Set processor priority level calls. Most could (should) be replaced | |
683 | * by inline asm expansions. However, SPL0 and SPLX require special | 687 | * by inline asm expansions. However, SPL0 and SPLX require special | |
684 | * handling. If we are returning to the base processor priority (SPL0) | 688 | * handling. If we are returning to the base processor priority (SPL0) | |
685 | * we need to check for our emulated software interrupts. | 689 | * we need to check for our emulated software interrupts. | |
686 | */ | 690 | */ | |
687 | 691 | |||
688 | ENTRY(spl0) | 692 | ENTRY(spl0) | |
689 | moveq #0,%d0 | 693 | moveq #0,%d0 | |
690 | movw %sr,%d0 | get old SR for return | 694 | movw %sr,%d0 | get old SR for return | |
691 | movw #PSL_LOWIPL,%sr | restore new SR | 695 | movw #PSL_LOWIPL,%sr | restore new SR | |
692 | | jra Lsplsir | 696 | | jra Lsplsir | |
693 | rts | 697 | rts | |
694 | 698 | |||
695 | ENTRY(splx) | 699 | ENTRY(splx) | |
696 | moveq #0,%d0 | 700 | moveq #0,%d0 | |
697 | movw %sr,%d0 | get current SR for return | 701 | movw %sr,%d0 | get current SR for return | |
698 | movw %sp@(6),%d1 | get new value | 702 | movw %sp@(6),%d1 | get new value | |
699 | movw %d1,%sr | restore new SR | 703 | movw %d1,%sr | restore new SR | |
700 | | andw #PSL_IPL7,%d1 | mask all but PSL_IPL | 704 | | andw #PSL_IPL7,%d1 | mask all but PSL_IPL | |
701 | | jne Lspldone | non-zero, all done | 705 | | jne Lspldone | non-zero, all done | |
702 | |Lsplsir: | 706 | |Lsplsir: | |
703 | | tstb _ssir | software interrupt pending? | 707 | | tstb _ssir | software interrupt pending? | |
704 | | jeq Lspldone | no, all done | 708 | | jeq Lspldone | no, all done | |
705 | | subql #4,%sp | make room for RTE frame | 709 | | subql #4,%sp | make room for RTE frame | |
706 | | movl %sp@(4),%sp@(2) | position return address | 710 | | movl %sp@(4),%sp@(2) | position return address | |
707 | | clrw %sp@(6) | set frame type 0 | 711 | | clrw %sp@(6) | set frame type 0 | |
708 | | movw #PSL_LOWIPL,%sp@ | and new SR | 712 | | movw #PSL_LOWIPL,%sp@ | and new SR | |
709 | | jra Lgotsir | go handle it | 713 | | jra Lgotsir | go handle it | |
710 | |Lspldone: | 714 | |Lspldone: | |
711 | rts | 715 | rts | |
712 | 716 | |||
713 | ENTRY(spl1) | 717 | ENTRY(spl1) | |
714 | moveq #0,%d0 | 718 | moveq #0,%d0 | |
715 | movw %sr,%d0 | 719 | movw %sr,%d0 | |
716 | movw #SPL1,%sr | 720 | movw #SPL1,%sr | |
717 | rts | 721 | rts | |
718 | 722 | |||
719 | ALTENTRY(splscsi, _spl2) | 723 | ALTENTRY(splscsi, _spl2) | |
720 | ENTRY(spl2) | 724 | ENTRY(spl2) | |
721 | moveq #0,%d0 | 725 | moveq #0,%d0 | |
722 | movw %sr,%d0 | 726 | movw %sr,%d0 | |
723 | movw #SPL2,%sr | 727 | movw #SPL2,%sr | |
724 | rts | 728 | rts | |
725 | 729 | |||
726 | ENTRY(spl3) | 730 | ENTRY(spl3) | |
727 | moveq #0,%d0 | 731 | moveq #0,%d0 | |
728 | movw %sr,%d0 | 732 | movw %sr,%d0 | |
729 | movw #SPL3,%sr | 733 | movw #SPL3,%sr | |
730 | rts | 734 | rts | |
731 | 735 | |||
732 | ENTRY(spl4) | 736 | ENTRY(spl4) | |
733 | moveq #0,%d0 | 737 | moveq #0,%d0 | |
734 | movw %sr,%d0 | 738 | movw %sr,%d0 | |
735 | movw #SPL4,%sr | 739 | movw #SPL4,%sr | |
736 | rts | 740 | rts | |
737 | 741 | |||
738 | ENTRY(spl5) | 742 | ENTRY(spl5) | |
739 | moveq #0,%d0 | 743 | moveq #0,%d0 | |
740 | movw %sr,%d0 | 744 | movw %sr,%d0 | |
741 | movw #SPL5,%sr | 745 | movw #SPL5,%sr | |
742 | rts | 746 | rts | |
743 | 747 | |||
744 | ENTRY(spl6) | 748 | ENTRY(spl6) | |
745 | moveq #0,%d0 | 749 | moveq #0,%d0 | |
746 | movw %sr,%d0 | 750 | movw %sr,%d0 | |
747 | movw #SPL6,%sr | 751 | movw #SPL6,%sr | |
748 | rts | 752 | rts | |
749 | 753 | |||
750 | ALTENTRY(splhigh, _spl7) | 754 | ALTENTRY(splhigh, _spl7) | |
751 | ENTRY(spl7) | 755 | ENTRY(spl7) | |
752 | moveq #0,%d0 | 756 | moveq #0,%d0 | |
753 | movw %sr,%d0 | 757 | movw %sr,%d0 | |
754 | movw #PSL_HIGHIPL,%sr | 758 | movw #PSL_HIGHIPL,%sr | |
755 | rts | 759 | rts | |
756 | 760 | |||
757 | 761 | |||
758 | .data | 762 | .data | |
759 | 763 | |||
760 | /* | 764 | /* | |
761 | * Memory Infomation Field for secondary booter memory allocator | 765 | * Memory Infomation Field for secondary booter memory allocator | |
762 | */ | 766 | */ | |
763 | 767 | |||
764 | GLOBAL(prgcore) | 768 | GLOBAL(prgcore) | |
765 | .long 0 | 769 | .long 0 | |
766 | .long 0 | 770 | .long 0 | |
767 | .long 0 | 771 | .long 0 | |
768 | 772 | |||
769 | ASLOCAL(gotoROM) | 773 | ASLOCAL(gotoROM) | |
770 | .long 0 | 774 | .long 0 | |
771 | 775 | |||
772 | GLOBAL(dipsw1) | 776 | GLOBAL(dipsw1) | |
773 | .long 0 | 777 | .long 0 | |
774 | 778 | |||
775 | GLOBAL(dipsw2) | 779 | GLOBAL(dipsw2) | |
776 | .long 0 | 780 | .long 0 | |
777 | 781 | |||
778 | GLOBAL(cputype) | 782 | GLOBAL(cputype) | |
779 | .long CPU_68030 | 783 | .long CPU_68030 |
--- 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,228 +1,231 @@ | @@ -1,228 +1,231 @@ | |||
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. | |
15 | * 3. Neither the name of the University nor the names of its contributors | 15 | * 3. Neither the name of the University nor the names of its contributors | |
16 | * may be used to endorse or promote products derived from this software | 16 | * may be used to endorse or promote products derived from this software | |
17 | * without specific prior written permission. | 17 | * without specific prior written permission. | |
18 | * | 18 | * | |
19 | * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND | 19 | * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND | |
20 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | 20 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
21 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | 21 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |
22 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE | 22 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE | |
23 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | 23 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
24 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | 24 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | |
25 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | 25 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
26 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | 26 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |
27 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | 27 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
28 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | 28 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
29 | * SUCH DAMAGE. | 29 | * SUCH DAMAGE. | |
30 | * | 30 | * | |
31 | * @(#)samachdep.h 8.1 (Berkeley) 6/10/93 | 31 | * @(#)samachdep.h 8.1 (Berkeley) 6/10/93 | |
32 | */ | 32 | */ | |
33 | 33 | |||
34 | #include <sys/param.h> | 34 | #include <sys/param.h> | |
35 | #include <m68k/frame.h> | 35 | #include <m68k/frame.h> | |
36 | #include <lib/libsa/stand.h> | 36 | #include <lib/libsa/stand.h> | |
37 | 37 | |||
38 | #define NSCSI 2 | 38 | #define NSCSI 2 | |
39 | #define NSD 8 | 39 | #define NSD 8 | |
40 | #define DK_NDRIVE 8 | 40 | #define DK_NDRIVE 8 | |
41 | 41 | |||
42 | #define MHZ_8 1 | 42 | #define MHZ_8 1 | |
43 | #define MHZ_16 2 | 43 | #define MHZ_16 2 | |
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 */ | |
74 | extern int howto; | 76 | extern int howto; | |
75 | extern char default_file[]; | 77 | extern char default_file[]; | |
76 | int how_to_boot(int, char **); | 78 | int how_to_boot(int, char **); | |
77 | int boot(int, char **); | 79 | int boot(int, char **); | |
78 | int bootnetbsd(char *); | 80 | int bootnetbsd(char *); | |
79 | 81 | |||
80 | /* clock.c */ | 82 | /* clock.c */ | |
81 | /* not yet */ | 83 | /* not yet */ | |
82 | 84 | |||
83 | /* cons.c */ | 85 | /* cons.c */ | |
84 | void cninit(void); | 86 | void cninit(void); | |
85 | int cngetc(void); | 87 | int cngetc(void); | |
86 | void cnputc(int); | 88 | void cnputc(int); | |
87 | 89 | |||
88 | /* devopen.c */ | 90 | /* devopen.c */ | |
89 | extern u_int opendev; | 91 | extern u_int opendev; | |
90 | int atoi(char *); | 92 | int atoi(char *); | |
91 | 93 | |||
92 | /* disklabel.c */ | 94 | /* disklabel.c */ | |
93 | extern u_char lbl_buff[]; | 95 | extern u_char lbl_buff[]; | |
94 | int disklabel(int, char **); | 96 | int disklabel(int, char **); | |
95 | 97 | |||
96 | /* exec.c */ | 98 | /* exec.c */ | |
97 | void exec_hp300(char *, u_long, int); | 99 | void exec_hp300(char *, u_long, int); | |
98 | 100 | |||
99 | /* font.c */ | 101 | /* font.c */ | |
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 | |||
172 | /* sc.c */ | 175 | /* sc.c */ | |
173 | struct scsi_fmt_cdb; | 176 | struct scsi_fmt_cdb; | |
174 | int scsi_immed_command(int, int, int, struct scsi_fmt_cdb *, u_char *, | 177 | int scsi_immed_command(int, int, int, struct scsi_fmt_cdb *, u_char *, | |
175 | unsigned int); | 178 | unsigned int); | |
176 | int scsi_request_sense(int, int, int, u_char *, unsigned int); | 179 | int scsi_request_sense(int, int, int, u_char *, unsigned int); | |
177 | int scsi_test_unit_rdy(int, int, int); | 180 | int scsi_test_unit_rdy(int, int, int); | |
178 | int scsi_format_unit(int, int, int); | 181 | int scsi_format_unit(int, int, int); | |
179 | int scintr(void); | 182 | int scintr(void); | |
180 | 183 | |||
181 | /* scsi.c */ | 184 | /* scsi.c */ | |
182 | int scsi(int, char **); | 185 | int scsi(int, char **); | |
183 | int scsi_read_raw(u_int, u_int, u_int, u_char *, u_int); | 186 | int scsi_read_raw(u_int, u_int, u_int, u_char *, u_int); | |
184 | int scsi_read(u_int, u_char *, u_int); | 187 | int scsi_read(u_int, u_char *, u_int); | |
185 | int scsi_write(u_int, u_char *, u_int); | 188 | int scsi_write(u_int, u_char *, u_int); | |
186 | 189 | |||
187 | /* screen.c */ | 190 | /* screen.c */ | |
188 | int screen(int, char **); | 191 | int screen(int, char **); | |
189 | 192 | |||
190 | /* scsi.c */ | 193 | /* scsi.c */ | |
191 | int scsi(int, char **); | 194 | int scsi(int, char **); | |
192 | 195 | |||
193 | /* sd.c */ | 196 | /* sd.c */ | |
194 | int sdstrategy(void *, int, daddr_t, size_t, void *, size_t *); | 197 | int sdstrategy(void *, int, daddr_t, size_t, void *, size_t *); | |
195 | int sdopen(struct open_file *, ...); | 198 | int sdopen(struct open_file *, ...); | |
196 | int sdclose(struct open_file *); | 199 | int sdclose(struct open_file *); | |
197 | 200 | |||
198 | /* sio.c */ | 201 | /* sio.c */ | |
199 | void _siointr(void); | 202 | void _siointr(void); | |
200 | void siocnprobe(struct consdev *); | 203 | void siocnprobe(struct consdev *); | |
201 | void siocninit(struct consdev *); | 204 | void siocninit(struct consdev *); | |
202 | int siocngetc(dev_t); | 205 | int siocngetc(dev_t); | |
203 | void siocnputc(dev_t, int); | 206 | void siocnputc(dev_t, int); | |
204 | void sioinit(void); | 207 | void sioinit(void); | |
205 | 208 | |||
206 | /* tape.c */ | 209 | /* tape.c */ | |
207 | int tape(int, char **); | 210 | int tape(int, char **); | |
208 | 211 | |||
209 | /* trap.c */ | 212 | /* trap.c */ | |
210 | void trap(int, unsigned int, unsigned int, struct frame); | 213 | void trap(int, unsigned int, unsigned int, struct frame); | |
211 | 214 | |||
212 | /* ufs_disklabel.c */ | 215 | /* ufs_disklabel.c */ | |
213 | char *readdisklabel(int, int, struct disklabel *); | 216 | char *readdisklabel(int, int, struct disklabel *); | |
214 | 217 | |||
215 | 218 | |||
216 | #define DELAY(n) \ | 219 | #define DELAY(n) \ | |
217 | do { \ | 220 | do { \ | |
218 | register int __N = cpuspeed * (n); \ | 221 | register int __N = cpuspeed * (n); \ | |
219 | do { \ | 222 | do { \ | |
220 | __asm("subql #1, %0" : "=r" (__N) : "0" (__N)); \ | 223 | __asm("subql #1, %0" : "=r" (__N) : "0" (__N)); \ | |
221 | } while (__N > 0); \ | 224 | } while (__N > 0); \ | |
222 | } while (/* CONSTCOND */ 0) | 225 | } while (/* CONSTCOND */ 0) | |
223 | 226 | |||
224 | extern struct fs_ops file_system_disk[]; | 227 | extern struct fs_ops file_system_disk[]; | |
225 | extern int nfsys_disk; | 228 | extern int nfsys_disk; | |
226 | extern struct fs_ops file_system_nfs[]; | 229 | extern struct fs_ops file_system_nfs[]; | |
227 | 230 | |||
228 | extern const char bootprog_name[], bootprog_rev[], bootprog_kernrev[]; | 231 | extern const char bootprog_name[], bootprog_rev[], bootprog_kernrev[]; |
/* $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,135 +1,134 @@ | @@ -1,135 +1,134 @@ | |||
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 | |
15 | * notice, this list of conditions and the following disclaimer in the | 15 | * notice, this list of conditions and the following disclaimer in the | |
16 | * documentation and/or other materials provided with the distribution. | 16 | * documentation and/or other materials provided with the distribution. | |
17 | * 3. All advertising materials mentioning features or use of this software | 17 | * 3. All advertising materials mentioning features or use of this software | |
18 | * must display the following acknowledgement: | 18 | * must display the following acknowledgement: | |
19 | * This product includes software developed by the University of | 19 | * This product includes software developed by the University of | |
20 | * California, Berkeley and its contributors. | 20 | * California, Berkeley and its contributors. | |
21 | * 4. Neither the name of the University nor the names of its contributors | 21 | * 4. Neither the name of the University nor the names of its contributors | |
22 | * may be used to endorse or promote products derived from this software | 22 | * may be used to endorse or promote products derived from this software | |
23 | * without specific prior written permission. | 23 | * without specific prior written permission. | |
24 | * | 24 | * | |
25 | * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND | 25 | * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND | |
26 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | 26 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
27 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | 27 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |
28 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE | 28 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE | |
29 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | 29 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
30 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | 30 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | |
31 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | 31 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
32 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | 32 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |
33 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | 33 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
34 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | 34 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
35 | * SUCH DAMAGE. | 35 | * SUCH DAMAGE. | |
36 | * | 36 | * | |
37 | * @(#)bmc.c 8.1 (Berkeley) 6/10/93 | 37 | * @(#)bmc.c 8.1 (Berkeley) 6/10/93 | |
38 | */ | 38 | */ | |
39 | /* | 39 | /* | |
40 | * Copyright (c) 1992, 1993 | 40 | * Copyright (c) 1992, 1993 | |
41 | * The Regents of the University of California. All rights reserved. | 41 | * The Regents of the University of California. All rights reserved. | |
42 | * | 42 | * | |
43 | * This code is derived from software contributed to Berkeley by | 43 | * This code is derived from software contributed to Berkeley by | |
44 | * OMRON Corporation. | 44 | * OMRON Corporation. | |
45 | * | 45 | * | |
46 | * Redistribution and use in source and binary forms, with or without | 46 | * Redistribution and use in source and binary forms, with or without | |
47 | * modification, are permitted provided that the following conditions | 47 | * modification, are permitted provided that the following conditions | |
48 | * are met: | 48 | * are met: | |
49 | * 1. Redistributions of source code must retain the above copyright | 49 | * 1. Redistributions of source code must retain the above copyright | |
50 | * notice, this list of conditions and the following disclaimer. | 50 | * notice, this list of conditions and the following disclaimer. | |
51 | * 2. Redistributions in binary form must reproduce the above copyright | 51 | * 2. Redistributions in binary form must reproduce the above copyright | |
52 | * notice, this list of conditions and the following disclaimer in the | 52 | * notice, this list of conditions and the following disclaimer in the | |
53 | * documentation and/or other materials provided with the distribution. | 53 | * documentation and/or other materials provided with the distribution. | |
54 | * 3. Neither the name of the University nor the names of its contributors | 54 | * 3. Neither the name of the University nor the names of its contributors | |
55 | * may be used to endorse or promote products derived from this software | 55 | * may be used to endorse or promote products derived from this software | |
56 | * without specific prior written permission. | 56 | * without specific prior written permission. | |
57 | * | 57 | * | |
58 | * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND | 58 | * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND | |
59 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | 59 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
60 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | 60 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |
61 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE | 61 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE | |
62 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | 62 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
63 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | 63 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | |
64 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | 64 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
65 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | 65 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |
66 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | 66 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
67 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | 67 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
68 | * SUCH DAMAGE. | 68 | * SUCH DAMAGE. | |
69 | * | 69 | * | |
70 | * @(#)bmc.c 8.1 (Berkeley) 6/10/93 | 70 | * @(#)bmc.c 8.1 (Berkeley) 6/10/93 | |
71 | */ | 71 | */ | |
72 | 72 | |||
73 | /* | 73 | /* | |
74 | * bmc.c -- bitmap console driver | 74 | * bmc.c -- bitmap console driver | |
75 | * by A.Fujita, JUL-06-1992 | 75 | * by A.Fujita, JUL-06-1992 | |
76 | */ | 76 | */ | |
77 | 77 | |||
78 | #include <sys/param.h> | 78 | #include <sys/param.h> | |
79 | #include <luna68k/stand/boot/samachdep.h> | 79 | #include <luna68k/stand/boot/samachdep.h> | |
80 | #include <luna68k/stand/boot/rcvbuf.h> | 80 | #include <luna68k/stand/boot/rcvbuf.h> | |
81 | #include <luna68k/stand/boot/preset.h> | 81 | #include <luna68k/stand/boot/preset.h> | |
82 | 82 | |||
83 | /* | 83 | /* | |
84 | * Following are all routines needed for SIO to act as console | 84 | * Following are all routines needed for SIO to act as console | |
85 | */ | 85 | */ | |
86 | #include <dev/cons.h> | 86 | #include <dev/cons.h> | |
87 | 87 | |||
88 | void | 88 | void | |
89 | bmccnprobe(struct consdev *cp) | 89 | bmccnprobe(struct consdev *cp) | |
90 | { | 90 | { | |
91 | if ((dipsw1 & PS_BMC_CONS) == 0) { | 91 | if ((dipsw1 & PS_BMC_CONS) == 0) { | |
92 | cp->cn_pri = CN_DEAD; | 92 | cp->cn_pri = CN_DEAD; | |
93 | return; | 93 | return; | |
94 | } | 94 | } | |
95 | 95 | |||
96 | if (nplane == 0) { | 96 | if (nplane == 0) { | |
97 | cp->cn_pri = CN_DEAD; | 97 | cp->cn_pri = CN_DEAD; | |
98 | return; | 98 | return; | |
99 | } | 99 | } | |
100 | 100 | |||
101 | /* initialize required fields */ | 101 | /* initialize required fields */ | |
102 | cp->cn_dev = 1; | 102 | cp->cn_dev = 1; | |
103 | cp->cn_pri = CN_NORMAL; | 103 | cp->cn_pri = CN_NORMAL; | |
104 | } | 104 | } | |
105 | 105 | |||
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); | |
135 | } | 134 | } |
--- 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,212 +1,213 @@ | @@ -1,212 +1,213 @@ | |||
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 | |
15 | * notice, this list of conditions and the following disclaimer in the | 15 | * notice, this list of conditions and the following disclaimer in the | |
16 | * documentation and/or other materials provided with the distribution. | 16 | * documentation and/or other materials provided with the distribution. | |
17 | * 3. All advertising materials mentioning features or use of this software | 17 | * 3. All advertising materials mentioning features or use of this software | |
18 | * must display the following acknowledgement: | 18 | * must display the following acknowledgement: | |
19 | * This product includes software developed by the University of | 19 | * This product includes software developed by the University of | |
20 | * California, Berkeley and its contributors. | 20 | * California, Berkeley and its contributors. | |
21 | * 4. Neither the name of the University nor the names of its contributors | 21 | * 4. Neither the name of the University nor the names of its contributors | |
22 | * may be used to endorse or promote products derived from this software | 22 | * may be used to endorse or promote products derived from this software | |
23 | * without specific prior written permission. | 23 | * without specific prior written permission. | |
24 | * | 24 | * | |
25 | * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND | 25 | * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND | |
26 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | 26 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
27 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | 27 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |
28 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE | 28 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE | |
29 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | 29 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
30 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | 30 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | |
31 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | 31 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
32 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | 32 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |
33 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | 33 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
34 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | 34 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
35 | * SUCH DAMAGE. | 35 | * SUCH DAMAGE. | |
36 | * | 36 | * | |
37 | * @(#)boot.c 8.1 (Berkeley) 6/10/93 | 37 | * @(#)boot.c 8.1 (Berkeley) 6/10/93 | |
38 | */ | 38 | */ | |
39 | /* | 39 | /* | |
40 | * Copyright (c) 1992, 1993 | 40 | * Copyright (c) 1992, 1993 | |
41 | * The Regents of the University of California. All rights reserved. | 41 | * The Regents of the University of California. All rights reserved. | |
42 | * | 42 | * | |
43 | * This code is derived from software contributed to Berkeley by | 43 | * This code is derived from software contributed to Berkeley by | |
44 | * OMRON Corporation. | 44 | * OMRON Corporation. | |
45 | * | 45 | * | |
46 | * Redistribution and use in source and binary forms, with or without | 46 | * Redistribution and use in source and binary forms, with or without | |
47 | * modification, are permitted provided that the following conditions | 47 | * modification, are permitted provided that the following conditions | |
48 | * are met: | 48 | * are met: | |
49 | * 1. Redistributions of source code must retain the above copyright | 49 | * 1. Redistributions of source code must retain the above copyright | |
50 | * notice, this list of conditions and the following disclaimer. | 50 | * notice, this list of conditions and the following disclaimer. | |
51 | * 2. Redistributions in binary form must reproduce the above copyright | 51 | * 2. Redistributions in binary form must reproduce the above copyright | |
52 | * notice, this list of conditions and the following disclaimer in the | 52 | * notice, this list of conditions and the following disclaimer in the | |
53 | * documentation and/or other materials provided with the distribution. | 53 | * documentation and/or other materials provided with the distribution. | |
54 | * 3. Neither the name of the University nor the names of its contributors | 54 | * 3. Neither the name of the University nor the names of its contributors | |
55 | * may be used to endorse or promote products derived from this software | 55 | * may be used to endorse or promote products derived from this software | |
56 | * without specific prior written permission. | 56 | * without specific prior written permission. | |
57 | * | 57 | * | |
58 | * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND | 58 | * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND | |
59 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | 59 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
60 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | 60 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |
61 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE | 61 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE | |
62 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | 62 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
63 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | 63 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | |
64 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | 64 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
65 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | 65 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |
66 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | 66 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
67 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | 67 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
68 | * SUCH DAMAGE. | 68 | * SUCH DAMAGE. | |
69 | * | 69 | * | |
70 | * @(#)boot.c 8.1 (Berkeley) 6/10/93 | 70 | * @(#)boot.c 8.1 (Berkeley) 6/10/93 | |
71 | */ | 71 | */ | |
72 | 72 | |||
73 | /* | 73 | /* | |
74 | * boot.c -- boot program | 74 | * boot.c -- boot program | |
75 | * by A.Fujita, MAR-01-1992 | 75 | * by A.Fujita, MAR-01-1992 | |
76 | */ | 76 | */ | |
77 | 77 | |||
78 | #include <sys/param.h> | 78 | #include <sys/param.h> | |
79 | #include <sys/reboot.h> | 79 | #include <sys/reboot.h> | |
80 | #include <sys/exec.h> | 80 | #include <sys/exec.h> | |
81 | #include <luna68k/stand/boot/samachdep.h> | 81 | #include <luna68k/stand/boot/samachdep.h> | |
82 | #include <luna68k/stand/boot/stinger.h> | 82 | #include <luna68k/stand/boot/stinger.h> | |
83 | #include <luna68k/stand/boot/status.h> | 83 | #include <luna68k/stand/boot/status.h> | |
84 | #include <lib/libsa/loadfile.h> | 84 | #include <lib/libsa/loadfile.h> | |
85 | 85 | |||
86 | int howto; | 86 | int howto; | |
87 | 87 | |||
88 | static int get_boot_device(const char *, int *, int *, int *); | 88 | static int get_boot_device(const char *, int *, int *, int *); | |
89 | 89 | |||
90 | struct exec header; | 90 | struct exec header; | |
91 | char default_file[] = "sd(0,0)netbsd"; | 91 | char default_file[] = "sd(0,0)netbsd"; | |
92 | 92 | |||
93 | char *how_to_info[] = { | 93 | char *how_to_info[] = { | |
94 | "RB_ASKNAME ask for file name to reboot from", | 94 | "RB_ASKNAME ask for file name to reboot from", | |
95 | "RB_SINGLE reboot to single user only", | 95 | "RB_SINGLE reboot to single user only", | |
96 | "RB_NOSYNC dont sync before reboot", | 96 | "RB_NOSYNC dont sync before reboot", | |
97 | "RB_HALT don't reboot, just halt", | 97 | "RB_HALT don't reboot, just halt", | |
98 | "RB_INITNAME name given for /etc/init (unused)", | 98 | "RB_INITNAME name given for /etc/init (unused)", | |
99 | "RB_DFLTROOT use compiled-in rootdev", | 99 | "RB_DFLTROOT use compiled-in rootdev", | |
100 | "RB_KDB give control to kernel debugger", | 100 | "RB_KDB give control to kernel debugger", | |
101 | "RB_RDONLY mount root fs read-only" | 101 | "RB_RDONLY mount root fs read-only" | |
102 | }; | 102 | }; | |
103 | 103 | |||
104 | int | 104 | int | |
105 | how_to_boot(int argc, char *argv[]) | 105 | how_to_boot(int argc, char *argv[]) | |
106 | { | 106 | { | |
107 | int i, h = howto; | 107 | int i, h = howto; | |
108 | 108 | |||
109 | if (argc < 2) { | 109 | if (argc < 2) { | |
110 | printf("howto: 0x%s\n\n", hexstr(howto, 2)); | 110 | printf("howto: 0x%s\n\n", hexstr(howto, 2)); | |
111 | 111 | |||
112 | if (h == 0) { | 112 | if (h == 0) { | |
113 | printf("\t%s\n", "RB_AUTOBOOT flags for system auto-booting itself"); | 113 | printf("\t%s\n", "RB_AUTOBOOT flags for system auto-booting itself"); | |
114 | } else { | 114 | } else { | |
115 | for (i = 0; i < 8; i++, h >>= 1) { | 115 | for (i = 0; i < 8; i++, h >>= 1) { | |
116 | if (h & 0x01) { | 116 | if (h & 0x01) { | |
117 | printf("\t%s\n", how_to_info[i]); | 117 | printf("\t%s\n", how_to_info[i]); | |
118 | } | 118 | } | |
119 | } | 119 | } | |
120 | } | 120 | } | |
121 | 121 | |||
122 | printf("\n"); | 122 | printf("\n"); | |
123 | } | 123 | } | |
124 | return ST_NORMAL; | 124 | return ST_NORMAL; | |
125 | } | 125 | } | |
126 | 126 | |||
127 | int | 127 | int | |
128 | get_boot_device(const char *s, int *devp, int *unitp, int *partp) | 128 | get_boot_device(const char *s, int *devp, int *unitp, int *partp) | |
129 | { | 129 | { | |
130 | const char *p = s; | 130 | const char *p = s; | |
131 | int unit, part; | 131 | int unit, part; | |
132 | 132 | |||
133 | while (*p != '(') { | 133 | while (*p != '(') { | |
134 | if (*p == '\0') | 134 | if (*p == '\0') | |
135 | goto error; | 135 | goto error; | |
136 | p++; | 136 | p++; | |
137 | } | 137 | } | |
138 | 138 | |||
139 | while (*++p != ',') { | 139 | while (*++p != ',') { | |
140 | if (*p == '\0') | 140 | if (*p == '\0') | |
141 | goto error; | 141 | goto error; | |
142 | if (*p >= '0' && *p <= '9') | 142 | if (*p >= '0' && *p <= '9') | |
143 | unit = (unit * 10) + (*p - '0'); | 143 | unit = (unit * 10) + (*p - '0'); | |
144 | } | 144 | } | |
145 | 145 | |||
146 | while (*++p != ')') { | 146 | while (*++p != ')') { | |
147 | if (*p == '\0') | 147 | if (*p == '\0') | |
148 | goto error; | 148 | goto error; | |
149 | if (*p >= '0' && *p <= '9') | 149 | if (*p >= '0' && *p <= '9') | |
150 | part = (part * 10) + (*p - '0'); | 150 | part = (part * 10) + (*p - '0'); | |
151 | } | 151 | } | |
152 | 152 | |||
153 | *devp = 0; /* XXX not yet */ | 153 | *devp = 0; /* XXX not yet */ | |
154 | *unitp = unit; /* XXX should pass SCSI ID, not logical unit number */ | 154 | *unitp = unit; /* XXX should pass SCSI ID, not logical unit number */ | |
155 | *partp = part; | 155 | *partp = part; | |
156 | 156 | |||
157 | return 0; | 157 | return 0; | |
158 | 158 | |||
159 | error: | 159 | error: | |
160 | return -1; | 160 | return -1; | |
161 | } | 161 | } | |
162 | 162 | |||
163 | int | 163 | int | |
164 | boot(int argc, char *argv[]) | 164 | boot(int argc, char *argv[]) | |
165 | { | 165 | { | |
166 | char *line; | 166 | char *line; | |
167 | 167 | |||
168 | if (argc < 2) | 168 | if (argc < 2) | |
169 | line = default_file; | 169 | line = default_file; | |
170 | else | 170 | else | |
171 | line = argv[1]; | 171 | line = argv[1]; | |
172 | 172 | |||
173 | printf("Booting %s\n", line); | 173 | printf("Booting %s\n", line); | |
174 | 174 | |||
175 | return bootnetbsd(line); | 175 | return bootnetbsd(line); | |
176 | } | 176 | } | |
177 | 177 | |||
178 | int | 178 | int | |
179 | bootnetbsd(char *line) | 179 | bootnetbsd(char *line) | |
180 | { | 180 | { | |
181 | int io; | 181 | int io; | |
182 | int dev, unit, part; | 182 | int dev, unit, part; | |
183 | u_long marks[MARK_MAX]; | 183 | u_long marks[MARK_MAX]; | |
184 | void (*entry)(void); | 184 | void (*entry)(void); | |
185 | 185 | |||
186 | if (get_boot_device(line, &dev, &unit, &part) != 0) { | 186 | if (get_boot_device(line, &dev, &unit, &part) != 0) { | |
187 | printf("Bad file name %s\n", line); | 187 | printf("Bad file name %s\n", line); | |
188 | return ST_ERROR; | 188 | return ST_ERROR; | |
189 | } | 189 | } | |
190 | 190 | |||
191 | /* Note marks[MARK_START] is passed as an load address offset */ | 191 | /* Note marks[MARK_START] is passed as an load address offset */ | |
192 | memset(marks, 0, sizeof(marks)); | 192 | memset(marks, 0, sizeof(marks)); | |
193 | 193 | |||
194 | io = loadfile(line, marks, LOAD_KERNEL); | 194 | io = loadfile(line, marks, LOAD_KERNEL); | |
195 | if (io >= 0) { | 195 | if (io >= 0) { | |
196 | #ifdef DEBUG | 196 | #ifdef DEBUG | |
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,78 +1,76 @@ | @@ -1,78 +1,76 @@ | |||
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. | |
15 | * 3. Neither the name of the University nor the names of its contributors | 15 | * 3. Neither the name of the University nor the names of its contributors | |
16 | * may be used to endorse or promote products derived from this software | 16 | * may be used to endorse or promote products derived from this software | |
17 | * without specific prior written permission. | 17 | * without specific prior written permission. | |
18 | * | 18 | * | |
19 | * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND | 19 | * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND | |
20 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | 20 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
21 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | 21 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |
22 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE | 22 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE | |
23 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | 23 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
24 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | 24 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | |
25 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | 25 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
26 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | 26 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |
27 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | 27 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
28 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | 28 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
29 | * SUCH DAMAGE. | 29 | * SUCH DAMAGE. | |
30 | * | 30 | * | |
31 | * @(#)prf.c 8.1 (Berkeley) 6/10/93 | 31 | * @(#)prf.c 8.1 (Berkeley) 6/10/93 | |
32 | */ | 32 | */ | |
33 | 33 | |||
34 | #include <lib/libsa/stand.h> | 34 | #include <lib/libsa/stand.h> | |
35 | #include <luna68k/stand/boot/samachdep.h> | 35 | #include <luna68k/stand/boot/samachdep.h> | |
36 | 36 | |||
37 | int | 37 | int | |
38 | getchar(void) | 38 | getchar(void) | |
39 | { | 39 | { | |
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,217 +1,233 @@ | @@ -1,217 +1,233 @@ | |||
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 | |
15 | * notice, this list of conditions and the following disclaimer in the | 15 | * notice, this list of conditions and the following disclaimer in the | |
16 | * documentation and/or other materials provided with the distribution. | 16 | * documentation and/or other materials provided with the distribution. | |
17 | * 3. All advertising materials mentioning features or use of this software | 17 | * 3. All advertising materials mentioning features or use of this software | |
18 | * must display the following acknowledgement: | 18 | * must display the following acknowledgement: | |
19 | * This product includes software developed by the University of | 19 | * This product includes software developed by the University of | |
20 | * California, Berkeley and its contributors. | 20 | * California, Berkeley and its contributors. | |
21 | * 4. Neither the name of the University nor the names of its contributors | 21 | * 4. Neither the name of the University nor the names of its contributors | |
22 | * may be used to endorse or promote products derived from this software | 22 | * may be used to endorse or promote products derived from this software | |
23 | * without specific prior written permission. | 23 | * without specific prior written permission. | |
24 | * | 24 | * | |
25 | * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND | 25 | * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND | |
26 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | 26 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
27 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | 27 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |
28 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE | 28 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE | |
29 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | 29 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
30 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | 30 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | |
31 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | 31 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
32 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | 32 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |
33 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | 33 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
34 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | 34 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
35 | * SUCH DAMAGE. | 35 | * SUCH DAMAGE. | |
36 | * | 36 | * | |
37 | * @(#)init_main.c 8.2 (Berkeley) 8/15/93 | 37 | * @(#)init_main.c 8.2 (Berkeley) 8/15/93 | |
38 | */ | 38 | */ | |
39 | /* | 39 | /* | |
40 | * Copyright (c) 1992, 1993 | 40 | * Copyright (c) 1992, 1993 | |
41 | * The Regents of the University of California. All rights reserved. | 41 | * The Regents of the University of California. All rights reserved. | |
42 | * | 42 | * | |
43 | * This code is derived from software contributed to Berkeley by | 43 | * This code is derived from software contributed to Berkeley by | |
44 | * OMRON Corporation. | 44 | * OMRON Corporation. | |
45 | * | 45 | * | |
46 | * Redistribution and use in source and binary forms, with or without | 46 | * Redistribution and use in source and binary forms, with or without | |
47 | * modification, are permitted provided that the following conditions | 47 | * modification, are permitted provided that the following conditions | |
48 | * are met: | 48 | * are met: | |
49 | * 1. Redistributions of source code must retain the above copyright | 49 | * 1. Redistributions of source code must retain the above copyright | |
50 | * notice, this list of conditions and the following disclaimer. | 50 | * notice, this list of conditions and the following disclaimer. | |
51 | * 2. Redistributions in binary form must reproduce the above copyright | 51 | * 2. Redistributions in binary form must reproduce the above copyright | |
52 | * notice, this list of conditions and the following disclaimer in the | 52 | * notice, this list of conditions and the following disclaimer in the | |
53 | * documentation and/or other materials provided with the distribution. | 53 | * documentation and/or other materials provided with the distribution. | |
54 | * 3. Neither the name of the University nor the names of its contributors | 54 | * 3. Neither the name of the University nor the names of its contributors | |
55 | * may be used to endorse or promote products derived from this software | 55 | * may be used to endorse or promote products derived from this software | |
56 | * without specific prior written permission. | 56 | * without specific prior written permission. | |
57 | * | 57 | * | |
58 | * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND | 58 | * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND | |
59 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | 59 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
60 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | 60 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |
61 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE | 61 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE | |
62 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | 62 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
63 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | 63 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | |
64 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | 64 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
65 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | 65 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |
66 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | 66 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
67 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | 67 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
68 | * SUCH DAMAGE. | 68 | * SUCH DAMAGE. | |
69 | * | 69 | * | |
70 | * @(#)init_main.c 8.2 (Berkeley) 8/15/93 | 70 | * @(#)init_main.c 8.2 (Berkeley) 8/15/93 | |
71 | */ | 71 | */ | |
72 | 72 | |||
73 | #include <sys/param.h> | 73 | #include <sys/param.h> | |
74 | #include <machine/cpu.h> | 74 | #include <machine/cpu.h> | |
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; | |
141 | kiff->plane = nplane; | 147 | kiff->plane = nplane; | |
142 | 148 | |||
143 | i = (int) kiff->maxaddr + 1; | 149 | i = (int) kiff->maxaddr + 1; | |
144 | printf("Machine model = %s\n", machstr); | 150 | printf("Machine model = %s\n", machstr); | |
145 | printf("Physical Memory = 0x%x ", i); | 151 | printf("Physical Memory = 0x%x ", i); | |
146 | i >>= 20; | 152 | i >>= 20; | |
147 | printf("(%d MB)\n", i); | 153 | printf("(%d MB)\n", i); | |
148 | printf("\n"); | 154 | printf("\n"); | |
149 | 155 | |||
150 | /* | 156 | /* | |
151 | * IO configuration | 157 | * IO configuration | |
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 | } | |
186 | 202 | |||
187 | int | 203 | int | |
188 | get_plane_numbers(void) | 204 | get_plane_numbers(void) | |
189 | { | 205 | { | |
190 | int r = ROM_plane; | 206 | int r = ROM_plane; | |
191 | int n = 0; | 207 | int n = 0; | |
192 | 208 | |||
193 | for (; r ; r >>= 1) | 209 | for (; r ; r >>= 1) | |
194 | if (r & 0x1) | 210 | if (r & 0x1) | |
195 | n++; | 211 | n++; | |
196 | 212 | |||
197 | return(n); | 213 | return(n); | |
198 | } | 214 | } | |
199 | 215 | |||
200 | int | 216 | int | |
201 | reorder_dipsw(int dipsw) | 217 | reorder_dipsw(int dipsw) | |
202 | { | 218 | { | |
203 | int i, sw = 0; | 219 | int i, sw = 0; | |
204 | 220 | |||
205 | for (i = 0; i < 8; i++) { | 221 | for (i = 0; i < 8; i++) { | |
206 | if ((dipsw & 0x01) == 0) | 222 | if ((dipsw & 0x01) == 0) | |
207 | sw += 1; | 223 | sw += 1; | |
208 | 224 | |||
209 | if (i == 7) | 225 | if (i == 7) | |
210 | break; | 226 | break; | |
211 | 227 | |||
212 | sw <<= 1; | 228 | sw <<= 1; | |
213 | dipsw >>= 1; | 229 | dipsw >>= 1; | |
214 | } | 230 | } | |
215 | 231 | |||
216 | return(sw); | 232 | return(sw); | |
217 | } | 233 | } |
--- 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,166 +1,194 @@ | @@ -1,166 +1,194 @@ | |||
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 | |
15 | * notice, this list of conditions and the following disclaimer in the | 15 | * notice, this list of conditions and the following disclaimer in the | |
16 | * documentation and/or other materials provided with the distribution. | 16 | * documentation and/or other materials provided with the distribution. | |
17 | * 3. All advertising materials mentioning features or use of this software | 17 | * 3. All advertising materials mentioning features or use of this software | |
18 | * must display the following acknowledgement: | 18 | * must display the following acknowledgement: | |
19 | * This product includes software developed by the University of | 19 | * This product includes software developed by the University of | |
20 | * California, Berkeley and its contributors. | 20 | * California, Berkeley and its contributors. | |
21 | * 4. Neither the name of the University nor the names of its contributors | 21 | * 4. Neither the name of the University nor the names of its contributors | |
22 | * may be used to endorse or promote products derived from this software | 22 | * may be used to endorse or promote products derived from this software | |
23 | * without specific prior written permission. | 23 | * without specific prior written permission. | |
24 | * | 24 | * | |
25 | * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND | 25 | * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND | |
26 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | 26 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
27 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | 27 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |
28 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE | 28 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE | |
29 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | 29 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
30 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | 30 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | |
31 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | 31 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
32 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | 32 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |
33 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | 33 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
34 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | 34 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
35 | * SUCH DAMAGE. | 35 | * SUCH DAMAGE. | |
36 | * | 36 | * | |
37 | * @(#)parse.c 8.1 (Berkeley) 6/10/93 | 37 | * @(#)parse.c 8.1 (Berkeley) 6/10/93 | |
38 | */ | 38 | */ | |
39 | /* | 39 | /* | |
40 | * Copyright (c) 1992, 1993 | 40 | * Copyright (c) 1992, 1993 | |
41 | * The Regents of the University of California. All rights reserved. | 41 | * The Regents of the University of California. All rights reserved. | |
42 | * | 42 | * | |
43 | * This code is derived from software contributed to Berkeley by | 43 | * This code is derived from software contributed to Berkeley by | |
44 | * OMRON Corporation. | 44 | * OMRON Corporation. | |
45 | * | 45 | * | |
46 | * Redistribution and use in source and binary forms, with or without | 46 | * Redistribution and use in source and binary forms, with or without | |
47 | * modification, are permitted provided that the following conditions | 47 | * modification, are permitted provided that the following conditions | |
48 | * are met: | 48 | * are met: | |
49 | * 1. Redistributions of source code must retain the above copyright | 49 | * 1. Redistributions of source code must retain the above copyright | |
50 | * notice, this list of conditions and the following disclaimer. | 50 | * notice, this list of conditions and the following disclaimer. | |
51 | * 2. Redistributions in binary form must reproduce the above copyright | 51 | * 2. Redistributions in binary form must reproduce the above copyright | |
52 | * notice, this list of conditions and the following disclaimer in the | 52 | * notice, this list of conditions and the following disclaimer in the | |
53 | * documentation and/or other materials provided with the distribution. | 53 | * documentation and/or other materials provided with the distribution. | |
54 | * 3. Neither the name of the University nor the names of its contributors | 54 | * 3. Neither the name of the University nor the names of its contributors | |
55 | * may be used to endorse or promote products derived from this software | 55 | * may be used to endorse or promote products derived from this software | |
56 | * without specific prior written permission. | 56 | * without specific prior written permission. | |
57 | * | 57 | * | |
58 | * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND | 58 | * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND | |
59 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | 59 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
60 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | 60 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |
61 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE | 61 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE | |
62 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | 62 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
63 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | 63 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | |
64 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | 64 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
65 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | 65 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |
66 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | 66 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
67 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | 67 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
68 | * SUCH DAMAGE. | 68 | * SUCH DAMAGE. | |
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 | |||
127 | int | 155 | int | |
128 | parse(int argc, char *argv[]) | 156 | parse(int argc, char *argv[]) | |
129 | { | 157 | { | |
130 | int i, status = ST_NOTFOUND; | 158 | int i, status = ST_NOTFOUND; | |
131 | 159 | |||
132 | for (i = 0; entries[i].name != (char *) 0; i++) { | 160 | for (i = 0; entries[i].name != (char *) 0; i++) { | |
133 | if (!strcmp(argv[0], entries[i].name)) { | 161 | if (!strcmp(argv[0], entries[i].name)) { | |
134 | status = (*entries[i].func)(argc, argv); | 162 | status = (*entries[i].func)(argc, argv); | |
135 | break; | 163 | break; | |
136 | } | 164 | } | |
137 | } | 165 | } | |
138 | 166 | |||
139 | return(status); | 167 | return(status); | |
140 | } | 168 | } | |
141 | 169 | |||
142 | 170 | |||
143 | 171 | |||
144 | /* | 172 | /* | |
145 | * getargs -- make argument arrays | 173 | * getargs -- make argument arrays | |
146 | */ | 174 | */ | |
147 | 175 | |||
148 | int | 176 | int | |
149 | getargs(char buffer[], char *argv[], int maxargs) | 177 | getargs(char buffer[], char *argv[], int maxargs) | |
150 | { | 178 | { | |
151 | int n = 0; | 179 | int n = 0; | |
152 | char *p = buffer; | 180 | char *p = buffer; | |
153 | 181 | |||
154 | argv[n++] = p; | 182 | argv[n++] = p; | |
155 | while (*p != '\0') { | 183 | while (*p != '\0') { | |
156 | if ( *p == ' ' ) { | 184 | if ( *p == ' ' ) { | |
157 | *p = '\0'; | 185 | *p = '\0'; | |
158 | } else if (p != buffer && *(p-1) == '\0') { | 186 | } else if (p != buffer && *(p-1) == '\0') { | |
159 | if ( n < maxargs ) | 187 | if ( n < maxargs ) | |
160 | argv[n++] = p; | 188 | argv[n++] = p; | |
161 | } | 189 | } | |
162 | p++; | 190 | p++; | |
163 | } | 191 | } | |
164 | 192 | |||
165 | return(n); | 193 | return(n); | |
166 | } | 194 | } |
--- 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,256 +1,255 @@ | @@ -1,256 +1,255 @@ | |||
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 | |
15 | * notice, this list of conditions and the following disclaimer in the | 15 | * notice, this list of conditions and the following disclaimer in the | |
16 | * documentation and/or other materials provided with the distribution. | 16 | * documentation and/or other materials provided with the distribution. | |
17 | * 3. All advertising materials mentioning features or use of this software | 17 | * 3. All advertising materials mentioning features or use of this software | |
18 | * must display the following acknowledgement: | 18 | * must display the following acknowledgement: | |
19 | * This product includes software developed by the University of | 19 | * This product includes software developed by the University of | |
20 | * California, Berkeley and its contributors. | 20 | * California, Berkeley and its contributors. | |
21 | * 4. Neither the name of the University nor the names of its contributors | 21 | * 4. Neither the name of the University nor the names of its contributors | |
22 | * may be used to endorse or promote products derived from this software | 22 | * may be used to endorse or promote products derived from this software | |
23 | * without specific prior written permission. | 23 | * without specific prior written permission. | |
24 | * | 24 | * | |
25 | * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND | 25 | * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND | |
26 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | 26 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
27 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | 27 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |
28 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE | 28 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE | |
29 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | 29 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
30 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | 30 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | |
31 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | 31 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
32 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | 32 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |
33 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | 33 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
34 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | 34 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
35 | * SUCH DAMAGE. | 35 | * SUCH DAMAGE. | |
36 | * | 36 | * | |
37 | * @(#)sio.c 8.1 (Berkeley) 6/10/93 | 37 | * @(#)sio.c 8.1 (Berkeley) 6/10/93 | |
38 | */ | 38 | */ | |
39 | /* | 39 | /* | |
40 | * Copyright (c) 1992, 1993 | 40 | * Copyright (c) 1992, 1993 | |
41 | * The Regents of the University of California. All rights reserved. | 41 | * The Regents of the University of California. All rights reserved. | |
42 | * | 42 | * | |
43 | * This code is derived from software contributed to Berkeley by | 43 | * This code is derived from software contributed to Berkeley by | |
44 | * OMRON Corporation. | 44 | * OMRON Corporation. | |
45 | * | 45 | * | |
46 | * Redistribution and use in source and binary forms, with or without | 46 | * Redistribution and use in source and binary forms, with or without | |
47 | * modification, are permitted provided that the following conditions | 47 | * modification, are permitted provided that the following conditions | |
48 | * are met: | 48 | * are met: | |
49 | * 1. Redistributions of source code must retain the above copyright | 49 | * 1. Redistributions of source code must retain the above copyright | |
50 | * notice, this list of conditions and the following disclaimer. | 50 | * notice, this list of conditions and the following disclaimer. | |
51 | * 2. Redistributions in binary form must reproduce the above copyright | 51 | * 2. Redistributions in binary form must reproduce the above copyright | |
52 | * notice, this list of conditions and the following disclaimer in the | 52 | * notice, this list of conditions and the following disclaimer in the | |
53 | * documentation and/or other materials provided with the distribution. | 53 | * documentation and/or other materials provided with the distribution. | |
54 | * 3. Neither the name of the University nor the names of its contributors | 54 | * 3. Neither the name of the University nor the names of its contributors | |
55 | * may be used to endorse or promote products derived from this software | 55 | * may be used to endorse or promote products derived from this software | |
56 | * without specific prior written permission. | 56 | * without specific prior written permission. | |
57 | * | 57 | * | |
58 | * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND | 58 | * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND | |
59 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | 59 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
60 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | 60 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |
61 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE | 61 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE | |
62 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | 62 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
63 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | 63 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | |
64 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | 64 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
65 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | 65 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |
66 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | 66 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
67 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | 67 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
68 | * SUCH DAMAGE. | 68 | * SUCH DAMAGE. | |
69 | * | 69 | * | |
70 | * @(#)sio.c 8.1 (Berkeley) 6/10/93 | 70 | * @(#)sio.c 8.1 (Berkeley) 6/10/93 | |
71 | */ | 71 | */ | |
72 | 72 | |||
73 | /* sio.c NOV-25-1991 */ | 73 | /* sio.c NOV-25-1991 */ | |
74 | 74 | |||
75 | #define NSIO 2 | 75 | #define NSIO 2 | |
76 | 76 | |||
77 | #include <sys/param.h> | 77 | #include <sys/param.h> | |
78 | #include <luna68k/stand/boot/samachdep.h> | 78 | #include <luna68k/stand/boot/samachdep.h> | |
79 | #include <luna68k/stand/boot/sioreg.h> | 79 | #include <luna68k/stand/boot/sioreg.h> | |
80 | #include <luna68k/stand/boot/rcvbuf.h> | 80 | #include <luna68k/stand/boot/rcvbuf.h> | |
81 | #include <luna68k/stand/boot/kbdreg.h> | 81 | #include <luna68k/stand/boot/kbdreg.h> | |
82 | 82 | |||
83 | static void siointr(int); | 83 | static void siointr(int); | |
84 | static int sioreg(int, int); | 84 | static int sioreg(int, int); | |
85 | 85 | |||
86 | struct rcvbuf rcvbuf[NSIO]; | 86 | struct rcvbuf rcvbuf[NSIO]; | |
87 | 87 | |||
88 | int sioconsole = -1; | 88 | int sioconsole = -1; | |
89 | struct siodevice *sio_addr[2]; | 89 | struct siodevice *sio_addr[2]; | |
90 | int cur_unit; | 90 | int cur_unit; | |
91 | 91 | |||
92 | 92 | |||
93 | #define siounit(x) ( x & 0xffff ) | 93 | #define siounit(x) ( x & 0xffff ) | |
94 | #define isprint(c) ((c >= 0x20) && (c < 0x7F) ? 1 : 0) | 94 | #define isprint(c) ((c >= 0x20) && (c < 0x7F) ? 1 : 0) | |
95 | 95 | |||
96 | 96 | |||
97 | void | 97 | void | |
98 | _siointr(void) | 98 | _siointr(void) | |
99 | { | 99 | { | |
100 | int unit; | 100 | int unit; | |
101 | 101 | |||
102 | for (unit = 0; unit < NSIO; unit++) | 102 | for (unit = 0; unit < NSIO; unit++) | |
103 | siointr(unit); | 103 | siointr(unit); | |
104 | } | 104 | } | |
105 | 105 | |||
106 | void | 106 | void | |
107 | siointr(int unit) | 107 | siointr(int unit) | |
108 | { | 108 | { | |
109 | /* struct siodevice *sio = sio_addr[unit]; */ | 109 | /* struct siodevice *sio = sio_addr[unit]; */ | |
110 | int rr0 = sioreg(REG(unit, RR0), 0); | 110 | int rr0 = sioreg(REG(unit, RR0), 0); | |
111 | int rr1 = sioreg(REG(unit, RR1), 0); | 111 | int rr1 = sioreg(REG(unit, RR1), 0); | |
112 | 112 | |||
113 | if (rr0 & RR0_RXAVAIL) { | 113 | if (rr0 & RR0_RXAVAIL) { | |
114 | if (rr1 & RR1_FRAMING) | 114 | if (rr1 & RR1_FRAMING) | |
115 | return; | 115 | return; | |
116 | 116 | |||
117 | if (rr1 & (RR1_PARITY | RR1_OVERRUN)) | 117 | if (rr1 & (RR1_PARITY | RR1_OVERRUN)) | |
118 | sioreg(REG(unit, WR0), WR0_ERRRST); /* Channel-A Error Reset */ | 118 | sioreg(REG(unit, WR0), WR0_ERRRST); /* Channel-A Error Reset */ | |
119 | 119 | |||
120 | if (unit == 1) { | 120 | if (unit == 1) { | |
121 | int c = kbd_decode(sio_addr[unit]->sio_data); | 121 | int c = kbd_decode(sio_addr[unit]->sio_data); | |
122 | 122 | |||
123 | if ((c & KC_TYPE) == KC_CODE) | 123 | if ((c & KC_TYPE) == KC_CODE) | |
124 | PUSH_RBUF(unit, c); | 124 | PUSH_RBUF(unit, c); | |
125 | } else { | 125 | } else { | |
126 | PUSH_RBUF(unit, sio_addr[unit]->sio_data); | 126 | PUSH_RBUF(unit, sio_addr[unit]->sio_data); | |
127 | } | 127 | } | |
128 | } | 128 | } | |
129 | } | 129 | } | |
130 | 130 | |||
131 | /* | 131 | /* | |
132 | * Following are all routines needed for SIO to act as console | 132 | * Following are all routines needed for SIO to act as console | |
133 | */ | 133 | */ | |
134 | #include <dev/cons.h> | 134 | #include <dev/cons.h> | |
135 | #include <luna68k/stand/boot/romvec.h> | 135 | #include <luna68k/stand/boot/romvec.h> | |
136 | 136 | |||
137 | void | 137 | void | |
138 | siocnprobe(struct consdev *cp) | 138 | siocnprobe(struct consdev *cp) | |
139 | { | 139 | { | |
140 | sio_addr[0] = (struct siodevice *) 0x51000000; | 140 | sio_addr[0] = (struct siodevice *) 0x51000000; | |
141 | sio_addr[1] = (struct siodevice *) 0x51000004; | 141 | sio_addr[1] = (struct siodevice *) 0x51000004; | |
142 | 142 | |||
143 | /* make sure hardware exists */ | 143 | /* make sure hardware exists */ | |
144 | if (badaddr((short *)sio_addr[0])) { | 144 | if (badaddr((short *)sio_addr[0])) { | |
145 | cp->cn_pri = CN_DEAD; | 145 | cp->cn_pri = CN_DEAD; | |
146 | return; | 146 | return; | |
147 | } | 147 | } | |
148 | 148 | |||
149 | /* locate the major number */ | 149 | /* locate the major number */ | |
150 | 150 | |||
151 | /* initialize required fields */ | 151 | /* initialize required fields */ | |
152 | cp->cn_dev = cur_unit = 0; | 152 | cp->cn_dev = cur_unit = 0; | |
153 | cp->cn_pri = CN_NORMAL; | 153 | cp->cn_pri = CN_NORMAL; | |
154 | } | 154 | } | |
155 | 155 | |||
156 | void | 156 | 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) { | |
186 | (void) sioinit(); | 185 | (void) sioinit(); | |
187 | sioconsole = unit; | 186 | sioconsole = unit; | |
188 | } | 187 | } | |
189 | 188 | |||
190 | s = splsio(); | 189 | s = splsio(); | |
191 | 190 | |||
192 | /* wait for any pending transmission to finish */ | 191 | /* wait for any pending transmission to finish */ | |
193 | while ((sioreg(REG(unit, RR0), 0) & RR0_TXEMPTY) == 0); | 192 | while ((sioreg(REG(unit, RR0), 0) & RR0_TXEMPTY) == 0); | |
194 | 193 | |||
195 | sio_addr[unit]->sio_data = (c & 0xFF); | 194 | sio_addr[unit]->sio_data = (c & 0xFF); | |
196 | 195 | |||
197 | /* wait for any pending transmission to finish */ | 196 | /* wait for any pending transmission to finish */ | |
198 | while ((sioreg(REG(unit, RR0), 0) & RR0_TXEMPTY) == 0); | 197 | while ((sioreg(REG(unit, RR0), 0) & RR0_TXEMPTY) == 0); | |
199 | 198 | |||
200 | splx(s); | 199 | splx(s); | |
201 | } | 200 | } | |
202 | 201 | |||
203 | /* SIO misc routines */ | 202 | /* SIO misc routines */ | |
204 | 203 | |||
205 | void | 204 | void | |
206 | sioinit(void) | 205 | sioinit(void) | |
207 | { | 206 | { | |
208 | int s; | 207 | int s; | |
209 | 208 | |||
210 | RBUF_INIT(0); | 209 | RBUF_INIT(0); | |
211 | RBUF_INIT(1); | 210 | RBUF_INIT(1); | |
212 | 211 | |||
213 | s = splsio(); | 212 | s = splsio(); | |
214 | 213 | |||
215 | sioreg(REG(0, WR0), WR0_CHANRST); /* Channel-A Reset */ | 214 | sioreg(REG(0, WR0), WR0_CHANRST); /* Channel-A Reset */ | |
216 | 215 | |||
217 | sioreg(WR2A, WR2_VEC86 | WR2_INTR_1); /* Set CPU BUS Interface Mode */ | 216 | sioreg(WR2A, WR2_VEC86 | WR2_INTR_1); /* Set CPU BUS Interface Mode */ | |
218 | sioreg(WR2B, 0); /* Set Interrupt Vector */ | 217 | sioreg(WR2B, 0); /* Set Interrupt Vector */ | |
219 | 218 | |||
220 | sioreg(REG(0, WR0), WR0_RSTINT); /* Reset E/S Interrupt */ | 219 | sioreg(REG(0, WR0), WR0_RSTINT); /* Reset E/S Interrupt */ | |
221 | sioreg(REG(0, WR4), WR4_BAUD96 | WR4_STOP1 | WR4_NPARITY); /* Tx/Rx */ | 220 | sioreg(REG(0, WR4), WR4_BAUD96 | WR4_STOP1 | WR4_NPARITY); /* Tx/Rx */ | |
222 | sioreg(REG(0, WR3), WR3_RX8BIT | WR3_RXENBL); /* Rx */ | 221 | sioreg(REG(0, WR3), WR3_RX8BIT | WR3_RXENBL); /* Rx */ | |
223 | sioreg(REG(0, WR5), WR5_TX8BIT | WR5_TXENBL | WR5_DTR | WR5_RTS); /* Tx */ | 222 | sioreg(REG(0, WR5), WR5_TX8BIT | WR5_TXENBL | WR5_DTR | WR5_RTS); /* Tx */ | |
224 | sioreg(REG(0, WR0), WR0_RSTINT); /* Reset E/S Interrupt */ | 223 | sioreg(REG(0, WR0), WR0_RSTINT); /* Reset E/S Interrupt */ | |
225 | sioreg(REG(0, WR1), WR1_RXALLS); /* Interrupted All Char. */ | 224 | sioreg(REG(0, WR1), WR1_RXALLS); /* Interrupted All Char. */ | |
226 | 225 | |||
227 | sioreg(REG(1, WR0), WR0_CHANRST); /* Channel-A Reset */ | 226 | sioreg(REG(1, WR0), WR0_CHANRST); /* Channel-A Reset */ | |
228 | 227 | |||
229 | sioreg(REG(1, WR0), WR0_RSTINT); /* Reset E/S Interrupt */ | 228 | sioreg(REG(1, WR0), WR0_RSTINT); /* Reset E/S Interrupt */ | |
230 | sioreg(REG(1, WR4), WR4_BAUD96 | WR4_STOP1 | WR4_NPARITY); /* Tx/Rx */ | 229 | sioreg(REG(1, WR4), WR4_BAUD96 | WR4_STOP1 | WR4_NPARITY); /* Tx/Rx */ | |
231 | sioreg(REG(1, WR3), WR3_RX8BIT | WR3_RXENBL); /* Rx */ | 230 | sioreg(REG(1, WR3), WR3_RX8BIT | WR3_RXENBL); /* Rx */ | |
232 | sioreg(REG(1, WR5), WR5_TX8BIT | WR5_TXENBL); /* Tx */ | 231 | sioreg(REG(1, WR5), WR5_TX8BIT | WR5_TXENBL); /* Tx */ | |
233 | sioreg(REG(1, WR0), WR0_RSTINT); /* Reset E/S Interrupt */ | 232 | sioreg(REG(1, WR0), WR0_RSTINT); /* Reset E/S Interrupt */ | |
234 | sioreg(REG(1, WR1), WR1_RXALLS); /* Interrupted All Char. */ | 233 | sioreg(REG(1, WR1), WR1_RXALLS); /* Interrupted All Char. */ | |
235 | 234 | |||
236 | splx(s); | 235 | splx(s); | |
237 | } | 236 | } | |
238 | 237 | |||
239 | int | 238 | int | |
240 | sioreg(int reg, int val) | 239 | sioreg(int reg, int val) | |
241 | { | 240 | { | |
242 | int chan; | 241 | int chan; | |
243 | 242 | |||
244 | chan = CHANNEL(reg); | 243 | chan = CHANNEL(reg); | |
245 | 244 | |||
246 | if (isStatusReg(reg)) { | 245 | if (isStatusReg(reg)) { | |
247 | if (REGNO(reg) != 0) | 246 | if (REGNO(reg) != 0) | |
248 | sio_addr[chan]->sio_cmd = REGNO(reg); | 247 | sio_addr[chan]->sio_cmd = REGNO(reg); | |
249 | return(sio_addr[chan]->sio_stat); | 248 | return(sio_addr[chan]->sio_stat); | |
250 | } else { | 249 | } else { | |
251 | if (REGNO(reg) != 0) | 250 | if (REGNO(reg) != 0) | |
252 | sio_addr[chan]->sio_cmd = REGNO(reg); | 251 | sio_addr[chan]->sio_cmd = REGNO(reg); | |
253 | sio_addr[chan]->sio_cmd = val; | 252 | sio_addr[chan]->sio_cmd = val; | |
254 | return(val); | 253 | return(val); | |
255 | } | 254 | } | |
256 | } | 255 | } |