summaryrefslogtreecommitdiffstats
path: root/MdePkg/Include/Protocol/LoadedImage.h
blob: 6af6ef76bd7e4c036eed94332d04084e911632e0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
/** @file
  UEFI 2.0 Loaded image protocol definition.

  Every EFI driver and application is passed an image handle when it is loaded.
  This image handle will contain a Loaded Image Protocol.

  Copyright (c) 2006 - 2008, Intel Corporation                                                         
  All rights reserved. This program and the accompanying materials                          
  are licensed and made available under the terms and conditions of the BSD License         
  which accompanies this distribution.  The full text of the license may be found at        
  http://opensource.org/licenses/bsd-license.php                                            

  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,                     
  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.             

**/

#ifndef __LOADED_IMAGE_PROTOCOL_H__
#define __LOADED_IMAGE_PROTOCOL_H__

#include <Protocol/DevicePath.h>

#define EFI_LOADED_IMAGE_PROTOCOL_GUID \
  { \
    0x5B1B31A1, 0x9562, 0x11d2, {0x8E, 0x3F, 0x00, 0xA0, 0xC9, 0x69, 0x72, 0x3B } \
  }

#define EFI_LOADED_IMAGE_DEVICE_PATH_PROTOCOL_GUID \
  { \
    0xbc62157e, 0x3e33, 0x4fec, {0x99, 0x20, 0x2d, 0x3b, 0x36, 0xd7, 0x50, 0xdf } \
  }

///
/// Protocol GUID defined in EFI1.1.
/// 
#define LOADED_IMAGE_PROTOCOL   EFI_LOADED_IMAGE_PROTOCOL_GUID

///
/// EFI_SYSTEM_TABLE & EFI_IMAGE_UNLOAD are defined in EfiApi.h
///
#define EFI_LOADED_IMAGE_PROTOCOL_REVISION  0x1000

///
/// Revision defined in EFI1.1.
/// 
#define EFI_LOADED_IMAGE_INFORMATION_REVISION    EFI_LOADED_IMAGE_PROTOCOL_REVISION

/**  
  @par Protocol Description:
  Can be used on any image handle to obtain information about the loaded image.
**/
typedef struct {
  ///
  /// Defines the revision of the EFI_LOADED_IMAGE_PROTOCOL structure. 
  /// All future revisions will be backward compatible to the current revision.
  ///
  UINT32                    Revision;

  ///
  /// Parent image's image handle. NULL if the image is loaded directly from 
  /// the firmware's boot manager. 
  ///
  EFI_HANDLE                ParentHandle;
  EFI_SYSTEM_TABLE          *SystemTable;

  //
  // Source location of image
  //
  ///
  /// The device handle that the EFI Image was loaded from. 
  ///
  EFI_HANDLE                DeviceHandle;
  
  ///
  /// A pointer to the file path portion specific to DeviceHandle 
  /// that the EFI Image was loaded from. 
  ///
  EFI_DEVICE_PATH_PROTOCOL  *FilePath;
  VOID                      *Reserved;       ///< Reserved. DO NOT USE.

  //
  // Images load options
  //
  ///
  /// The size in bytes of LoadOptions.
  ///
  UINT32                    LoadOptionsSize;
  
  ///
  /// A pointer to the image's binary load options.
  ///
  VOID                      *LoadOptions;

  //
  // Location of where image was loaded
  //
  ///
  /// The base address at which the image was loaded.
  ///
  VOID                      *ImageBase;
  
  ///
  /// The size in bytes of the loaded image.
  ///
  UINT64                    ImageSize;
  EFI_MEMORY_TYPE           ImageCodeType;
  EFI_MEMORY_TYPE           ImageDataType;

  //
  // If the driver image supports a dynamic unload request
  //
  EFI_IMAGE_UNLOAD          Unload;

} EFI_LOADED_IMAGE_PROTOCOL;

//
// For backward-compatible with EFI1.1.
// 
typedef EFI_LOADED_IMAGE_PROTOCOL EFI_LOADED_IMAGE;

extern EFI_GUID gEfiLoadedImageProtocolGuid;
extern EFI_GUID gEfiLoadedImageDevicePathProtocolGuid;

#endif