[SPARC64]: Add support for IRQ pre-handlers.
[linux-2.6] / arch / ppc / kernel / setup.c
1 /*
2  * Common prep/pmac/chrp boot and setup code.
3  */
4
5 #include <linux/config.h>
6 #include <linux/module.h>
7 #include <linux/string.h>
8 #include <linux/sched.h>
9 #include <linux/init.h>
10 #include <linux/kernel.h>
11 #include <linux/reboot.h>
12 #include <linux/delay.h>
13 #include <linux/initrd.h>
14 #include <linux/ide.h>
15 #include <linux/tty.h>
16 #include <linux/bootmem.h>
17 #include <linux/seq_file.h>
18 #include <linux/root_dev.h>
19 #include <linux/cpu.h>
20 #include <linux/console.h>
21
22 #include <asm/residual.h>
23 #include <asm/io.h>
24 #include <asm/prom.h>
25 #include <asm/processor.h>
26 #include <asm/pgtable.h>
27 #include <asm/bootinfo.h>
28 #include <asm/setup.h>
29 #include <asm/amigappc.h>
30 #include <asm/smp.h>
31 #include <asm/elf.h>
32 #include <asm/cputable.h>
33 #include <asm/bootx.h>
34 #include <asm/btext.h>
35 #include <asm/machdep.h>
36 #include <asm/uaccess.h>
37 #include <asm/system.h>
38 #include <asm/pmac_feature.h>
39 #include <asm/sections.h>
40 #include <asm/nvram.h>
41 #include <asm/xmon.h>
42 #include <asm/ocp.h>
43
44 #if defined(CONFIG_85xx) || defined(CONFIG_83xx) || defined(CONFIG_MPC10X_BRIDGE)
45 #include <asm/ppc_sys.h>
46 #endif
47
48 #if defined CONFIG_KGDB
49 #include <asm/kgdb.h>
50 #endif
51
52 extern void platform_init(unsigned long r3, unsigned long r4,
53                 unsigned long r5, unsigned long r6, unsigned long r7);
54 extern void bootx_init(unsigned long r4, unsigned long phys);
55 extern void identify_cpu(unsigned long offset, unsigned long cpu);
56 extern void do_cpu_ftr_fixups(unsigned long offset);
57 extern void reloc_got2(unsigned long offset);
58
59 extern void ppc6xx_idle(void);
60 extern void power4_idle(void);
61
62 extern boot_infos_t *boot_infos;
63 struct ide_machdep_calls ppc_ide_md;
64
65 /* Used with the BI_MEMSIZE bootinfo parameter to store the memory
66    size value reported by the boot loader. */
67 unsigned long boot_mem_size;
68
69 unsigned long ISA_DMA_THRESHOLD;
70 unsigned long DMA_MODE_READ, DMA_MODE_WRITE;
71
72 #ifdef CONFIG_PPC_MULTIPLATFORM
73 int _machine = 0;
74
75 extern void prep_init(unsigned long r3, unsigned long r4,
76                 unsigned long r5, unsigned long r6, unsigned long r7);
77 extern void pmac_init(unsigned long r3, unsigned long r4,
78                 unsigned long r5, unsigned long r6, unsigned long r7);
79 extern void chrp_init(unsigned long r3, unsigned long r4,
80                 unsigned long r5, unsigned long r6, unsigned long r7);
81 #endif /* CONFIG_PPC_MULTIPLATFORM */
82
83 #ifdef CONFIG_MAGIC_SYSRQ
84 unsigned long SYSRQ_KEY = 0x54;
85 #endif /* CONFIG_MAGIC_SYSRQ */
86
87 #ifdef CONFIG_VGA_CONSOLE
88 unsigned long vgacon_remap_base;
89 #endif
90
91 struct machdep_calls ppc_md;
92
93 /*
94  * These are used in binfmt_elf.c to put aux entries on the stack
95  * for each elf executable being started.
96  */
97 int dcache_bsize;
98 int icache_bsize;
99 int ucache_bsize;
100
101 #if defined(CONFIG_VGA_CONSOLE) || defined(CONFIG_FB_VGA16) || \
102     defined(CONFIG_FB_VGA16_MODULE) || defined(CONFIG_FB_VESA)
103 struct screen_info screen_info = {
104         0, 25,                  /* orig-x, orig-y */
105         0,                      /* unused */
106         0,                      /* orig-video-page */
107         0,                      /* orig-video-mode */
108         80,                     /* orig-video-cols */
109         0,0,0,                  /* ega_ax, ega_bx, ega_cx */
110         25,                     /* orig-video-lines */
111         1,                      /* orig-video-isVGA */
112         16                      /* orig-video-points */
113 };
114 #endif /* CONFIG_VGA_CONSOLE || CONFIG_FB_VGA16 || CONFIG_FB_VESA */
115
116 void machine_restart(char *cmd)
117 {
118 #ifdef CONFIG_NVRAM
119         nvram_sync();
120 #endif
121         ppc_md.restart(cmd);
122 }
123
124 EXPORT_SYMBOL(machine_restart);
125
126 void machine_power_off(void)
127 {
128 #ifdef CONFIG_NVRAM
129         nvram_sync();
130 #endif
131         ppc_md.power_off();
132 }
133
134 EXPORT_SYMBOL(machine_power_off);
135
136 void machine_halt(void)
137 {
138 #ifdef CONFIG_NVRAM
139         nvram_sync();
140 #endif
141         ppc_md.halt();
142 }
143
144 EXPORT_SYMBOL(machine_halt);
145
146 void (*pm_power_off)(void) = machine_power_off;
147
148 #ifdef CONFIG_TAU
149 extern u32 cpu_temp(unsigned long cpu);
150 extern u32 cpu_temp_both(unsigned long cpu);
151 #endif /* CONFIG_TAU */
152
153 int show_cpuinfo(struct seq_file *m, void *v)
154 {
155         int i = (int) v - 1;
156         int err = 0;
157         unsigned int pvr;
158         unsigned short maj, min;
159         unsigned long lpj;
160
161         if (i >= NR_CPUS) {
162                 /* Show summary information */
163 #ifdef CONFIG_SMP
164                 unsigned long bogosum = 0;
165                 for (i = 0; i < NR_CPUS; ++i)
166                         if (cpu_online(i))
167                                 bogosum += cpu_data[i].loops_per_jiffy;
168                 seq_printf(m, "total bogomips\t: %lu.%02lu\n",
169                            bogosum/(500000/HZ), bogosum/(5000/HZ) % 100);
170 #endif /* CONFIG_SMP */
171
172                 if (ppc_md.show_cpuinfo != NULL)
173                         err = ppc_md.show_cpuinfo(m);
174                 return err;
175         }
176
177 #ifdef CONFIG_SMP
178         if (!cpu_online(i))
179                 return 0;
180         pvr = cpu_data[i].pvr;
181         lpj = cpu_data[i].loops_per_jiffy;
182 #else
183         pvr = mfspr(SPRN_PVR);
184         lpj = loops_per_jiffy;
185 #endif
186
187         seq_printf(m, "processor\t: %d\n", i);
188         seq_printf(m, "cpu\t\t: ");
189
190         if (cur_cpu_spec[i]->pvr_mask)
191                 seq_printf(m, "%s", cur_cpu_spec[i]->cpu_name);
192         else
193                 seq_printf(m, "unknown (%08x)", pvr);
194 #ifdef CONFIG_ALTIVEC
195         if (cur_cpu_spec[i]->cpu_features & CPU_FTR_ALTIVEC)
196                 seq_printf(m, ", altivec supported");
197 #endif
198         seq_printf(m, "\n");
199
200 #ifdef CONFIG_TAU
201         if (cur_cpu_spec[i]->cpu_features & CPU_FTR_TAU) {
202 #ifdef CONFIG_TAU_AVERAGE
203                 /* more straightforward, but potentially misleading */
204                 seq_printf(m,  "temperature \t: %u C (uncalibrated)\n",
205                            cpu_temp(i));
206 #else
207                 /* show the actual temp sensor range */
208                 u32 temp;
209                 temp = cpu_temp_both(i);
210                 seq_printf(m, "temperature \t: %u-%u C (uncalibrated)\n",
211                            temp & 0xff, temp >> 16);
212 #endif
213         }
214 #endif /* CONFIG_TAU */
215
216         if (ppc_md.show_percpuinfo != NULL) {
217                 err = ppc_md.show_percpuinfo(m, i);
218                 if (err)
219                         return err;
220         }
221
222         /* If we are a Freescale core do a simple check so
223          * we dont have to keep adding cases in the future */
224         if ((PVR_VER(pvr) & 0x8000) == 0x8000) {
225                 maj = PVR_MAJ(pvr);
226                 min = PVR_MIN(pvr);
227         } else {
228                 switch (PVR_VER(pvr)) {
229                         case 0x0020:    /* 403 family */
230                                 maj = PVR_MAJ(pvr) + 1;
231                                 min = PVR_MIN(pvr);
232                                 break;
233                         case 0x1008:    /* 740P/750P ?? */
234                                 maj = ((pvr >> 8) & 0xFF) - 1;
235                                 min = pvr & 0xFF;
236                                 break;
237                         default:
238                                 maj = (pvr >> 8) & 0xFF;
239                                 min = pvr & 0xFF;
240                                 break;
241                 }
242         }
243
244         seq_printf(m, "revision\t: %hd.%hd (pvr %04x %04x)\n",
245                    maj, min, PVR_VER(pvr), PVR_REV(pvr));
246
247         seq_printf(m, "bogomips\t: %lu.%02lu\n",
248                    lpj / (500000/HZ), (lpj / (5000/HZ)) % 100);
249
250 #if defined(CONFIG_85xx) || defined(CONFIG_83xx) || defined(CONFIG_MPC10X_BRIDGE)
251         if (cur_ppc_sys_spec->ppc_sys_name)
252                 seq_printf(m, "chipset\t\t: %s\n",
253                         cur_ppc_sys_spec->ppc_sys_name);
254 #endif
255
256 #ifdef CONFIG_SMP
257         seq_printf(m, "\n");
258 #endif
259
260         return 0;
261 }
262
263 static void *c_start(struct seq_file *m, loff_t *pos)
264 {
265         int i = *pos;
266
267         return i <= NR_CPUS? (void *) (i + 1): NULL;
268 }
269
270 static void *c_next(struct seq_file *m, void *v, loff_t *pos)
271 {
272         ++*pos;
273         return c_start(m, pos);
274 }
275
276 static void c_stop(struct seq_file *m, void *v)
277 {
278 }
279
280 struct seq_operations cpuinfo_op = {
281         .start =c_start,
282         .next = c_next,
283         .stop = c_stop,
284         .show = show_cpuinfo,
285 };
286
287 /*
288  * We're called here very early in the boot.  We determine the machine
289  * type and call the appropriate low-level setup functions.
290  *  -- Cort <cort@fsmlabs.com>
291  *
292  * Note that the kernel may be running at an address which is different
293  * from the address that it was linked at, so we must use RELOC/PTRRELOC
294  * to access static data (including strings).  -- paulus
295  */
296 __init
297 unsigned long
298 early_init(int r3, int r4, int r5)
299 {
300         unsigned long phys;
301         unsigned long offset = reloc_offset();
302
303         /* Default */
304         phys = offset + KERNELBASE;
305
306         /* First zero the BSS -- use memset, some arches don't have
307          * caches on yet */
308         memset_io(PTRRELOC(&__bss_start), 0, _end - __bss_start);
309
310         /*
311          * Identify the CPU type and fix up code sections
312          * that depend on which cpu we have.
313          */
314         identify_cpu(offset, 0);
315         do_cpu_ftr_fixups(offset);
316
317 #if defined(CONFIG_PPC_MULTIPLATFORM)
318         reloc_got2(offset);
319
320         /* If we came here from BootX, clear the screen,
321          * set up some pointers and return. */
322         if ((r3 == 0x426f6f58) && (r5 == 0))
323                 bootx_init(r4, phys);
324
325         /*
326          * don't do anything on prep
327          * for now, don't use bootinfo because it breaks yaboot 0.5
328          * and assume that if we didn't find a magic number, we have OF
329          */
330         else if (*(unsigned long *)(0) != 0xdeadc0de)
331                 phys = prom_init(r3, r4, (prom_entry)r5);
332
333         reloc_got2(-offset);
334 #endif
335
336         return phys;
337 }
338
339 #ifdef CONFIG_PPC_OF
340 /*
341  * Assume here that all clock rates are the same in a
342  * smp system.  -- Cort
343  */
344 int __openfirmware
345 of_show_percpuinfo(struct seq_file *m, int i)
346 {
347         struct device_node *cpu_node;
348         u32 *fp;
349         int s;
350         
351         cpu_node = find_type_devices("cpu");
352         if (!cpu_node)
353                 return 0;
354         for (s = 0; s < i && cpu_node->next; s++)
355                 cpu_node = cpu_node->next;
356         fp = (u32 *)get_property(cpu_node, "clock-frequency", NULL);
357         if (fp)
358                 seq_printf(m, "clock\t\t: %dMHz\n", *fp / 1000000);
359         return 0;
360 }
361
362 void __init
363 intuit_machine_type(void)
364 {
365         char *model;
366         struct device_node *root;
367         
368         /* ask the OF info if we're a chrp or pmac */
369         root = find_path_device("/");
370         if (root != 0) {
371                 /* assume pmac unless proven to be chrp -- Cort */
372                 _machine = _MACH_Pmac;
373                 model = get_property(root, "device_type", NULL);
374                 if (model && !strncmp("chrp", model, 4))
375                         _machine = _MACH_chrp;
376                 else {
377                         model = get_property(root, "model", NULL);
378                         if (model && !strncmp(model, "IBM", 3))
379                                 _machine = _MACH_chrp;
380                 }
381         }
382 }
383 #endif
384
385 #ifdef CONFIG_PPC_MULTIPLATFORM
386 /*
387  * The PPC_MULTIPLATFORM version of platform_init...
388  */
389 void __init
390 platform_init(unsigned long r3, unsigned long r4, unsigned long r5,
391               unsigned long r6, unsigned long r7)
392 {
393 #ifdef CONFIG_BOOTX_TEXT
394         if (boot_text_mapped) {
395                 btext_clearscreen();
396                 btext_welcome();
397         }
398 #endif
399
400         parse_bootinfo(find_bootinfo());
401
402         /* if we didn't get any bootinfo telling us what we are... */
403         if (_machine == 0) {
404                 /* prep boot loader tells us if we're prep or not */
405                 if ( *(unsigned long *)(KERNELBASE) == (0xdeadc0de) )
406                         _machine = _MACH_prep;
407         }
408
409         /* not much more to do here, if prep */
410         if (_machine == _MACH_prep) {
411                 prep_init(r3, r4, r5, r6, r7);
412                 return;
413         }
414
415         /* prom_init has already been called from __start */
416         if (boot_infos)
417                 relocate_nodes();
418
419         /* If we aren't PReP, we can find out if we're Pmac
420          * or CHRP with this. */
421         if (_machine == 0)
422                 intuit_machine_type();
423
424         /* finish_device_tree may need _machine defined. */
425         finish_device_tree();
426
427         /*
428          * If we were booted via quik, r3 points to the physical
429          * address of the command-line parameters.
430          * If we were booted from an xcoff image (i.e. netbooted or
431          * booted from floppy), we get the command line from the
432          * bootargs property of the /chosen node.
433          * If an initial ramdisk is present, r3 and r4
434          * are used for initrd_start and initrd_size,
435          * otherwise they contain 0xdeadbeef.
436          */
437         if (r3 >= 0x4000 && r3 < 0x800000 && r4 == 0) {
438                 strlcpy(cmd_line, (char *)r3 + KERNELBASE,
439                         sizeof(cmd_line));
440         } else if (boot_infos != 0) {
441                 /* booted by BootX - check for ramdisk */
442                 if (boot_infos->kernelParamsOffset != 0)
443                         strlcpy(cmd_line, (char *) boot_infos
444                                 + boot_infos->kernelParamsOffset,
445                                 sizeof(cmd_line));
446 #ifdef CONFIG_BLK_DEV_INITRD
447                 if (boot_infos->ramDisk) {
448                         initrd_start = (unsigned long) boot_infos
449                                 + boot_infos->ramDisk;
450                         initrd_end = initrd_start + boot_infos->ramDiskSize;
451                         initrd_below_start_ok = 1;
452                 }
453 #endif
454         } else {
455                 struct device_node *chosen;
456                 char *p;
457         
458 #ifdef CONFIG_BLK_DEV_INITRD
459                 if (r3 && r4 && r4 != 0xdeadbeef) {
460                         if (r3 < KERNELBASE)
461                                 r3 += KERNELBASE;
462                         initrd_start = r3;
463                         initrd_end = r3 + r4;
464                         ROOT_DEV = Root_RAM0;
465                         initrd_below_start_ok = 1;
466                 }
467 #endif
468                 chosen = find_devices("chosen");
469                 if (chosen != NULL) {
470                         p = get_property(chosen, "bootargs", NULL);
471                         if (p && *p) {
472                                 strlcpy(cmd_line, p, sizeof(cmd_line));
473                         }
474                 }
475         }
476 #ifdef CONFIG_ADB
477         if (strstr(cmd_line, "adb_sync")) {
478                 extern int __adb_probe_sync;
479                 __adb_probe_sync = 1;
480         }
481 #endif /* CONFIG_ADB */
482
483         switch (_machine) {
484         case _MACH_Pmac:
485                 pmac_init(r3, r4, r5, r6, r7);
486                 break;
487         case _MACH_chrp:
488                 chrp_init(r3, r4, r5, r6, r7);
489                 break;
490         }
491 }
492
493 #ifdef CONFIG_SERIAL_CORE_CONSOLE
494 extern char *of_stdout_device;
495
496 static int __init set_preferred_console(void)
497 {
498         struct device_node *prom_stdout;
499         char *name;
500         int offset = 0;
501
502         if (of_stdout_device == NULL)
503                 return -ENODEV;
504
505         /* The user has requested a console so this is already set up. */
506         if (strstr(saved_command_line, "console="))
507                 return -EBUSY;
508
509         prom_stdout = find_path_device(of_stdout_device);
510         if (!prom_stdout)
511                 return -ENODEV;
512
513         name = (char *)get_property(prom_stdout, "name", NULL);
514         if (!name)
515                 return -ENODEV;
516
517         if (strcmp(name, "serial") == 0) {
518                 int i;
519                 u32 *reg = (u32 *)get_property(prom_stdout, "reg", &i);
520                 if (i > 8) {
521                         switch (reg[1]) {
522                                 case 0x3f8:
523                                         offset = 0;
524                                         break;
525                                 case 0x2f8:
526                                         offset = 1;
527                                         break;
528                                 case 0x898:
529                                         offset = 2;
530                                         break;
531                                 case 0x890:
532                                         offset = 3;
533                                         break;
534                                 default:
535                                         /* We dont recognise the serial port */
536                                         return -ENODEV;
537                         }
538                 }
539         } else if (strcmp(name, "ch-a") == 0)
540                 offset = 0;
541         else if (strcmp(name, "ch-b") == 0)
542                 offset = 1;
543         else
544                 return -ENODEV;
545         return add_preferred_console("ttyS", offset, NULL);
546 }
547 console_initcall(set_preferred_console);
548 #endif /* CONFIG_SERIAL_CORE_CONSOLE */
549 #endif /* CONFIG_PPC_MULTIPLATFORM */
550
551 struct bi_record *find_bootinfo(void)
552 {
553         struct bi_record *rec;
554
555         rec = (struct bi_record *)_ALIGN((ulong)__bss_start+(1<<20)-1,(1<<20));
556         if ( rec->tag != BI_FIRST ) {
557                 /*
558                  * This 0x10000 offset is a terrible hack but it will go away when
559                  * we have the bootloader handle all the relocation and
560                  * prom calls -- Cort
561                  */
562                 rec = (struct bi_record *)_ALIGN((ulong)__bss_start+0x10000+(1<<20)-1,(1<<20));
563                 if ( rec->tag != BI_FIRST )
564                         return NULL;
565         }
566         return rec;
567 }
568
569 void parse_bootinfo(struct bi_record *rec)
570 {
571         if (rec == NULL || rec->tag != BI_FIRST)
572                 return;
573         while (rec->tag != BI_LAST) {
574                 ulong *data = rec->data;
575                 switch (rec->tag) {
576                 case BI_CMD_LINE:
577                         strlcpy(cmd_line, (void *)data, sizeof(cmd_line));
578                         break;
579 #ifdef CONFIG_BLK_DEV_INITRD
580                 case BI_INITRD:
581                         initrd_start = data[0] + KERNELBASE;
582                         initrd_end = data[0] + data[1] + KERNELBASE;
583                         break;
584 #endif /* CONFIG_BLK_DEV_INITRD */
585 #ifdef CONFIG_PPC_MULTIPLATFORM
586                 case BI_MACHTYPE:
587                         _machine = data[0];
588                         break;
589 #endif
590                 case BI_MEMSIZE:
591                         boot_mem_size = data[0];
592                         break;
593                 }
594                 rec = (struct bi_record *)((ulong)rec + rec->size);
595         }
596 }
597
598 /*
599  * Find out what kind of machine we're on and save any data we need
600  * from the early boot process (devtree is copied on pmac by prom_init()).
601  * This is called very early on the boot process, after a minimal
602  * MMU environment has been set up but before MMU_init is called.
603  */
604 void __init
605 machine_init(unsigned long r3, unsigned long r4, unsigned long r5,
606              unsigned long r6, unsigned long r7)
607 {
608 #ifdef CONFIG_CMDLINE
609         strlcpy(cmd_line, CONFIG_CMDLINE, sizeof(cmd_line));
610 #endif /* CONFIG_CMDLINE */
611
612 #ifdef CONFIG_6xx
613         ppc_md.power_save = ppc6xx_idle;
614 #endif
615 #ifdef CONFIG_POWER4
616         ppc_md.power_save = power4_idle;
617 #endif
618
619         platform_init(r3, r4, r5, r6, r7);
620
621         if (ppc_md.progress)
622                 ppc_md.progress("id mach(): done", 0x200);
623 }
624
625 /* Checks "l2cr=xxxx" command-line option */
626 int __init ppc_setup_l2cr(char *str)
627 {
628         if (cpu_has_feature(CPU_FTR_L2CR)) {
629                 unsigned long val = simple_strtoul(str, NULL, 0);
630                 printk(KERN_INFO "l2cr set to %lx\n", val);
631                 _set_L2CR(0);           /* force invalidate by disable cache */
632                 _set_L2CR(val);         /* and enable it */
633         }
634         return 1;
635 }
636 __setup("l2cr=", ppc_setup_l2cr);
637
638 #ifdef CONFIG_GENERIC_NVRAM
639
640 /* Generic nvram hooks used by drivers/char/gen_nvram.c */
641 unsigned char nvram_read_byte(int addr)
642 {
643         if (ppc_md.nvram_read_val)
644                 return ppc_md.nvram_read_val(addr);
645         return 0xff;
646 }
647 EXPORT_SYMBOL(nvram_read_byte);
648
649 void nvram_write_byte(unsigned char val, int addr)
650 {
651         if (ppc_md.nvram_write_val)
652                 ppc_md.nvram_write_val(addr, val);
653 }
654 EXPORT_SYMBOL(nvram_write_byte);
655
656 void nvram_sync(void)
657 {
658         if (ppc_md.nvram_sync)
659                 ppc_md.nvram_sync();
660 }
661 EXPORT_SYMBOL(nvram_sync);
662
663 #endif /* CONFIG_NVRAM */
664
665 static struct cpu cpu_devices[NR_CPUS];
666
667 int __init ppc_init(void)
668 {
669         int i;
670
671         /* clear the progress line */
672         if ( ppc_md.progress ) ppc_md.progress("             ", 0xffff);
673
674         /* register CPU devices */
675         for (i = 0; i < NR_CPUS; i++)
676                 if (cpu_possible(i))
677                         register_cpu(&cpu_devices[i], i, NULL);
678
679         /* call platform init */
680         if (ppc_md.init != NULL) {
681                 ppc_md.init();
682         }
683         return 0;
684 }
685
686 arch_initcall(ppc_init);
687
688 /* Warning, IO base is not yet inited */
689 void __init setup_arch(char **cmdline_p)
690 {
691         extern char *klimit;
692         extern void do_init_bootmem(void);
693
694         /* so udelay does something sensible, assume <= 1000 bogomips */
695         loops_per_jiffy = 500000000 / HZ;
696
697 #ifdef CONFIG_PPC_MULTIPLATFORM
698         /* This could be called "early setup arch", it must be done
699          * now because xmon need it
700          */
701         if (_machine == _MACH_Pmac)
702                 pmac_feature_init();    /* New cool way */
703 #endif
704
705 #ifdef CONFIG_XMON
706         xmon_map_scc();
707         if (strstr(cmd_line, "xmon"))
708                 xmon(NULL);
709 #endif /* CONFIG_XMON */
710         if ( ppc_md.progress ) ppc_md.progress("setup_arch: enter", 0x3eab);
711
712 #if defined(CONFIG_KGDB)
713         if (ppc_md.kgdb_map_scc)
714                 ppc_md.kgdb_map_scc();
715         set_debug_traps();
716         if (strstr(cmd_line, "gdb")) {
717                 if (ppc_md.progress)
718                         ppc_md.progress("setup_arch: kgdb breakpoint", 0x4000);
719                 printk("kgdb breakpoint activated\n");
720                 breakpoint();
721         }
722 #endif
723
724         /*
725          * Set cache line size based on type of cpu as a default.
726          * Systems with OF can look in the properties on the cpu node(s)
727          * for a possibly more accurate value.
728          */
729         if (cpu_has_feature(CPU_FTR_SPLIT_ID_CACHE)) {
730                 dcache_bsize = cur_cpu_spec[0]->dcache_bsize;
731                 icache_bsize = cur_cpu_spec[0]->icache_bsize;
732                 ucache_bsize = 0;
733         } else
734                 ucache_bsize = dcache_bsize = icache_bsize
735                         = cur_cpu_spec[0]->dcache_bsize;
736
737         /* reboot on panic */
738         panic_timeout = 180;
739
740         init_mm.start_code = PAGE_OFFSET;
741         init_mm.end_code = (unsigned long) _etext;
742         init_mm.end_data = (unsigned long) _edata;
743         init_mm.brk = (unsigned long) klimit;
744
745         /* Save unparsed command line copy for /proc/cmdline */
746         strlcpy(saved_command_line, cmd_line, COMMAND_LINE_SIZE);
747         *cmdline_p = cmd_line;
748
749         parse_early_param();
750
751         /* set up the bootmem stuff with available memory */
752         do_init_bootmem();
753         if ( ppc_md.progress ) ppc_md.progress("setup_arch: bootmem", 0x3eab);
754
755 #ifdef CONFIG_PPC_OCP
756         /* Initialize OCP device list */
757         ocp_early_init();
758         if ( ppc_md.progress ) ppc_md.progress("ocp: exit", 0x3eab);
759 #endif
760
761 #ifdef CONFIG_DUMMY_CONSOLE
762         conswitchp = &dummy_con;
763 #endif
764
765         ppc_md.setup_arch();
766         if ( ppc_md.progress ) ppc_md.progress("arch: exit", 0x3eab);
767
768         paging_init();
769
770         /* this is for modules since _machine can be a define -- Cort */
771         ppc_md.ppc_machine = _machine;
772 }