ipmi_si.h (2955B)
1/* SPDX-License-Identifier: GPL-2.0+ */ 2/* 3 * ipmi_si.h 4 * 5 * Interface from the device-specific interfaces (OF, DMI, ACPI, PCI, 6 * etc) to the base ipmi system interface code. 7 */ 8 9#ifndef __IPMI_SI_H__ 10#define __IPMI_SI_H__ 11 12#include <linux/ipmi.h> 13#include <linux/interrupt.h> 14#include <linux/platform_device.h> 15 16#define SI_DEVICE_NAME "ipmi_si" 17 18#define DEFAULT_REGSPACING 1 19#define DEFAULT_REGSIZE 1 20 21/* Numbers in this enumerator should be mapped to si_to_str[] */ 22enum si_type { 23 SI_TYPE_INVALID, SI_KCS, SI_SMIC, SI_BT, SI_TYPE_MAX 24}; 25 26/* Array is defined in the ipmi_si_intf.c */ 27extern const char *const si_to_str[]; 28 29enum ipmi_addr_space { 30 IPMI_IO_ADDR_SPACE, IPMI_MEM_ADDR_SPACE 31}; 32 33/* 34 * The structure for doing I/O in the state machine. The state 35 * machine doesn't have the actual I/O routines, they are done through 36 * this interface. 37 */ 38struct si_sm_io { 39 unsigned char (*inputb)(const struct si_sm_io *io, unsigned int offset); 40 void (*outputb)(const struct si_sm_io *io, 41 unsigned int offset, 42 unsigned char b); 43 44 /* 45 * Generic info used by the actual handling routines, the 46 * state machine shouldn't touch these. 47 */ 48 void __iomem *addr; 49 unsigned int regspacing; 50 unsigned int regsize; 51 unsigned int regshift; 52 enum ipmi_addr_space addr_space; 53 unsigned long addr_data; 54 enum ipmi_addr_src addr_source; /* ACPI, PCI, SMBIOS, hardcode, etc. */ 55 union ipmi_smi_info_union addr_info; 56 57 int (*io_setup)(struct si_sm_io *info); 58 void (*io_cleanup)(struct si_sm_io *info); 59 unsigned int io_size; 60 61 int irq; 62 int (*irq_setup)(struct si_sm_io *io); 63 void *irq_handler_data; 64 void (*irq_cleanup)(struct si_sm_io *io); 65 66 u8 slave_addr; 67 enum si_type si_type; 68 struct device *dev; 69}; 70 71int ipmi_si_add_smi(struct si_sm_io *io); 72irqreturn_t ipmi_si_irq_handler(int irq, void *data); 73void ipmi_irq_start_cleanup(struct si_sm_io *io); 74int ipmi_std_irq_setup(struct si_sm_io *io); 75void ipmi_irq_finish_setup(struct si_sm_io *io); 76void ipmi_si_remove_by_dev(struct device *dev); 77struct device *ipmi_si_remove_by_data(int addr_space, enum si_type si_type, 78 unsigned long addr); 79void ipmi_hardcode_init(void); 80void ipmi_si_hardcode_exit(void); 81void ipmi_si_hotmod_exit(void); 82int ipmi_si_hardcode_match(int addr_space, unsigned long addr); 83void ipmi_si_platform_init(void); 84void ipmi_si_platform_shutdown(void); 85void ipmi_remove_platform_device_by_name(char *name); 86 87extern struct platform_driver ipmi_platform_driver; 88 89#ifdef CONFIG_PCI 90void ipmi_si_pci_init(void); 91void ipmi_si_pci_shutdown(void); 92#else 93static inline void ipmi_si_pci_init(void) { } 94static inline void ipmi_si_pci_shutdown(void) { } 95#endif 96#ifdef CONFIG_PARISC 97void ipmi_si_parisc_init(void); 98void ipmi_si_parisc_shutdown(void); 99#else 100static inline void ipmi_si_parisc_init(void) { } 101static inline void ipmi_si_parisc_shutdown(void) { } 102#endif 103 104int ipmi_si_port_setup(struct si_sm_io *io); 105int ipmi_si_mem_setup(struct si_sm_io *io); 106 107#endif /* __IPMI_SI_H__ */