public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "duke.zhai via groups.io" <duke.zhai=amd.com@groups.io>
To: <devel@edk2.groups.io>
Cc: Ken Yao <ken.yao@amd.com>, Duke Zhai <duke.zhai@amd.com>,
	Igniculus Fu <igniculus.fu@amd.com>,
	Abner Chang <abner.chang@amd.com>
Subject: [edk2-devel] [PATCH 23/33] AMD/VanGoghBoard: Check in AcpiPlatform.
Date: Thu, 18 Jan 2024 14:50:36 +0800	[thread overview]
Message-ID: <20240118065046.961-24-duke.zhai@amd.com> (raw)
In-Reply-To: <20240118065046.961-1-duke.zhai@amd.com>

From: Duke Zhai <Duke.Zhai@amd.com>


BZ #:4640

Initial Acpi platform dxe drivers. Use firmware volume protocol

to update global NVS area for ASL and SMM init code.



Signed-off-by: Eric Xing <eric.xing@amd.com>

Cc: Ken Yao <ken.yao@amd.com>

Cc: Duke Zhai <duke.zhai@amd.com>

Cc: Igniculus Fu <igniculus.fu@amd.com>

Cc: Abner Chang <abner.chang@amd.com>

---

 .../Universal/AcpiPlatformDxe/AcpiPlatform.c  | 343 ++++++++++++++++++

 .../AcpiPlatformDxe/AcpiPlatform.uni          |  24 ++

 .../AcpiPlatformDxe/AcpiPlatformDxe.inf       |  65 ++++

 .../AcpiPlatformDxe/AcpiPlatformExtra.uni     |  22 ++

 .../AcpiPlatformDxe/AcpiPlatformHooks.c       | 159 ++++++++

 .../AcpiPlatformDxe/AcpiPlatformHooks.h       |  55 +++

 6 files changed, 668 insertions(+)

 create mode 100644 Platform/AMD/VanGoghBoard/Universal/AcpiPlatformDxe/AcpiPlatform.c

 create mode 100644 Platform/AMD/VanGoghBoard/Universal/AcpiPlatformDxe/AcpiPlatform.uni

 create mode 100644 Platform/AMD/VanGoghBoard/Universal/AcpiPlatformDxe/AcpiPlatformDxe.inf

 create mode 100644 Platform/AMD/VanGoghBoard/Universal/AcpiPlatformDxe/AcpiPlatformExtra.uni

 create mode 100644 Platform/AMD/VanGoghBoard/Universal/AcpiPlatformDxe/AcpiPlatformHooks.c

 create mode 100644 Platform/AMD/VanGoghBoard/Universal/AcpiPlatformDxe/AcpiPlatformHooks.h



diff --git a/Platform/AMD/VanGoghBoard/Universal/AcpiPlatformDxe/AcpiPlatform.c b/Platform/AMD/VanGoghBoard/Universal/AcpiPlatformDxe/AcpiPlatform.c

new file mode 100644

index 0000000000..4ac29ca17e

--- /dev/null

+++ b/Platform/AMD/VanGoghBoard/Universal/AcpiPlatformDxe/AcpiPlatform.c

@@ -0,0 +1,343 @@

+/** @file

+  Implements AcpiPlatform in Board Package

+

+  Copyright (C) 2024 Advanced Micro Devices, Inc. All rights reserved.<BR>

+  SPDX-License-Identifier: BSD-2-Clause-Patent

+**/

+/* This file includes code originally published under the following license. */

+

+/** @file

+  Sample ACPI Platform Driver

+

+  Copyright (c) 2008 - 2018, Intel Corporation. All rights reserved.<BR>

+  SPDX-License-Identifier: BSD-2-Clause-Patent

+

+**/

+

+#include <PiDxe.h>

+

+#include <Protocol/AcpiTable.h>

+#include <Protocol/FirmwareVolume2.h>

+

+#include <Library/BaseLib.h>

+#include <Library/UefiBootServicesTableLib.h>

+#include <Library/DebugLib.h>

+#include <Library/PcdLib.h>

+

+#include <IndustryStandard/Acpi.h>

+

+#include "AcpiPlatformHooks.h"

+#include <Protocol/GlobalNvsArea.h>

+

+EFI_GLOBAL_NVS_AREA_PROTOCOL  mGlobalNvsArea;

+

+/**

+  Locate the first instance of a protocol.  If the protocol requested is an

+  FV protocol, then it will return the first FV that contains the ACPI table

+  storage file.

+

+  @param  Instance      Return pointer to the first instance of the protocol

+

+  @return EFI_SUCCESS           The function completed successfully.

+  @return EFI_NOT_FOUND         The protocol could not be located.

+  @return EFI_OUT_OF_RESOURCES  There are not enough resources to find the protocol.

+

+**/

+EFI_STATUS

+LocateFvInstanceWithTables (

+  OUT EFI_FIRMWARE_VOLUME2_PROTOCOL  **Instance

+  )

+{

+  EFI_STATUS                     Status;

+  EFI_HANDLE                     *HandleBuffer;

+  UINTN                          NumberOfHandles;

+  EFI_FV_FILETYPE                FileType;

+  UINT32                         FvStatus;

+  EFI_FV_FILE_ATTRIBUTES         Attributes;

+  UINTN                          Size;

+  UINTN                          Index;

+  EFI_FIRMWARE_VOLUME2_PROTOCOL  *FvInstance;

+

+  FvStatus = 0;

+

+  //

+  // Locate protocol.

+  //

+  Status = gBS->LocateHandleBuffer (

+                  ByProtocol,

+                  &gEfiFirmwareVolume2ProtocolGuid,

+                  NULL,

+                  &NumberOfHandles,

+                  &HandleBuffer

+                  );

+  if (EFI_ERROR (Status)) {

+    //

+    // Defined errors at this time are not found and out of resources.

+    //

+    return Status;

+  }

+

+  //

+  // Looking for FV with ACPI storage file

+  //

+

+  for (Index = 0; Index < NumberOfHandles; Index++) {

+    //

+    // Get the protocol on this handle

+    // This should not fail because of LocateHandleBuffer

+    //

+    Status = gBS->HandleProtocol (

+                    HandleBuffer[Index],

+                    &gEfiFirmwareVolume2ProtocolGuid,

+                    (VOID **)&FvInstance

+                    );

+    ASSERT_EFI_ERROR (Status);

+

+    //

+    // See if it has the ACPI storage file

+    //

+    Status = FvInstance->ReadFile (

+                           FvInstance,

+                           (EFI_GUID *)PcdGetPtr (PcdAcpiTableStorageFile),

+                           NULL,

+                           &Size,

+                           &FileType,

+                           &Attributes,

+                           &FvStatus

+                           );

+

+    //

+    // If we found it, then we are done

+    //

+    if (Status == EFI_SUCCESS) {

+      *Instance = FvInstance;

+      break;

+    }

+  }

+

+  //

+  // Our exit status is determined by the success of the previous operations

+  // If the protocol was found, Instance already points to it.

+  //

+

+  //

+  // Free any allocated buffers

+  //

+  gBS->FreePool (HandleBuffer);

+

+  return Status;

+}

+

+/**

+  This function calculates and updates an UINT8 checksum.

+

+  @param  Buffer          Pointer to buffer to checksum

+  @param  Size            Number of bytes to checksum

+

+**/

+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);

+}

+

+/**

+  This function will update any runtime platform specific information.

+  This currently includes:

+    Setting OEM table values, ID, table ID, creator ID and creator revision.

+    Enabling the proper processor entries in the APIC tables.

+

+  @param[in]  Table       The table to update.

+

+  @retval  EFI_SUCCESS    The function completed successfully.

+

+**/

+EFI_STATUS

+PlatformUpdateTables (

+  IN OUT EFI_ACPI_COMMON_HEADER  *Table

+  )

+{

+  switch (Table->Signature) {

+    case EFI_ACPI_5_0_DIFFERENTIATED_SYSTEM_DESCRIPTION_TABLE_SIGNATURE:

+      //

+      // Patch the memory resource.

+      //

+      PatchDsdtTable ((EFI_ACPI_DESCRIPTION_HEADER *)Table);

+      break;

+

+    case EFI_ACPI_5_0_MULTIPLE_APIC_DESCRIPTION_TABLE_SIGNATURE:

+      PatchMadtTable ((EFI_ACPI_DESCRIPTION_HEADER *)Table);

+      break;

+

+    default:

+      break;

+  }

+

+  return EFI_SUCCESS;

+}

+

+/**

+  Entrypoint of Acpi Platform driver.

+

+  @param  ImageHandle

+  @param  SystemTable

+

+  @return EFI_SUCCESS

+  @return EFI_LOAD_ERROR

+  @return EFI_OUT_OF_RESOURCES

+

+**/

+EFI_STATUS

+EFIAPI

+AcpiPlatformEntryPoint (

+  IN EFI_HANDLE        ImageHandle,

+  IN EFI_SYSTEM_TABLE  *SystemTable

+  )

+{

+  EFI_STATUS                     Status;

+  EFI_STATUS                     AcpiStatus;

+  EFI_ACPI_TABLE_PROTOCOL        *AcpiTable;

+  EFI_FIRMWARE_VOLUME2_PROTOCOL  *FwVol;

+  INTN                           Instance;

+  EFI_ACPI_COMMON_HEADER         *CurrentTable;

+  UINTN                          TableHandle;

+  UINT32                         FvStatus;

+  UINTN                          TableSize;

+  UINTN                          Size;

+  EFI_HANDLE                     Handle;

+

+  Instance     = 0;

+  CurrentTable = NULL;

+  TableHandle  = 0;

+

+  //

+  // Find the AcpiTable protocol

+  //

+  Status = gBS->LocateProtocol (&gEfiAcpiTableProtocolGuid, NULL, (VOID **)&AcpiTable);

+  if (EFI_ERROR (Status)) {

+    return EFI_ABORTED;

+  }

+

+  //

+  // Allocate and initialize the NVS area for SMM and ASL communication.

+  //

+  Status = gBS->AllocatePool (

+                  EfiACPIMemoryNVS,

+                  sizeof (EFI_GLOBAL_NVS_AREA),

+                  (void **)&mGlobalNvsArea.Area

+                  );

+  ASSERT_EFI_ERROR (Status);

+  gBS->SetMem (

+         mGlobalNvsArea.Area,

+         sizeof (EFI_GLOBAL_NVS_AREA),

+         0

+         );

+  DEBUG ((DEBUG_INFO, "mGlobalNvsArea.Area is at 0x%X\n", mGlobalNvsArea.Area));

+

+  //

+  // Update global NVS area for ASL and SMM init code to use.

+  //

+  mGlobalNvsArea.Area->PcieBaseAddress = (UINT32)PcdGet64 (PcdPciExpressBaseAddress);

+  mGlobalNvsArea.Area->PcieBaseLimit   = (UINT32)(PcdGet64 (PcdPciExpressBaseAddress) + (PcdGet32 (PcdPciExpressSize) - 1));

+

+  if (FeaturePcdGet (PcdNbIoApicSupport)) {

+    mGlobalNvsArea.Area->NbIoApic = TRUE;

+  } else {

+    mGlobalNvsArea.Area->NbIoApic = FALSE;

+  }

+

+  mGlobalNvsArea.Area->TopOfMem = (UINT32)AsmReadMsr64 (0xC001001A);

+

+  Handle = NULL;

+  Status = gBS->InstallMultipleProtocolInterfaces (

+                  &Handle,

+                  &gEfiGlobalNvsAreaProtocolGuid,

+                  &mGlobalNvsArea,

+                  NULL

+                  );

+

+  //

+  // Locate the firmware volume protocol

+  //

+  Status = LocateFvInstanceWithTables (&FwVol);

+  if (EFI_ERROR (Status)) {

+    return EFI_ABORTED;

+  }

+

+  //

+  // Read tables from the storage file.

+  //

+  while (Status == EFI_SUCCESS) {

+    Status = FwVol->ReadSection (

+                      FwVol,

+                      (EFI_GUID *)PcdGetPtr (PcdAcpiTableStorageFile),

+                      EFI_SECTION_RAW,

+                      Instance,

+                      (VOID **)&CurrentTable,

+                      &Size,

+                      &FvStatus

+                      );

+    if (!EFI_ERROR (Status)) {

+      AcpiStatus = PlatformUpdateTables (CurrentTable);

+      if (!EFI_ERROR (AcpiStatus)) {

+        //

+        // Add the table

+        //

+        TableHandle = 0;

+

+        TableSize = ((EFI_ACPI_DESCRIPTION_HEADER *)CurrentTable)->Length;

+        ASSERT (Size >= TableSize);

+

+        //

+        // Checksum ACPI table

+        //

+        AcpiPlatformChecksum ((UINT8 *)CurrentTable, TableSize);

+

+        //

+        // Install ACPI table

+        //

+        Status = AcpiTable->InstallAcpiTable (

+                              AcpiTable,

+                              CurrentTable,

+                              TableSize,

+                              &TableHandle

+                              );

+      }

+

+      //

+      // Free memory allocated by ReadSection

+      //

+      gBS->FreePool (CurrentTable);

+

+      if (EFI_ERROR (Status)) {

+        return EFI_ABORTED;

+      }

+

+      //

+      // Increment the instance

+      //

+      Instance++;

+      CurrentTable = NULL;

+    }

+  }

+

+  //

+  // The driver does not require to be kept loaded.

+  //

+  return EFI_SUCCESS;

+}

diff --git a/Platform/AMD/VanGoghBoard/Universal/AcpiPlatformDxe/AcpiPlatform.uni b/Platform/AMD/VanGoghBoard/Universal/AcpiPlatformDxe/AcpiPlatform.uni

new file mode 100644

index 0000000000..f79d718588

--- /dev/null

+++ b/Platform/AMD/VanGoghBoard/Universal/AcpiPlatformDxe/AcpiPlatform.uni

@@ -0,0 +1,24 @@

+// /** @file

+// Acpi Platform uni file

+//

+// Copyright (C) 2024 Advanced Micro Devices, Inc. All rights reserved.<BR>

+//

+// SPDX-License-Identifier: BSD-2-Clause-Patent

+//

+// **/

+// This file includes code originally published under the following license.

+// */

+// /** @file

+// Sample ACPI Platform Driver

+//

+// Sample ACPI Platform Driver

+//

+// Copyright (c) 2008 - 2018, Intel Corporation. All rights reserved.<BR>

+//

+// SPDX-License-Identifier: BSD-2-Clause-Patent

+//

+// **/

+

+#string STR_MODULE_ABSTRACT             #language en-US "Sample ACPI Platform Driver"

+

+#string STR_MODULE_DESCRIPTION          #language en-US "Sample ACPI Platform Driver"

diff --git a/Platform/AMD/VanGoghBoard/Universal/AcpiPlatformDxe/AcpiPlatformDxe.inf b/Platform/AMD/VanGoghBoard/Universal/AcpiPlatformDxe/AcpiPlatformDxe.inf

new file mode 100644

index 0000000000..b197e2c6e7

--- /dev/null

+++ b/Platform/AMD/VanGoghBoard/Universal/AcpiPlatformDxe/AcpiPlatformDxe.inf

@@ -0,0 +1,65 @@

+## @file

+# Acpi Platform Dxe driver

+#

+# Copyright (C) 2024 Advanced Micro Devices, Inc. All rights reserved.<BR>

+# SPDX-License-Identifier: BSD-2-Clause-Patent

+##

+# This file includes code originally published under the following license.

+## @file

+#  Sample ACPI Platform Driver

+#

+#  Copyright (c) 2008 - 2018, Intel Corporation. All rights reserved.<BR>

+#  SPDX-License-Identifier: BSD-2-Clause-Patent

+#

+##

+

+[Defines]

+  INF_VERSION                    = 0x00010005

+  BASE_NAME                      = AcpiPlatform

+  MODULE_UNI_FILE                = AcpiPlatform.uni

+  FILE_GUID                      = 6A462E1D-7B1A-95BE-DCF1-241320F01646

+  MODULE_TYPE                    = DXE_DRIVER

+  VERSION_STRING                 = 1.0

+  ENTRY_POINT                    = AcpiPlatformEntryPoint

+

+#

+# The following information is for reference only and not required by the build tools.

+#

+#  VALID_ARCHITECTURES           = IA32 X64 EBC

+#

+

+[Sources]

+  AcpiPlatform.c

+  AcpiPlatformHooks.c

+

+[Packages]

+  MdePkg/MdePkg.dec

+  MdeModulePkg/MdeModulePkg.dec

+  VanGoghCommonPkg/AmdCommonPkg.dec

+  ChachaniBoardPkg/Project.dec

+

+[LibraryClasses]

+  UefiLib

+  DxeServicesLib

+  PcdLib

+  BaseMemoryLib

+  DebugLib

+  UefiBootServicesTableLib

+  UefiDriverEntryPoint

+

+[Protocols]

+  gEfiAcpiTableProtocolGuid                     ## CONSUMES

+  gEfiGlobalNvsAreaProtocolGuid

+  gEfiMpServiceProtocolGuid

+

+[Pcd]

+  gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiTableStorageFile    ## CONSUMES

+  gPlatformPkgTokenSpaceGuid.PcdNbIoApicSupport

+  gEfiMdePkgTokenSpaceGuid.PcdPciExpressBaseAddress

+  gPlatformPkgTokenSpaceGuid.PcdPciExpressSize

+

+[Depex]

+  gEfiAcpiTableProtocolGuid

+

+[UserExtensions.TianoCore."ExtraFiles"]

+  AcpiPlatformExtra.uni

diff --git a/Platform/AMD/VanGoghBoard/Universal/AcpiPlatformDxe/AcpiPlatformExtra.uni b/Platform/AMD/VanGoghBoard/Universal/AcpiPlatformDxe/AcpiPlatformExtra.uni

new file mode 100644

index 0000000000..b0d84752d6

--- /dev/null

+++ b/Platform/AMD/VanGoghBoard/Universal/AcpiPlatformDxe/AcpiPlatformExtra.uni

@@ -0,0 +1,22 @@

+// /** @file

+// Acpi Platform extra uni file

+//

+// Copyright (C) 2024 Advanced Micro Devices, Inc. All rights reserved.<BR>

+//

+// SPDX-License-Identifier: BSD-2-Clause-Patent

+//

+// **/

+// This file includes code originally published under the following license.

+// */

+// /** @file

+// AcpiPlatform Localized Strings and Content

+//

+// Copyright (c) 2013 - 2018, Intel Corporation. All rights reserved.<BR>

+//

+// SPDX-License-Identifier: BSD-2-Clause-Patent

+//

+// **/

+

+#string STR_PROPERTIES_MODULE_NAME

+#language en-US

+"ACPI Platform Sample DXE Driver"

diff --git a/Platform/AMD/VanGoghBoard/Universal/AcpiPlatformDxe/AcpiPlatformHooks.c b/Platform/AMD/VanGoghBoard/Universal/AcpiPlatformDxe/AcpiPlatformHooks.c

new file mode 100644

index 0000000000..9ac9c15e18

--- /dev/null

+++ b/Platform/AMD/VanGoghBoard/Universal/AcpiPlatformDxe/AcpiPlatformHooks.c

@@ -0,0 +1,159 @@

+/** @file

+  Implements AcpiPlatform Hooks in Board Package

+

+  Copyright (C) 2024 Advanced Micro Devices, Inc. All rights reserved.<BR>

+  SPDX-License-Identifier: BSD-2-Clause-Patent

+**/

+/* This file includes code originally published under the following license. */

+

+/** @file

+  Sample ACPI Platform Driver

+

+  Copyright (c) 2008 - 2018, Intel Corporation. All rights reserved.<BR>

+  SPDX-License-Identifier: BSD-2-Clause-Patent

+

+**/

+

+//

+// Statements that include other files.

+//

+#include "AcpiPlatformHooks.h"

+#include <Protocol/GlobalNvsArea.h>

+

+extern EFI_GLOBAL_NVS_AREA_PROTOCOL  mGlobalNvsArea;

+

+/**

+    Update the DSDT table.

+

+    @param   TableHeader   The table to be set.

+

+    @retval  EFI_SUCCESS   Update DSDT table sucessfully.

+

+**/

+EFI_STATUS

+PatchDsdtTable (

+  IN OUT   EFI_ACPI_DESCRIPTION_HEADER  *TableHeader

+  )

+{

+  UINT8   *CurrPtr;

+  UINT8   *DsdtPointer;

+  UINT32  *Signature;

+  UINT8   *Operation;

+  UINT32  *Address;

+  UINT16  *Size;

+

+  //

+  // Loop through the ASL looking for values that we must fix up.

+  //

+  CurrPtr = (UINT8 *)TableHeader;

+  for (DsdtPointer = CurrPtr; DsdtPointer <= (CurrPtr + ((EFI_ACPI_COMMON_HEADER *)CurrPtr)->Length); DsdtPointer++) {

+    Signature = (UINT32 *)DsdtPointer;

+

+    switch (*Signature) {

+      //

+      // GNVS operation region.

+      //

+      case (SIGNATURE_32 ('G', 'N', 'V', 'S')):

+        //

+        // Conditional match.  For Region Objects, the Operator will always be the

+        // byte immediately before the specific name.  Therefore, subtract 1 to check

+        // the Operator.

+        //

+        Operation = DsdtPointer - 1;

+        if (*Operation == AML_OPREGION_OP) {

+          Address  = (UINT32 *)(DsdtPointer + 6);

+          *Address = (UINT32)(UINTN)mGlobalNvsArea.Area;

+          Size     = (UINT16 *)(DsdtPointer + 11);

+          *Size    = sizeof (EFI_GLOBAL_NVS_AREA);

+        }

+

+        break;

+      default:

+        break;

+    }

+  }

+

+  return EFI_SUCCESS;

+}

+

+/**

+    Update the MADT table.

+

+    @param  TableHeader   The table to be set.

+

+    @retval  EFI_SUCCESS  Update MADT table sucessfully.

+

+**/

+EFI_STATUS

+PatchMadtTable (

+  IN OUT   EFI_ACPI_DESCRIPTION_HEADER  *TableHeader

+  )

+{

+  EFI_STATUS                                   Status;

+  EFI_MP_SERVICES_PROTOCOL                     *MpService;

+  UINTN                                        NumCPUs = 1;

+  UINTN                                        NumEnabledCPUs;

+  UINT8                                        CurrProcessor = 0;

+  EFI_PROCESSOR_INFORMATION                    ProcessorInfo;

+  UINT8                                        *CurrPtr;

+  EFI_ACPI_5_0_PROCESSOR_LOCAL_APIC_STRUCTURE  *ApicPtr   = NULL;

+  EFI_ACPI_5_0_IO_APIC_STRUCTURE               *IoApicPtr = NULL;

+

+  // Find the MP Protocol.

+  Status = gBS->LocateProtocol (

+                  &gEfiMpServiceProtocolGuid,

+                  NULL,

+                  (VOID **)&MpService

+                  );

+  if (EFI_ERROR (Status)) {

+    return Status;

+  }

+

+  // Determine the number of processors

+  MpService->GetNumberOfProcessors (

+               MpService,

+               &NumCPUs,

+               &NumEnabledCPUs

+               );

+

+  CurrPtr  = (UINT8 *)TableHeader;

+  CurrPtr += sizeof (EFI_ACPI_5_0_MULTIPLE_APIC_DESCRIPTION_TABLE_HEADER);

+  while (CurrPtr < ((UINT8 *)TableHeader + ((EFI_ACPI_COMMON_HEADER *)TableHeader)->Length)) {

+    // Local APIC

+    ApicPtr = (EFI_ACPI_5_0_PROCESSOR_LOCAL_APIC_STRUCTURE *)CurrPtr;

+    if (ApicPtr->Type == EFI_ACPI_5_0_PROCESSOR_LOCAL_APIC) {

+      // Disable at first

+      ApicPtr->Flags  = 0;

+      ApicPtr->ApicId = 0;

+

+      // retrieve processor information

+      Status = MpService->GetProcessorInfo (

+                            MpService,

+                            CurrProcessor,

+                            &ProcessorInfo

+                            );

+      if (!EFI_ERROR (Status)) {

+        if (ProcessorInfo.StatusFlag & PROCESSOR_ENABLED_BIT) {

+          ApicPtr->Flags = EFI_ACPI_5_0_LOCAL_APIC_ENABLED;

+        }

+

+        ApicPtr->ApicId = (UINT8)(ProcessorInfo.ProcessorId);

+      }

+

+      // Increment the procesor count

+      CurrProcessor++;

+    }

+

+    // IO APIC (IOHUB and FCH)

+    IoApicPtr = (EFI_ACPI_5_0_IO_APIC_STRUCTURE *)CurrPtr;

+    if (IoApicPtr->Type == EFI_ACPI_5_0_IO_APIC) {

+      // IoApicPtr->IoApicId = PcdGet8 (PcdCfgFchIoapicId);

+      // IoApicPtr->IoApicId = PcdGet8 (PcdCfgGnbIoapicId);

+    }

+

+    // Go to the next structure in the APIC table

+    CurrPtr += (ApicPtr->Length);

+  }

+

+  return EFI_SUCCESS;

+}

diff --git a/Platform/AMD/VanGoghBoard/Universal/AcpiPlatformDxe/AcpiPlatformHooks.h b/Platform/AMD/VanGoghBoard/Universal/AcpiPlatformDxe/AcpiPlatformHooks.h

new file mode 100644

index 0000000000..5d1b7ac38c

--- /dev/null

+++ b/Platform/AMD/VanGoghBoard/Universal/AcpiPlatformDxe/AcpiPlatformHooks.h

@@ -0,0 +1,55 @@

+/** @file

+  Implements AcpiPlatform Hooks head file in Board Package

+

+  Copyright (C) 2024 Advanced Micro Devices, Inc. All rights reserved.<BR>

+  SPDX-License-Identifier: BSD-2-Clause-Patent

+**/

+/* This file includes code originally published under the following license. */

+

+/** @file

+  Sample ACPI Platform Driver

+

+  Copyright (c) 2008 - 2018, Intel Corporation. All rights reserved.<BR>

+  SPDX-License-Identifier: BSD-2-Clause-Patent

+

+**/

+

+#ifndef _ACPI_PLATFORM_HOOKS_H_

+#define _ACPI_PLATFORM_HOOKS_H_

+

+//

+// Statements that include other header files

+//

+#include <IndustryStandard/Acpi.h>

+#include <Protocol/MpService.h>

+#include <Library/UefiBootServicesTableLib.h>

+

+#define AML_OPREGION_OP  0x80

+

+/**

+    Update the DSDT table.

+

+    @param  TableHeader   The table to be set.

+

+    @retval  EFI_SUCCESS  Update DSDT table sucessfully.

+

+**/

+EFI_STATUS

+PatchDsdtTable (

+  IN OUT   EFI_ACPI_DESCRIPTION_HEADER  *TableHeader

+  );

+

+/**

+    Update the MADT table.

+

+    @param  TableHeader   The table to be set.

+

+    @retval  EFI_SUCCESS  Update MADT table successfully.

+

+**/

+EFI_STATUS

+PatchMadtTable (

+  IN OUT   EFI_ACPI_DESCRIPTION_HEADER  *TableHeader

+  );

+

+#endif

--

2.31.1





-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#114069): https://edk2.groups.io/g/devel/message/114069
Mute This Topic: https://groups.io/mt/103831192/7686176
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io]
-=-=-=-=-=-=-=-=-=-=-=-



  parent reply	other threads:[~2024-01-19 14:57 UTC|newest]

Thread overview: 49+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-18  6:50 [edk2-devel] [PATCH 00/33] Introduce AMD Vangogh platform reference code duke.zhai via groups.io
2024-01-18  6:50 ` [edk2-devel] [PATCH 01/33] AMD/AmdPlatformPkg: Check in AMD S3 logo duke.zhai via groups.io
2024-01-18  6:50 ` [edk2-devel] [PATCH 02/33] AMD/VanGoghBoard: Check in ACPI tables duke.zhai via groups.io
2024-01-18  6:50 ` [edk2-devel] [PATCH 03/33] AMD/VanGoghBoard: Check in Capsule update duke.zhai via groups.io
2024-01-23  4:42   ` Chang, Abner via groups.io
2024-01-25  8:25     ` Zhai, MingXin (Duke) via groups.io
2024-01-25 11:45       ` Chang, Abner via groups.io
2024-01-18  6:50 ` [edk2-devel] [PATCH 04/33] AMD/VanGoghBoard: Check in AgesaPublic pkg duke.zhai via groups.io
2024-01-23  4:44   ` Chang, Abner via groups.io
2024-01-25  8:17     ` Xing, Eric via groups.io
2024-01-18  6:50 ` [edk2-devel] [PATCH 05/33] AMD/VanGoghBoard: Check in PlatformSecLib duke.zhai via groups.io
2024-01-23  4:46   ` Chang, Abner via groups.io
2024-01-18  6:50 ` [edk2-devel] [PATCH 06/33] AMD/VanGoghBoard: Check in AmdIdsExtLib duke.zhai via groups.io
2024-01-18  6:50 ` [edk2-devel] [PATCH 07/33] AMD/VanGoghBoard: Check in PciPlatform duke.zhai via groups.io
2024-01-23  4:50   ` Chang, Abner via groups.io
2024-01-18  6:50 ` [edk2-devel] [PATCH 08/33] AMD/VanGoghBoard: Check in UDKFlashUpdate duke.zhai via groups.io
2024-01-18  6:50 ` [edk2-devel] [PATCH 09/33] AMD/VanGoghBoard: Check in Flash_AB duke.zhai via groups.io
2024-01-18  6:50 ` [edk2-devel] [PATCH 10/33] AMD/VanGoghBoard: Check in FlashUpdate duke.zhai via groups.io
2024-01-18  6:50 ` [edk2-devel] [PATCH 11/33] AMD/VanGoghBoard: Check in FvbServices duke.zhai via groups.io
2024-01-18  6:50 ` [edk2-devel] [PATCH 12/33] AMD/VanGoghBoard: Check in AMD BaseSerialPortLib duke.zhai via groups.io
2024-01-18  6:50 ` [edk2-devel] [PATCH 13/33] AMD/VanGoghBoard: Check in PlatformFlashAccessLib duke.zhai via groups.io
2024-01-18  6:50 ` [edk2-devel] [PATCH 14/33] AMD/VanGoghBoard: Check in SmbiosLib duke.zhai via groups.io
2024-01-18  6:50 ` [edk2-devel] [PATCH 15/33] AMD/VanGoghBoard: Check in SpiFlashDeviceLib duke.zhai via groups.io
2024-01-18  6:50 ` [edk2-devel] [PATCH 16/33] AMD/VanGoghBoard: Check in BaseTscTimerLib duke.zhai via groups.io
2024-01-18  6:50 ` [edk2-devel] [PATCH 17/33] AMD/VanGoghBoard: Check in Smm access module duke.zhai via groups.io
2024-01-18  6:50 ` [edk2-devel] [PATCH 18/33] AMD/VanGoghBoard: Check in PciHostBridge module duke.zhai via groups.io
2024-01-18  6:50 ` [edk2-devel] [PATCH 19/33] AMD/VanGoghBoard: Check in PcatRealTimeClockRuntimeDxe module duke.zhai via groups.io
2024-01-18  6:50 ` [edk2-devel] [PATCH 20/33] AMD/VanGoghBoard: Check in FTPM module duke.zhai via groups.io
2024-01-18  6:50 ` [edk2-devel] [PATCH 21/33] AMD/VanGoghBoard: Check in SignedCapsule duke.zhai via groups.io
2024-01-18  6:50 ` [edk2-devel] [PATCH 22/33] AMD/VanGoghBoard: Check in Vtf0 duke.zhai via groups.io
2024-01-18  6:50 ` duke.zhai via groups.io [this message]
2024-01-18  6:50 ` [edk2-devel] [PATCH 24/33] AMD/VanGoghBoard: Check in FchSpi module duke.zhai via groups.io
2024-01-18  6:50 ` [edk2-devel] [PATCH 25/33] AMD/VanGoghBoard: Check in PlatformInitPei module duke.zhai via groups.io
2024-01-23  6:35   ` Chang, Abner via groups.io
2024-01-18  6:50 ` [edk2-devel] [PATCH 26/33] AMD/VanGoghBoard: Check in Smbios platform dxe drivers duke.zhai via groups.io
2024-01-18  6:50 ` [edk2-devel] [PATCH 27/33] AMD/VanGoghBoard: Check in Fsp2WrapperPkg duke.zhai via groups.io
2024-01-18  6:50 ` [edk2-devel] [PATCH 28/33] AMD/VanGoghBoard: Check in SmmCpuFeaturesLibCommon module duke.zhai via groups.io
2024-01-23  5:14   ` Chang, Abner via groups.io
2024-01-23 10:20     ` Xing, Eric via groups.io
2024-01-23 10:44       ` Chang, Abner via groups.io
2024-01-18  6:50 ` [edk2-devel] [PATCH 29/33] AMD/VanGoghBoard: Check in SmramSaveState module duke.zhai via groups.io
2024-01-20 14:37   ` Abdul Lateef Attar via groups.io
2024-01-23  5:15     ` Chang, Abner via groups.io
2024-01-23 10:27       ` Xing, Eric via groups.io
2024-01-23 10:44         ` Chang, Abner via groups.io
2024-01-18  6:50 ` [edk2-devel] [PATCH 30/33] AMD/VanGoghBoard: Check in EDK2 override files duke.zhai via groups.io
2024-01-18  6:50 ` [edk2-devel] [PATCH 31/33] AMD/VanGoghBoard: Check in AMD SmmControlPei module duke.zhai via groups.io
2024-01-18  6:50 ` [edk2-devel] [PATCH 32/33] AMD/VanGoghBoard: Check in Chachani board project files and build script duke.zhai via groups.io
2024-01-18  6:50 ` [edk2-devel] [PATCH 33/33] AMD/VanGoghBoard: Improvement coding style duke.zhai via groups.io

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=20240118065046.961-24-duke.zhai@amd.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