1 /* SPDX-License-Identifier: GPL-2.0+ */
5 * Interface from the device-specific interfaces (OF, DMI, ACPI, PCI,
6 * etc) to the base ipmi system interface code.
12 #include <linux/ipmi.h>
13 #include <linux/interrupt.h>
14 #include <linux/platform_device.h>
16 #define SI_DEVICE_NAME "ipmi_si"
18 #define DEFAULT_REGSPACING 1
19 #define DEFAULT_REGSIZE 1
22 SI_TYPE_INVALID, SI_KCS, SI_SMIC, SI_BT
25 enum ipmi_addr_space {
26 IPMI_IO_ADDR_SPACE, IPMI_MEM_ADDR_SPACE
30 * The structure for doing I/O in the state machine. The state
31 * machine doesn't have the actual I/O routines, they are done through
35 unsigned char (*inputb)(const struct si_sm_io *io, unsigned int offset);
36 void (*outputb)(const struct si_sm_io *io,
41 * Generic info used by the actual handling routines, the
42 * state machine shouldn't touch these.
45 unsigned int regspacing;
47 unsigned int regshift;
48 enum ipmi_addr_space addr_space;
49 unsigned long addr_data;
50 enum ipmi_addr_src addr_source; /* ACPI, PCI, SMBIOS, hardcode, etc. */
51 void (*addr_source_cleanup)(struct si_sm_io *io);
52 void *addr_source_data;
53 union ipmi_smi_info_union addr_info;
55 int (*io_setup)(struct si_sm_io *info);
56 void (*io_cleanup)(struct si_sm_io *info);
60 int (*irq_setup)(struct si_sm_io *io);
61 void *irq_handler_data;
62 void (*irq_cleanup)(struct si_sm_io *io);
69 int ipmi_si_add_smi(struct si_sm_io *io);
70 irqreturn_t ipmi_si_irq_handler(int irq, void *data);
71 void ipmi_irq_start_cleanup(struct si_sm_io *io);
72 int ipmi_std_irq_setup(struct si_sm_io *io);
73 void ipmi_irq_finish_setup(struct si_sm_io *io);
74 int ipmi_si_remove_by_dev(struct device *dev);
75 struct device *ipmi_si_remove_by_data(int addr_space, enum si_type si_type,
77 void ipmi_hardcode_init(void);
78 void ipmi_si_hardcode_exit(void);
79 void ipmi_si_hotmod_exit(void);
80 int ipmi_si_hardcode_match(int addr_space, unsigned long addr);
81 void ipmi_si_platform_init(void);
82 void ipmi_si_platform_shutdown(void);
83 void ipmi_remove_platform_device_by_name(char *name);
85 extern struct platform_driver ipmi_platform_driver;
88 void ipmi_si_pci_init(void);
89 void ipmi_si_pci_shutdown(void);
91 static inline void ipmi_si_pci_init(void) { }
92 static inline void ipmi_si_pci_shutdown(void) { }
95 void ipmi_si_parisc_init(void);
96 void ipmi_si_parisc_shutdown(void);
98 static inline void ipmi_si_parisc_init(void) { }
99 static inline void ipmi_si_parisc_shutdown(void) { }
102 int ipmi_si_port_setup(struct si_sm_io *io);
103 int ipmi_si_mem_setup(struct si_sm_io *io);
105 #endif /* __IPMI_SI_H__ */