From patchwork Tue Jan 16 00:57:55 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Corey Minyard X-Patchwork-Id: 10165609 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 A43CB601E7 for ; Tue, 16 Jan 2018 00:59:32 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 93146269B2 for ; Tue, 16 Jan 2018 00:59:32 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8650F26E75; Tue, 16 Jan 2018 00:59:32 +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 32303269B2 for ; Tue, 16 Jan 2018 00:59:32 +0000 (UTC) Received: from localhost ([::1]:49556 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ebFb9-0000Oi-FN for patchwork-qemu-devel@patchwork.kernel.org; Mon, 15 Jan 2018 19:59:31 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59576) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ebFZu-0007sD-Kr for qemu-devel@nongnu.org; Mon, 15 Jan 2018 19:58:15 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ebFZt-0000lz-Hn for qemu-devel@nongnu.org; Mon, 15 Jan 2018 19:58:14 -0500 Received: from mail-ot0-x242.google.com ([2607:f8b0:4003:c0f::242]:33988) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ebFZt-0000ls-Dl for qemu-devel@nongnu.org; Mon, 15 Jan 2018 19:58:13 -0500 Received: by mail-ot0-x242.google.com with SMTP id p16so12206718otf.1 for ; Mon, 15 Jan 2018 16:58:13 -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=xEV6SmV/vklWlR0FbWcQCRcVYfv2IMVPXqrDvll5yxI=; b=Eu5y3rx6G4ZVUFhwBfOieSNVqqDsjH82Ysg08sWfGJ5T2IOgJqb46BzuYvVjy7PKkq 65FKvBWk9ndLIrR+Mj5Dtf0q5f+JQHDERxbQAZXRtfdHeiUHIzayqFYCL7jfVo/hbTP7 nANslp7r7IE6lmgWPbDmm0BASs9MP5DbJ+BJRsrcS9wqHytWKPLMLmTZK11bIc+LzHak i3ik9jvKH12cCKNyNST9ynD0djZ0XsU3jxGqFA0QIn6xo52gTyrV6CTCLNAXIuJUgYZj VF0uZjHOR8dZsx+V6BJgkD/1MDuv1csmyoNL063l5JjKinrdhSGRdkj53dDhqfUvx9Pj 5IxQ== 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=xEV6SmV/vklWlR0FbWcQCRcVYfv2IMVPXqrDvll5yxI=; b=pZHla/b4L5BCdID9ALGO12RLQsQeGxTIxZ/og5GPOapem9z0FOBfH82abuzYze55LP xTuB0rCopMh0vqaqUkCx8BkVuFWgdNtehmCeMvjBFU0bxcbkPDnC/1b+iq7SUHd2G8r9 fSaJzey8zZ+oqL3F/IBj56ihrScOj41sQU9T8U61ZPAGmuG8xXiefhzpUv+f1+vw2ION Ge3UiH4uMI7mUjlcDeHiRUrLvZ9txO/R+x3wjMt5Bw0Cnj5FBE4+9UezaCkHwDSmUC5N co+Op4uAxBrIC1GVnwnTKbG6av9JjWFzy9drBhmGXJUqbaUJiwnA2M6ei1NqG6/P8Ao4 eHxA== X-Gm-Message-State: AKwxytd0OHuoHGqrandsD+B9utR2lhyfbkvo8RY7wvQ2ZhgskJ0R5dcX 63+PZDXEItLAge9f3+oFCw== X-Google-Smtp-Source: ACJfBotDtB45Y1gMDz8qtjw1F3OzKw/Dnxk70GJNWnGSTixxTATwHPX3uGn3I/DnC9uteYm9qnUPWQ== X-Received: by 10.157.11.234 with SMTP id 97mr11196749oth.40.1516064292596; Mon, 15 Jan 2018 16:58:12 -0800 (PST) Received: from serve.minyard.net (serve.minyard.net. [2001:470:b8f6:1b::1]) by smtp.gmail.com with ESMTPSA id f193sm466134oih.28.2018.01.15.16.58.09 (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 4FF918FC; Mon, 15 Jan 2018 18:58:07 -0600 (CST) Received: by t430.minyard.net (Postfix, from userid 1000) id E06C130006F; 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:55 -0600 Message-Id: <1516064279-14816-4-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:c0f::242 Subject: [Qemu-devel] [PATCH 3/7] ipmi: Don't set the timestamp on add events that don't have it 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 According to the spec, from section "32.3 OEM SEL Record - Type E0h-FFh", event types from 0x0e to 0xff do not have a timestamp. So don't set it when adding those types. This required putting the timestamp in a temporary buffer, since it's still required to set the last addition time. Signed-off-by: Corey Minyard Reviewed-by: Cédric Le Goater --- hw/ipmi/ipmi_bmc_sim.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/hw/ipmi/ipmi_bmc_sim.c b/hw/ipmi/ipmi_bmc_sim.c index cc068f2..a0bbfd5 100644 --- a/hw/ipmi/ipmi_bmc_sim.c +++ b/hw/ipmi/ipmi_bmc_sim.c @@ -443,16 +443,21 @@ static void sel_inc_reservation(IPMISel *sel) /* Returns 1 if the SEL is full and can't hold the event. */ static int sel_add_event(IPMIBmcSim *ibs, uint8_t *event) { + uint8_t ts[4]; + event[0] = 0xff; event[1] = 0xff; - set_timestamp(ibs, event + 3); + set_timestamp(ibs, ts); + if (event[2] < 0xe0) { /* Don't set timestamps for type 0xe0-0xff. */ + memcpy(event + 3, ts, 4); + } if (ibs->sel.next_free == MAX_SEL_SIZE) { ibs->sel.overflow = 1; return 1; } event[0] = ibs->sel.next_free & 0xff; event[1] = (ibs->sel.next_free >> 8) & 0xff; - memcpy(ibs->sel.last_addition, event + 3, 4); + memcpy(ibs->sel.last_addition, ts, 4); memcpy(ibs->sel.sel[ibs->sel.next_free], event, 16); ibs->sel.next_free++; sel_inc_reservation(&ibs->sel);