Created
December 14, 2022 13:41
-
-
Save ao-kenji/627e43bf6058617905117624e0acf612 to your computer and use it in GitHub Desktop.
Study to use ROM putchar in luna88k bootloader
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Index: sys/arch/luna88k/stand/boot/Makefile | |
=================================================================== | |
RCS file: /cvs/src/sys/arch/luna88k/stand/boot/Makefile,v | |
retrieving revision 1.12 | |
diff -u -r1.12 Makefile | |
--- sys/arch/luna88k/stand/boot/Makefile 10 Dec 2019 11:28:13 -0000 1.12 | |
+++ sys/arch/luna88k/stand/boot/Makefile 14 Dec 2022 13:34:32 -0000 | |
@@ -31,9 +31,11 @@ | |
SRCS+= boot.c | |
SRCS+= cons.c prf.c awaitkey.c | |
SRCS+= sio.c | |
-SRCS+= bmc.c bmd.c font.c kbd.c | |
+#SRCS+= bmc.c bmd.c font.c kbd.c | |
+SRCS+= bmc.c kbd.c | |
SRCS+= sc.c sd.c | |
SRCS+= ufs_disksubr.c | |
+SRCS+= romcons.c | |
# netboot support | |
SRCS+= if_le.c lance.c getsecs.c | |
Index: sys/arch/luna88k/stand/boot/bmc.c | |
=================================================================== | |
RCS file: /cvs/src/sys/arch/luna88k/stand/boot/bmc.c,v | |
retrieving revision 1.1 | |
diff -u -r1.1 bmc.c | |
--- sys/arch/luna88k/stand/boot/bmc.c 28 Oct 2013 22:13:12 -0000 1.1 | |
+++ sys/arch/luna88k/stand/boot/bmc.c 14 Dec 2022 13:34:32 -0000 | |
@@ -109,7 +109,9 @@ | |
bmccninit(struct consdev *cp) | |
{ | |
sioinit(); | |
+#if 0 | |
bmdinit(); | |
+#endif | |
} | |
int | |
@@ -130,8 +132,10 @@ | |
*/ | |
} | |
+#if 0 | |
void | |
bmccnputc(dev_t dev, int c) | |
{ | |
bmdputc(c); | |
} | |
+#endif | |
Index: sys/arch/luna88k/stand/boot/conf.c | |
=================================================================== | |
RCS file: /cvs/src/sys/arch/luna88k/stand/boot/conf.c,v | |
retrieving revision 1.4 | |
diff -u -r1.4 conf.c | |
--- sys/arch/luna88k/stand/boot/conf.c 9 Dec 2020 18:10:19 -0000 1.4 | |
+++ sys/arch/luna88k/stand/boot/conf.c 14 Dec 2022 13:34:32 -0000 | |
@@ -117,8 +117,11 @@ | |
*/ | |
struct consdev constab[] = { | |
- { bmccnprobe, bmccninit, bmccngetc, bmccnputc }, | |
- { siocnprobe, siocninit, siocngetc, siocnputc }, | |
+#if 0 | |
+ { romcnprobe, romcninit, romcngetc, romcnputc }, | |
+#endif | |
+ { bmccnprobe, bmccninit, bmccngetc, romcnputc }, | |
+ { siocnprobe, siocninit, siocngetc, romcnputc }, | |
{ 0 }, | |
}; | |
Index: sys/arch/luna88k/stand/boot/init_main.c | |
=================================================================== | |
RCS file: /cvs/src/sys/arch/luna88k/stand/boot/init_main.c,v | |
retrieving revision 1.9 | |
diff -u -r1.9 init_main.c | |
--- sys/arch/luna88k/stand/boot/init_main.c 14 Oct 2022 20:53:19 -0000 1.9 | |
+++ sys/arch/luna88k/stand/boot/init_main.c 14 Dec 2022 13:34:32 -0000 | |
@@ -188,7 +188,7 @@ | |
nplane = get_plane_numbers(); | |
cninit(); | |
- printf("\nOpenBSD/" MACHINE " (%s) boot 0.7\n\n", machstr); | |
+ printf("\nOpenBSD/" MACHINE " (%s) boot 0.7 ROMCONS_TEST\n\n", machstr); | |
#ifdef SUPPORT_ETHERNET | |
try_bootp = 1; | |
Index: sys/arch/luna88k/stand/boot/romcons.c | |
=================================================================== | |
RCS file: sys/arch/luna88k/stand/boot/romcons.c | |
diff -N sys/arch/luna88k/stand/boot/romcons.c | |
--- /dev/null 1 Jan 1970 00:00:00 -0000 | |
+++ sys/arch/luna88k/stand/boot/romcons.c 14 Dec 2022 13:34:32 -0000 | |
@@ -0,0 +1,51 @@ | |
+/* | |
+ * ROM console routines | |
+ */ | |
+ | |
+#include <sys/param.h> | |
+#include <dev/cons.h> | |
+#include <luna88k/stand/boot/samachdep.h> /* Need this ? */ | |
+ | |
+#define __ROM_FUNC_TABLE ((int **)0x00001100) | |
+#define ROMGETC() (*(int (*)(void))__ROM_FUNC_TABLE[3])() | |
+#define ROMPUTC(x) (*(void (*)(int))__ROM_FUNC_TABLE[4])(x) | |
+ | |
+void | |
+romcnprobe(struct consdev *cp) | |
+{ | |
+ /* XXX */ | |
+ cp->cn_probe = romcnprobe; | |
+ cp->cn_init = romcninit; | |
+ cp->cn_getc = romcngetc; | |
+ cp->cn_putc = romcnputc; | |
+ cp->cn_pollc = NULL; | |
+ cp->cn_bell = NULL; | |
+ /* XXX */ | |
+ cp->cn_dev = 2; | |
+ cp->cn_pri = CN_FORCED; | |
+} | |
+ | |
+void | |
+romcninit(struct consdev *cp) | |
+{ | |
+ /* Nothing to do */ | |
+} | |
+ | |
+int | |
+romcngetc(dev_t dev) | |
+{ | |
+ int c; | |
+ | |
+ do { | |
+ c = ROMGETC(); | |
+ } while (c == -1); | |
+ return c; | |
+} | |
+ | |
+void | |
+romcnputc(dev_t dev, int c) | |
+{ | |
+ if ((char)c == '\n') | |
+ ROMPUTC('\r'); | |
+ ROMPUTC(c); | |
+} | |
Index: sys/arch/luna88k/stand/boot/samachdep.h | |
=================================================================== | |
RCS file: /cvs/src/sys/arch/luna88k/stand/boot/samachdep.h,v | |
retrieving revision 1.5 | |
diff -u -r1.5 samachdep.h | |
--- sys/arch/luna88k/stand/boot/samachdep.h 14 Oct 2022 20:53:19 -0000 1.5 | |
+++ sys/arch/luna88k/stand/boot/samachdep.h 14 Dec 2022 13:34:32 -0000 | |
@@ -125,6 +125,12 @@ | |
int parse(int, char **); | |
int getargs(char *, char **, int); | |
+/* romcons.c */ | |
+void romcnprobe(struct consdev *); | |
+void romcninit(struct consdev *); | |
+int romcngetc(dev_t); | |
+void romcnputc(dev_t, int); | |
+ | |
/* sc.c */ | |
struct scsi_softc; | |
int scinit(struct scsi_softc *, uint); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment