diff options
author | Marcel Moolenaar <marcel@FreeBSD.org> | 2005-09-21 04:36:40 +0000 |
---|---|---|
committer | Marcel Moolenaar <marcel@FreeBSD.org> | 2005-09-21 04:36:40 +0000 |
commit | 3cf09dd12307639f48a0a53c7de93e8b96f9347e (patch) | |
tree | b3636ee41c743d0cc49068a1893c2beb275df39f /sys/dev/fxp/if_fxp.c | |
parent | 8aaa8fe7337c8fff293e7688aff704046ee065cc (diff) |
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
Notes
Notes:
svn path=/head/; revision=150408
Diffstat (limited to 'sys/dev/fxp/if_fxp.c')
-rw-r--r-- | sys/dev/fxp/if_fxp.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/sys/dev/fxp/if_fxp.c b/sys/dev/fxp/if_fxp.c index a51509e6d115..c5a7afb1935c 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 |