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