summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Dong <eric.dong@intel.com>2014-12-11 08:03:19 +0000
committerydong10 <ydong10@Edk2>2014-12-11 08:03:19 +0000
commit300c1f0d354bbb4ec1c7a97bf508c656983f6eec (patch)
treed800e036cc91186ad66f700208592c523d94d588
parent5789fe3587ce0fb2fa5af1b00b11b5b0659b3289 (diff)
downloadedk2-platforms-300c1f0d354bbb4ec1c7a97bf508c656983f6eec.tar.xz
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 <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
-rw-r--r--MdeModulePkg/Universal/SetupBrowserDxe/IfrParse.c47
1 files changed, 47 insertions, 0 deletions
diff --git a/MdeModulePkg/Universal/SetupBrowserDxe/IfrParse.c b/MdeModulePkg/Universal/SetupBrowserDxe/IfrParse.c
index d3b1186427..e9cdea0e8b 100644
--- a/MdeModulePkg/Universal/SetupBrowserDxe/IfrParse.c
+++ b/MdeModulePkg/Universal/SetupBrowserDxe/IfrParse.c
@@ -452,6 +452,42 @@ IntializeBrowserStorage (
}
/**
+ 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 @@ CreateStorage (
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;