summaryrefslogtreecommitdiffstats
path: root/sys/dev/uart
diff options
context:
space:
mode:
authormarcel <marcel@FreeBSD.org>2005-04-27 21:57:51 +0000
committermarcel <marcel@FreeBSD.org>2005-04-27 21:57:51 +0000
commit4caac8b9730f92775c41e5d0d46b932473c22b48 (patch)
treeb7c75677048ca0565672a14dc0feccca62f794e4 /sys/dev/uart
parent1dcbf1fa6d10d13dbb22aa0e0ad569b2a28c7791 (diff)
downloadFreeBSD-src-4caac8b9730f92775c41e5d0d46b932473c22b48.zip
FreeBSD-src-4caac8b9730f92775c41e5d0d46b932473c22b48.tar.gz
Make the Z8530 more reliable as low-level console by making use of the
fact that access to RR0 does not need a prior write to the register index because the index always reverts to 0 after the indexed register has been accessed. Typically when a RR or WR is to accessed, one programs the index (which is a write to the control register), followed by a read or write to the actual indexed register (a read pr write to the same control register). When this non-atomic sequence is interrupted after having written the index and low-level console I/O is done in that situation, the write to program the index will actually write to the indexed register and nuke state. This almost always yields a wedge. By not programming the index register and instead just reading from RR0, the worst case scenario is non-fatal. For if we don't actually read from RR0 but some other register we get an invalid status, which may lead us to conclude that the transit data register is empty when it's not or that the receive data register contains data when it doesn't. Hence, we may lose an output character or get a sporadic input character, but given the situation this is a non-issue. Full serialization is not possible due to the fact that this code needs to work from DDB and before mutex initialization has happened. In collaboration with: kris@, marius@ Tested by: kris@ MFC after: 1 day X-MFC: 5.4-RELEASE candidate
Diffstat (limited to 'sys/dev/uart')
-rw-r--r--sys/dev/uart/uart_dev_z8530.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/sys/dev/uart/uart_dev_z8530.c b/sys/dev/uart/uart_dev_z8530.c
index 725b314..9178423 100644
--- a/sys/dev/uart/uart_dev_z8530.c
+++ b/sys/dev/uart/uart_dev_z8530.c
@@ -213,7 +213,7 @@ static void
z8530_putc(struct uart_bas *bas, int c)
{
- while (!(uart_getmreg(bas, RR_BES) & BES_TXE))
+ while (!(uart_getreg(bas, REG_CTRL) & BES_TXE))
;
uart_setreg(bas, REG_DATA, c);
uart_barrier(bas);
@@ -223,7 +223,7 @@ static int
z8530_poll(struct uart_bas *bas)
{
- if (!(uart_getmreg(bas, RR_BES) & BES_RXA))
+ if (!(uart_getreg(bas, REG_CTRL) & BES_RXA))
return (-1);
return (uart_getreg(bas, REG_DATA));
}
@@ -232,7 +232,7 @@ static int
z8530_getc(struct uart_bas *bas)
{
- while (!(uart_getmreg(bas, RR_BES) & BES_RXA))
+ while (!(uart_getreg(bas, REG_CTRL) & BES_RXA))
;
return (uart_getreg(bas, REG_DATA));
}
OpenPOWER on IntegriCloud