aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/kernel/setup.c
diff options
context:
space:
mode:
authorRussell King <rmk@dyn-67.arm.linux.org.uk>2008-09-25 09:45:02 -0400
committerRussell King <rmk+kernel@arm.linux.org.uk>2008-09-25 09:45:02 -0400
commit90f1e084783be9bbff4861fa8e460b76de2787f4 (patch)
treec7b9b40020c9fd884a63ccb9747f9c473bf8eb14 /arch/arm/kernel/setup.c
parent1562f98f918f2de7549edbaaabdb8bece52320f0 (diff)
[ARM] Remove cache type printks
The cache type register found in ARMv5 and later CPUs changes format and meaning depending on the CPU architecture version. Currently, this code: a) doesn't work for everything - Xscale's are identified as 'unknown 5'. b) is not able to tell whether the caches are VIVT or VIPT from the cache type. c) prints rubbish on some ARMv6 and ARMv7+ CPUs. The two solutions to this are: 1. Add yet more code to decode and print the various different register formats. 2. Remove the code altogther. The code only exists to decode and print the cache parameters. Increasing the complexity of it just for the sake of a few prinks isn't worth it. Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'arch/arm/kernel/setup.c')
-rw-r--r--arch/arm/kernel/setup.c142
1 files changed, 1 insertions, 141 deletions
diff --git a/arch/arm/kernel/setup.c b/arch/arm/kernel/setup.c
index 61a2242b18b8..1939c904dae3 100644
--- a/arch/arm/kernel/setup.c
+++ b/arch/arm/kernel/setup.c
@@ -176,63 +176,6 @@ static struct resource io_res[] = {
176#define lp1 io_res[1] 176#define lp1 io_res[1]
177#define lp2 io_res[2] 177#define lp2 io_res[2]
178 178
179static const char *cache_types[16] = {
180 "write-through",
181 "write-back",
182 "write-back",
183 "undefined 3",
184 "undefined 4",
185 "undefined 5",
186 "write-back",
187 "write-back",
188 "undefined 8",
189 "undefined 9",
190 "undefined 10",
191 "undefined 11",
192 "undefined 12",
193 "undefined 13",
194 "write-back",
195 "undefined 15",
196};
197
198static const char *cache_clean[16] = {
199 "not required",
200 "read-block",
201 "cp15 c7 ops",
202 "undefined 3",
203 "undefined 4",
204 "undefined 5",
205 "cp15 c7 ops",
206 "cp15 c7 ops",
207 "undefined 8",
208 "undefined 9",
209 "undefined 10",
210 "undefined 11",
211 "undefined 12",
212 "undefined 13",
213 "cp15 c7 ops",
214 "undefined 15",
215};
216
217static const char *cache_lockdown[16] = {
218 "not supported",
219 "not supported",
220 "not supported",
221 "undefined 3",
222 "undefined 4",
223 "undefined 5",
224 "format A",
225 "format B",
226 "undefined 8",
227 "undefined 9",
228 "undefined 10",
229 "undefined 11",
230 "undefined 12",
231 "undefined 13",
232 "format C",
233 "undefined 15",
234};
235
236static const char *proc_arch[] = { 179static const char *proc_arch[] = {
237 "undefined/unknown", 180 "undefined/unknown",
238 "3", 181 "3",
@@ -253,48 +196,6 @@ static const char *proc_arch[] = {
253 "?(17)", 196 "?(17)",
254}; 197};
255 198
256#define CACHE_TYPE(x) (((x) >> 25) & 15)
257#define CACHE_S(x) ((x) & (1 << 24))
258#define CACHE_DSIZE(x) (((x) >> 12) & 4095) /* only if S=1 */
259#define CACHE_ISIZE(x) ((x) & 4095)
260
261#define CACHE_SIZE(y) (((y) >> 6) & 7)
262#define CACHE_ASSOC(y) (((y) >> 3) & 7)
263#define CACHE_M(y) ((y) & (1 << 2))
264#define CACHE_LINE(y) ((y) & 3)
265
266static inline void dump_cache(const char *prefix, int cpu, unsigned int cache)
267{
268 unsigned int mult = 2 + (CACHE_M(cache) ? 1 : 0);
269
270 printk("CPU%u: %s: %d bytes, associativity %d, %d byte lines, %d sets\n",
271 cpu, prefix,
272 mult << (8 + CACHE_SIZE(cache)),
273 (mult << CACHE_ASSOC(cache)) >> 1,
274 8 << CACHE_LINE(cache),
275 1 << (6 + CACHE_SIZE(cache) - CACHE_ASSOC(cache) -
276 CACHE_LINE(cache)));
277}
278
279static void __init dump_cpu_info(int cpu)
280{
281 unsigned int info = read_cpuid_cachetype();
282
283 if (info != read_cpuid_id()) {
284 printk("CPU%u: D %s %s cache\n", cpu, cache_is_vivt() ? "VIVT" : "VIPT",
285 cache_types[CACHE_TYPE(info)]);
286 if (CACHE_S(info)) {
287 dump_cache("I cache", cpu, CACHE_ISIZE(info));
288 dump_cache("D cache", cpu, CACHE_DSIZE(info));
289 } else {
290 dump_cache("cache", cpu, CACHE_ISIZE(info));
291 }
292 }
293
294 if (arch_is_coherent())
295 printk("Cache coherency enabled\n");
296}
297
298int cpu_architecture(void) 199int cpu_architecture(void)
299{ 200{
300 int cpu_arch; 201 int cpu_arch;
@@ -383,8 +284,7 @@ static void __init setup_processor(void)
383/* 284/*
384 * cpu_init - initialise one CPU. 285 * cpu_init - initialise one CPU.
385 * 286 *
386 * cpu_init dumps the cache information, initialises SMP specific 287 * cpu_init sets up the per-CPU stacks.
387 * information, and sets up the per-CPU stacks.
388 */ 288 */
389void cpu_init(void) 289void cpu_init(void)
390{ 290{
@@ -396,9 +296,6 @@ void cpu_init(void)
396 BUG(); 296 BUG();
397 } 297 }
398 298
399 if (system_state == SYSTEM_BOOTING)
400 dump_cpu_info(cpu);
401
402 /* 299 /*
403 * setup stacks for re-entrant exception handlers 300 * setup stacks for re-entrant exception handlers
404 */ 301 */
@@ -865,22 +762,6 @@ static const char *hwcap_str[] = {
865 NULL 762 NULL
866}; 763};
867 764
868static void
869c_show_cache(struct seq_file *m, const char *type, unsigned int cache)
870{
871 unsigned int mult = 2 + (CACHE_M(cache) ? 1 : 0);
872
873 seq_printf(m, "%s size\t\t: %d\n"
874 "%s assoc\t\t: %d\n"
875 "%s line length\t: %d\n"
876 "%s sets\t\t: %d\n",
877 type, mult << (8 + CACHE_SIZE(cache)),
878 type, (mult << CACHE_ASSOC(cache)) >> 1,
879 type, 8 << CACHE_LINE(cache),
880 type, 1 << (6 + CACHE_SIZE(cache) - CACHE_ASSOC(cache) -
881 CACHE_LINE(cache)));
882}
883
884static int c_show(struct seq_file *m, void *v) 765static int c_show(struct seq_file *m, void *v)
885{ 766{
886 int i; 767 int i;
@@ -934,27 +815,6 @@ static int c_show(struct seq_file *m, void *v)
934 } 815 }
935 seq_printf(m, "CPU revision\t: %d\n", read_cpuid_id() & 15); 816 seq_printf(m, "CPU revision\t: %d\n", read_cpuid_id() & 15);
936 817
937 {
938 unsigned int cache_info = read_cpuid_cachetype();
939 if (cache_info != read_cpuid_id()) {
940 seq_printf(m, "Cache type\t: %s\n"
941 "Cache clean\t: %s\n"
942 "Cache lockdown\t: %s\n"
943 "Cache format\t: %s\n",
944 cache_types[CACHE_TYPE(cache_info)],
945 cache_clean[CACHE_TYPE(cache_info)],
946 cache_lockdown[CACHE_TYPE(cache_info)],
947 CACHE_S(cache_info) ? "Harvard" : "Unified");
948
949 if (CACHE_S(cache_info)) {
950 c_show_cache(m, "I", CACHE_ISIZE(cache_info));
951 c_show_cache(m, "D", CACHE_DSIZE(cache_info));
952 } else {
953 c_show_cache(m, "Cache", CACHE_ISIZE(cache_info));
954 }
955 }
956 }
957
958 seq_puts(m, "\n"); 818 seq_puts(m, "\n");
959 819
960 seq_printf(m, "Hardware\t: %s\n", machine_name); 820 seq_printf(m, "Hardware\t: %s\n", machine_name);