X-Git-Url: https://git.proxmox.com/?a=blobdiff_plain;f=MdeModulePkg%2FCore%2FDxe%2FDxeMain%2FDxeMain.c;h=04ec17708b2c9376b4c9640f604088b322009370;hb=cd5ebaa06dca3e6ef3c464081e6defe00d358c69;hp=6e535b5d93d1255700363737dd82446dd1acd3f6;hpb=0428a6cb12ecc3eecdfab67171d9145663a15187;p=mirror_edk2.git diff --git a/MdeModulePkg/Core/Dxe/DxeMain/DxeMain.c b/MdeModulePkg/Core/Dxe/DxeMain/DxeMain.c index 6e535b5d93..04ec17708b 100644 --- a/MdeModulePkg/Core/Dxe/DxeMain/DxeMain.c +++ b/MdeModulePkg/Core/Dxe/DxeMain/DxeMain.c @@ -1,8 +1,8 @@ /** @file DXE Core Main Entry Point -Copyright (c) 2006 - 2008, Intel Corporation.
-All rights reserved. This program and the accompanying materials +Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.
+This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License which accompanies this distribution. The full text of the license may be found at http://opensource.org/licenses/bsd-license.php @@ -29,6 +29,11 @@ EFI_TIMER_ARCH_PROTOCOL *gTimer = NULL; EFI_BDS_ARCH_PROTOCOL *gBds = NULL; EFI_WATCHDOG_TIMER_ARCH_PROTOCOL *gWatchdogTimer = NULL; +// +// DXE Core globals for optional protocol dependencies +// +EFI_SMM_BASE2_PROTOCOL *gSmmBase2 = NULL; + // // DXE Core Global used to update core loaded image protocol handle // @@ -210,6 +215,11 @@ 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}; + // Main entry point to the DXE Core // @@ -231,6 +241,11 @@ DxeMain ( EFI_PHYSICAL_ADDRESS MemoryBaseAddress; UINT64 MemoryLength; + // + // Initialize Debug Agent to support source level debug in DXE phase + // + InitializeDebugAgent (DEBUG_AGENT_INIT_DXE_CORE, HobStart); + // // Initialize Memory Services // @@ -258,8 +273,8 @@ DxeMain ( // Call constructor for all libraries // ProcessLibraryConstructorList (gDxeCoreImageHandle, gDxeCoreST); - PERF_END (0,"PEI", NULL, 0) ; - PERF_START (0,"DXE", NULL, 0) ; + PERF_END (NULL,"PEI", NULL, 0) ; + PERF_START (NULL,"DXE", NULL, 0) ; // // Initialize the Global Coherency Domain Services @@ -285,12 +300,21 @@ DxeMain ( Status = CoreInstallConfigurationTable (&gEfiMemoryTypeInformationGuid, &gMemoryTypeInformation); ASSERT_EFI_ERROR (Status); + // + // If Loading modules At fixed address feature is enabled, install Load moduels at fixed address + // 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) { + Status = CoreInstallConfigurationTable (&gLoadFixedAddressConfigurationTableGuid, &gLoadModuleAtFixAddressConfigurationTable); + ASSERT_EFI_ERROR (Status); + } // // Report Status Code here for DXE_ENTRY_POINT once it is available // REPORT_STATUS_CODE ( EFI_PROGRESS_CODE, - FixedPcdGet32(PcdStatusCodeValueDxeCoreEntry) + (EFI_SOFTWARE_DXE_CORE | EFI_SW_DXE_CORE_PC_ENTRY_POINT) ); // @@ -307,6 +331,26 @@ 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)); + } + } + for (Hob.Raw = HobStart; !END_OF_HOB_LIST(Hob); Hob.Raw = GET_NEXT_HOB(Hob)) { + 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)); + } else 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.FirmwareVolume2->Length - 1)); + } + } + DEBUG_CODE_END (); + // // Initialize the Event Services // @@ -339,8 +383,9 @@ DxeMain ( // // 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. // - CoreNotifyOnArchProtocolInstallation (); + CoreNotifyOnProtocolInstallation (); // // Produce Firmware Volume Protocols, one for each FV in the HOB list. @@ -360,16 +405,16 @@ DxeMain ( // // Initialize the DXE Dispatcher // - PERF_START (0,"CoreInitializeDispatcher", "DxeMain", 0) ; + PERF_START (NULL,"CoreInitializeDispatcher", "DxeMain", 0) ; CoreInitializeDispatcher (); - PERF_END (0,"CoreInitializeDispatcher", "DxeMain", 0) ; + PERF_END (NULL,"CoreInitializeDispatcher", "DxeMain", 0) ; // // Invoke the DXE Dispatcher // - PERF_START (0, "CoreDispatcher", "DxeMain", 0); + PERF_START (NULL, "CoreDispatcher", "DxeMain", 0); CoreDispatcher (); - PERF_END (0, "CoreDispatcher", "DxeMain", 0); + PERF_END (NULL, "CoreDispatcher", "DxeMain", 0); // // Display Architectural protocols that were not loaded if this is DEBUG build @@ -396,7 +441,7 @@ DxeMain ( // REPORT_STATUS_CODE ( EFI_PROGRESS_CODE, - FixedPcdGet32 (PcdStatusCodeValueDxeCoreHandoffToBds) + (EFI_SOFTWARE_DXE_CORE | EFI_SW_DXE_CORE_PC_HANDOFF_TO_NEXT) ); // @@ -640,6 +685,11 @@ CoreExitBootServices ( // CoreNotifySignalList (&gEfiEventExitBootServicesGuid); + // + // Disable interrupt of Debug timer. + // + SaveAndSetDebugTimerInterrupt (FALSE); + // // Disable CPU Interrupts // @@ -650,7 +700,7 @@ CoreExitBootServices ( // REPORT_STATUS_CODE ( EFI_PROGRESS_CODE, - FixedPcdGet32 (PcdStatusCodeValueBootServiceExit) + (EFI_SOFTWARE_EFI_BOOT_SERVICE | EFI_SW_BS_PC_EXIT_BOOT_SERVICES) ); //