]> git.proxmox.com Git - mirror_edk2.git/blob - SecurityPkg/Library/DxeDeferImageLoadLib/DxeDeferImageLoadLib.h
MdeModulePkg/DxeCapsuleLibFmp: Add missing NULL pointer check.
[mirror_edk2.git] / SecurityPkg / Library / DxeDeferImageLoadLib / DxeDeferImageLoadLib.h
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 - 2018, Intel Corporation. All rights reserved.<BR>
6 SPDX-License-Identifier: BSD-2-Clause-Patent
7
8 **/
9
10 #ifndef __DEFER_IMAGE_LOAD_LIB_H__
11 #define __DEFER_IMAGE_LOAD_LIB_H__
12
13 #include <PiDxe.h>
14 #include <Library/UefiRuntimeServicesTableLib.h>
15 #include <Library/UefiBootServicesTableLib.h>
16 #include <Library/SecurityManagementLib.h>
17 #include <Library/MemoryAllocationLib.h>
18 #include <Library/DevicePathLib.h>
19 #include <Library/BaseMemoryLib.h>
20 #include <Library/PrintLib.h>
21 #include <Library/DebugLib.h>
22 #include <Library/UefiLib.h>
23 #include <Library/PcdLib.h>
24
25 #include <Protocol/FirmwareVolume2.h>
26 #include <Protocol/BlockIo.h>
27 #include <Protocol/SimpleFileSystem.h>
28 #include <Protocol/DeferredImageLoad.h>
29 #include <Protocol/UserCredential.h>
30 #include <Protocol/UserManager.h>
31
32 #include <Guid/GlobalVariable.h>
33
34 //
35 // Image type definitions.
36 //
37 #define IMAGE_UNKNOWN 0x00000001
38 #define IMAGE_FROM_FV 0x00000002
39 #define IMAGE_FROM_OPTION_ROM 0x00000004
40 #define IMAGE_FROM_REMOVABLE_MEDIA 0x00000008
41 #define IMAGE_FROM_FIXED_MEDIA 0x00000010
42
43 //
44 // The struct to save the deferred image information.
45 //
46 typedef struct {
47 EFI_DEVICE_PATH_PROTOCOL *ImageDevicePath;
48 VOID *Image;
49 UINTN ImageSize;
50 BOOLEAN BootOption;
51 } DEFERRED_IMAGE_INFO;
52
53 //
54 // The table to save the deferred image item.
55 //
56 typedef struct {
57 UINTN Count; ///< deferred image count
58 DEFERRED_IMAGE_INFO *ImageInfo; ///< deferred image item
59 } DEFERRED_IMAGE_TABLE;
60
61 /**
62 Returns information about a deferred image.
63
64 This function returns information about a single deferred image. The deferred images are
65 numbered consecutively, starting with 0. If there is no image which corresponds to
66 ImageIndex, then EFI_NOT_FOUND is returned. All deferred images may be returned by
67 iteratively calling this function until EFI_NOT_FOUND is returned.
68 Image may be NULL and ImageSize set to 0 if the decision to defer execution was made
69 because of the location of the executable image, rather than its actual contents.
70
71 @param[in] This Points to this instance of the EFI_DEFERRED_IMAGE_LOAD_PROTOCOL.
72 @param[in] ImageIndex Zero-based index of the deferred index.
73 @param[out] ImageDevicePath On return, points to a pointer to the device path of the image.
74 The device path should not be freed by the caller.
75 @param[out] Image On return, points to the first byte of the image or NULL if the
76 image is not available. The image should not be freed by the caller
77 unless LoadImage() has been called successfully.
78 @param[out] ImageSize On return, the size of the image, or 0 if the image is not available.
79 @param[out] BootOption On return, points to TRUE if the image was intended as a boot option
80 or FALSE if it was not intended as a boot option.
81
82 @retval EFI_SUCCESS Image information returned successfully.
83 @retval EFI_NOT_FOUND ImageIndex does not refer to a valid image.
84 @retval EFI_INVALID_PARAMETER ImageDevicePath is NULL or Image is NULL or ImageSize is NULL or
85 BootOption is NULL.
86
87 **/
88 EFI_STATUS
89 EFIAPI
90 GetDefferedImageInfo (
91 IN EFI_DEFERRED_IMAGE_LOAD_PROTOCOL *This,
92 IN UINTN ImageIndex,
93 OUT EFI_DEVICE_PATH_PROTOCOL **ImageDevicePath,
94 OUT VOID **Image,
95 OUT UINTN *ImageSize,
96 OUT BOOLEAN *BootOption
97 );
98
99 #endif