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: 126581 Delivered-To: patch@linaro.org Received: by 10.46.124.24 with SMTP id x24csp1975475ljc; Thu, 1 Feb 2018 10:56:20 -0800 (PST) X-Google-Smtp-Source: AH8x226YB/hzvMXgovQuMXGV0zyOZQM956X/B69FcKRxuD8bazDY0fPQn26D7/cLHXNKnKaYU49z X-Received: by 10.13.201.65 with SMTP id l62mr25152909ywd.331.1517511380883; Thu, 01 Feb 2018 10:56:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517511380; cv=none; d=google.com; s=arc-20160816; b=GygAFxOSVYi6mIWWvjfBCFe87v3uyprBGhuDL+NglRxLTe0iwHP93VIdcRe8LIq2xJ TNCoowik02eZH8OpGGFpKJdc+8gBFPZTgKGnu9xK3v8hvlBhFzj1/Wy4TB+whR1aEJJv e+p3giOUZpkV8I0CDZJq9hpY2TfqaWfcRapUzV6sDBoE2BW1p91k0X8PGNilHS6IrYob NRVZGAvVftBGg8K4Qf2P3xIaeu5/6I3K3szrq95QNXNY2GISvkOaJT2kkRcL5Vu71Wml EkY5xfiKl9s/m9koRcdHBUNgTn/vhjBS8JQltn40maNylFVCBWu+weJuP5dl7oE/z9PY +6XA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject :content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:to:from:dkim-signature:arc-authentication-results; bh=789edMDauOWZHbsNILLacYVL9cPRbrYiExCSkLdLCNY=; b=bGk4GvkBiCRzF67xJLhjPKAXbKb0/zMMV3M7MWFeBvvSUhAGXYL+HgQCsYVdRgX+vq PUL1dj1zpYWCnWUQ5vvl/I5dP2wKdVQjx/a1yQfFRce4mPOE2sn4UIiTgdUmHPhhVBjY MzArtMbBZFqVGLTgf7Rymob8I/26U4pPAHK5XDGnWc7tH5vkTwI0wOhH+DF8kVVOBbA0 7QgoqGCECoGdtT0FEPZGLohfZRsL6DdGjXaBgX1a7a43r+x6k9vq80pw0XNp9nby27EB tfh15QPtlVwrXE7pmDcTx32wjrMb/Wp0zV/BqkJgV6sGwteqaWRPDVrPifroYmEaTZC1 /ssw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=ctMJtboR; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) smtp.mailfrom=qemu-devel-bounces+patch=linaro.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id 202si40583ywq.804.2018.02.01.10.56.20 for (version=TLS1 cipher=AES128-SHA bits=128/128); Thu, 01 Feb 2018 10:56:20 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) client-ip=2001:4830:134:3::11; Authentication-Results: mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=ctMJtboR; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) smtp.mailfrom=qemu-devel-bounces+patch=linaro.org@nongnu.org Received: from localhost ([::1]:54752 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ehK20-0005fu-5P for patch@linaro.org; Thu, 01 Feb 2018 13:56: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-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+patch=linaro.org@nongnu.org Sender: "Qemu-devel" 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(+) -- 2.7.4 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 },