From nobody Mon Feb 9 23:18:25 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; dkim=fail spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1493191274087364.47984001894304; Wed, 26 Apr 2017 00:21:14 -0700 (PDT) Received: from localhost ([::1]:53081 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d3HGC-0005kq-TL for importer@patchew.org; Wed, 26 Apr 2017 03:21:12 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56781) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d3Gwp-0005KA-UC for qemu-devel@nongnu.org; Wed, 26 Apr 2017 03:01:24 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1d3Gwk-00085J-8r for qemu-devel@nongnu.org; Wed, 26 Apr 2017 03:01:12 -0400 Received: from ozlabs.org ([2401:3900:2:1::2]:57725) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1d3Gwj-00082P-SJ; Wed, 26 Apr 2017 03:01:06 -0400 Received: by ozlabs.org (Postfix, from userid 1007) id 3wCWFL6HJkz9sNS; Wed, 26 Apr 2017 17:00:53 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1493190054; bh=VtcMhafTc5puGtqKpcyCAkPMWHriQsbpszpDfX+v4BM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=OnuJCGaeb+xsSRWJNvJ8eYvIK2zYf478Tl/dVmGe243AX+BJZ33nl2Ybhmn5i8pgX PNB4FRg0SCEbpNiVPkieMijydFXs5+CMw/zGCl2kkelF8fI68ZJgrfjbCSgZSx+Hz9 bfzEc1nIGVKFMky7ixgCSWu87K6hPblLrYeCqiXY= From: David Gibson To: peter.maydell@linaro.org Date: Wed, 26 Apr 2017 17:00:19 +1000 Message-Id: <20170426070034.10727-34-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170426070034.10727-1-david@gibson.dropbear.id.au> References: <20170426070034.10727-1-david@gibson.dropbear.id.au> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2401:3900:2:1::2 Subject: [Qemu-devel] [PULL 33/48] ipmi: introduce an ipmi_bmc_gen_event() API X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: mdroth@linux.vnet.ibm.com, aik@ozlabs.ru, qemu-devel@nongnu.org, agraf@suse.de, qemu-ppc@nongnu.org, clg@kaod.org, David Gibson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" From: C=C3=A9dric Le Goater 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=C3=A9dric Le Goater Acked-by: Corey Minyard Signed-off-by: David Gibson --- 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 09213ab..277c28c 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)); } =20 +void ipmi_bmc_gen_event(IPMIBmc *b, uint8_t *evt, bool log) +{ + IPMIBmcSim *ibs =3D IPMI_BMC_SIMULATOR(b); + IPMIInterface *s =3D ibs->parent.intf; + IPMIInterfaceClass *k =3D 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 |=3D 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 deas= sert, uint8_t evd1, uint8_t evd2, uint8_t evd3) { diff --git a/include/hw/ipmi/ipmi.h b/include/hw/ipmi/ipmi.h index 0d36cfc..0affe5a 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 i= pmi_sdr_compact)]; =20 int ipmi_bmc_sdr_find(IPMIBmc *b, uint16_t recid, const struct ipmi_sdr_compact **sdr, uint16_t *nextr= ec); +void ipmi_bmc_gen_event(IPMIBmc *b, uint8_t *evt, bool log); + #endif --=20 2.9.3