diff --git a/MdeModulePkg/Core/Dxe/DxeMain/DxeMain.c b/MdeModulePkg/Core/Dxe/DxeMain/DxeMain.c index 7134de0929..0e40926c02 100644 --- a/MdeModulePkg/Core/Dxe/DxeMain/DxeMain.c +++ b/MdeModulePkg/Core/Dxe/DxeMain/DxeMain.c @@ -306,6 +306,24 @@ DxeMain ( Status = CoreInitializeGcdServices (&HobStart, MemoryBaseAddress, MemoryLength); ASSERT_EFI_ERROR (Status); + // + // 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 (); + // // Call constructor for all libraries // @@ -313,6 +331,11 @@ DxeMain ( 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 @@ -435,12 +458,6 @@ DxeMain ( DEBUG_CODE_END (); - // - // Initialize the Event Services - // - Status = CoreInitializeEventServices (); - ASSERT_EFI_ERROR (Status); - MemoryProfileInstallProtocol (); CoreInitializeMemoryAttributesTable (); @@ -489,13 +506,6 @@ 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. // @@ -516,11 +526,6 @@ DxeMain ( // CoreInitializeDispatcher (); - // - // Initialize CPU Architectural Protocol - // - InitializeCpu (); - // // Invoke the DXE Dispatcher // diff --git a/UefiCpuPkg/Include/Library/CpuArchLib.h b/UefiCpuPkg/Include/Library/CpuArchLib.h index b72fed737a..e9521d4e4f 100644 --- a/UefiCpuPkg/Include/Library/CpuArchLib.h +++ b/UefiCpuPkg/Include/Library/CpuArchLib.h @@ -19,4 +19,13 @@ InitializeCpu ( VOID ); +/** + Initialize Multi-processor support. + +**/ +VOID +InitializeMpSupport ( + VOID + ); + #endif // _CPU_ARCH_LIB_H_ diff --git a/UefiCpuPkg/Library/CpuArchLib/CpuDxe.c b/UefiCpuPkg/Library/CpuArchLib/CpuDxe.c index 05db93e4dd..6beeb258a1 100644 --- a/UefiCpuPkg/Library/CpuArchLib/CpuDxe.c +++ b/UefiCpuPkg/Library/CpuArchLib/CpuDxe.c @@ -1280,7 +1280,5 @@ InitializeCpu ( ); ASSERT_EFI_ERROR (Status); - InitializeMpSupport (); - return Status; } diff --git a/UefiCpuPkg/Library/CpuArchLib/CpuDxeNull.c b/UefiCpuPkg/Library/CpuArchLib/CpuDxeNull.c index 26e8202c6c..d61890e05b 100644 --- a/UefiCpuPkg/Library/CpuArchLib/CpuDxeNull.c +++ b/UefiCpuPkg/Library/CpuArchLib/CpuDxeNull.c @@ -1,7 +1,9 @@ /** - Dummy function for DxeMain.inf. + 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 ( @@ -10,3 +12,14 @@ InitializeCpu ( { return EFI_SUCCESS; } + +/** + Initialize Multi-processor support. + +**/ +VOID +InitializeMpSupport ( + VOID + ) +{ +} diff --git a/UefiCpuPkg/Library/CpuArchLib/CpuMp.h b/UefiCpuPkg/Library/CpuArchLib/CpuMp.h index b461753510..c42a617bcf 100644 --- a/UefiCpuPkg/Library/CpuArchLib/CpuMp.h +++ b/UefiCpuPkg/Library/CpuArchLib/CpuMp.h @@ -9,15 +9,6 @@ #ifndef _CPU_MP_H_ #define _CPU_MP_H_ -/** - Initialize Multi-processor support. - -**/ -VOID -InitializeMpSupport ( - VOID - ); - /** This service retrieves the number of logical processor in the platform and the number of those logical processors that are enabled on this boot.