summaryrefslogtreecommitdiff
path: root/sys/dev/sdmmc/sdmmc.c
diff options
context:
space:
mode:
authorUwe Stuehler <uwe@cvs.openbsd.org>2006-06-01 22:33:38 +0000
committerUwe Stuehler <uwe@cvs.openbsd.org>2006-06-01 22:33:38 +0000
commit53f49de83a616883ff7ef624e0be1700d8f286a5 (patch)
treed71b0dc7c10c753c631b0129eb4ddd9e40ee7cf6 /sys/dev/sdmmc/sdmmc.c
parent9c04b313dfc99670226124c7a36322dd97c76ee2 (diff)
Multiply the capacity for cards with block size >512 bytes (e.g. 2G cards).
Diffstat (limited to 'sys/dev/sdmmc/sdmmc.c')
-rw-r--r--sys/dev/sdmmc/sdmmc.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/sys/dev/sdmmc/sdmmc.c b/sys/dev/sdmmc/sdmmc.c
index 15bb8ca1930..14cfa47908e 100644
--- a/sys/dev/sdmmc/sdmmc.c
+++ b/sys/dev/sdmmc/sdmmc.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sdmmc.c,v 1.3 2006/06/01 21:53:41 uwe Exp $ */
+/* $OpenBSD: sdmmc.c,v 1.4 2006/06/01 22:33:37 uwe Exp $ */
/*
* Copyright (c) 2006 Uwe Stuehler <uwe@openbsd.org>
@@ -487,10 +487,13 @@ sdmmc_decode_csd(struct sdmmc_softc *sc, sdmmc_response resp,
csd->mmcver = MMC_CSD_MMCVER(resp);
csd->capacity = MMC_CSD_CAPACITY(resp);
csd->read_bl_len = MMC_CSD_READ_BL_LEN(resp);
- csd->sector_size = 1 << csd->read_bl_len;
}
csd->sector_size = MIN(1 << csd->read_bl_len,
sdmmc_chip_host_maxblklen(sc->sct, sc->sch));
+ if (csd->sector_size < (1<<csd->read_bl_len))
+ csd->capacity *= (1<<csd->read_bl_len) /
+ csd->sector_size;
+
return 0;
}