xref: /freebsd/sys/contrib/edk2/Include/Protocol/LoadedImage.h (revision f439973d6726c3be929c8fb3b1545b8b1744abc3)
1*f439973dSWarner Losh /** @file
2*f439973dSWarner Losh   UEFI 2.0 Loaded image protocol definition.
3*f439973dSWarner Losh 
4*f439973dSWarner Losh   Every EFI driver and application is passed an image handle when it is loaded.
5*f439973dSWarner Losh   This image handle will contain a Loaded Image Protocol.
6*f439973dSWarner Losh 
7*f439973dSWarner Losh   Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
8*f439973dSWarner Losh   SPDX-License-Identifier: BSD-2-Clause-Patent
9*f439973dSWarner Losh 
10*f439973dSWarner Losh **/
11*f439973dSWarner Losh 
12*f439973dSWarner Losh #ifndef __LOADED_IMAGE_PROTOCOL_H__
13*f439973dSWarner Losh #define __LOADED_IMAGE_PROTOCOL_H__
14*f439973dSWarner Losh 
15*f439973dSWarner Losh #define EFI_LOADED_IMAGE_PROTOCOL_GUID \
16*f439973dSWarner Losh   { \
17*f439973dSWarner Losh     0x5B1B31A1, 0x9562, 0x11d2, {0x8E, 0x3F, 0x00, 0xA0, 0xC9, 0x69, 0x72, 0x3B } \
18*f439973dSWarner Losh   }
19*f439973dSWarner Losh 
20*f439973dSWarner Losh #define EFI_LOADED_IMAGE_DEVICE_PATH_PROTOCOL_GUID \
21*f439973dSWarner Losh   { \
22*f439973dSWarner Losh     0xbc62157e, 0x3e33, 0x4fec, {0x99, 0x20, 0x2d, 0x3b, 0x36, 0xd7, 0x50, 0xdf } \
23*f439973dSWarner Losh   }
24*f439973dSWarner Losh 
25*f439973dSWarner Losh ///
26*f439973dSWarner Losh /// Protocol GUID defined in EFI1.1.
27*f439973dSWarner Losh ///
28*f439973dSWarner Losh #define LOADED_IMAGE_PROTOCOL  EFI_LOADED_IMAGE_PROTOCOL_GUID
29*f439973dSWarner Losh 
30*f439973dSWarner Losh ///
31*f439973dSWarner Losh /// EFI_SYSTEM_TABLE & EFI_IMAGE_UNLOAD are defined in EfiApi.h
32*f439973dSWarner Losh ///
33*f439973dSWarner Losh #define EFI_LOADED_IMAGE_PROTOCOL_REVISION  0x1000
34*f439973dSWarner Losh 
35*f439973dSWarner Losh ///
36*f439973dSWarner Losh /// Revision defined in EFI1.1.
37*f439973dSWarner Losh ///
38*f439973dSWarner Losh #define EFI_LOADED_IMAGE_INFORMATION_REVISION  EFI_LOADED_IMAGE_PROTOCOL_REVISION
39*f439973dSWarner Losh 
40*f439973dSWarner Losh ///
41*f439973dSWarner Losh /// Can be used on any image handle to obtain information about the loaded image.
42*f439973dSWarner Losh ///
43*f439973dSWarner Losh typedef struct {
44*f439973dSWarner Losh   UINT32                      Revision;     ///< Defines the revision of the EFI_LOADED_IMAGE_PROTOCOL structure.
45*f439973dSWarner Losh                                             ///< All future revisions will be backward compatible to the current revision.
46*f439973dSWarner Losh   EFI_HANDLE                  ParentHandle; ///< Parent image's image handle. NULL if the image is loaded directly from
47*f439973dSWarner Losh                                             ///< the firmware's boot manager.
48*f439973dSWarner Losh   EFI_SYSTEM_TABLE            *SystemTable; ///< the image's EFI system table pointer.
49*f439973dSWarner Losh 
50*f439973dSWarner Losh   //
51*f439973dSWarner Losh   // Source location of image
52*f439973dSWarner Losh   //
53*f439973dSWarner Losh   EFI_HANDLE                  DeviceHandle; ///< The device handle that the EFI Image was loaded from.
54*f439973dSWarner Losh   EFI_DEVICE_PATH_PROTOCOL    *FilePath;    ///< A pointer to the file path portion specific to DeviceHandle
55*f439973dSWarner Losh                                             ///< that the EFI Image was loaded from.
56*f439973dSWarner Losh   VOID                        *Reserved;    ///< Reserved. DO NOT USE.
57*f439973dSWarner Losh 
58*f439973dSWarner Losh   //
59*f439973dSWarner Losh   // Images load options
60*f439973dSWarner Losh   //
61*f439973dSWarner Losh   UINT32                      LoadOptionsSize; ///< The size in bytes of LoadOptions.
62*f439973dSWarner Losh   VOID                        *LoadOptions;    ///< A pointer to the image's binary load options.
63*f439973dSWarner Losh 
64*f439973dSWarner Losh   //
65*f439973dSWarner Losh   // Location of where image was loaded
66*f439973dSWarner Losh   //
67*f439973dSWarner Losh   VOID                        *ImageBase;    ///< The base address at which the image was loaded.
68*f439973dSWarner Losh   UINT64                      ImageSize;     ///< The size in bytes of the loaded image.
69*f439973dSWarner Losh   EFI_MEMORY_TYPE             ImageCodeType; ///< The memory type that the code sections were loaded as.
70*f439973dSWarner Losh   EFI_MEMORY_TYPE             ImageDataType; ///< The memory type that the data sections were loaded as.
71*f439973dSWarner Losh   EFI_IMAGE_UNLOAD            Unload;
72*f439973dSWarner Losh } EFI_LOADED_IMAGE_PROTOCOL;
73*f439973dSWarner Losh 
74*f439973dSWarner Losh //
75*f439973dSWarner Losh // For backward-compatible with EFI1.1.
76*f439973dSWarner Losh //
77*f439973dSWarner Losh typedef EFI_LOADED_IMAGE_PROTOCOL EFI_LOADED_IMAGE;
78*f439973dSWarner Losh 
79*f439973dSWarner Losh extern EFI_GUID  gEfiLoadedImageProtocolGuid;
80*f439973dSWarner Losh extern EFI_GUID  gEfiLoadedImageDevicePathProtocolGuid;
81*f439973dSWarner Losh 
82*f439973dSWarner Losh #endif
83