]> git.proxmox.com Git - mirror_edk2.git/commitdiff
MdeModulePkg: Update the device path info for the storage when former drivers not...
authorEric Dong <eric.dong@intel.com>
Thu, 11 Dec 2014 08:03:19 +0000 (08:03 +0000)
committerydong10 <ydong10@Edk2>
Thu, 11 Dec 2014 08:03:19 +0000 (08:03 +0000)
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Eric Dong <eric.dong@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@16499 6f19259b-4bc3-4df7-8a09-765794883524

MdeModulePkg/Universal/SetupBrowserDxe/IfrParse.c

index d3b11864270b9dde1860ab8046a803b3967385e1..e9cdea0e8ba076668214446eebd3fe3db687e96e 100644 (file)
@@ -451,6 +451,42 @@ IntializeBrowserStorage (
   }\r
 }\r
 \r
+/**\r
+  Check whether exist device path info in the ConfigHdr string.\r
+\r
+  @param  String                 UEFI configuration string\r
+\r
+  @retval TRUE                   Device Path exist.\r
+  @retval FALSE                  Not exist device path info.\r
+\r
+**/\r
+BOOLEAN\r
+IsDevicePathExist (\r
+  IN  EFI_STRING                   String\r
+  )\r
+{\r
+  UINTN                    Length;\r
+  EFI_STRING               PathHdr;\r
+\r
+  for (; (*String != 0 && StrnCmp (String, L"PATH=", StrLen (L"PATH=")) != 0); String++);\r
+  if (*String == 0) {\r
+    return FALSE;\r
+  }\r
+\r
+  String += StrLen (L"PATH=");\r
+  if (*String == 0) {\r
+    return FALSE;\r
+  }\r
+  PathHdr = String;\r
+\r
+  for (Length = 0; *String != 0 && *String != L'&'; String++, Length++);\r
+  if (((Length + 1) / 2) < sizeof (EFI_DEVICE_PATH_PROTOCOL)) {\r
+    return FALSE;\r
+  }\r
+\r
+  return TRUE;\r
+}\r
+\r
 /**\r
   Allocate a FORMSET_STORAGE data structure and insert to FormSet Storage List.\r
 \r
@@ -528,6 +564,17 @@ CreateStorage (
     InitializeConfigHdr (FormSet, BrowserStorage);\r
 \r
     BrowserStorage->Initialized = FALSE;\r
+  } else {\r
+    if ((StorageType == EFI_HII_VARSTORE_EFI_VARIABLE_BUFFER) && \r
+        (FormSet->DriverHandle != NULL) && \r
+        (!IsDevicePathExist (BrowserStorage->ConfigHdr))) {\r
+      //\r
+      // If this storage not has device path info but new formset has,\r
+      // update the device path info.\r
+      //\r
+      FreePool (BrowserStorage->ConfigHdr);\r
+      InitializeConfigHdr (FormSet, BrowserStorage);\r
+    }\r
   }\r
 \r
   Storage->BrowserStorage = BrowserStorage;\r