xref: /openbmc/linux/arch/powerpc/platforms/powermac/setup.c (revision f90bb153b1493719d18b4529a46ebfe43220ea6c)
1f6d57916SPaul Mackerras /*
235499c01SPaul Mackerras  *  Powermac setup and early boot code plus other random bits.
3f6d57916SPaul Mackerras  *
4f6d57916SPaul Mackerras  *  PowerPC version
5f6d57916SPaul Mackerras  *    Copyright (C) 1995-1996 Gary Thomas (gdt@linuxppc.org)
6f6d57916SPaul Mackerras  *
7f6d57916SPaul Mackerras  *  Adapted for Power Macintosh by Paul Mackerras
835499c01SPaul Mackerras  *    Copyright (C) 1996 Paul Mackerras (paulus@samba.org)
9f6d57916SPaul Mackerras  *
10f6d57916SPaul Mackerras  *  Derived from "arch/alpha/kernel/setup.c"
11f6d57916SPaul Mackerras  *    Copyright (C) 1995 Linus Torvalds
12f6d57916SPaul Mackerras  *
13f6d57916SPaul Mackerras  *  Maintained by Benjamin Herrenschmidt (benh@kernel.crashing.org)
14f6d57916SPaul Mackerras  *
15f6d57916SPaul Mackerras  *  This program is free software; you can redistribute it and/or
16f6d57916SPaul Mackerras  *  modify it under the terms of the GNU General Public License
17f6d57916SPaul Mackerras  *  as published by the Free Software Foundation; either version
18f6d57916SPaul Mackerras  *  2 of the License, or (at your option) any later version.
19f6d57916SPaul Mackerras  *
20f6d57916SPaul Mackerras  */
21f6d57916SPaul Mackerras 
22f6d57916SPaul Mackerras /*
23f6d57916SPaul Mackerras  * bootup setup stuff..
24f6d57916SPaul Mackerras  */
25f6d57916SPaul Mackerras 
26f6d57916SPaul Mackerras #include <linux/init.h>
27f6d57916SPaul Mackerras #include <linux/errno.h>
28f6d57916SPaul Mackerras #include <linux/sched.h>
29f6d57916SPaul Mackerras #include <linux/kernel.h>
30f6d57916SPaul Mackerras #include <linux/mm.h>
31f6d57916SPaul Mackerras #include <linux/stddef.h>
32f6d57916SPaul Mackerras #include <linux/unistd.h>
33f6d57916SPaul Mackerras #include <linux/ptrace.h>
34f6d57916SPaul Mackerras #include <linux/slab.h>
35f6d57916SPaul Mackerras #include <linux/user.h>
36f6d57916SPaul Mackerras #include <linux/a.out.h>
37f6d57916SPaul Mackerras #include <linux/tty.h>
38f6d57916SPaul Mackerras #include <linux/string.h>
39f6d57916SPaul Mackerras #include <linux/delay.h>
40f6d57916SPaul Mackerras #include <linux/ioport.h>
41f6d57916SPaul Mackerras #include <linux/major.h>
42f6d57916SPaul Mackerras #include <linux/initrd.h>
43f6d57916SPaul Mackerras #include <linux/vt_kern.h>
44f6d57916SPaul Mackerras #include <linux/console.h>
45f6d57916SPaul Mackerras #include <linux/ide.h>
46f6d57916SPaul Mackerras #include <linux/pci.h>
47f6d57916SPaul Mackerras #include <linux/adb.h>
48f6d57916SPaul Mackerras #include <linux/cuda.h>
49f6d57916SPaul Mackerras #include <linux/pmu.h>
50f6d57916SPaul Mackerras #include <linux/irq.h>
51f6d57916SPaul Mackerras #include <linux/seq_file.h>
52f6d57916SPaul Mackerras #include <linux/root_dev.h>
53f6d57916SPaul Mackerras #include <linux/bitops.h>
54f6d57916SPaul Mackerras #include <linux/suspend.h>
55f6d57916SPaul Mackerras 
56f6d57916SPaul Mackerras #include <asm/reg.h>
57f6d57916SPaul Mackerras #include <asm/sections.h>
58f6d57916SPaul Mackerras #include <asm/prom.h>
59f6d57916SPaul Mackerras #include <asm/system.h>
60f6d57916SPaul Mackerras #include <asm/pgtable.h>
61f6d57916SPaul Mackerras #include <asm/io.h>
623d1229d6SMichael Ellerman #include <asm/kexec.h>
63f6d57916SPaul Mackerras #include <asm/pci-bridge.h>
64f6d57916SPaul Mackerras #include <asm/ohare.h>
65f6d57916SPaul Mackerras #include <asm/mediabay.h>
66f6d57916SPaul Mackerras #include <asm/machdep.h>
67f6d57916SPaul Mackerras #include <asm/dma.h>
68f6d57916SPaul Mackerras #include <asm/cputable.h>
69f6d57916SPaul Mackerras #include <asm/btext.h>
70f6d57916SPaul Mackerras #include <asm/pmac_feature.h>
71f6d57916SPaul Mackerras #include <asm/time.h>
72f6d57916SPaul Mackerras #include <asm/of_device.h>
73f6d57916SPaul Mackerras #include <asm/mmu_context.h>
7435499c01SPaul Mackerras #include <asm/iommu.h>
7535499c01SPaul Mackerras #include <asm/smu.h>
7635499c01SPaul Mackerras #include <asm/pmc.h>
77fbf1769dSPaul Mackerras #include <asm/lmb.h>
7851d3082fSBenjamin Herrenschmidt #include <asm/udbg.h>
79f6d57916SPaul Mackerras 
803c3f42d6SPaul Mackerras #include "pmac.h"
81f6d57916SPaul Mackerras 
82f6d57916SPaul Mackerras #undef SHOW_GATWICK_IRQS
83f6d57916SPaul Mackerras 
84f6d57916SPaul Mackerras int ppc_override_l2cr = 0;
85f6d57916SPaul Mackerras int ppc_override_l2cr_value;
86f6d57916SPaul Mackerras int has_l2cache = 0;
87f6d57916SPaul Mackerras 
88d2515c80SOlaf Hering int pmac_newworld;
89f6d57916SPaul Mackerras 
90f6d57916SPaul Mackerras static int current_root_goodness = -1;
91f6d57916SPaul Mackerras 
9235499c01SPaul Mackerras extern struct machdep_calls pmac_md;
93f6d57916SPaul Mackerras 
94f6d57916SPaul Mackerras #define DEFAULT_ROOT_DEVICE Root_SDA1	/* sda1 - slightly silly choice */
95f6d57916SPaul Mackerras 
9635499c01SPaul Mackerras #ifdef CONFIG_PPC64
9735499c01SPaul Mackerras #include <asm/udbg.h>
9835499c01SPaul Mackerras int sccdbg;
99f6d57916SPaul Mackerras #endif
100f6d57916SPaul Mackerras 
10135499c01SPaul Mackerras extern void zs_kgdb_hook(int tty_num);
10235499c01SPaul Mackerras 
103f6d57916SPaul Mackerras sys_ctrler_t sys_ctrler = SYS_CTRLER_UNKNOWN;
10435499c01SPaul Mackerras EXPORT_SYMBOL(sys_ctrler);
10535499c01SPaul Mackerras 
10635499c01SPaul Mackerras #ifdef CONFIG_PMAC_SMU
10735499c01SPaul Mackerras unsigned long smu_cmdbuf_abs;
10835499c01SPaul Mackerras EXPORT_SYMBOL(smu_cmdbuf_abs);
10935499c01SPaul Mackerras #endif
110f6d57916SPaul Mackerras 
111f6d57916SPaul Mackerras #ifdef CONFIG_SMP
112f6d57916SPaul Mackerras extern struct smp_ops_t psurge_smp_ops;
113f6d57916SPaul Mackerras extern struct smp_ops_t core99_smp_ops;
114f6d57916SPaul Mackerras #endif /* CONFIG_SMP */
115f6d57916SPaul Mackerras 
1160dd194d0SPaul Mackerras static void pmac_show_cpuinfo(struct seq_file *m)
117f6d57916SPaul Mackerras {
118f6d57916SPaul Mackerras 	struct device_node *np;
119018a3d1dSJeremy Kerr 	const char *pp;
120f6d57916SPaul Mackerras 	int plen;
1210dd194d0SPaul Mackerras 	int mbmodel;
1220dd194d0SPaul Mackerras 	unsigned int mbflags;
123f6d57916SPaul Mackerras 	char* mbname;
124f6d57916SPaul Mackerras 
1250dd194d0SPaul Mackerras 	mbmodel = pmac_call_feature(PMAC_FTR_GET_MB_INFO, NULL,
1260dd194d0SPaul Mackerras 				    PMAC_MB_INFO_MODEL, 0);
1270dd194d0SPaul Mackerras 	mbflags = pmac_call_feature(PMAC_FTR_GET_MB_INFO, NULL,
1280dd194d0SPaul Mackerras 				    PMAC_MB_INFO_FLAGS, 0);
1290dd194d0SPaul Mackerras 	if (pmac_call_feature(PMAC_FTR_GET_MB_INFO, NULL, PMAC_MB_INFO_NAME,
1300dd194d0SPaul Mackerras 			      (long) &mbname) != 0)
131f6d57916SPaul Mackerras 		mbname = "Unknown";
132f6d57916SPaul Mackerras 
133f6d57916SPaul Mackerras 	/* find motherboard type */
134f6d57916SPaul Mackerras 	seq_printf(m, "machine\t\t: ");
1350dd194d0SPaul Mackerras 	np = of_find_node_by_path("/");
136f6d57916SPaul Mackerras 	if (np != NULL) {
137018a3d1dSJeremy Kerr 		pp = get_property(np, "model", NULL);
138f6d57916SPaul Mackerras 		if (pp != NULL)
139f6d57916SPaul Mackerras 			seq_printf(m, "%s\n", pp);
140f6d57916SPaul Mackerras 		else
141f6d57916SPaul Mackerras 			seq_printf(m, "PowerMac\n");
142018a3d1dSJeremy Kerr 		pp = get_property(np, "compatible", &plen);
143f6d57916SPaul Mackerras 		if (pp != NULL) {
144f6d57916SPaul Mackerras 			seq_printf(m, "motherboard\t:");
145f6d57916SPaul Mackerras 			while (plen > 0) {
146f6d57916SPaul Mackerras 				int l = strlen(pp) + 1;
147f6d57916SPaul Mackerras 				seq_printf(m, " %s", pp);
148f6d57916SPaul Mackerras 				plen -= l;
149f6d57916SPaul Mackerras 				pp += l;
150f6d57916SPaul Mackerras 			}
151f6d57916SPaul Mackerras 			seq_printf(m, "\n");
152f6d57916SPaul Mackerras 		}
1530dd194d0SPaul Mackerras 		of_node_put(np);
154f6d57916SPaul Mackerras 	} else
155f6d57916SPaul Mackerras 		seq_printf(m, "PowerMac\n");
156f6d57916SPaul Mackerras 
157f6d57916SPaul Mackerras 	/* print parsed model */
158f6d57916SPaul Mackerras 	seq_printf(m, "detected as\t: %d (%s)\n", mbmodel, mbname);
159f6d57916SPaul Mackerras 	seq_printf(m, "pmac flags\t: %08x\n", mbflags);
160f6d57916SPaul Mackerras 
161f6d57916SPaul Mackerras 	/* find l2 cache info */
1620dd194d0SPaul Mackerras 	np = of_find_node_by_name(NULL, "l2-cache");
1630dd194d0SPaul Mackerras 	if (np == NULL)
1640dd194d0SPaul Mackerras 		np = of_find_node_by_type(NULL, "cache");
1650dd194d0SPaul Mackerras 	if (np != NULL) {
166018a3d1dSJeremy Kerr 		const unsigned int *ic = get_property(np, "i-cache-size", NULL);
167018a3d1dSJeremy Kerr 		const unsigned int *dc = get_property(np, "d-cache-size", NULL);
168f6d57916SPaul Mackerras 		seq_printf(m, "L2 cache\t:");
169f6d57916SPaul Mackerras 		has_l2cache = 1;
170f6d57916SPaul Mackerras 		if (get_property(np, "cache-unified", NULL) != 0 && dc) {
171f6d57916SPaul Mackerras 			seq_printf(m, " %dK unified", *dc / 1024);
172f6d57916SPaul Mackerras 		} else {
173f6d57916SPaul Mackerras 			if (ic)
174f6d57916SPaul Mackerras 				seq_printf(m, " %dK instruction", *ic / 1024);
175f6d57916SPaul Mackerras 			if (dc)
176f6d57916SPaul Mackerras 				seq_printf(m, "%s %dK data",
177f6d57916SPaul Mackerras 					   (ic? " +": ""), *dc / 1024);
178f6d57916SPaul Mackerras 		}
179f6d57916SPaul Mackerras 		pp = get_property(np, "ram-type", NULL);
180f6d57916SPaul Mackerras 		if (pp)
181f6d57916SPaul Mackerras 			seq_printf(m, " %s", pp);
182f6d57916SPaul Mackerras 		seq_printf(m, "\n");
1830dd194d0SPaul Mackerras 		of_node_put(np);
184f6d57916SPaul Mackerras 	}
185f6d57916SPaul Mackerras 
186f6d57916SPaul Mackerras 	/* Indicate newworld/oldworld */
187f6d57916SPaul Mackerras 	seq_printf(m, "pmac-generation\t: %s\n",
188f6d57916SPaul Mackerras 		   pmac_newworld ? "NewWorld" : "OldWorld");
189f6d57916SPaul Mackerras }
190f6d57916SPaul Mackerras 
19135499c01SPaul Mackerras #ifndef CONFIG_ADB_CUDA
19235499c01SPaul Mackerras int find_via_cuda(void)
19335499c01SPaul Mackerras {
19435499c01SPaul Mackerras 	if (!find_devices("via-cuda"))
19535499c01SPaul Mackerras 		return 0;
19635499c01SPaul Mackerras 	printk("WARNING ! Your machine is CUDA-based but your kernel\n");
19735499c01SPaul Mackerras 	printk("          wasn't compiled with CONFIG_ADB_CUDA option !\n");
19835499c01SPaul Mackerras 	return 0;
19935499c01SPaul Mackerras }
20035499c01SPaul Mackerras #endif
20135499c01SPaul Mackerras 
20235499c01SPaul Mackerras #ifndef CONFIG_ADB_PMU
20335499c01SPaul Mackerras int find_via_pmu(void)
20435499c01SPaul Mackerras {
20535499c01SPaul Mackerras 	if (!find_devices("via-pmu"))
20635499c01SPaul Mackerras 		return 0;
20735499c01SPaul Mackerras 	printk("WARNING ! Your machine is PMU-based but your kernel\n");
20835499c01SPaul Mackerras 	printk("          wasn't compiled with CONFIG_ADB_PMU option !\n");
209a575b807SPaul Mackerras 	return 0;
21035499c01SPaul Mackerras }
21135499c01SPaul Mackerras #endif
21235499c01SPaul Mackerras 
21335499c01SPaul Mackerras #ifndef CONFIG_PMAC_SMU
21435499c01SPaul Mackerras int smu_init(void)
21535499c01SPaul Mackerras {
21635499c01SPaul Mackerras 	/* should check and warn if SMU is present */
21735499c01SPaul Mackerras 	return 0;
21835499c01SPaul Mackerras }
21935499c01SPaul Mackerras #endif
22035499c01SPaul Mackerras 
22135499c01SPaul Mackerras #ifdef CONFIG_PPC32
222f6d57916SPaul Mackerras static volatile u32 *sysctrl_regs;
223f6d57916SPaul Mackerras 
22435499c01SPaul Mackerras static void __init ohare_init(void)
225f6d57916SPaul Mackerras {
226f6d57916SPaul Mackerras 	/* this area has the CPU identification register
227f6d57916SPaul Mackerras 	   and some registers used by smp boards */
228f6d57916SPaul Mackerras 	sysctrl_regs = (volatile u32 *) ioremap(0xf8000000, 0x1000);
229f6d57916SPaul Mackerras 
23035499c01SPaul Mackerras 	/*
23135499c01SPaul Mackerras 	 * Turn on the L2 cache.
23235499c01SPaul Mackerras 	 * We assume that we have a PSX memory controller iff
23335499c01SPaul Mackerras 	 * we have an ohare I/O controller.
23435499c01SPaul Mackerras 	 */
23535499c01SPaul Mackerras 	if (find_devices("ohare") != NULL) {
23635499c01SPaul Mackerras 		if (((sysctrl_regs[2] >> 24) & 0xf) >= 3) {
23735499c01SPaul Mackerras 			if (sysctrl_regs[4] & 0x10)
23835499c01SPaul Mackerras 				sysctrl_regs[4] |= 0x04000020;
23935499c01SPaul Mackerras 			else
24035499c01SPaul Mackerras 				sysctrl_regs[4] |= 0x04000000;
24135499c01SPaul Mackerras 			if(has_l2cache)
24235499c01SPaul Mackerras 				printk(KERN_INFO "Level 2 cache enabled\n");
24335499c01SPaul Mackerras 		}
24435499c01SPaul Mackerras 	}
24535499c01SPaul Mackerras }
246f6d57916SPaul Mackerras 
24735499c01SPaul Mackerras static void __init l2cr_init(void)
24835499c01SPaul Mackerras {
249f6d57916SPaul Mackerras 	/* Checks "l2cr-value" property in the registry */
250f6d57916SPaul Mackerras 	if (cpu_has_feature(CPU_FTR_L2CR)) {
251f6d57916SPaul Mackerras 		struct device_node *np = find_devices("cpus");
252f6d57916SPaul Mackerras 		if (np == 0)
253f6d57916SPaul Mackerras 			np = find_type_devices("cpu");
254f6d57916SPaul Mackerras 		if (np != 0) {
255018a3d1dSJeremy Kerr 			const unsigned int *l2cr =
256f6d57916SPaul Mackerras 				get_property(np, "l2cr-value", NULL);
257f6d57916SPaul Mackerras 			if (l2cr != 0) {
258f6d57916SPaul Mackerras 				ppc_override_l2cr = 1;
259f6d57916SPaul Mackerras 				ppc_override_l2cr_value = *l2cr;
260f6d57916SPaul Mackerras 				_set_L2CR(0);
261f6d57916SPaul Mackerras 				_set_L2CR(ppc_override_l2cr_value);
262f6d57916SPaul Mackerras 			}
263f6d57916SPaul Mackerras 		}
264f6d57916SPaul Mackerras 	}
265f6d57916SPaul Mackerras 
266f6d57916SPaul Mackerras 	if (ppc_override_l2cr)
26735499c01SPaul Mackerras 		printk(KERN_INFO "L2CR overridden (0x%x), "
26835499c01SPaul Mackerras 		       "backside cache is %s\n",
26935499c01SPaul Mackerras 		       ppc_override_l2cr_value,
27035499c01SPaul Mackerras 		       (ppc_override_l2cr_value & 0x80000000)
271f6d57916SPaul Mackerras 				? "enabled" : "disabled");
27235499c01SPaul Mackerras }
27335499c01SPaul Mackerras #endif
27435499c01SPaul Mackerras 
275ff38e7c8SArnd Bergmann static void __init pmac_setup_arch(void)
27635499c01SPaul Mackerras {
277a575b807SPaul Mackerras 	struct device_node *cpu, *ic;
278018a3d1dSJeremy Kerr 	const int *fp;
27935499c01SPaul Mackerras 	unsigned long pvr;
28035499c01SPaul Mackerras 
28135499c01SPaul Mackerras 	pvr = PVR_VER(mfspr(SPRN_PVR));
28235499c01SPaul Mackerras 
28335499c01SPaul Mackerras 	/* Set loops_per_jiffy to a half-way reasonable value,
28435499c01SPaul Mackerras 	   for use until calibrate_delay gets called. */
28535499c01SPaul Mackerras 	loops_per_jiffy = 50000000 / HZ;
28635499c01SPaul Mackerras 	cpu = of_find_node_by_type(NULL, "cpu");
28735499c01SPaul Mackerras 	if (cpu != NULL) {
288018a3d1dSJeremy Kerr 		fp = get_property(cpu, "clock-frequency", NULL);
28935499c01SPaul Mackerras 		if (fp != NULL) {
29035499c01SPaul Mackerras 			if (pvr >= 0x30 && pvr < 0x80)
29135499c01SPaul Mackerras 				/* PPC970 etc. */
29235499c01SPaul Mackerras 				loops_per_jiffy = *fp / (3 * HZ);
29335499c01SPaul Mackerras 			else if (pvr == 4 || pvr >= 8)
29435499c01SPaul Mackerras 				/* 604, G3, G4 etc. */
29535499c01SPaul Mackerras 				loops_per_jiffy = *fp / HZ;
29635499c01SPaul Mackerras 			else
29735499c01SPaul Mackerras 				/* 601, 603, etc. */
29835499c01SPaul Mackerras 				loops_per_jiffy = *fp / (2 * HZ);
29935499c01SPaul Mackerras 		}
30035499c01SPaul Mackerras 		of_node_put(cpu);
30135499c01SPaul Mackerras 	}
30235499c01SPaul Mackerras 
303a575b807SPaul Mackerras 	/* See if newworld or oldworld */
304bfab1019SPaul Mackerras 	for (ic = NULL; (ic = of_find_all_nodes(ic)) != NULL; )
305bfab1019SPaul Mackerras 		if (get_property(ic, "interrupt-controller", NULL))
306bfab1019SPaul Mackerras 			break;
307d2515c80SOlaf Hering 	if (ic) {
308d2515c80SOlaf Hering 		pmac_newworld = 1;
309a575b807SPaul Mackerras 		of_node_put(ic);
310d2515c80SOlaf Hering 	}
311a575b807SPaul Mackerras 
31235499c01SPaul Mackerras 	/* Lookup PCI hosts */
31335499c01SPaul Mackerras 	pmac_pci_init();
31435499c01SPaul Mackerras 
31535499c01SPaul Mackerras #ifdef CONFIG_PPC32
31635499c01SPaul Mackerras 	ohare_init();
31735499c01SPaul Mackerras 	l2cr_init();
31835499c01SPaul Mackerras #endif /* CONFIG_PPC32 */
31935499c01SPaul Mackerras 
320f6d57916SPaul Mackerras #ifdef CONFIG_KGDB
321f6d57916SPaul Mackerras 	zs_kgdb_hook(0);
322f6d57916SPaul Mackerras #endif
323f6d57916SPaul Mackerras 
324f6d57916SPaul Mackerras 	find_via_cuda();
325f6d57916SPaul Mackerras 	find_via_pmu();
32635499c01SPaul Mackerras 	smu_init();
32735499c01SPaul Mackerras 
32891c33d28SDavid Woodhouse #if defined(CONFIG_NVRAM) || defined(CONFIG_PPC64)
329f6d57916SPaul Mackerras 	pmac_nvram_init();
330f6d57916SPaul Mackerras #endif
33135499c01SPaul Mackerras 
33235499c01SPaul Mackerras #ifdef CONFIG_PPC32
333f6d57916SPaul Mackerras #ifdef CONFIG_BLK_DEV_INITRD
334f6d57916SPaul Mackerras 	if (initrd_start)
335f6d57916SPaul Mackerras 		ROOT_DEV = Root_RAM0;
336f6d57916SPaul Mackerras 	else
337f6d57916SPaul Mackerras #endif
338f6d57916SPaul Mackerras 		ROOT_DEV = DEFAULT_ROOT_DEVICE;
33935499c01SPaul Mackerras #endif
340f6d57916SPaul Mackerras 
341f6d57916SPaul Mackerras #ifdef CONFIG_SMP
342f6d57916SPaul Mackerras 	/* Check for Core99 */
3431beb6a7dSBenjamin Herrenschmidt 	if (find_devices("uni-n") || find_devices("u3") || find_devices("u4"))
3447ed476d1SPaul Mackerras 		smp_ops = &core99_smp_ops;
34535499c01SPaul Mackerras #ifdef CONFIG_PPC32
346f6d57916SPaul Mackerras 	else
3477ed476d1SPaul Mackerras 		smp_ops = &psurge_smp_ops;
34835499c01SPaul Mackerras #endif
349f6d57916SPaul Mackerras #endif /* CONFIG_SMP */
350e8222502SBenjamin Herrenschmidt 
351e8222502SBenjamin Herrenschmidt #ifdef CONFIG_ADB
352e8222502SBenjamin Herrenschmidt 	if (strstr(cmd_line, "adb_sync")) {
353e8222502SBenjamin Herrenschmidt 		extern int __adb_probe_sync;
354e8222502SBenjamin Herrenschmidt 		__adb_probe_sync = 1;
355e8222502SBenjamin Herrenschmidt 	}
356e8222502SBenjamin Herrenschmidt #endif /* CONFIG_ADB */
357f6d57916SPaul Mackerras }
358f6d57916SPaul Mackerras 
359f6d57916SPaul Mackerras char *bootpath;
360f6d57916SPaul Mackerras char *bootdevice;
361f6d57916SPaul Mackerras void *boot_host;
362f6d57916SPaul Mackerras int boot_target;
363f6d57916SPaul Mackerras int boot_part;
364fd6e7d2dSs.hauer@pengutronix.de static dev_t boot_dev;
365f6d57916SPaul Mackerras 
366f6d57916SPaul Mackerras #ifdef CONFIG_SCSI
36735499c01SPaul Mackerras void __init note_scsi_host(struct device_node *node, void *host)
368f6d57916SPaul Mackerras {
369f6d57916SPaul Mackerras 	int l;
370f6d57916SPaul Mackerras 	char *p;
371f6d57916SPaul Mackerras 
372f6d57916SPaul Mackerras 	l = strlen(node->full_name);
373f6d57916SPaul Mackerras 	if (bootpath != NULL && bootdevice != NULL
374f6d57916SPaul Mackerras 	    && strncmp(node->full_name, bootdevice, l) == 0
375f6d57916SPaul Mackerras 	    && (bootdevice[l] == '/' || bootdevice[l] == 0)) {
376f6d57916SPaul Mackerras 		boot_host = host;
377f6d57916SPaul Mackerras 		/*
378f6d57916SPaul Mackerras 		 * There's a bug in OF 1.0.5.  (Why am I not surprised.)
379f6d57916SPaul Mackerras 		 * If you pass a path like scsi/sd@1:0 to canon, it returns
380f6d57916SPaul Mackerras 		 * something like /bandit@F2000000/gc@10/53c94@10000/sd@0,0
381f6d57916SPaul Mackerras 		 * That is, the scsi target number doesn't get preserved.
382f6d57916SPaul Mackerras 		 * So we pick the target number out of bootpath and use that.
383f6d57916SPaul Mackerras 		 */
384f6d57916SPaul Mackerras 		p = strstr(bootpath, "/sd@");
385f6d57916SPaul Mackerras 		if (p != NULL) {
386f6d57916SPaul Mackerras 			p += 4;
387f6d57916SPaul Mackerras 			boot_target = simple_strtoul(p, NULL, 10);
388f6d57916SPaul Mackerras 			p = strchr(p, ':');
389f6d57916SPaul Mackerras 			if (p != NULL)
390f6d57916SPaul Mackerras 				boot_part = simple_strtoul(p + 1, NULL, 10);
391f6d57916SPaul Mackerras 		}
392f6d57916SPaul Mackerras 	}
393f6d57916SPaul Mackerras }
394f6d57916SPaul Mackerras EXPORT_SYMBOL(note_scsi_host);
395f6d57916SPaul Mackerras #endif
396f6d57916SPaul Mackerras 
397f6d57916SPaul Mackerras #if defined(CONFIG_BLK_DEV_IDE) && defined(CONFIG_BLK_DEV_IDE_PMAC)
39835499c01SPaul Mackerras static dev_t __init find_ide_boot(void)
399f6d57916SPaul Mackerras {
400f6d57916SPaul Mackerras 	char *p;
401f6d57916SPaul Mackerras 	int n;
402f6d57916SPaul Mackerras 	dev_t __init pmac_find_ide_boot(char *bootdevice, int n);
403f6d57916SPaul Mackerras 
404f6d57916SPaul Mackerras 	if (bootdevice == NULL)
405f6d57916SPaul Mackerras 		return 0;
406f6d57916SPaul Mackerras 	p = strrchr(bootdevice, '/');
407f6d57916SPaul Mackerras 	if (p == NULL)
408f6d57916SPaul Mackerras 		return 0;
409f6d57916SPaul Mackerras 	n = p - bootdevice;
410f6d57916SPaul Mackerras 
411f6d57916SPaul Mackerras 	return pmac_find_ide_boot(bootdevice, n);
412f6d57916SPaul Mackerras }
413f6d57916SPaul Mackerras #endif /* CONFIG_BLK_DEV_IDE && CONFIG_BLK_DEV_IDE_PMAC */
414f6d57916SPaul Mackerras 
41535499c01SPaul Mackerras static void __init find_boot_device(void)
416f6d57916SPaul Mackerras {
417f6d57916SPaul Mackerras #if defined(CONFIG_BLK_DEV_IDE) && defined(CONFIG_BLK_DEV_IDE_PMAC)
418f6d57916SPaul Mackerras 	boot_dev = find_ide_boot();
419f6d57916SPaul Mackerras #endif
420f6d57916SPaul Mackerras }
421f6d57916SPaul Mackerras 
422f6d57916SPaul Mackerras /* TODO: Merge the suspend-to-ram with the common code !!!
423f6d57916SPaul Mackerras  * currently, this is a stub implementation for suspend-to-disk
424f6d57916SPaul Mackerras  * only
425f6d57916SPaul Mackerras  */
426f6d57916SPaul Mackerras 
427f6d57916SPaul Mackerras #ifdef CONFIG_SOFTWARE_SUSPEND
428f6d57916SPaul Mackerras 
429f6d57916SPaul Mackerras static int pmac_pm_prepare(suspend_state_t state)
430f6d57916SPaul Mackerras {
431f6d57916SPaul Mackerras 	printk(KERN_DEBUG "%s(%d)\n", __FUNCTION__, state);
432f6d57916SPaul Mackerras 
433f6d57916SPaul Mackerras 	return 0;
434f6d57916SPaul Mackerras }
435f6d57916SPaul Mackerras 
436f6d57916SPaul Mackerras static int pmac_pm_enter(suspend_state_t state)
437f6d57916SPaul Mackerras {
438f6d57916SPaul Mackerras 	printk(KERN_DEBUG "%s(%d)\n", __FUNCTION__, state);
439f6d57916SPaul Mackerras 
440f6d57916SPaul Mackerras 	/* Giveup the lazy FPU & vec so we don't have to back them
441f6d57916SPaul Mackerras 	 * up from the low level code
442f6d57916SPaul Mackerras 	 */
443f6d57916SPaul Mackerras 	enable_kernel_fp();
444f6d57916SPaul Mackerras 
445f6d57916SPaul Mackerras #ifdef CONFIG_ALTIVEC
446f6d57916SPaul Mackerras 	if (cur_cpu_spec->cpu_features & CPU_FTR_ALTIVEC)
447f6d57916SPaul Mackerras 		enable_kernel_altivec();
448f6d57916SPaul Mackerras #endif /* CONFIG_ALTIVEC */
449f6d57916SPaul Mackerras 
450f6d57916SPaul Mackerras 	return 0;
451f6d57916SPaul Mackerras }
452f6d57916SPaul Mackerras 
453f6d57916SPaul Mackerras static int pmac_pm_finish(suspend_state_t state)
454f6d57916SPaul Mackerras {
455f6d57916SPaul Mackerras 	printk(KERN_DEBUG "%s(%d)\n", __FUNCTION__, state);
456f6d57916SPaul Mackerras 
457f6d57916SPaul Mackerras 	/* Restore userland MMU context */
4586218a761SPaul Mackerras 	set_context(current->active_mm->context.id, current->active_mm->pgd);
459f6d57916SPaul Mackerras 
460f6d57916SPaul Mackerras 	return 0;
461f6d57916SPaul Mackerras }
462f6d57916SPaul Mackerras 
4630fba3a1fSJohannes Berg static int pmac_pm_valid(suspend_state_t state)
4640fba3a1fSJohannes Berg {
4650fba3a1fSJohannes Berg 	switch (state) {
4660fba3a1fSJohannes Berg 	case PM_SUSPEND_DISK:
4670fba3a1fSJohannes Berg 		return 1;
4680fba3a1fSJohannes Berg 	/* can't do any other states via generic mechanism yet */
4690fba3a1fSJohannes Berg 	default:
4700fba3a1fSJohannes Berg 		return 0;
4710fba3a1fSJohannes Berg 	}
4720fba3a1fSJohannes Berg }
4730fba3a1fSJohannes Berg 
474f6d57916SPaul Mackerras static struct pm_ops pmac_pm_ops = {
475f6d57916SPaul Mackerras 	.pm_disk_mode	= PM_DISK_SHUTDOWN,
476f6d57916SPaul Mackerras 	.prepare	= pmac_pm_prepare,
477f6d57916SPaul Mackerras 	.enter		= pmac_pm_enter,
478f6d57916SPaul Mackerras 	.finish		= pmac_pm_finish,
4790fba3a1fSJohannes Berg 	.valid		= pmac_pm_valid,
480f6d57916SPaul Mackerras };
481f6d57916SPaul Mackerras 
482f6d57916SPaul Mackerras #endif /* CONFIG_SOFTWARE_SUSPEND */
483f6d57916SPaul Mackerras 
48435499c01SPaul Mackerras static int initializing = 1;
48535499c01SPaul Mackerras 
486f6d57916SPaul Mackerras static int pmac_late_init(void)
487f6d57916SPaul Mackerras {
488f6d57916SPaul Mackerras 	initializing = 0;
489f6d57916SPaul Mackerras #ifdef CONFIG_SOFTWARE_SUSPEND
490f6d57916SPaul Mackerras 	pm_set_ops(&pmac_pm_ops);
491f6d57916SPaul Mackerras #endif /* CONFIG_SOFTWARE_SUSPEND */
492f6d57916SPaul Mackerras 	return 0;
493f6d57916SPaul Mackerras }
494f6d57916SPaul Mackerras 
495f6d57916SPaul Mackerras late_initcall(pmac_late_init);
496f6d57916SPaul Mackerras 
497f6d57916SPaul Mackerras /* can't be __init - can be called whenever a disk is first accessed */
49835499c01SPaul Mackerras void note_bootable_part(dev_t dev, int part, int goodness)
499f6d57916SPaul Mackerras {
500f6d57916SPaul Mackerras 	static int found_boot = 0;
501f6d57916SPaul Mackerras 	char *p;
502f6d57916SPaul Mackerras 
503f6d57916SPaul Mackerras 	if (!initializing)
504f6d57916SPaul Mackerras 		return;
505f6d57916SPaul Mackerras 	if ((goodness <= current_root_goodness) &&
506f6d57916SPaul Mackerras 	    ROOT_DEV != DEFAULT_ROOT_DEVICE)
507f6d57916SPaul Mackerras 		return;
508f6d57916SPaul Mackerras 	p = strstr(saved_command_line, "root=");
509f6d57916SPaul Mackerras 	if (p != NULL && (p == saved_command_line || p[-1] == ' '))
510f6d57916SPaul Mackerras 		return;
511f6d57916SPaul Mackerras 
512f6d57916SPaul Mackerras 	if (!found_boot) {
513f6d57916SPaul Mackerras 		find_boot_device();
514f6d57916SPaul Mackerras 		found_boot = 1;
515f6d57916SPaul Mackerras 	}
516f6d57916SPaul Mackerras 	if (!boot_dev || dev == boot_dev) {
517f6d57916SPaul Mackerras 		ROOT_DEV = dev + part;
518f6d57916SPaul Mackerras 		boot_dev = 0;
519f6d57916SPaul Mackerras 		current_root_goodness = goodness;
520f6d57916SPaul Mackerras 	}
521f6d57916SPaul Mackerras }
522f6d57916SPaul Mackerras 
52335499c01SPaul Mackerras #ifdef CONFIG_ADB_CUDA
52435499c01SPaul Mackerras static void cuda_restart(void)
525f6d57916SPaul Mackerras {
526f6d57916SPaul Mackerras 	struct adb_request req;
527f6d57916SPaul Mackerras 
52835499c01SPaul Mackerras 	cuda_request(&req, NULL, 2, CUDA_PACKET, CUDA_RESET_SYSTEM);
529f6d57916SPaul Mackerras 	for (;;)
530f6d57916SPaul Mackerras 		cuda_poll();
53135499c01SPaul Mackerras }
53235499c01SPaul Mackerras 
53335499c01SPaul Mackerras static void cuda_shutdown(void)
53435499c01SPaul Mackerras {
53535499c01SPaul Mackerras 	struct adb_request req;
53635499c01SPaul Mackerras 
53735499c01SPaul Mackerras 	cuda_request(&req, NULL, 2, CUDA_PACKET, CUDA_POWERDOWN);
53835499c01SPaul Mackerras 	for (;;)
53935499c01SPaul Mackerras 		cuda_poll();
54035499c01SPaul Mackerras }
54135499c01SPaul Mackerras 
54235499c01SPaul Mackerras #else
54335499c01SPaul Mackerras #define cuda_restart()
54435499c01SPaul Mackerras #define cuda_shutdown()
54535499c01SPaul Mackerras #endif
54635499c01SPaul Mackerras 
54735499c01SPaul Mackerras #ifndef CONFIG_ADB_PMU
54835499c01SPaul Mackerras #define pmu_restart()
54935499c01SPaul Mackerras #define pmu_shutdown()
55035499c01SPaul Mackerras #endif
55135499c01SPaul Mackerras 
55235499c01SPaul Mackerras #ifndef CONFIG_PMAC_SMU
55335499c01SPaul Mackerras #define smu_restart()
55435499c01SPaul Mackerras #define smu_shutdown()
55535499c01SPaul Mackerras #endif
55635499c01SPaul Mackerras 
55735499c01SPaul Mackerras static void pmac_restart(char *cmd)
55835499c01SPaul Mackerras {
55935499c01SPaul Mackerras 	switch (sys_ctrler) {
56035499c01SPaul Mackerras 	case SYS_CTRLER_CUDA:
56135499c01SPaul Mackerras 		cuda_restart();
562f6d57916SPaul Mackerras 		break;
563f6d57916SPaul Mackerras 	case SYS_CTRLER_PMU:
564f6d57916SPaul Mackerras 		pmu_restart();
565f6d57916SPaul Mackerras 		break;
56635499c01SPaul Mackerras 	case SYS_CTRLER_SMU:
56735499c01SPaul Mackerras 		smu_restart();
56835499c01SPaul Mackerras 		break;
569f6d57916SPaul Mackerras 	default: ;
570f6d57916SPaul Mackerras 	}
571f6d57916SPaul Mackerras }
572f6d57916SPaul Mackerras 
57335499c01SPaul Mackerras static void pmac_power_off(void)
574f6d57916SPaul Mackerras {
575f6d57916SPaul Mackerras 	switch (sys_ctrler) {
576f6d57916SPaul Mackerras 	case SYS_CTRLER_CUDA:
57735499c01SPaul Mackerras 		cuda_shutdown();
578f6d57916SPaul Mackerras 		break;
579f6d57916SPaul Mackerras 	case SYS_CTRLER_PMU:
580f6d57916SPaul Mackerras 		pmu_shutdown();
581f6d57916SPaul Mackerras 		break;
58235499c01SPaul Mackerras 	case SYS_CTRLER_SMU:
58335499c01SPaul Mackerras 		smu_shutdown();
58435499c01SPaul Mackerras 		break;
585f6d57916SPaul Mackerras 	default: ;
586f6d57916SPaul Mackerras 	}
587f6d57916SPaul Mackerras }
588f6d57916SPaul Mackerras 
589f6d57916SPaul Mackerras static void
590f6d57916SPaul Mackerras pmac_halt(void)
591f6d57916SPaul Mackerras {
592f6d57916SPaul Mackerras 	pmac_power_off();
593f6d57916SPaul Mackerras }
594f6d57916SPaul Mackerras 
59535499c01SPaul Mackerras /*
59635499c01SPaul Mackerras  * Early initialization.
59735499c01SPaul Mackerras  */
59835499c01SPaul Mackerras static void __init pmac_init_early(void)
599f6d57916SPaul Mackerras {
60051d3082fSBenjamin Herrenschmidt 	/* Enable early btext debug if requested */
60151d3082fSBenjamin Herrenschmidt 	if (strstr(cmd_line, "btextdbg")) {
60251d3082fSBenjamin Herrenschmidt 		udbg_adb_init_early();
60351d3082fSBenjamin Herrenschmidt 		register_early_udbg_console();
60435499c01SPaul Mackerras 	}
60535499c01SPaul Mackerras 
60651d3082fSBenjamin Herrenschmidt 	/* Probe motherboard chipset */
60751d3082fSBenjamin Herrenschmidt 	pmac_feature_init();
60851d3082fSBenjamin Herrenschmidt 
60951d3082fSBenjamin Herrenschmidt 	/* Initialize debug stuff */
61051d3082fSBenjamin Herrenschmidt 	udbg_scc_init(!!strstr(cmd_line, "sccdbg"));
61151d3082fSBenjamin Herrenschmidt 	udbg_adb_init(!!strstr(cmd_line, "btextdbg"));
61251d3082fSBenjamin Herrenschmidt 
61351d3082fSBenjamin Herrenschmidt #ifdef CONFIG_PPC64
6141beb6a7dSBenjamin Herrenschmidt 	iommu_init_early_dart();
61535499c01SPaul Mackerras #endif
61635499c01SPaul Mackerras }
61735499c01SPaul Mackerras 
61835499c01SPaul Mackerras /*
61935499c01SPaul Mackerras  * pmac has no legacy IO, anything calling this function has to
62035499c01SPaul Mackerras  * fail or bad things will happen
62135499c01SPaul Mackerras  */
62235499c01SPaul Mackerras static int pmac_check_legacy_ioport(unsigned int baseport)
62335499c01SPaul Mackerras {
62435499c01SPaul Mackerras 	return -ENODEV;
62535499c01SPaul Mackerras }
62635499c01SPaul Mackerras 
62735499c01SPaul Mackerras static int __init pmac_declare_of_platform_devices(void)
628f6d57916SPaul Mackerras {
629a28d3af2SBenjamin Herrenschmidt 	struct device_node *np;
630f6d57916SPaul Mackerras 
631e8222502SBenjamin Herrenschmidt 	if (machine_is(chrp))
632e8222502SBenjamin Herrenschmidt 		return -1;
633e8222502SBenjamin Herrenschmidt 
634e8222502SBenjamin Herrenschmidt 	if (!machine_is(powermac))
635e8222502SBenjamin Herrenschmidt 		return 0;
636e8222502SBenjamin Herrenschmidt 
637730745a5SBenjamin Herrenschmidt 	np = of_find_node_by_name(NULL, "valkyrie");
63835499c01SPaul Mackerras 	if (np)
63935499c01SPaul Mackerras 		of_platform_device_create(np, "valkyrie", NULL);
640730745a5SBenjamin Herrenschmidt 	np = of_find_node_by_name(NULL, "platinum");
64135499c01SPaul Mackerras 	if (np)
64235499c01SPaul Mackerras 		of_platform_device_create(np, "platinum", NULL);
64335499c01SPaul Mackerras         np = of_find_node_by_type(NULL, "smu");
64435499c01SPaul Mackerras         if (np) {
64535499c01SPaul Mackerras 		of_platform_device_create(np, "smu", NULL);
64635499c01SPaul Mackerras 		of_node_put(np);
64735499c01SPaul Mackerras 	}
648f6d57916SPaul Mackerras 
649f6d57916SPaul Mackerras 	return 0;
650f6d57916SPaul Mackerras }
651f6d57916SPaul Mackerras 
652f6d57916SPaul Mackerras device_initcall(pmac_declare_of_platform_devices);
65335499c01SPaul Mackerras 
65435499c01SPaul Mackerras /*
65535499c01SPaul Mackerras  * Called very early, MMU is off, device-tree isn't unflattened
65635499c01SPaul Mackerras  */
657e8222502SBenjamin Herrenschmidt static int __init pmac_probe(void)
65835499c01SPaul Mackerras {
659e8222502SBenjamin Herrenschmidt 	unsigned long root = of_get_flat_dt_root();
660e8222502SBenjamin Herrenschmidt 
661e8222502SBenjamin Herrenschmidt 	if (!of_flat_dt_is_compatible(root, "Power Macintosh") &&
662e8222502SBenjamin Herrenschmidt 	    !of_flat_dt_is_compatible(root, "MacRISC"))
66335499c01SPaul Mackerras 		return 0;
66435499c01SPaul Mackerras 
665e8222502SBenjamin Herrenschmidt #ifdef CONFIG_PPC64
66635499c01SPaul Mackerras 	/*
66735499c01SPaul Mackerras 	 * On U3, the DART (iommu) must be allocated now since it
66835499c01SPaul Mackerras 	 * has an impact on htab_initialize (due to the large page it
66935499c01SPaul Mackerras 	 * occupies having to be broken up so the DART itself is not
67035499c01SPaul Mackerras 	 * part of the cacheable linar mapping
67135499c01SPaul Mackerras 	 */
6721beb6a7dSBenjamin Herrenschmidt 	alloc_dart_table();
6737d0daae4SMichael Ellerman 
6747d0daae4SMichael Ellerman 	hpte_init_native();
67535499c01SPaul Mackerras #endif
67635499c01SPaul Mackerras 
677e8222502SBenjamin Herrenschmidt #ifdef CONFIG_PPC32
678e8222502SBenjamin Herrenschmidt 	/* isa_io_base gets set in pmac_pci_init */
679e8222502SBenjamin Herrenschmidt 	isa_mem_base = PMAC_ISA_MEM_BASE;
680e8222502SBenjamin Herrenschmidt 	pci_dram_offset = PMAC_PCI_DRAM_OFFSET;
681e8222502SBenjamin Herrenschmidt 	ISA_DMA_THRESHOLD = ~0L;
682e8222502SBenjamin Herrenschmidt 	DMA_MODE_READ = 1;
683e8222502SBenjamin Herrenschmidt 	DMA_MODE_WRITE = 2;
684e8222502SBenjamin Herrenschmidt 
685e8222502SBenjamin Herrenschmidt #if defined(CONFIG_BLK_DEV_IDE) || defined(CONFIG_BLK_DEV_IDE_MODULE)
686e8222502SBenjamin Herrenschmidt #ifdef CONFIG_BLK_DEV_IDE_PMAC
687e8222502SBenjamin Herrenschmidt         ppc_ide_md.ide_init_hwif	= pmac_ide_init_hwif_ports;
688e8222502SBenjamin Herrenschmidt         ppc_ide_md.default_io_base	= pmac_ide_get_base;
689e8222502SBenjamin Herrenschmidt #endif /* CONFIG_BLK_DEV_IDE_PMAC */
690e8222502SBenjamin Herrenschmidt #endif /* defined(CONFIG_BLK_DEV_IDE) || defined(CONFIG_BLK_DEV_IDE_MODULE) */
691e8222502SBenjamin Herrenschmidt 
692e8222502SBenjamin Herrenschmidt #endif /* CONFIG_PPC32 */
693e8222502SBenjamin Herrenschmidt 
69435499c01SPaul Mackerras #ifdef CONFIG_PMAC_SMU
69535499c01SPaul Mackerras 	/*
69635499c01SPaul Mackerras 	 * SMU based G5s need some memory below 2Gb, at least the current
69735499c01SPaul Mackerras 	 * driver needs that. We have to allocate it now. We allocate 4k
69835499c01SPaul Mackerras 	 * (1 small page) for now.
69935499c01SPaul Mackerras 	 */
70035499c01SPaul Mackerras 	smu_cmdbuf_abs = lmb_alloc_base(4096, 4096, 0x80000000UL);
70135499c01SPaul Mackerras #endif /* CONFIG_PMAC_SMU */
70235499c01SPaul Mackerras 
70335499c01SPaul Mackerras 	return 1;
70435499c01SPaul Mackerras }
70535499c01SPaul Mackerras 
70635499c01SPaul Mackerras #ifdef CONFIG_PPC64
70751d3082fSBenjamin Herrenschmidt /* Move that to pci.c */
70851d3082fSBenjamin Herrenschmidt static int pmac_pci_probe_mode(struct pci_bus *bus)
70935499c01SPaul Mackerras {
71035499c01SPaul Mackerras 	struct device_node *node = bus->sysdata;
71135499c01SPaul Mackerras 
71235499c01SPaul Mackerras 	/* We need to use normal PCI probing for the AGP bus,
7131beb6a7dSBenjamin Herrenschmidt 	 * since the device for the AGP bridge isn't in the tree.
7141beb6a7dSBenjamin Herrenschmidt 	 */
7151beb6a7dSBenjamin Herrenschmidt 	if (bus->self == NULL && (device_is_compatible(node, "u3-agp") ||
7161beb6a7dSBenjamin Herrenschmidt 				  device_is_compatible(node, "u4-pcie")))
71735499c01SPaul Mackerras 		return PCI_PROBE_NORMAL;
71835499c01SPaul Mackerras 	return PCI_PROBE_DEVTREE;
71935499c01SPaul Mackerras }
72035499c01SPaul Mackerras #endif
72135499c01SPaul Mackerras 
722e8222502SBenjamin Herrenschmidt define_machine(powermac) {
723e8222502SBenjamin Herrenschmidt 	.name			= "PowerMac",
72435499c01SPaul Mackerras 	.probe			= pmac_probe,
72535499c01SPaul Mackerras 	.setup_arch		= pmac_setup_arch,
72635499c01SPaul Mackerras 	.init_early		= pmac_init_early,
72735499c01SPaul Mackerras 	.show_cpuinfo		= pmac_show_cpuinfo,
72835499c01SPaul Mackerras 	.init_IRQ		= pmac_pic_init,
729cc5d0189SBenjamin Herrenschmidt 	.get_irq		= NULL,	/* changed later */
730*f90bb153SBenjamin Herrenschmidt 	.pci_irq_fixup		= pmac_pci_irq_fixup,
73135499c01SPaul Mackerras 	.restart		= pmac_restart,
73235499c01SPaul Mackerras 	.power_off		= pmac_power_off,
73335499c01SPaul Mackerras 	.halt			= pmac_halt,
73435499c01SPaul Mackerras 	.time_init		= pmac_time_init,
73535499c01SPaul Mackerras 	.get_boot_time		= pmac_get_boot_time,
73635499c01SPaul Mackerras 	.set_rtc_time		= pmac_set_rtc_time,
73735499c01SPaul Mackerras 	.get_rtc_time		= pmac_get_rtc_time,
73835499c01SPaul Mackerras 	.calibrate_decr		= pmac_calibrate_decr,
73935499c01SPaul Mackerras 	.feature_call		= pmac_do_feature_call,
74035499c01SPaul Mackerras 	.check_legacy_ioport	= pmac_check_legacy_ioport,
741be6b8439SKumar Gala 	.progress		= udbg_progress,
74235499c01SPaul Mackerras #ifdef CONFIG_PPC64
74351d3082fSBenjamin Herrenschmidt 	.pci_probe_mode		= pmac_pci_probe_mode,
744a0652fc9SPaul Mackerras 	.power_save		= power4_idle,
74535499c01SPaul Mackerras 	.enable_pmcs		= power4_enable_pmcs,
7463d1229d6SMichael Ellerman #ifdef CONFIG_KEXEC
7473d1229d6SMichael Ellerman 	.machine_kexec		= default_machine_kexec,
7483d1229d6SMichael Ellerman 	.machine_kexec_prepare	= default_machine_kexec_prepare,
749cc532915SMichael Ellerman 	.machine_crash_shutdown	= default_machine_crash_shutdown,
75035499c01SPaul Mackerras #endif
7513d1229d6SMichael Ellerman #endif /* CONFIG_PPC64 */
75235499c01SPaul Mackerras #ifdef CONFIG_PPC32
75335499c01SPaul Mackerras 	.pcibios_enable_device_hook = pmac_pci_enable_device_hook,
75435499c01SPaul Mackerras 	.pcibios_after_init	= pmac_pcibios_after_init,
75535499c01SPaul Mackerras 	.phys_mem_access_prot	= pci_phys_mem_access_prot,
75635499c01SPaul Mackerras #endif
757e8222502SBenjamin Herrenschmidt #if defined(CONFIG_HOTPLUG_CPU) && defined(CONFIG_PPC64)
758e8222502SBenjamin Herrenschmidt 	.cpu_die		= generic_mach_cpu_die,
759e8222502SBenjamin Herrenschmidt #endif
76035499c01SPaul Mackerras };
761