From patchwork Tue Jul 10 00:01:32 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 941754 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; dmarc=fail (p=none dis=none) header.from=redhat.com 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 41Pj7R5RQGz9s0W for ; Tue, 10 Jul 2018 10:02:27 +1000 (AEST) Received: from localhost ([::1]:44957 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fcg6r-00019H-BS for incoming@patchwork.ozlabs.org; Mon, 09 Jul 2018 20:02:25 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36026) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fcg62-00018B-MZ for qemu-devel@nongnu.org; Mon, 09 Jul 2018 20:01:35 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fcg61-0001oL-RV for qemu-devel@nongnu.org; Mon, 09 Jul 2018 20:01:34 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:41010 helo=mx1.redhat.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fcg61-0001oD-MU for qemu-devel@nongnu.org; Mon, 09 Jul 2018 20:01:33 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 34F7D87AC4 for ; Tue, 10 Jul 2018 00:01:33 +0000 (UTC) Received: from redhat.com (ovpn-120-239.rdu2.redhat.com [10.10.120.239]) by smtp.corp.redhat.com (Postfix) with SMTP id E691A111D3CF; Tue, 10 Jul 2018 00:01:32 +0000 (UTC) Date: Tue, 10 Jul 2018 03:01:32 +0300 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Message-ID: <20180710000024.542612-5-mst@redhat.com> References: <20180710000024.542612-1-mst@redhat.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20180710000024.542612-1-mst@redhat.com> X-Mutt-Fcc: =sent X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.1]); Tue, 10 Jul 2018 00:01:33 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.1]); Tue, 10 Jul 2018 00:01:33 +0000 (UTC) for IP:'10.11.54.3' DOMAIN:'int-mx03.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'mst@redhat.com' RCPT:'' X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 66.187.233.73 Subject: [Qemu-devel] [PATCH hack dontapply v2 4/7] acpi: export acpi_checksum 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: imammedo@redhat.com, ehabkost@redhat.com, pbonzini@redhat.com Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" For most tables we supply to guests checksum is calculated by the bios at load time. However, when table needs to be changed later dynamically, QEMU has to calculate the checksum. Export acpi_checksum so ACPI generation code can re-use it. Signed-off-by: Michael S. Tsirkin --- include/hw/acpi/acpi.h | 2 ++ hw/acpi/core.c | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/include/hw/acpi/acpi.h b/include/hw/acpi/acpi.h index c20ace0d0b..957a064d58 100644 --- a/include/hw/acpi/acpi.h +++ b/include/hw/acpi/acpi.h @@ -148,6 +148,8 @@ struct ACPIREGS { Notifier wakeup; }; +int acpi_checksum(const uint8_t *data, int len); + /* PM_TMR */ void acpi_pm_tmr_update(ACPIREGS *ar, bool enable); void acpi_pm_tmr_calc_overflow_time(ACPIREGS *ar); diff --git a/hw/acpi/core.c b/hw/acpi/core.c index b8d39012cd..ae24d104d4 100644 --- a/hw/acpi/core.c +++ b/hw/acpi/core.c @@ -72,7 +72,7 @@ static void acpi_register_config(void) opts_init(acpi_register_config); -static int acpi_checksum(const uint8_t *data, int len) +int acpi_checksum(const uint8_t *data, int len) { int sum, i; sum = 0;