X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=blobdiff_plain;f=MdeModulePkg%2FCore%2FPei%2FImage%2FImage.c;h=efe8c83b101b8a7a4679dc5f39861b8abcfbe9e0;hp=d08fee42e150b1339f18efc9592c760e26015c6c;hb=ed66e1bc0d2be0a185fc47adab4930c3b7e2767f;hpb=b1f6a7c636fca9eda65a3045302de577c00e438d diff --git a/MdeModulePkg/Core/Pei/Image/Image.c b/MdeModulePkg/Core/Pei/Image/Image.c index d08fee42e1..efe8c83b10 100644 --- a/MdeModulePkg/Core/Pei/Image/Image.c +++ b/MdeModulePkg/Core/Pei/Image/Image.c @@ -1,7 +1,7 @@ /** @file Pei Core Load Image Support -Copyright (c) 2006 - 2007, Intel Corporation +Copyright (c) 2006 - 2008, 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 @@ -14,32 +14,6 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. #include -/** - Routine for loading file image. - - @param PeiServices The PEI core services table. - @param FileHandle Pointer to the FFS file header of the image. - @param ImageAddressArg Pointer to PE/TE image. - @param ImageSizeArg Size of PE/TE image. - @param EntryPoint Pointer to entry point of specified image file for output. - @param AuthenticationState - Pointer to attestation authentication state of image. - - @retval EFI_SUCCESS - Image is successfully loaded. - @retval EFI_NOT_FOUND - Fail to locate necessary PPI - @retval Others - Fail to load file. - -**/ -EFI_STATUS -PeiLoadImageLoadImage ( - IN EFI_PEI_SERVICES **PeiServices, - IN EFI_PEI_FILE_HANDLE FileHandle, - OUT EFI_PHYSICAL_ADDRESS *ImageAddressArg, OPTIONAL - OUT UINT64 *ImageSizeArg, OPTIONAL - OUT EFI_PHYSICAL_ADDRESS *EntryPoint, - OUT UINT32 *AuthenticationState - ) -; - /** The wrapper function of PeiLoadImageLoadImage(). @@ -62,8 +36,7 @@ PeiLoadImageLoadImageWrapper ( OUT UINT64 *ImageSizeArg, OPTIONAL OUT EFI_PHYSICAL_ADDRESS *EntryPoint, OUT UINT32 *AuthenticationState - ) -; + ); STATIC EFI_PEI_LOAD_FILE_PPI mPeiLoadImagePpi = { PeiLoadImageLoadImageWrapper @@ -94,7 +67,7 @@ EFIAPI PeiImageRead ( IN VOID *FileHandle, IN UINTN FileOffset, - IN OUT UINTN *ReadSize, + IN UINTN *ReadSize, OUT VOID *Buffer ) { @@ -114,7 +87,7 @@ PeiImageRead ( /** - Support routine to return the Image Read. + Support routine to get the Image read file function. @param ImageContext - The context of the image being loaded @@ -150,6 +123,7 @@ GetImageReadFunction ( @retval EFI_SUCCESS The file was loaded and relocated @retval EFI_OUT_OF_RESOURCES There was not enough memory to load and relocate the PE/COFF file + @retval EFI_INVALID_PARAMETER The image withou .reloc section can't be relocated. **/ EFI_STATUS @@ -223,18 +197,20 @@ LoadAndRelocatePeCoffImage ( } /** - Routine for loading file image. + Loads a PEIM into memory for subsequent execution. If there are compressed + images or images that need to be relocated into memory for performance reasons, + this service performs that transformation. - @param PeiServices The PEI core services table. + @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation @param FileHandle Pointer to the FFS file header of the image. @param ImageAddressArg Pointer to PE/TE image. @param ImageSizeArg Size of PE/TE image. @param EntryPoint Pointer to entry point of specified image file for output. @param AuthenticationState - Pointer to attestation authentication state of image. - @retval EFI_SUCCESS - Image is successfully loaded. - @retval EFI_NOT_FOUND - Fail to locate necessary PPI - @retval Others - Fail to load file. + @retval EFI_SUCCESS Image is successfully loaded. + @retval EFI_NOT_FOUND Fail to locate necessary PPI. + @retval EFI_UNSUPPORTED Image Machine Type is not supported. **/ EFI_STATUS @@ -355,12 +331,12 @@ PeiLoadImageLoadImage ( // Print debug message: Loading PEIM at 0x12345678 EntryPoint=0x12345688 Driver.efi // if (Machine != IMAGE_FILE_MACHINE_IA64) { - DEBUG ((EFI_D_INFO | EFI_D_LOAD, "Loading PEIM at 0x%10p EntryPoint=0x%10p ", (VOID *)(UINTN)ImageAddress, (VOID *)(UINTN)*EntryPoint)); + DEBUG ((EFI_D_INFO | EFI_D_LOAD, "Loading PEIM at 0x%11p EntryPoint=0x%11p ", (VOID *)(UINTN)ImageAddress, (VOID *)(UINTN)*EntryPoint)); } else { // // For IPF Image, the real entry point should be print. // - DEBUG ((EFI_D_INFO | EFI_D_LOAD, "Loading PEIM at 0x%10p EntryPoint=0x%10p ", (VOID *)(UINTN)ImageAddress, (VOID *)(UINTN)(*(UINT64 *)(UINTN)*EntryPoint))); + DEBUG ((EFI_D_INFO | EFI_D_LOAD, "Loading PEIM at 0x%11p EntryPoint=0x%11p ", (VOID *)(UINTN)ImageAddress, (VOID *)(UINTN)(*(UINT64 *)(UINTN)*EntryPoint))); } // @@ -428,11 +404,11 @@ PeiLoadImageLoadImageWrapper ( } /** + Routine to load image file for subsequent execution by LoadFile Ppi. + If any LoadFile Ppi is not found, the build-in support function for the PE32+/TE + XIP image format is used. - Routine for load image file. - - - @param PeiServices - The PEI core services table. + @param PeiServices - An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation @param FileHandle - Pointer to the FFS file header of the image. @param EntryPoint - Pointer to entry point of specified image file for output. @param AuthenticationState - Pointer to attestation authentication state of image.