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