diff options
author | Dandan Bi <dandan.bi@intel.com> | 2016-04-15 13:25:55 +0800 |
---|---|---|
committer | Star Zeng <star.zeng@intel.com> | 2016-04-19 17:48:12 +0800 |
commit | 622ce645084b9b1f9fb8b27a6a343d868b377cd3 (patch) | |
tree | 4d1982b1fde81ab917aa3a3306f9ef546c4ad716 /MdeModulePkg/Universal | |
parent | 7f36d62918c74079a3150b87e23b62445c36b5ab (diff) | |
download | edk2-platforms-622ce645084b9b1f9fb8b27a6a343d868b377cd3.tar.xz |
MdeModulePkg/DriverSampleDxe: Add a sample case
Add the sample case for orderedlist to get standard
default value from Callback function.
Cc: Liming Gao <liming.gao@intel.com>
Cc: Eric Dong <eric.dong@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Dandan Bi <dandan.bi@intel.com>
Reviewed-by: Eric Dong <eric.dong@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
Diffstat (limited to 'MdeModulePkg/Universal')
-rw-r--r-- | MdeModulePkg/Universal/DriverSampleDxe/DriverSample.c | 53 | ||||
-rw-r--r-- | MdeModulePkg/Universal/DriverSampleDxe/NVDataStruc.h | 1 | ||||
-rw-r--r-- | MdeModulePkg/Universal/DriverSampleDxe/Vfr.vfr | 13 |
3 files changed, 65 insertions, 2 deletions
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 @@ -69,6 +69,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.
@param Event The Event need to be process
@@ -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.<BR>
+// Copyright (c) 2004 - 2016, Intel Corporation. All rights reserved.<BR>
// 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,
|