]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Library/UefiHiiLib/HiiLib.c
EDK II Packages: Add Contributions.txt and License.txt files
[mirror_edk2.git] / MdeModulePkg / Library / UefiHiiLib / HiiLib.c
index 2ad85ad75ea550d7cdf353e43bf5e06166d26d31..7a2415e9e5e65e60d3ff3533a0208a7e62e8bf54 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   HII Library implementation that uses DXE protocols and services.\r
 \r
-  Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>\r
+  Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR>\r
   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
@@ -129,7 +129,7 @@ InternalHiiExtractGuidFromHiiHandle (
                                to packages terminated by a NULL.\r
 \r
   @retval NULL   A HII Handle has already been registered in the HII Database with\r
-                 the same PackageListGuid.\r
+                 the same PackageListGuid and DeviceHandle.\r
   @retval NULL   The HII Handle could not be created.\r
   @retval NULL   An empty list of packages was passed in.\r
   @retval NULL   All packages are empty.\r
@@ -1411,7 +1411,7 @@ InternalHiiValidateCurrentSetting (
           // Get Offset by Question header\r
           //\r
           Offset = IfrCheckBox->Question.VarStoreInfo.VarOffset;\r
-          Width  = sizeof (BOOLEAN);\r
+          Width  = (UINT16) sizeof (BOOLEAN);\r
           //\r
           // Check whether this question is in current block array.\r
           //\r
@@ -1629,18 +1629,12 @@ InternalHiiIfrValueAction (
   UINT32         Index;\r
   EFI_GUID       *VarGuid;\r
   EFI_STRING     VarName;\r
-  EFI_STRING_ID  DefaultName;\r
 \r
-  UINT8                        *PackageData;\r
-  UINTN                        IfrOffset;\r
-  EFI_IFR_OP_HEADER            *IfrOpHdr;\r
   EFI_HII_PACKAGE_LIST_HEADER  *HiiPackageList;\r
-  UINT32                       PackageOffset;  \r
   UINTN                        PackageListLength;\r
-  EFI_HII_PACKAGE_HEADER       PacakgeHeader;\r
   EFI_DEVICE_PATH_PROTOCOL     *DevicePath;\r
   EFI_DEVICE_PATH_PROTOCOL     *TempDevicePath;\r
-  \r
+\r
   ConfigAltResp = NULL;\r
   ConfigResp    = NULL;\r
   VarGuid       = NULL;\r
@@ -1651,7 +1645,6 @@ InternalHiiIfrValueAction (
   Index            = 0;\r
   TempDriverHandle = NULL;\r
   HiiHandle        = NULL;\r
-  PackageData      = NULL;\r
   HiiPackageList   = NULL;\r
   \r
   //\r
@@ -1772,13 +1765,9 @@ InternalHiiIfrValueAction (
            Status = EFI_SUCCESS;\r
       goto NextConfigAltResp;\r
     }\r
-    \r
-    //\r
-    // 2. Get DefaultName string ID by parsing the PacakgeList \r
-    //\r
 \r
     //\r
-    // Get HiiPackage by HiiHandle\r
+    // 2. Get HiiPackage by HiiHandle\r
     //\r
     PackageListLength  = 0;\r
     HiiPackageList     = NULL;\r
@@ -1806,59 +1795,9 @@ InternalHiiIfrValueAction (
       goto Done;\r
     }\r
     \r
-    //\r
-    // Parse the form package and get the default name string ID.\r
-    //\r
-    if (ActionType == ACTION_SET_DEFAUTL_VALUE) {\r
-      PackageOffset = sizeof (EFI_HII_PACKAGE_LIST_HEADER);\r
-      Status = EFI_NOT_FOUND;\r
-      while (PackageOffset < PackageListLength) {\r
-        CopyMem (&PacakgeHeader, (UINT8 *) HiiPackageList + PackageOffset, sizeof (PacakgeHeader));\r
-        \r
-        //\r
-        // Parse IFR opcode to get default store opcode\r
-        //\r
-        if (PacakgeHeader.Type == EFI_HII_PACKAGE_FORMS) {\r
-          IfrOffset = sizeof (PacakgeHeader);\r
-          PackageData = (UINT8 *) HiiPackageList + PackageOffset;\r
-          while (IfrOffset < PacakgeHeader.Length) {\r
-            IfrOpHdr = (EFI_IFR_OP_HEADER *) (PackageData + IfrOffset);\r
-            //\r
-            // Match DefaultId to find its DefaultName\r
-            //\r
-            if (IfrOpHdr->OpCode == EFI_IFR_DEFAULTSTORE_OP) {\r
-              if (((EFI_IFR_DEFAULTSTORE *) IfrOpHdr)->DefaultId == DefaultId) {\r
-                DefaultName = ((EFI_IFR_DEFAULTSTORE *) IfrOpHdr)->DefaultName;\r
-                Status = EFI_SUCCESS;\r
-                break;\r
-              }\r
-            }\r
-            IfrOffset += IfrOpHdr->Length;\r
-          }\r
-          //\r
-          // Only one form is in a package list.\r
-          //\r
-          break;\r
-        }\r
-        \r
-        //\r
-        // Go to next package.\r
-        //\r
-        PackageOffset += PacakgeHeader.Length;      \r
-      }\r
-      \r
-      //\r
-      // Not found the matched default string ID\r
-      //\r
-      if (EFI_ERROR (Status)) {\r
-        Status = EFI_SUCCESS;\r
-        goto NextConfigAltResp;\r
-      }\r
-    }\r
-    \r
     //\r
     // 3. Call ConfigRouting GetAltCfg(ConfigRoute, <ConfigResponse>, Guid, Name, DevicePath, AltCfgId, AltCfgResp)\r
-    //    Get the default configuration string according to the found default name string ID.\r
+    //    Get the default configuration string according to the default ID.\r
     //\r
     Status = gHiiConfigRouting->GetAltConfig (\r
                                   gHiiConfigRouting,\r
@@ -1866,7 +1805,7 @@ InternalHiiIfrValueAction (
                                   VarGuid,\r
                                   VarName,\r
                                   DevicePath,\r
-                                  (ActionType == ACTION_SET_DEFAUTL_VALUE) ? &DefaultName:NULL,  // it can be NULL to get the current setting.\r
+                                  (ActionType == ACTION_SET_DEFAUTL_VALUE) ? &DefaultId:NULL,  // it can be NULL to get the current setting.\r
                                   &ConfigResp\r
                                 );\r
     \r
@@ -2032,7 +1971,7 @@ Done:
                     If it is NULL, all current configuration for the\r
                     entirety of the current HII database will be validated.\r
   \r
-  @retval TURE    Current configuration is valid.\r
+  @retval TRUE    Current configuration is valid.\r
   @retval FALSE   Current configuration is invalid.\r
 **/\r
 BOOLEAN\r
@@ -2505,9 +2444,7 @@ InternalHiiGrowOpCodeHandle (
               OpCodeBuffer->BufferSize + (Size + HII_LIB_OPCODE_ALLOCATION_SIZE),\r
               OpCodeBuffer->Buffer\r
               );\r
-    if (Buffer == NULL) {\r
-      return NULL;\r
-    }\r
+    ASSERT (Buffer != NULL);\r
     OpCodeBuffer->Buffer = Buffer;\r
     OpCodeBuffer->BufferSize += (Size + HII_LIB_OPCODE_ALLOCATION_SIZE);\r
   }\r