mirror of
https://github.com/acidanthera/audk.git
synced 2025-04-08 17:05:09 +02:00
MdeModulePkg/Core/Dxe: Integrate CPU Architectural producer
BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=3223 In the current design, memory protection is not available till CpuDxe is loaded. To resolve this, introduce CpuArchLib to move the CPU Architectural initialization to DxeCore. Cc: Eric Dong <eric.dong@intel.com> Cc: Ray Ni <ray.ni@intel.com> Cc: Laszlo Ersek <lersek@redhat.com> Cc: Rahul Kumar <rahul1.kumar@intel.com> Cc: Vitaly Cheptsov <vit9696@protonmail.com> Signed-off-by: Marvin Häuser <mhaeuser@posteo.de>
This commit is contained in:
parent
a759ddb400
commit
20dd836214
@ -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
|
||||
@ -118,8 +119,8 @@
|
||||
ArmPkg/Library/SemiHostingSerialPortLib/SemiHostingSerialPortLib.inf
|
||||
ArmPkg/Library/SemihostLib/SemihostLib.inf
|
||||
ArmPkg/Library/ArmExceptionLib/ArmExceptionLib.inf
|
||||
ArmPkg/Library/CpuArchLib/CpuArchLib.inf
|
||||
|
||||
ArmPkg/Drivers/CpuDxe/CpuDxe.inf
|
||||
ArmPkg/Drivers/CpuPei/CpuPei.inf
|
||||
ArmPkg/Drivers/ArmGicDxe/ArmGicDxe.inf
|
||||
ArmPkg/Drivers/ArmGicDxe/ArmGicV2Dxe.inf
|
||||
|
@ -1,6 +1,6 @@
|
||||
#/** @file
|
||||
#
|
||||
# DXE CPU driver
|
||||
# This library installs CPU Architecture Protocol
|
||||
#
|
||||
# Copyright (c) 2009, Apple Inc. All rights reserved.<BR>
|
||||
# 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]
|
@ -395,9 +395,8 @@ HardwareInterruptProtocolNotify (
|
||||
}
|
||||
|
||||
EFI_STATUS
|
||||
CpuDxeInitialize (
|
||||
IN EFI_HANDLE ImageHandle,
|
||||
IN EFI_SYSTEM_TABLE *SystemTable
|
||||
InitializeCpu (
|
||||
VOID
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
@ -475,3 +474,14 @@ CpuDxeInitialize (
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
/**
|
||||
Initialize Multi-processor support.
|
||||
|
||||
**/
|
||||
VOID
|
||||
InitializeMpSupport (
|
||||
VOID
|
||||
)
|
||||
{
|
||||
}
|
@ -236,6 +236,7 @@
|
||||
MemoryAllocationLib|MdeModulePkg/Library/DxeCoreMemoryAllocationLib/DxeCoreMemoryAllocationLib.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
|
||||
|
@ -235,6 +235,9 @@
|
||||
<LibraryClasses>
|
||||
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 {
|
||||
<LibraryClasses>
|
||||
@ -244,7 +247,6 @@
|
||||
#
|
||||
# Architectural Protocols
|
||||
#
|
||||
ArmPkg/Drivers/CpuDxe/CpuDxe.inf
|
||||
MdeModulePkg/Core/RuntimeDxe/RuntimeDxe.inf
|
||||
MdeModulePkg/Universal/Variable/RuntimeDxe/VariableRuntimeDxe.inf {
|
||||
<LibraryClasses>
|
||||
|
@ -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
|
||||
|
@ -260,6 +260,9 @@
|
||||
<LibraryClasses>
|
||||
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 {
|
||||
<LibraryClasses>
|
||||
@ -269,7 +272,6 @@
|
||||
#
|
||||
# Architectural Protocols
|
||||
#
|
||||
ArmPkg/Drivers/CpuDxe/CpuDxe.inf
|
||||
MdeModulePkg/Core/RuntimeDxe/RuntimeDxe.inf
|
||||
MdeModulePkg/Universal/Variable/RuntimeDxe/VariableRuntimeDxe.inf {
|
||||
<LibraryClasses>
|
||||
|
@ -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
|
||||
|
@ -368,6 +368,9 @@
|
||||
<LibraryClasses>
|
||||
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 {
|
||||
<LibraryClasses>
|
||||
@ -377,7 +380,6 @@
|
||||
#
|
||||
# Architectural Protocols
|
||||
#
|
||||
ArmPkg/Drivers/CpuDxe/CpuDxe.inf
|
||||
MdeModulePkg/Core/RuntimeDxe/RuntimeDxe.inf
|
||||
MdeModulePkg/Universal/Variable/RuntimeDxe/VariableRuntimeDxe.inf {
|
||||
<LibraryClasses>
|
||||
|
@ -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
|
||||
|
@ -290,6 +290,9 @@
|
||||
<LibraryClasses>
|
||||
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 {
|
||||
<LibraryClasses>
|
||||
@ -299,7 +302,6 @@
|
||||
#
|
||||
# Architectural Protocols
|
||||
#
|
||||
ArmPkg/Drivers/CpuDxe/CpuDxe.inf
|
||||
MdeModulePkg/Core/RuntimeDxe/RuntimeDxe.inf
|
||||
MdeModulePkg/Universal/Variable/RuntimeDxe/VariableRuntimeDxe.inf {
|
||||
<LibraryClasses>
|
||||
|
@ -163,6 +163,9 @@
|
||||
<LibraryClasses>
|
||||
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 {
|
||||
<LibraryClasses>
|
||||
@ -172,7 +175,6 @@
|
||||
#
|
||||
# Architectural Protocols
|
||||
#
|
||||
ArmPkg/Drivers/CpuDxe/CpuDxe.inf
|
||||
MdeModulePkg/Core/RuntimeDxe/RuntimeDxe.inf
|
||||
MdeModulePkg/Universal/SecurityStubDxe/SecurityStubDxe.inf
|
||||
MdeModulePkg/Universal/CapsuleRuntimeDxe/CapsuleRuntimeDxe.inf
|
||||
|
@ -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
|
||||
|
@ -453,7 +453,7 @@ CoreDispatcher (
|
||||
DEBUG ((DEBUG_INFO, "Loading driver %g\n", &DriverEntry->FileName));
|
||||
Status = CoreLoadImage (
|
||||
FALSE,
|
||||
gDxeCoreImageHandle,
|
||||
gImageHandle,
|
||||
DriverEntry->FvFileDevicePath,
|
||||
NULL,
|
||||
0,
|
||||
|
@ -85,6 +85,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
#include <Library/DebugAgentLib.h>
|
||||
#include <Library/CpuExceptionHandlerLib.h>
|
||||
#include <Library/OrderedCollectionLib.h>
|
||||
#include <Library/CpuArchLib.h>
|
||||
|
||||
//
|
||||
// attributes for reserved memory before it is promoted to system memory
|
||||
@ -232,14 +233,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;
|
||||
@ -251,20 +252,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
|
||||
//
|
||||
|
@ -71,6 +71,7 @@
|
||||
[Packages]
|
||||
MdePkg/MdePkg.dec
|
||||
MdeModulePkg/MdeModulePkg.dec
|
||||
UefiCpuPkg/UefiCpuPkg.dec
|
||||
|
||||
[LibraryClasses]
|
||||
BaseMemoryLib
|
||||
@ -95,6 +96,7 @@
|
||||
PcdLib
|
||||
ImagePropertiesRecordLib
|
||||
OrderedCollectionLib
|
||||
CpuArchLib
|
||||
|
||||
[Guids]
|
||||
gEfiEventMemoryMapChangeGuid ## PRODUCES ## Event
|
||||
|
@ -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;
|
||||
|
||||
static BOOLEAN mExitBootServicesCalled = FALSE;
|
||||
|
||||
@ -245,18 +246,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
|
||||
//
|
||||
@ -299,26 +288,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
|
||||
@ -338,12 +364,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
|
||||
//
|
||||
@ -383,7 +403,7 @@ DxeMain (
|
||||
CoreNewDebugImageInfoEntry (
|
||||
EFI_DEBUG_IMAGE_INFO_TYPE_NORMAL,
|
||||
gDxeCoreLoadedImage,
|
||||
gDxeCoreImageHandle,
|
||||
gImageHandle,
|
||||
&ImageContext
|
||||
);
|
||||
|
||||
@ -447,26 +467,11 @@ DxeMain (
|
||||
|
||||
DEBUG_CODE_END ();
|
||||
|
||||
//
|
||||
// Initialize the Event Services
|
||||
//
|
||||
Status = CoreInitializeEventServices ();
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
|
||||
//
|
||||
// Give the debug agent a chance to initialize with events.
|
||||
//
|
||||
InitializeDebugAgent (DEBUG_AGENT_INIT_DXE_CORE_LATE, HobStart, NULL);
|
||||
|
||||
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));
|
||||
@ -506,26 +511,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);
|
||||
|
||||
//
|
||||
@ -827,18 +825,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
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1498,7 +1498,7 @@ CoreAddMemorySpace (
|
||||
EFI_PAGE_SHIFT,
|
||||
PageLength,
|
||||
&PageBaseAddress,
|
||||
gDxeCoreImageHandle,
|
||||
gImageHandle,
|
||||
NULL
|
||||
);
|
||||
|
||||
@ -1517,7 +1517,7 @@ CoreAddMemorySpace (
|
||||
EFI_PAGE_SHIFT,
|
||||
EFI_PAGE_SIZE,
|
||||
&PageBaseAddress,
|
||||
gDxeCoreImageHandle,
|
||||
gImageHandle,
|
||||
NULL
|
||||
);
|
||||
|
||||
@ -2735,7 +2735,7 @@ CoreInitializeGcdServices (
|
||||
0,
|
||||
MemoryLength,
|
||||
&MemoryBaseAddress,
|
||||
gDxeCoreImageHandle,
|
||||
gImageHandle,
|
||||
NULL
|
||||
);
|
||||
}
|
||||
@ -2756,7 +2756,7 @@ CoreInitializeGcdServices (
|
||||
0,
|
||||
MemoryHob->AllocDescriptor.MemoryLength,
|
||||
&BaseAddress,
|
||||
gDxeCoreImageHandle,
|
||||
gImageHandle,
|
||||
NULL
|
||||
);
|
||||
if (!EFI_ERROR (Status) &&
|
||||
@ -2782,7 +2782,7 @@ CoreInitializeGcdServices (
|
||||
0,
|
||||
FirmwareVolumeHob->Length,
|
||||
&BaseAddress,
|
||||
gDxeCoreImageHandle,
|
||||
gImageHandle,
|
||||
NULL
|
||||
);
|
||||
}
|
||||
@ -2830,7 +2830,7 @@ CoreInitializeGcdServices (
|
||||
0,
|
||||
Length,
|
||||
&BaseAddress,
|
||||
gDxeCoreImageHandle,
|
||||
gImageHandle,
|
||||
NULL
|
||||
);
|
||||
}
|
||||
@ -2872,7 +2872,7 @@ CoreInitializeGcdServices (
|
||||
0,
|
||||
Length,
|
||||
&BaseAddress,
|
||||
gDxeCoreImageHandle,
|
||||
gImageHandle,
|
||||
NULL
|
||||
);
|
||||
}
|
||||
|
@ -1047,7 +1047,7 @@ CoreHandleProtocol (
|
||||
UserHandle,
|
||||
Protocol,
|
||||
Interface,
|
||||
gDxeCoreImageHandle,
|
||||
gImageHandle,
|
||||
NULL,
|
||||
EFI_OPEN_PROTOCOL_BY_HANDLE_PROTOCOL
|
||||
);
|
||||
|
@ -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);
|
||||
|
@ -419,7 +419,7 @@ PromoteMemoryResource (
|
||||
}
|
||||
|
||||
Entry->Capabilities |= EFI_MEMORY_TESTED;
|
||||
Entry->ImageHandle = gDxeCoreImageHandle;
|
||||
Entry->ImageHandle = gImageHandle;
|
||||
Entry->DeviceHandle = NULL;
|
||||
|
||||
//
|
||||
|
@ -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;
|
||||
|
||||
//
|
||||
|
@ -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
|
||||
|
@ -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.<BR>
|
||||
SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
|
||||
**/
|
||||
|
||||
#include <PiDxe.h>
|
||||
#include <Guid/DxeServices.h>
|
||||
#include <Library/DxeServicesTableLib.h>
|
||||
#include <Library/DebugLib.h>
|
||||
#include <Library/UefiLib.h>
|
||||
|
||||
/**
|
||||
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;
|
||||
}
|
@ -0,0 +1,40 @@
|
||||
## @file
|
||||
# Dummy instance of DXE Services Table Library for DxeCore.
|
||||
#
|
||||
# Copyright (c) 2021, Marvin Häuser. All rights reserved.<BR>
|
||||
#
|
||||
# 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
|
@ -0,0 +1,13 @@
|
||||
// /** @file
|
||||
// Dummy instance of DXE Services Table Library for DxeCore.
|
||||
//
|
||||
// Copyright (c) 2021, Marvin Häuser. All rights reserved.<BR>
|
||||
//
|
||||
// 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."
|
@ -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.<BR>
|
||||
SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
|
||||
**/
|
||||
|
||||
#include <Uefi.h>
|
||||
|
||||
#include <Library/UefiBootServicesTableLib.h>
|
||||
#include <Library/DebugLib.h>
|
||||
|
||||
/**
|
||||
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;
|
||||
}
|
@ -0,0 +1,34 @@
|
||||
## @file
|
||||
# Dummy instance of UEFI Boot Services Table Library for DxeCore.
|
||||
#
|
||||
# Copyright (c) 2021, Marvin Häuser. All rights reserved.<BR>
|
||||
#
|
||||
# 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
|
@ -0,0 +1,13 @@
|
||||
// /** @file
|
||||
// Dummy instance of UEFI Boot Services Table Library for DxeCore.
|
||||
//
|
||||
// Copyright (c) 2021, Marvin Häuser. All rights reserved.<BR>
|
||||
//
|
||||
// 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."
|
@ -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.<BR>
|
||||
SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
|
||||
**/
|
||||
|
||||
#include <Uefi.h>
|
||||
|
||||
#include <Library/UefiRuntimeServicesTableLib.h>
|
||||
#include <Library/DebugLib.h>
|
||||
|
||||
/**
|
||||
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;
|
||||
}
|
@ -0,0 +1,35 @@
|
||||
## @file
|
||||
# Dummy instance of UEFI Runtime Services Table Library for DxeCore.
|
||||
#
|
||||
# Copyright (c) 2021, Marvin Häuser. All rights reserved.<BR>
|
||||
#
|
||||
# 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
|
@ -0,0 +1,13 @@
|
||||
// /** @file
|
||||
// Dummy instance of UEFI Runtime Services Table Library for DxeCore.
|
||||
//
|
||||
// Copyright (c) 2021, Marvin Häuser. All rights reserved.<BR>
|
||||
//
|
||||
// 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."
|
@ -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
|
||||
@ -345,6 +361,9 @@
|
||||
MdeModulePkg/Library/DisplayUpdateProgressLibText/DisplayUpdateProgressLibText.inf
|
||||
MdeModulePkg/Library/BaseRngLibTimerLib/BaseRngLibTimerLib.inf
|
||||
MdeModulePkg/Library/HobPrintLib/HobPrintLib.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
|
||||
@ -527,4 +546,3 @@
|
||||
MdeModulePkg/Universal/CapsulePei/CapsuleX64.inf
|
||||
|
||||
[BuildOptions]
|
||||
|
||||
|
@ -55,6 +55,9 @@ typedef struct {
|
||||
BOOLEAN QemuFwCfgChecked;
|
||||
BOOLEAN QemuFwCfgSupported;
|
||||
BOOLEAN QemuFwCfgDmaSupported;
|
||||
|
||||
UINT64 PteMemoryEncryptionAddressOrMask;
|
||||
UINT64 GhcbBase;
|
||||
} EFI_HOB_PLATFORM_INFO;
|
||||
#pragma pack()
|
||||
|
||||
|
@ -256,6 +256,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
|
||||
@ -573,6 +575,9 @@
|
||||
<LibraryClasses>
|
||||
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
|
||||
@ -595,29 +600,6 @@
|
||||
MdeModulePkg/Universal/EbcDxe/EbcDxe.inf
|
||||
UefiCpuPkg/CpuIo2Dxe/CpuIo2Dxe.inf
|
||||
|
||||
UefiCpuPkg/CpuDxe/CpuDxe.inf {
|
||||
<LibraryClasses>
|
||||
#
|
||||
# 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 {
|
||||
<Defines>
|
||||
FILE_GUID = $(UP_CPU_DXE_GUID)
|
||||
|
||||
<LibraryClasses>
|
||||
#
|
||||
# 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
|
||||
|
@ -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
|
||||
|
@ -327,6 +327,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
|
||||
@ -731,6 +733,9 @@
|
||||
<LibraryClasses>
|
||||
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
|
||||
@ -752,7 +757,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
|
||||
|
@ -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
|
||||
|
@ -332,6 +332,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
|
||||
@ -747,6 +749,9 @@
|
||||
<LibraryClasses>
|
||||
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
|
||||
@ -768,7 +773,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
|
||||
|
@ -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
|
||||
|
@ -354,6 +354,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
|
||||
@ -793,6 +795,9 @@
|
||||
<LibraryClasses>
|
||||
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
|
||||
@ -815,29 +820,6 @@
|
||||
MdeModulePkg/Universal/EbcDxe/EbcDxe.inf
|
||||
UefiCpuPkg/CpuIo2Dxe/CpuIo2Dxe.inf
|
||||
|
||||
UefiCpuPkg/CpuDxe/CpuDxe.inf {
|
||||
<LibraryClasses>
|
||||
#
|
||||
# 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 {
|
||||
<Defines>
|
||||
FILE_GUID = $(UP_CPU_DXE_GUID)
|
||||
|
||||
<LibraryClasses>
|
||||
#
|
||||
# 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
|
||||
|
@ -251,9 +251,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
|
||||
|
@ -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);
|
||||
|
||||
@ -459,6 +462,8 @@ AmdSevInitialize (
|
||||
PcdStatus = PcdSet64S (PcdPteMemoryEncryptionAddressOrMask, EncryptionMask);
|
||||
ASSERT_RETURN_ERROR (PcdStatus);
|
||||
|
||||
PlatformInfoHob->PteMemoryEncryptionAddressOrMask = EncryptionMask;
|
||||
|
||||
DEBUG ((DEBUG_INFO, "SEV is enabled (mask 0x%lx)\n", EncryptionMask));
|
||||
|
||||
//
|
||||
@ -530,6 +535,7 @@ AmdSevInitialize (
|
||||
}
|
||||
|
||||
PcdStatus = PcdSet64S (PcdConfidentialComputingGuestAttr, CCGuestAttr);
|
||||
PlatformInfoHob->PcdConfidentialComputingGuestAttr = CCGuestAttr;
|
||||
|
||||
ASSERT_RETURN_ERROR (PcdStatus);
|
||||
}
|
||||
|
@ -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;
|
||||
@ -43,8 +44,12 @@ 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;
|
||||
#endif
|
||||
}
|
||||
|
@ -368,7 +368,7 @@ InitializePlatform (
|
||||
PlatformIdInitialization (PeiServices);
|
||||
}
|
||||
|
||||
IntelTdxInitialize ();
|
||||
IntelTdxInitialize (PlatformInfoHob);
|
||||
InstallFeatureControlCallback (PlatformInfoHob);
|
||||
if (PlatformInfoHob->SmmSmramRequire) {
|
||||
RelocateSmBase ();
|
||||
|
@ -95,7 +95,7 @@ AmdSevInitialize (
|
||||
**/
|
||||
VOID
|
||||
IntelTdxInitialize (
|
||||
VOID
|
||||
IN EFI_HOB_PLATFORM_INFO *PlatformInfoHob
|
||||
);
|
||||
|
||||
/**
|
||||
|
@ -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.<BR>
|
||||
//
|
||||
// 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."
|
||||
|
31
UefiCpuPkg/Include/Library/CpuArchLib.h
Normal file
31
UefiCpuPkg/Include/Library/CpuArchLib.h
Normal file
@ -0,0 +1,31 @@
|
||||
/** @file
|
||||
CPU DXE Module to produce CPU ARCH Protocol.
|
||||
Copyright (c) 2008 - 2022, Intel Corporation. All rights reserved.<BR>
|
||||
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_
|
@ -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.<BR>
|
||||
# Copyright (c) 2017, AMD Incorporated. All rights reserved.<BR>
|
||||
@ -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]
|
||||
@ -82,13 +82,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
|
13
UefiCpuPkg/Library/CpuArchLib/CpuArchLib.uni
Normal file
13
UefiCpuPkg/Library/CpuArchLib/CpuArchLib.uni
Normal file
@ -0,0 +1,13 @@
|
||||
// /** @file
|
||||
// This library installs CPU Architecture Protocol and CPU MP Protocol.
|
||||
//
|
||||
// Copyright (c) 2008 - 2018, Intel Corporation. All rights reserved.<BR>
|
||||
//
|
||||
// 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."
|
24
UefiCpuPkg/Library/CpuArchLib/CpuArchLibNull.inf
Normal file
24
UefiCpuPkg/Library/CpuArchLib/CpuArchLibNull.inf
Normal file
@ -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
|
@ -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);
|
||||
@ -1046,7 +1049,7 @@ InitializeCpu (
|
||||
//
|
||||
// Add and allocate local APIC memory mapped space
|
||||
//
|
||||
AddLocalApicMemorySpace (ImageHandle);
|
||||
AddLocalApicMemorySpace ();
|
||||
|
||||
//
|
||||
// Setup a callback for idle events
|
||||
@ -1061,7 +1064,5 @@ InitializeCpu (
|
||||
);
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
|
||||
InitializeMpSupport ();
|
||||
|
||||
return Status;
|
||||
}
|
@ -35,6 +35,7 @@
|
||||
#include <Library/ReportStatusCodeLib.h>
|
||||
#include <Library/MpInitLib.h>
|
||||
#include <Library/TimerLib.h>
|
||||
#include <Library/PlatformInitLib.h>
|
||||
|
||||
#include <Guid/IdleLoopEvent.h>
|
||||
#include <Guid/VectorHandoffTable.h>
|
||||
@ -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
|
@ -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"
|
25
UefiCpuPkg/Library/CpuArchLib/CpuDxeNull.c
Normal file
25
UefiCpuPkg/Library/CpuArchLib/CpuDxeNull.c
Normal file
@ -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
|
||||
)
|
||||
{
|
||||
}
|
@ -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.
|
@ -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) {
|
||||
//
|
||||
@ -1654,7 +1654,7 @@ EfiGetMemoryAttributes (
|
||||
|
||||
// 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;
|
||||
|
||||
GetCurrentPagingContext (&CurrentPagingContext);
|
||||
|
@ -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]
|
||||
@ -80,16 +81,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
|
||||
|
@ -9,13 +9,17 @@
|
||||
**/
|
||||
|
||||
#include "MpLib.h"
|
||||
|
||||
#include <Library/CcExitLib.h>
|
||||
#include <Register/Amd/SevSnpMsr.h>
|
||||
#include <Library/PlatformInitLib.h>
|
||||
|
||||
#include <Register/Amd/Ghcb.h>
|
||||
|
||||
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;
|
||||
|
||||
RELOCATE_AP_LOOP_ENTRY mReservedApLoop;
|
||||
UINTN mReservedTopOfApStack;
|
||||
@ -589,7 +593,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);
|
||||
|
||||
return CpuMpData->CpuCount;
|
||||
}
|
||||
@ -1151,7 +1155,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
|
||||
@ -1303,7 +1307,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.
|
||||
@ -1319,7 +1323,7 @@ WakeUpAP (
|
||||
//
|
||||
TimedWaitForApFinish (
|
||||
CpuMpData,
|
||||
PcdGet32 (PcdCpuBootLogicalProcessorNumber) - 1,
|
||||
mPlatformInfoHob->PcdCpuBootLogicalProcessorNumber - 1,
|
||||
MAX_UINT32 // approx. 71 minutes
|
||||
);
|
||||
} else {
|
||||
@ -1357,7 +1361,7 @@ WakeUpAP (
|
||||
//
|
||||
TimedWaitForApFinish (
|
||||
CpuMpData,
|
||||
PcdGet32 (PcdCpuMaxLogicalProcessorNumber) - 1,
|
||||
mPlatformInfoHob->PcdCpuMaxLogicalProcessorNumber - 1,
|
||||
PcdGet32 (PcdCpuApInitTimeOutInMicroSeconds)
|
||||
);
|
||||
|
||||
@ -2067,6 +2071,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) {
|
||||
@ -2086,7 +2096,7 @@ MpInitLibInitialize (
|
||||
MaxLogicalProcessorNumber += MpHandOff->CpuCount;
|
||||
}
|
||||
} else {
|
||||
MaxLogicalProcessorNumber = PcdGet32 (PcdCpuMaxLogicalProcessorNumber);
|
||||
MaxLogicalProcessorNumber = mPlatformInfoHob->PcdCpuMaxLogicalProcessorNumber;
|
||||
}
|
||||
|
||||
ASSERT (MaxLogicalProcessorNumber != 0);
|
||||
@ -2170,7 +2180,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) {
|
||||
@ -3342,7 +3352,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.
|
||||
|
@ -49,6 +49,7 @@
|
||||
[Packages]
|
||||
MdePkg/MdePkg.dec
|
||||
MdeModulePkg/MdeModulePkg.dec
|
||||
OvmfPkg/OvmfPkg.dec
|
||||
UefiCpuPkg/UefiCpuPkg.dec
|
||||
|
||||
[LibraryClasses]
|
||||
@ -70,10 +71,6 @@
|
||||
CpuPageTableLib
|
||||
|
||||
[Pcd]
|
||||
gEfiMdeModulePkgTokenSpaceGuid.PcdGhcbBase ## CONSUMES
|
||||
gEfiMdePkgTokenSpaceGuid.PcdConfidentialComputingGuestAttr ## CONSUMES
|
||||
gUefiCpuPkgTokenSpaceGuid.PcdCpuMaxLogicalProcessorNumber ## CONSUMES
|
||||
gUefiCpuPkgTokenSpaceGuid.PcdCpuBootLogicalProcessorNumber ## CONSUMES
|
||||
gUefiCpuPkgTokenSpaceGuid.PcdCpuApInitTimeOutInMicroSeconds ## SOMETIMES_CONSUMES
|
||||
gUefiCpuPkgTokenSpaceGuid.PcdCpuApStackSize ## CONSUMES
|
||||
gUefiCpuPkgTokenSpaceGuid.PcdCpuMicrocodePatchAddress ## CONSUMES
|
||||
@ -91,6 +88,7 @@
|
||||
gEdkiiMicrocodePatchHobGuid
|
||||
gGhcbApicIdsGuid ## SOMETIMES_CONSUMES
|
||||
gEdkiiEndOfS3ResumeGuid
|
||||
gUefiOvmfPkgPlatformInfoGuid ## CONSUMES ## HOB
|
||||
|
||||
[Guids.LoongArch64]
|
||||
gProcessorResourceHobGuid ## SOMETIMES_CONSUMES ## HOB
|
||||
|
@ -76,6 +76,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 function to initialize the FPU.
|
||||
|
@ -75,6 +75,7 @@
|
||||
HobLib|MdeModulePkg/Library/BaseHobLibNull/BaseHobLibNull.inf
|
||||
MemoryAllocationLib|MdeModulePkg/Library/BaseMemoryAllocationLibNull/BaseMemoryAllocationLibNull.inf
|
||||
IntrinsicLib|CryptoPkg/Library/IntrinsicLib/IntrinsicLib.inf
|
||||
CpuArchLib|UefiCpuPkg/Library/CpuArchLib/CpuArchLib.inf
|
||||
|
||||
[LibraryClasses.common.SEC]
|
||||
PlatformSecLib|UefiCpuPkg/Library/PlatformSecLibNull/PlatformSecLibNull.inf
|
||||
@ -143,7 +144,6 @@
|
||||
CryptoPkg/Library/IntrinsicLib/IntrinsicLib.inf
|
||||
|
||||
[Components.IA32, Components.X64]
|
||||
UefiCpuPkg/CpuDxe/CpuDxe.inf
|
||||
UefiCpuPkg/CpuFeatures/CpuFeaturesPei.inf {
|
||||
<LibraryClasses>
|
||||
NULL|UefiCpuPkg/Library/CpuCommonFeaturesLib/CpuCommonFeaturesLib.inf
|
||||
@ -156,8 +156,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
|
||||
@ -176,9 +179,7 @@
|
||||
UefiCpuPkg/Library/SmmCpuFeaturesLib/SmmCpuFeaturesLibStm.inf
|
||||
UefiCpuPkg/Library/SmmCpuFeaturesLib/StandaloneMmCpuFeaturesLib.inf
|
||||
UefiCpuPkg/Library/SmmCpuSyncLib/SmmCpuSyncLib.inf
|
||||
UefiCpuPkg/Library/CcExitLibNull/CcExitLibNull.inf
|
||||
UefiCpuPkg/Library/TdxMeasurementLibNull/TdxMeasurementLibNull.inf
|
||||
UefiCpuPkg/Library/AmdSvsmLibNull/AmdSvsmLibNull.inf
|
||||
UefiCpuPkg/PiSmmCommunication/PiSmmCommunicationPei.inf
|
||||
UefiCpuPkg/PiSmmCommunication/PiSmmCommunicationSmm.inf
|
||||
UefiCpuPkg/SecCore/SecCore.inf
|
||||
|
@ -382,6 +382,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
|
||||
@ -726,6 +728,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
|
||||
}
|
||||
|
||||
#
|
||||
@ -744,7 +749,6 @@
|
||||
SecurityPkg/VariableAuthenticated/SecureBootConfigDxe/SecureBootConfigDxe.inf
|
||||
!endif
|
||||
|
||||
UefiCpuPkg/CpuDxe/CpuDxe.inf
|
||||
MdeModulePkg/Universal/BdsDxe/BdsDxe.inf
|
||||
!if $(BOOTSPLASH_IMAGE)
|
||||
MdeModulePkg/Logo/LogoDxe.inf
|
||||
|
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user