[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-ppc] [PATCH 09/21] ipmi: introduce an ipmi_bmc_gen_event() API
From: |
Cédric Le Goater |
Subject: |
[Qemu-ppc] [PATCH 09/21] ipmi: introduce an ipmi_bmc_gen_event() API |
Date: |
Wed, 5 Apr 2017 14:41:34 +0200 |
It will be used to fill the message buffer with custom events expected
by some systems. Typically, an Open PowerNV platform guest is notified
with an OEM SEL message before a shutdown or a reboot.
Signed-off-by: Cédric Le Goater <address@hidden>
Acked-by: Corey Minyard <address@hidden>
---
hw/ipmi/ipmi_bmc_sim.c | 24 ++++++++++++++++++++++++
include/hw/ipmi/ipmi.h | 2 ++
2 files changed, 26 insertions(+)
diff --git a/hw/ipmi/ipmi_bmc_sim.c b/hw/ipmi/ipmi_bmc_sim.c
index 8185a84b76b9..155561d06614 100644
--- a/hw/ipmi/ipmi_bmc_sim.c
+++ b/hw/ipmi/ipmi_bmc_sim.c
@@ -473,6 +473,30 @@ static int attn_irq_enabled(IPMIBmcSim *ibs)
IPMI_BMC_MSG_FLAG_EVT_BUF_FULL_SET(ibs));
}
+void ipmi_bmc_gen_event(IPMIBmc *b, uint8_t *evt, bool log)
+{
+ IPMIBmcSim *ibs = IPMI_BMC_SIMULATOR(b);
+ IPMIInterface *s = ibs->parent.intf;
+ IPMIInterfaceClass *k = IPMI_INTERFACE_GET_CLASS(s);
+
+ if (!IPMI_BMC_EVENT_MSG_BUF_ENABLED(ibs)) {
+ return;
+ }
+
+ if (log && IPMI_BMC_EVENT_LOG_ENABLED(ibs)) {
+ sel_add_event(ibs, evt);
+ }
+
+ if (ibs->msg_flags & IPMI_BMC_MSG_FLAG_EVT_BUF_FULL) {
+ goto out;
+ }
+
+ memcpy(ibs->evtbuf, evt, 16);
+ ibs->msg_flags |= IPMI_BMC_MSG_FLAG_EVT_BUF_FULL;
+ k->set_atn(s, 1, attn_irq_enabled(ibs));
+ out:
+ return;
+}
static void gen_event(IPMIBmcSim *ibs, unsigned int sens_num, uint8_t deassert,
uint8_t evd1, uint8_t evd2, uint8_t evd3)
{
diff --git a/include/hw/ipmi/ipmi.h b/include/hw/ipmi/ipmi.h
index 0d36cfc6b7f3..0affe5a4d864 100644
--- a/include/hw/ipmi/ipmi.h
+++ b/include/hw/ipmi/ipmi.h
@@ -261,4 +261,6 @@ typedef uint8_t ipmi_sdr_compact_buffer[sizeof(struct
ipmi_sdr_compact)];
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);
+
#endif
--
2.7.4
- Re: [Qemu-ppc] [PATCH 04/21] ppc/pnv: enable only one LPC bus, (continued)
[Qemu-ppc] [PATCH 05/21] ppc: add IPMI support, Cédric Le Goater, 2017/04/05
[Qemu-ppc] [PATCH 06/21] ipmi: use a file to load SDRs, Cédric Le Goater, 2017/04/05
[Qemu-ppc] [PATCH 07/21] ipmi: provide support for FRUs, Cédric Le Goater, 2017/04/05
[Qemu-ppc] [PATCH 08/21] ipmi: introduce an ipmi_bmc_sdr_find() API, Cédric Le Goater, 2017/04/05
[Qemu-ppc] [PATCH 09/21] ipmi: introduce an ipmi_bmc_gen_event() API,
Cédric Le Goater <=
[Qemu-ppc] [PATCH 10/21] ipmi: add SET_SENSOR_READING command, Cédric Le Goater, 2017/04/05
[Qemu-ppc] [PATCH 11/21] ppc/pnv: scan ISA bus to populate device tree, Cédric Le Goater, 2017/04/05
[Qemu-ppc] [PATCH 12/21] ppc/pnv: populate device tree for RTC devices, Cédric Le Goater, 2017/04/05