Merge tag 'trace-printf-v6.13' of git://git.kernel.org/pub/scm/linux/kernel/git/trace...
[drm/drm-misc.git] / drivers / char / ipmi / ipmi_si.h
bloba7ead2a4c753b4a9cca7d919c0ebf0dcf638b777
1 /* SPDX-License-Identifier: GPL-2.0+ */
2 /*
3 * ipmi_si.h
5 * Interface from the device-specific interfaces (OF, DMI, ACPI, PCI,
6 * etc) to the base ipmi system interface code.
7 */
9 #ifndef __IPMI_SI_H__
10 #define __IPMI_SI_H__
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[] */
22 enum si_type {
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
36 * this interface.
38 struct 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);
45 * Generic info used by the actual handling routines, the
46 * state machine shouldn't touch these.
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;
57 int (*io_setup)(struct si_sm_io *info);
58 void (*io_cleanup)(struct si_sm_io *info);
59 unsigned int io_size;
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);
66 u8 slave_addr;
67 enum si_type si_type;
68 struct device *dev;
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,
78 unsigned long addr);
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;
89 #ifdef CONFIG_PCI
90 void ipmi_si_pci_init(void);
91 void ipmi_si_pci_shutdown(void);
92 #else
93 static inline void ipmi_si_pci_init(void) { }
94 static inline void ipmi_si_pci_shutdown(void) { }
95 #endif
96 #ifdef CONFIG_PARISC
97 void ipmi_si_parisc_init(void);
98 void ipmi_si_parisc_shutdown(void);
99 #else
100 static inline void ipmi_si_parisc_init(void) { }
101 static inline void ipmi_si_parisc_shutdown(void) { }
102 #endif
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__ */