From 16019c8582b8b44f7106fb2aa604c0a0d56f7356 Mon Sep 17 00:00:00 2001 From: lgao4 Date: Fri, 13 Nov 2009 07:13:11 +0000 Subject: Add Example for EFI_BROWSER_ACTION_RETRIEVE callback git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@9426 6f19259b-4bc3-4df7-8a09-765794883524 --- .../Universal/DriverSampleDxe/DriverSample.c | 20 ++++++++++++++++++-- MdeModulePkg/Universal/DriverSampleDxe/Vfr.vfr | 9 +++++---- 2 files changed, 23 insertions(+), 6 deletions(-) (limited to 'MdeModulePkg') diff --git a/MdeModulePkg/Universal/DriverSampleDxe/DriverSample.c b/MdeModulePkg/Universal/DriverSampleDxe/DriverSample.c index a3aa2511bc..d40d60d663 100644 --- a/MdeModulePkg/Universal/DriverSampleDxe/DriverSample.c +++ b/MdeModulePkg/Universal/DriverSampleDxe/DriverSample.c @@ -556,6 +556,7 @@ DriverCallback ( EFI_IFR_GUID_LABEL *EndLabel; EFI_INPUT_KEY Key; DRIVER_SAMPLE_CONFIGURATION *Configuration; + UINTN MyVarSize; if (Action == EFI_BROWSER_ACTION_FORM_OPEN) { // @@ -624,7 +625,6 @@ DriverCallback ( return EFI_INVALID_PARAMETER; } - Status = EFI_SUCCESS; PrivateData = DRIVER_SAMPLE_PRIVATE_FROM_THIS (This); @@ -821,12 +821,13 @@ DriverCallback ( // Change an EFI Variable storage (MyEfiVar) asynchronous, this will cause // the first statement in Form 3 be suppressed // + MyVarSize = 1; MyVar = 111; Status = gRT->SetVariable( L"MyVar", &mFormSetGuid, EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS, - 1, + MyVarSize, &MyVar ); break; @@ -870,6 +871,21 @@ DriverCallback ( break; + case 0x1111: + // + // EfiVarstore question takes sample action (print value as debug information) + // after read/write question. + // + MyVarSize = 1; + Status = gRT->GetVariable( + L"MyVar", + &mFormSetGuid, + NULL, + &MyVarSize, + &MyVar + ); + ASSERT_EFI_ERROR (Status); + DEBUG ((DEBUG_INFO, "EfiVarstore question: Tall value is %d with value width %d\n", MyVar, MyVarSize)); default: break; } diff --git a/MdeModulePkg/Universal/DriverSampleDxe/Vfr.vfr b/MdeModulePkg/Universal/DriverSampleDxe/Vfr.vfr index e8aae2b4d1..d5f906b93c 100644 --- a/MdeModulePkg/Universal/DriverSampleDxe/Vfr.vfr +++ b/MdeModulePkg/Universal/DriverSampleDxe/Vfr.vfr @@ -84,7 +84,7 @@ formset // Define a EFI variable Storage (EFI_IFR_VARSTORE_EFI) // efivarstore MyEfiVar, // Define referenced name in vfr - attribute = EFI_VARIABLE_BOOTSERVICE_ACCESS, // EFI variable attribures + attribute = EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_NON_VOLATILE, // EFI variable attribures name = STRING_TOKEN(STR_VAR_NAME), // EFI variable name varsize = 1, // Size of the EFI variable guid = FORMSET_GUID; // EFI variable GUID @@ -153,9 +153,9 @@ formset oneof varid = MyIfrNVData.BootOrderLarge, prompt = STRING_TOKEN(STR_ONE_OF_PROMPT), help = STRING_TOKEN(STR_ONE_OF_HELP), - default value = cond (questionref(MyOneOf) == 0x0 ? 0 : 1), + default value = cond (pushthis == 0 ? 0 : cond ((questionref(MyOneOf) >> 0x4 & 0xF00) == 0x0 + 0x2 ? 0 : 1)), option text = STRING_TOKEN(STR_BOOT_ORDER1), value = 0x0, flags = 0; - option text = STRING_TOKEN(STR_BOOT_ORDER2), value = 0x1, flags = DEFAULT; + option text = STRING_TOKEN(STR_BOOT_ORDER2), value = 0x1, flags = 0; endoneof; grayoutif ideqval MyIfrNVData.SuppressGrayOutSomething == 0x1; @@ -313,9 +313,10 @@ formset endnumeric; numeric varid = MyEfiVar, // Reference of EFI variable storage + questionid = 0x1111, prompt = STRING_TOKEN(STR_TALL_HEX_PROMPT), help = STRING_TOKEN(STR_NUMERIC_HELP1), - flags = DISPLAY_UINT_HEX, // Display in HEX format (if not specified, default is in decimal format) + flags = DISPLAY_UINT_HEX | INTERACTIVE, // Display in HEX format (if not specified, default is in decimal format) minimum = 0, maximum = 250, default = 175, -- cgit v1.2.3