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
This commit is contained in:
parent
1a8802f763
commit
d4775f2a4c
|
@ -633,12 +633,14 @@ CreateIfrDataArray (
|
||||||
LIST_ENTRY *Link;
|
LIST_ENTRY *Link;
|
||||||
EFI_STATUS Status;
|
EFI_STATUS Status;
|
||||||
|
|
||||||
|
Link = GetFirstNode (&ConfigAccess->BufferStorageListHead);
|
||||||
|
if (IsNull (&ConfigAccess->BufferStorageListHead, Link)) {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
IfrDataArray = AllocateZeroPool (0x100);
|
IfrDataArray = AllocateZeroPool (0x100);
|
||||||
ASSERT (IfrDataArray != NULL);
|
ASSERT (IfrDataArray != NULL);
|
||||||
|
|
||||||
Link = GetFirstNode (&ConfigAccess->BufferStorageListHead);
|
|
||||||
ASSERT (!IsNull (&ConfigAccess->BufferStorageListHead, Link));
|
|
||||||
|
|
||||||
BufferStorageEntry = BUFFER_STORAGE_ENTRY_FROM_LINK(Link);
|
BufferStorageEntry = BUFFER_STORAGE_ENTRY_FROM_LINK(Link);
|
||||||
BrowserDataSize = BufferStorageEntry->Size;
|
BrowserDataSize = BufferStorageEntry->Size;
|
||||||
|
|
||||||
|
@ -702,11 +704,13 @@ DestroyIfrDataArray (
|
||||||
IN BOOLEAN NvMapAllocated
|
IN BOOLEAN NvMapAllocated
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
if (NvMapAllocated) {
|
if (Array != NULL) {
|
||||||
FreePool (Array->NvRamMap);
|
if (NvMapAllocated) {
|
||||||
}
|
FreePool (Array->NvRamMap);
|
||||||
|
}
|
||||||
|
|
||||||
FreePool (Array);
|
FreePool (Array);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -950,6 +954,7 @@ ThunkCallback (
|
||||||
*ActionRequest = EFI_BROWSER_ACTION_REQUEST_SUBMIT;
|
*ActionRequest = EFI_BROWSER_ACTION_REQUEST_SUBMIT;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
DestroyIfrDataArray (Data, NvMapAllocated);
|
DestroyIfrDataArray (Data, NvMapAllocated);
|
||||||
|
|
||||||
return Status;
|
return Status;
|
||||||
|
|
|
@ -37,6 +37,8 @@
|
||||||
#
|
#
|
||||||
|
|
||||||
[Sources.common]
|
[Sources.common]
|
||||||
|
HiiHandle.c
|
||||||
|
HiiHandle.h
|
||||||
ConfigAccess.c
|
ConfigAccess.c
|
||||||
ConfigAccess.h
|
ConfigAccess.h
|
||||||
OpcodeCreation.c
|
OpcodeCreation.c
|
||||||
|
|
|
@ -14,6 +14,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
**/
|
**/
|
||||||
|
|
||||||
#include "HiiDatabase.h"
|
#include "HiiDatabase.h"
|
||||||
|
#include "HiiHandle.h"
|
||||||
|
|
||||||
HII_THUNK_PRIVATE_DATA *mHiiThunkPrivateData;
|
HII_THUNK_PRIVATE_DATA *mHiiThunkPrivateData;
|
||||||
|
|
||||||
|
@ -43,20 +44,6 @@ HII_THUNK_PRIVATE_DATA mHiiThunkPrivateDataTempate = {
|
||||||
HiiGetKeyboardLayout
|
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
|
NULL, NULL //HiiHandleLinkList
|
||||||
},
|
},
|
||||||
|
@ -111,6 +98,7 @@ Returns:
|
||||||
UINTN BufferLength;
|
UINTN BufferLength;
|
||||||
EFI_HII_HANDLE *Buffer;
|
EFI_HII_HANDLE *Buffer;
|
||||||
UINTN Index;
|
UINTN Index;
|
||||||
|
HII_THUNK_CONTEXT *ThunkContext;
|
||||||
|
|
||||||
|
|
||||||
ASSERT_PROTOCOL_ALREADY_INSTALLED (NULL, &gEfiHiiProtocolGuid);
|
ASSERT_PROTOCOL_ALREADY_INSTALLED (NULL, &gEfiHiiProtocolGuid);
|
||||||
|
@ -119,6 +107,8 @@ Returns:
|
||||||
ASSERT (Private != NULL);
|
ASSERT (Private != NULL);
|
||||||
InitializeListHead (&Private->ThunkContextListHead);
|
InitializeListHead (&Private->ThunkContextListHead);
|
||||||
|
|
||||||
|
InitHiiHandleDatabase ();
|
||||||
|
|
||||||
mHiiThunkPrivateData = Private;
|
mHiiThunkPrivateData = Private;
|
||||||
|
|
||||||
Status = gBS->LocateProtocol (
|
Status = gBS->LocateProtocol (
|
||||||
|
@ -174,8 +164,10 @@ Returns:
|
||||||
Status = HiiLibListPackageLists (EFI_HII_PACKAGE_STRINGS, NULL, &BufferLength, &Buffer);
|
Status = HiiLibListPackageLists (EFI_HII_PACKAGE_STRINGS, NULL, &BufferLength, &Buffer);
|
||||||
if (Status == EFI_SUCCESS) {
|
if (Status == EFI_SUCCESS) {
|
||||||
for (Index = 0; Index < BufferLength / sizeof (EFI_HII_HANDLE); Index++) {
|
for (Index = 0; Index < BufferLength / sizeof (EFI_HII_HANDLE); Index++) {
|
||||||
CreateThunkContextForUefiHiiHandle (Private, Buffer[Index]);
|
ThunkContext = CreateThunkContextForUefiHiiHandle (Buffer[Index]);
|
||||||
ASSERT_EFI_ERROR (Status);
|
ASSERT (ThunkContext!= NULL);
|
||||||
|
|
||||||
|
InsertTailList (&Private->ThunkContextListHead, &ThunkContext->Link);
|
||||||
}
|
}
|
||||||
|
|
||||||
FreePool (Buffer);
|
FreePool (Buffer);
|
||||||
|
|
|
@ -64,8 +64,6 @@ typedef struct {
|
||||||
UINTN Signature;
|
UINTN Signature;
|
||||||
EFI_HANDLE Handle;
|
EFI_HANDLE Handle;
|
||||||
EFI_HII_PROTOCOL Hii;
|
EFI_HII_PROTOCOL Hii;
|
||||||
FRAMEWORK_EFI_HII_HANDLE StaticHiiHandle;
|
|
||||||
FRAMEWORK_EFI_HII_HANDLE StaticPureUefiHiiHandle;
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// The head of link list for all HII_THUNK_CONTEXT.
|
// The head of link list for all HII_THUNK_CONTEXT.
|
||||||
|
@ -141,6 +139,8 @@ typedef struct {
|
||||||
UINTN IfrPackageCount;
|
UINTN IfrPackageCount;
|
||||||
UINTN StringPackageCount;
|
UINTN StringPackageCount;
|
||||||
|
|
||||||
|
BOOLEAN ByFrameworkHiiNewPack;
|
||||||
|
|
||||||
//
|
//
|
||||||
// The field below is only valid if IsPackageListWithOnlyStringPack is TRUE.
|
// 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
|
// The HII 0.92 version of HII data implementation in EDK 1.03 and 1.04 make an the following assumption
|
||||||
|
|
|
@ -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)));
|
||||||
|
}
|
|
@ -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 <FrameworkDxe.h>
|
||||||
|
#include <Protocol/FrameworkHii.h>
|
||||||
|
#include <Library/DebugLib.h>
|
||||||
|
|
||||||
|
VOID
|
||||||
|
InitHiiHandleDatabase (
|
||||||
|
VOID
|
||||||
|
)
|
||||||
|
;
|
||||||
|
|
||||||
|
EFI_STATUS
|
||||||
|
AllocateHiiHandle (
|
||||||
|
FRAMEWORK_EFI_HII_HANDLE *Handle
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
VOID
|
||||||
|
FreeHiiHandle (
|
||||||
|
FRAMEWORK_EFI_HII_HANDLE Handle
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
|
@ -14,6 +14,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
|
|
||||||
|
|
||||||
#include "HiiDatabase.h"
|
#include "HiiDatabase.h"
|
||||||
|
#include "HiiHandle.h"
|
||||||
|
|
||||||
|
|
||||||
STATIC BOOLEAN mInFrameworkHiiNewPack = FALSE;
|
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 =
|
CONST EFI_GUID mAGuid =
|
||||||
{ 0x14f95e01, 0xd562, 0x432e, { 0x84, 0x4a, 0x95, 0xa4, 0x39, 0x5, 0x10, 0x7e } };
|
{ 0x14f95e01, 0xd562, 0x432e, { 0x84, 0x4a, 0x95, 0xa4, 0x39, 0x5, 0x10, 0x7e } };
|
||||||
|
@ -420,7 +304,8 @@ UefiRegisterPackageList(
|
||||||
if (ThunkContext == NULL) {
|
if (ThunkContext == NULL) {
|
||||||
return EFI_OUT_OF_RESOURCES;
|
return EFI_OUT_OF_RESOURCES;
|
||||||
}
|
}
|
||||||
|
ThunkContext->ByFrameworkHiiNewPack = TRUE;
|
||||||
|
|
||||||
if (Packages->GuidId == NULL) {
|
if (Packages->GuidId == NULL) {
|
||||||
//
|
//
|
||||||
// UEFI HII Database require Package List GUID must be unique.
|
// UEFI HII Database require Package List GUID must be unique.
|
||||||
|
@ -509,7 +394,7 @@ UefiRegisterPackageList(
|
||||||
|
|
||||||
Done:
|
Done:
|
||||||
if (EFI_ERROR (Status)) {
|
if (EFI_ERROR (Status)) {
|
||||||
DestroyThunkContext (Private, ThunkContext);
|
DestroyThunkContext (ThunkContext);
|
||||||
} else {
|
} else {
|
||||||
InsertTailList (&Private->ThunkContextListHead, &ThunkContext->Link);
|
InsertTailList (&Private->ThunkContextListHead, &ThunkContext->Link);
|
||||||
*Handle = ThunkContext->FwHiiHandle;
|
*Handle = ThunkContext->FwHiiHandle;
|
||||||
|
@ -627,7 +512,7 @@ Returns:
|
||||||
|
|
||||||
RemoveEntryList (&ThunkContext->Link);
|
RemoveEntryList (&ThunkContext->Link);
|
||||||
|
|
||||||
DestroyThunkContext (Private, ThunkContext);
|
DestroyThunkContext (ThunkContext);
|
||||||
}else {
|
}else {
|
||||||
Status = EFI_NOT_FOUND;
|
Status = EFI_NOT_FOUND;
|
||||||
}
|
}
|
||||||
|
@ -669,8 +554,10 @@ NewOrAddPackNotify (
|
||||||
//
|
//
|
||||||
ThunkContext = UefiHiiHandleToThunkContext (Private, Handle);
|
ThunkContext = UefiHiiHandleToThunkContext (Private, Handle);
|
||||||
if (ThunkContext == NULL) {
|
if (ThunkContext == NULL) {
|
||||||
ThunkContext = CreateThunkContextForUefiHiiHandle (Private, Handle);
|
ThunkContext = CreateThunkContextForUefiHiiHandle (Handle);
|
||||||
ASSERT (ThunkContext != NULL);
|
ASSERT (ThunkContext != NULL);
|
||||||
|
|
||||||
|
InsertTailList (&Private->ThunkContextListHead, &ThunkContext->Link);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -769,14 +656,14 @@ RemovePackNotify (
|
||||||
|
|
||||||
ThunkContext = UefiHiiHandleToThunkContext (Private, Handle);
|
ThunkContext = UefiHiiHandleToThunkContext (Private, Handle);
|
||||||
|
|
||||||
if (ThunkContext->FwHiiHandle > Private->StaticHiiHandle) {
|
if (!ThunkContext->ByFrameworkHiiNewPack) {
|
||||||
if (IsRemovingLastStringPack (Handle)) {
|
if (IsRemovingLastStringPack (Handle)) {
|
||||||
//
|
//
|
||||||
// If the string package will be removed is the last string package
|
// 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
|
// in the package list, we will remove the HII Thunk entry from the
|
||||||
// database.
|
// database.
|
||||||
//
|
//
|
||||||
Status = DestroyThunkContextForUefiHiiHandle (Private, Handle);
|
DestroyThunkContextForUefiHiiHandle (Private, Handle);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -15,6 +15,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
|
|
||||||
|
|
||||||
#include "HiiDatabase.h"
|
#include "HiiDatabase.h"
|
||||||
|
#include "HiiHandle.h"
|
||||||
|
|
||||||
EFI_GUID gFrameworkHiiCompatbilityGuid = EFI_IFR_FRAMEWORK_GUID;
|
EFI_GUID gFrameworkHiiCompatbilityGuid = EFI_IFR_FRAMEWORK_GUID;
|
||||||
EFI_GUID gTianoHiiIfrGuid = EFI_IFR_TIANO_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
|
VOID
|
||||||
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
|
|
||||||
DestroyThunkContextForUefiHiiHandle (
|
DestroyThunkContextForUefiHiiHandle (
|
||||||
IN HII_THUNK_PRIVATE_DATA *Private,
|
IN HII_THUNK_PRIVATE_DATA *Private,
|
||||||
IN EFI_HII_HANDLE UefiHiiHandle
|
IN EFI_HII_HANDLE UefiHiiHandle
|
||||||
|
@ -188,14 +150,7 @@ DestroyThunkContextForUefiHiiHandle (
|
||||||
ThunkContext = UefiHiiHandleToThunkContext (Private, UefiHiiHandle);
|
ThunkContext = UefiHiiHandleToThunkContext (Private, UefiHiiHandle);
|
||||||
ASSERT (ThunkContext != NULL);
|
ASSERT (ThunkContext != NULL);
|
||||||
|
|
||||||
ASSERT (IsListEmpty (&ThunkContext->OneOfOptionMapListHead));
|
DestroyThunkContext (ThunkContext);
|
||||||
ASSERT (IsListEmpty (&ThunkContext->QuestionIdMapListHead));
|
|
||||||
|
|
||||||
RemoveEntryList (&ThunkContext->Link);
|
|
||||||
|
|
||||||
FreePool (ThunkContext);
|
|
||||||
|
|
||||||
return EFI_SUCCESS;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -208,7 +163,6 @@ DestroyThunkContextForUefiHiiHandle (
|
||||||
**/
|
**/
|
||||||
HII_THUNK_CONTEXT *
|
HII_THUNK_CONTEXT *
|
||||||
CreateThunkContextForUefiHiiHandle (
|
CreateThunkContextForUefiHiiHandle (
|
||||||
IN HII_THUNK_PRIVATE_DATA *Private,
|
|
||||||
IN EFI_HII_HANDLE UefiHiiHandle
|
IN EFI_HII_HANDLE UefiHiiHandle
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
@ -221,7 +175,7 @@ CreateThunkContextForUefiHiiHandle (
|
||||||
|
|
||||||
ThunkContext->Signature = HII_THUNK_CONTEXT_SIGNATURE;
|
ThunkContext->Signature = HII_THUNK_CONTEXT_SIGNATURE;
|
||||||
|
|
||||||
Status = AssignFrameworkHiiHandle (Private, FALSE, &ThunkContext->FwHiiHandle);
|
Status = AllocateHiiHandle (&ThunkContext->FwHiiHandle);
|
||||||
if (EFI_ERROR (Status)) {
|
if (EFI_ERROR (Status)) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
@ -236,8 +190,6 @@ CreateThunkContextForUefiHiiHandle (
|
||||||
InitializeListHead (&ThunkContext->QuestionIdMapListHead);
|
InitializeListHead (&ThunkContext->QuestionIdMapListHead);
|
||||||
InitializeListHead (&ThunkContext->OneOfOptionMapListHead);
|
InitializeListHead (&ThunkContext->OneOfOptionMapListHead);
|
||||||
|
|
||||||
InsertTailList (&Private->ThunkContextListHead, &ThunkContext->Link);
|
|
||||||
|
|
||||||
return ThunkContext;
|
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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -70,12 +70,11 @@ AssignFrameworkHiiHandle (
|
||||||
|
|
||||||
HII_THUNK_CONTEXT *
|
HII_THUNK_CONTEXT *
|
||||||
CreateThunkContextForUefiHiiHandle (
|
CreateThunkContextForUefiHiiHandle (
|
||||||
IN HII_THUNK_PRIVATE_DATA *Private,
|
|
||||||
IN EFI_HII_HANDLE UefiHiiHandle
|
IN EFI_HII_HANDLE UefiHiiHandle
|
||||||
)
|
)
|
||||||
;
|
;
|
||||||
|
|
||||||
EFI_STATUS
|
VOID
|
||||||
DestroyThunkContextForUefiHiiHandle (
|
DestroyThunkContextForUefiHiiHandle (
|
||||||
IN HII_THUNK_PRIVATE_DATA *Private,
|
IN HII_THUNK_PRIVATE_DATA *Private,
|
||||||
IN EFI_HII_HANDLE UefiHiiHandle
|
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
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue