diff --git a/MdeModulePkg/Universal/DriverSampleDxe/DriverSample.c b/MdeModulePkg/Universal/DriverSampleDxe/DriverSample.c index cdb8889e87..9c5d4bb61e 100644 --- a/MdeModulePkg/Universal/DriverSampleDxe/DriverSample.c +++ b/MdeModulePkg/Universal/DriverSampleDxe/DriverSample.c @@ -68,6 +68,48 @@ HII_VENDOR_DEVICE_PATH mHiiVendorDevicePath1 = { } }; +/** + Set value of a data element in an Array by its Index. + + @param Array The data array. + @param Type Type of the data in this array. + @param Index Zero based index for data in this array. + @param Value The value to be set. + +**/ +VOID +SetArrayData ( + IN VOID *Array, + IN UINT8 Type, + IN UINTN Index, + IN UINT64 Value + ) +{ + + ASSERT (Array != NULL); + + switch (Type) { + case EFI_IFR_TYPE_NUM_SIZE_8: + *(((UINT8 *) Array) + Index) = (UINT8) Value; + break; + + case EFI_IFR_TYPE_NUM_SIZE_16: + *(((UINT16 *) Array) + Index) = (UINT16) Value; + break; + + case EFI_IFR_TYPE_NUM_SIZE_32: + *(((UINT32 *) Array) + Index) = (UINT32) Value; + break; + + case EFI_IFR_TYPE_NUM_SIZE_64: + *(((UINT64 *) Array) + Index) = (UINT64) Value; + break; + + default: + break; + } +} + /** Add empty function for event process function. @@ -1283,7 +1325,9 @@ DriverCallback ( EFI_STRING Results; UINT32 ProgressErr; CHAR16 *TmpStr; - + UINTN Index; + UINT64 BufferValue; + if (((Value == NULL) && (Action != EFI_BROWSER_ACTION_FORM_OPEN) && (Action != EFI_BROWSER_ACTION_FORM_CLOSE))|| (ActionRequest == NULL)) { return EFI_INVALID_PARAMETER; @@ -1293,6 +1337,7 @@ DriverCallback ( FormId = 0; ProgressErr = 0; Status = EFI_SUCCESS; + BufferValue = 3; PrivateData = DRIVER_SAMPLE_PRIVATE_FROM_THIS (This); switch (Action) { @@ -1470,6 +1515,12 @@ DriverCallback ( Value->u8 = DEFAULT_CLASS_STANDARD_VALUE; break; + case 0x1252: + for (Index = 0; Index < 3; Index ++) { + SetArrayData (Value, EFI_IFR_TYPE_NUM_SIZE_8, Index, BufferValue--); + } + break; + default: Status = EFI_UNSUPPORTED; break; diff --git a/MdeModulePkg/Universal/DriverSampleDxe/NVDataStruc.h b/MdeModulePkg/Universal/DriverSampleDxe/NVDataStruc.h index 0b9e15f9bc..17b4d99c82 100644 --- a/MdeModulePkg/Universal/DriverSampleDxe/NVDataStruc.h +++ b/MdeModulePkg/Universal/DriverSampleDxe/NVDataStruc.h @@ -69,6 +69,7 @@ typedef struct { EFI_HII_TIME Time; UINT8 RefreshGuidCount; UINT8 Match2; + UINT8 GetDefaultValueFromCallBackForOrderedList[3]; } DRIVER_SAMPLE_CONFIGURATION; // diff --git a/MdeModulePkg/Universal/DriverSampleDxe/Vfr.vfr b/MdeModulePkg/Universal/DriverSampleDxe/Vfr.vfr index d1ce68dfb2..6e7b96bd8b 100644 --- a/MdeModulePkg/Universal/DriverSampleDxe/Vfr.vfr +++ b/MdeModulePkg/Universal/DriverSampleDxe/Vfr.vfr @@ -2,7 +2,7 @@ // // Sample Setup formset. // -// Copyright (c) 2004 - 2015, Intel Corporation. All rights reserved.
+// Copyright (c) 2004 - 2016, 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 @@ -434,6 +434,17 @@ formset step = 1, default = 18, endnumeric; + + orderedlist + varid = MyIfrNVData.GetDefaultValueFromCallBackForOrderedList, + questionid = 0x1252, + prompt = STRING_TOKEN(STR_DEFAULT_VALUE_FROM_CALLBACK_PROMPT), + help = STRING_TOKEN(STR_DEFAULT_VALUE_FROM_CALLBACK_HELP), + flags = INTERACTIVE, + option text = STRING_TOKEN(STR_ONE_OF_TEXT1), value = 1, flags = 0; + option text = STRING_TOKEN(STR_ONE_OF_TEXT2), value = 2, flags = 0; + option text = STRING_TOKEN(STR_ONE_OF_TEXT3), value = 3, flags = 0; + endlist; resetbutton defaultstore = MyStandardDefault,