diff --git a/ArmPkg/ArmPkg.dsc b/ArmPkg/ArmPkg.dsc
index 93683aa0f1..f0f29737f2 100644
--- a/ArmPkg/ArmPkg.dsc
+++ b/ArmPkg/ArmPkg.dsc
@@ -57,6 +57,7 @@
PeCoffLib2|MdePkg/Library/BasePeCoffLib2/BasePeCoffLib2.inf
UefiImageLib|MdePkg/Library/BaseUefiImageLib/BaseUefiImageLibPeCoff.inf
UefiImageExtraActionLib|MdePkg/Library/BaseUefiImageExtraActionLibNull/BaseUefiImageExtraActionLibNull.inf
+ CpuArchLib|ArmPkg/Library/CpuArchLib/CpuArchLib.inf
UefiHiiServicesLib|MdeModulePkg/Library/UefiHiiServicesLib/UefiHiiServicesLib.inf
HiiLib|MdeModulePkg/Library/UefiHiiLib/UefiHiiLib.inf
@@ -119,8 +120,8 @@
ArmPkg/Library/ArmPsciResetSystemLib/ArmPsciResetSystemLib.inf
ArmPkg/Library/ArmExceptionLib/ArmExceptionLib.inf
ArmPkg/Library/ArmExceptionLib/ArmRelocateExceptionLib.inf
+ ArmPkg/Library/CpuArchLib/CpuArchLib.inf
- ArmPkg/Drivers/CpuDxe/CpuDxe.inf
ArmPkg/Drivers/CpuPei/CpuPei.inf
ArmPkg/Drivers/ArmGic/ArmGicDxe.inf
ArmPkg/Drivers/ArmGic/ArmGicLib.inf
diff --git a/ArmPkg/Drivers/CpuDxe/AArch64/Mmu.c b/ArmPkg/Library/CpuArchLib/AArch64/Mmu.c
similarity index 100%
rename from ArmPkg/Drivers/CpuDxe/AArch64/Mmu.c
rename to ArmPkg/Library/CpuArchLib/AArch64/Mmu.c
diff --git a/ArmPkg/Drivers/CpuDxe/Arm/Mmu.c b/ArmPkg/Library/CpuArchLib/Arm/Mmu.c
similarity index 100%
rename from ArmPkg/Drivers/CpuDxe/Arm/Mmu.c
rename to ArmPkg/Library/CpuArchLib/Arm/Mmu.c
diff --git a/ArmPkg/Drivers/CpuDxe/CpuDxe.inf b/ArmPkg/Library/CpuArchLib/CpuArchLib.inf
similarity index 79%
rename from ArmPkg/Drivers/CpuDxe/CpuDxe.inf
rename to ArmPkg/Library/CpuArchLib/CpuArchLib.inf
index 596644497b..271e27ce5f 100644
--- a/ArmPkg/Drivers/CpuDxe/CpuDxe.inf
+++ b/ArmPkg/Library/CpuArchLib/CpuArchLib.inf
@@ -1,6 +1,6 @@
#/** @file
#
-# DXE CPU driver
+# This library installs CPU Architecture Protocol
#
# Copyright (c) 2009, Apple Inc. All rights reserved.
# Copyright (c) 2011-2013, ARM Limited. All rights reserved.
@@ -11,12 +11,11 @@
[Defines]
INF_VERSION = 0x00010005
- BASE_NAME = ArmCpuDxe
- FILE_GUID = B8D9777E-D72A-451F-9BDB-BAFB52A68415
- MODULE_TYPE = DXE_DRIVER
+ BASE_NAME = CpuArchLib
+ FILE_GUID = 47EE96CC-33FA-482B-8AD6-DD8C21AA3752
+ MODULE_TYPE = DXE_CORE
VERSION_STRING = 1.0
-
- ENTRY_POINT = CpuDxeInitialize
+ LIBRARY_CLASS = CpuArchLib
[Sources.Common]
CpuDxe.c
@@ -49,7 +48,6 @@
DxeServicesTableLib
HobLib
MemoryAllocationLib
- UefiDriverEntryPoint
UefiLib
[Protocols]
diff --git a/ArmPkg/Drivers/CpuDxe/CpuDxe.c b/ArmPkg/Library/CpuArchLib/CpuDxe.c
similarity index 95%
rename from ArmPkg/Drivers/CpuDxe/CpuDxe.c
rename to ArmPkg/Library/CpuArchLib/CpuDxe.c
index fc63e52784..15787e781f 100644
--- a/ArmPkg/Drivers/CpuDxe/CpuDxe.c
+++ b/ArmPkg/Library/CpuArchLib/CpuDxe.c
@@ -301,9 +301,8 @@ RemapUnusedMemoryNx (
}
EFI_STATUS
-CpuDxeInitialize (
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
+InitializeCpu (
+ VOID
)
{
EFI_STATUS Status;
@@ -360,3 +359,14 @@ CpuDxeInitialize (
return Status;
}
+
+/**
+ Initialize Multi-processor support.
+
+**/
+VOID
+InitializeMpSupport (
+ VOID
+ )
+{
+}
diff --git a/ArmPkg/Drivers/CpuDxe/CpuDxe.h b/ArmPkg/Library/CpuArchLib/CpuDxe.h
similarity index 100%
rename from ArmPkg/Drivers/CpuDxe/CpuDxe.h
rename to ArmPkg/Library/CpuArchLib/CpuDxe.h
diff --git a/ArmPkg/Drivers/CpuDxe/CpuMmuCommon.c b/ArmPkg/Library/CpuArchLib/CpuMmuCommon.c
similarity index 100%
rename from ArmPkg/Drivers/CpuDxe/CpuMmuCommon.c
rename to ArmPkg/Library/CpuArchLib/CpuMmuCommon.c
diff --git a/ArmPkg/Drivers/CpuDxe/Exception.c b/ArmPkg/Library/CpuArchLib/Exception.c
similarity index 100%
rename from ArmPkg/Drivers/CpuDxe/Exception.c
rename to ArmPkg/Library/CpuArchLib/Exception.c
diff --git a/ArmPkg/Drivers/CpuDxe/MemoryAttribute.c b/ArmPkg/Library/CpuArchLib/MemoryAttribute.c
similarity index 100%
rename from ArmPkg/Drivers/CpuDxe/MemoryAttribute.c
rename to ArmPkg/Library/CpuArchLib/MemoryAttribute.c
diff --git a/ArmVirtPkg/ArmVirt.dsc.inc b/ArmVirtPkg/ArmVirt.dsc.inc
index 704c9a33e2..9981821d97 100644
--- a/ArmVirtPkg/ArmVirt.dsc.inc
+++ b/ArmVirtPkg/ArmVirt.dsc.inc
@@ -233,6 +233,7 @@
DxeCoreEntryPoint|MdePkg/Library/DxeCoreEntryPoint/DxeCoreEntryPoint.inf
ExtractGuidedSectionLib|MdePkg/Library/DxeExtractGuidedSectionLib/DxeExtractGuidedSectionLib.inf
PerformanceLib|MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.inf
+ CpuArchLib|ArmPkg/Library/CpuArchLib/CpuArchLib.inf
[LibraryClasses.common.DXE_DRIVER]
SecurityManagementLib|MdeModulePkg/Library/DxeSecurityManagementLib/DxeSecurityManagementLib.inf
diff --git a/ArmVirtPkg/ArmVirtCloudHv.dsc b/ArmVirtPkg/ArmVirtCloudHv.dsc
index d5055a0341..f3800a7f18 100644
--- a/ArmVirtPkg/ArmVirtCloudHv.dsc
+++ b/ArmVirtPkg/ArmVirtCloudHv.dsc
@@ -237,6 +237,9 @@
NULL|MdeModulePkg/Library/DxeCrc32GuidedSectionExtractLib/DxeCrc32GuidedSectionExtractLib.inf
DevicePathLib|MdePkg/Library/UefiDevicePathLib/UefiDevicePathLib.inf
+ DxeServicesTableLib|MdeModulePkg/Library/DxeCoreDxeServicesTableLib/DxeCoreDxeServicesTableLib.inf
+ UefiBootServicesTableLib|MdeModulePkg/Library/DxeCoreUefiBootServicesTableLib/DxeCoreUefiBootServicesTableLib.inf
+ UefiRuntimeServicesTableLib|MdeModulePkg/Library/DxeCoreUefiRuntimeServicesTableLib/DxeCoreUefiRuntimeServicesTableLib.inf
}
MdeModulePkg/Universal/PCD/Dxe/Pcd.inf {
@@ -246,7 +249,6 @@
#
# Architectural Protocols
#
- ArmPkg/Drivers/CpuDxe/CpuDxe.inf
MdeModulePkg/Core/RuntimeDxe/RuntimeDxe.inf
MdeModulePkg/Universal/Variable/RuntimeDxe/VariableRuntimeDxe.inf {
diff --git a/ArmVirtPkg/ArmVirtCloudHv.fdf b/ArmVirtPkg/ArmVirtCloudHv.fdf
index 8554efc294..c8e7b6d412 100644
--- a/ArmVirtPkg/ArmVirtCloudHv.fdf
+++ b/ArmVirtPkg/ArmVirtCloudHv.fdf
@@ -112,7 +112,6 @@ READ_LOCK_STATUS = TRUE
#
# PI DXE Drivers producing Architectural Protocols (EFI Services)
#
- INF ArmPkg/Drivers/CpuDxe/CpuDxe.inf
INF MdeModulePkg/Core/RuntimeDxe/RuntimeDxe.inf
INF MdeModulePkg/Universal/SecurityStubDxe/SecurityStubDxe.inf
INF MdeModulePkg/Universal/CapsuleRuntimeDxe/CapsuleRuntimeDxe.inf
diff --git a/ArmVirtPkg/ArmVirtKvmTool.dsc b/ArmVirtPkg/ArmVirtKvmTool.dsc
index 076c1a6098..93829a1042 100644
--- a/ArmVirtPkg/ArmVirtKvmTool.dsc
+++ b/ArmVirtPkg/ArmVirtKvmTool.dsc
@@ -265,6 +265,9 @@
NULL|MdeModulePkg/Library/DxeCrc32GuidedSectionExtractLib/DxeCrc32GuidedSectionExtractLib.inf
DevicePathLib|MdePkg/Library/UefiDevicePathLib/UefiDevicePathLib.inf
+ DxeServicesTableLib|MdeModulePkg/Library/DxeCoreDxeServicesTableLib/DxeCoreDxeServicesTableLib.inf
+ UefiBootServicesTableLib|MdeModulePkg/Library/DxeCoreUefiBootServicesTableLib/DxeCoreUefiBootServicesTableLib.inf
+ UefiRuntimeServicesTableLib|MdeModulePkg/Library/DxeCoreUefiRuntimeServicesTableLib/DxeCoreUefiRuntimeServicesTableLib.inf
}
MdeModulePkg/Universal/PCD/Dxe/Pcd.inf {
@@ -274,7 +277,6 @@
#
# Architectural Protocols
#
- ArmPkg/Drivers/CpuDxe/CpuDxe.inf
MdeModulePkg/Core/RuntimeDxe/RuntimeDxe.inf
MdeModulePkg/Universal/Variable/RuntimeDxe/VariableRuntimeDxe.inf {
diff --git a/ArmVirtPkg/ArmVirtKvmTool.fdf b/ArmVirtPkg/ArmVirtKvmTool.fdf
index cdf756c112..f44ee9502f 100644
--- a/ArmVirtPkg/ArmVirtKvmTool.fdf
+++ b/ArmVirtPkg/ArmVirtKvmTool.fdf
@@ -127,7 +127,6 @@ READ_LOCK_STATUS = TRUE
#
# PI DXE Drivers producing Architectural Protocols (EFI Services)
#
- INF ArmPkg/Drivers/CpuDxe/CpuDxe.inf
INF MdeModulePkg/Core/RuntimeDxe/RuntimeDxe.inf
INF MdeModulePkg/Universal/SecurityStubDxe/SecurityStubDxe.inf
INF MdeModulePkg/Universal/CapsuleRuntimeDxe/CapsuleRuntimeDxe.inf
diff --git a/ArmVirtPkg/ArmVirtQemu.dsc b/ArmVirtPkg/ArmVirtQemu.dsc
index 64aa4e96e5..b42badbe58 100644
--- a/ArmVirtPkg/ArmVirtQemu.dsc
+++ b/ArmVirtPkg/ArmVirtQemu.dsc
@@ -372,6 +372,9 @@
NULL|MdeModulePkg/Library/DxeCrc32GuidedSectionExtractLib/DxeCrc32GuidedSectionExtractLib.inf
DevicePathLib|MdePkg/Library/UefiDevicePathLib/UefiDevicePathLib.inf
+ DxeServicesTableLib|MdeModulePkg/Library/DxeCoreDxeServicesTableLib/DxeCoreDxeServicesTableLib.inf
+ UefiBootServicesTableLib|MdeModulePkg/Library/DxeCoreUefiBootServicesTableLib/DxeCoreUefiBootServicesTableLib.inf
+ UefiRuntimeServicesTableLib|MdeModulePkg/Library/DxeCoreUefiRuntimeServicesTableLib/DxeCoreUefiRuntimeServicesTableLib.inf
}
MdeModulePkg/Universal/PCD/Dxe/Pcd.inf {
@@ -381,7 +384,6 @@
#
# Architectural Protocols
#
- ArmPkg/Drivers/CpuDxe/CpuDxe.inf
MdeModulePkg/Core/RuntimeDxe/RuntimeDxe.inf
MdeModulePkg/Universal/Variable/RuntimeDxe/VariableRuntimeDxe.inf {
diff --git a/ArmVirtPkg/ArmVirtQemuFvMain.fdf.inc b/ArmVirtPkg/ArmVirtQemuFvMain.fdf.inc
index 38906004d7..9ed1c73715 100644
--- a/ArmVirtPkg/ArmVirtQemuFvMain.fdf.inc
+++ b/ArmVirtPkg/ArmVirtQemuFvMain.fdf.inc
@@ -47,7 +47,6 @@ READ_LOCK_STATUS = TRUE
#
# PI DXE Drivers producing Architectural Protocols (EFI Services)
#
- INF ArmPkg/Drivers/CpuDxe/CpuDxe.inf
INF MdeModulePkg/Core/RuntimeDxe/RuntimeDxe.inf
INF MdeModulePkg/Universal/SecurityStubDxe/SecurityStubDxe.inf
INF MdeModulePkg/Universal/CapsuleRuntimeDxe/CapsuleRuntimeDxe.inf
diff --git a/ArmVirtPkg/ArmVirtQemuKernel.dsc b/ArmVirtPkg/ArmVirtQemuKernel.dsc
index 2cf96accbd..1f134f2cfe 100644
--- a/ArmVirtPkg/ArmVirtQemuKernel.dsc
+++ b/ArmVirtPkg/ArmVirtQemuKernel.dsc
@@ -284,6 +284,9 @@
NULL|MdeModulePkg/Library/DxeCrc32GuidedSectionExtractLib/DxeCrc32GuidedSectionExtractLib.inf
DevicePathLib|MdePkg/Library/UefiDevicePathLib/UefiDevicePathLib.inf
+ DxeServicesTableLib|MdeModulePkg/Library/DxeCoreDxeServicesTableLib/DxeCoreDxeServicesTableLib.inf
+ UefiBootServicesTableLib|MdeModulePkg/Library/DxeCoreUefiBootServicesTableLib/DxeCoreUefiBootServicesTableLib.inf
+ UefiRuntimeServicesTableLib|MdeModulePkg/Library/DxeCoreUefiRuntimeServicesTableLib/DxeCoreUefiRuntimeServicesTableLib.inf
}
MdeModulePkg/Universal/PCD/Dxe/Pcd.inf {
@@ -293,7 +296,6 @@
#
# Architectural Protocols
#
- ArmPkg/Drivers/CpuDxe/CpuDxe.inf
MdeModulePkg/Core/RuntimeDxe/RuntimeDxe.inf
MdeModulePkg/Universal/Variable/RuntimeDxe/VariableRuntimeDxe.inf {
diff --git a/ArmVirtPkg/ArmVirtXen.dsc b/ArmVirtPkg/ArmVirtXen.dsc
index 1505709a29..6bc3fcfcf0 100644
--- a/ArmVirtPkg/ArmVirtXen.dsc
+++ b/ArmVirtPkg/ArmVirtXen.dsc
@@ -169,6 +169,9 @@
NULL|MdeModulePkg/Library/DxeCrc32GuidedSectionExtractLib/DxeCrc32GuidedSectionExtractLib.inf
DevicePathLib|MdePkg/Library/UefiDevicePathLib/UefiDevicePathLib.inf
+ DxeServicesTableLib|MdeModulePkg/Library/DxeCoreDxeServicesTableLib/DxeCoreDxeServicesTableLib.inf
+ UefiBootServicesTableLib|MdeModulePkg/Library/DxeCoreUefiBootServicesTableLib/DxeCoreUefiBootServicesTableLib.inf
+ UefiRuntimeServicesTableLib|MdeModulePkg/Library/DxeCoreUefiRuntimeServicesTableLib/DxeCoreUefiRuntimeServicesTableLib.inf
}
MdeModulePkg/Universal/PCD/Dxe/Pcd.inf {
@@ -178,7 +181,6 @@
#
# Architectural Protocols
#
- ArmPkg/Drivers/CpuDxe/CpuDxe.inf
MdeModulePkg/Core/RuntimeDxe/RuntimeDxe.inf
MdeModulePkg/Universal/SecurityStubDxe/SecurityStubDxe.inf
MdeModulePkg/Universal/CapsuleRuntimeDxe/CapsuleRuntimeDxe.inf
diff --git a/ArmVirtPkg/ArmVirtXen.fdf b/ArmVirtPkg/ArmVirtXen.fdf
index ea835551b3..1e0ccfec8a 100644
--- a/ArmVirtPkg/ArmVirtXen.fdf
+++ b/ArmVirtPkg/ArmVirtXen.fdf
@@ -144,7 +144,6 @@ READ_LOCK_STATUS = TRUE
#
# PI DXE Drivers producing Architectural Protocols (EFI Services)
#
- INF ArmPkg/Drivers/CpuDxe/CpuDxe.inf
INF MdeModulePkg/Core/RuntimeDxe/RuntimeDxe.inf
INF MdeModulePkg/Universal/SecurityStubDxe/SecurityStubDxe.inf
INF MdeModulePkg/Universal/CapsuleRuntimeDxe/CapsuleRuntimeDxe.inf
diff --git a/MdeModulePkg/Core/Dxe/Dispatcher/Dispatcher.c b/MdeModulePkg/Core/Dxe/Dispatcher/Dispatcher.c
index cf9d556877..6bd35b9d3d 100644
--- a/MdeModulePkg/Core/Dxe/Dispatcher/Dispatcher.c
+++ b/MdeModulePkg/Core/Dxe/Dispatcher/Dispatcher.c
@@ -453,7 +453,7 @@ CoreDispatcher (
DEBUG ((DEBUG_INFO, "Loading driver %g\n", &DriverEntry->FileName));
Status = CoreLoadImage (
FALSE,
- gDxeCoreImageHandle,
+ gImageHandle,
DriverEntry->FvFileDevicePath,
NULL,
0,
diff --git a/MdeModulePkg/Core/Dxe/DxeMain.h b/MdeModulePkg/Core/Dxe/DxeMain.h
index aba7b6a03a..e78c52de02 100644
--- a/MdeModulePkg/Core/Dxe/DxeMain.h
+++ b/MdeModulePkg/Core/Dxe/DxeMain.h
@@ -84,6 +84,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
#include
#include
#include
+#include
//
// attributes for reserved memory before it is promoted to system memory
@@ -231,14 +232,14 @@ typedef struct {
//
// DXE Core Global Variables
//
-extern EFI_SYSTEM_TABLE *gDxeCoreST;
-extern EFI_RUNTIME_SERVICES *gDxeCoreRT;
-extern EFI_DXE_SERVICES *gDxeCoreDS;
-extern EFI_HANDLE gDxeCoreImageHandle;
+extern EFI_SYSTEM_TABLE *gST;
+extern EFI_RUNTIME_SERVICES *gRT;
+extern EFI_DXE_SERVICES *gDS;
+extern EFI_HANDLE gImageHandle;
-extern BOOLEAN gMemoryMapTerminated;
+extern BOOLEAN gMemoryMapTerminated;
-extern EFI_DECOMPRESS_PROTOCOL gEfiDecompress;
+extern EFI_DECOMPRESS_PROTOCOL gEfiDecompress;
extern EFI_RUNTIME_ARCH_PROTOCOL *gRuntime;
extern EFI_CPU_ARCH_PROTOCOL *gCpu;
@@ -250,20 +251,21 @@ extern EFI_SECURITY2_ARCH_PROTOCOL *gSecurity2;
extern EFI_BDS_ARCH_PROTOCOL *gBds;
extern EFI_SMM_BASE2_PROTOCOL *gSmmBase2;
-extern EFI_TPL gEfiCurrentTpl;
+extern EFI_TPL gEfiCurrentTpl;
-extern EFI_GUID *gDxeCoreFileName;
-extern EFI_LOADED_IMAGE_PROTOCOL *gDxeCoreLoadedImage;
+extern EFI_GUID *gDxeCoreFileName;
+extern EFI_LOADED_IMAGE_PROTOCOL *gDxeCoreLoadedImage;
-extern EFI_MEMORY_TYPE_INFORMATION gMemoryTypeInformation[EfiMaxMemoryType + 1];
+extern EFI_MEMORY_TYPE_INFORMATION gMemoryTypeInformation[EfiMaxMemoryType + 1];
-extern BOOLEAN gDispatcherRunning;
-extern EFI_RUNTIME_ARCH_PROTOCOL gRuntimeTemplate;
+extern BOOLEAN gDispatcherRunning;
+extern EFI_RUNTIME_ARCH_PROTOCOL gRuntimeTemplate;
extern BOOLEAN gMemoryAttributesTableForwardCfi;
extern EFI_LOAD_FIXED_ADDRESS_CONFIGURATION_TABLE gLoadModuleAtFixAddressConfigurationTable;
extern BOOLEAN gLoadFixedAddressCodeMemoryReady;
+extern LOADED_IMAGE_PRIVATE_DATA * mCurrentImage;
//
// Service Initialization Functions
//
diff --git a/MdeModulePkg/Core/Dxe/DxeMain.inf b/MdeModulePkg/Core/Dxe/DxeMain.inf
index 5f38eb597b..cc9905a8d9 100644
--- a/MdeModulePkg/Core/Dxe/DxeMain.inf
+++ b/MdeModulePkg/Core/Dxe/DxeMain.inf
@@ -71,6 +71,7 @@
[Packages]
MdePkg/MdePkg.dec
MdeModulePkg/MdeModulePkg.dec
+ UefiCpuPkg/UefiCpuPkg.dec
[LibraryClasses]
BaseMemoryLib
@@ -94,6 +95,7 @@
CpuExceptionHandlerLib
PcdLib
ImagePropertiesRecordLib
+ CpuArchLib
[Guids]
gEfiEventMemoryMapChangeGuid ## PRODUCES ## Event
diff --git a/MdeModulePkg/Core/Dxe/DxeMain/DxeMain.c b/MdeModulePkg/Core/Dxe/DxeMain/DxeMain.c
index a24dd8e6a5..e2576a028f 100644
--- a/MdeModulePkg/Core/Dxe/DxeMain/DxeMain.c
+++ b/MdeModulePkg/Core/Dxe/DxeMain/DxeMain.c
@@ -120,28 +120,6 @@ EFI_DXE_SERVICES mDxeServices = {
(EFI_SET_MEMORY_SPACE_CAPABILITIES)CoreSetMemorySpaceCapabilities, // SetMemorySpaceCapabilities
};
-EFI_SYSTEM_TABLE mEfiSystemTableTemplate = {
- {
- EFI_SYSTEM_TABLE_SIGNATURE, // Signature
- EFI_SYSTEM_TABLE_REVISION, // Revision
- sizeof (EFI_SYSTEM_TABLE), // HeaderSize
- 0, // CRC32
- 0 // Reserved
- },
- NULL, // FirmwareVendor
- 0, // FirmwareRevision
- NULL, // ConsoleInHandle
- NULL, // ConIn
- NULL, // ConsoleOutHandle
- NULL, // ConOut
- NULL, // StandardErrorHandle
- NULL, // StdErr
- NULL, // RuntimeServices
- &mBootServices, // BootServices
- 0, // NumberOfConfigurationTableEntries
- NULL // ConfigurationTable
-};
-
EFI_RUNTIME_SERVICES mEfiRuntimeServicesTableTemplate = {
{
EFI_RUNTIME_SERVICES_SIGNATURE, // Signature
@@ -166,6 +144,28 @@ EFI_RUNTIME_SERVICES mEfiRuntimeServicesTableTemplate = {
(EFI_QUERY_VARIABLE_INFO)CoreEfiNotAvailableYetArg4 // QueryVariableInfo
};
+EFI_SYSTEM_TABLE mEfiSystemTableTemplate = {
+ {
+ EFI_SYSTEM_TABLE_SIGNATURE, // Signature
+ EFI_SYSTEM_TABLE_REVISION, // Revision
+ sizeof (EFI_SYSTEM_TABLE), // HeaderSize
+ 0, // CRC32
+ 0 // Reserved
+ },
+ NULL, // FirmwareVendor
+ 0, // FirmwareRevision
+ NULL, // ConsoleInHandle
+ NULL, // ConIn
+ NULL, // ConsoleOutHandle
+ NULL, // ConOut
+ NULL, // StandardErrorHandle
+ NULL, // StdErr
+ &mEfiRuntimeServicesTableTemplate, // RuntimeServices
+ &mBootServices, // BootServices
+ 0, // NumberOfConfigurationTableEntries
+ NULL // ConfigurationTable
+};
+
EFI_RUNTIME_ARCH_PROTOCOL gRuntimeTemplate = {
INITIALIZE_LIST_HEAD_VARIABLE (gRuntimeTemplate.ImageHead),
INITIALIZE_LIST_HEAD_VARIABLE (gRuntimeTemplate.EventHead),
@@ -190,18 +190,19 @@ EFI_RUNTIME_ARCH_PROTOCOL *gRuntime = &gRuntimeTemplate;
// DXE Core Global Variables for the EFI System Table, Boot Services Table,
// DXE Services Table, and Runtime Services Table
//
-EFI_DXE_SERVICES *gDxeCoreDS = &mDxeServices;
-EFI_SYSTEM_TABLE *gDxeCoreST = NULL;
+EFI_DXE_SERVICES *gDS = &mDxeServices;
+EFI_BOOT_SERVICES *gBS = &mBootServices;
+EFI_SYSTEM_TABLE *gST = &mEfiSystemTableTemplate;
//
-// For debug initialize gDxeCoreRT to template. gDxeCoreRT must be allocated from RT memory
-// but gDxeCoreRT is used for ASSERT () and DEBUG () type macros so lets give it
+// For debug initialize gRT to template. gRT must be allocated from RT memory
+// but gRT is used for ASSERT () and DEBUG () type macros so lets give it
// a value that will not cause debug infrastructure to crash early on.
//
-EFI_RUNTIME_SERVICES *gDxeCoreRT = &mEfiRuntimeServicesTableTemplate;
-EFI_HANDLE gDxeCoreImageHandle = NULL;
+EFI_RUNTIME_SERVICES *gRT = &mEfiRuntimeServicesTableTemplate;
+EFI_HANDLE gImageHandle = NULL;
-BOOLEAN gMemoryMapTerminated = FALSE;
+BOOLEAN gMemoryMapTerminated = FALSE;
//
// EFI Decompress Protocol
@@ -243,18 +244,6 @@ DxeMain (
EFI_VECTOR_HANDOFF_INFO *VectorInfoList;
EFI_VECTOR_HANDOFF_INFO *VectorInfo;
- //
- // Setup the default exception handlers
- //
- VectorInfoList = NULL;
- GuidHob = GetNextGuidHob (&gEfiVectorHandoffInfoPpiGuid, HobStart);
- if (GuidHob != NULL) {
- VectorInfoList = (EFI_VECTOR_HANDOFF_INFO *)(GET_GUID_HOB_DATA (GuidHob));
- }
-
- Status = InitializeCpuExceptionHandlers (VectorInfoList);
- ASSERT_EFI_ERROR (Status);
-
//
// Setup Stack Guard
//
@@ -291,26 +280,63 @@ DxeMain (
// Allocate the EFI System Table and EFI Runtime Service Table from EfiRuntimeServicesData
// Use the templates to initialize the contents of the EFI System Table and EFI Runtime Services Table
//
- gDxeCoreST = AllocateRuntimeCopyPool (sizeof (EFI_SYSTEM_TABLE), &mEfiSystemTableTemplate);
- ASSERT (gDxeCoreST != NULL);
+ gST = AllocateRuntimeCopyPool (sizeof (EFI_SYSTEM_TABLE), &mEfiSystemTableTemplate);
+ ASSERT (gST != NULL);
- gDxeCoreRT = AllocateRuntimeCopyPool (sizeof (EFI_RUNTIME_SERVICES), &mEfiRuntimeServicesTableTemplate);
- ASSERT (gDxeCoreRT != NULL);
+ gRT = AllocateRuntimeCopyPool (sizeof (EFI_RUNTIME_SERVICES), &mEfiRuntimeServicesTableTemplate);
+ ASSERT (gRT != NULL);
- gDxeCoreST->RuntimeServices = gDxeCoreRT;
+ gST->RuntimeServices = gRT;
+
+ //
+ // Install the DXE Services Table into the EFI System Tables's Configuration Table
+ //
+ Status = CoreInstallConfigurationTable (&gEfiDxeServicesTableGuid, gDS);
+ ASSERT_EFI_ERROR (Status);
//
// Update DXE Core Loaded Image Protocol with allocated UEFI System Table
//
- gDxeCoreLoadedImage->SystemTable = gDxeCoreST;
+ gDxeCoreLoadedImage->SystemTable = gST;
+
+ //
+ // Initialize the Event Services
+ //
+ Status = CoreInitializeEventServices ();
+ ASSERT_EFI_ERROR (Status);
+
+ //
+ // Register for the GUIDs of the Architectural Protocols, so the rest of the
+ // EFI Boot Services and EFI Runtime Services tables can be filled in.
+ // Also register for the GUIDs of optional protocols.
+ //
+ CoreNotifyOnProtocolInstallation ();
+
+ //
+ // Initialize CPU Architectural Protocol
+ //
+ InitializeCpu ();
+
+ MemoryProfileInstallProtocol ();
+
+ CoreInitializeMemoryAttributesTable ();
+
+ CoreInitializeMemoryProtection ();
+
+ ProtectUefiImage (mCurrentImage, &ImageContext);
//
// Call constructor for all libraries
//
- ProcessLibraryConstructorList (gDxeCoreImageHandle, gDxeCoreST);
+ ProcessLibraryConstructorList (gImageHandle, gST);
PERF_CROSSMODULE_END ("PEI");
PERF_CROSSMODULE_BEGIN ("DXE");
+ //
+ // Initialize Multi-processor support
+ //
+ InitializeMpSupport ();
+
//
// Log MemoryBaseAddress and MemoryLength again (from
// CoreInitializeMemoryServices()), now that library constructors have
@@ -330,12 +356,6 @@ DxeMain (
//
UefiImageLoaderRelocateImageExtraAction (&ImageContext);
- //
- // Install the DXE Services Table into the EFI System Tables's Configuration Table
- //
- Status = CoreInstallConfigurationTable (&gEfiDxeServicesTableGuid, gDxeCoreDS);
- ASSERT_EFI_ERROR (Status);
-
//
// Install the HOB List into the EFI System Tables's Configuration Table
//
@@ -375,7 +395,7 @@ DxeMain (
CoreNewDebugImageInfoEntry (
EFI_DEBUG_IMAGE_INFO_TYPE_NORMAL,
gDxeCoreLoadedImage,
- gDxeCoreImageHandle,
+ gImageHandle,
&ImageContext
);
@@ -439,21 +459,11 @@ DxeMain (
DEBUG_CODE_END ();
- //
- // Initialize the Event Services
- //
- Status = CoreInitializeEventServices ();
- ASSERT_EFI_ERROR (Status);
-
- MemoryProfileInstallProtocol ();
-
- CoreInitializeMemoryAttributesTable ();
- CoreInitializeMemoryProtection ();
-
//
// Get persisted vector hand-off info from GUIDeed HOB again due to HobStart may be updated,
// and install configuration table
//
+ VectorInfoList = NULL;
GuidHob = GetNextGuidHob (&gEfiVectorHandoffInfoPpiGuid, HobStart);
if (GuidHob != NULL) {
VectorInfoList = (EFI_VECTOR_HANDOFF_INFO *)(GET_GUID_HOB_DATA (GuidHob));
@@ -493,26 +503,19 @@ DxeMain (
);
ASSERT_EFI_ERROR (Status);
- //
- // Register for the GUIDs of the Architectural Protocols, so the rest of the
- // EFI Boot Services and EFI Runtime Services tables can be filled in.
- // Also register for the GUIDs of optional protocols.
- //
- CoreNotifyOnProtocolInstallation ();
-
//
// Produce Firmware Volume Protocols, one for each FV in the HOB list.
//
- Status = FwVolBlockDriverInit (gDxeCoreImageHandle, gDxeCoreST);
+ Status = FwVolBlockDriverInit (gImageHandle, gST);
ASSERT_EFI_ERROR (Status);
- Status = FwVolDriverInit (gDxeCoreImageHandle, gDxeCoreST);
+ Status = FwVolDriverInit (gImageHandle, gST);
ASSERT_EFI_ERROR (Status);
//
// Produce the Section Extraction Protocol
//
- Status = InitializeSectionExtraction (gDxeCoreImageHandle, gDxeCoreST);
+ Status = InitializeSectionExtraction (gImageHandle, gST);
ASSERT_EFI_ERROR (Status);
//
@@ -811,18 +814,18 @@ CoreExitBootServices (
//
// Clear the non-runtime values of the EFI System Table
//
- gDxeCoreST->BootServices = NULL;
- gDxeCoreST->ConIn = NULL;
- gDxeCoreST->ConsoleInHandle = NULL;
- gDxeCoreST->ConOut = NULL;
- gDxeCoreST->ConsoleOutHandle = NULL;
- gDxeCoreST->StdErr = NULL;
- gDxeCoreST->StandardErrorHandle = NULL;
+ gST->BootServices = NULL;
+ gST->ConIn = NULL;
+ gST->ConsoleInHandle = NULL;
+ gST->ConOut = NULL;
+ gST->ConsoleOutHandle = NULL;
+ gST->StdErr = NULL;
+ gST->StandardErrorHandle = NULL;
//
// Recompute the 32-bit CRC of the EFI System Table
//
- CalculateEfiHdrCrc (&gDxeCoreST->Hdr);
+ CalculateEfiHdrCrc (&gST->Hdr);
//
// Zero out the Boot Service Table
diff --git a/MdeModulePkg/Core/Dxe/DxeMain/DxeProtocolNotify.c b/MdeModulePkg/Core/Dxe/DxeMain/DxeProtocolNotify.c
index 3fe02940ed..1f85d33f97 100644
--- a/MdeModulePkg/Core/Dxe/DxeMain/DxeProtocolNotify.c
+++ b/MdeModulePkg/Core/Dxe/DxeMain/DxeProtocolNotify.c
@@ -194,10 +194,10 @@ GenericProtocolNotify (
//
// It's over kill to do them all every time, but it saves a lot of code.
//
- CalculateEfiHdrCrc (&gDxeCoreRT->Hdr);
+ CalculateEfiHdrCrc (&gRT->Hdr);
CalculateEfiHdrCrc (&gBS->Hdr);
- CalculateEfiHdrCrc (&gDxeCoreST->Hdr);
- CalculateEfiHdrCrc (&gDxeCoreDS->Hdr);
+ CalculateEfiHdrCrc (&gST->Hdr);
+ CalculateEfiHdrCrc (&gDS->Hdr);
}
/**
diff --git a/MdeModulePkg/Core/Dxe/Gcd/Gcd.c b/MdeModulePkg/Core/Dxe/Gcd/Gcd.c
index fe1bbd6974..143b452d06 100644
--- a/MdeModulePkg/Core/Dxe/Gcd/Gcd.c
+++ b/MdeModulePkg/Core/Dxe/Gcd/Gcd.c
@@ -1483,7 +1483,7 @@ CoreAddMemorySpace (
EFI_PAGE_SHIFT,
PageLength,
&PageBaseAddress,
- gDxeCoreImageHandle,
+ gImageHandle,
NULL
);
@@ -1502,7 +1502,7 @@ CoreAddMemorySpace (
EFI_PAGE_SHIFT,
EFI_PAGE_SIZE,
&PageBaseAddress,
- gDxeCoreImageHandle,
+ gImageHandle,
NULL
);
@@ -2727,7 +2727,7 @@ CoreInitializeGcdServices (
0,
MemoryLength,
&MemoryBaseAddress,
- gDxeCoreImageHandle,
+ gImageHandle,
NULL
);
}
@@ -2748,7 +2748,7 @@ CoreInitializeGcdServices (
0,
MemoryHob->AllocDescriptor.MemoryLength,
&BaseAddress,
- gDxeCoreImageHandle,
+ gImageHandle,
NULL
);
if (!EFI_ERROR (Status) &&
@@ -2774,7 +2774,7 @@ CoreInitializeGcdServices (
0,
FirmwareVolumeHob->Length,
&BaseAddress,
- gDxeCoreImageHandle,
+ gImageHandle,
NULL
);
}
@@ -2822,7 +2822,7 @@ CoreInitializeGcdServices (
0,
Length,
&BaseAddress,
- gDxeCoreImageHandle,
+ gImageHandle,
NULL
);
}
@@ -2864,7 +2864,7 @@ CoreInitializeGcdServices (
0,
Length,
&BaseAddress,
- gDxeCoreImageHandle,
+ gImageHandle,
NULL
);
}
diff --git a/MdeModulePkg/Core/Dxe/Hand/Handle.c b/MdeModulePkg/Core/Dxe/Hand/Handle.c
index 24e4fbf5f3..3a4564a5e9 100644
--- a/MdeModulePkg/Core/Dxe/Hand/Handle.c
+++ b/MdeModulePkg/Core/Dxe/Hand/Handle.c
@@ -980,7 +980,7 @@ CoreHandleProtocol (
UserHandle,
Protocol,
Interface,
- gDxeCoreImageHandle,
+ gImageHandle,
NULL,
EFI_OPEN_PROTOCOL_BY_HANDLE_PROTOCOL
);
diff --git a/MdeModulePkg/Core/Dxe/Image/Image.c b/MdeModulePkg/Core/Dxe/Image/Image.c
index d6ee206809..4a6a6bbba4 100644
--- a/MdeModulePkg/Core/Dxe/Image/Image.c
+++ b/MdeModulePkg/Core/Dxe/Image/Image.c
@@ -271,7 +271,7 @@ CoreInitializeImageServices (
//
// Fill in DXE globals
//
- gDxeCoreImageHandle = Image->Handle;
+ gImageHandle = Image->Handle;
gDxeCoreLoadedImage = &Image->Info;
//
@@ -298,8 +298,6 @@ CoreInitializeImageServices (
InitializeListHead (&mAvailableEmulators);
- ProtectUefiImage (Image, ImageContext);
-
return Status;
}
@@ -1285,7 +1283,7 @@ CoreLoadImageCommon (
// Initialize the fields for an internal driver
//
Image->Signature = LOADED_IMAGE_PRIVATE_DATA_SIGNATURE;
- Image->Info.SystemTable = gDxeCoreST;
+ Image->Info.SystemTable = gST;
Image->Info.DeviceHandle = DeviceHandle;
Image->Info.Revision = EFI_LOADED_IMAGE_PROTOCOL_REVISION;
Image->Info.FilePath = DuplicateDevicePath (FilePath);
diff --git a/MdeModulePkg/Core/Dxe/Mem/Page.c b/MdeModulePkg/Core/Dxe/Mem/Page.c
index 5a51d9df1a..0a5c7180ca 100644
--- a/MdeModulePkg/Core/Dxe/Mem/Page.c
+++ b/MdeModulePkg/Core/Dxe/Mem/Page.c
@@ -419,7 +419,7 @@ PromoteMemoryResource (
}
Entry->Capabilities |= EFI_MEMORY_TESTED;
- Entry->ImageHandle = gDxeCoreImageHandle;
+ Entry->ImageHandle = gImageHandle;
Entry->DeviceHandle = NULL;
//
diff --git a/MdeModulePkg/Core/Dxe/Misc/DebugImageInfo.c b/MdeModulePkg/Core/Dxe/Misc/DebugImageInfo.c
index d6e732e021..9074de9670 100644
--- a/MdeModulePkg/Core/Dxe/Misc/DebugImageInfo.c
+++ b/MdeModulePkg/Core/Dxe/Misc/DebugImageInfo.c
@@ -119,7 +119,7 @@ CoreInitializeDebugImageInfoTable (
// Initialize EFI_SYSTEM_TABLE_POINTER structure
//
mDebugTable->Signature = EFI_SYSTEM_TABLE_SIGNATURE;
- mDebugTable->EfiSystemTableBase = (EFI_PHYSICAL_ADDRESS)(UINTN)gDxeCoreST;
+ mDebugTable->EfiSystemTableBase = (EFI_PHYSICAL_ADDRESS)(UINTN)gST;
mDebugTable->Crc32 = 0;
//
diff --git a/MdeModulePkg/Core/Dxe/Misc/InstallConfigurationTable.c b/MdeModulePkg/Core/Dxe/Misc/InstallConfigurationTable.c
index f47f3bd804..e7cc4764b9 100755
--- a/MdeModulePkg/Core/Dxe/Misc/InstallConfigurationTable.c
+++ b/MdeModulePkg/Core/Dxe/Misc/InstallConfigurationTable.c
@@ -45,18 +45,18 @@ CoreInstallConfigurationTable (
return EFI_INVALID_PARAMETER;
}
- EfiConfigurationTable = gDxeCoreST->ConfigurationTable;
+ EfiConfigurationTable = gST->ConfigurationTable;
//
// Search all the table for an entry that matches Guid
//
- for (Index = 0; Index < gDxeCoreST->NumberOfTableEntries; Index++) {
- if (CompareGuid (Guid, &(gDxeCoreST->ConfigurationTable[Index].VendorGuid))) {
+ for (Index = 0; Index < gST->NumberOfTableEntries; Index++) {
+ if (CompareGuid (Guid, &(gST->ConfigurationTable[Index].VendorGuid))) {
break;
}
}
- if (Index < gDxeCoreST->NumberOfTableEntries) {
+ if (Index < gST->NumberOfTableEntries) {
//
// A match was found, so this is either a modify or a delete operation
//
@@ -65,7 +65,7 @@ CoreInstallConfigurationTable (
// If Table is not NULL, then this is a modify operation.
// Modify the table entry and return.
//
- gDxeCoreST->ConfigurationTable[Index].VendorTable = Table;
+ gST->ConfigurationTable[Index].VendorTable = Table;
//
// Signal Configuration Table change
@@ -78,15 +78,15 @@ CoreInstallConfigurationTable (
//
// A match was found and Table is NULL, so this is a delete operation.
//
- gDxeCoreST->NumberOfTableEntries--;
+ gST->NumberOfTableEntries--;
//
// Copy over deleted entry
//
CopyMem (
&(EfiConfigurationTable[Index]),
- &(gDxeCoreST->ConfigurationTable[Index + 1]),
- (gDxeCoreST->NumberOfTableEntries - Index) * sizeof (EFI_CONFIGURATION_TABLE)
+ &(gST->ConfigurationTable[Index + 1]),
+ (gST->NumberOfTableEntries - Index) * sizeof (EFI_CONFIGURATION_TABLE)
);
} else {
//
@@ -101,7 +101,7 @@ CoreInstallConfigurationTable (
}
//
- // Assume that Index == gDxeCoreST->NumberOfTableEntries
+ // Assume that Index == gST->NumberOfTableEntries
//
if ((Index * sizeof (EFI_CONFIGURATION_TABLE)) >= mSystemTableAllocateSize) {
//
@@ -116,30 +116,30 @@ CoreInstallConfigurationTable (
return EFI_OUT_OF_RESOURCES;
}
- if (gDxeCoreST->ConfigurationTable != NULL) {
+ if (gST->ConfigurationTable != NULL) {
//
// Copy the old table to the new table.
//
CopyMem (
EfiConfigurationTable,
- gDxeCoreST->ConfigurationTable,
+ gST->ConfigurationTable,
Index * sizeof (EFI_CONFIGURATION_TABLE)
);
//
// Record the old table pointer.
//
- OldTable = gDxeCoreST->ConfigurationTable;
+ OldTable = gST->ConfigurationTable;
//
// As the CoreInstallConfigurationTable() may be re-entered by CoreFreePool()
// in its calling stack, updating System table to the new table pointer must
// be done before calling CoreFreePool() to free the old table.
- // It can make sure the gDxeCoreST->ConfigurationTable point to the new table
+ // It can make sure the gST->ConfigurationTable point to the new table
// and avoid the errors of use-after-free to the old table by the reenter of
// CoreInstallConfigurationTable() in CoreFreePool()'s calling stack.
//
- gDxeCoreST->ConfigurationTable = EfiConfigurationTable;
+ gST->ConfigurationTable = EfiConfigurationTable;
//
// Free the old table after updating System Table to the new table pointer.
@@ -149,7 +149,7 @@ CoreInstallConfigurationTable (
//
// Update System Table
//
- gDxeCoreST->ConfigurationTable = EfiConfigurationTable;
+ gST->ConfigurationTable = EfiConfigurationTable;
}
}
@@ -162,13 +162,13 @@ CoreInstallConfigurationTable (
//
// This is an add operation, so increment the number of table entries
//
- gDxeCoreST->NumberOfTableEntries++;
+ gST->NumberOfTableEntries++;
}
//
// Fix up the CRC-32 in the EFI System Table
//
- CalculateEfiHdrCrc (&gDxeCoreST->Hdr);
+ CalculateEfiHdrCrc (&gST->Hdr);
//
// Signal Configuration Table change
diff --git a/MdeModulePkg/Library/DxeCoreDxeServicesTableLib/DxeCoreDxeServicesTableLib.c b/MdeModulePkg/Library/DxeCoreDxeServicesTableLib/DxeCoreDxeServicesTableLib.c
new file mode 100644
index 0000000000..a683ea5dd3
--- /dev/null
+++ b/MdeModulePkg/Library/DxeCoreDxeServicesTableLib/DxeCoreDxeServicesTableLib.c
@@ -0,0 +1,48 @@
+/** @file
+ Dummy instance of DXE Services Table Library for DxeCore.
+
+ Relies on and sanity-checks that DxeCore provides the variables itself.
+
+ Copyright (c) 2021, Marvin Häuser. All rights reserved.
+ SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#include
+#include
+#include
+#include
+#include
+
+/**
+ The constructor function sanity-checks the variables set by DxeCore.
+ It will always return EFI_SUCCESS.
+
+ @param ImageHandle The firmware allocated handle for the EFI image.
+ @param SystemTable A pointer to the EFI System Table.
+
+ @retval EFI_SUCCESS The constructor always returns EFI_SUCCESS.
+
+**/
+EFI_STATUS
+EFIAPI
+DxeServicesTableLibConstructor (
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
+ )
+{
+ EFI_STATUS Status;
+ EFI_DXE_SERVICES *DS;
+
+ //
+ // ASSERT that DxeCore provides the services correctly and in time
+ //
+ DEBUG_CODE_BEGIN ();
+ Status = EfiGetSystemConfigurationTable (&gEfiDxeServicesTableGuid, (VOID **) &DS);
+ ASSERT_EFI_ERROR (Status);
+ ASSERT (gDS == DS);
+ DEBUG_CODE_END ();
+ ASSERT (gDS != NULL);
+
+ return EFI_SUCCESS;
+}
diff --git a/MdeModulePkg/Library/DxeCoreDxeServicesTableLib/DxeCoreDxeServicesTableLib.inf b/MdeModulePkg/Library/DxeCoreDxeServicesTableLib/DxeCoreDxeServicesTableLib.inf
new file mode 100644
index 0000000000..dd5633bdf6
--- /dev/null
+++ b/MdeModulePkg/Library/DxeCoreDxeServicesTableLib/DxeCoreDxeServicesTableLib.inf
@@ -0,0 +1,40 @@
+## @file
+# Dummy instance of DXE Services Table Library for DxeCore.
+#
+# Copyright (c) 2021, Marvin Häuser. All rights reserved.
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+#
+##
+
+[Defines]
+ INF_VERSION = 0x00010005
+ BASE_NAME = DxeCoreDxeServicesTableLib
+ MODULE_UNI_FILE = DxeCoreDxeServicesTableLib.uni
+ FILE_GUID = 898fc74c-b07c-4b68-bdd3-365c9ce26a9d
+ MODULE_TYPE = DXE_CORE
+ VERSION_STRING = 1.0
+ LIBRARY_CLASS = DxeServicesTableLib|DXE_CORE
+
+ CONSTRUCTOR = DxeServicesTableLibConstructor
+
+#
+# VALID_ARCHITECTURES = IA32 X64 EBC ARM AARCH64
+#
+
+[Sources]
+ DxeCoreDxeServicesTableLib.c
+
+
+[Packages]
+ MdePkg/MdePkg.dec
+
+
+[LibraryClasses]
+ UefiLib
+ DebugLib
+
+
+[Guids]
+ gEfiDxeServicesTableGuid ## CONSUMES ## SystemTable
diff --git a/MdeModulePkg/Library/DxeCoreDxeServicesTableLib/DxeCoreDxeServicesTableLib.uni b/MdeModulePkg/Library/DxeCoreDxeServicesTableLib/DxeCoreDxeServicesTableLib.uni
new file mode 100644
index 0000000000..0019a62e3f
--- /dev/null
+++ b/MdeModulePkg/Library/DxeCoreDxeServicesTableLib/DxeCoreDxeServicesTableLib.uni
@@ -0,0 +1,13 @@
+// /** @file
+// Dummy instance of DXE Services Table Library for DxeCore.
+//
+// Copyright (c) 2021, Marvin Häuser. All rights reserved.
+//
+// SPDX-License-Identifier: BSD-2-Clause-Patent
+//
+// **/
+
+
+#string STR_MODULE_ABSTRACT #language en-US "Dummy instance for DxeCore"
+
+#string STR_MODULE_DESCRIPTION #language en-US "DXE Services Table Library retrieves a pointer to the DXE Services Table from the Configuration Table in the EFI System Table."
diff --git a/MdeModulePkg/Library/DxeCoreUefiBootServicesTableLib/DxeCoreUefiBootServicesTableLib.c b/MdeModulePkg/Library/DxeCoreUefiBootServicesTableLib/DxeCoreUefiBootServicesTableLib.c
new file mode 100644
index 0000000000..aa95351214
--- /dev/null
+++ b/MdeModulePkg/Library/DxeCoreUefiBootServicesTableLib/DxeCoreUefiBootServicesTableLib.c
@@ -0,0 +1,44 @@
+/** @file
+ Dummy instance of UEFI Boot Services Table Library for DxeCore.
+
+ Relies on and sanity-checks that DxeCore provides the variables itself.
+
+ Copyright (c) 2021, Marvin Häuser. All rights reserved.
+ SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#include
+
+#include
+#include
+
+/**
+ The constructor function sanity-checks the variables set by DxeCore.
+ It will always return EFI_SUCCESS.
+
+ @param ImageHandle The firmware allocated handle for the EFI image.
+ @param SystemTable A pointer to the EFI System Table.
+
+ @retval EFI_SUCCESS The constructor always returns EFI_SUCCESS.
+
+**/
+EFI_STATUS
+EFIAPI
+UefiBootServicesTableLibConstructor (
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
+ )
+{
+ //
+ // ASSERT that DxeCore provides the services correctly and in time
+ //
+ ASSERT (gImageHandle == ImageHandle);
+ ASSERT (gImageHandle != NULL);
+ ASSERT (gST == SystemTable);
+ ASSERT (gST != NULL);
+ ASSERT (gBS == gST->BootServices);
+ ASSERT (gBS != NULL);
+
+ return EFI_SUCCESS;
+}
diff --git a/MdeModulePkg/Library/DxeCoreUefiBootServicesTableLib/DxeCoreUefiBootServicesTableLib.inf b/MdeModulePkg/Library/DxeCoreUefiBootServicesTableLib/DxeCoreUefiBootServicesTableLib.inf
new file mode 100644
index 0000000000..81b70fac3f
--- /dev/null
+++ b/MdeModulePkg/Library/DxeCoreUefiBootServicesTableLib/DxeCoreUefiBootServicesTableLib.inf
@@ -0,0 +1,34 @@
+## @file
+# Dummy instance of UEFI Boot Services Table Library for DxeCore.
+#
+# Copyright (c) 2021, Marvin Häuser. All rights reserved.
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+#
+##
+
+[Defines]
+ INF_VERSION = 0x00010005
+ BASE_NAME = DxeCoreUefiBootServicesTableLib
+ MODULE_UNI_FILE = DxeCoreUefiBootServicesTableLib.uni
+ FILE_GUID = 67ecd0d0-5e42-4933-baee-cb129e4f4c55
+ MODULE_TYPE = DXE_CORE
+ VERSION_STRING = 1.0
+ LIBRARY_CLASS = UefiBootServicesTableLib|DXE_CORE
+
+ CONSTRUCTOR = UefiBootServicesTableLibConstructor
+
+#
+# VALID_ARCHITECTURES = IA32 X64 EBC ARM AARCH64
+#
+
+[Sources]
+ DxeCoreUefiBootServicesTableLib.c
+
+[Packages]
+ MdePkg/MdePkg.dec
+
+
+[LibraryClasses]
+ DebugLib
diff --git a/MdeModulePkg/Library/DxeCoreUefiBootServicesTableLib/DxeCoreUefiBootServicesTableLib.uni b/MdeModulePkg/Library/DxeCoreUefiBootServicesTableLib/DxeCoreUefiBootServicesTableLib.uni
new file mode 100644
index 0000000000..4f060a394d
--- /dev/null
+++ b/MdeModulePkg/Library/DxeCoreUefiBootServicesTableLib/DxeCoreUefiBootServicesTableLib.uni
@@ -0,0 +1,13 @@
+// /** @file
+// Dummy instance of UEFI Boot Services Table Library for DxeCore.
+//
+// Copyright (c) 2021, Marvin Häuser. All rights reserved.
+//
+// SPDX-License-Identifier: BSD-2-Clause-Patent
+//
+// **/
+
+
+#string STR_MODULE_ABSTRACT #language en-US "Dummy instance of UEFI Boot Services Table Library for DxeCore"
+
+#string STR_MODULE_DESCRIPTION #language en-US "Dummy instance of UEFI Boot Services Table Library for DxeCore."
diff --git a/MdeModulePkg/Library/DxeCoreUefiRuntimeServicesTableLib/DxeCoreUefiRuntimeServicesTableLib.c b/MdeModulePkg/Library/DxeCoreUefiRuntimeServicesTableLib/DxeCoreUefiRuntimeServicesTableLib.c
new file mode 100644
index 0000000000..3c92746ab1
--- /dev/null
+++ b/MdeModulePkg/Library/DxeCoreUefiRuntimeServicesTableLib/DxeCoreUefiRuntimeServicesTableLib.c
@@ -0,0 +1,39 @@
+/** @file
+ Dummy instance of UEFI Runtime Services Table Library for DxeCore.
+
+ Relies on and sanity-checks that DxeCore provides the variables itself.
+
+ Copyright (c) 2021, Marvin Häuser. All rights reserved.
+ SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#include
+
+#include
+#include
+
+/**
+ The constructor function sanity-checks the variables set by DxeCore.
+ It will always return EFI_SUCCESS.
+
+ @param ImageHandle The firmware allocated handle for the EFI image.
+ @param SystemTable A pointer to the EFI System Table.
+
+ @retval EFI_SUCCESS The constructor always returns EFI_SUCCESS.
+
+**/
+EFI_STATUS
+EFIAPI
+UefiRuntimeServicesTableLibConstructor (
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
+ )
+{
+ //
+ // ASSERT that DxeCore provides the services correctly and in time
+ //
+ ASSERT (gRT == SystemTable->RuntimeServices);
+ ASSERT (gRT != NULL);
+ return EFI_SUCCESS;
+}
diff --git a/MdeModulePkg/Library/DxeCoreUefiRuntimeServicesTableLib/DxeCoreUefiRuntimeServicesTableLib.inf b/MdeModulePkg/Library/DxeCoreUefiRuntimeServicesTableLib/DxeCoreUefiRuntimeServicesTableLib.inf
new file mode 100644
index 0000000000..5ff3fd8eee
--- /dev/null
+++ b/MdeModulePkg/Library/DxeCoreUefiRuntimeServicesTableLib/DxeCoreUefiRuntimeServicesTableLib.inf
@@ -0,0 +1,35 @@
+## @file
+# Dummy instance of UEFI Runtime Services Table Library for DxeCore.
+#
+# Copyright (c) 2021, Marvin Häuser. All rights reserved.
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+#
+##
+
+[Defines]
+ INF_VERSION = 0x00010005
+ BASE_NAME = DxeCoreUefiRuntimeServicesTableLib
+ MODULE_UNI_FILE = DxeCoreUefiRuntimeServicesTableLib.uni
+ FILE_GUID = 59a35203-341d-46b6-96f6-ec69e035b02e
+ MODULE_TYPE = DXE_CORE
+ VERSION_STRING = 1.0
+ LIBRARY_CLASS = UefiRuntimeServicesTableLib|DXE_CORE
+
+ CONSTRUCTOR = UefiRuntimeServicesTableLibConstructor
+
+#
+# VALID_ARCHITECTURES = IA32 X64 EBC ARM AARCH64
+#
+
+[Sources]
+ DxeCoreUefiRuntimeServicesTableLib.c
+
+
+[Packages]
+ MdePkg/MdePkg.dec
+
+
+[LibraryClasses]
+ DebugLib
diff --git a/MdeModulePkg/Library/DxeCoreUefiRuntimeServicesTableLib/DxeCoreUefiRuntimeServicesTableLib.uni b/MdeModulePkg/Library/DxeCoreUefiRuntimeServicesTableLib/DxeCoreUefiRuntimeServicesTableLib.uni
new file mode 100644
index 0000000000..b860b3f996
--- /dev/null
+++ b/MdeModulePkg/Library/DxeCoreUefiRuntimeServicesTableLib/DxeCoreUefiRuntimeServicesTableLib.uni
@@ -0,0 +1,13 @@
+// /** @file
+// Dummy instance of UEFI Runtime Services Table Library for DxeCore.
+//
+// Copyright (c) 2021, Marvin Häuser. All rights reserved.
+//
+// SPDX-License-Identifier: BSD-2-Clause-Patent
+//
+// **/
+
+
+#string STR_MODULE_ABSTRACT #language en-US "Dummy instance of UEFI Runtime Services Table Library for DxeCore"
+
+#string STR_MODULE_DESCRIPTION #language en-US "Dummy instance of UEFI Runtime Services Table Library for DxeCore."
diff --git a/MdeModulePkg/MdeModulePkg.dsc b/MdeModulePkg/MdeModulePkg.dsc
index c59fb29e8f..6f61afab86 100644
--- a/MdeModulePkg/MdeModulePkg.dsc
+++ b/MdeModulePkg/MdeModulePkg.dsc
@@ -127,6 +127,22 @@
HobLib|MdePkg/Library/DxeCoreHobLib/DxeCoreHobLib.inf
MemoryAllocationLib|MdeModulePkg/Library/DxeCoreMemoryAllocationLib/DxeCoreMemoryAllocationLib.inf
ExtractGuidedSectionLib|MdePkg/Library/DxeExtractGuidedSectionLib/DxeExtractGuidedSectionLib.inf
+ DxeServicesTableLib|MdeModulePkg/Library/DxeCoreDxeServicesTableLib/DxeCoreDxeServicesTableLib.inf
+ UefiBootServicesTableLib|MdeModulePkg/Library/DxeCoreUefiBootServicesTableLib/DxeCoreUefiBootServicesTableLib.inf
+ UefiRuntimeServicesTableLib|MdeModulePkg/Library/DxeCoreUefiRuntimeServicesTableLib/DxeCoreUefiRuntimeServicesTableLib.inf
+ CpuArchLib|UefiCpuPkg/Library/CpuArchLib/CpuArchLib.inf
+ MtrrLib|UefiCpuPkg/Library/MtrrLib/MtrrLib.inf
+ LocalApicLib|UefiCpuPkg/Library/BaseXApicX2ApicLib/BaseXApicX2ApicLib.inf
+ UefiCpuLib|UefiCpuPkg/Library/BaseUefiCpuLib/BaseUefiCpuLib.inf
+ MpInitLib|UefiCpuPkg/Library/MpInitLib/DxeMpInitLib.inf
+ MicrocodeLib|UefiCpuPkg/Library/MicrocodeLib/MicrocodeLib.inf
+ MemEncryptSevLib|OvmfPkg/Library/BaseMemEncryptSevLib/DxeMemEncryptSevLib.inf
+
+[LibraryClasses.IA32.DXE_CORE]
+ CcExitLib|UefiCpuPkg/Library/CcExitLibNull/CcExitLibNull.inf
+
+[LibraryClasses.X64.DXE_CORE]
+ CcExitLib|OvmfPkg/Library/CcExitLib/CcExitLib.inf
[LibraryClasses.common.DXE_DRIVER]
HobLib|MdePkg/Library/DxeHobLib/DxeHobLib.inf
@@ -353,6 +369,9 @@
MdeModulePkg/Library/DisplayUpdateProgressLibGraphics/DisplayUpdateProgressLibGraphics.inf
MdeModulePkg/Library/DisplayUpdateProgressLibText/DisplayUpdateProgressLibText.inf
MdeModulePkg/Library/BaseRngLibTimerLib/BaseRngLibTimerLib.inf
+ MdeModulePkg/Library/DxeCoreDxeServicesTableLib/DxeCoreDxeServicesTableLib.inf
+ MdeModulePkg/Library/DxeCoreUefiBootServicesTableLib/DxeCoreUefiBootServicesTableLib.inf
+ MdeModulePkg/Library/DxeCoreUefiRuntimeServicesTableLib/DxeCoreUefiRuntimeServicesTableLib.inf
MdeModulePkg/Universal/BdsDxe/BdsDxe.inf
MdeModulePkg/Application/BootManagerMenuApp/BootManagerMenuApp.inf
@@ -535,4 +554,3 @@
MdeModulePkg/Universal/CapsulePei/CapsuleX64.inf
[BuildOptions]
-
diff --git a/OvmfPkg/Include/Library/PlatformInitLib.h b/OvmfPkg/Include/Library/PlatformInitLib.h
index 57b18b94d9..36f23e37ac 100644
--- a/OvmfPkg/Include/Library/PlatformInitLib.h
+++ b/OvmfPkg/Include/Library/PlatformInitLib.h
@@ -55,6 +55,9 @@ typedef struct {
BOOLEAN QemuFwCfgChecked;
BOOLEAN QemuFwCfgSupported;
BOOLEAN QemuFwCfgDmaSupported;
+
+ UINT64 PteMemoryEncryptionAddressOrMask;
+ UINT64 GhcbBase;
} EFI_HOB_PLATFORM_INFO;
#pragma pack()
diff --git a/OvmfPkg/IntelTdx/IntelTdxX64.dsc b/OvmfPkg/IntelTdx/IntelTdxX64.dsc
index 69beae7649..ac01770284 100644
--- a/OvmfPkg/IntelTdx/IntelTdxX64.dsc
+++ b/OvmfPkg/IntelTdx/IntelTdxX64.dsc
@@ -255,6 +255,8 @@
ExtractGuidedSectionLib|MdePkg/Library/DxeExtractGuidedSectionLib/DxeExtractGuidedSectionLib.inf
CpuExceptionHandlerLib|UefiCpuPkg/Library/CpuExceptionHandlerLib/DxeCpuExceptionHandlerLib.inf
PcdLib|MdePkg/Library/DxePcdLib/DxePcdLib.inf
+ CpuArchLib|UefiCpuPkg/Library/CpuArchLib/CpuArchLib.inf
+ MpInitLib|UefiCpuPkg/Library/MpInitLib/DxeMpInitLib.inf
[LibraryClasses.common.DXE_RUNTIME_DRIVER]
PcdLib|MdePkg/Library/DxePcdLib/DxePcdLib.inf
@@ -571,6 +573,9 @@
NULL|MdeModulePkg/Library/LzmaCustomDecompressLib/LzmaCustomDecompressLib.inf
DevicePathLib|MdePkg/Library/UefiDevicePathLib/UefiDevicePathLib.inf
+ DxeServicesTableLib|MdeModulePkg/Library/DxeCoreDxeServicesTableLib/DxeCoreDxeServicesTableLib.inf
+ UefiBootServicesTableLib|MdeModulePkg/Library/DxeCoreUefiBootServicesTableLib/DxeCoreUefiBootServicesTableLib.inf
+ UefiRuntimeServicesTableLib|MdeModulePkg/Library/DxeCoreUefiRuntimeServicesTableLib/DxeCoreUefiRuntimeServicesTableLib.inf
}
MdeModulePkg/Universal/ReportStatusCodeRouter/RuntimeDxe/ReportStatusCodeRouterRuntimeDxe.inf
@@ -593,29 +598,6 @@
MdeModulePkg/Universal/EbcDxe/EbcDxe.inf
UefiCpuPkg/CpuIo2Dxe/CpuIo2Dxe.inf
- UefiCpuPkg/CpuDxe/CpuDxe.inf {
-
- #
- # Directly use DxeMpInitLib. It depends on DxeMpInitLibMpDepLib which
- # checks the Protocol of gEfiMpInitLibMpDepProtocolGuid.
- #
- MpInitLib|UefiCpuPkg/Library/MpInitLib/DxeMpInitLib.inf
- NULL|OvmfPkg/Library/MpInitLibDepLib/DxeMpInitLibMpDepLib.inf
- }
-
- UefiCpuPkg/CpuDxe/CpuDxe.inf {
-
- FILE_GUID = $(UP_CPU_DXE_GUID)
-
-
- #
- # Directly use MpInitLibUp. It depends on DxeMpInitLibUpDepLib which
- # checks the Protocol of gEfiMpInitLibUpDepProtocolGuid.
- #
- MpInitLib|UefiCpuPkg/Library/MpInitLibUp/MpInitLibUp.inf
- NULL|OvmfPkg/Library/MpInitLibDepLib/DxeMpInitLibUpDepLib.inf
- }
-
OvmfPkg/LocalApicTimerDxe/LocalApicTimerDxe.inf
OvmfPkg/IncompatiblePciDeviceSupportDxe/IncompatiblePciDeviceSupport.inf
OvmfPkg/PciHotPlugInitDxe/PciHotPlugInit.inf
diff --git a/OvmfPkg/IntelTdx/IntelTdxX64.fdf b/OvmfPkg/IntelTdx/IntelTdxX64.fdf
index ce5d542048..a119a91091 100644
--- a/OvmfPkg/IntelTdx/IntelTdxX64.fdf
+++ b/OvmfPkg/IntelTdx/IntelTdxX64.fdf
@@ -189,9 +189,6 @@ INF MdeModulePkg/Core/RuntimeDxe/RuntimeDxe.inf
INF MdeModulePkg/Universal/SecurityStubDxe/SecurityStubDxe.inf
INF UefiCpuPkg/CpuIo2Dxe/CpuIo2Dxe.inf
-INF UefiCpuPkg/CpuDxe/CpuDxe.inf
-INF FILE_GUID = $(UP_CPU_DXE_GUID) UefiCpuPkg/CpuDxe/CpuDxe.inf
-
INF OvmfPkg/LocalApicTimerDxe/LocalApicTimerDxe.inf
INF OvmfPkg/IncompatiblePciDeviceSupportDxe/IncompatiblePciDeviceSupport.inf
INF OvmfPkg/PciHotPlugInitDxe/PciHotPlugInit.inf
diff --git a/OvmfPkg/OvmfPkgIa32.dsc b/OvmfPkg/OvmfPkgIa32.dsc
index fb0306fb25..4940d75b7c 100644
--- a/OvmfPkg/OvmfPkgIa32.dsc
+++ b/OvmfPkg/OvmfPkgIa32.dsc
@@ -324,6 +324,8 @@
!endif
CpuExceptionHandlerLib|UefiCpuPkg/Library/CpuExceptionHandlerLib/DxeCpuExceptionHandlerLib.inf
PcdLib|MdePkg/Library/DxePcdLib/DxePcdLib.inf
+ CpuArchLib|UefiCpuPkg/Library/CpuArchLib/CpuArchLib.inf
+ MpInitLib|UefiCpuPkg/Library/MpInitLib/DxeMpInitLib.inf
[LibraryClasses.common.DXE_RUNTIME_DRIVER]
PcdLib|MdePkg/Library/DxePcdLib/DxePcdLib.inf
@@ -732,6 +734,9 @@
NULL|MdeModulePkg/Library/LzmaCustomDecompressLib/LzmaCustomDecompressLib.inf
DevicePathLib|MdePkg/Library/UefiDevicePathLib/UefiDevicePathLib.inf
+ DxeServicesTableLib|MdeModulePkg/Library/DxeCoreDxeServicesTableLib/DxeCoreDxeServicesTableLib.inf
+ UefiBootServicesTableLib|MdeModulePkg/Library/DxeCoreUefiBootServicesTableLib/DxeCoreUefiBootServicesTableLib.inf
+ UefiRuntimeServicesTableLib|MdeModulePkg/Library/DxeCoreUefiRuntimeServicesTableLib/DxeCoreUefiRuntimeServicesTableLib.inf
}
MdeModulePkg/Universal/ReportStatusCodeRouter/RuntimeDxe/ReportStatusCodeRouterRuntimeDxe.inf
@@ -753,7 +758,6 @@
MdeModulePkg/Universal/EbcDxe/EbcDxe.inf
UefiCpuPkg/CpuIo2Dxe/CpuIo2Dxe.inf
- UefiCpuPkg/CpuDxe/CpuDxe.inf
OvmfPkg/LocalApicTimerDxe/LocalApicTimerDxe.inf
OvmfPkg/IncompatiblePciDeviceSupportDxe/IncompatiblePciDeviceSupport.inf
OvmfPkg/PciHotPlugInitDxe/PciHotPlugInit.inf
diff --git a/OvmfPkg/OvmfPkgIa32.fdf b/OvmfPkg/OvmfPkgIa32.fdf
index 0d4abb50a8..cb96b13eb8 100644
--- a/OvmfPkg/OvmfPkgIa32.fdf
+++ b/OvmfPkg/OvmfPkgIa32.fdf
@@ -218,7 +218,6 @@ INF MdeModulePkg/Core/RuntimeDxe/RuntimeDxe.inf
INF MdeModulePkg/Universal/SecurityStubDxe/SecurityStubDxe.inf
INF MdeModulePkg/Universal/EbcDxe/EbcDxe.inf
INF UefiCpuPkg/CpuIo2Dxe/CpuIo2Dxe.inf
-INF UefiCpuPkg/CpuDxe/CpuDxe.inf
INF OvmfPkg/LocalApicTimerDxe/LocalApicTimerDxe.inf
INF OvmfPkg/IncompatiblePciDeviceSupportDxe/IncompatiblePciDeviceSupport.inf
INF OvmfPkg/PciHotPlugInitDxe/PciHotPlugInit.inf
diff --git a/OvmfPkg/OvmfPkgIa32X64.dsc b/OvmfPkg/OvmfPkgIa32X64.dsc
index 506ca96d40..c874bf20da 100644
--- a/OvmfPkg/OvmfPkgIa32X64.dsc
+++ b/OvmfPkg/OvmfPkgIa32X64.dsc
@@ -330,6 +330,8 @@
!endif
CpuExceptionHandlerLib|UefiCpuPkg/Library/CpuExceptionHandlerLib/DxeCpuExceptionHandlerLib.inf
PcdLib|MdePkg/Library/DxePcdLib/DxePcdLib.inf
+ CpuArchLib|UefiCpuPkg/Library/CpuArchLib/CpuArchLib.inf
+ MpInitLib|UefiCpuPkg/Library/MpInitLib/DxeMpInitLib.inf
[LibraryClasses.common.DXE_RUNTIME_DRIVER]
PcdLib|MdePkg/Library/DxePcdLib/DxePcdLib.inf
@@ -749,6 +751,9 @@
NULL|MdeModulePkg/Library/LzmaCustomDecompressLib/LzmaCustomDecompressLib.inf
DevicePathLib|MdePkg/Library/UefiDevicePathLib/UefiDevicePathLib.inf
+ DxeServicesTableLib|MdeModulePkg/Library/DxeCoreDxeServicesTableLib/DxeCoreDxeServicesTableLib.inf
+ UefiBootServicesTableLib|MdeModulePkg/Library/DxeCoreUefiBootServicesTableLib/DxeCoreUefiBootServicesTableLib.inf
+ UefiRuntimeServicesTableLib|MdeModulePkg/Library/DxeCoreUefiRuntimeServicesTableLib/DxeCoreUefiRuntimeServicesTableLib.inf
}
MdeModulePkg/Universal/ReportStatusCodeRouter/RuntimeDxe/ReportStatusCodeRouterRuntimeDxe.inf
@@ -770,7 +775,6 @@
MdeModulePkg/Universal/EbcDxe/EbcDxe.inf
UefiCpuPkg/CpuIo2Dxe/CpuIo2Dxe.inf
- UefiCpuPkg/CpuDxe/CpuDxe.inf
OvmfPkg/LocalApicTimerDxe/LocalApicTimerDxe.inf
OvmfPkg/IncompatiblePciDeviceSupportDxe/IncompatiblePciDeviceSupport.inf
OvmfPkg/PciHotPlugInitDxe/PciHotPlugInit.inf
diff --git a/OvmfPkg/OvmfPkgIa32X64.fdf b/OvmfPkg/OvmfPkgIa32X64.fdf
index 5280b8bd4e..5dc2a69fba 100644
--- a/OvmfPkg/OvmfPkgIa32X64.fdf
+++ b/OvmfPkg/OvmfPkgIa32X64.fdf
@@ -219,7 +219,6 @@ INF MdeModulePkg/Core/RuntimeDxe/RuntimeDxe.inf
INF MdeModulePkg/Universal/SecurityStubDxe/SecurityStubDxe.inf
INF MdeModulePkg/Universal/EbcDxe/EbcDxe.inf
INF UefiCpuPkg/CpuIo2Dxe/CpuIo2Dxe.inf
-INF UefiCpuPkg/CpuDxe/CpuDxe.inf
INF OvmfPkg/LocalApicTimerDxe/LocalApicTimerDxe.inf
INF OvmfPkg/IncompatiblePciDeviceSupportDxe/IncompatiblePciDeviceSupport.inf
INF OvmfPkg/PciHotPlugInitDxe/PciHotPlugInit.inf
diff --git a/OvmfPkg/OvmfPkgX64.dsc b/OvmfPkg/OvmfPkgX64.dsc
index a5681c6931..5af9443143 100644
--- a/OvmfPkg/OvmfPkgX64.dsc
+++ b/OvmfPkg/OvmfPkgX64.dsc
@@ -349,6 +349,8 @@
!endif
CpuExceptionHandlerLib|UefiCpuPkg/Library/CpuExceptionHandlerLib/DxeCpuExceptionHandlerLib.inf
PcdLib|MdePkg/Library/DxePcdLib/DxePcdLib.inf
+ CpuArchLib|UefiCpuPkg/Library/CpuArchLib/CpuArchLib.inf
+ MpInitLib|UefiCpuPkg/Library/MpInitLib/DxeMpInitLib.inf
[LibraryClasses.common.DXE_RUNTIME_DRIVER]
PcdLib|MdePkg/Library/DxePcdLib/DxePcdLib.inf
@@ -787,6 +789,9 @@
NULL|MdeModulePkg/Library/LzmaCustomDecompressLib/LzmaCustomDecompressLib.inf
DevicePathLib|MdePkg/Library/UefiDevicePathLib/UefiDevicePathLib.inf
+ DxeServicesTableLib|MdeModulePkg/Library/DxeCoreDxeServicesTableLib/DxeCoreDxeServicesTableLib.inf
+ UefiBootServicesTableLib|MdeModulePkg/Library/DxeCoreUefiBootServicesTableLib/DxeCoreUefiBootServicesTableLib.inf
+ UefiRuntimeServicesTableLib|MdeModulePkg/Library/DxeCoreUefiRuntimeServicesTableLib/DxeCoreUefiRuntimeServicesTableLib.inf
}
MdeModulePkg/Universal/ReportStatusCodeRouter/RuntimeDxe/ReportStatusCodeRouterRuntimeDxe.inf
@@ -809,29 +814,6 @@
MdeModulePkg/Universal/EbcDxe/EbcDxe.inf
UefiCpuPkg/CpuIo2Dxe/CpuIo2Dxe.inf
- UefiCpuPkg/CpuDxe/CpuDxe.inf {
-
- #
- # Directly use DxeMpInitLib. It depends on DxeMpInitLibMpDepLib which
- # checks the Protocol of gEfiMpInitLibMpDepProtocolGuid.
- #
- MpInitLib|UefiCpuPkg/Library/MpInitLib/DxeMpInitLib.inf
- NULL|OvmfPkg/Library/MpInitLibDepLib/DxeMpInitLibMpDepLib.inf
- }
-
- UefiCpuPkg/CpuDxe/CpuDxe.inf {
-
- FILE_GUID = $(UP_CPU_DXE_GUID)
-
-
- #
- # Directly use MpInitLibUp. It depends on DxeMpInitLibUpDepLib which
- # checks the Protocol of gEfiMpInitLibUpDepProtocolGuid.
- #
- MpInitLib|UefiCpuPkg/Library/MpInitLibUp/MpInitLibUp.inf
- NULL|OvmfPkg/Library/MpInitLibDepLib/DxeMpInitLibUpDepLib.inf
- }
-
OvmfPkg/LocalApicTimerDxe/LocalApicTimerDxe.inf
OvmfPkg/IncompatiblePciDeviceSupportDxe/IncompatiblePciDeviceSupport.inf
OvmfPkg/PciHotPlugInitDxe/PciHotPlugInit.inf
diff --git a/OvmfPkg/OvmfPkgX64.fdf b/OvmfPkg/OvmfPkgX64.fdf
index ddabe42be0..7247798034 100644
--- a/OvmfPkg/OvmfPkgX64.fdf
+++ b/OvmfPkg/OvmfPkgX64.fdf
@@ -248,9 +248,6 @@ INF MdeModulePkg/Universal/SecurityStubDxe/SecurityStubDxe.inf
INF MdeModulePkg/Universal/EbcDxe/EbcDxe.inf
INF UefiCpuPkg/CpuIo2Dxe/CpuIo2Dxe.inf
-INF UefiCpuPkg/CpuDxe/CpuDxe.inf
-INF FILE_GUID = $(UP_CPU_DXE_GUID) UefiCpuPkg/CpuDxe/CpuDxe.inf
-
INF OvmfPkg/LocalApicTimerDxe/LocalApicTimerDxe.inf
INF OvmfPkg/IncompatiblePciDeviceSupportDxe/IncompatiblePciDeviceSupport.inf
INF OvmfPkg/PciHotPlugInitDxe/PciHotPlugInit.inf
diff --git a/OvmfPkg/PlatformPei/AmdSev.c b/OvmfPkg/PlatformPei/AmdSev.c
index 88ca14507f..6a0dbe65e2 100644
--- a/OvmfPkg/PlatformPei/AmdSev.c
+++ b/OvmfPkg/PlatformPei/AmdSev.c
@@ -348,6 +348,9 @@ AmdSevEsInitialize (
Status = PcdSet64S (PcdGhcbBase, GhcbBasePa);
ASSERT_RETURN_ERROR (Status);
+
+ PlatformInfoHob->GhcbBase = GhcbBasePa;
+
Status = PcdSet64S (PcdGhcbSize, EFI_PAGES_TO_SIZE (GhcbPageCount));
ASSERT_RETURN_ERROR (Status);
@@ -458,6 +461,8 @@ AmdSevInitialize (
PcdStatus = PcdSet64S (PcdPteMemoryEncryptionAddressOrMask, EncryptionMask);
ASSERT_RETURN_ERROR (PcdStatus);
+ PlatformInfoHob->PteMemoryEncryptionAddressOrMask = EncryptionMask;
+
DEBUG ((DEBUG_INFO, "SEV is enabled (mask 0x%lx)\n", EncryptionMask));
//
@@ -518,10 +523,13 @@ AmdSevInitialize (
//
if (MemEncryptSevSnpIsEnabled ()) {
PcdStatus = PcdSet64S (PcdConfidentialComputingGuestAttr, CCAttrAmdSevSnp);
+ PlatformInfoHob->PcdConfidentialComputingGuestAttr = CCAttrAmdSevSnp;
} else if (MemEncryptSevEsIsEnabled ()) {
PcdStatus = PcdSet64S (PcdConfidentialComputingGuestAttr, CCAttrAmdSevEs);
+ PlatformInfoHob->PcdConfidentialComputingGuestAttr = CCAttrAmdSevEs;
} else {
PcdStatus = PcdSet64S (PcdConfidentialComputingGuestAttr, CCAttrAmdSev);
+ PlatformInfoHob->PcdConfidentialComputingGuestAttr = CCAttrAmdSev;
}
ASSERT_RETURN_ERROR (PcdStatus);
diff --git a/OvmfPkg/PlatformPei/IntelTdx.c b/OvmfPkg/PlatformPei/IntelTdx.c
index 3d625cabd8..207b85de74 100644
--- a/OvmfPkg/PlatformPei/IntelTdx.c
+++ b/OvmfPkg/PlatformPei/IntelTdx.c
@@ -30,11 +30,12 @@
**/
VOID
IntelTdxInitialize (
- VOID
+ IN OUT EFI_HOB_PLATFORM_INFO *PlatformInfoHob
)
{
#ifdef MDE_CPU_X64
RETURN_STATUS PcdStatus;
+ UINT64 PageMask;
if (!TdIsEnabled ()) {
return;
@@ -45,9 +46,14 @@ IntelTdxInitialize (
PcdStatus = PcdSet64S (PcdConfidentialComputingGuestAttr, CCAttrIntelTdx);
ASSERT_RETURN_ERROR (PcdStatus);
- PcdStatus = PcdSet64S (PcdTdxSharedBitMask, TdSharedPageMask ());
+ PlatformInfoHob->PcdConfidentialComputingGuestAttr = CCAttrIntelTdx;
+
+ PageMask = TdSharedPageMask ();
+ PcdStatus = PcdSet64S (PcdTdxSharedBitMask, PageMask);
ASSERT_RETURN_ERROR (PcdStatus);
+ PlatformInfoHob->PcdTdxSharedBitMask = PageMask;
+
PcdStatus = PcdSetBoolS (PcdSetNxForStack, TRUE);
ASSERT_RETURN_ERROR (PcdStatus);
#endif
diff --git a/OvmfPkg/PlatformPei/Platform.c b/OvmfPkg/PlatformPei/Platform.c
index df35726ff6..6a01bde08e 100644
--- a/OvmfPkg/PlatformPei/Platform.c
+++ b/OvmfPkg/PlatformPei/Platform.c
@@ -365,7 +365,7 @@ InitializePlatform (
MiscInitialization (PlatformInfoHob);
}
- IntelTdxInitialize ();
+ IntelTdxInitialize (PlatformInfoHob);
InstallFeatureControlCallback (PlatformInfoHob);
if (PlatformInfoHob->SmmSmramRequire) {
RelocateSmBase ();
diff --git a/OvmfPkg/PlatformPei/Platform.h b/OvmfPkg/PlatformPei/Platform.h
index 0a59547cfc..39ef3107e9 100644
--- a/OvmfPkg/PlatformPei/Platform.h
+++ b/OvmfPkg/PlatformPei/Platform.h
@@ -95,7 +95,7 @@ AmdSevInitialize (
**/
VOID
IntelTdxInitialize (
- VOID
+ IN EFI_HOB_PLATFORM_INFO *PlatformInfoHob
);
/**
diff --git a/UefiCpuPkg/CpuDxe/CpuDxe.uni b/UefiCpuPkg/CpuDxe/CpuDxe.uni
deleted file mode 100644
index 85d977d8c8..0000000000
--- a/UefiCpuPkg/CpuDxe/CpuDxe.uni
+++ /dev/null
@@ -1,16 +0,0 @@
-// /** @file
-// CPU driver installs CPU Architecture Protocol and CPU MP Protocol.
-//
-// CPU driver installs CPU Architecture Protocol and CPU MP Protocol.
-//
-// Copyright (c) 2008 - 2018, Intel Corporation. All rights reserved.
-//
-// SPDX-License-Identifier: BSD-2-Clause-Patent
-//
-// **/
-
-
-#string STR_MODULE_ABSTRACT #language en-US "CPU driver installs CPU Architecture Protocol and CPU MP Protocol."
-
-#string STR_MODULE_DESCRIPTION #language en-US "CPU driver installs CPU Architecture Protocol and CPU MP Protocol."
-
diff --git a/UefiCpuPkg/Include/Library/CpuArchLib.h b/UefiCpuPkg/Include/Library/CpuArchLib.h
new file mode 100644
index 0000000000..e9521d4e4f
--- /dev/null
+++ b/UefiCpuPkg/Include/Library/CpuArchLib.h
@@ -0,0 +1,31 @@
+/** @file
+ CPU DXE Module to produce CPU ARCH Protocol.
+ Copyright (c) 2008 - 2022, Intel Corporation. All rights reserved.
+ SPDX-License-Identifier: BSD-2-Clause-Patent
+**/
+
+#ifndef _CPU_ARCH_LIB_H_
+#define _CPU_ARCH_LIB_H_
+
+/**
+ Initialize the state information for the CPU Architectural Protocol.
+
+ @retval EFI_SUCCESS Thread can be successfully created
+ @retval EFI_OUT_OF_RESOURCES Can not allocate protocol data structure
+ @retval EFI_DEVICE_ERROR Can not create the thread
+**/
+EFI_STATUS
+InitializeCpu (
+ VOID
+ );
+
+/**
+ Initialize Multi-processor support.
+
+**/
+VOID
+InitializeMpSupport (
+ VOID
+ );
+
+#endif // _CPU_ARCH_LIB_H_
diff --git a/UefiCpuPkg/CpuDxe/CpuDxe.inf b/UefiCpuPkg/Library/CpuArchLib/CpuArchLib.inf
similarity index 81%
rename from UefiCpuPkg/CpuDxe/CpuDxe.inf
rename to UefiCpuPkg/Library/CpuArchLib/CpuArchLib.inf
index fca74c44b3..8818607ce4 100644
--- a/UefiCpuPkg/CpuDxe/CpuDxe.inf
+++ b/UefiCpuPkg/Library/CpuArchLib/CpuArchLib.inf
@@ -1,5 +1,5 @@
## @file
-# CPU driver installs CPU Architecture Protocol and CPU MP protocol.
+# This library installs CPU Architecture Protocol and CPU MP protocol.
#
# Copyright (c) 2008 - 2019, Intel Corporation. All rights reserved.
# Copyright (c) 2017, AMD Incorporated. All rights reserved.
@@ -11,16 +11,17 @@
[Defines]
INF_VERSION = 0x00010005
- BASE_NAME = CpuDxe
- MODULE_UNI_FILE = CpuDxe.uni
- FILE_GUID = 1A1E4886-9517-440e-9FDE-3BE44CEE2136
- MODULE_TYPE = DXE_DRIVER
+ BASE_NAME = CpuArchLib
+ MODULE_UNI_FILE = CpuArchLib.uni
+ FILE_GUID = EF9CBDF2-BD7C-48F1-9D87-EE83A0269EEE
+ MODULE_TYPE = DXE_CORE
VERSION_STRING = 1.0
- ENTRY_POINT = InitializeCpu
+ LIBRARY_CLASS = CpuArchLib
[Packages]
MdePkg/MdePkg.dec
MdeModulePkg/MdeModulePkg.dec
+ OvmfPkg/OvmfPkg.dec
UefiCpuPkg/UefiCpuPkg.dec
[LibraryClasses.common]
@@ -33,11 +34,10 @@
HobLib
MemoryAllocationLib
MpInitLib
- PeCoffGetEntryPointLib
ReportStatusCodeLib
+ SerialPortLib
TimerLib
UefiBootServicesTableLib
- UefiDriverEntryPoint
UefiLib
[LibraryClasses.IA32, LibraryClasses.X64]
@@ -81,13 +81,13 @@
[Guids]
gIdleLoopEventGuid ## CONSUMES ## Event
gEfiVectorHandoffTableGuid ## SOMETIMES_CONSUMES ## SystemTable
+ gUefiOvmfPkgPlatformInfoGuid ## CONSUMES ## HOB
[Ppis]
gEfiSecPlatformInformation2PpiGuid ## UNDEFINED # HOB
gEfiSecPlatformInformationPpiGuid ## UNDEFINED # HOB
[Pcd]
- gEfiMdeModulePkgTokenSpaceGuid.PcdPteMemoryEncryptionAddressOrMask ## CONSUMES
gEfiMdeModulePkgTokenSpaceGuid.PcdCpuStackGuard ## CONSUMES
gEfiMdeModulePkgTokenSpaceGuid.PcdHeapGuardPropertyMask ## CONSUMES
gEfiMdeModulePkgTokenSpaceGuid.PcdNullPointerDetectionPropertyMask ## CONSUMES
diff --git a/UefiCpuPkg/Library/CpuArchLib/CpuArchLib.uni b/UefiCpuPkg/Library/CpuArchLib/CpuArchLib.uni
new file mode 100644
index 0000000000..2c9429979a
--- /dev/null
+++ b/UefiCpuPkg/Library/CpuArchLib/CpuArchLib.uni
@@ -0,0 +1,13 @@
+// /** @file
+// This library installs CPU Architecture Protocol and CPU MP Protocol.
+//
+// Copyright (c) 2008 - 2018, Intel Corporation. All rights reserved.
+//
+// SPDX-License-Identifier: BSD-2-Clause-Patent
+//
+// **/
+
+
+#string STR_MODULE_ABSTRACT #language en-US "This library installs CPU Architecture Protocol and CPU MP Protocol."
+
+#string STR_MODULE_DESCRIPTION #language en-US "This library installs CPU Architecture Protocol and CPU MP Protocol."
diff --git a/UefiCpuPkg/Library/CpuArchLib/CpuArchLibNull.inf b/UefiCpuPkg/Library/CpuArchLib/CpuArchLibNull.inf
new file mode 100644
index 0000000000..febba954bd
--- /dev/null
+++ b/UefiCpuPkg/Library/CpuArchLib/CpuArchLibNull.inf
@@ -0,0 +1,24 @@
+## @file
+# This library provides dummy InitializeCpu() for DxeMain.inf.
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+##
+
+[Defines]
+ INF_VERSION = 0x00010005
+ BASE_NAME = CpuArchLib
+ FILE_GUID = EF9CBDF2-BD7C-48F1-9D87-EE83A0269EEE
+ MODULE_TYPE = DXE_CORE
+ VERSION_STRING = 1.0
+ LIBRARY_CLASS = CpuArchLib
+
+[Packages]
+ MdePkg/MdePkg.dec
+ MdeModulePkg/MdeModulePkg.dec
+
+[LibraryClasses]
+ BaseLib
+
+[Sources]
+ CpuDxeNull.c
diff --git a/UefiCpuPkg/CpuDxe/CpuDxe.c b/UefiCpuPkg/Library/CpuArchLib/CpuDxe.c
similarity index 94%
rename from UefiCpuPkg/CpuDxe/CpuDxe.c
rename to UefiCpuPkg/Library/CpuArchLib/CpuDxe.c
index bf03978710..9a26bb5af7 100644
--- a/UefiCpuPkg/CpuDxe/CpuDxe.c
+++ b/UefiCpuPkg/Library/CpuArchLib/CpuDxe.c
@@ -21,7 +21,7 @@ BOOLEAN mIsFlushingGCD;
BOOLEAN mIsAllocatingPageTable = FALSE;
UINT64 mTimerPeriod = 0;
-EFI_CPU_ARCH_PROTOCOL gCpu = {
+EFI_CPU_ARCH_PROTOCOL gCpuImpl = {
CpuFlushCpuDataCache,
CpuEnableInterrupt,
CpuDisableInterrupt,
@@ -34,6 +34,8 @@ EFI_CPU_ARCH_PROTOCOL gCpu = {
4 // DmaBufferAlignment
};
+EFI_HOB_PLATFORM_INFO *mPlatformInfoHob2 = NULL;
+
//
// CPU Arch Protocol Functions
//
@@ -947,7 +949,7 @@ FreeMemorySpaceMap:
**/
VOID
AddLocalApicMemorySpace (
- IN EFI_HANDLE ImageHandle
+ VOID
)
{
EFI_STATUS Status;
@@ -968,7 +970,7 @@ AddLocalApicMemorySpace (
0,
SIZE_4KB,
&BaseAddress,
- ImageHandle,
+ gImageHandle,
NULL
);
if (EFI_ERROR (Status)) {
@@ -985,23 +987,24 @@ AddLocalApicMemorySpace (
/**
Initialize the state information for the CPU Architectural Protocol.
- @param ImageHandle Image handle this driver.
- @param SystemTable Pointer to the System Table.
-
@retval EFI_SUCCESS Thread can be successfully created
- @retval EFI_OUT_OF_RESOURCES Cannot allocate protocol data structure
- @retval EFI_DEVICE_ERROR Cannot create the thread
+ @retval EFI_OUT_OF_RESOURCES Can not allocate protocol data structure
+ @retval EFI_DEVICE_ERROR Can not create the thread
**/
EFI_STATUS
-EFIAPI
InitializeCpu (
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
+ VOID
)
{
- EFI_STATUS Status;
- EFI_EVENT IdleLoopEvent;
+ EFI_STATUS Status;
+ EFI_EVENT IdleLoopEvent;
+ EFI_HOB_GUID_TYPE *GuidHob;
+
+ GuidHob = GetFirstGuidHob (&gUefiOvmfPkgPlatformInfoGuid);
+ if (GuidHob != NULL) {
+ mPlatformInfoHob2 = (EFI_HOB_PLATFORM_INFO *)(GET_GUID_HOB_DATA (GuidHob));
+ }
InitializePageTableLib ();
@@ -1028,7 +1031,7 @@ InitializeCpu (
Status = gBS->InstallMultipleProtocolInterfaces (
&mCpuHandle,
&gEfiCpuArchProtocolGuid,
- &gCpu,
+ &gCpuImpl,
NULL
);
ASSERT_EFI_ERROR (Status);
@@ -1041,7 +1044,7 @@ InitializeCpu (
//
// Add and allocate local APIC memory mapped space
//
- AddLocalApicMemorySpace (ImageHandle);
+ AddLocalApicMemorySpace ();
//
// Setup a callback for idle events
@@ -1056,7 +1059,5 @@ InitializeCpu (
);
ASSERT_EFI_ERROR (Status);
- InitializeMpSupport ();
-
return Status;
}
diff --git a/UefiCpuPkg/CpuDxe/CpuDxe.h b/UefiCpuPkg/Library/CpuArchLib/CpuDxe.h
similarity index 94%
rename from UefiCpuPkg/CpuDxe/CpuDxe.h
rename to UefiCpuPkg/Library/CpuArchLib/CpuDxe.h
index 0e7d88dd35..34a865d1dd 100644
--- a/UefiCpuPkg/CpuDxe/CpuDxe.h
+++ b/UefiCpuPkg/Library/CpuArchLib/CpuDxe.h
@@ -35,6 +35,7 @@
#include
#include
#include
+#include
#include
#include
@@ -293,7 +294,8 @@ PageFaultExceptionHandler (
IN EFI_SYSTEM_CONTEXT SystemContext
);
-extern BOOLEAN mIsAllocatingPageTable;
-extern UINTN mNumberOfProcessors;
+extern BOOLEAN mIsAllocatingPageTable;
+extern UINTN mNumberOfProcessors;
+extern EFI_HOB_PLATFORM_INFO *mPlatformInfoHob2;
#endif
diff --git a/UefiCpuPkg/CpuDxe/CpuDxeExtra.uni b/UefiCpuPkg/Library/CpuArchLib/CpuDxeExtra.uni
similarity index 77%
rename from UefiCpuPkg/CpuDxe/CpuDxeExtra.uni
rename to UefiCpuPkg/Library/CpuArchLib/CpuDxeExtra.uni
index 5bb116fee7..57bf2691e7 100644
--- a/UefiCpuPkg/CpuDxe/CpuDxeExtra.uni
+++ b/UefiCpuPkg/Library/CpuArchLib/CpuDxeExtra.uni
@@ -9,6 +9,4 @@
#string STR_PROPERTIES_MODULE_NAME
#language en-US
-"CPU Architectural and CPU Multi-processor DXE Driver"
-
-
+"CPU Architectural and CPU Multi-processor DXE library"
diff --git a/UefiCpuPkg/Library/CpuArchLib/CpuDxeNull.c b/UefiCpuPkg/Library/CpuArchLib/CpuDxeNull.c
new file mode 100644
index 0000000000..d61890e05b
--- /dev/null
+++ b/UefiCpuPkg/Library/CpuArchLib/CpuDxeNull.c
@@ -0,0 +1,25 @@
+/**
+ Initialize the state information for the CPU Architectural Protocol.
+
+ @retval EFI_SUCCESS Thread can be successfully created
+ @retval EFI_OUT_OF_RESOURCES Can not allocate protocol data structure
+ @retval EFI_DEVICE_ERROR Can not create the thread
+**/
+EFI_STATUS
+InitializeCpu (
+ VOID
+ )
+{
+ return EFI_SUCCESS;
+}
+
+/**
+ Initialize Multi-processor support.
+
+**/
+VOID
+InitializeMpSupport (
+ VOID
+ )
+{
+}
diff --git a/UefiCpuPkg/CpuDxe/CpuGdt.c b/UefiCpuPkg/Library/CpuArchLib/CpuGdt.c
similarity index 100%
rename from UefiCpuPkg/CpuDxe/CpuGdt.c
rename to UefiCpuPkg/Library/CpuArchLib/CpuGdt.c
diff --git a/UefiCpuPkg/CpuDxe/CpuGdt.h b/UefiCpuPkg/Library/CpuArchLib/CpuGdt.h
similarity index 100%
rename from UefiCpuPkg/CpuDxe/CpuGdt.h
rename to UefiCpuPkg/Library/CpuArchLib/CpuGdt.h
diff --git a/UefiCpuPkg/CpuDxe/CpuMp.c b/UefiCpuPkg/Library/CpuArchLib/CpuMp.c
similarity index 100%
rename from UefiCpuPkg/CpuDxe/CpuMp.c
rename to UefiCpuPkg/Library/CpuArchLib/CpuMp.c
diff --git a/UefiCpuPkg/CpuDxe/CpuMp.h b/UefiCpuPkg/Library/CpuArchLib/CpuMp.h
similarity index 97%
rename from UefiCpuPkg/CpuDxe/CpuMp.h
rename to UefiCpuPkg/Library/CpuArchLib/CpuMp.h
index b461753510..c42a617bcf 100644
--- a/UefiCpuPkg/CpuDxe/CpuMp.h
+++ b/UefiCpuPkg/Library/CpuArchLib/CpuMp.h
@@ -9,15 +9,6 @@
#ifndef _CPU_MP_H_
#define _CPU_MP_H_
-/**
- Initialize Multi-processor support.
-
-**/
-VOID
-InitializeMpSupport (
- VOID
- );
-
/**
This service retrieves the number of logical processor in the platform
and the number of those logical processors that are enabled on this boot.
diff --git a/UefiCpuPkg/CpuDxe/CpuPageTable.c b/UefiCpuPkg/Library/CpuArchLib/CpuPageTable.c
similarity index 95%
rename from UefiCpuPkg/CpuDxe/CpuPageTable.c
rename to UefiCpuPkg/Library/CpuArchLib/CpuPageTable.c
index b5609da9c2..ad2c79cd64 100644
--- a/UefiCpuPkg/CpuDxe/CpuPageTable.c
+++ b/UefiCpuPkg/Library/CpuArchLib/CpuPageTable.c
@@ -90,13 +90,13 @@ PAGE_ATTRIBUTE_TABLE mPageAttributeTable[] = {
PAGE_TABLE_POOL *mPageTablePool = NULL;
BOOLEAN mPageTablePoolLock = FALSE;
PAGE_TABLE_LIB_PAGING_CONTEXT mPagingContext;
-EFI_SMM_BASE2_PROTOCOL *mSmmBase2 = NULL;
+EFI_SMM_BASE2_PROTOCOL *mSmmBase2 = NULL;
//
// Record the page fault exception count for one instruction execution.
//
UINTN *mPFEntryCount;
-UINT64 *(*mLastPFEntryPointer)[MAX_PF_ENTRY_COUNT];
+UINT64 *(*mLastPFEntryPointer)[MAX_PF_ENTRY_COUNT];
/**
Check if current execution environment is in SMM mode or not, via
@@ -308,9 +308,9 @@ GetPageTableEntry (
// Make sure AddressEncMask is contained to smallest supported address field.
//
- AddressEncMask = PcdGet64 (PcdPteMemoryEncryptionAddressOrMask) & PAGING_1G_ADDRESS_MASK_64;
+ AddressEncMask = mPlatformInfoHob2->PteMemoryEncryptionAddressOrMask & PAGING_1G_ADDRESS_MASK_64;
if (AddressEncMask == 0) {
- AddressEncMask = PcdGet64 (PcdTdxSharedBitMask) & PAGING_1G_ADDRESS_MASK_64;
+ AddressEncMask = mPlatformInfoHob2->PcdTdxSharedBitMask & PAGING_1G_ADDRESS_MASK_64;
}
if (PagingContext->MachineType == IMAGE_FILE_MACHINE_X64) {
@@ -566,7 +566,7 @@ SplitPage (
// Make sure AddressEncMask is contained to smallest supported address field.
//
- AddressEncMask = PcdGet64 (PcdPteMemoryEncryptionAddressOrMask) & PAGING_1G_ADDRESS_MASK_64;
+ AddressEncMask = mPlatformInfoHob2->PteMemoryEncryptionAddressOrMask & PAGING_1G_ADDRESS_MASK_64;
if (PageAttribute == Page2M) {
//
diff --git a/UefiCpuPkg/CpuDxe/CpuPageTable.h b/UefiCpuPkg/Library/CpuArchLib/CpuPageTable.h
similarity index 100%
rename from UefiCpuPkg/CpuDxe/CpuPageTable.h
rename to UefiCpuPkg/Library/CpuArchLib/CpuPageTable.h
diff --git a/UefiCpuPkg/CpuDxe/Ia32/CpuAsm.nasm b/UefiCpuPkg/Library/CpuArchLib/Ia32/CpuAsm.nasm
similarity index 100%
rename from UefiCpuPkg/CpuDxe/Ia32/CpuAsm.nasm
rename to UefiCpuPkg/Library/CpuArchLib/Ia32/CpuAsm.nasm
diff --git a/UefiCpuPkg/CpuDxe/Ia32/PagingAttribute.c b/UefiCpuPkg/Library/CpuArchLib/Ia32/PagingAttribute.c
similarity index 100%
rename from UefiCpuPkg/CpuDxe/Ia32/PagingAttribute.c
rename to UefiCpuPkg/Library/CpuArchLib/Ia32/PagingAttribute.c
diff --git a/UefiCpuPkg/CpuDxe/LoongArch64/CpuDxe.c b/UefiCpuPkg/Library/CpuArchLib/LoongArch64/CpuDxe.c
similarity index 100%
rename from UefiCpuPkg/CpuDxe/LoongArch64/CpuDxe.c
rename to UefiCpuPkg/Library/CpuArchLib/LoongArch64/CpuDxe.c
diff --git a/UefiCpuPkg/CpuDxe/LoongArch64/CpuDxe.h b/UefiCpuPkg/Library/CpuArchLib/LoongArch64/CpuDxe.h
similarity index 100%
rename from UefiCpuPkg/CpuDxe/LoongArch64/CpuDxe.h
rename to UefiCpuPkg/Library/CpuArchLib/LoongArch64/CpuDxe.h
diff --git a/UefiCpuPkg/CpuDxe/LoongArch64/CpuMp.c b/UefiCpuPkg/Library/CpuArchLib/LoongArch64/CpuMp.c
similarity index 100%
rename from UefiCpuPkg/CpuDxe/LoongArch64/CpuMp.c
rename to UefiCpuPkg/Library/CpuArchLib/LoongArch64/CpuMp.c
diff --git a/UefiCpuPkg/CpuDxe/LoongArch64/Exception.c b/UefiCpuPkg/Library/CpuArchLib/LoongArch64/Exception.c
similarity index 100%
rename from UefiCpuPkg/CpuDxe/LoongArch64/Exception.c
rename to UefiCpuPkg/Library/CpuArchLib/LoongArch64/Exception.c
diff --git a/UefiCpuPkg/CpuDxe/X64/CpuAsm.nasm b/UefiCpuPkg/Library/CpuArchLib/X64/CpuAsm.nasm
similarity index 100%
rename from UefiCpuPkg/CpuDxe/X64/CpuAsm.nasm
rename to UefiCpuPkg/Library/CpuArchLib/X64/CpuAsm.nasm
diff --git a/UefiCpuPkg/CpuDxe/X64/PagingAttribute.c b/UefiCpuPkg/Library/CpuArchLib/X64/PagingAttribute.c
similarity index 100%
rename from UefiCpuPkg/CpuDxe/X64/PagingAttribute.c
rename to UefiCpuPkg/Library/CpuArchLib/X64/PagingAttribute.c
diff --git a/UefiCpuPkg/Library/MpInitLib/DxeMpInitLib.inf b/UefiCpuPkg/Library/MpInitLib/DxeMpInitLib.inf
index 41d5a80bc9..c4302aa0a7 100644
--- a/UefiCpuPkg/Library/MpInitLib/DxeMpInitLib.inf
+++ b/UefiCpuPkg/Library/MpInitLib/DxeMpInitLib.inf
@@ -14,7 +14,7 @@
FILE_GUID = B88F7146-9834-4c55-BFAC-481CC0C33736
MODULE_TYPE = DXE_DRIVER
VERSION_STRING = 1.1
- LIBRARY_CLASS = MpInitLib|DXE_DRIVER
+ LIBRARY_CLASS = MpInitLib|DXE_DRIVER DXE_CORE
#
# The following information is for reference only and not required by the build tools.
@@ -49,6 +49,7 @@
[Packages]
MdePkg/MdePkg.dec
MdeModulePkg/MdeModulePkg.dec
+ OvmfPkg/OvmfPkg.dec
UefiCpuPkg/UefiCpuPkg.dec
[LibraryClasses]
@@ -79,16 +80,13 @@
gEfiEventLegacyBootGuid ## SOMETIMES_CONSUMES ## Event
gEdkiiMicrocodePatchHobGuid ## SOMETIMES_CONSUMES ## HOB
gGhcbApicIdsGuid ## SOMETIMES_CONSUMES ## HOB
+ gUefiOvmfPkgPlatformInfoGuid ## CONSUMES ## HOB
[Guids.LoongArch64]
gProcessorResourceHobGuid ## SOMETIMES_CONSUMES ## HOB
[Pcd]
gEfiMdeModulePkgTokenSpaceGuid.PcdCpuStackGuard ## CONSUMES
- gEfiMdeModulePkgTokenSpaceGuid.PcdGhcbBase ## CONSUMES
- gEfiMdePkgTokenSpaceGuid.PcdConfidentialComputingGuestAttr ## CONSUMES
- gUefiCpuPkgTokenSpaceGuid.PcdCpuMaxLogicalProcessorNumber ## CONSUMES
- gUefiCpuPkgTokenSpaceGuid.PcdCpuBootLogicalProcessorNumber ## CONSUMES
gUefiCpuPkgTokenSpaceGuid.PcdCpuApInitTimeOutInMicroSeconds ## SOMETIMES_CONSUMES
gUefiCpuPkgTokenSpaceGuid.PcdCpuApStackSize ## CONSUMES
gUefiCpuPkgTokenSpaceGuid.PcdCpuMicrocodePatchAddress ## CONSUMES
diff --git a/UefiCpuPkg/Library/MpInitLib/MpLib.c b/UefiCpuPkg/Library/MpInitLib/MpLib.c
index d724456502..245c97e161 100644
--- a/UefiCpuPkg/Library/MpInitLib/MpLib.c
+++ b/UefiCpuPkg/Library/MpInitLib/MpLib.c
@@ -9,13 +9,17 @@
**/
#include "MpLib.h"
+
#include
+#include
+
#include
#include
-EFI_GUID mCpuInitMpLibHobGuid = CPU_INIT_MP_LIB_HOB_GUID;
-EFI_GUID mMpHandOffGuid = MP_HANDOFF_GUID;
-EFI_GUID mMpHandOffConfigGuid = MP_HANDOFF_CONFIG_GUID;
+EFI_GUID mCpuInitMpLibHobGuid = CPU_INIT_MP_LIB_HOB_GUID;
+EFI_GUID mMpHandOffGuid = MP_HANDOFF_GUID;
+EFI_GUID mMpHandOffConfigGuid = MP_HANDOFF_CONFIG_GUID;
+EFI_HOB_PLATFORM_INFO *mPlatformInfoHob = NULL;
/**
Save the volatile registers required to be restored following INIT IPI.
@@ -529,7 +533,7 @@ CollectProcessorCount (
// FinishedCount is the number of check-in APs.
//
CpuMpData->CpuCount = CpuMpData->FinishedCount + 1;
- ASSERT (CpuMpData->CpuCount <= PcdGet32 (PcdCpuMaxLogicalProcessorNumber));
+ ASSERT (CpuMpData->CpuCount <= mPlatformInfoHob->PcdCpuMaxLogicalProcessorNumber);
//
// Enable x2APIC mode if
@@ -1168,7 +1172,7 @@ AllocateResetVectorBelow1Mb (
// of processors for calculating the total stack area.
//
ApResetStackSize = (AP_RESET_STACK_SIZE *
- PcdGet32 (PcdCpuMaxLogicalProcessorNumber));
+ mPlatformInfoHob->PcdCpuMaxLogicalProcessorNumber);
//
// Invoke GetWakeupBuffer a second time to allocate the stack area
@@ -1321,7 +1325,7 @@ WakeUpAP (
}
if (CpuMpData->InitFlag == ApInitConfig) {
- if (PcdGet32 (PcdCpuBootLogicalProcessorNumber) > 0) {
+ if (mPlatformInfoHob->PcdCpuBootLogicalProcessorNumber > 0) {
//
// The AP enumeration algorithm below is suitable only when the
// platform can tell us the *exact* boot CPU count in advance.
@@ -1337,7 +1341,7 @@ WakeUpAP (
//
TimedWaitForApFinish (
CpuMpData,
- PcdGet32 (PcdCpuBootLogicalProcessorNumber) - 1,
+ mPlatformInfoHob->PcdCpuBootLogicalProcessorNumber - 1,
MAX_UINT32 // approx. 71 minutes
);
} else {
@@ -1375,7 +1379,7 @@ WakeUpAP (
//
TimedWaitForApFinish (
CpuMpData,
- PcdGet32 (PcdCpuMaxLogicalProcessorNumber) - 1,
+ mPlatformInfoHob->PcdCpuMaxLogicalProcessorNumber - 1,
PcdGet32 (PcdCpuApInitTimeOutInMicroSeconds)
);
@@ -2066,6 +2070,12 @@ MpInitLibInitialize (
UINTN ApResetVectorSizeAbove1Mb;
UINTN BackupBufferAddr;
UINTN ApIdtBase;
+ EFI_HOB_GUID_TYPE *GuidHob;
+
+ GuidHob = GetFirstGuidHob (&gUefiOvmfPkgPlatformInfoGuid);
+ if (GuidHob != NULL) {
+ mPlatformInfoHob = (EFI_HOB_PLATFORM_INFO *)(GET_GUID_HOB_DATA (GuidHob));
+ }
FirstMpHandOff = GetNextMpHandOffHob (NULL);
if (FirstMpHandOff != NULL) {
@@ -2085,7 +2095,7 @@ MpInitLibInitialize (
MaxLogicalProcessorNumber += MpHandOff->CpuCount;
}
} else {
- MaxLogicalProcessorNumber = PcdGet32 (PcdCpuMaxLogicalProcessorNumber);
+ MaxLogicalProcessorNumber = mPlatformInfoHob->PcdCpuMaxLogicalProcessorNumber;
}
ASSERT (MaxLogicalProcessorNumber != 0);
@@ -2160,7 +2170,7 @@ MpInitLibInitialize (
CpuMpData->SevEsIsEnabled = ConfidentialComputingGuestHas (CCAttrAmdSevEs);
CpuMpData->SevSnpIsEnabled = ConfidentialComputingGuestHas (CCAttrAmdSevSnp);
CpuMpData->SevEsAPBuffer = (UINTN)-1;
- CpuMpData->GhcbBase = PcdGet64 (PcdGhcbBase);
+ CpuMpData->GhcbBase = mPlatformInfoHob->GhcbBase;
CpuMpData->UseSevEsAPMethod = CpuMpData->SevEsIsEnabled && !CpuMpData->SevSnpIsEnabled;
if (CpuMpData->SevSnpIsEnabled) {
@@ -3216,7 +3226,7 @@ ConfidentialComputingGuestHas (
//
// Get the current CC attribute.
//
- CurrentAttr = PcdGet64 (PcdConfidentialComputingGuestAttr);
+ CurrentAttr = mPlatformInfoHob->PcdConfidentialComputingGuestAttr;
//
// If attr is for the AMD group then call AMD specific checks.
diff --git a/UefiCpuPkg/Library/MpInitLib/PeiMpInitLib.inf b/UefiCpuPkg/Library/MpInitLib/PeiMpInitLib.inf
index e31e34b6f9..dc021d7fb5 100644
--- a/UefiCpuPkg/Library/MpInitLib/PeiMpInitLib.inf
+++ b/UefiCpuPkg/Library/MpInitLib/PeiMpInitLib.inf
@@ -47,6 +47,7 @@
[Packages]
MdePkg/MdePkg.dec
MdeModulePkg/MdeModulePkg.dec
+ OvmfPkg/OvmfPkg.dec
UefiCpuPkg/UefiCpuPkg.dec
[LibraryClasses]
@@ -66,10 +67,6 @@
MtrrLib
[Pcd]
- gEfiMdeModulePkgTokenSpaceGuid.PcdGhcbBase ## CONSUMES
- gEfiMdePkgTokenSpaceGuid.PcdConfidentialComputingGuestAttr ## CONSUMES
- gUefiCpuPkgTokenSpaceGuid.PcdCpuMaxLogicalProcessorNumber ## CONSUMES
- gUefiCpuPkgTokenSpaceGuid.PcdCpuBootLogicalProcessorNumber ## CONSUMES
gUefiCpuPkgTokenSpaceGuid.PcdCpuApInitTimeOutInMicroSeconds ## SOMETIMES_CONSUMES
gUefiCpuPkgTokenSpaceGuid.PcdCpuApStackSize ## CONSUMES
gUefiCpuPkgTokenSpaceGuid.PcdCpuMicrocodePatchAddress ## CONSUMES
@@ -87,6 +84,7 @@
gEdkiiS3SmmInitDoneGuid
gEdkiiMicrocodePatchHobGuid
gGhcbApicIdsGuid ## SOMETIMES_CONSUMES
+ gUefiOvmfPkgPlatformInfoGuid ## CONSUMES ## HOB
[Guids.LoongArch64]
gProcessorResourceHobGuid ## SOMETIMES_CONSUMES ## HOB
diff --git a/UefiCpuPkg/UefiCpuPkg.dec b/UefiCpuPkg/UefiCpuPkg.dec
index cc31554f10..b99171d986 100644
--- a/UefiCpuPkg/UefiCpuPkg.dec
+++ b/UefiCpuPkg/UefiCpuPkg.dec
@@ -73,6 +73,10 @@
## @libraryclass Provides functions for SMM Relocation Operation.
SmmRelocationLib|Include/Library/SmmRelocationLib.h
+
+ ## @libraryclass Installs CPU Architecture Protocol.
+ ##
+ CpuArchLib|Include/Library/CpuArchLib.h
[LibraryClasses.RISCV64]
## @libraryclass Provides functions to manage MMU features on RISCV64 CPUs.
diff --git a/UefiCpuPkg/UefiCpuPkg.dsc b/UefiCpuPkg/UefiCpuPkg.dsc
index a32da54617..ad0b1aa1c8 100644
--- a/UefiCpuPkg/UefiCpuPkg.dsc
+++ b/UefiCpuPkg/UefiCpuPkg.dsc
@@ -70,6 +70,7 @@
UnitTestPersistenceLib|UnitTestFrameworkPkg/Library/UnitTestPersistenceLibNull/UnitTestPersistenceLibNull.inf
UnitTestResultReportLib|UnitTestFrameworkPkg/Library/UnitTestResultReportLib/UnitTestResultReportLibDebugLib.inf
IntrinsicLib|CryptoPkg/Library/IntrinsicLib/IntrinsicLib.inf
+ CpuArchLib|UefiCpuPkg/Library/CpuArchLib/CpuArchLib.inf
[LibraryClasses.common.SEC]
PlatformSecLib|UefiCpuPkg/Library/PlatformSecLibNull/PlatformSecLibNull.inf
@@ -134,7 +135,6 @@
CryptoPkg/Library/IntrinsicLib/IntrinsicLib.inf
[Components.IA32, Components.X64]
- UefiCpuPkg/CpuDxe/CpuDxe.inf
UefiCpuPkg/CpuFeatures/CpuFeaturesPei.inf {
NULL|UefiCpuPkg/Library/CpuCommonFeaturesLib/CpuCommonFeaturesLib.inf
@@ -147,8 +147,11 @@
UefiCpuPkg/CpuIo2Smm/CpuIo2StandaloneMm.inf
UefiCpuPkg/CpuMpPei/CpuMpPei.inf
UefiCpuPkg/CpuS3DataDxe/CpuS3DataDxe.inf
+ UefiCpuPkg/Library/AmdSvsmLibNull/AmdSvsmLibNull.inf
UefiCpuPkg/Library/BaseXApicLib/BaseXApicLib.inf
UefiCpuPkg/Library/BaseXApicX2ApicLib/BaseXApicX2ApicLib.inf
+ UefiCpuPkg/Library/CcExitLibNull/CcExitLibNull.inf
+ UefiCpuPkg/Library/CpuArchLib/CpuArchLib.inf
UefiCpuPkg/Library/CpuCommonFeaturesLib/CpuCommonFeaturesLib.inf
UefiCpuPkg/Library/CpuExceptionHandlerLib/DxeCpuExceptionHandlerLib.inf
UefiCpuPkg/Library/CpuExceptionHandlerLib/SecPeiCpuExceptionHandlerLib.inf
@@ -167,8 +170,6 @@
UefiCpuPkg/Library/SmmCpuFeaturesLib/SmmCpuFeaturesLibStm.inf
UefiCpuPkg/Library/SmmCpuFeaturesLib/StandaloneMmCpuFeaturesLib.inf
UefiCpuPkg/Library/SmmCpuSyncLib/SmmCpuSyncLib.inf
- UefiCpuPkg/Library/CcExitLibNull/CcExitLibNull.inf
- UefiCpuPkg/Library/AmdSvsmLibNull/AmdSvsmLibNull.inf
UefiCpuPkg/PiSmmCommunication/PiSmmCommunicationPei.inf
UefiCpuPkg/PiSmmCommunication/PiSmmCommunicationSmm.inf
UefiCpuPkg/SecCore/SecCore.inf
diff --git a/UefiPayloadPkg/UefiPayloadPkg.dsc b/UefiPayloadPkg/UefiPayloadPkg.dsc
index 5bb5f5511d..d0d518dfee 100644
--- a/UefiPayloadPkg/UefiPayloadPkg.dsc
+++ b/UefiPayloadPkg/UefiPayloadPkg.dsc
@@ -359,6 +359,8 @@
!if $(PERFORMANCE_MEASUREMENT_ENABLE)
PerformanceLib|MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.inf
!endif
+ CpuArchLib|UefiCpuPkg/Library/CpuArchLib/CpuArchLib.inf
+ MpInitLib|UefiCpuPkg/Library/MpInitLib/DxeMpInitLib.inf
[LibraryClasses.common.DXE_DRIVER]
PcdLib|MdePkg/Library/DxePcdLib/DxePcdLib.inf
@@ -671,6 +673,9 @@
SerialPortLib|UefiPayloadPkg/Library/BaseSerialPortLibHob/DxeBaseSerialPortLibHob.inf
!endif
NULL|MdeModulePkg/Library/LzmaCustomDecompressLib/LzmaCustomDecompressLib.inf
+ DxeServicesTableLib|MdeModulePkg/Library/DxeCoreDxeServicesTableLib/DxeCoreDxeServicesTableLib.inf
+ UefiBootServicesTableLib|MdeModulePkg/Library/DxeCoreUefiBootServicesTableLib/DxeCoreUefiBootServicesTableLib.inf
+ UefiRuntimeServicesTableLib|MdeModulePkg/Library/DxeCoreUefiRuntimeServicesTableLib/DxeCoreUefiRuntimeServicesTableLib.inf
}
#
@@ -679,7 +684,6 @@
!if $(SECURITY_STUB_ENABLE) == TRUE
MdeModulePkg/Universal/SecurityStubDxe/SecurityStubDxe.inf
!endif
- UefiCpuPkg/CpuDxe/CpuDxe.inf
MdeModulePkg/Universal/BdsDxe/BdsDxe.inf
!if $(BOOTSPLASH_IMAGE)
MdeModulePkg/Logo/LogoDxe.inf
diff --git a/UefiPayloadPkg/UefiPayloadPkg.fdf b/UefiPayloadPkg/UefiPayloadPkg.fdf
index c961dc11b3..f5af3b7771 100644
--- a/UefiPayloadPkg/UefiPayloadPkg.fdf
+++ b/UefiPayloadPkg/UefiPayloadPkg.fdf
@@ -161,7 +161,6 @@ INF CryptoPkg/Driver/CryptoDxe.inf
!if $(SECURITY_STUB_ENABLE) == TRUE
INF MdeModulePkg/Universal/SecurityStubDxe/SecurityStubDxe.inf
!endif
-INF UefiCpuPkg/CpuDxe/CpuDxe.inf
!if $(TIMER_SUPPORT) == "HPET"
INF PcAtChipsetPkg/HpetTimerDxe/HpetTimerDxe.inf