]> git.proxmox.com Git - mirror_edk2.git/commitdiff
Update HiiDataBase to fix parsing Hii package error. Some HiiPackages have no varstor...
authorlgao4 <lgao4@6f19259b-4bc3-4df7-8a09-765794883524>
Thu, 14 May 2009 12:37:02 +0000 (12:37 +0000)
committerlgao4 <lgao4@6f19259b-4bc3-4df7-8a09-765794883524>
Thu, 14 May 2009 12:37:02 +0000 (12:37 +0000)
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@8314 6f19259b-4bc3-4df7-8a09-765794883524

MdeModulePkg/Include/Library/HiiLib.h
MdeModulePkg/Library/UefiHiiLib/HiiLib.c
MdeModulePkg/Universal/DriverSampleDxe/DriverSample.c
MdeModulePkg/Universal/HiiDatabaseDxe/ConfigRouting.c

index 3054a9b9c9889aeb8d90adadb30b1d278450cac0..81fdaabd470b5acbdea53e25452b8a8ce75b438e 100644 (file)
@@ -286,18 +286,17 @@ HiiConstructConfigHdr (
   );\r
 \r
 /**\r
-  It has the many same logic to HiiValidateSetting API.\r
-\r
   Reset the default value specified by DefaultId to the driver\r
   configuration got by Request string. \r
-  NULL request string support depends on the ExtractConfig interface of\r
+\r
+  NULL request string support depends on the ExportConfig interface of\r
   HiiConfigRouting protocol in UEFI specification.\r
   \r
-  @param EFI_STRING  Request    A null-terminated Unicode string in \r
-                                <MultiConfigRequest> format. It can be NULL.\r
-                                If it is NULL, all configuration for the\r
-                                entirety of the current HII database will be reset.\r
-  @param UINT16      DefaultId  Specifies the type of defaults to retrieve.\r
+  @param Request    A null-terminated Unicode string in \r
+                    <MultiConfigRequest> format. It can be NULL.\r
+                    If it is NULL, all configuration for the\r
+                    entirety of the current HII database will be reset.\r
+  @param DefaultId  Specifies the type of defaults to retrieve.\r
   \r
   @retval TURE    The default value is set successfully.\r
   @retval FALSE   The default value can't be found and set.\r
@@ -311,15 +310,14 @@ HiiSetToDefaults (
 \r
 /**\r
   Validate the current configuration by parsing HII form IFR opcode.\r
-  It can share the most logic with HiiSetToDefaults.\r
 \r
   NULL request string support depends on the ExtractConfig interface of\r
   HiiConfigRouting protocol in UEFI specification.\r
   \r
-  @param EFI_STRING  Request    A null-terminated Unicode string in \r
-                                <MultiConfigRequest> format. It can be NULL.\r
-                                If it is NULL, all current configuration for the\r
-                                entirety of the current HII database will be validated.\r
+  @param  Request   A null-terminated Unicode string in \r
+                    <MultiConfigRequest> format. It can be NULL.\r
+                    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 FALSE   Current configuration is invalid.\r
index de7cb3f46e0b6b2e7c076480b20c454a93cd1061..b9323706a6f24f95462bb2101224e818d4381f29 100644 (file)
@@ -1177,6 +1177,11 @@ InternalHiiValidateCurrentSetting (
     }\r
     Link = Link->ForwardLink;      \r
   }\r
+  \r
+  if (IsListEmpty (&CurrentBlockArray->Entry)) {\r
+    Status = EFI_SUCCESS;\r
+    goto Done;\r
+  }\r
 \r
   //\r
   // 2. Check IFR value is in block data, then Validate Vaule\r
@@ -1233,7 +1238,7 @@ InternalHiiValidateCurrentSetting (
           // Check the matched VarStoreId is found.\r
           //\r
           if (IfrVarStore == NULL) {\r
-            Status = EFI_NOT_FOUND;\r
+            Status = EFI_SUCCESS;\r
             goto Done;\r
           }\r
           break;\r
@@ -1580,7 +1585,7 @@ BOOLEAN
 EFIAPI\r
 InternalHiiIfrValueAction (\r
   IN CONST EFI_STRING Request,  OPTIONAL\r
-  IN UINT16        DefaultId,\r
+  IN UINT16           DefaultId,\r
   IN UINT8            ActionType\r
   )\r
 {\r
@@ -1738,6 +1743,7 @@ InternalHiiIfrValueAction (
       // Its default value and validating can't execute by parsing IFR data.\r
       // Directly jump into the next ConfigAltResp string for another pair Guid, Name, and Path.   \r
       //\r
+         Status = EFI_SUCCESS;\r
       goto NextConfigAltResp;\r
     }\r
     \r
@@ -1819,7 +1825,8 @@ InternalHiiIfrValueAction (
       // Not found the matched default string ID\r
       //\r
       if (EFI_ERROR (Status)) {\r
-        goto Done;\r
+        Status = EFI_SUCCESS;\r
+        goto NextConfigAltResp;\r
       }\r
     }\r
     \r
@@ -1838,7 +1845,8 @@ InternalHiiIfrValueAction (
                                 );\r
 \r
     if (EFI_ERROR (Status)) {\r
-      goto Done;\r
+      Status = EFI_SUCCESS;\r
+      goto NextConfigAltResp;\r
     }\r
     \r
     //\r
@@ -1861,6 +1869,7 @@ InternalHiiIfrValueAction (
       goto Done;\r
     }\r
 \r
+NextConfigAltResp:\r
     //\r
     // Free the allocated pacakge buffer and the got ConfigResp string.\r
     //\r
@@ -1868,11 +1877,12 @@ InternalHiiIfrValueAction (
       FreePool (HiiPackageList);\r
       HiiPackageList = NULL;\r
     }\r
+    \r
+       if (ConfigResp != NULL) {\r
+         FreePool (ConfigResp);\r
+         ConfigResp = NULL;\r
+       }\r
 \r
-    FreePool (ConfigResp);\r
-    ConfigResp = NULL;\r
-\r
-NextConfigAltResp:\r
     //\r
     // Free the allocated buffer.\r
     //\r
index 87ffac827903fe9312638c3b7ab64bb5744f1aa4..254f7f95811f3ea20a13a14aaf0af21f1c6d7517 100644 (file)
@@ -418,6 +418,7 @@ ExtractConfig (
   \r
   if (Request == NULL) {\r
     FreePool (ConfigRequest);\r
+       *Progress = NULL;\r
   }\r
 \r
   return Status;\r
index 6b278afe173a36f86aceb6b28fc69334c9c5a5a0..2761be1018acf01565270211c88308610003a7e4 100644 (file)
@@ -1728,6 +1728,13 @@ GetFullStringFromHiiFormPackages (
 \r
     PackageOffset += PacakgeHeader.Length;\r
   }\r
+  \r
+  //\r
+  // No requested varstore in IFR data and directly return\r
+  //\r
+  if (VarStorageData->Size == 0) {\r
+    goto Done;\r
+  }\r
 \r
   //\r
   // 3. Construct Request Element (Block Name) for 2.1 and 2.2 case.\r
@@ -2204,6 +2211,13 @@ HiiConfigRoutingExtractConfig (
       if (EFI_ERROR (Status)) {\r
         goto Done;\r
       }\r
+         //\r
+         // Not any request block is found.\r
+         //\r
+         if (StrStr (ConfigRequest, L"&OFFSET=") == NULL) {\r
+        AccessResults = AllocateCopyPool (StrSize (ConfigRequest), ConfigRequest);\r
+               goto NextConfigString;\r
+         }\r
     }\r
 \r
     //\r
@@ -2261,7 +2275,8 @@ HiiConfigRoutingExtractConfig (
       FreePool (DefaultResults);\r
       DefaultResults = NULL;\r
     }\r
-    \r
+\r
+NextConfigString:   \r
     if (!FirstElement) {\r
       Status = AppendToMultiString (Results, L"&");\r
       ASSERT_EFI_ERROR (Status);\r
@@ -2292,6 +2307,7 @@ HiiConfigRoutingExtractConfig (
 Done:\r
   if (EFI_ERROR (Status)) {\r
     FreePool (*Results);\r
+       *Results = NULL;\r
   }\r
   \r
   if (ConfigRequest != NULL) {\r
@@ -2783,7 +2799,7 @@ HiiBlockToConfig (
     StringPtr++;\r
   }\r
   if (*StringPtr == 0) {\r
-    *Progress = StringPtr;\r
+    *Progress = StringPtr - 1;\r
     Status = EFI_INVALID_PARAMETER;\r
     goto Exit;\r
   }\r
@@ -2792,7 +2808,7 @@ HiiBlockToConfig (
     StringPtr++;\r
   }\r
   if (*StringPtr == 0) {\r
-    *Progress = StringPtr;\r
+    *Progress = StringPtr - 1;\r
     Status = EFI_INVALID_PARAMETER;\r
     goto Exit;\r
   }\r
@@ -2947,7 +2963,10 @@ HiiBlockToConfig (
   return EFI_SUCCESS;\r
 \r
 Exit:\r
-  FreePool (*Config);\r
+  if (*Config != NULL) {\r
+       FreePool (*Config);\r
+       *Config = NULL;\r
+  }\r
   if (ValueStr != NULL) {\r
     FreePool (ValueStr);\r
   }\r
@@ -3401,7 +3420,7 @@ HiiGetAltCfg (
   Status = EFI_NOT_FOUND;\r
 \r
 Exit:\r
-\r
+  *AltCfgResp = NULL;\r
   if (!EFI_ERROR (Status) && (Result != NULL)) {\r
     //\r
     // Copy the <ConfigHdr> and <ConfigBody>\r