X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=blobdiff_plain;f=MdeModulePkg%2FCore%2FDxe%2FDxeMain%2FDxeMain.c;h=d8c7cd02491cfcd6a715dcbd1ef01a72c4c26a14;hp=2cf082b74f0f03f9a54b3873a14bd8382209d37f;hb=e4c83a4f9cad7f2c362727cdeb3f5daf297ec270;hpb=213fecefbbc2fa9badd2ac371a569908390999f0 diff --git a/MdeModulePkg/Core/Dxe/DxeMain/DxeMain.c b/MdeModulePkg/Core/Dxe/DxeMain/DxeMain.c index 2cf082b74f..d8c7cd0249 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 - 2010, Intel Corporation.
-All rights reserved. This program and the accompanying materials +Copyright (c) 2006 - 2014, 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 @@ -23,6 +23,7 @@ EFI_HANDLE mDecompressHandle = NULL; // DXE Core globals for Architecture Protocols // EFI_SECURITY_ARCH_PROTOCOL *gSecurity = NULL; +EFI_SECURITY2_ARCH_PROTOCOL *gSecurity2 = NULL; EFI_CPU_ARCH_PROTOCOL *gCpu = NULL; EFI_METRONOME_ARCH_PROTOCOL *gMetronome = NULL; EFI_TIMER_ARCH_PROTOCOL *gTimer = NULL; @@ -237,14 +238,30 @@ DxeMain ( IN VOID *HobStart ) { - EFI_STATUS Status; - EFI_PHYSICAL_ADDRESS MemoryBaseAddress; - UINT64 MemoryLength; - + EFI_STATUS Status; + EFI_PHYSICAL_ADDRESS MemoryBaseAddress; + UINT64 MemoryLength; + PE_COFF_LOADER_IMAGE_CONTEXT ImageContext; + UINTN Index; + EFI_HOB_GUID_TYPE *GuidHob; + 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); + // // Initialize Debug Agent to support source level debug in DXE phase // - InitializeDebugAgent (DEBUG_AGENT_INIT_DXE_CORE, HobStart); + InitializeDebugAgent (DEBUG_AGENT_INIT_DXE_CORE, HobStart, NULL); // // Initialize Memory Services @@ -276,6 +293,13 @@ DxeMain ( PERF_END (NULL,"PEI", NULL, 0) ; PERF_START (NULL,"DXE", NULL, 0) ; + // + // Report DXE Core image information to the PE/COFF Extra Action Library + // + ImageContext.ImageAddress = (EFI_PHYSICAL_ADDRESS)(UINTN)gDxeCoreLoadedImage->ImageBase; + ImageContext.PdbPointer = PeCoffLoaderGetPdbPointer ((VOID*) (UINTN) ImageContext.ImageAddress); + PeCoffLoaderRelocateImageExtraAction (&ImageContext); + // // Initialize the Global Coherency Domain Services // @@ -357,6 +381,24 @@ DxeMain ( Status = CoreInitializeEventServices (); ASSERT_EFI_ERROR (Status); + // + // Get persisted vector hand-off info from GUIDeed HOB again due to HobStart may be updated, + // and install configuration table + // + GuidHob = GetNextGuidHob (&gEfiVectorHandoffInfoPpiGuid, HobStart); + if (GuidHob != NULL) { + 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 = AllocateCopyPool (sizeof (EFI_VECTOR_HANDOFF_INFO) * Index, (VOID *) VectorInfoList); + ASSERT (VectorInfo != NULL); + Status = CoreInstallConfigurationTable (&gEfiVectorHandoffTableGuid, (VOID *) VectorInfo); + ASSERT_EFI_ERROR (Status); + } // // Get the Protocols that were passed in from PEI to DXE through GUIDed HOBs @@ -434,7 +476,17 @@ DxeMain ( // // Assert if the Architectural Protocols are not present. // - ASSERT_EFI_ERROR (CoreAllEfiServicesAvailable ()); + Status = CoreAllEfiServicesAvailable (); + if (EFI_ERROR(Status)) { + // + // Report Status code that some Architectural Protocols are not present. + // + REPORT_STATUS_CODE ( + EFI_ERROR_CODE | EFI_ERROR_MAJOR, + (EFI_SOFTWARE_DXE_CORE | EFI_SW_DXE_CORE_EC_NO_ARCH) + ); + } + ASSERT_EFI_ERROR (Status); // // Report Status code before transfer control to BDS @@ -667,23 +719,35 @@ CoreExitBootServices ( { EFI_STATUS Status; + // + // Disable Timer + // + gTimer->SetTimerPeriod (gTimer, 0); + // // Terminate memory services if the MapKey matches // Status = CoreTerminateMemoryMap (MapKey); if (EFI_ERROR (Status)) { + // + // Notify other drivers that ExitBootServices fail + // + CoreNotifySignalList (&gEventExitBootServicesFailedGuid); return Status; } // - // Disable Timer + // Notify other drivers that we are exiting boot services. // - gTimer->SetTimerPeriod (gTimer, 0); + CoreNotifySignalList (&gEfiEventExitBootServicesGuid); // - // Notify other drivers that we are exiting boot services. + // Report that ExitBootServices() has been called // - CoreNotifySignalList (&gEfiEventExitBootServicesGuid); + REPORT_STATUS_CODE ( + EFI_PROGRESS_CODE, + (EFI_SOFTWARE_EFI_BOOT_SERVICE | EFI_SW_BS_PC_EXIT_BOOT_SERVICES) + ); // // Disable interrupt of Debug timer. @@ -695,14 +759,6 @@ CoreExitBootServices ( // gCpu->DisableInterrupt (gCpu); - // - // Report that ExitBootServices() has been called - // - REPORT_STATUS_CODE ( - EFI_PROGRESS_CODE, - (EFI_SOFTWARE_EFI_BOOT_SERVICE | EFI_SW_BS_PC_EXIT_BOOT_SERVICES) - ); - // // Clear the non-runtime values of the EFI System Table //