X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=arch%2Fpowerpc%2Fkernel%2Fsetup_32.c;h=db72a92943bf63e4cb9f1c1e583f027a6be06698;hb=987b0145d94eecf292d8b301228356f44611ab7c;hp=69ac2570134425dd108d372fe030fcb9d271483e;hpb=f7ed79d23a47594e7834d66a8f14449796d4f3e6;p=linux-2.6.git diff --git a/arch/powerpc/kernel/setup_32.c b/arch/powerpc/kernel/setup_32.c index 69ac25701..db72a9294 100644 --- a/arch/powerpc/kernel/setup_32.c +++ b/arch/powerpc/kernel/setup_32.c @@ -50,8 +50,12 @@ #include #endif +extern void platform_init(void); extern void bootx_init(unsigned long r4, unsigned long phys); +extern void ppc6xx_idle(void); +extern void power4_idle(void); + boot_infos_t *boot_infos; struct ide_machdep_calls ppc_ide_md; @@ -66,6 +70,10 @@ unsigned int DMA_MODE_WRITE; int have_of = 1; #ifdef CONFIG_PPC_MULTIPLATFORM +extern void prep_init(void); +extern void pmac_init(void); +extern void chrp_init(void); + dev_t boot_dev; #endif /* CONFIG_PPC_MULTIPLATFORM */ @@ -77,6 +85,9 @@ unsigned long SYSRQ_KEY = 0x54; unsigned long vgacon_remap_base; #endif +struct machdep_calls ppc_md; +EXPORT_SYMBOL(ppc_md); + /* * These are used in binfmt_elf.c to put aux entries on the stack * for each elf executable being started. @@ -100,7 +111,7 @@ unsigned long __init early_init(unsigned long dt_ptr) /* First zero the BSS -- use memset_io, some platforms don't have * caches on yet */ - memset_io((void __iomem *)PTRRELOC(&__bss_start), 0, _end - __bss_start); + memset_io(PTRRELOC(&__bss_start), 0, _end - __bss_start); /* * Identify the CPU type and fix up code sections @@ -112,6 +123,48 @@ unsigned long __init early_init(unsigned long dt_ptr) return KERNELBASE + offset; } +#ifdef CONFIG_PPC_MULTIPLATFORM +/* + * The PPC_MULTIPLATFORM version of platform_init... + */ +void __init platform_init(void) +{ + /* if we didn't get any bootinfo telling us what we are... */ + if (_machine == 0) { + /* prep boot loader tells us if we're prep or not */ + if ( *(unsigned long *)(KERNELBASE) == (0xdeadc0de) ) + _machine = _MACH_prep; + } + +#ifdef CONFIG_PPC_PREP + /* not much more to do here, if prep */ + if (_machine == _MACH_prep) { + prep_init(); + return; + } +#endif + +#ifdef CONFIG_ADB + if (strstr(cmd_line, "adb_sync")) { + extern int __adb_probe_sync; + __adb_probe_sync = 1; + } +#endif /* CONFIG_ADB */ + + switch (_machine) { +#ifdef CONFIG_PPC_PMAC + case _MACH_Pmac: + pmac_init(); + break; +#endif +#ifdef CONFIG_PPC_CHRP + case _MACH_chrp: + chrp_init(); + break; +#endif + } +} +#endif /* * Find out what kind of machine we're on and save any data we need @@ -137,12 +190,11 @@ void __init machine_init(unsigned long dt_ptr, unsigned long phys) strlcpy(cmd_line, CONFIG_CMDLINE, sizeof(cmd_line)); #endif /* CONFIG_CMDLINE */ - probe_machine(); + /* Base init based on machine type */ + platform_init(); #ifdef CONFIG_6xx - if (cpu_has_feature(CPU_FTR_CAN_DOZE) || - cpu_has_feature(CPU_FTR_CAN_NAP)) - ppc_md.power_save = ppc6xx_idle; + ppc_md.power_save = ppc6xx_idle; #endif if (ppc_md.progress) @@ -220,8 +272,9 @@ int __init ppc_init(void) if ( ppc_md.progress ) ppc_md.progress(" ", 0xffff); /* register CPU devices */ - for_each_possible_cpu(i) - register_cpu(&cpu_devices[i], i, NULL); + for (i = 0; i < NR_CPUS; i++) + if (cpu_possible(i)) + register_cpu(&cpu_devices[i], i, NULL); /* call platform init */ if (ppc_md.init != NULL) { @@ -300,6 +353,12 @@ void __init setup_arch(char **cmdline_p) do_init_bootmem(); if ( ppc_md.progress ) ppc_md.progress("setup_arch: bootmem", 0x3eab); +#ifdef CONFIG_PPC_OCP + /* Initialize OCP device list */ + ocp_early_init(); + if ( ppc_md.progress ) ppc_md.progress("ocp: exit", 0x3eab); +#endif + #ifdef CONFIG_DUMMY_CONSOLE conswitchp = &dummy_con; #endif @@ -308,4 +367,7 @@ void __init setup_arch(char **cmdline_p) if ( ppc_md.progress ) ppc_md.progress("arch: exit", 0x3eab); paging_init(); + + /* this is for modules since _machine can be a define -- Cort */ + ppc_md.ppc_machine = _machine; }