1 /** @file 2 The internal header file includes the common header files, defines 3 internal structure and functions used by DeferImageLoadLib. 4 5 Copyright (c) 2009 - 2013, Intel Corporation. All rights reserved.<BR> 6 This program and the accompanying materials 7 are licensed and made available under the terms and conditions of the BSD License 8 which accompanies this distribution. The full text of the license may be found at 9 http://opensource.org/licenses/bsd-license.php 10 11 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 12 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 13 14 **/ 15 16 #ifndef __DEFER_IMAGE_LOAD_LIB_H__ 17 #define __DEFER_IMAGE_LOAD_LIB_H__ 18 19 #include <PiDxe.h> 20 #include <Library/UefiRuntimeServicesTableLib.h> 21 #include <Library/UefiBootServicesTableLib.h> 22 #include <Library/SecurityManagementLib.h> 23 #include <Library/MemoryAllocationLib.h> 24 #include <Library/DevicePathLib.h> 25 #include <Library/BaseMemoryLib.h> 26 #include <Library/PrintLib.h> 27 #include <Library/DebugLib.h> 28 #include <Library/UefiLib.h> 29 #include <Library/PcdLib.h> 30 31 #include <Protocol/FirmwareVolume2.h> 32 #include <Protocol/BlockIo.h> 33 #include <Protocol/SimpleFileSystem.h> 34 #include <Protocol/DeferredImageLoad.h> 35 #include <Protocol/UserCredential.h> 36 #include <Protocol/UserManager.h> 37 38 #include <Guid/GlobalVariable.h> 39 40 // 41 // Image type definitions. 42 // 43 #define IMAGE_UNKNOWN 0x00000001 44 #define IMAGE_FROM_FV 0x00000002 45 #define IMAGE_FROM_OPTION_ROM 0x00000004 46 #define IMAGE_FROM_REMOVABLE_MEDIA 0x00000008 47 #define IMAGE_FROM_FIXED_MEDIA 0x00000010 48 49 // 50 // The struct to save the deferred image information. 51 // 52 typedef struct { 53 EFI_DEVICE_PATH_PROTOCOL *ImageDevicePath; 54 VOID *Image; 55 UINTN ImageSize; 56 BOOLEAN BootOption; 57 } DEFERRED_IMAGE_INFO; 58 59 // 60 // The table to save the deferred image item. 61 // 62 typedef struct { 63 UINTN Count; ///< deferred image count 64 DEFERRED_IMAGE_INFO *ImageInfo; ///< deferred image item 65 } DEFERRED_IMAGE_TABLE; 66 67 /** 68 Returns information about a deferred image. 69 70 This function returns information about a single deferred image. The deferred images are 71 numbered consecutively, starting with 0. If there is no image which corresponds to 72 ImageIndex, then EFI_NOT_FOUND is returned. All deferred images may be returned by 73 iteratively calling this function until EFI_NOT_FOUND is returned. 74 Image may be NULL and ImageSize set to 0 if the decision to defer execution was made 75 because of the location of the executable image, rather than its actual contents. 76 77 @param[in] This Points to this instance of the EFI_DEFERRED_IMAGE_LOAD_PROTOCOL. 78 @param[in] ImageIndex Zero-based index of the deferred index. 79 @param[out] ImageDevicePath On return, points to a pointer to the device path of the image. 80 The device path should not be freed by the caller. 81 @param[out] Image On return, points to the first byte of the image or NULL if the 82 image is not available. The image should not be freed by the caller 83 unless LoadImage() has been called successfully. 84 @param[out] ImageSize On return, the size of the image, or 0 if the image is not available. 85 @param[out] BootOption On return, points to TRUE if the image was intended as a boot option 86 or FALSE if it was not intended as a boot option. 87 88 @retval EFI_SUCCESS Image information returned successfully. 89 @retval EFI_NOT_FOUND ImageIndex does not refer to a valid image. 90 @retval EFI_INVALID_PARAMETER ImageDevicePath is NULL or Image is NULL or ImageSize is NULL or 91 BootOption is NULL. 92 93 **/ 94 EFI_STATUS 95 EFIAPI 96 GetDefferedImageInfo ( 97 IN EFI_DEFERRED_IMAGE_LOAD_PROTOCOL *This, 98 IN UINTN ImageIndex, 99 OUT EFI_DEVICE_PATH_PROTOCOL **ImageDevicePath, 100 OUT VOID **Image, 101 OUT UINTN *ImageSize, 102 OUT BOOLEAN *BootOption 103 ); 104 105 #endif 106