1 | /** @file
|
---|
2 | Implement defer image load services for user identification in UEFI2.2.
|
---|
3 |
|
---|
4 | Copyright (c) 2016, Intel Corporation. All rights reserved.<BR>
|
---|
5 | SPDX-License-Identifier: BSD-2-Clause-Patent
|
---|
6 |
|
---|
7 | **/
|
---|
8 |
|
---|
9 | #ifndef _DEFER_3RD_PARTY_IMAGE_LOAD_H_
|
---|
10 | #define _DEFER_3RD_PARTY_IMAGE_LOAD_H_
|
---|
11 |
|
---|
12 | #include <PiDxe.h>
|
---|
13 | #include <Guid/EventGroup.h>
|
---|
14 | #include <Protocol/DeferredImageLoad.h>
|
---|
15 | #include <Protocol/FirmwareVolume2.h>
|
---|
16 | #include <Protocol/DxeSmmReadyToLock.h>
|
---|
17 |
|
---|
18 | #include <Library/UefiBootServicesTableLib.h>
|
---|
19 | #include <Library/BaseMemoryLib.h>
|
---|
20 | #include <Library/MemoryAllocationLib.h>
|
---|
21 | #include <Library/DevicePathLib.h>
|
---|
22 | #include <Library/DebugLib.h>
|
---|
23 | #include <Library/UefiLib.h>
|
---|
24 | #include <Library/ReportStatusCodeLib.h>
|
---|
25 |
|
---|
26 | /**
|
---|
27 | Returns information about a deferred image.
|
---|
28 |
|
---|
29 | This function returns information about a single deferred image. The deferred images are
|
---|
30 | numbered consecutively, starting with 0. If there is no image which corresponds to
|
---|
31 | ImageIndex, then EFI_NOT_FOUND is returned. All deferred images may be returned by
|
---|
32 | iteratively calling this function until EFI_NOT_FOUND is returned.
|
---|
33 | Image may be NULL and ImageSize set to 0 if the decision to defer execution was made
|
---|
34 | because of the location of the executable image, rather than its actual contents.
|
---|
35 |
|
---|
36 | @param[in] This Points to this instance of the EFI_DEFERRED_IMAGE_LOAD_PROTOCOL.
|
---|
37 | @param[in] ImageIndex Zero-based index of the deferred index.
|
---|
38 | @param[out] ImageDevicePath On return, points to a pointer to the device path of the image.
|
---|
39 | The device path should not be freed by the caller.
|
---|
40 | @param[out] Image On return, points to the first byte of the image or NULL if the
|
---|
41 | image is not available. The image should not be freed by the caller
|
---|
42 | unless LoadImage() has been successfully called.
|
---|
43 | @param[out] ImageSize On return, the size of the image, or 0 if the image is not available.
|
---|
44 | @param[out] BootOption On return, points to TRUE if the image was intended as a boot option
|
---|
45 | or FALSE if it was not intended as a boot option.
|
---|
46 |
|
---|
47 | @retval EFI_SUCCESS Image information returned successfully.
|
---|
48 | @retval EFI_NOT_FOUND ImageIndex does not refer to a valid image.
|
---|
49 | @retval EFI_INVALID_PARAMETER ImageDevicePath is NULL or Image is NULL or ImageSize is NULL or
|
---|
50 | BootOption is NULL.
|
---|
51 |
|
---|
52 | **/
|
---|
53 | EFI_STATUS
|
---|
54 | EFIAPI
|
---|
55 | GetDefferedImageInfo (
|
---|
56 | IN EFI_DEFERRED_IMAGE_LOAD_PROTOCOL *This,
|
---|
57 | IN UINTN ImageIndex,
|
---|
58 | OUT EFI_DEVICE_PATH_PROTOCOL **ImageDevicePath,
|
---|
59 | OUT VOID **Image,
|
---|
60 | OUT UINTN *ImageSize,
|
---|
61 | OUT BOOLEAN *BootOption
|
---|
62 | );
|
---|
63 |
|
---|
64 | /**
|
---|
65 | Defer the 3rd party image load and installs Deferred Image Load Protocol.
|
---|
66 |
|
---|
67 | @param[in] File This is a pointer to the device path of the file that
|
---|
68 | is being dispatched. This will optionally be used for
|
---|
69 | logging.
|
---|
70 | @param[in] BootPolicy A boot policy that was used to call LoadImage() UEFI service.
|
---|
71 |
|
---|
72 | @retval EFI_SUCCESS The file is not 3rd party image and can be loaded immediately.
|
---|
73 | @retval EFI_ACCESS_DENIED The file is 3rd party image and needs deferred.
|
---|
74 | **/
|
---|
75 | EFI_STATUS
|
---|
76 | Defer3rdPartyImageLoad (
|
---|
77 | IN CONST EFI_DEVICE_PATH_PROTOCOL *File,
|
---|
78 | IN BOOLEAN BootPolicy
|
---|
79 | );
|
---|
80 |
|
---|
81 | /**
|
---|
82 | Installs DeferredImageLoad Protocol and listens EndOfDxe event.
|
---|
83 | **/
|
---|
84 | VOID
|
---|
85 | Defer3rdPartyImageLoadInitialize (
|
---|
86 | VOID
|
---|
87 | );
|
---|
88 |
|
---|
89 | #endif
|
---|