From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57340) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aUt2k-0008EW-Hy for qemu-devel@nongnu.org; Sun, 14 Feb 2016 04:32:39 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aUt2f-0006rQ-J0 for qemu-devel@nongnu.org; Sun, 14 Feb 2016 04:32:38 -0500 Received: from mail-wm0-x244.google.com ([2a00:1450:400c:c09::244]:36092) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aUt2f-0006rM-CI for qemu-devel@nongnu.org; Sun, 14 Feb 2016 04:32:33 -0500 Received: by mail-wm0-x244.google.com with SMTP id a4so5522240wme.3 for ; Sun, 14 Feb 2016 01:32:33 -0800 (PST) References: <1455020010-17532-1-git-send-email-clg@fr.ibm.com> <1455020010-17532-9-git-send-email-clg@fr.ibm.com> From: Marcel Apfelbaum Message-ID: <56C049AE.50802@gmail.com> Date: Sun, 14 Feb 2016 11:32:30 +0200 MIME-Version: 1.0 In-Reply-To: <1455020010-17532-9-git-send-email-clg@fr.ibm.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Subject: Re: [Qemu-devel] [PATCH 8/8] ipmi: introduce an ipmi_bmc_gen_event() API Reply-To: marcel@redhat.com List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: =?UTF-8?Q?C=c3=a9dric_Le_Goater?= , Corey Minyard Cc: "Michael S. Tsirkin" , qemu-devel@nongnu.org, 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 > --- > 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 >