]> git.proxmox.com Git - mirror_edk2.git/blobdiff - IntelFrameworkPkg/Library/FrameworkHiiLib/HiiLib.c
Fix typo in comment.
[mirror_edk2.git] / IntelFrameworkPkg / Library / FrameworkHiiLib / HiiLib.c
index 9f572624a145e64cc70de47a8c0f4df2f852a8ca..f2edf44317a837b985bdd18288c7c9cfb7d51719 100644 (file)
@@ -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:  HiiLib.c\r
-\r
 **/\r
 \r
 \r
 \r
 #include <Protocol/FrameworkHii.h>\r
 \r
-\r
 #include <Library/FrameworkHiiLib.h>\r
 #include <Library/DebugLib.h>\r
 #include <Library/MemoryAllocationLib.h>\r
 #include <Library/UefiBootServicesTableLib.h>\r
 #include <Library/BaseMemoryLib.h>\r
 \r
+\r
 EFI_HII_PROTOCOL *mHii = NULL;\r
 \r
+/**\r
+  Library constustor function for HiiLib library instance locate the\r
+  gEfiHiiProtocolGuid firstly, the other interface in this library\r
+  instance will dependent on the protocol of gEfiHiiProtocolGuid.\r
+  So the depex of gEfiHiiProtocolGuid is required for this library \r
+  instance.\r
+  If protocol of gEfiHiiProtocolGuid is not installed, then ASSERT().\r
+  \r
+  @param ImageHandle  The image handle of driver module who use this library \r
+                      instance.\r
+  @param SystemTable  Pointer to the EFI System Table.\r
+  @retval EFI_SUCCESS library constuctor always success.\r
+**/\r
 EFI_STATUS\r
 EFIAPI\r
 FrameworkHiiLibConstructor (\r
@@ -48,7 +59,18 @@ FrameworkHiiLibConstructor (
   return EFI_SUCCESS;\r
 }\r
 \r
-\r
+/**\r
+  This function is internal function that prepare and create\r
+  HII packages with given number and package's guid.\r
+  It is invoked by HiiAddPackages() and PreparePackages() interface.\r
+  If the parameter of package's number is 0, then ASSERT().\r
+  \r
+  @param NumberOfPackages  Given number of package item in a HII package list.\r
+  @param Guid              Given GUID of a HII package list.\r
+  @param Marker            Package's content list.\r
+  \r
+  @return pointer to new created HII package list.\r
+**/\r
 EFI_HII_PACKAGES *\r
 InternalPreparePackages (\r
   IN UINTN           NumberOfPackages,\r
@@ -78,7 +100,6 @@ InternalPreparePackages (
 \r
 }\r
 \r
-\r
 /**\r
   This function allocates pool for an EFI_HII_PACKAGES structure\r
   with enough space for the variable argument list of package pointers.\r
@@ -116,10 +137,11 @@ PreparePackages (
   Then, EFI_HII_PACKAGE_LIST will be register to the default System HII Database. The\r
   Handle to the newly registered Package List is returned throught HiiHandle.\r
 \r
-  @param  NumberOfPackages  The number of HII packages to register.\r
-  @param  GuidId                    Package List GUID ID.\r
+  @param  NumberOfPackages         The number of HII packages to register.\r
+  @param  GuidId                   Package List GUID ID.\r
+  @param  DriverHandle             The pointer of driver handle\r
   @param  HiiHandle                The ID used to retrieve the Package List later.\r
-  @param  ...                          The variable argument list describing all HII Package.\r
+  @param  ...                      The variable argument list describing all HII Package.\r
 \r
   @return\r
   The allocated and initialized packages.\r
@@ -159,42 +181,18 @@ HiiLibAddPackages (
   return Status;\r
 }\r
 \r
-EFI_STATUS\r
-EFIAPI\r
-HiiLibAddFontPackageToHiiDatabase (\r
-  IN       UINTN               FontSize,\r
-  IN CONST UINT8               *FontBinary,\r
-  IN CONST EFI_GUID            *GuidId,\r
-  OUT      EFI_HII_HANDLE      *HiiHandle OPTIONAL\r
-  )\r
-{\r
-  EFI_STATUS            Status;\r
-  EFI_HII_FONT_PACK     *FontPack;\r
-  UINT8                 *Location;\r
-\r
-  FontPack        = AllocateZeroPool (sizeof (EFI_HII_FONT_PACK) + FontSize);\r
-  ASSERT (FontPack != NULL);\r
-\r
-  FontPack->Header.Length         = (UINT32) (sizeof (EFI_HII_FONT_PACK) + FontSize);\r
-  FontPack->Header.Type           = EFI_HII_FONT;\r
-  FontPack->NumberOfNarrowGlyphs  = (UINT16) (FontSize / sizeof (EFI_NARROW_GLYPH));\r
-\r
-  Location                        = (UINT8 *) (&FontPack->NumberOfWideGlyphs + sizeof (UINT8));\r
-  CopyMem (Location, FontBinary, FontSize);\r
+/**\r
+  Removes a package list from the default HII database.\r
 \r
+  If HiiHandle is NULL, then ASSERT.\r
+  If HiiHandle is not a valid EFI_HII_HANDLE in the default HII database, then ASSERT.\r
 \r
-  //\r
-  // Register our Fonts into the global database\r
-  //\r
-  Status = HiiLibAddPackages (1, NULL, HiiHandle, NULL, FontPack);\r
-  //\r
-  // Free the font database\r
-  //\r
-  FreePool (FontPack);\r
+  @param  HiiHandle                The handle that was previously registered to the data base that is requested for removal.\r
+                                             List later.\r
 \r
-  return Status;  \r
-}\r
+  @return  VOID\r
 \r
+**/\r
 VOID\r
 EFIAPI\r
 HiiLibRemovePackages (\r
@@ -247,33 +245,22 @@ HiiLibNewString (
   return Status;\r
 }\r
 \r
+/**\r
+  Get the string given the StringId and String package Producer's Guid. The caller\r
+  is responsible to free the *String.\r
 \r
-EFI_STATUS\r
-EFIAPI\r
-HiiLibUpdateString (\r
-  IN  EFI_HII_HANDLE                  PackageList,\r
-  IN  EFI_STRING_ID                   StringId,\r
-  IN  CONST EFI_STRING                String\r
-  )\r
-{\r
-  FRAMEWORK_EFI_HII_HANDLE  FrameworkHiiHandle;\r
-  EFI_STATUS                Status;\r
+  If PackageList with the matching ProducerGuid is not found, then ASSERT.\r
+  If PackageList with the matching ProducerGuid is found but no String is\r
+  specified by StringId is found, then ASSERT.\r
 \r
-  FrameworkHiiHandle = (FRAMEWORK_EFI_HII_HANDLE) (UINTN) PackageList;\r
-  Status = mHii->NewString (\r
-            mHii,\r
-            NULL,\r
-            FrameworkHiiHandle,\r
-            &StringId,\r
-            String\r
-          );\r
+  @param  ProducerGuid           The Guid of String package list.\r
+  @param  StringId               The String ID.\r
+  @param  String                 The output string.\r
 \r
-  return Status;\r
-}\r
+  @retval EFI_SUCCESS            Operation is successful.\r
+  @retval EFI_OUT_OF_RESOURCES   There is not enought memory in the system.\r
 \r
-//\r
-// Just use the UEFI prototype\r
-//\r
+**/\r
 EFI_STATUS\r
 EFIAPI\r
 HiiLibGetStringFromToken (\r
@@ -285,9 +272,24 @@ HiiLibGetStringFromToken (
   return EFI_SUCCESS;  \r
 }\r
 \r
-//\r
-// Just use the UEFI prototype\r
-//\r
+/**\r
+  Get string specified by StringId form the HiiHandle. The caller\r
+  is responsible to free the *String.\r
+\r
+  If String is NULL, then ASSERT.\r
+  If HiiHandle could not be found in the default HII database, then ASSERT.\r
+  If StringId is not found in PackageList, then ASSERT.\r
+\r
+  @param  PackageList            The HII handle of package list.\r
+  @param  StringId               The String ID.\r
+  @param  String                 The output string.\r
+\r
+  @retval EFI_NOT_FOUND          String is not found.\r
+  @retval EFI_SUCCESS            Operation is successful.\r
+  @retval EFI_OUT_OF_RESOURCES   There is not enought memory in the system.\r
+  @retval EFI_INVALID_PARAMETER  The String is NULL.\r
+\r
+**/\r
 EFI_STATUS\r
 EFIAPI\r
 HiiLibGetStringFromHandle (\r
@@ -299,9 +301,16 @@ HiiLibGetStringFromHandle (
   return EFI_SUCCESS;\r
 }\r
 \r
-//\r
-// Just use the UEFI prototype\r
-//\r
+/**\r
+  Create the driver handle for HII driver. The protocol and \r
+  Package list of this driver wili be installed into this \r
+  driver handle. \r
+  The implement set DriverHandle to NULL simpliy to let \r
+  handle manager create a default new handle.\r
+  \r
+  @param[out] DriverHandle the pointer of driver handle\r
+  @return always successful.\r
+**/\r
 EFI_STATUS\r
 EFIAPI\r
 HiiLibCreateHiiDriverHandle (\r