Source-Changes archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

CVS commit: src/sys/dev



Module Name:    src
Committed By:   brad
Date:           Tue Nov 25 13:23:29 UTC 2025

Modified Files:
        src/sys/dev/i2c: sc16is7xxi2c.c
        src/sys/dev/ic: com.c comvar.h sc16is7xx.c sc16is7xx_tty.c
            sc16is7xx_ttyvar.h
        src/sys/dev/spi: sc16is7xxspi.c

Log Message:
Address a couple of problems with the sc16ix7xx(4) driver, noticed
when you have a bus that can detach, such as presented by the
umcpmio(4) driver.

o The dev/ic/com.c code pretty much assumed that it was using a device
on a computer bus and as such the registers would not suddenly
disappear out from under it.  This won't be the case with the
sc16is7xx(4) driver.  However, the code in dev/ic/com.c is not at all
structured in a manor that handles a failure to do a read or write.
Generally, this won't be a problem, except for comintr() which is the
interrupt handler.  When called in polled mode, especially, it is
possible that the code in comintr() can get stuck in one of its loops
because it will NEVER get the values it expects back from the device
if the device disappears.  To deal with this introduce a out of band
way to indicate that a read or write failed and check that in
comintr().  This allows it to exit out in a sane manor.  This along
with the corresponding changes to the attachment specific code fixes a
problem where the system could (and probably would) hang up hard if
the device disappeared (comintr() would be running in a VERY tight
loop hogging everything).  Note that the enable / disable support that
com.c has wasn't enough to deal with this, as the call into comintr()
could already have been in flight and well on its way to getting
stuck.

o Use the proper softc in the CFATTACH_DECL_ call for the I2C and SPI
attachments.  I don't know what I was thinking at the time.  Fixes a
problem where the system will panic in a unusual way if the device is
detached and then reattached.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/dev/i2c/sc16is7xxi2c.c
cvs rdiff -u -r1.389 -r1.390 src/sys/dev/ic/com.c
cvs rdiff -u -r1.99 -r1.100 src/sys/dev/ic/comvar.h
cvs rdiff -u -r1.2 -r1.3 src/sys/dev/ic/sc16is7xx.c \
    src/sys/dev/ic/sc16is7xx_tty.c
cvs rdiff -u -r1.1 -r1.2 src/sys/dev/ic/sc16is7xx_ttyvar.h
cvs rdiff -u -r1.1 -r1.2 src/sys/dev/spi/sc16is7xxspi.c

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




Home | Main Index | Thread Index | Old Index