提交 30cbb0c0 编写于 作者: S Stephen Boyd 提交者: Kumar Gala

ARM: qcom: scm: Get cacheline size from CTR

Instead of hardcoding the cacheline size as 32, get the cacheline size from
the CTR register.
Signed-off-by: NStephen Boyd <sboyd@codeaurora.org>
Signed-off-by: NKumar Gala <galak@codeaurora.org>
上级 f76c6916
...@@ -27,9 +27,6 @@ ...@@ -27,9 +27,6 @@
#include "scm.h" #include "scm.h"
/* Cache line size for msm8x60 */
#define CACHELINESIZE 32
#define SCM_ENOMEM -5 #define SCM_ENOMEM -5
#define SCM_EOPNOTSUPP -4 #define SCM_EOPNOTSUPP -4
#define SCM_EINVAL_ADDR -3 #define SCM_EINVAL_ADDR -3
...@@ -214,13 +211,18 @@ static int __scm_call(const struct scm_command *cmd) ...@@ -214,13 +211,18 @@ static int __scm_call(const struct scm_command *cmd)
static void scm_inv_range(unsigned long start, unsigned long end) static void scm_inv_range(unsigned long start, unsigned long end)
{ {
start = round_down(start, CACHELINESIZE); u32 cacheline_size, ctr;
end = round_up(end, CACHELINESIZE);
asm volatile("mrc p15, 0, %0, c0, c0, 1" : "=r" (ctr));
cacheline_size = 4 << ((ctr >> 16) & 0xf);
start = round_down(start, cacheline_size);
end = round_up(end, cacheline_size);
outer_inv_range(start, end); outer_inv_range(start, end);
while (start < end) { while (start < end) {
asm ("mcr p15, 0, %0, c7, c6, 1" : : "r" (start) asm ("mcr p15, 0, %0, c7, c6, 1" : : "r" (start)
: "memory"); : "memory");
start += CACHELINESIZE; start += cacheline_size;
} }
dsb(); dsb();
isb(); isb();
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册