Subject: Problems in com.c
To: None <port-i386@NetBSD.ORG>
From: Geir Inge Jensen <geiri@jk1.Cc.UiT.No>
List: port-i386
Date: 05/20/1997 18:02:01
Hi,

I have been tracking current for some years now, and it has always worked
reasonably well. Last november I sup'ed current and it compiled fine.
However, I got into a kernel loop as soon as I entered 'ttyflags' in
rc. This was due to a problem in com.c and I was forced to go back to
a clean 1.2 system. 

Yesterday I got an internal error in /usr/bin/ld, and I thougt it was time
to upgrade my system again. I did report my problem last time, and I 
assumed it would be fixed by now. However, the kernel loops at the very
same place. It might be a HW-related bug, but it works fine with a clean
1.2 system (and every release before that).

This is the statement that loops in procedure com_iflush:

/* flush any pending I/O */
while (ISSET(bus_space_read_1(iot, ioh, com_lsr), LSR_RXRDY))
        (void) bus_space_read_1(iot, ioh, com_data);

Somehow, it seems that there always are pending incoming packets (although
there is nothing connected to the port!). How can I check that the
bus_space_read_1 actually reads the data? Could it be that either iot or ioh
has wrong values? Is the port initialized correctly?

Output from boot messages:

...
May 19 23:11:27 jk1 /netbsd: com0 at isa0 port 0x3f8-0x3ff irq 4: ns8250 or ns16
450, no fifo
May 19 23:11:27 jk1 /netbsd: com1 at isa0 port 0x2f8-0x2ff irq 3: ns8250 or ns16
450, no fifo
May 19 23:11:27 jk1 /netbsd: com2 at isa0 port 0x3e8-0x3ef irq 5: ns16550a, work
ing fifo
May 19 23:11:27 jk1 /netbsd: com3 at isa0 port 0x2e8-0x2ef irq 3: ns8250 or ns16
450, no fifo                                                         
...
Setting tty flags
com0: comparam -clocal +dcd +ts_carr_on -dtr -tx_stopped
com0: comparam -crtscts +cts -ts_ttstop -rts -rx_blocked
com0: comiflush -clocal +dcd +ts_carr_on +dtr -tx_stopped
com0: comiflush -crtscts +cts -ts_ttstop +rts -rx_blocked


'comiflush' has I put in just before the statement that loops. Anybody
that knows how to fix this? Any clue at all to how I can debug this?
It would be nice to track current again (and still be able to use the
com ports ;)

Keep up the good work.

-Geir Inge