1 /** @file 2 Implement defer image load services for user identification in UEFI2.2. 3 4 Copyright (c) 2016, Intel Corporation. All rights reserved.<BR> 5 This program and the accompanying materials 6 are licensed and made available under the terms and conditions of the BSD License 7 which accompanies this distribution. The full text of the license may be found at 8 http://opensource.org/licenses/bsd-license.php 9 10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 12 13 **/ 14 15 #ifndef _DEFER_3RD_PARTY_IMAGE_LOAD_H_ 16 #define _DEFER_3RD_PARTY_IMAGE_LOAD_H_ 17 18 #include <PiDxe.h> 19 #include <Guid/EventGroup.h> 20 #include <Protocol/DeferredImageLoad.h> 21 #include <Protocol/FirmwareVolume2.h> 22 #include <Protocol/DxeSmmReadyToLock.h> 23 24 #include <Library/UefiBootServicesTableLib.h> 25 #include <Library/BaseMemoryLib.h> 26 #include <Library/MemoryAllocationLib.h> 27 #include <Library/DevicePathLib.h> 28 #include <Library/DebugLib.h> 29 #include <Library/UefiLib.h> 30 #include <Library/ReportStatusCodeLib.h> 31 32 /** 33 Returns information about a deferred image. 34 35 This function returns information about a single deferred image. The deferred images are 36 numbered consecutively, starting with 0. If there is no image which corresponds to 37 ImageIndex, then EFI_NOT_FOUND is returned. All deferred images may be returned by 38 iteratively calling this function until EFI_NOT_FOUND is returned. 39 Image may be NULL and ImageSize set to 0 if the decision to defer execution was made 40 because of the location of the executable image, rather than its actual contents. 41 42 @param[in] This Points to this instance of the EFI_DEFERRED_IMAGE_LOAD_PROTOCOL. 43 @param[in] ImageIndex Zero-based index of the deferred index. 44 @param[out] ImageDevicePath On return, points to a pointer to the device path of the image. 45 The device path should not be freed by the caller. 46 @param[out] Image On return, points to the first byte of the image or NULL if the 47 image is not available. The image should not be freed by the caller 48 unless LoadImage() has been successfully called. 49 @param[out] ImageSize On return, the size of the image, or 0 if the image is not available. 50 @param[out] BootOption On return, points to TRUE if the image was intended as a boot option 51 or FALSE if it was not intended as a boot option. 52 53 @retval EFI_SUCCESS Image information returned successfully. 54 @retval EFI_NOT_FOUND ImageIndex does not refer to a valid image. 55 @retval EFI_INVALID_PARAMETER ImageDevicePath is NULL or Image is NULL or ImageSize is NULL or 56 BootOption is NULL. 57 58 **/ 59 EFI_STATUS 60 EFIAPI 61 GetDefferedImageInfo ( 62 IN EFI_DEFERRED_IMAGE_LOAD_PROTOCOL *This, 63 IN UINTN ImageIndex, 64 OUT EFI_DEVICE_PATH_PROTOCOL **ImageDevicePath, 65 OUT VOID **Image, 66 OUT UINTN *ImageSize, 67 OUT BOOLEAN *BootOption 68 ); 69 70 /** 71 Defer the 3rd party image load and installs Deferred Image Load Protocol. 72 73 @param[in] File This is a pointer to the device path of the file that 74 is being dispatched. This will optionally be used for 75 logging. 76 @param[in] BootPolicy A boot policy that was used to call LoadImage() UEFI service. 77 78 @retval EFI_SUCCESS The file is not 3rd party image and can be loaded immediately. 79 @retval EFI_ACCESS_DENIED The file is 3rd party image and needs deferred. 80 **/ 81 EFI_STATUS 82 Defer3rdPartyImageLoad ( 83 IN CONST EFI_DEVICE_PATH_PROTOCOL *File, 84 IN BOOLEAN BootPolicy 85 ); 86 87 /** 88 Installs DeferredImageLoad Protocol and listens EndOfDxe event. 89 **/ 90 VOID 91 Defer3rdPartyImageLoadInitialize ( 92 VOID 93 ); 94 95 #endif 96