X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=blobdiff_plain;f=MdeModulePkg%2FCore%2FDxe%2FDxeMain%2FDxeMain.c;h=1ac5cc17212d590479723f9216e85e3f69852fe3;hp=84a3583a6bcf60c13da1adf9fa9733b8798585b6;hb=84edd20bd0756ef5719835498d4283435d6b5e77;hpb=1e172d6bbfeb75d3a5d9f0066eee97789fc617b7 diff --git a/MdeModulePkg/Core/Dxe/DxeMain/DxeMain.c b/MdeModulePkg/Core/Dxe/DxeMain/DxeMain.c index 84a3583a6b..1ac5cc1721 100644 --- a/MdeModulePkg/Core/Dxe/DxeMain/DxeMain.c +++ b/MdeModulePkg/Core/Dxe/DxeMain/DxeMain.c @@ -1,7 +1,7 @@ /** @file DXE Core Main Entry Point -Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.
+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 @@ -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; @@ -241,11 +242,21 @@ DxeMain ( 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 // - SetupCpuExceptionHandlers (); + 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 @@ -257,6 +268,8 @@ DxeMain ( // CoreInitializeMemoryServices (&HobStart, &MemoryBaseAddress, &MemoryLength); + MemoryProfileInit (HobStart); + // // 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 @@ -285,8 +298,9 @@ DxeMain ( // // 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.PdbPointer = PeCoffLoaderGetPdbPointer ((VOID*) (UINTN) ImageContext.ImageAddress); PeCoffLoaderRelocateImageExtraAction (&ImageContext); // @@ -370,6 +384,26 @@ DxeMain ( Status = CoreInitializeEventServices (); ASSERT_EFI_ERROR (Status); + MemoryProfileInstallProtocol (); + + // + // 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 @@ -447,7 +481,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 @@ -690,6 +734,10 @@ CoreExitBootServices ( // Status = CoreTerminateMemoryMap (MapKey); if (EFI_ERROR (Status)) { + // + // Notify other drivers that ExitBootServices fail + // + CoreNotifySignalList (&gEventExitBootServicesFailedGuid); return Status; } @@ -698,6 +746,14 @@ CoreExitBootServices ( // CoreNotifySignalList (&gEfiEventExitBootServicesGuid); + // + // Report that ExitBootServices() has been called + // + REPORT_STATUS_CODE ( + EFI_PROGRESS_CODE, + (EFI_SOFTWARE_EFI_BOOT_SERVICE | EFI_SW_BS_PC_EXIT_BOOT_SERVICES) + ); + // // Disable interrupt of Debug timer. // @@ -708,14 +764,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 // @@ -813,7 +861,7 @@ DxeMainUefiDecompressGetInfo ( implementation. It is the caller's responsibility to allocate and free the Destination and Scratch buffers. If the compressed source data specified by Source and SourceSize is - sucessfully decompressed into Destination, then EFI_SUCCESS is returned. If + successfully decompressed into Destination, then EFI_SUCCESS is returned. If the compressed source data specified by Source and SourceSize is not in a valid compressed data format, then EFI_INVALID_PARAMETER is returned.