summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--EdkCompatibilityPkg/Compatibility/FrameworkHiiToUefiHiiThunk/ConfigAccess.c480
-rw-r--r--EdkCompatibilityPkg/Compatibility/FrameworkHiiToUefiHiiThunk/ConfigAccess.h62
-rw-r--r--EdkCompatibilityPkg/Compatibility/FrameworkHiiToUefiHiiThunk/Forms.c58
-rw-r--r--EdkCompatibilityPkg/Compatibility/FrameworkHiiToUefiHiiThunk/FrameworkHiiToUefiHiiThunk.inf12
-rw-r--r--EdkCompatibilityPkg/Compatibility/FrameworkHiiToUefiHiiThunk/HiiDatabase.c17
-rw-r--r--EdkCompatibilityPkg/Compatibility/FrameworkHiiToUefiHiiThunk/HiiDatabase.h34
-rw-r--r--EdkCompatibilityPkg/Compatibility/FrameworkHiiToUefiHiiThunk/Package.c11
-rw-r--r--EdkCompatibilityPkg/Compatibility/FrameworkHiiToUefiHiiThunk/Utility.c24
-rw-r--r--EdkCompatibilityPkg/Compatibility/FrameworkHiiToUefiHiiThunk/Utility.h8
9 files changed, 684 insertions, 22 deletions
diff --git a/EdkCompatibilityPkg/Compatibility/FrameworkHiiToUefiHiiThunk/ConfigAccess.c b/EdkCompatibilityPkg/Compatibility/FrameworkHiiToUefiHiiThunk/ConfigAccess.c
new file mode 100644
index 0000000000..8834bd7034
--- /dev/null
+++ b/EdkCompatibilityPkg/Compatibility/FrameworkHiiToUefiHiiThunk/ConfigAccess.c
@@ -0,0 +1,480 @@
+/**@file
+ This file contains functions related to Config Access Protocols installed by
+ by HII Thunk Modules which is used to thunk UEFI Config Access Callback to
+ Framework HII Callback.
+
+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 "HiiDatabase.h"
+
+HII_TRHUNK_CONFIG_ACCESS_PROTOCOL_INSTANCE ConfigAccessProtocolInstanceTempate = {
+ HII_TRHUNK_CONFIG_ACCESS_PROTOCOL_INSTANCE_SIGNATURE,
+ {
+ ThunkExtractConfig,
+ ThunkRouteConfig,
+ ThunkCallback
+ }, //ConfigAccessProtocol
+ NULL, //FrameworkFormCallbackProtocol
+ {NULL, NULL} //ConfigAccessStorageListHead
+};
+
+EFI_HII_PACKAGE_HEADER *
+GetIfrFormSet (
+ IN CONST EFI_HII_PACKAGES *Packages
+ )
+{
+ TIANO_AUTOGEN_PACKAGES_HEADER **TianoAutogenPackageHdrArray;
+ EFI_HII_PACKAGE_HEADER *IfrPackage;
+ UINTN Index;
+
+ ASSERT (Packages != NULL);
+
+ IfrPackage = NULL;
+
+ TianoAutogenPackageHdrArray = (TIANO_AUTOGEN_PACKAGES_HEADER **) (((UINT8 *) &Packages->GuidId) + sizeof (Packages->GuidId));
+ for (Index = 0; Index < Packages->NumberOfPackages; Index++) {
+ //
+ // BugBug: The current UEFI HII build tool generate a binary in the format defined in:
+ // TIANO_AUTOGEN_PACKAGES_HEADER. We assume that all packages generated in
+ // this binary is with same package type. So the returned IfrPackNum and StringPackNum
+ // may not be the exact number of valid package number in the binary generated
+ // by HII Build tool.
+ //
+ switch (TianoAutogenPackageHdrArray[Index]->PackageHeader.Type) {
+ case EFI_HII_PACKAGE_FORM:
+ return &TianoAutogenPackageHdrArray[Index]->PackageHeader;
+ break;
+
+ case EFI_HII_PACKAGE_STRINGS:
+ case EFI_HII_PACKAGE_SIMPLE_FONTS:
+ break;
+
+ //
+ // The following fonts are invalid for a module that using Framework to UEFI thunk layer.
+ //
+ case EFI_HII_PACKAGE_KEYBOARD_LAYOUT:
+ case EFI_HII_PACKAGE_FONTS:
+ case EFI_HII_PACKAGE_IMAGES:
+ default:
+ ASSERT (FALSE);
+ break;
+ }
+ }
+
+ return (EFI_HII_PACKAGE_HEADER *) NULL;
+}
+
+EFI_STATUS
+GetBufferStorage (
+ IN CONST EFI_HII_PACKAGE_HEADER *FormSetPackage,
+ OUT LIST_ENTRY *BufferStorageListHead
+ )
+{
+ UINTN OpCodeOffset;
+ UINTN OpCodeLength;
+ UINT8 *OpCodeData;
+ UINT8 Operand;
+ EFI_IFR_VARSTORE *VarStoreOpCode;
+ HII_TRHUNK_BUFFER_STORAGE_KEY *BufferStorageKey;
+
+ OpCodeOffset = sizeof (EFI_HII_PACKAGE_HEADER);
+ while (OpCodeOffset < FormSetPackage->Length) {
+ OpCodeData = (UINT8 *) FormSetPackage + OpCodeOffset;
+
+ OpCodeLength = ((EFI_IFR_OP_HEADER *) OpCodeData)->Length;
+ OpCodeOffset += OpCodeLength;
+ Operand = ((EFI_IFR_OP_HEADER *) OpCodeData)->OpCode;
+
+ if (Operand == EFI_IFR_VARSTORE_OP) {
+ VarStoreOpCode = (EFI_IFR_VARSTORE *)OpCodeData;
+ BufferStorageKey = AllocateZeroPool (sizeof (*BufferStorageKey));
+ if (BufferStorageKey == NULL) {
+ return EFI_OUT_OF_RESOURCES;
+ }
+ CopyGuid (&BufferStorageKey->Guid, &VarStoreOpCode->Guid);
+
+ BufferStorageKey->Name = AllocateZeroPool (AsciiStrSize (VarStoreOpCode->Name) * 2);
+ AsciiStrToUnicodeStr (VarStoreOpCode->Name, BufferStorageKey->Name);
+
+ BufferStorageKey->VarStoreId = VarStoreOpCode->VarStoreId;
+
+ BufferStorageKey->Size = VarStoreOpCode->Size;
+ BufferStorageKey->Signature = HII_TRHUNK_BUFFER_STORAGE_KEY_SIGNATURE;
+
+ InsertTailList (BufferStorageListHead, &BufferStorageKey->List);
+ }
+ }
+ return EFI_SUCCESS;
+}
+
+
+EFI_STATUS
+InstallDefaultUefiConfigAccessProtocol (
+ IN CONST EFI_HII_PACKAGES *Packages,
+ OUT EFI_HANDLE *Handle,
+ IN OUT HII_TRHUNK_HANDLE_MAPPING_DATABASE_ENTRY *MapEntry
+ )
+{
+ EFI_HII_PACKAGE_HEADER *FormSetPackage;
+ EFI_STATUS Status;
+ HII_TRHUNK_CONFIG_ACCESS_PROTOCOL_INSTANCE *ConfigAccessInstance;
+
+ Status = HiiLibCreateHiiDriverHandle (Handle);
+ ConfigAccessInstance = AllocateCopyPool (
+ sizeof (HII_TRHUNK_CONFIG_ACCESS_PROTOCOL_INSTANCE),
+ &ConfigAccessProtocolInstanceTempate
+ );
+ InitializeListHead (&ConfigAccessInstance->ConfigAccessBufferStorageListHead);
+
+ //
+ // We assume there is only one formset package in each Forms Package
+ //
+ FormSetPackage = GetIfrFormSet (Packages);
+ Status = GetBufferStorage (FormSetPackage, &ConfigAccessInstance->ConfigAccessBufferStorageListHead);
+ if (EFI_ERROR (Status)) {
+ FreePool (ConfigAccessInstance);
+ ASSERT (FALSE);
+ return Status;
+ }
+
+ Status = gBS->InstallMultipleProtocolInterfaces (
+ Handle,
+ &gEfiHiiConfigAccessProtocolGuid,
+ &ConfigAccessInstance->ConfigAccessProtocol,
+ NULL
+ );
+ ASSERT_EFI_ERROR (Status);
+ if (EFI_ERROR (Status)) {
+ FreePool (ConfigAccessInstance);
+ return Status;
+ }
+
+ return EFI_SUCCESS;
+}
+
+EFI_STATUS
+RouteConfigToFrameworkFormCallBack (
+ IN HII_TRHUNK_BUFFER_STORAGE_KEY *BufferStorageKey,
+ IN EFI_FORM_CALLBACK_PROTOCOL *FrameworkFormCallBack,
+ IN VOID *Data,
+ IN UINTN DataSize
+ )
+{
+ EFI_STATUS Status;
+ BOOLEAN ResetRequired;
+
+ Status = FrameworkFormCallBack->NvWrite (
+ FrameworkFormCallBack,
+ BufferStorageKey->Name,
+ &BufferStorageKey->Guid,
+ EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS,
+ DataSize,
+ Data,
+ &ResetRequired
+ );
+ return Status;
+}
+
+EFI_STATUS
+ExtractConfigFromFrameworkFormCallBack (
+ IN HII_TRHUNK_BUFFER_STORAGE_KEY *BufferStorageKey,
+ IN EFI_FORM_CALLBACK_PROTOCOL *FrameworkFormCallBack,
+ OUT VOID **Data,
+ OUT UINTN *DataSize
+ )
+{
+ EFI_STATUS Status;
+
+ *DataSize = 0;
+ *Data = NULL;
+
+ Status = FrameworkFormCallBack->NvRead (
+ FrameworkFormCallBack,
+ BufferStorageKey->Name,
+ &BufferStorageKey->Guid,
+ NULL,
+ DataSize,
+ *Data
+ );
+ if (Status == EFI_BUFFER_TOO_SMALL) {
+ if (BufferStorageKey->Size != *DataSize) {
+ ASSERT (FALSE);
+ return EFI_INVALID_PARAMETER;
+ }
+
+ *Data = AllocateZeroPool (*DataSize);
+ if (Data == NULL) {
+ return EFI_OUT_OF_RESOURCES;
+ }
+
+ FrameworkFormCallBack->NvRead (
+ FrameworkFormCallBack,
+ BufferStorageKey->Name,
+ &BufferStorageKey->Guid,
+ NULL,
+ DataSize,
+ *Data
+ );
+ }
+
+ return Status;
+}
+
+EFI_STATUS
+RouteConfigToUefiVariable (
+ IN HII_TRHUNK_BUFFER_STORAGE_KEY *BufferStorageKey,
+ IN VOID *Data,
+ IN UINTN DataSize
+ )
+{
+ return gRT->SetVariable (
+ BufferStorageKey->Name,
+ &BufferStorageKey->Guid,
+ EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS,
+ DataSize,
+ Data
+ );
+
+}
+EFI_STATUS
+ExtractConfigFromUefiVariable (
+ IN HII_TRHUNK_BUFFER_STORAGE_KEY *BufferStorageKey,
+ OUT VOID **Data,
+ OUT UINTN *DataSize
+ )
+{
+ EFI_STATUS Status;
+
+ *DataSize = 0;
+ *Data = NULL;
+ Status = gRT->GetVariable (
+ BufferStorageKey->Name,
+ &BufferStorageKey->Guid,
+ NULL,
+ DataSize,
+ *Data
+ );
+ if (Status == EFI_BUFFER_TOO_SMALL) {
+
+ if (BufferStorageKey->Size != *DataSize) {
+ ASSERT (FALSE);
+ return EFI_INVALID_PARAMETER;
+ }
+
+ *Data = AllocateZeroPool (*DataSize);
+ if (Data == NULL) {
+ return EFI_OUT_OF_RESOURCES;
+ }
+
+ Status = gRT->GetVariable (
+ BufferStorageKey->Name,
+ &BufferStorageKey->Guid,
+ NULL,
+ DataSize,
+ *Data
+ );
+ }
+
+ return Status;
+}
+
+
+EFI_STATUS
+EFIAPI
+ThunkExtractConfig (
+ IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This,
+ IN CONST EFI_STRING Request,
+ OUT EFI_STRING *Progress,
+ OUT EFI_STRING *Results
+ )
+{
+ EFI_STATUS Status;
+ HII_TRHUNK_CONFIG_ACCESS_PROTOCOL_INSTANCE *ConfigaAccessInstance;
+ LIST_ENTRY *ListEntry;
+ HII_TRHUNK_BUFFER_STORAGE_KEY *BufferStorageKey;
+ VOID *Data;
+ UINTN DataSize;
+
+ Data = NULL;
+ ConfigaAccessInstance = HII_TRHUNK_CONFIG_ACCESS_PROTOCOL_INSTANCE_FROM_PROTOCOL (This);
+
+ ListEntry = GetFirstNode (&ConfigaAccessInstance->ConfigAccessBufferStorageListHead);
+ if (ListEntry == NULL) {
+ ASSERT (FALSE);
+ return EFI_INVALID_PARAMETER;
+ }
+
+ BufferStorageKey = HII_TRHUNK_BUFFER_STORAGE_KEY_FROM_LIST_ENTRY (ListEntry);
+
+ if (ConfigaAccessInstance->FrameworkFormCallbackProtocol == NULL ||
+ ConfigaAccessInstance->FrameworkFormCallbackProtocol->NvRead == NULL) {
+ Status = ExtractConfigFromUefiVariable (
+ BufferStorageKey,
+ &Data,
+ &DataSize
+ );
+ } else {
+ Status = ExtractConfigFromFrameworkFormCallBack (
+ BufferStorageKey,
+ ConfigaAccessInstance->FrameworkFormCallbackProtocol,
+ &Data,
+ &DataSize
+ );
+ }
+
+ if (!EFI_ERROR (Status)) {
+ Status = mUefiConfigRoutingProtocol->BlockToConfig (
+ mUefiConfigRoutingProtocol,
+ Request,
+ Data,
+ DataSize,
+ Results,
+ Progress
+ );
+ }
+
+ SafeFreePool (Data);
+ return Status;
+}
+
+
+EFI_STATUS
+EFIAPI
+ThunkRouteConfig (
+ IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This,
+ IN CONST EFI_STRING Configuration,
+ OUT EFI_STRING *Progress
+ )
+{
+ EFI_STATUS Status;
+ HII_TRHUNK_CONFIG_ACCESS_PROTOCOL_INSTANCE *ConfigaAccessInstance;
+ LIST_ENTRY *ListEntry;
+ HII_TRHUNK_BUFFER_STORAGE_KEY *BufferStorageKey;
+ VOID *Data;
+ UINTN DataSize;
+ UINTN LastModifiedByteIndex;
+
+ Data = NULL;
+ ConfigaAccessInstance = HII_TRHUNK_CONFIG_ACCESS_PROTOCOL_INSTANCE_FROM_PROTOCOL (This);
+
+ ListEntry = GetFirstNode (&ConfigaAccessInstance->ConfigAccessBufferStorageListHead);
+ if (ListEntry == NULL) {
+ ASSERT (FALSE);
+ return EFI_INVALID_PARAMETER;
+ }
+
+ BufferStorageKey = HII_TRHUNK_BUFFER_STORAGE_KEY_FROM_LIST_ENTRY (ListEntry);
+
+ Data = AllocateZeroPool (BufferStorageKey->Size);
+ if (Data == NULL) {
+ return EFI_OUT_OF_RESOURCES;
+ }
+ Status = mUefiConfigRoutingProtocol->ConfigToBlock (
+ mUefiConfigRoutingProtocol,
+ Configuration,
+ Data,
+ &LastModifiedByteIndex,
+ Progress
+ );
+
+ if (EFI_ERROR (Status)) {
+ goto Done;
+ }
+
+ DataSize = BufferStorageKey->Size;
+ if (ConfigaAccessInstance->FrameworkFormCallbackProtocol == NULL ||
+ ConfigaAccessInstance->FrameworkFormCallbackProtocol->NvRead == NULL) {
+ Status = RouteConfigToUefiVariable (
+ BufferStorageKey,
+ Data,
+ DataSize
+ );
+ } else {
+ Status = RouteConfigToFrameworkFormCallBack (
+ BufferStorageKey,
+ ConfigaAccessInstance->FrameworkFormCallbackProtocol,
+ Data,
+ DataSize
+ );
+ }
+
+Done:
+ SafeFreePool (Data);
+ return Status;
+}
+
+EFI_STATUS
+EFIAPI
+ThunkCallback (
+ IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This,
+ IN EFI_BROWSER_ACTION Action,
+ IN EFI_QUESTION_ID QuestionId,
+ IN UINT8 Type,
+ IN EFI_IFR_TYPE_VALUE *Value,
+ OUT EFI_BROWSER_ACTION_REQUEST *ActionRequest
+ )
+{
+ EFI_STATUS Status;
+ HII_TRHUNK_CONFIG_ACCESS_PROTOCOL_INSTANCE *ConfigaAccessInstance;
+ EFI_FORM_CALLBACK_PROTOCOL *FrameworkFormCallbackProtocol;
+ EFI_HII_CALLBACK_PACKET *Packet;
+ FRAMEWORK_EFI_IFR_DATA_ARRAY Data;
+ FRAMEWORK_EFI_IFR_DATA_ENTRY *DataEntry;
+ EFI_FORM_CALLBACK Callback;
+
+ ASSERT (This != NULL);
+ ASSERT (Value != NULL);
+ ASSERT (ActionRequest != NULL);
+
+ *ActionRequest = EFI_BROWSER_ACTION_REQUEST_NONE;
+
+ ConfigaAccessInstance = HII_TRHUNK_CONFIG_ACCESS_PROTOCOL_INSTANCE_FROM_PROTOCOL (This);
+
+ FrameworkFormCallbackProtocol = ConfigaAccessInstance->FrameworkFormCallbackProtocol;
+ if (FrameworkFormCallbackProtocol == NULL) {
+ return EFI_UNSUPPORTED;
+ }
+ Callback = FrameworkFormCallbackProtocol->Callback;
+
+ Status = Callback (
+ FrameworkFormCallbackProtocol,
+ QuestionId,
+ &Data,
+ &Packet
+ );
+
+ //
+ // Callback require browser to perform action
+ //
+ if (Packet != NULL) {
+ if (Packet->DataArray.EntryCount == 1 && Packet->DataArray.NvRamMap == NULL) {
+ DataEntry = (FRAMEWORK_EFI_IFR_DATA_ENTRY *) ((UINT8 *) Packet + sizeof (FRAMEWORK_EFI_IFR_DATA_ARRAY));
+ switch (DataEntry->Flags) {
+ case EXIT_REQUIRED:
+ *ActionRequest = EFI_BROWSER_ACTION_REQUEST_EXIT;
+ break;
+ case SAVE_REQUIRED:
+ *ActionRequest = EFI_BROWSER_ACTION_REQUEST_SUBMIT;
+ break;
+ case RESET_REQUIRED:
+ *ActionRequest = EFI_BROWSER_ACTION_REQUEST_RESET;
+ break;
+ default:
+ *ActionRequest = EFI_BROWSER_ACTION_REQUEST_NONE;
+ break;
+ }
+ }
+ }
+
+ return Status;
+}
+
diff --git a/EdkCompatibilityPkg/Compatibility/FrameworkHiiToUefiHiiThunk/ConfigAccess.h b/EdkCompatibilityPkg/Compatibility/FrameworkHiiToUefiHiiThunk/ConfigAccess.h
new file mode 100644
index 0000000000..d9abdcc109
--- /dev/null
+++ b/EdkCompatibilityPkg/Compatibility/FrameworkHiiToUefiHiiThunk/ConfigAccess.h
@@ -0,0 +1,62 @@
+/**@file
+ This file contains functions related to Config Access Protocols installed by
+ by HII Thunk Modules which is used to thunk UEFI Config Access Callback to
+ Framework HII Callback.
+
+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.
+
+**/
+
+#ifndef _HII_THUNK_CONFIG_ACCESS_H
+#define _HII_THUNK_CONFIG_ACCESS_H
+
+
+EFI_STATUS
+InstallDefaultUefiConfigAccessProtocol (
+ IN CONST EFI_HII_PACKAGES *Packages,
+ OUT EFI_HANDLE *Handle,
+ IN OUT HII_TRHUNK_HANDLE_MAPPING_DATABASE_ENTRY *MapEntry
+ )
+;
+
+EFI_STATUS
+EFIAPI
+ThunkExtractConfig (
+ IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This,
+ IN CONST EFI_STRING Request,
+ OUT EFI_STRING *Progress,
+ OUT EFI_STRING *Results
+ )
+;
+
+
+EFI_STATUS
+EFIAPI
+ThunkRouteConfig (
+ IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This,
+ IN CONST EFI_STRING Configuration,
+ OUT EFI_STRING *Progress
+ )
+;
+
+EFI_STATUS
+EFIAPI
+ThunkCallback (
+ IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This,
+ IN EFI_BROWSER_ACTION Action,
+ IN EFI_QUESTION_ID QuestionId,
+ IN UINT8 Type,
+ IN EFI_IFR_TYPE_VALUE *Value,
+ OUT EFI_BROWSER_ACTION_REQUEST *ActionRequest
+ )
+;
+
+#endif
+
diff --git a/EdkCompatibilityPkg/Compatibility/FrameworkHiiToUefiHiiThunk/Forms.c b/EdkCompatibilityPkg/Compatibility/FrameworkHiiToUefiHiiThunk/Forms.c
index 0e49e2066b..6cf81c3f8a 100644
--- a/EdkCompatibilityPkg/Compatibility/FrameworkHiiToUefiHiiThunk/Forms.c
+++ b/EdkCompatibilityPkg/Compatibility/FrameworkHiiToUefiHiiThunk/Forms.c
@@ -122,6 +122,46 @@ HiiGetDefaultImage (
return EFI_SUCCESS;
}
+EFI_STATUS
+ThunkUpdateFormCallBack (
+ IN EFI_HANDLE CallbackHandle,
+ IN CONST HII_TRHUNK_HANDLE_MAPPING_DATABASE_ENTRY *HandleMapEntry
+ )
+{
+ EFI_STATUS Status;
+ EFI_FORM_CALLBACK_PROTOCOL *FrameworkFormCallbackProtocol;
+ EFI_HII_CONFIG_ACCESS_PROTOCOL *ConfigAccessProtocol;
+ EFI_HANDLE UefiDriverHandle;
+ HII_TRHUNK_CONFIG_ACCESS_PROTOCOL_INSTANCE *ConfigAccessProtocolInstance;
+
+ Status = gBS->HandleProtocol (
+ CallbackHandle,
+ &gEfiFormCallbackProtocolGuid,
+ (VOID **) &FrameworkFormCallbackProtocol
+ );
+ if (EFI_ERROR (Status)) {
+ return EFI_INVALID_PARAMETER;
+ }
+
+ Status = mUefiHiiDatabaseProtocol->GetPackageListHandle (
+ mUefiHiiDatabaseProtocol,
+ HandleMapEntry->UefiHiiHandle,
+ &UefiDriverHandle
+ );
+ ASSERT_EFI_ERROR (Status);
+ Status = gBS->HandleProtocol (
+ UefiDriverHandle,
+ &gEfiHiiConfigAccessProtocolGuid,
+ (VOID **) &ConfigAccessProtocol
+ );
+ ASSERT_EFI_ERROR (Status);
+
+ ConfigAccessProtocolInstance = HII_TRHUNK_CONFIG_ACCESS_PROTOCOL_INSTANCE_FROM_PROTOCOL (ConfigAccessProtocol);
+
+ ConfigAccessProtocolInstance->FrameworkFormCallbackProtocol = FrameworkFormCallbackProtocol;
+
+ return EFI_SUCCESS;
+}
EFI_STATUS
EFIAPI
@@ -150,5 +190,23 @@ Returns:
--*/
{
+ EFI_STATUS Status;
+ EFI_HII_THUNK_PRIVATE_DATA *Private;
+ HII_TRHUNK_HANDLE_MAPPING_DATABASE_ENTRY *HandleMapEntry;
+
+ Private = EFI_HII_THUNK_PRIVATE_DATA_FROM_THIS(This);
+
+ HandleMapEntry = FrameworkHiiHandleToMapDatabaseEntry (Private, Handle);
+
+ if (HandleMapEntry == NULL) {
+ return EFI_NOT_FOUND;
+ }
+
+ if (Data->FormSetUpdate) {
+ Status = ThunkUpdateFormCallBack ((EFI_HANDLE) (UINTN) Data->FormCallbackHandle, HandleMapEntry);
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+ }
return EFI_SUCCESS;
}
diff --git a/EdkCompatibilityPkg/Compatibility/FrameworkHiiToUefiHiiThunk/FrameworkHiiToUefiHiiThunk.inf b/EdkCompatibilityPkg/Compatibility/FrameworkHiiToUefiHiiThunk/FrameworkHiiToUefiHiiThunk.inf
index 38f7a9beb8..a0107fa212 100644
--- a/EdkCompatibilityPkg/Compatibility/FrameworkHiiToUefiHiiThunk/FrameworkHiiToUefiHiiThunk.inf
+++ b/EdkCompatibilityPkg/Compatibility/FrameworkHiiToUefiHiiThunk/FrameworkHiiToUefiHiiThunk.inf
@@ -40,12 +40,15 @@
Forms.c
HiiDatabase.h
HiiDatabase.c
+ ConfigAccess.c
+ ConfigAccess.h
Utility.c
Utility.h
-
+
[Packages]
MdePkg/MdePkg.dec
+ MdeModulePkg/MdeModulePkg.dec
IntelFrameworkPkg/IntelFrameworkPkg.dec
[LibraryClasses]
@@ -57,6 +60,7 @@
DebugLib
BaseLib
HiiLib
+ ExtendedHiiLib
@@ -66,10 +70,14 @@
gEfiHiiDatabaseProtocolGuid
gEfiHiiStringProtocolGuid
gEfiHiiFontProtocolGuid
+ gEfiHiiConfigRoutingProtocolGuid
+ gEfiHiiConfigAccessProtocolGuid
+ gEfiFormCallbackProtocolGuid
[Depex]
gEfiHiiImageProtocolGuid AND
gEfiHiiDatabaseProtocolGuid AND
gEfiHiiStringProtocolGuid AND
- gEfiHiiFontProtocolGuid
+ gEfiHiiFontProtocolGuid AND
+ gEfiHiiConfigRoutingProtocolGuid
diff --git a/EdkCompatibilityPkg/Compatibility/FrameworkHiiToUefiHiiThunk/HiiDatabase.c b/EdkCompatibilityPkg/Compatibility/FrameworkHiiToUefiHiiThunk/HiiDatabase.c
index d5ef19c356..e2e2ded7c3 100644
--- a/EdkCompatibilityPkg/Compatibility/FrameworkHiiToUefiHiiThunk/HiiDatabase.c
+++ b/EdkCompatibilityPkg/Compatibility/FrameworkHiiToUefiHiiThunk/HiiDatabase.c
@@ -56,10 +56,12 @@ EFI_HII_THUNK_PRIVATE_DATA HiiThunkPrivateDataTempate = {
},
};
-EFI_HII_DATABASE_PROTOCOL *mUefiHiiDatabaseProtocol;
-EFI_HII_FONT_PROTOCOL *mUefiHiiFontProtocol;
-EFI_HII_IMAGE_PROTOCOL *mUefiHiiImageProtocol;
-EFI_HII_STRING_PROTOCOL *mUefiStringProtocol;
+CONST EFI_HII_DATABASE_PROTOCOL *mUefiHiiDatabaseProtocol;
+CONST EFI_HII_FONT_PROTOCOL *mUefiHiiFontProtocol;
+CONST EFI_HII_IMAGE_PROTOCOL *mUefiHiiImageProtocol;
+CONST EFI_HII_STRING_PROTOCOL *mUefiStringProtocol;
+CONST EFI_HII_CONFIG_ROUTING_PROTOCOL *mUefiConfigRoutingProtocol;
+
EFI_STATUS
EFIAPI
@@ -119,6 +121,13 @@ Returns:
);
ASSERT_EFI_ERROR (Status);
+ Status = gBS->LocateProtocol (
+ &gEfiHiiConfigRoutingProtocolGuid,
+ NULL,
+ (VOID **) &mUefiConfigRoutingProtocol
+ );
+ ASSERT_EFI_ERROR (Status);
+
//
// Install protocol interface
//
diff --git a/EdkCompatibilityPkg/Compatibility/FrameworkHiiToUefiHiiThunk/HiiDatabase.h b/EdkCompatibilityPkg/Compatibility/FrameworkHiiToUefiHiiThunk/HiiDatabase.h
index dd07afd06a..9934e3c281 100644
--- a/EdkCompatibilityPkg/Compatibility/FrameworkHiiToUefiHiiThunk/HiiDatabase.h
+++ b/EdkCompatibilityPkg/Compatibility/FrameworkHiiToUefiHiiThunk/HiiDatabase.h
@@ -44,6 +44,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
#include <Library/UefiRuntimeServicesTableLib.h>
#include <Library/FrameworkIfrSupportLib.h>
#include <Library/HiiLib.h>
+#include <Library/ExtendedHiiLib.h>
//
// Macros
@@ -106,17 +107,37 @@ typedef struct {
// other package list with IsPackageListWithOnlyStringPackages is TRUE.
//
BOOLEAN DoesPackageListImportStringPackages;
- EFI_HII_PACKAGE_LIST_HEADER *ImportedUefiStringPackageListHeader; //Only valid if DoesPackageListImportStringPackages is true.
-
+
} HII_TRHUNK_HANDLE_MAPPING_DATABASE_ENTRY;
+#define HII_TRHUNK_BUFFER_STORAGE_KEY_SIGNATURE EFI_SIGNATURE_32 ('H', 'T', 's', 'k')
+#define HII_TRHUNK_BUFFER_STORAGE_KEY_FROM_LIST_ENTRY(Record) CR(Record, HII_TRHUNK_BUFFER_STORAGE_KEY, List, HII_TRHUNK_BUFFER_STORAGE_KEY_SIGNATURE)
+typedef struct {
+ LIST_ENTRY List;
+ UINT32 Signature;
+ EFI_GUID Guid;
+ CHAR16 *Name;
+ UINTN Size;
+ UINT16 VarStoreId;
+} HII_TRHUNK_BUFFER_STORAGE_KEY;
+
+#define HII_TRHUNK_CONFIG_ACCESS_PROTOCOL_INSTANCE_SIGNATURE EFI_SIGNATURE_32 ('H', 'T', 'c', 'a')
+#define HII_TRHUNK_CONFIG_ACCESS_PROTOCOL_INSTANCE_FROM_PROTOCOL(Record) CR(Record, HII_TRHUNK_CONFIG_ACCESS_PROTOCOL_INSTANCE, ConfigAccessProtocol, HII_TRHUNK_CONFIG_ACCESS_PROTOCOL_INSTANCE_SIGNATURE)
+typedef struct {
+ UINT32 Signature;
+ EFI_HII_CONFIG_ACCESS_PROTOCOL ConfigAccessProtocol;
+ EFI_FORM_CALLBACK_PROTOCOL *FrameworkFormCallbackProtocol;
+ LIST_ENTRY ConfigAccessBufferStorageListHead;
+} HII_TRHUNK_CONFIG_ACCESS_PROTOCOL_INSTANCE;
+
//
// Extern Variables
//
-extern EFI_HII_DATABASE_PROTOCOL *mUefiHiiDatabaseProtocol;
-extern EFI_HII_FONT_PROTOCOL *mUefiHiiFontProtocol;
-extern EFI_HII_IMAGE_PROTOCOL *mUefiHiiImageProtocol;
-extern EFI_HII_STRING_PROTOCOL *mUefiStringProtocol;
+extern CONST EFI_HII_DATABASE_PROTOCOL *mUefiHiiDatabaseProtocol;
+extern CONST EFI_HII_FONT_PROTOCOL *mUefiHiiFontProtocol;
+extern CONST EFI_HII_IMAGE_PROTOCOL *mUefiHiiImageProtocol;
+extern CONST EFI_HII_STRING_PROTOCOL *mUefiStringProtocol;
+extern CONST EFI_HII_CONFIG_ROUTING_PROTOCOL *mUefiConfigRoutingProtocol;
//
// Prototypes
@@ -319,5 +340,6 @@ HiiCompareLanguage (
;
#include "Utility.h"
+#include "ConfigAccess.h"
#endif
diff --git a/EdkCompatibilityPkg/Compatibility/FrameworkHiiToUefiHiiThunk/Package.c b/EdkCompatibilityPkg/Compatibility/FrameworkHiiToUefiHiiThunk/Package.c
index 2a1407c366..d5f108d749 100644
--- a/EdkCompatibilityPkg/Compatibility/FrameworkHiiToUefiHiiThunk/Package.c
+++ b/EdkCompatibilityPkg/Compatibility/FrameworkHiiToUefiHiiThunk/Package.c
@@ -308,15 +308,6 @@ FindAndAddStringPackageToIfrPackageList(
}
EFI_STATUS
-InstallDefaultUefiConfigAccessProtocol (
- IN EFI_HII_PACKAGES *Packages,
- OUT EFI_HANDLE *Handle
- )
-{
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
UefiRegisterPackageList(
EFI_HII_THUNK_PRIVATE_DATA *Private,
EFI_HII_PACKAGES *Packages,
@@ -358,7 +349,7 @@ UefiRegisterPackageList(
// that Setup Utility will load the Buffer Storage
//
if (IfrPackNum != 0) {
- InstallDefaultUefiConfigAccessProtocol (Packages, &UefiHiiDriverHandle);
+ InstallDefaultUefiConfigAccessProtocol (Packages, &UefiHiiDriverHandle, HandleMappingEntry);
}
UefiPackageListHeader = PrepareUefiPackageListFromFrameworkHiiPackages (Packages, GuidId);
Status = mUefiHiiDatabaseProtocol->NewPackageList (
diff --git a/EdkCompatibilityPkg/Compatibility/FrameworkHiiToUefiHiiThunk/Utility.c b/EdkCompatibilityPkg/Compatibility/FrameworkHiiToUefiHiiThunk/Utility.c
index 001efa2e14..37be9d212e 100644
--- a/EdkCompatibilityPkg/Compatibility/FrameworkHiiToUefiHiiThunk/Utility.c
+++ b/EdkCompatibilityPkg/Compatibility/FrameworkHiiToUefiHiiThunk/Utility.c
@@ -66,3 +66,27 @@ FrameworkHiiHandleToUefiHiiHandle (
return (EFI_HII_HANDLE) NULL;
}
+
+HII_TRHUNK_HANDLE_MAPPING_DATABASE_ENTRY *
+FrameworkHiiHandleToMapDatabaseEntry (
+ IN CONST EFI_HII_THUNK_PRIVATE_DATA *Private,
+ IN FRAMEWORK_EFI_HII_HANDLE FrameworkHiiHandle
+ )
+{
+ LIST_ENTRY *ListEntry;
+ HII_TRHUNK_HANDLE_MAPPING_DATABASE_ENTRY *HandleMapEntry;
+
+ for (ListEntry = Private->HiiThunkHandleMappingDBListHead.ForwardLink;
+ ListEntry != &Private->HiiThunkHandleMappingDBListHead;
+ ListEntry = ListEntry->ForwardLink
+ ) {
+ HandleMapEntry = HII_TRHUNK_HANDLE_MAPPING_DATABASE_ENTRY_FROM_LISTENTRY (ListEntry);
+
+ if (FrameworkHiiHandle == HandleMapEntry->FrameworkHiiHandle) {
+ return HandleMapEntry;
+ }
+ }
+
+ return (HII_TRHUNK_HANDLE_MAPPING_DATABASE_ENTRY *) NULL;
+}
+
diff --git a/EdkCompatibilityPkg/Compatibility/FrameworkHiiToUefiHiiThunk/Utility.h b/EdkCompatibilityPkg/Compatibility/FrameworkHiiToUefiHiiThunk/Utility.h
index a0a3be3934..9b5a9bfb23 100644
--- a/EdkCompatibilityPkg/Compatibility/FrameworkHiiToUefiHiiThunk/Utility.h
+++ b/EdkCompatibilityPkg/Compatibility/FrameworkHiiToUefiHiiThunk/Utility.h
@@ -38,4 +38,12 @@ FrameworkHiiHandleToUefiHiiHandle (
IN FRAMEWORK_EFI_HII_HANDLE FrameworkHiiHandle
)
;
+
+HII_TRHUNK_HANDLE_MAPPING_DATABASE_ENTRY *
+FrameworkHiiHandleToMapDatabaseEntry (
+ IN CONST EFI_HII_THUNK_PRIVATE_DATA *Private,
+ IN FRAMEWORK_EFI_HII_HANDLE FrameworkHiiHandle
+ )
+;
+
#endif