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