]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdePkg/Include/Library/UefiLib.h
Second set of changes based on a review of the code comments in the Include directory...
[mirror_edk2.git] / MdePkg / Include / Library / UefiLib.h
index 354cf3192c714a2dc38de2104012ec7f7689a46d..56352dbf30bc5e68a0608c0d79bf174cb09d153d 100644 (file)
@@ -62,7 +62,7 @@ typedef struct {
   Macro that returns the number of 100 ns units for a specified number of microseconds.\r
   Useful for managing EFI timer events.\r
 \r
-  @param  Microseconds           Number of microseonds.\r
+  @param  Microseconds           Number of microseconds.\r
 \r
   @return The number of 100 ns units equivalent to the number of microseconds specified\r
           by Microseconds.\r
@@ -71,7 +71,7 @@ typedef struct {
 #define EFI_TIMER_PERIOD_MICROSECONDS(Microseconds) MultU64x32((UINT64)(Microseconds), 10)\r
 \r
 /**\r
-  Macro that returns the number of 100 ns units for a specified number of milliseoconds.\r
+  Macro that returns the number of 100 ns units for a specified number of milliseconds.\r
   Useful for managing EFI timer events.\r
 \r
   @param  Milliseconds           Number of milliseconds.\r
@@ -83,7 +83,7 @@ typedef struct {
 #define EFI_TIMER_PERIOD_MILLISECONDS(Milliseconds) MultU64x32((UINT64)(Milliseconds), 10000)\r
 \r
 /**\r
-  Macro that returns the number of 100 ns units for a specified number of seoconds.\r
+  Macro that returns the number of 100 ns units for a specified number of seconds.\r
   Useful for managing EFI timer events.\r
 \r
   @param  Seconds                Number of seconds.\r
@@ -113,8 +113,8 @@ typedef struct {
   based on a specified GUID.\r
   \r
   This function searches the list of configuration tables stored in the EFI System Table\r
-  for a table with a GUID that matches TableGuid.  If a match is found, then a pointer to\r
-  the configuration table is returned in Table., and EFI_SUCCESS is returned. If a matching GUID\r
+  for a table with a GUID that matches TableGuid. If a match is found, then a pointer to\r
+  the configuration table is returned in Table, and EFI_SUCCESS is returned. If a matching GUID\r
   is not found, then EFI_NOT_FOUND is returned.\r
   If TableGuid is NULL, then ASSERT().\r
   If Table is NULL, then ASSERT().\r
@@ -138,15 +138,17 @@ EfiGetSystemConfigurationTable (
   instances specified by ProtocolGuid.\r
 \r
   This function causes the notification function to be executed for every protocol of type\r
-  ProtocolGuid instance that exists in the system when this function is invoked.\r
-  In addition, every time a protocol of type ProtocolGuid instance is installed or reinstalled,\r
-  the notification function is also executed.  This function returns the notification event\r
-  that was created. \r
+  ProtocolGuid instance that exists in the system when this function is invoked. If there are\r
+  no instances of ProtocolGuid in the handle database at the time this function is invoked,\r
+  then the notification function is still executed one time. In addition, every time a protocol\r
+  of type ProtocolGuid instance is installed or reinstalled, the notification function is also\r
+  executed. This function returns the notification event that was created. \r
   If ProtocolGuid is NULL, then ASSERT().\r
   If NotifyTpl is not a legal TPL value, then ASSERT().\r
   If NotifyFunction is NULL, then ASSERT().\r
   If Registration is NULL, then ASSERT().\r
 \r
+\r
   @param  ProtocolGuid    Supplies GUID of the protocol upon whose installation the event is fired.\r
   @param  NotifyTpl       Supplies the task priority level of the event notifications.\r
   @param  NotifyFunction  Supplies the function to notify when the event is signaled.\r
@@ -376,9 +378,9 @@ EfiReleaseLock (
                                function.\r
 \r
   @retval EFI_SUCCESS          ControllerHandle is managed by the driver\r
-                               specifed by DriverBindingHandle.\r
+                               specified by DriverBindingHandle.\r
   @retval EFI_UNSUPPORTED      ControllerHandle is not managed by the driver\r
-                               specifed by DriverBindingHandle.\r
+                               specified by DriverBindingHandle.\r
 \r
 **/\r
 EFI_STATUS\r
@@ -434,7 +436,7 @@ EfiTestChildHandle (
 \r
   @retval EFI_SUCCESS             The Unicode string that matches the language \r
                                   specified by Language was found\r
-                                  in the table of Unicoide strings UnicodeStringTable, \r
+                                  in the table of Unicode strings UnicodeStringTable, \r
                                   and it was returned in UnicodeString.\r
   @retval EFI_INVALID_PARAMETER   Language is NULL.\r
   @retval EFI_INVALID_PARAMETER   UnicodeString is NULL.\r
@@ -466,7 +468,7 @@ LookupUnicodeString (
                                RFC 4646 language code for the Unicode string to look up and\r
                                return. If Iso639Language is TRUE, then this ASCII string is\r
                                not assumed to be Null-terminated, and only the first three\r
-                               chacters are used. If Iso639Language is FALSE, then this ASCII\r
+                               characters are used. If Iso639Language is FALSE, then this ASCII\r
                                string must be Null-terminated. \r
   @param  SupportedLanguages   A pointer to a Null-terminated ASCII string that contains a\r
                                set of ISO 639-2 or RFC 4646 language codes that the Unicode\r
@@ -617,6 +619,129 @@ FreeUnicodeStringTable (
   IN EFI_UNICODE_STRING_TABLE  *UnicodeStringTable\r
   );\r
 \r
+\r
+/**\r
+  Returns a pointer to an allocated buffer that contains the contents of a \r
+  variable retrieved through the UEFI Runtime Service GetVariable().  The \r
+  returned buffer is allocated using AllocatePool().  The caller is responsible\r
+  for freeing this buffer with FreePool().\r
+\r
+  If Name is NULL, then ASSERT().\r
+  If Guid is NULL, then ASSERT().\r
+\r
+  @param[in]  Name  Pointer to a Null-terminated Unicode string.\r
+  @param[in]  Guid  Pointer to an EFI_GUID structure\r
+\r
+  @retval NULL   The variable could not be retrieved.\r
+  @retval NULL   There are not enough resources available for the variable contents.\r
+  @retval Other  A pointer to allocated buffer containing the variable contents.\r
+\r
+**/\r
+VOID *\r
+EFIAPI\r
+GetVariable (\r
+  IN CONST CHAR16    *Name,\r
+  IN CONST EFI_GUID  *Guid\r
+  );\r
+\r
+/**\r
+  Returns a pointer to an allocated buffer that contains the contents of a \r
+  variable retrieved through the UEFI Runtime Service GetVariable().  This \r
+  function always uses the EFI_GLOBAL_VARIABLE GUID to retrieve variables.\r
+  The returned buffer is allocated using AllocatePool().  The caller is \r
+  responsible for freeing this buffer with FreePool().\r
+\r
+  If Name is NULL, then ASSERT().\r
+\r
+  @param[in]  Name  Pointer to a Null-terminated Unicode string.\r
+\r
+  @retval NULL   The variable could not be retrieved.\r
+  @retval NULL   There are not enough resources available for the variable contents.\r
+  @retval Other  A pointer to allocated buffer containing the variable contents.\r
+\r
+**/\r
+VOID *\r
+EFIAPI\r
+GetEfiGlobalVariable (\r
+  IN CONST CHAR16  *Name\r
+  );\r
+\r
+\r
+/**\r
+  Returns a pointer to an allocated buffer that contains the best matching language \r
+  from a set of supported languages.  \r
+  \r
+  This function supports both ISO 639-2 and RFC 4646 language codes, but language \r
+  code types may not be mixed in a single call to this function.  The language \r
+  code returned is allocated using AllocatePool().  The caller is responsible for \r
+  freeing the allocated buffer using FreePool().  This function supports a variable\r
+  argument list that allows the caller to pass in a prioritized list of language \r
+  codes to test against all the language codes in SupportedLanguages. \r
+\r
+  If SupportedLanguages is NULL, then ASSERT().\r
+\r
+  @param[in]  SupportedLanguages  A pointer to a Null-terminated ASCII string that\r
+                                  contains a set of language codes in the format \r
+                                  specified by Iso639Language.\r
+  @param[in]  Iso639Language      If TRUE, then all language codes are assumed to be\r
+                                  in ISO 639-2 format.  If FALSE, then all language\r
+                                  codes are assumed to be in RFC 4646 language format\r
+  @param[in]  ...                 A variable argument list that contains pointers to \r
+                                  Null-terminated ASCII strings that contain one or more\r
+                                  language codes in the format specified by Iso639Language.\r
+                                  The first language code from each of these language\r
+                                  code lists is used to determine if it is an exact or\r
+                                  close match to any of the language codes in \r
+                                  SupportedLanguages.  Close matches only apply to RFC 4646\r
+                                  language codes, and the matching algorithm from RFC 4647\r
+                                  is used to determine if a close match is present.  If \r
+                                  an exact or close match is found, then the matching\r
+                                  language code from SupportedLanguages is returned.  If\r
+                                  no matches are found, then the next variable argument\r
+                                  parameter is evaluated.  The variable argument list \r
+                                  is terminated by a NULL.\r
+\r
+  @retval NULL   The best matching language could not be found in SupportedLanguages.\r
+  @retval NULL   There are not enough resources available to return the best matching \r
+                 language.\r
+  @retval Other  A pointer to a Null-terminated ASCII string that is the best matching \r
+                 language in SupportedLanguages.\r
+\r
+**/\r
+CHAR8 *\r
+EFIAPI\r
+GetBestLanguage (\r
+  IN CONST CHAR8  *SupportedLanguages, \r
+  IN BOOLEAN      Iso639Language,\r
+  ...\r
+  );\r
+\r
+/**\r
+  Draws a dialog box to the console output device specified by \r
+  ConOut defined in the EFI_SYSTEM_TABLE and waits for a keystroke\r
+  from the console input device specified by ConIn defined in the \r
+  EFI_SYSTEM_TABLE.\r
+\r
+  If there are no strings in the variable argument list, then ASSERT().\r
+  If all the strings in the variable argument list are empty, then ASSERT().\r
+\r
+  @param[in]   Attribute  Specifies the foreground and background color of the popup.\r
+  @param[out]  Key        A pointer to the EFI_KEY value of the key that was \r
+                          pressed.  This is an optional parameter that may be NULL.\r
+                          If it is NULL then no wait for a keypress will be performed.\r
+  @param[in]  ...         The variable argument list that contains pointers to Null-\r
+                          terminated Unicode strings to display in the dialog box.  \r
+                          The variable argument list is terminated by a NULL.\r
+\r
+**/\r
+VOID\r
+EFIAPI\r
+CreatePopUp (\r
+  IN  UINTN          Attribute,                \r
+  OUT EFI_INPUT_KEY  *Key,      OPTIONAL\r
+  ...\r
+  );\r
+\r
 /**\r
   Retrieves the width of a Unicode character.\r
 \r
@@ -823,7 +948,7 @@ EfiInitializeFwVolDevicepathNode (
   This library function abstracts validating a device path node.\r
   Check the MEDIA_FW_VOL_FILEPATH_DEVICE_PATH data structure to see if it's valid.  \r
   If it is valid, then return the GUID file name from the device path node.  Otherwise, \r
-  return NULL.  This device path changed in the DXE CIS version 0.92 in a non back ward \r
+  return NULL.  This device path changed in the DXE CIS version 0.92 in a non backward \r
   compatible way to not conflict with the UEFI 2.0 specification.  This function abstracts \r
   the differences from the caller.\r
   If FvDevicePathNode is NULL, then ASSERT().\r
@@ -942,14 +1067,16 @@ AsciiErrorPrint (
   ...\r
   );\r
 \r
+\r
 /**\r
   Prints a formatted Unicode string to a graphics console device specified by \r
   ConsoleOutputHandle defined in the EFI_SYSTEM_TABLE at the given (X,Y) coordinates.\r
 \r
   This function prints a formatted Unicode string to the graphics console device \r
   specified by ConsoleOutputHandle in EFI_SYSTEM_TABLE and returns the number of \r
-  Unicode characters printed.  If the length of the formatted Unicode string is\r
-  greater than PcdUefiLibMaxPrintBufferSize, then only the first \r
+  Unicode characters displayed, not including partial characters that may be clipped \r
+  by the right edge of the display.  If the length of the formatted Unicode string is\r
+  greater than PcdUefiLibMaxPrintBufferSize, then at most the first \r
   PcdUefiLibMaxPrintBufferSize characters are printed.  The EFI_HII_FONT_PROTOCOL\r
   is used to convert the string to a bitmap using the glyphs registered with the \r
   HII database.  No wrapping is performed, so any portions of the string the fall\r
@@ -962,9 +1089,9 @@ AsciiErrorPrint (
   If Format is NULL, then ASSERT().\r
   If Format is not aligned on a 16-bit boundary, then ASSERT().\r
 \r
-  @param  X            X coordinate to print the string.\r
-  @param  Y            Y coordinate to print the string.\r
-  @param  ForeGround   The forground color of the string being printed.  This is\r
+  @param  PointX       X coordinate to print the string.\r
+  @param  PointY       Y coordinate to print the string.\r
+  @param  ForeGround   The foreground color of the string being printed.  This is\r
                        an optional parameter that may be NULL.  If it is NULL,\r
                        then the foreground color of the current ConOut device\r
                        in the EFI_SYSTEM_TABLE is used.\r
@@ -983,8 +1110,8 @@ AsciiErrorPrint (
 UINTN\r
 EFIAPI\r
 PrintXY (\r
-  IN UINTN                            X,\r
-  IN UINTN                            Y,\r
+  IN UINTN                            PointX,\r
+  IN UINTN                            PointY,\r
   IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL    *ForeGround, OPTIONAL\r
   IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL    *BackGround, OPTIONAL\r
   IN CONST CHAR16                     *Format,\r
@@ -997,8 +1124,9 @@ PrintXY (
 \r
   This function prints a formatted ASCII string to the graphics console device \r
   specified by ConsoleOutputHandle in EFI_SYSTEM_TABLE and returns the number of \r
-  ASCII characters printed.  If the length of the formatted ASCII string is\r
-  greater than PcdUefiLibMaxPrintBufferSize, then only the first \r
+  ASCII characters displayed, not including partial characters that may be clipped \r
+  by the right edge of the display.  If the length of the formatted ASCII string is\r
+  greater than PcdUefiLibMaxPrintBufferSize, then at most the first \r
   PcdUefiLibMaxPrintBufferSize characters are printed.  The EFI_HII_FONT_PROTOCOL\r
   is used to convert the string to a bitmap using the glyphs registered with the \r
   HII database.  No wrapping is performed, so any portions of the string the fall\r
@@ -1010,9 +1138,9 @@ PrintXY (
   string is printed, and 0 is returned.\r
   If Format is NULL, then ASSERT().\r
 \r
-  @param  X            X coordinate to print the string.\r
-  @param  Y            Y coordinate to print the string.\r
-  @param  ForeGround   The forground color of the string being printed.  This is\r
+  @param  PointX       X coordinate to print the string.\r
+  @param  PointY       Y coordinate to print the string.\r
+  @param  ForeGround   The foreground color of the string being printed.  This is\r
                        an optional parameter that may be NULL.  If it is NULL,\r
                        then the foreground color of the current ConOut device\r
                        in the EFI_SYSTEM_TABLE is used.\r
@@ -1031,8 +1159,8 @@ PrintXY (
 UINTN\r
 EFIAPI\r
 AsciiPrintXY (\r
-  IN UINTN                            X,\r
-  IN UINTN                            Y,\r
+  IN UINTN                            PointX,\r
+  IN UINTN                            PointY,\r
   IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL    *ForeGround, OPTIONAL\r
   IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL    *BackGround, OPTIONAL\r
   IN CONST CHAR8                      *Format,\r
@@ -1078,7 +1206,7 @@ EfiLibInstallDriverBinding (
   Initializes a driver by installing the Driver Binding Protocol together with the\r
   optional Component Name, optional Driver Configure and optional Driver Diagnostic\r
   Protocols onto the driver's DriverBindingHandle. If DriverBindingHandle is NULL,\r
-  then the protocols are  installed onto a newly created handle. DriverBindingHandle\r
+  then the protocols are installed onto a newly created handle. DriverBindingHandle\r
   is typically the same as the driver's ImageHandle, but it can be different if the\r
   driver produces multiple Driver Binding Protocols. \r
   If DriverBinding is NULL, then ASSERT(). \r
@@ -1162,7 +1290,7 @@ EfiLibInstallDriverBindingComponentName2 (
   @param  ImageHandle           The image handle of the driver.\r
   @param  SystemTable           The EFI System Table that was passed to the driver's entry point.\r
   @param  DriverBinding         A Driver Binding Protocol instance that this driver is producing.\r
-  @param  DriverBindingHandle   The handle that DriverBinding is to be installe onto.  If this\r
+  @param  DriverBindingHandle   The handle that DriverBinding is to be installed onto.  If this\r
                                 parameter is NULL, then a new handle is created.\r
   @param  ComponentName         A Component Name Protocol instance that this driver is producing.\r
   @param  ComponentName2        A Component Name 2 Protocol instance that this driver is producing.\r
@@ -1185,7 +1313,7 @@ EfiLibInstallAllDriverProtocols2 (
   IN CONST EFI_COMPONENT_NAME_PROTOCOL        *ComponentName,        OPTIONAL\r
   IN CONST EFI_COMPONENT_NAME2_PROTOCOL       *ComponentName2,       OPTIONAL\r
   IN CONST EFI_DRIVER_CONFIGURATION_PROTOCOL  *DriverConfiguration,  OPTIONAL\r
-  IN CONST EFI_DRIVER_CONFIGURATION_PROTOCOL  *DriverConfiguration2, OPTIONAL\r
+  IN CONST EFI_DRIVER_CONFIGURATION2_PROTOCOL *DriverConfiguration2, OPTIONAL\r
   IN CONST EFI_DRIVER_DIAGNOSTICS_PROTOCOL    *DriverDiagnostics,    OPTIONAL\r
   IN CONST EFI_DRIVER_DIAGNOSTICS2_PROTOCOL   *DriverDiagnostics2    OPTIONAL\r
   );\r