Module Name:    src
Committed By:   tsutsui
Date:           Sat Sep 25 15:18:38 UTC 2021

Modified Files:
        src/sys/arch/luna68k/dev: lunaws.c sio.c sioreg.h siotty.c siovar.h
        src/sys/arch/luna68k/luna68k: machdep.c
Added Files:
        src/sys/arch/luna68k/dev: siottyvar.h
Removed Files:
        src/sys/arch/luna68k/dev: syscn.h

Log Message:
Refactor and cleanup sio (uPD7201) drivers.

- remove confusing syscn*() functions (and its header) and prepare
  explicit siottycninit(), siottycnget() and siottycnput() functions
- use exported struct consdev and cn_tab to initialize siotty console
- enable and handle E/S interrupts to make BREAK signal detected properly
- make CSR (status regsiters) access functions inline static
- make single byte read/write (i.e. cnputc() and cngetc()) functions
  static inline and take struct sio_register rather than sio channel
- use proper integer type (uint16_t) for getsiocsr() as siotty.c
- handle channel dependent CR2A and CR2B registers properly
- use more explicit definitions for RR_* macro used by getsiocsr()
- define and use proper RR0 (read register) values
  (there is no isStatusReg(r) macro used on 4.4BSD/luna68k)

Tested on LUNA with both wscons console and serial console.


To generate a diff of this commit:
cvs rdiff -u -r1.38 -r1.39 src/sys/arch/luna68k/dev/lunaws.c
cvs rdiff -u -r1.15 -r1.16 src/sys/arch/luna68k/dev/sio.c
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/luna68k/dev/sioreg.h
cvs rdiff -u -r1.50 -r1.51 src/sys/arch/luna68k/dev/siotty.c
cvs rdiff -u -r0 -r1.1 src/sys/arch/luna68k/dev/siottyvar.h
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/luna68k/dev/siovar.h
cvs rdiff -u -r1.1 -r0 src/sys/arch/luna68k/dev/syscn.h
cvs rdiff -u -r1.106 -r1.107 src/sys/arch/luna68k/luna68k/machdep.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/luna68k/dev/lunaws.c
diff -u src/sys/arch/luna68k/dev/lunaws.c:1.38 src/sys/arch/luna68k/dev/lunaws.c:1.39
--- src/sys/arch/luna68k/dev/lunaws.c:1.38	Mon Sep 20 08:31:09 2021
+++ src/sys/arch/luna68k/dev/lunaws.c	Sat Sep 25 15:18:38 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: lunaws.c,v 1.38 2021/09/20 08:31:09 tsutsui Exp $ */
+/* $NetBSD: lunaws.c,v 1.39 2021/09/25 15:18:38 tsutsui Exp $ */
 
 /*-
  * Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 #include <sys/cdefs.h>			/* RCS ID & Copyright macro defns */
 
-__KERNEL_RCSID(0, "$NetBSD: lunaws.c,v 1.38 2021/09/20 08:31:09 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: lunaws.c,v 1.39 2021/09/25 15:18:38 tsutsui Exp $");
 
 #include "opt_wsdisplay_compat.h"
 #include "wsmouse.h"
@@ -50,7 +50,8 @@ __KERNEL_RCSID(0, "$NetBSD: lunaws.c,v 1
 #include <luna68k/dev/omkbdmap.h>
 #include <luna68k/dev/sioreg.h>
 #include <luna68k/dev/siovar.h>
-#include <luna68k/dev/syscn.h>
+
+#include <machine/board.h>
 
 #include "ioconf.h"
 
@@ -261,7 +262,7 @@ wsintr(void *arg)
 	struct ws_softc *sc = arg;
 	struct sioreg *sio = sc->sc_ctl;
 	uint8_t code;
-	int rr;
+	uint16_t rr;
 	bool handled = false;
 
 	rr = getsiocsr(sio);
@@ -513,10 +514,14 @@ omkbd_get_buzcmd(struct ws_softc *sc, st
 static void
 ws_cngetc(void *cookie, u_int *type, int *data)
 {
-	struct ws_softc *sc = cookie;
+	struct ws_softc *sc = cookie;	/* currently unused */
+	struct sioreg *sio, *sio_base;
 	int code;
 
-	code = syscngetc((dev_t)1);
+	sio_base = (struct sioreg *)OBIO_SIO;
+	sio = &sio_base[1];	/* channel B */
+
+	code = siogetc(sio);
 	omkbd_decode(sc, code, type, data);
 }
 
@@ -528,10 +533,14 @@ ws_cnpollc(void *cookie, int on)
 static void
 ws_cnbell(void *cookie, u_int pitch, u_int period, u_int volume)
 {
-	struct ws_softc *sc = cookie;
+	struct ws_softc *sc = cookie;	/* currently unused */
+	struct sioreg *sio, *sio_base;
 	struct wskbd_bell_data wbd;
 	uint8_t buzcmd;
 
+	sio_base = (struct sioreg *)OBIO_SIO;
+	sio = &sio_base[1];	/* channel B */
+
 	/*
 	 * XXX cnbell(9) man page should describe each args..
 	 *     (it looks similar to the struct wskbd_bell_data)
@@ -545,7 +554,7 @@ ws_cnbell(void *cookie, u_int pitch, u_i
 	wbd.volume = volume;
 	buzcmd = omkbd_get_buzcmd(sc, &wbd, OMKBD_BUZZER_DEFAULT);
 
-	syscnputc((dev_t)1, buzcmd);
+	sioputc(sio, buzcmd);
 }
 
 /* EXPORT */ void

Index: src/sys/arch/luna68k/dev/sio.c
diff -u src/sys/arch/luna68k/dev/sio.c:1.15 src/sys/arch/luna68k/dev/sio.c:1.16
--- src/sys/arch/luna68k/dev/sio.c:1.15	Sat Aug  7 16:18:57 2021
+++ src/sys/arch/luna68k/dev/sio.c	Sat Sep 25 15:18:38 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: sio.c,v 1.15 2021/08/07 16:18:57 thorpej Exp $ */
+/* $NetBSD: sio.c,v 1.16 2021/09/25 15:18:38 tsutsui Exp $ */
 
 /*-
  * Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 #include <sys/cdefs.h>			/* RCS ID & Copyright macro defns */
 
-__KERNEL_RCSID(0, "$NetBSD: sio.c,v 1.15 2021/08/07 16:18:57 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sio.c,v 1.16 2021/09/25 15:18:38 tsutsui Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -41,6 +41,7 @@ __KERNEL_RCSID(0, "$NetBSD: sio.c,v 1.15
 #include <machine/autoconf.h>
 
 #include <luna68k/luna68k/isr.h>
+#include <luna68k/dev/sioreg.h>
 #include <luna68k/dev/siovar.h>
 
 #include "ioconf.h"

Index: src/sys/arch/luna68k/dev/sioreg.h
diff -u src/sys/arch/luna68k/dev/sioreg.h:1.4 src/sys/arch/luna68k/dev/sioreg.h:1.5
--- src/sys/arch/luna68k/dev/sioreg.h:1.4	Wed Jul 27 14:17:54 2011
+++ src/sys/arch/luna68k/dev/sioreg.h	Sat Sep 25 15:18:38 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: sioreg.h,v 1.4 2011/07/27 14:17:54 tsutsui Exp $ */
+/* $NetBSD: sioreg.h,v 1.5 2021/09/25 15:18:38 tsutsui Exp $ */
 /*
  * Copyright (c) 1992, 1993
  *	The Regents of the University of California.  All rights reserved.
@@ -79,17 +79,12 @@
 #define WR6		0x06
 #define WR7		0x07
 
-#define WR2A		WR2
-#define WR2B		(WR2|0x10)
+#define WR2A		WR2	/* on channel A */
+#define WR2B		WR2	/* on channel B */
 
-#define RR0		0x08
-#define RR1		0x09
-#define RR2		0x0A
-#define RR3		0x0B
-#define RR4		0x0C
-
-#define RR2A		RR2
-#define RR2B		(RR2|0x10)
+#define RR0		0x00
+#define RR1		0x01
+#define RR2		0x02	/* only on channel B */
 
 #define WR0_NOP		0x00	/* No Operation */
 #define WR0_SNDABRT	0x08	/* Send Abort (HDLC) */
@@ -108,12 +103,14 @@
 #define WR1_RXALLS	0x10	/* Interrupt Every Characters Received (with Special Char.) */
 #define WR1_RXALL	0x18	/* Interrupt Every Characters Received (without Special Char.) */
 
-#define WR2_INTR_0	0x00	/* Interrupt Priority: RxA TxA RxB TxB E/SA E/SA */
-#define WR2_INTR_1	0x04	/* Interrupt Priority: RxA RxB TxA TxB E/SA E/SA */
-#define WR2_VEC85_1	0x00	/* 8085 Vectored Mode - 1 */
-#define WR2_VEC85_2	0x08	/* 8085 Vectored Mode - 2 */
-#define WR2_VEC86	0x10	/* 8086 Vectored */
-#define WR2_VEC85_3	0x18	/* 8085 Vectored Mode - 3 */
+#define WR2A_INTR_0	0x00	/* Interrupt Priority: RxA TxA RxB TxB E/SA E/SA */
+#define WR2A_INTR_1	0x04	/* Interrupt Priority: RxA RxB TxA TxB E/SA E/SA */
+#define WR2A_VEC85_1	0x00	/* 8085 Vectored Mode - 1 */
+#define WR2A_VEC85_2	0x08	/* 8085 Vectored Mode - 2 */
+#define WR2A_VEC86	0x10	/* 8086 Vectored */
+#define WR2A_VEC85_3	0x18	/* 8085 Vectored Mode - 3 */
+
+/* WR2B has interrupt vector value */
 
 #define WR3_RXENBL	0x01	/* Rx Enable */
 #define WR3_RXCRC	0x08	/* Rx CRC Check */
@@ -156,13 +153,14 @@
 #define RR1_OVERRUN	0x20	/* Data Over Run */
 #define RR1_FRAMING	0x40	/* Framing Error */
 
-#define RR_RXRDY	0x0100	/* Rx Character Available */
-#define RR_INTRPEND	0x0200	/* Interrupt Pending (Channel-A Only) */
-#define RR_TXRDY	0x0400	/* Tx Buffer Empty */
-#define RR_DCD		0x0800	/* Data Carrier Detect [DCD] */
-#define RR_SYNC		0x1000	/* Synchronization */
-#define RR_CTS		0x2000	/* Clear To Send       [CTS] */
-#define RR_BREAK	0x8000	/* Break Detected */
-#define RR_PARITY	0x0010	/* Parity Error */
-#define RR_OVERRUN	0x0020	/* Data Over Run */
-#define RR_FRAMING	0x0040	/* Framing Error */
+/* for getsiocsr() */
+#define RR_RXRDY	(RR0_RXAVAIL  << 8)
+#define RR_INTRPEND	(RR0_INTRPEND << 8)
+#define RR_TXRDY	(RR0_TXEMPTY  << 8)
+#define RR_DCD		(RR0_DCD      << 8)
+#define RR_SYNC		(RR0_SYNC     << 8)
+#define RR_CTS		(RR0_CTS      << 8)
+#define RR_BREAK	(RR0_BREAK    << 8)
+#define RR_PARITY	(RR1_PARITY)
+#define RR_OVERRUN	(RR1_OVERRUN)
+#define RR_FRAMING	(RR1_FRAMING)

Index: src/sys/arch/luna68k/dev/siotty.c
diff -u src/sys/arch/luna68k/dev/siotty.c:1.50 src/sys/arch/luna68k/dev/siotty.c:1.51
--- src/sys/arch/luna68k/dev/siotty.c:1.50	Sat Sep  4 12:54:19 2021
+++ src/sys/arch/luna68k/dev/siotty.c	Sat Sep 25 15:18:38 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: siotty.c,v 1.50 2021/09/04 12:54:19 tsutsui Exp $ */
+/* $NetBSD: siotty.c,v 1.51 2021/09/25 15:18:38 tsutsui Exp $ */
 
 /*-
  * Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 #include <sys/cdefs.h>			/* RCS ID & Copyright macro defns */
 
-__KERNEL_RCSID(0, "$NetBSD: siotty.c,v 1.50 2021/09/04 12:54:19 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: siotty.c,v 1.51 2021/09/25 15:18:38 tsutsui Exp $");
 
 #include "opt_ddb.h"
 #include "siotty.h"
@@ -55,7 +55,6 @@ __KERNEL_RCSID(0, "$NetBSD: siotty.c,v 1
 
 #include <luna68k/dev/sioreg.h>
 #include <luna68k/dev/siovar.h>
-#include <luna68k/dev/syscn.h>
 
 #include "ioconf.h"
 
@@ -63,7 +62,7 @@ __KERNEL_RCSID(0, "$NetBSD: siotty.c,v 1
 
 static const uint8_t ch0_regs[6] = {
 	WR0_RSTINT,				/* reset E/S interrupt */
-	WR1_RXALLS | WR1_TXENBL,		/* Rx per char, Tx */
+	WR1_RXALLS | WR1_TXENBL | WR1_ESENBL,	/* Rx per char, Tx, E/S */
 	0,					/* */
 	WR3_RX8BIT | WR3_RXENBL,		/* Rx */
 	WR4_BAUD96 | WR4_STOP1,			/* Tx/Rx */
@@ -129,6 +128,10 @@ static dev_type_stop(siostop);
 static dev_type_tty(siotty);
 static dev_type_poll(siopoll);
 
+static dev_type_cninit(siottycninit);
+static dev_type_cngetc(siottycngetc);
+static dev_type_cnputc(siottycnputc);
+
 const struct cdevsw siotty_cdevsw = {
 	.d_open = sioopen,
 	.d_close = sioclose,
@@ -177,8 +180,8 @@ siotty_attach(device_t parent, device_t 
 		sc->sc_flags = TIOCFLAG_SOFTCAR;
 	} else {
 		setsioreg(sc->sc_ctl, WR0, WR0_CHANRST);
-		setsioreg(sc->sc_ctl, WR2A, WR2_VEC86 | WR2_INTR_1);
-		setsioreg(sc->sc_ctl, WR2B, 0);
+		setsioreg(&siosc->sc_ctl[0], WR2A, WR2A_VEC86 | WR2A_INTR_1);
+		setsioreg(&siosc->sc_ctl[1], WR2B, 0);
 		setsioreg(sc->sc_ctl, WR0, sc->sc_wr[WR0]);
 		setsioreg(sc->sc_ctl, WR4, sc->sc_wr[WR4]);
 		setsioreg(sc->sc_ctl, WR3, sc->sc_wr[WR3]);
@@ -227,9 +230,11 @@ siottyintr(void *arg)
 	sio = sc->sc_ctl;
 	rr = getsiocsr(sio);
 	if ((rr & RR_BREAK) != 0) {
-		sio->sio_cmd = WR0_RSTINT;
 		cn_check_magic(sc->sc_tty->t_dev, CNC_BREAK, siotty_cnm_state);
 	}
+	/* XXX should handle RR_DCD and RR_CTS */
+	sio->sio_cmd = WR0_RSTINT;
+
 	if ((rr & RR_RXRDY) != 0) {
 		do {
 			if (cc > 0) {
@@ -669,35 +674,13 @@ siotty(dev_t dev)
 	return sc->sc_tty;
 }
 
-/*--------------------  miscelleneous routine --------------------*/
-
-/* EXPORT */ void
-setsioreg(struct sioreg *sio, int regno, int val)
-{
-
-	if (regno != 0)
-		sio->sio_cmd = regno;	/* DELAY(); */
-	sio->sio_cmd = val;		/* DELAY(); */
-}
-
-/* EXPORT */ uint16_t
-getsiocsr(struct sioreg *sio)
-{
-	int val;
-
-	val = sio->sio_stat << 8;	/* DELAY(); */
-	sio->sio_cmd = 1;		/* DELAY(); */
-	val |= sio->sio_stat;		/* DELAY(); */
-	return val;
-}
-
 /*---------------------  console interface ----------------------*/
 
-struct consdev syscons = {
+struct consdev siottycons = {
 	.cn_probe = NULL,
-	.cn_init  = NULL,
-	.cn_getc  = syscngetc,
-	.cn_putc  = syscnputc,
+	.cn_init  = siottycninit,
+	.cn_getc  = siottycngetc,
+	.cn_putc  = siottycnputc,
 	.cn_pollc = nullcnpollc,
 	.cn_bell  = NULL,
 	.cn_halt  = NULL,
@@ -706,25 +689,28 @@ struct consdev syscons = {
 	.cn_pri   = CN_REMOTE,
 };
 
-/* EXPORT */ void
-syscninit(int channel)
+static void
+siottycninit(struct consdev *cn)
 {
 /*
  * Channel A is immediately initialized with 9600N1 right after cold
  * boot/reset/poweron.  ROM monitor emits one line message on CH.A.
  */
-	struct sioreg *sio;
-	sio = (struct sioreg *)OBIO_SIO + channel;
+	struct sioreg *sio, *sio_base, *sio_a, *sio_b;
 
-	syscons.cn_dev = makedev(cdevsw_lookup_major(&siotty_cdevsw),
-				 channel);
-	cn_tab = &syscons;
+	sio_base = (struct sioreg *)OBIO_SIO;
+	sio_a = &sio_base[0];
+	sio_b = &sio_base[1];
+	sio   = sio_a;
+
+	siottycons.cn_dev =
+	    makedev(cdevsw_lookup_major(&siotty_cdevsw), 0);
 	cn_init_magic(&siotty_cnm_state);
 	cn_set_magic("\047\001");
 
 	setsioreg(sio, WR0, WR0_CHANRST);
-	setsioreg(sio, WR2A, WR2_VEC86 | WR2_INTR_1);
-	setsioreg(sio, WR2B, 0);
+	setsioreg(sio_a, WR2A, WR2A_VEC86 | WR2A_INTR_1);
+	setsioreg(sio_b, WR2B, 0);
 	setsioreg(sio, WR0, ch0_regs[WR0]);
 	setsioreg(sio, WR4, ch0_regs[WR4]);
 	setsioreg(sio, WR3, ch0_regs[WR3]);
@@ -732,33 +718,20 @@ syscninit(int channel)
 	setsioreg(sio, WR0, ch0_regs[WR0]);
 }
 
-/* EXPORT */ int
-syscngetc(dev_t dev)
+static int
+siottycngetc(dev_t dev)
 {
 	struct sioreg *sio;
-	int s, c;
 
-	sio = (struct sioreg *)OBIO_SIO + ((int)dev & 0x1);
-	s = splhigh();
-	while ((getsiocsr(sio) & RR_RXRDY) == 0)
-		continue;
-	c = sio->sio_data;
-	splx(s);
-
-	return c;
+	sio = (struct sioreg *)OBIO_SIO;
+	return siogetc(sio);
 }
 
-/* EXPORT */ void
-syscnputc(dev_t dev, int c)
+static void
+siottycnputc(dev_t dev, int c)
 {
 	struct sioreg *sio;
-	int s;
 
-	sio = (struct sioreg *)OBIO_SIO + ((int)dev & 0x1);
-	s = splhigh();
-	while ((getsiocsr(sio) & RR_TXRDY) == 0)
-		continue;
-	sio->sio_cmd = WR0_RSTPEND;
-	sio->sio_data = c;
-	splx(s);
+	sio = (struct sioreg *)OBIO_SIO;
+	sioputc(sio, c);
 }

Index: src/sys/arch/luna68k/dev/siovar.h
diff -u src/sys/arch/luna68k/dev/siovar.h:1.8 src/sys/arch/luna68k/dev/siovar.h:1.9
--- src/sys/arch/luna68k/dev/siovar.h:1.8	Sun Feb  2 15:35:06 2014
+++ src/sys/arch/luna68k/dev/siovar.h	Sat Sep 25 15:18:38 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: siovar.h,v 1.8 2014/02/02 15:35:06 tsutsui Exp $ */
+/* $NetBSD: siovar.h,v 1.9 2021/09/25 15:18:38 tsutsui Exp $ */
 
 /*-
  * Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -51,5 +51,56 @@ struct sio_softc {
 	} sc_intrhand[2];
 };
 
-uint16_t getsiocsr(struct sioreg *);
-void setsioreg(struct sioreg *, int, int);
+static inline uint16_t getsiocsr(struct sioreg *);
+static inline void setsioreg(struct sioreg *, int, int);
+
+static inline int siogetc(struct sioreg *);
+static inline void sioputc(struct sioreg *, int);
+
+static inline uint16_t
+getsiocsr(struct sioreg *sio)
+{
+	uint16_t val;
+
+	val = sio->sio_stat << 8;
+	sio->sio_cmd = RR1;
+	val |= sio->sio_stat;
+
+	return val;
+}
+
+static inline void
+setsioreg(struct sioreg *sio, int regno, int val)
+{
+
+	if (regno != WR0)
+		sio->sio_cmd = regno;
+	sio->sio_cmd = val;
+}
+
+static inline int
+siogetc(struct sioreg *sio)
+{
+	int s, c;
+
+	s = splhigh();
+	while ((getsiocsr(sio) & RR_RXRDY) == 0)
+		continue;
+	c = sio->sio_data;
+	splx(s);
+
+	return c;
+}
+
+static inline void
+sioputc(struct sioreg *sio, int c)
+{
+	int s;
+
+	s = splhigh();
+	while ((getsiocsr(sio) & RR_TXRDY) == 0)
+		continue;
+	sio->sio_cmd = WR0_RSTPEND;
+	sio->sio_data = c;
+	splx(s);
+}

Index: src/sys/arch/luna68k/luna68k/machdep.c
diff -u src/sys/arch/luna68k/luna68k/machdep.c:1.106 src/sys/arch/luna68k/luna68k/machdep.c:1.107
--- src/sys/arch/luna68k/luna68k/machdep.c:1.106	Thu Jun 11 19:20:44 2020
+++ src/sys/arch/luna68k/luna68k/machdep.c	Sat Sep 25 15:18:38 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: machdep.c,v 1.106 2020/06/11 19:20:44 ad Exp $ */
+/* $NetBSD: machdep.c,v 1.107 2021/09/25 15:18:38 tsutsui Exp $ */
 
 /*-
  * Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 #include <sys/cdefs.h>			/* RCS ID & Copyright macro defns */
 
-__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.106 2020/06/11 19:20:44 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.107 2021/09/25 15:18:38 tsutsui Exp $");
 
 #include "opt_ddb.h"
 #include "opt_kgdb.h"
@@ -84,7 +84,7 @@ __KERNEL_RCSID(0, "$NetBSD: machdep.c,v 
 #include <machine/pte.h>
 #include <machine/kcore.h>	/* XXX should be pulled in by sys/kcore.h */
 
-#include <luna68k/dev/syscn.h>
+#include <luna68k/dev/siottyvar.h>
 
 #include <dev/cons.h>
 #include <dev/mm.h>
@@ -136,7 +136,6 @@ cpu_kcore_hdr_t cpu_kcore_hdr;
 int	machtype;	/* model: 1 for LUNA-1, 2 for LUNA-2 */
 int	sysconsole;	/* console: 0 for ttya, 1 for video */
 
-extern struct consdev syscons;
 extern void omfb_cnattach(void);
 extern void ws_cnattach(void);
 
@@ -166,7 +165,7 @@ luna68k_init(void)
 
 	/* initialize cn_tab for early console */
 #if 1
-	cn_tab = &syscons;
+	cn_tab = &siottycons;
 #else
 	cn_tab = &romcons;
 #endif
@@ -248,9 +247,10 @@ void
 consinit(void)
 {
 
-	if (sysconsole == 0)
-		syscninit(0);
-	else {
+	if (sysconsole == 0) {
+		cn_tab = &siottycons;
+		(*cn_tab->cn_init)(cn_tab);
+	} else {
 		omfb_cnattach();
 		ws_cnattach();
 	}

Added files:

Index: src/sys/arch/luna68k/dev/siottyvar.h
diff -u /dev/null src/sys/arch/luna68k/dev/siottyvar.h:1.1
--- /dev/null	Sat Sep 25 15:18:38 2021
+++ src/sys/arch/luna68k/dev/siottyvar.h	Sat Sep 25 15:18:38 2021
@@ -0,0 +1,3 @@
+/* $NetBSD: siottyvar.h,v 1.1 2021/09/25 15:18:38 tsutsui Exp $ */
+
+extern struct consdev siottycons;

Reply via email to