Detects the APIC mode by calling GetApicMode().
if current platform is in X2APIC mode sets the
global mX2ApicEnabled.

Also install the APIC NMI structure only if
platform is not in X2APIC mode.

Cc: Chasel Chiu <chasel.c...@intel.com>
Cc: Nate DeSimone <nathaniel.l.desim...@intel.com>
Cc: Liming Gao <gaolim...@byosoft.com.cn>
Cc: Eric Dong <eric.d...@intel.com>
Signed-off-by: Abdul Lateef Attar <abdat...@amd.com>
---
 Platform/Intel/MinPlatformPkg/Acpi/AcpiTables/AcpiPlatform.c | 35 
++++++++++++--------
 1 file changed, 21 insertions(+), 14 deletions(-)

diff --git a/Platform/Intel/MinPlatformPkg/Acpi/AcpiTables/AcpiPlatform.c 
b/Platform/Intel/MinPlatformPkg/Acpi/AcpiTables/AcpiPlatform.c
index f5c4f2c3f1a9..032903029a95 100644
--- a/Platform/Intel/MinPlatformPkg/Acpi/AcpiTables/AcpiPlatform.c
+++ b/Platform/Intel/MinPlatformPkg/Acpi/AcpiTables/AcpiPlatform.c
@@ -3,6 +3,7 @@
 

 Copyright (c) 2017 - 2021, Intel Corporation. All rights reserved.<BR>

 Copyright (c) Microsoft Corporation.<BR>

+Copyright (c) 2021, AMD Incorporated. All rights reserved.<BR>

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

 

 **/

@@ -947,21 +948,23 @@ InstallMadtFromScratch (
   //

   // Build Local APIC NMI Structures

   //

-  LocalApciNmiStruct.Type   = EFI_ACPI_6_3_LOCAL_APIC_NMI;

-  LocalApciNmiStruct.Length = sizeof (EFI_ACPI_6_3_LOCAL_APIC_NMI_STRUCTURE);

-  LocalApciNmiStruct.AcpiProcessorUid = 0xFF;      // Applies to all processors

-  LocalApciNmiStruct.Flags            = 0x0005;    // Flags - Edge-tiggered, 
Active High

-  LocalApciNmiStruct.LocalApicLint    = 0x1;

+  if (!mX2ApicEnabled) {

+    LocalApciNmiStruct.Type   = EFI_ACPI_6_3_LOCAL_APIC_NMI;

+    LocalApciNmiStruct.Length = sizeof (EFI_ACPI_6_3_LOCAL_APIC_NMI_STRUCTURE);

+    LocalApciNmiStruct.AcpiProcessorUid = 0xFF;      // Applies to all 
processors

+    LocalApciNmiStruct.Flags            = 0x0005;    // Flags - Edge-tiggered, 
Active High

+    LocalApciNmiStruct.LocalApicLint    = 0x1;

 

-  ASSERT (MadtStructsIndex < MaxMadtStructCount);

-  Status = CopyStructure (

-             &MadtTableHeader.Header,

-             (STRUCTURE_HEADER *) &LocalApciNmiStruct,

-             &MadtStructs[MadtStructsIndex++]

-             );

-  if (EFI_ERROR (Status)) {

-    DEBUG ((DEBUG_ERROR, "CopyMadtStructure (APIC NMI) failed: %r\n", Status));

-    goto Done;

+    ASSERT (MadtStructsIndex < MaxMadtStructCount);

+    Status = CopyStructure (

+              &MadtTableHeader.Header,

+              (STRUCTURE_HEADER *) &LocalApciNmiStruct,

+              &MadtStructs[MadtStructsIndex++]

+              );

+    if (EFI_ERROR (Status)) {

+      DEBUG ((DEBUG_ERROR, "CopyMadtStructure (APIC NMI) failed: %r\n", 
Status));

+      goto Done;

+    }

   }

 

   //

@@ -1454,6 +1457,10 @@ InstallAcpiPlatform (
   DEBUG ((DEBUG_INFO, "mNumberOfCpus - %d\n", mNumberOfCpus));

   DEBUG ((DEBUG_INFO, "mNumberOfEnabledCPUs - %d\n", mNumberOfEnabledCPUs));

 

+  if (LOCAL_APIC_MODE_X2APIC == GetApicMode ()) {

+    mX2ApicEnabled = TRUE;

+  }

+

   DEBUG ((DEBUG_INFO, "mX2ApicEnabled - 0x%x\n", mX2ApicEnabled));

   DEBUG ((DEBUG_INFO, "mForceX2ApicId - 0x%x\n", mForceX2ApicId));

 

-- 
2.25.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#82525): https://edk2.groups.io/g/devel/message/82525
Mute This Topic: https://groups.io/mt/86515674/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-


Reply via email to