From patchwork Thu Dec 7 21:30:07 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Corey Minyard X-Patchwork-Id: 845853 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="UXUEolZn"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3yt7vt0mJGz9s81 for ; Fri, 8 Dec 2017 08:31:22 +1100 (AEDT) Received: from localhost ([::1]:34405 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eN3lI-0005Zd-55 for incoming@patchwork.ozlabs.org; Thu, 07 Dec 2017 16:31:20 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44865) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eN3kS-0005YW-OZ for qemu-devel@nongnu.org; Thu, 07 Dec 2017 16:30:29 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eN3kQ-0001w4-IM for qemu-devel@nongnu.org; Thu, 07 Dec 2017 16:30:27 -0500 Received: from mail-pg0-x243.google.com ([2607:f8b0:400e:c05::243]:44678) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eN3kP-0001vK-TA for qemu-devel@nongnu.org; Thu, 07 Dec 2017 16:30:26 -0500 Received: by mail-pg0-x243.google.com with SMTP id j9so5352150pgc.11 for ; Thu, 07 Dec 2017 13:30:25 -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=UXUEolZncxDn0BUGaWiGJEazVdhyzLRRERMw/C1HqucXd3LFJinv9N2+aPmO+NhEBe 6gtK0Gr183CY0WywSKh8IgU0gpi92zZSbkf567PDKQEavOwph7pM4uN1UGVICXUyDlZ4 9wIDtXxOUoaClfkUyFtQgyHmPZ5MoxwByOBvNBos1a+PDVwLnWuk16nz03yhypXwDgOU 1ZNi9lPOr5PVo8SPDdwwQLEt27MuXiNu6h5GLwpH1JQdMeCzeN5XAuAtsH0O/xT9Pw4I fptxwWLKmC2Ac3mYgY/ZQ0UK8TrsU6U83KQD/cqQDnyrUq1pTLTgZCuI9OznwtKqHXgI +KkQ== 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=LxBa8Dpbt2JCJpQyQkwDKad/xr0k7AZmwjPHdWgs7j3ZZu1+w09JBSPifIZewSJFjH aYAThEyrBRxPnrKI2xOX9emG9nLH4Ptdv6IMCRCWBc0YcnoOupQEZHopVGMHJ3w22j7q 4NxygBaZBT3RHoeQvPmHlkeoMbuShjO6Gm7IkLuJkGiI+apvDaqx9YGt/PC1dZgBwxPt PSPzabhhk4/tMN9lJhnaZm9gXv6haXt7UTZUee91YiprJ+QuOOe2GtYP8uria/lNg9C0 ypMqLqlxQjpXW9DlPKkGefrMBdpz37NmsZ69Uw+e+EgJ3lUfaoZ5UDDiPW1eU0Q5Y5JC OMZA== X-Gm-Message-State: AJaThX5nQXTAkFBLhHDGiQw7026DUhIxGxOZ1mK4zz4e+jN4XHgzLcas A0LX1r050I/hZZouezJZVD4NJp0= X-Google-Smtp-Source: AGs4zMZLEPzSrfchLGmoeAh2tohKCpkUm6LpBxW8RseShxN3Fwaqa+jc6nXuERggOMUt0hS9lld3cQ== X-Received: by 10.99.121.4 with SMTP id u4mr27365483pgc.235.1512682224805; Thu, 07 Dec 2017 13:30:24 -0800 (PST) Received: from serve.minyard.net ([47.184.168.85]) by smtp.gmail.com with ESMTPSA id o184sm9349744pga.3.2017.12.07.13.30.22 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 07 Dec 2017 13:30:23 -0800 (PST) Received: from t430.minyard.net (t430m.minyard.net [192.168.27.3]) by serve.minyard.net (Postfix) with ESMTPA id A7F42B76; Thu, 7 Dec 2017 15:30:20 -0600 (CST) Received: by t430.minyard.net (Postfix, from userid 1000) id 89B71302366; Thu, 7 Dec 2017 15:30:17 -0600 (CST) From: minyard@acm.org To: qemu-devel@nongnu.org Date: Thu, 7 Dec 2017 15:30:07 -0600 Message-Id: <1512682213-4354-3-git-send-email-minyard@acm.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1512682213-4354-1-git-send-email-minyard@acm.org> References: <1512682213-4354-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:400e:c05::243 Subject: [Qemu-devel] [PATCH 2/8] 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: Corey Minyard Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" 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);