mirror of https://github.com/acidanthera/audk.git
1) Fix a bug. Before this fix, a Module that calling UEFI HII Interface to get the String Information will fail to locate the Package List based on a Package GUID if a required String Pack is registered using Framework HII NewPack instance.
2) Correct a few other minor issues. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@5185 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
parent
adf74fc6b2
commit
63dd6a961c
|
@ -120,7 +120,6 @@ GetBufferStorage (
|
|||
EFI_STATUS
|
||||
InstallDefaultUefiConfigAccessProtocol (
|
||||
IN CONST EFI_HII_PACKAGES *Packages,
|
||||
OUT EFI_HANDLE *Handle,
|
||||
IN OUT HII_TRHUNK_HANDLE_MAPPING_DATABASE_ENTRY *MapEntry
|
||||
)
|
||||
{
|
||||
|
@ -128,7 +127,7 @@ InstallDefaultUefiConfigAccessProtocol (
|
|||
EFI_STATUS Status;
|
||||
HII_TRHUNK_CONFIG_ACCESS_PROTOCOL_INSTANCE *ConfigAccessInstance;
|
||||
|
||||
Status = HiiLibCreateHiiDriverHandle (Handle);
|
||||
Status = HiiLibCreateHiiDriverHandle (&MapEntry->UefiHiiDriverHandle);
|
||||
ConfigAccessInstance = AllocateCopyPool (
|
||||
sizeof (HII_TRHUNK_CONFIG_ACCESS_PROTOCOL_INSTANCE),
|
||||
&ConfigAccessProtocolInstanceTempate
|
||||
|
@ -147,7 +146,7 @@ InstallDefaultUefiConfigAccessProtocol (
|
|||
}
|
||||
|
||||
Status = gBS->InstallMultipleProtocolInterfaces (
|
||||
Handle,
|
||||
&MapEntry->UefiHiiDriverHandle,
|
||||
&gEfiHiiConfigAccessProtocolGuid,
|
||||
&ConfigAccessInstance->ConfigAccessProtocol,
|
||||
NULL
|
||||
|
|
|
@ -21,7 +21,6 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
|||
EFI_STATUS
|
||||
InstallDefaultUefiConfigAccessProtocol (
|
||||
IN CONST EFI_HII_PACKAGES *Packages,
|
||||
OUT EFI_HANDLE *Handle,
|
||||
IN OUT HII_TRHUNK_HANDLE_MAPPING_DATABASE_ENTRY *MapEntry
|
||||
)
|
||||
;
|
||||
|
|
|
@ -136,6 +136,10 @@ AddPackNotify (
|
|||
Status = EFI_SUCCESS;
|
||||
Private = mHiiThunkPrivateData;
|
||||
|
||||
if (mInFrameworkHiiNewPack) {
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
//
|
||||
// We only create a MapEntry if the Uefi Hii Handle is only already registered
|
||||
// by the HII Thunk Layer.
|
||||
|
@ -252,6 +256,10 @@ RemovePackNotify (
|
|||
ASSERT (PackageType == EFI_HII_PACKAGE_STRINGS);
|
||||
ASSERT (NotifyType == EFI_HII_DATABASE_NOTIFY_REMOVE_PACK);
|
||||
|
||||
if (mInFrameworkHiiRemovePack) {
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
Private = mHiiThunkPrivateData;
|
||||
|
||||
MapEntry = UefiHiiHandleToMapDatabaseEntry (Private, Handle);
|
||||
|
|
|
@ -95,6 +95,7 @@ typedef struct {
|
|||
UINT32 Signature;
|
||||
FRAMEWORK_EFI_HII_HANDLE FrameworkHiiHandle;
|
||||
EFI_HII_HANDLE UefiHiiHandle;
|
||||
EFI_HANDLE UefiHiiDriverHandle;
|
||||
|
||||
BOOLEAN IsPackageListWithOnlyStringPackages;
|
||||
//
|
||||
|
@ -151,6 +152,7 @@ extern CONST EFI_HII_STRING_PROTOCOL *mHiiStringProtocol;
|
|||
extern CONST EFI_HII_CONFIG_ROUTING_PROTOCOL *mHiiConfigRoutingProtocol;
|
||||
|
||||
extern BOOLEAN mInFrameworkHiiNewPack;
|
||||
extern BOOLEAN mInFrameworkHiiRemovePack;
|
||||
|
||||
|
||||
//
|
||||
|
|
|
@ -17,6 +17,10 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
|||
#include "HiiDatabase.h"
|
||||
|
||||
|
||||
BOOLEAN mInFrameworkHiiNewPack = FALSE;
|
||||
BOOLEAN mInFrameworkHiiRemovePack = FALSE;
|
||||
|
||||
|
||||
EFI_STATUS
|
||||
GetIfrAndStringPackNum (
|
||||
IN CONST EFI_HII_PACKAGES *Packages,
|
||||
|
@ -196,7 +200,7 @@ AddStringPackagesToMatchingIfrPackageList (
|
|||
EFI_HII_PACKAGE_LIST_HEADER *
|
||||
PrepareUefiPackageListFromFrameworkHiiPackages (
|
||||
IN CONST EFI_HII_PACKAGES *Packages,
|
||||
IN CONST EFI_GUID *GuidId OPTIONAL
|
||||
IN CONST EFI_GUID *PackageListGuid
|
||||
)
|
||||
{
|
||||
UINTN NumberOfPackages;
|
||||
|
@ -208,6 +212,9 @@ PrepareUefiPackageListFromFrameworkHiiPackages (
|
|||
UINTN Index;
|
||||
TIANO_AUTOGEN_PACKAGES_HEADER **TianoAutogenPackageHdrArray;
|
||||
|
||||
ASSERT (Packages != NULL);
|
||||
ASSERT (PackageListGuid != NULL);
|
||||
|
||||
TianoAutogenPackageHdrArray = (TIANO_AUTOGEN_PACKAGES_HEADER **) ((UINT8 *) &Packages->GuidId + sizeof (Packages->GuidId));
|
||||
NumberOfPackages = Packages->NumberOfPackages;
|
||||
|
||||
|
@ -227,11 +234,8 @@ PrepareUefiPackageListFromFrameworkHiiPackages (
|
|||
PackageListLength += sizeof (EFI_HII_PACKAGE_HEADER);
|
||||
PackageListHeader = AllocateZeroPool (PackageListLength);
|
||||
ASSERT (PackageListHeader != NULL);
|
||||
if (GuidId == NULL) {
|
||||
CopyMem (&PackageListHeader->PackageListGuid, Packages->GuidId, sizeof (EFI_GUID));
|
||||
} else {
|
||||
CopyMem (&PackageListHeader->PackageListGuid, GuidId, sizeof (EFI_GUID));
|
||||
}
|
||||
|
||||
CopyMem (&PackageListHeader->PackageListGuid, PackageListGuid, sizeof (EFI_GUID));
|
||||
PackageListHeader->PackageLength = PackageListLength;
|
||||
|
||||
PackageListData = ((UINT8 *) PackageListHeader) + sizeof (EFI_HII_PACKAGE_LIST_HEADER);
|
||||
|
@ -324,9 +328,7 @@ UefiRegisterPackageList(
|
|||
EFI_HII_PACKAGE_LIST_HEADER *UefiPackageListHeader;
|
||||
HII_TRHUNK_HANDLE_MAPPING_DATABASE_ENTRY *HandleMappingEntry;
|
||||
EFI_GUID GuidId;
|
||||
EFI_HANDLE UefiHiiDriverHandle;
|
||||
|
||||
UefiHiiDriverHandle = NULL;
|
||||
UefiPackageListHeader = NULL;
|
||||
|
||||
Status = GetIfrAndStringPackNum (Packages, &IfrPackNum, &StringPackNum);
|
||||
|
@ -355,6 +357,8 @@ UefiRegisterPackageList(
|
|||
if (Packages->GuidId == NULL) {
|
||||
Packages->GuidId = &GuidId;
|
||||
GenerateGuidId (&mAGuid, Packages->GuidId);
|
||||
} else {
|
||||
CopyGuid (&GuidId, Packages->GuidId);
|
||||
}
|
||||
|
||||
CopyGuid (&HandleMappingEntry->TagGuid, Packages->GuidId);
|
||||
|
@ -373,13 +377,13 @@ UefiRegisterPackageList(
|
|||
// that Setup Utility can load the Buffer Storage using this protocol.
|
||||
//
|
||||
if (IfrPackNum != 0) {
|
||||
InstallDefaultUefiConfigAccessProtocol (Packages, &UefiHiiDriverHandle, HandleMappingEntry);
|
||||
InstallDefaultUefiConfigAccessProtocol (Packages, HandleMappingEntry);
|
||||
}
|
||||
UefiPackageListHeader = PrepareUefiPackageListFromFrameworkHiiPackages (Packages, &GuidId);
|
||||
Status = mHiiDatabase->NewPackageList (
|
||||
mHiiDatabase,
|
||||
UefiPackageListHeader,
|
||||
UefiHiiDriverHandle,
|
||||
HandleMappingEntry->UefiHiiDriverHandle,
|
||||
&HandleMappingEntry->UefiHiiHandle
|
||||
);
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
|
@ -438,7 +442,6 @@ Done:
|
|||
return Status;
|
||||
}
|
||||
|
||||
BOOLEAN mInFrameworkHiiNewPack = FALSE;
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
|
@ -468,6 +471,7 @@ Returns:
|
|||
{
|
||||
EFI_STATUS Status;
|
||||
EFI_HII_THUNK_PRIVATE_DATA *Private;
|
||||
EFI_TPL OldTpl;
|
||||
|
||||
if (Handle == NULL) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
|
@ -477,6 +481,8 @@ Returns:
|
|||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
OldTpl = gBS->RaiseTPL (TPL_NOTIFY);
|
||||
|
||||
//
|
||||
// We use a simple Global variable to inform NewPackNotify
|
||||
// that the package list registered here is already registered
|
||||
|
@ -495,6 +501,8 @@ Returns:
|
|||
|
||||
mInFrameworkHiiNewPack = FALSE;
|
||||
|
||||
gBS->RestoreTPL (OldTpl);
|
||||
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
@ -518,41 +526,54 @@ Returns:
|
|||
EFI_STATUS Status;
|
||||
EFI_HII_THUNK_PRIVATE_DATA *Private;
|
||||
HII_TRHUNK_HANDLE_MAPPING_DATABASE_ENTRY *HandleMapEntry;
|
||||
EFI_DEVICE_PATH_PROTOCOL *Path;
|
||||
EFI_TPL OldTpl;
|
||||
EFI_HII_CONFIG_ACCESS_PROTOCOL *ConfigAccess;
|
||||
|
||||
OldTpl = gBS->RaiseTPL (TPL_NOTIFY);
|
||||
|
||||
mInFrameworkHiiRemovePack = TRUE;
|
||||
|
||||
Private = EFI_HII_THUNK_PRIVATE_DATA_FROM_THIS(This);
|
||||
|
||||
HandleMapEntry = FrameworkHiiHandleToMapDatabaseEntry (Private, Handle);
|
||||
|
||||
if (HandleMapEntry->UefiHiiHandle != NULL) {
|
||||
if (HandleMapEntry != NULL) {
|
||||
Status = mHiiDatabase->RemovePackageList (
|
||||
mHiiDatabase,
|
||||
HandleMapEntry->UefiHiiHandle
|
||||
);
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
|
||||
HiiLibDestroyHiiDriverHandle (HandleMapEntry->UefiHiiHandle);
|
||||
|
||||
Status = gBS->HandleProtocol (
|
||||
HandleMapEntry->UefiHiiHandle,
|
||||
&gEfiDevicePathProtocolGuid,
|
||||
&Path
|
||||
HandleMapEntry->UefiHiiDriverHandle,
|
||||
&gEfiHiiConfigAccessProtocolGuid,
|
||||
(VOID **) &ConfigAccess
|
||||
);
|
||||
|
||||
if (!EFI_ERROR (Status)) {
|
||||
Status = gBS->UninstallProtocolInterface (
|
||||
HandleMapEntry->UefiHiiHandle,
|
||||
&gEfiDevicePathProtocolGuid,
|
||||
Path
|
||||
HandleMapEntry->UefiHiiDriverHandle,
|
||||
&gEfiHiiConfigAccessProtocolGuid,
|
||||
ConfigAccess
|
||||
);
|
||||
if (!EFI_ERROR (Status)) {
|
||||
FreePool (Path);
|
||||
}
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
} else {
|
||||
Status = EFI_SUCCESS;
|
||||
}
|
||||
|
||||
RemoveEntryList (&HandleMapEntry->List);
|
||||
|
||||
FreePool (HandleMapEntry);
|
||||
return Status;
|
||||
|
||||
}else {
|
||||
Status = EFI_NOT_FOUND;
|
||||
}
|
||||
|
||||
return EFI_NOT_FOUND;
|
||||
mInFrameworkHiiRemovePack = FALSE;
|
||||
|
||||
gBS->RestoreTPL (OldTpl);
|
||||
|
||||
return Status;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue