]>
Commit | Line | Data |
---|---|---|
55190f88 BH |
1 | /* |
2 | * PowerNV setup code. | |
3 | * | |
4 | * Copyright 2011 IBM Corp. | |
5 | * | |
6 | * This program is free software; you can redistribute it and/or | |
7 | * modify it under the terms of the GNU General Public License | |
8 | * as published by the Free Software Foundation; either version | |
9 | * 2 of the License, or (at your option) any later version. | |
10 | */ | |
11 | ||
12 | #undef DEBUG | |
13 | ||
14 | #include <linux/cpu.h> | |
15 | #include <linux/errno.h> | |
16 | #include <linux/sched.h> | |
17 | #include <linux/kernel.h> | |
18 | #include <linux/tty.h> | |
19 | #include <linux/reboot.h> | |
20 | #include <linux/init.h> | |
21 | #include <linux/console.h> | |
22 | #include <linux/delay.h> | |
23 | #include <linux/irq.h> | |
24 | #include <linux/seq_file.h> | |
25 | #include <linux/of.h> | |
26 | #include <linux/interrupt.h> | |
27 | #include <linux/bug.h> | |
28 | ||
29 | #include <asm/machdep.h> | |
30 | #include <asm/firmware.h> | |
31 | #include <asm/xics.h> | |
32 | ||
33 | #include "powernv.h" | |
34 | ||
35 | static void __init pnv_setup_arch(void) | |
36 | { | |
37 | /* Force console to hvc for now until we have sorted out the | |
38 | * real console situation for the platform. This will make | |
39 | * hvc_udbg work at least. | |
40 | */ | |
41 | add_preferred_console("hvc", 0, NULL); | |
42 | ||
43 | /* Initialize SMP */ | |
44 | pnv_smp_init(); | |
45 | ||
46 | /* XXX PCI */ | |
47 | ||
48 | /* XXX NVRAM */ | |
49 | ||
50 | /* Enable NAP mode */ | |
51 | powersave_nap = 1; | |
52 | ||
53 | /* XXX PMCS */ | |
54 | } | |
55 | ||
56 | static void __init pnv_init_early(void) | |
57 | { | |
58 | /* XXX IOMMU */ | |
59 | } | |
60 | ||
61 | static void __init pnv_init_IRQ(void) | |
62 | { | |
63 | xics_init(); | |
64 | ||
65 | WARN_ON(!ppc_md.get_irq); | |
66 | } | |
67 | ||
68 | static void pnv_show_cpuinfo(struct seq_file *m) | |
69 | { | |
70 | struct device_node *root; | |
71 | const char *model = ""; | |
72 | ||
73 | root = of_find_node_by_path("/"); | |
74 | if (root) | |
75 | model = of_get_property(root, "model", NULL); | |
76 | seq_printf(m, "machine\t\t: PowerNV %s\n", model); | |
14a43e69 BH |
77 | if (firmware_has_feature(FW_FEATURE_OPALv2)) |
78 | seq_printf(m, "firmware\t: OPAL v2\n"); | |
79 | else if (firmware_has_feature(FW_FEATURE_OPAL)) | |
80 | seq_printf(m, "firmware\t: OPAL v1\n"); | |
81 | else | |
82 | seq_printf(m, "firmware\t: BML\n"); | |
55190f88 BH |
83 | of_node_put(root); |
84 | } | |
85 | ||
86 | static void pnv_restart(char *cmd) | |
87 | { | |
88 | for (;;); | |
89 | } | |
90 | ||
91 | static void pnv_power_off(void) | |
92 | { | |
93 | for (;;); | |
94 | } | |
95 | ||
96 | static void pnv_halt(void) | |
97 | { | |
98 | for (;;); | |
99 | } | |
100 | ||
101 | static unsigned long __init pnv_get_boot_time(void) | |
102 | { | |
103 | return 0; | |
104 | } | |
105 | ||
106 | static void pnv_get_rtc_time(struct rtc_time *rtc_tm) | |
107 | { | |
108 | } | |
109 | ||
110 | static int pnv_set_rtc_time(struct rtc_time *tm) | |
111 | { | |
112 | return 0; | |
113 | } | |
114 | ||
115 | static void pnv_progress(char *s, unsigned short hex) | |
116 | { | |
117 | } | |
118 | ||
119 | #ifdef CONFIG_KEXEC | |
120 | static void pnv_kexec_cpu_down(int crash_shutdown, int secondary) | |
121 | { | |
122 | xics_kexec_teardown_cpu(secondary); | |
123 | } | |
124 | #endif /* CONFIG_KEXEC */ | |
125 | ||
126 | static int __init pnv_probe(void) | |
127 | { | |
128 | unsigned long root = of_get_flat_dt_root(); | |
129 | ||
130 | if (!of_flat_dt_is_compatible(root, "ibm,powernv")) | |
131 | return 0; | |
132 | ||
133 | hpte_init_native(); | |
134 | ||
135 | pr_debug("PowerNV detected !\n"); | |
136 | ||
137 | return 1; | |
138 | } | |
139 | ||
140 | define_machine(powernv) { | |
141 | .name = "PowerNV", | |
142 | .probe = pnv_probe, | |
143 | .setup_arch = pnv_setup_arch, | |
144 | .init_early = pnv_init_early, | |
145 | .init_IRQ = pnv_init_IRQ, | |
146 | .show_cpuinfo = pnv_show_cpuinfo, | |
147 | .restart = pnv_restart, | |
148 | .power_off = pnv_power_off, | |
149 | .halt = pnv_halt, | |
150 | .get_boot_time = pnv_get_boot_time, | |
151 | .get_rtc_time = pnv_get_rtc_time, | |
152 | .set_rtc_time = pnv_set_rtc_time, | |
153 | .progress = pnv_progress, | |
154 | .power_save = power7_idle, | |
155 | .calibrate_decr = generic_calibrate_decr, | |
156 | #ifdef CONFIG_KEXEC | |
157 | .kexec_cpu_down = pnv_kexec_cpu_down, | |
158 | #endif | |
159 | }; |