PERFORCE change 209161 for review
Robert Watson
rwatson at FreeBSD.org
Fri Apr 6 18:15:07 UTC 2012
http://p4web.freebsd.org/@@209161?ac=10
Change 209161 by rwatson at rwatson_svr_ctsrd_mipsbuild on 2012/04/06 18:14:42
Enable querying and printing of Altera SD Card IP Core register RR1
when an I/O error is reported. Leave XXX comments as it remains the
case that the error-related bits are not properly documented in the
specification. Do more generally print failure information when I/O
bombs. There appear to be non-trivial reliability issues with I/O
-- this evening I will investigate whether simply retrying the I/O
request causes them to clear, and whether the data it returns,
despite the error, might be correct.
Affected files ...
.. //depot/projects/ctsrd/beribsd/src/sys/dev/altera/sdcard/altera_sdcard.h#6 edit
.. //depot/projects/ctsrd/beribsd/src/sys/dev/altera/sdcard/altera_sdcard_io.c#7 edit
Differences ...
==== //depot/projects/ctsrd/beribsd/src/sys/dev/altera/sdcard/altera_sdcard.h#6 (text+ko) ====
@@ -103,6 +103,7 @@
*/
uint16_t altera_sdcard_read_asr(struct altera_sdcard_softc *sc);
int altera_sdcard_read_csd(struct altera_sdcard_softc *sc);
+uint16_t altera_sdcard_read_rr1(struct altera_sdcard_softc *sc);
void altera_sdcard_io_complete(struct altera_sdcard_softc *sc,
uint16_t asr);
==== //depot/projects/ctsrd/beribsd/src/sys/dev/altera/sdcard/altera_sdcard_io.c#7 (text+ko) ====
@@ -183,7 +183,6 @@
return (0);
}
-#if 0
/*
* XXXRW: The Altera IP Core specification indicates that RR1 is a 16-bit
* register, but all bits it identifies are >16 bit. Most likely, RR1 is a
@@ -195,7 +194,6 @@
return (le16toh(bus_read_2(sc->as_res, ALTERA_SDCARD_OFF_RR1)));
}
-#endif
static void
altera_sdcard_write_cmd_arg(struct altera_sdcard_softc *sc, uint32_t cmd_arg)
@@ -277,9 +275,7 @@
altera_sdcard_io_complete(struct altera_sdcard_softc *sc, uint16_t asr)
{
struct bio *bp;
-#if 0
uint16_t rr1;
-#endif
ALTERA_SDCARD_LOCK_ASSERT(sc);
KASSERT(!(asr & ALTERA_SDCARD_ASR_CMDINPROGRESS),
@@ -296,19 +292,19 @@
*/
if (asr &
(ALTERA_SDCARD_ASR_CMDTIMEOUT | ALTERA_SDCARD_ASR_CMDDATAERROR)) {
+ rr1 = altera_sdcard_read_rr1(sc);
+ device_printf(sc->as_dev, "%s: %s operation block %ju length "
+ "%ju failed; asr 0x%08x (rr1: 0x%04x)\n",
+ __func__, bp->bio_cmd == BIO_READ ? "BIO_READ" :
+ (bp->bio_cmd == BIO_WRITE ? "write" : "unknown"),
+ bp->bio_pblkno, bp->bio_bcount, asr, rr1);
biofinish(bp, NULL, EIO);
return;
}
-#if 0
/*
- * XXXRW: We would like to use RR1 to check on the status of the last
- * command handled by the unit. Unfortunately, the documentation on
- * its use is inconsistent, so we don't do that yet.
+ * Successful I/O completion path.
*/
- rr1 = altera_sdcard_read_rr1(sc);
-#endif
-
switch (bp->bio_cmd) {
case BIO_READ:
altera_sdcard_read_rxtx_buffer(sc, bp->bio_data,
More information about the p4-projects
mailing list