@@ -117,7 +117,7 @@ static void ipmi_bmc_handle_hw_op(IPMICore *ic, unsigned char hw_op,
}
}
-static void ipmi_bmc_extern_handle_command(IPMIBmc *b,
+static void ipmi_bmc_extern_handle_command(IPMICore *b,
uint8_t *cmd, unsigned int cmd_len,
unsigned int max_cmd_len,
uint8_t msg_id)
@@ -185,8 +185,8 @@ static void ipmi_bmc_extern_class_init(ObjectClass *oc, void *data)
IPMIBmcClass *bk = IPMI_BMC_CLASS(oc);
IPMICoreClass *ck = IPMI_CORE_CLASS(oc);
- bk->handle_command = ipmi_bmc_extern_handle_command;
bk->handle_reset = ipmi_bmc_extern_handle_reset;
+ ck->handle_command = ipmi_bmc_extern_handle_command;
ck->handle_hw_op = ipmi_bmc_handle_hw_op;
dc->hotpluggable = false;
dc->realize = ipmi_bmc_extern_realize;
@@ -640,7 +640,7 @@ static void next_timeout(IPMIBmcSim *ibs)
timer_mod_ns(ibs->timer, next);
}
-static void ipmi_sim_handle_command(IPMIBmc *b,
+static void ipmi_sim_handle_command(IPMICore *b,
uint8_t *cmd, unsigned int cmd_len,
unsigned int max_cmd_len,
uint8_t msg_id)
@@ -2222,12 +2222,12 @@ static Property ipmi_sim_properties[] = {
static void ipmi_sim_class_init(ObjectClass *oc, void *data)
{
DeviceClass *dc = DEVICE_CLASS(oc);
- IPMIBmcClass *bk = IPMI_BMC_CLASS(oc);
+ IPMICoreClass *ck = IPMI_CORE_CLASS(oc);
dc->hotpluggable = false;
dc->realize = ipmi_sim_realize;
device_class_set_props(dc, ipmi_sim_properties);
- bk->handle_command = ipmi_sim_handle_command;
+ ck->handle_command = ipmi_sim_handle_command;
}
static const TypeInfo ipmi_sim_type = {
@@ -141,8 +141,8 @@ static void ipmi_bt_handle_event(IPMIInterface *ii)
ib->waiting_seq = ib->inmsg[2];
ib->inmsg[2] = ib->inmsg[1];
{
- IPMIBmcClass *bk = IPMI_BMC_GET_CLASS(ib->bmc);
- bk->handle_command(ib->bmc, ib->inmsg + 2, ib->inlen - 2,
+ IPMICoreClass *ck = IPMI_CORE_GET_CLASS(ib->bmc);
+ ck->handle_command(IPMI_CORE(ib->bmc), ib->inmsg + 2, ib->inlen - 2,
sizeof(ib->inmsg), ib->waiting_rsp);
}
out:
@@ -119,9 +119,9 @@ static void addchar(IPMIExtern *ibe, unsigned char ch)
}
void ipmi_extern_handle_command(IPMIExtern *ibe,
- uint8_t *cmd, unsigned int cmd_len,
- unsigned int max_cmd_len,
- uint8_t msg_id)
+ uint8_t *cmd, unsigned int cmd_len,
+ unsigned int max_cmd_len,
+ uint8_t msg_id)
{
IPMIInterface *s = ibe->core->intf;
uint8_t err = 0, csum;
@@ -162,12 +162,12 @@ static void ipmi_kcs_handle_event(IPMIInterface *ii)
ik->inlen++;
}
if (ik->write_end) {
- IPMIBmcClass *bk = IPMI_BMC_GET_CLASS(ik->bmc);
+ IPMICoreClass *ck = IPMI_CORE_GET_CLASS(ik->bmc);
ik->outlen = 0;
ik->write_end = 0;
ik->outpos = 0;
- bk->handle_command(ik->bmc, ik->inmsg, ik->inlen, sizeof(ik->inmsg),
- ik->waiting_rsp);
+ ck->handle_command(IPMI_CORE(ik->bmc), ik->inmsg, ik->inlen,
+ sizeof(ik->inmsg), ik->waiting_rsp);
goto out_noibf;
} else if (ik->cmd_reg == IPMI_KCS_WRITE_END_CMD) {
ik->cmd_reg = -1;
@@ -107,7 +107,7 @@ static void smbus_ipmi_send_msg(SMBusIPMIDevice *sid)
{
uint8_t *msg = sid->inmsg;
uint32_t len = sid->inlen;
- IPMIBmcClass *bk = IPMI_BMC_GET_CLASS(sid->bmc);
+ IPMICoreClass *ck = IPMI_CORE_GET_CLASS(sid->bmc);
sid->outlen = 0;
sid->outpos = 0;
@@ -135,8 +135,8 @@ static void smbus_ipmi_send_msg(SMBusIPMIDevice *sid)
return;
}
- bk->handle_command(sid->bmc, sid->inmsg, sid->inlen, sizeof(sid->inmsg),
- sid->waiting_rsp);
+ ck->handle_command(IPMI_CORE(sid->bmc), sid->inmsg, sid->inlen,
+ sizeof(sid->inmsg), sid->waiting_rsp);
}
static uint8_t ipmi_receive_byte(SMBusDevice *dev)
@@ -196,6 +196,14 @@ struct IPMICoreClass {
* Handle a hardware command.
*/
void (*handle_hw_op)(struct IPMICore *s, uint8_t hw_op, uint8_t operand);
+
+ /*
+ * Handle a command to the bmc.
+ */
+ void (*handle_command)(struct IPMICore *s,
+ uint8_t *cmd, unsigned int cmd_len,
+ unsigned int max_cmd_len,
+ uint8_t msg_id);
};
/*
@@ -216,14 +224,6 @@ struct IPMIBmcClass {
/* Called when the system resets to report to the bmc. */
void (*handle_reset)(struct IPMIBmc *s);
-
- /*
- * Handle a command to the bmc.
- */
- void (*handle_command)(struct IPMIBmc *s,
- uint8_t *cmd, unsigned int cmd_len,
- unsigned int max_cmd_len,
- uint8_t msg_id);
};
/*
Move the function handle_command to IPMICoreClass. This function is shared between BMC-side emulation and Host-side emulation. Signed-off-by: Hao Wu <wuhaotsh@google.com> --- hw/ipmi/ipmi_bmc_extern.c | 4 ++-- hw/ipmi/ipmi_bmc_sim.c | 6 +++--- hw/ipmi/ipmi_bt.c | 4 ++-- hw/ipmi/ipmi_extern.c | 6 +++--- hw/ipmi/ipmi_kcs.c | 6 +++--- hw/ipmi/smbus_ipmi.c | 6 +++--- include/hw/ipmi/ipmi.h | 16 ++++++++-------- 7 files changed, 24 insertions(+), 24 deletions(-)