Thomas Gleixner | 2874c5f | 2019-05-27 08:55:01 +0200 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0-or-later |
Paul Mackerras | 14cf11a | 2005-09-26 16:04:21 +1000 | [diff] [blame] | 2 | /* |
Paul Mackerras | 35499c0 | 2005-10-22 16:02:39 +1000 | [diff] [blame] | 3 | * Powermac setup and early boot code plus other random bits. |
Paul Mackerras | 14cf11a | 2005-09-26 16:04:21 +1000 | [diff] [blame] | 4 | * |
| 5 | * PowerPC version |
| 6 | * Copyright (C) 1995-1996 Gary Thomas (gdt@linuxppc.org) |
| 7 | * |
| 8 | * Adapted for Power Macintosh by Paul Mackerras |
Paul Mackerras | 35499c0 | 2005-10-22 16:02:39 +1000 | [diff] [blame] | 9 | * Copyright (C) 1996 Paul Mackerras (paulus@samba.org) |
Paul Mackerras | 14cf11a | 2005-09-26 16:04:21 +1000 | [diff] [blame] | 10 | * |
| 11 | * Derived from "arch/alpha/kernel/setup.c" |
| 12 | * Copyright (C) 1995 Linus Torvalds |
| 13 | * |
| 14 | * Maintained by Benjamin Herrenschmidt (benh@kernel.crashing.org) |
Paul Mackerras | 14cf11a | 2005-09-26 16:04:21 +1000 | [diff] [blame] | 15 | */ |
| 16 | |
| 17 | /* |
| 18 | * bootup setup stuff.. |
| 19 | */ |
| 20 | |
Paul Mackerras | 14cf11a | 2005-09-26 16:04:21 +1000 | [diff] [blame] | 21 | #include <linux/init.h> |
| 22 | #include <linux/errno.h> |
| 23 | #include <linux/sched.h> |
| 24 | #include <linux/kernel.h> |
| 25 | #include <linux/mm.h> |
| 26 | #include <linux/stddef.h> |
| 27 | #include <linux/unistd.h> |
| 28 | #include <linux/ptrace.h> |
Paul Gortmaker | 66b15db | 2011-05-27 10:46:24 -0400 | [diff] [blame] | 29 | #include <linux/export.h> |
Paul Mackerras | 14cf11a | 2005-09-26 16:04:21 +1000 | [diff] [blame] | 30 | #include <linux/user.h> |
Paul Mackerras | 14cf11a | 2005-09-26 16:04:21 +1000 | [diff] [blame] | 31 | #include <linux/tty.h> |
| 32 | #include <linux/string.h> |
| 33 | #include <linux/delay.h> |
| 34 | #include <linux/ioport.h> |
| 35 | #include <linux/major.h> |
| 36 | #include <linux/initrd.h> |
| 37 | #include <linux/vt_kern.h> |
| 38 | #include <linux/console.h> |
Paul Mackerras | 14cf11a | 2005-09-26 16:04:21 +1000 | [diff] [blame] | 39 | #include <linux/pci.h> |
| 40 | #include <linux/adb.h> |
| 41 | #include <linux/cuda.h> |
| 42 | #include <linux/pmu.h> |
| 43 | #include <linux/irq.h> |
| 44 | #include <linux/seq_file.h> |
| 45 | #include <linux/root_dev.h> |
| 46 | #include <linux/bitops.h> |
| 47 | #include <linux/suspend.h> |
Jon Loeliger | 5f867dc | 2007-11-14 04:13:03 +1100 | [diff] [blame] | 48 | #include <linux/of_device.h> |
| 49 | #include <linux/of_platform.h> |
Paul Mackerras | 14cf11a | 2005-09-26 16:04:21 +1000 | [diff] [blame] | 50 | |
| 51 | #include <asm/reg.h> |
| 52 | #include <asm/sections.h> |
| 53 | #include <asm/prom.h> |
Paul Mackerras | 14cf11a | 2005-09-26 16:04:21 +1000 | [diff] [blame] | 54 | #include <asm/io.h> |
| 55 | #include <asm/pci-bridge.h> |
| 56 | #include <asm/ohare.h> |
| 57 | #include <asm/mediabay.h> |
| 58 | #include <asm/machdep.h> |
| 59 | #include <asm/dma.h> |
Paul Mackerras | 14cf11a | 2005-09-26 16:04:21 +1000 | [diff] [blame] | 60 | #include <asm/cputable.h> |
| 61 | #include <asm/btext.h> |
| 62 | #include <asm/pmac_feature.h> |
| 63 | #include <asm/time.h> |
Paul Mackerras | 14cf11a | 2005-09-26 16:04:21 +1000 | [diff] [blame] | 64 | #include <asm/mmu_context.h> |
Paul Mackerras | 35499c0 | 2005-10-22 16:02:39 +1000 | [diff] [blame] | 65 | #include <asm/iommu.h> |
| 66 | #include <asm/smu.h> |
| 67 | #include <asm/pmc.h> |
Benjamin Herrenschmidt | 51d3082 | 2005-11-23 17:57:25 +1100 | [diff] [blame] | 68 | #include <asm/udbg.h> |
Paul Mackerras | 14cf11a | 2005-09-26 16:04:21 +1000 | [diff] [blame] | 69 | |
Paul Mackerras | 3c3f42d | 2005-10-10 22:58:41 +1000 | [diff] [blame] | 70 | #include "pmac.h" |
Paul Mackerras | 14cf11a | 2005-09-26 16:04:21 +1000 | [diff] [blame] | 71 | |
| 72 | #undef SHOW_GATWICK_IRQS |
| 73 | |
Paul Mackerras | 14cf11a | 2005-09-26 16:04:21 +1000 | [diff] [blame] | 74 | int ppc_override_l2cr = 0; |
| 75 | int ppc_override_l2cr_value; |
| 76 | int has_l2cache = 0; |
| 77 | |
Olaf Hering | d2515c8 | 2006-01-22 22:19:02 +0100 | [diff] [blame] | 78 | int pmac_newworld; |
Paul Mackerras | 9b6b563 | 2005-10-06 12:06:20 +1000 | [diff] [blame] | 79 | |
Paul Mackerras | 14cf11a | 2005-09-26 16:04:21 +1000 | [diff] [blame] | 80 | static int current_root_goodness = -1; |
| 81 | |
Paul Mackerras | 14cf11a | 2005-09-26 16:04:21 +1000 | [diff] [blame] | 82 | #define DEFAULT_ROOT_DEVICE Root_SDA1 /* sda1 - slightly silly choice */ |
| 83 | |
Paul Mackerras | 35499c0 | 2005-10-22 16:02:39 +1000 | [diff] [blame] | 84 | #ifdef CONFIG_PPC64 |
Paul Mackerras | 35499c0 | 2005-10-22 16:02:39 +1000 | [diff] [blame] | 85 | int sccdbg; |
Paul Mackerras | 14cf11a | 2005-09-26 16:04:21 +1000 | [diff] [blame] | 86 | #endif |
| 87 | |
| 88 | sys_ctrler_t sys_ctrler = SYS_CTRLER_UNKNOWN; |
Paul Mackerras | 35499c0 | 2005-10-22 16:02:39 +1000 | [diff] [blame] | 89 | EXPORT_SYMBOL(sys_ctrler); |
| 90 | |
Paul Mackerras | 0dd194d | 2005-10-20 20:48:19 +1000 | [diff] [blame] | 91 | static void pmac_show_cpuinfo(struct seq_file *m) |
Paul Mackerras | 14cf11a | 2005-09-26 16:04:21 +1000 | [diff] [blame] | 92 | { |
| 93 | struct device_node *np; |
Jeremy Kerr | 018a3d1 | 2006-07-12 15:40:29 +1000 | [diff] [blame] | 94 | const char *pp; |
Paul Mackerras | 14cf11a | 2005-09-26 16:04:21 +1000 | [diff] [blame] | 95 | int plen; |
Paul Mackerras | 0dd194d | 2005-10-20 20:48:19 +1000 | [diff] [blame] | 96 | int mbmodel; |
| 97 | unsigned int mbflags; |
Paul Mackerras | 14cf11a | 2005-09-26 16:04:21 +1000 | [diff] [blame] | 98 | char* mbname; |
| 99 | |
Paul Mackerras | 0dd194d | 2005-10-20 20:48:19 +1000 | [diff] [blame] | 100 | mbmodel = pmac_call_feature(PMAC_FTR_GET_MB_INFO, NULL, |
| 101 | PMAC_MB_INFO_MODEL, 0); |
| 102 | mbflags = pmac_call_feature(PMAC_FTR_GET_MB_INFO, NULL, |
| 103 | PMAC_MB_INFO_FLAGS, 0); |
| 104 | if (pmac_call_feature(PMAC_FTR_GET_MB_INFO, NULL, PMAC_MB_INFO_NAME, |
| 105 | (long) &mbname) != 0) |
Paul Mackerras | 14cf11a | 2005-09-26 16:04:21 +1000 | [diff] [blame] | 106 | mbname = "Unknown"; |
| 107 | |
| 108 | /* find motherboard type */ |
| 109 | seq_printf(m, "machine\t\t: "); |
Paul Mackerras | 0dd194d | 2005-10-20 20:48:19 +1000 | [diff] [blame] | 110 | np = of_find_node_by_path("/"); |
Paul Mackerras | 14cf11a | 2005-09-26 16:04:21 +1000 | [diff] [blame] | 111 | if (np != NULL) { |
Stephen Rothwell | e2eb639 | 2007-04-03 22:26:41 +1000 | [diff] [blame] | 112 | pp = of_get_property(np, "model", NULL); |
Paul Mackerras | 14cf11a | 2005-09-26 16:04:21 +1000 | [diff] [blame] | 113 | if (pp != NULL) |
| 114 | seq_printf(m, "%s\n", pp); |
| 115 | else |
| 116 | seq_printf(m, "PowerMac\n"); |
Stephen Rothwell | e2eb639 | 2007-04-03 22:26:41 +1000 | [diff] [blame] | 117 | pp = of_get_property(np, "compatible", &plen); |
Paul Mackerras | 14cf11a | 2005-09-26 16:04:21 +1000 | [diff] [blame] | 118 | if (pp != NULL) { |
| 119 | seq_printf(m, "motherboard\t:"); |
| 120 | while (plen > 0) { |
| 121 | int l = strlen(pp) + 1; |
| 122 | seq_printf(m, " %s", pp); |
| 123 | plen -= l; |
| 124 | pp += l; |
| 125 | } |
| 126 | seq_printf(m, "\n"); |
| 127 | } |
Paul Mackerras | 0dd194d | 2005-10-20 20:48:19 +1000 | [diff] [blame] | 128 | of_node_put(np); |
Paul Mackerras | 14cf11a | 2005-09-26 16:04:21 +1000 | [diff] [blame] | 129 | } else |
| 130 | seq_printf(m, "PowerMac\n"); |
| 131 | |
| 132 | /* print parsed model */ |
| 133 | seq_printf(m, "detected as\t: %d (%s)\n", mbmodel, mbname); |
| 134 | seq_printf(m, "pmac flags\t: %08x\n", mbflags); |
| 135 | |
| 136 | /* find l2 cache info */ |
Paul Mackerras | 0dd194d | 2005-10-20 20:48:19 +1000 | [diff] [blame] | 137 | np = of_find_node_by_name(NULL, "l2-cache"); |
| 138 | if (np == NULL) |
| 139 | np = of_find_node_by_type(NULL, "cache"); |
| 140 | if (np != NULL) { |
Stephen Rothwell | e2eb639 | 2007-04-03 22:26:41 +1000 | [diff] [blame] | 141 | const unsigned int *ic = |
| 142 | of_get_property(np, "i-cache-size", NULL); |
| 143 | const unsigned int *dc = |
| 144 | of_get_property(np, "d-cache-size", NULL); |
Paul Mackerras | 14cf11a | 2005-09-26 16:04:21 +1000 | [diff] [blame] | 145 | seq_printf(m, "L2 cache\t:"); |
| 146 | has_l2cache = 1; |
Mathieu Malaterre | d873152 | 2018-04-13 20:41:43 +0200 | [diff] [blame] | 147 | if (of_get_property(np, "cache-unified", NULL) && dc) { |
Paul Mackerras | 14cf11a | 2005-09-26 16:04:21 +1000 | [diff] [blame] | 148 | seq_printf(m, " %dK unified", *dc / 1024); |
| 149 | } else { |
| 150 | if (ic) |
| 151 | seq_printf(m, " %dK instruction", *ic / 1024); |
| 152 | if (dc) |
| 153 | seq_printf(m, "%s %dK data", |
| 154 | (ic? " +": ""), *dc / 1024); |
| 155 | } |
Stephen Rothwell | e2eb639 | 2007-04-03 22:26:41 +1000 | [diff] [blame] | 156 | pp = of_get_property(np, "ram-type", NULL); |
Paul Mackerras | 14cf11a | 2005-09-26 16:04:21 +1000 | [diff] [blame] | 157 | if (pp) |
| 158 | seq_printf(m, " %s", pp); |
| 159 | seq_printf(m, "\n"); |
Paul Mackerras | 0dd194d | 2005-10-20 20:48:19 +1000 | [diff] [blame] | 160 | of_node_put(np); |
Paul Mackerras | 14cf11a | 2005-09-26 16:04:21 +1000 | [diff] [blame] | 161 | } |
| 162 | |
| 163 | /* Indicate newworld/oldworld */ |
| 164 | seq_printf(m, "pmac-generation\t: %s\n", |
| 165 | pmac_newworld ? "NewWorld" : "OldWorld"); |
Paul Mackerras | 14cf11a | 2005-09-26 16:04:21 +1000 | [diff] [blame] | 166 | } |
| 167 | |
Paul Mackerras | 35499c0 | 2005-10-22 16:02:39 +1000 | [diff] [blame] | 168 | #ifndef CONFIG_ADB_CUDA |
Nick Child | 7da1d1d | 2021-12-16 17:00:35 -0500 | [diff] [blame] | 169 | int __init find_via_cuda(void) |
Paul Mackerras | 35499c0 | 2005-10-22 16:02:39 +1000 | [diff] [blame] | 170 | { |
Stephen Rothwell | 30686ba | 2007-04-24 13:53:04 +1000 | [diff] [blame] | 171 | struct device_node *dn = of_find_node_by_name(NULL, "via-cuda"); |
| 172 | |
| 173 | if (!dn) |
Paul Mackerras | 35499c0 | 2005-10-22 16:02:39 +1000 | [diff] [blame] | 174 | return 0; |
Stephen Rothwell | 30686ba | 2007-04-24 13:53:04 +1000 | [diff] [blame] | 175 | of_node_put(dn); |
Paul Mackerras | 35499c0 | 2005-10-22 16:02:39 +1000 | [diff] [blame] | 176 | printk("WARNING ! Your machine is CUDA-based but your kernel\n"); |
| 177 | printk(" wasn't compiled with CONFIG_ADB_CUDA option !\n"); |
| 178 | return 0; |
| 179 | } |
| 180 | #endif |
| 181 | |
| 182 | #ifndef CONFIG_ADB_PMU |
Nick Child | 7da1d1d | 2021-12-16 17:00:35 -0500 | [diff] [blame] | 183 | int __init find_via_pmu(void) |
Paul Mackerras | 35499c0 | 2005-10-22 16:02:39 +1000 | [diff] [blame] | 184 | { |
Stephen Rothwell | 30686ba | 2007-04-24 13:53:04 +1000 | [diff] [blame] | 185 | struct device_node *dn = of_find_node_by_name(NULL, "via-pmu"); |
| 186 | |
| 187 | if (!dn) |
Paul Mackerras | 35499c0 | 2005-10-22 16:02:39 +1000 | [diff] [blame] | 188 | return 0; |
Stephen Rothwell | 30686ba | 2007-04-24 13:53:04 +1000 | [diff] [blame] | 189 | of_node_put(dn); |
Paul Mackerras | 35499c0 | 2005-10-22 16:02:39 +1000 | [diff] [blame] | 190 | printk("WARNING ! Your machine is PMU-based but your kernel\n"); |
| 191 | printk(" wasn't compiled with CONFIG_ADB_PMU option !\n"); |
Paul Mackerras | a575b80 | 2005-10-23 17:23:21 +1000 | [diff] [blame] | 192 | return 0; |
Paul Mackerras | 35499c0 | 2005-10-22 16:02:39 +1000 | [diff] [blame] | 193 | } |
| 194 | #endif |
| 195 | |
| 196 | #ifndef CONFIG_PMAC_SMU |
Nick Child | b346f57 | 2021-12-16 17:00:25 -0500 | [diff] [blame] | 197 | int __init smu_init(void) |
Paul Mackerras | 35499c0 | 2005-10-22 16:02:39 +1000 | [diff] [blame] | 198 | { |
| 199 | /* should check and warn if SMU is present */ |
| 200 | return 0; |
| 201 | } |
| 202 | #endif |
| 203 | |
| 204 | #ifdef CONFIG_PPC32 |
Paul Mackerras | 14cf11a | 2005-09-26 16:04:21 +1000 | [diff] [blame] | 205 | static volatile u32 *sysctrl_regs; |
| 206 | |
Paul Mackerras | 35499c0 | 2005-10-22 16:02:39 +1000 | [diff] [blame] | 207 | static void __init ohare_init(void) |
Paul Mackerras | 14cf11a | 2005-09-26 16:04:21 +1000 | [diff] [blame] | 208 | { |
Stephen Rothwell | 30686ba | 2007-04-24 13:53:04 +1000 | [diff] [blame] | 209 | struct device_node *dn; |
| 210 | |
Paul Mackerras | 14cf11a | 2005-09-26 16:04:21 +1000 | [diff] [blame] | 211 | /* this area has the CPU identification register |
| 212 | and some registers used by smp boards */ |
| 213 | sysctrl_regs = (volatile u32 *) ioremap(0xf8000000, 0x1000); |
Paul Mackerras | 14cf11a | 2005-09-26 16:04:21 +1000 | [diff] [blame] | 214 | |
Paul Mackerras | 35499c0 | 2005-10-22 16:02:39 +1000 | [diff] [blame] | 215 | /* |
| 216 | * Turn on the L2 cache. |
| 217 | * We assume that we have a PSX memory controller iff |
| 218 | * we have an ohare I/O controller. |
| 219 | */ |
Stephen Rothwell | 30686ba | 2007-04-24 13:53:04 +1000 | [diff] [blame] | 220 | dn = of_find_node_by_name(NULL, "ohare"); |
| 221 | if (dn) { |
| 222 | of_node_put(dn); |
Paul Mackerras | 35499c0 | 2005-10-22 16:02:39 +1000 | [diff] [blame] | 223 | if (((sysctrl_regs[2] >> 24) & 0xf) >= 3) { |
| 224 | if (sysctrl_regs[4] & 0x10) |
| 225 | sysctrl_regs[4] |= 0x04000020; |
| 226 | else |
| 227 | sysctrl_regs[4] |= 0x04000000; |
| 228 | if(has_l2cache) |
| 229 | printk(KERN_INFO "Level 2 cache enabled\n"); |
| 230 | } |
| 231 | } |
| 232 | } |
Paul Mackerras | 14cf11a | 2005-09-26 16:04:21 +1000 | [diff] [blame] | 233 | |
Paul Mackerras | 35499c0 | 2005-10-22 16:02:39 +1000 | [diff] [blame] | 234 | static void __init l2cr_init(void) |
| 235 | { |
Paul Mackerras | 14cf11a | 2005-09-26 16:04:21 +1000 | [diff] [blame] | 236 | /* Checks "l2cr-value" property in the registry */ |
| 237 | if (cpu_has_feature(CPU_FTR_L2CR)) { |
Rob Herring | a94fe36 | 2018-08-27 12:24:09 -0500 | [diff] [blame] | 238 | struct device_node *np; |
| 239 | |
| 240 | for_each_of_cpu_node(np) { |
Jeremy Kerr | 018a3d1 | 2006-07-12 15:40:29 +1000 | [diff] [blame] | 241 | const unsigned int *l2cr = |
Stephen Rothwell | e2eb639 | 2007-04-03 22:26:41 +1000 | [diff] [blame] | 242 | of_get_property(np, "l2cr-value", NULL); |
Mathieu Malaterre | d873152 | 2018-04-13 20:41:43 +0200 | [diff] [blame] | 243 | if (l2cr) { |
Paul Mackerras | 14cf11a | 2005-09-26 16:04:21 +1000 | [diff] [blame] | 244 | ppc_override_l2cr = 1; |
| 245 | ppc_override_l2cr_value = *l2cr; |
| 246 | _set_L2CR(0); |
| 247 | _set_L2CR(ppc_override_l2cr_value); |
| 248 | } |
Stephen Rothwell | 1658ab6 | 2007-04-24 13:51:59 +1000 | [diff] [blame] | 249 | of_node_put(np); |
Rob Herring | a94fe36 | 2018-08-27 12:24:09 -0500 | [diff] [blame] | 250 | break; |
Paul Mackerras | 14cf11a | 2005-09-26 16:04:21 +1000 | [diff] [blame] | 251 | } |
| 252 | } |
| 253 | |
| 254 | if (ppc_override_l2cr) |
Paul Mackerras | 35499c0 | 2005-10-22 16:02:39 +1000 | [diff] [blame] | 255 | printk(KERN_INFO "L2CR overridden (0x%x), " |
| 256 | "backside cache is %s\n", |
| 257 | ppc_override_l2cr_value, |
| 258 | (ppc_override_l2cr_value & 0x80000000) |
Paul Mackerras | 14cf11a | 2005-09-26 16:04:21 +1000 | [diff] [blame] | 259 | ? "enabled" : "disabled"); |
Paul Mackerras | 35499c0 | 2005-10-22 16:02:39 +1000 | [diff] [blame] | 260 | } |
| 261 | #endif |
| 262 | |
Arnd Bergmann | ff38e7c | 2006-01-11 00:00:03 +0000 | [diff] [blame] | 263 | static void __init pmac_setup_arch(void) |
Paul Mackerras | 35499c0 | 2005-10-22 16:02:39 +1000 | [diff] [blame] | 264 | { |
Paul Mackerras | a575b80 | 2005-10-23 17:23:21 +1000 | [diff] [blame] | 265 | struct device_node *cpu, *ic; |
Jeremy Kerr | 018a3d1 | 2006-07-12 15:40:29 +1000 | [diff] [blame] | 266 | const int *fp; |
Paul Mackerras | 35499c0 | 2005-10-22 16:02:39 +1000 | [diff] [blame] | 267 | unsigned long pvr; |
| 268 | |
| 269 | pvr = PVR_VER(mfspr(SPRN_PVR)); |
| 270 | |
| 271 | /* Set loops_per_jiffy to a half-way reasonable value, |
| 272 | for use until calibrate_delay gets called. */ |
| 273 | loops_per_jiffy = 50000000 / HZ; |
Rob Herring | a94fe36 | 2018-08-27 12:24:09 -0500 | [diff] [blame] | 274 | |
| 275 | for_each_of_cpu_node(cpu) { |
Stephen Rothwell | e2eb639 | 2007-04-03 22:26:41 +1000 | [diff] [blame] | 276 | fp = of_get_property(cpu, "clock-frequency", NULL); |
Paul Mackerras | 35499c0 | 2005-10-22 16:02:39 +1000 | [diff] [blame] | 277 | if (fp != NULL) { |
| 278 | if (pvr >= 0x30 && pvr < 0x80) |
| 279 | /* PPC970 etc. */ |
| 280 | loops_per_jiffy = *fp / (3 * HZ); |
| 281 | else if (pvr == 4 || pvr >= 8) |
| 282 | /* 604, G3, G4 etc. */ |
| 283 | loops_per_jiffy = *fp / HZ; |
| 284 | else |
Christophe Leroy | 8b14e1d | 2020-09-29 06:48:36 +0000 | [diff] [blame] | 285 | /* 603, etc. */ |
Paul Mackerras | 35499c0 | 2005-10-22 16:02:39 +1000 | [diff] [blame] | 286 | loops_per_jiffy = *fp / (2 * HZ); |
Rob Herring | a94fe36 | 2018-08-27 12:24:09 -0500 | [diff] [blame] | 287 | of_node_put(cpu); |
| 288 | break; |
Paul Mackerras | 35499c0 | 2005-10-22 16:02:39 +1000 | [diff] [blame] | 289 | } |
Paul Mackerras | 35499c0 | 2005-10-22 16:02:39 +1000 | [diff] [blame] | 290 | } |
| 291 | |
Paul Mackerras | a575b80 | 2005-10-23 17:23:21 +1000 | [diff] [blame] | 292 | /* See if newworld or oldworld */ |
Michael Ellerman | 22059a9 | 2008-11-12 18:20:43 +0000 | [diff] [blame] | 293 | ic = of_find_node_with_property(NULL, "interrupt-controller"); |
Olaf Hering | d2515c8 | 2006-01-22 22:19:02 +0100 | [diff] [blame] | 294 | if (ic) { |
| 295 | pmac_newworld = 1; |
Paul Mackerras | a575b80 | 2005-10-23 17:23:21 +1000 | [diff] [blame] | 296 | of_node_put(ic); |
Olaf Hering | d2515c8 | 2006-01-22 22:19:02 +0100 | [diff] [blame] | 297 | } |
Paul Mackerras | a575b80 | 2005-10-23 17:23:21 +1000 | [diff] [blame] | 298 | |
Paul Mackerras | 35499c0 | 2005-10-22 16:02:39 +1000 | [diff] [blame] | 299 | #ifdef CONFIG_PPC32 |
| 300 | ohare_init(); |
| 301 | l2cr_init(); |
| 302 | #endif /* CONFIG_PPC32 */ |
| 303 | |
Paul Mackerras | 14cf11a | 2005-09-26 16:04:21 +1000 | [diff] [blame] | 304 | find_via_cuda(); |
Paul Mackerras | 14cf11a | 2005-09-26 16:04:21 +1000 | [diff] [blame] | 305 | find_via_pmu(); |
Paul Mackerras | 35499c0 | 2005-10-22 16:02:39 +1000 | [diff] [blame] | 306 | smu_init(); |
| 307 | |
Finn Thain | 20e07af | 2019-01-15 15:18:56 +1100 | [diff] [blame] | 308 | #if IS_ENABLED(CONFIG_NVRAM) |
Paul Mackerras | 14cf11a | 2005-09-26 16:04:21 +1000 | [diff] [blame] | 309 | pmac_nvram_init(); |
| 310 | #endif |
Paul Mackerras | 35499c0 | 2005-10-22 16:02:39 +1000 | [diff] [blame] | 311 | #ifdef CONFIG_PPC32 |
Paul Mackerras | 14cf11a | 2005-09-26 16:04:21 +1000 | [diff] [blame] | 312 | #ifdef CONFIG_BLK_DEV_INITRD |
| 313 | if (initrd_start) |
| 314 | ROOT_DEV = Root_RAM0; |
| 315 | else |
| 316 | #endif |
| 317 | ROOT_DEV = DEFAULT_ROOT_DEVICE; |
Paul Mackerras | 35499c0 | 2005-10-22 16:02:39 +1000 | [diff] [blame] | 318 | #endif |
Paul Mackerras | 14cf11a | 2005-09-26 16:04:21 +1000 | [diff] [blame] | 319 | |
Benjamin Herrenschmidt | e822250 | 2006-03-28 23:15:54 +1100 | [diff] [blame] | 320 | #ifdef CONFIG_ADB |
Anton Blanchard | 3e47d14 | 2014-09-17 14:39:36 +1000 | [diff] [blame] | 321 | if (strstr(boot_command_line, "adb_sync")) { |
Benjamin Herrenschmidt | e822250 | 2006-03-28 23:15:54 +1100 | [diff] [blame] | 322 | extern int __adb_probe_sync; |
| 323 | __adb_probe_sync = 1; |
| 324 | } |
| 325 | #endif /* CONFIG_ADB */ |
Paul Mackerras | 14cf11a | 2005-09-26 16:04:21 +1000 | [diff] [blame] | 326 | } |
| 327 | |
Paul Mackerras | 14cf11a | 2005-09-26 16:04:21 +1000 | [diff] [blame] | 328 | #ifdef CONFIG_SCSI |
Li Yang | 405861a | 2007-05-23 11:28:03 +0800 | [diff] [blame] | 329 | void note_scsi_host(struct device_node *node, void *host) |
Paul Mackerras | 14cf11a | 2005-09-26 16:04:21 +1000 | [diff] [blame] | 330 | { |
Paul Mackerras | 14cf11a | 2005-09-26 16:04:21 +1000 | [diff] [blame] | 331 | } |
Paul Mackerras | 9b6b563 | 2005-10-06 12:06:20 +1000 | [diff] [blame] | 332 | EXPORT_SYMBOL(note_scsi_host); |
Paul Mackerras | 14cf11a | 2005-09-26 16:04:21 +1000 | [diff] [blame] | 333 | #endif |
| 334 | |
Paul Mackerras | 35499c0 | 2005-10-22 16:02:39 +1000 | [diff] [blame] | 335 | static int initializing = 1; |
| 336 | |
Paul Mackerras | 14cf11a | 2005-09-26 16:04:21 +1000 | [diff] [blame] | 337 | static int pmac_late_init(void) |
| 338 | { |
| 339 | initializing = 0; |
Paul Mackerras | 14cf11a | 2005-09-26 16:04:21 +1000 | [diff] [blame] | 340 | return 0; |
| 341 | } |
Grant Likely | d518b71 | 2008-01-03 06:14:28 +1100 | [diff] [blame] | 342 | machine_late_initcall(powermac, pmac_late_init); |
Paul Mackerras | 14cf11a | 2005-09-26 16:04:21 +1000 | [diff] [blame] | 343 | |
Mathieu Malaterre | f72cf3f | 2018-04-04 22:13:05 +0200 | [diff] [blame] | 344 | void note_bootable_part(dev_t dev, int part, int goodness); |
Stephen Rothwell | d741803 | 2007-10-04 12:00:28 +1000 | [diff] [blame] | 345 | /* |
Fabian Frederick | bd721ea | 2016-08-02 14:03:33 -0700 | [diff] [blame] | 346 | * This is __ref because we check for "initializing" before |
Stephen Rothwell | d741803 | 2007-10-04 12:00:28 +1000 | [diff] [blame] | 347 | * touching any of the __init sensitive things and "initializing" |
| 348 | * will be false after __init time. This can't be __init because it |
| 349 | * can be called whenever a disk is first accessed. |
| 350 | */ |
Fabian Frederick | bd721ea | 2016-08-02 14:03:33 -0700 | [diff] [blame] | 351 | void __ref note_bootable_part(dev_t dev, int part, int goodness) |
Paul Mackerras | 14cf11a | 2005-09-26 16:04:21 +1000 | [diff] [blame] | 352 | { |
Paul Mackerras | 14cf11a | 2005-09-26 16:04:21 +1000 | [diff] [blame] | 353 | char *p; |
| 354 | |
| 355 | if (!initializing) |
| 356 | return; |
| 357 | if ((goodness <= current_root_goodness) && |
| 358 | ROOT_DEV != DEFAULT_ROOT_DEVICE) |
| 359 | return; |
Alon Bar-Lev | b8757b2 | 2007-02-12 00:54:17 -0800 | [diff] [blame] | 360 | p = strstr(boot_command_line, "root="); |
| 361 | if (p != NULL && (p == boot_command_line || p[-1] == ' ')) |
Paul Mackerras | 14cf11a | 2005-09-26 16:04:21 +1000 | [diff] [blame] | 362 | return; |
| 363 | |
Paul Mackerras | 6ee0d9f | 2007-10-04 13:47:06 +1000 | [diff] [blame] | 364 | ROOT_DEV = dev + part; |
| 365 | current_root_goodness = goodness; |
Paul Mackerras | 14cf11a | 2005-09-26 16:04:21 +1000 | [diff] [blame] | 366 | } |
| 367 | |
Paul Mackerras | 35499c0 | 2005-10-22 16:02:39 +1000 | [diff] [blame] | 368 | #ifdef CONFIG_ADB_CUDA |
Daniel Axtens | 95ec77c | 2016-07-12 10:54:52 +1000 | [diff] [blame] | 369 | static void __noreturn cuda_restart(void) |
Paul Mackerras | 14cf11a | 2005-09-26 16:04:21 +1000 | [diff] [blame] | 370 | { |
Paul Mackerras | 14cf11a | 2005-09-26 16:04:21 +1000 | [diff] [blame] | 371 | struct adb_request req; |
Paul Mackerras | 14cf11a | 2005-09-26 16:04:21 +1000 | [diff] [blame] | 372 | |
Paul Mackerras | 35499c0 | 2005-10-22 16:02:39 +1000 | [diff] [blame] | 373 | cuda_request(&req, NULL, 2, CUDA_PACKET, CUDA_RESET_SYSTEM); |
| 374 | for (;;) |
| 375 | cuda_poll(); |
| 376 | } |
| 377 | |
Daniel Axtens | 95ec77c | 2016-07-12 10:54:52 +1000 | [diff] [blame] | 378 | static void __noreturn cuda_shutdown(void) |
Paul Mackerras | 35499c0 | 2005-10-22 16:02:39 +1000 | [diff] [blame] | 379 | { |
| 380 | struct adb_request req; |
| 381 | |
| 382 | cuda_request(&req, NULL, 2, CUDA_PACKET, CUDA_POWERDOWN); |
| 383 | for (;;) |
| 384 | cuda_poll(); |
| 385 | } |
| 386 | |
| 387 | #else |
| 388 | #define cuda_restart() |
| 389 | #define cuda_shutdown() |
| 390 | #endif |
| 391 | |
| 392 | #ifndef CONFIG_ADB_PMU |
| 393 | #define pmu_restart() |
| 394 | #define pmu_shutdown() |
| 395 | #endif |
| 396 | |
| 397 | #ifndef CONFIG_PMAC_SMU |
| 398 | #define smu_restart() |
| 399 | #define smu_shutdown() |
| 400 | #endif |
| 401 | |
Daniel Axtens | 95ec77c | 2016-07-12 10:54:52 +1000 | [diff] [blame] | 402 | static void __noreturn pmac_restart(char *cmd) |
Paul Mackerras | 35499c0 | 2005-10-22 16:02:39 +1000 | [diff] [blame] | 403 | { |
Paul Mackerras | 14cf11a | 2005-09-26 16:04:21 +1000 | [diff] [blame] | 404 | switch (sys_ctrler) { |
Paul Mackerras | 14cf11a | 2005-09-26 16:04:21 +1000 | [diff] [blame] | 405 | case SYS_CTRLER_CUDA: |
Paul Mackerras | 35499c0 | 2005-10-22 16:02:39 +1000 | [diff] [blame] | 406 | cuda_restart(); |
Paul Mackerras | 14cf11a | 2005-09-26 16:04:21 +1000 | [diff] [blame] | 407 | break; |
Paul Mackerras | 14cf11a | 2005-09-26 16:04:21 +1000 | [diff] [blame] | 408 | case SYS_CTRLER_PMU: |
| 409 | pmu_restart(); |
| 410 | break; |
Paul Mackerras | 35499c0 | 2005-10-22 16:02:39 +1000 | [diff] [blame] | 411 | case SYS_CTRLER_SMU: |
| 412 | smu_restart(); |
| 413 | break; |
Paul Mackerras | 14cf11a | 2005-09-26 16:04:21 +1000 | [diff] [blame] | 414 | default: ; |
| 415 | } |
Daniel Axtens | 95ec77c | 2016-07-12 10:54:52 +1000 | [diff] [blame] | 416 | while (1) ; |
Paul Mackerras | 14cf11a | 2005-09-26 16:04:21 +1000 | [diff] [blame] | 417 | } |
| 418 | |
Daniel Axtens | 95ec77c | 2016-07-12 10:54:52 +1000 | [diff] [blame] | 419 | static void __noreturn pmac_power_off(void) |
Paul Mackerras | 14cf11a | 2005-09-26 16:04:21 +1000 | [diff] [blame] | 420 | { |
Paul Mackerras | 14cf11a | 2005-09-26 16:04:21 +1000 | [diff] [blame] | 421 | switch (sys_ctrler) { |
Paul Mackerras | 14cf11a | 2005-09-26 16:04:21 +1000 | [diff] [blame] | 422 | case SYS_CTRLER_CUDA: |
Paul Mackerras | 35499c0 | 2005-10-22 16:02:39 +1000 | [diff] [blame] | 423 | cuda_shutdown(); |
Paul Mackerras | 14cf11a | 2005-09-26 16:04:21 +1000 | [diff] [blame] | 424 | break; |
Paul Mackerras | 14cf11a | 2005-09-26 16:04:21 +1000 | [diff] [blame] | 425 | case SYS_CTRLER_PMU: |
| 426 | pmu_shutdown(); |
| 427 | break; |
Paul Mackerras | 35499c0 | 2005-10-22 16:02:39 +1000 | [diff] [blame] | 428 | case SYS_CTRLER_SMU: |
| 429 | smu_shutdown(); |
| 430 | break; |
Paul Mackerras | 14cf11a | 2005-09-26 16:04:21 +1000 | [diff] [blame] | 431 | default: ; |
| 432 | } |
Daniel Axtens | 95ec77c | 2016-07-12 10:54:52 +1000 | [diff] [blame] | 433 | while (1) ; |
Paul Mackerras | 14cf11a | 2005-09-26 16:04:21 +1000 | [diff] [blame] | 434 | } |
| 435 | |
Daniel Axtens | 95ec77c | 2016-07-12 10:54:52 +1000 | [diff] [blame] | 436 | static void __noreturn |
Paul Mackerras | 14cf11a | 2005-09-26 16:04:21 +1000 | [diff] [blame] | 437 | pmac_halt(void) |
| 438 | { |
| 439 | pmac_power_off(); |
| 440 | } |
| 441 | |
Paul Mackerras | 35499c0 | 2005-10-22 16:02:39 +1000 | [diff] [blame] | 442 | /* |
| 443 | * Early initialization. |
| 444 | */ |
Benjamin Herrenschmidt | f2d5769 | 2016-07-05 15:04:06 +1000 | [diff] [blame] | 445 | static void __init pmac_init(void) |
Paul Mackerras | 14cf11a | 2005-09-26 16:04:21 +1000 | [diff] [blame] | 446 | { |
Benjamin Herrenschmidt | 51d3082 | 2005-11-23 17:57:25 +1100 | [diff] [blame] | 447 | /* Enable early btext debug if requested */ |
Anton Blanchard | 3e47d14 | 2014-09-17 14:39:36 +1000 | [diff] [blame] | 448 | if (strstr(boot_command_line, "btextdbg")) { |
Benjamin Herrenschmidt | 51d3082 | 2005-11-23 17:57:25 +1100 | [diff] [blame] | 449 | udbg_adb_init_early(); |
| 450 | register_early_udbg_console(); |
Paul Mackerras | 35499c0 | 2005-10-22 16:02:39 +1000 | [diff] [blame] | 451 | } |
| 452 | |
Benjamin Herrenschmidt | 51d3082 | 2005-11-23 17:57:25 +1100 | [diff] [blame] | 453 | /* Probe motherboard chipset */ |
| 454 | pmac_feature_init(); |
| 455 | |
Benjamin Herrenschmidt | 51d3082 | 2005-11-23 17:57:25 +1100 | [diff] [blame] | 456 | /* Initialize debug stuff */ |
Anton Blanchard | 3e47d14 | 2014-09-17 14:39:36 +1000 | [diff] [blame] | 457 | udbg_scc_init(!!strstr(boot_command_line, "sccdbg")); |
| 458 | udbg_adb_init(!!strstr(boot_command_line, "btextdbg")); |
Benjamin Herrenschmidt | 51d3082 | 2005-11-23 17:57:25 +1100 | [diff] [blame] | 459 | |
| 460 | #ifdef CONFIG_PPC64 |
Daniel Axtens | e63f26d | 2015-03-31 16:00:49 +1100 | [diff] [blame] | 461 | iommu_init_early_dart(&pmac_pci_controller_ops); |
Paul Mackerras | 35499c0 | 2005-10-22 16:02:39 +1000 | [diff] [blame] | 462 | #endif |
Benjamin Herrenschmidt | 7ccbe50 | 2009-06-18 23:30:07 +0000 | [diff] [blame] | 463 | |
| 464 | /* SMP Init has to be done early as we need to patch up |
Anton Blanchard | 828a698 | 2010-04-26 15:32:44 +0000 | [diff] [blame] | 465 | * cpu_possible_mask before interrupt stacks are allocated |
Benjamin Herrenschmidt | 7ccbe50 | 2009-06-18 23:30:07 +0000 | [diff] [blame] | 466 | * or kaboom... |
| 467 | */ |
| 468 | #ifdef CONFIG_SMP |
| 469 | pmac_setup_smp(); |
| 470 | #endif |
Paul Mackerras | 35499c0 | 2005-10-22 16:02:39 +1000 | [diff] [blame] | 471 | } |
| 472 | |
Paul Mackerras | 35499c0 | 2005-10-22 16:02:39 +1000 | [diff] [blame] | 473 | static int __init pmac_declare_of_platform_devices(void) |
Paul Mackerras | 14cf11a | 2005-09-26 16:04:21 +1000 | [diff] [blame] | 474 | { |
Benjamin Herrenschmidt | a28d3af | 2006-01-07 11:35:26 +1100 | [diff] [blame] | 475 | struct device_node *np; |
Paul Mackerras | 14cf11a | 2005-09-26 16:04:21 +1000 | [diff] [blame] | 476 | |
Benjamin Herrenschmidt | 730745a | 2006-01-07 11:30:44 +1100 | [diff] [blame] | 477 | np = of_find_node_by_name(NULL, "valkyrie"); |
Julia Lawall | 3631cb8 | 2011-08-21 06:10:01 +0000 | [diff] [blame] | 478 | if (np) { |
Paul Mackerras | 35499c0 | 2005-10-22 16:02:39 +1000 | [diff] [blame] | 479 | of_platform_device_create(np, "valkyrie", NULL); |
Julia Lawall | 3631cb8 | 2011-08-21 06:10:01 +0000 | [diff] [blame] | 480 | of_node_put(np); |
| 481 | } |
Benjamin Herrenschmidt | 730745a | 2006-01-07 11:30:44 +1100 | [diff] [blame] | 482 | np = of_find_node_by_name(NULL, "platinum"); |
Julia Lawall | 3631cb8 | 2011-08-21 06:10:01 +0000 | [diff] [blame] | 483 | if (np) { |
Paul Mackerras | 35499c0 | 2005-10-22 16:02:39 +1000 | [diff] [blame] | 484 | of_platform_device_create(np, "platinum", NULL); |
Julia Lawall | 3631cb8 | 2011-08-21 06:10:01 +0000 | [diff] [blame] | 485 | of_node_put(np); |
| 486 | } |
Paul Mackerras | 35499c0 | 2005-10-22 16:02:39 +1000 | [diff] [blame] | 487 | np = of_find_node_by_type(NULL, "smu"); |
| 488 | if (np) { |
| 489 | of_platform_device_create(np, "smu", NULL); |
| 490 | of_node_put(np); |
| 491 | } |
Marc Zyngier | 98b14d6 | 2010-12-05 05:05:37 +0000 | [diff] [blame] | 492 | np = of_find_node_by_type(NULL, "fcu"); |
| 493 | if (np == NULL) { |
| 494 | /* Some machines have strangely broken device-tree */ |
| 495 | np = of_find_node_by_path("/u3@0,f8000000/i2c@f8001000/fan@15e"); |
| 496 | } |
| 497 | if (np) { |
| 498 | of_platform_device_create(np, "temperature", NULL); |
| 499 | of_node_put(np); |
| 500 | } |
Paul Mackerras | 14cf11a | 2005-09-26 16:04:21 +1000 | [diff] [blame] | 501 | |
| 502 | return 0; |
| 503 | } |
Grant Likely | d518b71 | 2008-01-03 06:14:28 +1100 | [diff] [blame] | 504 | machine_device_initcall(powermac, pmac_declare_of_platform_devices); |
Paul Mackerras | 35499c0 | 2005-10-22 16:02:39 +1000 | [diff] [blame] | 505 | |
Benjamin Herrenschmidt | 025d791 | 2008-07-28 13:49:15 +1000 | [diff] [blame] | 506 | #ifdef CONFIG_SERIAL_PMACZILOG_CONSOLE |
| 507 | /* |
| 508 | * This is called very early, as part of console_init() (typically just after |
| 509 | * time_init()). This function is respondible for trying to find a good |
| 510 | * default console on serial ports. It tries to match the open firmware |
| 511 | * default output with one of the available serial console drivers. |
| 512 | */ |
| 513 | static int __init check_pmac_serial_console(void) |
| 514 | { |
| 515 | struct device_node *prom_stdout = NULL; |
| 516 | int offset = 0; |
| 517 | const char *name; |
| 518 | #ifdef CONFIG_SERIAL_PMACZILOG_TTYS |
| 519 | char *devname = "ttyS"; |
| 520 | #else |
| 521 | char *devname = "ttyPZ"; |
| 522 | #endif |
| 523 | |
| 524 | pr_debug(" -> check_pmac_serial_console()\n"); |
| 525 | |
| 526 | /* The user has requested a console so this is already set up. */ |
| 527 | if (strstr(boot_command_line, "console=")) { |
| 528 | pr_debug(" console was specified !\n"); |
| 529 | return -EBUSY; |
| 530 | } |
| 531 | |
| 532 | if (!of_chosen) { |
| 533 | pr_debug(" of_chosen is NULL !\n"); |
| 534 | return -ENODEV; |
| 535 | } |
| 536 | |
| 537 | /* We are getting a weird phandle from OF ... */ |
| 538 | /* ... So use the full path instead */ |
| 539 | name = of_get_property(of_chosen, "linux,stdout-path", NULL); |
| 540 | if (name == NULL) { |
| 541 | pr_debug(" no linux,stdout-path !\n"); |
| 542 | return -ENODEV; |
| 543 | } |
| 544 | prom_stdout = of_find_node_by_path(name); |
| 545 | if (!prom_stdout) { |
| 546 | pr_debug(" can't find stdout package %s !\n", name); |
| 547 | return -ENODEV; |
| 548 | } |
Rob Herring | b7c670d | 2017-08-21 10:16:47 -0500 | [diff] [blame] | 549 | pr_debug("stdout is %pOF\n", prom_stdout); |
Benjamin Herrenschmidt | 025d791 | 2008-07-28 13:49:15 +1000 | [diff] [blame] | 550 | |
Rob Herring | 2c8e65b | 2018-12-05 13:50:18 -0600 | [diff] [blame] | 551 | if (of_node_name_eq(prom_stdout, "ch-a")) |
Benjamin Herrenschmidt | 025d791 | 2008-07-28 13:49:15 +1000 | [diff] [blame] | 552 | offset = 0; |
Rob Herring | 2c8e65b | 2018-12-05 13:50:18 -0600 | [diff] [blame] | 553 | else if (of_node_name_eq(prom_stdout, "ch-b")) |
Benjamin Herrenschmidt | 025d791 | 2008-07-28 13:49:15 +1000 | [diff] [blame] | 554 | offset = 1; |
| 555 | else |
| 556 | goto not_found; |
| 557 | of_node_put(prom_stdout); |
| 558 | |
| 559 | pr_debug("Found serial console at %s%d\n", devname, offset); |
| 560 | |
| 561 | return add_preferred_console(devname, offset, NULL); |
| 562 | |
| 563 | not_found: |
| 564 | pr_debug("No preferred console found !\n"); |
| 565 | of_node_put(prom_stdout); |
| 566 | return -ENODEV; |
| 567 | } |
| 568 | console_initcall(check_pmac_serial_console); |
| 569 | |
| 570 | #endif /* CONFIG_SERIAL_PMACZILOG_CONSOLE */ |
| 571 | |
Paul Mackerras | 35499c0 | 2005-10-22 16:02:39 +1000 | [diff] [blame] | 572 | /* |
| 573 | * Called very early, MMU is off, device-tree isn't unflattened |
| 574 | */ |
Benjamin Herrenschmidt | e822250 | 2006-03-28 23:15:54 +1100 | [diff] [blame] | 575 | static int __init pmac_probe(void) |
Paul Mackerras | 35499c0 | 2005-10-22 16:02:39 +1000 | [diff] [blame] | 576 | { |
Benjamin Herrenschmidt | 406b0b6 | 2016-07-05 15:04:00 +1000 | [diff] [blame] | 577 | if (!of_machine_is_compatible("Power Macintosh") && |
| 578 | !of_machine_is_compatible("MacRISC")) |
| 579 | return 0; |
Paul Mackerras | 35499c0 | 2005-10-22 16:02:39 +1000 | [diff] [blame] | 580 | |
Benjamin Herrenschmidt | e822250 | 2006-03-28 23:15:54 +1100 | [diff] [blame] | 581 | #ifdef CONFIG_PPC32 |
| 582 | /* isa_io_base gets set in pmac_pci_init */ |
Benjamin Herrenschmidt | e822250 | 2006-03-28 23:15:54 +1100 | [diff] [blame] | 583 | DMA_MODE_READ = 1; |
| 584 | DMA_MODE_WRITE = 2; |
Benjamin Herrenschmidt | e822250 | 2006-03-28 23:15:54 +1100 | [diff] [blame] | 585 | #endif /* CONFIG_PPC32 */ |
| 586 | |
Alexander Graf | 9178ba2 | 2014-10-13 16:01:09 +0200 | [diff] [blame] | 587 | pm_power_off = pmac_power_off; |
| 588 | |
Benjamin Herrenschmidt | f2d5769 | 2016-07-05 15:04:06 +1000 | [diff] [blame] | 589 | pmac_init(); |
| 590 | |
Paul Mackerras | 35499c0 | 2005-10-22 16:02:39 +1000 | [diff] [blame] | 591 | return 1; |
| 592 | } |
| 593 | |
Benjamin Herrenschmidt | e822250 | 2006-03-28 23:15:54 +1100 | [diff] [blame] | 594 | define_machine(powermac) { |
| 595 | .name = "PowerMac", |
Paul Mackerras | 35499c0 | 2005-10-22 16:02:39 +1000 | [diff] [blame] | 596 | .probe = pmac_probe, |
| 597 | .setup_arch = pmac_setup_arch, |
Oliver O'Halloran | fbbefb32 | 2020-11-03 15:35:07 +1100 | [diff] [blame] | 598 | .discover_phbs = pmac_pci_init, |
Paul Mackerras | 35499c0 | 2005-10-22 16:02:39 +1000 | [diff] [blame] | 599 | .show_cpuinfo = pmac_show_cpuinfo, |
Paul Mackerras | 35499c0 | 2005-10-22 16:02:39 +1000 | [diff] [blame] | 600 | .init_IRQ = pmac_pic_init, |
Benjamin Herrenschmidt | cc5d018 | 2005-12-13 18:01:21 +1100 | [diff] [blame] | 601 | .get_irq = NULL, /* changed later */ |
Benjamin Herrenschmidt | f90bb15 | 2006-11-11 17:24:51 +1100 | [diff] [blame] | 602 | .pci_irq_fixup = pmac_pci_irq_fixup, |
Paul Mackerras | 35499c0 | 2005-10-22 16:02:39 +1000 | [diff] [blame] | 603 | .restart = pmac_restart, |
Paul Mackerras | 35499c0 | 2005-10-22 16:02:39 +1000 | [diff] [blame] | 604 | .halt = pmac_halt, |
| 605 | .time_init = pmac_time_init, |
| 606 | .get_boot_time = pmac_get_boot_time, |
| 607 | .set_rtc_time = pmac_set_rtc_time, |
| 608 | .get_rtc_time = pmac_get_rtc_time, |
| 609 | .calibrate_decr = pmac_calibrate_decr, |
| 610 | .feature_call = pmac_do_feature_call, |
Kumar Gala | be6b843 | 2005-12-20 16:37:07 -0600 | [diff] [blame] | 611 | .progress = udbg_progress, |
Paul Mackerras | 35499c0 | 2005-10-22 16:02:39 +1000 | [diff] [blame] | 612 | #ifdef CONFIG_PPC64 |
Paul Mackerras | a0652fc | 2006-03-27 15:03:03 +1100 | [diff] [blame] | 613 | .power_save = power4_idle, |
Paul Mackerras | 35499c0 | 2005-10-22 16:02:39 +1000 | [diff] [blame] | 614 | .enable_pmcs = power4_enable_pmcs, |
Michael Ellerman | 3d1229d | 2005-11-14 23:35:00 +1100 | [diff] [blame] | 615 | #endif /* CONFIG_PPC64 */ |
Paul Mackerras | 35499c0 | 2005-10-22 16:02:39 +1000 | [diff] [blame] | 616 | #ifdef CONFIG_PPC32 |
Paul Mackerras | 35499c0 | 2005-10-22 16:02:39 +1000 | [diff] [blame] | 617 | .pcibios_after_init = pmac_pcibios_after_init, |
| 618 | .phys_mem_access_prot = pci_phys_mem_access_prot, |
| 619 | #endif |
| 620 | }; |