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
21 /* Numbers in this enumerator should be mapped to si_to_str[] */
23 SI_TYPE_INVALID
, SI_KCS
, SI_SMIC
, SI_BT
, SI_TYPE_MAX
26 /* Array is defined in the ipmi_si_intf.c */
27 extern const char *const si_to_str
[];
29 enum ipmi_addr_space
{
30 IPMI_IO_ADDR_SPACE
, IPMI_MEM_ADDR_SPACE
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
39 unsigned char (*inputb
)(const struct si_sm_io
*io
, unsigned int offset
);
40 void (*outputb
)(const struct si_sm_io
*io
,
45 * Generic info used by the actual handling routines, the
46 * state machine shouldn't touch these.
49 unsigned int regspacing
;
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
;
57 int (*io_setup
)(struct si_sm_io
*info
);
58 void (*io_cleanup
)(struct si_sm_io
*info
);
62 int (*irq_setup
)(struct si_sm_io
*io
);
63 void *irq_handler_data
;
64 void (*irq_cleanup
)(struct si_sm_io
*io
);
71 int ipmi_si_add_smi(struct si_sm_io
*io
);
72 irqreturn_t
ipmi_si_irq_handler(int irq
, void *data
);
73 void ipmi_irq_start_cleanup(struct si_sm_io
*io
);
74 int ipmi_std_irq_setup(struct si_sm_io
*io
);
75 void ipmi_irq_finish_setup(struct si_sm_io
*io
);
76 void ipmi_si_remove_by_dev(struct device
*dev
);
77 struct device
*ipmi_si_remove_by_data(int addr_space
, enum si_type si_type
,
79 void ipmi_hardcode_init(void);
80 void ipmi_si_hardcode_exit(void);
81 void ipmi_si_hotmod_exit(void);
82 int ipmi_si_hardcode_match(int addr_space
, unsigned long addr
);
83 void ipmi_si_platform_init(void);
84 void ipmi_si_platform_shutdown(void);
85 void ipmi_remove_platform_device_by_name(char *name
);
87 extern struct platform_driver ipmi_platform_driver
;
90 void ipmi_si_pci_init(void);
91 void ipmi_si_pci_shutdown(void);
93 static inline void ipmi_si_pci_init(void) { }
94 static inline void ipmi_si_pci_shutdown(void) { }
97 void ipmi_si_parisc_init(void);
98 void ipmi_si_parisc_shutdown(void);
100 static inline void ipmi_si_parisc_init(void) { }
101 static inline void ipmi_si_parisc_shutdown(void) { }
104 int ipmi_si_port_setup(struct si_sm_io
*io
);
105 int ipmi_si_mem_setup(struct si_sm_io
*io
);
107 #endif /* __IPMI_SI_H__ */