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