1 /* 1 /* 2 * Copyright (C) 2007-2009 Michal Simek <monst !! 2 * Common prep/pmac/chrp boot and setup code. 3 * Copyright (C) 2007-2009 PetaLogix << 4 * Copyright (C) 2006 Atmark Techno, Inc. << 5 * << 6 * This file is subject to the terms and condi << 7 * License. See the file "COPYING" in the main << 8 * for more details. << 9 */ 3 */ 10 4 11 #include <linux/init.h> !! 5 #include <linux/config.h> 12 #include <linux/of_clk.h> !! 6 #include <linux/module.h> 13 #include <linux/clocksource.h> << 14 #include <linux/string.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/blk.h> >> 13 #include <linux/ide.h> >> 14 #include <linux/tty.h> >> 15 #include <linux/bootmem.h> 15 #include <linux/seq_file.h> 16 #include <linux/seq_file.h> 16 #include <linux/cpu.h> << 17 #include <linux/initrd.h> << 18 #include <linux/console.h> << 19 #include <linux/debugfs.h> << 20 #include <linux/of_fdt.h> << 21 #include <linux/pgtable.h> << 22 17 >> 18 #include <asm/residual.h> >> 19 #include <asm/io.h> >> 20 #include <asm/prom.h> >> 21 #include <asm/processor.h> >> 22 #include <asm/pgtable.h> >> 23 #include <asm/bootinfo.h> 23 #include <asm/setup.h> 24 #include <asm/setup.h> 24 #include <asm/sections.h> !! 25 #include <asm/amigappc.h> 25 #include <asm/page.h> !! 26 #include <asm/smp.h> 26 #include <linux/io.h> !! 27 #include <asm/elf.h> 27 #include <linux/bug.h> !! 28 #include <asm/cputable.h> 28 #include <linux/param.h> !! 29 #include <asm/bootx.h> 29 #include <linux/pci.h> !! 30 #include <asm/btext.h> 30 #include <linux/cache.h> !! 31 #include <asm/machdep.h> 31 #include <linux/of.h> !! 32 #include <asm/uaccess.h> 32 #include <linux/dma-mapping.h> !! 33 #include <asm/system.h> 33 #include <asm/cacheflush.h> !! 34 #include <asm/pmac_feature.h> 34 #include <asm/entry.h> !! 35 #include <asm/kgdb.h> 35 #include <asm/cpuinfo.h> !! 36 36 !! 37 extern void platform_init(unsigned long r3, unsigned long r4, 37 !! 38 unsigned long r5, unsigned long r6, unsigned long r7); 38 DEFINE_PER_CPU(unsigned int, KSP); /* Sav !! 39 extern void bootx_init(unsigned long r4, unsigned long phys); 39 DEFINE_PER_CPU(unsigned int, KM); /* Ker !! 40 extern void identify_cpu(unsigned long offset, unsigned long cpu); 40 DEFINE_PER_CPU(unsigned int, ENTRY_SP); /* Sav !! 41 extern void do_cpu_ftr_fixups(unsigned long offset); 41 DEFINE_PER_CPU(unsigned int, R11_SAVE); /* Tem !! 42 extern void reloc_got2(unsigned long offset); 42 DEFINE_PER_CPU(unsigned int, CURRENT_SAVE); !! 43 >> 44 #ifdef CONFIG_XMON >> 45 extern void xmon_map_scc(void); >> 46 #endif >> 47 >> 48 extern boot_infos_t *boot_infos; >> 49 char saved_command_line[512]; >> 50 extern char cmd_line[512]; >> 51 unsigned char aux_device_present; >> 52 struct ide_machdep_calls ppc_ide_md; >> 53 char *sysmap; >> 54 unsigned long sysmap_size; >> 55 >> 56 /* Used with the BI_MEMSIZE bootinfo parameter to store the memory >> 57 size value reported by the boot loader. */ >> 58 unsigned long boot_mem_size; >> 59 >> 60 unsigned long ISA_DMA_THRESHOLD; >> 61 unsigned long DMA_MODE_READ, DMA_MODE_WRITE; >> 62 >> 63 #ifdef CONFIG_ALL_PPC >> 64 int _machine = 0; >> 65 >> 66 extern void prep_init(unsigned long r3, unsigned long r4, >> 67 unsigned long r5, unsigned long r6, unsigned long r7); >> 68 extern void pmac_init(unsigned long r3, unsigned long r4, >> 69 unsigned long r5, unsigned long r6, unsigned long r7); >> 70 extern void chrp_init(unsigned long r3, unsigned long r4, >> 71 unsigned long r5, unsigned long r6, unsigned long r7); >> 72 #endif /* CONFIG_ALL_PPC */ >> 73 >> 74 #ifdef CONFIG_MAGIC_SYSRQ >> 75 unsigned long SYSRQ_KEY; >> 76 #endif /* CONFIG_MAGIC_SYSRQ */ >> 77 >> 78 #ifdef CONFIG_VGA_CONSOLE >> 79 unsigned long vgacon_remap_base; >> 80 #endif >> 81 >> 82 struct machdep_calls ppc_md; 43 83 44 /* 84 /* 45 * Placed cmd_line to .data section because ca !! 85 * These are used in binfmt_elf.c to put aux entries on the stack 46 * ASM code. Default position is BSS section w !! 86 * for each elf executable being started. 47 * in machine_early_init(). << 48 */ 87 */ 49 char cmd_line[COMMAND_LINE_SIZE] __section(".d !! 88 int dcache_bsize; >> 89 int icache_bsize; >> 90 int ucache_bsize; >> 91 >> 92 #if defined(CONFIG_VGA_CONSOLE) || defined(CONFIG_FB) >> 93 struct screen_info screen_info = { >> 94 0, 25, /* orig-x, orig-y */ >> 95 0, /* unused */ >> 96 0, /* orig-video-page */ >> 97 0, /* orig-video-mode */ >> 98 80, /* orig-video-cols */ >> 99 0,0,0, /* ega_ax, ega_bx, ega_cx */ >> 100 25, /* orig-video-lines */ >> 101 1, /* orig-video-isVGA */ >> 102 16 /* orig-video-points */ >> 103 }; >> 104 #endif /* CONFIG_VGA_CONSOLE || CONFIG_FB */ 50 105 51 void __init setup_arch(char **cmdline_p) !! 106 void machine_restart(char *cmd) 52 { 107 { 53 *cmdline_p = boot_command_line; !! 108 ppc_md.restart(cmd); >> 109 } 54 110 55 setup_memory(); !! 111 void machine_power_off(void) >> 112 { >> 113 ppc_md.power_off(); >> 114 } 56 115 57 console_verbose(); !! 116 void machine_halt(void) >> 117 { >> 118 ppc_md.halt(); >> 119 } >> 120 >> 121 #ifdef CONFIG_TAU >> 122 extern u32 cpu_temp(unsigned long cpu); >> 123 extern u32 cpu_temp_both(unsigned long cpu); >> 124 #endif /* CONFIG_TAU */ 58 125 59 unflatten_device_tree(); !! 126 int show_cpuinfo(struct seq_file *m, void *v) >> 127 { >> 128 int i = (int) v - 1; >> 129 int err = 0; >> 130 unsigned int pvr; >> 131 unsigned short maj, min; >> 132 unsigned long lpj; >> 133 >> 134 if (i >= NR_CPUS) { >> 135 /* Show summary information */ >> 136 #ifdef CONFIG_SMP >> 137 unsigned long bogosum = 0; >> 138 for (i = 0; i < smp_num_cpus; ++i) >> 139 if (cpu_online_map & (1 << i)) >> 140 bogosum += cpu_data[i].loops_per_jiffy; >> 141 seq_printf(m, "total bogomips\t: %lu.%02lu\n", >> 142 bogosum/(500000/HZ), bogosum/(5000/HZ) % 100); >> 143 #endif /* CONFIG_SMP */ >> 144 >> 145 if (ppc_md.show_cpuinfo != NULL) >> 146 err = ppc_md.show_cpuinfo(m); >> 147 return err; >> 148 } 60 149 61 setup_cpuinfo(); !! 150 #ifdef CONFIG_SMP >> 151 if (!(cpu_online_map & (1 << i))) >> 152 return 0; >> 153 pvr = cpu_data[i].pvr; >> 154 lpj = cpu_data[i].loops_per_jiffy; >> 155 #else >> 156 pvr = mfspr(PVR); >> 157 lpj = loops_per_jiffy; >> 158 #endif 62 159 63 microblaze_cache_init(); !! 160 seq_printf(m, "processor\t: %u\n", i); >> 161 seq_printf(m, "cpu\t\t: "); 64 162 65 xilinx_pci_init(); !! 163 if (cur_cpu_spec[i]->pvr_mask) 66 } !! 164 seq_printf(m, "%s", cur_cpu_spec[i]->cpu_name); >> 165 else >> 166 seq_printf(m, "unknown (%08x)", pvr); >> 167 #ifdef CONFIG_ALTIVEC >> 168 if (cur_cpu_spec[i]->cpu_features & CPU_FTR_ALTIVEC) >> 169 seq_printf(m, ", altivec supported"); >> 170 #endif >> 171 seq_printf(m, "\n"); 67 172 68 #ifdef CONFIG_MTD_UCLINUX !! 173 #ifdef CONFIG_TAU 69 /* Handle both romfs and cramfs types, without !! 174 if (cur_cpu_spec[i]->cpu_features & CPU_FTR_TAU) { 70 code (ie no point checking for CRAMFS if it's !! 175 #ifdef CONFIG_TAU_AVERAGE 71 inline unsigned get_romfs_len(unsigned *addr) !! 176 /* more straightforward, but potentially misleading */ 72 { !! 177 seq_printf(m, "temperature \t: %u C (uncalibrated)\n", 73 #ifdef CONFIG_ROMFS_FS !! 178 cpu_temp(i)); 74 if (memcmp(&addr[0], "-rom1fs-", 8) == !! 179 #else 75 return be32_to_cpu(addr[2]); !! 180 /* show the actual temp sensor range */ >> 181 u32 temp; >> 182 temp = cpu_temp_both(i); >> 183 seq_printf(m, "temperature \t: %u-%u C (uncalibrated)\n", >> 184 temp & 0xff, temp >> 16); 76 #endif 185 #endif >> 186 } >> 187 #endif /* CONFIG_TAU */ >> 188 >> 189 if (ppc_md.show_percpuinfo != NULL) { >> 190 err = ppc_md.show_percpuinfo(m, i); >> 191 if (err) >> 192 return err; >> 193 } >> 194 >> 195 switch (PVR_VER(pvr)) { >> 196 case 0x0020: /* 403 family */ >> 197 maj = PVR_MAJ(pvr) + 1; >> 198 min = PVR_MIN(pvr); >> 199 break; >> 200 case 0x1008: /* 740P/750P ?? */ >> 201 maj = ((pvr >> 8) & 0xFF) - 1; >> 202 min = pvr & 0xFF; >> 203 break; >> 204 default: >> 205 maj = (pvr >> 8) & 0xFF; >> 206 min = pvr & 0xFF; >> 207 break; >> 208 } >> 209 >> 210 seq_printf(m, "revision\t: %hd.%hd (pvr %04x %04x)\n", >> 211 maj, min, PVR_VER(pvr), PVR_REV(pvr)); >> 212 >> 213 seq_printf(m, "bogomips\t: %lu.%02lu\n", >> 214 lpj / (500000/HZ), (lpj / (5000/HZ)) % 100); 77 215 78 #ifdef CONFIG_CRAMFS !! 216 #ifdef CONFIG_SMP 79 if (addr[0] == le32_to_cpu(0x28cd3d45) !! 217 seq_printf(m, "\n"); 80 return le32_to_cpu(addr[1]); << 81 #endif 218 #endif >> 219 82 return 0; 220 return 0; 83 } 221 } 84 #endif /* CONFIG_MTD_UCLINUX_EBSS */ << 85 222 86 unsigned long kernel_tlb; << 87 223 88 void __init machine_early_init(const char *cmd !! 224 static void *c_start(struct seq_file *m, loff_t *pos) 89 unsigned int fdt, unsigned int << 90 unsigned int tlb1) << 91 { 225 { 92 unsigned long *src, *dst; !! 226 int i = *pos; 93 unsigned int offset = 0; << 94 227 95 /* If CONFIG_MTD_UCLINUX is defined, a !! 228 return i <= NR_CPUS? (void *) (i + 1): NULL; 96 * end of kernel. There are two positi !! 229 } 97 * The first is __init_end and the sec << 98 */ << 99 #ifdef CONFIG_MTD_UCLINUX << 100 int romfs_size; << 101 unsigned int romfs_base; << 102 char *old_klimit = klimit; << 103 230 104 romfs_base = (ram ? ram : (unsigned in !! 231 static void *c_next(struct seq_file *m, void *v, loff_t *pos) 105 romfs_size = PAGE_ALIGN(get_romfs_len( !! 232 { 106 if (!romfs_size) { !! 233 ++*pos; 107 romfs_base = (unsigned int)&__ !! 234 return c_start(m, pos); 108 romfs_size = PAGE_ALIGN(get_ro !! 235 } 109 } << 110 236 111 /* Move ROMFS out of BSS before cleari !! 237 static void c_stop(struct seq_file *m, void *v) 112 if (romfs_size > 0) { !! 238 { 113 memmove(&__bss_stop, (int *)ro !! 239 } 114 klimit += romfs_size; !! 240 115 } !! 241 struct seq_operations cpuinfo_op = { 116 #endif !! 242 start: c_start, >> 243 next: c_next, >> 244 stop: c_stop, >> 245 show: show_cpuinfo, >> 246 }; 117 247 118 /* clearing bss section */ !! 248 /* 119 memset(__bss_start, 0, __bss_stop-__bs !! 249 * We're called here very early in the boot. We determine the machine 120 memset(_ssbss, 0, _esbss-_ssbss); !! 250 * type and call the appropriate low-level setup functions. >> 251 * -- Cort <cort@fsmlabs.com> >> 252 * >> 253 * Note that the kernel may be running at an address which is different >> 254 * from the address that it was linked at, so we must use RELOC/PTRRELOC >> 255 * to access static data (including strings). -- paulus >> 256 */ >> 257 __init >> 258 unsigned long >> 259 early_init(int r3, int r4, int r5) >> 260 { >> 261 extern char __bss_start[], _end[]; >> 262 unsigned long phys; >> 263 unsigned long offset = reloc_offset(); >> 264 >> 265 /* Default */ >> 266 phys = offset + KERNELBASE; >> 267 >> 268 /* First zero the BSS -- use memset, some arches don't have >> 269 * caches on yet */ >> 270 memset_io(PTRRELOC(&__bss_start), 0, _end - __bss_start); >> 271 >> 272 /* >> 273 * Identify the CPU type and fix up code sections >> 274 * that depend on which cpu we have. >> 275 */ >> 276 identify_cpu(offset, 0); >> 277 do_cpu_ftr_fixups(offset); 121 278 122 /* initialize device tree for usage in early_p !! 279 #if defined(CONFIG_ALL_PPC) 123 early_init_devtree(_fdt_start); !! 280 reloc_got2(offset); 124 281 125 /* setup kernel_tlb after BSS cleaning !! 282 /* If we came here from BootX, clear the screen, 126 * Maybe worth to move to asm code */ !! 283 * set up some pointers and return. */ 127 kernel_tlb = tlb0 + tlb1; !! 284 if ((r3 == 0x426f6f58) && (r5 == 0)) 128 /* printk("TLB1 0x%08x, TLB0 0x%08x, t !! 285 bootx_init(r4, phys); 129 !! 286 >> 287 /* >> 288 * don't do anything on prep >> 289 * for now, don't use bootinfo because it breaks yaboot 0.5 >> 290 * and assume that if we didn't find a magic number, we have OF >> 291 */ >> 292 else if (*(unsigned long *)(0) != 0xdeadc0de) >> 293 phys = prom_init(r3, r4, (prom_entry)r5); 130 294 131 pr_info("Ramdisk addr 0x%08x, ", ram); !! 295 reloc_got2(-offset); 132 if (fdt) !! 296 #endif 133 pr_info("FDT at 0x%08x\n", fdt << 134 else << 135 pr_info("Compiled-in FDT at %p << 136 297 137 #ifdef CONFIG_MTD_UCLINUX !! 298 return phys; 138 pr_info("Found romfs @ 0x%08x (0x%08x) !! 299 } 139 romfs_base, romfs_size << 140 pr_info("#### klimit %p ####\n", old_k << 141 BUG_ON(romfs_size < 0); /* What else c << 142 300 143 pr_info("Moved 0x%08x bytes from 0x%08 !! 301 #ifdef CONFIG_ALL_PPC 144 romfs_size, romfs_base !! 302 void __init >> 303 intuit_machine_type(void) >> 304 { >> 305 char *model; >> 306 struct device_node *root; 145 307 146 pr_info("New klimit: 0x%08x\n", (unsig !! 308 /* ask the OF info if we're a chrp or pmac */ >> 309 root = find_path_device("/"); >> 310 if (root != 0) { >> 311 /* assume pmac unless proven to be chrp -- Cort */ >> 312 _machine = _MACH_Pmac; >> 313 model = get_property(root, "device_type", NULL); >> 314 if (model && !strncmp("chrp", model, 4)) >> 315 _machine = _MACH_chrp; >> 316 else { >> 317 model = get_property(root, "model", NULL); >> 318 if (model && !strncmp(model, "IBM", 3)) >> 319 _machine = _MACH_chrp; >> 320 } >> 321 } >> 322 } >> 323 >> 324 /* >> 325 * The ALL_PPC version of platform_init... >> 326 */ >> 327 void __init >> 328 platform_init(unsigned long r3, unsigned long r4, unsigned long r5, >> 329 unsigned long r6, unsigned long r7) >> 330 { >> 331 #ifdef CONFIG_BOOTX_TEXT >> 332 if (boot_text_mapped) { >> 333 btext_clearscreen(); >> 334 btext_welcome(); >> 335 } 147 #endif 336 #endif 148 337 149 #if CONFIG_XILINX_MICROBLAZE0_USE_MSR_INSTR !! 338 parse_bootinfo(find_bootinfo()); 150 if (msr) { !! 339 151 pr_info("!!!Your kernel has se !! 340 /* if we didn't get any bootinfo telling us what we are... */ 152 pr_cont("CPU don't have it %x\ !! 341 if (_machine == 0) { >> 342 /* prep boot loader tells us if we're prep or not */ >> 343 if ( *(unsigned long *)(KERNELBASE) == (0xdeadc0de) ) >> 344 _machine = _MACH_prep; 153 } 345 } 154 #else !! 346 155 if (!msr) { !! 347 /* not much more to do here, if prep */ 156 pr_info("!!!Your kernel not se !! 348 if (_machine == _MACH_prep) { 157 pr_cont("CPU have it %x\n", ms !! 349 prep_init(r3, r4, r5, r6, r7); >> 350 return; 158 } 351 } 159 #endif << 160 352 161 /* Do not copy reset vectors. offset = !! 353 /* prom_init has already been called from __start */ 162 * two instructions. dst is pointer to !! 354 if (boot_infos) 163 * in block ram. If you want to copy r !! 355 relocate_nodes(); 164 #if !CONFIG_MANUAL_RESET_VECTOR !! 356 165 offset = 0x2; !! 357 /* If we aren't PReP, we can find out if we're Pmac >> 358 * or CHRP with this. */ >> 359 if (_machine == 0) >> 360 intuit_machine_type(); >> 361 >> 362 /* finish_device_tree may need _machine defined. */ >> 363 finish_device_tree(); >> 364 >> 365 /* >> 366 * If we were booted via quik, r3 points to the physical >> 367 * address of the command-line parameters. >> 368 * If we were booted from an xcoff image (i.e. netbooted or >> 369 * booted from floppy), we get the command line from the >> 370 * bootargs property of the /chosen node. >> 371 * If an initial ramdisk is present, r3 and r4 >> 372 * are used for initrd_start and initrd_size, >> 373 * otherwise they contain 0xdeadbeef. >> 374 */ >> 375 if (r3 >= 0x4000 && r3 < 0x800000 && r4 == 0) { >> 376 cmd_line[0] = 0; >> 377 strncpy(cmd_line, (char *)r3 + KERNELBASE, >> 378 sizeof(cmd_line)); >> 379 } else if (boot_infos != 0) { >> 380 /* booted by BootX - check for ramdisk */ >> 381 if (boot_infos->kernelParamsOffset != 0) >> 382 strncpy(cmd_line, (char *) boot_infos >> 383 + boot_infos->kernelParamsOffset, >> 384 sizeof(cmd_line)); >> 385 #ifdef CONFIG_BLK_DEV_INITRD >> 386 if (boot_infos->ramDisk) { >> 387 initrd_start = (unsigned long) boot_infos >> 388 + boot_infos->ramDisk; >> 389 initrd_end = initrd_start + boot_infos->ramDiskSize; >> 390 initrd_below_start_ok = 1; >> 391 } >> 392 #endif >> 393 } else { >> 394 struct device_node *chosen; >> 395 char *p; >> 396 >> 397 #ifdef CONFIG_BLK_DEV_INITRD >> 398 if (r3 && r4 && r4 != 0xdeadbeef) { >> 399 if (r3 < KERNELBASE) >> 400 r3 += KERNELBASE; >> 401 initrd_start = r3; >> 402 initrd_end = r3 + r4; >> 403 ROOT_DEV = MKDEV(RAMDISK_MAJOR, 0); >> 404 initrd_below_start_ok = 1; >> 405 } 166 #endif 406 #endif 167 dst = (unsigned long *) (offset * size !! 407 chosen = find_devices("chosen"); 168 for (src = __ivt_start + offset; src < !! 408 if (chosen != NULL) { 169 *dst = *src; !! 409 p = get_property(chosen, "bootargs", NULL); >> 410 if (p && *p) { >> 411 cmd_line[0] = 0; >> 412 strncpy(cmd_line, p, sizeof(cmd_line)); >> 413 } >> 414 } >> 415 } >> 416 cmd_line[sizeof(cmd_line) - 1] = 0; >> 417 >> 418 switch (_machine) { >> 419 case _MACH_Pmac: >> 420 pmac_init(r3, r4, r5, r6, r7); >> 421 break; >> 422 case _MACH_chrp: >> 423 chrp_init(r3, r4, r5, r6, r7); >> 424 break; >> 425 } >> 426 } >> 427 #endif /* CONFIG_ALL_PPC */ >> 428 >> 429 #ifndef CONFIG_APUS >> 430 struct bi_record *find_bootinfo(void) >> 431 { >> 432 struct bi_record *rec; >> 433 extern char __bss_start[]; >> 434 >> 435 rec = (struct bi_record *)_ALIGN((ulong)__bss_start+(1<<20)-1,(1<<20)); >> 436 if ( rec->tag != BI_FIRST ) { >> 437 /* >> 438 * This 0x10000 offset is a terrible hack but it will go away when >> 439 * we have the bootloader handle all the relocation and >> 440 * prom calls -- Cort >> 441 */ >> 442 rec = (struct bi_record *)_ALIGN((ulong)__bss_start+0x10000+(1<<20)-1,(1<<20)); >> 443 if ( rec->tag != BI_FIRST ) >> 444 return NULL; >> 445 } >> 446 return rec; >> 447 } 170 448 171 /* Initialize global data */ !! 449 void parse_bootinfo(struct bi_record *rec) 172 per_cpu(KM, 0) = 0x1; /* We start in !! 450 { 173 per_cpu(CURRENT_SAVE, 0) = (unsigned l !! 451 if (rec == NULL || rec->tag != BI_FIRST) >> 452 return; >> 453 while (rec->tag != BI_LAST) { >> 454 ulong *data = rec->data; >> 455 switch (rec->tag) { >> 456 case BI_CMD_LINE: >> 457 memcpy(cmd_line, (void *)data, rec->size - >> 458 sizeof(struct bi_record)); >> 459 break; >> 460 case BI_SYSMAP: >> 461 sysmap = (char *)((data[0] >= (KERNELBASE)) ? data[0] : >> 462 (data[0]+KERNELBASE)); >> 463 sysmap_size = data[1]; >> 464 break; >> 465 #ifdef CONFIG_BLK_DEV_INITRD >> 466 case BI_INITRD: >> 467 initrd_start = data[0] + KERNELBASE; >> 468 initrd_end = data[0] + data[1] + KERNELBASE; >> 469 break; >> 470 #endif /* CONFIG_BLK_DEV_INITRD */ >> 471 #ifdef CONFIG_ALL_PPC >> 472 case BI_MACHTYPE: >> 473 _machine = data[0]; >> 474 break; >> 475 #endif /* CONFIG_ALL_PPC */ >> 476 case BI_MEMSIZE: >> 477 boot_mem_size = data[0]; >> 478 break; >> 479 case BI_BOARD_INFO: >> 480 /* data is typically a bd_t */ >> 481 if (ppc_md.board_info) >> 482 ppc_md.board_info((void *)data, >> 483 rec->size - sizeof(struct bi_record)); >> 484 break; >> 485 } >> 486 rec = (struct bi_record *)((ulong)rec + rec->size); >> 487 } 174 } 488 } >> 489 #endif /* CONFIG_APUS */ 175 490 176 void __init time_init(void) !! 491 /* >> 492 * Find out what kind of machine we're on and save any data we need >> 493 * from the early boot process (devtree is copied on pmac by prom_init()). >> 494 * This is called very early on the boot process, after a minimal >> 495 * MMU environment has been set up but before MMU_init is called. >> 496 */ >> 497 void __init >> 498 machine_init(unsigned long r3, unsigned long r4, unsigned long r5, >> 499 unsigned long r6, unsigned long r7) 177 { 500 { 178 of_clk_init(NULL); !! 501 #ifdef CONFIG_CMDLINE 179 setup_cpuinfo_clk(); !! 502 strcpy(cmd_line, CONFIG_CMDLINE); 180 timer_probe(); !! 503 #endif /* CONFIG_CMDLINE */ >> 504 >> 505 platform_init(r3, r4, r5, r6, r7); >> 506 >> 507 if (ppc_md.progress) >> 508 ppc_md.progress("id mach(): done", 0x200); 181 } 509 } 182 510 183 #ifdef CONFIG_DEBUG_FS !! 511 /* Checks "l2cr=xxxx" command-line option */ 184 struct dentry *of_debugfs_root; !! 512 int __init ppc_setup_l2cr(char *str) >> 513 { >> 514 if (cur_cpu_spec[0]->cpu_features & CPU_FTR_L2CR) { >> 515 unsigned long val = simple_strtoul(str, NULL, 0); >> 516 printk(KERN_INFO "l2cr set to %lx\n", val); >> 517 _set_L2CR(0); /* force invalidate by disable cache */ >> 518 _set_L2CR(val); /* and enable it */ >> 519 } >> 520 return 1; >> 521 } >> 522 __setup("l2cr=", ppc_setup_l2cr); 185 523 186 static int microblaze_debugfs_init(void) !! 524 void __init arch_discover_root(void) 187 { 525 { 188 of_debugfs_root = debugfs_create_dir(" !! 526 if (ppc_md.discover_root != NULL) 189 return 0; !! 527 ppc_md.discover_root(); 190 } 528 } 191 arch_initcall(microblaze_debugfs_init); << 192 529 193 static int __init debugfs_tlb(void) !! 530 void __init ppc_init(void) 194 { 531 { 195 debugfs_create_u32("tlb_skip", S_IRUGO !! 532 /* clear the progress line */ 196 return 0; !! 533 if ( ppc_md.progress ) ppc_md.progress(" ", 0xffff); >> 534 >> 535 if (ppc_md.init != NULL) { >> 536 ppc_md.init(); >> 537 } 197 } 538 } 198 device_initcall(debugfs_tlb); !! 539 >> 540 /* Warning, IO base is not yet inited */ >> 541 void __init setup_arch(char **cmdline_p) >> 542 { >> 543 extern int panic_timeout; >> 544 extern char _etext[], _edata[]; >> 545 extern char *klimit; >> 546 extern void do_init_bootmem(void); >> 547 >> 548 /* so udelay does something sensible, assume <= 1000 bogomips */ >> 549 loops_per_jiffy = 500000000 / HZ; >> 550 >> 551 #ifdef CONFIG_ALL_PPC >> 552 /* This could be called "early setup arch", it must be done >> 553 * now because xmon need it >> 554 */ >> 555 if (_machine == _MACH_Pmac) >> 556 pmac_feature_init(); /* New cool way */ >> 557 #endif /* CONFIG_ALL_PPC */ >> 558 >> 559 #ifdef CONFIG_XMON >> 560 xmon_map_scc(); >> 561 if (strstr(cmd_line, "xmon")) >> 562 xmon(0); >> 563 #endif /* CONFIG_XMON */ >> 564 if ( ppc_md.progress ) ppc_md.progress("setup_arch: enter", 0x3eab); >> 565 >> 566 #if defined(CONFIG_KGDB) >> 567 kgdb_map_scc(); >> 568 set_debug_traps(); >> 569 if (strstr(cmd_line, "gdb")) { >> 570 if (ppc_md.progress) >> 571 ppc_md.progress("setup_arch: kgdb breakpoint", 0x4000); >> 572 printk("kgdb breakpoint activated\n"); >> 573 breakpoint(); >> 574 } >> 575 #endif >> 576 >> 577 /* >> 578 * Set cache line size based on type of cpu as a default. >> 579 * Systems with OF can look in the properties on the cpu node(s) >> 580 * for a possibly more accurate value. >> 581 */ >> 582 if (cur_cpu_spec[0]->cpu_features & CPU_FTR_SPLIT_ID_CACHE) { >> 583 dcache_bsize = cur_cpu_spec[0]->dcache_bsize; >> 584 icache_bsize = cur_cpu_spec[0]->icache_bsize; >> 585 ucache_bsize = 0; >> 586 } else >> 587 ucache_bsize = dcache_bsize = icache_bsize >> 588 = cur_cpu_spec[0]->dcache_bsize; >> 589 >> 590 /* reboot on panic */ >> 591 panic_timeout = 180; >> 592 >> 593 init_mm.start_code = PAGE_OFFSET; >> 594 init_mm.end_code = (unsigned long) _etext; >> 595 init_mm.end_data = (unsigned long) _edata; >> 596 init_mm.brk = (unsigned long) klimit; >> 597 >> 598 /* Save unparsed command line copy for /proc/cmdline */ >> 599 strcpy(saved_command_line, cmd_line); >> 600 *cmdline_p = cmd_line; >> 601 >> 602 /* set up the bootmem stuff with available memory */ >> 603 do_init_bootmem(); >> 604 if ( ppc_md.progress ) ppc_md.progress("setup_arch: bootmem", 0x3eab); >> 605 >> 606 #ifdef CONFIG_PPC_OCP >> 607 /* Initialize OCP device list */ >> 608 ocp_early_init(); >> 609 if ( ppc_md.progress ) ppc_md.progress("setup_arch: ocp_early_init", 0x3eab); 199 #endif 610 #endif >> 611 >> 612 ppc_md.setup_arch(); >> 613 if ( ppc_md.progress ) ppc_md.progress("arch: exit", 0x3eab); >> 614 >> 615 paging_init(); >> 616 sort_exception_table(); >> 617 >> 618 /* this is for modules since _machine can be a define -- Cort */ >> 619 ppc_md.ppc_machine = _machine; >> 620 } 200 621
Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.