[PATCH 3/9] bsps/cache: Fix ARM CP-15 get cache size
Sebastian Huber
sebastian.huber at embedded-brains.de
Tue Apr 23 19:15:49 UTC 2024
The rtems_cache_get_data_cache_size() and
rtems_cache_get_instruction_cache_size() functions shall return the entire
cache size for a level of 0. Levels greater than 0 shall return the size of
the associated level.
Update #4982.
---
bsps/arm/shared/cache/cache-cp15.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/bsps/arm/shared/cache/cache-cp15.c b/bsps/arm/shared/cache/cache-cp15.c
index 92ccfcb276..8e0f22282b 100644
--- a/bsps/arm/shared/cache/cache-cp15.c
+++ b/bsps/arm/shared/cache/cache-cp15.c
@@ -222,12 +222,12 @@ static inline size_t arm_cp15_get_cache_size(
clidr = arm_cp15_get_cache_level_id();
loc = arm_clidr_get_level_of_coherency(clidr);
- if (level >= loc) {
- return 0;
- }
-
if (level == 0) {
level = loc - 1;
+ } else if (level - 1 >= loc) {
+ return 0;
+ } else {
+ --level;
}
ccsidr = arm_cp15_get_cache_size_id_for_level(
--
2.35.3
More information about the devel
mailing list