public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Ming Huang" <huangming23@huawei.com>
To: <devel@edk2.groups.io>, <leif@nuviainc.com>, <ard.biesheuvel@linaro.org>
Cc: <lidongzhan@huawei.com>, <huangming23@huawei.com>,
	<songdongkuang@huawei.com>, <wanghuiqiang@huawei.com>,
	<qiuliangen@huawei.com>, <shenlimei@huawei.com>,
	<xiewenyi2@huawei.com>
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	[thread overview]
Message-ID: <1591709245-44527-2-git-send-email-huangming23@huawei.com> (raw)
In-Reply-To: <1591709245-44527-1-git-send-email-huangming23@huawei.com>

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 <huangming23@huawei.com>
Reviewed-by: Leif Lindholm <leif@nuviainc.com>
---
 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.<BR>
-  Copyright (c) 2015, Hisilicon Limited. All rights reserved.<BR>
+  Copyright (c) 2015 - 2020, Hisilicon Limited. All rights reserved.<BR>
   Copyright (c) 2015, Linaro Limited. All rights reserved.<BR>
   SPDX-License-Identifier: BSD-2-Clause-Patent
 
@@ -23,6 +23,38 @@
 #include <IndustryStandard/AcpiAml.h>
 #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.<BR>
-#  Copyright (c) 2015, Hisilicon Limited. All rights reserved.<BR>
+#  Copyright (c) 2015 - 2020, Hisilicon Limited. All rights reserved.<BR>
 #  Copyright (c) 2015, Linaro Limited. All rights reserved.<BR>
 #  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


  reply	other threads:[~2020-06-09 13:30 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-09 13:27 [PATCH edk2-platforms v3 0/4] Improve D0x Ming Huang
2020-06-09 13:27 ` Ming Huang [this message]
2020-06-09 13:27 ` [PATCH edk2-platforms v3 2/4] Silicon/Hisilicon: Add HISI_SAS_CONFIG_PROTOCOL Ming Huang
2020-06-09 13:27 ` [PATCH edk2-platforms v3 3/4] Silicon/Hisilicon/Acpi: Add update sas address feature Ming Huang
2020-06-16 14:20   ` [edk2-devel] " Leif Lindholm
2020-06-17  2:07     ` Ming Huang
2020-06-17 11:07       ` Leif Lindholm
2020-06-17 11:23         ` Ming Huang
2020-06-17 12:07           ` Leif Lindholm
2020-06-09 13:27 ` [PATCH edk2-platforms v3 4/4] Silicon/Hisilicon: Rename EthMac files Ming Huang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1591709245-44527-2-git-send-email-huangming23@huawei.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox