summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorqwang12 <qwang12@6f19259b-4bc3-4df7-8a09-765794883524>2008-05-08 08:57:58 +0000
committerqwang12 <qwang12@6f19259b-4bc3-4df7-8a09-765794883524>2008-05-08 08:57:58 +0000
commit63dd6a961c9e156e599c3c1a81949281c5e59268 (patch)
tree52c494685e1801d372acffd07a463bbf5e751def
parentadf74fc6b2a9e5e362e1791fb4784784e5bea4ef (diff)
downloadedk2-platforms-63dd6a961c9e156e599c3c1a81949281c5e59268.tar.xz
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
-rw-r--r--EdkCompatibilityPkg/Compatibility/FrameworkHiiToUefiHiiThunk/ConfigAccess.c5
-rw-r--r--EdkCompatibilityPkg/Compatibility/FrameworkHiiToUefiHiiThunk/ConfigAccess.h1
-rw-r--r--EdkCompatibilityPkg/Compatibility/FrameworkHiiToUefiHiiThunk/HiiDatabase.c8
-rw-r--r--EdkCompatibilityPkg/Compatibility/FrameworkHiiToUefiHiiThunk/HiiDatabase.h2
-rw-r--r--EdkCompatibilityPkg/Compatibility/FrameworkHiiToUefiHiiThunk/Package.c69
5 files changed, 57 insertions, 28 deletions
diff --git a/EdkCompatibilityPkg/Compatibility/FrameworkHiiToUefiHiiThunk/ConfigAccess.c b/EdkCompatibilityPkg/Compatibility/FrameworkHiiToUefiHiiThunk/ConfigAccess.c
index ab99d5d760..6a83c3a3b7 100644
--- a/EdkCompatibilityPkg/Compatibility/FrameworkHiiToUefiHiiThunk/ConfigAccess.c
+++ b/EdkCompatibilityPkg/Compatibility/FrameworkHiiToUefiHiiThunk/ConfigAccess.c
@@ -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
diff --git a/EdkCompatibilityPkg/Compatibility/FrameworkHiiToUefiHiiThunk/ConfigAccess.h b/EdkCompatibilityPkg/Compatibility/FrameworkHiiToUefiHiiThunk/ConfigAccess.h
index d9abdcc109..365578344f 100644
--- a/EdkCompatibilityPkg/Compatibility/FrameworkHiiToUefiHiiThunk/ConfigAccess.h
+++ b/EdkCompatibilityPkg/Compatibility/FrameworkHiiToUefiHiiThunk/ConfigAccess.h
@@ -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
)
;
diff --git a/EdkCompatibilityPkg/Compatibility/FrameworkHiiToUefiHiiThunk/HiiDatabase.c b/EdkCompatibilityPkg/Compatibility/FrameworkHiiToUefiHiiThunk/HiiDatabase.c
index 53863d8114..8eab0813e6 100644
--- a/EdkCompatibilityPkg/Compatibility/FrameworkHiiToUefiHiiThunk/HiiDatabase.c
+++ b/EdkCompatibilityPkg/Compatibility/FrameworkHiiToUefiHiiThunk/HiiDatabase.c
@@ -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);
diff --git a/EdkCompatibilityPkg/Compatibility/FrameworkHiiToUefiHiiThunk/HiiDatabase.h b/EdkCompatibilityPkg/Compatibility/FrameworkHiiToUefiHiiThunk/HiiDatabase.h
index 64a8aeacaa..6e9c28a841 100644
--- a/EdkCompatibilityPkg/Compatibility/FrameworkHiiToUefiHiiThunk/HiiDatabase.h
+++ b/EdkCompatibilityPkg/Compatibility/FrameworkHiiToUefiHiiThunk/HiiDatabase.h
@@ -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;
//
diff --git a/EdkCompatibilityPkg/Compatibility/FrameworkHiiToUefiHiiThunk/Package.c b/EdkCompatibilityPkg/Compatibility/FrameworkHiiToUefiHiiThunk/Package.c
index 9624e377f4..970d789368 100644
--- a/EdkCompatibilityPkg/Compatibility/FrameworkHiiToUefiHiiThunk/Package.c
+++ b/EdkCompatibilityPkg/Compatibility/FrameworkHiiToUefiHiiThunk/Package.c
@@ -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;
}