X-Git-Url: https://git.proxmox.com/?a=blobdiff_plain;f=MdeModulePkg%2FUniversal%2FSetupBrowserDxe%2FIfrParse.c;h=3785c32f3c6ae47f4fa85a1d1a025522d56dcefb;hb=aee257db53c87e5657b9e2c8aa558b58c4ec0fb4;hp=e9cdea0e8ba076668214446eebd3fe3db687e96e;hpb=300c1f0d354bbb4ec1c7a97bf508c656983f6eec;p=mirror_edk2.git diff --git a/MdeModulePkg/Universal/SetupBrowserDxe/IfrParse.c b/MdeModulePkg/Universal/SetupBrowserDxe/IfrParse.c index e9cdea0e8b..3785c32f3c 100644 --- a/MdeModulePkg/Universal/SetupBrowserDxe/IfrParse.c +++ b/MdeModulePkg/Universal/SetupBrowserDxe/IfrParse.c @@ -1,7 +1,7 @@ /** @file Parser for IFR binary encoding. -Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.
+Copyright (c) 2007 - 2015, Intel Corporation. All rights reserved.
This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License which accompanies this distribution. The full text of the license may be found at @@ -320,20 +320,20 @@ CreateExpression ( EFI_STATUS InitializeConfigHdr ( IN FORM_BROWSER_FORMSET *FormSet, - IN OUT BROWSER_STORAGE *Storage + IN OUT FORMSET_STORAGE *Storage ) { CHAR16 *Name; - if (Storage->Type == EFI_HII_VARSTORE_BUFFER || - Storage->Type == EFI_HII_VARSTORE_EFI_VARIABLE_BUFFER) { - Name = Storage->Name; + if (Storage->BrowserStorage->Type == EFI_HII_VARSTORE_BUFFER || + Storage->BrowserStorage->Type == EFI_HII_VARSTORE_EFI_VARIABLE_BUFFER) { + Name = Storage->BrowserStorage->Name; } else { Name = NULL; } Storage->ConfigHdr = HiiConstructConfigHdr ( - &Storage->Guid, + &Storage->BrowserStorage->Guid, Name, FormSet->DriverHandle ); @@ -466,7 +466,6 @@ IsDevicePathExist ( ) { UINTN Length; - EFI_STRING PathHdr; for (; (*String != 0 && StrnCmp (String, L"PATH=", StrLen (L"PATH=")) != 0); String++); if (*String == 0) { @@ -477,7 +476,6 @@ IsDevicePathExist ( 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)) { @@ -561,29 +559,108 @@ CreateStorage ( } BrowserStorage->HiiHandle = FormSet->HiiHandle; - 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; - Storage->ConfigRequest = AllocateCopyPool (StrSize (BrowserStorage->ConfigHdr), BrowserStorage->ConfigHdr); + InitializeConfigHdr (FormSet, Storage); + Storage->ConfigRequest = AllocateCopyPool (StrSize (Storage->ConfigHdr), Storage->ConfigHdr); Storage->SpareStrLen = 0; return Storage; } +/** + Get Formset_storage base on the input varstoreid info. + + @param FormSet Pointer of the current FormSet. + @param VarStoreId Varstore ID info. + + @return Pointer to a FORMSET_STORAGE data structure. + +**/ +FORMSET_STORAGE * +GetFstStgFromVarId ( + IN FORM_BROWSER_FORMSET *FormSet, + IN EFI_VARSTORE_ID VarStoreId + ) +{ + FORMSET_STORAGE *FormsetStorage; + LIST_ENTRY *Link; + BOOLEAN Found; + + Found = FALSE; + FormsetStorage = NULL; + // + // Find Formset Storage for this Question + // + Link = GetFirstNode (&FormSet->StorageListHead); + while (!IsNull (&FormSet->StorageListHead, Link)) { + FormsetStorage = FORMSET_STORAGE_FROM_LINK (Link); + + if (FormsetStorage->VarStoreId == VarStoreId) { + Found = TRUE; + break; + } + + Link = GetNextNode (&FormSet->StorageListHead, Link); + } + + return Found ? FormsetStorage : NULL; +} + +/** + Get Formset_storage base on the input browser storage. + + More than one formsets may share the same browser storage, + this function just get the first formset storage which + share the browser storage. + + @param Storage browser storage info. + + @return Pointer to a FORMSET_STORAGE data structure. + + +**/ +FORMSET_STORAGE * +GetFstStgFromBrsStg ( + IN BROWSER_STORAGE *Storage + ) +{ + FORMSET_STORAGE *FormsetStorage; + LIST_ENTRY *Link; + LIST_ENTRY *FormsetLink; + FORM_BROWSER_FORMSET *FormSet; + BOOLEAN Found; + + Found = FALSE; + FormsetStorage = NULL; + + FormsetLink = GetFirstNode (&gBrowserFormSetList); + while (!IsNull (&gBrowserFormSetList, FormsetLink)) { + FormSet = FORM_BROWSER_FORMSET_FROM_LINK (FormsetLink); + FormsetLink = GetNextNode (&gBrowserFormSetList, FormsetLink); + + Link = GetFirstNode (&FormSet->StorageListHead); + while (!IsNull (&FormSet->StorageListHead, Link)) { + FormsetStorage = FORMSET_STORAGE_FROM_LINK (Link); + Link = GetNextNode (&FormSet->StorageListHead, Link); + + if (FormsetStorage->BrowserStorage == Storage) { + Found = TRUE; + break; + } + } + + if (Found) { + break; + } + } + + return Found ? FormsetStorage : NULL; +} + /** Initialize Request Element of a Question. ::= '&' | '&'