From patchwork Tue Apr 11 11:48:04 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chenhui Sun X-Patchwork-Id: 97248 Delivered-To: patch@linaro.org Received: by 10.140.89.233 with SMTP id v96csp1769738qgd; Tue, 11 Apr 2017 04:51:56 -0700 (PDT) X-Received: by 10.55.39.199 with SMTP id n190mr45535471qkn.295.1491911516387; Tue, 11 Apr 2017 04:51:56 -0700 (PDT) Return-Path: Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id n19si16144227qtn.330.2017.04.11.04.51.56; Tue, 11 Apr 2017 04:51:56 -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 C87C163FD0; Tue, 11 Apr 2017 11:51:55 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by lists.linaro.org (Postfix) with ESMTP id B521763FC6; Tue, 11 Apr 2017 11:51:53 +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 936D863FC8; Tue, 11 Apr 2017 11:51:52 +0000 (UTC) Received: from mail-pg0-f54.google.com (mail-pg0-f54.google.com [74.125.83.54]) by lists.linaro.org (Postfix) with ESMTPS id 6751163FC5 for ; Tue, 11 Apr 2017 11:51:50 +0000 (UTC) Received: by mail-pg0-f54.google.com with SMTP id g2so119924777pge.3 for ; Tue, 11 Apr 2017 04:51:50 -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; bh=r3galyMVOWm4EoJAaBY7rUqRiJrZH+pG/4iNTkem4Y0=; b=kvXRU1e6APtjMbC8NY8Tqx53GmJfsUlCUPRge269hPaq25hTqSg3ypJXr9BRqtoprM nrVs/h1AY22TlwqT48rDH/EMynoSDSPmkj9G2wpIN83e3W2Gz8gHDlzFdgY2uG/VFUZX jG+zz+bTvx0mtktbZHSmkwzPaA+JSYYgGkFJpS2+vYjJmITNzWdkzpENlRN7dIpIv/VM oyswJBo4UtZL0OXbUcUF4e5tz7OtALFb+gPJU24WUt640+3Q/XbNV9hLBlyWlJZXfi6o +bSNBWN8Net60ZeJd8DlBFUXxSB4v8kvlTswuUzdFN7n4jA4B/WuHIoirccUX0YvzJ06 oNSQ== X-Gm-Message-State: AFeK/H1HoCsHlPCeVOuxdxSC2sxNnHm0YRgKbGSGvC2m7My/zktzw+sg8vaQVtt2SZvn/b8+txI= X-Received: by 10.99.149.16 with SMTP id p16mr61028374pgd.112.1491911509657; Tue, 11 Apr 2017 04:51:49 -0700 (PDT) Received: from localhost.localdomain ([119.145.15.121]) by smtp.gmail.com with ESMTPSA id 65sm30395707pgc.1.2017.04.11.04.51.46 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 11 Apr 2017 04:51:49 -0700 (PDT) From: Chenhui Sun To: leif.lindholm@linaro.org, linaro-uefi@lists.linaro.org, graeme.gregory@linaro.org Date: Tue, 11 Apr 2017 19:48:04 +0800 Message-Id: <1491911284-128983-1-git-send-email-chenhui.sun@linaro.org> X-Mailer: git-send-email 1.9.1 Cc: Yi Li , Chenhui Sun , sunchenhui@huawei.com, wanghuiqiang@huawei.com Subject: [Linaro-uefi] [PATCH] 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 Reviewed-by: Leif Lindholm --- Chips/Hisilicon/Drivers/AcpiPlatformDxe/EthMac.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/Chips/Hisilicon/Drivers/AcpiPlatformDxe/EthMac.c b/Chips/Hisilicon/Drivers/AcpiPlatformDxe/EthMac.c index 41f5692..1f74d31 100644 --- a/Chips/Hisilicon/Drivers/AcpiPlatformDxe/EthMac.c +++ b/Chips/Hisilicon/Drivers/AcpiPlatformDxe/EthMac.c @@ -442,6 +442,29 @@ static EFI_STATUS ProcessDSDT( return EFI_SUCCESS; } +STATIC +VOID +AcpiCheckSum ( + IN OUT EFI_ACPI_SDT_HEADER *Table + ) +{ + UINTN ChecksumOffset; + UINT8 *Buffer; + + ChecksumOffset = OFFSET_OF (EFI_ACPI_DESCRIPTION_HEADER, Checksum); + Buffer = (UINT8 *)Table; + + // + // set checksum to 0 first + // + Buffer[ChecksumOffset] = 0; + + // + // Update checksum value + // + Buffer[ChecksumOffset] = CalculateCheckSum8 (Buffer, Table->Length); +} + EFI_STATUS EthMacInit(void) { EFI_STATUS Status; @@ -478,6 +501,7 @@ EFI_STATUS EthMacInit(void) ProcessDSDT(AcpiTableProtocol, TableHandle); AcpiTableProtocol->Close(TableHandle); + AcpiCheckSum (Table); } return EFI_SUCCESS;