From patchwork Thu Feb 1 18:52:59 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Corey Minyard X-Patchwork-Id: 10195919 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 91E9F60567 for ; Thu, 1 Feb 2018 18:57:22 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6F75528965 for ; Thu, 1 Feb 2018 18:57:22 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 64109289C5; Thu, 1 Feb 2018 18:57:22 +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 B53D1289B9 for ; Thu, 1 Feb 2018 18:57:21 +0000 (UTC) Received: from localhost ([::1]:54766 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ehK2y-0006qs-1H for patchwork-qemu-devel@patchwork.kernel.org; Thu, 01 Feb 2018 13:57:20 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36375) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ehJz0-0003G8-MA for qemu-devel@nongnu.org; Thu, 01 Feb 2018 13:53:16 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ehJyv-0008Ve-MA for qemu-devel@nongnu.org; Thu, 01 Feb 2018 13:53:14 -0500 Received: from mail-ot0-x244.google.com ([2607:f8b0:4003:c0f::244]:40623) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ehJyv-0008UG-HP for qemu-devel@nongnu.org; Thu, 01 Feb 2018 13:53:09 -0500 Received: by mail-ot0-x244.google.com with SMTP id x4so17887548otg.7 for ; Thu, 01 Feb 2018 10:53:09 -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=ctMJtboRUbtnpNX+ahVNy8jfKidVC2FphCKpD/iBCwRsFp7ZwsVk+1iU7/LcoqkPk7 NdefTbnPkkO9ZkV6kCYNLDPEDlGCRQrrP759nT3mWV2szUoLC7UeP3GAC5pYvrEiFOH0 s0WaTI+KyfLHXDJwaXL7EZ9wX3UENFgo43IQEZYo7+HXbzP+Xmw04a4olMshW/QtVnli +KEktBNjaS++GhyrvChgwS7ks1e063trYZWtyPMAxrnrFa20nCRY7clbWaMr2pm0XB6h WfqzxZxNiANm9vlFtdOYFN6ZeFEeD6lsvkGn52XDPnbsEh/pcDRusc0bRoq9R0xaOSmC nCEQ== 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=N6BnR88JpXHeeu0J8vwy4fsYtNRQs4GFaN2fCBEGTZMrWZjFltkLRDW3IfT+iZTNTK Zc1ABjpIhfL34/H9cuanLNp3jORK9RZGUVugyvusaB7Kosjw+TYDKMQj18MCsM4/MRg1 ElpXajjXEBsT9hrLDx/Xto26DrfUTHvzM2kzf6YS1axut+qFW25CjsNgbRKejZJZh3mY YANic1n4ztzGhYKHpS+30RBIcG01SjqTyjbDfMa6YHJu7eTFitO0x9YWIsdFo+fE5Dea 05f+7kA/buK839mXxcZws48pE5MGnNn570urUf+DSzZ93Ro0RC4cy1sbw7C8hKP2XYb0 R4CQ== X-Gm-Message-State: AKwxytdWRZuTVjHkpEC3BSp0Hodvhd2K6k7C2eSVKaQpn/Z/PPdmZxGM 7O++2/bzQOdAQaeTCMNwDQ== X-Google-Smtp-Source: AH8x225ak87WV1g4lsjEBg8ZF8OJ9IIJiVXorLZs/pOSPqBWOCtFyUfl/PQLE3M9L+dz3V2yGZhWDA== X-Received: by 10.157.60.51 with SMTP id q48mr8957597otc.288.1517511188247; Thu, 01 Feb 2018 10:53:08 -0800 (PST) Received: from serve.minyard.net ([47.184.168.85]) by smtp.gmail.com with ESMTPSA id u32sm125624otb.11.2018.02.01.10.53.07 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 01 Feb 2018 10:53:07 -0800 (PST) Received: from t430.minyard.net (t430m.minyard.net [192.168.27.3]) by serve.minyard.net (Postfix) with ESMTPA id F2FD170A; Thu, 1 Feb 2018 12:53:05 -0600 (CST) Received: by t430.minyard.net (Postfix, from userid 1000) id 8CC9C3000A3; Thu, 1 Feb 2018 12:53:04 -0600 (CST) From: minyard@acm.org To: Peter Maydell , qemu-devel@nongnu.org Date: Thu, 1 Feb 2018 12:52:59 -0600 Message-Id: <1517511182-9944-5-git-send-email-minyard@acm.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1517511182-9944-1-git-send-email-minyard@acm.org> References: <1517511182-9944-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:c0f::244 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: 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 },