From patchwork Tue Jan 16 00:57:56 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Corey Minyard X-Patchwork-Id: 10165605 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id D6FC8601E7 for ; Tue, 16 Jan 2018 00:59:28 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C710026E51 for ; Tue, 16 Jan 2018 00:59:28 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BB89827CF3; Tue, 16 Jan 2018 00:59:28 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id B689226E51 for ; Tue, 16 Jan 2018 00:59:27 +0000 (UTC) Received: from localhost ([::1]:49554 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ebFb5-0000Kk-1h for patchwork-qemu-devel@patchwork.kernel.org; Mon, 15 Jan 2018 19:59:27 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59538) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ebFZs-0007rq-Rg for qemu-devel@nongnu.org; Mon, 15 Jan 2018 19:58:14 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ebFZr-0000ke-Lp for qemu-devel@nongnu.org; Mon, 15 Jan 2018 19:58:12 -0500 Received: from mail-oi0-x243.google.com ([2607:f8b0:4003:c06::243]:34855) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ebFZr-0000kK-Go for qemu-devel@nongnu.org; Mon, 15 Jan 2018 19:58:11 -0500 Received: by mail-oi0-x243.google.com with SMTP id j139so6479824oih.2 for ; Mon, 15 Jan 2018 16:58:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=789edMDauOWZHbsNILLacYVL9cPRbrYiExCSkLdLCNY=; b=ll8l8LNYZ0Yc+h0iiWs55qiCWhGZU4G/ofmfAoPQzKdyjhllN9tGk/MhFPfm8sm6QY g+o3Z9MmhsSyMGvOyNWhOgGY06QGOEv3+oeQIRdFDMNVoNXZBPckZxGs8K0DQIUlb2kp 6BmhHLxIw21NRebudWkuW874Vzae4XlwGMNjgtgwfLu5BnjpdYhNHomTAGYAWLdj79Zs WnE5fSObJCg+WsJSa9SppTrB/ba93/lzUsYM09B40NGMFj2hTc5hUeq9OxZGCXRRVxkA Ce0ovgHmu6vqsAO8J3GHeAQ7TYJw54nYpDR27fqgXUnrbWuIsYva+NN02PaY/kREV0nf ZAcQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=789edMDauOWZHbsNILLacYVL9cPRbrYiExCSkLdLCNY=; b=KTuGzR1RLt3s+g0CO96Cfms2fAmMAVRE0EaAoeDVIIf91/QS3C/ClqaoaG2nJmgGjO f6mY8EOT8BnNBhR0MYwjIOjaZ427iv7PziAgW9NqEUVnPv91QVmKK1sjPzMSBHPQDPXj A+tEdscEdC2C4d+fhz7yhug9DI3l8/CZ2vFtSdV17DC31s/gfy6bcOx3gsWYaQmVQk6H aRhBpyYR44McwOzbi7FjxyrfQnk5lo8HMQzxWlrkeZs2tNr/pFWZ4de2+Y/EL9TlWetS Y7UK9bLt8xkybyAnmVRTAEliqAhVreRHy1Igk04q6pdAMDyjOqkTWbepz/kI0FPGV6n/ FXmw== X-Gm-Message-State: AKwxytczNs8s0AeEj5SeSvt8VbNEADukCB9rWJIjCacvPN8b6RpCQT8I Y/kV8KNModdvHUGHfwZ7Zg== X-Google-Smtp-Source: ACJfBosDuTPvyvy6VKD1X+Oeb+UWg9W2juSSduWEz3mkRAdpe5YE3iY+crxEc+AQSf6di9Q2Pbs/LQ== X-Received: by 10.202.216.136 with SMTP id p130mr7569818oig.6.1516064290614; Mon, 15 Jan 2018 16:58:10 -0800 (PST) Received: from serve.minyard.net (serve.minyard.net. [2001:470:b8f6:1b::1]) by smtp.gmail.com with ESMTPSA id r7sm519531otr.24.2018.01.15.16.58.08 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 15 Jan 2018 16:58:09 -0800 (PST) Received: from t430.minyard.net (t430m.minyard.net [192.168.27.3]) by serve.minyard.net (Postfix) with ESMTPA id 860C96AD; Mon, 15 Jan 2018 18:58:06 -0600 (CST) Received: by t430.minyard.net (Postfix, from userid 1000) id 6CB1230001C; Mon, 15 Jan 2018 18:58:04 -0600 (CST) From: minyard@acm.org To: qemu-devel@nongnu.org Date: Mon, 15 Jan 2018 18:57:56 -0600 Message-Id: <1516064279-14816-5-git-send-email-minyard@acm.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1516064279-14816-1-git-send-email-minyard@acm.org> References: <1516064279-14816-1-git-send-email-minyard@acm.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4003:c06::243 Subject: [Qemu-devel] [PATCH 4/7] ipmi: Add the platform event message command 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: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= , Corey Minyard Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: Corey Minyard This lets an event be added to the SEL as if a sensor had generated it. The OpenIPMI driver uses it for storing panic event information. Signed-off-by: Corey Minyard Reviewed-by: Cédric Le Goater --- hw/ipmi/ipmi_bmc_sim.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/hw/ipmi/ipmi_bmc_sim.c b/hw/ipmi/ipmi_bmc_sim.c index a0bbfd5..e84d710 100644 --- a/hw/ipmi/ipmi_bmc_sim.c +++ b/hw/ipmi/ipmi_bmc_sim.c @@ -38,6 +38,7 @@ #define IPMI_NETFN_SENSOR_EVENT 0x04 +#define IPMI_CMD_PLATFORM_EVENT_MSG 0x02 #define IPMI_CMD_SET_SENSOR_EVT_ENABLE 0x28 #define IPMI_CMD_GET_SENSOR_EVT_ENABLE 0x29 #define IPMI_CMD_REARM_SENSOR_EVTS 0x2a @@ -1581,6 +1582,28 @@ static void set_sel_time(IPMIBmcSim *ibs, ibs->sel.time_offset = now.tv_sec - ((long) val); } +static void platform_event_msg(IPMIBmcSim *ibs, + uint8_t *cmd, unsigned int cmd_len, + RspBuffer *rsp) +{ + uint8_t event[16]; + + event[2] = 2; /* System event record */ + event[7] = cmd[2]; /* Generator ID */ + event[8] = 0; + event[9] = cmd[3]; /* EvMRev */ + event[10] = cmd[4]; /* Sensor type */ + event[11] = cmd[5]; /* Sensor number */ + event[12] = cmd[6]; /* Event dir / Event type */ + event[13] = cmd[7]; /* Event data 1 */ + event[14] = cmd[8]; /* Event data 2 */ + event[15] = cmd[9]; /* Event data 3 */ + + if (sel_add_event(ibs, event)) { + rsp_buffer_set_error(rsp, IPMI_CC_OUT_OF_SPACE); + } +} + static void set_sensor_evt_enable(IPMIBmcSim *ibs, uint8_t *cmd, unsigned int cmd_len, RspBuffer *rsp) @@ -1757,6 +1780,7 @@ static const IPMINetfn chassis_netfn = { }; static const IPMICmdHandler sensor_event_cmds[] = { + [IPMI_CMD_PLATFORM_EVENT_MSG] = { platform_event_msg, 10 }, [IPMI_CMD_SET_SENSOR_EVT_ENABLE] = { set_sensor_evt_enable, 4 }, [IPMI_CMD_GET_SENSOR_EVT_ENABLE] = { get_sensor_evt_enable, 3 }, [IPMI_CMD_REARM_SENSOR_EVTS] = { rearm_sensor_evts, 4 },