summaryrefslogtreecommitdiff
path: root/Platform/Intel/MinPlatformPkg/Acpi/AcpiTables
diff options
context:
space:
mode:
Diffstat (limited to 'Platform/Intel/MinPlatformPkg/Acpi/AcpiTables')
-rw-r--r--Platform/Intel/MinPlatformPkg/Acpi/AcpiTables/AcpiPlatform.c1718
-rw-r--r--Platform/Intel/MinPlatformPkg/Acpi/AcpiTables/AcpiPlatform.h87
-rw-r--r--Platform/Intel/MinPlatformPkg/Acpi/AcpiTables/AcpiPlatform.inf46
-rw-r--r--Platform/Intel/MinPlatformPkg/Acpi/AcpiTables/Facs/Facs.c20
-rw-r--r--Platform/Intel/MinPlatformPkg/Acpi/AcpiTables/Facs/Facs.h42
-rw-r--r--Platform/Intel/MinPlatformPkg/Acpi/AcpiTables/Fadt/Fadt.c151
-rw-r--r--Platform/Intel/MinPlatformPkg/Acpi/AcpiTables/Fadt/Fadt.h189
-rw-r--r--Platform/Intel/MinPlatformPkg/Acpi/AcpiTables/Hpet/Hpet.c25
-rw-r--r--Platform/Intel/MinPlatformPkg/Acpi/AcpiTables/Hpet/Hpet.h51
-rw-r--r--Platform/Intel/MinPlatformPkg/Acpi/AcpiTables/Madt/Madt.c389
-rw-r--r--Platform/Intel/MinPlatformPkg/Acpi/AcpiTables/Madt/Madt.h144
-rw-r--r--Platform/Intel/MinPlatformPkg/Acpi/AcpiTables/Mcfg/Mcfg.c78
-rw-r--r--Platform/Intel/MinPlatformPkg/Acpi/AcpiTables/Mcfg/Mcfg.h62
-rw-r--r--Platform/Intel/MinPlatformPkg/Acpi/AcpiTables/Wsmt/Wsmt.c10
-rw-r--r--Platform/Intel/MinPlatformPkg/Acpi/AcpiTables/Wsmt/Wsmt.h30
15 files changed, 1500 insertions, 1542 deletions
diff --git a/Platform/Intel/MinPlatformPkg/Acpi/AcpiTables/AcpiPlatform.c b/Platform/Intel/MinPlatformPkg/Acpi/AcpiTables/AcpiPlatform.c
index f6c30ec321..c71bf1ae50 100644
--- a/Platform/Intel/MinPlatformPkg/Acpi/AcpiTables/AcpiPlatform.c
+++ b/Platform/Intel/MinPlatformPkg/Acpi/AcpiTables/AcpiPlatform.c
@@ -14,50 +14,1187 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
#include "AcpiPlatform.h"
+#define MAX_CPU_NUM (FixedPcdGet32(PcdMaxCpuThreadCount) * FixedPcdGet32(PcdMaxCpuCoreCount) * FixedPcdGet32(PcdMaxCpuSocketCount))
+
+#pragma pack(1)
+
+typedef struct {
+ UINT32 AcpiProcessorId;
+ UINT32 ApicId;
+ UINT32 Flags;
+ UINT32 SwProcApicId;
+ UINT32 SocketNum;
+} EFI_CPU_ID_ORDER_MAP;
+
+//
+// Private Driver Data
+//
//
-// Global variables
+// Define Union of IO APIC & Local APIC structure;
//
+typedef union {
+ EFI_ACPI_4_0_PROCESSOR_LOCAL_APIC_STRUCTURE AcpiLocalApic;
+ EFI_ACPI_4_0_IO_APIC_STRUCTURE AcpiIoApic;
+ EFI_ACPI_4_0_PROCESSOR_LOCAL_X2APIC_STRUCTURE AcpiLocalx2Apic;
+ struct {
+ UINT8 Type;
+ UINT8 Length;
+ } AcpiApicCommon;
+} ACPI_APIC_STRUCTURE_PTR;
+
+#pragma pack()
+
+extern EFI_ACPI_5_0_FIRMWARE_ACPI_CONTROL_STRUCTURE Facs;
+extern EFI_ACPI_5_0_FIXED_ACPI_DESCRIPTION_TABLE Fadt;
+extern EFI_ACPI_HIGH_PRECISION_EVENT_TIMER_TABLE_HEADER Hpet;
+extern EFI_ACPI_WSMT_TABLE Wsmt;
VOID *mLocalTable[] = {
&Facs,
&Fadt,
&Hpet,
- &Madt,
- &Mcfg,
- &Wsmt
+ &Wsmt,
};
-GLOBAL_REMOVE_IF_UNREFERENCED EFI_CPU_ID_ORDER_MAP mCpuApicIdOrderTable[MAX_CPU_NUM];
-GLOBAL_REMOVE_IF_UNREFERENCED EFI_CPU_APIC_ID_REORDER_MAP mCpuApicIdReorderTable[MAX_CPU_NUM];
+EFI_ACPI_TABLE_PROTOCOL *mAcpiTable;
+
+UINT32 mNumOfBitShift = 6;
+BOOLEAN mForceX2ApicId;
+BOOLEAN mX2ApicEnabled;
+
+EFI_MP_SERVICES_PROTOCOL *mMpService;
+BOOLEAN mCpuOrderSorted;
+EFI_CPU_ID_ORDER_MAP mCpuApicIdOrderTable[MAX_CPU_NUM];
+UINTN mNumberOfCPUs = 0;
+UINTN mNumberOfEnabledCPUs = 0;
+
+// following are possible APICID Map for SKX
+static const UINT32 ApicIdMapA[] = { //for SKUs have number of core > 16
+ //it is 14 + 14 + 14 + 14 format
+ 0x00000000, 0x00000001, 0x00000002, 0x00000003, 0x00000004, 0x00000005, 0x00000006, 0x00000007,
+ 0x00000008, 0x00000009, 0x0000000A, 0x0000000B, 0x0000000C, 0x0000000D, 0x00000010, 0x00000011,
+ 0x00000012, 0x00000013, 0x00000014, 0x00000015, 0x00000016, 0x00000017, 0x00000018, 0x00000019,
+ 0x0000001A, 0x0000001B, 0x0000001C, 0x0000001D, 0x00000020, 0x00000021, 0x00000022, 0x00000023,
+ 0x00000024, 0x00000025, 0x00000026, 0x00000027, 0x00000028, 0x00000029, 0x0000002A, 0x0000002B,
+ 0x0000002C, 0x0000002D, 0x00000030, 0x00000031, 0x00000032, 0x00000033, 0x00000034, 0x00000035,
+ 0x00000036, 0x00000037, 0x00000038, 0x00000039, 0x0000003A, 0x0000003B, 0x0000003C, 0x0000003D
+};
-GLOBAL_REMOVE_IF_UNREFERENCED EFI_CPU_PACKAGE_INFO mSbspPackageInfo;
+static const UINT32 ApicIdMapB[] = { //for SKUs have number of cores <= 16 use 32 ID space
+ //it is 16+16 format
+ 0x00000000, 0x00000001, 0x00000002, 0x00000003, 0x00000004, 0x00000005, 0x00000006, 0x00000007,
+ 0x00000008, 0x00000009, 0x0000000A, 0x0000000B, 0x0000000C, 0x0000000D, 0x0000000E, 0x0000000F,
+ 0x00000010, 0x00000011, 0x00000012, 0x00000013, 0x00000014, 0x00000015, 0x00000016, 0x00000017,
+ 0x00000018, 0x00000019, 0x0000001A, 0x0000001B, 0x0000001C, 0x0000001D, 0x0000001E, 0x0000001F,
+ 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
+ 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
+ 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF
+};
-//
-// Function implementations
-//
-/*
- This function will determine whether Native ASPM is supported on the platform.
+static const UINT32 ApicIdMapC[] = { //for SKUs have number of cores <= 16 use 64 ID space
+ //it is 16+0+16+0 format
+ 0x00000000, 0x00000001, 0x00000002, 0x00000003, 0x00000004, 0x00000005, 0x00000006, 0x00000007,
+ 0x00000008, 0x00000009, 0x0000000A, 0x0000000B, 0x0000000C, 0x0000000D, 0x0000000E, 0x0000000F,
+ 0x00000020, 0x00000021, 0x00000022, 0x00000023, 0x00000024, 0x00000025, 0x00000026, 0x00000027,
+ 0x00000028, 0x00000029, 0x0000002A, 0x0000002B, 0x0000002C, 0x0000002D, 0x0000002E, 0x0000002F,
+ 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
+ 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
+ 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF
+};
+
+static const UINT32 ApicIdMapD[] = { //for SKUs have number of cores <= 8 use 16 ID space
+ //it is 16 format
+ 0x00000000, 0x00000001, 0x00000002, 0x00000003, 0x00000004, 0x00000005, 0x00000006, 0x00000007,
+ 0x00000008, 0x00000009, 0x0000000A, 0x0000000B, 0x0000000C, 0x0000000D, 0x0000000E, 0x0000000F,
+ 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
+ 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
+ 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
+ 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
+ 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF
+};
+
+const UINT32 *mApicIdMap = NULL;
+
+/**
+ This function detect the APICID map and update ApicID Map pointer
+
+ @param None
+
+ @retval VOID
+
+**/
+VOID DetectApicIdMap(VOID)
+{
+ UINTN CoreCount;
+
+ CoreCount = 0;
+
+ if(mApicIdMap != NULL) {
+ return; //aleady initialized
+ }
+
+ mApicIdMap = ApicIdMapA; // default to > 16C SKUs
+
+ CoreCount = mNumberOfEnabledCPUs / 2;
+ DEBUG ((DEBUG_INFO, "CoreCount - %d\n", CoreCount));
+
+ //DEBUG((EFI_D_ERROR, ":: Default to use Map A @ %08X FusedCoreCount: %02d, sktlevel: %d\n",mApicIdMap, FusedCoreCount, mNumOfBitShift));
+ ASSERT (CoreCount != 0);
+
+ if(CoreCount <= 16) {
+
+ if(mNumOfBitShift == 4) {
+ mApicIdMap = ApicIdMapD;
+ //DEBUG((EFI_D_ERROR, ":: Use Map B @ %08X\n",mApicIdMap));
+ }
+
+ if(mNumOfBitShift == 5) {
+ mApicIdMap = ApicIdMapB;
+ //DEBUG((EFI_D_ERROR, ":: Use Map B @ %08X\n",mApicIdMap));
+ }
+
+ if(mNumOfBitShift == 6) {
+ mApicIdMap = ApicIdMapC;
+ //DEBUG((EFI_D_ERROR, ":: Use Map C @ %08X\n",mApicIdMap));
+ }
- @return TRUE if Native ASPM is supported, FALSE otherwise
-*/
-BOOLEAN
-IsNativeAspmSupported (
+ }
+
+ return;
+}
+
+/**
+ This function return the CoreThreadId of ApicId from ACPI ApicId Map array
+
+ @param ApicId
+
+ @retval Index of ACPI ApicId Map array
+
+**/
+UINT32
+GetIndexFromApicId (
+ UINT32 ApicId
+ )
+{
+ UINT32 CoreThreadId;
+ UINT32 i;
+
+ ASSERT (mApicIdMap != NULL);
+
+ CoreThreadId = ApicId & ((1 << mNumOfBitShift) - 1);
+
+ for(i = 0; i < (FixedPcdGet32(PcdMaxCpuCoreCount) * FixedPcdGet32(PcdMaxCpuThreadCount)); i++) {
+ if(mApicIdMap[i] == CoreThreadId) {
+ break;
+ }
+ }
+
+ ASSERT (i <= (FixedPcdGet32(PcdMaxCpuCoreCount) * FixedPcdGet32(PcdMaxCpuThreadCount)));
+
+ return i;
+}
+
+UINT32
+ApicId2SwProcApicId (
+ UINT32 ApicId
+ )
+{
+ UINT32 Index;
+
+ for (Index = 0; Index < MAX_CPU_NUM; Index++) {
+ if ((mCpuApicIdOrderTable[Index].Flags == 1) && (mCpuApicIdOrderTable[Index].ApicId == ApicId)) {
+ return Index;
+ }
+ }
+
+ return (UINT32) -1;
+
+}
+
+VOID
+DebugDisplayReOrderTable(
VOID
)
{
- if (PcdGet8 (PcdPciExpNative) == 0) {
- return FALSE;
- }
- switch (PcdGet8 (PcdNativeAspmEnable)) {
- case 0:
- return FALSE;
- case 1:
- return TRUE;
- default:
- ASSERT (0);
+ UINT32 Index;
+
+ DEBUG ((EFI_D_ERROR, "Index AcpiProcId ApicId Flags SwApicId Skt\n"));
+ for (Index=0; Index<MAX_CPU_NUM; Index++) {
+ DEBUG ((EFI_D_ERROR, " %02d 0x%02X 0x%02X %d 0x%02X %d\n",
+ Index, mCpuApicIdOrderTable[Index].AcpiProcessorId,
+ mCpuApicIdOrderTable[Index].ApicId,
+ mCpuApicIdOrderTable[Index].Flags,
+ mCpuApicIdOrderTable[Index].SwProcApicId,
+ mCpuApicIdOrderTable[Index].SocketNum));
+ }
+}
+
+EFI_STATUS
+AppendCpuMapTableEntry (
+ IN VOID *ApicPtr,
+ IN UINT32 LocalApicCounter
+ )
+{
+ EFI_STATUS Status;
+ EFI_ACPI_4_0_PROCESSOR_LOCAL_APIC_STRUCTURE *LocalApicPtr;
+ EFI_ACPI_4_0_PROCESSOR_LOCAL_X2APIC_STRUCTURE *LocalX2ApicPtr;
+ UINT8 Type;
+
+ Status = EFI_SUCCESS;
+ Type = ((ACPI_APIC_STRUCTURE_PTR *)ApicPtr)->AcpiApicCommon.Type;
+ LocalApicPtr = (EFI_ACPI_4_0_PROCESSOR_LOCAL_APIC_STRUCTURE *)(&((ACPI_APIC_STRUCTURE_PTR *)ApicPtr)->AcpiLocalApic);
+ LocalX2ApicPtr = (EFI_ACPI_4_0_PROCESSOR_LOCAL_X2APIC_STRUCTURE *)(&((ACPI_APIC_STRUCTURE_PTR *)ApicPtr)->AcpiLocalx2Apic);
+
+ if(Type == EFI_ACPI_4_0_PROCESSOR_LOCAL_APIC) {
+ if(!mX2ApicEnabled) {
+ LocalApicPtr->Flags = (UINT8)mCpuApicIdOrderTable[LocalApicCounter].Flags;
+ LocalApicPtr->ApicId = (UINT8)mCpuApicIdOrderTable[LocalApicCounter].ApicId;
+ LocalApicPtr->AcpiProcessorId = (UINT8)mCpuApicIdOrderTable[LocalApicCounter].AcpiProcessorId;
+ } else {
+ LocalApicPtr->Flags = 0;
+ LocalApicPtr->ApicId = 0xFF;
+ LocalApicPtr->AcpiProcessorId = (UINT8)0xFF;
+ Status = EFI_UNSUPPORTED;
+ }
+ } else if(Type == EFI_ACPI_4_0_PROCESSOR_LOCAL_X2APIC) {
+ if(mX2ApicEnabled) {
+ LocalX2ApicPtr->Flags = (UINT8)mCpuApicIdOrderTable[LocalApicCounter].Flags;
+ LocalX2ApicPtr->X2ApicId = mCpuApicIdOrderTable[LocalApicCounter].ApicId;
+ LocalX2ApicPtr->AcpiProcessorUid = mCpuApicIdOrderTable[LocalApicCounter].AcpiProcessorId;
+ } else {
+ LocalX2ApicPtr->Flags = 0;
+ LocalX2ApicPtr->X2ApicId = (UINT32)-1;
+ LocalX2ApicPtr->AcpiProcessorUid = (UINT32)-1;
+ Status = EFI_UNSUPPORTED;
+ }
+ } else {
+ Status = EFI_UNSUPPORTED;
+ }
+
+ return Status;
+
+}
+
+EFI_STATUS
+SortCpuLocalApicInTable (
+ VOID
+ )
+{
+ EFI_STATUS Status;
+ EFI_PROCESSOR_INFORMATION ProcessorInfoBuffer;
+ UINT32 Index;
+ UINT32 CurrProcessor;
+ UINT32 BspApicId;
+ UINT32 TempVal = 0;
+ EFI_CPU_ID_ORDER_MAP *CpuIdMapPtr;
+ UINT32 CoreThreadMask;
+
+ Index = 0;
+ Status = EFI_SUCCESS;
+
+ CoreThreadMask = (UINT32) ((1 << mNumOfBitShift) - 1);
+
+ if(!mCpuOrderSorted) {
+
+ Index = 0;
+
+ for (CurrProcessor = 0; CurrProcessor < mNumberOfCPUs; CurrProcessor++) {
+ Status = mMpService->GetProcessorInfo (
+ mMpService,
+ CurrProcessor,
+ &ProcessorInfoBuffer
+ );
+
+ if ((ProcessorInfoBuffer.StatusFlag & PROCESSOR_ENABLED_BIT) != 0) {
+ if(ProcessorInfoBuffer.ProcessorId & 1) { //is 2nd thread
+ CpuIdMapPtr = (EFI_CPU_ID_ORDER_MAP *)&mCpuApicIdOrderTable[(Index - 1) + MAX_CPU_NUM / 2];
+ } else { //is primary thread
+ CpuIdMapPtr = (EFI_CPU_ID_ORDER_MAP *)&mCpuApicIdOrderTable[Index];
+ Index++;
+ }
+ CpuIdMapPtr->ApicId = (UINT32)ProcessorInfoBuffer.ProcessorId;
+ CpuIdMapPtr->Flags = ((ProcessorInfoBuffer.StatusFlag & PROCESSOR_ENABLED_BIT) != 0);
+ CpuIdMapPtr->SocketNum = (UINT32)ProcessorInfoBuffer.Location.Package;
+ CpuIdMapPtr->AcpiProcessorId = (CpuIdMapPtr->SocketNum * FixedPcdGet32(PcdMaxCpuCoreCount) * FixedPcdGet32(PcdMaxCpuThreadCount)) + GetIndexFromApicId(CpuIdMapPtr->ApicId); //CpuIdMapPtr->ApicId;
+ CpuIdMapPtr->SwProcApicId = ((UINT32)(ProcessorInfoBuffer.Location.Package << mNumOfBitShift) + (((UINT32)ProcessorInfoBuffer.ProcessorId) & CoreThreadMask));
+ if(mX2ApicEnabled) { //if X2Apic, re-order the socket # so it starts from base 0 and contiguous
+ //may not necessory!!!!!
+ }
+
+ //update processorbitMask
+ if (CpuIdMapPtr->Flags == 1) {
+
+ if(mForceX2ApicId) {
+ CpuIdMapPtr->SocketNum &= 0x7;
+ CpuIdMapPtr->AcpiProcessorId &= 0xFF; //keep lower 8bit due to use Proc obj in dsdt
+ CpuIdMapPtr->SwProcApicId &= 0xFF;
+ }
+ }
+ } else { //not enabled
+ CpuIdMapPtr = (EFI_CPU_ID_ORDER_MAP *)&mCpuApicIdOrderTable[Index];
+ CpuIdMapPtr->ApicId = (UINT32)-1;
+ CpuIdMapPtr->Flags = 0;
+ CpuIdMapPtr->AcpiProcessorId = (UINT32)-1;
+ CpuIdMapPtr->SwProcApicId = (UINT32)-1;
+ CpuIdMapPtr->SocketNum = (UINT32)-1;
+ } //end if PROC ENABLE
+ } //end for CurrentProcessor
+
+ //keep for debug purpose
+ DEBUG(( EFI_D_ERROR, "::ACPI:: APIC ID Order Table Init. CoreThreadMask = %x, mNumOfBitShift = %x\n", CoreThreadMask, mNumOfBitShift));
+ DebugDisplayReOrderTable();
+
+ //make sure 1st entry is BSP
+ if(mX2ApicEnabled) {
+ BspApicId = (UINT32)AsmReadMsr64(0x802);
+ } else {
+ BspApicId = (*(volatile UINT32 *)(UINTN)0xFEE00020) >> 24;
+ }
+ DEBUG ((EFI_D_INFO, "BspApicId - 0x%x\n", BspApicId));
+
+ if(mCpuApicIdOrderTable[0].ApicId != BspApicId) {
+ //check to see if 1st entry is BSP, if not swap it
+ Index = ApicId2SwProcApicId(BspApicId);
+
+ if(MAX_CPU_NUM <= Index) {
+ DEBUG ((EFI_D_ERROR, "Asserting the SortCpuLocalApicInTable Index Bufferflow\n"));
+ ASSERT_EFI_ERROR(EFI_INVALID_PARAMETER);
+ }
+
+ TempVal = mCpuApicIdOrderTable[Index].ApicId;
+ mCpuApicIdOrderTable[Index].ApicId = mCpuApicIdOrderTable[0].ApicId;
+ mCpuApicIdOrderTable[0].ApicId = TempVal;
+ mCpuApicIdOrderTable[Index].Flags = mCpuApicIdOrderTable[0].Flags;
+ mCpuApicIdOrderTable[0].Flags = 1;
+ TempVal = mCpuApicIdOrderTable[Index].SwProcApicId;
+ mCpuApicIdOrderTable[Index].SwProcApicId = mCpuApicIdOrderTable[0].SwProcApicId;
+ mCpuApicIdOrderTable[0].SwProcApicId = TempVal;
+ //swap AcpiProcId
+ TempVal = mCpuApicIdOrderTable[Index].AcpiProcessorId;
+ mCpuApicIdOrderTable[Index].AcpiProcessorId = mCpuApicIdOrderTable[0].AcpiProcessorId;
+ mCpuApicIdOrderTable[0].AcpiProcessorId = TempVal;
+
+ }
+
+ //Make sure no holes between enabled threads
+ for(CurrProcessor = 0; CurrProcessor < MAX_CPU_NUM; CurrProcessor++) {
+
+ if(mCpuApicIdOrderTable[CurrProcessor].Flags == 0) {
+ //make sure disabled entry has ProcId set to FFs
+ mCpuApicIdOrderTable[CurrProcessor].ApicId = (UINT32)-1;
+ mCpuApicIdOrderTable[CurrProcessor].AcpiProcessorId = (UINT32)-1;
+ mCpuApicIdOrderTable[CurrProcessor].SwProcApicId = (UINT32)-1;
+
+ for(Index = CurrProcessor+1; Index < MAX_CPU_NUM; Index++) {
+ if(mCpuApicIdOrderTable[Index].Flags == 1) {
+ //move enabled entry up
+ mCpuApicIdOrderTable[CurrProcessor].Flags = 1;
+ mCpuApicIdOrderTable[CurrProcessor].ApicId = mCpuApicIdOrderTable[Index].ApicId;
+ mCpuApicIdOrderTable[CurrProcessor].AcpiProcessorId = mCpuApicIdOrderTable[Index].AcpiProcessorId;
+ mCpuApicIdOrderTable[CurrProcessor].SwProcApicId = mCpuApicIdOrderTable[Index].SwProcApicId;
+ mCpuApicIdOrderTable[CurrProcessor].SocketNum = mCpuApicIdOrderTable[Index].SocketNum;
+ //disable moved entry
+ mCpuApicIdOrderTable[Index].Flags = 0;
+ mCpuApicIdOrderTable[Index].ApicId = (UINT32)-1;
+ mCpuApicIdOrderTable[Index].AcpiProcessorId = (UINT32)-1;
+ mCpuApicIdOrderTable[Index].SwProcApicId = (UINT32)-1;
+ break;
+ }
+ }
+ }
+ }
+
+ //keep for debug purpose
+ DEBUG ((EFI_D_ERROR, "APIC ID Order Table ReOrdered\n"));
+ DebugDisplayReOrderTable();
+
+ mCpuOrderSorted = TRUE;
+ }
+
+ return Status;
+}
+
+
+/** Structure of a sub-structure of the ACPI header.
+
+ This structure contains the type and length fields, which are common to every
+ sub-structure of the ACPI tables. A pointer to any structure can be cast as this.
+**/
+typedef struct {
+ UINT8 Type;
+ UINT8 Length;
+} STRUCTURE_HEADER;
+
+STRUCTURE_HEADER mMadtStructureTable[] = {
+ {EFI_ACPI_4_0_PROCESSOR_LOCAL_APIC, sizeof (EFI_ACPI_4_0_PROCESSOR_LOCAL_APIC_STRUCTURE)},
+ {EFI_ACPI_4_0_IO_APIC, sizeof (EFI_ACPI_4_0_IO_APIC_STRUCTURE)},
+ {EFI_ACPI_4_0_INTERRUPT_SOURCE_OVERRIDE, sizeof (EFI_ACPI_4_0_INTERRUPT_SOURCE_OVERRIDE_STRUCTURE)},
+ {EFI_ACPI_4_0_NON_MASKABLE_INTERRUPT_SOURCE, sizeof (EFI_ACPI_4_0_NON_MASKABLE_INTERRUPT_SOURCE_STRUCTURE)},
+ {EFI_ACPI_4_0_LOCAL_APIC_NMI, sizeof (EFI_ACPI_4_0_LOCAL_APIC_NMI_STRUCTURE)},
+ {EFI_ACPI_4_0_LOCAL_APIC_ADDRESS_OVERRIDE, sizeof (EFI_ACPI_4_0_LOCAL_APIC_ADDRESS_OVERRIDE_STRUCTURE)},
+ {EFI_ACPI_4_0_IO_SAPIC, sizeof (EFI_ACPI_4_0_IO_SAPIC_STRUCTURE)},
+ {EFI_ACPI_4_0_LOCAL_SAPIC, sizeof (EFI_ACPI_4_0_PROCESSOR_LOCAL_SAPIC_STRUCTURE)},
+ {EFI_ACPI_4_0_PLATFORM_INTERRUPT_SOURCES, sizeof (EFI_ACPI_4_0_PLATFORM_INTERRUPT_SOURCES_STRUCTURE)},
+ {EFI_ACPI_4_0_PROCESSOR_LOCAL_X2APIC, sizeof (EFI_ACPI_4_0_PROCESSOR_LOCAL_X2APIC_STRUCTURE)},
+ {EFI_ACPI_4_0_LOCAL_X2APIC_NMI, sizeof (EFI_ACPI_4_0_LOCAL_X2APIC_NMI_STRUCTURE)}
+};
+
+/**
+ Get the size of the ACPI table.
+
+ This function calculates the size needed for the ACPI Table based on the number and
+ size of the sub-structures that will compose it.
+
+ @param[in] TableSpecificHdrLength Size of the table specific header, not the ACPI standard header size.
+ @param[in] Structures Pointer to an array of sub-structure pointers.
+ @param[in] StructureCount Number of structure pointers in the array.
+
+ @return Total size needed for the ACPI table.
+**/
+UINT32
+GetTableSize (
+ IN UINTN TableSpecificHdrLength,
+ IN STRUCTURE_HEADER **Structures,
+ IN UINTN StructureCount
+ )
+{
+ UINT32 TableLength;
+ UINT32 Index;
+
+ //
+ // Compute size of the ACPI table; header plus all structures needed.
+ //
+ TableLength = (UINT32) TableSpecificHdrLength;
+
+ for (Index = 0; Index < StructureCount; Index++) {
+ ASSERT (Structures[Index] != NULL);
+ if (Structures[Index] == NULL) {
+ return 0;
+ }
+
+ TableLength += Structures[Index]->Length;
+ }
+
+ return TableLength;
+}
+
+/**
+ Allocate the ACPI Table.
+
+ This function allocates space for the ACPI table based on the number and size of
+ the sub-structures that will compose it.
+
+ @param[in] TableSpecificHdrLength Size of the table specific header, not the ACPI standard header size.
+ @param[in] Structures Pointer to an array of sub-structure pointers.
+ @param[in] StructureCount Number of structure pointers in the array.
+ @param[out] Table Newly allocated ACPI Table pointer.
+
+ @retval EFI_SUCCESS Successfully allocated the Table.
+ @retval EFI_OUT_OF_RESOURCES Space for the Table could not be allocated.
+**/
+EFI_STATUS
+AllocateTable (
+ IN UINTN TableSpecificHdrLength,
+ IN STRUCTURE_HEADER **Structures,
+ IN UINTN StructureCount,
+ OUT EFI_ACPI_DESCRIPTION_HEADER **Table
+ )
+{
+ EFI_STATUS Status;
+ UINT32 Size;
+ EFI_ACPI_DESCRIPTION_HEADER *InternalTable;
+
+ //
+ // Get the size of the ACPI table and allocate memory.
+ //
+ Size = GetTableSize (TableSpecificHdrLength, Structures, StructureCount);
+ InternalTable = (EFI_ACPI_DESCRIPTION_HEADER *) AllocatePool (Size);
+
+ if (InternalTable == NULL) {
+ Status = EFI_OUT_OF_RESOURCES;
+ DEBUG ((
+ DEBUG_ERROR,
+ "Failed to allocate %d bytes for ACPI Table\n",
+ Size
+ ));
+ } else {
+ Status = EFI_SUCCESS;
+ DEBUG ((
+ DEBUG_INFO,
+ "Successfully allocated %d bytes for ACPI Table at 0x%p\n",
+ Size,
+ InternalTable
+ ));
+ *Table = InternalTable;
+ }
+
+ return Status;
+}
+
+/**
+ Initialize the header.
+
+ This function fills in the standard table header with correct values,
+ except for the length and checksum fields, which are filled in later.
+
+ @param[in,out] Header Pointer to the header structure.
+
+ @retval EFI_SUCCESS Successfully initialized the header.
+ @retval EFI_INVALID_PARAMETER Pointer parameter was null.
+**/
+EFI_STATUS
+InitializeHeader (
+ IN OUT EFI_ACPI_DESCRIPTION_HEADER *Header,
+ IN UINT32 Signature,
+ IN UINT8 Revision,
+ IN UINT32 OemRevision
+ )
+{
+ UINT64 AcpiTableOemId;
+
+ if (Header == NULL) {
+ DEBUG ((DEBUG_ERROR, "Header pointer is NULL\n"));
+ return EFI_INVALID_PARAMETER;
+ }
+
+ Header->Signature = Signature;
+ Header->Length = 0; // filled in by Build function
+ Header->Revision = Revision;
+ Header->Checksum = 0; // filled in by InstallAcpiTable
+
+ CopyMem (
+ (VOID *) &Header->OemId,
+ PcdGetPtr (PcdAcpiDefaultOemId),
+ sizeof (Header->OemId)
+ );
+
+ AcpiTableOemId = PcdGet64 (PcdAcpiDefaultOemTableId);
+ CopyMem (
+ (VOID *) &Header->OemTableId,
+ (VOID *) &AcpiTableOemId,
+ sizeof (Header->OemTableId)
+ );
+
+ Header->OemRevision = OemRevision;
+ Header->CreatorId = 0;
+ Header->CreatorRevision = 0;
+
+ return EFI_SUCCESS;
+}
+
+/**
+ Initialize the MADT header.
+
+ This function fills in the MADT's standard table header with correct values,
+ except for the length and checksum fields, which are filled in later.
+
+ @param[in,out] MadtHeader Pointer to the MADT header structure.
+
+ @retval EFI_SUCCESS Successfully initialized the MADT header.
+ @retval EFI_INVALID_PARAMETER Pointer parameter was null.
+**/
+EFI_STATUS
+InitializeMadtHeader (
+ IN OUT EFI_ACPI_4_0_MULTIPLE_APIC_DESCRIPTION_TABLE_HEADER *MadtHeader
+ )
+{
+ EFI_STATUS Status;
+
+ if (MadtHeader == NULL) {
+ DEBUG ((DEBUG_ERROR, "MADT header pointer is NULL\n"));
+ return EFI_INVALID_PARAMETER;
+ }
+
+ Status = InitializeHeader (
+ &MadtHeader->Header,
+ EFI_ACPI_4_0_MULTIPLE_APIC_DESCRIPTION_TABLE_SIGNATURE,
+ EFI_ACPI_4_0_MULTIPLE_APIC_DESCRIPTION_TABLE_REVISION,
+ 0
+ );
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+
+ MadtHeader->LocalApicAddress = PcdGet32(PcdLocalApicAddress);
+ MadtHeader->Flags = EFI_ACPI_4_0_PCAT_COMPAT;
+
+ return EFI_SUCCESS;
+}
+
+/**
+ Copy an ACPI sub-structure; MADT and SRAT supported
+
+ This function validates the structure type and size of a sub-structure
+ and returns a newly allocated copy of it.
+
+ @param[in] Header Pointer to the header of the table.
+ @param[in] Structure Pointer to the structure to copy.
+ @param[in] NewStructure Newly allocated copy of the structure.
+
+ @retval EFI_SUCCESS Successfully copied the structure.
+ @retval EFI_INVALID_PARAMETER Pointer parameter was null.
+ @retval EFI_INVALID_PARAMETER Structure type was unknown.
+ @retval EFI_INVALID_PARAMETER Structure length was wrong for its type.
+ @retval EFI_UNSUPPORTED Header passed in is not supported.
+**/
+EFI_STATUS
+CopyStructure (
+ IN EFI_ACPI_DESCRIPTION_HEADER *Header,
+ IN STRUCTURE_HEADER *Structure,
+ OUT STRUCTURE_HEADER **NewStructure
+ )
+{
+ STRUCTURE_HEADER *NewStructureInternal;
+ STRUCTURE_HEADER *StructureTable;
+ UINTN TableNumEntries;
+ BOOLEAN EntryFound;
+ UINT8 Index;
+
+ //
+ // Initialize the number of table entries and the table based on the table header passed in.
+ //
+ if (Header->Signature == EFI_ACPI_4_0_MULTIPLE_APIC_DESCRIPTION_TABLE_SIGNATURE) {
+ TableNumEntries = sizeof (mMadtStructureTable) / sizeof (STRUCTURE_HEADER);
+ StructureTable = mMadtStructureTable;
+ } else {
+ return EFI_UNSUPPORTED;
}
- return TRUE;
+
+ //
+ // Check the incoming structure against the table of supported structures.
+ //
+ EntryFound = FALSE;
+ for (Index = 0; Index < TableNumEntries; Index++) {
+ if (Structure->Type == StructureTable[Index].Type) {
+ if (Structure->Length == StructureTable[Index].Length) {
+ EntryFound = TRUE;
+ } else {
+ DEBUG ((
+ DEBUG_ERROR,
+ "Invalid length for structure type %d: expected %d, actually %d\n",
+ Structure->Type,
+ StructureTable[Index].Length,
+ Structure->Length
+ ));
+ return EFI_INVALID_PARAMETER;
+ }
+ }
+ }
+
+ //
+ // If no entry in the table matches the structure type and length passed in
+ // then return invalid parameter.
+ //
+ if (!EntryFound) {
+ DEBUG ((
+ DEBUG_ERROR,
+ "Unknown structure type: %d\n",
+ Structure->Type
+ ));
+ return EFI_INVALID_PARAMETER;
+ }
+
+ NewStructureInternal = (STRUCTURE_HEADER *) AllocatePool (Structure->Length);
+ if (NewStructureInternal == NULL) {
+ DEBUG ((
+ DEBUG_ERROR,
+ "Failed to allocate %d bytes for type %d structure\n",
+ Structure->Length,
+ Structure->Type
+ ));
+ return EFI_OUT_OF_RESOURCES;
+ } else {
+ DEBUG ((
+ DEBUG_INFO,
+ "Successfully allocated %d bytes for type %d structure at 0x%p\n",
+ Structure->Length,
+ Structure->Type,
+ NewStructureInternal
+ ));
+ }
+
+ CopyMem (
+ (VOID *) NewStructureInternal,
+ (VOID *) Structure,
+ Structure->Length
+ );
+
+ *NewStructure = NewStructureInternal;
+ return EFI_SUCCESS;
+}
+
+/**
+ Build ACPI Table. MADT tables supported.
+
+ This function builds the ACPI table from the header plus the list of sub-structures
+ passed in. The table returned by this function is ready to be installed using
+ the ACPI table protocol's InstallAcpiTable function, which copies it into
+ ACPI memory. After that, the caller should free the memory returned by this
+ function.
+
+ @param[in] AcpiHeader Pointer to the header structure.
+ @param[in] TableSpecificHdrLength Size of the table specific header, not the ACPI standard header size.
+ @param[in] Structures Pointer to an array of sub-structure pointers.
+ @param[in] StructureCount Number of structure pointers in the array.
+ @param[out] NewTable Newly allocated and initialized pointer to the ACPI Table.
+
+ @retval EFI_SUCCESS Successfully built the ACPI table.
+ @retval EFI_INVALID_PARAMETER Pointer parameter was null.
+ @retval EFI_INVALID_PARAMETER Header parameter had the wrong signature.
+ @retval EFI_OUT_OF_RESOURCES Space for the ACPI Table could not be allocated.
+**/
+EFI_STATUS
+BuildAcpiTable (
+ IN EFI_ACPI_DESCRIPTION_HEADER *AcpiHeader,
+ IN UINTN TableSpecificHdrLength,
+ IN STRUCTURE_HEADER **Structures,
+ IN UINTN StructureCount,
+ OUT UINT8 **NewTable
+ )
+{
+ EFI_STATUS Status;
+ EFI_ACPI_DESCRIPTION_HEADER *InternalTable;
+ UINTN Index;
+ UINT8 *CurrPtr;
+ UINT8 *EndOfTablePtr;
+
+ if (AcpiHeader == NULL) {
+ DEBUG ((DEBUG_ERROR, "AcpiHeader pointer is NULL\n"));
+ return EFI_INVALID_PARAMETER;
+ }
+
+ if (AcpiHeader->Signature != EFI_ACPI_4_0_MULTIPLE_APIC_DESCRIPTION_TABLE_SIGNATURE) {
+ DEBUG ((
+ DEBUG_ERROR,
+ "MADT header signature is expected, actually 0x%08x\n",
+ AcpiHeader->Signature
+ ));
+ return EFI_INVALID_PARAMETER;
+ }
+
+ if (Structures == NULL) {
+ DEBUG ((DEBUG_ERROR, "Structure array pointer is NULL\n"));
+ return EFI_INVALID_PARAMETER;
+ }
+
+ for (Index = 0; Index < StructureCount; Index++) {
+ if (Structures[Index] == NULL) {
+ DEBUG ((DEBUG_ERROR, "Structure pointer %d is NULL\n", Index));
+ return EFI_INVALID_PARAMETER;
+ }
+ }
+
+ //
+ // Allocate the memory needed for the table.
+ //
+ Status = AllocateTable (
+ TableSpecificHdrLength,
+ Structures,
+ StructureCount,
+ &InternalTable
+ );
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+
+ //
+ // Copy Header and patch in structure length, checksum is programmed later
+ // after all structures are populated.
+ //
+ CopyMem (
+ (VOID *) InternalTable,
+ (VOID *) AcpiHeader,
+ TableSpecificHdrLength
+ );
+
+ InternalTable->Length = GetTableSize (TableSpecificHdrLength, Structures, StructureCount);
+
+ //
+ // Copy all the sub structures to the table.
+ //
+ CurrPtr = ((UINT8 *) InternalTable) + TableSpecificHdrLength;
+ EndOfTablePtr = ((UINT8 *) InternalTable) + InternalTable->Length;
+
+ for (Index = 0; Index < StructureCount; Index++) {
+ ASSERT (Structures[Index] != NULL);
+ if (Structures[Index] == NULL) {
+ break;
+ }
+
+ CopyMem (
+ (VOID *) CurrPtr,
+ (VOID *) Structures[Index],
+ Structures[Index]->Length
+ );
+
+ CurrPtr += Structures[Index]->Length;
+ ASSERT (CurrPtr <= EndOfTablePtr);
+ if (CurrPtr > EndOfTablePtr) {
+ break;
+ }
+ }
+
+ //
+ // Update the return pointer.
+ //
+ *NewTable = (UINT8 *) InternalTable;
+ return EFI_SUCCESS;
+}
+
+/**
+ Build from scratch and install the MADT.
+
+ @retval EFI_SUCCESS The MADT was installed successfully.
+ @retval EFI_OUT_OF_RESOURCES Could not allocate required structures.
+**/
+EFI_STATUS
+InstallMadtFromScratch (
+ VOID
+ )
+{
+ EFI_STATUS Status;
+ UINTN Index;
+ EFI_ACPI_4_0_MULTIPLE_APIC_DESCRIPTION_TABLE_HEADER *NewMadtTable;
+ UINTN TableHandle;
+ EFI_ACPI_4_0_MULTIPLE_APIC_DESCRIPTION_TABLE_HEADER MadtTableHeader;
+ EFI_ACPI_4_0_PROCESSOR_LOCAL_APIC_STRUCTURE ProcLocalApicStruct;
+ EFI_ACPI_4_0_IO_APIC_STRUCTURE IoApicStruct;
+ EFI_ACPI_4_0_INTERRUPT_SOURCE_OVERRIDE_STRUCTURE IntSrcOverrideStruct;
+ EFI_ACPI_4_0_LOCAL_APIC_NMI_STRUCTURE LocalApciNmiStruct;
+ EFI_ACPI_4_0_PROCESSOR_LOCAL_X2APIC_STRUCTURE ProcLocalX2ApicStruct;
+ EFI_ACPI_4_0_LOCAL_X2APIC_NMI_STRUCTURE LocalX2ApicNmiStruct;
+ STRUCTURE_HEADER **MadtStructs;
+ UINTN MaxMadtStructCount;
+ UINTN MadtStructsIndex;
+ UINT32 CurrentIoApicAddress = (UINT32)(PcdGet32(PcdPcIoApicAddressBase));
+ UINT32 PcIoApicEnable;
+ UINT32 PcIoApicMask;
+ UINTN PcIoApicIndex;
+
+ DetectApicIdMap();
+
+ // Call for Local APIC ID Reorder
+ SortCpuLocalApicInTable ();
+
+ NewMadtTable = NULL;
+
+ MaxMadtStructCount = (UINT32) (
+ MAX_CPU_NUM + // processor local APIC structures
+ MAX_CPU_NUM + // processor local x2APIC structures
+ 1 + PcdGet8(PcdPcIoApicCount) + // I/O APIC structures
+ 2 + // interrupt source override structures
+ 1 + // local APIC NMI structures
+ 1 // local x2APIC NMI structures
+ ); // other structures are not used
+
+ MadtStructs = (STRUCTURE_HEADER **) AllocateZeroPool (MaxMadtStructCount * sizeof (STRUCTURE_HEADER *));
+ if (MadtStructs == NULL) {
+ DEBUG ((DEBUG_ERROR, "Could not allocate MADT structure pointer array\n"));
+ return EFI_OUT_OF_RESOURCES;
+ }
+
+ //
+ // Initialize the next index into the structure pointer array. It is
+ // incremented every time a structure of any type is copied to the array.
+ //
+ MadtStructsIndex = 0;
+
+ //
+ // Initialize MADT Header Structure
+ //
+ Status = InitializeMadtHeader (&MadtTableHeader);
+ if (EFI_ERROR (Status)) {
+ DEBUG ((EFI_D_ERROR, "InitializeMadtHeader failed: %r\n", Status));
+ goto Done;
+ }
+
+ DEBUG ((EFI_D_INFO, "Number of CPUs detected = %d \n", mNumberOfCPUs));
+
+ //
+ // Build Processor Local APIC Structures and Processor Local X2APIC Structures
+ //
+ ProcLocalApicStruct.Type = EFI_ACPI_4_0_PROCESSOR_LOCAL_APIC;
+ ProcLocalApicStruct.Length = sizeof (EFI_ACPI_4_0_PROCESSOR_LOCAL_APIC_STRUCTURE);
+
+ ProcLocalX2ApicStruct.Type = EFI_ACPI_4_0_PROCESSOR_LOCAL_X2APIC;
+ ProcLocalX2ApicStruct.Length = sizeof (EFI_ACPI_4_0_PROCESSOR_LOCAL_X2APIC_STRUCTURE);
+ ProcLocalX2ApicStruct.Reserved[0] = 0;
+ ProcLocalX2ApicStruct.Reserved[1] = 0;
+
+ for (Index = 0; Index < MAX_CPU_NUM; Index++) {
+ //
+ // If x2APIC mode is not enabled, and if it is possible to express the
+ // APIC ID as a UINT8, use a processor local APIC structure. Otherwise,
+ // use a processor local x2APIC structure.
+ //
+ if (!mX2ApicEnabled && mCpuApicIdOrderTable[Index].ApicId < MAX_UINT8) {
+ ProcLocalApicStruct.Flags = (UINT8) mCpuApicIdOrderTable[Index].Flags;
+ ProcLocalApicStruct.ApicId = (UINT8) mCpuApicIdOrderTable[Index].ApicId;
+ ProcLocalApicStruct.AcpiProcessorId = (UINT8) mCpuApicIdOrderTable[Index].AcpiProcessorId;
+
+ ASSERT (MadtStructsIndex < MaxMadtStructCount);
+ Status = CopyStructure (
+ &MadtTableHeader.Header,
+ (STRUCTURE_HEADER *) &ProcLocalApicStruct,
+ &MadtStructs[MadtStructsIndex++]
+ );
+ } else if (mCpuApicIdOrderTable[Index].ApicId != 0xFFFFFFFF) {
+ ProcLocalX2ApicStruct.Flags = (UINT8) mCpuApicIdOrderTable[Index].Flags;
+ ProcLocalX2ApicStruct.X2ApicId = mCpuApicIdOrderTable[Index].ApicId;
+ ProcLocalX2ApicStruct.AcpiProcessorUid = mCpuApicIdOrderTable[Index].AcpiProcessorId;
+
+ ASSERT (MadtStructsIndex < MaxMadtStructCount);
+ Status = CopyStructure (
+ &MadtTableHeader.Header,
+ (STRUCTURE_HEADER *) &ProcLocalX2ApicStruct,
+ &MadtStructs[MadtStructsIndex++]
+ );
+ }
+ if (EFI_ERROR (Status)) {
+ DEBUG ((EFI_D_ERROR, "CopyMadtStructure (local APIC/x2APIC) failed: %r\n", Status));
+ goto Done;
+ }
+ }
+
+ //
+ // Build I/O APIC Structures
+ //
+ IoApicStruct.Type = EFI_ACPI_4_0_IO_APIC;
+ IoApicStruct.Length = sizeof (EFI_ACPI_4_0_IO_APIC_STRUCTURE);
+ IoApicStruct.Reserved = 0;
+
+ PcIoApicEnable = PcdGet32(PcdPcIoApicEnable);
+
+ if (FixedPcdGet32(PcdMaxCpuSocketCount) <= 4) {
+ IoApicStruct.IoApicId = PcdGet8(PcdIoApicId);
+ IoApicStruct.IoApicAddress = PcdGet32(PcdIoApicAddress);
+ IoApicStruct.GlobalSystemInterruptBase = 0;
+ ASSERT (MadtStructsIndex < MaxMadtStructCount);
+ Status = CopyStructure (
+ &MadtTableHeader.Header,
+ (STRUCTURE_HEADER *) &IoApicStruct,
+ &MadtStructs[MadtStructsIndex++]
+ );
+ if (EFI_ERROR (Status)) {
+ DEBUG ((EFI_D_ERROR, "CopyMadtStructure (I/O APIC) failed: %r\n", Status));
+ goto Done;
+ }
+ }
+
+ for (PcIoApicIndex = 0; PcIoApicIndex < PcdGet8(PcdPcIoApicCount); PcIoApicIndex++) {
+ PcIoApicMask = (1 << PcIoApicIndex);
+ if ((PcIoApicEnable & PcIoApicMask) == 0) {
+ continue;
+ }
+
+ IoApicStruct.IoApicId = (UINT8)(PcdGet8(PcdPcIoApicIdBase) + PcIoApicIndex);
+ IoApicStruct.IoApicAddress = CurrentIoApicAddress;
+ CurrentIoApicAddress = (CurrentIoApicAddress & 0xFFFF8000) + 0x8000;
+ IoApicStruct.GlobalSystemInterruptBase = (UINT32)(24 + (PcIoApicIndex * 8));
+ ASSERT (MadtStructsIndex < MaxMadtStructCount);
+ Status = CopyStructure (
+ &MadtTableHeader.Header,
+ (STRUCTURE_HEADER *) &IoApicStruct,
+ &MadtStructs[MadtStructsIndex++]
+ );
+ if (EFI_ERROR (Status)) {
+ DEBUG ((EFI_D_ERROR, "CopyMadtStructure (I/O APIC) failed: %r\n", Status));
+ goto Done;
+ }
+ }
+
+ //
+ // Build Interrupt Source Override Structures
+ //
+ IntSrcOverrideStruct.Type = EFI_ACPI_4_0_INTERRUPT_SOURCE_OVERRIDE;
+ IntSrcOverrideStruct.Length = sizeof (EFI_ACPI_4_0_INTERRUPT_SOURCE_OVERRIDE_STRUCTURE);
+
+ //
+ // IRQ0=>IRQ2 Interrupt Source Override Structure
+ //
+ IntSrcOverrideStruct.Bus = 0x0; // Bus - ISA
+ IntSrcOverrideStruct.Source = 0x0; // Source - IRQ0
+ IntSrcOverrideStruct.GlobalSystemInterrupt = 0x2; // Global System Interrupt - IRQ2
+ IntSrcOverrideStruct.Flags = 0x0; // Flags - Conforms to specifications of the bus
+
+ ASSERT (MadtStructsIndex < MaxMadtStructCount);
+ Status = CopyStructure (
+ &MadtTableHeader.Header,
+ (STRUCTURE_HEADER *) &IntSrcOverrideStruct,
+ &MadtStructs[MadtStructsIndex++]
+ );
+ if (EFI_ERROR (Status)) {
+ DEBUG ((EFI_D_ERROR, "CopyMadtStructure (IRQ2 source override) failed: %r\n", Status));
+ goto Done;
+ }
+
+ //
+ // IRQ9 (SCI Active High) Interrupt Source Override Structure
+ //
+ IntSrcOverrideStruct.Bus = 0x0; // Bus - ISA
+ IntSrcOverrideStruct.Source = 0x9; // Source - IRQ9
+ IntSrcOverrideStruct.GlobalSystemInterrupt = 0x9; // Global System Interrupt - IRQ9
+ IntSrcOverrideStruct.Flags = 0xD; // Flags - Level-tiggered, Active High
+
+ ASSERT (MadtStructsIndex < MaxMadtStructCount);
+ Status = CopyStructure (
+ &MadtTableHeader.Header,
+ (STRUCTURE_HEADER *) &IntSrcOverrideStruct,
+ &MadtStructs[MadtStructsIndex++]
+ );
+ if (EFI_ERROR (Status)) {
+ DEBUG ((EFI_D_ERROR, "CopyMadtStructure (IRQ9 source override) failed: %r\n", Status));
+ goto Done;
+ }
+
+ //
+ // Build Local APIC NMI Structures
+ //
+ LocalApciNmiStruct.Type = EFI_ACPI_4_0_LOCAL_APIC_NMI;
+ LocalApciNmiStruct.Length = sizeof (EFI_ACPI_4_0_LOCAL_APIC_NMI_STRUCTURE);
+ LocalApciNmiStruct.AcpiProcessorId = 0xFF; // Applies to all processors
+ LocalApciNmiStruct.Flags = 0x000D; // Flags - Level-tiggered, Active High
+ LocalApciNmiStruct.LocalApicLint = 0x1;
+
+ ASSERT (MadtStructsIndex < MaxMadtStructCount);
+ Status = CopyStructure (
+ &MadtTableHeader.Header,
+ (STRUCTURE_HEADER *) &LocalApciNmiStruct,
+ &MadtStructs[MadtStructsIndex++]
+ );
+ if (EFI_ERROR (Status)) {
+ DEBUG ((EFI_D_ERROR, "CopyMadtStructure (APIC NMI) failed: %r\n", Status));
+ goto Done;
+ }
+
+ //
+ // Build Local x2APIC NMI Structure
+ //
+ LocalX2ApicNmiStruct.Type = EFI_ACPI_4_0_LOCAL_X2APIC_NMI;
+ LocalX2ApicNmiStruct.Length = sizeof (EFI_ACPI_4_0_LOCAL_X2APIC_NMI_STRUCTURE);
+ LocalX2ApicNmiStruct.Flags = 0x000D; // Flags - Level-tiggered, Active High
+ LocalX2ApicNmiStruct.AcpiProcessorUid = 0xFFFFFFFF; // Applies to all processors
+ LocalX2ApicNmiStruct.LocalX2ApicLint = 0x01;
+ LocalX2ApicNmiStruct.Reserved[0] = 0x00;
+ LocalX2ApicNmiStruct.Reserved[1] = 0x00;
+ LocalX2ApicNmiStruct.Reserved[2] = 0x00;
+
+ ASSERT (MadtStructsIndex < MaxMadtStructCount);
+ Status = CopyStructure (
+ &MadtTableHeader.Header,
+ (STRUCTURE_HEADER *) &LocalX2ApicNmiStruct,
+ &MadtStructs[MadtStructsIndex++]
+ );
+ if (EFI_ERROR (Status)) {
+ DEBUG ((EFI_D_ERROR, "CopyMadtStructure (x2APIC NMI) failed: %r\n", Status));
+ goto Done;
+ }
+
+ //
+ // Build Madt Structure from the Madt Header and collection of pointers in MadtStructs[]
+ //
+ Status = BuildAcpiTable (
+ (EFI_ACPI_DESCRIPTION_HEADER *) &MadtTableHeader,
+ sizeof (EFI_ACPI_4_0_MULTIPLE_APIC_DESCRIPTION_TABLE_HEADER),
+ MadtStructs,
+ MadtStructsIndex,
+ (UINT8 **)&NewMadtTable
+ );
+ if (EFI_ERROR (Status)) {
+ DEBUG ((EFI_D_ERROR, "BuildAcpiTable failed: %r\n", Status));
+ goto Done;
+ }
+
+ //
+ // Publish Madt Structure to ACPI
+ //
+ Status = mAcpiTable->InstallAcpiTable (
+ mAcpiTable,
+ NewMadtTable,
+ NewMadtTable->Header.Length,
+ &TableHandle
+ );
+
+Done:
+ //
+ // Free memory
+ //
+ for (MadtStructsIndex = 0; MadtStructsIndex < MaxMadtStructCount; MadtStructsIndex++) {
+ if (MadtStructs[MadtStructsIndex] != NULL) {
+ FreePool (MadtStructs[MadtStructsIndex]);
+ }
+ }
+
+ FreePool (MadtStructs);
+
+ if (NewMadtTable != NULL) {
+ FreePool (NewMadtTable);
+ }
+
+ return Status;
+}
+
+EFI_STATUS
+InstallMcfgFromScratch (
+ VOID
+ )
+{
+ EFI_STATUS Status;
+ EFI_ACPI_MEMORY_MAPPED_CONFIGURATION_BASE_ADDRESS_TABLE_HEADER *McfgTable;
+ EFI_ACPI_MEMORY_MAPPED_ENHANCED_CONFIGURATION_SPACE_BASE_ADDRESS_ALLOCATION_STRUCTURE *Segment;
+ UINTN Index;
+ UINTN SegmentCount;
+ PCI_SEGMENT_INFO *PciSegmentInfo;
+ UINTN TableHandle;
+
+ PciSegmentInfo = GetPciSegmentInfo (&SegmentCount);
+
+ McfgTable = AllocateZeroPool (
+ sizeof(EFI_ACPI_MEMORY_MAPPED_CONFIGURATION_BASE_ADDRESS_TABLE_HEADER) +
+ sizeof(EFI_ACPI_MEMORY_MAPPED_ENHANCED_CONFIGURATION_SPACE_BASE_ADDRESS_ALLOCATION_STRUCTURE) * SegmentCount
+ );
+ if (McfgTable == NULL) {
+ DEBUG ((DEBUG_ERROR, "Could not allocate MCFG structure\n"));
+ return EFI_OUT_OF_RESOURCES;
+ }
+
+ Status = InitializeHeader (
+ &McfgTable->Header,
+ EFI_ACPI_3_0_PCI_EXPRESS_MEMORY_MAPPED_CONFIGURATION_SPACE_BASE_ADDRESS_DESCRIPTION_TABLE_SIGNATURE,
+ EFI_ACPI_MEMORY_MAPPED_CONFIGURATION_SPACE_ACCESS_TABLE_REVISION,
+ 0
+ );
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+
+ //
+ // Set MCFG table "Length" field based on the number of PCIe segments enumerated so far
+ //
+ McfgTable->Header.Length = (UINT32)(sizeof (EFI_ACPI_MEMORY_MAPPED_CONFIGURATION_BASE_ADDRESS_TABLE_HEADER) +
+ sizeof (EFI_ACPI_MEMORY_MAPPED_ENHANCED_CONFIGURATION_SPACE_BASE_ADDRESS_ALLOCATION_STRUCTURE) * SegmentCount);
+
+ Segment = (VOID *)(McfgTable + 1);
+
+ for (Index = 0; Index < SegmentCount; Index++) {
+ Segment[Index].PciSegmentGroupNumber = PciSegmentInfo[Index].SegmentNumber;
+ Segment[Index].BaseAddress = PciSegmentInfo[Index].BaseAddress;
+ Segment[Index].StartBusNumber = PciSegmentInfo[Index].StartBusNumber;
+ Segment[Index].EndBusNumber = PciSegmentInfo[Index].EndBusNumber;
+ }
+
+ //
+ // Publish Madt Structure to ACPI
+ //
+ Status = mAcpiTable->InstallAcpiTable (
+ mAcpiTable,
+ McfgTable,
+ McfgTable->Header.Length,
+ &TableHandle
+ );
+
+ return Status;
}
/**
@@ -78,25 +1215,17 @@ PlatformUpdateTables (
IN OUT EFI_ACPI_TABLE_VERSION *Version
)
{
- EFI_ACPI_DESCRIPTION_HEADER *TableHeader;
- UINT8 *CurrPtr;
- UINT8 *EndPtr;
- EFI_ACPI_1_0_PROCESSOR_LOCAL_APIC_STRUCTURE *ApicPtr;
- EFI_STATUS Status;
- EFI_MP_SERVICES_PROTOCOL *MpService;
- UINTN NumberOfCPUs;
- UINTN NumberOfEnabledCPUs;
- UINT32 HpetBaseAdress;
- UINT8 LocalApicCounter;
-
- CurrPtr = NULL;
- EndPtr = NULL;
- ApicPtr = NULL;
- NumberOfCPUs = 1;
- LocalApicCounter = 0;
-
+ EFI_ACPI_DESCRIPTION_HEADER *TableHeader;
+ UINT8 *TempOemId;
+ UINT64 TempOemTableId;
+ EFI_ACPI_5_0_FIXED_ACPI_DESCRIPTION_TABLE *FadtHeader;
+ EFI_ACPI_HIGH_PRECISION_EVENT_TIMER_TABLE_HEADER *HpetTable;
+
+ TableHeader = NULL;
+
//
- // This will be accurate except for FACS structure
+ // By default, a table belongs in all ACPI table versions published.
+ // Some tables will override this because they have different versions of the table.
//
TableHeader = (EFI_ACPI_DESCRIPTION_HEADER *) Table;
@@ -104,8 +1233,8 @@ PlatformUpdateTables (
// Update the OEM and creator information for every table except FACS.
//
if (Table->Signature != EFI_ACPI_1_0_FIRMWARE_ACPI_CONTROL_STRUCTURE_SIGNATURE) {
- *(UINT32 *) (TableHeader->OemId) = 'I' + ('N' << 8) + ('T' << 16) + ('E' << 24);
- *(UINT16 *) (TableHeader->OemId + 4) = 'L' + (' ' << 8);
+ TempOemId = (UINT8 *)PcdGetPtr(PcdAcpiDefaultOemId);
+ CopyMem (&TableHeader->OemId, TempOemId, 6);
//
// Skip OEM table ID and creator information for DSDT, SSDT and PSDT tables, since these are
@@ -115,39 +1244,21 @@ PlatformUpdateTables (
Table->Signature != EFI_ACPI_1_0_SECONDARY_SYSTEM_DESCRIPTION_TABLE_SIGNATURE &&
Table->Signature != EFI_ACPI_1_0_PERSISTENT_SYSTEM_DESCRIPTION_TABLE_SIGNATURE
) {
+ TempOemTableId = PcdGet64(PcdAcpiDefaultOemTableId);
+ CopyMem (&TableHeader->OemTableId, &TempOemTableId, 8);
//
- // Update OEM table ID
+ // Update the creator ID
//
- // Check if the silicon is KBL
- TableHeader->OemTableId = PcdGet64 (PcdAcpiDefaultOemTableId);
+ TableHeader->CreatorId = PcdGet32(PcdAcpiDefaultCreatorId);
+
//
- // Update creator information
+ // Update the creator revision
//
- TableHeader->CreatorId = EFI_ACPI_CREATOR_ID;
- TableHeader->CreatorRevision = EFI_ACPI_CREATOR_REVISION;
+ TableHeader->CreatorRevision = PcdGet32(PcdAcpiDefaultCreatorRevision);
}
}
- //
- // Locate the MP services protocol
- // Find the MP Protocol. This is an MP platform, so MP protocol must be there.
- //
- Status = gBS->LocateProtocol (
- &gEfiMpServiceProtocolGuid,
- NULL,
- (VOID **) &MpService
- );
- ASSERT_EFI_ERROR (Status);
-
- //
- // Determine the number of processors
- //
- MpService->GetNumberOfProcessors (
- MpService,
- &NumberOfCPUs,
- &NumberOfEnabledCPUs
- );
//
// By default, a table belongs in all ACPI table versions published.
@@ -160,158 +1271,69 @@ PlatformUpdateTables (
//
switch (Table->Signature) {
- case EFI_ACPI_1_0_APIC_SIGNATURE:
- //
- // if not MP and not APIC then don't publish the APIC tables.
- //
-
- //
- // Call for Local APIC ID Reorder
- //
- SortCpuLocalApicInTable (
- MpService,
- NumberOfCPUs,
- NumberOfEnabledCPUs
- );
-
- CurrPtr = (UINT8 *) &((EFI_ACPI_DESCRIPTION_HEADER *) Table)[1];
- CurrPtr = CurrPtr + 8;
- //
- // Size of Local APIC Address & Flag
- //
- EndPtr = (UINT8 *) Table;
- EndPtr = EndPtr + Table->Length;
-
- while (CurrPtr < EndPtr) {
- ApicPtr = (EFI_ACPI_1_0_PROCESSOR_LOCAL_APIC_STRUCTURE *) CurrPtr;
-
- //
- // Check table entry type
- //
- if (ApicPtr->Type == EFI_ACPI_1_0_PROCESSOR_LOCAL_APIC) {
- AppendCpuMapTableEntry (
- ApicPtr,
- NumberOfCPUs,
- NumberOfEnabledCPUs,
- LocalApicCounter
- );
- LocalApicCounter++;
- }
-
- //
- // Go to the next structure in the APIC table
- //
- CurrPtr = CurrPtr + ApicPtr->Length;
- }
+ case EFI_ACPI_4_0_MULTIPLE_APIC_DESCRIPTION_TABLE_SIGNATURE:
+ ASSERT(FALSE);
break;
case EFI_ACPI_5_0_FIXED_ACPI_DESCRIPTION_TABLE_SIGNATURE:
- //
- // Fix up all FACP Table values if configuration requires it.
- // This code fixes up the following Table values:
- // (1) C2/C3/CST Enable FACP values
- // (2) RTC S4 Flag
- //
- {
- EFI_ACPI_5_0_FIXED_ACPI_DESCRIPTION_TABLE *FadtPointer;
-
- FadtPointer = (EFI_ACPI_5_0_FIXED_ACPI_DESCRIPTION_TABLE *) Table;
-
- //
- // Check the version of the table
- //
- *Version = EFI_ACPI_TABLE_VERSION_NONE;
- if (FadtPointer->Header.Revision == EFI_ACPI_1_0_FIXED_ACPI_DESCRIPTION_TABLE_REVISION) {
- *Version = EFI_ACPI_TABLE_VERSION_NONE;
- } else if (FadtPointer->Header.Revision == EFI_ACPI_2_0_FIXED_ACPI_DESCRIPTION_TABLE_REVISION) {
- *Version = EFI_ACPI_TABLE_VERSION_1_0B | EFI_ACPI_TABLE_VERSION_2_0;
- } else if (FadtPointer->Header.Revision == EFI_ACPI_3_0_FIXED_ACPI_DESCRIPTION_TABLE_REVISION) {
- *Version = EFI_ACPI_TABLE_VERSION_1_0B | EFI_ACPI_TABLE_VERSION_3_0;
- } else if (FadtPointer->Header.Revision == EFI_ACPI_5_0_FIXED_ACPI_DESCRIPTION_TABLE_REVISION) {
- *Version = EFI_ACPI_TABLE_VERSION_1_0B | EFI_ACPI_TABLE_VERSION_5_0;
- }
-
- //
- // Modify Preferred_PM_Profile field based on Board SKU's. Default is set to Mobile
- //
- FadtPointer->PreferredPmProfile = PcdGet8 (PcdPreferredPmProfile);
-
- //
- // if Native ASPM is disabled, set FACP table to skip Native ASPM
- //
- if (!IsNativeAspmSupported ()) {
- FadtPointer->IaPcBootArch |= 0x10;
- }
-
- //
- //PME WAKE supported, set PCI_EXP_WAK, BIT14 of Fixed feature flags.
- //
- FadtPointer->Flags |= (EFI_ACPI_6_0_PCI_EXP_WAK);
-
- if (PcdGet8 (PcdLowPowerS0Idle)) {
- // The Flags field within the FADT (offset 112)
- // 1) will have a new Low Power S0 Idle Capable ACPI flag (bit offset 21).
- FadtPointer->Flags = (BIT21 | FadtPointer->Flags);
- //Only passive docking available in Conected Standby mode. Clear Docking capability Bit
- FadtPointer->Flags &= ~BIT9;
- }
- //
- // Modify FADT Fixed Feature Flag to support 10 sec Power button.
- // If 10sec Power button is enabled: Set PWR_BUTTON(bit4) in Fixed Feature Flag(FACP offset 112)
- //
- if ((PcdGet8 (PcdLowPowerS0Idle) == 1) || (PcdGet8 (PcdTenSecondPowerButtonEnable) == 1)) {
- FadtPointer->Flags |= EFI_ACPI_2_0_PWR_BUTTON; // Set Fixed Power Button flag (Disabling Fixed Power button and enabling Control Method PB)
- } else {
- FadtPointer->Flags &= ~(EFI_ACPI_2_0_PWR_BUTTON); // Clear fixed Power Button flag, means enable Power Button as Fixed PB
- }
-
- //
- // 1. set header revision.
- //
- FadtPointer->Header.Revision = EFI_ACPI_5_0_FIXED_ACPI_DESCRIPTION_TABLE_REVISION;
-
- //
- // 2. set all GAR register AccessSize to valid value.
- //
- ((EFI_ACPI_5_0_FIXED_ACPI_DESCRIPTION_TABLE *)FadtPointer)->ResetReg.AccessSize = EFI_ACPI_5_0_BYTE;
- ((EFI_ACPI_5_0_FIXED_ACPI_DESCRIPTION_TABLE *)FadtPointer)->XPm1aEvtBlk.AccessSize = EFI_ACPI_5_0_WORD;
- ((EFI_ACPI_5_0_FIXED_ACPI_DESCRIPTION_TABLE *)FadtPointer)->XPm1bEvtBlk.AccessSize = EFI_ACPI_5_0_WORD;
- ((EFI_ACPI_5_0_FIXED_ACPI_DESCRIPTION_TABLE *)FadtPointer)->XPm1aCntBlk.AccessSize = EFI_ACPI_5_0_WORD;
- ((EFI_ACPI_5_0_FIXED_ACPI_DESCRIPTION_TABLE *)FadtPointer)->XPm1bCntBlk.AccessSize = EFI_ACPI_5_0_WORD;
- ((EFI_ACPI_5_0_FIXED_ACPI_DESCRIPTION_TABLE *)FadtPointer)->XPm2CntBlk.AccessSize = EFI_ACPI_5_0_BYTE;
- ((EFI_ACPI_5_0_FIXED_ACPI_DESCRIPTION_TABLE *)FadtPointer)->XPmTmrBlk.AccessSize = EFI_ACPI_5_0_DWORD;
- ((EFI_ACPI_5_0_FIXED_ACPI_DESCRIPTION_TABLE *)FadtPointer)->XGpe0Blk.AccessSize = EFI_ACPI_5_0_BYTE;
- ((EFI_ACPI_5_0_FIXED_ACPI_DESCRIPTION_TABLE *)FadtPointer)->XGpe1Blk.AccessSize = EFI_ACPI_5_0_BYTE;
-
- ((EFI_ACPI_5_0_FIXED_ACPI_DESCRIPTION_TABLE *)FadtPointer)->SleepControlReg.AddressSpaceId = 0x1;
- ((EFI_ACPI_5_0_FIXED_ACPI_DESCRIPTION_TABLE *)FadtPointer)->SleepControlReg.RegisterBitWidth = 0x8;
- ((EFI_ACPI_5_0_FIXED_ACPI_DESCRIPTION_TABLE *)FadtPointer)->SleepControlReg.RegisterBitOffset = 0;
- ((EFI_ACPI_5_0_FIXED_ACPI_DESCRIPTION_TABLE *)FadtPointer)->SleepControlReg.AccessSize = EFI_ACPI_5_0_DWORD;
- ((EFI_ACPI_5_0_FIXED_ACPI_DESCRIPTION_TABLE *)FadtPointer)->SleepControlReg.Address = EFI_ACPI_PM1A_EVT_BLK_ADDRESS + 4;
-
- ((EFI_ACPI_5_0_FIXED_ACPI_DESCRIPTION_TABLE *)FadtPointer)->SleepStatusReg.AddressSpaceId = 0x1;
- ((EFI_ACPI_5_0_FIXED_ACPI_DESCRIPTION_TABLE *)FadtPointer)->SleepStatusReg.RegisterBitWidth = 0x8;
- ((EFI_ACPI_5_0_FIXED_ACPI_DESCRIPTION_TABLE *)FadtPointer)->SleepStatusReg.RegisterBitOffset = 0;
- ((EFI_ACPI_5_0_FIXED_ACPI_DESCRIPTION_TABLE *)FadtPointer)->SleepStatusReg.AccessSize = EFI_ACPI_5_0_DWORD;
- ((EFI_ACPI_5_0_FIXED_ACPI_DESCRIPTION_TABLE *)FadtPointer)->SleepStatusReg.Address = EFI_ACPI_PM1A_EVT_BLK_ADDRESS;
-
+ FadtHeader = (EFI_ACPI_5_0_FIXED_ACPI_DESCRIPTION_TABLE *) Table;
+
+ FadtHeader->PreferredPmProfile = PcdGet8 (PcdFadtPreferredPmProfile);
+ FadtHeader->IaPcBootArch = PcdGet16 (PcdFadtIaPcBootArch);
+ FadtHeader->Flags = PcdGet32 (PcdFadtFlags);
+
+ FadtHeader->AcpiEnable = PcdGet8 (PcdAcpiEnableSwSmi);
+ FadtHeader->AcpiDisable = PcdGet8 (PcdAcpiDisableSwSmi);
+
+ FadtHeader->Pm1aEvtBlk = PcdGet16 (PcdAcpiPm1AEventBlockAddress);
+ FadtHeader->Pm1bEvtBlk = PcdGet16 (PcdAcpiPm1BEventBlockAddress);
+ FadtHeader->Pm1aCntBlk = PcdGet16 (PcdAcpiPm1AControlBlockAddress);
+ FadtHeader->Pm1bCntBlk = PcdGet16 (PcdAcpiPm1BControlBlockAddress);
+ FadtHeader->Pm2CntBlk = PcdGet16 (PcdAcpiPm2ControlBlockAddress);
+ FadtHeader->PmTmrBlk = PcdGet16 (PcdAcpiPmTimerBlockAddress);
+ FadtHeader->Gpe0Blk = PcdGet16 (PcdAcpiGpe0BlockAddress);
+ FadtHeader->Gpe0BlkLen = 0x20;
+ FadtHeader->Gpe1Blk = PcdGet16 (PcdAcpiGpe1BlockAddress);
+
+ FadtHeader->XPm1aEvtBlk.Address = PcdGet16 (PcdAcpiPm1AEventBlockAddress);
+ FadtHeader->XPm1bEvtBlk.Address = PcdGet16 (PcdAcpiPm1BEventBlockAddress);
+ if (FadtHeader->XPm1bEvtBlk.Address == 0) {
+ FadtHeader->XPm1bEvtBlk.AccessSize = 0;
+ }
+ FadtHeader->XPm1aCntBlk.Address = PcdGet16 (PcdAcpiPm1AControlBlockAddress);
+ FadtHeader->XPm1bCntBlk.Address = PcdGet16 (PcdAcpiPm1BControlBlockAddress);
+ if (FadtHeader->XPm1bCntBlk.Address == 0) {
+ FadtHeader->XPm1bCntBlk.AccessSize = 0;
+ }
+ FadtHeader->XPm2CntBlk.Address = PcdGet16 (PcdAcpiPm2ControlBlockAddress);
+ //if (FadtHeader->XPm2CntBlk.Address == 0) {
+ FadtHeader->XPm2CntBlk.AccessSize = 0;
+ //}
+ FadtHeader->XPmTmrBlk.Address = PcdGet16 (PcdAcpiPmTimerBlockAddress);
+ FadtHeader->XGpe0Blk.Address = PcdGet16 (PcdAcpiGpe0BlockAddress);
+ FadtHeader->XGpe1Blk.Address = PcdGet16 (PcdAcpiGpe1BlockAddress);
+ if (FadtHeader->XGpe1Blk.Address == 0) {
+ FadtHeader->XGpe1Blk.AccessSize = 0;
}
+
+ DEBUG(( EFI_D_ERROR, "ACPI FADT table @ address 0x%x\n", Table ));
+ DEBUG(( EFI_D_ERROR, " IaPcBootArch 0x%x\n", FadtHeader->IaPcBootArch ));
+ DEBUG(( EFI_D_ERROR, " Flags 0x%x\n", FadtHeader->Flags ));
break;
case EFI_ACPI_3_0_HIGH_PRECISION_EVENT_TIMER_TABLE_SIGNATURE:
- //
- // If HPET is disabled in setup, don't publish the table.
- //
- //
- // Get HPET base address
- //
- HpetBaseAdress = PcdGet32 (PcdHpetBaseAddress);
- //
- // Adjust HPET Table to correct the Base Address
- //
- ((EFI_ACPI_HIGH_PRECISION_EVENT_TIMER_TABLE_HEADER*) Table)->BaseAddressLower32Bit.Address = HpetBaseAdress;
+ HpetTable = (EFI_ACPI_HIGH_PRECISION_EVENT_TIMER_TABLE_HEADER *)Table;
+ HpetTable->BaseAddressLower32Bit.Address = PcdGet32 (PcdHpetBaseAddress);
+ HpetTable->BaseAddressLower32Bit.RegisterBitWidth = 0;
+ HpetTable->EventTimerBlockId = PcdGet32 (PcdHpetTimerBlockId);
+ DEBUG(( EFI_D_ERROR, "ACPI HPET table @ address 0x%x\n", Table ));
+ DEBUG(( EFI_D_ERROR, " HPET base 0x%x\n", PcdGet32 (PcdHpetBaseAddress) ));
break;
-
+
+ case EFI_ACPI_3_0_PCI_EXPRESS_MEMORY_MAPPED_CONFIGURATION_SPACE_BASE_ADDRESS_DESCRIPTION_TABLE_SIGNATURE:
+ ASSERT(FALSE);
+ break;
+
default:
break;
}
@@ -422,35 +1444,24 @@ UpdateLocalTable (
EFI_ACPI_COMMON_HEADER *CurrentTable;
EFI_ACPI_TABLE_VERSION Version;
UINTN TableHandle;
- EFI_ACPI_TABLE_PROTOCOL *AcpiTable;
UINTN Index;
- Status = gBS->LocateProtocol (
- &gEfiAcpiTableProtocolGuid,
- NULL,
- (VOID **)&AcpiTable
- );
-
for (Index = 0; Index < sizeof(mLocalTable)/sizeof(mLocalTable[0]); Index++) {
CurrentTable = mLocalTable[Index];
- PlatformUpdateTables (CurrentTable, &Version);
+ PlatformUpdateTables (CurrentTable, &Version);
- //
- // Add the table
- //
- TableHandle = 0;
+ TableHandle = 0;
- if (Version != EFI_ACPI_TABLE_VERSION_NONE) {
- Status = AcpiTable->InstallAcpiTable (
- AcpiTable,
+ if (Version != EFI_ACPI_TABLE_VERSION_NONE) {
+ Status = mAcpiTable->InstallAcpiTable (
+ mAcpiTable,
CurrentTable,
CurrentTable->Length,
&TableHandle
);
- }
-
ASSERT_EFI_ERROR (Status);
+ }
}
}
@@ -495,6 +1506,13 @@ InstallAcpiPlatform (
EFI_STATUS Status;
EFI_EVENT EndOfDxeEvent;
+
+ Status = gBS->LocateProtocol (&gEfiMpServiceProtocolGuid, NULL, (VOID **)&mMpService);
+ ASSERT_EFI_ERROR (Status);
+
+ Status = gBS->LocateProtocol (&gEfiAcpiTableProtocolGuid, NULL, (VOID **)&mAcpiTable);
+ ASSERT_EFI_ERROR (Status);
+
//
// Create an End of DXE event.
//
@@ -509,227 +1527,29 @@ InstallAcpiPlatform (
ASSERT_EFI_ERROR (Status);
//
- // Update local table
- //
- UpdateLocalTable ();
-
- //
- // Finished
- //
- return EFI_SUCCESS;
-}
-
-/**
- Sort ordering of CPUs according to the priorities of cores and threads.
- ** ASSUMPTION: 1) single CPU package systsem wide; 2) two threads per core
-
- @param[in] MpService The MP servicde protocol (used to retrievel MP info)
- @param[in] NumberOfCPUs Number of CPUs
- @param[in] NumberOfEnabledCPUs Number of Enabled CPUs.
-
- @retval EFI_SUCCESS The driver installed without error.
-
-**/
-EFI_STATUS
-SortCpuLocalApicInTable (
- IN EFI_MP_SERVICES_PROTOCOL *MpService,
- IN UINTN NumberOfCPUs,
- IN UINTN NumberOfEnabledCPUs
- )
-{
- EFI_PROCESSOR_INFORMATION *MpContext;
- INTN Index2;
- UINTN Index1;
- UINTN Index;
- UINT8 CpuThreadIndex;
- UINTN BspIndex;
- UINT8 CurrProcessor;
- EFI_STATUS Status;
- UINT8 MaxCpuPackage;
- UINT8 MaxCpuCore;
- UINT8 MaxCpuThread;
-
- MpContext = NULL;
- MaxCpuPackage = 0;
- MaxCpuCore = 0;
- MaxCpuThread = 0;
-
- Status = MpService->WhoAmI (
- MpService,
- &BspIndex
- );
-
- //
- // Fill mCpuApicIdOrderTable
- //
- for (CurrProcessor = 0; CurrProcessor < NumberOfCPUs; CurrProcessor++) {
-
- MpContext = AllocatePool (sizeof(EFI_PROCESSOR_INFORMATION));
- ASSERT (MpContext != NULL);
- Status = MpService->GetProcessorInfo (
- MpService,
- CurrProcessor,
- MpContext
- );
- ASSERT_EFI_ERROR (Status);
-
- if (MpContext == NULL) {
- return Status;
- }
- mCpuApicIdOrderTable[CurrProcessor].ApicId = (UINT8) MpContext->ProcessorId;
- DEBUG((DEBUG_INFO, "The CurrProcessor 0x%x ApicId is 0x%x\n", CurrProcessor, mCpuApicIdOrderTable[CurrProcessor].ApicId));
- mCpuApicIdOrderTable[CurrProcessor].Flags = (MpContext->StatusFlag | PROCESSOR_ENABLED_BIT)? 1: 0;
- mCpuApicIdOrderTable[CurrProcessor].Package = (UINT8) MpContext->Location.Package;
- mCpuApicIdOrderTable[CurrProcessor].Die = (UINT8) 0;
- mCpuApicIdOrderTable[CurrProcessor].Core = (UINT8) MpContext->Location.Core;
- mCpuApicIdOrderTable[CurrProcessor].Thread = (UINT8) MpContext->Location.Thread;
-
- if (MaxCpuThread < (UINT8) MpContext->Location.Thread) {
- MaxCpuThread = (UINT8) MpContext->Location.Thread;
- }
-
- if (MaxCpuCore < (UINT8) MpContext->Location.Core) {
- MaxCpuCore = (UINT8) MpContext->Location.Core;
- }
-
- if (MaxCpuPackage < (UINT8) MpContext->Location.Package) {
- MaxCpuPackage = (UINT8) MpContext->Location.Package;
- }
- }
-
- //
- // Do some statistics about the SBSP package
- //
- for (CurrProcessor = 0; CurrProcessor < NumberOfCPUs; CurrProcessor++) {
- if (CurrProcessor == BspIndex) {
- mSbspPackageInfo.BspApicId = mCpuApicIdOrderTable[CurrProcessor].ApicId;
- mSbspPackageInfo.PackageNo = mCpuApicIdOrderTable[CurrProcessor].Package;
- mSbspPackageInfo.TotalThreads = 0;
- mSbspPackageInfo.CoreNo = 0;
- mSbspPackageInfo.LogicalThreadNo = 0;
- }
- }
-
- for (CurrProcessor = 0; CurrProcessor < NumberOfCPUs; CurrProcessor++) {
- if (mCpuApicIdOrderTable[CurrProcessor].Package == mSbspPackageInfo.PackageNo) {
- mSbspPackageInfo.TotalThreads++;
- if (mCpuApicIdOrderTable[CurrProcessor].Thread == 0) {
- mSbspPackageInfo.CoreNo++;
- } else {
- mSbspPackageInfo.LogicalThreadNo++;
- }
- }
- }
-
- //
- // Output debug info
- //
- for (Index = 0; Index < NumberOfCPUs; Index++) {
- DEBUG((DEBUG_INFO, "Package = %x, Die = %x, Core = %x, Thread = %x, ApicId = %x\n", \
- mCpuApicIdOrderTable[Index].Package, \
- mCpuApicIdOrderTable[Index].Die, \
- mCpuApicIdOrderTable[Index].Core, \
- mCpuApicIdOrderTable[Index].Thread, \
- mCpuApicIdOrderTable[Index].ApicId));
- }
-
- DEBUG((DEBUG_INFO, "MaxCpuPackage = %x\n", MaxCpuPackage));
- DEBUG((DEBUG_INFO, "MaxCpuCore = %x\n", MaxCpuCore));
- DEBUG((DEBUG_INFO, "MaxCpuThread = %x\n\n", MaxCpuThread));
- DEBUG((DEBUG_INFO, "mSbspPackageInfo.BspApicId = %x\n", mSbspPackageInfo.BspApicId));
- DEBUG((DEBUG_INFO, "mSbspPackageInfo.TotalThreads = %x\n", mSbspPackageInfo.TotalThreads));
- DEBUG((DEBUG_INFO, "mSbspPackageInfo.PackageNo = %x\n", mSbspPackageInfo.PackageNo));
- DEBUG((DEBUG_INFO, "mSbspPackageInfo.CoreNo = %x\n", mSbspPackageInfo.CoreNo));
- DEBUG((DEBUG_INFO, "mSbspPackageInfo.LogicalThreadNo = %x\n", mSbspPackageInfo.LogicalThreadNo));
-
- //
- // First entry is always SBSP
- //
- CurrProcessor = 0;
- mCpuApicIdReorderTable[CurrProcessor].ApicId = mSbspPackageInfo.BspApicId;
- mCpuApicIdReorderTable[CurrProcessor].Package = mSbspPackageInfo.PackageNo;
- mCpuApicIdReorderTable[CurrProcessor].Flags = 1;
- CurrProcessor++;
-
- //
- // Reorder Core and threads
- //
- for (Index2 = -1; Index2 <= MaxCpuPackage; Index2 ++) {
- INTN PackageIndex;
-
- PackageIndex = Index2;
- if (Index2 == -1) {
- // add Sbsp as first
- PackageIndex = mSbspPackageInfo.PackageNo;
- } else if (Index2 == mSbspPackageInfo.PackageNo) {
- // Skip Sbsp
- continue;
- }
- for (Index1 = 0; Index1 <= MaxCpuThread; Index1 ++) {
- for (Index = 0; Index <= MaxCpuCore; Index++) {
- for (CpuThreadIndex = 0; CpuThreadIndex < NumberOfCPUs; CpuThreadIndex++) {
- if ((mCpuApicIdOrderTable[CpuThreadIndex].Package == PackageIndex) &&
- (mCpuApicIdOrderTable[CpuThreadIndex].Thread == Index1) &&
- (mCpuApicIdOrderTable[CpuThreadIndex].Core == Index) &&
- (mCpuApicIdOrderTable[CpuThreadIndex].ApicId != mCpuApicIdReorderTable[0].ApicId)) {
- mCpuApicIdReorderTable[CurrProcessor].ApicId = mCpuApicIdOrderTable[CpuThreadIndex].ApicId;
- mCpuApicIdReorderTable[CurrProcessor].Package = (UINT8)PackageIndex;
- mCpuApicIdReorderTable[CurrProcessor].Flags = mCpuApicIdOrderTable[CpuThreadIndex].Flags;
- CurrProcessor++;
- break;
- }
- }
- }
- }
- }
-
- //
- // Output debug info
+ // Determine the number of processors
//
- for (Index = 0; Index < NumberOfCPUs; Index++) {
- DEBUG((DEBUG_INFO, "Index = %x, ApicId = %x, Package = %x\n", \
- Index, \
- mCpuApicIdReorderTable[Index].ApicId, \
- mCpuApicIdReorderTable[Index].Package));
- }
-
- FreePool (MpContext);
+ mMpService->GetNumberOfProcessors (
+ mMpService,
+ &mNumberOfCPUs,
+ &mNumberOfEnabledCPUs
+ );
+ ASSERT (mNumberOfCPUs <= MAX_CPU_NUM && mNumberOfEnabledCPUs >= 1);
+ DEBUG ((DEBUG_INFO, "mNumberOfCPUs - %d\n", mNumberOfCPUs));
+ DEBUG ((DEBUG_INFO, "mNumberOfEnabledCPUs - %d\n", mNumberOfEnabledCPUs));
- return EFI_SUCCESS;
-}
+ DEBUG ((DEBUG_INFO, "mX2ApicEnabled - 0x%x\n", mX2ApicEnabled));
+ DEBUG ((DEBUG_INFO, "mForceX2ApicId - 0x%x\n", mForceX2ApicId));
+ // support up to 64 threads/socket
+ AsmCpuidEx(CPUID_EXTENDED_TOPOLOGY, 1, &mNumOfBitShift, NULL, NULL, NULL);
+ mNumOfBitShift &= 0x1F;
+ DEBUG ((DEBUG_INFO, "mNumOfBitShift - 0x%x\n", mNumOfBitShift));
-EFI_STATUS
-AppendCpuMapTableEntry (
- IN EFI_ACPI_1_0_PROCESSOR_LOCAL_APIC_STRUCTURE *AcpiLocalApic,
- IN UINTN NumberOfCPUs,
- IN UINTN NumberOfEnabledCPUs,
- IN UINT8 LocalApicCounter
- )
-{
- if (LocalApicCounter < NumberOfCPUs) {
- AcpiLocalApic->Flags = mCpuApicIdReorderTable[LocalApicCounter].Flags;
- AcpiLocalApic->ApicId = mCpuApicIdReorderTable[LocalApicCounter].ApicId;
- //
- // Make AcpiProcessorIds 1-based, matching the ones in Processor() definitions
- //
- AcpiLocalApic->AcpiProcessorId = LocalApicCounter + 1;
- } else {
- AcpiLocalApic->Flags = 0;
- AcpiLocalApic->ApicId = 0xFF;
- //
- // Make AcpiProcessorIds 1-based, matching the ones in Processor() definitions
- //
- AcpiLocalApic->AcpiProcessorId = LocalApicCounter + 1;
- }
+ UpdateLocalTable ();
- //
- // Display the results
- //
- DEBUG((DEBUG_INFO, "AcpiLocalApic: AcpiProcessorId=%x, ApicId=%x, Flags=%x\n", \
- AcpiLocalApic->AcpiProcessorId, \
- AcpiLocalApic->ApicId, \
- AcpiLocalApic->Flags));
+ InstallMadtFromScratch ();
+ InstallMcfgFromScratch ();
return EFI_SUCCESS;
}
diff --git a/Platform/Intel/MinPlatformPkg/Acpi/AcpiTables/AcpiPlatform.h b/Platform/Intel/MinPlatformPkg/Acpi/AcpiTables/AcpiPlatform.h
index 3ba9b02340..76df7fb761 100644
--- a/Platform/Intel/MinPlatformPkg/Acpi/AcpiTables/AcpiPlatform.h
+++ b/Platform/Intel/MinPlatformPkg/Acpi/AcpiTables/AcpiPlatform.h
@@ -23,6 +23,9 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
#include <Uefi.h>
#include <IndustryStandard/Pci30.h>
#include <IndustryStandard/Acpi.h>
+#include <IndustryStandard/HighPrecisionEventTimerTable.h>
+#include <IndustryStandard/MemoryMappedConfigurationSpaceAccessTable.h>
+#include <IndustryStandard/WindowsSmmSecurityMitigationTable.h>
#include <Guid/EventGroup.h>
#include <Guid/GlobalVariable.h>
#include <Library/UefiLib.h>
@@ -35,6 +38,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
#include <Library/BoardAcpiTableLib.h>
#include <Library/MemoryAllocationLib.h>
#include <Library/AslUpdateLib.h>
+#include <Library/PciSegmentInfoLib.h>
#include <Protocol/AcpiTable.h>
#include <Protocol/MpService.h>
@@ -42,87 +46,4 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
#include <Register/Cpuid.h>
-#include "Fadt/Fadt.h"
-#include "Facs/Facs.h"
-#include "Madt/Madt.h"
-#include "Mcfg/Mcfg.h"
-#include "Hpet/Hpet.h"
-#include "Wsmt/Wsmt.h"
-
-//
-// ACPI table information used to initialize tables.
-//
-#define EFI_ACPI_OEM_ID "INTEL "
-#define ACPI_OEM_TABLE_ID_SKL 0x4C4B53 // SKL
-#define ACPI_OEM_TABLE_ID_SKL_ULT 0x544C552D4C4B53 // SKL-ULT
-#define ACPI_OEM_TABLE_ID_SKL_SDS 0x5344532D4C4B53 // SKL-SDS
-#define ACPI_OEM_TABLE_ID_KBL 0x4C424B // KBL
-#define ACPI_OEM_TABLE_ID_KBL_ULT 0x544C552D4C424B // KBL-ULT
-#define ACPI_OEM_TABLE_ID_KBL_SDS 0x5344532D4C424B // KBL-SDS
-#define ACPI_OEM_TABLE_ID_UNKNOWN 0x304E574F4E4B4E55 // "UNKNOWN0"
-#define EFI_ACPI_OEM_REVISION 0x00000001
-#define EFI_ACPI_CREATOR_ID 0x5446534D // "MSFT"
-#define EFI_ACPI_CREATOR_REVISION 0x00000005F
-
-#define MAX_CPU_NUM 16
-
-typedef struct {
- UINT8 ApicId;
- UINT32 Flags;
- UINT8 Package;
- UINT8 Die;
- UINT8 Core;
- UINT8 Thread;
-} EFI_CPU_ID_ORDER_MAP;
-
-typedef struct {
- UINT8 Package;
- UINT8 ApicId;
- UINT32 Flags;
-} EFI_CPU_APIC_ID_REORDER_MAP;
-
-typedef struct {
- UINT8 BspApicId;
- UINT8 TotalThreads;
- UINT8 PackageNo;
- UINT8 CoreNo;
- UINT8 LogicalThreadNo;
-} EFI_CPU_PACKAGE_INFO;
-
-//
-// Function definitions
-//
-
-/**
- Entry point of the ACPI platform driver.
-
- @param[in] ImageHandle A handle for the image that is initializing this driver
- @param[in] SystemTable A pointer to the EFI system table
-
- @retval EFI_SUCCESS The driver installed without error.
- @retval EFI_ABORTED The driver encountered an error and could not complete
- installation of the ACPI tables.
-**/
-EFI_STATUS
-EFIAPI
-InstallAcpiPlatform (
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
- );
-
-EFI_STATUS
-SortCpuLocalApicInTable (
- IN EFI_MP_SERVICES_PROTOCOL *MpService,
- IN UINTN NumberOfCPUs,
- IN UINTN NumberOfEnabledCPUs
- );
-
-EFI_STATUS
-AppendCpuMapTableEntry (
- IN EFI_ACPI_1_0_PROCESSOR_LOCAL_APIC_STRUCTURE *AcpiLocalApic,
- IN UINTN NumberOfCPUs,
- IN UINTN NumberOfEnabledCPUs,
- IN UINT8 LocalApicCounter
- );
-
#endif
diff --git a/Platform/Intel/MinPlatformPkg/Acpi/AcpiTables/AcpiPlatform.inf b/Platform/Intel/MinPlatformPkg/Acpi/AcpiTables/AcpiPlatform.inf
index 6e4429dfe3..dabf28fde7 100644
--- a/Platform/Intel/MinPlatformPkg/Acpi/AcpiTables/AcpiPlatform.inf
+++ b/Platform/Intel/MinPlatformPkg/Acpi/AcpiTables/AcpiPlatform.inf
@@ -27,8 +27,6 @@
Fadt/Fadt.c
Facs/Facs.c
Hpet/Hpet.c
- Madt/Madt.c
- Mcfg/Mcfg.c
Wsmt/Wsmt.c
[Packages]
@@ -48,21 +46,35 @@
UefiRuntimeServicesTableLib
BaseMemoryLib
HobLib
+ PciSegmentInfoLib
AslUpdateLib
BoardAcpiTableLib
[Pcd]
- gEfiMdePkgTokenSpaceGuid.PcdPciExpressBaseAddress ## CONSUMES
- gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiDefaultOemTableId ## CONSUMES
- gPcAtChipsetPkgTokenSpaceGuid.PcdHpetBaseAddress
+ gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiDefaultOemId
+ gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiDefaultOemTableId
+ gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiDefaultCreatorId
+ gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiDefaultCreatorRevision
+
+ gMinPlatformPkgTokenSpaceGuid.PcdPcIoApicEnable
+ gMinPlatformPkgTokenSpaceGuid.PcdPcIoApicCount
+ gMinPlatformPkgTokenSpaceGuid.PcdPcIoApicIdBase
+ gMinPlatformPkgTokenSpaceGuid.PcdPcIoApicAddressBase
+ gMinPlatformPkgTokenSpaceGuid.PcdPcIoApicInterruptBase
+ gMinPlatformPkgTokenSpaceGuid.PcdMaxCpuThreadCount
+ gMinPlatformPkgTokenSpaceGuid.PcdMaxCpuCoreCount
+ gMinPlatformPkgTokenSpaceGuid.PcdMaxCpuSocketCount
- gMinPlatformPkgTokenSpaceGuid.PcdPreferredPmProfile
- gMinPlatformPkgTokenSpaceGuid.PcdLowPowerS0Idle
- gMinPlatformPkgTokenSpaceGuid.PcdTenSecondPowerButtonEnable
- gMinPlatformPkgTokenSpaceGuid.PcdPciExpNative
- gMinPlatformPkgTokenSpaceGuid.PcdNativeAspmEnable
+ gMinPlatformPkgTokenSpaceGuid.PcdFadtPreferredPmProfile
+ gMinPlatformPkgTokenSpaceGuid.PcdFadtIaPcBootArch
+ gMinPlatformPkgTokenSpaceGuid.PcdFadtFlags
-[FixedPcd]
+ gPcAtChipsetPkgTokenSpaceGuid.PcdHpetBaseAddress
+ gMinPlatformPkgTokenSpaceGuid.PcdHpetTimerBlockId
+ gEfiMdePkgTokenSpaceGuid.PcdPciExpressBaseAddress
+ gMinPlatformPkgTokenSpaceGuid.PcdPciExpressRegionLength
+ gMinPlatformPkgTokenSpaceGuid.PcdAcpiEnableSwSmi
+ gMinPlatformPkgTokenSpaceGuid.PcdAcpiDisableSwSmi
gMinPlatformPkgTokenSpaceGuid.PcdAcpiPm1AEventBlockAddress
gMinPlatformPkgTokenSpaceGuid.PcdAcpiPm1BEventBlockAddress
gMinPlatformPkgTokenSpaceGuid.PcdAcpiPm1AControlBlockAddress
@@ -71,13 +83,13 @@
gMinPlatformPkgTokenSpaceGuid.PcdAcpiPmTimerBlockAddress
gMinPlatformPkgTokenSpaceGuid.PcdAcpiGpe0BlockAddress
gMinPlatformPkgTokenSpaceGuid.PcdAcpiGpe1BlockAddress
- gMinPlatformPkgTokenSpaceGuid.PcdPciExpressRegionLength
- gMinPlatformPkgTokenSpaceGuid.PcdApicLocalAddress ## CONSUMES
- gMinPlatformPkgTokenSpaceGuid.PcdApicIoAddress ## CONSUMES
- gMinPlatformPkgTokenSpaceGuid.PcdAcpiEnableSwSmi ## CONSUMES
- gMinPlatformPkgTokenSpaceGuid.PcdAcpiDisableSwSmi ## CONSUMES
- gMinPlatformPkgTokenSpaceGuid.PcdApicIoIdPch ## CONSUMES
+ gMinPlatformPkgTokenSpaceGuid.PcdLocalApicAddress
+ gMinPlatformPkgTokenSpaceGuid.PcdIoApicAddress
+ gMinPlatformPkgTokenSpaceGuid.PcdIoApicId
+
+ gUefiCpuPkgTokenSpaceGuid.PcdCpuMaxLogicalProcessorNumber
+ gMinPlatformPkgTokenSpaceGuid.PcdMaxCpuSocketCount
gMinPlatformPkgTokenSpaceGuid.PcdWsmtProtectionFlags
diff --git a/Platform/Intel/MinPlatformPkg/Acpi/AcpiTables/Facs/Facs.c b/Platform/Intel/MinPlatformPkg/Acpi/AcpiTables/Facs/Facs.c
index 5cc44182af..b454a8ddc1 100644
--- a/Platform/Intel/MinPlatformPkg/Acpi/AcpiTables/Facs/Facs.c
+++ b/Platform/Intel/MinPlatformPkg/Acpi/AcpiTables/Facs/Facs.c
@@ -18,7 +18,23 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
// Statements that include other files
//
-#include "Facs.h"
+#include <IndustryStandard/Acpi.h>
+
+//
+// FACS Definitions
+//
+#define EFI_ACPI_FIRMWARE_WAKING_VECTOR 0x00000000
+#define EFI_ACPI_GLOBAL_LOCK 0x00000000
+
+//
+// Firmware Control Structure Feature Flags are defined in AcpiX.0.h
+//
+#define EFI_ACPI_FIRMWARE_CONTROL_STRUCTURE_FLAGS 0x00000000
+
+#define EFI_ACPI_X_FIRMWARE_WAKING_VECTOR 0x0000000000000000
+
+#define EFI_ACPI_OSPM_FLAGS 0x00000000
+
//
// Firmware ACPI Control Structure
@@ -44,7 +60,7 @@ EFI_ACPI_5_0_FIRMWARE_ACPI_CONTROL_STRUCTURE Facs = {
EFI_ACPI_RESERVED_BYTE,
EFI_ACPI_RESERVED_BYTE
},
- EFI_ACPI_RESERVED_DWORD, //EFI_ACPI_5_0_OSPM_64BIT_WAKE_F
+ EFI_ACPI_OSPM_FLAGS,
{
EFI_ACPI_RESERVED_BYTE,
EFI_ACPI_RESERVED_BYTE,
diff --git a/Platform/Intel/MinPlatformPkg/Acpi/AcpiTables/Facs/Facs.h b/Platform/Intel/MinPlatformPkg/Acpi/AcpiTables/Facs/Facs.h
deleted file mode 100644
index 4254d9c4b2..0000000000
--- a/Platform/Intel/MinPlatformPkg/Acpi/AcpiTables/Facs/Facs.h
+++ /dev/null
@@ -1,42 +0,0 @@
-/** @file
- This file describes the contents of the ACPI Firmware ACPI Control
- Structure (FACS). All changes to the FACS contents should be done
- in this file.
-
-Copyright (c) 2017, Intel Corporation. All rights reserved.<BR>
-This program and the accompanying materials are licensed and made available under
-the terms and conditions of the BSD License that accompanies this distribution.
-The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php.
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-**/
-
-#ifndef _FACS_H_
-#define _FACS_H_
-
-//
-// Statements that include other files
-//
-
-#include <IndustryStandard/Acpi50.h>
-
-//
-// FACS Definitions
-//
-
-#define EFI_ACPI_FIRMWARE_WAKING_VECTOR 0x00000000
-#define EFI_ACPI_GLOBAL_LOCK 0x00000000
-
-//
-// Firmware Control Structure Feature Flags are defined in AcpiX.0.h
-//
-#define EFI_ACPI_FIRMWARE_CONTROL_STRUCTURE_FLAGS 0x00000000
-
-#define EFI_ACPI_X_FIRMWARE_WAKING_VECTOR 0x0000000000000000
-
-extern EFI_ACPI_5_0_FIRMWARE_ACPI_CONTROL_STRUCTURE Facs;
-
-#endif
diff --git a/Platform/Intel/MinPlatformPkg/Acpi/AcpiTables/Fadt/Fadt.c b/Platform/Intel/MinPlatformPkg/Acpi/AcpiTables/Fadt/Fadt.c
index 0eb1328332..0def9f6c2b 100644
--- a/Platform/Intel/MinPlatformPkg/Acpi/AcpiTables/Fadt/Fadt.c
+++ b/Platform/Intel/MinPlatformPkg/Acpi/AcpiTables/Fadt/Fadt.c
@@ -17,8 +17,151 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
//
// Statements that include other files
//
+#include <IndustryStandard/Acpi.h>
-#include "Fadt.h"
+//
+// FADT Definitions
+//
+#define EFI_ACPI_OEM_FADT_REVISION 0x00000000
+
+#define EFI_ACPI_PREFERRED_PM_PROFILE 0x00 // To be fixed
+
+#define EFI_ACPI_SCI_INT 0x0009
+#define EFI_ACPI_SMI_CMD 0x000000B2
+
+#define EFI_ACPI_ACPI_ENABLE 0 // To be fixed
+#define EFI_ACPI_ACPI_DISABLE 0 // To be fixed
+#define EFI_ACPI_S4_BIOS_REQ 0x00
+#define EFI_ACPI_CST_CNT 0x00
+
+#define EFI_ACPI_PSTATE_CNT 0x00
+#define EFI_ACPI_GPE1_BASE (EFI_ACPI_GPE1_BLK_BIT_WIDTH / 2)
+#define EFI_ACPI_P_LVL2_LAT 0x0065 // 101
+#define EFI_ACPI_P_LVL3_LAT 0x03E9 // 1001
+#define EFI_ACPI_FLUSH_SIZE 0x0000
+#define EFI_ACPI_FLUSH_STRIDE 0x0000
+#define EFI_ACPI_DUTY_OFFSET 0x01
+#define EFI_ACPI_DUTY_WIDTH 0x00
+
+#define EFI_ACPI_DAY_ALRM 0x0D
+#define EFI_ACPI_MON_ALRM 0x00
+#define EFI_ACPI_CENTURY 0x32
+
+//
+// IA-PC Boot Architecture Flags
+//
+
+#define EFI_ACPI_IAPC_BOOT_ARCH 0 // To be fixed
+
+//
+// Fixed Feature Flags
+//
+#define EFI_ACPI_FIXED_FEATURE_FLAGS 0 // To be fixed
+
+//
+// PM1A Event Register Block Generic Address Information
+//
+#define EFI_ACPI_PM1A_EVT_BLK_ADDRESS_SPACE_ID EFI_ACPI_2_0_SYSTEM_IO
+#define EFI_ACPI_PM1A_EVT_BLK_BIT_WIDTH 0x20
+#define EFI_ACPI_PM1A_EVT_BLK_BIT_OFFSET 0x00
+#define EFI_ACPI_PM1A_EVT_BLK_ADDRESS 0 // To be fixed
+
+//
+// PM1B Event Register Block Generic Address Information
+//
+#define EFI_ACPI_PM1B_EVT_BLK_ADDRESS_SPACE_ID EFI_ACPI_2_0_SYSTEM_IO
+#define EFI_ACPI_PM1B_EVT_BLK_BIT_WIDTH 0x00
+#define EFI_ACPI_PM1B_EVT_BLK_BIT_OFFSET 0x00
+#define EFI_ACPI_PM1B_EVT_BLK_ADDRESS 0 // To be fixed
+
+//
+// PM1A Control Register Block Generic Address Information
+//
+#define EFI_ACPI_PM1A_CNT_BLK_ADDRESS_SPACE_ID EFI_ACPI_2_0_SYSTEM_IO
+#define EFI_ACPI_PM1A_CNT_BLK_BIT_WIDTH 0x10
+#define EFI_ACPI_PM1A_CNT_BLK_BIT_OFFSET 0x00
+#define EFI_ACPI_PM1A_CNT_BLK_ADDRESS 0 // To be fixed
+
+//
+// PM1B Control Register Block Generic Address Information
+//
+#define EFI_ACPI_PM1B_CNT_BLK_ADDRESS_SPACE_ID EFI_ACPI_2_0_SYSTEM_IO
+#define EFI_ACPI_PM1B_CNT_BLK_BIT_WIDTH 0x00
+#define EFI_ACPI_PM1B_CNT_BLK_BIT_OFFSET 0x00
+#define EFI_ACPI_PM1B_CNT_BLK_ADDRESS 0 // To be fixed
+
+//
+// PM2 Control Register Block Generic Address Information
+//
+#define EFI_ACPI_PM2_CNT_BLK_ADDRESS_SPACE_ID EFI_ACPI_2_0_SYSTEM_IO
+#define EFI_ACPI_PM2_CNT_BLK_BIT_WIDTH 0x08
+#define EFI_ACPI_PM2_CNT_BLK_BIT_OFFSET 0x00
+#define EFI_ACPI_PM2_CNT_BLK_ADDRESS 0 // To be fixed
+
+//
+// Power Management Timer Control Register Block Generic Address
+// Information
+//
+#define EFI_ACPI_PM_TMR_BLK_ADDRESS_SPACE_ID EFI_ACPI_2_0_SYSTEM_IO
+#define EFI_ACPI_PM_TMR_BLK_BIT_WIDTH 0x20
+#define EFI_ACPI_PM_TMR_BLK_BIT_OFFSET 0x00
+#define EFI_ACPI_PM_TMR_BLK_ADDRESS 0 // To be fixed
+
+//
+// General Purpose Event 0 Register Block Generic Address
+// Information
+//
+#define EFI_ACPI_GPE0_BLK_ADDRESS_SPACE_ID EFI_ACPI_2_0_SYSTEM_IO
+#define EFI_ACPI_GPE0_BLK_BIT_WIDTH 0 // size of R_PCH_ACPI_GPE0_STS_127_96 + R_PCH_ACPI_GPE0_EN_127_96
+#define EFI_ACPI_GPE0_BLK_BIT_OFFSET 0x00
+#define EFI_ACPI_GPE0_BLK_ADDRESS 0 // To be fixed
+
+//
+// General Purpose Event 1 Register Block Generic Address
+// Information
+//
+#define EFI_ACPI_GPE1_BLK_ADDRESS_SPACE_ID EFI_ACPI_2_0_SYSTEM_IO
+#define EFI_ACPI_GPE1_BLK_BIT_WIDTH 0x0
+#define EFI_ACPI_GPE1_BLK_BIT_OFFSET 0x0
+#define EFI_ACPI_GPE1_BLK_ADDRESS 0 // To be fixed
+//
+// Reset Register Generic Address Information
+//
+#define EFI_ACPI_RESET_REG_ADDRESS_SPACE_ID EFI_ACPI_2_0_SYSTEM_IO
+#define EFI_ACPI_RESET_REG_BIT_WIDTH 0x08
+#define EFI_ACPI_RESET_REG_BIT_OFFSET 0x00
+#define EFI_ACPI_RESET_REG_ADDRESS 0x00000CF9
+#define EFI_ACPI_RESET_VALUE 0x06
+
+//
+// Number of bytes decoded by PM1 event blocks (a and b)
+//
+#define EFI_ACPI_PM1_EVT_LEN ((EFI_ACPI_PM1A_EVT_BLK_BIT_WIDTH + EFI_ACPI_PM1B_EVT_BLK_BIT_WIDTH) / 8)
+
+//
+// Number of bytes decoded by PM1 control blocks (a and b)
+//
+#define EFI_ACPI_PM1_CNT_LEN ((EFI_ACPI_PM1A_CNT_BLK_BIT_WIDTH + EFI_ACPI_PM1B_CNT_BLK_BIT_WIDTH) / 8)
+
+//
+// Number of bytes decoded by PM2 control block
+//
+#define EFI_ACPI_PM2_CNT_LEN (EFI_ACPI_PM2_CNT_BLK_BIT_WIDTH / 8)
+
+//
+// Number of bytes decoded by PM timer block
+//
+#define EFI_ACPI_PM_TMR_LEN (EFI_ACPI_PM_TMR_BLK_BIT_WIDTH / 8)
+
+//
+// Number of bytes decoded by GPE0 block
+//
+#define EFI_ACPI_GPE0_BLK_LEN (EFI_ACPI_GPE0_BLK_BIT_WIDTH / 8)
+
+//
+// Number of bytes decoded by GPE1 block
+//
+#define EFI_ACPI_GPE1_BLK_LEN (EFI_ACPI_GPE1_BLK_BIT_WIDTH / 8)
//
// Fixed ACPI Description Table
@@ -57,8 +200,8 @@ EFI_ACPI_5_0_FIXED_ACPI_DESCRIPTION_TABLE Fadt = {
EFI_ACPI_PREFERRED_PM_PROFILE,
EFI_ACPI_SCI_INT,
EFI_ACPI_SMI_CMD,
- FixedPcdGet8 (PcdAcpiEnableSwSmi),
- FixedPcdGet8 (PcdAcpiDisableSwSmi),
+ EFI_ACPI_ACPI_ENABLE,
+ EFI_ACPI_ACPI_DISABLE,
EFI_ACPI_S4_BIOS_REQ,
EFI_ACPI_PSTATE_CNT,
@@ -184,7 +327,7 @@ EFI_ACPI_5_0_FIXED_ACPI_DESCRIPTION_TABLE Fadt = {
// X_General Purpose Event 0 Register Block
//
EFI_ACPI_GPE0_BLK_ADDRESS_SPACE_ID,
- 0x0,
+ EFI_ACPI_GPE0_BLK_BIT_WIDTH,
EFI_ACPI_GPE0_BLK_BIT_OFFSET,
EFI_ACPI_5_0_BYTE,
EFI_ACPI_GPE0_BLK_ADDRESS
diff --git a/Platform/Intel/MinPlatformPkg/Acpi/AcpiTables/Fadt/Fadt.h b/Platform/Intel/MinPlatformPkg/Acpi/AcpiTables/Fadt/Fadt.h
deleted file mode 100644
index fb4c191b59..0000000000
--- a/Platform/Intel/MinPlatformPkg/Acpi/AcpiTables/Fadt/Fadt.h
+++ /dev/null
@@ -1,189 +0,0 @@
-/** @file
- This file describes the contents of the ACPI Fixed ACPI Description Table
- (FADT). All changes to the FADT contents should be done in this file.
-
-Copyright (c) 2017, Intel Corporation. All rights reserved.<BR>
-This program and the accompanying materials are licensed and made available under
-the terms and conditions of the BSD License that accompanies this distribution.
-The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php.
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-**/
-
-#ifndef _FADT_H_
-#define _FADT_H_
-
-//
-// Statements that include other files
-//
-
-#include <IndustryStandard/Acpi50.h>
-
-//
-// FADT Definitions
-//
-#ifndef EFI_ACPI_OEM_FADT_REVISION
-#define EFI_ACPI_OEM_FADT_REVISION 0x00000000
-#endif
-
-//
-// For ACPI 1.0 support
-//
-#define EFI_ACPI_INT_MODEL 0x00
-/*
-1 Desktop
-2 Mobile
-3 Workstation
-4 Enterprise Server
-5 SOHO Server
-6 Appliance PC
-7 Performance Server
-*/
-#define EFI_ACPI_PREFERRED_PM_PROFILE 0x02
-#define EFI_ACPI_SCI_INT 0x0009
-#define EFI_ACPI_SMI_CMD 0x000000B2
-#define EFI_ACPI_S4_BIOS_REQ 0xF2
-#define EFI_ACPI_PSTATE_CNT 0x00
-#define EFI_ACPI_GPE1_BASE 0x10
-#define EFI_ACPI_CST_CNT 0x0
-#define EFI_ACPI_P_LVL2_LAT 101
-#define EFI_ACPI_P_LVL3_LAT 1001
-#define EFI_ACPI_FLUSH_SIZE 0x0000
-#define EFI_ACPI_FLUSH_STRIDE 0x0000
-#define EFI_ACPI_DUTY_OFFSET 0x01
-#define EFI_ACPI_DUTY_WIDTH 0x03
-#define EFI_ACPI_DAY_ALRM 0x0D
-#define EFI_ACPI_MON_ALRM 0x00
-#define EFI_ACPI_CENTURY 0x32
-
-//
-// IA-PC Boot Architecture Flags, see ACPI 5.0 table specification and Acpi50.h
-// We should not use EFI_ACPI_5_0_8042 for legacy free platform, or XP reset fail. No impact to mobile.
-//
-#define EFI_ACPI_IAPC_BOOT_ARCH (EFI_ACPI_5_0_LEGACY_DEVICES)
-
-//
-// Fixed Feature Flags, see ACPI 2.0 table specification and Acpi2_0.h
-//
-#define EFI_ACPI_FIXED_FEATURE_FLAGS (\
- EFI_ACPI_5_0_USE_PLATFORM_CLOCK | \
- EFI_ACPI_5_0_WBINVD | \
- EFI_ACPI_5_0_DCK_CAP | \
- EFI_ACPI_5_0_RTC_S4 | \
- EFI_ACPI_5_0_SLP_BUTTON | \
- EFI_ACPI_5_0_PROC_C1 | \
- EFI_ACPI_5_0_RESET_REG_SUP \
- )
-
-//
-// PM1A Event Register Block Generic Address Information
-//
-#define EFI_ACPI_PM1A_EVT_BLK_ADDRESS_SPACE_ID EFI_ACPI_5_0_SYSTEM_IO
-#define EFI_ACPI_PM1A_EVT_BLK_BIT_WIDTH 0x20
-#define EFI_ACPI_PM1A_EVT_BLK_BIT_OFFSET 0x00
-#define EFI_ACPI_PM1A_EVT_BLK_ADDRESS FixedPcdGet16 (PcdAcpiPm1AEventBlockAddress)
-
-//
-// PM1B Event Register Block Generic Address Information
-//
-#define EFI_ACPI_PM1B_EVT_BLK_ADDRESS_SPACE_ID EFI_ACPI_5_0_SYSTEM_IO
-#define EFI_ACPI_PM1B_EVT_BLK_BIT_WIDTH 0x00
-#define EFI_ACPI_PM1B_EVT_BLK_BIT_OFFSET 0x00
-#define EFI_ACPI_PM1B_EVT_BLK_ADDRESS FixedPcdGet16 (PcdAcpiPm1BEventBlockAddress)
-
-//
-// PM1A Control Register Block Generic Address Information
-//
-#define EFI_ACPI_PM1A_CNT_BLK_ADDRESS_SPACE_ID EFI_ACPI_5_0_SYSTEM_IO
-#define EFI_ACPI_PM1A_CNT_BLK_BIT_WIDTH 0x10
-#define EFI_ACPI_PM1A_CNT_BLK_BIT_OFFSET 0x00
-#define EFI_ACPI_PM1A_CNT_BLK_ADDRESS FixedPcdGet16 (PcdAcpiPm1AControlBlockAddress)
-
-//
-// PM1B Control Register Block Generic Address Information
-//
-#define EFI_ACPI_PM1B_CNT_BLK_ADDRESS_SPACE_ID EFI_ACPI_5_0_SYSTEM_IO
-#define EFI_ACPI_PM1B_CNT_BLK_BIT_WIDTH 0x00
-#define EFI_ACPI_PM1B_CNT_BLK_BIT_OFFSET 0x00
-#define EFI_ACPI_PM1B_CNT_BLK_ADDRESS FixedPcdGet16 (PcdAcpiPm1BControlBlockAddress)
-
-//
-// PM2 Control Register Block Generic Address Information
-//
-#define EFI_ACPI_PM2_CNT_BLK_ADDRESS_SPACE_ID EFI_ACPI_5_0_SYSTEM_IO
-#define EFI_ACPI_PM2_CNT_BLK_BIT_WIDTH 0x08
-#define EFI_ACPI_PM2_CNT_BLK_BIT_OFFSET 0x00
-#define EFI_ACPI_PM2_CNT_BLK_ADDRESS FixedPcdGet16 (PcdAcpiPm2ControlBlockAddress)
-
-//
-// Power Management Timer Control Register Block Generic Address
-// Information
-//
-#define EFI_ACPI_PM_TMR_BLK_ADDRESS_SPACE_ID EFI_ACPI_5_0_SYSTEM_IO
-#define EFI_ACPI_PM_TMR_BLK_BIT_WIDTH 0x20
-#define EFI_ACPI_PM_TMR_BLK_BIT_OFFSET 0x00
-#define EFI_ACPI_PM_TMR_BLK_ADDRESS FixedPcdGet16 (PcdAcpiPmTimerBlockAddress)
-
-//
-// General Purpose Event 0 Register Block Generic Address
-// Information
-//
-#define EFI_ACPI_GPE0_BLK_ADDRESS_SPACE_ID EFI_ACPI_5_0_SYSTEM_IO
-#define EFI_ACPI_GPE0_BLK_BIT_WIDTH 0x100
-#define EFI_ACPI_GPE0_BLK_BIT_OFFSET 0x00
-#define EFI_ACPI_GPE0_BLK_ADDRESS FixedPcdGet16 (PcdAcpiGpe0BlockAddress)
-
-//
-// General Purpose Event 1 Register Block Generic Address
-// Information
-//
-#define EFI_ACPI_GPE1_BLK_ADDRESS_SPACE_ID EFI_ACPI_5_0_SYSTEM_IO
-#define EFI_ACPI_GPE1_BLK_BIT_WIDTH 0x00
-#define EFI_ACPI_GPE1_BLK_BIT_OFFSET 0x00
-#define EFI_ACPI_GPE1_BLK_ADDRESS FixedPcdGet16 (PcdAcpiGpe1BlockAddress)
-
-//
-// Reset Register Generic Address Information
-//
-#define EFI_ACPI_RESET_REG_ADDRESS_SPACE_ID EFI_ACPI_5_0_SYSTEM_IO
-#define EFI_ACPI_RESET_REG_BIT_WIDTH 0x08
-#define EFI_ACPI_RESET_REG_BIT_OFFSET 0x00
-#define EFI_ACPI_RESET_REG_ADDRESS 0x0000000000000CF9
-#define EFI_ACPI_RESET_VALUE 0x06
-
-//
-// Number of bytes decoded by PM1 event blocks (a and b)
-//
-#define EFI_ACPI_PM1_EVT_LEN ((EFI_ACPI_PM1A_EVT_BLK_BIT_WIDTH + EFI_ACPI_PM1B_EVT_BLK_BIT_WIDTH) / 8)
-
-//
-// Number of bytes decoded by PM1 control blocks (a and b)
-//
-#define EFI_ACPI_PM1_CNT_LEN ((EFI_ACPI_PM1A_CNT_BLK_BIT_WIDTH + EFI_ACPI_PM1B_CNT_BLK_BIT_WIDTH) / 8)
-
-//
-// Number of bytes decoded by PM2 control block
-//
-#define EFI_ACPI_PM2_CNT_LEN (EFI_ACPI_PM2_CNT_BLK_BIT_WIDTH / 8)
-
-//
-// Number of bytes decoded by PM timer block
-//
-#define EFI_ACPI_PM_TMR_LEN (EFI_ACPI_PM_TMR_BLK_BIT_WIDTH / 8)
-
-//
-// Number of bytes decoded by GPE0 block
-//
-#define EFI_ACPI_GPE0_BLK_LEN (EFI_ACPI_GPE0_BLK_BIT_WIDTH / 8)
-
-//
-// Number of bytes decoded by GPE1 block
-//
-#define EFI_ACPI_GPE1_BLK_LEN (EFI_ACPI_GPE1_BLK_BIT_WIDTH / 8)
-
-extern EFI_ACPI_5_0_FIXED_ACPI_DESCRIPTION_TABLE Fadt;
-
-#endif
diff --git a/Platform/Intel/MinPlatformPkg/Acpi/AcpiTables/Hpet/Hpet.c b/Platform/Intel/MinPlatformPkg/Acpi/AcpiTables/Hpet/Hpet.c
index ea8fcba5ad..2512793158 100644
--- a/Platform/Intel/MinPlatformPkg/Acpi/AcpiTables/Hpet/Hpet.c
+++ b/Platform/Intel/MinPlatformPkg/Acpi/AcpiTables/Hpet/Hpet.c
@@ -18,7 +18,30 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
// Statements that include other files
//
-#include "Hpet.h"
+#include <IndustryStandard/Acpi.h>
+#include <IndustryStandard/HighPrecisionEventTimerTable.h>
+
+//
+// HPET Definitions
+//
+#define EFI_ACPI_OEM_HPET_REVISION 0x00000001
+
+#define EFI_ACPI_EVENT_TIMER_BLOCK_ID 0x0 // To be filled
+
+//
+// Event Timer Block Base Address Information
+//
+#define EFI_ACPI_EVENT_TIMER_BLOCK_ADDRESS_SPACE_ID EFI_ACPI_3_0_SYSTEM_MEMORY
+#define EFI_ACPI_EVENT_TIMER_BLOCK_BIT_WIDTH 0x40
+#define EFI_ACPI_EVENT_TIMER_BLOCK_BIT_OFFSET 0x00
+#define EFI_ACPI_EVENT_TIMER_ACCESS_SIZE 0x00
+#define EFI_ACPI_EVENT_TIMER_BLOCK_ADDRESS 0x0 // To be filled
+
+#define EFI_ACPI_HPET_NUMBER 0x00
+
+#define EFI_ACPI_MIN_CLOCK_TICK 0x0080
+
+#define EFI_ACPI_HPET_ATTRIBUTES 0x00
//
// High Precision Event Timer Table
diff --git a/Platform/Intel/MinPlatformPkg/Acpi/AcpiTables/Hpet/Hpet.h b/Platform/Intel/MinPlatformPkg/Acpi/AcpiTables/Hpet/Hpet.h
deleted file mode 100644
index b12954f330..0000000000
--- a/Platform/Intel/MinPlatformPkg/Acpi/AcpiTables/Hpet/Hpet.h
+++ /dev/null
@@ -1,51 +0,0 @@
-/** @file
- This file describes the contents of the ACPI High Precision Event Timer Description Table
- (HPET). All changes to the HPET contents should be done in this file.
-
-Copyright (c) 2017, Intel Corporation. All rights reserved.<BR>
-This program and the accompanying materials are licensed and made available under
-the terms and conditions of the BSD License that accompanies this distribution.
-The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php.
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-**/
-
-#ifndef _HPET_H_
-#define _HPET_H_
-
-//
-// Statements that include other files
-//
-
-#include <IndustryStandard/Acpi30.h>
-#include <IndustryStandard/HighPrecisionEventTimerTable.h>
-
-//
-// HPET Definitions
-//
-
-#define EFI_ACPI_OEM_HPET_REVISION 0x00000001
-
-#define EFI_ACPI_EVENT_TIMER_BLOCK_ID 0x8086A201
-
-//
-// Event Timer Block Base Address Information
-//
-#define EFI_ACPI_EVENT_TIMER_BLOCK_ADDRESS_SPACE_ID EFI_ACPI_3_0_SYSTEM_MEMORY
-#define EFI_ACPI_EVENT_TIMER_BLOCK_BIT_WIDTH 0x40
-#define EFI_ACPI_EVENT_TIMER_BLOCK_BIT_OFFSET 0x00
-#define EFI_ACPI_EVENT_TIMER_ACCESS_SIZE 0x00
-#define EFI_ACPI_EVENT_TIMER_BLOCK_ADDRESS 0x00000000FED00000
-
-#define EFI_ACPI_HPET_NUMBER 0x00
-
-#define EFI_ACPI_MIN_CLOCK_TICK 0x0080
-
-#define EFI_ACPI_HPET_ATTRIBUTES 0x00
-
-extern EFI_ACPI_HIGH_PRECISION_EVENT_TIMER_TABLE_HEADER Hpet;
-
-#endif
diff --git a/Platform/Intel/MinPlatformPkg/Acpi/AcpiTables/Madt/Madt.c b/Platform/Intel/MinPlatformPkg/Acpi/AcpiTables/Madt/Madt.c
deleted file mode 100644
index 70ce150d73..0000000000
--- a/Platform/Intel/MinPlatformPkg/Acpi/AcpiTables/Madt/Madt.c
+++ /dev/null
@@ -1,389 +0,0 @@
-/** @file
- This file contains a structure definition for the ACPI 2.0 Multiple APIC
- Description Table (MADT). Any changes to the MADT table require updating the
- respective structure count in Madt.h and then adding the structure to the
- MADT defined in this file.
-
-Copyright (c) 2017, Intel Corporation. All rights reserved.<BR>
-This program and the accompanying materials are licensed and made available under
-the terms and conditions of the BSD License that accompanies this distribution.
-The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php.
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-**/
-
-//
-// Statements that include other files
-//
-
-#include "Madt.h"
-
-//
-// Multiple APIC Description Table
-//
-
-EFI_ACPI_2_0_MULTIPLE_APIC_DESCRIPTION_TABLE Madt = {
- {
- {
- EFI_ACPI_2_0_MULTIPLE_SAPIC_DESCRIPTION_TABLE_SIGNATURE,
- sizeof (EFI_ACPI_2_0_MULTIPLE_APIC_DESCRIPTION_TABLE),
- EFI_ACPI_5_1_MULTIPLE_APIC_DESCRIPTION_TABLE_REVISION,
-
- //
- // Checksum will be updated at runtime
- //
- 0x00,
-
- //
- // It is expected that these values will be programmed at runtime
- //
- { ' ', ' ', ' ', ' ', ' ', ' ' },
-
- 0,
- EFI_ACPI_OEM_MADT_REVISION,
- 0,
- 0
- },
-
- //
- // MADT specific fields
- //
- FixedPcdGet64 (PcdApicLocalAddress),
- EFI_ACPI_2_0_MULTIPLE_APIC_FLAGS
- },
-
- //
- // Sample Processor Local APIC Structure
- //
- //EFI_ACPI_2_0_PROCESSOR_LOCAL_APIC, // Type
- //sizeof (EFI_ACPI_2_0_PROCESSOR_LOCAL_APIC_STRUCTURE), // Length
- //0x00 // Processor ID
- //0x00 // Local APIC ID
- //0x00000000, // Flags - Disabled (until initialized by platform driver)
- {
- {
- EFI_ACPI_2_0_PROCESSOR_LOCAL_APIC, // Type
- sizeof (EFI_ACPI_2_0_PROCESSOR_LOCAL_APIC_STRUCTURE), // Length
- 0x01, // Processor ID
- 0xFF, // Local APIC ID
- 0x00000000 // Flags - Disabled (until initialized by platform driver)
- },
- {
- EFI_ACPI_2_0_PROCESSOR_LOCAL_APIC, // Type
- sizeof (EFI_ACPI_2_0_PROCESSOR_LOCAL_APIC_STRUCTURE), // Length
- 0x02, // Processor ID
- 0xFF, // Local APIC ID
- 0x00000000 // Flags - Disabled (until initialized by platform driver)
- },
- {
- EFI_ACPI_2_0_PROCESSOR_LOCAL_APIC, // Type
- sizeof (EFI_ACPI_2_0_PROCESSOR_LOCAL_APIC_STRUCTURE), // Length
- 0x03, // Processor ID
- 0xFF, // Local APIC ID
- 0x00000000 // Flags - Disabled (until initialized by platform driver)
- },
- {
- EFI_ACPI_2_0_PROCESSOR_LOCAL_APIC, // Type
- sizeof (EFI_ACPI_2_0_PROCESSOR_LOCAL_APIC_STRUCTURE), // Length
- 0x04, // Processor ID
- 0xFF, // Local APIC ID
- 0x00000000 // Flags - Disabled (until initialized by platform driver)
- },
- {
- EFI_ACPI_2_0_PROCESSOR_LOCAL_APIC, // Type
- sizeof (EFI_ACPI_2_0_PROCESSOR_LOCAL_APIC_STRUCTURE), // Length
- 0x05, // Processor ID
- 0xFF, // Local APIC ID
- 0x00000000 // Flags - Disabled (until initialized by platform driver)
- },
- {
- EFI_ACPI_2_0_PROCESSOR_LOCAL_APIC, // Type
- sizeof (EFI_ACPI_2_0_PROCESSOR_LOCAL_APIC_STRUCTURE), // Length
- 0x06, // Processor ID
- 0xFF, // Local APIC ID
- 0x00000000 // Flags - Disabled (until initialized by platform driver)
- },
- {
- EFI_ACPI_2_0_PROCESSOR_LOCAL_APIC, // Type
- sizeof (EFI_ACPI_2_0_PROCESSOR_LOCAL_APIC_STRUCTURE), // Length
- 0x07, // Processor ID
- 0xFF, // Local APIC ID
- 0x00000000 // Flags - Disabled (until initialized by platform driver)
- },
- {
- EFI_ACPI_2_0_PROCESSOR_LOCAL_APIC, // Type
- sizeof (EFI_ACPI_2_0_PROCESSOR_LOCAL_APIC_STRUCTURE), // Length
- 0x08, // Processor ID
- 0xFF, // Local APIC ID
- 0x00000000 // Flags - Disabled (until initialized by platform driver)
- },
- {
- EFI_ACPI_2_0_PROCESSOR_LOCAL_APIC, // Type
- sizeof (EFI_ACPI_2_0_PROCESSOR_LOCAL_APIC_STRUCTURE), // Length
- 0x09, // Processor ID
- 0xFF, // Local APIC ID
- 0x00000000 // Flags - Disabled (until initialized by platform driver)
- },
- {
- EFI_ACPI_2_0_PROCESSOR_LOCAL_APIC, // Type
- sizeof (EFI_ACPI_2_0_PROCESSOR_LOCAL_APIC_STRUCTURE), // Length
- 0x0A, // Processor ID
- 0xFF, // Local APIC ID
- 0x00000000 // Flags - Disabled (until initialized by platform driver)
- },
- {
- EFI_ACPI_2_0_PROCESSOR_LOCAL_APIC, // Type
- sizeof (EFI_ACPI_2_0_PROCESSOR_LOCAL_APIC_STRUCTURE), // Length
- 0x0B, // Processor ID
- 0xFF, // Local APIC ID
- 0x00000000 // Flags - Disabled (until initialized by platform driver)
- },
- {
- EFI_ACPI_2_0_PROCESSOR_LOCAL_APIC, // Type
- sizeof (EFI_ACPI_2_0_PROCESSOR_LOCAL_APIC_STRUCTURE), // Length
- 0x0C, // Processor ID
- 0xFF, // Local APIC ID
- 0x00000000 // Flags - Disabled (until initialized by platform driver)
- },
- {
- EFI_ACPI_2_0_PROCESSOR_LOCAL_APIC, // Type
- sizeof (EFI_ACPI_2_0_PROCESSOR_LOCAL_APIC_STRUCTURE), // Length
- 0x0D, // Processor ID
- 0xFF, // Local APIC ID
- 0x00000000 // Flags - Disabled (until initialized by platform driver)
- },
- {
- EFI_ACPI_2_0_PROCESSOR_LOCAL_APIC, // Type
- sizeof (EFI_ACPI_2_0_PROCESSOR_LOCAL_APIC_STRUCTURE), // Length
- 0x0E, // Processor ID
- 0xFF, // Local APIC ID
- 0x00000000 // Flags - Disabled (until initialized by platform driver)
- },
- {
- EFI_ACPI_2_0_PROCESSOR_LOCAL_APIC, // Type
- sizeof (EFI_ACPI_2_0_PROCESSOR_LOCAL_APIC_STRUCTURE), // Length
- 0x0F, // Processor ID
- 0xFF, // Local APIC ID
- 0x00000000 // Flags - Disabled (until initialized by platform driver)
- },
- {
- EFI_ACPI_2_0_PROCESSOR_LOCAL_APIC, // Type
- sizeof (EFI_ACPI_2_0_PROCESSOR_LOCAL_APIC_STRUCTURE), // Length
- 0x10, // Processor ID
- 0xFF, // Local APIC ID
- 0x00000000 // Flags - Disabled (until initialized by platform driver)
- }
- },
-
- //
- // Sample IO APIC Structure
- //
- //EFI_ACPI_2_0_IO_APIC, // Type
- //sizeof (EFI_ACPI_2_0_IO_APIC_STRUCTURE), // Length
- //0x00, // IO APIC ID
- //EFI_ACPI_RESERVED_BYTE, // Reserved
- //0x00000000, // IO APIC Address (physical)
- //0x00000000, // Global System Interrupt Base
- {
- {
- //
- // I/O SAPIC (ICH)
- //
- EFI_ACPI_2_0_IO_APIC, // Type
- sizeof (EFI_ACPI_2_0_IO_APIC_STRUCTURE), // Length
- FixedPcdGet8 (PcdApicIoIdPch), // IO APIC ID
- EFI_ACPI_RESERVED_BYTE, // Reserved
- FixedPcdGet64 (PcdApicIoAddress), // IO APIC Address (physical)
- 0x18 * 0 // Global System Interrupt Base
- }
- },
- //
- // Sample Interrupt Source Override Structure
- //
- //EFI_ACPI_2_0_INTERRUPT_SOURCE_OVERRIDE, // Type
- //sizeof (EFI_ACPI_2_0_INTERRUPT_SOURCE_OVERRIDE_STRUCTURE), // Length
- //0x00, // Bus
- //0x00, // Source
- //0x00000000, // Global System Interrupt
- //0x0000, // Flags
- {
- {
- //
- // IRQ0=>IRQ2 Interrupt Source Override Structure
- //
- EFI_ACPI_2_0_INTERRUPT_SOURCE_OVERRIDE, // Type
- sizeof (EFI_ACPI_2_0_INTERRUPT_SOURCE_OVERRIDE_STRUCTURE),// Length
- 0x00, // Bus - ISA
- 0x00, // Source - IRQ0
- 0x00000002, // Global System Interrupt - IRQ2
- 0x0000 // Flags - Conforms to specifications of the bus
- },
- {
- //
- // ISO (SCI Active High) Interrupt Source Override Structure
- //
- EFI_ACPI_2_0_INTERRUPT_SOURCE_OVERRIDE, // Type
- sizeof (EFI_ACPI_2_0_INTERRUPT_SOURCE_OVERRIDE_STRUCTURE),// Length
- 0x00, // Bus - ISA
- 0x09, // Source - IRQ9
- 0x00000009, // Global System Interrupt - IRQ9
- 0x000D // Flags - Level-tiggered, Active High
- }
- },
- //
- // Sample Non-Maskable Interrupt Source Structure
- //
- //EFI_ACPI_2_0_NON_MASKABLE_INTERRUPT_SOURCE, // Type
- //sizeof (EFI_ACPI_2_0_NON_MASKABLE_INTERRUPT_SOURCE_STRUCTURE), // Length
- //0x0000, // Flags
- //0x00000000, // Global System Interrupt
-
- //
- // Sample Local APIC NMI Structure
- //
- //EFI_ACPI_2_0_LOCAL_APIC_NMI, // Type
- //sizeof (EFI_ACPI_2_0_LOCAL_APIC_NMI_STRUCTURE), // Length
- //0x00, // ACPI Processor ID
- //0x0000, // Flags
- //0x00, // Local APIC LINT#
-
- {
- {
- EFI_ACPI_2_0_LOCAL_APIC_NMI, // Type
- sizeof (EFI_ACPI_2_0_LOCAL_APIC_NMI_STRUCTURE), // Length
- 0x01, // ACPI Processor ID
- 0x0005, // Flags - Edge-tiggered, Active High
- 0x01 // Local APIC LINT#
- },
- {
- EFI_ACPI_2_0_LOCAL_APIC_NMI, // Type
- sizeof (EFI_ACPI_2_0_LOCAL_APIC_NMI_STRUCTURE), // Length
- 0x02, // ACPI Processor ID
- 0x0005, // Flags - Edge-tiggered, Active High
- 0x01 // Local APIC LINT#
- },
- {
- EFI_ACPI_2_0_LOCAL_APIC_NMI, // Type
- sizeof (EFI_ACPI_2_0_LOCAL_APIC_NMI_STRUCTURE), // Length
- 0x03, // ACPI Processor ID
- 0x0005, // Flags - Edge-tiggered, Active High
- 0x01 // Local APIC LINT#
- },
- {
- EFI_ACPI_2_0_LOCAL_APIC_NMI, // Type
- sizeof (EFI_ACPI_2_0_LOCAL_APIC_NMI_STRUCTURE), // Length
- 0x04, // ACPI Processor ID
- 0x0005, // Flags - Edge-tiggered, Active High
- 0x01 // Local APIC LINT#
- },
- {
- EFI_ACPI_2_0_LOCAL_APIC_NMI, // Type
- sizeof (EFI_ACPI_2_0_LOCAL_APIC_NMI_STRUCTURE), // Length
- 0x05, // ACPI Processor ID
- 0x0005, // Flags - Edge-tiggered, Active High
- 0x01 // Local APIC LINT#
- },
- {
- EFI_ACPI_2_0_LOCAL_APIC_NMI, // Type
- sizeof (EFI_ACPI_2_0_LOCAL_APIC_NMI_STRUCTURE), // Length
- 0x06, // ACPI Processor ID
- 0x0005, // Flags - Edge-tiggered, Active High
- 0x01 // Local APIC LINT#
- },
- {
- EFI_ACPI_2_0_LOCAL_APIC_NMI, // Type
- sizeof (EFI_ACPI_2_0_LOCAL_APIC_NMI_STRUCTURE), // Length
- 0x07, // ACPI Processor ID
- 0x0005, // Flags - Edge-tiggered, Active High
- 0x01 // Local APIC LINT#
- },
- {
- EFI_ACPI_2_0_LOCAL_APIC_NMI, // Type
- sizeof (EFI_ACPI_2_0_LOCAL_APIC_NMI_STRUCTURE), // Length
- 0x08, // ACPI Processor ID
- 0x0005, // Flags - Edge-tiggered, Active High
- 0x01 // Local APIC LINT#
- },
- {
- EFI_ACPI_2_0_LOCAL_APIC_NMI, // Type
- sizeof (EFI_ACPI_2_0_LOCAL_APIC_NMI_STRUCTURE), // Length
- 0x09, // ACPI Processor ID
- 0x0005, // Flags - Edge-tiggered, Active High
- 0x01 // Local APIC LINT#
- },
- {
- EFI_ACPI_2_0_LOCAL_APIC_NMI, // Type
- sizeof (EFI_ACPI_2_0_LOCAL_APIC_NMI_STRUCTURE), // Length
- 0x0A, // ACPI Processor ID
- 0x0005, // Flags - Edge-tiggered, Active High
- 0x01 // Local APIC LINT#
- },
- {
- EFI_ACPI_2_0_LOCAL_APIC_NMI, // Type
- sizeof (EFI_ACPI_2_0_LOCAL_APIC_NMI_STRUCTURE), // Length
- 0x0B, // ACPI Processor ID
- 0x0005, // Flags - Edge-tiggered, Active High
- 0x01 // Local APIC LINT#
- },
- {
- EFI_ACPI_2_0_LOCAL_APIC_NMI, // Type
- sizeof (EFI_ACPI_2_0_LOCAL_APIC_NMI_STRUCTURE), // Length
- 0x0C, // ACPI Processor ID
- 0x0005, // Flags - Edge-tiggered, Active High
- 0x01 // Local APIC LINT#
- },
- {
- EFI_ACPI_2_0_LOCAL_APIC_NMI, // Type
- sizeof (EFI_ACPI_2_0_LOCAL_APIC_NMI_STRUCTURE), // Length
- 0x0D, // ACPI Processor ID
- 0x0005, // Flags - Edge-tiggered, Active High
- 0x01 // Local APIC LINT#
- },
- {
- EFI_ACPI_2_0_LOCAL_APIC_NMI, // Type
- sizeof (EFI_ACPI_2_0_LOCAL_APIC_NMI_STRUCTURE), // Length
- 0x0E, // ACPI Processor ID
- 0x0005, // Flags - Edge-tiggered, Active High
- 0x01 // Local APIC LINT#
- },
- {
- EFI_ACPI_2_0_LOCAL_APIC_NMI, // Type
- sizeof (EFI_ACPI_2_0_LOCAL_APIC_NMI_STRUCTURE), // Length
- 0x0F, // ACPI Processor ID
- 0x0005, // Flags - Edge-tiggered, Active High
- 0x01 // Local APIC LINT#
- },
- {
- EFI_ACPI_2_0_LOCAL_APIC_NMI, // Type
- sizeof (EFI_ACPI_2_0_LOCAL_APIC_NMI_STRUCTURE), // Length
- 0x10, // ACPI Processor ID
- 0x0005, // Flags - Edge-tiggered, Active High
- 0x01 // Local APIC LINT#
- }
- }
-
- //
- // Sample Local APIC Address Override Structure
- //
- //EFI_ACPI_2_0_LOCAL_APIC_ADDRESS_OVERRIDE, // Type
- //sizeof (EFI_ACPI_2_0_LOCAL_APIC_ADDRESS_OVERRIDE_STRUCTURE), // Length
- //EFI_ACPI_RESERVED_WORD, // Reserved
- //0x0000000000000000, // Local APIC Address
-
- //
- // Sample Platform Interrupt Sources Structure
- //
- //EFI_ACPI_2_0_PLATFORM_INTERRUPT_SOURCES, // Type
- //sizeof (EFI_ACPI_2_0_PLATFORM_INTERRUPT_SOURCES_STRUCTURE), // Length
- //0x0000, // Flags
- //0x00, // Interrupt Type
- //0x00, // Processor ID
- //0x00, // Processor EID
- //0x00, // IO SAPIC Vector
- //0x00000000, // Global System Interrupt
- //EFI_ACPI_RESERVED_DWORD, // Reserved
-
-};
diff --git a/Platform/Intel/MinPlatformPkg/Acpi/AcpiTables/Madt/Madt.h b/Platform/Intel/MinPlatformPkg/Acpi/AcpiTables/Madt/Madt.h
deleted file mode 100644
index d45db43b6d..0000000000
--- a/Platform/Intel/MinPlatformPkg/Acpi/AcpiTables/Madt/Madt.h
+++ /dev/null
@@ -1,144 +0,0 @@
-/** @file
- This file describes the contents of the ACPI Multiple APIC Description
- Table (MADT).
- To make changes to the MADT, it is necessary to update the count for the
- APIC structure being updated, and to modify table found in Madt.c.
-
-Copyright (c) 2017, Intel Corporation. All rights reserved.<BR>
-This program and the accompanying materials are licensed and made available under
-the terms and conditions of the BSD License that accompanies this distribution.
-The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php.
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-**/
-
-#ifndef _MADT_H_
-#define _MADT_H_
-
-//
-// Statements that include other files
-//
-
-#include <IndustryStandard/Acpi51.h>
-
-//
-// MADT Definitions
-//
-
-#define EFI_ACPI_OEM_MADT_REVISION 0x00000001
-
-
-//
-// Multiple APIC Flags are defined in AcpiX.0.h
-//
-#define EFI_ACPI_1_0_MULTIPLE_APIC_FLAGS (EFI_ACPI_1_0_PCAT_COMPAT)
-#define EFI_ACPI_2_0_MULTIPLE_APIC_FLAGS (EFI_ACPI_2_0_PCAT_COMPAT)
-
-//
-// Define the number of each table type.
-// This is where the table layout is modified.
-//
-
-#define EFI_ACPI_PROCESSOR_LOCAL_APIC_COUNT 16
-#define EFI_ACPI_IO_APIC_COUNT 1
-#define EFI_ACPI_INTERRUPT_SOURCE_OVERRIDE_COUNT 2
-#define EFI_ACPI_NON_MASKABLE_INTERRUPT_SOURCE_COUNT 0
-#define EFI_ACPI_LOCAL_APIC_NMI_COUNT 16
-#define EFI_ACPI_LOCAL_APIC_ADDRESS_OVERRIDE_COUNT 0
-#define EFI_ACPI_IO_SAPIC_COUNT 0
-#define EFI_ACPI_PROCESSOR_LOCAL_SAPIC_COUNT 0
-#define EFI_ACPI_PLATFORM_INTERRUPT_SOURCES_COUNT 0
-
-//
-// MADT structure
-//
-
-//
-// Ensure proper structure formats
-//
-#pragma pack (1)
-
-//
-// ACPI 1.0 Table structure
-//
-typedef struct {
- EFI_ACPI_1_0_MULTIPLE_APIC_DESCRIPTION_TABLE_HEADER Header;
-
-#if EFI_ACPI_PROCESSOR_LOCAL_APIC_COUNT > 0
- EFI_ACPI_1_0_PROCESSOR_LOCAL_APIC_STRUCTURE LocalApic[EFI_ACPI_PROCESSOR_LOCAL_APIC_COUNT];
-#endif
-
-#if EFI_ACPI_IO_APIC_COUNT > 0
- EFI_ACPI_1_0_IO_APIC_STRUCTURE IoApic[EFI_ACPI_IO_APIC_COUNT];
-#endif
-
-#if EFI_ACPI_INTERRUPT_SOURCE_OVERRIDE_COUNT > 0
- EFI_ACPI_1_0_INTERRUPT_SOURCE_OVERRIDE_STRUCTURE Iso[EFI_ACPI_INTERRUPT_SOURCE_OVERRIDE_COUNT];
-#endif
-
-#if EFI_ACPI_NON_MASKABLE_INTERRUPT_SOURCE_COUNT > 0
- EFI_ACPI_1_0_NON_MASKABLE_INTERRUPT_SOURCE_STRUCTURE NmiSource[EFI_ACPI_NON_MASKABLE_INTERRUPT_SOURCE_COUNT];
-#endif
-
-#if EFI_ACPI_LOCAL_APIC_NMI_COUNT > 0
- EFI_ACPI_1_0_LOCAL_APIC_NMI_STRUCTURE LocalApicNmi[EFI_ACPI_LOCAL_APIC_NMI_COUNT];
-#endif
-
-#if EFI_ACPI_LOCAL_APIC_ADDRESS_OVERRIDE_COUNT > 0
- EFI_ACPI_1_0_LOCAL_APIC_ADDRESS_OVERRIDE_STRUCTURE LocalApicOverride[EFI_ACPI_LOCAL_APIC_OVERRIDE_COUNT];
-#endif
-
-} EFI_ACPI_1_0_MULTIPLE_APIC_DESCRIPTION_TABLE;
-
-//
-// ACPI 2.0 Table structure
-//
-typedef struct {
- EFI_ACPI_2_0_MULTIPLE_APIC_DESCRIPTION_TABLE_HEADER Header;
-
-#if EFI_ACPI_PROCESSOR_LOCAL_APIC_COUNT > 0
- EFI_ACPI_2_0_PROCESSOR_LOCAL_APIC_STRUCTURE LocalApic[EFI_ACPI_PROCESSOR_LOCAL_APIC_COUNT];
-#endif
-
-#if EFI_ACPI_IO_APIC_COUNT > 0
- EFI_ACPI_2_0_IO_APIC_STRUCTURE IoApic[EFI_ACPI_IO_APIC_COUNT];
-#endif
-
-#if EFI_ACPI_INTERRUPT_SOURCE_OVERRIDE_COUNT > 0
- EFI_ACPI_2_0_INTERRUPT_SOURCE_OVERRIDE_STRUCTURE Iso[EFI_ACPI_INTERRUPT_SOURCE_OVERRIDE_COUNT];
-#endif
-
-#if EFI_ACPI_NON_MASKABLE_INTERRUPT_SOURCE_COUNT > 0
- EFI_ACPI_2_0_NON_MASKABLE_INTERRUPT_SOURCE_STRUCTURE NmiSource[EFI_ACPI_NON_MASKABLE_INTERRUPT_SOURCE_COUNT];
-#endif
-
-#if EFI_ACPI_LOCAL_APIC_NMI_COUNT > 0
- EFI_ACPI_2_0_LOCAL_APIC_NMI_STRUCTURE LocalApicNmi[EFI_ACPI_LOCAL_APIC_NMI_COUNT];
-#endif
-
-#if EFI_ACPI_LOCAL_APIC_ADDRESS_OVERRIDE_COUNT > 0
- EFI_ACPI_2_0_LOCAL_APIC_ADDRESS_OVERRIDE_STRUCTURE LocalApicOverride[EFI_ACPI_LOCAL_APIC_OVERRIDE_COUNT];
-#endif
-
-#if EFI_ACPI_IO_SAPIC_COUNT > 0
- EFI_ACPI_2_0_IO_SAPIC_STRUCTURE IoSapic[EFI_ACPI_IO_SAPIC_COUNT];
-#endif
-
-#if EFI_ACPI_PROCESSOR_LOCAL_SAPIC_COUNT > 0
- EFI_ACPI_2_0_PROCESSOR_LOCAL_SAPIC_STRUCTURE LocalSapic[EFI_ACPI_PROCESSOR_LOCAL_SAPIC_COUNT];
-#endif
-
-#if EFI_ACPI_PLATFORM_INTERRUPT_SOURCES_COUNT > 0
- EFI_ACPI_2_0_PLATFORM_INTERRUPT_SOURCES_STRUCTURE PlatformInterruptSources[EFI_ACPI_PLATFORM_INTERRUPT_SOURCES_COUNT];
-#endif
-
-} EFI_ACPI_2_0_MULTIPLE_APIC_DESCRIPTION_TABLE;
-
-#pragma pack ()
-
-extern EFI_ACPI_2_0_MULTIPLE_APIC_DESCRIPTION_TABLE Madt;
-
-#endif
diff --git a/Platform/Intel/MinPlatformPkg/Acpi/AcpiTables/Mcfg/Mcfg.c b/Platform/Intel/MinPlatformPkg/Acpi/AcpiTables/Mcfg/Mcfg.c
deleted file mode 100644
index 86f491a0bb..0000000000
--- a/Platform/Intel/MinPlatformPkg/Acpi/AcpiTables/Mcfg/Mcfg.c
+++ /dev/null
@@ -1,78 +0,0 @@
-/** @file
- This file contains a structure definition for the ACPI Memory Mapped Configuration
- Address Space table (MCFG). Any changes to the number of entries in the table require
- updating the structure count in Mcfg.h and then adding the structure to the
- MCFG defined in this file. The table layout is defined in Mcfg.h and the
- table contents are defined in the MemoryMappedConfigurationSpaceAccessTable.h.
-
-Copyright (c) 2017, Intel Corporation. All rights reserved.<BR>
-This program and the accompanying materials are licensed and made available under
-the terms and conditions of the BSD License that accompanies this distribution.
-The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php.
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-**/
-
-//
-// Statements that include other files
-//
-
-#include "Mcfg.h"
-
-//
-// Multiple APIC Description Table
-//
-
-EFI_ACPI_MEMORY_MAPPED_CONFIGURATION_SPACE_ACCESS_DESCRIPTION_TABLE Mcfg = {
- {
- EFI_ACPI_3_0_PCI_EXPRESS_MEMORY_MAPPED_CONFIGURATION_SPACE_BASE_ADDRESS_DESCRIPTION_TABLE_SIGNATURE,
- sizeof (EFI_ACPI_MEMORY_MAPPED_CONFIGURATION_SPACE_ACCESS_DESCRIPTION_TABLE),
- EFI_ACPI_MEMORY_MAPPED_CONFIGURATION_SPACE_ACCESS_TABLE_REVISION,
-
- //
- // Checksum will be updated at runtime
- //
- 0x00,
-
- //
- // It is expected that these values will be programmed at runtime
- //
- { ' ', ' ', ' ', ' ', ' ', ' ' },
-
- 0,
- EFI_ACPI_OEM_MCFG_REVISION,
- 0,
- 0
- },
-
- //
- // Reserved
- //
- 0x0000000000000000,
-
- //
- // MCFG specific fields
- //
- {
- {
- //
- // Sample Base Address Structure
- //
- //0x0000000000000000, // BaseAddress
- //0x0000, // PciSegmentGroupNumber
- //0x00, // StartBusNumber
- //0x00, // EndBusNumber
- //0x00000000, // Reserved
-
- FixedPcdGet64 (PcdPciExpressBaseAddress), // BaseAddress
- 0x0000, // PciSegmentGroupNumber
- 0x00, // StartBusNumber
- ((FixedPcdGet32 (PcdPciExpressRegionLength) / 0x100000) - 1), // EndBusNumber
- 0x00000000 // Reserved
- }
- }
-};
-
diff --git a/Platform/Intel/MinPlatformPkg/Acpi/AcpiTables/Mcfg/Mcfg.h b/Platform/Intel/MinPlatformPkg/Acpi/AcpiTables/Mcfg/Mcfg.h
deleted file mode 100644
index e41c223ef5..0000000000
--- a/Platform/Intel/MinPlatformPkg/Acpi/AcpiTables/Mcfg/Mcfg.h
+++ /dev/null
@@ -1,62 +0,0 @@
-/** @file
- This file describes the contents of the ACPI Memory Mapped Configuration
- Space Access Table (MCFG).
-
-Copyright (c) 2017, Intel Corporation. All rights reserved.<BR>
-This program and the accompanying materials are licensed and made available under
-the terms and conditions of the BSD License that accompanies this distribution.
-The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php.
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-**/
-
-#ifndef _MCFG_H_
-#define _MCFG_H_
-
-//
-// Statements that include other files
-//
-
-#include <IndustryStandard/Acpi30.h>
-#include <IndustryStandard/MemoryMappedConfigurationSpaceAccessTable.h>
-
-//
-// MCFG Definitions
-//
-
-#define EFI_ACPI_OEM_MCFG_REVISION 0x00000001
-
-//
-// Define the number of allocation structures so that we can build the table structure.
-//
-
-#define EFI_ACPI_ALLOCATION_STRUCTURE_COUNT 1
-
-//
-// MCFG structure
-//
-
-//
-// Ensure proper structure formats
-//
-#pragma pack (1)
-
-//
-// MCFG Table structure
-//
-typedef struct {
- EFI_ACPI_DESCRIPTION_HEADER Header;
- UINT64 Reserved;
-#if EFI_ACPI_ALLOCATION_STRUCTURE_COUNT > 0
- EFI_ACPI_MEMORY_MAPPED_ENHANCED_CONFIGURATION_SPACE_BASE_ADDRESS_ALLOCATION_STRUCTURE AllocationStructure[EFI_ACPI_ALLOCATION_STRUCTURE_COUNT];
-#endif
-} EFI_ACPI_MEMORY_MAPPED_CONFIGURATION_SPACE_ACCESS_DESCRIPTION_TABLE;
-
-#pragma pack ()
-
-extern EFI_ACPI_MEMORY_MAPPED_CONFIGURATION_SPACE_ACCESS_DESCRIPTION_TABLE Mcfg;
-
-#endif
diff --git a/Platform/Intel/MinPlatformPkg/Acpi/AcpiTables/Wsmt/Wsmt.c b/Platform/Intel/MinPlatformPkg/Acpi/AcpiTables/Wsmt/Wsmt.c
index ca6657d878..6d25de2ae7 100644
--- a/Platform/Intel/MinPlatformPkg/Acpi/AcpiTables/Wsmt/Wsmt.c
+++ b/Platform/Intel/MinPlatformPkg/Acpi/AcpiTables/Wsmt/Wsmt.c
@@ -16,7 +16,15 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
// Statements that include other files
//
-#include "Wsmt.h"
+#include <IndustryStandard/Acpi.h>
+#include <IndustryStandard/WindowsSmmSecurityMitigationTable.h>
+#include <Library/PcdLib.h>
+
+//
+// WSMT Definitions
+//
+
+#define EFI_ACPI_OEM_WSMT_REVISION 0x00000001
EFI_ACPI_WSMT_TABLE Wsmt = {
{
diff --git a/Platform/Intel/MinPlatformPkg/Acpi/AcpiTables/Wsmt/Wsmt.h b/Platform/Intel/MinPlatformPkg/Acpi/AcpiTables/Wsmt/Wsmt.h
deleted file mode 100644
index dba8e23685..0000000000
--- a/Platform/Intel/MinPlatformPkg/Acpi/AcpiTables/Wsmt/Wsmt.h
+++ /dev/null
@@ -1,30 +0,0 @@
-/** @file
- ACPI WSMT table
-
-Copyright (c) 2017, Intel Corporation. All rights reserved.<BR>
-This program and the accompanying materials are licensed and made available under
-the terms and conditions of the BSD License that accompanies this distribution.
-The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php.
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-**/
-
-#ifndef _WSMT_H_
-#define _WSMT_H_
-
-#include <IndustryStandard/Acpi.h>
-#include <IndustryStandard/WindowsSmmSecurityMitigationTable.h>
-#include <Library/PcdLib.h>
-
-//
-// WSMT Definitions
-//
-
-#define EFI_ACPI_OEM_WSMT_REVISION 0x00000001
-
-extern EFI_ACPI_WSMT_TABLE Wsmt;
-
-#endif