* [Qemu-devel] [PATCH 8/8] ipmi: introduce an ipmi_bmc_gen_event() API
@ 2016-01-05 17:30 Cédric Le Goater
0 siblings, 0 replies; 3+ messages in thread
From: Cédric Le Goater @ 2016-01-05 17:30 UTC (permalink / raw)
To: Corey Minyard; +Cc: Cédric Le Goater, qemu-devel, Michael S. Tsirkin
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 <clg@fr.ibm.com>
---
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 9618db44ce69..cf105c343596 100644
--- a/hw/ipmi/ipmi_bmc_sim.c
+++ b/hw/ipmi/ipmi_bmc_sim.c
@@ -447,6 +447,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 ce1f539754be..0006299e263b 100644
--- a/include/hw/ipmi/ipmi.h
+++ b/include/hw/ipmi/ipmi.h
@@ -247,4 +247,6 @@ typedef uint8_t ipmi_sdr_compact_buffer[sizeof(struct ipmi_sdr_compact)];
int ipmi_bmc_init_sensor(IPMIBmc *b, const uint8_t *entry,
unsigned int len, uint8_t *sensor_num);
+void ipmi_bmc_gen_event(IPMIBmc *b, uint8_t *evt, bool log);
+
#endif
--
2.1.4
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [Qemu-devel] [PATCH 8/8] ipmi: introduce an ipmi_bmc_gen_event() API
2016-02-09 12:13 [Qemu-devel] [PATCH 0/8] ipmi: a couple of enhancements to the BMC simulator (round 2) Cédric Le Goater
@ 2016-02-09 12:13 ` Cédric Le Goater
2016-02-14 9:32 ` Marcel Apfelbaum
0 siblings, 1 reply; 3+ messages in thread
From: Cédric Le Goater @ 2016-02-09 12:13 UTC (permalink / raw)
To: Corey Minyard
Cc: Cédric Le Goater, Greg Kurz, qemu-devel, Michael S. Tsirkin
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 <clg@fr.ibm.com>
---
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 c952219429f4..cd2db03a4188 100644
--- a/hw/ipmi/ipmi_bmc_sim.c
+++ b/hw/ipmi/ipmi_bmc_sim.c
@@ -463,6 +463,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 e41321db174d..178e72d72b40 100644
--- a/include/hw/ipmi/ipmi.h
+++ b/include/hw/ipmi/ipmi.h
@@ -257,4 +257,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.1.4
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [Qemu-devel] [PATCH 8/8] ipmi: introduce an ipmi_bmc_gen_event() API
2016-02-09 12:13 ` [Qemu-devel] [PATCH 8/8] ipmi: introduce an ipmi_bmc_gen_event() API Cédric Le Goater
@ 2016-02-14 9:32 ` Marcel Apfelbaum
0 siblings, 0 replies; 3+ messages in thread
From: Marcel Apfelbaum @ 2016-02-14 9:32 UTC (permalink / raw)
To: Cédric Le Goater, Corey Minyard
Cc: Michael S. Tsirkin, qemu-devel, Greg Kurz
On 02/09/2016 02:13 PM, Cédric Le Goater wrote:
> 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 <clg@fr.ibm.com>
> ---
> 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 c952219429f4..cd2db03a4188 100644
> --- a/hw/ipmi/ipmi_bmc_sim.c
> +++ b/hw/ipmi/ipmi_bmc_sim.c
> @@ -463,6 +463,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 e41321db174d..178e72d72b40 100644
> --- a/include/hw/ipmi/ipmi.h
> +++ b/include/hw/ipmi/ipmi.h
> @@ -257,4 +257,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);
Hi,
The same here, maybe you can add this function when it will be used.
Thanks,
Marcel
> +
> #endif
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2016-02-14 9:32 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-01-05 17:30 [Qemu-devel] [PATCH 8/8] ipmi: introduce an ipmi_bmc_gen_event() API Cédric Le Goater
-- strict thread matches above, loose matches on Subject: below --
2016-02-09 12:13 [Qemu-devel] [PATCH 0/8] ipmi: a couple of enhancements to the BMC simulator (round 2) Cédric Le Goater
2016-02-09 12:13 ` [Qemu-devel] [PATCH 8/8] ipmi: introduce an ipmi_bmc_gen_event() API Cédric Le Goater
2016-02-14 9:32 ` Marcel Apfelbaum
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).