Subject: Re: panics with X running
To: None <michaelv@HeadCandy.com>
From: Kenneth Stailey <kstailey@leidecker.gsfc.nasa.gov>
List: port-i386
Date: 04/11/1995 21:51:23
I am now running pluto with the console on the second serial port at 19.2K

When I panic (mount /tmp /tmp is an easy way) while running X I end up
in the debugger on the serial port.

The only flaw seems to be that one of the console startup messages is
wrecked.  Instead of

Apr 11 20:56:18 pluto /netbsd: com1 at isa0 port 0x2f8-0x2ff irq 3: ns16550a, working fifo

I see glorp instead.  All of the other messages work.

What got changed...

I started with adding three lines to the PLUTO config file based on
KICKME since it also uses a serial console:

options         COMCONSOLE=0
options         COMUNIT=0
options         COMADDR=0x3f8

Later I realized that the last two of these line don't do anything.
Typo on COMUNIT vs CONUNIT?  Anyhow I now use:

options         COMCONSOLE=1    # console
options         CONUNIT=1       # on the second
options         CONADDR=0x2f8   # serial port
options         CONSPEED=B19200

The last one, CONSPEED, requires a hack to com.c, as does getting most
of the starup messages to work (can't disable interrupts or messages
will stop, a printf in comcninit() causes the baud to get set early.)

--- com.c.DIST  Tue Apr 11 18:56:53 1995
+++ com.c       Tue Apr 11 21:47:40 1995
@@ -97,10 +97,11 @@
        NULL, "com", comprobe, comattach, DV_TTY, sizeof(struct com_softc)
 };
 
-int    comdefaultrate = TTY_DEFAULT;
 #ifdef COMCONSOLE
+int    comdefaultrate = CONSPEED;
 int    comconsole = COMCONSOLE;
 #else
+int    comdefaultrate = TTY_DEFAULT;
 int    comconsole = -1;
 #endif
 int    comconsinit;
@@ -208,8 +209,10 @@
        outb(iobase + com_fifo, 0);
 
        /* disable interrupts */
-       outb(iobase + com_ier, 0);
-       outb(iobase + com_mcr, 0);
+       if (sc->sc_dev.dv_unit != comconsole) {
+               outb(iobase + com_ier, 0);
+               outb(iobase + com_mcr, 0);
+       }
 
        if (ia->ia_irq != IRQUNK) {
                sc->sc_ih.ih_fun = comintr;
@@ -857,6 +860,8 @@
        cominit(CONUNIT, comdefaultrate);
        comconsole = CONUNIT;
        comconsinit = 0;
+       /* this printf forces console to initialize */
+       printf("serial console initialized\n");
 }
 
 cominit(unit, rate)

-------------------------------------------------------------------
comreg.h has a very pessimistic two part WARNING toward the bottom.
Fortunately it is all wrong:

pluto% diff -u comreg.h.DIST comreg.h
--- comreg.h.DIST       Tue Apr 11 18:23:43 1995
+++ comreg.h    Tue Apr 11 19:12:54 1995
@@ -114,5 +114,14 @@
  * WARNING: Serial console is assumed to be at COM1 address
  * and CONUNIT must be 0.
  */
-#define        CONADDR (0x3f8)
-#define        CONUNIT (0)
+#ifndef CONADDR
+# define       CONADDR (0x3f8)
+#endif
+
+#ifndef CONUNIT
+# define       CONUNIT (0)
+#endif
+
+#ifndef CONSPEED
+# define CONSPEED TTYDEF_SPEED
+#endif

Also cninit.c was broken on the day that I tried all of this, since you
can't initialize an external.  Hopefully it's fixed, since it prevents
kernel builds it's pretty noticeable.

pluto% diff -u cninit.c~ cninit.c
--- cninit.c~   Tue Apr 11 14:05:39 1995
+++ cninit.c    Tue Apr 11 14:23:14 1995
@@ -57,7 +57,7 @@
 
 extern struct consdev constab[];
 
-extern struct  tty *constty = NULL;    /* virtual console output device */
+extern struct  tty *constty;           /* virtual console output device */
 extern struct  consdev *cn_tab;        /* physical console device info */
 extern struct  vnode *cn_devvp;        /* vnode for underlying device. */