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