summaryrefslogtreecommitdiffstats
path: root/sys/dev/fxp
diff options
context:
space:
mode:
authormarcel <marcel@FreeBSD.org>2005-09-21 04:36:40 +0000
committermarcel <marcel@FreeBSD.org>2005-09-21 04:36:40 +0000
commitfc1e5e377c8e1e29a5131d2328685503cef2feb7 (patch)
treeb3636ee41c743d0cc49068a1893c2beb275df39f /sys/dev/fxp
parentdcb8de96ab47d1932ce313adbac5a673210b1c91 (diff)
downloadFreeBSD-src-fc1e5e377c8e1e29a5131d2328685503cef2feb7.zip
FreeBSD-src-fc1e5e377c8e1e29a5131d2328685503cef2feb7.tar.gz
Fix an unaligned I/O memory access in the event that a SCB times out.
The FXP_SCR_FLOWCONTROL registers is at offset 0x19, but 2 bytes wide. It cannot be read as a word without causing a panic on architectures that enforce strict alignment. MFC after: 3 days
Diffstat (limited to 'sys/dev/fxp')
-rw-r--r--sys/dev/fxp/if_fxp.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/sys/dev/fxp/if_fxp.c b/sys/dev/fxp/if_fxp.c
index a51509e..c5a7afb 100644
--- a/sys/dev/fxp/if_fxp.c
+++ b/sys/dev/fxp/if_fxp.c
@@ -289,16 +289,22 @@ DRIVER_MODULE(miibus, fxp, miibus_driver, miibus_devclass, 0, 0);
static void
fxp_scb_wait(struct fxp_softc *sc)
{
+ union {
+ uint16_t w;
+ uint8_t b[2];
+ } flowctl;
int i = 10000;
while (CSR_READ_1(sc, FXP_CSR_SCB_COMMAND) && --i)
DELAY(2);
- if (i == 0)
+ if (i == 0) {
+ flowctl.b[0] = CSR_READ_1(sc, FXP_CSR_FLOWCONTROL);
+ flowctl.b[1] = CSR_READ_1(sc, FXP_CSR_FLOWCONTROL + 1);
device_printf(sc->dev, "SCB timeout: 0x%x 0x%x 0x%x 0x%x\n",
CSR_READ_1(sc, FXP_CSR_SCB_COMMAND),
CSR_READ_1(sc, FXP_CSR_SCB_STATACK),
- CSR_READ_1(sc, FXP_CSR_SCB_RUSCUS),
- CSR_READ_2(sc, FXP_CSR_FLOWCONTROL));
+ CSR_READ_1(sc, FXP_CSR_SCB_RUSCUS), flowctl.w);
+ }
}
static void
OpenPOWER on IntegriCloud