Move ConfigHdr from browser_storage to Formset_storage, avoid device path lost for drivers.
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@16680 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
		| @@ -1,7 +1,7 @@ | |||||||
| /** @file | /** @file | ||||||
| Parser for IFR binary encoding. | Parser for IFR binary encoding. | ||||||
|  |  | ||||||
| Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.<BR> | Copyright (c) 2007 - 2015, Intel Corporation. All rights reserved.<BR> | ||||||
| This program and the accompanying materials | This program and the accompanying materials | ||||||
| are licensed and made available under the terms and conditions of the BSD License | 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 | which accompanies this distribution.  The full text of the license may be found at | ||||||
| @@ -320,20 +320,20 @@ CreateExpression ( | |||||||
| EFI_STATUS | EFI_STATUS | ||||||
| InitializeConfigHdr ( | InitializeConfigHdr ( | ||||||
|   IN FORM_BROWSER_FORMSET  *FormSet, |   IN FORM_BROWSER_FORMSET  *FormSet, | ||||||
|   IN OUT BROWSER_STORAGE   *Storage |   IN OUT FORMSET_STORAGE   *Storage | ||||||
|   ) |   ) | ||||||
| { | { | ||||||
|   CHAR16      *Name; |   CHAR16      *Name; | ||||||
|  |  | ||||||
|   if (Storage->Type == EFI_HII_VARSTORE_BUFFER ||  |   if (Storage->BrowserStorage->Type == EFI_HII_VARSTORE_BUFFER ||  | ||||||
|       Storage->Type == EFI_HII_VARSTORE_EFI_VARIABLE_BUFFER) { |       Storage->BrowserStorage->Type == EFI_HII_VARSTORE_EFI_VARIABLE_BUFFER) { | ||||||
|     Name = Storage->Name; |     Name = Storage->BrowserStorage->Name; | ||||||
|   } else { |   } else { | ||||||
|     Name = NULL; |     Name = NULL; | ||||||
|   } |   } | ||||||
|  |  | ||||||
|   Storage->ConfigHdr = HiiConstructConfigHdr ( |   Storage->ConfigHdr = HiiConstructConfigHdr ( | ||||||
|                          &Storage->Guid, |                          &Storage->BrowserStorage->Guid, | ||||||
|                          Name, |                          Name, | ||||||
|                          FormSet->DriverHandle |                          FormSet->DriverHandle | ||||||
|                          ); |                          ); | ||||||
| @@ -559,29 +559,108 @@ CreateStorage ( | |||||||
|     } |     } | ||||||
|  |  | ||||||
|     BrowserStorage->HiiHandle = FormSet->HiiHandle; |     BrowserStorage->HiiHandle = FormSet->HiiHandle; | ||||||
|     InitializeConfigHdr (FormSet, BrowserStorage); |  | ||||||
|  |  | ||||||
|     BrowserStorage->Initialized = FALSE; |     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->BrowserStorage = BrowserStorage; | ||||||
|   Storage->ConfigRequest = AllocateCopyPool (StrSize (BrowserStorage->ConfigHdr), BrowserStorage->ConfigHdr); |   InitializeConfigHdr (FormSet, Storage); | ||||||
|  |   Storage->ConfigRequest = AllocateCopyPool (StrSize (Storage->ConfigHdr), Storage->ConfigHdr); | ||||||
|   Storage->SpareStrLen = 0; |   Storage->SpareStrLen = 0; | ||||||
|  |  | ||||||
|   return Storage; |   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. <RequestElement> ::= '&'<BlockName> | '&'<Label> |   Initialize Request Element of a Question. <RequestElement> ::= '&'<BlockName> | '&'<Label> | ||||||
|  |  | ||||||
| @@ -651,17 +730,7 @@ InitializeRequestElement ( | |||||||
|   // |   // | ||||||
|   // Find Formset Storage for this Question |   // Find Formset Storage for this Question | ||||||
|   // |   // | ||||||
|   FormsetStorage = NULL; |   FormsetStorage = GetFstStgFromVarId(FormSet, Question->VarStoreId); | ||||||
|   Link = GetFirstNode (&FormSet->StorageListHead); |  | ||||||
|   while (!IsNull (&FormSet->StorageListHead, Link)) { |  | ||||||
|     FormsetStorage = FORMSET_STORAGE_FROM_LINK (Link); |  | ||||||
|  |  | ||||||
|     if (FormsetStorage->VarStoreId == Question->VarStoreId) { |  | ||||||
|       break; |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     Link = GetNextNode (&FormSet->StorageListHead, Link); |  | ||||||
|   } |  | ||||||
|   ASSERT (FormsetStorage != NULL); |   ASSERT (FormsetStorage != NULL); | ||||||
|  |  | ||||||
|   // |   // | ||||||
| @@ -695,7 +764,7 @@ InitializeRequestElement ( | |||||||
|   while (!IsNull (&Form->ConfigRequestHead, Link)) { |   while (!IsNull (&Form->ConfigRequestHead, Link)) { | ||||||
|     ConfigInfo = FORM_BROWSER_CONFIG_REQUEST_FROM_LINK (Link); |     ConfigInfo = FORM_BROWSER_CONFIG_REQUEST_FROM_LINK (Link); | ||||||
|  |  | ||||||
|     if (ConfigInfo != NULL && ConfigInfo->Storage == Storage) { |     if (ConfigInfo != NULL && ConfigInfo->Storage == FormsetStorage->BrowserStorage) { | ||||||
|       Find = TRUE; |       Find = TRUE; | ||||||
|       break; |       break; | ||||||
|     } |     } | ||||||
| @@ -707,10 +776,10 @@ InitializeRequestElement ( | |||||||
|     ConfigInfo = AllocateZeroPool(sizeof (FORM_BROWSER_CONFIG_REQUEST)); |     ConfigInfo = AllocateZeroPool(sizeof (FORM_BROWSER_CONFIG_REQUEST)); | ||||||
|     ASSERT (ConfigInfo != NULL); |     ASSERT (ConfigInfo != NULL); | ||||||
|     ConfigInfo->Signature     = FORM_BROWSER_CONFIG_REQUEST_SIGNATURE; |     ConfigInfo->Signature     = FORM_BROWSER_CONFIG_REQUEST_SIGNATURE; | ||||||
|     ConfigInfo->ConfigRequest = AllocateCopyPool (StrSize (Storage->ConfigHdr), Storage->ConfigHdr); |     ConfigInfo->ConfigRequest = AllocateCopyPool (StrSize (FormsetStorage->ConfigHdr), FormsetStorage->ConfigHdr); | ||||||
|     ASSERT (ConfigInfo->ConfigRequest != NULL); |     ASSERT (ConfigInfo->ConfigRequest != NULL); | ||||||
|     ConfigInfo->SpareStrLen   = 0; |     ConfigInfo->SpareStrLen   = 0; | ||||||
|     ConfigInfo->Storage       = Storage; |     ConfigInfo->Storage       = FormsetStorage->BrowserStorage; | ||||||
|     InsertTailList(&Form->ConfigRequestHead, &ConfigInfo->Link); |     InsertTailList(&Form->ConfigRequestHead, &ConfigInfo->Link); | ||||||
|   } |   } | ||||||
|  |  | ||||||
|   | |||||||
| @@ -1,7 +1,7 @@ | |||||||
| /** @file | /** @file | ||||||
| Entry and initialization module for the browser. | Entry and initialization module for the browser. | ||||||
|  |  | ||||||
| Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.<BR> | Copyright (c) 2007 - 2015, Intel Corporation. All rights reserved.<BR> | ||||||
| This program and the accompanying materials | This program and the accompanying materials | ||||||
| are licensed and made available under the terms and conditions of the BSD License | 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 | which accompanies this distribution.  The full text of the license may be found at | ||||||
| @@ -621,6 +621,7 @@ ProcessStorage ( | |||||||
|   CHAR16                *StrPtr; |   CHAR16                *StrPtr; | ||||||
|   UINTN                 BufferSize; |   UINTN                 BufferSize; | ||||||
|   UINTN                 TmpSize; |   UINTN                 TmpSize; | ||||||
|  |   FORMSET_STORAGE       *BrowserStorage; | ||||||
|  |  | ||||||
|   if (RetrieveData) { |   if (RetrieveData) { | ||||||
|     // |     // | ||||||
| @@ -635,10 +636,12 @@ ProcessStorage ( | |||||||
|     // Skip <ConfigHdr> and '&' to point to <ConfigBody> when first copy the configbody. |     // Skip <ConfigHdr> and '&' to point to <ConfigBody> when first copy the configbody. | ||||||
|     // Also need to consider add "\0" at first time. |     // Also need to consider add "\0" at first time. | ||||||
|     // |     // | ||||||
|     StrPtr     = ConfigResp + StrLen (Storage->ConfigHdr) + 1; |     StrPtr = StrStr (ConfigResp, L"PATH"); | ||||||
|  |     ASSERT (StrPtr != NULL); | ||||||
|  |     StrPtr = StrStr (StrPtr, L"&"); | ||||||
|  |     StrPtr += 1; | ||||||
|     BufferSize = StrSize (StrPtr); |     BufferSize = StrSize (StrPtr); | ||||||
|  |  | ||||||
|  |  | ||||||
|     // |     // | ||||||
|     // Copy the data if the input buffer is bigger enough. |     // Copy the data if the input buffer is bigger enough. | ||||||
|     // |     // | ||||||
| @@ -652,12 +655,14 @@ ProcessStorage ( | |||||||
|     // |     // | ||||||
|     // Prepare <ConfigResp> |     // Prepare <ConfigResp> | ||||||
|     // |     // | ||||||
|  |     BrowserStorage = GetFstStgFromBrsStg (Storage); | ||||||
|  |     ASSERT (BrowserStorage != NULL); | ||||||
|     TmpSize = StrLen (*ResultsData); |     TmpSize = StrLen (*ResultsData); | ||||||
|     BufferSize = (TmpSize + StrLen (Storage->ConfigHdr) + 2) * sizeof (CHAR16); |     BufferSize = (TmpSize + StrLen (BrowserStorage->ConfigHdr) + 2) * sizeof (CHAR16); | ||||||
|     ConfigResp = AllocateZeroPool (BufferSize); |     ConfigResp = AllocateZeroPool (BufferSize); | ||||||
|     ASSERT (ConfigResp != NULL); |     ASSERT (ConfigResp != NULL); | ||||||
|  |  | ||||||
|     StrCpy (ConfigResp, Storage->ConfigHdr); |     StrCpy (ConfigResp, BrowserStorage->ConfigHdr); | ||||||
|     StrCat (ConfigResp, L"&"); |     StrCat (ConfigResp, L"&"); | ||||||
|     StrCat (ConfigResp, *ResultsData); |     StrCat (ConfigResp, *ResultsData); | ||||||
|  |  | ||||||
| @@ -1217,6 +1222,7 @@ StorageToConfigResp ( | |||||||
|   LIST_ENTRY              *Link; |   LIST_ENTRY              *Link; | ||||||
|   NAME_VALUE_NODE         *Node; |   NAME_VALUE_NODE         *Node; | ||||||
|   UINT8                   *SourceBuf; |   UINT8                   *SourceBuf; | ||||||
|  |   FORMSET_STORAGE         *FormsetStorage; | ||||||
|  |  | ||||||
|   Status = EFI_SUCCESS; |   Status = EFI_SUCCESS; | ||||||
|  |  | ||||||
| @@ -1236,7 +1242,9 @@ StorageToConfigResp ( | |||||||
|  |  | ||||||
|   case EFI_HII_VARSTORE_NAME_VALUE: |   case EFI_HII_VARSTORE_NAME_VALUE: | ||||||
|     *ConfigResp = NULL; |     *ConfigResp = NULL; | ||||||
|     NewStringCat (ConfigResp, Storage->ConfigHdr); |     FormsetStorage = GetFstStgFromBrsStg(Storage); | ||||||
|  |     ASSERT (FormsetStorage != NULL); | ||||||
|  |     NewStringCat (ConfigResp, FormsetStorage->ConfigHdr); | ||||||
|  |  | ||||||
|     Link = GetFirstNode (&Storage->NameValueListHead); |     Link = GetFirstNode (&Storage->NameValueListHead); | ||||||
|     while (!IsNull (&Storage->NameValueListHead, Link)) { |     while (!IsNull (&Storage->NameValueListHead, Link)) { | ||||||
| @@ -1475,6 +1483,7 @@ GetQuestionValue ( | |||||||
|   UINTN               StorageWidth; |   UINTN               StorageWidth; | ||||||
|   EFI_TIME            EfiTime; |   EFI_TIME            EfiTime; | ||||||
|   BROWSER_STORAGE     *Storage; |   BROWSER_STORAGE     *Storage; | ||||||
|  |   FORMSET_STORAGE     *FormsetStorage; | ||||||
|   EFI_IFR_TYPE_VALUE  *QuestionValue; |   EFI_IFR_TYPE_VALUE  *QuestionValue; | ||||||
|   CHAR16              *ConfigRequest; |   CHAR16              *ConfigRequest; | ||||||
|   CHAR16              *Progress; |   CHAR16              *Progress; | ||||||
| @@ -1659,21 +1668,23 @@ GetQuestionValue ( | |||||||
|       FreePool (Value); |       FreePool (Value); | ||||||
|     } |     } | ||||||
|   } else { |   } else { | ||||||
|  |     FormsetStorage = GetFstStgFromVarId(FormSet, Question->VarStoreId); | ||||||
|  |     ASSERT (FormsetStorage != NULL); | ||||||
|     // |     // | ||||||
|     // <ConfigRequest> ::= <ConfigHdr> + <BlockName> || |     // <ConfigRequest> ::= <ConfigHdr> + <BlockName> || | ||||||
|     //                   <ConfigHdr> + "&" + <VariableName> |     //                   <ConfigHdr> + "&" + <VariableName> | ||||||
|     // |     // | ||||||
|     if (IsBufferStorage) { |     if (IsBufferStorage) { | ||||||
|       Length = StrLen (Storage->ConfigHdr); |       Length = StrLen (FormsetStorage->ConfigHdr); | ||||||
|       Length += StrLen (Question->BlockName); |       Length += StrLen (Question->BlockName); | ||||||
|     } else { |     } else { | ||||||
|       Length = StrLen (Storage->ConfigHdr); |       Length = StrLen (FormsetStorage->ConfigHdr); | ||||||
|       Length += StrLen (Question->VariableName) + 1; |       Length += StrLen (Question->VariableName) + 1; | ||||||
|     } |     } | ||||||
|     ConfigRequest = AllocateZeroPool ((Length + 1) * sizeof (CHAR16)); |     ConfigRequest = AllocateZeroPool ((Length + 1) * sizeof (CHAR16)); | ||||||
|     ASSERT (ConfigRequest != NULL); |     ASSERT (ConfigRequest != NULL); | ||||||
|  |  | ||||||
|     StrCpy (ConfigRequest, Storage->ConfigHdr); |     StrCpy (ConfigRequest, FormsetStorage->ConfigHdr); | ||||||
|     if (IsBufferStorage) { |     if (IsBufferStorage) { | ||||||
|       StrCat (ConfigRequest, Question->BlockName); |       StrCat (ConfigRequest, Question->BlockName); | ||||||
|     } else { |     } else { | ||||||
| @@ -1771,6 +1782,7 @@ SetQuestionValue ( | |||||||
|   UINTN               BufferLen; |   UINTN               BufferLen; | ||||||
|   UINTN               StorageWidth; |   UINTN               StorageWidth; | ||||||
|   BROWSER_STORAGE     *Storage; |   BROWSER_STORAGE     *Storage; | ||||||
|  |   FORMSET_STORAGE     *FormsetStorage; | ||||||
|   EFI_IFR_TYPE_VALUE  *QuestionValue; |   EFI_IFR_TYPE_VALUE  *QuestionValue; | ||||||
|   CHAR16              *ConfigResp; |   CHAR16              *ConfigResp; | ||||||
|   CHAR16              *Progress; |   CHAR16              *Progress; | ||||||
| @@ -1965,10 +1977,12 @@ SetQuestionValue ( | |||||||
|     } else { |     } else { | ||||||
|       Length += (StorageWidth * 2); |       Length += (StorageWidth * 2); | ||||||
|     } |     } | ||||||
|     ConfigResp = AllocateZeroPool ((StrLen (Storage->ConfigHdr) + Length + 1) * sizeof (CHAR16)); |     FormsetStorage = GetFstStgFromVarId(FormSet, Question->VarStoreId); | ||||||
|  |     ASSERT (FormsetStorage != NULL); | ||||||
|  |     ConfigResp = AllocateZeroPool ((StrLen (FormsetStorage->ConfigHdr) + Length + 1) * sizeof (CHAR16)); | ||||||
|     ASSERT (ConfigResp != NULL); |     ASSERT (ConfigResp != NULL); | ||||||
|  |  | ||||||
|     StrCpy (ConfigResp, Storage->ConfigHdr); |     StrCpy (ConfigResp, FormsetStorage->ConfigHdr); | ||||||
|     if (IsBufferStorage) { |     if (IsBufferStorage) { | ||||||
|       StrCat (ConfigResp, Question->BlockName); |       StrCat (ConfigResp, Question->BlockName); | ||||||
|       StrCat (ConfigResp, L"&VALUE="); |       StrCat (ConfigResp, L"&VALUE="); | ||||||
| @@ -2681,6 +2695,11 @@ FindQuestionFromProgress ( | |||||||
|           *RetQuestion = Statement; |           *RetQuestion = Statement; | ||||||
|           break; |           break; | ||||||
|         } |         } | ||||||
|  |  | ||||||
|  |         if (Statement->VariableName != NULL && StrStr (Statement->VariableName, Progress) != NULL) { | ||||||
|  |           *RetQuestion = Statement; | ||||||
|  |           break; | ||||||
|  |         } | ||||||
|       } |       } | ||||||
|     } |     } | ||||||
|  |  | ||||||
| @@ -4645,13 +4664,13 @@ RemoveElement ( | |||||||
| /** | /** | ||||||
|   Adjust config request in storage, remove the request elements existed in the input ConfigRequest. |   Adjust config request in storage, remove the request elements existed in the input ConfigRequest. | ||||||
|  |  | ||||||
|   @param  Storage                Pointer to the browser storage. |   @param  Storage                Pointer to the formset storage. | ||||||
|   @param  ConfigRequest          The pointer to the Request element. |   @param  ConfigRequest          The pointer to the Request element. | ||||||
|  |  | ||||||
| **/ | **/ | ||||||
| VOID | VOID | ||||||
| RemoveConfigRequest ( | RemoveConfigRequest ( | ||||||
|   BROWSER_STORAGE   *Storage, |   FORMSET_STORAGE   *Storage, | ||||||
|   CHAR16            *ConfigRequest |   CHAR16            *ConfigRequest | ||||||
|   ) |   ) | ||||||
| { | { | ||||||
| @@ -4666,7 +4685,7 @@ RemoveConfigRequest ( | |||||||
|     return; |     return; | ||||||
|   } |   } | ||||||
|  |  | ||||||
|   if (Storage->Type == EFI_HII_VARSTORE_NAME_VALUE) { |   if (Storage->BrowserStorage->Type == EFI_HII_VARSTORE_NAME_VALUE) { | ||||||
|     // |     // | ||||||
|     // "&Name1&Name2" section for EFI_HII_VARSTORE_NAME_VALUE storage |     // "&Name1&Name2" section for EFI_HII_VARSTORE_NAME_VALUE storage | ||||||
|     // |     // | ||||||
| @@ -4681,7 +4700,7 @@ RemoveConfigRequest ( | |||||||
|   // |   // | ||||||
|   // Find SearchKey storage |   // Find SearchKey storage | ||||||
|   // |   // | ||||||
|   if (Storage->Type == EFI_HII_VARSTORE_NAME_VALUE) { |   if (Storage->BrowserStorage->Type == EFI_HII_VARSTORE_NAME_VALUE) { | ||||||
|     RequestElement = StrStr (ConfigRequest, L"PATH"); |     RequestElement = StrStr (ConfigRequest, L"PATH"); | ||||||
|     ASSERT (RequestElement != NULL); |     ASSERT (RequestElement != NULL); | ||||||
|     RequestElement = StrStr (RequestElement, SearchKey);     |     RequestElement = StrStr (RequestElement, SearchKey);     | ||||||
| @@ -4705,7 +4724,7 @@ RemoveConfigRequest ( | |||||||
|       *NextRequestElement = L'\0'; |       *NextRequestElement = L'\0'; | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     RemoveElement (Storage, RequestElement); |     RemoveElement (Storage->BrowserStorage, RequestElement); | ||||||
|  |  | ||||||
|     if (NextRequestElement != NULL) { |     if (NextRequestElement != NULL) { | ||||||
|       // |       // | ||||||
| @@ -4720,10 +4739,10 @@ RemoveConfigRequest ( | |||||||
|   // |   // | ||||||
|   // If no request element remain, just remove the ConfigRequest string. |   // If no request element remain, just remove the ConfigRequest string. | ||||||
|   // |   // | ||||||
|   if (StrCmp (Storage->ConfigRequest, Storage->ConfigHdr) == 0) { |   if (StrCmp (Storage->BrowserStorage->ConfigRequest, Storage->ConfigHdr) == 0) { | ||||||
|     FreePool (Storage->ConfigRequest); |     FreePool (Storage->BrowserStorage->ConfigRequest); | ||||||
|     Storage->ConfigRequest = NULL; |     Storage->BrowserStorage->ConfigRequest = NULL; | ||||||
|     Storage->SpareStrLen   = 0; |     Storage->BrowserStorage->SpareStrLen   = 0; | ||||||
|   } |   } | ||||||
| } | } | ||||||
|  |  | ||||||
| @@ -4751,7 +4770,7 @@ CleanBrowserStorage ( | |||||||
|         continue; |         continue; | ||||||
|       } |       } | ||||||
|  |  | ||||||
|       RemoveConfigRequest (Storage->BrowserStorage, Storage->ConfigRequest); |       RemoveConfigRequest (Storage, Storage->ConfigRequest); | ||||||
|     } else if (Storage->BrowserStorage->Type == EFI_HII_VARSTORE_BUFFER || |     } else if (Storage->BrowserStorage->Type == EFI_HII_VARSTORE_BUFFER || | ||||||
|                Storage->BrowserStorage->Type == EFI_HII_VARSTORE_NAME_VALUE) { |                Storage->BrowserStorage->Type == EFI_HII_VARSTORE_NAME_VALUE) { | ||||||
|       if (Storage->BrowserStorage->ConfigRequest != NULL) {  |       if (Storage->BrowserStorage->ConfigRequest != NULL) {  | ||||||
| @@ -5011,14 +5030,14 @@ LoadStorage ( | |||||||
|     // Allocate and fill a buffer large enough to hold the <ConfigHdr> template |     // Allocate and fill a buffer large enough to hold the <ConfigHdr> template | ||||||
|     // followed by "&OFFSET=0&WIDTH=WWWW"followed by a Null-terminator |     // followed by "&OFFSET=0&WIDTH=WWWW"followed by a Null-terminator | ||||||
|     // |     // | ||||||
|     StrLen = StrSize (Storage->BrowserStorage->ConfigHdr) + 20 * sizeof (CHAR16); |     StrLen = StrSize (Storage->ConfigHdr) + 20 * sizeof (CHAR16); | ||||||
|     ConfigRequest = AllocateZeroPool (StrLen); |     ConfigRequest = AllocateZeroPool (StrLen); | ||||||
|     ASSERT (ConfigRequest != NULL); |     ASSERT (ConfigRequest != NULL); | ||||||
|     UnicodeSPrint ( |     UnicodeSPrint ( | ||||||
|                ConfigRequest,  |                ConfigRequest,  | ||||||
|                StrLen,  |                StrLen,  | ||||||
|                L"%s&OFFSET=0&WIDTH=%04x",  |                L"%s&OFFSET=0&WIDTH=%04x",  | ||||||
|                Storage->BrowserStorage->ConfigHdr, |                Storage->ConfigHdr, | ||||||
|                Storage->BrowserStorage->Size); |                Storage->BrowserStorage->Size); | ||||||
|   } else { |   } else { | ||||||
|     ConfigRequest = Storage->ConfigRequest; |     ConfigRequest = Storage->ConfigRequest; | ||||||
|   | |||||||
| @@ -1,7 +1,7 @@ | |||||||
| /** @file | /** @file | ||||||
| Private MACRO, structure and function definitions for Setup Browser module. | Private MACRO, structure and function definitions for Setup Browser module. | ||||||
|  |  | ||||||
| Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.<BR> | Copyright (c) 2007 - 2015, Intel Corporation. All rights reserved.<BR> | ||||||
| This program and the accompanying materials | This program and the accompanying materials | ||||||
| are licensed and made available under the terms and conditions of the BSD License | 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 | which accompanies this distribution.  The full text of the license may be found at | ||||||
| @@ -150,7 +150,6 @@ typedef struct { | |||||||
|  |  | ||||||
|   UINT32           Attributes;     // For EFI_IFR_VARSTORE_EFI: EFI Variable attribute |   UINT32           Attributes;     // For EFI_IFR_VARSTORE_EFI: EFI Variable attribute | ||||||
|  |  | ||||||
|   CHAR16           *ConfigHdr;     // <ConfigHdr> |  | ||||||
|   CHAR16           *ConfigRequest; // <ConfigRequest> = <ConfigHdr> + <RequestElement> |   CHAR16           *ConfigRequest; // <ConfigRequest> = <ConfigHdr> + <RequestElement> | ||||||
|                                    // <RequestElement> includes all fields which is used by current form sets. |                                    // <RequestElement> includes all fields which is used by current form sets. | ||||||
|   UINTN            SpareStrLen;    // Spare length of ConfigRequest string buffer |   UINTN            SpareStrLen;    // Spare length of ConfigRequest string buffer | ||||||
| @@ -170,6 +169,8 @@ typedef struct { | |||||||
|  |  | ||||||
|   BROWSER_STORAGE  *BrowserStorage; |   BROWSER_STORAGE  *BrowserStorage; | ||||||
|  |  | ||||||
|  |   CHAR16           *ConfigHdr;     // <ConfigHdr> | ||||||
|  |  | ||||||
|   CHAR16           *ConfigRequest; // <ConfigRequest> = <ConfigHdr> + <RequestElement> |   CHAR16           *ConfigRequest; // <ConfigRequest> = <ConfigHdr> + <RequestElement> | ||||||
|   CHAR16           *ConfigAltResp; // Alt config response string for this ConfigRequest. |   CHAR16           *ConfigAltResp; // Alt config response string for this ConfigRequest. | ||||||
|   BOOLEAN          HasCallAltCfg;  // Flag to show whether browser has call ExtractConfig to get Altcfg string. |   BOOLEAN          HasCallAltCfg;  // Flag to show whether browser has call ExtractConfig to get Altcfg string. | ||||||
| @@ -1795,4 +1796,37 @@ IsTrue ( | |||||||
|   IN EFI_HII_VALUE     *Result |   IN EFI_HII_VALUE     *Result | ||||||
|   ); |   ); | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   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 | ||||||
|  |   ); | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   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 | ||||||
|  |   ); | ||||||
|  |  | ||||||
| #endif | #endif | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user