Hi,
I just updated my old workhorse system to r353746 (11.3-STABLE, i386)
and one of my serial connections (driving a 1-wire network) stopped working.
The card with the serial port is a:
puc0 at pci0:4:3:0:??? class=0x070002 card=0x40371409 chip=0x71681409
rev=0x01 hdr=0x00
??? vendor???? = 'Timedia Technology Co Ltd'
??? device???? = 'PCI2S550 (Dual 16550 UART)'
??? class????? = simple comms
??? subclass?? = UART
A ktrace/kdump of the program using the port (around the time when it
gets upset) is:
?71279 WeatherStation CALL?
openat(AT_FDCWD,0x29646010,0x6<O_RDWR|O_NONBLOCK>)
?71279 WeatherStation NAMI? "/dev/cuau3"
?71279 WeatherStation RET?? openat 3
?71279 WeatherStation CALL? ioctl(0x3,TIOCGETA,0xbfbfe9c8)
?71279 WeatherStation RET?? ioctl 0
?71279 WeatherStation CALL? ioctl(0x3,TIOCGETA,0xbfbfe9c8)
?71279 WeatherStation RET?? ioctl 0
?71279 WeatherStation CALL? ioctl(0x3,TIOCSETAF,0xbfbfe9c8)
?71279 WeatherStation RET?? ioctl 0
?71279 WeatherStation CALL? ioctl(0x3,TIOCFLUSH,0xbfbfe998)
?71279 WeatherStation RET?? ioctl 0
?71279 WeatherStation CALL? ioctl(0x3,TIOCGETA,0xbfbfe9c4)
?71279 WeatherStation RET?? ioctl 0
?71279 WeatherStation CALL? ioctl(0x3,TIOCSETAF,0xbfbfe9c4)
?71279 WeatherStation RET?? ioctl 0
?71279 WeatherStation CALL? ioctl(0x3,TIOCSBRK,0)
?71279 WeatherStation RET?? ioctl 0
?71279 WeatherStation CALL? select(0,0,0,0,0xbfbfe9b8)
?71279 WeatherStation RET?? select 0
?71279 WeatherStation CALL? ioctl(0x3,TIOCCBRK,0)
?71279 WeatherStation RET?? ioctl 0
?71279 WeatherStation CALL? nanosleep(0xbfbfe9f0,0)
?71279 WeatherStation RET?? nanosleep 0
?71279 WeatherStation CALL? ioctl(0x3,TIOCFLUSH,0xbfbfe9d8)
?71279 WeatherStation RET?? ioctl 0
?71279 WeatherStation CALL? write(0x3,0xbfbfea2d,0x1)
?71279 WeatherStation GIO?? fd 3 wrote 1 byte
?????? 0x0000
c1????????????????????????????????????????????????????????????????????????????????????????????????????????????
|.|
?71279 WeatherStation RET?? write 1
?71279 WeatherStation CALL? ioctl(0x3,TIOCDRAIN,0)
?71279 WeatherStation RET?? ioctl -1 errno 35 Resource temporarily
unavailable
?71279 WeatherStation CALL? nanosleep(0xbfbfe9f0,0)
?71279 WeatherStation RET?? nanosleep 0
?71279 WeatherStation CALL? ioctl(0x3,TIOCFLUSH,0xbfbfe9d8)
?71279 WeatherStation RET?? ioctl 0
?71279 WeatherStation CALL? write(0x3,0xbfbfea2d,0x5)
?71279 WeatherStation GIO?? fd 3 wrote 5 bytes
?????? 0x0000 1745 5b0f
91??????????????????????????????????????????????????????????????????????????????????????????????????
|.E[..|
?71279 WeatherStation RET?? write 5
?71279 WeatherStation CALL? ioctl(0x3,TIOCDRAIN,0)
?71279 WeatherStation RET?? ioctl -1 errno 35 Resource temporarily
unavailable
?71279 WeatherStation CALL? select(0x4,0xbfbfe968,0,0,0xbfbfe960)
?71279 WeatherStation RET?? select 0
?71279 WeatherStation CALL? ioctl(0x3,TIOCSETAF,0x8158b80)
?71279 WeatherStation RET?? ioctl -1 errno 35 Resource temporarily
unavailable
?71279 WeatherStation CALL? ioctl(0x3,TIOCFLUSH,0xbfbfe9f8)
?71279 WeatherStation RET?? ioctl 0
?71279 WeatherStation CALL? close(0x3)
?71279 WeatherStation RET?? close 0
So it looks like problems with TIOCDRAIN on the serial port.
Doing some very non-scientific digging around what has changed in recent
times, I found r352862 (sys/dev/uart/uart_dev_ns8250.c) that seems to be
working in this area.
(https://svnweb.freebsd.org/base?view=revision&revision=352862) I backed
that change out and now everything is working properly again.
What I don't know because I didn't dig any further is if this is a
problem with the change or if it's a problem with the puc driver not
supporting fields that are then required by the uart code. I know this
card will be quite old so it may be that I need to upgrade to something
newer at some point. The fact that this change has been in current and
has now been merged back to stable sort of suggests that not many other
people have the same hardware. It also may be that I'm the only person
running a 1-wire network from one of these (very likely) and am
therefore the only one seeing this behaviour.
Any thoughts? Thanks for reading.
Brian