4 * Copyright 2011 IBM Corp.
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.
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>
26 #include <linux/interrupt.h>
27 #include <linux/bug.h>
29 #include <asm/machdep.h>
30 #include <asm/firmware.h>
36 static void __init pnv_setup_arch(void)
51 static void __init pnv_init_early(void)
53 #ifdef CONFIG_HVC_OPAL
54 if (firmware_has_feature(FW_FEATURE_OPAL))
55 hvc_opal_init_early();
58 add_preferred_console("hvc", 0, NULL);
61 static void __init pnv_init_IRQ(void)
65 WARN_ON(!ppc_md.get_irq);
68 static void pnv_show_cpuinfo(struct seq_file *m)
70 struct device_node *root;
71 const char *model = "";
73 root = of_find_node_by_path("/");
75 model = of_get_property(root, "model", NULL);
76 seq_printf(m, "machine\t\t: PowerNV %s\n", model);
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");
82 seq_printf(m, "firmware\t: BML\n");
86 static void pnv_restart(char *cmd)
91 static void pnv_power_off(void)
96 static void pnv_halt(void)
101 static unsigned long __init pnv_get_boot_time(void)
106 static void pnv_get_rtc_time(struct rtc_time *rtc_tm)
110 static int pnv_set_rtc_time(struct rtc_time *tm)
115 static void pnv_progress(char *s, unsigned short hex)
120 static void pnv_kexec_cpu_down(int crash_shutdown, int secondary)
122 xics_kexec_teardown_cpu(secondary);
124 #endif /* CONFIG_KEXEC */
126 static int __init pnv_probe(void)
128 unsigned long root = of_get_flat_dt_root();
130 if (!of_flat_dt_is_compatible(root, "ibm,powernv"))
135 pr_debug("PowerNV detected !\n");
140 define_machine(powernv) {
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,
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,
157 .kexec_cpu_down = pnv_kexec_cpu_down,