From d4775f2a4c46a1ff5cda0724079f25aa302b06bd Mon Sep 17 00:00:00 2001 From: qwang12 Date: Wed, 20 Aug 2008 14:17:24 +0000 Subject: [PATCH] 1) Add in fix to handle the case when a form is not related to a buffer storage. 2) Allocate Hii Handle from a bitfield array so Framework Hii Handle can be recycled. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@5700 6f19259b-4bc3-4df7-8a09-765794883524 --- .../FrameworkHiiToUefiHiiThunk/ConfigAccess.c | 19 +- .../FrameworkHiiToUefiHiiThunk.inf | 2 + .../FrameworkHiiToUefiHiiThunk/HiiDatabase.c | 24 +-- .../FrameworkHiiToUefiHiiThunk/HiiDatabase.h | 4 +- .../FrameworkHiiToUefiHiiThunk/HiiHandle.c | 66 +++++++ .../FrameworkHiiToUefiHiiThunk/HiiHandle.h | 42 +++++ .../FrameworkHiiToUefiHiiThunk/Package.c | 133 ++------------ .../FrameworkHiiToUefiHiiThunk/Utility.c | 167 ++++++++++++------ .../FrameworkHiiToUefiHiiThunk/Utility.h | 30 +++- 9 files changed, 285 insertions(+), 202 deletions(-) create mode 100644 EdkCompatibilityPkg/Compatibility/FrameworkHiiToUefiHiiThunk/HiiHandle.c create mode 100644 EdkCompatibilityPkg/Compatibility/FrameworkHiiToUefiHiiThunk/HiiHandle.h diff --git a/EdkCompatibilityPkg/Compatibility/FrameworkHiiToUefiHiiThunk/ConfigAccess.c b/EdkCompatibilityPkg/Compatibility/FrameworkHiiToUefiHiiThunk/ConfigAccess.c index c537a47b1c..d6165b3dec 100644 --- a/EdkCompatibilityPkg/Compatibility/FrameworkHiiToUefiHiiThunk/ConfigAccess.c +++ b/EdkCompatibilityPkg/Compatibility/FrameworkHiiToUefiHiiThunk/ConfigAccess.c @@ -633,12 +633,14 @@ CreateIfrDataArray ( LIST_ENTRY *Link; EFI_STATUS Status; + Link = GetFirstNode (&ConfigAccess->BufferStorageListHead); + if (IsNull (&ConfigAccess->BufferStorageListHead, Link)) { + return NULL; + } + IfrDataArray = AllocateZeroPool (0x100); ASSERT (IfrDataArray != NULL); - Link = GetFirstNode (&ConfigAccess->BufferStorageListHead); - ASSERT (!IsNull (&ConfigAccess->BufferStorageListHead, Link)); - BufferStorageEntry = BUFFER_STORAGE_ENTRY_FROM_LINK(Link); BrowserDataSize = BufferStorageEntry->Size; @@ -702,11 +704,13 @@ DestroyIfrDataArray ( IN BOOLEAN NvMapAllocated ) { - if (NvMapAllocated) { - FreePool (Array->NvRamMap); - } + if (Array != NULL) { + if (NvMapAllocated) { + FreePool (Array->NvRamMap); + } - FreePool (Array); + FreePool (Array); + } } @@ -950,6 +954,7 @@ ThunkCallback ( *ActionRequest = EFI_BROWSER_ACTION_REQUEST_SUBMIT; } + DestroyIfrDataArray (Data, NvMapAllocated); return Status; diff --git a/EdkCompatibilityPkg/Compatibility/FrameworkHiiToUefiHiiThunk/FrameworkHiiToUefiHiiThunk.inf b/EdkCompatibilityPkg/Compatibility/FrameworkHiiToUefiHiiThunk/FrameworkHiiToUefiHiiThunk.inf index ea83bdf66e..68b3bead20 100644 --- a/EdkCompatibilityPkg/Compatibility/FrameworkHiiToUefiHiiThunk/FrameworkHiiToUefiHiiThunk.inf +++ b/EdkCompatibilityPkg/Compatibility/FrameworkHiiToUefiHiiThunk/FrameworkHiiToUefiHiiThunk.inf @@ -37,6 +37,8 @@ # [Sources.common] + HiiHandle.c + HiiHandle.h ConfigAccess.c ConfigAccess.h OpcodeCreation.c diff --git a/EdkCompatibilityPkg/Compatibility/FrameworkHiiToUefiHiiThunk/HiiDatabase.c b/EdkCompatibilityPkg/Compatibility/FrameworkHiiToUefiHiiThunk/HiiDatabase.c index c9428a2328..3fc839ae89 100644 --- a/EdkCompatibilityPkg/Compatibility/FrameworkHiiToUefiHiiThunk/HiiDatabase.c +++ b/EdkCompatibilityPkg/Compatibility/FrameworkHiiToUefiHiiThunk/HiiDatabase.c @@ -14,6 +14,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. **/ #include "HiiDatabase.h" +#include "HiiHandle.h" HII_THUNK_PRIVATE_DATA *mHiiThunkPrivateData; @@ -43,20 +44,6 @@ HII_THUNK_PRIVATE_DATA mHiiThunkPrivateDataTempate = { HiiGetKeyboardLayout }, - // - //StaticHiiHandle - //The FRAMEWORK_EFI_HII_HANDLE starts from 1 - // and increase upwords untill reach the value of StaticPureUefiHiiHandle. - // The code will assert to prevent overflow. - (FRAMEWORK_EFI_HII_HANDLE) 1, - - // - //StaticPureUefiHiiHandle - //The Static FRAMEWORK_EFI_HII_HANDLE starts from 0xFFFF - // and decrease downwords untill reach the value of StaticHiiHandle. - // The code will assert to prevent overflow. - // - (FRAMEWORK_EFI_HII_HANDLE) 0xFFFF, { NULL, NULL //HiiHandleLinkList }, @@ -111,6 +98,7 @@ Returns: UINTN BufferLength; EFI_HII_HANDLE *Buffer; UINTN Index; + HII_THUNK_CONTEXT *ThunkContext; ASSERT_PROTOCOL_ALREADY_INSTALLED (NULL, &gEfiHiiProtocolGuid); @@ -119,6 +107,8 @@ Returns: ASSERT (Private != NULL); InitializeListHead (&Private->ThunkContextListHead); + InitHiiHandleDatabase (); + mHiiThunkPrivateData = Private; Status = gBS->LocateProtocol ( @@ -174,8 +164,10 @@ Returns: Status = HiiLibListPackageLists (EFI_HII_PACKAGE_STRINGS, NULL, &BufferLength, &Buffer); if (Status == EFI_SUCCESS) { for (Index = 0; Index < BufferLength / sizeof (EFI_HII_HANDLE); Index++) { - CreateThunkContextForUefiHiiHandle (Private, Buffer[Index]); - ASSERT_EFI_ERROR (Status); + ThunkContext = CreateThunkContextForUefiHiiHandle (Buffer[Index]); + ASSERT (ThunkContext!= NULL); + + InsertTailList (&Private->ThunkContextListHead, &ThunkContext->Link); } FreePool (Buffer); diff --git a/EdkCompatibilityPkg/Compatibility/FrameworkHiiToUefiHiiThunk/HiiDatabase.h b/EdkCompatibilityPkg/Compatibility/FrameworkHiiToUefiHiiThunk/HiiDatabase.h index 55362ea7bf..55d1859faf 100644 --- a/EdkCompatibilityPkg/Compatibility/FrameworkHiiToUefiHiiThunk/HiiDatabase.h +++ b/EdkCompatibilityPkg/Compatibility/FrameworkHiiToUefiHiiThunk/HiiDatabase.h @@ -64,8 +64,6 @@ typedef struct { UINTN Signature; EFI_HANDLE Handle; EFI_HII_PROTOCOL Hii; - FRAMEWORK_EFI_HII_HANDLE StaticHiiHandle; - FRAMEWORK_EFI_HII_HANDLE StaticPureUefiHiiHandle; // // The head of link list for all HII_THUNK_CONTEXT. @@ -141,6 +139,8 @@ typedef struct { UINTN IfrPackageCount; UINTN StringPackageCount; + BOOLEAN ByFrameworkHiiNewPack; + // // The field below is only valid if IsPackageListWithOnlyStringPack is TRUE. // The HII 0.92 version of HII data implementation in EDK 1.03 and 1.04 make an the following assumption diff --git a/EdkCompatibilityPkg/Compatibility/FrameworkHiiToUefiHiiThunk/HiiHandle.c b/EdkCompatibilityPkg/Compatibility/FrameworkHiiToUefiHiiThunk/HiiHandle.c new file mode 100644 index 0000000000..78eae0f1e0 --- /dev/null +++ b/EdkCompatibilityPkg/Compatibility/FrameworkHiiToUefiHiiThunk/HiiHandle.c @@ -0,0 +1,66 @@ +/**@file + Framework HII handle database allocation and deallocation functins. + +Copyright (c) 2008, 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 +http://opensource.org/licenses/bsd-license.php + +THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. + +**/ + + +#include "HiiHandle.h" + +// +// FRAMEWORK_EFI_HII_HANDLE +// +UINT8 mHandle[1024 * 8] = {0}; + +VOID +InitHiiHandleDatabase ( + VOID + ) +{ + // + // FRAMEWORK_EFI_HII_HANDLE 0 is reserved. + // Set Bit 0 in mHandle[0] to 1. + // + mHandle[0] |= 1 << 0; +} + + +EFI_STATUS +AllocateHiiHandle ( + FRAMEWORK_EFI_HII_HANDLE *Handle + ) +{ + UINTN Index; + + for (Index = 0; Index < sizeof (mHandle) * 8; Index++) { + if ((mHandle[Index / 8] & (1 << (Index % 8))) == 0) { + mHandle[Index / 8] |= (1 << (Index % 8)); + *Handle = (FRAMEWORK_EFI_HII_HANDLE) Index; + ASSERT (*Handle != 0); + return EFI_SUCCESS; + } + } + + return EFI_OUT_OF_RESOURCES; +} + +VOID +FreeHiiHandle ( + FRAMEWORK_EFI_HII_HANDLE Handle + ) +{ + UINT16 Num; + + Num = (UINT16) Handle; + + ASSERT ((mHandle [Num / 8] & (~(1 << (Num % 8)))) != 0); + mHandle [Num / 8] &= (~(1 << (Num % 8))); +} diff --git a/EdkCompatibilityPkg/Compatibility/FrameworkHiiToUefiHiiThunk/HiiHandle.h b/EdkCompatibilityPkg/Compatibility/FrameworkHiiToUefiHiiThunk/HiiHandle.h new file mode 100644 index 0000000000..4697996223 --- /dev/null +++ b/EdkCompatibilityPkg/Compatibility/FrameworkHiiToUefiHiiThunk/HiiHandle.h @@ -0,0 +1,42 @@ +/**@file + + This file contains utility functions by HII Thunk Modules. + +Copyright (c) 2006 - 2008, 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 +http://opensource.org/licenses/bsd-license.php + +THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. + +**/ + +#ifndef _HII_HANDLE_H +#define _HII_HANDLE_H + +#include +#include +#include + +VOID +InitHiiHandleDatabase ( + VOID + ) +; + +EFI_STATUS +AllocateHiiHandle ( + FRAMEWORK_EFI_HII_HANDLE *Handle +); + + +VOID +FreeHiiHandle ( + FRAMEWORK_EFI_HII_HANDLE Handle +); + + +#endif + diff --git a/EdkCompatibilityPkg/Compatibility/FrameworkHiiToUefiHiiThunk/Package.c b/EdkCompatibilityPkg/Compatibility/FrameworkHiiToUefiHiiThunk/Package.c index 994c67b9a0..49cde52080 100644 --- a/EdkCompatibilityPkg/Compatibility/FrameworkHiiToUefiHiiThunk/Package.c +++ b/EdkCompatibilityPkg/Compatibility/FrameworkHiiToUefiHiiThunk/Package.c @@ -14,6 +14,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. #include "HiiDatabase.h" +#include "HiiHandle.h" STATIC BOOLEAN mInFrameworkHiiNewPack = FALSE; @@ -268,124 +269,7 @@ FindStringPackAndAddToPackListWithOnlyIfrPack( } -HII_THUNK_CONTEXT * -CreateThunkContext ( - IN HII_THUNK_PRIVATE_DATA *Private, - IN UINTN StringPackageCount, - IN UINTN IfrPackageCount - ) -{ - EFI_STATUS Status; - HII_THUNK_CONTEXT *ThunkContext; - - ThunkContext = AllocateZeroPool (sizeof (HII_THUNK_CONTEXT)); - ASSERT (ThunkContext != NULL); - - ThunkContext->Signature = HII_THUNK_CONTEXT_SIGNATURE; - ThunkContext->IfrPackageCount = IfrPackageCount; - ThunkContext->StringPackageCount = StringPackageCount; - Status = AssignFrameworkHiiHandle (Private, TRUE, &ThunkContext->FwHiiHandle); - if (EFI_ERROR (Status)) { - return NULL; - } - - InitializeListHead (&ThunkContext->QuestionIdMapListHead); - InitializeListHead (&ThunkContext->OneOfOptionMapListHead); - - - return ThunkContext; - -} - -VOID -FreeFrameworkHiiHandle ( - IN HII_THUNK_PRIVATE_DATA *Private, - IN FRAMEWORK_EFI_HII_HANDLE FwHandle - ) -{ - // - // TODO: - // - - return; -} - -VOID -DestoryOneOfOptionMap ( - IN LIST_ENTRY *OneOfOptionMapListHead - ) -{ - ONE_OF_OPTION_MAP *Map; - ONE_OF_OPTION_MAP_ENTRY *MapEntry; - LIST_ENTRY *Link; - LIST_ENTRY *Link2; - - while (!IsListEmpty (OneOfOptionMapListHead)) { - Link = GetFirstNode (OneOfOptionMapListHead); - - Map = ONE_OF_OPTION_MAP_FROM_LINK (Link); - - while (!IsListEmpty (&Map->OneOfOptionMapEntryListHead)) { - Link2 = GetFirstNode (&Map->OneOfOptionMapEntryListHead); - - MapEntry = ONE_OF_OPTION_MAP_ENTRY_FROM_LINK (Link); - - RemoveEntryList (Link2); - FreePool (MapEntry); - } - - RemoveEntryList (Link); - FreePool (Map); - } -} - -VOID -DestroyQuestionIdMap ( - IN LIST_ENTRY *QuestionIdMapListHead - ) -{ - QUESTION_ID_MAP *IdMap; - QUESTION_ID_MAP_ENTRY *IdMapEntry; - LIST_ENTRY *Link; - LIST_ENTRY *Link2; - - while (!IsListEmpty (QuestionIdMapListHead)) { - Link = GetFirstNode (QuestionIdMapListHead); - - IdMap = QUESTION_ID_MAP_FROM_LINK (Link); - - while (!IsListEmpty (&IdMap->MapEntryListHead)) { - Link2 = GetFirstNode (&IdMap->MapEntryListHead); - - IdMapEntry = QUESTION_ID_MAP_ENTRY_FROM_LINK (Link); - - RemoveEntryList (Link2); - - FreePool (IdMapEntry); - } - - RemoveEntryList (Link); - FreePool (IdMap); - } -} - -VOID -DestroyThunkContext ( - IN HII_THUNK_PRIVATE_DATA *Private, - IN HII_THUNK_CONTEXT *ThunkContext - ) -{ - ASSERT (ThunkContext != NULL); - - FreeFrameworkHiiHandle (Private, ThunkContext->FwHiiHandle); - - DestroyQuestionIdMap (&ThunkContext->QuestionIdMapListHead); - - DestoryOneOfOptionMap (&ThunkContext->OneOfOptionMapListHead); - - FreePool (ThunkContext); -} CONST EFI_GUID mAGuid = { 0x14f95e01, 0xd562, 0x432e, { 0x84, 0x4a, 0x95, 0xa4, 0x39, 0x5, 0x10, 0x7e } }; @@ -420,7 +304,8 @@ UefiRegisterPackageList( if (ThunkContext == NULL) { return EFI_OUT_OF_RESOURCES; } - + ThunkContext->ByFrameworkHiiNewPack = TRUE; + if (Packages->GuidId == NULL) { // // UEFI HII Database require Package List GUID must be unique. @@ -509,7 +394,7 @@ UefiRegisterPackageList( Done: if (EFI_ERROR (Status)) { - DestroyThunkContext (Private, ThunkContext); + DestroyThunkContext (ThunkContext); } else { InsertTailList (&Private->ThunkContextListHead, &ThunkContext->Link); *Handle = ThunkContext->FwHiiHandle; @@ -627,7 +512,7 @@ Returns: RemoveEntryList (&ThunkContext->Link); - DestroyThunkContext (Private, ThunkContext); + DestroyThunkContext (ThunkContext); }else { Status = EFI_NOT_FOUND; } @@ -669,8 +554,10 @@ NewOrAddPackNotify ( // ThunkContext = UefiHiiHandleToThunkContext (Private, Handle); if (ThunkContext == NULL) { - ThunkContext = CreateThunkContextForUefiHiiHandle (Private, Handle); + ThunkContext = CreateThunkContextForUefiHiiHandle (Handle); ASSERT (ThunkContext != NULL); + + InsertTailList (&Private->ThunkContextListHead, &ThunkContext->Link); } @@ -769,14 +656,14 @@ RemovePackNotify ( ThunkContext = UefiHiiHandleToThunkContext (Private, Handle); - if (ThunkContext->FwHiiHandle > Private->StaticHiiHandle) { + if (!ThunkContext->ByFrameworkHiiNewPack) { if (IsRemovingLastStringPack (Handle)) { // // If the string package will be removed is the last string package // in the package list, we will remove the HII Thunk entry from the // database. // - Status = DestroyThunkContextForUefiHiiHandle (Private, Handle); + DestroyThunkContextForUefiHiiHandle (Private, Handle); } } diff --git a/EdkCompatibilityPkg/Compatibility/FrameworkHiiToUefiHiiThunk/Utility.c b/EdkCompatibilityPkg/Compatibility/FrameworkHiiToUefiHiiThunk/Utility.c index 58019d5b95..9e41487778 100644 --- a/EdkCompatibilityPkg/Compatibility/FrameworkHiiToUefiHiiThunk/Utility.c +++ b/EdkCompatibilityPkg/Compatibility/FrameworkHiiToUefiHiiThunk/Utility.c @@ -15,6 +15,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. #include "HiiDatabase.h" +#include "HiiHandle.h" EFI_GUID gFrameworkHiiCompatbilityGuid = EFI_IFR_FRAMEWORK_GUID; EFI_GUID gTianoHiiIfrGuid = EFI_IFR_TIANO_GUID; @@ -137,47 +138,8 @@ TagGuidToUefiHiiHandle ( } -BOOLEAN -IsFrameworkHiiDatabaseHandleDepleted ( - IN CONST HII_THUNK_PRIVATE_DATA *Private - ) -{ - return (BOOLEAN) (Private->StaticHiiHandle == (UINTN) Private->StaticPureUefiHiiHandle); -} - -EFI_STATUS -AssignFrameworkHiiHandle ( - IN OUT HII_THUNK_PRIVATE_DATA *Private, - IN BOOLEAN FromFwHiiNewPack, - OUT FRAMEWORK_EFI_HII_HANDLE *Handle - ) -{ - ASSERT (Handle != NULL); - - if (FromFwHiiNewPack) { - - *Handle = Private->StaticHiiHandle; - Private->StaticHiiHandle += 1; - - if (IsFrameworkHiiDatabaseHandleDepleted (Private)) { - return EFI_OUT_OF_RESOURCES; - } - } else { - - *Handle = Private->StaticPureUefiHiiHandle; - Private->StaticPureUefiHiiHandle -= 1; - - if (IsFrameworkHiiDatabaseHandleDepleted (Private)) { - return EFI_OUT_OF_RESOURCES; - } - - } - - return EFI_SUCCESS; -} - -EFI_STATUS +VOID DestroyThunkContextForUefiHiiHandle ( IN HII_THUNK_PRIVATE_DATA *Private, IN EFI_HII_HANDLE UefiHiiHandle @@ -188,14 +150,7 @@ DestroyThunkContextForUefiHiiHandle ( ThunkContext = UefiHiiHandleToThunkContext (Private, UefiHiiHandle); ASSERT (ThunkContext != NULL); - ASSERT (IsListEmpty (&ThunkContext->OneOfOptionMapListHead)); - ASSERT (IsListEmpty (&ThunkContext->QuestionIdMapListHead)); - - RemoveEntryList (&ThunkContext->Link); - - FreePool (ThunkContext); - - return EFI_SUCCESS; + DestroyThunkContext (ThunkContext); } @@ -208,7 +163,6 @@ DestroyThunkContextForUefiHiiHandle ( **/ HII_THUNK_CONTEXT * CreateThunkContextForUefiHiiHandle ( - IN HII_THUNK_PRIVATE_DATA *Private, IN EFI_HII_HANDLE UefiHiiHandle ) { @@ -221,7 +175,7 @@ CreateThunkContextForUefiHiiHandle ( ThunkContext->Signature = HII_THUNK_CONTEXT_SIGNATURE; - Status = AssignFrameworkHiiHandle (Private, FALSE, &ThunkContext->FwHiiHandle); + Status = AllocateHiiHandle (&ThunkContext->FwHiiHandle); if (EFI_ERROR (Status)) { return NULL; } @@ -236,8 +190,6 @@ CreateThunkContextForUefiHiiHandle ( InitializeListHead (&ThunkContext->QuestionIdMapListHead); InitializeListHead (&ThunkContext->OneOfOptionMapListHead); - InsertTailList (&Private->ThunkContextListHead, &ThunkContext->Link); - return ThunkContext; } @@ -471,3 +423,114 @@ GetMapEntryListHead ( } +HII_THUNK_CONTEXT * +CreateThunkContext ( + IN HII_THUNK_PRIVATE_DATA *Private, + IN UINTN StringPackageCount, + IN UINTN IfrPackageCount + ) +{ + EFI_STATUS Status; + HII_THUNK_CONTEXT *ThunkContext; + + ThunkContext = AllocateZeroPool (sizeof (HII_THUNK_CONTEXT)); + ASSERT (ThunkContext != NULL); + + ThunkContext->Signature = HII_THUNK_CONTEXT_SIGNATURE; + ThunkContext->IfrPackageCount = IfrPackageCount; + ThunkContext->StringPackageCount = StringPackageCount; + Status = AllocateHiiHandle (&ThunkContext->FwHiiHandle); + if (EFI_ERROR (Status)) { + return NULL; + } + + InitializeListHead (&ThunkContext->QuestionIdMapListHead); + InitializeListHead (&ThunkContext->OneOfOptionMapListHead); + + + return ThunkContext; + +} + +VOID +DestroyThunkContext ( + IN HII_THUNK_CONTEXT *ThunkContext + ) +{ + ASSERT (ThunkContext != NULL); + + FreeHiiHandle (ThunkContext->FwHiiHandle); + + DestroyQuestionIdMap (&ThunkContext->QuestionIdMapListHead); + + DestoryOneOfOptionMap (&ThunkContext->OneOfOptionMapListHead); + + RemoveEntryList (&ThunkContext->Link); + + FreePool (ThunkContext); +} + + +VOID +DestroyQuestionIdMap ( + IN LIST_ENTRY *QuestionIdMapListHead + ) +{ + QUESTION_ID_MAP *IdMap; + QUESTION_ID_MAP_ENTRY *IdMapEntry; + LIST_ENTRY *Link; + LIST_ENTRY *Link2; + + while (!IsListEmpty (QuestionIdMapListHead)) { + Link = GetFirstNode (QuestionIdMapListHead); + + IdMap = QUESTION_ID_MAP_FROM_LINK (Link); + + while (!IsListEmpty (&IdMap->MapEntryListHead)) { + Link2 = GetFirstNode (&IdMap->MapEntryListHead); + + IdMapEntry = QUESTION_ID_MAP_ENTRY_FROM_LINK (Link); + + RemoveEntryList (Link2); + + FreePool (IdMapEntry); + } + + RemoveEntryList (Link); + FreePool (IdMap); + } +} + +VOID +DestoryOneOfOptionMap ( + IN LIST_ENTRY *OneOfOptionMapListHead + ) +{ + ONE_OF_OPTION_MAP *Map; + ONE_OF_OPTION_MAP_ENTRY *MapEntry; + LIST_ENTRY *Link; + LIST_ENTRY *Link2; + + while (!IsListEmpty (OneOfOptionMapListHead)) { + Link = GetFirstNode (OneOfOptionMapListHead); + + Map = ONE_OF_OPTION_MAP_FROM_LINK (Link); + + while (!IsListEmpty (&Map->OneOfOptionMapEntryListHead)) { + Link2 = GetFirstNode (&Map->OneOfOptionMapEntryListHead); + + MapEntry = ONE_OF_OPTION_MAP_ENTRY_FROM_LINK (Link); + + RemoveEntryList (Link2); + + FreePool (MapEntry); + } + + RemoveEntryList (Link); + FreePool (Map); + } +} + + + + diff --git a/EdkCompatibilityPkg/Compatibility/FrameworkHiiToUefiHiiThunk/Utility.h b/EdkCompatibilityPkg/Compatibility/FrameworkHiiToUefiHiiThunk/Utility.h index e8867ed29a..d6b758d140 100644 --- a/EdkCompatibilityPkg/Compatibility/FrameworkHiiToUefiHiiThunk/Utility.h +++ b/EdkCompatibilityPkg/Compatibility/FrameworkHiiToUefiHiiThunk/Utility.h @@ -70,12 +70,11 @@ AssignFrameworkHiiHandle ( HII_THUNK_CONTEXT * CreateThunkContextForUefiHiiHandle ( - IN HII_THUNK_PRIVATE_DATA *Private, IN EFI_HII_HANDLE UefiHiiHandle ) ; -EFI_STATUS +VOID DestroyThunkContextForUefiHiiHandle ( IN HII_THUNK_PRIVATE_DATA *Private, IN EFI_HII_HANDLE UefiHiiHandle @@ -102,4 +101,31 @@ GetMapEntryListHead ( ) ; +HII_THUNK_CONTEXT * +CreateThunkContext ( + IN HII_THUNK_PRIVATE_DATA *Private, + IN UINTN StringPackageCount, + IN UINTN IfrPackageCount + ) +; + +VOID +DestroyThunkContext ( + IN HII_THUNK_CONTEXT *ThunkContext + ) +; + +VOID +DestroyQuestionIdMap ( + IN LIST_ENTRY *QuestionIdMapListHead + ) +; + + +VOID +DestoryOneOfOptionMap ( + IN LIST_ENTRY *OneOfOptionMapListHead + ) +; + #endif -- 2.39.2