diff options
author | Warner Losh <imp@FreeBSD.org> | 2012-08-23 04:35:55 +0000 |
---|---|---|
committer | Warner Losh <imp@FreeBSD.org> | 2012-08-23 04:35:55 +0000 |
commit | bb1ef63f081082bc11fd2fcc7c60032f50f5e705 (patch) | |
tree | 7a45c86f5b8ab098ce188af9a2b5bfb52b82199f /sys/dev/mmc/mmcsd.c | |
parent | 38c0190699f0e0e7df6847ebe29654dbe1f00096 (diff) | |
download | src-bb1ef63f081082bc11fd2fcc7c60032f50f5e705.tar.gz src-bb1ef63f081082bc11fd2fcc7c60032f50f5e705.zip |
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.
Notes
Notes:
svn path=/head/; revision=239607
Diffstat (limited to 'sys/dev/mmc/mmcsd.c')
-rw-r--r-- | sys/dev/mmc/mmcsd.c | 31 |
1 files changed, 24 insertions, 7 deletions
diff --git a/sys/dev/mmc/mmcsd.c b/sys/dev/mmc/mmcsd.c index cdba4a9a56a0..52b23e443ce0 100644 --- a/sys/dev/mmc/mmcsd.c +++ b/sys/dev/mmc/mmcsd.c @@ -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 bio *bp) 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); |