From patchwork Mon Mar 20 13:11: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: 95534 Delivered-To: patch@linaro.org Received: by 10.140.89.233 with SMTP id v96csp937131qgd; Mon, 20 Mar 2017 06:17:41 -0700 (PDT) X-Received: by 10.36.164.75 with SMTP id v11mr10235619iti.101.1490015861180; Mon, 20 Mar 2017 06:17:41 -0700 (PDT) Return-Path: Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id c9si10662042itf.40.2017.03.20.06.17.40; Mon, 20 Mar 2017 06:17:41 -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 B407863E98; Mon, 20 Mar 2017 13:17:40 +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 73B2A63E9C; Mon, 20 Mar 2017 13:15:47 +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 A700863E83; Mon, 20 Mar 2017 13:15:40 +0000 (UTC) Received: from mail-pf0-f170.google.com (mail-pf0-f170.google.com [209.85.192.170]) by lists.linaro.org (Postfix) with ESMTPS id 1820E63E7D for ; Mon, 20 Mar 2017 13:15:05 +0000 (UTC) Received: by mail-pf0-f170.google.com with SMTP id 20so17966894pfk.2 for ; Mon, 20 Mar 2017 06:15:05 -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=LhctDMT73bti79v/oKN27OyJyab8VWY+VgIWCc0wI08=; b=LF4RNhMfglGWmjPID5YHqTO7QLXGGw5ScBzXkXDx8o2ib9qwGlkdBiS8uQX7ZZ5zNW OYTwXOpMETU3vtWwULRWfwb2YwSZMt15OdPVTYfxmN4oI1tF1zj64YT/wOKGzgSgTrwR 4DGYCfBuQLa5bPPhHM8r8sdUnY2Xf2h9Sa3VQdzAETWT9XilCYPbHh+CHgwqbaeBGfOM 9H6JnsOAd/jfa6urLu6GpbIsWwIv1DW/1xt/tV3PS3QQocfiuwUIiaPupEWjDheSs0Rk mARZsSML+RDglWF94lZFrvtFdzanahfSC1mKnOOuVnC3Pk5Pm8VeTXEdSTx8p4IW/ilI olfQ== X-Gm-Message-State: AFeK/H3AxN632Jl9k9+W6fkwEB7bWdoyuJ6jf3hxruGPQZk8EOLwsYpJJRc+NPNHg2GxjjLxeT0= X-Received: by 10.84.254.68 with SMTP id a4mr30481395pln.57.1490015704403; Mon, 20 Mar 2017 06:15:04 -0700 (PDT) Received: from localhost.localdomain ([119.145.15.121]) by smtp.gmail.com with ESMTPSA id a62sm33573787pgc.60.2017.03.20.06.15.02 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 20 Mar 2017 06:15:03 -0700 (PDT) From: Chenhui Sun To: leif.lindholm@linaro.org, linaro-uefi@lists.linaro.org Date: Mon, 20 Mar 2017 21:11:10 +0800 Message-Id: <1490015485-53685-7-git-send-email-chenhui.sun@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1490015485-53685-1-git-send-email-chenhui.sun@linaro.org> References: <1490015485-53685-1-git-send-email-chenhui.sun@linaro.org> Cc: Yi Li , wanglijun , sunchenhui@huawei.com, wanghuiqiang@huawei.com Subject: [Linaro-uefi] [Linaro-uefi v1 06/21] 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" From: Chenhui Sun Refresh checksum after changing DSDT table. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: wanglijun Signed-off-by: Heyi Guo Signed-off-by: Yi Li Reviewed-by: Graeme Gregory --- 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..98be4dc 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 +AcpiPlatformChecksum ( + IN 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); + AcpiPlatformChecksum ((UINT8*)Table, Table->Length); } return EFI_SUCCESS;