Skip to contentSkip to conversation

mmc-utils: Fix scaling of cache size

PATCH In review [email protected] 3 participants 7 messages Feb 13, 2020 – Mar 31, 2021 MMC, SD and SDIO

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mmc-utils: Fix scaling of cache size

From: Patrick Oppenlander <[email protected]>

JESD84-B51 7.4.30 CACHE_SIZE [252:249] states that "the size is indicated as multiple of kilobits". This is also supported by Table 39, "e.MMC internal sizes and related Units / Granularities" which lists "32Kb (=4KB)" as the cache size granularity for 4KiB native devices.

---
 mmc_cmds.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
mmc_cmds.c +2 -2
index fb37189..a1b1d75 100644
@@ -1419,8 +1419,8 @@ int do_read_extcsd(int nargs, char **argv)
 		printf("Power off notification [POWER_OFF_LONG_TIME: 0x%02x]\n",
 			ext_csd[247]);
 		printf("Cache Size [CACHE_SIZE] is %d KiB\n",
-			ext_csd[249] << 0 | (ext_csd[250] << 8) |
-			(ext_csd[251] << 16) | (ext_csd[252] << 24));
+			(ext_csd[249] << 0 | (ext_csd[250] << 8) |
+			(ext_csd[251] << 16) | (ext_csd[252] << 24)) / 8);
 	}
 
 	/* A441: Reserved [501:247]
Signature · 1 line
2.25.0
Reviewed-by on v1 1/1
#1 lore raw
Quoted 8 lines

From: Patrick Oppenlander <[email protected]>

JESD84-B51 7.4.30 CACHE_SIZE [252:249] states that "the size is indicated as multiple of kilobits". This is also supported by Table 39, "e.MMC internal sizes and related Units / Granularities" which lists "32Kb (=4KB)" as the cache size granularity for 4KiB native devices.

Quoted 21 lines
---
 mmc_cmds.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
mmc_cmds.c +2 -3
index fb37189..a1b1d75 100644
@@ -1419,8 +1419,8 @@ int do_read_extcsd(int nargs, char **argv)
                printf("Power off notification [POWER_OFF_LONG_TIME: 0x%02x]\n",
                        ext_csd[247]);
                printf("Cache Size [CACHE_SIZE] is %d KiB\n",
-                       ext_csd[249] << 0 | (ext_csd[250] << 8) |
-                       (ext_csd[251] << 16) | (ext_csd[252] << 24));
+                       (ext_csd[249] << 0 | (ext_csd[250] << 8) |
+                       (ext_csd[251] << 16) | (ext_csd[252] << 24)) / 8);
        }
 
        /* A441: Reserved [501:247]
--

2.25.0

#2 lore raw
Quoted 11 lines · Avri Altman
Quoted 9 lines

From: Patrick Oppenlander <[email protected]>

JESD84-B51 7.4.30 CACHE_SIZE [252:249] states that "the size is indicated as multiple of kilobits". This is also supported by Table 39, "e.MMC internal sizes and related Units / Granularities" which lists "32Kb (=4KB)" as the cache size granularity for 4KiB native devices.

Does anything else need to happen to get this applied?

Thanks,

Patrick

#3 lore raw

+ Chris

Quoted 10 lines · Patrick Oppenlander
Quoted 8 lines · Avri Altman
Quoted 8 lines

From: Patrick Oppenlander <[email protected]>

JESD84-B51 7.4.30 CACHE_SIZE [252:249] states that "the size is indicated as multiple of kilobits". This is also supported by Table 39, "e.MMC internal sizes and related Units / Granularities" which lists "32Kb (=4KB)" as the cache size granularity for 4KiB native devices.

Quoted 5 lines
Quoted 3 lines
Quoted 1 line

Does anything else need to happen to get this applied?

Chris Ball maintains mmc-utils. I have added him to the loop, but perhaps you should resend this to make sure he gets the patch.

Kind regards
Uffe

#4 lore raw

PATCH 1/1 mmc-utils: Fix scaling of cache size

From: Patrick Oppenlander <[email protected]>

Resend requested by Uffe.

===8<===

JESD84-B51 7.4.30 CACHE_SIZE [252:249] states that "the size is indicated as multiple of kilobits". This is also supported by Table 39, "e.MMC internal sizes and related Units / Granularities" which lists "32Kb (=4KB)" as the cache size granularity for 4KiB native devices.

---
 mmc_cmds.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
mmc_cmds.c +2 -2
index fb37189..a1b1d75 100644
@@ -1419,8 +1419,8 @@ int do_read_extcsd(int nargs, char **argv)
 		printf("Power off notification [POWER_OFF_LONG_TIME: 0x%02x]\n",
 			ext_csd[247]);
 		printf("Cache Size [CACHE_SIZE] is %d KiB\n",
-			ext_csd[249] << 0 | (ext_csd[250] << 8) |
-			(ext_csd[251] << 16) | (ext_csd[252] << 24));
+			(ext_csd[249] << 0 | (ext_csd[250] << 8) |
+			(ext_csd[251] << 16) | (ext_csd[252] << 24)) / 8);
 	}
 
 	/* A441: Reserved [501:247]
Signature · 1 line
2.26.0
Applied
#6 lore raw
In reply to [email protected]
Quoted 7 lines · On Thu, 2 Apr 2020 at 00:15, <[email protected]> wrote:

From: Patrick Oppenlander <[email protected]>

Resend requested by Uffe.

===8<===

Quoted 7 lines

JESD84-B51 7.4.30 CACHE_SIZE [252:249] states that "the size is indicated as multiple of kilobits". This is also supported by Table 39, "e.MMC internal sizes and related Units / Granularities" which lists "32Kb (=4KB)" as the cache size granularity for 4KiB native devices.

Applied to git.kernel.org/pub/scm/utils/mmc/mmc-utils.git master, thanks!

Kind regards
Uffe

Quoted 22 lines
---
 mmc_cmds.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
mmc_cmds.c +2 -3
index fb37189..a1b1d75 100644
@@ -1419,8 +1419,8 @@ int do_read_extcsd(int nargs, char **argv)
                printf("Power off notification [POWER_OFF_LONG_TIME: 0x%02x]\n",
                        ext_csd[247]);
                printf("Cache Size [CACHE_SIZE] is %d KiB\n",
-                       ext_csd[249] << 0 | (ext_csd[250] << 8) |
-                       (ext_csd[251] << 16) | (ext_csd[252] << 24));
+                       (ext_csd[249] << 0 | (ext_csd[250] << 8) |
+                       (ext_csd[251] << 16) | (ext_csd[252] << 24)) / 8);
        }
 
        /* A441: Reserved [501:247]
--

2.26.0