From 728c7ffac317723e2704bf180954aed162831885 Mon Sep 17 00:00:00 2001 From: Dandan Bi Date: Sun, 28 Apr 2019 21:31:31 +0800 Subject: MdeModulePkg/Core: Remove PcdFrameworkCompatibilitySupport usage REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1464 Currently Framework compatibility is not needed and PcdFrameworkCompatibilitySupport will be removed from edk2. So remove the usage of this PCD firstly. Cc: Liming Gao Signed-off-by: Dandan Bi Reviewed-by: Liming Gao --- MdeModulePkg/Core/Dxe/DxeMain.inf | 6 +- MdeModulePkg/Core/Dxe/Image/Image.c | 132 +----------------------------------- MdeModulePkg/Core/Dxe/Image/Image.h | 85 +---------------------- MdeModulePkg/Core/Pei/FwVol/FwVol.c | 65 ------------------ MdeModulePkg/Core/Pei/PeiMain.inf | 1 - 5 files changed, 3 insertions(+), 286 deletions(-) (limited to 'MdeModulePkg/Core') diff --git a/MdeModulePkg/Core/Dxe/DxeMain.inf b/MdeModulePkg/Core/Dxe/DxeMain.inf index 8dee5bee0a..61161bee28 100644 --- a/MdeModulePkg/Core/Dxe/DxeMain.inf +++ b/MdeModulePkg/Core/Dxe/DxeMain.inf @@ -3,7 +3,7 @@ # # It provides an implementation of DXE Core that is compliant with DXE CIS. # -# Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
+# Copyright (c) 2006 - 2019, Intel Corporation. All rights reserved.
# SPDX-License-Identifier: BSD-2-Clause-Patent # ## @@ -132,7 +132,6 @@ ## PRODUCES ## SOMETIMES_CONSUMES gEfiDecompressProtocolGuid - gEfiLoadPeImageProtocolGuid ## SOMETIMES_PRODUCES # Produces when PcdFrameworkCompatibilitySupport is set gEfiSimpleFileSystemProtocolGuid ## SOMETIMES_CONSUMES gEfiLoadFileProtocolGuid ## SOMETIMES_CONSUMES gEfiLoadFile2ProtocolGuid ## SOMETIMES_CONSUMES @@ -173,9 +172,6 @@ gEfiCapsuleArchProtocolGuid ## CONSUMES gEfiWatchdogTimerArchProtocolGuid ## CONSUMES -[FeaturePcd] - gEfiMdeModulePkgTokenSpaceGuid.PcdFrameworkCompatibilitySupport ## CONSUMES - [Pcd] gEfiMdeModulePkgTokenSpaceGuid.PcdLoadFixAddressBootTimeCodePageNumber ## SOMETIMES_CONSUMES gEfiMdeModulePkgTokenSpaceGuid.PcdLoadFixAddressRuntimeCodePageNumber ## SOMETIMES_CONSUMES diff --git a/MdeModulePkg/Core/Dxe/Image/Image.c b/MdeModulePkg/Core/Dxe/Image/Image.c index de5b8bed27..22a87ecf6d 100644 --- a/MdeModulePkg/Core/Dxe/Image/Image.c +++ b/MdeModulePkg/Core/Dxe/Image/Image.c @@ -1,7 +1,7 @@ /** @file Core image handling services to load and unload PeImage. -Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
+Copyright (c) 2006 - 2019, Intel Corporation. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent **/ @@ -14,15 +14,6 @@ SPDX-License-Identifier: BSD-2-Clause-Patent // LOADED_IMAGE_PRIVATE_DATA *mCurrentImage = NULL; -LOAD_PE32_IMAGE_PRIVATE_DATA mLoadPe32PrivateData = { - LOAD_PE32_IMAGE_PRIVATE_DATA_SIGNATURE, - NULL, - { - CoreLoadImageEx, - CoreUnloadImageEx - } -}; - typedef struct { LIST_ENTRY Link; EDKII_PECOFF_IMAGE_EMULATOR_PROTOCOL *Emulator; @@ -276,18 +267,6 @@ CoreInitializeImageServices ( InitializeListHead (&mAvailableEmulators); - if (FeaturePcdGet (PcdFrameworkCompatibilitySupport)) { - // - // Export DXE Core PE Loader functionality for backward compatibility. - // - Status = CoreInstallProtocolInterface ( - &mLoadPe32PrivateData.Handle, - &gEfiLoadPeImageProtocolGuid, - EFI_NATIVE_INTERFACE, - &mLoadPe32PrivateData.Pe32Image - ); - } - ProtectUefiImage (&Image->Info, Image->LoadedImageDevicePath); return Status; @@ -1566,92 +1545,6 @@ CoreLoadImage ( return Status; } - - -/** - Loads an EFI image into memory and returns a handle to the image with extended parameters. - - @param This Calling context - @param ParentImageHandle The caller's image handle. - @param FilePath The specific file path from which the image is - loaded. - @param SourceBuffer If not NULL, a pointer to the memory location - containing a copy of the image to be loaded. - @param SourceSize The size in bytes of SourceBuffer. - @param DstBuffer The buffer to store the image. - @param NumberOfPages For input, specifies the space size of the - image by caller if not NULL. For output, - specifies the actual space size needed. - @param ImageHandle Image handle for output. - @param EntryPoint Image entry point for output. - @param Attribute The bit mask of attributes to set for the load - PE image. - - @retval EFI_SUCCESS The image was loaded into memory. - @retval EFI_NOT_FOUND The FilePath was not found. - @retval EFI_INVALID_PARAMETER One of the parameters has an invalid value. - @retval EFI_UNSUPPORTED The image type is not supported, or the device - path cannot be parsed to locate the proper - protocol for loading the file. - @retval EFI_OUT_OF_RESOURCES Image was not loaded due to insufficient - resources. - @retval EFI_LOAD_ERROR Image was not loaded because the image format was corrupt or not - understood. - @retval EFI_DEVICE_ERROR Image was not loaded because the device returned a read error. - @retval EFI_ACCESS_DENIED Image was not loaded because the platform policy prohibits the - image from being loaded. NULL is returned in *ImageHandle. - @retval EFI_SECURITY_VIOLATION Image was loaded and an ImageHandle was created with a - valid EFI_LOADED_IMAGE_PROTOCOL. However, the current - platform policy specifies that the image should not be started. - -**/ -EFI_STATUS -EFIAPI -CoreLoadImageEx ( - IN EFI_PE32_IMAGE_PROTOCOL *This, - IN EFI_HANDLE ParentImageHandle, - IN EFI_DEVICE_PATH_PROTOCOL *FilePath, - IN VOID *SourceBuffer OPTIONAL, - IN UINTN SourceSize, - IN EFI_PHYSICAL_ADDRESS DstBuffer OPTIONAL, - OUT UINTN *NumberOfPages OPTIONAL, - OUT EFI_HANDLE *ImageHandle, - OUT EFI_PHYSICAL_ADDRESS *EntryPoint OPTIONAL, - IN UINT32 Attribute - ) -{ - EFI_STATUS Status; - EFI_HANDLE Handle; - - PERF_LOAD_IMAGE_BEGIN (NULL); - - Status = CoreLoadImageCommon ( - TRUE, - ParentImageHandle, - FilePath, - SourceBuffer, - SourceSize, - DstBuffer, - NumberOfPages, - ImageHandle, - EntryPoint, - Attribute - ); - - Handle = NULL; - if (!EFI_ERROR (Status)) { - // - // ImageHandle will be valid only Status is success. - // - Handle = *ImageHandle; - } - - PERF_LOAD_IMAGE_END (Handle); - - return Status; -} - - /** Transfer control to a loaded image's entry point. @@ -2012,26 +1905,3 @@ CoreUnloadImage ( Done: return Status; } - - - -/** - Unload the specified image. - - @param This Indicates the calling context. - @param ImageHandle The specified image handle. - - @retval EFI_INVALID_PARAMETER Image handle is NULL. - @retval EFI_UNSUPPORTED Attempt to unload an unsupported image. - @retval EFI_SUCCESS Image successfully unloaded. - -**/ -EFI_STATUS -EFIAPI -CoreUnloadImageEx ( - IN EFI_PE32_IMAGE_PROTOCOL *This, - IN EFI_HANDLE ImageHandle - ) -{ - return CoreUnloadImage (ImageHandle); -} diff --git a/MdeModulePkg/Core/Dxe/Image/Image.h b/MdeModulePkg/Core/Dxe/Image/Image.h index 6020a27371..e9c44ab2a7 100644 --- a/MdeModulePkg/Core/Dxe/Image/Image.h +++ b/MdeModulePkg/Core/Dxe/Image/Image.h @@ -1,7 +1,7 @@ /** @file Data structure and functions to load and unload PeImage. -Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
+Copyright (c) 2006 - 2019, Intel Corporation. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent **/ @@ -10,19 +10,6 @@ SPDX-License-Identifier: BSD-2-Clause-Patent #ifndef _IMAGE_H_ #define _IMAGE_H_ -#define LOAD_PE32_IMAGE_PRIVATE_DATA_SIGNATURE SIGNATURE_32('l','p','e','i') - -typedef struct { - UINTN Signature; - /// Image handle - EFI_HANDLE Handle; - EFI_PE32_IMAGE_PROTOCOL Pe32Image; -} LOAD_PE32_IMAGE_PRIVATE_DATA; - -#define LOAD_PE32_IMAGE_PRIVATE_DATA_FROM_THIS(a) \ - CR(a, LOAD_PE32_IMAGE_PRIVATE_DATA, Pe32Image, LOAD_PE32_IMAGE_PRIVATE_DATA_SIGNATURE) - - // // Private Data Types // @@ -34,74 +21,4 @@ typedef struct { UINTN SourceSize; } IMAGE_FILE_HANDLE; -/** - Loads an EFI image into memory and returns a handle to the image with extended parameters. - - @param This Calling context - @param ParentImageHandle The caller's image handle. - @param FilePath The specific file path from which the image is - loaded. - @param SourceBuffer If not NULL, a pointer to the memory location - containing a copy of the image to be loaded. - @param SourceSize The size in bytes of SourceBuffer. - @param DstBuffer The buffer to store the image. - @param NumberOfPages For input, specifies the space size of the - image by caller if not NULL. For output, - specifies the actual space size needed. - @param ImageHandle Image handle for output. - @param EntryPoint Image entry point for output. - @param Attribute The bit mask of attributes to set for the load - PE image. - - @retval EFI_SUCCESS The image was loaded into memory. - @retval EFI_NOT_FOUND The FilePath was not found. - @retval EFI_INVALID_PARAMETER One of the parameters has an invalid value. - @retval EFI_UNSUPPORTED The image type is not supported, or the device - path cannot be parsed to locate the proper - protocol for loading the file. - @retval EFI_OUT_OF_RESOURCES Image was not loaded due to insufficient - resources. - @retval EFI_LOAD_ERROR Image was not loaded because the image format was corrupt or not - understood. - @retval EFI_DEVICE_ERROR Image was not loaded because the device returned a read error. - @retval EFI_ACCESS_DENIED Image was not loaded because the platform policy prohibits the - image from being loaded. NULL is returned in *ImageHandle. - @retval EFI_SECURITY_VIOLATION Image was loaded and an ImageHandle was created with a - valid EFI_LOADED_IMAGE_PROTOCOL. However, the current - platform policy specifies that the image should not be started. - -**/ -EFI_STATUS -EFIAPI -CoreLoadImageEx ( - IN EFI_PE32_IMAGE_PROTOCOL *This, - IN EFI_HANDLE ParentImageHandle, - IN EFI_DEVICE_PATH_PROTOCOL *FilePath, - IN VOID *SourceBuffer OPTIONAL, - IN UINTN SourceSize, - IN EFI_PHYSICAL_ADDRESS DstBuffer OPTIONAL, - OUT UINTN *NumberOfPages OPTIONAL, - OUT EFI_HANDLE *ImageHandle, - OUT EFI_PHYSICAL_ADDRESS *EntryPoint OPTIONAL, - IN UINT32 Attribute - ); - - -/** - Unload the specified image. - - @param This Indicates the calling context. - @param ImageHandle The specified image handle. - - @retval EFI_INVALID_PARAMETER Image handle is NULL. - @retval EFI_UNSUPPORTED Attempt to unload an unsupported image. - @retval EFI_SUCCESS Image successfully unloaded. - -**/ -EFI_STATUS -EFIAPI -CoreUnloadImageEx ( - IN EFI_PE32_IMAGE_PROTOCOL *This, - IN EFI_HANDLE ImageHandle - ); #endif diff --git a/MdeModulePkg/Core/Pei/FwVol/FwVol.c b/MdeModulePkg/Core/Pei/FwVol/FwVol.c index f817ba04e2..709db00694 100644 --- a/MdeModulePkg/Core/Pei/FwVol/FwVol.c +++ b/MdeModulePkg/Core/Pei/FwVol/FwVol.c @@ -1094,15 +1094,6 @@ PeiFfsFindNextFile ( CoreFvHandle = FvHandleToCoreHandle (FvHandle); - // - // To make backward compatiblity, if can not find corresponding the handle of FV - // then treat FV as build-in FFS2/FFS3 format and memory mapped FV that FV handle is pointed - // to the address of first byte of FV. - // - if ((CoreFvHandle == NULL) && FeaturePcdGet (PcdFrameworkCompatibilitySupport)) { - return FindFileEx (FvHandle, NULL, SearchType, FileHandle, NULL); - } - if ((CoreFvHandle == NULL) || CoreFvHandle->FvPpi == NULL) { return EFI_NOT_FOUND; } @@ -2111,62 +2102,6 @@ FindNextCoreFvHandle ( IN UINTN Instance ) { - UINTN Index; - BOOLEAN Match; - EFI_HOB_FIRMWARE_VOLUME *FvHob; - - // - // Handle Framework FvHob and Install FvInfo Ppi for it. - // - if (FeaturePcdGet (PcdFrameworkCompatibilitySupport)) { - // - // Loop to search the wanted FirmwareVolume which supports FFS - // - FvHob = (EFI_HOB_FIRMWARE_VOLUME *)GetFirstHob (EFI_HOB_TYPE_FV); - while (FvHob != NULL) { - // - // Search whether FvHob has been installed into PeiCore's FV database. - // If found, no need install new FvInfoPpi for it. - // - for (Index = 0, Match = FALSE; Index < Private->FvCount; Index++) { - if ((EFI_PEI_FV_HANDLE)(UINTN)FvHob->BaseAddress == Private->Fv[Index].FvHeader) { - Match = TRUE; - break; - } - } - - // - // Search whether FvHob has been cached into PeiCore's Unknown FV database. - // If found, no need install new FvInfoPpi for it. - // - if (!Match) { - for (Index = 0; Index < Private->UnknownFvInfoCount; Index ++) { - if ((UINTN)FvHob->BaseAddress == (UINTN)Private->UnknownFvInfo[Index].FvInfo) { - Match = TRUE; - break; - } - } - } - - // - // If the Fv in FvHob has not been installed into PeiCore's FV database and has - // not been cached into PeiCore's Unknown FV database, install a new FvInfoPpi - // for it then PeiCore will dispatch it in callback of FvInfoPpi. - // - if (!Match) { - PeiServicesInstallFvInfoPpi ( - &(((EFI_FIRMWARE_VOLUME_HEADER *)(UINTN)FvHob->BaseAddress)->FileSystemGuid), - (VOID *)(UINTN)FvHob->BaseAddress, - (UINT32)FvHob->Length, - NULL, - NULL - ); - } - - FvHob = (EFI_HOB_FIRMWARE_VOLUME *)GetNextHob (EFI_HOB_TYPE_FV, (VOID *)((UINTN)FvHob + FvHob->Header.HobLength)); - } - } - if (Instance >= Private->FvCount) { return NULL; } diff --git a/MdeModulePkg/Core/Pei/PeiMain.inf b/MdeModulePkg/Core/Pei/PeiMain.inf index c8a6d5b80b..7c482dacfc 100644 --- a/MdeModulePkg/Core/Pei/PeiMain.inf +++ b/MdeModulePkg/Core/Pei/PeiMain.inf @@ -102,7 +102,6 @@ [Pcd] gEfiMdeModulePkgTokenSpaceGuid.PcdPeiCoreMaxPeiStackSize ## CONSUMES gEfiMdeModulePkgTokenSpaceGuid.PcdPeiCoreImageLoaderSearchTeSectionFirst ## CONSUMES - gEfiMdeModulePkgTokenSpaceGuid.PcdFrameworkCompatibilitySupport ## CONSUMES gEfiMdeModulePkgTokenSpaceGuid.PcdLoadFixAddressPeiCodePageNumber ## SOMETIMES_CONSUMES gEfiMdeModulePkgTokenSpaceGuid.PcdLoadFixAddressBootTimeCodePageNumber ## SOMETIMES_CONSUMES gEfiMdeModulePkgTokenSpaceGuid.PcdLoadFixAddressRuntimeCodePageNumber ## SOMETIMES_CONSUMES -- cgit v1.2.3