]> git.proxmox.com Git - mirror_edk2.git/blob - MdeModulePkg/Universal/SecurityStubDxe/Defer3rdPartyImageLoad.h
3fab2582a787d976d210f77741cfbc5c151b8c1d
[mirror_edk2.git] / MdeModulePkg / Universal / SecurityStubDxe / Defer3rdPartyImageLoad.h
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 This program and the accompanying materials
6 are licensed and made available under the terms and conditions of the BSD License
7 which accompanies this distribution. The full text of the license may be found at
8 http://opensource.org/licenses/bsd-license.php
9
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
12
13 **/
14
15 #ifndef _DEFER_3RD_PARTY_IMAGE_LOAD_H_
16 #define _DEFER_3RD_PARTY_IMAGE_LOAD_H_
17
18 #include <Uefi.h>
19 #include <Guid/EventGroup.h>
20 #include <Protocol/DeferredImageLoad.h>
21 #include <Protocol/FirmwareVolume2.h>
22
23 #include <Library/UefiBootServicesTableLib.h>
24 #include <Library/BaseMemoryLib.h>
25 #include <Library/MemoryAllocationLib.h>
26 #include <Library/DevicePathLib.h>
27 #include <Library/DebugLib.h>
28
29 /**
30 Returns information about a deferred image.
31
32 This function returns information about a single deferred image. The deferred images are
33 numbered consecutively, starting with 0. If there is no image which corresponds to
34 ImageIndex, then EFI_NOT_FOUND is returned. All deferred images may be returned by
35 iteratively calling this function until EFI_NOT_FOUND is returned.
36 Image may be NULL and ImageSize set to 0 if the decision to defer execution was made
37 because of the location of the executable image, rather than its actual contents.
38
39 @param[in] This Points to this instance of the EFI_DEFERRED_IMAGE_LOAD_PROTOCOL.
40 @param[in] ImageIndex Zero-based index of the deferred index.
41 @param[out] ImageDevicePath On return, points to a pointer to the device path of the image.
42 The device path should not be freed by the caller.
43 @param[out] Image On return, points to the first byte of the image or NULL if the
44 image is not available. The image should not be freed by the caller
45 unless LoadImage() has been successfully called.
46 @param[out] ImageSize On return, the size of the image, or 0 if the image is not available.
47 @param[out] BootOption On return, points to TRUE if the image was intended as a boot option
48 or FALSE if it was not intended as a boot option.
49
50 @retval EFI_SUCCESS Image information returned successfully.
51 @retval EFI_NOT_FOUND ImageIndex does not refer to a valid image.
52 @retval EFI_INVALID_PARAMETER ImageDevicePath is NULL or Image is NULL or ImageSize is NULL or
53 BootOption is NULL.
54
55 **/
56 EFI_STATUS
57 EFIAPI
58 GetDefferedImageInfo (
59 IN EFI_DEFERRED_IMAGE_LOAD_PROTOCOL *This,
60 IN UINTN ImageIndex,
61 OUT EFI_DEVICE_PATH_PROTOCOL **ImageDevicePath,
62 OUT VOID **Image,
63 OUT UINTN *ImageSize,
64 OUT BOOLEAN *BootOption
65 );
66
67 /**
68 Defer the 3rd party image load and installs Deferred Image Load Protocol.
69
70 @param[in] File This is a pointer to the device path of the file that
71 is being dispatched. This will optionally be used for
72 logging.
73 @param[in] BootPolicy A boot policy that was used to call LoadImage() UEFI service.
74
75 @retval EFI_SUCCESS The file is not 3rd party image and can be loaded immediately.
76 @retval EFI_ACCESS_DENIED The file is 3rd party image and needs deferred.
77 **/
78 EFI_STATUS
79 Defer3rdPartyImageLoad (
80 IN CONST EFI_DEVICE_PATH_PROTOCOL *File,
81 IN BOOLEAN BootPolicy
82 );
83
84 /**
85 Installs DeferredImageLoad Protocol and listens EndOfDxe event.
86 **/
87 VOID
88 Defer3rdPartyImageLoadInitialize (
89 VOID
90 );
91
92 #endif