12#define DISPLAY_ONLY_MY_ITEM 0x0002
14CHAR16 VariableName[] = L
"MyIfrNVData";
15CHAR16 MyEfiVar[] = L
"MyEfiVar";
16CHAR16 MyEfiBitVar[] = L
"MyEfiBitVar";
17CHAR16 MyEfiUnionVar[] = L
"MyEfiUnionVar";
33 DRIVER_SAMPLE_FORMSET_GUID
37 END_ENTIRE_DEVICE_PATH_SUBTYPE,
39 (UINT8)(END_DEVICE_PATH_LENGTH),
40 (UINT8)((END_DEVICE_PATH_LENGTH) >> 8)
55 DRIVER_SAMPLE_INVENTORY_GUID
59 END_ENTIRE_DEVICE_PATH_SUBTYPE,
61 (UINT8)(END_DEVICE_PATH_LENGTH),
62 (UINT8)((END_DEVICE_PATH_LENGTH) >> 8)
84 ASSERT (Array !=
NULL);
87 case EFI_IFR_TYPE_NUM_SIZE_8:
88 *(((UINT8 *)Array) + Index) = (UINT8)Value;
91 case EFI_IFR_TYPE_NUM_SIZE_16:
92 *(((UINT16 *)Array) + Index) = (UINT16)Value;
95 case EFI_IFR_TYPE_NUM_SIZE_32:
96 *(((UINT32 *)Array) + Index) = (UINT32)Value;
99 case EFI_IFR_TYPE_NUM_SIZE_64:
100 *(((UINT64 *)Array) + Index) = (UINT64)Value;
121 gBS->SignalEvent (mEvent);
146 Status =
gBS->LocateHandleBuffer (
148 &gEfiSimpleTextInputExProtocolGuid,
153 for (HandleIndex = 0; HandleIndex < HandleCount; HandleIndex++) {
154 Status =
gBS->HandleProtocol (Handles[HandleIndex], &gEfiSimpleTextInputExProtocolGuid, (VOID **)&SimpleEx);
158 KeyData.
Key.ScanCode = 0;
160 KeyData.
Key.UnicodeChar = L
'c';
162 Status = SimpleEx->RegisterKeyNotify (
168 if (EFI_ERROR (Status)) {
173 Status = SimpleEx->RegisterKeyNotify (
179 if (EFI_ERROR (Status)) {
207 Status =
gBS->LocateHandleBuffer (
209 &gEfiSimpleTextInputExProtocolGuid,
214 for (HandleIndex = 0; HandleIndex < HandleCount; HandleIndex++) {
215 Status =
gBS->HandleProtocol (Handles[HandleIndex], &gEfiSimpleTextInputExProtocolGuid, (VOID **)&SimpleEx);
219 KeyData.
Key.ScanCode = 0;
221 KeyData.
Key.UnicodeChar = L
'c';
223 Status = SimpleEx->RegisterKeyNotify (
229 if (!EFI_ERROR (Status)) {
230 Status = SimpleEx->UnregisterKeyNotify (SimpleEx, NotifyHandle);
234 Status = SimpleEx->RegisterKeyNotify (
240 if (!EFI_ERROR (Status)) {
241 Status = SimpleEx->UnregisterKeyNotify (SimpleEx, NotifyHandle);
267 for (Index = 0; Index < NAME_VALUE_NAME_NUMBER; Index++) {
269 PrivateData->HiiHandle[0],
270 PrivateData->NameStringId[Index],
273 if (PrivateData->NameValueName[Index] ==
NULL) {
274 return EFI_NOT_FOUND;
302 IN EFI_STRING StringPtr,
316 if ((StringPtr ==
NULL) || (*StringPtr == L
'\0') || (Number ==
NULL) || (Len ==
NULL)) {
317 return EFI_INVALID_PARAMETER;
323 while (*StringPtr != L
'\0' && *StringPtr != L
'&') {
327 *Len = StringPtr - TmpPtr;
332 Status = EFI_OUT_OF_RESOURCES;
336 CopyMem (Str, TmpPtr, *Len *
sizeof (CHAR16));
337 *(Str + *Len) = L
'\0';
339 Length = (Length + 1) / 2;
342 Status = EFI_OUT_OF_RESOURCES;
347 ZeroMem (TemStr,
sizeof (TemStr));
348 for (Index = 0; Index < Length; Index++) {
349 TemStr[0] = Str[Length - Index - 1];
351 if ((Index & 1) == 0) {
352 Buf[Index/2] = DigitUint8;
354 Buf[Index/2] = (UINT8)((DigitUint8 << 4) + Buf[Index/2]);
382 IN EFI_STRING Result,
383 IN EFI_STRING ConfigHdr,
388 EFI_STRING StringPtr;
396 NewLen = (NewLen + ((1 +
StrLen (ConfigHdr) + 8 + 4) + (8 + 4 + 7 + 4 + 7 + 4)) * 2 + 1) *
sizeof (CHAR16);
398 if (StringPtr ==
NULL) {
403 if (Result !=
NULL) {
404 StrCpyS (StringPtr, NewLen /
sizeof (CHAR16), Result);
405 StringPtr +=
StrLen (Result);
411 (1 +
StrLen (ConfigHdr) + 8 + 4 + 1) *
sizeof (CHAR16),
414 EFI_HII_DEFAULT_CLASS_STANDARD
416 StringPtr +=
StrLen (StringPtr);
420 (8 + 4 + 7 + 4 + 7 + 4 + 1) *
sizeof (CHAR16),
421 L
"&OFFSET=%04x&WIDTH=%04x&VALUE=%04x",
424 DEFAULT_CLASS_STANDARD_VALUE
426 StringPtr +=
StrLen (StringPtr);
430 (1 +
StrLen (ConfigHdr) + 8 + 4 + 1) *
sizeof (CHAR16),
433 EFI_HII_DEFAULT_CLASS_MANUFACTURING
435 StringPtr +=
StrLen (StringPtr);
439 (8 + 4 + 7 + 4 + 7 + 4 + 1) *
sizeof (CHAR16),
440 L
"&OFFSET=%04x&WIDTH=%04x&VALUE=%04x",
443 DEFAULT_CLASS_MANUFACTURING_VALUE
445 StringPtr +=
StrLen (StringPtr);
460 IN OUT EFI_STRING *RequestResult,
461 IN EFI_STRING ConfigRequestHdr
464 EFI_STRING StringPtr;
475 StringPtr = *RequestResult;
476 StringPtr =
StrStr (StringPtr, L
"OFFSET");
481 if (StringPtr ==
NULL) {
485 while (*StringPtr != 0 &&
StrnCmp (StringPtr, L
"OFFSET=",
StrLen (L
"OFFSET=")) == 0) {
486 StringPtr +=
StrLen (L
"OFFSET=");
491 if (EFI_ERROR (Status)) {
499 (((Length + 1) / 2) <
sizeof (
UINTN)) ? ((Length + 1) / 2) :
sizeof (
UINTN)
504 if (
StrnCmp (StringPtr, L
"&WIDTH=",
StrLen (L
"&WIDTH=")) != 0) {
508 StringPtr +=
StrLen (L
"&WIDTH=");
514 if (EFI_ERROR (Status)) {
522 (((Length + 1) / 2) <
sizeof (
UINTN)) ? ((Length + 1) / 2) :
sizeof (
UINTN)
527 if (
StrnCmp (StringPtr, L
"&VALUE=",
StrLen (L
"&VALUE=")) != 0) {
531 StringPtr +=
StrLen (L
"&VALUE=");
537 if (EFI_ERROR (Status)) {
551 if (Offset + Width > BlockSize) {
555 if ((Offset <= ValueOffset) && (Offset + Width >= ValueOffset + ValueWidth)) {
556 *RequestResult =
CreateAltCfgString (*RequestResult, ConfigRequestHdr, ValueOffset, ValueWidth);
593 OUT EFI_STRING *Progress,
594 OUT EFI_STRING *Results
601 EFI_STRING ConfigRequest;
602 EFI_STRING ConfigRequestHdr;
608 BOOLEAN AllocatedRequest;
610 if ((Progress ==
NULL) || (Results ==
NULL)) {
611 return EFI_INVALID_PARAMETER;
617 ConfigRequestHdr =
NULL;
618 ConfigRequest =
NULL;
621 AllocatedRequest =
FALSE;
623 PrivateData = DRIVER_SAMPLE_PRIVATE_FROM_THIS (This);
624 HiiConfigRouting = PrivateData->HiiConfigRouting;
631 Status =
gRT->GetVariable (
633 &gDriverSampleFormSetGuid,
636 &PrivateData->Configuration
638 if (EFI_ERROR (Status)) {
639 return EFI_NOT_FOUND;
642 if (Request ==
NULL) {
651 ConfigRequestHdr =
HiiConstructConfigHdr (&gDriverSampleFormSetGuid, VariableName, PrivateData->DriverHandle[0]);
652 Size = (
StrLen (ConfigRequestHdr) + 32 + 1) *
sizeof (CHAR16);
654 ASSERT (ConfigRequest !=
NULL);
655 AllocatedRequest =
TRUE;
656 UnicodeSPrint (ConfigRequest, Size, L
"%s&OFFSET=0&WIDTH=%016LX", ConfigRequestHdr, (UINT64)BufferSize);
658 ConfigRequestHdr =
NULL;
665 return EFI_NOT_FOUND;
673 return EFI_UNSUPPORTED;
677 return EFI_UNSUPPORTED;
681 return EFI_UNSUPPORTED;
687 ConfigRequest = Request;
695 StrPointer =
StrStr (Request, L
"PATH");
696 if (StrPointer ==
NULL) {
697 return EFI_INVALID_PARAMETER;
701 Size = (
StrLen (Request) + 32 + 1) *
sizeof (CHAR16);
703 ASSERT (ConfigRequest !=
NULL);
704 AllocatedRequest =
TRUE;
705 UnicodeSPrint (ConfigRequest, Size, L
"%s&OFFSET=0&WIDTH=%016LX", Request, (UINT64)BufferSize);
713 if (
StrStr (ConfigRequest, L
"OFFSET") ==
NULL) {
718 if (EFI_ERROR (Status)) {
727 BufferSize = (
StrLen (ConfigRequest) +
728 1 +
sizeof (PrivateData->Configuration.NameValueVar0) * 2 +
729 1 +
sizeof (PrivateData->Configuration.NameValueVar1) * 2 +
730 1 +
sizeof (PrivateData->Configuration.NameValueVar2) * 2 + 1) *
sizeof (CHAR16);
732 ASSERT (*Results !=
NULL);
733 StrCpyS (*Results, BufferSize /
sizeof (CHAR16), ConfigRequest);
739 if ((Value =
StrStr (*Results, PrivateData->NameValueName[0])) !=
NULL) {
740 Value +=
StrLen (PrivateData->NameValueName[0]);
741 ValueStrLen = ((
sizeof (PrivateData->Configuration.NameValueVar0) * 2) + 1);
744 BackupChar = Value[ValueStrLen];
748 BufferSize - ((
UINTN)Value - (
UINTN)*Results),
749 PREFIX_ZERO | RADIX_HEX,
750 PrivateData->Configuration.NameValueVar0,
751 sizeof (PrivateData->Configuration.NameValueVar0) * 2
753 Value +=
StrnLenS (Value, (BufferSize - ((
UINTN)Value - (
UINTN)*Results)) /
sizeof (CHAR16));
760 if ((Value =
StrStr (*Results, PrivateData->NameValueName[1])) !=
NULL) {
761 Value +=
StrLen (PrivateData->NameValueName[1]);
762 ValueStrLen = ((
sizeof (PrivateData->Configuration.NameValueVar1) * 2) + 1);
765 BackupChar = Value[ValueStrLen];
769 BufferSize - ((
UINTN)Value - (
UINTN)*Results),
770 PREFIX_ZERO | RADIX_HEX,
771 PrivateData->Configuration.NameValueVar1,
772 sizeof (PrivateData->Configuration.NameValueVar1) * 2
774 Value +=
StrnLenS (Value, (BufferSize - ((
UINTN)Value - (
UINTN)*Results)) /
sizeof (CHAR16));
781 if ((Value =
StrStr (*Results, PrivateData->NameValueName[2])) !=
NULL) {
782 Value +=
StrLen (PrivateData->NameValueName[2]);
783 ValueStrLen =
StrLen (PrivateData->Configuration.NameValueVar2) * 4 + 1;
790 StrPointer = (CHAR16 *)PrivateData->Configuration.NameValueVar2;
791 for ( ; *StrPointer != L
'\0'; StrPointer++) {
794 BufferSize - ((
UINTN)Value - (
UINTN)*Results),
795 PREFIX_ZERO | RADIX_HEX,
799 Value +=
StrnLenS (Value, (BufferSize - ((
UINTN)Value - (
UINTN)*Results)) /
sizeof (CHAR16));
808 Status = HiiConfigRouting->BlockToConfig (
811 (UINT8 *)&PrivateData->Configuration,
816 if (!EFI_ERROR (Status)) {
817 ConfigRequestHdr =
HiiConstructConfigHdr (&gDriverSampleFormSetGuid, VariableName, PrivateData->DriverHandle[0]);
825 if (AllocatedRequest) {
829 if (ConfigRequestHdr !=
NULL) {
836 if (Request ==
NULL) {
838 }
else if (
StrStr (Request, L
"OFFSET") ==
NULL) {
839 *Progress = Request +
StrLen (Request);
868 IN CONST EFI_STRING Configuration,
869 OUT EFI_STRING *Progress
884 if ((Configuration ==
NULL) || (Progress ==
NULL)) {
885 return EFI_INVALID_PARAMETER;
888 PrivateData = DRIVER_SAMPLE_PRIVATE_FROM_THIS (This);
889 HiiConfigRouting = PrivateData->HiiConfigRouting;
890 *Progress = Configuration;
897 return EFI_NOT_FOUND;
905 return EFI_UNSUPPORTED;
909 return EFI_UNSUPPORTED;
913 return EFI_UNSUPPORTED;
920 Status =
gRT->GetVariable (
922 &gDriverSampleFormSetGuid,
925 &PrivateData->Configuration
927 if (EFI_ERROR (Status)) {
934 if (
StrStr (Configuration, L
"OFFSET") ==
NULL) {
939 if (EFI_ERROR (Status)) {
946 if ((Value =
StrStr (Configuration, PrivateData->NameValueName[0])) !=
NULL) {
950 Value +=
StrLen (PrivateData->NameValueName[0]);
955 StrPtr =
StrStr (Value, L
"&");
956 if (StrPtr ==
NULL) {
957 StrPtr = Value +
StrLen (Value);
963 DataBuffer = (UINT8 *)&PrivateData->Configuration.NameValueVar0;
964 ZeroMem (TemStr,
sizeof (TemStr));
965 for (Index = 0, StrPtr--; StrPtr >= Value; StrPtr--, Index++) {
968 if ((Index & 1) == 0) {
969 DataBuffer[Index/2] = DigitUint8;
971 DataBuffer[Index/2] = (UINT8)((UINT8)(DigitUint8 << 4) + DataBuffer[Index/2]);
979 if ((Value =
StrStr (Configuration, PrivateData->NameValueName[1])) !=
NULL) {
983 Value +=
StrLen (PrivateData->NameValueName[1]);
988 StrPtr =
StrStr (Value, L
"&");
989 if (StrPtr ==
NULL) {
990 StrPtr = Value +
StrLen (Value);
996 DataBuffer = (UINT8 *)&PrivateData->Configuration.NameValueVar1;
997 ZeroMem (TemStr,
sizeof (TemStr));
998 for (Index = 0, StrPtr--; StrPtr >= Value; StrPtr--, Index++) {
1001 if ((Index & 1) == 0) {
1002 DataBuffer[Index/2] = DigitUint8;
1004 DataBuffer[Index/2] = (UINT8)((UINT8)(DigitUint8 << 4) + DataBuffer[Index/2]);
1012 if ((Value =
StrStr (Configuration, PrivateData->NameValueName[2])) !=
NULL) {
1016 Value +=
StrLen (PrivateData->NameValueName[2]);
1021 StrPtr =
StrStr (Value, L
"&");
1022 if (StrPtr ==
NULL) {
1023 StrPtr = Value +
StrLen (Value);
1029 StrBuffer = (CHAR16 *)PrivateData->Configuration.NameValueVar2;
1030 ZeroMem (TemStr,
sizeof (TemStr));
1031 while (Value < StrPtr) {
1032 StrnCpyS (TemStr,
sizeof (TemStr) /
sizeof (CHAR16), Value, 4);
1043 Status =
gRT->SetVariable (
1045 &gDriverSampleFormSetGuid,
1048 &PrivateData->Configuration
1058 Status = HiiConfigRouting->ConfigToBlock (
1061 (UINT8 *)&PrivateData->Configuration,
1065 if (EFI_ERROR (Status)) {
1069 if (PrivateData->Configuration.QuestionApply == 44) {
1071 return EFI_DEVICE_ERROR;
1077 Status =
gRT->SetVariable (
1079 &gDriverSampleFormSetGuid,
1082 &PrivateData->Configuration
1114 IN EFI_BROWSER_ACTION Action,
1115 IN EFI_QUESTION_ID QuestionId,
1118 OUT EFI_BROWSER_ACTION_REQUEST *ActionRequest
1123 VOID *StartOpCodeHandle;
1124 VOID *OptionsOpCodeHandle;
1126 VOID *EndOpCodeHandle;
1132 EFI_STRING Progress;
1138 EFI_HII_POPUP_SELECTION UserSelection;
1140 UserSelection = 0xFF;
1142 if (((Value ==
NULL) && (Action != EFI_BROWSER_ACTION_FORM_OPEN) && (Action != EFI_BROWSER_ACTION_FORM_CLOSE)) ||
1143 (ActionRequest ==
NULL))
1145 return EFI_INVALID_PARAMETER;
1152 PrivateData = DRIVER_SAMPLE_PRIVATE_FROM_THIS (This);
1155 case EFI_BROWSER_ACTION_FORM_OPEN:
1157 if (QuestionId == 0x1234) {
1163 PrivateData = DRIVER_SAMPLE_PRIVATE_FROM_THIS (This);
1169 ASSERT (StartOpCodeHandle !=
NULL);
1176 StartLabel->
Number = LABEL_UPDATE2;
1183 EFI_IFR_FLAG_CALLBACK,
1188 PrivateData->HiiHandle[0],
1189 &gDriverSampleFormSetGuid,
1198 if (QuestionId == 0x1247) {
1206 case EFI_BROWSER_ACTION_FORM_CLOSE:
1208 if (QuestionId == 0x5678) {
1215 EFI_LIGHTGRAY | EFI_BACKGROUND_BLUE,
1218 L
"You are going to leave third Form!",
1219 L
"Press ESC or ENTER to continue ...",
1223 }
while ((Key.ScanCode != SCAN_ESC) && (Key.UnicodeChar != CHAR_CARRIAGE_RETURN));
1226 if (QuestionId == 0x1247) {
1234 case EFI_BROWSER_ACTION_RETRIEVE:
1236 switch (QuestionId ) {
1238 if (Type != EFI_IFR_TYPE_REF) {
1239 return EFI_INVALID_PARAMETER;
1242 Value->ref.FormId = 0x3;
1255 ASSERT (StartOpCodeHandle !=
NULL);
1262 if (QuestionId == 0x5678) {
1263 StartLabel->
Number = LABEL_UPDATE2;
1265 PrivateData->Configuration.DynamicRefresh++;
1266 }
else if (QuestionId == 0x1247 ) {
1267 StartLabel->
Number = LABEL_UPDATE3;
1269 PrivateData->Configuration.RefreshGuidCount++;
1277 EFI_IFR_FLAG_CALLBACK,
1282 PrivateData->HiiHandle[0],
1283 &gDriverSampleFormSetGuid,
1294 Status =
gRT->SetVariable (
1296 &gDriverSampleFormSetGuid,
1299 &PrivateData->Configuration
1302 if (QuestionId == 0x5678) {
1307 ASSERT (EfiData !=
NULL);
1309 EfiData->Field8 = 111;
1311 &gDriverSampleFormSetGuid,
1328 case EFI_BROWSER_ACTION_DEFAULT_STANDARD:
1330 switch (QuestionId) {
1332 Value->u8 = DEFAULT_CLASS_STANDARD_VALUE;
1336 for (Index = 0; Index < 3; Index++) {
1337 SetArrayData (Value, EFI_IFR_TYPE_NUM_SIZE_8, Index, BufferValue--);
1347 Status = EFI_UNSUPPORTED;
1354 case EFI_BROWSER_ACTION_DEFAULT_MANUFACTURING:
1356 switch (QuestionId) {
1358 Value->u8 = DEFAULT_CLASS_MANUFACTURING_VALUE;
1366 Status = EFI_UNSUPPORTED;
1373 case EFI_BROWSER_ACTION_CHANGING:
1375 switch (QuestionId) {
1378 if (Type != EFI_IFR_TYPE_REF) {
1379 return EFI_INVALID_PARAMETER;
1382 Value->ref.FormId = 0x1234;
1390 ASSERT (StartOpCodeHandle !=
NULL);
1393 ASSERT (EndOpCodeHandle !=
NULL);
1400 StartLabel->
Number = LABEL_UPDATE1;
1407 EndLabel->
Number = LABEL_END;
1414 EFI_IFR_FLAG_CALLBACK,
1422 ASSERT (OptionsOpCodeHandle !=
NULL);
1425 OptionsOpCodeHandle,
1428 EFI_IFR_NUMERIC_SIZE_1,
1433 OptionsOpCodeHandle,
1436 EFI_IFR_NUMERIC_SIZE_1,
1443 PrivateData->Configuration.DynamicOneof = 2;
1444 Status =
gRT->SetVariable (
1446 &gDriverSampleFormSetGuid,
1449 &PrivateData->Configuration
1456 ASSERT (Configuration !=
NULL);
1458 Configuration->DynamicOneof = 2;
1464 &gDriverSampleFormSetGuid,
1467 (UINT8 *)Configuration,
1477 CONFIGURATION_VARSTORE_ID,
1478 (UINT16)DYNAMIC_ONE_OF_VAR_OFFSET,
1481 EFI_IFR_FLAG_CALLBACK,
1482 EFI_IFR_NUMERIC_SIZE_1,
1483 OptionsOpCodeHandle,
1490 CONFIGURATION_VARSTORE_ID,
1491 (UINT16)DYNAMIC_ORDERED_LIST_VAR_OFFSET,
1494 EFI_IFR_FLAG_RESET_REQUIRED,
1496 EFI_IFR_NUMERIC_SIZE_1,
1498 OptionsOpCodeHandle,
1517 QF_DATE_STORAGE_TIME,
1529 QF_TIME_STORAGE_TIME,
1543 PrivateData->HiiHandle[0],
1544 &gDriverSampleFormSetGuid,
1562 case EFI_BROWSER_ACTION_CHANGED:
1563 switch (QuestionId) {
1568 *ActionRequest = EFI_BROWSER_ACTION_REQUEST_EXIT;
1575 *ActionRequest = EFI_BROWSER_ACTION_REQUEST_SUBMIT;
1583 *ActionRequest = EFI_BROWSER_ACTION_REQUEST_FORM_SUBMIT_EXIT;
1590 *ActionRequest = EFI_BROWSER_ACTION_REQUEST_FORM_DISCARD;
1597 *ActionRequest = EFI_BROWSER_ACTION_REQUEST_FORM_APPLY;
1605 *ActionRequest = EFI_BROWSER_ACTION_REQUEST_FORM_DISCARD_EXIT;
1612 *ActionRequest = EFI_BROWSER_ACTION_REQUEST_QUESTION_APPLY;
1619 Status = PrivateData->HiiKeywordHandler->GetData (
1620 PrivateData->HiiKeywordHandler,
1621 L
"NAMESPACE=x-UEFI-ns",
1622 L
"KEYWORD=iSCSIBootEnable",
1627 if (EFI_ERROR (Status)) {
1630 EFI_LIGHTGRAY | EFI_BACKGROUND_BLUE,
1633 L
"This system not support this keyword!",
1634 L
"Press ENTER to continue ...",
1638 }
while (Key.UnicodeChar != CHAR_CARRIAGE_RETURN);
1651 TmpStr =
StrStr (Results, L
"&VALUE=");
1652 ASSERT (TmpStr !=
NULL);
1653 TmpStr +=
StrLen (L
"&VALUE=");
1655 if (*TmpStr == L
'0') {
1664 Status = PrivateData->HiiKeywordHandler->SetData (
1665 PrivateData->HiiKeywordHandler,
1670 if (EFI_ERROR (Status)) {
1673 EFI_LIGHTGRAY | EFI_BACKGROUND_BLUE,
1676 L
"Set keyword to the system failed!",
1677 L
"Press ENTER to continue ...",
1681 }
while (Key.UnicodeChar != CHAR_CARRIAGE_RETURN);
1690 Status = mPrivateData->HiiPopup->CreatePopup (
1691 mPrivateData->HiiPopup,
1692 EfiHiiPopupStyleInfo,
1693 EfiHiiPopupTypeYesNo,
1694 mPrivateData->HiiHandle[0],
1698 if (!EFI_ERROR (Status)) {
1699 if (UserSelection == EfiHiiPopupSelectionYes) {
1700 *ActionRequest = EFI_BROWSER_ACTION_REQUEST_EXIT;
1712 case EFI_BROWSER_ACTION_SUBMITTED:
1714 if (QuestionId == 0x1250) {
1721 EFI_LIGHTGRAY | EFI_BACKGROUND_BLUE,
1724 L
"EfiVarstore value has been submitted!",
1725 L
"Press ESC or ENTER to continue ...",
1729 }
while ((Key.ScanCode != SCAN_ESC) && (Key.UnicodeChar != CHAR_CARRIAGE_RETURN));
1736 Status = EFI_UNSUPPORTED;
1772 EFI_STRING ConfigRequestHdr;
1773 EFI_STRING NameRequestHdr;
1783 ConfigRequestHdr =
NULL;
1794 Screen.BottomRow = Screen.BottomRow - 3;
1800 if (mPrivateData ==
NULL) {
1801 return EFI_OUT_OF_RESOURCES;
1804 mPrivateData->Signature = DRIVER_SAMPLE_PRIVATE_SIGNATURE;
1807 mPrivateData->ConfigAccess.RouteConfig =
RouteConfig;
1813 Status =
gBS->LocateProtocol (&gEfiHiiDatabaseProtocolGuid,
NULL, (VOID **)&HiiDatabase);
1814 if (EFI_ERROR (Status)) {
1818 mPrivateData->HiiDatabase = HiiDatabase;
1823 Status =
gBS->LocateProtocol (&gEfiHiiStringProtocolGuid,
NULL, (VOID **)&HiiString);
1824 if (EFI_ERROR (Status)) {
1828 mPrivateData->HiiString = HiiString;
1833 Status =
gBS->LocateProtocol (&gEfiFormBrowser2ProtocolGuid,
NULL, (VOID **)&FormBrowser2);
1834 if (EFI_ERROR (Status)) {
1838 mPrivateData->FormBrowser2 = FormBrowser2;
1843 Status =
gBS->LocateProtocol (&gEfiHiiConfigRoutingProtocolGuid,
NULL, (VOID **)&HiiConfigRouting);
1844 if (EFI_ERROR (Status)) {
1848 mPrivateData->HiiConfigRouting = HiiConfigRouting;
1853 Status =
gBS->LocateProtocol (&gEfiConfigKeywordHandlerProtocolGuid,
NULL, (VOID **)&HiiKeywordHandler);
1854 if (EFI_ERROR (Status)) {
1858 mPrivateData->HiiKeywordHandler = HiiKeywordHandler;
1863 Status =
gBS->LocateProtocol (&gEfiHiiPopupProtocolGuid,
NULL, (VOID **)&PopupHandler);
1864 if (EFI_ERROR (Status)) {
1868 mPrivateData->HiiPopup = PopupHandler;
1870 Status =
gBS->InstallMultipleProtocolInterfaces (
1872 &gEfiDevicePathProtocolGuid,
1873 &mHiiVendorDevicePath0,
1874 &gEfiHiiConfigAccessProtocolGuid,
1875 &mPrivateData->ConfigAccess,
1880 mPrivateData->DriverHandle[0] = DriverHandle[0];
1886 &gDriverSampleFormSetGuid,
1888 DriverSampleStrings,
1892 if (HiiHandle[0] ==
NULL) {
1893 return EFI_OUT_OF_RESOURCES;
1896 mPrivateData->HiiHandle[0] = HiiHandle[0];
1901 Status =
gBS->InstallMultipleProtocolInterfaces (
1903 &gEfiDevicePathProtocolGuid,
1904 &mHiiVendorDevicePath1,
1905 &gEfiHiiConfigAccessProtocolGuid,
1906 &mPrivateData->ConfigAccess,
1911 mPrivateData->DriverHandle[1] = DriverHandle[1];
1914 &gDriverSampleInventoryGuid,
1916 DriverSampleStrings,
1920 if (HiiHandle[1] ==
NULL) {
1922 return EFI_OUT_OF_RESOURCES;
1925 mPrivateData->HiiHandle[1] = HiiHandle[1];
1933 return EFI_OUT_OF_RESOURCES;
1948 return EFI_OUT_OF_RESOURCES;
1956 mPrivateData->NameStringId[0] = STR_NAME_VALUE_VAR_NAME0;
1957 mPrivateData->NameStringId[1] = STR_NAME_VALUE_VAR_NAME1;
1958 mPrivateData->NameStringId[2] = STR_NAME_VALUE_VAR_NAME2;
1963 Configuration = &mPrivateData->Configuration;
1969 ConfigRequestHdr =
HiiConstructConfigHdr (&gDriverSampleFormSetGuid, VariableName, DriverHandle[0]);
1970 ASSERT (ConfigRequestHdr !=
NULL);
1973 ASSERT (NameRequestHdr !=
NULL);
1976 Status =
gRT->GetVariable (VariableName, &gDriverSampleFormSetGuid,
NULL, &BufferSize, Configuration);
1977 if (EFI_ERROR (Status)) {
1981 Status =
gRT->SetVariable (
1983 &gDriverSampleFormSetGuid,
1988 if (EFI_ERROR (Status)) {
1997 ActionFlag =
HiiSetToDefaults (NameRequestHdr, EFI_HII_DEFAULT_CLASS_STANDARD);
2000 return EFI_INVALID_PARAMETER;
2003 ActionFlag =
HiiSetToDefaults (ConfigRequestHdr, EFI_HII_DEFAULT_CLASS_STANDARD);
2006 return EFI_INVALID_PARAMETER;
2015 return EFI_INVALID_PARAMETER;
2021 return EFI_INVALID_PARAMETER;
2030 VarStoreConfig = &mPrivateData->VarStoreConfig;
2034 ASSERT (ConfigRequestHdr !=
NULL);
2037 Status =
gRT->GetVariable (MyEfiVar, &gDriverSampleFormSetGuid,
NULL, &BufferSize, VarStoreConfig);
2038 if (EFI_ERROR (Status)) {
2042 Status =
gRT->SetVariable (
2044 &gDriverSampleFormSetGuid,
2049 if (EFI_ERROR (Status)) {
2058 ActionFlag =
HiiSetToDefaults (ConfigRequestHdr, EFI_HII_DEFAULT_CLASS_STANDARD);
2061 return EFI_INVALID_PARAMETER;
2070 return EFI_INVALID_PARAMETER;
2079 BitsVarStoreConfig = &mPrivateData->BitsVarStoreConfig;
2083 ASSERT (ConfigRequestHdr !=
NULL);
2086 Status =
gRT->GetVariable (MyEfiBitVar, &gDriverSampleFormSetGuid,
NULL, &BufferSize, BitsVarStoreConfig);
2087 if (EFI_ERROR (Status)) {
2091 Status =
gRT->SetVariable (
2093 &gDriverSampleFormSetGuid,
2098 if (EFI_ERROR (Status)) {
2107 ActionFlag =
HiiSetToDefaults (ConfigRequestHdr, EFI_HII_DEFAULT_CLASS_STANDARD);
2110 return EFI_INVALID_PARAMETER;
2119 return EFI_INVALID_PARAMETER;
2128 UnionConfig = &mPrivateData->UnionConfig;
2131 ConfigRequestHdr =
HiiConstructConfigHdr (&gDriverSampleFormSetGuid, MyEfiUnionVar, DriverHandle[0]);
2132 ASSERT (ConfigRequestHdr !=
NULL);
2135 Status =
gRT->GetVariable (MyEfiUnionVar, &gDriverSampleFormSetGuid,
NULL, &BufferSize, UnionConfig);
2136 if (EFI_ERROR (Status)) {
2140 Status =
gRT->SetVariable (
2142 &gDriverSampleFormSetGuid,
2147 if (EFI_ERROR (Status)) {
2156 ActionFlag =
HiiSetToDefaults (ConfigRequestHdr, EFI_HII_DEFAULT_CLASS_STANDARD);
2159 return EFI_INVALID_PARAMETER;
2168 return EFI_INVALID_PARAMETER;
2174 Status =
gBS->CreateEventEx (
2179 &gEfiIfrRefreshIdOpGuid,
2187 Status =
gBS->LocateProtocol (&gEdkiiFormBrowserExProtocolGuid,
NULL, (VOID **)&FormBrowserEx);
2188 if (!EFI_ERROR (Status)) {
2192 HotKey.UnicodeChar = CHAR_NULL;
2193 HotKey.ScanCode = SCAN_F9;
2194 FormBrowserEx->RegisterHotKey (&HotKey, 0, 0,
NULL);
2195 HotKey.ScanCode = SCAN_F10;
2196 FormBrowserEx->RegisterHotKey (&HotKey, 0, 0,
NULL);
2201 HotKey.ScanCode = SCAN_F10;
2204 FormBrowserEx->RegisterHotKey (&HotKey, BROWSER_ACTION_SUBMIT, 0,
NewString);
2205 HotKey.ScanCode = SCAN_F9;
2208 FormBrowserEx->RegisterHotKey (&HotKey, BROWSER_ACTION_DEFAULT, EFI_HII_DEFAULT_CLASS_STANDARD,
NewString);
2221 if (DISPLAY_ONLY_MY_ITEM <= 1) {
2225 Status = FormBrowser2->SendForm (
2227 &(HiiHandle[DISPLAY_ONLY_MY_ITEM]),
2258 ASSERT (mPrivateData !=
NULL);
2260 if (DriverHandle[0] !=
NULL) {
2261 gBS->UninstallMultipleProtocolInterfaces (
2263 &gEfiDevicePathProtocolGuid,
2264 &mHiiVendorDevicePath0,
2265 &gEfiHiiConfigAccessProtocolGuid,
2266 &mPrivateData->ConfigAccess,
2269 DriverHandle[0] =
NULL;
2272 if (DriverHandle[1] !=
NULL) {
2273 gBS->UninstallMultipleProtocolInterfaces (
2275 &gEfiDevicePathProtocolGuid,
2276 &mHiiVendorDevicePath1,
2277 &gEfiHiiConfigAccessProtocolGuid,
2278 &mPrivateData->ConfigAccess,
2281 DriverHandle[1] =
NULL;
2284 if (mPrivateData->HiiHandle[0] !=
NULL) {
2288 if (mPrivateData->HiiHandle[1] !=
NULL) {
2292 for (Index = 0; Index < NAME_VALUE_NAME_NUMBER; Index++) {
2293 if (mPrivateData->NameValueName[Index] !=
NULL) {
2294 FreePool (mPrivateData->NameValueName[Index]);
2299 mPrivateData =
NULL;
2301 gBS->CloseEvent (mEvent);
UINT64 EFIAPI StrHexToUint64(IN CONST CHAR16 *String)
UINTN EFIAPI StrSize(IN CONST CHAR16 *String)
RETURN_STATUS EFIAPI StrCpyS(OUT CHAR16 *Destination, IN UINTN DestMax, IN CONST CHAR16 *Source)
UINTN EFIAPI StrnLenS(IN CONST CHAR16 *String, IN UINTN MaxSize)
INTN EFIAPI StrnCmp(IN CONST CHAR16 *FirstString, IN CONST CHAR16 *SecondString, IN UINTN Length)
RETURN_STATUS EFIAPI StrnCpyS(OUT CHAR16 *Destination, IN UINTN DestMax, IN CONST CHAR16 *Source, IN UINTN Length)
UINTN EFIAPI StrLen(IN CONST CHAR16 *String)
CHAR16 *EFIAPI StrStr(IN CONST CHAR16 *String, IN CONST CHAR16 *SearchString)
VOID *EFIAPI CopyMem(OUT VOID *DestinationBuffer, IN CONST VOID *SourceBuffer, IN UINTN Length)
VOID *EFIAPI ZeroMem(OUT VOID *Buffer, IN UINTN Length)
#define HARDWARE_DEVICE_PATH
CHAR16 *EFIAPI ConvertDevicePathToText(IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath, IN BOOLEAN DisplayOnly, IN BOOLEAN AllowShortcuts)
EFI_STATUS LoadNameValueNames(IN DRIVER_SAMPLE_PRIVATE_DATA *PrivateData)
EFI_STATUS EFIAPI ExtractConfig(IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This, IN CONST EFI_STRING Request, OUT EFI_STRING *Progress, OUT EFI_STRING *Results)
EFI_STATUS EFIAPI DriverSampleUnload(IN EFI_HANDLE ImageHandle)
EFI_STATUS EFIAPI NotificationFunction(IN EFI_KEY_DATA *KeyData)
VOID AppendAltCfgString(IN OUT EFI_STRING *RequestResult, IN EFI_STRING ConfigRequestHdr)
EFI_STRING CreateAltCfgString(IN EFI_STRING Result, IN EFI_STRING ConfigHdr, IN UINTN Offset, IN UINTN Width)
EFI_STATUS EFIAPI InternalStartMonitor(VOID)
EFI_STATUS GetValueOfNumber(IN EFI_STRING StringPtr, OUT UINT8 **Number, OUT UINTN *Len)
VOID SetArrayData(IN VOID *Array, IN UINT8 Type, IN UINTN Index, IN UINT64 Value)
EFI_STATUS EFIAPI DriverCallback(IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This, IN EFI_BROWSER_ACTION Action, IN EFI_QUESTION_ID QuestionId, IN UINT8 Type, IN EFI_IFR_TYPE_VALUE *Value, OUT EFI_BROWSER_ACTION_REQUEST *ActionRequest)
EFI_STATUS EFIAPI DriverSampleInit(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable)
EFI_STATUS EFIAPI RouteConfig(IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This, IN CONST EFI_STRING Configuration, OUT EFI_STRING *Progress)
EFI_STATUS EFIAPI InternalStopMonitor(VOID)
VOID *EFIAPI AllocateZeroPool(IN UINTN AllocationSize)
VOID EFIAPI FreePool(IN VOID *Buffer)
EFI_STRING EFIAPI HiiConstructConfigHdr(IN CONST EFI_GUID *Guid OPTIONAL, IN CONST CHAR16 *Name OPTIONAL, IN EFI_HANDLE DriverHandle)
UINT8 *EFIAPI HiiCreateDateOpCode(IN VOID *OpCodeHandle, IN EFI_QUESTION_ID QuestionId, IN EFI_VARSTORE_ID VarStoreId OPTIONAL, IN UINT16 VarOffset OPTIONAL, IN EFI_STRING_ID Prompt, IN EFI_STRING_ID Help, IN UINT8 QuestionFlags, IN UINT8 DateFlags, IN VOID *DefaultsOpCodeHandle OPTIONAL)
BOOLEAN EFIAPI HiiGetBrowserData(IN CONST EFI_GUID *VariableGuid OPTIONAL, IN CONST CHAR16 *VariableName OPTIONAL, IN UINTN BufferSize, OUT UINT8 *Buffer)
UINT8 *EFIAPI HiiCreateGotoOpCode(IN VOID *OpCodeHandle, IN EFI_FORM_ID FormId, IN EFI_STRING_ID Prompt, IN EFI_STRING_ID Help, IN UINT8 QuestionFlags, IN EFI_QUESTION_ID QuestionId)
VOID *EFIAPI HiiAllocateOpCodeHandle(VOID)
UINT8 *EFIAPI HiiCreateTimeOpCode(IN VOID *OpCodeHandle, IN EFI_QUESTION_ID QuestionId, IN EFI_VARSTORE_ID VarStoreId OPTIONAL, IN UINT16 VarOffset OPTIONAL, IN EFI_STRING_ID Prompt, IN EFI_STRING_ID Help, IN UINT8 QuestionFlags, IN UINT8 TimeFlags, IN VOID *DefaultsOpCodeHandle OPTIONAL)
VOID EFIAPI HiiFreeOpCodeHandle(VOID *OpCodeHandle)
EFI_HII_HANDLE EFIAPI HiiAddPackages(IN CONST EFI_GUID *PackageListGuid, IN EFI_HANDLE DeviceHandle OPTIONAL,...)
UINT8 *EFIAPI HiiCreateGuidOpCode(IN VOID *OpCodeHandle, IN CONST EFI_GUID *Guid, IN CONST VOID *GuidOpCode OPTIONAL, IN UINTN OpCodeSize)
BOOLEAN EFIAPI HiiSetBrowserData(IN CONST EFI_GUID *VariableGuid OPTIONAL, IN CONST CHAR16 *VariableName OPTIONAL, IN UINTN BufferSize, IN CONST UINT8 *Buffer, IN CONST CHAR16 *RequestElement OPTIONAL)
EFI_STRING EFIAPI HiiGetString(IN EFI_HII_HANDLE HiiHandle, IN EFI_STRING_ID StringId, IN CONST CHAR8 *Language OPTIONAL)
UINT8 *EFIAPI HiiCreateOneOfOptionOpCode(IN VOID *OpCodeHandle, IN UINT16 StringId, IN UINT8 Flags, IN UINT8 Type, IN UINT64 Value)
EFI_STATUS EFIAPI HiiUpdateForm(IN EFI_HII_HANDLE HiiHandle, IN EFI_GUID *FormSetGuid OPTIONAL, IN EFI_FORM_ID FormId, IN VOID *StartOpCodeHandle, IN VOID *EndOpCodeHandle OPTIONAL)
BOOLEAN EFIAPI HiiIsConfigHdrMatch(IN CONST EFI_STRING ConfigHdr, IN CONST EFI_GUID *Guid OPTIONAL, IN CONST CHAR16 *Name OPTIONAL)
UINT8 *EFIAPI HiiCreateOneOfOpCode(IN VOID *OpCodeHandle, IN EFI_QUESTION_ID QuestionId, IN EFI_VARSTORE_ID VarStoreId, IN UINT16 VarOffset, IN EFI_STRING_ID Prompt, IN EFI_STRING_ID Help, IN UINT8 QuestionFlags, IN UINT8 OneOfFlags, IN VOID *OptionsOpCodeHandle, IN VOID *DefaultsOpCodeHandle OPTIONAL)
EFI_STRING_ID EFIAPI HiiSetString(IN EFI_HII_HANDLE HiiHandle, IN EFI_STRING_ID StringId OPTIONAL, IN CONST EFI_STRING String, IN CONST CHAR8 *SupportedLanguages OPTIONAL)
UINT8 *EFIAPI HiiCreateActionOpCode(IN VOID *OpCodeHandle, IN EFI_QUESTION_ID QuestionId, IN EFI_STRING_ID Prompt, IN EFI_STRING_ID Help, IN UINT8 QuestionFlags, IN EFI_STRING_ID QuestionConfig)
UINT8 *EFIAPI HiiCreateOrderedListOpCode(IN VOID *OpCodeHandle, IN EFI_QUESTION_ID QuestionId, IN EFI_VARSTORE_ID VarStoreId, IN UINT16 VarOffset, IN EFI_STRING_ID Prompt, IN EFI_STRING_ID Help, IN UINT8 QuestionFlags, IN UINT8 OrderedListFlags, IN UINT8 DataType, IN UINT8 MaxContainers, IN VOID *OptionsOpCodeHandle, IN VOID *DefaultsOpCodeHandle OPTIONAL)
UINT8 *EFIAPI HiiCreateTextOpCode(IN VOID *OpCodeHandle, IN EFI_STRING_ID Prompt, IN EFI_STRING_ID Help, IN EFI_STRING_ID TextTwo)
BOOLEAN EFIAPI HiiValidateSettings(IN CONST EFI_STRING Request OPTIONAL)
BOOLEAN EFIAPI HiiSetToDefaults(IN CONST EFI_STRING Request OPTIONAL, IN UINT16 DefaultId)
VOID EFIAPI HiiRemovePackages(IN EFI_HII_HANDLE HiiHandle)
#define EFI_IFR_EXTEND_OP_LABEL
RETURN_STATUS EFIAPI UnicodeValueToStringS(IN OUT CHAR16 *Buffer, IN UINTN BufferSize, IN UINTN Flags, IN INT64 Value, IN UINTN Width)
UINTN EFIAPI UnicodeSPrint(OUT CHAR16 *StartOfBuffer, IN UINTN BufferSize, IN CONST CHAR16 *FormatString,...)
EFI_RUNTIME_SERVICES * gRT
#define OFFSET_OF(TYPE, Field)
#define ASSERT_EFI_ERROR(StatusParameter)
EFI_STRING_ID NewString(IN CHAR16 *String, IN EFI_HII_HANDLE HiiHandle)
VOID EFIAPI Exit(IN EFI_STATUS Status)
VOID EFIAPI EfiEventEmptyFunction(IN EFI_EVENT Event, IN VOID *Context)
VOID EFIAPI CreatePopUp(IN UINTN Attribute, OUT EFI_INPUT_KEY *Key OPTIONAL,...)
#define EFI_VARIABLE_NON_VOLATILE
EFI_KEY_TOGGLE_STATE KeyToggleState
EFI_SIMPLE_TEXT_OUTPUT_MODE * Mode
EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL * ConOut