xref: /openbmc/linux/arch/powerpc/platforms/powermac/setup.c (revision 30686ba6d56858657829d3eb524ed73e5dc98d2b)
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/pci.h>
46f6d57916SPaul Mackerras #include <linux/adb.h>
47f6d57916SPaul Mackerras #include <linux/cuda.h>
48f6d57916SPaul Mackerras #include <linux/pmu.h>
49f6d57916SPaul Mackerras #include <linux/irq.h>
50f6d57916SPaul Mackerras #include <linux/seq_file.h>
51f6d57916SPaul Mackerras #include <linux/root_dev.h>
52f6d57916SPaul Mackerras #include <linux/bitops.h>
53f6d57916SPaul Mackerras #include <linux/suspend.h>
54f6d57916SPaul Mackerras 
55f6d57916SPaul Mackerras #include <asm/reg.h>
56f6d57916SPaul Mackerras #include <asm/sections.h>
57f6d57916SPaul Mackerras #include <asm/prom.h>
58f6d57916SPaul Mackerras #include <asm/system.h>
59f6d57916SPaul Mackerras #include <asm/pgtable.h>
60f6d57916SPaul Mackerras #include <asm/io.h>
613d1229d6SMichael Ellerman #include <asm/kexec.h>
62f6d57916SPaul Mackerras #include <asm/pci-bridge.h>
63f6d57916SPaul Mackerras #include <asm/ohare.h>
64f6d57916SPaul Mackerras #include <asm/mediabay.h>
65f6d57916SPaul Mackerras #include <asm/machdep.h>
66f6d57916SPaul Mackerras #include <asm/dma.h>
67f6d57916SPaul Mackerras #include <asm/cputable.h>
68f6d57916SPaul Mackerras #include <asm/btext.h>
69f6d57916SPaul Mackerras #include <asm/pmac_feature.h>
70f6d57916SPaul Mackerras #include <asm/time.h>
71f6d57916SPaul Mackerras #include <asm/of_device.h>
727eebde70SBenjamin Herrenschmidt #include <asm/of_platform.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) {
137e2eb6392SStephen Rothwell 		pp = of_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");
142e2eb6392SStephen Rothwell 		pp = of_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) {
166e2eb6392SStephen Rothwell 		const unsigned int *ic =
167e2eb6392SStephen Rothwell 			of_get_property(np, "i-cache-size", NULL);
168e2eb6392SStephen Rothwell 		const unsigned int *dc =
169e2eb6392SStephen Rothwell 			of_get_property(np, "d-cache-size", NULL);
170f6d57916SPaul Mackerras 		seq_printf(m, "L2 cache\t:");
171f6d57916SPaul Mackerras 		has_l2cache = 1;
172e2eb6392SStephen Rothwell 		if (of_get_property(np, "cache-unified", NULL) != 0 && dc) {
173f6d57916SPaul Mackerras 			seq_printf(m, " %dK unified", *dc / 1024);
174f6d57916SPaul Mackerras 		} else {
175f6d57916SPaul Mackerras 			if (ic)
176f6d57916SPaul Mackerras 				seq_printf(m, " %dK instruction", *ic / 1024);
177f6d57916SPaul Mackerras 			if (dc)
178f6d57916SPaul Mackerras 				seq_printf(m, "%s %dK data",
179f6d57916SPaul Mackerras 					   (ic? " +": ""), *dc / 1024);
180f6d57916SPaul Mackerras 		}
181e2eb6392SStephen Rothwell 		pp = of_get_property(np, "ram-type", NULL);
182f6d57916SPaul Mackerras 		if (pp)
183f6d57916SPaul Mackerras 			seq_printf(m, " %s", pp);
184f6d57916SPaul Mackerras 		seq_printf(m, "\n");
1850dd194d0SPaul Mackerras 		of_node_put(np);
186f6d57916SPaul Mackerras 	}
187f6d57916SPaul Mackerras 
188f6d57916SPaul Mackerras 	/* Indicate newworld/oldworld */
189f6d57916SPaul Mackerras 	seq_printf(m, "pmac-generation\t: %s\n",
190f6d57916SPaul Mackerras 		   pmac_newworld ? "NewWorld" : "OldWorld");
191f6d57916SPaul Mackerras }
192f6d57916SPaul Mackerras 
19335499c01SPaul Mackerras #ifndef CONFIG_ADB_CUDA
19435499c01SPaul Mackerras int find_via_cuda(void)
19535499c01SPaul Mackerras {
196*30686ba6SStephen Rothwell 	struct device_node *dn = of_find_node_by_name(NULL, "via-cuda");
197*30686ba6SStephen Rothwell 
198*30686ba6SStephen Rothwell 	if (!dn)
19935499c01SPaul Mackerras 		return 0;
200*30686ba6SStephen Rothwell 	of_node_put(dn);
20135499c01SPaul Mackerras 	printk("WARNING ! Your machine is CUDA-based but your kernel\n");
20235499c01SPaul Mackerras 	printk("          wasn't compiled with CONFIG_ADB_CUDA option !\n");
20335499c01SPaul Mackerras 	return 0;
20435499c01SPaul Mackerras }
20535499c01SPaul Mackerras #endif
20635499c01SPaul Mackerras 
20735499c01SPaul Mackerras #ifndef CONFIG_ADB_PMU
20835499c01SPaul Mackerras int find_via_pmu(void)
20935499c01SPaul Mackerras {
210*30686ba6SStephen Rothwell 	struct device_node *dn = of_find_node_by_name(NULL, "via-pmu");
211*30686ba6SStephen Rothwell 
212*30686ba6SStephen Rothwell 	if (!dn)
21335499c01SPaul Mackerras 		return 0;
214*30686ba6SStephen Rothwell 	of_node_put(dn);
21535499c01SPaul Mackerras 	printk("WARNING ! Your machine is PMU-based but your kernel\n");
21635499c01SPaul Mackerras 	printk("          wasn't compiled with CONFIG_ADB_PMU option !\n");
217a575b807SPaul Mackerras 	return 0;
21835499c01SPaul Mackerras }
21935499c01SPaul Mackerras #endif
22035499c01SPaul Mackerras 
22135499c01SPaul Mackerras #ifndef CONFIG_PMAC_SMU
22235499c01SPaul Mackerras int smu_init(void)
22335499c01SPaul Mackerras {
22435499c01SPaul Mackerras 	/* should check and warn if SMU is present */
22535499c01SPaul Mackerras 	return 0;
22635499c01SPaul Mackerras }
22735499c01SPaul Mackerras #endif
22835499c01SPaul Mackerras 
22935499c01SPaul Mackerras #ifdef CONFIG_PPC32
230f6d57916SPaul Mackerras static volatile u32 *sysctrl_regs;
231f6d57916SPaul Mackerras 
23235499c01SPaul Mackerras static void __init ohare_init(void)
233f6d57916SPaul Mackerras {
234*30686ba6SStephen Rothwell 	struct device_node *dn;
235*30686ba6SStephen Rothwell 
236f6d57916SPaul Mackerras 	/* this area has the CPU identification register
237f6d57916SPaul Mackerras 	   and some registers used by smp boards */
238f6d57916SPaul Mackerras 	sysctrl_regs = (volatile u32 *) ioremap(0xf8000000, 0x1000);
239f6d57916SPaul Mackerras 
24035499c01SPaul Mackerras 	/*
24135499c01SPaul Mackerras 	 * Turn on the L2 cache.
24235499c01SPaul Mackerras 	 * We assume that we have a PSX memory controller iff
24335499c01SPaul Mackerras 	 * we have an ohare I/O controller.
24435499c01SPaul Mackerras 	 */
245*30686ba6SStephen Rothwell 	dn = of_find_node_by_name(NULL, "ohare");
246*30686ba6SStephen Rothwell 	if (dn) {
247*30686ba6SStephen Rothwell 		of_node_put(dn);
24835499c01SPaul Mackerras 		if (((sysctrl_regs[2] >> 24) & 0xf) >= 3) {
24935499c01SPaul Mackerras 			if (sysctrl_regs[4] & 0x10)
25035499c01SPaul Mackerras 				sysctrl_regs[4] |= 0x04000020;
25135499c01SPaul Mackerras 			else
25235499c01SPaul Mackerras 				sysctrl_regs[4] |= 0x04000000;
25335499c01SPaul Mackerras 			if(has_l2cache)
25435499c01SPaul Mackerras 				printk(KERN_INFO "Level 2 cache enabled\n");
25535499c01SPaul Mackerras 		}
25635499c01SPaul Mackerras 	}
25735499c01SPaul Mackerras }
258f6d57916SPaul Mackerras 
25935499c01SPaul Mackerras static void __init l2cr_init(void)
26035499c01SPaul Mackerras {
261f6d57916SPaul Mackerras 	/* Checks "l2cr-value" property in the registry */
262f6d57916SPaul Mackerras 	if (cpu_has_feature(CPU_FTR_L2CR)) {
2631658ab66SStephen Rothwell 		struct device_node *np = of_find_node_by_name(NULL, "cpus");
264f6d57916SPaul Mackerras 		if (np == 0)
2651658ab66SStephen Rothwell 			np = of_find_node_by_type(NULL, "cpu");
266f6d57916SPaul Mackerras 		if (np != 0) {
267018a3d1dSJeremy Kerr 			const unsigned int *l2cr =
268e2eb6392SStephen Rothwell 				of_get_property(np, "l2cr-value", NULL);
269f6d57916SPaul Mackerras 			if (l2cr != 0) {
270f6d57916SPaul Mackerras 				ppc_override_l2cr = 1;
271f6d57916SPaul Mackerras 				ppc_override_l2cr_value = *l2cr;
272f6d57916SPaul Mackerras 				_set_L2CR(0);
273f6d57916SPaul Mackerras 				_set_L2CR(ppc_override_l2cr_value);
274f6d57916SPaul Mackerras 			}
2751658ab66SStephen Rothwell 			of_node_put(np);
276f6d57916SPaul Mackerras 		}
277f6d57916SPaul Mackerras 	}
278f6d57916SPaul Mackerras 
279f6d57916SPaul Mackerras 	if (ppc_override_l2cr)
28035499c01SPaul Mackerras 		printk(KERN_INFO "L2CR overridden (0x%x), "
28135499c01SPaul Mackerras 		       "backside cache is %s\n",
28235499c01SPaul Mackerras 		       ppc_override_l2cr_value,
28335499c01SPaul Mackerras 		       (ppc_override_l2cr_value & 0x80000000)
284f6d57916SPaul Mackerras 				? "enabled" : "disabled");
28535499c01SPaul Mackerras }
28635499c01SPaul Mackerras #endif
28735499c01SPaul Mackerras 
288ff38e7c8SArnd Bergmann static void __init pmac_setup_arch(void)
28935499c01SPaul Mackerras {
290a575b807SPaul Mackerras 	struct device_node *cpu, *ic;
291018a3d1dSJeremy Kerr 	const int *fp;
29235499c01SPaul Mackerras 	unsigned long pvr;
29335499c01SPaul Mackerras 
29435499c01SPaul Mackerras 	pvr = PVR_VER(mfspr(SPRN_PVR));
29535499c01SPaul Mackerras 
29635499c01SPaul Mackerras 	/* Set loops_per_jiffy to a half-way reasonable value,
29735499c01SPaul Mackerras 	   for use until calibrate_delay gets called. */
29835499c01SPaul Mackerras 	loops_per_jiffy = 50000000 / HZ;
29935499c01SPaul Mackerras 	cpu = of_find_node_by_type(NULL, "cpu");
30035499c01SPaul Mackerras 	if (cpu != NULL) {
301e2eb6392SStephen Rothwell 		fp = of_get_property(cpu, "clock-frequency", NULL);
30235499c01SPaul Mackerras 		if (fp != NULL) {
30335499c01SPaul Mackerras 			if (pvr >= 0x30 && pvr < 0x80)
30435499c01SPaul Mackerras 				/* PPC970 etc. */
30535499c01SPaul Mackerras 				loops_per_jiffy = *fp / (3 * HZ);
30635499c01SPaul Mackerras 			else if (pvr == 4 || pvr >= 8)
30735499c01SPaul Mackerras 				/* 604, G3, G4 etc. */
30835499c01SPaul Mackerras 				loops_per_jiffy = *fp / HZ;
30935499c01SPaul Mackerras 			else
31035499c01SPaul Mackerras 				/* 601, 603, etc. */
31135499c01SPaul Mackerras 				loops_per_jiffy = *fp / (2 * HZ);
31235499c01SPaul Mackerras 		}
31335499c01SPaul Mackerras 		of_node_put(cpu);
31435499c01SPaul Mackerras 	}
31535499c01SPaul Mackerras 
316a575b807SPaul Mackerras 	/* See if newworld or oldworld */
317bfab1019SPaul Mackerras 	for (ic = NULL; (ic = of_find_all_nodes(ic)) != NULL; )
318e2eb6392SStephen Rothwell 		if (of_get_property(ic, "interrupt-controller", NULL))
319bfab1019SPaul Mackerras 			break;
320d2515c80SOlaf Hering 	if (ic) {
321d2515c80SOlaf Hering 		pmac_newworld = 1;
322a575b807SPaul Mackerras 		of_node_put(ic);
323d2515c80SOlaf Hering 	}
324a575b807SPaul Mackerras 
32535499c01SPaul Mackerras 	/* Lookup PCI hosts */
32635499c01SPaul Mackerras 	pmac_pci_init();
32735499c01SPaul Mackerras 
32835499c01SPaul Mackerras #ifdef CONFIG_PPC32
32935499c01SPaul Mackerras 	ohare_init();
33035499c01SPaul Mackerras 	l2cr_init();
33135499c01SPaul Mackerras #endif /* CONFIG_PPC32 */
33235499c01SPaul Mackerras 
333f6d57916SPaul Mackerras #ifdef CONFIG_KGDB
334f6d57916SPaul Mackerras 	zs_kgdb_hook(0);
335f6d57916SPaul Mackerras #endif
336f6d57916SPaul Mackerras 
337f6d57916SPaul Mackerras 	find_via_cuda();
338f6d57916SPaul Mackerras 	find_via_pmu();
33935499c01SPaul Mackerras 	smu_init();
34035499c01SPaul Mackerras 
34191c33d28SDavid Woodhouse #if defined(CONFIG_NVRAM) || defined(CONFIG_PPC64)
342f6d57916SPaul Mackerras 	pmac_nvram_init();
343f6d57916SPaul Mackerras #endif
34435499c01SPaul Mackerras 
34535499c01SPaul Mackerras #ifdef CONFIG_PPC32
346f6d57916SPaul Mackerras #ifdef CONFIG_BLK_DEV_INITRD
347f6d57916SPaul Mackerras 	if (initrd_start)
348f6d57916SPaul Mackerras 		ROOT_DEV = Root_RAM0;
349f6d57916SPaul Mackerras 	else
350f6d57916SPaul Mackerras #endif
351f6d57916SPaul Mackerras 		ROOT_DEV = DEFAULT_ROOT_DEVICE;
35235499c01SPaul Mackerras #endif
353f6d57916SPaul Mackerras 
354f6d57916SPaul Mackerras #ifdef CONFIG_SMP
355f6d57916SPaul Mackerras 	/* Check for Core99 */
356*30686ba6SStephen Rothwell 	ic = of_find_node_by_name(NULL, "uni-n");
357*30686ba6SStephen Rothwell 	if (!ic)
358*30686ba6SStephen Rothwell 		ic = of_find_node_by_name(NULL, "u3");
359*30686ba6SStephen Rothwell 	if (!ic)
360*30686ba6SStephen Rothwell 		ic = of_find_node_by_name(NULL, "u4");
361*30686ba6SStephen Rothwell 	if (ic) {
362*30686ba6SStephen Rothwell 		of_node_put(ic);
3637ed476d1SPaul Mackerras 		smp_ops = &core99_smp_ops;
364*30686ba6SStephen Rothwell 	}
36535499c01SPaul Mackerras #ifdef CONFIG_PPC32
366f6d57916SPaul Mackerras 	else
3677ed476d1SPaul Mackerras 		smp_ops = &psurge_smp_ops;
36835499c01SPaul Mackerras #endif
369f6d57916SPaul Mackerras #endif /* CONFIG_SMP */
370e8222502SBenjamin Herrenschmidt 
371e8222502SBenjamin Herrenschmidt #ifdef CONFIG_ADB
372e8222502SBenjamin Herrenschmidt 	if (strstr(cmd_line, "adb_sync")) {
373e8222502SBenjamin Herrenschmidt 		extern int __adb_probe_sync;
374e8222502SBenjamin Herrenschmidt 		__adb_probe_sync = 1;
375e8222502SBenjamin Herrenschmidt 	}
376e8222502SBenjamin Herrenschmidt #endif /* CONFIG_ADB */
377f6d57916SPaul Mackerras }
378f6d57916SPaul Mackerras 
379f6d57916SPaul Mackerras char *bootpath;
380f6d57916SPaul Mackerras char *bootdevice;
381f6d57916SPaul Mackerras void *boot_host;
382f6d57916SPaul Mackerras int boot_target;
383f6d57916SPaul Mackerras int boot_part;
384fd6e7d2dSs.hauer@pengutronix.de static dev_t boot_dev;
385f6d57916SPaul Mackerras 
386f6d57916SPaul Mackerras #ifdef CONFIG_SCSI
38735499c01SPaul Mackerras void __init note_scsi_host(struct device_node *node, void *host)
388f6d57916SPaul Mackerras {
389f6d57916SPaul Mackerras 	int l;
390f6d57916SPaul Mackerras 	char *p;
391f6d57916SPaul Mackerras 
392f6d57916SPaul Mackerras 	l = strlen(node->full_name);
393f6d57916SPaul Mackerras 	if (bootpath != NULL && bootdevice != NULL
394f6d57916SPaul Mackerras 	    && strncmp(node->full_name, bootdevice, l) == 0
395f6d57916SPaul Mackerras 	    && (bootdevice[l] == '/' || bootdevice[l] == 0)) {
396f6d57916SPaul Mackerras 		boot_host = host;
397f6d57916SPaul Mackerras 		/*
398f6d57916SPaul Mackerras 		 * There's a bug in OF 1.0.5.  (Why am I not surprised.)
399f6d57916SPaul Mackerras 		 * If you pass a path like scsi/sd@1:0 to canon, it returns
400f6d57916SPaul Mackerras 		 * something like /bandit@F2000000/gc@10/53c94@10000/sd@0,0
401f6d57916SPaul Mackerras 		 * That is, the scsi target number doesn't get preserved.
402f6d57916SPaul Mackerras 		 * So we pick the target number out of bootpath and use that.
403f6d57916SPaul Mackerras 		 */
404f6d57916SPaul Mackerras 		p = strstr(bootpath, "/sd@");
405f6d57916SPaul Mackerras 		if (p != NULL) {
406f6d57916SPaul Mackerras 			p += 4;
407f6d57916SPaul Mackerras 			boot_target = simple_strtoul(p, NULL, 10);
408f6d57916SPaul Mackerras 			p = strchr(p, ':');
409f6d57916SPaul Mackerras 			if (p != NULL)
410f6d57916SPaul Mackerras 				boot_part = simple_strtoul(p + 1, NULL, 10);
411f6d57916SPaul Mackerras 		}
412f6d57916SPaul Mackerras 	}
413f6d57916SPaul Mackerras }
414f6d57916SPaul Mackerras EXPORT_SYMBOL(note_scsi_host);
415f6d57916SPaul Mackerras #endif
416f6d57916SPaul Mackerras 
417f6d57916SPaul Mackerras #if defined(CONFIG_BLK_DEV_IDE) && defined(CONFIG_BLK_DEV_IDE_PMAC)
41835499c01SPaul Mackerras static dev_t __init find_ide_boot(void)
419f6d57916SPaul Mackerras {
420f6d57916SPaul Mackerras 	char *p;
421f6d57916SPaul Mackerras 	int n;
422f6d57916SPaul Mackerras 	dev_t __init pmac_find_ide_boot(char *bootdevice, int n);
423f6d57916SPaul Mackerras 
424f6d57916SPaul Mackerras 	if (bootdevice == NULL)
425f6d57916SPaul Mackerras 		return 0;
426f6d57916SPaul Mackerras 	p = strrchr(bootdevice, '/');
427f6d57916SPaul Mackerras 	if (p == NULL)
428f6d57916SPaul Mackerras 		return 0;
429f6d57916SPaul Mackerras 	n = p - bootdevice;
430f6d57916SPaul Mackerras 
431f6d57916SPaul Mackerras 	return pmac_find_ide_boot(bootdevice, n);
432f6d57916SPaul Mackerras }
433f6d57916SPaul Mackerras #endif /* CONFIG_BLK_DEV_IDE && CONFIG_BLK_DEV_IDE_PMAC */
434f6d57916SPaul Mackerras 
43535499c01SPaul Mackerras static void __init find_boot_device(void)
436f6d57916SPaul Mackerras {
437f6d57916SPaul Mackerras #if defined(CONFIG_BLK_DEV_IDE) && defined(CONFIG_BLK_DEV_IDE_PMAC)
438f6d57916SPaul Mackerras 	boot_dev = find_ide_boot();
439f6d57916SPaul Mackerras #endif
440f6d57916SPaul Mackerras }
441f6d57916SPaul Mackerras 
442f6d57916SPaul Mackerras /* TODO: Merge the suspend-to-ram with the common code !!!
443f6d57916SPaul Mackerras  * currently, this is a stub implementation for suspend-to-disk
444f6d57916SPaul Mackerras  * only
445f6d57916SPaul Mackerras  */
446f6d57916SPaul Mackerras 
447f6d57916SPaul Mackerras #ifdef CONFIG_SOFTWARE_SUSPEND
448f6d57916SPaul Mackerras 
449f6d57916SPaul Mackerras static int pmac_pm_prepare(suspend_state_t state)
450f6d57916SPaul Mackerras {
451f6d57916SPaul Mackerras 	printk(KERN_DEBUG "%s(%d)\n", __FUNCTION__, state);
452f6d57916SPaul Mackerras 
453f6d57916SPaul Mackerras 	return 0;
454f6d57916SPaul Mackerras }
455f6d57916SPaul Mackerras 
456f6d57916SPaul Mackerras static int pmac_pm_enter(suspend_state_t state)
457f6d57916SPaul Mackerras {
458f6d57916SPaul Mackerras 	printk(KERN_DEBUG "%s(%d)\n", __FUNCTION__, state);
459f6d57916SPaul Mackerras 
460f6d57916SPaul Mackerras 	/* Giveup the lazy FPU & vec so we don't have to back them
461f6d57916SPaul Mackerras 	 * up from the low level code
462f6d57916SPaul Mackerras 	 */
463f6d57916SPaul Mackerras 	enable_kernel_fp();
464f6d57916SPaul Mackerras 
465f6d57916SPaul Mackerras #ifdef CONFIG_ALTIVEC
466f6d57916SPaul Mackerras 	if (cur_cpu_spec->cpu_features & CPU_FTR_ALTIVEC)
467f6d57916SPaul Mackerras 		enable_kernel_altivec();
468f6d57916SPaul Mackerras #endif /* CONFIG_ALTIVEC */
469f6d57916SPaul Mackerras 
470f6d57916SPaul Mackerras 	return 0;
471f6d57916SPaul Mackerras }
472f6d57916SPaul Mackerras 
473f6d57916SPaul Mackerras static int pmac_pm_finish(suspend_state_t state)
474f6d57916SPaul Mackerras {
475f6d57916SPaul Mackerras 	printk(KERN_DEBUG "%s(%d)\n", __FUNCTION__, state);
476f6d57916SPaul Mackerras 
477f6d57916SPaul Mackerras 	/* Restore userland MMU context */
4786218a761SPaul Mackerras 	set_context(current->active_mm->context.id, current->active_mm->pgd);
479f6d57916SPaul Mackerras 
480f6d57916SPaul Mackerras 	return 0;
481f6d57916SPaul Mackerras }
482f6d57916SPaul Mackerras 
4830fba3a1fSJohannes Berg static int pmac_pm_valid(suspend_state_t state)
4840fba3a1fSJohannes Berg {
4850fba3a1fSJohannes Berg 	switch (state) {
4860fba3a1fSJohannes Berg 	case PM_SUSPEND_DISK:
4870fba3a1fSJohannes Berg 		return 1;
4880fba3a1fSJohannes Berg 	/* can't do any other states via generic mechanism yet */
4890fba3a1fSJohannes Berg 	default:
4900fba3a1fSJohannes Berg 		return 0;
4910fba3a1fSJohannes Berg 	}
4920fba3a1fSJohannes Berg }
4930fba3a1fSJohannes Berg 
494f6d57916SPaul Mackerras static struct pm_ops pmac_pm_ops = {
495f6d57916SPaul Mackerras 	.pm_disk_mode	= PM_DISK_SHUTDOWN,
496f6d57916SPaul Mackerras 	.prepare	= pmac_pm_prepare,
497f6d57916SPaul Mackerras 	.enter		= pmac_pm_enter,
498f6d57916SPaul Mackerras 	.finish		= pmac_pm_finish,
4990fba3a1fSJohannes Berg 	.valid		= pmac_pm_valid,
500f6d57916SPaul Mackerras };
501f6d57916SPaul Mackerras 
502f6d57916SPaul Mackerras #endif /* CONFIG_SOFTWARE_SUSPEND */
503f6d57916SPaul Mackerras 
50435499c01SPaul Mackerras static int initializing = 1;
50535499c01SPaul Mackerras 
506f6d57916SPaul Mackerras static int pmac_late_init(void)
507f6d57916SPaul Mackerras {
508f6d57916SPaul Mackerras 	initializing = 0;
509f6d57916SPaul Mackerras #ifdef CONFIG_SOFTWARE_SUSPEND
510f6d57916SPaul Mackerras 	pm_set_ops(&pmac_pm_ops);
511f6d57916SPaul Mackerras #endif /* CONFIG_SOFTWARE_SUSPEND */
512f6d57916SPaul Mackerras 	return 0;
513f6d57916SPaul Mackerras }
514f6d57916SPaul Mackerras 
515f6d57916SPaul Mackerras late_initcall(pmac_late_init);
516f6d57916SPaul Mackerras 
517f6d57916SPaul Mackerras /* can't be __init - can be called whenever a disk is first accessed */
51835499c01SPaul Mackerras void note_bootable_part(dev_t dev, int part, int goodness)
519f6d57916SPaul Mackerras {
520f6d57916SPaul Mackerras 	static int found_boot = 0;
521f6d57916SPaul Mackerras 	char *p;
522f6d57916SPaul Mackerras 
523f6d57916SPaul Mackerras 	if (!initializing)
524f6d57916SPaul Mackerras 		return;
525f6d57916SPaul Mackerras 	if ((goodness <= current_root_goodness) &&
526f6d57916SPaul Mackerras 	    ROOT_DEV != DEFAULT_ROOT_DEVICE)
527f6d57916SPaul Mackerras 		return;
528b8757b21SAlon Bar-Lev 	p = strstr(boot_command_line, "root=");
529b8757b21SAlon Bar-Lev 	if (p != NULL && (p == boot_command_line || p[-1] == ' '))
530f6d57916SPaul Mackerras 		return;
531f6d57916SPaul Mackerras 
532f6d57916SPaul Mackerras 	if (!found_boot) {
533f6d57916SPaul Mackerras 		find_boot_device();
534f6d57916SPaul Mackerras 		found_boot = 1;
535f6d57916SPaul Mackerras 	}
536f6d57916SPaul Mackerras 	if (!boot_dev || dev == boot_dev) {
537f6d57916SPaul Mackerras 		ROOT_DEV = dev + part;
538f6d57916SPaul Mackerras 		boot_dev = 0;
539f6d57916SPaul Mackerras 		current_root_goodness = goodness;
540f6d57916SPaul Mackerras 	}
541f6d57916SPaul Mackerras }
542f6d57916SPaul Mackerras 
54335499c01SPaul Mackerras #ifdef CONFIG_ADB_CUDA
54435499c01SPaul Mackerras static void cuda_restart(void)
545f6d57916SPaul Mackerras {
546f6d57916SPaul Mackerras 	struct adb_request req;
547f6d57916SPaul Mackerras 
54835499c01SPaul Mackerras 	cuda_request(&req, NULL, 2, CUDA_PACKET, CUDA_RESET_SYSTEM);
549f6d57916SPaul Mackerras 	for (;;)
550f6d57916SPaul Mackerras 		cuda_poll();
55135499c01SPaul Mackerras }
55235499c01SPaul Mackerras 
55335499c01SPaul Mackerras static void cuda_shutdown(void)
55435499c01SPaul Mackerras {
55535499c01SPaul Mackerras 	struct adb_request req;
55635499c01SPaul Mackerras 
55735499c01SPaul Mackerras 	cuda_request(&req, NULL, 2, CUDA_PACKET, CUDA_POWERDOWN);
55835499c01SPaul Mackerras 	for (;;)
55935499c01SPaul Mackerras 		cuda_poll();
56035499c01SPaul Mackerras }
56135499c01SPaul Mackerras 
56235499c01SPaul Mackerras #else
56335499c01SPaul Mackerras #define cuda_restart()
56435499c01SPaul Mackerras #define cuda_shutdown()
56535499c01SPaul Mackerras #endif
56635499c01SPaul Mackerras 
56735499c01SPaul Mackerras #ifndef CONFIG_ADB_PMU
56835499c01SPaul Mackerras #define pmu_restart()
56935499c01SPaul Mackerras #define pmu_shutdown()
57035499c01SPaul Mackerras #endif
57135499c01SPaul Mackerras 
57235499c01SPaul Mackerras #ifndef CONFIG_PMAC_SMU
57335499c01SPaul Mackerras #define smu_restart()
57435499c01SPaul Mackerras #define smu_shutdown()
57535499c01SPaul Mackerras #endif
57635499c01SPaul Mackerras 
57735499c01SPaul Mackerras static void pmac_restart(char *cmd)
57835499c01SPaul Mackerras {
57935499c01SPaul Mackerras 	switch (sys_ctrler) {
58035499c01SPaul Mackerras 	case SYS_CTRLER_CUDA:
58135499c01SPaul Mackerras 		cuda_restart();
582f6d57916SPaul Mackerras 		break;
583f6d57916SPaul Mackerras 	case SYS_CTRLER_PMU:
584f6d57916SPaul Mackerras 		pmu_restart();
585f6d57916SPaul Mackerras 		break;
58635499c01SPaul Mackerras 	case SYS_CTRLER_SMU:
58735499c01SPaul Mackerras 		smu_restart();
58835499c01SPaul Mackerras 		break;
589f6d57916SPaul Mackerras 	default: ;
590f6d57916SPaul Mackerras 	}
591f6d57916SPaul Mackerras }
592f6d57916SPaul Mackerras 
59335499c01SPaul Mackerras static void pmac_power_off(void)
594f6d57916SPaul Mackerras {
595f6d57916SPaul Mackerras 	switch (sys_ctrler) {
596f6d57916SPaul Mackerras 	case SYS_CTRLER_CUDA:
59735499c01SPaul Mackerras 		cuda_shutdown();
598f6d57916SPaul Mackerras 		break;
599f6d57916SPaul Mackerras 	case SYS_CTRLER_PMU:
600f6d57916SPaul Mackerras 		pmu_shutdown();
601f6d57916SPaul Mackerras 		break;
60235499c01SPaul Mackerras 	case SYS_CTRLER_SMU:
60335499c01SPaul Mackerras 		smu_shutdown();
60435499c01SPaul Mackerras 		break;
605f6d57916SPaul Mackerras 	default: ;
606f6d57916SPaul Mackerras 	}
607f6d57916SPaul Mackerras }
608f6d57916SPaul Mackerras 
609f6d57916SPaul Mackerras static void
610f6d57916SPaul Mackerras pmac_halt(void)
611f6d57916SPaul Mackerras {
612f6d57916SPaul Mackerras 	pmac_power_off();
613f6d57916SPaul Mackerras }
614f6d57916SPaul Mackerras 
61535499c01SPaul Mackerras /*
61635499c01SPaul Mackerras  * Early initialization.
61735499c01SPaul Mackerras  */
61835499c01SPaul Mackerras static void __init pmac_init_early(void)
619f6d57916SPaul Mackerras {
62051d3082fSBenjamin Herrenschmidt 	/* Enable early btext debug if requested */
62151d3082fSBenjamin Herrenschmidt 	if (strstr(cmd_line, "btextdbg")) {
62251d3082fSBenjamin Herrenschmidt 		udbg_adb_init_early();
62351d3082fSBenjamin Herrenschmidt 		register_early_udbg_console();
62435499c01SPaul Mackerras 	}
62535499c01SPaul Mackerras 
62651d3082fSBenjamin Herrenschmidt 	/* Probe motherboard chipset */
62751d3082fSBenjamin Herrenschmidt 	pmac_feature_init();
62851d3082fSBenjamin Herrenschmidt 
62951d3082fSBenjamin Herrenschmidt 	/* Initialize debug stuff */
63051d3082fSBenjamin Herrenschmidt 	udbg_scc_init(!!strstr(cmd_line, "sccdbg"));
63151d3082fSBenjamin Herrenschmidt 	udbg_adb_init(!!strstr(cmd_line, "btextdbg"));
63251d3082fSBenjamin Herrenschmidt 
63351d3082fSBenjamin Herrenschmidt #ifdef CONFIG_PPC64
6341beb6a7dSBenjamin Herrenschmidt 	iommu_init_early_dart();
63535499c01SPaul Mackerras #endif
63635499c01SPaul Mackerras }
63735499c01SPaul Mackerras 
63835499c01SPaul Mackerras /*
63935499c01SPaul Mackerras  * pmac has no legacy IO, anything calling this function has to
64035499c01SPaul Mackerras  * fail or bad things will happen
64135499c01SPaul Mackerras  */
64235499c01SPaul Mackerras static int pmac_check_legacy_ioport(unsigned int baseport)
64335499c01SPaul Mackerras {
64435499c01SPaul Mackerras 	return -ENODEV;
64535499c01SPaul Mackerras }
64635499c01SPaul Mackerras 
64735499c01SPaul Mackerras static int __init pmac_declare_of_platform_devices(void)
648f6d57916SPaul Mackerras {
649a28d3af2SBenjamin Herrenschmidt 	struct device_node *np;
650f6d57916SPaul Mackerras 
651e8222502SBenjamin Herrenschmidt 	if (machine_is(chrp))
652e8222502SBenjamin Herrenschmidt 		return -1;
653e8222502SBenjamin Herrenschmidt 
654e8222502SBenjamin Herrenschmidt 	if (!machine_is(powermac))
655e8222502SBenjamin Herrenschmidt 		return 0;
656e8222502SBenjamin Herrenschmidt 
657730745a5SBenjamin Herrenschmidt 	np = of_find_node_by_name(NULL, "valkyrie");
65835499c01SPaul Mackerras 	if (np)
65935499c01SPaul Mackerras 		of_platform_device_create(np, "valkyrie", NULL);
660730745a5SBenjamin Herrenschmidt 	np = of_find_node_by_name(NULL, "platinum");
66135499c01SPaul Mackerras 	if (np)
66235499c01SPaul Mackerras 		of_platform_device_create(np, "platinum", NULL);
66335499c01SPaul Mackerras         np = of_find_node_by_type(NULL, "smu");
66435499c01SPaul Mackerras         if (np) {
66535499c01SPaul Mackerras 		of_platform_device_create(np, "smu", NULL);
66635499c01SPaul Mackerras 		of_node_put(np);
66735499c01SPaul Mackerras 	}
668f6d57916SPaul Mackerras 
669f6d57916SPaul Mackerras 	return 0;
670f6d57916SPaul Mackerras }
671f6d57916SPaul Mackerras 
672f6d57916SPaul Mackerras device_initcall(pmac_declare_of_platform_devices);
67335499c01SPaul Mackerras 
67435499c01SPaul Mackerras /*
67535499c01SPaul Mackerras  * Called very early, MMU is off, device-tree isn't unflattened
67635499c01SPaul Mackerras  */
677e8222502SBenjamin Herrenschmidt static int __init pmac_probe(void)
67835499c01SPaul Mackerras {
679e8222502SBenjamin Herrenschmidt 	unsigned long root = of_get_flat_dt_root();
680e8222502SBenjamin Herrenschmidt 
681e8222502SBenjamin Herrenschmidt 	if (!of_flat_dt_is_compatible(root, "Power Macintosh") &&
682e8222502SBenjamin Herrenschmidt 	    !of_flat_dt_is_compatible(root, "MacRISC"))
68335499c01SPaul Mackerras 		return 0;
68435499c01SPaul Mackerras 
685e8222502SBenjamin Herrenschmidt #ifdef CONFIG_PPC64
68635499c01SPaul Mackerras 	/*
68735499c01SPaul Mackerras 	 * On U3, the DART (iommu) must be allocated now since it
68835499c01SPaul Mackerras 	 * has an impact on htab_initialize (due to the large page it
68935499c01SPaul Mackerras 	 * occupies having to be broken up so the DART itself is not
69035499c01SPaul Mackerras 	 * part of the cacheable linar mapping
69135499c01SPaul Mackerras 	 */
6921beb6a7dSBenjamin Herrenschmidt 	alloc_dart_table();
6937d0daae4SMichael Ellerman 
6947d0daae4SMichael Ellerman 	hpte_init_native();
69535499c01SPaul Mackerras #endif
69635499c01SPaul Mackerras 
697e8222502SBenjamin Herrenschmidt #ifdef CONFIG_PPC32
698e8222502SBenjamin Herrenschmidt 	/* isa_io_base gets set in pmac_pci_init */
699e8222502SBenjamin Herrenschmidt 	ISA_DMA_THRESHOLD = ~0L;
700e8222502SBenjamin Herrenschmidt 	DMA_MODE_READ = 1;
701e8222502SBenjamin Herrenschmidt 	DMA_MODE_WRITE = 2;
702e8222502SBenjamin Herrenschmidt 
703e8222502SBenjamin Herrenschmidt #if defined(CONFIG_BLK_DEV_IDE) || defined(CONFIG_BLK_DEV_IDE_MODULE)
704e8222502SBenjamin Herrenschmidt #ifdef CONFIG_BLK_DEV_IDE_PMAC
705e8222502SBenjamin Herrenschmidt         ppc_ide_md.ide_init_hwif	= pmac_ide_init_hwif_ports;
706e8222502SBenjamin Herrenschmidt         ppc_ide_md.default_io_base	= pmac_ide_get_base;
707e8222502SBenjamin Herrenschmidt #endif /* CONFIG_BLK_DEV_IDE_PMAC */
708e8222502SBenjamin Herrenschmidt #endif /* defined(CONFIG_BLK_DEV_IDE) || defined(CONFIG_BLK_DEV_IDE_MODULE) */
709e8222502SBenjamin Herrenschmidt 
710e8222502SBenjamin Herrenschmidt #endif /* CONFIG_PPC32 */
711e8222502SBenjamin Herrenschmidt 
71235499c01SPaul Mackerras #ifdef CONFIG_PMAC_SMU
71335499c01SPaul Mackerras 	/*
71435499c01SPaul Mackerras 	 * SMU based G5s need some memory below 2Gb, at least the current
71535499c01SPaul Mackerras 	 * driver needs that. We have to allocate it now. We allocate 4k
71635499c01SPaul Mackerras 	 * (1 small page) for now.
71735499c01SPaul Mackerras 	 */
71835499c01SPaul Mackerras 	smu_cmdbuf_abs = lmb_alloc_base(4096, 4096, 0x80000000UL);
71935499c01SPaul Mackerras #endif /* CONFIG_PMAC_SMU */
72035499c01SPaul Mackerras 
72135499c01SPaul Mackerras 	return 1;
72235499c01SPaul Mackerras }
72335499c01SPaul Mackerras 
72435499c01SPaul Mackerras #ifdef CONFIG_PPC64
72551d3082fSBenjamin Herrenschmidt /* Move that to pci.c */
72651d3082fSBenjamin Herrenschmidt static int pmac_pci_probe_mode(struct pci_bus *bus)
72735499c01SPaul Mackerras {
72835499c01SPaul Mackerras 	struct device_node *node = bus->sysdata;
72935499c01SPaul Mackerras 
73035499c01SPaul Mackerras 	/* We need to use normal PCI probing for the AGP bus,
7311beb6a7dSBenjamin Herrenschmidt 	 * since the device for the AGP bridge isn't in the tree.
7321beb6a7dSBenjamin Herrenschmidt 	 */
7331beb6a7dSBenjamin Herrenschmidt 	if (bus->self == NULL && (device_is_compatible(node, "u3-agp") ||
7341beb6a7dSBenjamin Herrenschmidt 				  device_is_compatible(node, "u4-pcie")))
73535499c01SPaul Mackerras 		return PCI_PROBE_NORMAL;
73635499c01SPaul Mackerras 	return PCI_PROBE_DEVTREE;
73735499c01SPaul Mackerras }
73835499c01SPaul Mackerras #endif
73935499c01SPaul Mackerras 
740e8222502SBenjamin Herrenschmidt define_machine(powermac) {
741e8222502SBenjamin Herrenschmidt 	.name			= "PowerMac",
74235499c01SPaul Mackerras 	.probe			= pmac_probe,
74335499c01SPaul Mackerras 	.setup_arch		= pmac_setup_arch,
74435499c01SPaul Mackerras 	.init_early		= pmac_init_early,
74535499c01SPaul Mackerras 	.show_cpuinfo		= pmac_show_cpuinfo,
74635499c01SPaul Mackerras 	.init_IRQ		= pmac_pic_init,
747cc5d0189SBenjamin Herrenschmidt 	.get_irq		= NULL,	/* changed later */
748f90bb153SBenjamin Herrenschmidt 	.pci_irq_fixup		= pmac_pci_irq_fixup,
74935499c01SPaul Mackerras 	.restart		= pmac_restart,
75035499c01SPaul Mackerras 	.power_off		= pmac_power_off,
75135499c01SPaul Mackerras 	.halt			= pmac_halt,
75235499c01SPaul Mackerras 	.time_init		= pmac_time_init,
75335499c01SPaul Mackerras 	.get_boot_time		= pmac_get_boot_time,
75435499c01SPaul Mackerras 	.set_rtc_time		= pmac_set_rtc_time,
75535499c01SPaul Mackerras 	.get_rtc_time		= pmac_get_rtc_time,
75635499c01SPaul Mackerras 	.calibrate_decr		= pmac_calibrate_decr,
75735499c01SPaul Mackerras 	.feature_call		= pmac_do_feature_call,
75835499c01SPaul Mackerras 	.check_legacy_ioport	= pmac_check_legacy_ioport,
759be6b8439SKumar Gala 	.progress		= udbg_progress,
76035499c01SPaul Mackerras #ifdef CONFIG_PPC64
76151d3082fSBenjamin Herrenschmidt 	.pci_probe_mode		= pmac_pci_probe_mode,
762a0652fc9SPaul Mackerras 	.power_save		= power4_idle,
76335499c01SPaul Mackerras 	.enable_pmcs		= power4_enable_pmcs,
7643d1229d6SMichael Ellerman #ifdef CONFIG_KEXEC
7653d1229d6SMichael Ellerman 	.machine_kexec		= default_machine_kexec,
7663d1229d6SMichael Ellerman 	.machine_kexec_prepare	= default_machine_kexec_prepare,
767cc532915SMichael Ellerman 	.machine_crash_shutdown	= default_machine_crash_shutdown,
76835499c01SPaul Mackerras #endif
7693d1229d6SMichael Ellerman #endif /* CONFIG_PPC64 */
77035499c01SPaul Mackerras #ifdef CONFIG_PPC32
77135499c01SPaul Mackerras 	.pcibios_enable_device_hook = pmac_pci_enable_device_hook,
77235499c01SPaul Mackerras 	.pcibios_after_init	= pmac_pcibios_after_init,
77335499c01SPaul Mackerras 	.phys_mem_access_prot	= pci_phys_mem_access_prot,
77435499c01SPaul Mackerras #endif
775e8222502SBenjamin Herrenschmidt #if defined(CONFIG_HOTPLUG_CPU) && defined(CONFIG_PPC64)
776e8222502SBenjamin Herrenschmidt 	.cpu_die		= generic_mach_cpu_die,
777e8222502SBenjamin Herrenschmidt #endif
77835499c01SPaul Mackerras };
779