]> git.proxmox.com Git - mirror_edk2.git/blame - MdePkg/Include/Protocol/Ebc.h
Code Scrub for Protocol and Ppi Definition
[mirror_edk2.git] / MdePkg / Include / Protocol / Ebc.h
CommitLineData
d1f95000 1/** @file\r
2 Describes the protocol interface to the EBC interpreter.\r
3\r
4ca9b6c4 4 Copyright (c) 2006 - 2008, Intel Corporation \r
d1f95000 5 All rights reserved. This program and the accompanying materials \r
6 are licensed and made available under the terms and conditions of the BSD License \r
7 which accompanies this distribution. The full text of the license may be found at \r
8 http://opensource.org/licenses/bsd-license.php \r
9\r
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, \r
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. \r
12\r
d1f95000 13**/\r
14\r
15#ifndef __EFI_EBC_PROTOCOL_H__\r
16#define __EFI_EBC_PROTOCOL_H__\r
17\r
18#define EFI_EBC_INTERPRETER_PROTOCOL_GUID \\r
19 { \\r
20 0x13AC6DD1, 0x73D0, 0x11D4, {0xB0, 0x6B, 0x00, 0xAA, 0x00, 0xBD, 0x6D, 0xE7 } \\r
21 }\r
22\r
23//\r
24// Protocol Guid Name defined in spec.\r
25//\r
26#define EFI_EBC_PROTOCOL_GUID EFI_EBC_INTERPRETER_PROTOCOL_GUID\r
27\r
28//\r
29// Define for forward reference.\r
30//\r
31typedef struct _EFI_EBC_PROTOCOL EFI_EBC_PROTOCOL;\r
32\r
33/**\r
4ca9b6c4
LG
34 Creates a thunk for an EBC entry point, returning the address of the thunk.\r
35 \r
36 A PE32+ EBC image, like any other PE32+ image, contains an optional header that specifies the\r
37 entry point for image execution. However for EBC images this is the entry point of EBC\r
38 instructions, so is not directly executable by the native processor. Therefore when an EBC image is\r
39 loaded, the loader must call this service to get a pointer to native code (thunk) that can be executed\r
40 which will invoke the interpreter to begin execution at the original EBC entry point.\r
41\r
42 @param This A pointer to the EFI_EBC_PROTOCOL instance.\r
43 @param ImageHandle Handle of image for which the thunk is being created.\r
44 @param EbcEntryPoint Address of the actual EBC entry point or protocol service the thunk should call.\r
45 @param Thunk Returned pointer to a thunk created.\r
46\r
47 @retval EFI_SUCCESS The function completed successfully.\r
48 @retval EFI_INVALID_PARAMETER Image entry point is not 2-byte aligned.\r
49 @retval EFI_OUT_OF_RESOURCES Memory could not be allocated for the thunk.\r
d1f95000 50**/\r
51typedef\r
52EFI_STATUS\r
8b13229b 53(EFIAPI *EFI_EBC_CREATE_THUNK)(\r
d1f95000 54 IN EFI_EBC_PROTOCOL *This,\r
55 IN EFI_HANDLE ImageHandle,\r
56 IN VOID *EbcEntryPoint,\r
57 OUT VOID **Thunk\r
58 );\r
59\r
60/**\r
4ca9b6c4 61 Called prior to unloading an EBC image from memory.\r
d1f95000 62\r
4ca9b6c4
LG
63 This function is called after an EBC image has exited, but before the image is actually unloaded. It\r
64 is intended to provide the interpreter with the opportunity to perform any cleanup that may be\r
65 necessary as a result of loading and executing the image.\r
d1f95000 66\r
4ca9b6c4
LG
67 @param This A pointer to the EFI_EBC_PROTOCOL instance.\r
68 @param ImageHandle Image handle of the EBC image that is being unloaded from memory.\r
d1f95000 69\r
4ca9b6c4
LG
70 @retval EFI_SUCCESS The function completed successfully.\r
71 @retval EFI_INVALID_PARAMETER Image handle is not recognized as belonging \r
72 to an EBC image that has been executed.\r
d1f95000 73**/\r
74typedef\r
75EFI_STATUS\r
8b13229b 76(EFIAPI *EFI_EBC_UNLOAD_IMAGE)(\r
d1f95000 77 IN EFI_EBC_PROTOCOL *This,\r
78 IN EFI_HANDLE ImageHandle\r
79 );\r
80\r
81/**\r
4ca9b6c4
LG
82 This is the prototype for the Flush callback routine. A pointer to a routine \r
83 of this type is passed to the EBC EFI_EBC_REGISTER_ICACHE_FLUSH protocol service.\r
d1f95000 84\r
4ca9b6c4
LG
85 @param Start The beginning physical address to flush from the processor's instruction cache.\r
86 @param Length The number of bytes to flush from the processor's instruction cache.\r
d1f95000 87\r
4ca9b6c4 88 @retval EFI_SUCCESS The function completed successfully.\r
d1f95000 89\r
90**/\r
91typedef\r
92EFI_STATUS\r
8b13229b 93(EFIAPI *EBC_ICACHE_FLUSH)(\r
d1f95000 94 IN EFI_PHYSICAL_ADDRESS Start,\r
95 IN UINT64 Length\r
96 );\r
97\r
98/**\r
99 This routine is called by the core firmware to provide the EBC driver with\r
100 a function to call to flush the CPU's instruction cache following creation\r
101 of a thunk. It is not required.\r
102\r
4ca9b6c4
LG
103 @param This A pointer to the EFI_EBC_PROTOCOL instance.\r
104 @param Flush Pointer to a function of type EBC_ICACH_FLUSH.\r
d1f95000 105\r
4ca9b6c4 106 @retval EFI_SUCCESS The function completed successfully.\r
d1f95000 107\r
108**/\r
109typedef\r
110EFI_STATUS\r
8b13229b 111(EFIAPI *EFI_EBC_REGISTER_ICACHE_FLUSH)(\r
d1f95000 112 IN EFI_EBC_PROTOCOL *This,\r
113 IN EBC_ICACHE_FLUSH Flush\r
114 );\r
115\r
116/**\r
4ca9b6c4
LG
117 Called to get the version of the interpreter.\r
118\r
119 This function is called to get the version of the loaded EBC interpreter. The value and format of the\r
120 returned version is identical to that returned by the EBC BREAK 1 instruction.\r
d1f95000 121\r
4ca9b6c4
LG
122 @param This A pointer to the EFI_EBC_PROTOCOL instance. \r
123 @param Version Pointer to where to store the returned version of the interpreter.\r
d1f95000 124\r
4ca9b6c4
LG
125 @retval EFI_SUCCESS The function completed successfully.\r
126 @retval EFI_INVALID_PARAMETER Version pointer is NULL.\r
d1f95000 127\r
128**/\r
129typedef\r
130EFI_STATUS\r
8b13229b 131(EFIAPI *EFI_EBC_GET_VERSION)(\r
d1f95000 132 IN EFI_EBC_PROTOCOL *This,\r
133 IN OUT UINT64 *Version\r
134 );\r
135\r
136//\r
137// Prototype for the actual EBC protocol interface\r
138//\r
4ca9b6c4
LG
139/**\r
140 This protocol provides the services that allow execution of EBC images.\r
141\r
142 @par Protocol Description:\r
143 The EFI EBC protocol provides services to load and execute EBC images, which will typically be\r
144 loaded into option ROMs. The image loader will load the EBC image, perform standard relocations,\r
145 and invoke the CreateThunk() service to create a thunk for the EBC image's entry point. The\r
146 image can then be run using the standard EFI start image services.\r
147\r
148 @param CreateThunk \r
149 Creates a thunk for an EBC image entry point or protocol service,\r
150 and returns a pointer to the thunk. \r
151 \r
152 @param UnloadImage \r
153 Called when an EBC image is unloaded to allow the interpreter to\r
154 perform any cleanup associated with the image execution. \r
155 \r
156 @param RegisterICacheFlush\r
157 Called to register a callback function that the EBC interpreter can\r
158 call to flush the processor instruction cache after creating thunks.\r
159 \r
160 @param GetVersion \r
161 Called to get the version of the associated EBC interpreter.\r
162\r
163**/\r
d1f95000 164struct _EFI_EBC_PROTOCOL {\r
165 EFI_EBC_CREATE_THUNK CreateThunk;\r
166 EFI_EBC_UNLOAD_IMAGE UnloadImage;\r
167 EFI_EBC_REGISTER_ICACHE_FLUSH RegisterICacheFlush;\r
168 EFI_EBC_GET_VERSION GetVersion;\r
169};\r
170\r
171//\r
172// Extern the global EBC protocol GUID\r
173//\r
174extern EFI_GUID gEfiEbcProtocolGuid;\r
175\r
176#endif\r