]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdePkg/Include/Protocol/Ebc.h
Formalize comments for Protocols and PPIs.
[mirror_edk2.git] / MdePkg / Include / Protocol / Ebc.h
index c1abcbac5b21f1139008998eb92c65fd25ea0430..b67cda97c03c3f851e266f5d0cf5eeb1c3939d71 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   Describes the protocol interface to the EBC interpreter.\r
 \r
-  Copyright (c) 2006, Intel Corporation                                                         \r
+  Copyright (c) 2006 - 2008, Intel Corporation                                                         \r
   All rights reserved. This program and the accompanying materials                          \r
   are licensed and made available under the terms and conditions of the BSD License         \r
   which accompanies this distribution.  The full text of the license may be found at        \r
@@ -10,8 +10,6 @@
   THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,                     \r
   WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.             \r
 \r
-  Module Name:  Ebc.h\r
-\r
 **/\r
 \r
 #ifndef __EFI_EBC_PROTOCOL_H__\r
     0x13AC6DD1, 0x73D0, 0x11D4, {0xB0, 0x6B, 0x00, 0xAA, 0x00, 0xBD, 0x6D, 0xE7 } \\r
   }\r
 \r
-//\r
-// Protocol Guid Name defined in spec.\r
-//\r
+///\r
+/// Protocol Guid Name defined in spec.\r
+///\r
 #define EFI_EBC_PROTOCOL_GUID EFI_EBC_INTERPRETER_PROTOCOL_GUID\r
 \r
-//\r
-// Define for forward reference.\r
-//\r
+///\r
+/// Define for forward reference.\r
+///\r
 typedef struct _EFI_EBC_PROTOCOL EFI_EBC_PROTOCOL;\r
 \r
 /**\r
-  Create a thunk for an image entry point. In short, given the physical address\r
-  of the entry point for a loaded image, create a thunk that does some \r
-  fixup of arguments (and perform any other necessary overhead) and then\r
-  calls the original entry point. The caller can then use the returned pointer\r
-  to the created thunk as the new entry point to image.\r
-\r
-  @param  This          protocol instance pointer\r
-  @param  ImageHandle   handle to the image. The EBC interpreter may use this to keep\r
-                        track of any resource allocations performed in loading and\r
-                        executing the image.\r
-  @param  EbcEntryPoint the entry point for the image (as defined in the file header)\r
-  @param  Thunk pointer to thunk pointer where the address of the created\r
-                        thunk is returned.\r
-\r
-  @return Standard EFI_STATUS\r
-\r
+  Creates a thunk for an EBC entry point, returning the address of the thunk.\r
+  \r
+  A PE32+ EBC image, like any other PE32+ image, contains an optional header that specifies the\r
+  entry point for image execution. However for EBC images this is the entry point of EBC\r
+  instructions, so is not directly executable by the native processor. Therefore when an EBC image is\r
+  loaded, the loader must call this service to get a pointer to native code (thunk) that can be executed\r
+  which will invoke the interpreter to begin execution at the original EBC entry point.\r
+\r
+  @param  This          A pointer to the EFI_EBC_PROTOCOL instance.\r
+  @param  ImageHandle   Handle of image for which the thunk is being created.\r
+  @param  EbcEntryPoint Address of the actual EBC entry point or protocol service the thunk should call.\r
+  @param  Thunk         Returned pointer to a thunk created.\r
+\r
+  @retval EFI_SUCCESS            The function completed successfully.\r
+  @retval EFI_INVALID_PARAMETER  Image entry point is not 2-byte aligned.\r
+  @retval EFI_OUT_OF_RESOURCES   Memory could not be allocated for the thunk.\r
 **/\r
 typedef\r
 EFI_STATUS\r
-(EFIAPI *EFI_EBC_CREATE_THUNK) (\r
+(EFIAPI *EFI_EBC_CREATE_THUNK)(\r
   IN EFI_EBC_PROTOCOL           *This,\r
   IN EFI_HANDLE                 ImageHandle,\r
   IN VOID                       *EbcEntryPoint,\r
@@ -60,36 +58,39 @@ EFI_STATUS
   );\r
 \r
 /**\r
-  Perform any cleanup necessary when an image is unloaded. Basically it gives\r
-  the EBC interpreter the chance to free up any resources allocated during\r
-  load and execution of an EBC image.\r
+  Called prior to unloading an EBC image from memory.\r
 \r
-  @param  This        protocol instance pointer\r
-  @param  ImageHandle the handle of the image being unloaded.\r
+  This function is called after an EBC image has exited, but before the image is actually unloaded. It\r
+  is intended to provide the interpreter with the opportunity to perform any cleanup that may be\r
+  necessary as a result of loading and executing the image.\r
 \r
-  @return Standard EFI_STATUS.\r
+  @param  This          A pointer to the EFI_EBC_PROTOCOL instance.\r
+  @param  ImageHandle   Image handle of the EBC image that is being unloaded from memory.\r
 \r
+  @retval EFI_SUCCESS            The function completed successfully.\r
+  @retval EFI_INVALID_PARAMETER  Image handle is not recognized as belonging \r
+                                 to an EBC image that has been executed.\r
 **/\r
 typedef\r
 EFI_STATUS\r
-(EFIAPI *EFI_EBC_UNLOAD_IMAGE) (\r
+(EFIAPI *EFI_EBC_UNLOAD_IMAGE)(\r
   IN EFI_EBC_PROTOCOL           *This,\r
   IN EFI_HANDLE                 ImageHandle\r
   );\r
 \r
 /**\r
-  The I-Cache-flush registration service takes a pointer to a function to\r
-  call to flush the I-Cache. Here's the prototype for that function pointer.\r
+  This is the prototype for the Flush callback routine. A pointer to a routine \r
+  of this type is passed to the EBC EFI_EBC_REGISTER_ICACHE_FLUSH protocol service.\r
 \r
-  @param  Start  physical start address of CPU instruction cache to flush.\r
-  @param  Length how many bytes to flush of the instruction cache.\r
+  @param  Start  The beginning physical address to flush from the processor's instruction cache.\r
+  @param  Length The number of bytes to flush from the processor's instruction cache.\r
 \r
-  @return Standard EFI_STATUS.\r
+  @retval EFI_SUCCESS            The function completed successfully.\r
 \r
 **/\r
 typedef\r
 EFI_STATUS\r
-(EFIAPI *EBC_ICACHE_FLUSH) (\r
+(EFIAPI *EBC_ICACHE_FLUSH)(\r
   IN EFI_PHYSICAL_ADDRESS     Start,\r
   IN UINT64                   Length\r
   );\r
@@ -99,40 +100,45 @@ EFI_STATUS
   a function to call to flush the CPU's instruction cache following creation\r
   of a thunk. It is not required.\r
 \r
-  @param  This  protocol instance pointer\r
-  @param  Flush pointer to the function to call to flush the CPU instruction\r
-  cache.\r
+  @param  This       A pointer to the EFI_EBC_PROTOCOL instance.\r
+  @param  Flush      Pointer to a function of type EBC_ICACH_FLUSH.\r
 \r
-  @return Standard EFI_STATUS.\r
+  @retval EFI_SUCCESS            The function completed successfully.\r
 \r
 **/\r
 typedef\r
 EFI_STATUS\r
-(EFIAPI *EFI_EBC_REGISTER_ICACHE_FLUSH) (\r
+(EFIAPI *EFI_EBC_REGISTER_ICACHE_FLUSH)(\r
   IN EFI_EBC_PROTOCOL           *This,\r
   IN EBC_ICACHE_FLUSH           Flush\r
   );\r
 \r
 /**\r
-  This routine can be called to get the VM revision. It returns the same\r
-  value as the EBC BREAK 1 instruction returns.\r
+  Called to get the version of the interpreter.\r
+\r
+  This function is called to get the version of the loaded EBC interpreter. The value and format of the\r
+  returned version is identical to that returned by the EBC BREAK 1 instruction.\r
 \r
-  @param  This    protocol instance pointer\r
-  @param  Version pointer to where to return the VM version\r
+  @param  This       A pointer to the EFI_EBC_PROTOCOL instance.  \r
+  @param  Version Pointer to where to store the returned version of the interpreter.\r
 \r
-  @return Standard EFI_STATUS.\r
+  @retval EFI_SUCCESS            The function completed successfully.\r
+  @retval EFI_INVALID_PARAMETER  Version pointer is NULL.\r
 \r
 **/\r
 typedef\r
 EFI_STATUS\r
-(EFIAPI *EFI_EBC_GET_VERSION) (\r
+(EFIAPI *EFI_EBC_GET_VERSION)(\r
   IN EFI_EBC_PROTOCOL           *This,\r
   IN OUT UINT64                 *Version\r
   );\r
 \r
-//\r
-// Prototype for the actual EBC protocol interface\r
-//\r
+///\r
+/// The EFI EBC protocol provides services to load and execute EBC images, which will typically be\r
+/// loaded into option ROMs. The image loader will load the EBC image, perform standard relocations,\r
+/// and invoke the CreateThunk() service to create a thunk for the EBC image's entry point. The\r
+/// image can then be run using the standard EFI start image services.\r
+///\r
 struct _EFI_EBC_PROTOCOL {\r
   EFI_EBC_CREATE_THUNK          CreateThunk;\r
   EFI_EBC_UNLOAD_IMAGE          UnloadImage;\r