mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-05 00:33:55 -06:00
ipmi: Add support to customize OEM functions
The routine ipmi_register_oem_netfn() lets external modules register command handlers for OEM functions. Required for the PowerNV machine. Cc: Corey Minyard <cminyard@mvista.com> Reviewed-by: Corey Minyard <cminyard@mvista.com> Signed-off-by: Cédric Le Goater <clg@kaod.org> Message-Id: <20191028070027.22752-2-clg@kaod.org> Acked-by: Corey Minyard <cminyard@mvista.com> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
This commit is contained in:
parent
1c27b252e7
commit
ed8da05cdb
2 changed files with 48 additions and 44 deletions
|
@ -55,6 +55,7 @@ enum ipmi_op {
|
|||
#define IPMI_CC_COMMAND_NOT_SUPPORTED 0xd5
|
||||
|
||||
#define IPMI_NETFN_APP 0x06
|
||||
#define IPMI_NETFN_OEM 0x3a
|
||||
|
||||
#define IPMI_DEBUG 1
|
||||
|
||||
|
@ -265,4 +266,45 @@ int ipmi_bmc_sdr_find(IPMIBmc *b, uint16_t recid,
|
|||
const struct ipmi_sdr_compact **sdr, uint16_t *nextrec);
|
||||
void ipmi_bmc_gen_event(IPMIBmc *b, uint8_t *evt, bool log);
|
||||
|
||||
#define TYPE_IPMI_BMC_SIMULATOR "ipmi-bmc-sim"
|
||||
#define IPMI_BMC_SIMULATOR(obj) OBJECT_CHECK(IPMIBmcSim, (obj), \
|
||||
TYPE_IPMI_BMC_SIMULATOR)
|
||||
|
||||
typedef struct IPMIBmcSim IPMIBmcSim;
|
||||
|
||||
typedef struct RspBuffer {
|
||||
uint8_t buffer[MAX_IPMI_MSG_SIZE];
|
||||
unsigned int len;
|
||||
} RspBuffer;
|
||||
|
||||
static inline void rsp_buffer_set_error(RspBuffer *rsp, uint8_t byte)
|
||||
{
|
||||
rsp->buffer[2] = byte;
|
||||
}
|
||||
|
||||
/* Add a byte to the response. */
|
||||
static inline void rsp_buffer_push(RspBuffer *rsp, uint8_t byte)
|
||||
{
|
||||
if (rsp->len >= sizeof(rsp->buffer)) {
|
||||
rsp_buffer_set_error(rsp, IPMI_CC_REQUEST_DATA_TRUNCATED);
|
||||
return;
|
||||
}
|
||||
rsp->buffer[rsp->len++] = byte;
|
||||
}
|
||||
|
||||
typedef struct IPMICmdHandler {
|
||||
void (*cmd_handler)(IPMIBmcSim *s,
|
||||
uint8_t *cmd, unsigned int cmd_len,
|
||||
RspBuffer *rsp);
|
||||
unsigned int cmd_len_min;
|
||||
} IPMICmdHandler;
|
||||
|
||||
typedef struct IPMINetfn {
|
||||
unsigned int cmd_nums;
|
||||
const IPMICmdHandler *cmd_handlers;
|
||||
} IPMINetfn;
|
||||
|
||||
int ipmi_sim_register_netfn(IPMIBmcSim *s, unsigned int netfn,
|
||||
const IPMINetfn *netfnd);
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue