Blackfin arch: to do some consolidation of common code and common name spaces
[linux-2.6] / arch / blackfin / kernel / setup.c
1 /*
2  * File:         arch/blackfin/kernel/setup.c
3  * Based on:
4  * Author:
5  *
6  * Created:
7  * Description:
8  *
9  * Modified:
10  *               Copyright 2004-2006 Analog Devices Inc.
11  *
12  * Bugs:         Enter bugs at http://blackfin.uclinux.org/
13  *
14  * This program is free software; you can redistribute it and/or modify
15  * it under the terms of the GNU General Public License as published by
16  * the Free Software Foundation; either version 2 of the License, or
17  * (at your option) any later version.
18  *
19  * This program is distributed in the hope that it will be useful,
20  * but WITHOUT ANY WARRANTY; without even the implied warranty of
21  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
22  * GNU General Public License for more details.
23  *
24  * You should have received a copy of the GNU General Public License
25  * along with this program; if not, see the file COPYING, or write
26  * to the Free Software Foundation, Inc.,
27  * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
28  */
29
30 #include <linux/delay.h>
31 #include <linux/console.h>
32 #include <linux/bootmem.h>
33 #include <linux/seq_file.h>
34 #include <linux/cpu.h>
35 #include <linux/module.h>
36 #include <linux/tty.h>
37
38 #include <linux/ext2_fs.h>
39 #include <linux/cramfs_fs.h>
40 #include <linux/romfs_fs.h>
41
42 #include <asm/cplb.h>
43 #include <asm/cacheflush.h>
44 #include <asm/blackfin.h>
45 #include <asm/cplbinit.h>
46 #include <asm/fixed_code.h>
47
48 u16 _bfin_swrst;
49
50 unsigned long memory_start, memory_end, physical_mem_end;
51 unsigned long reserved_mem_dcache_on;
52 unsigned long reserved_mem_icache_on;
53 EXPORT_SYMBOL(memory_start);
54 EXPORT_SYMBOL(memory_end);
55 EXPORT_SYMBOL(physical_mem_end);
56 EXPORT_SYMBOL(_ramend);
57
58 #ifdef CONFIG_MTD_UCLINUX
59 unsigned long memory_mtd_end, memory_mtd_start, mtd_size;
60 unsigned long _ebss;
61 EXPORT_SYMBOL(memory_mtd_end);
62 EXPORT_SYMBOL(memory_mtd_start);
63 EXPORT_SYMBOL(mtd_size);
64 #endif
65
66 char __initdata command_line[COMMAND_LINE_SIZE];
67
68 void __init bf53x_cache_init(void)
69 {
70 #if defined(CONFIG_BFIN_DCACHE) || defined(CONFIG_BFIN_ICACHE)
71         generate_cpl_tables();
72 #endif
73
74 #ifdef CONFIG_BFIN_ICACHE
75         bfin_icache_init();
76         printk(KERN_INFO "Instruction Cache Enabled\n");
77 #endif
78
79 #ifdef CONFIG_BFIN_DCACHE
80         bfin_dcache_init();
81         printk(KERN_INFO "Data Cache Enabled"
82 # if defined CONFIG_BFIN_WB
83                 " (write-back)"
84 # elif defined CONFIG_BFIN_WT
85                 " (write-through)"
86 # endif
87                 "\n");
88 #endif
89 }
90
91 void __init bf53x_relocate_l1_mem(void)
92 {
93         unsigned long l1_code_length;
94         unsigned long l1_data_a_length;
95         unsigned long l1_data_b_length;
96
97         l1_code_length = _etext_l1 - _stext_l1;
98         if (l1_code_length > L1_CODE_LENGTH)
99                 l1_code_length = L1_CODE_LENGTH;
100         /* cannot complain as printk is not available as yet.
101          * But we can continue booting and complain later!
102          */
103
104         /* Copy _stext_l1 to _etext_l1 to L1 instruction SRAM */
105         dma_memcpy(_stext_l1, _l1_lma_start, l1_code_length);
106
107         l1_data_a_length = _ebss_l1 - _sdata_l1;
108         if (l1_data_a_length > L1_DATA_A_LENGTH)
109                 l1_data_a_length = L1_DATA_A_LENGTH;
110
111         /* Copy _sdata_l1 to _ebss_l1 to L1 data bank A SRAM */
112         dma_memcpy(_sdata_l1, _l1_lma_start + l1_code_length, l1_data_a_length);
113
114         l1_data_b_length = _ebss_b_l1 - _sdata_b_l1;
115         if (l1_data_b_length > L1_DATA_B_LENGTH)
116                 l1_data_b_length = L1_DATA_B_LENGTH;
117
118         /* Copy _sdata_b_l1 to _ebss_b_l1 to L1 data bank B SRAM */
119         dma_memcpy(_sdata_b_l1, _l1_lma_start + l1_code_length +
120                         l1_data_a_length, l1_data_b_length);
121
122 }
123
124 /*
125  * Initial parsing of the command line.  Currently, we support:
126  *  - Controlling the linux memory size: mem=xxx[KMG]
127  *  - Controlling the physical memory size: max_mem=xxx[KMG][$][#]
128  *       $ -> reserved memory is dcacheable
129  *       # -> reserved memory is icacheable
130  */
131 static __init void parse_cmdline_early(char *cmdline_p)
132 {
133         char c = ' ', *to = cmdline_p;
134         unsigned int memsize;
135         for (;;) {
136                 if (c == ' ') {
137
138                         if (!memcmp(to, "mem=", 4)) {
139                                 to += 4;
140                                 memsize = memparse(to, &to);
141                                 if (memsize)
142                                         _ramend = memsize;
143
144                         } else if (!memcmp(to, "max_mem=", 8)) {
145                                 to += 8;
146                                 memsize = memparse(to, &to);
147                                 if (memsize) {
148                                         physical_mem_end = memsize;
149                                         if (*to != ' ') {
150                                                 if (*to == '$'
151                                                     || *(to + 1) == '$')
152                                                         reserved_mem_dcache_on =
153                                                             1;
154                                                 if (*to == '#'
155                                                     || *(to + 1) == '#')
156                                                         reserved_mem_icache_on =
157                                                             1;
158                                         }
159                                 }
160                         }
161
162                 }
163                 c = *(to++);
164                 if (!c)
165                         break;
166         }
167 }
168
169 void __init setup_arch(char **cmdline_p)
170 {
171         int bootmap_size;
172         unsigned long l1_length, sclk, cclk;
173 #ifdef CONFIG_MTD_UCLINUX
174         unsigned long mtd_phys = 0;
175 #endif
176
177 #ifdef CONFIG_DUMMY_CONSOLE
178         conswitchp = &dummy_con;
179 #endif
180         cclk = get_cclk();
181         sclk = get_sclk();
182
183 #if !defined(CONFIG_BFIN_KERNEL_CLOCK)
184         if (ANOMALY_05000273 && cclk == sclk)
185                 panic("ANOMALY 05000273, SCLK can not be same as CCLK");
186 #endif
187
188 #ifdef BF561_FAMILY
189         if (ANOMALY_05000266) {
190                 bfin_read_IMDMA_D0_IRQ_STATUS();
191                 bfin_read_IMDMA_D1_IRQ_STATUS();
192         }
193 #endif
194
195 #ifdef DEBUG_SERIAL_EARLY_INIT
196         bfin_console_init();    /* early console registration */
197         /* this give a chance to get printk() working before crash. */
198 #endif
199
200         printk(KERN_INFO "Hardware Trace ");
201         if (bfin_read_TBUFCTL() & 0x1 )
202                 printk("Active ");
203         else
204                 printk("Off ");
205         if (bfin_read_TBUFCTL() & 0x2)
206                 printk("and Enabled\n");
207         else
208         printk("and Disabled\n");
209
210
211 #if defined(CONFIG_CHR_DEV_FLASH) || defined(CONFIG_BLK_DEV_FLASH)
212         /* we need to initialize the Flashrom device here since we might
213          * do things with flash early on in the boot
214          */
215         flash_probe();
216 #endif
217
218 #if defined(CONFIG_CMDLINE_BOOL)
219         strncpy(&command_line[0], CONFIG_CMDLINE, sizeof(command_line));
220         command_line[sizeof(command_line) - 1] = 0;
221 #endif
222
223         /* Keep a copy of command line */
224         *cmdline_p = &command_line[0];
225         memcpy(boot_command_line, command_line, COMMAND_LINE_SIZE);
226         boot_command_line[COMMAND_LINE_SIZE - 1] = '\0';
227
228         /* setup memory defaults from the user config */
229         physical_mem_end = 0;
230         _ramend = CONFIG_MEM_SIZE * 1024 * 1024;
231
232         parse_cmdline_early(&command_line[0]);
233
234         if (physical_mem_end == 0)
235                 physical_mem_end = _ramend;
236
237         /* by now the stack is part of the init task */
238         memory_end = _ramend - DMA_UNCACHED_REGION;
239
240         _ramstart = (unsigned long)__bss_stop;
241         memory_start = PAGE_ALIGN(_ramstart);
242
243 #if defined(CONFIG_MTD_UCLINUX)
244         /* generic memory mapped MTD driver */
245         memory_mtd_end = memory_end;
246
247         mtd_phys = _ramstart;
248         mtd_size = PAGE_ALIGN(*((unsigned long *)(mtd_phys + 8)));
249
250 # if defined(CONFIG_EXT2_FS) || defined(CONFIG_EXT3_FS)
251         if (*((unsigned short *)(mtd_phys + 0x438)) == EXT2_SUPER_MAGIC)
252                 mtd_size =
253                     PAGE_ALIGN(*((unsigned long *)(mtd_phys + 0x404)) << 10);
254 # endif
255
256 # if defined(CONFIG_CRAMFS)
257         if (*((unsigned long *)(mtd_phys)) == CRAMFS_MAGIC)
258                 mtd_size = PAGE_ALIGN(*((unsigned long *)(mtd_phys + 0x4)));
259 # endif
260
261 # if defined(CONFIG_ROMFS_FS)
262         if (((unsigned long *)mtd_phys)[0] == ROMSB_WORD0
263             && ((unsigned long *)mtd_phys)[1] == ROMSB_WORD1)
264                 mtd_size =
265                     PAGE_ALIGN(be32_to_cpu(((unsigned long *)mtd_phys)[2]));
266 #  if (defined(CONFIG_BFIN_ICACHE) && ANOMALY_05000263)
267         /* Due to a Hardware Anomaly we need to limit the size of usable
268          * instruction memory to max 60MB, 56 if HUNT_FOR_ZERO is on
269          * 05000263 - Hardware loop corrupted when taking an ICPLB exception
270          */
271 #   if (defined(CONFIG_DEBUG_HUNT_FOR_ZERO))
272         if (memory_end >= 56 * 1024 * 1024)
273                 memory_end = 56 * 1024 * 1024;
274 #   else
275         if (memory_end >= 60 * 1024 * 1024)
276                 memory_end = 60 * 1024 * 1024;
277 #   endif                               /* CONFIG_DEBUG_HUNT_FOR_ZERO */
278 #  endif                                /* ANOMALY_05000263 */
279 # endif                         /* CONFIG_ROMFS_FS */
280
281         memory_end -= mtd_size;
282
283         if (mtd_size == 0) {
284                 console_init();
285                 panic("Don't boot kernel without rootfs attached.\n");
286         }
287
288         /* Relocate MTD image to the top of memory after the uncached memory area */
289         dma_memcpy((char *)memory_end, __bss_stop, mtd_size);
290
291         memory_mtd_start = memory_end;
292         _ebss = memory_mtd_start;       /* define _ebss for compatible */
293 #endif                          /* CONFIG_MTD_UCLINUX */
294
295 #if (defined(CONFIG_BFIN_ICACHE) && ANOMALY_05000263)
296         /* Due to a Hardware Anomaly we need to limit the size of usable
297          * instruction memory to max 60MB, 56 if HUNT_FOR_ZERO is on
298          * 05000263 - Hardware loop corrupted when taking an ICPLB exception
299          */
300 #if (defined(CONFIG_DEBUG_HUNT_FOR_ZERO))
301         if (memory_end >= 56 * 1024 * 1024)
302                 memory_end = 56 * 1024 * 1024;
303 #else
304         if (memory_end >= 60 * 1024 * 1024)
305                 memory_end = 60 * 1024 * 1024;
306 #endif                          /* CONFIG_DEBUG_HUNT_FOR_ZERO */
307         printk(KERN_NOTICE "Warning: limiting memory to %liMB due to hardware anomaly 05000263\n", memory_end >> 20);
308 #endif                          /* ANOMALY_05000263 */
309
310 #if !defined(CONFIG_MTD_UCLINUX)
311         memory_end -= SIZE_4K; /*In case there is no valid CPLB behind memory_end make sure we don't get to close*/
312 #endif
313         init_mm.start_code = (unsigned long)_stext;
314         init_mm.end_code = (unsigned long)_etext;
315         init_mm.end_data = (unsigned long)_edata;
316         init_mm.brk = (unsigned long)0;
317
318         init_leds();
319
320         printk(KERN_INFO "Blackfin support (C) 2004-2007 Analog Devices, Inc.\n");
321         if (bfin_compiled_revid() == 0xffff)
322                 printk(KERN_INFO "Compiled for ADSP-%s Rev any\n", CPU);
323         else if (bfin_compiled_revid() == -1)
324                 printk(KERN_INFO "Compiled for ADSP-%s Rev none\n", CPU);
325         else
326                 printk(KERN_INFO "Compiled for ADSP-%s Rev 0.%d\n", CPU, bfin_compiled_revid());
327         if (bfin_revid() != bfin_compiled_revid()) {
328                 if (bfin_compiled_revid() == -1)
329                         printk(KERN_ERR "Warning: Compiled for Rev none, but running on Rev %d\n",
330                                bfin_revid());
331                 else if (bfin_compiled_revid() != 0xffff)
332                         printk(KERN_ERR "Warning: Compiled for Rev %d, but running on Rev %d\n",
333                                bfin_compiled_revid(), bfin_revid());
334         }
335         if (bfin_revid() < SUPPORTED_REVID)
336                 printk(KERN_ERR "Warning: Unsupported Chip Revision ADSP-%s Rev 0.%d detected\n",
337                        CPU, bfin_revid());
338         printk(KERN_INFO "Blackfin Linux support by http://blackfin.uclinux.org/\n");
339
340         printk(KERN_INFO "Processor Speed: %lu MHz core clock and %lu Mhz System Clock\n",
341                cclk / 1000000,  sclk / 1000000);
342
343         if (ANOMALY_05000273 && (cclk >> 1) <= sclk)
344                 printk("\n\n\nANOMALY_05000273: CCLK must be >= 2*SCLK !!!\n\n\n");
345
346         printk(KERN_INFO "Board Memory: %ldMB\n", physical_mem_end >> 20);
347         printk(KERN_INFO "Kernel Managed Memory: %ldMB\n", _ramend >> 20);
348
349         printk(KERN_INFO "Memory map:\n"
350                KERN_INFO "  text      = 0x%p-0x%p\n"
351                KERN_INFO "  rodata    = 0x%p-0x%p\n"
352                KERN_INFO "  data      = 0x%p-0x%p\n"
353                KERN_INFO "    stack   = 0x%p-0x%p\n"
354                KERN_INFO "  init      = 0x%p-0x%p\n"
355                KERN_INFO "  bss       = 0x%p-0x%p\n"
356                KERN_INFO "  available = 0x%p-0x%p\n"
357 #ifdef CONFIG_MTD_UCLINUX
358                KERN_INFO "  rootfs    = 0x%p-0x%p\n"
359 #endif
360 #if DMA_UNCACHED_REGION > 0
361                KERN_INFO "  DMA Zone  = 0x%p-0x%p\n"
362 #endif
363                , _stext, _etext,
364                __start_rodata, __end_rodata,
365                _sdata, _edata,
366                (void *)&init_thread_union, (void *)((int)(&init_thread_union) + 0x2000),
367                __init_begin, __init_end,
368                __bss_start, __bss_stop,
369                (void *)_ramstart, (void *)memory_end
370 #ifdef CONFIG_MTD_UCLINUX
371                , (void *)memory_mtd_start, (void *)(memory_mtd_start + mtd_size)
372 #endif
373 #if DMA_UNCACHED_REGION > 0
374                , (void *)(_ramend - DMA_UNCACHED_REGION), (void *)(_ramend)
375 #endif
376                );
377
378         /*
379          * give all the memory to the bootmap allocator,  tell it to put the
380          * boot mem_map at the start of memory
381          */
382         bootmap_size = init_bootmem_node(NODE_DATA(0), memory_start >> PAGE_SHIFT,      /* map goes here */
383                                          PAGE_OFFSET >> PAGE_SHIFT,
384                                          memory_end >> PAGE_SHIFT);
385         /*
386          * free the usable memory,  we have to make sure we do not free
387          * the bootmem bitmap so we then reserve it after freeing it :-)
388          */
389         free_bootmem(memory_start, memory_end - memory_start);
390
391         reserve_bootmem(memory_start, bootmap_size);
392         /*
393          * get kmalloc into gear
394          */
395         paging_init();
396
397         /* check the size of the l1 area */
398         l1_length = _etext_l1 - _stext_l1;
399         if (l1_length > L1_CODE_LENGTH)
400                 panic("L1 code memory overflow\n");
401
402         l1_length = _ebss_l1 - _sdata_l1;
403         if (l1_length > L1_DATA_A_LENGTH)
404                 panic("L1 data memory overflow\n");
405
406         _bfin_swrst = bfin_read_SWRST();
407
408         /* Copy atomic sequences to their fixed location, and sanity check that
409            these locations are the ones that we advertise to userspace.  */
410         memcpy((void *)FIXED_CODE_START, &fixed_code_start,
411                FIXED_CODE_END - FIXED_CODE_START);
412         BUG_ON((char *)&sigreturn_stub - (char *)&fixed_code_start
413                != SIGRETURN_STUB - FIXED_CODE_START);
414         BUG_ON((char *)&atomic_xchg32 - (char *)&fixed_code_start
415                != ATOMIC_XCHG32 - FIXED_CODE_START);
416         BUG_ON((char *)&atomic_cas32 - (char *)&fixed_code_start
417                != ATOMIC_CAS32 - FIXED_CODE_START);
418         BUG_ON((char *)&atomic_add32 - (char *)&fixed_code_start
419                != ATOMIC_ADD32 - FIXED_CODE_START);
420         BUG_ON((char *)&atomic_sub32 - (char *)&fixed_code_start
421                != ATOMIC_SUB32 - FIXED_CODE_START);
422         BUG_ON((char *)&atomic_ior32 - (char *)&fixed_code_start
423                != ATOMIC_IOR32 - FIXED_CODE_START);
424         BUG_ON((char *)&atomic_and32 - (char *)&fixed_code_start
425                != ATOMIC_AND32 - FIXED_CODE_START);
426         BUG_ON((char *)&atomic_xor32 - (char *)&fixed_code_start
427                != ATOMIC_XOR32 - FIXED_CODE_START);
428
429         init_exception_vectors();
430         bf53x_cache_init();
431 }
432
433 static int __init topology_init(void)
434 {
435 #if defined (CONFIG_BF561)
436         static struct cpu cpu[2];
437         register_cpu(&cpu[0], 0);
438         register_cpu(&cpu[1], 1);
439         return 0;
440 #else
441         static struct cpu cpu[1];
442         return register_cpu(cpu, 0);
443 #endif
444 }
445
446 subsys_initcall(topology_init);
447
448 static u_long get_vco(void)
449 {
450         u_long msel;
451         u_long vco;
452
453         msel = (bfin_read_PLL_CTL() >> 9) & 0x3F;
454         if (0 == msel)
455                 msel = 64;
456
457         vco = CONFIG_CLKIN_HZ;
458         vco >>= (1 & bfin_read_PLL_CTL());      /* DF bit */
459         vco = msel * vco;
460         return vco;
461 }
462
463 /*Get the Core clock*/
464 u_long get_cclk(void)
465 {
466         u_long csel, ssel;
467         if (bfin_read_PLL_STAT() & 0x1)
468                 return CONFIG_CLKIN_HZ;
469
470         ssel = bfin_read_PLL_DIV();
471         csel = ((ssel >> 4) & 0x03);
472         ssel &= 0xf;
473         if (ssel && ssel < (1 << csel)) /* SCLK > CCLK */
474                 return get_vco() / ssel;
475         return get_vco() >> csel;
476 }
477 EXPORT_SYMBOL(get_cclk);
478
479 /* Get the System clock */
480 u_long get_sclk(void)
481 {
482         u_long ssel;
483
484         if (bfin_read_PLL_STAT() & 0x1)
485                 return CONFIG_CLKIN_HZ;
486
487         ssel = (bfin_read_PLL_DIV() & 0xf);
488         if (0 == ssel) {
489                 printk(KERN_WARNING "Invalid System Clock\n");
490                 ssel = 1;
491         }
492
493         return get_vco() / ssel;
494 }
495 EXPORT_SYMBOL(get_sclk);
496
497 /*
498  *      Get CPU information for use by the procfs.
499  */
500 static int show_cpuinfo(struct seq_file *m, void *v)
501 {
502         char *cpu, *mmu, *fpu, *name;
503         uint32_t revid;
504
505         u_long cclk = 0, sclk = 0;
506         u_int dcache_size = 0, dsup_banks = 0;
507
508         cpu = CPU;
509         mmu = "none";
510         fpu = "none";
511         revid = bfin_revid();
512         name = bfin_board_name;
513
514         cclk = get_cclk();
515         sclk = get_sclk();
516
517         seq_printf(m, "CPU:\t\tADSP-%s Rev. 0.%d\n"
518                    "MMU:\t\t%s\n"
519                    "FPU:\t\t%s\n"
520                    "Core Clock:\t%9lu Hz\n"
521                    "System Clock:\t%9lu Hz\n"
522                    "BogoMips:\t%lu.%02lu\n"
523                    "Calibration:\t%lu loops\n",
524                    cpu, revid, mmu, fpu,
525                    cclk,
526                    sclk,
527                    (loops_per_jiffy * HZ) / 500000,
528                    ((loops_per_jiffy * HZ) / 5000) % 100,
529                    (loops_per_jiffy * HZ));
530         seq_printf(m, "Board Name:\t%s\n", name);
531         seq_printf(m, "Board Memory:\t%ld MB\n", physical_mem_end >> 20);
532         seq_printf(m, "Kernel Memory:\t%ld MB\n", (unsigned long)_ramend >> 20);
533         if (bfin_read_IMEM_CONTROL() & (ENICPLB | IMC))
534                 seq_printf(m, "I-CACHE:\tON\n");
535         else
536                 seq_printf(m, "I-CACHE:\tOFF\n");
537         if ((bfin_read_DMEM_CONTROL()) & (ENDCPLB | DMC_ENABLE))
538                 seq_printf(m, "D-CACHE:\tON"
539 #if defined CONFIG_BFIN_WB
540                            " (write-back)"
541 #elif defined CONFIG_BFIN_WT
542                            " (write-through)"
543 #endif
544                            "\n");
545         else
546                 seq_printf(m, "D-CACHE:\tOFF\n");
547
548
549         switch (bfin_read_DMEM_CONTROL() & (1 << DMC0_P | 1 << DMC1_P)) {
550         case ACACHE_BSRAM:
551                 seq_printf(m, "DBANK-A:\tCACHE\n" "DBANK-B:\tSRAM\n");
552                 dcache_size = 16;
553                 dsup_banks = 1;
554                 break;
555         case ACACHE_BCACHE:
556                 seq_printf(m, "DBANK-A:\tCACHE\n" "DBANK-B:\tCACHE\n");
557                 dcache_size = 32;
558                 dsup_banks = 2;
559                 break;
560         case ASRAM_BSRAM:
561                 seq_printf(m, "DBANK-A:\tSRAM\n" "DBANK-B:\tSRAM\n");
562                 dcache_size = 0;
563                 dsup_banks = 0;
564                 break;
565         default:
566                 break;
567         }
568
569
570         seq_printf(m, "I-CACHE Size:\t%dKB\n", BFIN_ICACHESIZE / 1024);
571         seq_printf(m, "D-CACHE Size:\t%dKB\n", dcache_size);
572         seq_printf(m, "I-CACHE Setup:\t%d Sub-banks/%d Ways, %d Lines/Way\n",
573                    BFIN_ISUBBANKS, BFIN_IWAYS, BFIN_ILINES);
574         seq_printf(m,
575                    "D-CACHE Setup:\t%d Super-banks/%d Sub-banks/%d Ways, %d Lines/Way\n",
576                    dsup_banks, BFIN_DSUBBANKS, BFIN_DWAYS,
577                    BFIN_DLINES);
578 #ifdef CONFIG_BFIN_ICACHE_LOCK
579         switch (read_iloc()) {
580         case WAY0_L:
581                 seq_printf(m, "Way0 Locked-Down\n");
582                 break;
583         case WAY1_L:
584                 seq_printf(m, "Way1 Locked-Down\n");
585                 break;
586         case WAY01_L:
587                 seq_printf(m, "Way0,Way1 Locked-Down\n");
588                 break;
589         case WAY2_L:
590                 seq_printf(m, "Way2 Locked-Down\n");
591                 break;
592         case WAY02_L:
593                 seq_printf(m, "Way0,Way2 Locked-Down\n");
594                 break;
595         case WAY12_L:
596                 seq_printf(m, "Way1,Way2 Locked-Down\n");
597                 break;
598         case WAY012_L:
599                 seq_printf(m, "Way0,Way1 & Way2 Locked-Down\n");
600                 break;
601         case WAY3_L:
602                 seq_printf(m, "Way3 Locked-Down\n");
603                 break;
604         case WAY03_L:
605                 seq_printf(m, "Way0,Way3 Locked-Down\n");
606                 break;
607         case WAY13_L:
608                 seq_printf(m, "Way1,Way3 Locked-Down\n");
609                 break;
610         case WAY013_L:
611                 seq_printf(m, "Way 0,Way1,Way3 Locked-Down\n");
612                 break;
613         case WAY32_L:
614                 seq_printf(m, "Way3,Way2 Locked-Down\n");
615                 break;
616         case WAY320_L:
617                 seq_printf(m, "Way3,Way2,Way0 Locked-Down\n");
618                 break;
619         case WAY321_L:
620                 seq_printf(m, "Way3,Way2,Way1 Locked-Down\n");
621                 break;
622         case WAYALL_L:
623                 seq_printf(m, "All Ways are locked\n");
624                 break;
625         default:
626                 seq_printf(m, "No Ways are locked\n");
627         }
628 #endif
629         return 0;
630 }
631
632 static void *c_start(struct seq_file *m, loff_t *pos)
633 {
634         return *pos < NR_CPUS ? ((void *)0x12345678) : NULL;
635 }
636
637 static void *c_next(struct seq_file *m, void *v, loff_t *pos)
638 {
639         ++*pos;
640         return c_start(m, pos);
641 }
642
643 static void c_stop(struct seq_file *m, void *v)
644 {
645 }
646
647 struct seq_operations cpuinfo_op = {
648         .start = c_start,
649         .next = c_next,
650         .stop = c_stop,
651         .show = show_cpuinfo,
652 };
653
654 void __init cmdline_init(const char *r0)
655 {
656         if (r0)
657                 strncpy(command_line, r0, COMMAND_LINE_SIZE);
658 }