diff options
Diffstat (limited to 'MdeModulePkg/Core/Dxe/DxeMain')
-rw-r--r-- | MdeModulePkg/Core/Dxe/DxeMain/DxeMain.c | 418 | ||||
-rw-r--r-- | MdeModulePkg/Core/Dxe/DxeMain/DxeProtocolNotify.c | 74 |
2 files changed, 249 insertions, 243 deletions
diff --git a/MdeModulePkg/Core/Dxe/DxeMain/DxeMain.c b/MdeModulePkg/Core/Dxe/DxeMain/DxeMain.c index db21311f93..2c27fc0695 100644 --- a/MdeModulePkg/Core/Dxe/DxeMain/DxeMain.c +++ b/MdeModulePkg/Core/Dxe/DxeMain/DxeMain.c @@ -11,7 +11,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent //
// DXE Core Global Variables for Protocols from PEI
//
-EFI_HANDLE mDecompressHandle = NULL;
+EFI_HANDLE mDecompressHandle = NULL;
//
// DXE Core globals for Architecture Protocols
@@ -27,18 +27,18 @@ EFI_WATCHDOG_TIMER_ARCH_PROTOCOL *gWatchdogTimer = NULL; //
// DXE Core globals for optional protocol dependencies
//
-EFI_SMM_BASE2_PROTOCOL *gSmmBase2 = NULL;
+EFI_SMM_BASE2_PROTOCOL *gSmmBase2 = NULL;
//
// DXE Core Global used to update core loaded image protocol handle
//
-EFI_GUID *gDxeCoreFileName;
-EFI_LOADED_IMAGE_PROTOCOL *gDxeCoreLoadedImage;
+EFI_GUID *gDxeCoreFileName;
+EFI_LOADED_IMAGE_PROTOCOL *gDxeCoreLoadedImage;
//
// DXE Core Module Variables
//
-EFI_BOOT_SERVICES mBootServices = {
+EFI_BOOT_SERVICES mBootServices = {
{
EFI_BOOT_SERVICES_SIGNATURE, // Signature
EFI_BOOT_SERVICES_REVISION, // Revision
@@ -46,81 +46,81 @@ EFI_BOOT_SERVICES mBootServices = { 0, // CRC32
0 // Reserved
},
- (EFI_RAISE_TPL) CoreRaiseTpl, // RaiseTPL
- (EFI_RESTORE_TPL) CoreRestoreTpl, // RestoreTPL
- (EFI_ALLOCATE_PAGES) CoreAllocatePages, // AllocatePages
- (EFI_FREE_PAGES) CoreFreePages, // FreePages
- (EFI_GET_MEMORY_MAP) CoreGetMemoryMap, // GetMemoryMap
- (EFI_ALLOCATE_POOL) CoreAllocatePool, // AllocatePool
- (EFI_FREE_POOL) CoreFreePool, // FreePool
- (EFI_CREATE_EVENT) CoreCreateEvent, // CreateEvent
- (EFI_SET_TIMER) CoreSetTimer, // SetTimer
- (EFI_WAIT_FOR_EVENT) CoreWaitForEvent, // WaitForEvent
- (EFI_SIGNAL_EVENT) CoreSignalEvent, // SignalEvent
- (EFI_CLOSE_EVENT) CoreCloseEvent, // CloseEvent
- (EFI_CHECK_EVENT) CoreCheckEvent, // CheckEvent
- (EFI_INSTALL_PROTOCOL_INTERFACE) CoreInstallProtocolInterface, // InstallProtocolInterface
- (EFI_REINSTALL_PROTOCOL_INTERFACE) CoreReinstallProtocolInterface, // ReinstallProtocolInterface
- (EFI_UNINSTALL_PROTOCOL_INTERFACE) CoreUninstallProtocolInterface, // UninstallProtocolInterface
- (EFI_HANDLE_PROTOCOL) CoreHandleProtocol, // HandleProtocol
- (VOID *) NULL, // Reserved
- (EFI_REGISTER_PROTOCOL_NOTIFY) CoreRegisterProtocolNotify, // RegisterProtocolNotify
- (EFI_LOCATE_HANDLE) CoreLocateHandle, // LocateHandle
- (EFI_LOCATE_DEVICE_PATH) CoreLocateDevicePath, // LocateDevicePath
- (EFI_INSTALL_CONFIGURATION_TABLE) CoreInstallConfigurationTable, // InstallConfigurationTable
- (EFI_IMAGE_LOAD) CoreLoadImage, // LoadImage
- (EFI_IMAGE_START) CoreStartImage, // StartImage
- (EFI_EXIT) CoreExit, // Exit
- (EFI_IMAGE_UNLOAD) CoreUnloadImage, // UnloadImage
- (EFI_EXIT_BOOT_SERVICES) CoreExitBootServices, // ExitBootServices
- (EFI_GET_NEXT_MONOTONIC_COUNT) CoreEfiNotAvailableYetArg1, // GetNextMonotonicCount
- (EFI_STALL) CoreStall, // Stall
- (EFI_SET_WATCHDOG_TIMER) CoreSetWatchdogTimer, // SetWatchdogTimer
- (EFI_CONNECT_CONTROLLER) CoreConnectController, // ConnectController
- (EFI_DISCONNECT_CONTROLLER) CoreDisconnectController, // DisconnectController
- (EFI_OPEN_PROTOCOL) CoreOpenProtocol, // OpenProtocol
- (EFI_CLOSE_PROTOCOL) CoreCloseProtocol, // CloseProtocol
- (EFI_OPEN_PROTOCOL_INFORMATION) CoreOpenProtocolInformation, // OpenProtocolInformation
- (EFI_PROTOCOLS_PER_HANDLE) CoreProtocolsPerHandle, // ProtocolsPerHandle
- (EFI_LOCATE_HANDLE_BUFFER) CoreLocateHandleBuffer, // LocateHandleBuffer
- (EFI_LOCATE_PROTOCOL) CoreLocateProtocol, // LocateProtocol
- (EFI_INSTALL_MULTIPLE_PROTOCOL_INTERFACES) CoreInstallMultipleProtocolInterfaces, // InstallMultipleProtocolInterfaces
- (EFI_UNINSTALL_MULTIPLE_PROTOCOL_INTERFACES) CoreUninstallMultipleProtocolInterfaces, // UninstallMultipleProtocolInterfaces
- (EFI_CALCULATE_CRC32) CoreEfiNotAvailableYetArg3, // CalculateCrc32
- (EFI_COPY_MEM) CopyMem, // CopyMem
- (EFI_SET_MEM) SetMem, // SetMem
- (EFI_CREATE_EVENT_EX) CoreCreateEventEx // CreateEventEx
+ (EFI_RAISE_TPL)CoreRaiseTpl, // RaiseTPL
+ (EFI_RESTORE_TPL)CoreRestoreTpl, // RestoreTPL
+ (EFI_ALLOCATE_PAGES)CoreAllocatePages, // AllocatePages
+ (EFI_FREE_PAGES)CoreFreePages, // FreePages
+ (EFI_GET_MEMORY_MAP)CoreGetMemoryMap, // GetMemoryMap
+ (EFI_ALLOCATE_POOL)CoreAllocatePool, // AllocatePool
+ (EFI_FREE_POOL)CoreFreePool, // FreePool
+ (EFI_CREATE_EVENT)CoreCreateEvent, // CreateEvent
+ (EFI_SET_TIMER)CoreSetTimer, // SetTimer
+ (EFI_WAIT_FOR_EVENT)CoreWaitForEvent, // WaitForEvent
+ (EFI_SIGNAL_EVENT)CoreSignalEvent, // SignalEvent
+ (EFI_CLOSE_EVENT)CoreCloseEvent, // CloseEvent
+ (EFI_CHECK_EVENT)CoreCheckEvent, // CheckEvent
+ (EFI_INSTALL_PROTOCOL_INTERFACE)CoreInstallProtocolInterface, // InstallProtocolInterface
+ (EFI_REINSTALL_PROTOCOL_INTERFACE)CoreReinstallProtocolInterface, // ReinstallProtocolInterface
+ (EFI_UNINSTALL_PROTOCOL_INTERFACE)CoreUninstallProtocolInterface, // UninstallProtocolInterface
+ (EFI_HANDLE_PROTOCOL)CoreHandleProtocol, // HandleProtocol
+ (VOID *)NULL, // Reserved
+ (EFI_REGISTER_PROTOCOL_NOTIFY)CoreRegisterProtocolNotify, // RegisterProtocolNotify
+ (EFI_LOCATE_HANDLE)CoreLocateHandle, // LocateHandle
+ (EFI_LOCATE_DEVICE_PATH)CoreLocateDevicePath, // LocateDevicePath
+ (EFI_INSTALL_CONFIGURATION_TABLE)CoreInstallConfigurationTable, // InstallConfigurationTable
+ (EFI_IMAGE_LOAD)CoreLoadImage, // LoadImage
+ (EFI_IMAGE_START)CoreStartImage, // StartImage
+ (EFI_EXIT)CoreExit, // Exit
+ (EFI_IMAGE_UNLOAD)CoreUnloadImage, // UnloadImage
+ (EFI_EXIT_BOOT_SERVICES)CoreExitBootServices, // ExitBootServices
+ (EFI_GET_NEXT_MONOTONIC_COUNT)CoreEfiNotAvailableYetArg1, // GetNextMonotonicCount
+ (EFI_STALL)CoreStall, // Stall
+ (EFI_SET_WATCHDOG_TIMER)CoreSetWatchdogTimer, // SetWatchdogTimer
+ (EFI_CONNECT_CONTROLLER)CoreConnectController, // ConnectController
+ (EFI_DISCONNECT_CONTROLLER)CoreDisconnectController, // DisconnectController
+ (EFI_OPEN_PROTOCOL)CoreOpenProtocol, // OpenProtocol
+ (EFI_CLOSE_PROTOCOL)CoreCloseProtocol, // CloseProtocol
+ (EFI_OPEN_PROTOCOL_INFORMATION)CoreOpenProtocolInformation, // OpenProtocolInformation
+ (EFI_PROTOCOLS_PER_HANDLE)CoreProtocolsPerHandle, // ProtocolsPerHandle
+ (EFI_LOCATE_HANDLE_BUFFER)CoreLocateHandleBuffer, // LocateHandleBuffer
+ (EFI_LOCATE_PROTOCOL)CoreLocateProtocol, // LocateProtocol
+ (EFI_INSTALL_MULTIPLE_PROTOCOL_INTERFACES)CoreInstallMultipleProtocolInterfaces, // InstallMultipleProtocolInterfaces
+ (EFI_UNINSTALL_MULTIPLE_PROTOCOL_INTERFACES)CoreUninstallMultipleProtocolInterfaces, // UninstallMultipleProtocolInterfaces
+ (EFI_CALCULATE_CRC32)CoreEfiNotAvailableYetArg3, // CalculateCrc32
+ (EFI_COPY_MEM)CopyMem, // CopyMem
+ (EFI_SET_MEM)SetMem, // SetMem
+ (EFI_CREATE_EVENT_EX)CoreCreateEventEx // CreateEventEx
};
-EFI_DXE_SERVICES mDxeServices = {
+EFI_DXE_SERVICES mDxeServices = {
{
DXE_SERVICES_SIGNATURE, // Signature
DXE_SERVICES_REVISION, // Revision
sizeof (DXE_SERVICES), // HeaderSize
- 0, // CRC32
- 0 // Reserved
+ 0, // CRC32
+ 0 // Reserved
},
- (EFI_ADD_MEMORY_SPACE) CoreAddMemorySpace, // AddMemorySpace
- (EFI_ALLOCATE_MEMORY_SPACE) CoreAllocateMemorySpace, // AllocateMemorySpace
- (EFI_FREE_MEMORY_SPACE) CoreFreeMemorySpace, // FreeMemorySpace
- (EFI_REMOVE_MEMORY_SPACE) CoreRemoveMemorySpace, // RemoveMemorySpace
- (EFI_GET_MEMORY_SPACE_DESCRIPTOR) CoreGetMemorySpaceDescriptor, // GetMemorySpaceDescriptor
- (EFI_SET_MEMORY_SPACE_ATTRIBUTES) CoreSetMemorySpaceAttributes, // SetMemorySpaceAttributes
- (EFI_GET_MEMORY_SPACE_MAP) CoreGetMemorySpaceMap, // GetMemorySpaceMap
- (EFI_ADD_IO_SPACE) CoreAddIoSpace, // AddIoSpace
- (EFI_ALLOCATE_IO_SPACE) CoreAllocateIoSpace, // AllocateIoSpace
- (EFI_FREE_IO_SPACE) CoreFreeIoSpace, // FreeIoSpace
- (EFI_REMOVE_IO_SPACE) CoreRemoveIoSpace, // RemoveIoSpace
- (EFI_GET_IO_SPACE_DESCRIPTOR) CoreGetIoSpaceDescriptor, // GetIoSpaceDescriptor
- (EFI_GET_IO_SPACE_MAP) CoreGetIoSpaceMap, // GetIoSpaceMap
- (EFI_DISPATCH) CoreDispatcher, // Dispatch
- (EFI_SCHEDULE) CoreSchedule, // Schedule
- (EFI_TRUST) CoreTrust, // Trust
- (EFI_PROCESS_FIRMWARE_VOLUME) CoreProcessFirmwareVolume, // ProcessFirmwareVolume
+ (EFI_ADD_MEMORY_SPACE)CoreAddMemorySpace, // AddMemorySpace
+ (EFI_ALLOCATE_MEMORY_SPACE)CoreAllocateMemorySpace, // AllocateMemorySpace
+ (EFI_FREE_MEMORY_SPACE)CoreFreeMemorySpace, // FreeMemorySpace
+ (EFI_REMOVE_MEMORY_SPACE)CoreRemoveMemorySpace, // RemoveMemorySpace
+ (EFI_GET_MEMORY_SPACE_DESCRIPTOR)CoreGetMemorySpaceDescriptor, // GetMemorySpaceDescriptor
+ (EFI_SET_MEMORY_SPACE_ATTRIBUTES)CoreSetMemorySpaceAttributes, // SetMemorySpaceAttributes
+ (EFI_GET_MEMORY_SPACE_MAP)CoreGetMemorySpaceMap, // GetMemorySpaceMap
+ (EFI_ADD_IO_SPACE)CoreAddIoSpace, // AddIoSpace
+ (EFI_ALLOCATE_IO_SPACE)CoreAllocateIoSpace, // AllocateIoSpace
+ (EFI_FREE_IO_SPACE)CoreFreeIoSpace, // FreeIoSpace
+ (EFI_REMOVE_IO_SPACE)CoreRemoveIoSpace, // RemoveIoSpace
+ (EFI_GET_IO_SPACE_DESCRIPTOR)CoreGetIoSpaceDescriptor, // GetIoSpaceDescriptor
+ (EFI_GET_IO_SPACE_MAP)CoreGetIoSpaceMap, // GetIoSpaceMap
+ (EFI_DISPATCH)CoreDispatcher, // Dispatch
+ (EFI_SCHEDULE)CoreSchedule, // Schedule
+ (EFI_TRUST)CoreTrust, // Trust
+ (EFI_PROCESS_FIRMWARE_VOLUME)CoreProcessFirmwareVolume, // ProcessFirmwareVolume
(EFI_SET_MEMORY_SPACE_CAPABILITIES)CoreSetMemorySpaceCapabilities, // SetMemorySpaceCapabilities
};
-EFI_SYSTEM_TABLE mEfiSystemTableTemplate = {
+EFI_SYSTEM_TABLE mEfiSystemTableTemplate = {
{
EFI_SYSTEM_TABLE_SIGNATURE, // Signature
EFI_SYSTEM_TABLE_REVISION, // Revision
@@ -142,7 +142,7 @@ EFI_SYSTEM_TABLE mEfiSystemTableTemplate = { NULL // ConfigurationTable
};
-EFI_RUNTIME_SERVICES mEfiRuntimeServicesTableTemplate = {
+EFI_RUNTIME_SERVICES mEfiRuntimeServicesTableTemplate = {
{
EFI_RUNTIME_SERVICES_SIGNATURE, // Signature
EFI_RUNTIME_SERVICES_REVISION, // Revision
@@ -150,23 +150,23 @@ EFI_RUNTIME_SERVICES mEfiRuntimeServicesTableTemplate = { 0, // CRC32
0 // Reserved
},
- (EFI_GET_TIME) CoreEfiNotAvailableYetArg2, // GetTime
- (EFI_SET_TIME) CoreEfiNotAvailableYetArg1, // SetTime
- (EFI_GET_WAKEUP_TIME) CoreEfiNotAvailableYetArg3, // GetWakeupTime
- (EFI_SET_WAKEUP_TIME) CoreEfiNotAvailableYetArg2, // SetWakeupTime
- (EFI_SET_VIRTUAL_ADDRESS_MAP) CoreEfiNotAvailableYetArg4, // SetVirtualAddressMap
- (EFI_CONVERT_POINTER) CoreEfiNotAvailableYetArg2, // ConvertPointer
- (EFI_GET_VARIABLE) CoreEfiNotAvailableYetArg5, // GetVariable
- (EFI_GET_NEXT_VARIABLE_NAME) CoreEfiNotAvailableYetArg3, // GetNextVariableName
- (EFI_SET_VARIABLE) CoreEfiNotAvailableYetArg5, // SetVariable
- (EFI_GET_NEXT_HIGH_MONO_COUNT) CoreEfiNotAvailableYetArg1, // GetNextHighMonotonicCount
- (EFI_RESET_SYSTEM) CoreEfiNotAvailableYetArg4, // ResetSystem
- (EFI_UPDATE_CAPSULE) CoreEfiNotAvailableYetArg3, // UpdateCapsule
- (EFI_QUERY_CAPSULE_CAPABILITIES) CoreEfiNotAvailableYetArg4, // QueryCapsuleCapabilities
- (EFI_QUERY_VARIABLE_INFO) CoreEfiNotAvailableYetArg4 // QueryVariableInfo
+ (EFI_GET_TIME)CoreEfiNotAvailableYetArg2, // GetTime
+ (EFI_SET_TIME)CoreEfiNotAvailableYetArg1, // SetTime
+ (EFI_GET_WAKEUP_TIME)CoreEfiNotAvailableYetArg3, // GetWakeupTime
+ (EFI_SET_WAKEUP_TIME)CoreEfiNotAvailableYetArg2, // SetWakeupTime
+ (EFI_SET_VIRTUAL_ADDRESS_MAP)CoreEfiNotAvailableYetArg4, // SetVirtualAddressMap
+ (EFI_CONVERT_POINTER)CoreEfiNotAvailableYetArg2, // ConvertPointer
+ (EFI_GET_VARIABLE)CoreEfiNotAvailableYetArg5, // GetVariable
+ (EFI_GET_NEXT_VARIABLE_NAME)CoreEfiNotAvailableYetArg3, // GetNextVariableName
+ (EFI_SET_VARIABLE)CoreEfiNotAvailableYetArg5, // SetVariable
+ (EFI_GET_NEXT_HIGH_MONO_COUNT)CoreEfiNotAvailableYetArg1, // GetNextHighMonotonicCount
+ (EFI_RESET_SYSTEM)CoreEfiNotAvailableYetArg4, // ResetSystem
+ (EFI_UPDATE_CAPSULE)CoreEfiNotAvailableYetArg3, // UpdateCapsule
+ (EFI_QUERY_CAPSULE_CAPABILITIES)CoreEfiNotAvailableYetArg4, // QueryCapsuleCapabilities
+ (EFI_QUERY_VARIABLE_INFO)CoreEfiNotAvailableYetArg4 // QueryVariableInfo
};
-EFI_RUNTIME_ARCH_PROTOCOL gRuntimeTemplate = {
+EFI_RUNTIME_ARCH_PROTOCOL gRuntimeTemplate = {
INITIALIZE_LIST_HEAD_VARIABLE (gRuntimeTemplate.ImageHead),
INITIALIZE_LIST_HEAD_VARIABLE (gRuntimeTemplate.EventHead),
@@ -184,24 +184,24 @@ EFI_RUNTIME_ARCH_PROTOCOL gRuntimeTemplate = { FALSE
};
-EFI_RUNTIME_ARCH_PROTOCOL *gRuntime = &gRuntimeTemplate;
+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 *gDxeCoreDS = &mDxeServices;
+EFI_SYSTEM_TABLE *gDxeCoreST = NULL;
//
// 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
// a value that will not cause debug infrastructure to crash early on.
//
-EFI_RUNTIME_SERVICES *gDxeCoreRT = &mEfiRuntimeServicesTableTemplate;
+EFI_RUNTIME_SERVICES *gDxeCoreRT = &mEfiRuntimeServicesTableTemplate;
EFI_HANDLE gDxeCoreImageHandle = NULL;
-BOOLEAN gMemoryMapTerminated = FALSE;
+BOOLEAN gMemoryMapTerminated = FALSE;
//
// EFI Decompress Protocol
@@ -215,7 +215,7 @@ EFI_DECOMPRESS_PROTOCOL gEfiDecompress = { // For Loading modules at fixed address feature, the configuration table is to cache the top address below which to load
// Runtime code&boot time code
//
-GLOBAL_REMOVE_IF_UNREFERENCED EFI_LOAD_FIXED_ADDRESS_CONFIGURATION_TABLE gLoadModuleAtFixAddressConfigurationTable = {0, 0};
+GLOBAL_REMOVE_IF_UNREFERENCED EFI_LOAD_FIXED_ADDRESS_CONFIGURATION_TABLE gLoadModuleAtFixAddressConfigurationTable = { 0, 0 };
// Main entry point to the DXE Core
//
@@ -231,7 +231,7 @@ GLOBAL_REMOVE_IF_UNREFERENCED EFI_LOAD_FIXED_ADDRESS_CONFIGURATION_TABLE gLoa VOID
EFIAPI
DxeMain (
- IN VOID *HobStart
+ IN VOID *HobStart
)
{
EFI_STATUS Status;
@@ -248,10 +248,11 @@ DxeMain ( // Setup the default exception handlers
//
VectorInfoList = NULL;
- GuidHob = GetNextGuidHob (&gEfiVectorHandoffInfoPpiGuid, HobStart);
+ GuidHob = GetNextGuidHob (&gEfiVectorHandoffInfoPpiGuid, HobStart);
if (GuidHob != NULL) {
- VectorInfoList = (EFI_VECTOR_HANDOFF_INFO *) (GET_GUID_HOB_DATA(GuidHob));
+ VectorInfoList = (EFI_VECTOR_HANDOFF_INFO *)(GET_GUID_HOB_DATA (GuidHob));
}
+
Status = InitializeCpuExceptionHandlersEx (VectorInfoList, NULL);
ASSERT_EFI_ERROR (Status);
@@ -295,7 +296,7 @@ DxeMain ( // Call constructor for all libraries
//
ProcessLibraryConstructorList (gDxeCoreImageHandle, gDxeCoreST);
- PERF_CROSSMODULE_END ("PEI");
+ PERF_CROSSMODULE_END ("PEI");
PERF_CROSSMODULE_BEGIN ("DXE");
//
@@ -303,22 +304,28 @@ DxeMain ( // CoreInitializeMemoryServices()), now that library constructors have
// executed.
//
- DEBUG ((DEBUG_INFO, "%a: MemoryBaseAddress=0x%Lx MemoryLength=0x%Lx\n",
- __FUNCTION__, MemoryBaseAddress, MemoryLength));
+ DEBUG ((
+ DEBUG_INFO,
+ "%a: MemoryBaseAddress=0x%Lx MemoryLength=0x%Lx\n",
+ __FUNCTION__,
+ MemoryBaseAddress,
+ MemoryLength
+ ));
//
// Report DXE Core image information to the PE/COFF Extra Action Library
//
ZeroMem (&ImageContext, sizeof (ImageContext));
- ImageContext.ImageAddress = (EFI_PHYSICAL_ADDRESS)(UINTN)gDxeCoreLoadedImage->ImageBase;
- ImageContext.PdbPointer = PeCoffLoaderGetPdbPointer ((VOID*)(UINTN)ImageContext.ImageAddress);
- ImageContext.SizeOfHeaders = PeCoffGetSizeOfHeaders ((VOID*)(UINTN)ImageContext.ImageAddress);
- Status = PeCoffLoaderGetEntryPoint ((VOID*)(UINTN)ImageContext.ImageAddress, &EntryPoint);
+ ImageContext.ImageAddress = (EFI_PHYSICAL_ADDRESS)(UINTN)gDxeCoreLoadedImage->ImageBase;
+ ImageContext.PdbPointer = PeCoffLoaderGetPdbPointer ((VOID *)(UINTN)ImageContext.ImageAddress);
+ ImageContext.SizeOfHeaders = PeCoffGetSizeOfHeaders ((VOID *)(UINTN)ImageContext.ImageAddress);
+ Status = PeCoffLoaderGetEntryPoint ((VOID *)(UINTN)ImageContext.ImageAddress, &EntryPoint);
if (Status == EFI_SUCCESS) {
ImageContext.EntryPoint = (EFI_PHYSICAL_ADDRESS)(UINTN)EntryPoint;
}
- ImageContext.Handle = (VOID *)(UINTN)gDxeCoreLoadedImage->ImageBase;
- ImageContext.ImageRead = PeCoffLoaderImageReadFromMemory;
+
+ ImageContext.Handle = (VOID *)(UINTN)gDxeCoreLoadedImage->ImageBase;
+ ImageContext.ImageRead = PeCoffLoaderImageReadFromMemory;
PeCoffLoaderRelocateImageExtraAction (&ImageContext);
//
@@ -344,10 +351,11 @@ DxeMain ( // Configuration Table so that user could easily to retrieve the top address to load Dxe and PEI
// Code and Tseg base to load SMM driver.
//
- if (PcdGet64(PcdLoadModuleAtFixAddressEnable) != 0) {
+ if (PcdGet64 (PcdLoadModuleAtFixAddressEnable) != 0) {
Status = CoreInstallConfigurationTable (&gLoadFixedAddressConfigurationTableGuid, &gLoadModuleAtFixAddressConfigurationTable);
ASSERT_EFI_ERROR (Status);
}
+
//
// Report Status Code here for DXE_ENTRY_POINT once it is available
//
@@ -371,56 +379,61 @@ DxeMain ( DEBUG ((DEBUG_INFO | DEBUG_LOAD, "HOBLIST address in DXE = 0x%p\n", HobStart));
DEBUG_CODE_BEGIN ();
- EFI_PEI_HOB_POINTERS Hob;
-
- for (Hob.Raw = HobStart; !END_OF_HOB_LIST(Hob); Hob.Raw = GET_NEXT_HOB(Hob)) {
- if (GET_HOB_TYPE (Hob) == EFI_HOB_TYPE_MEMORY_ALLOCATION) {
- DEBUG ((DEBUG_INFO | DEBUG_LOAD, "Memory Allocation 0x%08x 0x%0lx - 0x%0lx\n", \
- Hob.MemoryAllocation->AllocDescriptor.MemoryType, \
- Hob.MemoryAllocation->AllocDescriptor.MemoryBaseAddress, \
- Hob.MemoryAllocation->AllocDescriptor.MemoryBaseAddress + Hob.MemoryAllocation->AllocDescriptor.MemoryLength - 1));
- }
+ EFI_PEI_HOB_POINTERS Hob;
+
+ for (Hob.Raw = HobStart; !END_OF_HOB_LIST (Hob); Hob.Raw = GET_NEXT_HOB (Hob)) {
+ if (GET_HOB_TYPE (Hob) == EFI_HOB_TYPE_MEMORY_ALLOCATION) {
+ DEBUG ((
+ DEBUG_INFO | DEBUG_LOAD,
+ "Memory Allocation 0x%08x 0x%0lx - 0x%0lx\n", \
+ Hob.MemoryAllocation->AllocDescriptor.MemoryType, \
+ Hob.MemoryAllocation->AllocDescriptor.MemoryBaseAddress, \
+ Hob.MemoryAllocation->AllocDescriptor.MemoryBaseAddress + Hob.MemoryAllocation->AllocDescriptor.MemoryLength - 1
+ ));
}
- for (Hob.Raw = HobStart; !END_OF_HOB_LIST(Hob); Hob.Raw = GET_NEXT_HOB(Hob)) {
- if (GET_HOB_TYPE (Hob) == EFI_HOB_TYPE_FV) {
- DEBUG ((
- DEBUG_INFO | DEBUG_LOAD,
- "FV Hob 0x%0lx - 0x%0lx\n",
- Hob.FirmwareVolume->BaseAddress,
- Hob.FirmwareVolume->BaseAddress + Hob.FirmwareVolume->Length - 1
- ));
- } else if (GET_HOB_TYPE (Hob) == EFI_HOB_TYPE_FV2) {
- DEBUG ((
- DEBUG_INFO | DEBUG_LOAD,
- "FV2 Hob 0x%0lx - 0x%0lx\n",
- Hob.FirmwareVolume2->BaseAddress,
- Hob.FirmwareVolume2->BaseAddress + Hob.FirmwareVolume2->Length - 1
- ));
+ }
+
+ for (Hob.Raw = HobStart; !END_OF_HOB_LIST (Hob); Hob.Raw = GET_NEXT_HOB (Hob)) {
+ if (GET_HOB_TYPE (Hob) == EFI_HOB_TYPE_FV) {
+ DEBUG ((
+ DEBUG_INFO | DEBUG_LOAD,
+ "FV Hob 0x%0lx - 0x%0lx\n",
+ Hob.FirmwareVolume->BaseAddress,
+ Hob.FirmwareVolume->BaseAddress + Hob.FirmwareVolume->Length - 1
+ ));
+ } else if (GET_HOB_TYPE (Hob) == EFI_HOB_TYPE_FV2) {
+ DEBUG ((
+ DEBUG_INFO | DEBUG_LOAD,
+ "FV2 Hob 0x%0lx - 0x%0lx\n",
+ Hob.FirmwareVolume2->BaseAddress,
+ Hob.FirmwareVolume2->BaseAddress + Hob.FirmwareVolume2->Length - 1
+ ));
+ DEBUG ((
+ DEBUG_INFO | DEBUG_LOAD,
+ " %g - %g\n",
+ &Hob.FirmwareVolume2->FvName,
+ &Hob.FirmwareVolume2->FileName
+ ));
+ } else if (GET_HOB_TYPE (Hob) == EFI_HOB_TYPE_FV3) {
+ DEBUG ((
+ DEBUG_INFO | DEBUG_LOAD,
+ "FV3 Hob 0x%0lx - 0x%0lx - 0x%x - 0x%x\n",
+ Hob.FirmwareVolume3->BaseAddress,
+ Hob.FirmwareVolume3->BaseAddress + Hob.FirmwareVolume3->Length - 1,
+ Hob.FirmwareVolume3->AuthenticationStatus,
+ Hob.FirmwareVolume3->ExtractedFv
+ ));
+ if (Hob.FirmwareVolume3->ExtractedFv) {
DEBUG ((
DEBUG_INFO | DEBUG_LOAD,
" %g - %g\n",
- &Hob.FirmwareVolume2->FvName,
- &Hob.FirmwareVolume2->FileName
- ));
- } else if (GET_HOB_TYPE (Hob) == EFI_HOB_TYPE_FV3) {
- DEBUG ((
- DEBUG_INFO | DEBUG_LOAD,
- "FV3 Hob 0x%0lx - 0x%0lx - 0x%x - 0x%x\n",
- Hob.FirmwareVolume3->BaseAddress,
- Hob.FirmwareVolume3->BaseAddress + Hob.FirmwareVolume3->Length - 1,
- Hob.FirmwareVolume3->AuthenticationStatus,
- Hob.FirmwareVolume3->ExtractedFv
+ &Hob.FirmwareVolume3->FvName,
+ &Hob.FirmwareVolume3->FileName
));
- if (Hob.FirmwareVolume3->ExtractedFv) {
- DEBUG ((
- DEBUG_INFO | DEBUG_LOAD,
- " %g - %g\n",
- &Hob.FirmwareVolume3->FvName,
- &Hob.FirmwareVolume3->FileName
- ));
- }
}
}
+ }
+
DEBUG_CODE_END ();
//
@@ -440,16 +453,17 @@ DxeMain ( //
GuidHob = GetNextGuidHob (&gEfiVectorHandoffInfoPpiGuid, HobStart);
if (GuidHob != NULL) {
- VectorInfoList = (EFI_VECTOR_HANDOFF_INFO *) (GET_GUID_HOB_DATA(GuidHob));
- VectorInfo = VectorInfoList;
- Index = 1;
+ VectorInfoList = (EFI_VECTOR_HANDOFF_INFO *)(GET_GUID_HOB_DATA (GuidHob));
+ VectorInfo = VectorInfoList;
+ Index = 1;
while (VectorInfo->Attribute != EFI_VECTOR_HANDOFF_LAST_ENTRY) {
- VectorInfo ++;
- Index ++;
+ VectorInfo++;
+ Index++;
}
- VectorInfo = AllocateCopyPool (sizeof (EFI_VECTOR_HANDOFF_INFO) * Index, (VOID *) VectorInfoList);
+
+ VectorInfo = AllocateCopyPool (sizeof (EFI_VECTOR_HANDOFF_INFO) * Index, (VOID *)VectorInfoList);
ASSERT (VectorInfo != NULL);
- Status = CoreInstallConfigurationTable (&gEfiVectorHandoffTableGuid, (VOID *) VectorInfo);
+ Status = CoreInstallConfigurationTable (&gEfiVectorHandoffTableGuid, (VOID *)VectorInfo);
ASSERT_EFI_ERROR (Status);
}
@@ -470,7 +484,8 @@ DxeMain ( //
Status = CoreInstallMultipleProtocolInterfaces (
&mDecompressHandle,
- &gEfiDecompressProtocolGuid, &gEfiDecompress,
+ &gEfiDecompressProtocolGuid,
+ &gEfiDecompress,
NULL
);
ASSERT_EFI_ERROR (Status);
@@ -511,7 +526,7 @@ DxeMain ( // Display Architectural protocols that were not loaded if this is DEBUG build
//
DEBUG_CODE_BEGIN ();
- CoreDisplayMissingArchProtocols ();
+ CoreDisplayMissingArchProtocols ();
DEBUG_CODE_END ();
//
@@ -519,14 +534,14 @@ DxeMain ( // evaluated to false if this is a debug build
//
DEBUG_CODE_BEGIN ();
- CoreDisplayDiscoveredNotDispatched ();
+ CoreDisplayDiscoveredNotDispatched ();
DEBUG_CODE_END ();
//
// Assert if the Architectural Protocols are not present.
//
Status = CoreAllEfiServicesAvailable ();
- if (EFI_ERROR(Status)) {
+ if (EFI_ERROR (Status)) {
//
// Report Status code that some Architectural Protocols are not present.
//
@@ -535,6 +550,7 @@ DxeMain ( (EFI_SOFTWARE_DXE_CORE | EFI_SW_DXE_CORE_EC_NO_ARCH)
);
}
+
ASSERT_EFI_ERROR (Status);
//
@@ -559,9 +575,6 @@ DxeMain ( UNREACHABLE ();
}
-
-
-
/**
Place holder function until all the Boot Services and Runtime Services are
available.
@@ -574,7 +587,7 @@ DxeMain ( EFI_STATUS
EFIAPI
CoreEfiNotAvailableYetArg1 (
- UINTN Arg1
+ UINTN Arg1
)
{
//
@@ -586,7 +599,6 @@ CoreEfiNotAvailableYetArg1 ( return EFI_NOT_AVAILABLE_YET;
}
-
/**
Place holder function until all the Boot Services and Runtime Services are available.
@@ -599,8 +611,8 @@ CoreEfiNotAvailableYetArg1 ( EFI_STATUS
EFIAPI
CoreEfiNotAvailableYetArg2 (
- UINTN Arg1,
- UINTN Arg2
+ UINTN Arg1,
+ UINTN Arg2
)
{
//
@@ -612,7 +624,6 @@ CoreEfiNotAvailableYetArg2 ( return EFI_NOT_AVAILABLE_YET;
}
-
/**
Place holder function until all the Boot Services and Runtime Services are available.
@@ -626,9 +637,9 @@ CoreEfiNotAvailableYetArg2 ( EFI_STATUS
EFIAPI
CoreEfiNotAvailableYetArg3 (
- UINTN Arg1,
- UINTN Arg2,
- UINTN Arg3
+ UINTN Arg1,
+ UINTN Arg2,
+ UINTN Arg3
)
{
//
@@ -640,7 +651,6 @@ CoreEfiNotAvailableYetArg3 ( return EFI_NOT_AVAILABLE_YET;
}
-
/**
Place holder function until all the Boot Services and Runtime Services are available.
@@ -655,10 +665,10 @@ CoreEfiNotAvailableYetArg3 ( EFI_STATUS
EFIAPI
CoreEfiNotAvailableYetArg4 (
- UINTN Arg1,
- UINTN Arg2,
- UINTN Arg3,
- UINTN Arg4
+ UINTN Arg1,
+ UINTN Arg2,
+ UINTN Arg3,
+ UINTN Arg4
)
{
//
@@ -670,7 +680,6 @@ CoreEfiNotAvailableYetArg4 ( return EFI_NOT_AVAILABLE_YET;
}
-
/**
Place holder function until all the Boot Services and Runtime Services are available.
@@ -686,11 +695,11 @@ CoreEfiNotAvailableYetArg4 ( EFI_STATUS
EFIAPI
CoreEfiNotAvailableYetArg5 (
- UINTN Arg1,
- UINTN Arg2,
- UINTN Arg3,
- UINTN Arg4,
- UINTN Arg5
+ UINTN Arg1,
+ UINTN Arg2,
+ UINTN Arg3,
+ UINTN Arg4,
+ UINTN Arg5
)
{
//
@@ -702,7 +711,6 @@ CoreEfiNotAvailableYetArg5 ( return EFI_NOT_AVAILABLE_YET;
}
-
/**
Calcualte the 32-bit CRC in a EFI table using the service provided by the
gRuntime service.
@@ -712,10 +720,10 @@ CoreEfiNotAvailableYetArg5 ( **/
VOID
CalculateEfiHdrCrc (
- IN OUT EFI_TABLE_HEADER *Hdr
+ IN OUT EFI_TABLE_HEADER *Hdr
)
{
- UINT32 Crc;
+ UINT32 Crc;
Hdr->CRC32 = 0;
@@ -728,7 +736,6 @@ CalculateEfiHdrCrc ( Hdr->CRC32 = Crc;
}
-
/**
Terminates all boot services.
@@ -742,11 +749,11 @@ CalculateEfiHdrCrc ( EFI_STATUS
EFIAPI
CoreExitBootServices (
- IN EFI_HANDLE ImageHandle,
- IN UINTN MapKey
+ IN EFI_HANDLE ImageHandle,
+ IN UINTN MapKey
)
{
- EFI_STATUS Status;
+ EFI_STATUS Status;
//
// Disable Timer
@@ -780,7 +787,7 @@ CoreExitBootServices ( (EFI_SOFTWARE_EFI_BOOT_SERVICE | EFI_SW_BS_PC_EXIT_BOOT_SERVICES)
);
- MemoryProtectionExitBootServicesCallback();
+ MemoryProtectionExitBootServicesCallback ();
//
// Disable interrupt of Debug timer.
@@ -822,7 +829,6 @@ CoreExitBootServices ( return Status;
}
-
/**
Given a compressed source buffer, this function retrieves the size of the
uncompressed buffer and the size of the scratch buffer required to decompress
@@ -865,20 +871,20 @@ CoreExitBootServices ( EFI_STATUS
EFIAPI
DxeMainUefiDecompressGetInfo (
- IN EFI_DECOMPRESS_PROTOCOL *This,
- IN VOID *Source,
- IN UINT32 SourceSize,
- OUT UINT32 *DestinationSize,
- OUT UINT32 *ScratchSize
+ IN EFI_DECOMPRESS_PROTOCOL *This,
+ IN VOID *Source,
+ IN UINT32 SourceSize,
+ OUT UINT32 *DestinationSize,
+ OUT UINT32 *ScratchSize
)
{
- if (Source == NULL || DestinationSize == NULL || ScratchSize == NULL) {
+ if ((Source == NULL) || (DestinationSize == NULL) || (ScratchSize == NULL)) {
return EFI_INVALID_PARAMETER;
}
+
return UefiDecompressGetInfo (Source, SourceSize, DestinationSize, ScratchSize);
}
-
/**
Decompresses a compressed source buffer.
@@ -916,20 +922,20 @@ DxeMainUefiDecompressGetInfo ( EFI_STATUS
EFIAPI
DxeMainUefiDecompress (
- IN EFI_DECOMPRESS_PROTOCOL *This,
- IN VOID *Source,
- IN UINT32 SourceSize,
- IN OUT VOID *Destination,
- IN UINT32 DestinationSize,
- IN OUT VOID *Scratch,
- IN UINT32 ScratchSize
+ IN EFI_DECOMPRESS_PROTOCOL *This,
+ IN VOID *Source,
+ IN UINT32 SourceSize,
+ IN OUT VOID *Destination,
+ IN UINT32 DestinationSize,
+ IN OUT VOID *Scratch,
+ IN UINT32 ScratchSize
)
{
EFI_STATUS Status;
UINT32 TestDestinationSize;
UINT32 TestScratchSize;
- if (Source == NULL || Destination== NULL || Scratch == NULL) {
+ if ((Source == NULL) || (Destination == NULL) || (Scratch == NULL)) {
return EFI_INVALID_PARAMETER;
}
@@ -938,7 +944,7 @@ DxeMainUefiDecompress ( return Status;
}
- if (ScratchSize < TestScratchSize || DestinationSize < TestDestinationSize) {
+ if ((ScratchSize < TestScratchSize) || (DestinationSize < TestDestinationSize)) {
return RETURN_INVALID_PARAMETER;
}
diff --git a/MdeModulePkg/Core/Dxe/DxeMain/DxeProtocolNotify.c b/MdeModulePkg/Core/Dxe/DxeMain/DxeProtocolNotify.c index 29a55d02e6..3fe02940ed 100644 --- a/MdeModulePkg/Core/Dxe/DxeMain/DxeProtocolNotify.c +++ b/MdeModulePkg/Core/Dxe/DxeMain/DxeProtocolNotify.c @@ -39,34 +39,34 @@ EFI_CORE_PROTOCOL_NOTIFY_ENTRY mArchProtocols[] = { // Optional protocols that the DXE Core will use if they are present
//
EFI_CORE_PROTOCOL_NOTIFY_ENTRY mOptionalProtocols[] = {
- { &gEfiSecurity2ArchProtocolGuid, (VOID **)&gSecurity2, NULL, NULL, FALSE },
- { &gEfiSmmBase2ProtocolGuid, (VOID **)&gSmmBase2, NULL, NULL, FALSE },
- { NULL, (VOID **)NULL, NULL, NULL, FALSE }
+ { &gEfiSecurity2ArchProtocolGuid, (VOID **)&gSecurity2, NULL, NULL, FALSE },
+ { &gEfiSmmBase2ProtocolGuid, (VOID **)&gSmmBase2, NULL, NULL, FALSE },
+ { NULL, (VOID **)NULL, NULL, NULL, FALSE }
};
//
// Following is needed to display missing architectural protocols in debug builds
//
typedef struct {
- EFI_GUID *ProtocolGuid;
- CHAR8 *GuidString;
+ EFI_GUID *ProtocolGuid;
+ CHAR8 *GuidString;
} GUID_TO_STRING_PROTOCOL_ENTRY;
-GLOBAL_REMOVE_IF_UNREFERENCED CONST GUID_TO_STRING_PROTOCOL_ENTRY mMissingProtocols[] = {
- { &gEfiSecurityArchProtocolGuid, "Security" },
- { &gEfiCpuArchProtocolGuid, "CPU" },
- { &gEfiMetronomeArchProtocolGuid, "Metronome" },
- { &gEfiTimerArchProtocolGuid, "Timer" },
- { &gEfiBdsArchProtocolGuid, "Bds" },
- { &gEfiWatchdogTimerArchProtocolGuid, "Watchdog Timer" },
- { &gEfiRuntimeArchProtocolGuid, "Runtime" },
- { &gEfiVariableArchProtocolGuid, "Variable" },
- { &gEfiVariableWriteArchProtocolGuid, "Variable Write" },
- { &gEfiCapsuleArchProtocolGuid, "Capsule" },
- { &gEfiMonotonicCounterArchProtocolGuid, "Monotonic Counter" },
- { &gEfiResetArchProtocolGuid, "Reset" },
- { &gEfiRealTimeClockArchProtocolGuid, "Real Time Clock" },
- { NULL, "" }
+GLOBAL_REMOVE_IF_UNREFERENCED CONST GUID_TO_STRING_PROTOCOL_ENTRY mMissingProtocols[] = {
+ { &gEfiSecurityArchProtocolGuid, "Security" },
+ { &gEfiCpuArchProtocolGuid, "CPU" },
+ { &gEfiMetronomeArchProtocolGuid, "Metronome" },
+ { &gEfiTimerArchProtocolGuid, "Timer" },
+ { &gEfiBdsArchProtocolGuid, "Bds" },
+ { &gEfiWatchdogTimerArchProtocolGuid, "Watchdog Timer" },
+ { &gEfiRuntimeArchProtocolGuid, "Runtime" },
+ { &gEfiVariableArchProtocolGuid, "Variable" },
+ { &gEfiVariableWriteArchProtocolGuid, "Variable Write" },
+ { &gEfiCapsuleArchProtocolGuid, "Capsule" },
+ { &gEfiMonotonicCounterArchProtocolGuid, "Monotonic Counter" },
+ { &gEfiResetArchProtocolGuid, "Reset" },
+ { &gEfiRealTimeClockArchProtocolGuid, "Real Time Clock" },
+ { NULL, "" }
};
/**
@@ -88,10 +88,10 @@ CoreAllEfiServicesAvailable ( return EFI_NOT_FOUND;
}
}
+
return EFI_SUCCESS;
}
-
/**
Notification event handler registered by CoreNotifyOnArchProtocolInstallation ().
This notify function is registered for every architectural protocol. This handler
@@ -170,14 +170,15 @@ GenericProtocolNotify ( // Copy all the registered Image to new gRuntime protocol
//
for (Link = gRuntimeTemplate.ImageHead.ForwardLink; Link != &gRuntimeTemplate.ImageHead; Link = TempLinkNode.ForwardLink) {
- CopyMem (&TempLinkNode, Link, sizeof(LIST_ENTRY));
+ CopyMem (&TempLinkNode, Link, sizeof (LIST_ENTRY));
InsertTailList (&gRuntime->ImageHead, Link);
}
+
//
// Copy all the registered Event to new gRuntime protocol
//
for (Link = gRuntimeTemplate.EventHead.ForwardLink; Link != &gRuntimeTemplate.EventHead; Link = TempLinkNode.ForwardLink) {
- CopyMem (&TempLinkNode, Link, sizeof(LIST_ENTRY));
+ CopyMem (&TempLinkNode, Link, sizeof (LIST_ENTRY));
InsertTailList (&gRuntime->EventHead, Link);
}
@@ -213,28 +214,28 @@ CoreNotifyOnProtocolEntryTable ( {
EFI_STATUS Status;
- for (; Entry->ProtocolGuid != NULL; Entry++) {
+ for ( ; Entry->ProtocolGuid != NULL; Entry++) {
//
// Create the event
//
Status = CoreCreateEvent (
- EVT_NOTIFY_SIGNAL,
- TPL_CALLBACK,
- GenericProtocolNotify,
- Entry,
- &Entry->Event
- );
- ASSERT_EFI_ERROR(Status);
+ EVT_NOTIFY_SIGNAL,
+ TPL_CALLBACK,
+ GenericProtocolNotify,
+ Entry,
+ &Entry->Event
+ );
+ ASSERT_EFI_ERROR (Status);
//
// Register for protocol notifactions on this event
//
Status = CoreRegisterProtocolNotify (
- Entry->ProtocolGuid,
- Entry->Event,
- &Entry->Registration
- );
- ASSERT_EFI_ERROR(Status);
+ Entry->ProtocolGuid,
+ Entry->Event,
+ &Entry->Registration
+ );
+ ASSERT_EFI_ERROR (Status);
}
}
@@ -252,7 +253,6 @@ CoreNotifyOnProtocolInstallation ( CoreNotifyOnProtocolEntryTable (mOptionalProtocols);
}
-
/**
Displays Architectural protocols that were not loaded and are required for DXE
core to function. Only used in Debug Builds.
|