public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [PATCH 1/2] UefiPayloadPkg: Remove ACPI board Hob.
@ 2021-09-13  3:01 thiyagux.kesavan.balakrishnan
  2021-09-13  3:01 ` [PATCH 2/2] OvmfPkg: Transfer PlatformBootManager library to driver thiyagukb
  0 siblings, 1 reply; 2+ messages in thread
From: thiyagux.kesavan.balakrishnan @ 2021-09-13  3:01 UTC (permalink / raw)
  To: devel; +Cc: thiyagukb, Guo Dong

BlSupportDxe would parse ACPI table and set PCDs.
Updated other modules to consume dynamic PCDs instead of HOBs.

Tested boot to shell with both SBL (universal and SblOpen)

Signed-off-by: Guo Dong <guo.dong@intel.com>
---
 UefiPayloadPkg/BlSupportDxe/BlSupportDxe.c                                               | 174 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++---------------
 UefiPayloadPkg/BlSupportDxe/BlSupportDxe.h                                               |   9 +++++++--
 UefiPayloadPkg/BlSupportDxe/BlSupportDxe.inf                                             |  15 +++++++++++++--
 UefiPayloadPkg/Include/Guid/AcpiBoardInfoGuid.h                                          |  30 ------------------------------
 UefiPayloadPkg/Include/Library/BlParseLib.h                                              |   1 -
 UefiPayloadPkg/Library/AcpiTimerLib/AcpiTimerLib.c                                       |  45 ++++-----------------------------------------
 UefiPayloadPkg/Library/AcpiTimerLib/AcpiTimerLib.inf                                     |   9 +++------
 UefiPayloadPkg/Library/PciSegmentInfoLibAcpiBoardInfo/PciSegmentInfoLibAcpiBoardInfo.c   |  28 ++++++++++++----------------
 UefiPayloadPkg/Library/PciSegmentInfoLibAcpiBoardInfo/PciSegmentInfoLibAcpiBoardInfo.inf |   5 ++++-
 UefiPayloadPkg/Library/ResetSystemLib/ResetSystemLib.c                                   |  57 ++++++---------------------------------------------------
 UefiPayloadPkg/Library/ResetSystemLib/ResetSystemLib.inf                                 |  12 +++++++-----
 UefiPayloadPkg/UefiPayloadEntry/PrintHob.c                                               |  28 ----------------------------
 UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.c                                       | 264 ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
 UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.h                                       |   3 ---
 UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.inf                                     |   1 -
 UefiPayloadPkg/UefiPayloadEntry/UniversalPayloadEntry.inf                                |   1 -
 UefiPayloadPkg/UefiPayloadPkg.dec                                                        |  26 +++++++++++++++++++++++++-
 UefiPayloadPkg/UefiPayloadPkg.dsc                                                        |   7 +++++++
 18 files changed, 247 insertions(+), 468 deletions(-)

diff --git a/UefiPayloadPkg/BlSupportDxe/BlSupportDxe.c b/UefiPayloadPkg/BlSupportDxe/BlSupportDxe.c
index 04e968a232..1d9da112c0 100644
--- a/UefiPayloadPkg/BlSupportDxe/BlSupportDxe.c
+++ b/UefiPayloadPkg/BlSupportDxe/BlSupportDxe.c
@@ -84,6 +84,152 @@ ReserveResourceInGcd (
 }
 
 
+/**
+  Set the platform related PCDs using ACPI table
+
+  @param[in]  AcpiTableBase         ACPI table start address in memory
+
+  @retval RETURN_SUCCESS            Successfully set PCDs based ACPI table.
+  @retval RETURN_NOT_FOUND          Failed to find the required info
+
+**/
+RETURN_STATUS
+SetPcdsUsingAcpiTable (
+  IN   UINT64                                   AcpiTableBase
+  )
+{
+  EFI_STATUS                                    Status;
+  EFI_ACPI_3_0_ROOT_SYSTEM_DESCRIPTION_POINTER  *Rsdp;
+  EFI_ACPI_DESCRIPTION_HEADER                   *Rsdt;
+  UINT32                                        *Entry32;
+  UINTN                                         Entry32Num;
+  EFI_ACPI_3_0_FIXED_ACPI_DESCRIPTION_TABLE     *Fadt;
+  EFI_ACPI_DESCRIPTION_HEADER                   *Xsdt;
+  UINT64                                        *Entry64;
+  UINTN                                         Entry64Num;
+  UINTN                                         Idx;
+  UINT32                                        *Signature;
+  EFI_ACPI_MEMORY_MAPPED_CONFIGURATION_BASE_ADDRESS_TABLE_HEADER *MmCfgHdr;
+  EFI_ACPI_MEMORY_MAPPED_ENHANCED_CONFIGURATION_SPACE_BASE_ADDRESS_ALLOCATION_STRUCTURE *MmCfgBase;
+  UINT64                                        PcieBaseAddress;
+  UINT64                                        PcieBaseSize;
+
+  Rsdp = (EFI_ACPI_3_0_ROOT_SYSTEM_DESCRIPTION_POINTER *)(UINTN)AcpiTableBase;
+  DEBUG ((DEBUG_INFO, "Rsdp at 0x%p\n", Rsdp));
+  DEBUG ((DEBUG_INFO, "Rsdt at 0x%x, Xsdt at 0x%lx\n", Rsdp->RsdtAddress, Rsdp->XsdtAddress));
+
+  //
+  // Search Rsdt First
+  //
+  Fadt     = NULL;
+  MmCfgHdr = NULL;
+  Rsdt     = (EFI_ACPI_DESCRIPTION_HEADER *)(UINTN)(Rsdp->RsdtAddress);
+  if (Rsdt != NULL) {
+    Entry32  = (UINT32 *)(Rsdt + 1);
+    Entry32Num = (Rsdt->Length - sizeof(EFI_ACPI_DESCRIPTION_HEADER)) >> 2;
+    for (Idx = 0; Idx < Entry32Num; Idx++) {
+      Signature = (UINT32 *)(UINTN)Entry32[Idx];
+      if (*Signature == EFI_ACPI_3_0_FIXED_ACPI_DESCRIPTION_TABLE_SIGNATURE) {
+        Fadt = (EFI_ACPI_3_0_FIXED_ACPI_DESCRIPTION_TABLE *)Signature;
+        DEBUG ((DEBUG_INFO, "Found Fadt in Rsdt\n"));
+      }
+
+      if (*Signature == EFI_ACPI_5_0_PCI_EXPRESS_MEMORY_MAPPED_CONFIGURATION_SPACE_BASE_ADDRESS_DESCRIPTION_TABLE_SIGNATURE) {
+        MmCfgHdr = (EFI_ACPI_MEMORY_MAPPED_CONFIGURATION_BASE_ADDRESS_TABLE_HEADER *)Signature;
+        DEBUG ((DEBUG_INFO, "Found MM config address in Rsdt\n"));
+      }
+
+      if ((Fadt != NULL) && (MmCfgHdr != NULL)) {
+        goto Done;
+      }
+    }
+  }
+
+  //
+  // Search Xsdt Second
+  //
+  Xsdt     = (EFI_ACPI_DESCRIPTION_HEADER *)(UINTN)(Rsdp->XsdtAddress);
+  if (Xsdt != NULL) {
+    Entry64  = (UINT64 *)(Xsdt + 1);
+    Entry64Num = (Xsdt->Length - sizeof(EFI_ACPI_DESCRIPTION_HEADER)) >> 3;
+    for (Idx = 0; Idx < Entry64Num; Idx++) {
+      Signature = (UINT32 *)(UINTN)Entry64[Idx];
+      if (*Signature == EFI_ACPI_3_0_FIXED_ACPI_DESCRIPTION_TABLE_SIGNATURE) {
+        Fadt = (EFI_ACPI_3_0_FIXED_ACPI_DESCRIPTION_TABLE *)Signature;
+        DEBUG ((DEBUG_INFO, "Found Fadt in Xsdt\n"));
+      }
+
+      if (*Signature == EFI_ACPI_5_0_PCI_EXPRESS_MEMORY_MAPPED_CONFIGURATION_SPACE_BASE_ADDRESS_DESCRIPTION_TABLE_SIGNATURE) {
+        MmCfgHdr = (EFI_ACPI_MEMORY_MAPPED_CONFIGURATION_BASE_ADDRESS_TABLE_HEADER *)Signature;
+        DEBUG ((DEBUG_INFO, "Found MM config address in Xsdt\n"));
+      }
+
+      if ((Fadt != NULL) && (MmCfgHdr != NULL)) {
+        goto Done;
+      }
+    }
+  }
+
+  if (Fadt == NULL) {
+    return RETURN_NOT_FOUND;
+  }
+
+Done:
+
+  if (MmCfgHdr != NULL) {
+    MmCfgBase = (EFI_ACPI_MEMORY_MAPPED_ENHANCED_CONFIGURATION_SPACE_BASE_ADDRESS_ALLOCATION_STRUCTURE *)((UINT8*) MmCfgHdr + sizeof (*MmCfgHdr));
+    PcieBaseAddress = MmCfgBase->BaseAddress;
+    PcieBaseSize    = (MmCfgBase->EndBusNumber + 1 - MmCfgBase->StartBusNumber) * 4096 * 32 * 8;
+  } else {
+    PcieBaseAddress = 0;
+    PcieBaseSize    = 0;
+  }
+  DEBUG ((DEBUG_INFO, "PmCtrl  Reg 0x%lx\n",  Fadt->Pm1aCntBlk));
+  DEBUG ((DEBUG_INFO, "PmTimer Reg 0x%lx\n",  Fadt->PmTmrBlk));
+  DEBUG ((DEBUG_INFO, "Reset   Reg 0x%lx\n",  Fadt->ResetReg.Address));
+  DEBUG ((DEBUG_INFO, "Reset   Value 0x%x\n", Fadt->ResetValue));
+  DEBUG ((DEBUG_INFO, "PmEvt   Reg 0x%lx\n",  Fadt->Pm1aEvtBlk));
+  DEBUG ((DEBUG_INFO, "PmGpeEn Reg 0x%lx\n",  Fadt->Gpe0Blk + Fadt->Gpe0BlkLen / 2));
+  DEBUG ((DEBUG_INFO, "PcieBaseAddr 0x%lx\n", PcieBaseAddress));
+  DEBUG ((DEBUG_INFO, "PcieBaseSize 0x%lx\n", PcieBaseSize));
+
+  //
+  // Verify values for proper operation
+  //
+  ASSERT(Fadt->Pm1aCntBlk       != 0);
+  ASSERT(Fadt->PmTmrBlk         != 0);
+  ASSERT(Fadt->ResetReg.Address != 0);
+  ASSERT(Fadt->Pm1aEvtBlk       != 0);
+  ASSERT(Fadt->Gpe0Blk          != 0);
+
+  Status = PcdSet32S (PcdAcpiPm1aControlAddress, Fadt->Pm1aCntBlk);
+  ASSERT_EFI_ERROR (Status);
+
+  Status = PcdSet32S (PcdAcpiPm1aEventAddress, Fadt->Pm1aEvtBlk);
+  ASSERT_EFI_ERROR (Status);
+
+  Status = PcdSet32S (PcdAcpiGpe0EnableAddress, Fadt->Gpe0Blk + Fadt->Gpe0BlkLen / 2);
+  ASSERT_EFI_ERROR (Status);
+
+  Status = PcdSet64S (PcdAcpiResetRegister, Fadt->ResetReg.Address);
+  ASSERT_EFI_ERROR (Status);
+
+  Status = PcdSet8S (PcdAcpiResetValue, Fadt->ResetValue);
+  ASSERT_EFI_ERROR (Status);
+
+  Status = PcdSet32S (PcdAcpiPm1TimerRegister, Fadt->PmTmrBlk);
+  ASSERT_EFI_ERROR (Status);
+
+  Status = PcdSet64S (PcdPciExpressBaseAddress, PcieBaseAddress);
+  ASSERT_EFI_ERROR (Status);
+
+  Status = PcdSet64S (PcdPciExpressBaseSize, PcieBaseSize);
+  ASSERT_EFI_ERROR (Status);
+
+  return RETURN_SUCCESS;
+}
+
+
 /**
   Main entry for the bootloader support DXE module.
 
@@ -101,12 +247,13 @@ BlDxeEntryPoint (
   IN EFI_SYSTEM_TABLE        *SystemTable
   )
 {
-  EFI_STATUS Status;
-  EFI_HOB_GUID_TYPE          *GuidHob;
-  EFI_PEI_GRAPHICS_INFO_HOB  *GfxInfo;
-  ACPI_BOARD_INFO            *AcpiBoardInfo;
+  EFI_STATUS                       Status;
+  EFI_HOB_GUID_TYPE                *GuidHob;
+  EFI_PEI_GRAPHICS_INFO_HOB        *GfxInfo;
+  UNIVERSAL_PAYLOAD_ACPI_TABLE     *AcpiTableHob;
 
   Status = EFI_SUCCESS;
+
   //
   // Report MMIO/IO Resources
   //
@@ -131,17 +278,14 @@ BlDxeEntryPoint (
   }
 
   //
-  // Set PcdPciExpressBaseAddress and PcdPciExpressBaseSize by HOB info
+  // Install Acpi Table
   //
-  GuidHob = GetFirstGuidHob (&gUefiAcpiBoardInfoGuid);
-  if (GuidHob != NULL) {
-    AcpiBoardInfo = (ACPI_BOARD_INFO *)GET_GUID_HOB_DATA (GuidHob);
-    Status = PcdSet64S (PcdPciExpressBaseAddress, AcpiBoardInfo->PcieBaseAddress);
-    ASSERT_EFI_ERROR (Status);
-    Status = PcdSet64S (PcdPciExpressBaseSize, AcpiBoardInfo->PcieBaseSize);
-    ASSERT_EFI_ERROR (Status);
-  }
-
+  GuidHob = GetFirstGuidHob (&gUniversalPayloadAcpiTableGuid);
+ if (GuidHob != NULL) {
+   AcpiTableHob = (UNIVERSAL_PAYLOAD_ACPI_TABLE *)GET_GUID_HOB_DATA (GuidHob);
+   DEBUG ((DEBUG_ERROR, "Install Acpi Table at 0x%lx \n", AcpiTableHob->Rsdp));
+   Status = SetPcdsUsingAcpiTable ((UINT64)(UINTN)AcpiTableHob->Rsdp);
+   ASSERT_EFI_ERROR (Status);
+ }
   return EFI_SUCCESS;
 }
-
diff --git a/UefiPayloadPkg/BlSupportDxe/BlSupportDxe.h b/UefiPayloadPkg/BlSupportDxe/BlSupportDxe.h
index 3332a30eae..0790a5572a 100644
--- a/UefiPayloadPkg/BlSupportDxe/BlSupportDxe.h
+++ b/UefiPayloadPkg/BlSupportDxe/BlSupportDxe.h
@@ -19,9 +19,14 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
 #include <Library/IoLib.h>
 #include <Library/HobLib.h>
 
+#include <Guid/Acpi.h>
 #include <Guid/SmBios.h>
-#include <Guid/SystemTableInfoGuid.h>
-#include <Guid/AcpiBoardInfoGuid.h>
+#include <UniversalPayload/AcpiTable.h>
+#include <UniversalPayload/SmbiosTable.h>
 #include <Guid/GraphicsInfoHob.h>
 
+#include <IndustryStandard/Acpi.h>
+#include <IndustryStandard/MemoryMappedConfigurationSpaceAccessTable.h>
+#include <UniversalPayload/AcpiTable.h>
+
 #endif
diff --git a/UefiPayloadPkg/BlSupportDxe/BlSupportDxe.inf b/UefiPayloadPkg/BlSupportDxe/BlSupportDxe.inf
index 1ccb250991..5d39a9b3f2 100644
--- a/UefiPayloadPkg/BlSupportDxe/BlSupportDxe.inf
+++ b/UefiPayloadPkg/BlSupportDxe/BlSupportDxe.inf
@@ -42,9 +42,8 @@
   HobLib
 
 [Guids]
-  gUefiSystemTableInfoGuid
-  gUefiAcpiBoardInfoGuid
   gEfiGraphicsInfoHobGuid
+  gUniversalPayloadAcpiTableGuid
 
 [Pcd]
   gEfiMdeModulePkgTokenSpaceGuid.PcdVideoHorizontalResolution
@@ -53,6 +52,18 @@
   gEfiMdeModulePkgTokenSpaceGuid.PcdSetupVideoVerticalResolution
   gEfiMdePkgTokenSpaceGuid.PcdPciExpressBaseAddress
   gEfiMdePkgTokenSpaceGuid.PcdPciExpressBaseSize
+  gUefiPayloadPkgTokenSpaceGuid.PcdAcpiPm1TimerRegister
+  gUefiPayloadPkgTokenSpaceGuid.PcdAcpiResetRegister
+  gUefiPayloadPkgTokenSpaceGuid.PcdAcpiResetValue
+  gUefiPayloadPkgTokenSpaceGuid.PcdAcpiPm1aControlAddress
+  gUefiPayloadPkgTokenSpaceGuid.PcdAcpiPm1aEventAddress
+  gUefiPayloadPkgTokenSpaceGuid.PcdAcpiGpe0EnableAddress
+  gUefiPayloadPkgTokenSpaceGuid.PcdAcpiPm1TimerRegister
+  gUefiPayloadPkgTokenSpaceGuid.PcdAcpiResetRegister
+  gUefiPayloadPkgTokenSpaceGuid.PcdAcpiResetValue
+  gUefiPayloadPkgTokenSpaceGuid.PcdAcpiPm1aControlAddress
+  gUefiPayloadPkgTokenSpaceGuid.PcdAcpiPm1aEventAddress
+  gUefiPayloadPkgTokenSpaceGuid.PcdAcpiGpe0EnableAddress
 
 [Depex]
   TRUE
diff --git a/UefiPayloadPkg/Include/Guid/AcpiBoardInfoGuid.h b/UefiPayloadPkg/Include/Guid/AcpiBoardInfoGuid.h
deleted file mode 100644
index 043b748ae4..0000000000
--- a/UefiPayloadPkg/Include/Guid/AcpiBoardInfoGuid.h
+++ /dev/null
@@ -1,30 +0,0 @@
-/** @file
-  This file defines the hob structure for board related information from acpi table
-
-  Copyright (c) 2014, Intel Corporation. All rights reserved.<BR>
-  SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#ifndef __ACPI_BOARD_INFO_GUID_H__
-#define __ACPI_BOARD_INFO_GUID_H__
-
-///
-/// Board information GUID
-///
-extern EFI_GUID gUefiAcpiBoardInfoGuid;
-
-typedef struct {
-  UINT8              Revision;
-  UINT8              Reserved0[2];
-  UINT8              ResetValue;
-  UINT64             PmEvtBase;
-  UINT64             PmGpeEnBase;
-  UINT64             PmCtrlRegBase;
-  UINT64             PmTimerRegBase;
-  UINT64             ResetRegAddress;
-  UINT64             PcieBaseAddress;
-  UINT64             PcieBaseSize;
-} ACPI_BOARD_INFO;
-
-#endif
diff --git a/UefiPayloadPkg/Include/Library/BlParseLib.h b/UefiPayloadPkg/Include/Library/BlParseLib.h
index 8058c1a17b..6310a02f95 100644
--- a/UefiPayloadPkg/Include/Library/BlParseLib.h
+++ b/UefiPayloadPkg/Include/Library/BlParseLib.h
@@ -13,7 +13,6 @@
 #include <UniversalPayload/AcpiTable.h>
 #include <UniversalPayload/SmbiosTable.h>
 #include <Guid/SystemTableInfoGuid.h>
-#include <Guid/AcpiBoardInfoGuid.h>
 
 #ifndef __BOOTLOADER_PARSE_LIB__
 #define __BOOTLOADER_PARSE_LIB__
diff --git a/UefiPayloadPkg/Library/AcpiTimerLib/AcpiTimerLib.c b/UefiPayloadPkg/Library/AcpiTimerLib/AcpiTimerLib.c
index b86382d709..541327709c 100644
--- a/UefiPayloadPkg/Library/AcpiTimerLib/AcpiTimerLib.c
+++ b/UefiPayloadPkg/Library/AcpiTimerLib/AcpiTimerLib.c
@@ -1,7 +1,7 @@
 /** @file
   ACPI Timer implements one instance of Timer Library.
 
-  Copyright (c) 2014, Intel Corporation. All rights reserved.<BR>
+  Copyright (c) 2014 - 2021, Intel Corporation. All rights reserved.<BR>
   SPDX-License-Identifier: BSD-2-Clause-Patent
 
 **/
@@ -10,47 +10,11 @@
 #include <Library/TimerLib.h>
 #include <Library/BaseLib.h>
 #include <Library/IoLib.h>
-#include <Library/HobLib.h>
 #include <Library/DebugLib.h>
-
-#include <Guid/AcpiBoardInfoGuid.h>
 #include <IndustryStandard/Acpi.h>
 
 #define ACPI_TIMER_COUNT_SIZE  BIT24
 
-UINTN mPmTimerReg = 0;
-
-/**
-  The constructor function enables ACPI IO space.
-
-  If ACPI I/O space not enabled, this function will enable it.
-  It will always return RETURN_SUCCESS.
-
-  @retval EFI_SUCCESS   The constructor always returns RETURN_SUCCESS.
-
-**/
-RETURN_STATUS
-EFIAPI
-AcpiTimerLibConstructor (
-  VOID
-  )
-{
-  EFI_HOB_GUID_TYPE  *GuidHob;
-  ACPI_BOARD_INFO    *pAcpiBoardInfo;
-
-  //
-  // Find the acpi board information guid hob
-  //
-  GuidHob = GetFirstGuidHob (&gUefiAcpiBoardInfoGuid);
-  ASSERT (GuidHob != NULL);
-
-  pAcpiBoardInfo = (ACPI_BOARD_INFO *)GET_GUID_HOB_DATA (GuidHob);
-
-  mPmTimerReg = (UINTN)pAcpiBoardInfo->PmTimerRegBase;
-
-  return EFI_SUCCESS;
-}
-
 /**
   Internal function to read the current tick counter of ACPI.
 
@@ -64,10 +28,9 @@ InternalAcpiGetTimerTick (
   VOID
   )
 {
-  if (mPmTimerReg == 0) {
-    AcpiTimerLibConstructor ();
-  }
-  return IoRead32 (mPmTimerReg);
+
+  ASSERT (PcdGet32 (PcdAcpiPm1TimerRegister) != 0);
+  return IoRead32 (PcdGet32 (PcdAcpiPm1TimerRegister));
 }
 
 /**
diff --git a/UefiPayloadPkg/Library/AcpiTimerLib/AcpiTimerLib.inf b/UefiPayloadPkg/Library/AcpiTimerLib/AcpiTimerLib.inf
index 3e177cadc0..0fea86c83a 100644
--- a/UefiPayloadPkg/Library/AcpiTimerLib/AcpiTimerLib.inf
+++ b/UefiPayloadPkg/Library/AcpiTimerLib/AcpiTimerLib.inf
@@ -1,7 +1,7 @@
 ## @file
 #  ACPI Timer Library Instance.
 #
-#  Copyright (c) 2014 - 2018, Intel Corporation. All rights reserved.<BR>
+#  Copyright (c) 2014 - 2021, Intel Corporation. All rights reserved.<BR>
 #  SPDX-License-Identifier: BSD-2-Clause-Patent
 #
 ##
@@ -14,8 +14,6 @@
   VERSION_STRING                 = 1.0
   LIBRARY_CLASS                  = TimerLib
 
-  CONSTRUCTOR                    = AcpiTimerLibConstructor
-
 #
 # The following information is for reference only and not required by the build tools.
 #
@@ -33,8 +31,7 @@
 [LibraryClasses]
   BaseLib
   IoLib
-  HobLib
   DebugLib
 
-[Guids]
-  gUefiAcpiBoardInfoGuid
+[Pcd]
+  gUefiPayloadPkgTokenSpaceGuid.PcdAcpiPm1TimerRegister
diff --git a/UefiPayloadPkg/Library/PciSegmentInfoLibAcpiBoardInfo/PciSegmentInfoLibAcpiBoardInfo.c b/UefiPayloadPkg/Library/PciSegmentInfoLibAcpiBoardInfo/PciSegmentInfoLibAcpiBoardInfo.c
index d37c91cc9f..3c79649b56 100644
--- a/UefiPayloadPkg/Library/PciSegmentInfoLibAcpiBoardInfo/PciSegmentInfoLibAcpiBoardInfo.c
+++ b/UefiPayloadPkg/Library/PciSegmentInfoLibAcpiBoardInfo/PciSegmentInfoLibAcpiBoardInfo.c
@@ -8,9 +8,7 @@
 **/
 
 #include <PiDxe.h>
-#include <Guid/AcpiBoardInfoGuid.h>
-
-#include <Library/HobLib.h>
+#include <Library/PcdLib.h>
 #include <Library/PciSegmentInfoLib.h>
 #include <Library/DebugLib.h>
 
@@ -21,6 +19,17 @@ STATIC PCI_SEGMENT_INFO mPciSegment0 = {
   255 // End bus number
 };
 
+
+RETURN_STATUS
+EFIAPI
+PciSegmentInfoInitialize (
+  VOID
+  )
+{
+  mPciSegment0.BaseAddress = PcdGet64 (PcdPciExpressBaseAddress);
+  return RETURN_SUCCESS;
+}
+
 /**
   Return an array of PCI_SEGMENT_INFO holding the segment information.
 
@@ -36,24 +45,11 @@ GetPciSegmentInfo (
   UINTN  *Count
   )
 {
-  EFI_HOB_GUID_TYPE  *GuidHob;
-  ACPI_BOARD_INFO    *AcpiBoardInfo;
-
   ASSERT (Count != NULL);
   if (Count == NULL) {
     return NULL;
   }
 
-  if (mPciSegment0.BaseAddress == 0) {
-    //
-    // Find the acpi board information guid hob
-    //
-    GuidHob = GetFirstGuidHob (&gUefiAcpiBoardInfoGuid);
-    ASSERT (GuidHob != NULL);
-
-    AcpiBoardInfo = (ACPI_BOARD_INFO *) GET_GUID_HOB_DATA (GuidHob);
-    mPciSegment0.BaseAddress = AcpiBoardInfo->PcieBaseAddress;
-  }
   *Count = 1;
   return &mPciSegment0;
 }
diff --git a/UefiPayloadPkg/Library/PciSegmentInfoLibAcpiBoardInfo/PciSegmentInfoLibAcpiBoardInfo.inf b/UefiPayloadPkg/Library/PciSegmentInfoLibAcpiBoardInfo/PciSegmentInfoLibAcpiBoardInfo.inf
index ec4dbaaa55..cc6ca83706 100644
--- a/UefiPayloadPkg/Library/PciSegmentInfoLibAcpiBoardInfo/PciSegmentInfoLibAcpiBoardInfo.inf
+++ b/UefiPayloadPkg/Library/PciSegmentInfoLibAcpiBoardInfo/PciSegmentInfoLibAcpiBoardInfo.inf
@@ -16,6 +16,7 @@
   MODULE_TYPE                    = BASE
   VERSION_STRING                 = 1.0
   LIBRARY_CLASS                  = PciSegmentInfoLib | DXE_DRIVER
+  CONSTRUCTOR                    = PciSegmentInfoInitialize
 
 #
 # The following information is for reference only and not required by the build tools.
@@ -32,5 +33,7 @@
 
 [LibraryClasses]
   PcdLib
-  HobLib
   DebugLib
+
+[Pcd]
+  gEfiMdePkgTokenSpaceGuid.PcdPciExpressBaseAddress
\ No newline at end of file
diff --git a/UefiPayloadPkg/Library/ResetSystemLib/ResetSystemLib.c b/UefiPayloadPkg/Library/ResetSystemLib/ResetSystemLib.c
index 2e4b7fe592..9e2e58f977 100644
--- a/UefiPayloadPkg/Library/ResetSystemLib/ResetSystemLib.c
+++ b/UefiPayloadPkg/Library/ResetSystemLib/ResetSystemLib.c
@@ -10,54 +10,8 @@
 #include <Library/BaseLib.h>
 #include <Library/DebugLib.h>
 #include <Library/IoLib.h>
-#include <Library/HobLib.h>
 #include <Library/BaseMemoryLib.h>
-#include <Guid/AcpiBoardInfoGuid.h>
 
-ACPI_BOARD_INFO    mAcpiBoardInfo;
-
-/**
-  The constructor function to initialize mAcpiBoardInfo.
-
-  @retval EFI_SUCCESS   The constructor always returns RETURN_SUCCESS.
-
-**/
-RETURN_STATUS
-EFIAPI
-ResetSystemLibConstructor (
-  VOID
-  )
-{
-  EFI_HOB_GUID_TYPE  *GuidHob;
-  ACPI_BOARD_INFO    *AcpiBoardInfoPtr;
-
-  //
-  // Find the acpi board information guid hob
-  //
-  GuidHob = GetFirstGuidHob (&gUefiAcpiBoardInfoGuid);
-  ASSERT (GuidHob != NULL);
-
-  AcpiBoardInfoPtr = (ACPI_BOARD_INFO *)GET_GUID_HOB_DATA (GuidHob);
-  CopyMem (&mAcpiBoardInfo, AcpiBoardInfoPtr, sizeof (ACPI_BOARD_INFO));
-
-  return EFI_SUCCESS;
-}
-
-
-VOID
-AcpiPmControl (
-  UINTN   SuspendType
-  )
-{
-  UINTN              PmCtrlReg;
-
-  ASSERT (SuspendType <= 7);
-
-  PmCtrlReg = (UINTN)mAcpiBoardInfo.PmCtrlRegBase;
-  IoAndThenOr16 (PmCtrlReg, (UINT16) ~0x3c00, (UINT16) (SuspendType << 10));
-  IoOr16 (PmCtrlReg, BIT13);
-  CpuDeadLoop ();
-}
 
 /**
   Calling this function causes a system-wide reset. This sets
@@ -74,7 +28,7 @@ ResetCold (
   VOID
   )
 {
-  IoWrite8 ((UINTN)mAcpiBoardInfo.ResetRegAddress, mAcpiBoardInfo.ResetValue);
+  IoWrite8 ((UINTN)PcdGet64 (PcdAcpiResetRegister), PcdGet8 (PcdAcpiResetValue));
   CpuDeadLoop ();
 }
 
@@ -91,7 +45,8 @@ ResetWarm (
   VOID
   )
 {
-  IoWrite8 ((UINTN)mAcpiBoardInfo.ResetRegAddress, mAcpiBoardInfo.ResetValue);
+  IoWrite8 ((UINTN)PcdGet64 (PcdAcpiResetRegister), PcdGet8 (PcdAcpiResetValue));
+
   CpuDeadLoop ();
 }
 
@@ -113,17 +68,17 @@ ResetShutdown (
   //
   // GPE0_EN should be disabled to avoid any GPI waking up the system from S5
   //
-  IoWrite16 ((UINTN)mAcpiBoardInfo.PmGpeEnBase,  0);
+  IoWrite16 (PcdGet32 (PcdAcpiGpe0EnableAddress),  0);
 
   //
   // Clear Power Button Status
   //
-  IoWrite16((UINTN) mAcpiBoardInfo.PmEvtBase, BIT8);
+  IoWrite16(PcdGet32 (PcdAcpiPm1aEventAddress), BIT8);
 
   //
   // Transform system into S5 sleep state
   //
-  PmCtrlReg = (UINTN)mAcpiBoardInfo.PmCtrlRegBase;
+  PmCtrlReg = PcdGet32 (PcdAcpiPm1aControlAddress);
   IoAndThenOr16 (PmCtrlReg, (UINT16) ~0x3c00, (UINT16) (7 << 10));
   IoOr16 (PmCtrlReg, BIT13);
   CpuDeadLoop ();
diff --git a/UefiPayloadPkg/Library/ResetSystemLib/ResetSystemLib.inf b/UefiPayloadPkg/Library/ResetSystemLib/ResetSystemLib.inf
index e7341c341a..77d73e7404 100644
--- a/UefiPayloadPkg/Library/ResetSystemLib/ResetSystemLib.inf
+++ b/UefiPayloadPkg/Library/ResetSystemLib/ResetSystemLib.inf
@@ -1,7 +1,7 @@
 ## @file
 #  Library instance for ResetSystem library class for bootloader
 #
-#  Copyright (c) 2014 - 2019, Intel Corporation. All rights reserved.<BR>
+#  Copyright (c) 2014 - 2021, Intel Corporation. All rights reserved.<BR>
 #  SPDX-License-Identifier: BSD-2-Clause-Patent
 #
 ##
@@ -14,7 +14,6 @@
   VERSION_STRING                 = 1.0
   LIBRARY_CLASS                  = ResetSystemLib
 
-  CONSTRUCTOR                    = ResetSystemLibConstructor
 #
 # The following information is for reference only and not required by the build tools.
 #
@@ -32,9 +31,12 @@
 [LibraryClasses]
   DebugLib
   IoLib
-  HobLib
   BaseMemoryLib
 
-[Guids]
-  gUefiAcpiBoardInfoGuid
+[Pcd]
+  gUefiPayloadPkgTokenSpaceGuid.PcdAcpiResetRegister
+  gUefiPayloadPkgTokenSpaceGuid.PcdAcpiResetValue
+  gUefiPayloadPkgTokenSpaceGuid.PcdAcpiGpe0EnableAddress
+  gUefiPayloadPkgTokenSpaceGuid.PcdAcpiPm1aEventAddress
+  gUefiPayloadPkgTokenSpaceGuid.PcdAcpiPm1aControlAddress
 
diff --git a/UefiPayloadPkg/UefiPayloadEntry/PrintHob.c b/UefiPayloadPkg/UefiPayloadEntry/PrintHob.c
index 5fb638d4a4..6a92bffed1 100644
--- a/UefiPayloadPkg/UefiPayloadEntry/PrintHob.c
+++ b/UefiPayloadPkg/UefiPayloadEntry/PrintHob.c
@@ -9,7 +9,6 @@
 #include <UniversalPayload/PciRootBridges.h>
 #include <UniversalPayload/ExtraData.h>
 #include <Guid/MemoryTypeInformation.h>
-#include <Guid/AcpiBoardInfoGuid.h>
 
 #define ROW_LIMITER 16
 
@@ -276,32 +275,6 @@ PrintSmbiosTablGuidHob (
   return EFI_SUCCESS;
 }
 
-/**
-  Print the information in Acpi BoardInfo Guid Hob.
-  @param[in] HobRaw          A pointer to the start of gUefiAcpiBoardInfoGuid HOB.
-  @retval EFI_SUCCESS        If it completed successfully.
-**/
-EFI_STATUS
-PrintAcpiBoardInfoGuidHob (
-  IN  UINT8          *HobRaw,
-  IN  UINT16         HobLength
-  )
-{
-  ACPI_BOARD_INFO          *AcpBoardInfo;
-  AcpBoardInfo = (ACPI_BOARD_INFO *) GET_GUID_HOB_DATA (HobRaw);
-  ASSERT (HobLength >= sizeof (*AcpBoardInfo));
-  DEBUG ((DEBUG_INFO, "   Revision        = 0x%x\n",  AcpBoardInfo->Revision));
-  DEBUG ((DEBUG_INFO, "   Reserved0       = 0x%x\n",  AcpBoardInfo->Reserved0));
-  DEBUG ((DEBUG_INFO, "   ResetValue      = 0x%x\n",  AcpBoardInfo->ResetValue));
-  DEBUG ((DEBUG_INFO, "   PmEvtBase       = 0x%lx\n", AcpBoardInfo->PmEvtBase));
-  DEBUG ((DEBUG_INFO, "   PmGpeEnBase     = 0x%lx\n", AcpBoardInfo->PmGpeEnBase));
-  DEBUG ((DEBUG_INFO, "   PmCtrlRegBase   = 0x%lx\n", AcpBoardInfo->PmCtrlRegBase));
-  DEBUG ((DEBUG_INFO, "   PmTimerRegBase  = 0x%lx\n", AcpBoardInfo->PmTimerRegBase));
-  DEBUG ((DEBUG_INFO, "   ResetRegAddress = 0x%lx\n", AcpBoardInfo->ResetRegAddress));
-  DEBUG ((DEBUG_INFO, "   PcieBaseAddress = 0x%lx\n", AcpBoardInfo->PcieBaseAddress));
-  DEBUG ((DEBUG_INFO, "   PcieBaseSize    = 0x%lx\n", AcpBoardInfo->PcieBaseSize));
-  return EFI_SUCCESS;
-}
 
 /**
   Print the information in Pci RootBridge Info Guid Hob.
@@ -415,7 +388,6 @@ GUID_HOB_PRINT_HANDLE GuidHobPrintHandleTable[] = {
   {&gUniversalPayloadSerialPortInfoGuid,    PrintSerialGuidHob,            "gUniversalPayloadSerialPortInfoGuid(Serial Port Info)"},
   {&gUniversalPayloadSmbios3TableGuid,      PrintSmbios3GuidHob,           "gUniversalPayloadSmbios3TableGuid(SmBios Guid)"},
   {&gUniversalPayloadSmbiosTableGuid,       PrintSmbiosTablGuidHob,        "gUniversalPayloadSmbiosTableGuid(SmBios Guid)"},
-  {&gUefiAcpiBoardInfoGuid,                 PrintAcpiBoardInfoGuidHob,     "gUefiAcpiBoardInfoGuid(Acpi Guid)"},
   {&gUniversalPayloadPciRootBridgeInfoGuid, PrintPciRootBridgeInfoGuidHob, "gUniversalPayloadPciRootBridgeInfoGuid(Pci Guid)"},
   {&gEfiMemoryTypeInformationGuid,          PrintMemoryTypeInfoGuidHob,    "gEfiMemoryTypeInformationGuid(Memory Type Information Guid)"},
   {&gUniversalPayloadExtraDataGuid,         PrintExtraDataGuidHob,         "gUniversalPayloadExtraDataGuid(PayLoad Extra Data Guid)"}
diff --git a/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.c b/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.c
index 64a76e84b1..8ccf0f3ac8 100644
--- a/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.c
+++ b/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.c
@@ -9,85 +9,6 @@
 
 STATIC UINT32 mTopOfLowerUsableDram = 0;
 
-/**
-   Callback function to build resource descriptor HOB
-
-   This function build a HOB based on the memory map entry info.
-   It creates only EFI_RESOURCE_MEMORY_MAPPED_IO and EFI_RESOURCE_MEMORY_RESERVED
-   resources.
-
-   @param MemoryMapEntry         Memory map entry info got from bootloader.
-   @param Params                 A pointer to ACPI_BOARD_INFO.
-
-  @retval EFI_SUCCESS            Successfully build a HOB.
-  @retval EFI_INVALID_PARAMETER  Invalid parameter provided.
-**/
-EFI_STATUS
-MemInfoCallbackMmio (
-  IN MEMROY_MAP_ENTRY          *MemoryMapEntry,
-  IN VOID                      *Params
-  )
-{
-  EFI_PHYSICAL_ADDRESS         Base;
-  EFI_RESOURCE_TYPE            Type;
-  UINT64                       Size;
-  EFI_RESOURCE_ATTRIBUTE_TYPE  Attribue;
-  ACPI_BOARD_INFO              *AcpiBoardInfo;
-
-  AcpiBoardInfo = (ACPI_BOARD_INFO *)Params;
-  if (AcpiBoardInfo == NULL) {
-    return EFI_INVALID_PARAMETER;
-  }
-
-  //
-  // Skip types already handled in MemInfoCallback
-  //
-  if (MemoryMapEntry->Type == E820_RAM || MemoryMapEntry->Type == E820_ACPI) {
-    return EFI_SUCCESS;
-  }
-
-  if (MemoryMapEntry->Base == AcpiBoardInfo->PcieBaseAddress) {
-    //
-    // MMCONF is always MMIO
-    //
-    Type = EFI_RESOURCE_MEMORY_MAPPED_IO;
-  } else if (MemoryMapEntry->Base < mTopOfLowerUsableDram) {
-    //
-    // It's in DRAM and thus must be reserved
-    //
-    Type = EFI_RESOURCE_MEMORY_RESERVED;
-  } else if ((MemoryMapEntry->Base < 0x100000000ULL) && (MemoryMapEntry->Base >= mTopOfLowerUsableDram)) {
-    //
-    // It's not in DRAM, must be MMIO
-    //
-    Type = EFI_RESOURCE_MEMORY_MAPPED_IO;
-  } else {
-    Type = EFI_RESOURCE_MEMORY_RESERVED;
-  }
-
-  Base    = MemoryMapEntry->Base;
-  Size    = MemoryMapEntry->Size;
-
-  Attribue = EFI_RESOURCE_ATTRIBUTE_PRESENT |
-             EFI_RESOURCE_ATTRIBUTE_INITIALIZED |
-             EFI_RESOURCE_ATTRIBUTE_TESTED |
-             EFI_RESOURCE_ATTRIBUTE_UNCACHEABLE |
-             EFI_RESOURCE_ATTRIBUTE_WRITE_COMBINEABLE |
-             EFI_RESOURCE_ATTRIBUTE_WRITE_THROUGH_CACHEABLE |
-             EFI_RESOURCE_ATTRIBUTE_WRITE_BACK_CACHEABLE;
-
-  BuildResourceDescriptorHob (Type, Attribue, (EFI_PHYSICAL_ADDRESS)Base, Size);
-  DEBUG ((DEBUG_INFO , "buildhob: base = 0x%lx, size = 0x%lx, type = 0x%x\n", Base, Size, Type));
-
-  if (MemoryMapEntry->Type == E820_UNUSABLE ||
-    MemoryMapEntry->Type == E820_DISABLED) {
-    BuildMemoryAllocationHob (Base, Size, EfiUnusableMemory);
-  } else if (MemoryMapEntry->Type == E820_PMEM) {
-    BuildMemoryAllocationHob (Base, Size, EfiPersistentMemory);
-  }
-
-  return EFI_SUCCESS;
-}
 
 
 /**
@@ -211,168 +132,6 @@ MemInfoCallback (
 }
 
 
-
-/**
-  Find the board related info from ACPI table
-
-  @param  AcpiTableBase          ACPI table start address in memory
-  @param  AcpiBoardInfo          Pointer to the acpi board info strucutre
-
-  @retval RETURN_SUCCESS     Successfully find out all the required information.
-  @retval RETURN_NOT_FOUND   Failed to find the required info.
-
-**/
-RETURN_STATUS
-ParseAcpiInfo (
-  IN   UINT64                                   AcpiTableBase,
-  OUT  ACPI_BOARD_INFO                          *AcpiBoardInfo
-  )
-{
-  EFI_ACPI_3_0_ROOT_SYSTEM_DESCRIPTION_POINTER  *Rsdp;
-  EFI_ACPI_DESCRIPTION_HEADER                   *Rsdt;
-  UINT32                                        *Entry32;
-  UINTN                                         Entry32Num;
-  EFI_ACPI_3_0_FIXED_ACPI_DESCRIPTION_TABLE     *Fadt;
-  EFI_ACPI_DESCRIPTION_HEADER                   *Xsdt;
-  UINT64                                        *Entry64;
-  UINTN                                         Entry64Num;
-  UINTN                                         Idx;
-  UINT32                                        *Signature;
-  EFI_ACPI_MEMORY_MAPPED_CONFIGURATION_BASE_ADDRESS_TABLE_HEADER *MmCfgHdr;
-  EFI_ACPI_MEMORY_MAPPED_ENHANCED_CONFIGURATION_SPACE_BASE_ADDRESS_ALLOCATION_STRUCTURE *MmCfgBase;
-
-  Rsdp = (EFI_ACPI_3_0_ROOT_SYSTEM_DESCRIPTION_POINTER *)(UINTN)AcpiTableBase;
-  DEBUG ((DEBUG_INFO, "Rsdp at 0x%p\n", Rsdp));
-  DEBUG ((DEBUG_INFO, "Rsdt at 0x%x, Xsdt at 0x%lx\n", Rsdp->RsdtAddress, Rsdp->XsdtAddress));
-
-  //
-  // Search Rsdt First
-  //
-  Fadt     = NULL;
-  MmCfgHdr = NULL;
-  Rsdt     = (EFI_ACPI_DESCRIPTION_HEADER *)(UINTN)(Rsdp->RsdtAddress);
-  if (Rsdt != NULL) {
-    Entry32  = (UINT32 *)(Rsdt + 1);
-    Entry32Num = (Rsdt->Length - sizeof(EFI_ACPI_DESCRIPTION_HEADER)) >> 2;
-    for (Idx = 0; Idx < Entry32Num; Idx++) {
-      Signature = (UINT32 *)(UINTN)Entry32[Idx];
-      if (*Signature == EFI_ACPI_3_0_FIXED_ACPI_DESCRIPTION_TABLE_SIGNATURE) {
-        Fadt = (EFI_ACPI_3_0_FIXED_ACPI_DESCRIPTION_TABLE *)Signature;
-        DEBUG ((DEBUG_INFO, "Found Fadt in Rsdt\n"));
-      }
-
-      if (*Signature == EFI_ACPI_5_0_PCI_EXPRESS_MEMORY_MAPPED_CONFIGURATION_SPACE_BASE_ADDRESS_DESCRIPTION_TABLE_SIGNATURE) {
-        MmCfgHdr = (EFI_ACPI_MEMORY_MAPPED_CONFIGURATION_BASE_ADDRESS_TABLE_HEADER *)Signature;
-        DEBUG ((DEBUG_INFO, "Found MM config address in Rsdt\n"));
-      }
-
-      if ((Fadt != NULL) && (MmCfgHdr != NULL)) {
-        goto Done;
-      }
-    }
-  }
-
-  //
-  // Search Xsdt Second
-  //
-  Xsdt     = (EFI_ACPI_DESCRIPTION_HEADER *)(UINTN)(Rsdp->XsdtAddress);
-  if (Xsdt != NULL) {
-    Entry64  = (UINT64 *)(Xsdt + 1);
-    Entry64Num = (Xsdt->Length - sizeof(EFI_ACPI_DESCRIPTION_HEADER)) >> 3;
-    for (Idx = 0; Idx < Entry64Num; Idx++) {
-      Signature = (UINT32 *)(UINTN)Entry64[Idx];
-      if (*Signature == EFI_ACPI_3_0_FIXED_ACPI_DESCRIPTION_TABLE_SIGNATURE) {
-        Fadt = (EFI_ACPI_3_0_FIXED_ACPI_DESCRIPTION_TABLE *)Signature;
-        DEBUG ((DEBUG_INFO, "Found Fadt in Xsdt\n"));
-      }
-
-      if (*Signature == EFI_ACPI_5_0_PCI_EXPRESS_MEMORY_MAPPED_CONFIGURATION_SPACE_BASE_ADDRESS_DESCRIPTION_TABLE_SIGNATURE) {
-        MmCfgHdr = (EFI_ACPI_MEMORY_MAPPED_CONFIGURATION_BASE_ADDRESS_TABLE_HEADER *)Signature;
-        DEBUG ((DEBUG_INFO, "Found MM config address in Xsdt\n"));
-      }
-
-      if ((Fadt != NULL) && (MmCfgHdr != NULL)) {
-        goto Done;
-      }
-    }
-  }
-
-  if (Fadt == NULL) {
-    return RETURN_NOT_FOUND;
-  }
-
-Done:
-
-  AcpiBoardInfo->PmCtrlRegBase   = Fadt->Pm1aCntBlk;
-  AcpiBoardInfo->PmTimerRegBase  = Fadt->PmTmrBlk;
-  AcpiBoardInfo->ResetRegAddress = Fadt->ResetReg.Address;
-  AcpiBoardInfo->ResetValue      = Fadt->ResetValue;
-  AcpiBoardInfo->PmEvtBase       = Fadt->Pm1aEvtBlk;
-  AcpiBoardInfo->PmGpeEnBase     = Fadt->Gpe0Blk + Fadt->Gpe0BlkLen / 2;
-
-  if (MmCfgHdr != NULL) {
-    MmCfgBase = (EFI_ACPI_MEMORY_MAPPED_ENHANCED_CONFIGURATION_SPACE_BASE_ADDRESS_ALLOCATION_STRUCTURE *)((UINT8*) MmCfgHdr + sizeof (*MmCfgHdr));
-    AcpiBoardInfo->PcieBaseAddress = MmCfgBase->BaseAddress;
-    AcpiBoardInfo->PcieBaseSize = (MmCfgBase->EndBusNumber + 1 - MmCfgBase->StartBusNumber) * 4096 * 32 * 8;
-  } else {
-    AcpiBoardInfo->PcieBaseAddress = 0;
-    AcpiBoardInfo->PcieBaseSize = 0;
-  }
-  DEBUG ((DEBUG_INFO, "PmCtrl  Reg 0x%lx\n",  AcpiBoardInfo->PmCtrlRegBase));
-  DEBUG ((DEBUG_INFO, "PmTimer Reg 0x%lx\n",  AcpiBoardInfo->PmTimerRegBase));
-  DEBUG ((DEBUG_INFO, "Reset   Reg 0x%lx\n",  AcpiBoardInfo->ResetRegAddress));
-  DEBUG ((DEBUG_INFO, "Reset   Value 0x%x\n", AcpiBoardInfo->ResetValue));
-  DEBUG ((DEBUG_INFO, "PmEvt   Reg 0x%lx\n",  AcpiBoardInfo->PmEvtBase));
-  DEBUG ((DEBUG_INFO, "PmGpeEn Reg 0x%lx\n",  AcpiBoardInfo->PmGpeEnBase));
-  DEBUG ((DEBUG_INFO, "PcieBaseAddr 0x%lx\n", AcpiBoardInfo->PcieBaseAddress));
-  DEBUG ((DEBUG_INFO, "PcieBaseSize 0x%lx\n", AcpiBoardInfo->PcieBaseSize));
-
-  //
-  // Verify values for proper operation
-  //
-  ASSERT(Fadt->Pm1aCntBlk != 0);
-  ASSERT(Fadt->PmTmrBlk != 0);
-  ASSERT(Fadt->ResetReg.Address != 0);
-  ASSERT(Fadt->Pm1aEvtBlk != 0);
-  ASSERT(Fadt->Gpe0Blk != 0);
-
-  DEBUG_CODE_BEGIN ();
-    BOOLEAN    SciEnabled;
-
-    //
-    // Check the consistency of SCI enabling
-    //
-
-    //
-    // Get SCI_EN value
-    //
-   if (Fadt->Pm1CntLen == 4) {
-      SciEnabled = (IoRead32 (Fadt->Pm1aCntBlk) & BIT0)? TRUE : FALSE;
-    } else {
-      //
-      // if (Pm1CntLen == 2), use 16 bit IO read;
-      // if (Pm1CntLen != 2 && Pm1CntLen != 4), use 16 bit IO read as a fallback
-      //
-      SciEnabled = (IoRead16 (Fadt->Pm1aCntBlk) & BIT0)? TRUE : FALSE;
-    }
-
-    if (!(Fadt->Flags & EFI_ACPI_5_0_HW_REDUCED_ACPI) &&
-        (Fadt->SmiCmd == 0) &&
-       !SciEnabled) {
-      //
-      // The ACPI enabling status is inconsistent: SCI is not enabled but ACPI
-      // table does not provide a means to enable it through FADT->SmiCmd
-      //
-      DEBUG ((DEBUG_ERROR, "ERROR: The ACPI enabling status is inconsistent: SCI is not"
-        " enabled but the ACPI table does not provide a means to enable it through FADT->SmiCmd."
-        " This may cause issues in OS.\n"));
-    }
-  DEBUG_CODE_END ();
-
-  return RETURN_SUCCESS;
-}
-
-
 /**
   It will build HOBs based on information from bootloaders.
 
@@ -385,8 +144,6 @@ BuildHobFromBl (
   )
 {
   EFI_STATUS                       Status;
-  ACPI_BOARD_INFO                  AcpiBoardInfo;
-  ACPI_BOARD_INFO                  *NewAcpiBoardInfo;
   EFI_PEI_GRAPHICS_INFO_HOB        GfxInfo;
   EFI_PEI_GRAPHICS_INFO_HOB        *NewGfxInfo;
   EFI_PEI_GRAPHICS_DEVICE_INFO_HOB GfxDeviceInfo;
@@ -460,27 +217,6 @@ BuildHobFromBl (
     DEBUG ((DEBUG_INFO, "Detected ACPI Table at 0x%lx\n", AcpiTableHob->Rsdp));
   }
 
-  //
-  // Create guid hob for acpi board information
-  //
-  Status = ParseAcpiInfo (AcpiTableHob->Rsdp, &AcpiBoardInfo);
-  ASSERT_EFI_ERROR (Status);
-  if (!EFI_ERROR (Status)) {
-    NewAcpiBoardInfo = BuildGuidHob (&gUefiAcpiBoardInfoGuid, sizeof (ACPI_BOARD_INFO));
-    ASSERT (NewAcpiBoardInfo != NULL);
-    CopyMem (NewAcpiBoardInfo, &AcpiBoardInfo, sizeof (ACPI_BOARD_INFO));
-    DEBUG ((DEBUG_INFO, "Create acpi board info guid hob\n"));
-  }
-
-  //
-  // Parse memory info and build memory HOBs for reserved DRAM and MMIO
-  //
-  DEBUG ((DEBUG_INFO , "Building ResourceDescriptorHobs for reserved memory:\n"));
-  Status = ParseMemoryInfo (MemInfoCallbackMmio, &AcpiBoardInfo);
-  if (EFI_ERROR(Status)) {
-    return Status;
-  }
-
   //
   // Parse platform specific information.
   //
diff --git a/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.h b/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.h
index 82590bf7c6..460253e4b6 100644
--- a/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.h
+++ b/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.h
@@ -24,11 +24,8 @@
 #include <Library/BlParseLib.h>
 #include <Library/PlatformSupportLib.h>
 #include <Library/UefiCpuLib.h>
-#include <IndustryStandard/Acpi.h>
-#include <IndustryStandard/MemoryMappedConfigurationSpaceAccessTable.h>
 #include <Guid/SerialPortInfoGuid.h>
 #include <Guid/MemoryMapInfoGuid.h>
-#include <Guid/AcpiBoardInfoGuid.h>
 #include <Guid/GraphicsInfoHob.h>
 #include <UniversalPayload/SmbiosTable.h>
 #include <UniversalPayload/AcpiTable.h>
diff --git a/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.inf b/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.inf
index 8d42925fcd..7b5ff184e9 100644
--- a/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.inf
+++ b/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.inf
@@ -63,7 +63,6 @@
   gUefiSystemTableInfoGuid
   gEfiGraphicsInfoHobGuid
   gEfiGraphicsDeviceInfoHobGuid
-  gUefiAcpiBoardInfoGuid
   gUniversalPayloadSmbiosTableGuid
   gUniversalPayloadAcpiTableGuid
 
diff --git a/UefiPayloadPkg/UefiPayloadEntry/UniversalPayloadEntry.inf b/UefiPayloadPkg/UefiPayloadEntry/UniversalPayloadEntry.inf
index 416a620598..6394af5048 100644
--- a/UefiPayloadPkg/UefiPayloadEntry/UniversalPayloadEntry.inf
+++ b/UefiPayloadPkg/UefiPayloadEntry/UniversalPayloadEntry.inf
@@ -59,7 +59,6 @@
   gUefiSystemTableInfoGuid
   gEfiGraphicsInfoHobGuid
   gEfiGraphicsDeviceInfoHobGuid
-  gUefiAcpiBoardInfoGuid
   gEfiSmbiosTableGuid
   gEfiAcpiTableGuid
   gUefiSerialPortInfoGuid
diff --git a/UefiPayloadPkg/UefiPayloadPkg.dec b/UefiPayloadPkg/UefiPayloadPkg.dec
index 8f0a7e3f95..94b0e057ce 100644
--- a/UefiPayloadPkg/UefiPayloadPkg.dec
+++ b/UefiPayloadPkg/UefiPayloadPkg.dec
@@ -33,7 +33,6 @@
   gEdkiiBootManagerMenuFileGuid = { 0xdf939333, 0x42fc, 0x4b2a, { 0xa5, 0x9e, 0xbb, 0xae, 0x82, 0x81, 0xfe, 0xef }}
 
   gUefiSystemTableInfoGuid = {0x16c8a6d0, 0xfe8a, 0x4082, {0xa2, 0x8, 0xcf, 0x89, 0xc4, 0x29, 0x4, 0x33}}
-  gUefiAcpiBoardInfoGuid   = {0xad3d31b, 0xb3d8, 0x4506, {0xae, 0x71, 0x2e, 0xf1, 0x10, 0x6, 0xd9, 0xf}}
   gUefiSerialPortInfoGuid  = { 0x6c6872fe, 0x56a9, 0x4403, { 0xbb, 0x98, 0x95, 0x8d, 0x62, 0xde, 0x87, 0xf1 } }
   gLoaderMemoryMapInfoGuid = { 0xa1ff7424, 0x7a1a, 0x478e, { 0xa9, 0xe4, 0x92, 0xf3, 0x57, 0xd1, 0x28, 0x32 } }
 
@@ -77,3 +76,28 @@ gUefiPayloadPkgTokenSpaceGuid.PcdMemoryTypeEfiRuntimeServicesCode|0x80|UINT32|0x
 gUefiPayloadPkgTokenSpaceGuid.PcdSystemMemoryUefiRegionSize|0x02000000|UINT32|0x00000017
 
 gUefiPayloadPkgTokenSpaceGuid.PcdPcdDriverFile|{ 0x57, 0x72, 0xcf, 0x80, 0xab, 0x87, 0xf9, 0x47, 0xa3, 0xfe, 0xD5, 0x0B, 0x76, 0xd8, 0x95, 0x41 }|VOID*|0x00000018
+
+[PcdsDynamic, PcdsDynamicEx]
+## Defines the 32-bit Timer register access address that resides within the ACPI BAR.
+# @Prompt ACPI PM1 timer register address
+gUefiPayloadPkgTokenSpaceGuid.PcdAcpiPm1TimerRegister           |0|UINT32|0x00000019
+
+## Defines the Reset register access address that resides within the ACPI BAR.
+# @Prompt ACPI reset register address
+gUefiPayloadPkgTokenSpaceGuid.PcdAcpiResetRegister              |0|UINT64|0x00000020
+
+## Defines the reset value writing to ACPI reset register.
+# @Prompt Reset value to ACPI reset register
+gUefiPayloadPkgTokenSpaceGuid.PcdAcpiResetValue                 |0|UINT8|0x00000021
+
+## Defines the system port address of the PM1a Control Register Block.
+# @Prompt PM1a control register address
+gUefiPayloadPkgTokenSpaceGuid.PcdAcpiPm1aControlAddress         |0|UINT32|0x00000022
+
+## Defines the system port address of the PM1a Event Register Block.
+# @Prompt PM1a event register register
+gUefiPayloadPkgTokenSpaceGuid.PcdAcpiPm1aEventAddress           |0|UINT32|0x00000023
+
+## Defines the General-Purpose Event 0 Enable Register
+# @Prompt ACPI GPE0 enable register
+gUefiPayloadPkgTokenSpaceGuid.PcdAcpiGpe0EnableAddress          |0|UINT32|0x00000024
diff --git a/UefiPayloadPkg/UefiPayloadPkg.dsc b/UefiPayloadPkg/UefiPayloadPkg.dsc
index 856d5ea786..a0b0cfe454 100644
--- a/UefiPayloadPkg/UefiPayloadPkg.dsc
+++ b/UefiPayloadPkg/UefiPayloadPkg.dsc
@@ -409,6 +409,13 @@
   gUefiCpuPkgTokenSpaceGuid.PcdSevEsIsEnabled|0
   gEfiMdeModulePkgTokenSpaceGuid.PcdPciDisableBusEnumeration|TRUE
 
+  gUefiPayloadPkgTokenSpaceGuid.PcdAcpiPm1TimerRegister|0
+  gUefiPayloadPkgTokenSpaceGuid.PcdAcpiResetRegister|0
+  gUefiPayloadPkgTokenSpaceGuid.PcdAcpiResetValue|0
+  gUefiPayloadPkgTokenSpaceGuid.PcdAcpiPm1aControlAddress|0
+  gUefiPayloadPkgTokenSpaceGuid.PcdAcpiPm1aEventAddress|0
+  gUefiPayloadPkgTokenSpaceGuid.PcdAcpiGpe0EnableAddress|0
+
 ################################################################################
 #
 # Components Section - list of all EDK II Modules needed by this Platform.
-- 
2.26.2.windows.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-09-13  3:01 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-09-13  3:01 [PATCH 1/2] UefiPayloadPkg: Remove ACPI board Hob thiyagux.kesavan.balakrishnan
2021-09-13  3:01 ` [PATCH 2/2] OvmfPkg: Transfer PlatformBootManager library to driver thiyagukb

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox