From fc794c706b500efbaa355409ed1edb690dde4b91 Mon Sep 17 00:00:00 2001 From: ian Date: Fri, 15 May 2015 18:07:58 +0000 Subject: [PATCH] Retrieve the cache parms in the proper arch-specific way. Submitted by: Michal Meloun --- sys/arm/arm/cpuinfo.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/sys/arm/arm/cpuinfo.c b/sys/arm/arm/cpuinfo.c index 46170033a0e6..d9899065361d 100644 --- a/sys/arm/arm/cpuinfo.c +++ b/sys/arm/arm/cpuinfo.c @@ -131,8 +131,17 @@ cpuinfo_init(void) cpuinfo.security_ext = (cpuinfo.id_pfr1 >> 4) & 0xF; /* L1 Cache sizes */ - cpuinfo.dcache_line_size = 1 << (CPU_CT_DMINLINE(cpuinfo.ctr ) + 2); + if (CPU_CT_FORMAT(cpuinfo.ctr) == CPU_CT_ARMV7) { + cpuinfo.dcache_line_size = + 1 << (CPU_CT_DMINLINE(cpuinfo.ctr) + 2); + cpuinfo.icache_line_size = + 1 << (CPU_CT_IMINLINE(cpuinfo.ctr) + 2); + } else { + cpuinfo.dcache_line_size = + 1 << (CPU_CT_xSIZE_LEN(CPU_CT_DSIZE(cpuinfo.ctr)) + 3); + cpuinfo.icache_line_size = + 1 << (CPU_CT_xSIZE_LEN(CPU_CT_ISIZE(cpuinfo.ctr)) + 3); + } cpuinfo.dcache_line_mask = cpuinfo.dcache_line_size - 1; - cpuinfo.icache_line_size= 1 << (CPU_CT_IMINLINE(cpuinfo.ctr ) + 2); cpuinfo.icache_line_mask = cpuinfo.icache_line_size - 1; }