From owner-p4-projects@FreeBSD.ORG Fri Apr 6 18:15:07 2012 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 012CD1065670; Fri, 6 Apr 2012 18:15:07 +0000 (UTC) Delivered-To: perforce@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B8162106564A for ; Fri, 6 Apr 2012 18:15:06 +0000 (UTC) (envelope-from bb+lists.freebsd.perforce@cyrus.watson.org) Received: from skunkworks.freebsd.org (skunkworks.freebsd.org [IPv6:2001:4f8:fff6::2d]) by mx1.freebsd.org (Postfix) with ESMTP id 7F4658FC08 for ; Fri, 6 Apr 2012 18:15:06 +0000 (UTC) Received: from skunkworks.freebsd.org (localhost [127.0.0.1]) by skunkworks.freebsd.org (8.14.4/8.14.4) with ESMTP id q36IF6I8000326 for ; Fri, 6 Apr 2012 18:15:06 GMT (envelope-from bb+lists.freebsd.perforce@cyrus.watson.org) Received: (from perforce@localhost) by skunkworks.freebsd.org (8.14.4/8.14.4/Submit) id q36IF6Ij000323 for perforce@freebsd.org; Fri, 6 Apr 2012 18:15:06 GMT (envelope-from bb+lists.freebsd.perforce@cyrus.watson.org) Date: Fri, 6 Apr 2012 18:15:06 GMT Message-Id: <201204061815.q36IF6Ij000323@skunkworks.freebsd.org> X-Authentication-Warning: skunkworks.freebsd.org: perforce set sender to bb+lists.freebsd.perforce@cyrus.watson.org using -f From: Robert Watson To: Perforce Change Reviews Precedence: bulk Cc: Subject: PERFORCE change 209161 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 Apr 2012 18:15:07 -0000 http://p4web.freebsd.org/@@209161?ac=10 Change 209161 by rwatson@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,