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

source code of linux/arch/powerpc/platforms/pseries/pseries.h