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