From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from huawei.com (huawei.com [45.249.212.35]) by mx.groups.io with SMTP id smtpd.web11.7148.1591709399927201458 for ; Tue, 09 Jun 2020 06:30:00 -0700 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: huawei.com, ip: 45.249.212.35, mailfrom: huangming23@huawei.com) Received: from DGGEMS411-HUB.china.huawei.com (unknown [172.30.72.58]) by Forcepoint Email with ESMTP id 062A37E92A2B87368A37; Tue, 9 Jun 2020 21:29:58 +0800 (CST) Received: from HGH1000039998.huawei.com (10.184.68.188) by DGGEMS411-HUB.china.huawei.com (10.3.19.211) with Microsoft SMTP Server id 14.3.487.0; Tue, 9 Jun 2020 21:29:51 +0800 From: "Ming Huang" To: , , CC: , , , , , , Subject: [PATCH edk2-platforms v3 1/4] Silicon/Hisilicon: Change updating dsdt in ready to boot event Date: Tue, 9 Jun 2020 21:27:22 +0800 Message-ID: <1591709245-44527-2-git-send-email-huangming23@huawei.com> X-Mailer: git-send-email 2.8.1 In-Reply-To: <1591709245-44527-1-git-send-email-huangming23@huawei.com> References: <1591709245-44527-1-git-send-email-huangming23@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.184.68.188] X-CFilter-Loop: Reflected Content-Type: text/plain The dsdt need be updated before boot to OS, so change the updating to ready to boot event and can remove the needless dependence. Signed-off-by: Ming Huang Reviewed-by: Leif Lindholm --- Silicon/Hisilicon/Drivers/AcpiPlatformDxe/AcpiPlatform.c | 56 +++++++++++++++++++- Silicon/Hisilicon/Drivers/AcpiPlatformDxe/AcpiPlatformDxe.inf | 4 +- 2 files changed, 56 insertions(+), 4 deletions(-) diff --git a/Silicon/Hisilicon/Drivers/AcpiPlatformDxe/AcpiPlatform.c b/Silicon/Hisilicon/Drivers/AcpiPlatformDxe/AcpiPlatform.c index b888cb1..c45a0bb 100644 --- a/Silicon/Hisilicon/Drivers/AcpiPlatformDxe/AcpiPlatform.c +++ b/Silicon/Hisilicon/Drivers/AcpiPlatformDxe/AcpiPlatform.c @@ -1,7 +1,7 @@ /** @file Copyright (c) 2014, Applied Micro Curcuit Corporation. All rights reserved.
- Copyright (c) 2015, Hisilicon Limited. All rights reserved.
+ Copyright (c) 2015 - 2020, Hisilicon Limited. All rights reserved.
Copyright (c) 2015, Linaro Limited. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent @@ -23,6 +23,38 @@ #include #include "EthMac.h" +EFI_EVENT mUpdateAcpiDsdtTableEvent; + +VOID +EFIAPI +UpdateAcpiDsdt ( + IN EFI_EVENT Event, + IN VOID *Context + ) +{ + EFI_ACPI_TABLE_PROTOCOL *AcpiTableProtocol; + EFI_STATUS Status; + + Status = gBS->LocateProtocol ( + &gEfiAcpiTableProtocolGuid, + NULL, + (VOID**)&AcpiTableProtocol + ); + + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_ERROR, " Unable to locate ACPI table protocol\n")); + return; + } + + Status = EthMacInit (); + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_ERROR, " UpdateAcpiDsdtTable Failed, Status = %r\n", Status)); + } + + gBS->CloseEvent (Event); + return; +} + EFI_STATUS EFIAPI AcpiPlatformEntryPoint ( @@ -30,5 +62,25 @@ AcpiPlatformEntryPoint ( IN EFI_SYSTEM_TABLE *SystemTable ) { - return EthMacInit(); + EFI_STATUS Status; + + // + // Register notify function + // + Status = gBS->CreateEventEx ( + EVT_NOTIFY_SIGNAL, + TPL_CALLBACK, + UpdateAcpiDsdt, + NULL, + &gEfiEventReadyToBootGuid, + &mUpdateAcpiDsdtTableEvent + ); + + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_ERROR, "Create ReadyToBoot event for UpdateAcpiDsdt failed.\n")); + } else { + DEBUG ((DEBUG_INFO, "Create ReadyToBoot event for UpdateAcpiDsdt success.\n")); + } + + return Status; } diff --git a/Silicon/Hisilicon/Drivers/AcpiPlatformDxe/AcpiPlatformDxe.inf b/Silicon/Hisilicon/Drivers/AcpiPlatformDxe/AcpiPlatformDxe.inf index 53da731..866ff75 100644 --- a/Silicon/Hisilicon/Drivers/AcpiPlatformDxe/AcpiPlatformDxe.inf +++ b/Silicon/Hisilicon/Drivers/AcpiPlatformDxe/AcpiPlatformDxe.inf @@ -1,7 +1,7 @@ ## @file # # Copyright (c) 2014, Applied Micro Curcuit Corp. All rights reserved.
-# Copyright (c) 2015, Hisilicon Limited. All rights reserved.
+# Copyright (c) 2015 - 2020, Hisilicon Limited. All rights reserved.
# Copyright (c) 2015, Linaro Limited. All rights reserved.
# SPDX-License-Identifier: BSD-2-Clause-Patent # @@ -62,5 +62,5 @@ gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiDefaultCreatorRevision [Depex] - gEfiAcpiTableProtocolGuid AND gEfiAcpiSdtProtocolGuid AND gHisiBoardNicProtocolGuid AND gHisiInstalledAcpiProtocolGuid + TRUE -- 2.8.1