From patchwork Sat Apr 1 11:29:10 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chenhui Sun X-Patchwork-Id: 96564 Delivered-To: patch@linaro.org Received: by 10.140.89.233 with SMTP id v96csp1124098qgd; Sat, 1 Apr 2017 04:34:58 -0700 (PDT) X-Received: by 10.237.62.176 with SMTP id n45mr7913452qtf.39.1491046498007; Sat, 01 Apr 2017 04:34:58 -0700 (PDT) Return-Path: Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id u29si7137959qta.260.2017.04.01.04.34.57; Sat, 01 Apr 2017 04:34:57 -0700 (PDT) Received-SPF: pass (google.com: domain of linaro-uefi-bounces@lists.linaro.org designates 54.225.227.206 as permitted sender) client-ip=54.225.227.206; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linaro-uefi-bounces@lists.linaro.org designates 54.225.227.206 as permitted sender) smtp.mailfrom=linaro-uefi-bounces@lists.linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: by lists.linaro.org (Postfix, from userid 109) id AD44463677; Sat, 1 Apr 2017 11:34:57 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on ip-10-142-244-252 X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, URIBL_BLOCKED autolearn=disabled version=3.4.0 Received: from [127.0.0.1] (localhost [127.0.0.1]) by lists.linaro.org (Postfix) with ESMTP id 5DC03608C2; Sat, 1 Apr 2017 11:34:15 +0000 (UTC) X-Original-To: linaro-uefi@lists.linaro.org Delivered-To: linaro-uefi@lists.linaro.org Received: by lists.linaro.org (Postfix, from userid 109) id 152E66365E; Sat, 1 Apr 2017 11:34:11 +0000 (UTC) Received: from mail-pf0-f177.google.com (mail-pf0-f177.google.com [209.85.192.177]) by lists.linaro.org (Postfix) with ESMTPS id D51ED62C8C for ; Sat, 1 Apr 2017 11:33:39 +0000 (UTC) Received: by mail-pf0-f177.google.com with SMTP id 197so4083574pfv.1 for ; Sat, 01 Apr 2017 04:33:39 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=MFtJGKalkT6Wb40uw1gbEoPXc/ydpxuEXt+pJarTIjk=; b=k8WT9atiQMZJQdfnQPDz3jq7KON5cwYdIQ95yzQa3n5C5OjRtMmbAqR8r/wbZTgb3r 1v8/suipYzxqnOh1Sj4w75XXo2iXezPr3Pd+bTPEOiutVuSnUWIGEBtG/Ov44nZN+eDX rd44oL4sbRu7m2JTMU1Ar3M0U3qX8luff5nUdE2CwAoeRgH3AEvpIeqNK/WXsLqmLtfV TNQcgzbxy5N/2ddivPgA2CL1I5VyK1gGlLJE1sqOUNgXKT0LcI0zj8127lDcM7zqWVc1 MaI9hHVIYu+ouoYk1yXLdrkOekHR8SHT+J/BE7bbWTvDyS9QcvLpJm77XTE5PKIG4s2B pwrw== X-Gm-Message-State: AFeK/H1jmk7Clxmmg3Ilb1QEk1TWkMRlCmZ06cqxZcjKL5Bt1nlMUogVoZV3v/fCLysuHisKOIs= X-Received: by 10.84.230.135 with SMTP id e7mr8863876plk.20.1491046419113; Sat, 01 Apr 2017 04:33:39 -0700 (PDT) Received: from localhost.localdomain ([119.145.15.121]) by smtp.gmail.com with ESMTPSA id a62sm15704868pgc.60.2017.04.01.04.33.27 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sat, 01 Apr 2017 04:33:38 -0700 (PDT) From: Chenhui Sun To: leif.lindholm@linaro.org, linaro-uefi@lists.linaro.org, graeme.gregory@linaro.org Date: Sat, 1 Apr 2017 19:29:10 +0800 Message-Id: <1491046162-53797-6-git-send-email-chenhui.sun@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1491046162-53797-1-git-send-email-chenhui.sun@linaro.org> References: <1491046162-53797-1-git-send-email-chenhui.sun@linaro.org> Cc: Yi Li , Chenhui Sun , sunchenhui@huawei.com, wanghuiqiang@huawei.com Subject: [Linaro-uefi] [Linaro-uefi v2 05/17] Hisilicon: Fix ACPI/DSDT table checksum error X-BeenThere: linaro-uefi@lists.linaro.org X-Mailman-Version: 2.1.16 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: linaro-uefi-bounces@lists.linaro.org Sender: "Linaro-uefi" Refresh checksum after changing DSDT table. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Heyi Guo Signed-off-by: Yi Li Signed-off-by: Chenhui Sun --- Chips/Hisilicon/Drivers/AcpiPlatformDxe/EthMac.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/Chips/Hisilicon/Drivers/AcpiPlatformDxe/EthMac.c b/Chips/Hisilicon/Drivers/AcpiPlatformDxe/EthMac.c index 41f5692..e22015a 100644 --- a/Chips/Hisilicon/Drivers/AcpiPlatformDxe/EthMac.c +++ b/Chips/Hisilicon/Drivers/AcpiPlatformDxe/EthMac.c @@ -442,6 +442,27 @@ static EFI_STATUS ProcessDSDT( return EFI_SUCCESS; } +VOID +AcpiChecksum ( + IN OUT UINT8 *Buffer, + IN UINTN Size + ) +{ + UINTN ChecksumOffset; + + ChecksumOffset = OFFSET_OF (EFI_ACPI_DESCRIPTION_HEADER, Checksum); + + // + // set checksum to 0 first + // + Buffer[ChecksumOffset] = 0; + + // + // Update checksum value + // + Buffer[ChecksumOffset] = CalculateCheckSum8(Buffer, Size); +} + EFI_STATUS EthMacInit(void) { EFI_STATUS Status; @@ -478,6 +499,7 @@ EFI_STATUS EthMacInit(void) ProcessDSDT(AcpiTableProtocol, TableHandle); AcpiTableProtocol->Close(TableHandle); + AcpiChecksum ((UINT8*)Table, Table->Length); } return EFI_SUCCESS;