2018-02-20 21:30:22 +08:00
|
|
|
/* SPDX-License-Identifier: GPL-2.0+ */
|
2017-09-13 02:52:13 +08:00
|
|
|
/*
|
|
|
|
* ipmi_si.h
|
|
|
|
*
|
|
|
|
* Interface from the device-specific interfaces (OF, DMI, ACPI, PCI,
|
|
|
|
* etc) to the base ipmi system interface code.
|
|
|
|
*/
|
|
|
|
|
2019-08-01 08:18:25 +08:00
|
|
|
#ifndef __IPMI_SI_H__
|
|
|
|
#define __IPMI_SI_H__
|
|
|
|
|
|
|
|
#include <linux/ipmi.h>
|
2017-09-13 04:10:22 +08:00
|
|
|
#include <linux/interrupt.h>
|
2019-02-22 04:21:17 +08:00
|
|
|
#include <linux/platform_device.h>
|
2019-08-01 08:18:25 +08:00
|
|
|
|
|
|
|
#define SI_DEVICE_NAME "ipmi_si"
|
2017-09-13 02:52:13 +08:00
|
|
|
|
|
|
|
#define DEFAULT_REGSPACING 1
|
|
|
|
#define DEFAULT_REGSIZE 1
|
|
|
|
|
2021-04-03 01:43:30 +08:00
|
|
|
/* Numbers in this enumerator should be mapped to si_to_str[] */
|
2019-08-01 08:18:25 +08:00
|
|
|
enum si_type {
|
2021-04-03 01:43:30 +08:00
|
|
|
SI_TYPE_INVALID, SI_KCS, SI_SMIC, SI_BT, SI_TYPE_MAX
|
2019-08-01 08:18:25 +08:00
|
|
|
};
|
|
|
|
|
2021-04-03 01:43:30 +08:00
|
|
|
/* Array is defined in the ipmi_si_intf.c */
|
|
|
|
extern const char *const si_to_str[];
|
|
|
|
|
2019-08-01 08:18:25 +08:00
|
|
|
enum ipmi_addr_space {
|
|
|
|
IPMI_IO_ADDR_SPACE, IPMI_MEM_ADDR_SPACE
|
|
|
|
};
|
|
|
|
|
|
|
|
/*
|
|
|
|
* The structure for doing I/O in the state machine. The state
|
|
|
|
* machine doesn't have the actual I/O routines, they are done through
|
|
|
|
* this interface.
|
|
|
|
*/
|
|
|
|
struct si_sm_io {
|
|
|
|
unsigned char (*inputb)(const struct si_sm_io *io, unsigned int offset);
|
|
|
|
void (*outputb)(const struct si_sm_io *io,
|
|
|
|
unsigned int offset,
|
|
|
|
unsigned char b);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Generic info used by the actual handling routines, the
|
|
|
|
* state machine shouldn't touch these.
|
|
|
|
*/
|
|
|
|
void __iomem *addr;
|
|
|
|
unsigned int regspacing;
|
|
|
|
unsigned int regsize;
|
|
|
|
unsigned int regshift;
|
|
|
|
enum ipmi_addr_space addr_space;
|
|
|
|
unsigned long addr_data;
|
|
|
|
enum ipmi_addr_src addr_source; /* ACPI, PCI, SMBIOS, hardcode, etc. */
|
|
|
|
union ipmi_smi_info_union addr_info;
|
|
|
|
|
|
|
|
int (*io_setup)(struct si_sm_io *info);
|
|
|
|
void (*io_cleanup)(struct si_sm_io *info);
|
|
|
|
unsigned int io_size;
|
|
|
|
|
|
|
|
int irq;
|
|
|
|
int (*irq_setup)(struct si_sm_io *io);
|
|
|
|
void *irq_handler_data;
|
|
|
|
void (*irq_cleanup)(struct si_sm_io *io);
|
|
|
|
|
|
|
|
u8 slave_addr;
|
|
|
|
enum si_type si_type;
|
|
|
|
struct device *dev;
|
|
|
|
};
|
2017-09-13 11:55:57 +08:00
|
|
|
|
2017-09-13 10:37:02 +08:00
|
|
|
int ipmi_si_add_smi(struct si_sm_io *io);
|
2017-09-13 04:10:22 +08:00
|
|
|
irqreturn_t ipmi_si_irq_handler(int irq, void *data);
|
|
|
|
void ipmi_irq_start_cleanup(struct si_sm_io *io);
|
|
|
|
int ipmi_std_irq_setup(struct si_sm_io *io);
|
|
|
|
void ipmi_irq_finish_setup(struct si_sm_io *io);
|
2021-08-07 17:19:27 +08:00
|
|
|
void ipmi_si_remove_by_dev(struct device *dev);
|
2019-02-22 07:21:50 +08:00
|
|
|
struct device *ipmi_si_remove_by_data(int addr_space, enum si_type si_type,
|
|
|
|
unsigned long addr);
|
2019-02-22 02:10:07 +08:00
|
|
|
void ipmi_hardcode_init(void);
|
|
|
|
void ipmi_si_hardcode_exit(void);
|
2019-02-22 07:21:50 +08:00
|
|
|
void ipmi_si_hotmod_exit(void);
|
2019-02-22 02:53:00 +08:00
|
|
|
int ipmi_si_hardcode_match(int addr_space, unsigned long addr);
|
2017-09-13 11:55:57 +08:00
|
|
|
void ipmi_si_platform_init(void);
|
|
|
|
void ipmi_si_platform_shutdown(void);
|
2019-02-22 07:41:47 +08:00
|
|
|
void ipmi_remove_platform_device_by_name(char *name);
|
2017-09-13 11:55:57 +08:00
|
|
|
|
|
|
|
extern struct platform_driver ipmi_platform_driver;
|
2017-09-13 12:04:35 +08:00
|
|
|
|
|
|
|
#ifdef CONFIG_PCI
|
|
|
|
void ipmi_si_pci_init(void);
|
|
|
|
void ipmi_si_pci_shutdown(void);
|
|
|
|
#else
|
|
|
|
static inline void ipmi_si_pci_init(void) { }
|
|
|
|
static inline void ipmi_si_pci_shutdown(void) { }
|
|
|
|
#endif
|
2017-09-13 12:10:18 +08:00
|
|
|
#ifdef CONFIG_PARISC
|
|
|
|
void ipmi_si_parisc_init(void);
|
|
|
|
void ipmi_si_parisc_shutdown(void);
|
|
|
|
#else
|
|
|
|
static inline void ipmi_si_parisc_init(void) { }
|
|
|
|
static inline void ipmi_si_parisc_shutdown(void) { }
|
|
|
|
#endif
|
2017-09-13 12:24:30 +08:00
|
|
|
|
|
|
|
int ipmi_si_port_setup(struct si_sm_io *io);
|
|
|
|
int ipmi_si_mem_setup(struct si_sm_io *io);
|
2019-08-01 08:18:25 +08:00
|
|
|
|
|
|
|
#endif /* __IPMI_SI_H__ */
|