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 14extern void 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); 24 25#ifdef CONFIG_SMP 26extern void smp_init_pseries(void); 27 28/* Get state of physical CPU from query_cpu_stopped */ 29int smp_query_cpu_stopped(unsigned int pcpu); 30#define QCSS_STOPPED 0 31#define QCSS_STOPPING 1 32#define QCSS_NOT_STOPPED 2 33#define QCSS_HARDWARE_ERROR -1 34#define QCSS_HARDWARE_BUSY -2 35#else 36static inline void smp_init_pseries(void) { } 37#endif 38 39extern void pseries_kexec_cpu_down(int crash_shutdown, int secondary); 40 41extern void pSeries_final_fixup(void); 42 43/* Poweron flag used for enabling auto ups restart */ 44extern unsigned long rtas_poweron_auto; 45 46/* Dynamic logical Partitioning/Mobility */ 47extern void dlpar_free_cc_nodes(struct device_node *); 48extern void dlpar_free_cc_property(struct property *); 49extern struct device_node *dlpar_configure_connector(__be32, 50 struct device_node *); 51extern int dlpar_attach_node(struct device_node *, struct device_node *); 52extern int dlpar_detach_node(struct device_node *); 53extern int dlpar_acquire_drc(u32 drc_index); 54extern int dlpar_release_drc(u32 drc_index); 55extern int dlpar_unisolate_drc(u32 drc_index); 56 57void queue_hotplug_event(struct pseries_hp_errorlog *hp_errlog); 58int handle_dlpar_errorlog(struct pseries_hp_errorlog *hp_errlog); 59 60#ifdef CONFIG_MEMORY_HOTPLUG 61int dlpar_memory(struct pseries_hp_errorlog *hp_elog); 62int dlpar_hp_pmem(struct pseries_hp_errorlog *hp_elog); 63#else 64static inline int dlpar_memory(struct pseries_hp_errorlog *hp_elog) 65{ 66 return -EOPNOTSUPP; 67} 68static inline int dlpar_hp_pmem(struct pseries_hp_errorlog *hp_elog) 69{ 70 return -EOPNOTSUPP; 71} 72#endif 73 74#ifdef CONFIG_HOTPLUG_CPU 75int dlpar_cpu(struct pseries_hp_errorlog *hp_elog); 76#else 77static inline int dlpar_cpu(struct pseries_hp_errorlog *hp_elog) 78{ 79 return -EOPNOTSUPP; 80} 81#endif 82 83/* PCI root bridge prepare function override for pseries */ 84struct pci_host_bridge; 85int pseries_root_bridge_prepare(struct pci_host_bridge *bridge); 86 87extern struct pci_controller_ops pseries_pci_controller_ops; 88int pseries_msi_allocate_domains(struct pci_controller *phb); 89void pseries_msi_free_domains(struct pci_controller *phb); 90 91unsigned long pseries_memory_block_size(void); 92 93extern int CMO_PrPSP; 94extern int CMO_SecPSP; 95extern unsigned long CMO_PageSize; 96 97static inline int cmo_get_primary_psp(void) 98{ 99 return CMO_PrPSP; 100} 101 102static inline int cmo_get_secondary_psp(void) 103{ 104 return CMO_SecPSP; 105} 106 107static inline unsigned long cmo_get_page_size(void) 108{ 109 return CMO_PageSize; 110} 111 112int dlpar_workqueue_init(void); 113 114extern u32 pseries_security_flavor; 115void pseries_setup_security_mitigations(void); 116void pseries_lpar_read_hblkrm_characteristics(void); 117 118#endif /* _PSERIES_PSERIES_H */ 119