Add security package to repository.
[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 - 2010, 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 #include <Protocol/DevicePathToText.h>
38
39 #include <Guid/GlobalVariable.h>
40
41 //
42 // Image type definitions.
43 //
44 #define IMAGE_UNKNOWN 0x00000001
45 #define IMAGE_FROM_FV 0x00000002
46 #define IMAGE_FROM_OPTION_ROM 0x00000004
47 #define IMAGE_FROM_REMOVABLE_MEDIA 0x00000008
48 #define IMAGE_FROM_FIXED_MEDIA 0x00000010
49
50 //
51 // The struct to save the deferred image information.
52 //
53 typedef struct {
54 EFI_DEVICE_PATH_PROTOCOL *ImageDevicePath;
55 VOID *Image;
56 UINTN ImageSize;
57 BOOLEAN BootOption;
58 } DEFERRED_IMAGE_INFO;
59
60 //
61 // The table to save the deferred image item.
62 //
63 typedef struct {
64 UINTN Count; ///< deferred image count
65 DEFERRED_IMAGE_INFO *ImageInfo; ///< deferred image item
66 } DEFERRED_IMAGE_TABLE;
67
68 /**
69 Returns information about a deferred image.
70
71 This function returns information about a single deferred image. The deferred images are
72 numbered consecutively, starting with 0. If there is no image which corresponds to
73 ImageIndex, then EFI_NOT_FOUND is returned. All deferred images may be returned by
74 iteratively calling this function until EFI_NOT_FOUND is returned.
75 Image may be NULL and ImageSize set to 0 if the decision to defer execution was made
76 because of the location of the executable image, rather than its actual contents.
77
78 @param[in] This Points to this instance of the EFI_DEFERRED_IMAGE_LOAD_PROTOCOL.
79 @param[in] ImageIndex Zero-based index of the deferred index.
80 @param[out] ImageDevicePath On return, points to a pointer to the device path of the image.
81 The device path should not be freed by the caller.
82 @param[out] Image On return, points to the first byte of the image or NULL if the
83 image is not available. The image should not be freed by the caller
84 unless LoadImage() has been called successfully.
85 @param[out] ImageSize On return, the size of the image, or 0 if the image is not available.
86 @param[out] BootOption On return, points to TRUE if the image was intended as a boot option
87 or FALSE if it was not intended as a boot option.
88
89 @retval EFI_SUCCESS Image information returned successfully.
90 @retval EFI_NOT_FOUND ImageIndex does not refer to a valid image.
91 @retval EFI_INVALID_PARAMETER ImageDevicePath is NULL or Image is NULL or ImageSize is NULL or
92 BootOption is NULL.
93
94 **/
95 EFI_STATUS
96 EFIAPI
97 GetDefferedImageInfo (
98 IN EFI_DEFERRED_IMAGE_LOAD_PROTOCOL *This,
99 IN UINTN ImageIndex,
100 OUT EFI_DEVICE_PATH_PROTOCOL **ImageDevicePath,
101 OUT VOID **Image,
102 OUT UINTN *ImageSize,
103 OUT BOOLEAN *BootOption
104 );
105
106 #endif