Subject: JS1 com console
To: None <port-sparc@netbsd.org>
From: Valeriy E. Ushakov <uwe@ptc.spbu.ru>
List: port-sparc
Date: 05/08/2001 10:17:39
Since -current runs solid on JS1/OBP3 and I can't play with keyboard
support for a while I looked at com driver (/obio/su) to learn more
about kernel internals (and, in the long run, to be able to use kgdb).

I tweaked com_obio.c:

#ifndef CONSPEED
#define CONSPEED	(B9600)
#endif
#ifndef CONMODE
#define CONMODE		((TTYDEF_CFLAG & ~(CSIZE|CSTOPB|PARENB))|CS8) /* 8N1 */
#endif

/* NB: com_ebus_isconsole only macroified */
static int
com_obio_isconsole(node)
	int node;
{
	return prom_instance_to_package(prom_stdin()) == node
	    || prom_instance_to_package(prom_stdout()) == node;
}


then at the very begining of com_obio_attach I do:

	if (com_obio_isconsole(sa->sa_node)) /* consult PROM settings */
		comcnattach(sc->sc_iot, sc->sc_iobase,
			    CONSPEED, COM_FREQ, CONMODE);


Autoconfiguration prints:

com0 at obio0 slot 0 offset 0x3002f8 level 13: ns16550a, working fifo
com0: console

and when init is started console is being filled with garbage.  I
guess I'm missing some bits of kernel internals here.  Any hints are
appreciated.


Thanks.

SY, Uwe
-- 
uwe@ptc.spbu.ru                         |       Zu Grunde kommen
http://www.ptc.spbu.ru/~uwe/            |       Ist zu Grunde gehen