From 8d00a0f1955de7aa4b658009a36df5165d0a75be Mon Sep 17 00:00:00 2001 From: qwang12 Date: Tue, 4 Nov 2008 14:28:08 +0000 Subject: [PATCH] Sync in bug fix from EDK I: 1) issue with setup browser and IFR refresh opcode 2) [HII]HIIConfigRoutingExportConfig generate error format of 3) [HII] ConfigRouting->ExtractConfig() will cause overflow 4) [Hii Database] EFI_HII_DATABASE_NOTIFY should be invoked when a string package is created internally when a new String Token is created 5) [PT]HIIConfigAccessProtocolTest fail on NT32uefi 6) Incorrect HII package types in EDK git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@6378 6f19259b-4bc3-4df7-8a09-765794883524 --- .../Include/Library/ExtendedIfrSupportLib.h | 34 ++ .../Library/ExtendedIfrSupportLib/Common.c | 2 +- .../Library/ExtendedIfrSupportLib/Form.c | 54 ++- .../Universal/BdsDxe/BootMaint/BootMaint.c | 4 + .../Universal/DriverSampleDxe/DriverSample.c | 235 +++++++--- .../Universal/DriverSampleDxe/DriverSample.h | 8 +- .../Universal/DriverSampleDxe/NVDataStruc.h | 6 +- .../Universal/DriverSampleDxe/Vfr.vfr | 97 ++-- .../Universal/DriverSampleDxe/VfrStrings.uni | Bin 36754 -> 38442 bytes .../Universal/HiiDatabaseDxe/ConfigRouting.c | 415 +++--------------- .../Universal/HiiDatabaseDxe/Database.c | 12 +- .../Universal/HiiDatabaseDxe/HiiDatabase.h | 24 + .../Universal/HiiDatabaseDxe/String.c | 13 + .../Universal/Network/IScsiDxe/IScsiConfig.c | 4 + .../PlatOverMngr/PlatOverMngr.c | 4 + .../Universal/SetupBrowserDxe/Expression.c | 10 +- .../Universal/SetupBrowserDxe/Presentation.c | 39 +- .../SetupBrowserDxe/ProcessOptions.c | 57 ++- .../Universal/SetupBrowserDxe/Setup.c | 25 +- .../Universal/SetupBrowserDxe/Setup.h | 2 + .../SetupBrowserDxe/SetupBrowserStr.uni | Bin 11772 -> 12638 bytes MdeModulePkg/Universal/SetupBrowserDxe/Ui.c | 182 +++++--- MdeModulePkg/Universal/SetupBrowserDxe/Ui.h | 3 +- 23 files changed, 680 insertions(+), 550 deletions(-) diff --git a/MdeModulePkg/Include/Library/ExtendedIfrSupportLib.h b/MdeModulePkg/Include/Library/ExtendedIfrSupportLib.h index 2d8db3b9e2..a10ebac6aa 100644 --- a/MdeModulePkg/Include/Library/ExtendedIfrSupportLib.h +++ b/MdeModulePkg/Include/Library/ExtendedIfrSupportLib.h @@ -39,6 +39,40 @@ CreateBannerOpCode ( IN OUT EFI_HII_UPDATE_DATA *Data ); +/** + This function initialize the data structure for dynamic opcode. + + @param UpdateData The adding data; + @param BufferSize Length of the buffer to fill dynamic opcodes. + + @retval EFI_SUCCESS Update data is initialized. + @retval EFI_INVALID_PARAMETER UpdateData is NULL. + @retval EFI_OUT_OF_RESOURCES No enough memory to allocate. + +**/ +EFI_STATUS +IfrLibInitUpdateData ( + IN OUT EFI_HII_UPDATE_DATA *UpdateData, + IN UINT32 BufferSize + ) +; + +/** + + This function free the resource of update data. + + @param UpdateData The adding data; + + @retval EFI_SUCCESS Resource in UpdateData is released. + @retval EFI_INVALID_PARAMETER UpdateData is NULL. + +**/ +EFI_STATUS +IfrLibFreeUpdateData ( + IN EFI_HII_UPDATE_DATA *UpdateData + ) +; + /** This function allows the caller to update a form that has previously been registered with the EFI HII database. diff --git a/MdeModulePkg/Library/ExtendedIfrSupportLib/Common.c b/MdeModulePkg/Library/ExtendedIfrSupportLib/Common.c index 2b639c9bb8..e74c709df7 100644 --- a/MdeModulePkg/Library/ExtendedIfrSupportLib/Common.c +++ b/MdeModulePkg/Library/ExtendedIfrSupportLib/Common.c @@ -125,7 +125,7 @@ IfrLibExtractClassFromHiiHandle ( Package = ((UINT8 *) HiiPackageList) + Offset; CopyMem (&PackageHeader, Package, sizeof (EFI_HII_PACKAGE_HEADER)); - if (PackageHeader.Type == EFI_HII_PACKAGE_FORM) { + if (PackageHeader.Type == EFI_HII_PACKAGE_FORMS) { // // Search Class Opcode in this Form Package // diff --git a/MdeModulePkg/Library/ExtendedIfrSupportLib/Form.c b/MdeModulePkg/Library/ExtendedIfrSupportLib/Form.c index d37821963c..a973d8f2dc 100644 --- a/MdeModulePkg/Library/ExtendedIfrSupportLib/Form.c +++ b/MdeModulePkg/Library/ExtendedIfrSupportLib/Form.c @@ -274,6 +274,58 @@ Fail: return EFI_SUCCESS; } +/** + This function initialize the data structure for dynamic opcode. + + @param UpdateData The adding data; + @param BufferSize Length of the buffer to fill dynamic opcodes. + + @retval EFI_SUCCESS Update data is initialized. + @retval EFI_INVALID_PARAMETER UpdateData is NULL. + @retval EFI_OUT_OF_RESOURCES No enough memory to allocate. + +**/ +EFI_STATUS +IfrLibInitUpdateData ( + IN OUT EFI_HII_UPDATE_DATA *UpdateData, + IN UINT32 BufferSize + ) +{ + ASSERT (UpdateData != NULL); + + UpdateData->BufferSize = BufferSize; + UpdateData->Offset = 0; + UpdateData->Data = AllocatePool (BufferSize); + + return (UpdateData->Data != NULL) ? EFI_SUCCESS : EFI_OUT_OF_RESOURCES; +} + +/** + + This function free the resource of update data. + + @param UpdateData The adding data; + + @retval EFI_SUCCESS Resource in UpdateData is released. + @retval EFI_INVALID_PARAMETER UpdateData is NULL. + +**/ +EFI_STATUS +IfrLibFreeUpdateData ( + IN EFI_HII_UPDATE_DATA *UpdateData + ) +{ + EFI_STATUS Status; + + if (UpdateData == NULL) { + return EFI_INVALID_PARAMETER; + } + + Status = gBS->FreePool (UpdateData->Data); + UpdateData->Data = NULL; + + return Status; +} /** This function allows the caller to update a form that has @@ -364,7 +416,7 @@ IfrLibUpdateForm ( Status = GetPackageDataFromPackageList (HiiPackageList, Index, &PackageLength, &Package); if (Status == EFI_SUCCESS) { CopyMem (&PackageHeader, Package, sizeof (EFI_HII_PACKAGE_HEADER)); - if ((PackageHeader.Type == EFI_HII_PACKAGE_FORM) && !Updated) { + if ((PackageHeader.Type == EFI_HII_PACKAGE_FORMS) && !Updated) { Status = UpdateFormPackageData (FormSetGuid, FormId, Package, PackageLength, Label, Insert, Data, (UINT8 **)&TempBuffer, &TempBufferSize); if (!EFI_ERROR(Status)) { if (FormSetGuid == NULL) { diff --git a/MdeModulePkg/Universal/BdsDxe/BootMaint/BootMaint.c b/MdeModulePkg/Universal/BdsDxe/BootMaint/BootMaint.c index ac31398987..709720c200 100644 --- a/MdeModulePkg/Universal/BdsDxe/BootMaint/BootMaint.c +++ b/MdeModulePkg/Universal/BdsDxe/BootMaint/BootMaint.c @@ -132,6 +132,10 @@ BootMaintExtractConfig ( UINTN BufferSize; BMM_CALLBACK_DATA *Private; + if (Request == NULL) { + return EFI_NOT_FOUND; + } + Private = BMM_CALLBACK_DATA_FROM_THIS (This); // diff --git a/MdeModulePkg/Universal/DriverSampleDxe/DriverSample.c b/MdeModulePkg/Universal/DriverSampleDxe/DriverSample.c index 45bfeaffcd..c468bc5900 100644 --- a/MdeModulePkg/Universal/DriverSampleDxe/DriverSample.c +++ b/MdeModulePkg/Universal/DriverSampleDxe/DriverSample.c @@ -1,5 +1,5 @@ /** @file -Copyright (c) 2004 - 2007, Intel Corporation +Copyright (c) 2004 - 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 @@ -29,6 +29,8 @@ EFI_GUID mInventoryGuid = INVENTORY_GUID; CHAR16 VariableName[] = L"MyIfrNVData"; +UINT8 VfrMyIfrNVDataBlockName[] = "BugBug"; + VOID EncodePassword ( IN CHAR16 *Password, @@ -259,6 +261,7 @@ ExtractConfig ( PrivateData = DRIVER_SAMPLE_PRIVATE_FROM_THIS (This); HiiConfigRouting = PrivateData->HiiConfigRouting; + // // // Get Buffer Storage data from EFI variable // @@ -274,6 +277,39 @@ ExtractConfig ( return Status; } + if (Request == NULL) { + // + // Request is set to NULL, return all configurable elements together with ALTCFG + // + Status = ConstructConfigAltResp ( + NULL, + NULL, + Results, + &mFormSetGuid, + VariableName, + PrivateData->DriverHandle[0], + &PrivateData->Configuration, + BufferSize, + VfrMyIfrNVDataBlockName, + 2, + STRING_TOKEN (STR_STANDARD_DEFAULT_PROMPT), + VfrMyIfrNVDataDefault0000, + STRING_TOKEN (STR_MANUFACTURE_DEFAULT_PROMPT), + VfrMyIfrNVDataDefault0001 + ); + + return Status; + } + + // + // Check routing data in . + // Note: if only one Storage is used, then this checking could be skipped. + // + if (!IsConfigHdrMatch (Request, &mFormSetGuid, VariableName)) { + *Progress = Request; + return EFI_NOT_FOUND; + } + // // Convert buffer data to by helper function BlockToConfig() // @@ -320,9 +356,21 @@ RouteConfig ( DRIVER_SAMPLE_PRIVATE_DATA *PrivateData; EFI_HII_CONFIG_ROUTING_PROTOCOL *HiiConfigRouting; + if (Configuration == NULL) { + return EFI_INVALID_PARAMETER; + } + PrivateData = DRIVER_SAMPLE_PRIVATE_FROM_THIS (This); HiiConfigRouting = PrivateData->HiiConfigRouting; + // Check routing data in . + // Note: if only one Storage is used, then this checking could be skipped. + // + if (!IsConfigHdrMatch (Configuration, &mFormSetGuid, VariableName)) { + *Progress = Configuration; + return EFI_NOT_FOUND; + } + // // Get Buffer Storage data from EFI variable // @@ -405,6 +453,7 @@ DriverCallback ( EFI_STATUS Status; EFI_HII_UPDATE_DATA UpdateData; IFR_OPTION *IfrOptionList; + UINT8 MyVar; if ((Value == NULL) || (ActionRequest == NULL)) { return EFI_INVALID_PARAMETER; @@ -416,12 +465,9 @@ DriverCallback ( switch (QuestionId) { case 0x1234: // - // Create dynamic page for this interactive goto + // Initialize the container for dynamic opcodes // - UpdateData.BufferSize = 0x1000; - UpdateData.Offset = 0; - UpdateData.Data = AllocatePool (0x1000); - ASSERT (UpdateData.Data != NULL); + IfrLibInitUpdateData (&UpdateData, 0x1000); IfrOptionList = AllocatePool (2 * sizeof (IFR_OPTION)); ASSERT (IfrOptionList != NULL); @@ -433,62 +479,127 @@ DriverCallback ( IfrOptionList[1].StringToken = STRING_TOKEN (STR_BOOT_OPTION2); IfrOptionList[1].Value.u8 = 2; - CreateActionOpCode ( - 0x1237, - STRING_TOKEN(STR_EXIT_TEXT), - STRING_TOKEN(STR_EXIT_TEXT), - EFI_IFR_FLAG_CALLBACK, - 0, - &UpdateData - ); - - CreateOneOfOpCode ( - 0x8001, - 0, - 0, - STRING_TOKEN (STR_ONE_OF_PROMPT), - STRING_TOKEN (STR_ONE_OF_HELP), - EFI_IFR_FLAG_CALLBACK, - EFI_IFR_NUMERIC_SIZE_1, - IfrOptionList, - 2, - &UpdateData - ); - - CreateOrderedListOpCode ( - 0x8002, - 0, - 0, - STRING_TOKEN (STR_BOOT_OPTIONS), - STRING_TOKEN (STR_BOOT_OPTIONS), - EFI_IFR_FLAG_RESET_REQUIRED, - 0, - EFI_IFR_NUMERIC_SIZE_1, - 10, - IfrOptionList, - 2, - &UpdateData - ); - - CreateGotoOpCode ( - 1, - STRING_TOKEN (STR_GOTO_FORM1), - STRING_TOKEN (STR_GOTO_HELP), - 0, - 0x8003, - &UpdateData - ); - - Status = IfrLibUpdateForm ( - PrivateData->HiiHandle[0], - &mFormSetGuid, - 0x1234, - 0x1234, - TRUE, - &UpdateData - ); - gBS->FreePool (IfrOptionList); - gBS->FreePool (UpdateData.Data); + CreateActionOpCode ( + 0x1237, // Question ID + STRING_TOKEN(STR_EXIT_TEXT), // Prompt text + STRING_TOKEN(STR_EXIT_TEXT), // Help text + EFI_IFR_FLAG_CALLBACK, // Question flag + 0, // Action String ID + &UpdateData // Container for dynamic created opcodes + ); + + // + // Prepare initial value for the dynamic created oneof Question + // + PrivateData->Configuration.DynamicOneof = 2; + Status = gRT->SetVariable( + VariableName, + &mFormSetGuid, + EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS, + sizeof (DRIVER_SAMPLE_CONFIGURATION), + &PrivateData->Configuration + ); + CreateOneOfOpCode ( + 0x8001, // Question ID (or call it "key") + CONFIGURATION_VARSTORE_ID, // VarStore ID + DYNAMIC_ONE_OF_VAR_OFFSET, // Offset in Buffer Storage + STRING_TOKEN (STR_ONE_OF_PROMPT), // Question prompt text + STRING_TOKEN (STR_ONE_OF_HELP), // Question help text + EFI_IFR_FLAG_CALLBACK, // Question flag + EFI_IFR_NUMERIC_SIZE_1, // Data type of Question Value + IfrOptionList, // Option list + 2, // Number of options in Option list + &UpdateData // Container for dynamic created opcodes + ); + + CreateOrderedListOpCode ( + 0x8002, // Question ID + CONFIGURATION_VARSTORE_ID, // VarStore ID + DYNAMIC_ORDERED_LIST_VAR_OFFSET, // Offset in Buffer Storage + STRING_TOKEN (STR_BOOT_OPTIONS), // Question prompt text + STRING_TOKEN (STR_BOOT_OPTIONS), // Question help text + EFI_IFR_FLAG_RESET_REQUIRED, // Question flag + 0, // Ordered list flag, e.g. EFI_IFR_UNIQUE_SET + EFI_IFR_NUMERIC_SIZE_1, // Data type of Question value + 5, // Maximum container + IfrOptionList, // Option list + 2, // Number of options in Option list + &UpdateData // Container for dynamic created opcodes + ); + + CreateGotoOpCode ( + 1, // Target Form ID + STRING_TOKEN (STR_GOTO_FORM1), // Prompt text + STRING_TOKEN (STR_GOTO_HELP), // Help text + 0, // Question flag + 0x8003, // Question ID + &UpdateData // Container for dynamic created opcodes + ); + + Status = IfrLibUpdateForm ( + PrivateData->HiiHandle[0], // HII handle + &mFormSetGuid, // Formset GUID + 0x1234, // Form ID + 0x1234, // Label for where to insert opcodes + TRUE, // Append or replace + &UpdateData // Dynamic created opcodes + ); + gBS->FreePool (IfrOptionList); + IfrLibFreeUpdateData (&UpdateData); + break; + + case 0x5678: + // + // We will reach here once the Question is refreshed + // + IfrLibInitUpdateData (&UpdateData, 0x1000); + + IfrOptionList = AllocatePool (2 * sizeof (IFR_OPTION)); + ASSERT (IfrOptionList != NULL); + + CreateActionOpCode ( + 0x1237, // Question ID + STRING_TOKEN(STR_EXIT_TEXT), // Prompt text + STRING_TOKEN(STR_EXIT_TEXT), // Help text + EFI_IFR_FLAG_CALLBACK, // Question flag + 0, // Action String ID + &UpdateData // Container for dynamic created opcodes + ); + + Status = IfrLibUpdateForm ( + PrivateData->HiiHandle[0], // HII handle + &mFormSetGuid, // Formset GUID + 3, // Form ID + 0x2234, // Label for where to insert opcodes + TRUE, // Append or replace + &UpdateData // Dynamic created opcodes + ); + IfrLibFreeUpdateData (&UpdateData); + + // + // Refresh the Question value + // + PrivateData->Configuration.DynamicRefresh++; + Status = gRT->SetVariable( + VariableName, + &mFormSetGuid, + EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS, + sizeof (DRIVER_SAMPLE_CONFIGURATION), + &PrivateData->Configuration + ); + + // + // Change an EFI Variable storage (MyEfiVar) asynchronous, this will cause + // the first statement in Form 3 be suppressed + // + MyVar = 111; + Status = gRT->SetVariable( + L"MyVar", + &mFormSetGuid, + EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS, + 1, + &MyVar + ); break; case 0x1237: diff --git a/MdeModulePkg/Universal/DriverSampleDxe/DriverSample.h b/MdeModulePkg/Universal/DriverSampleDxe/DriverSample.h index 0468fbd04f..1489da22ed 100644 --- a/MdeModulePkg/Universal/DriverSampleDxe/DriverSample.h +++ b/MdeModulePkg/Universal/DriverSampleDxe/DriverSample.h @@ -52,6 +52,8 @@ Revision History // This is the generated for defaults defined in VFR // extern UINT8 VfrMyIfrNVDataDefault0000[]; +extern UINT8 VfrMyIfrNVDataDefault0001[]; +extern UINT8 VfrMyIfrNVDataBlockName[]; // // This is the generated IFR binary data for each formset defined in VFR. @@ -68,7 +70,11 @@ extern UINT8 InventoryBin[]; // extern UINT8 DriverSampleStrings[]; -#define SAMPLE_STRING L"This is an error!" +#define VAR_OFFSET(Field) \ + ((UINT16) ((UINTN) &(((DRIVER_SAMPLE_CONFIGURATION *) 0)->Field))) + +#define DYNAMIC_ONE_OF_VAR_OFFSET VAR_OFFSET (DynamicOneof) +#define DYNAMIC_ORDERED_LIST_VAR_OFFSET VAR_OFFSET (DynamicOrderedList) #define DRIVER_SAMPLE_PRIVATE_SIGNATURE EFI_SIGNATURE_32 ('D', 'S', 'p', 's') diff --git a/MdeModulePkg/Universal/DriverSampleDxe/NVDataStruc.h b/MdeModulePkg/Universal/DriverSampleDxe/NVDataStruc.h index 1c93d33df9..171d3baf08 100644 --- a/MdeModulePkg/Universal/DriverSampleDxe/NVDataStruc.h +++ b/MdeModulePkg/Universal/DriverSampleDxe/NVDataStruc.h @@ -35,7 +35,7 @@ Revision History: 0xb3f56470, 0x6141, 0x4621, 0x8f, 0x19, 0x70, 0x4e, 0x57, 0x7a, 0xa9, 0xe8 \ } -#define VAR_EQ_TEST_NAME 0x100 +#define CONFIGURATION_VARSTORE_ID 0x1234 #pragma pack(1) typedef struct { @@ -57,7 +57,9 @@ typedef struct { UINT8 OrderedList[8]; UINT8 BootOrder[8]; UINT8 BootOrderLarge; - UINT8 DynamicCheck; + UINT8 DynamicRefresh; + UINT8 DynamicOneof; + UINT8 DynamicOrderedList[5]; } DRIVER_SAMPLE_CONFIGURATION; // diff --git a/MdeModulePkg/Universal/DriverSampleDxe/Vfr.vfr b/MdeModulePkg/Universal/DriverSampleDxe/Vfr.vfr index b248e7334d..01c76345b4 100644 --- a/MdeModulePkg/Universal/DriverSampleDxe/Vfr.vfr +++ b/MdeModulePkg/Universal/DriverSampleDxe/Vfr.vfr @@ -67,23 +67,11 @@ formset // VfrCompile -l --no-pre-processing --output-directory ${d_path} $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.iii // - // - // Define a Default Storage for Manufacturing Defauls. Attribut = 1 (EFI_HII_DEFAULT_CLASS_MANUFACTURING). - // Only if this Default Storage is defined, CHECKBOX_DEFAULT_MFG can be used for CheckBox. - // - defaultstore MfgDefault, prompt = STRING_TOKEN (STR_DEFAULTSTORE_MFG), attribute = 1; - - // - // Define a Safe Deafult Storage. Attribute = 2 (EFI_HII_DEFAULT_CLASS_SAFE) as an example. - // It is not referenced. - // - defaultstore SafeDefault, prompt = STRING_TOKEN (STR_DEFAULTSTORE_SAFE), attribute = 2; - - // + // // Define a Buffer Storage (EFI_IFR_VARSTORE) // varstore DRIVER_SAMPLE_CONFIGURATION, // This is the data structure type - varid = 0x1234, // Optional VarStore ID + varid = CONFIGURATION_VARSTORE_ID, // Optional VarStore ID name = MyIfrNVData, // Define referenced name in vfr guid = FORMSET_GUID; // GUID of this buffer storage @@ -103,6 +91,14 @@ formset varsize = 1, // Size of the EFI variable guid = FORMSET_GUID; // EFI variable GUID + defaultstore MyStandardDefault, + prompt = STRING_TOKEN(STR_STANDARD_DEFAULT_PROMPT), + attribute = 0x0000; // Default ID: 0000 standard default + + defaultstore MyManufactureDefault, + prompt = STRING_TOKEN(STR_MANUFACTURE_DEFAULT_PROMPT), + attribute = 0x0001; // Default ID: 0001 manufacture default + // // Define a Form (EFI_IFR_FORM) // @@ -121,11 +117,14 @@ formset text = STRING_TOKEN(STR_CPU_STRING), // Prompt string text = STRING_TOKEN(STR_CPU_STRING2); // TextTwo + // + // Define action button (EFI_IFR_ACTION) + // text help = STRING_TOKEN(STR_EXIT_TEXT), text = STRING_TOKEN(STR_EXIT_TEXT), text = STRING_TOKEN(STR_EXIT_TEXT), - flags = INTERACTIVE, + flags = INTERACTIVE, // VfrCompiler will generate opcode EFI_IFR_ACTION for Text marked as INTERACTIVE key = 0x1237; text @@ -138,9 +137,10 @@ formset // // Define oneof (EFI_IFR_ONE_OF) // - oneof varid = MyIfrNVData.SuppressGrayOutSomething, // Use "DataStructure.Member" to reference Buffer Storage - prompt = STRING_TOKEN(STR_ONE_OF_PROMPT), - help = STRING_TOKEN(STR_ONE_OF_HELP), + oneof name = MyOneOf, // Define reference name for Question + varid = MyIfrNVData.SuppressGrayOutSomething, // Use "DataStructure.Member" to reference Buffer Storage + prompt = STRING_TOKEN(STR_ONE_OF_PROMPT), + help = STRING_TOKEN(STR_ONE_OF_HELP), // // Define an option (EFI_IFR_ONE_OF_OPTION) // @@ -160,7 +160,7 @@ formset endoneof; grayoutif ideqval MyIfrNVData.SuppressGrayOutSomething == 0x1; - suppressif ideqval MyIfrNVData.SuppressGrayOutSomething == 0x0; + suppressif questionref(MyOneOf) == 0x0; checkbox varid = MyIfrNVData.ChooseToActivateNuclearWeaponry, prompt = STRING_TOKEN(STR_CHECK_BOX_PROMPT), @@ -199,7 +199,7 @@ formset option text = STRING_TOKEN(STR_BOOT_OPTION1), value = 1, flags = RESET_REQUIRED; option text = STRING_TOKEN(STR_BOOT_OPTION3), value = 3, flags = RESET_REQUIRED; suppressif ideqval MyIfrNVData.BootOrderLarge == 0; - option text = STRING_TOKEN(STR_BOOT_OPTION4), value = 4, flags = 0; + option text = STRING_TOKEN(STR_BOOT_OPTION4), value = 4, flags = RESET_REQUIRED; endif endlist; @@ -290,7 +290,8 @@ formset maximum = 0xf0, step = 0, // Stepping of 0 equates to a manual entering // of a value, otherwise it will be adjusted by "+"/"-" - default = 20, + default = 21, // defaultstore could be used to specify the default type + // If no defaultstore is specified, it implies Standard Default endnumeric; @@ -300,7 +301,7 @@ formset minimum = 0, maximum = 0xf0, step = 0, - default = 20, + default = 21, inconsistentif prompt = STRING_TOKEN(STR_ERROR_POPUP), ideqval MyIfrNVData.HowOldAreYouInYearsManual == 99 @@ -322,16 +323,6 @@ formset endnumeric; - numeric varid = MyIfrNVData2.Field8, // Reference of MyIfrNVData2 storage - prompt = STRING_TOKEN(STR_MYIFRNVDATA2_HEX_PROMPT), - help = STRING_TOKEN(STR_MYIFRNVDATA2_HEX_HELP), - flags = DISPLAY_UINT_HEX, // Display in HEX format (if not specified, default is in decimal format) - minimum = 0, - maximum = 250, - default = 175, - - endnumeric; - label LABEL_1_VALUE; label LABEL_2_VALUE; @@ -342,10 +333,23 @@ formset minimum = 0, maximum = 243, step = 1, - default = 18, - + default = 18, defaultstore = MyStandardDefault, // This is standard default value + default = 19, defaultstore = MyManufactureDefault, // This is manufacture default value + endnumeric; endif; + + resetbutton + defaultstore = MyStandardDefault, + prompt = STRING_TOKEN(STR_STANDARD_DEFAULT_PROMPT), + help = STRING_TOKEN(STR_STANDARD_DEFAULT_HELP), + endresetbutton; + + resetbutton + defaultstore = MyManufactureDefault, + prompt = STRING_TOKEN(STR_MANUFACTURE_DEFAULT_PROMPT), + help = STRING_TOKEN(STR_MANUFACTURE_DEFAULT_HELP), + endresetbutton; // // Non-interactive password, validate by Setup Browser @@ -354,7 +358,7 @@ formset prompt = STRING_TOKEN(STR_PASSWORD_PROMPT), help = STRING_TOKEN(STR_PASSWORD_HELP), minsize = 6, - maxsize = 20, // new opcode + maxsize = 20, endpassword; string varid = MyIfrNVData.PasswordClearText, @@ -373,7 +377,7 @@ formset flags = INTERACTIVE, key = 0x2000, minsize = 6, - maxsize = 20, // new opcode + maxsize = 20, endpassword; goto 2, @@ -493,12 +497,31 @@ formset form formid = 3, title = STRING_TOKEN(STR_FORM3_TITLE); // note formid is a variable (for readability) (UINT16) - also added Form to the line to signify the Op-Code - grayoutif ideqval MyIfrNVData.SuppressGrayOutSomething == 0x1; + suppressif ideqval MyEfiVar == 111; text help = STRING_TOKEN(STR_TEXT_HELP), text = STRING_TOKEN(STR_TEXT_TEXT_1); endif; + goto 1, + prompt = STRING_TOKEN(STR_GOTO_FORM1), //MainSetupPage + help = STRING_TOKEN(STR_GOTO_HELP); + + numeric varid = MyIfrNVData.DynamicRefresh, + prompt = STRING_TOKEN(STR_NUMERIC_MANUAL_PROMPT), + help = STRING_TOKEN(STR_NUMERIC_HELP0), + flags = INTERACTIVE, + key = 0x5678, + minimum = 0, + maximum = 0xff, + step = 0, + default = 0, + refresh interval = 3 // Refresh interval in seconds + endnumeric; + + label 0x2234; + label LABEL_END; + endform; form formid = 4, title = STRING_TOKEN(STR_FORM3_TITLE); diff --git a/MdeModulePkg/Universal/DriverSampleDxe/VfrStrings.uni b/MdeModulePkg/Universal/DriverSampleDxe/VfrStrings.uni index d18ceb14fd2deed13e232ffb443f95af1b977ff9..c687bf7d849ce224639b12db23fb057d3f323bff 100644 GIT binary patch delta 644 zcmbOCNF4}nC#RWAsEDv%1{i%B@7BcoX?;zS-($x@`2t0tTOgMJxY_0 zXp2m~r>#?8&XCEF1B40;MM$P3Ld8lLGJv8A41o-#VA&F&>U@Sgplwi_fcAk@WCC?7 z07Xj}5`nTQK(Yu(DgbdRLmH4*3N#Pox-uX;2W*xS11|#?(52Oh`I9%qat*LMlqb(L z7N4Bghb=4<`*m@IB}it5u>??`2D=A?D}xV1z~sOTV_#~9Y3}5YUE<<6!f|q8VkIc_ SsBfbr4jUO#Hy>>~%K-q6hLV~9 delta 14 WcmZ3rhH27#rVVG>HmCF+;{X6PJ_i5* diff --git a/MdeModulePkg/Universal/HiiDatabaseDxe/ConfigRouting.c b/MdeModulePkg/Universal/HiiDatabaseDxe/ConfigRouting.c index aed93be1f0..ca85619113 100644 --- a/MdeModulePkg/Universal/HiiDatabaseDxe/ConfigRouting.c +++ b/MdeModulePkg/Universal/HiiDatabaseDxe/ConfigRouting.c @@ -140,182 +140,6 @@ GetDevicePath ( } -/** - Extract Storage from all Form Packages in current hii database. - - This is a internal function. - - @param HiiDatabase EFI_HII_DATABASE_PROTOCOL instance. - @param StorageListHead Storage link List head. - - @retval EFI_NOT_FOUND There is no form package in current hii database. - @retval EFI_INVALID_PARAMETER Any parameter is invalid. - @retval EFI_SUCCESS All existing storage is exported. - -**/ -EFI_STATUS -ExportAllStorage ( - IN EFI_HII_DATABASE_PROTOCOL *HiiDatabase, - IN OUT LIST_ENTRY *StorageListHead -) -{ - EFI_STATUS Status; - UINTN BufferSize; - UINTN HandleCount; - EFI_HII_HANDLE *HandleBuffer; - UINTN Index; - UINTN Index2; - EFI_HII_PACKAGE_LIST_HEADER *HiiPackageList; - EFI_HII_PACKAGE_HEADER *Package; - UINT8 *OpCodeData; - UINT8 Operand; - UINT32 Offset; - HII_FORMSET_STORAGE *Storage; - EFI_HII_HANDLE HiiHandle; - EFI_HANDLE DriverHandle; - CHAR8 *AsciiString; - UINT32 PackageListLength; - EFI_HII_PACKAGE_HEADER PackageHeader; - - // - // Find the package list which contains Form package. - // - BufferSize = 0; - HandleBuffer = NULL; - Status = HiiListPackageLists ( - HiiDatabase, - EFI_HII_PACKAGE_FORM, - NULL, - &BufferSize, - HandleBuffer - ); - if (Status == EFI_BUFFER_TOO_SMALL) { - HandleBuffer = AllocateZeroPool (BufferSize); - ASSERT (HandleBuffer != NULL); - - Status = HiiListPackageLists ( - HiiDatabase, - EFI_HII_PACKAGE_FORM, - NULL, - &BufferSize, - HandleBuffer - ); - } - if (EFI_ERROR (Status)) { - if (HandleBuffer != NULL) { - FreePool (HandleBuffer); - } - return Status; - } - - HandleCount = BufferSize / sizeof (EFI_HII_HANDLE); - for (Index = 0; Index < HandleCount; Index++) { - HiiHandle = HandleBuffer[Index]; - - BufferSize = 0; - HiiPackageList = NULL; - Status = HiiExportPackageLists (HiiDatabase, HiiHandle, &BufferSize, HiiPackageList); - if (Status == EFI_BUFFER_TOO_SMALL) { - HiiPackageList = AllocateZeroPool (BufferSize); - ASSERT (HiiPackageList != NULL); - Status = HiiExportPackageLists (HiiDatabase, HiiHandle, &BufferSize, HiiPackageList); - } - if (EFI_ERROR (Status)) { - FreePool (HandleBuffer); - FreePool (HiiPackageList); - return Status; - } - - // - // Get Form package from this HII package List - // - Offset = sizeof (EFI_HII_PACKAGE_LIST_HEADER); - CopyMem (&PackageListLength, &HiiPackageList->PackageLength, sizeof (UINT32)); - Package = NULL; - ZeroMem (&PackageHeader, sizeof (EFI_HII_PACKAGE_HEADER)); - - while (Offset < PackageListLength) { - Package = (EFI_HII_PACKAGE_HEADER *) (((UINT8 *) HiiPackageList) + Offset); - CopyMem (&PackageHeader, Package, sizeof (EFI_HII_PACKAGE_HEADER)); - if (PackageHeader.Type == EFI_HII_PACKAGE_FORM) { - break; - } - Offset += PackageHeader.Length; - } - if (Offset >= PackageListLength) { - // - // Error here: No Form package found in this Package List - // - ASSERT (FALSE); - } - - // - // Search Storage definition in this Form package - // - Offset = sizeof (EFI_HII_PACKAGE_HEADER); - while (Offset < PackageHeader.Length) { - OpCodeData = ((UINT8 *) Package) + Offset; - Offset += ((EFI_IFR_OP_HEADER *) OpCodeData)->Length; - - Operand = ((EFI_IFR_OP_HEADER *) OpCodeData)->OpCode; - - if ((Operand == EFI_IFR_VARSTORE_OP) || - (Operand == EFI_IFR_VARSTORE_NAME_VALUE_OP) || - (Operand == EFI_IFR_VARSTORE_EFI_OP)) { - - Storage = AllocateZeroPool (sizeof (HII_FORMSET_STORAGE)); - ASSERT (Storage != NULL); - InsertTailList (StorageListHead, &Storage->Entry); - - Storage->Signature = HII_FORMSET_STORAGE_SIGNATURE; - Storage->HiiHandle = HiiHandle; - - Status = HiiGetPackageListHandle (HiiDatabase, HiiHandle, &DriverHandle); - if (EFI_ERROR (Status)) { - FreePool (HandleBuffer); - FreePool (HiiPackageList); - FreePool (Storage); - return Status; - } - Storage->DriverHandle = DriverHandle; - - if (Operand == EFI_IFR_VARSTORE_OP) { - Storage->Type = EFI_HII_VARSTORE_BUFFER; - - CopyMem (&Storage->Guid, &((EFI_IFR_VARSTORE *) OpCodeData)->Guid, sizeof (EFI_GUID)); - CopyMem (&Storage->Size, &((EFI_IFR_VARSTORE *) OpCodeData)->Size, sizeof (UINT16)); - - AsciiString = (CHAR8 *) ((EFI_IFR_VARSTORE *) OpCodeData)->Name; - Storage->Name = AllocateZeroPool (AsciiStrSize (AsciiString) * 2); - ASSERT (Storage->Name != NULL); - for (Index2 = 0; AsciiString[Index2] != 0; Index2++) { - Storage->Name[Index2] = (CHAR16) AsciiString[Index2]; - } - // - // Append '\0' to the end of the unicode string. - // - Storage->Name[Index2] = 0; - } else if (Operand == EFI_IFR_VARSTORE_NAME_VALUE_OP) { - Storage->Type = EFI_HII_VARSTORE_NAME_VALUE; - - CopyMem (&Storage->Guid, &((EFI_IFR_VARSTORE_NAME_VALUE *) OpCodeData)->Guid, sizeof (EFI_GUID)); - } else if (Operand == EFI_IFR_VARSTORE_EFI_OP) { - Storage->Type = EFI_HII_VARSTORE_EFI_VARIABLE; - - CopyMem (&Storage->Guid, &((EFI_IFR_VARSTORE_EFI *) OpCodeData)->Guid, sizeof (EFI_GUID)); - } - } - } - - FreePool (HiiPackageList); - } - - FreePool (HandleBuffer); - - return EFI_SUCCESS; -} - - /** Generate a sub string then output it. @@ -674,8 +498,7 @@ HiiConfigRoutingExtractConfig ( EFI_HII_CONFIG_ACCESS_PROTOCOL *ConfigAccess; EFI_STRING AccessProgress; EFI_STRING AccessResults; - UINTN RemainSize; - EFI_STRING TmpPtr; + BOOLEAN FirstElement; // // For size reduction, please define PcdSupportFullConfigRoutingProtocol @@ -707,6 +530,8 @@ HiiConfigRoutingExtractConfig ( return EFI_INVALID_PARAMETER; } + FirstElement = TRUE; + // // Allocate a fix length of memory to store Results. Reallocate memory for // Results if this fix length is insufficient. @@ -802,20 +627,27 @@ HiiConfigRoutingExtractConfig ( // AccessProgress indicates the parsing progress on . // Map it to the progress on then return it. // - RemainSize = StrSize (AccessProgress); - for (TmpPtr = StringPtr; CompareMem (TmpPtr, AccessProgress, RemainSize) != 0; TmpPtr++); - *Progress = TmpPtr; - + *Progress = StrStr (StringPtr, AccessProgress); FreePool (ConfigRequest); return Status; } // - // Attach this to a + // Attach this to a . There is a '&' + // which seperates the first and the following ones. // ASSERT (*AccessProgress == 0); + + if (!FirstElement) { + Status = AppendToMultiString (Results, L"&"); + ASSERT_EFI_ERROR (Status); + } + Status = AppendToMultiString (Results, AccessResults); ASSERT_EFI_ERROR (Status); + + FirstElement = FALSE; + FreePool (AccessResults); AccessResults = NULL; FreePool (ConfigRequest); @@ -869,20 +701,12 @@ HiiConfigRoutingExportConfig ( ) { EFI_STATUS Status; - HII_DATABASE_PRIVATE_DATA *Private; - LIST_ENTRY StorageListHdr; - HII_FORMSET_STORAGE *Storage; - LIST_ENTRY *Link; - EFI_DEVICE_PATH_PROTOCOL *DevicePath; - UINTN Length; - EFI_STRING PathHdr; - UINTN PathHdrSize; - EFI_STRING ConfigRequest; - UINTN RequestSize; - EFI_STRING StringPtr; EFI_HII_CONFIG_ACCESS_PROTOCOL *ConfigAccess; - EFI_STRING AccessProgress; - EFI_STRING AccessResults; + EFI_STRING AccessResults; + UINTN Index; + EFI_HANDLE *ConfigAccessHandles; + UINTN NumberConfigAccessHandles; + BOOLEAN FirstElement; // // For size reduction, please define PcdSupportFullConfigRoutingProtocol @@ -897,15 +721,6 @@ HiiConfigRoutingExportConfig ( return EFI_INVALID_PARAMETER; } - Private = CONFIG_ROUTING_DATABASE_PRIVATE_DATA_FROM_THIS (This); - - InitializeListHead (&StorageListHdr); - - Status = ExportAllStorage (&Private->HiiDatabase, &StorageListHdr); - if (EFI_ERROR (Status)) { - return Status; - } - // // Allocate a fix length of memory to store Results. Reallocate memory for // Results if this fix length is insufficient. @@ -915,164 +730,58 @@ HiiConfigRoutingExportConfig ( return EFI_OUT_OF_RESOURCES; } - // - // Parsing all formset storages. - // - for (Link = StorageListHdr.ForwardLink; Link != &StorageListHdr; Link = Link->ForwardLink) { - Storage = CR (Link, HII_FORMSET_STORAGE, Entry, HII_FORMSET_STORAGE_SIGNATURE); - // - // Find the corresponding device path instance - // + NumberConfigAccessHandles = 0; + Status = gBS->LocateHandleBuffer ( + ByProtocol, + &gEfiHiiConfigAccessProtocolGuid, + NULL, + &NumberConfigAccessHandles, + &ConfigAccessHandles + ); + if (EFI_ERROR (Status)) { + return Status; + } + + FirstElement = TRUE; + + for (Index = 0; Index < NumberConfigAccessHandles; Index++) { Status = gBS->HandleProtocol ( - Storage->DriverHandle, - &gEfiDevicePathProtocolGuid, - (VOID **) &DevicePath + ConfigAccessHandles[Index], + &gEfiHiiConfigAccessProtocolGuid, + (VOID **) &ConfigAccess ); if (EFI_ERROR (Status)) { - return Status; - } - // - // Convert the device path binary to hex UNICODE %02x bytes in the same order - // as the device path resides in RAM memory. - // - Length = GetDevicePathSize (DevicePath); - PathHdrSize = (Length * 2 + 1) * sizeof (CHAR16); - PathHdr = (EFI_STRING) AllocateZeroPool (PathHdrSize); - if (PathHdr == NULL) { - return EFI_OUT_OF_RESOURCES; - } - Status = BufInReverseOrderToHexString (PathHdr, (UINT8 *) DevicePath, Length); - ASSERT_EFI_ERROR (Status); - - // - // Generate a with one and zero . - // It means extract all possible configurations from this specific driver. - // - RequestSize = (StrLen (L"GUID=&NAME=&PATH=") + 32) * sizeof (CHAR16) + PathHdrSize; - if (Storage->Name != NULL) { - RequestSize += StrLen (Storage->Name) * 4 * sizeof (CHAR16); - } - - ConfigRequest = (EFI_STRING) AllocateZeroPool (RequestSize); - if (ConfigRequest == NULL) { - FreePool (PathHdr); - return EFI_OUT_OF_RESOURCES; + continue; } - // - // Add - // ::= 'GUID=' - // Convert in the same order as it resides in RAM memory. - // - StringPtr = ConfigRequest; - StrnCpy (StringPtr, L"GUID=", StrLen (L"GUID=")); - StringPtr += StrLen (L"GUID="); - - Status = BufInReverseOrderToHexString (StringPtr, (UINT8 *) (&Storage->Guid), sizeof (EFI_GUID)); - ASSERT_EFI_ERROR (Status); - - StringPtr += 32; - ASSERT (*StringPtr == 0); - *StringPtr = L'&'; - StringPtr++; - - // - // Add - // ::= 'NAME=' - // - StrnCpy (StringPtr, L"NAME=", StrLen (L"NAME=")); - StringPtr += StrLen (L"NAME="); - - if (Storage->Name != NULL) { - Length = (StrLen (Storage->Name) * 4 + 1) * sizeof (CHAR16); - Status = UnicodeToConfigString (StringPtr, &Length, Storage->Name); - ASSERT_EFI_ERROR (Status); - StringPtr += StrLen (Storage->Name) * 4; - } - - *StringPtr = L'&'; - StringPtr++; - - // - // Add - // ::= '' - // - StrnCpy (StringPtr, L"PATH=", StrLen (L"PATH=")); - StringPtr += StrLen (L"PATH="); - StrCpy (StringPtr, PathHdr); - - FreePool (PathHdr); - PathHdr = NULL; - - // - // BUGBUG: The "Implementation note" of ExportConfig() in UEFI spec makes the - // code somewhat complex. Let's TBD here whether a or a - // is required to call ConfigAccess.ExtractConfig(). - // - // Here we use to call ConfigAccess instance. It requires ConfigAccess - // to handle such kind of "ConfigRequest". It is not supported till now. - // - // Either the ExportConfig will be updated or the ConfigAccess.ExtractConfig() - // will be updated as soon as the decision is made. - - // - // Route the request to corresponding ConfigAccess protocol to extract settings. - // - Status = gBS->HandleProtocol ( - Storage->DriverHandle, - &gEfiHiiConfigAccessProtocolGuid, - (VOID **) &ConfigAccess - ); - ASSERT_EFI_ERROR (Status); - - AccessProgress = NULL; - AccessResults = NULL; Status = ConfigAccess->ExtractConfig ( ConfigAccess, - ConfigRequest, - &AccessProgress, + NULL, + NULL, &AccessResults ); - if (EFI_ERROR (Status)) { - FreePool (ConfigRequest); - if (AccessProgress != NULL) { - FreePool (AccessProgress); + if (!EFI_ERROR (Status)) { + // + // Attach this to a . There is a '&' + // which seperates the first and the following ones. + // + if (!FirstElement) { + Status = AppendToMultiString (Results, L"&"); + ASSERT_EFI_ERROR (Status); } - if (AccessResults != NULL) { - FreePool (AccessResults); - } - return EFI_INVALID_PARAMETER; + + Status = AppendToMultiString (Results, AccessResults); + ASSERT_EFI_ERROR (Status); + + FirstElement = FALSE; + + FreePool (AccessResults); + AccessResults = NULL; } - - // - // Attach this to a - // - ASSERT (*AccessProgress == 0); - Status = AppendToMultiString (Results, AccessResults); - ASSERT_EFI_ERROR (Status); - FreePool (AccessResults); - AccessResults = NULL; - FreePool (ConfigRequest); - ConfigRequest = NULL; - } + gBS->FreePool (ConfigAccessHandles); - // - // Free the exported storage resource - // - while (!IsListEmpty (&StorageListHdr)) { - Storage = CR ( - StorageListHdr.ForwardLink, - HII_FORMSET_STORAGE, - Entry, - HII_FORMSET_STORAGE_SIGNATURE - ); - RemoveEntryList (&Storage->Entry); - FreePool (Storage->Name); - FreePool (Storage); - } - - return EFI_SUCCESS; + return EFI_SUCCESS; } @@ -1122,8 +831,6 @@ HiiConfigRoutingRouteConfig ( EFI_HANDLE DriverHandle; EFI_HII_CONFIG_ACCESS_PROTOCOL *ConfigAccess; EFI_STRING AccessProgress; - UINTN RemainSize; - EFI_STRING TmpPtr; // // For size reduction, please define PcdSupportFullConfigRoutingProtocol @@ -1244,9 +951,7 @@ HiiConfigRoutingRouteConfig ( // AccessProgress indicates the parsing progress on . // Map it to the progress on then return it. // - RemainSize = StrSize (AccessProgress); - for (TmpPtr = StringPtr; CompareMem (TmpPtr, AccessProgress, RemainSize) != 0; TmpPtr++); - *Progress = TmpPtr; + *Progress = StrStr (StringPtr, AccessProgress); FreePool (ConfigResp); return Status; diff --git a/MdeModulePkg/Universal/HiiDatabaseDxe/Database.c b/MdeModulePkg/Universal/HiiDatabaseDxe/Database.c index 5a37dd0ef3..fab12670d9 100644 --- a/MdeModulePkg/Universal/HiiDatabaseDxe/Database.c +++ b/MdeModulePkg/Universal/HiiDatabaseDxe/Database.c @@ -195,7 +195,7 @@ InvokeRegisteredFunction ( Package = (EFI_HII_PACKAGE_HEADER *) (((HII_GUID_PACKAGE_INSTANCE *) PackageInstance)->GuidPkg); break; - case EFI_HII_PACKAGE_FORM: + case EFI_HII_PACKAGE_FORMS: BufferSize = ((HII_IFR_PACKAGE_INSTANCE *) PackageInstance)->FormPkgHdr.Length; Buffer = (UINT8 *) AllocateZeroPool (BufferSize); ASSERT (Buffer != NULL); @@ -667,7 +667,7 @@ ExportFormPackages ( Private, EFI_HII_DATABASE_NOTIFY_EXPORT_PACK, (VOID *) FormPackage, - EFI_HII_PACKAGE_FORM, + EFI_HII_PACKAGE_FORMS, Handle ); ASSERT_EFI_ERROR (Status); @@ -730,7 +730,7 @@ RemoveFormPackages ( Private, EFI_HII_DATABASE_NOTIFY_REMOVE_PACK, (VOID *) Package, - EFI_HII_PACKAGE_FORM, + EFI_HII_PACKAGE_FORMS, Handle ); if (EFI_ERROR (Status)) { @@ -2386,7 +2386,7 @@ AddPackages ( DatabaseRecord->Handle ); break; - case EFI_HII_PACKAGE_FORM: + case EFI_HII_PACKAGE_FORMS: Status = InsertFormPackage ( PackageHdrPtr, NotifyType, @@ -2957,7 +2957,7 @@ HiiUpdatePackageList ( case EFI_HII_PACKAGE_TYPE_GUID: Status = RemoveGuidPackages (Private, Handle, OldPackageList); break; - case EFI_HII_PACKAGE_FORM: + case EFI_HII_PACKAGE_FORMS: Status = RemoveFormPackages (Private, Handle, OldPackageList); break; case EFI_HII_PACKAGE_KEYBOARD_LAYOUT: @@ -3087,7 +3087,7 @@ HiiListPackageLists ( } } break; - case EFI_HII_PACKAGE_FORM: + case EFI_HII_PACKAGE_FORMS: if (!IsListEmpty (&PackageList->FormPkgHdr)) { Matched = TRUE; } diff --git a/MdeModulePkg/Universal/HiiDatabaseDxe/HiiDatabase.h b/MdeModulePkg/Universal/HiiDatabaseDxe/HiiDatabase.h index bbddd0369d..243c5ee9f5 100644 --- a/MdeModulePkg/Universal/HiiDatabaseDxe/HiiDatabase.h +++ b/MdeModulePkg/Universal/HiiDatabaseDxe/HiiDatabase.h @@ -339,6 +339,30 @@ IsFontInfoExisted ( OUT HII_GLOBAL_FONT_INFO **GlobalFontInfo OPTIONAL ); +/** + + This function invokes the matching registered function. + + @param Private HII Database driver private structure. + @param NotifyType The type of change concerning the database. + @param PackageInstance Points to the package referred to by the notification. + @param PackageType Package type + @param Handle The handle of the package list which contains the specified package. + + @retval EFI_SUCCESS Already checked all registered function and invoked + if matched. + @retval EFI_INVALID_PARAMETER Any input parameter is not valid. + +**/ +EFI_STATUS +InvokeRegisteredFunction ( + IN HII_DATABASE_PRIVATE_DATA *Private, + IN EFI_HII_DATABASE_NOTIFY_TYPE NotifyType, + IN VOID *PackageInstance, + IN UINT8 PackageType, + IN EFI_HII_HANDLE Handle + ) +; /** Retrieve system default font and color. diff --git a/MdeModulePkg/Universal/HiiDatabaseDxe/String.c b/MdeModulePkg/Universal/HiiDatabaseDxe/String.c index d4fcc971e5..8c207f9476 100644 --- a/MdeModulePkg/Universal/HiiDatabaseDxe/String.c +++ b/MdeModulePkg/Universal/HiiDatabaseDxe/String.c @@ -1253,6 +1253,19 @@ HiiNewString ( } } + // + // Trigger any registered notification function + // + if (!Matched) { + return InvokeRegisteredFunction ( + Private, + EFI_HII_DATABASE_NOTIFY_NEW_PACK, + (VOID *) StringPackage, + EFI_HII_PACKAGE_STRINGS, + PackageList + ); + } + return EFI_SUCCESS; } diff --git a/MdeModulePkg/Universal/Network/IScsiDxe/IScsiConfig.c b/MdeModulePkg/Universal/Network/IScsiDxe/IScsiConfig.c index b70e401637..86e41ba1a1 100644 --- a/MdeModulePkg/Universal/Network/IScsiDxe/IScsiConfig.c +++ b/MdeModulePkg/Universal/Network/IScsiDxe/IScsiConfig.c @@ -335,6 +335,10 @@ IScsiFormExtractConfig ( ISCSI_FORM_CALLBACK_INFO *Private; EFI_HII_CONFIG_ROUTING_PROTOCOL *HiiConfigRouting; + if (Request == NULL) { + return EFI_NOT_FOUND; + } + if (!mIScsiDeviceListUpdated) { // // Update the device list. diff --git a/MdeModulePkg/Universal/PlatformDriverOverride/PlatOverMngr/PlatOverMngr.c b/MdeModulePkg/Universal/PlatformDriverOverride/PlatOverMngr/PlatOverMngr.c index 7f5bb8d148..5269c35198 100644 --- a/MdeModulePkg/Universal/PlatformDriverOverride/PlatOverMngr/PlatOverMngr.c +++ b/MdeModulePkg/Universal/PlatformDriverOverride/PlatOverMngr/PlatOverMngr.c @@ -1128,6 +1128,10 @@ PlatOverMngrExtractConfig ( EFI_CALLBACK_INFO *Private; EFI_HII_CONFIG_ROUTING_PROTOCOL *HiiConfigRouting; + if (Request == NULL) { + return EFI_NOT_FOUND; + } + Private = EFI_CALLBACK_INFO_FROM_THIS (This); HiiConfigRouting = Private->HiiConfigRouting; diff --git a/MdeModulePkg/Universal/SetupBrowserDxe/Expression.c b/MdeModulePkg/Universal/SetupBrowserDxe/Expression.c index 46f70b986b..eb109f4dfc 100644 --- a/MdeModulePkg/Universal/SetupBrowserDxe/Expression.c +++ b/MdeModulePkg/Universal/SetupBrowserDxe/Expression.c @@ -1,7 +1,7 @@ /** @file Utility functions for expression evaluation. -Copyright (c) 2007, Intel Corporation +Copyright (c) 2007 - 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 @@ -421,6 +421,14 @@ IdToQuestion ( Question = IdToQuestion2 (Form, QuestionId); if (Question != NULL) { + // + // EFI variable storage may be updated by Callback() asynchronous, + // to keep synchronous, always reload the Question Value. + // + if (Question->Storage->Type == EFI_HII_VARSTORE_EFI_VARIABLE) { + GetQuestionValue (FormSet, Form, Question, FALSE); + } + return Question; } diff --git a/MdeModulePkg/Universal/SetupBrowserDxe/Presentation.c b/MdeModulePkg/Universal/SetupBrowserDxe/Presentation.c index ba6927c719..6b51cc6280 100644 --- a/MdeModulePkg/Universal/SetupBrowserDxe/Presentation.c +++ b/MdeModulePkg/Universal/SetupBrowserDxe/Presentation.c @@ -1,7 +1,7 @@ /** @file Utility functions for UI presentation. -Copyright (c) 2004 - 2007, Intel Corporation +Copyright (c) 2004 - 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 @@ -482,24 +482,6 @@ DisplayForm ( if (!IsListEmpty (&gMenuList)) { PrintStringAt (LocalScreen.LeftColumn + 2, LocalScreen.TopRow + 1, gFunctionTwoString); } - - PrintStringAt (LocalScreen.LeftColumn + 2, LocalScreen.BottomRow - 4, gFunctionOneString); - PrintStringAt ( - LocalScreen.LeftColumn + (LocalScreen.RightColumn - LocalScreen.LeftColumn) / 3, - LocalScreen.BottomRow - 4, - gFunctionNineString - ); - PrintStringAt ( - LocalScreen.LeftColumn + (LocalScreen.RightColumn - LocalScreen.LeftColumn) * 2 / 3, - LocalScreen.BottomRow - 4, - gFunctionTenString - ); - PrintAt (LocalScreen.LeftColumn + 2, LocalScreen.BottomRow - 3, L"%c%c%s", ARROW_UP, ARROW_DOWN, gMoveHighlight); - PrintStringAt ( - LocalScreen.LeftColumn + (LocalScreen.RightColumn - LocalScreen.LeftColumn) / 3, - LocalScreen.BottomRow - 3, - gEscapeString - ); } // // Remove Buffer allocated for StringPtr after it has been used. @@ -575,6 +557,7 @@ InitializeBrowserStrings ( gFunctionTenString = GetToken (STRING_TOKEN (FUNCTION_TEN_STRING), gHiiHandle); gEnterString = GetToken (STRING_TOKEN (ENTER_STRING), gHiiHandle); gEnterCommitString = GetToken (STRING_TOKEN (ENTER_COMMIT_STRING), gHiiHandle); + gEnterEscapeString = GetToken (STRING_TOKEN (ENTER_ESCAPE_STRING), gHiiHandle); gEscapeString = GetToken (STRING_TOKEN (ESCAPE_STRING), gHiiHandle); gSaveFailed = GetToken (STRING_TOKEN (SAVE_FAILED), gHiiHandle); gMoveHighlight = GetToken (STRING_TOKEN (MOVE_HIGHLIGHT), gHiiHandle); @@ -598,6 +581,7 @@ InitializeBrowserStrings ( gMinusString = GetToken (STRING_TOKEN (MINUS_STRING), gHiiHandle); gAdjustNumber = GetToken (STRING_TOKEN (ADJUST_NUMBER), gHiiHandle); gSaveChanges = GetToken (STRING_TOKEN (SAVE_CHANGES), gHiiHandle); + gOptionMismatch = GetToken (STRING_TOKEN (OPTION_MISMATCH), gHiiHandle); return ; } @@ -617,6 +601,7 @@ FreeBrowserStrings ( FreePool (gFunctionTenString); FreePool (gEnterString); FreePool (gEnterCommitString); + FreePool (gEnterEscapeString); FreePool (gEscapeString); FreePool (gMoveHighlight); FreePool (gMakeSelection); @@ -639,6 +624,7 @@ FreeBrowserStrings ( FreePool (gMinusString); FreePool (gAdjustNumber); FreePool (gSaveChanges); + FreePool (gOptionMismatch); return ; } @@ -701,8 +687,7 @@ UpdateKeyHelp ( } if ((Statement->Operand == EFI_IFR_DATE_OP) || - (Statement->Operand == EFI_IFR_TIME_OP) || - (Statement->Operand == EFI_IFR_NUMERIC_OP && Statement->Step != 0)) { + (Statement->Operand == EFI_IFR_TIME_OP)) { PrintAt ( StartColumnOfHelp, BottomRowOfHelp, @@ -716,7 +701,11 @@ UpdateKeyHelp ( PrintStringAt (SecCol, BottomRowOfHelp, gAdjustNumber); } else { PrintAt (StartColumnOfHelp, BottomRowOfHelp, L"%c%c%s", ARROW_UP, ARROW_DOWN, gMoveHighlight); - PrintStringAt (SecCol, BottomRowOfHelp, gEnterString); + if (Statement->Operand == EFI_IFR_NUMERIC_OP && Statement->Step != 0) { + PrintStringAt (SecCol, BottomRowOfHelp, gAdjustNumber); + } else { + PrintStringAt (SecCol, BottomRowOfHelp, gEnterString); + } } } else { PrintStringAt (SecCol, BottomRowOfHelp, gEnterCommitString); @@ -739,7 +728,7 @@ UpdateKeyHelp ( PrintStringAt (ThdCol, TopRowOfHelp, gMinusString); } - PrintStringAt (ThdCol, BottomRowOfHelp, gEscapeString); + PrintStringAt (ThdCol, BottomRowOfHelp, gEnterEscapeString); } break; @@ -784,7 +773,7 @@ UpdateKeyHelp ( BottomRowOfHelp, gEnterCommitString ); - PrintStringAt (ThdCol, BottomRowOfHelp, gEscapeString); + PrintStringAt (ThdCol, BottomRowOfHelp, gEnterEscapeString); } } break; @@ -874,7 +863,7 @@ SetupBrowser ( // Status = mHiiDatabase->RegisterPackageNotify ( mHiiDatabase, - EFI_HII_PACKAGE_FORM, + EFI_HII_PACKAGE_FORMS, NULL, FormUpdateNotify, EFI_HII_DATABASE_NOTIFY_REMOVE_PACK, diff --git a/MdeModulePkg/Universal/SetupBrowserDxe/ProcessOptions.c b/MdeModulePkg/Universal/SetupBrowserDxe/ProcessOptions.c index eaa832a998..49c7ff8c5a 100644 --- a/MdeModulePkg/Universal/SetupBrowserDxe/ProcessOptions.c +++ b/MdeModulePkg/Universal/SetupBrowserDxe/ProcessOptions.c @@ -2,7 +2,7 @@ Implementation for handling the User Interface option processing. -Copyright (c) 2004 - 2007, Intel Corporation +Copyright (c) 2004 - 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 @@ -309,6 +309,8 @@ ProcessOptions ( EFI_HII_VALUE *QuestionValue; BOOLEAN Suppress; UINT16 Maximum; + QUESTION_OPTION *Option; + UINTN Index2; Status = EFI_SUCCESS; @@ -359,7 +361,30 @@ ProcessOptions ( OneOfOption = ValueToOption (Question, &HiiValue); if (OneOfOption == NULL) { + // + // Show error message + // + do { + CreateDialog (4, TRUE, 0, NULL, &Key, gEmptyString, gOptionMismatch, gPressEnter, gEmptyString); + } while (Key.UnicodeChar != CHAR_CARRIAGE_RETURN); + + // + // The initial value of the orderedlist is invalid, force to be valid value + // + Link = GetFirstNode (&Question->OptionListHead); + Index2 = 0; + while (!IsNull (&Question->OptionListHead, Link) && Index2 < Question->MaxContainers) { + Option = QUESTION_OPTION_FROM_LINK (Link); + Question->BufferValue[Index2++] = Option->Value.Value.u8; + Link = GetNextNode (&Question->OptionListHead, Link); + } + Question->BufferValue[Index2] = 0; + + Status = SetQuestionValue (Selection->FormSet, Selection->Form, Question, TRUE); + UpdateStatusBar (NV_UPDATE_REQUIRED, Question->QuestionFlags, TRUE); + gBS->FreePool (*OptionString); + *OptionString = NULL; return EFI_NOT_FOUND; } @@ -400,8 +425,33 @@ ProcessOptions ( OneOfOption = ValueToOption (Question, QuestionValue); if (OneOfOption == NULL) { + // + // Show error message + // + do { + CreateDialog (4, TRUE, 0, NULL, &Key, gEmptyString, gOptionMismatch, gPressEnter, gEmptyString); + } while (Key.UnicodeChar != CHAR_CARRIAGE_RETURN); + + // + // Force the Question value to be valid + // + Link = GetFirstNode (&Question->OptionListHead); + while (!IsNull (&Question->OptionListHead, Link)) { + Option = QUESTION_OPTION_FROM_LINK (Link); + + if ((Option->SuppressExpression == NULL) || + !Option->SuppressExpression->Result.Value.b) { + CopyMem (QuestionValue, &Option->Value, sizeof (EFI_HII_VALUE)); + SetQuestionValue (Selection->FormSet, Selection->Form, Question, TRUE); + UpdateStatusBar (NV_UPDATE_REQUIRED, Question->QuestionFlags, TRUE); + break; + } + + Link = GetNextNode (&Question->OptionListHead, Link); + } + gBS->FreePool (*OptionString); - return EFI_NOT_FOUND; + *OptionString = NULL; } if ((OneOfOption->SuppressExpression != NULL) && @@ -428,6 +478,8 @@ ProcessOptions ( Suppress = FALSE; CopyMem (QuestionValue, &OneOfOption->Value, sizeof (EFI_HII_VALUE)); SetQuestionValue (Selection->FormSet, Selection->Form, Question, TRUE); + UpdateStatusBar (NV_UPDATE_REQUIRED, Question->QuestionFlags, TRUE); + gST->ConOut->SetAttribute (gST->ConOut, FIELD_TEXT | FIELD_BACKGROUND); break; } @@ -470,6 +522,7 @@ ProcessOptions ( // QuestionValue->Value.b = (BOOLEAN) (QuestionValue->Value.b ? FALSE : TRUE); gBS->FreePool (*OptionString); + *OptionString = NULL; return Status; } diff --git a/MdeModulePkg/Universal/SetupBrowserDxe/Setup.c b/MdeModulePkg/Universal/SetupBrowserDxe/Setup.c index 29b606fdef..847679fce5 100644 --- a/MdeModulePkg/Universal/SetupBrowserDxe/Setup.c +++ b/MdeModulePkg/Universal/SetupBrowserDxe/Setup.c @@ -58,6 +58,7 @@ CHAR16 *gFunctionNineString; CHAR16 *gFunctionTenString; CHAR16 *gEnterString; CHAR16 *gEnterCommitString; +CHAR16 *gEnterEscapeString; CHAR16 *gEscapeString; CHAR16 *gSaveFailed; CHAR16 *gMoveHighlight; @@ -81,6 +82,7 @@ CHAR16 *gPlusString; CHAR16 *gMinusString; CHAR16 *gAdjustNumber; CHAR16 *gSaveChanges; +CHAR16 *gOptionMismatch; CHAR16 gPromptBlockWidth; CHAR16 gOptionBlockWidth; @@ -1050,6 +1052,7 @@ GetQuestionValue ( CHAR16 *Progress; CHAR16 *Result; CHAR16 *Value; + CHAR16 *StringPtr; UINTN Length; BOOLEAN IsBufferStorage; BOOLEAN IsString; @@ -1245,6 +1248,16 @@ GetQuestionValue ( // Skip '=', point to value // Value = Value + 1; + + // + // Suppress if any + // + StringPtr = Value; + while (*StringPtr != L'\0' && *StringPtr != L'&') { + StringPtr++; + } + *StringPtr = L'\0'; + if (!IsBufferStorage && IsString) { // // Convert Config String to Unicode String, e.g "0041004200430044" => "ABCD" @@ -1895,6 +1908,16 @@ ExtractFormDefault ( Question = FORM_BROWSER_STATEMENT_FROM_LINK (Link); Link = GetNextNode (&Form->StatementListHead, Link); + // + // If Question is suppressed, don't reset it to default + // + if (Question->SuppressExpression != NULL) { + Status = EvaluateExpression (FormSet, Form, Question->SuppressExpression); + if (!EFI_ERROR (Status) && Question->SuppressExpression->Result.Value.b) { + continue; + } + } + // // Reset Question to its default value // @@ -2146,7 +2169,7 @@ GetIfrBinaryData ( Package = ((UINT8 *) HiiPackageList) + Offset; CopyMem (&PackageHeader, Package, sizeof (EFI_HII_PACKAGE_HEADER)); - if (PackageHeader.Type == EFI_HII_PACKAGE_FORM) { + if (PackageHeader.Type == EFI_HII_PACKAGE_FORMS) { // // Search FormSet in this Form Package // diff --git a/MdeModulePkg/Universal/SetupBrowserDxe/Setup.h b/MdeModulePkg/Universal/SetupBrowserDxe/Setup.h index 6d6d4843db..0804d5173f 100644 --- a/MdeModulePkg/Universal/SetupBrowserDxe/Setup.h +++ b/MdeModulePkg/Universal/SetupBrowserDxe/Setup.h @@ -469,6 +469,7 @@ extern CHAR16 *gFunctionNineString; extern CHAR16 *gFunctionTenString; extern CHAR16 *gEnterString; extern CHAR16 *gEnterCommitString; +extern CHAR16 *gEnterEscapeString; extern CHAR16 *gEscapeString; extern CHAR16 *gSaveFailed; extern CHAR16 *gMoveHighlight; @@ -492,6 +493,7 @@ extern CHAR16 *gPlusString; extern CHAR16 *gMinusString; extern CHAR16 *gAdjustNumber; extern CHAR16 *gSaveChanges; +extern CHAR16 *gOptionMismatch; extern CHAR16 gPromptBlockWidth; extern CHAR16 gOptionBlockWidth; diff --git a/MdeModulePkg/Universal/SetupBrowserDxe/SetupBrowserStr.uni b/MdeModulePkg/Universal/SetupBrowserDxe/SetupBrowserStr.uni index adb33c599e98c5452bddc6609dfb76f381e68bf9..ca3355ca770bfd7637e3d814c88ddce0d1844227 100644 GIT binary patch delta 270 zcmewpeJ^Q)8vo>ZJY176uo+Eu5K)+{!Y(v9hOch2f`HiMZM+(r)%dT;O)lXUk@aT? zUiS#a-c{FnB~t delta 12 TcmcbY^e1|Q8vo`1fopOADN+T5 diff --git a/MdeModulePkg/Universal/SetupBrowserDxe/Ui.c b/MdeModulePkg/Universal/SetupBrowserDxe/Ui.c index fc715fea5b..639854e8a8 100644 --- a/MdeModulePkg/Universal/SetupBrowserDxe/Ui.c +++ b/MdeModulePkg/Universal/SetupBrowserDxe/Ui.c @@ -295,66 +295,122 @@ UiFreeRefreshList ( Refresh screen. **/ -VOID +EFI_STATUS RefreshForm ( VOID ) { - CHAR16 *OptionString; - MENU_REFRESH_ENTRY *MenuRefreshEntry; - UINTN Index; - UINTN Loop; - EFI_STATUS Status; - UI_MENU_SELECTION *Selection; - FORM_BROWSER_STATEMENT *Question; - - OptionString = NULL; + CHAR16 *OptionString; + MENU_REFRESH_ENTRY *MenuRefreshEntry; + UINTN Index; + EFI_STATUS Status; + UI_MENU_SELECTION *Selection; + FORM_BROWSER_STATEMENT *Question; + EFI_HII_CONFIG_ACCESS_PROTOCOL *ConfigAccess; + EFI_HII_VALUE *HiiValue; + EFI_BROWSER_ACTION_REQUEST ActionRequest; if (gMenuRefreshHead != NULL) { MenuRefreshEntry = gMenuRefreshHead; + // + // Reset FormPackage update flag + // + mHiiPackageListUpdated = FALSE; + do { gST->ConOut->SetAttribute (gST->ConOut, MenuRefreshEntry->CurrentAttribute); Selection = MenuRefreshEntry->Selection; Question = MenuRefreshEntry->MenuOption->ThisTag; - // - // Don't update Question being edited - // - if (Question != MenuRefreshEntry->Selection->Statement) { + Status = GetQuestionValue (Selection->FormSet, Selection->Form, Question, FALSE); + if (EFI_ERROR (Status)) { + return Status; + } - Status = GetQuestionValue (Selection->FormSet, Selection->Form, Question, FALSE); - if (EFI_ERROR (Status)) { - return; + OptionString = NULL; + ProcessOptions (Selection, MenuRefreshEntry->MenuOption, FALSE, &OptionString); + + if (OptionString != NULL) { + // + // If leading spaces on OptionString - remove the spaces + // + for (Index = 0; OptionString[Index] == L' '; Index++) + ; + + PrintStringAt (MenuRefreshEntry->CurrentColumn, MenuRefreshEntry->CurrentRow, &OptionString[Index]); + gBS->FreePool (OptionString); + } + + // + // Question value may be changed, need invoke its Callback() + // + ConfigAccess = Selection->FormSet->ConfigAccess; + if ((Question->QuestionFlags & EFI_IFR_FLAG_CALLBACK) && (ConfigAccess != NULL)) { + ActionRequest = EFI_BROWSER_ACTION_REQUEST_NONE; + + HiiValue = &Question->HiiValue; + if (HiiValue->Type == EFI_IFR_TYPE_STRING) { + // + // Create String in HII database for Configuration Driver to retrieve + // + HiiValue->Value.string = NewString ((CHAR16 *) Question->BufferValue, Selection->FormSet->HiiHandle); } - ProcessOptions (Selection, MenuRefreshEntry->MenuOption, FALSE, &OptionString); + Status = ConfigAccess->Callback ( + ConfigAccess, + EFI_BROWSER_ACTION_CHANGING, + Question->QuestionId, + HiiValue->Type, + &HiiValue->Value, + &ActionRequest + ); - if (OptionString != NULL) { + if (HiiValue->Type == EFI_IFR_TYPE_STRING) { // - // If leading spaces on OptionString - remove the spaces + // Clean the String in HII Database // - for (Index = 0; OptionString[Index] == L' '; Index++) - ; + DeleteString (HiiValue->Value.string, Selection->FormSet->HiiHandle); + } - for (Loop = 0; OptionString[Index] != CHAR_NULL; Index++) { - OptionString[Loop] = OptionString[Index]; - Loop++; + if (!EFI_ERROR (Status)) { + switch (ActionRequest) { + case EFI_BROWSER_ACTION_REQUEST_RESET: + gResetRequired = TRUE; + break; + + case EFI_BROWSER_ACTION_REQUEST_SUBMIT: + SubmitForm (Selection->FormSet, Selection->Form); + break; + + case EFI_BROWSER_ACTION_REQUEST_EXIT: + Selection->Action = UI_ACTION_EXIT; + gNvUpdateRequired = FALSE; + break; + + default: + break; } - - OptionString[Loop] = CHAR_NULL; - - PrintStringAt (MenuRefreshEntry->CurrentColumn, MenuRefreshEntry->CurrentRow, OptionString); - gBS->FreePool (OptionString); } } MenuRefreshEntry = MenuRefreshEntry->Next; } while (MenuRefreshEntry != NULL); + + if (mHiiPackageListUpdated) { + // + // Package list is updated, force to reparse IFR binary of target Formset + // + mHiiPackageListUpdated = FALSE; + Selection->Action = UI_ACTION_REFRESH_FORMSET; + return EFI_SUCCESS; + } } + + return EFI_TIMEOUT; } @@ -446,7 +502,7 @@ UiWaitForSingleEvent ( if (!EFI_ERROR (Status) && Index == 1) { Status = EFI_TIMEOUT; if (RefreshInterval != 0) { - RefreshForm (); + Status = RefreshForm (); } } @@ -1595,7 +1651,16 @@ UiDisplayMenu ( Row = OriginalRow; gST->ConOut->SetAttribute (gST->ConOut, FIELD_TEXT | FIELD_BACKGROUND); - ProcessOptions (Selection, MenuOption, FALSE, &OptionString); + Status = ProcessOptions (Selection, MenuOption, FALSE, &OptionString); + if (EFI_ERROR (Status)) { + // + // Repaint to clear possible error prompt pop-up + // + Repaint = TRUE; + NewLine = TRUE; + ControlFlag = CfRepaint; + break; + } if (OptionString != NULL) { if (Statement->Operand == EFI_IFR_DATE_OP || Statement->Operand == EFI_IFR_TIME_OP) { @@ -2023,12 +2088,8 @@ UiDisplayMenu ( } } - if (((NewPos->ForwardLink != &Menu) && (ScreenOperation == UiDown)) || - ((NewPos->BackLink != &Menu) && (ScreenOperation == UiUp)) || - (ScreenOperation == UiNoOperation) - ) { - UpdateKeyHelp (MenuOption, FALSE); - } + UpdateKeyHelp (MenuOption, FALSE); + // // Clear reverse attribute // @@ -2095,17 +2156,22 @@ UiDisplayMenu ( Status = UiWaitForSingleEvent (gST->ConIn->WaitForKey, 0, MinRefreshInterval); } while (Status == EFI_TIMEOUT); - if (Status == EFI_TIMEOUT) { - Key.UnicodeChar = CHAR_CARRIAGE_RETURN; - } else { - Status = gST->ConIn->ReadKeyStroke (gST->ConIn, &Key); + if (Selection->Action == UI_ACTION_REFRESH_FORMSET) { // - // if we encounter error, continue to read another key in. + // IFR is updated in Callback of refresh opcode, re-parse it // - if (EFI_ERROR (Status)) { - ControlFlag = CfReadKey; - continue; - } + ControlFlag = CfUiReset; + Selection->Statement = NULL; + break; + } + + Status = gST->ConIn->ReadKeyStroke (gST->ConIn, &Key); + // + // if we encounter error, continue to read another key in. + // + if (EFI_ERROR (Status)) { + ControlFlag = CfReadKey; + break; } if (IsListEmpty (&Menu) && Key.UnicodeChar != CHAR_NULL) { @@ -2138,6 +2204,13 @@ UiDisplayMenu ( gDirection = SCAN_LEFT; } Status = ProcessOptions (Selection, MenuOption, TRUE, &OptionString); + if (EFI_ERROR (Status)) { + // + // Repaint to clear possible error prompt pop-up + // + Repaint = TRUE; + NewLine = TRUE; + } if (OptionString != NULL) { FreePool (OptionString); } @@ -2378,15 +2451,14 @@ UiDisplayMenu ( if (EFI_ERROR (Status)) { Repaint = TRUE; NewLine = TRUE; - break; - } + UpdateKeyHelp (MenuOption, FALSE); + } else { + Selection->Action = UI_ACTION_REFRESH_FORM; + } - if (OptionString != NULL) { - PrintStringAt (LocalScreen.LeftColumn + gPromptBlockWidth + 1, MenuOption->Row, OptionString); - gBS->FreePool (OptionString); - } - - Selection->Action = UI_ACTION_REFRESH_FORM; + if (OptionString != NULL) { + FreePool (OptionString); + } break; } break; diff --git a/MdeModulePkg/Universal/SetupBrowserDxe/Ui.h b/MdeModulePkg/Universal/SetupBrowserDxe/Ui.h index 1eaeb59aba..3244cd1dbc 100644 --- a/MdeModulePkg/Universal/SetupBrowserDxe/Ui.h +++ b/MdeModulePkg/Universal/SetupBrowserDxe/Ui.h @@ -1,7 +1,7 @@ /** @file Private structure, MACRO and function definitions for User Interface related functionalities. -Copyright (c) 2004 - 2007, Intel Corporation +Copyright (c) 2004 - 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 @@ -169,6 +169,7 @@ typedef struct { extern LIST_ENTRY gMenuList; extern MENU_REFRESH_ENTRY *gMenuRefreshHead; extern UI_MENU_SELECTION *gCurrentSelection; +extern BOOLEAN mHiiPackageListUpdated; // // Global Functions