Date: Thu, 23 Aug 2012 04:35:55 +0000 (UTC) From: Warner Losh <imp@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r239607 - head/sys/dev/mmc Message-ID: <201208230435.q7N4Ztvq057107@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
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);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201208230435.q7N4Ztvq057107>