27 #include <linux/errno.h>
28 #include <linux/sched.h>
29 #include <linux/kernel.h>
31 #include <linux/stddef.h>
33 #include <linux/ptrace.h>
34 #include <linux/export.h>
36 #include <linux/tty.h>
37 #include <linux/string.h>
44 #include <linux/pci.h>
45 #include <linux/adb.h>
46 #include <linux/cuda.h>
47 #include <linux/pmu.h>
51 #include <linux/bitops.h>
58 #include <asm/sections.h>
60 #include <asm/pgtable.h>
62 #include <asm/pci-bridge.h>
65 #include <asm/machdep.h>
67 #include <asm/cputable.h>
68 #include <asm/btext.h>
71 #include <asm/mmu_context.h>
72 #include <asm/iommu.h>
79 #undef SHOW_GATWICK_IRQS
87 static int current_root_goodness = -1;
89 extern struct machdep_calls
pmac_md;
91 #define DEFAULT_ROOT_DEVICE Root_SDA1
100 #ifdef CONFIG_PMAC_SMU
101 unsigned long smu_cmdbuf_abs;
105 static void pmac_show_cpuinfo(
struct seq_file *
m)
111 unsigned int mbflags;
114 mbmodel = pmac_call_feature(PMAC_FTR_GET_MB_INFO,
NULL,
115 PMAC_MB_INFO_MODEL, 0);
116 mbflags = pmac_call_feature(PMAC_FTR_GET_MB_INFO,
NULL,
117 PMAC_MB_INFO_FLAGS, 0);
118 if (pmac_call_feature(PMAC_FTR_GET_MB_INFO,
NULL, PMAC_MB_INFO_NAME,
119 (
long) &mbname) != 0)
147 seq_printf(m,
"detected as\t: %d (%s)\n", mbmodel, mbname);
148 seq_printf(m,
"pmac flags\t: %08x\n", mbflags);
155 const unsigned int *ic =
157 const unsigned int *
dc =
165 seq_printf(m,
" %dK instruction", *ic / 1024);
168 (ic?
" +":
""), *dc / 1024);
182 #ifndef CONFIG_ADB_CUDA
190 printk(
"WARNING ! Your machine is CUDA-based but your kernel\n");
191 printk(
" wasn't compiled with CONFIG_ADB_CUDA option !\n");
196 #ifndef CONFIG_ADB_PMU
204 printk(
"WARNING ! Your machine is PMU-based but your kernel\n");
205 printk(
" wasn't compiled with CONFIG_ADB_PMU option !\n");
210 #ifndef CONFIG_PMAC_SMU
219 static volatile u32 *sysctrl_regs;
221 static void __init ohare_init(
void)
227 sysctrl_regs = (
volatile u32 *)
ioremap(0xf8000000, 0x1000);
237 if (((sysctrl_regs[2] >> 24) & 0xf) >= 3) {
238 if (sysctrl_regs[4] & 0x10)
239 sysctrl_regs[4] |= 0x04000020;
241 sysctrl_regs[4] |= 0x04000000;
248 static void __init l2cr_init(
void)
256 const unsigned int *l2cr =
270 "backside cache is %s\n",
273 ?
"enabled" :
"disabled");
277 static void __init pmac_setup_arch(
void)
292 if (pvr >= 0x30 && pvr < 0x80)
295 else if (pvr == 4 || pvr >= 8)
324 #if defined(CONFIG_NVRAM) || defined(CONFIG_NVRAM_MODULE) || \
325 defined(CONFIG_PPC64)
330 #ifdef CONFIG_BLK_DEV_INITRD
339 if (
strstr(cmd_line,
"adb_sync")) {
341 __adb_probe_sync = 1;
353 static int initializing = 1;
355 static int pmac_late_init(
void)
374 if ((goodness <= current_root_goodness) &&
382 current_root_goodness = goodness;
385 #ifdef CONFIG_ADB_CUDA
405 #define cuda_restart()
406 #define cuda_shutdown()
409 #ifndef CONFIG_ADB_PMU
410 #define pmu_restart()
411 #define pmu_shutdown()
414 #ifndef CONFIG_PMAC_SMU
415 #define smu_restart()
416 #define smu_shutdown()
419 static void pmac_restart(
char *
cmd)
422 case SYS_CTRLER_CUDA:
435 static void pmac_power_off(
void)
438 case SYS_CTRLER_CUDA:
460 static void __init pmac_init_early(
void)
463 if (
strstr(cmd_line,
"btextdbg")) {
488 static int __init pmac_declare_of_platform_devices(
void)
492 if (machine_is(chrp))
497 of_platform_device_create(np,
"valkyrie",
NULL);
502 of_platform_device_create(np,
"platinum",
NULL);
507 of_platform_device_create(np,
"smu",
NULL);
516 of_platform_device_create(np,
"temperature",
NULL);
524 #ifdef CONFIG_SERIAL_PMACZILOG_CONSOLE
531 static int __init check_pmac_serial_console(
void)
536 #ifdef CONFIG_SERIAL_PMACZILOG_TTYS
537 char *devname =
"ttyS";
539 char *devname =
"ttyPZ";
542 pr_debug(
" -> check_pmac_serial_console()\n");
546 pr_debug(
" console was specified !\n");
559 pr_debug(
" no linux,stdout-path !\n");
564 pr_debug(
" can't find stdout package %s !\n", name);
571 pr_debug(
" stdout package has no name !\n");
575 if (
strcmp(name,
"ch-a") == 0)
577 else if (
strcmp(name,
"ch-b") == 0)
581 of_node_put(prom_stdout);
583 pr_debug(
"Found serial console at %s%d\n", devname, offset);
588 pr_debug(
"No preferred console found !\n");
589 of_node_put(prom_stdout);
599 static int __init pmac_probe(
void)
601 unsigned long root = of_get_flat_dt_root();
603 if (!of_flat_dt_is_compatible(root,
"Power Macintosh") &&
604 !of_flat_dt_is_compatible(root,
"MacRISC"))
626 #ifdef CONFIG_PMAC_SMU
640 static int pmac_pci_probe_mode(
struct pci_bus *
bus)
651 return PCI_PROBE_NORMAL;
652 return PCI_PROBE_DEVTREE;
659 .setup_arch = pmac_setup_arch,
660 .init_early = pmac_init_early,
661 .show_cpuinfo = pmac_show_cpuinfo,
665 .restart = pmac_restart,
666 .power_off = pmac_power_off,
676 .pci_probe_mode = pmac_pci_probe_mode,
677 .power_save = power4_idle,
678 .enable_pmcs = power4_enable_pmcs,