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