Revision: 16499
          http://sourceforge.net/p/edk2/code/16499
Author:   ydong10
Date:     2014-12-11 08:03:19 +0000 (Thu, 11 Dec 2014)
Log Message:
-----------
MdeModulePkg: Update the device path info for the storage when former drivers 
not provide it.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Eric Dong <[email protected]>
Reviewed-by: Liming Gao <[email protected]>

Modified Paths:
--------------
    trunk/edk2/MdeModulePkg/Universal/SetupBrowserDxe/IfrParse.c

Modified: trunk/edk2/MdeModulePkg/Universal/SetupBrowserDxe/IfrParse.c
===================================================================
--- trunk/edk2/MdeModulePkg/Universal/SetupBrowserDxe/IfrParse.c        
2014-12-11 06:34:57 UTC (rev 16498)
+++ trunk/edk2/MdeModulePkg/Universal/SetupBrowserDxe/IfrParse.c        
2014-12-11 08:03:19 UTC (rev 16499)
@@ -452,6 +452,42 @@
 }
 
 /**
+  Check whether exist device path info in the ConfigHdr string.
+
+  @param  String                 UEFI configuration string
+
+  @retval TRUE                   Device Path exist.
+  @retval FALSE                  Not exist device path info.
+
+**/
+BOOLEAN
+IsDevicePathExist (
+  IN  EFI_STRING                   String
+  )
+{
+  UINTN                    Length;
+  EFI_STRING               PathHdr;
+
+  for (; (*String != 0 && StrnCmp (String, L"PATH=", StrLen (L"PATH=")) != 0); 
String++);
+  if (*String == 0) {
+    return FALSE;
+  }
+
+  String += StrLen (L"PATH=");
+  if (*String == 0) {
+    return FALSE;
+  }
+  PathHdr = String;
+
+  for (Length = 0; *String != 0 && *String != L'&'; String++, Length++);
+  if (((Length + 1) / 2) < sizeof (EFI_DEVICE_PATH_PROTOCOL)) {
+    return FALSE;
+  }
+
+  return TRUE;
+}
+
+/**
   Allocate a FORMSET_STORAGE data structure and insert to FormSet Storage List.
 
   @param  FormSet                    Pointer of the current FormSet
@@ -528,6 +564,17 @@
     InitializeConfigHdr (FormSet, BrowserStorage);
 
     BrowserStorage->Initialized = FALSE;
+  } else {
+    if ((StorageType == EFI_HII_VARSTORE_EFI_VARIABLE_BUFFER) && 
+        (FormSet->DriverHandle != NULL) && 
+        (!IsDevicePathExist (BrowserStorage->ConfigHdr))) {
+      //
+      // If this storage not has device path info but new formset has,
+      // update the device path info.
+      //
+      FreePool (BrowserStorage->ConfigHdr);
+      InitializeConfigHdr (FormSet, BrowserStorage);
+    }
   }
 
   Storage->BrowserStorage = BrowserStorage;


------------------------------------------------------------------------------
Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server
from Actuate! Instantly Supercharge Your Business Reports and Dashboards
with Interactivity, Sharing, Native Excel Exports, App Integration & more
Get technology previously reserved for billion-dollar corporations, FREE
http://pubads.g.doubleclick.net/gampad/clk?id=164703151&iu=/4140/ostg.clktrk
_______________________________________________
edk2-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/edk2-commits

Reply via email to