xref: /linux/arch/powerpc/platforms/pseries/pseries.h (revision 010862d235c9fab4f0f9dd169efc72df94110758)
1 /* SPDX-License-Identifier: GPL-2.0-or-later */
2 /*
3  * Copyright 2006 IBM Corporation.
4  */
5 
6 #ifndef _PSERIES_PSERIES_H
7 #define _PSERIES_PSERIES_H
8 
9 #include <linux/interrupt.h>
10 #include <asm/rtas.h>
11 
12 struct device_node;
13 
14 void __init request_event_sources_irqs(struct device_node *np,
15 				       irq_handler_t handler, const char *name);
16 
17 #include <linux/of.h>
18 
19 struct pt_regs;
20 
21 extern int pSeries_system_reset_exception(struct pt_regs *regs);
22 extern int pSeries_machine_check_exception(struct pt_regs *regs);
23 extern long pseries_machine_check_realmode(struct pt_regs *regs);
24 void pSeries_machine_check_log_err(void);
25 
26 #ifdef CONFIG_SMP
27 extern void smp_init_pseries(void);
28 
29 /* Get state of physical CPU from query_cpu_stopped */
30 int smp_query_cpu_stopped(unsigned int pcpu);
31 #define QCSS_STOPPED 0
32 #define QCSS_STOPPING 1
33 #define QCSS_NOT_STOPPED 2
34 #define QCSS_HARDWARE_ERROR -1
35 #define QCSS_HARDWARE_BUSY -2
36 #else
37 static inline void smp_init_pseries(void) { }
38 #endif
39 
40 extern void pseries_kexec_cpu_down(int crash_shutdown, int secondary);
41 void pseries_machine_kexec(struct kimage *image);
42 
43 extern void pSeries_final_fixup(void);
44 
45 /* Poweron flag used for enabling auto ups restart */
46 extern unsigned long rtas_poweron_auto;
47 
48 /* Dynamic logical Partitioning/Mobility */
49 extern void dlpar_free_cc_nodes(struct device_node *);
50 extern void dlpar_free_cc_property(struct property *);
51 extern struct device_node *dlpar_configure_connector(__be32,
52 						struct device_node *);
53 extern int dlpar_attach_node(struct device_node *, struct device_node *);
54 extern int dlpar_detach_node(struct device_node *);
55 extern int dlpar_acquire_drc(u32 drc_index);
56 extern int dlpar_release_drc(u32 drc_index);
57 extern int dlpar_unisolate_drc(u32 drc_index);
58 extern void post_mobility_fixup(void);
59 
60 void queue_hotplug_event(struct pseries_hp_errorlog *hp_errlog);
61 int handle_dlpar_errorlog(struct pseries_hp_errorlog *hp_errlog);
62 
63 #ifdef CONFIG_MEMORY_HOTPLUG
64 int dlpar_memory(struct pseries_hp_errorlog *hp_elog);
65 int dlpar_hp_pmem(struct pseries_hp_errorlog *hp_elog);
66 #else
67 static inline int dlpar_memory(struct pseries_hp_errorlog *hp_elog)
68 {
69 	return -EOPNOTSUPP;
70 }
71 static inline int dlpar_hp_pmem(struct pseries_hp_errorlog *hp_elog)
72 {
73 	return -EOPNOTSUPP;
74 }
75 #endif
76 
77 #ifdef CONFIG_HOTPLUG_CPU
78 int dlpar_cpu(struct pseries_hp_errorlog *hp_elog);
79 void pseries_cpu_hotplug_init(void);
80 #else
81 static inline int dlpar_cpu(struct pseries_hp_errorlog *hp_elog)
82 {
83 	return -EOPNOTSUPP;
84 }
85 static inline void pseries_cpu_hotplug_init(void) { }
86 #endif
87 
88 /* PCI root bridge prepare function override for pseries */
89 struct pci_host_bridge;
90 int pseries_root_bridge_prepare(struct pci_host_bridge *bridge);
91 
92 extern struct pci_controller_ops pseries_pci_controller_ops;
93 int pseries_msi_allocate_domains(struct pci_controller *phb);
94 void pseries_msi_free_domains(struct pci_controller *phb);
95 
96 extern int CMO_PrPSP;
97 extern int CMO_SecPSP;
98 extern unsigned long CMO_PageSize;
99 
100 static inline int cmo_get_primary_psp(void)
101 {
102 	return CMO_PrPSP;
103 }
104 
105 static inline int cmo_get_secondary_psp(void)
106 {
107 	return CMO_SecPSP;
108 }
109 
110 static inline unsigned long cmo_get_page_size(void)
111 {
112 	return CMO_PageSize;
113 }
114 
115 int dlpar_workqueue_init(void);
116 
117 extern u32 pseries_security_flavor;
118 void pseries_setup_security_mitigations(void);
119 
120 #ifdef CONFIG_PPC_64S_HASH_MMU
121 void pseries_lpar_read_hblkrm_characteristics(void);
122 #else
123 static inline void pseries_lpar_read_hblkrm_characteristics(void) { }
124 #endif
125 
126 void pseries_rng_init(void);
127 #ifdef CONFIG_SPAPR_TCE_IOMMU
128 struct iommu_group *pSeries_pci_device_group(struct pci_controller *hose,
129 					     struct pci_dev *pdev);
130 #endif
131 
132 #endif /* _PSERIES_PSERIES_H */
133