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>
This commit is contained in:
Dandan Bi
2016-04-15 13:25:55 +08:00
committed by Star Zeng
parent 7f36d62918
commit 622ce64508
3 changed files with 65 additions and 2 deletions

View File

@ -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;