UPSTREAM: Fix reported offset for enhanced user area start address
Block-addressed devices should have address multiplied with sector size.
Clarify with comment how is_blockaddressed() is calculated.
BUG=None
TEST=Compile
Signed-off-by: Tomas Melin <tomas.melin@vaisala.com>
Signed-off-by: Chris Ball <chris@printf.net>
(cherry picked from commit 3c02759595f4c210655769cc76022ebfee4d13f9)
Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
Change-Id: I92ce4dd1147651bfad63500615584f98ea807196
Reviewed-on: https://chromium-review.googlesource.com/1114441
Commit-Ready: Gwendal Grignou <gwendal@chromium.org>
Tested-by: Gwendal Grignou <gwendal@chromium.org>
Reviewed-by: Julius Werner <jwerner@chromium.org>
diff --git a/mmc_cmds.c b/mmc_cmds.c
index 672d15d..5669578 100644
--- a/mmc_cmds.c
+++ b/mmc_cmds.c
@@ -811,6 +811,7 @@
{
unsigned int sectors = get_sector_count(ext_csd);
+ /* over 2GiB devices are block-addressed */
return (sectors > (2u * 1024 * 1024 * 1024) / 512);
}
@@ -1730,7 +1731,7 @@
printf("Enhanced User Data Start Address"
" [ENH_START_ADDR]: 0x%06x\n", regl);
printf(" i.e. %lu bytes offset\n", (is_blockaddresed(ext_csd) ?
- 1l : 512l) * regl);
+ 512l : 1l) * regl);
/* A441]: reserved [135] */
printf("Bad Block Management mode"