From owner-svn-src-all@FreeBSD.ORG Thu Aug 23 04:35:56 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 2CDD8106564A; Thu, 23 Aug 2012 04:35:56 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id F30948FC17; Thu, 23 Aug 2012 04:35:55 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q7N4ZtsC057109; Thu, 23 Aug 2012 04:35:55 GMT (envelope-from imp@svn.freebsd.org) Received: (from imp@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q7N4Ztvq057107; Thu, 23 Aug 2012 04:35:55 GMT (envelope-from imp@svn.freebsd.org) Message-Id: <201208230435.q7N4Ztvq057107@svn.freebsd.org> From: Warner Losh Date: Thu, 23 Aug 2012 04:35:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r239607 - head/sys/dev/mmc X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 23 Aug 2012 04:35:56 -0000 Author: imp Date: Thu Aug 23 04:35:55 2012 New Revision: 239607 URL: http://svn.freebsd.org/changeset/base/239607 Log: The check for MAXPHYS doesn't make sense, so remove it. Report errors indicated by the transport. If this is too chatty, I'll throw it behind a debug write. Remove commented out debugs that are no longer useful. Modified: head/sys/dev/mmc/mmcsd.c Modified: head/sys/dev/mmc/mmcsd.c ============================================================================== --- head/sys/dev/mmc/mmcsd.c Thu Aug 23 03:37:01 2012 (r239606) +++ head/sys/dev/mmc/mmcsd.c Thu Aug 23 04:35:55 2012 (r239607) @@ -88,6 +88,17 @@ struct mmcsd_softc { int suspend; }; +static const char *errmsg[] = +{ + "None", + "Timeout", + "Bad CRC", + "Fifo", + "Failed", + "Invalid", + "NO MEMORY" +}; + /* bus entry points */ static int mmcsd_attach(device_t dev); static int mmcsd_detach(device_t dev); @@ -169,13 +180,10 @@ mmcsd_attach(device_t dev) /* * Report the clock speed of the underlying hardware, which might be * different than what the card reports due to hardware limitations. - * Report how many blocks the hardware transfers at once, but clip the - * number to MAXPHYS since the system won't initiate larger transfers. + * Report how many blocks the hardware transfers at once. */ speed = mmcbr_get_clock(device_get_parent(dev)); maxblocks = mmc_get_max_data(dev); - if (maxblocks > MAXPHYS) - maxblocks = MAXPHYS; device_printf(dev, "%ju%cB <%s>%s at %s %d.%01dMHz/%dbit/%d-block\n", mb, unit, mmc_get_card_id_string(dev), mmc_get_read_only(dev) ? " (read-only)" : "", @@ -286,6 +294,14 @@ mmcsd_strategy(struct bio *bp) } } +static const char * +mmcsd_errmsg(int e) +{ + if (e < 0 || e > MMC_ERR_MAX) + return "Bad error code"; + return errmsg[e]; +} + static daddr_t mmcsd_rw(struct mmcsd_softc *sc, struct bio *bp) { @@ -337,12 +353,13 @@ mmcsd_rw(struct mmcsd_softc *sc, struct stop.flags = MMC_RSP_R1B | MMC_CMD_AC; req.stop = &stop; } -// printf("Len %d %lld-%lld flags %#x sz %d\n", -// (int)data.len, (long long)block, (long long)end, data.flags, sz); MMCBUS_WAIT_FOR_REQUEST(device_get_parent(dev), dev, &req); - if (req.cmd->error != MMC_ERR_NONE) + if (req.cmd->error != MMC_ERR_NONE) { + device_printf(dev, "Error indicated: %d %s\n", + req.cmd->error, mmcsd_errmsg(req.cmd->error)); break; + } block += numblocks; } return (block);