diff options
Diffstat (limited to 'MdeModulePkg/Universal')
-rw-r--r-- | MdeModulePkg/Universal/DriverSampleDxe/DriverSample.c | 220 | ||||
-rw-r--r-- | MdeModulePkg/Universal/DriverSampleDxe/DriverSampleDxe.inf | 1 | ||||
-rw-r--r-- | MdeModulePkg/Universal/DriverSampleDxe/NVDataStruc.h | 7 | ||||
-rw-r--r-- | MdeModulePkg/Universal/DriverSampleDxe/VfrStrings.uni | bin | 54756 -> 56050 bytes | |||
-rw-r--r-- | MdeModulePkg/Universal/SetupBrowserDxe/IfrParse.c | 8 | ||||
-rw-r--r-- | MdeModulePkg/Universal/SetupBrowserDxe/Setup.h | 1 | ||||
-rw-r--r-- | MdeModulePkg/Universal/SetupBrowserDxe/Ui.c | 189 | ||||
-rw-r--r-- | MdeModulePkg/Universal/SetupBrowserDxe/Ui.h | 1 |
8 files changed, 362 insertions, 65 deletions
diff --git a/MdeModulePkg/Universal/DriverSampleDxe/DriverSample.c b/MdeModulePkg/Universal/DriverSampleDxe/DriverSample.c index 021fe61129..e20e030be8 100644 --- a/MdeModulePkg/Universal/DriverSampleDxe/DriverSample.c +++ b/MdeModulePkg/Universal/DriverSampleDxe/DriverSample.c @@ -20,10 +20,12 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. EFI_GUID mFormSetGuid = FORMSET_GUID;
EFI_GUID mInventoryGuid = INVENTORY_GUID;
+EFI_GUID MyEventGroupGuid = EFI_IFR_REFRESH_ID_OP_GUID;
CHAR16 VariableName[] = L"MyIfrNVData";
EFI_HANDLE DriverHandle[2] = {NULL, NULL};
DRIVER_SAMPLE_PRIVATE_DATA *PrivateData = NULL;
+EFI_EVENT mEvent;
HII_VENDOR_DEVICE_PATH mHiiVendorDevicePath0 = {
{
@@ -76,6 +78,158 @@ HII_VENDOR_DEVICE_PATH mHiiVendorDevicePath1 = { };
/**
+ Add empty function for event process function.
+
+ @param Event The Event need to be process
+ @param Context The context of the event.
+
+**/
+VOID
+EFIAPI
+DriverSampleInternalEmptyFunction (
+ IN EFI_EVENT Event,
+ IN VOID *Context
+ )
+{
+}
+
+/**
+ Notification function for keystrokes.
+
+ @param[in] KeyData The key that was pressed.
+
+ @retval EFI_SUCCESS The operation was successful.
+**/
+EFI_STATUS
+EFIAPI
+NotificationFunction(
+ IN EFI_KEY_DATA *KeyData
+ )
+{
+ gBS->SignalEvent (mEvent);
+
+ return EFI_SUCCESS;
+}
+
+/**
+ Function to start monitoring for CTRL-C using SimpleTextInputEx.
+
+ @retval EFI_SUCCESS The feature is enabled.
+ @retval EFI_OUT_OF_RESOURCES There is not enough mnemory available.
+**/
+EFI_STATUS
+EFIAPI
+InternalStartMonitor(
+ VOID
+ )
+{
+ EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *SimpleEx;
+ EFI_KEY_DATA KeyData;
+ EFI_STATUS Status;
+ EFI_HANDLE *Handles;
+ UINTN HandleCount;
+ UINTN HandleIndex;
+ EFI_HANDLE NotifyHandle;
+
+ Status = gBS->LocateHandleBuffer (
+ ByProtocol,
+ &gEfiSimpleTextInputExProtocolGuid,
+ NULL,
+ &HandleCount,
+ &Handles
+ );
+ for (HandleIndex = 0; HandleIndex < HandleCount; HandleIndex++) {
+ Status = gBS->HandleProtocol (Handles[HandleIndex], &gEfiSimpleTextInputExProtocolGuid, (VOID **) &SimpleEx);
+ ASSERT_EFI_ERROR (Status);
+
+ KeyData.KeyState.KeyToggleState = 0;
+ KeyData.Key.ScanCode = 0;
+ KeyData.KeyState.KeyShiftState = EFI_SHIFT_STATE_VALID|EFI_LEFT_CONTROL_PRESSED;
+ KeyData.Key.UnicodeChar = L'c';
+
+ Status = SimpleEx->RegisterKeyNotify(
+ SimpleEx,
+ &KeyData,
+ NotificationFunction,
+ &NotifyHandle);
+ if (EFI_ERROR (Status)) {
+ break;
+ }
+
+ KeyData.KeyState.KeyShiftState = EFI_SHIFT_STATE_VALID|EFI_RIGHT_CONTROL_PRESSED;
+ Status = SimpleEx->RegisterKeyNotify(
+ SimpleEx,
+ &KeyData,
+ NotificationFunction,
+ &NotifyHandle);
+ if (EFI_ERROR (Status)) {
+ break;
+ }
+ }
+
+ return EFI_SUCCESS;
+}
+
+/**
+ Function to stop monitoring for CTRL-C using SimpleTextInputEx.
+
+ @retval EFI_SUCCESS The feature is enabled.
+ @retval EFI_OUT_OF_RESOURCES There is not enough mnemory available.
+**/
+EFI_STATUS
+EFIAPI
+InternalStopMonitor(
+ VOID
+ )
+{
+ EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *SimpleEx;
+ EFI_STATUS Status;
+ EFI_HANDLE *Handles;
+ EFI_KEY_DATA KeyData;
+ UINTN HandleCount;
+ UINTN HandleIndex;
+ EFI_HANDLE NotifyHandle;
+
+ Status = gBS->LocateHandleBuffer (
+ ByProtocol,
+ &gEfiSimpleTextInputExProtocolGuid,
+ NULL,
+ &HandleCount,
+ &Handles
+ );
+ for (HandleIndex = 0; HandleIndex < HandleCount; HandleIndex++) {
+ Status = gBS->HandleProtocol (Handles[HandleIndex], &gEfiSimpleTextInputExProtocolGuid, (VOID **) &SimpleEx);
+ ASSERT_EFI_ERROR (Status);
+
+ KeyData.KeyState.KeyToggleState = 0;
+ KeyData.Key.ScanCode = 0;
+ KeyData.KeyState.KeyShiftState = EFI_SHIFT_STATE_VALID|EFI_LEFT_CONTROL_PRESSED;
+ KeyData.Key.UnicodeChar = L'c';
+
+ Status = SimpleEx->RegisterKeyNotify(
+ SimpleEx,
+ &KeyData,
+ NotificationFunction,
+ &NotifyHandle);
+ if (!EFI_ERROR (Status)) {
+ Status = SimpleEx->UnregisterKeyNotify (SimpleEx, NotifyHandle);
+ }
+
+ KeyData.KeyState.KeyShiftState = EFI_SHIFT_STATE_VALID|EFI_RIGHT_CONTROL_PRESSED;
+ Status = SimpleEx->RegisterKeyNotify(
+ SimpleEx,
+ &KeyData,
+ NotificationFunction,
+ &NotifyHandle);
+ if (!EFI_ERROR (Status)) {
+ Status = SimpleEx->UnregisterKeyNotify (SimpleEx, NotifyHandle);
+ }
+ }
+ return EFI_SUCCESS;
+}
+
+
+/**
Encode the password using a simple algorithm.
@param Password The string to be encoded.
@@ -1124,6 +1278,7 @@ DriverCallback ( EFI_INPUT_KEY Key;
DRIVER_SAMPLE_CONFIGURATION *Configuration;
UINTN MyVarSize;
+ EFI_FORM_ID FormId;
if (((Value == NULL) && (Action != EFI_BROWSER_ACTION_FORM_OPEN) && (Action != EFI_BROWSER_ACTION_FORM_CLOSE))||
(ActionRequest == NULL)) {
@@ -1131,6 +1286,7 @@ DriverCallback ( }
+ FormId = 0;
Status = EFI_SUCCESS;
PrivateData = DRIVER_SAMPLE_PRIVATE_FROM_THIS (This);
@@ -1177,6 +1333,11 @@ DriverCallback ( HiiFreeOpCodeHandle (StartOpCodeHandle);
}
+
+ if (QuestionId == 0x1247) {
+ Status = InternalStartMonitor ();
+ ASSERT_EFI_ERROR (Status);
+ }
}
break;
@@ -1199,6 +1360,11 @@ DriverCallback ( );
} while ((Key.ScanCode != SCAN_ESC) && (Key.UnicodeChar != CHAR_CARRIAGE_RETURN));
}
+
+ if (QuestionId == 0x1247) {
+ Status = InternalStopMonitor ();
+ ASSERT_EFI_ERROR (Status);
+ }
}
break;
@@ -1424,6 +1590,7 @@ DriverCallback ( break;
case 0x5678:
+ case 0x1247:
//
// We will reach here once the Question is refreshed
//
@@ -1439,7 +1606,15 @@ DriverCallback ( //
StartLabel = (EFI_IFR_GUID_LABEL *) HiiCreateGuidOpCode (StartOpCodeHandle, &gEfiIfrTianoGuid, NULL, sizeof (EFI_IFR_GUID_LABEL));
StartLabel->ExtendOpCode = EFI_IFR_EXTEND_OP_LABEL;
- StartLabel->Number = LABEL_UPDATE2;
+ if (QuestionId == 0x5678) {
+ StartLabel->Number = LABEL_UPDATE2;
+ FormId = 0x03;
+ PrivateData->Configuration.DynamicRefresh++;
+ } else if (QuestionId == 0x1247 ) {
+ StartLabel->Number = LABEL_UPDATE3;
+ FormId = 0x05;
+ PrivateData->Configuration.RefreshGuidCount++;
+ }
HiiCreateActionOpCode (
StartOpCodeHandle, // Container for dynamic created opcodes
@@ -1453,7 +1628,7 @@ DriverCallback ( HiiUpdateForm (
PrivateData->HiiHandle[0], // HII handle
&mFormSetGuid, // Formset GUID
- 0x3, // Form ID
+ FormId, // Form ID
StartOpCodeHandle, // Label for where to insert opcodes
NULL // Insert data
);
@@ -1463,7 +1638,6 @@ DriverCallback ( //
// Refresh the Question value
//
- PrivateData->Configuration.DynamicRefresh++;
Status = gRT->SetVariable(
VariableName,
&mFormSetGuid,
@@ -1472,19 +1646,21 @@ DriverCallback ( &PrivateData->Configuration
);
- //
- // 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,
- MyVarSize,
- &MyVar
- );
+ if (QuestionId == 0x5678) {
+ //
+ // 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,
+ MyVarSize,
+ &MyVar
+ );
+ }
break;
case 0x1237:
@@ -1805,7 +1981,15 @@ DriverSampleInit ( FreePool (ConfigRequestHdr);
-
+ Status = gBS->CreateEventEx (
+ EVT_NOTIFY_SIGNAL,
+ TPL_NOTIFY,
+ DriverSampleInternalEmptyFunction,
+ NULL,
+ &MyEventGroupGuid,
+ &mEvent
+ );
+ ASSERT_EFI_ERROR (Status);
//
// In default, this driver is built into Flash device image,
// the following code doesn't run.
@@ -1893,5 +2077,7 @@ DriverSampleUnload ( FreePool (PrivateData);
PrivateData = NULL;
+ gBS->CloseEvent (mEvent);
+
return EFI_SUCCESS;
}
diff --git a/MdeModulePkg/Universal/DriverSampleDxe/DriverSampleDxe.inf b/MdeModulePkg/Universal/DriverSampleDxe/DriverSampleDxe.inf index 678a12ece7..81a5186414 100644 --- a/MdeModulePkg/Universal/DriverSampleDxe/DriverSampleDxe.inf +++ b/MdeModulePkg/Universal/DriverSampleDxe/DriverSampleDxe.inf @@ -65,6 +65,7 @@ gEfiHiiConfigAccessProtocolGuid ## PRODUCES
gEfiFormBrowser2ProtocolGuid ## CONSUMES
gEfiHiiDatabaseProtocolGuid ## CONSUMES
+ gEfiSimpleTextInputExProtocolGuid ## CONSUMES
[Depex]
diff --git a/MdeModulePkg/Universal/DriverSampleDxe/NVDataStruc.h b/MdeModulePkg/Universal/DriverSampleDxe/NVDataStruc.h index 8926ab0177..f0240301f0 100644 --- a/MdeModulePkg/Universal/DriverSampleDxe/NVDataStruc.h +++ b/MdeModulePkg/Universal/DriverSampleDxe/NVDataStruc.h @@ -41,6 +41,11 @@ Revision History: #define EFI_USER_INFO_ACCESS_SETUP_ADMIN_GUID \
{ 0x85b75607, 0xf7ce, 0x471e, { 0xb7, 0xe4, 0x2a, 0xea, 0x5f, 0x72, 0x32, 0xee } }
+#define EFI_IFR_REFRESH_ID_OP_GUID \
+ { \
+ 0xF5E655D9, 0x02A6, 0x46f2, {0x9E, 0x76, 0xB8, 0xBE, 0x8E, 0x60, 0xAB, 0x22} \
+ }
+
#define CONFIGURATION_VARSTORE_ID 0x1234
#pragma pack(1)
@@ -77,6 +82,7 @@ typedef struct { UINT8 GetDefaultValueFromCallBack;
UINT8 GetDefaultValueFromAccess;
EFI_HII_TIME Time;
+ UINT8 RefreshGuidCount;
} DRIVER_SAMPLE_CONFIGURATION;
//
@@ -93,6 +99,7 @@ typedef struct { //
#define LABEL_UPDATE1 0x1234
#define LABEL_UPDATE2 0x2234
+#define LABEL_UPDATE3 0x3234
#define LABEL_END 0x2223
#pragma pack()
diff --git a/MdeModulePkg/Universal/DriverSampleDxe/VfrStrings.uni b/MdeModulePkg/Universal/DriverSampleDxe/VfrStrings.uni Binary files differindex d0aa852663..d09fa5f265 100644 --- a/MdeModulePkg/Universal/DriverSampleDxe/VfrStrings.uni +++ b/MdeModulePkg/Universal/DriverSampleDxe/VfrStrings.uni diff --git a/MdeModulePkg/Universal/SetupBrowserDxe/IfrParse.c b/MdeModulePkg/Universal/SetupBrowserDxe/IfrParse.c index 469b274b44..d13a89797a 100644 --- a/MdeModulePkg/Universal/SetupBrowserDxe/IfrParse.c +++ b/MdeModulePkg/Universal/SetupBrowserDxe/IfrParse.c @@ -2069,6 +2069,14 @@ ParseOpCodes ( break;
//
+ // Refresh guid.
+ //
+ case EFI_IFR_REFRESH_ID_OP:
+ ASSERT (CurrentStatement != NULL);
+ CopyMem (&CurrentStatement->RefreshGuid, &((EFI_IFR_REFRESH_ID *) OpCodeData)->RefreshEventGroupId, sizeof (EFI_GUID));
+ break;
+
+ //
// Modal tag
//
case EFI_IFR_MODAL_TAG_OP:
diff --git a/MdeModulePkg/Universal/SetupBrowserDxe/Setup.h b/MdeModulePkg/Universal/SetupBrowserDxe/Setup.h index cb09fee344..40d18de690 100644 --- a/MdeModulePkg/Universal/SetupBrowserDxe/Setup.h +++ b/MdeModulePkg/Universal/SetupBrowserDxe/Setup.h @@ -376,6 +376,7 @@ typedef struct { EFI_QUESTION_ID RefQuestionId; // for EFI_IFR_REF2
EFI_GUID RefFormSetId; // for EFI_IFR_REF3
EFI_STRING_ID RefDevicePath; // for EFI_IFR_REF4
+ EFI_GUID RefreshGuid; // for EFI_IFR_REFRESH_ID
//
// Get from IFR parsing
diff --git a/MdeModulePkg/Universal/SetupBrowserDxe/Ui.c b/MdeModulePkg/Universal/SetupBrowserDxe/Ui.c index 9d08c130e7..d5f3b58b25 100644 --- a/MdeModulePkg/Universal/SetupBrowserDxe/Ui.c +++ b/MdeModulePkg/Universal/SetupBrowserDxe/Ui.c @@ -16,7 +16,8 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. LIST_ENTRY gMenuOption;
LIST_ENTRY gMenuList = INITIALIZE_LIST_HEAD_VARIABLE (gMenuList);
-MENU_REFRESH_ENTRY *gMenuRefreshHead;
+MENU_REFRESH_ENTRY *gMenuRefreshHead; // Menu list used for refresh timer opcode.
+MENU_REFRESH_ENTRY *gMenuEventGuidRefreshHead; // Menu list used for refresh event guid opcode.
//
// Search table for UiDisplayMenu()
@@ -320,79 +321,142 @@ UiFreeRefreshList ( gMenuRefreshHead = OldMenuRefreshEntry;
}
- gMenuRefreshHead = NULL;
+ while (gMenuEventGuidRefreshHead != NULL) {
+ OldMenuRefreshEntry = gMenuEventGuidRefreshHead->Next;
+ if (gMenuEventGuidRefreshHead != NULL) {
+ gBS->CloseEvent(gMenuEventGuidRefreshHead->Event);
+ }
+ FreePool (gMenuEventGuidRefreshHead);
+ gMenuEventGuidRefreshHead = OldMenuRefreshEntry;
+ }
}
/**
- Refresh screen.
+ Refresh question.
+ @param MenuRefreshEntry Menu refresh structure which has info about the refresh question.
**/
-EFI_STATUS
-RefreshForm (
- VOID
+EFI_STATUS
+RefreshQuestion (
+ IN MENU_REFRESH_ENTRY *MenuRefreshEntry
)
{
CHAR16 *OptionString;
- MENU_REFRESH_ENTRY *MenuRefreshEntry;
UINTN Index;
EFI_STATUS Status;
UI_MENU_SELECTION *Selection;
FORM_BROWSER_STATEMENT *Question;
- if (gMenuRefreshHead != NULL) {
+ Selection = MenuRefreshEntry->Selection;
+ Question = MenuRefreshEntry->MenuOption->ThisTag;
- MenuRefreshEntry = gMenuRefreshHead;
+ Status = GetQuestionValue (Selection->FormSet, Selection->Form, Question, FALSE);
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+
+ OptionString = NULL;
+ ProcessOptions (Selection, MenuRefreshEntry->MenuOption, FALSE, &OptionString);
+ if (OptionString != NULL) {
//
- // Reset FormPackage update flag
+ // If leading spaces on OptionString - remove the spaces
//
- mHiiPackageListUpdated = FALSE;
+ for (Index = 0; OptionString[Index] == L' '; Index++)
+ ;
- do {
- Selection = MenuRefreshEntry->Selection;
- Question = MenuRefreshEntry->MenuOption->ThisTag;
+ //
+ // If old Text is longer than new string, need to clean the old string before paint the newer.
+ // This option is no need for time/date opcode, because time/data opcode has fixed string length.
+ //
+ if ((MenuRefreshEntry->MenuOption->ThisTag->Operand != EFI_IFR_DATE_OP) &&
+ (MenuRefreshEntry->MenuOption->ThisTag->Operand != EFI_IFR_TIME_OP)) {
+ ClearLines (
+ MenuRefreshEntry->CurrentColumn,
+ MenuRefreshEntry->CurrentColumn + gOptionBlockWidth - 1,
+ MenuRefreshEntry->CurrentRow,
+ MenuRefreshEntry->CurrentRow,
+ PcdGet8 (PcdBrowserFieldTextColor) | FIELD_BACKGROUND
+ );
+ }
- Status = GetQuestionValue (Selection->FormSet, Selection->Form, Question, FALSE);
- if (EFI_ERROR (Status)) {
- return Status;
- }
+ gST->ConOut->SetAttribute (gST->ConOut, MenuRefreshEntry->CurrentAttribute);
+ PrintStringAt (MenuRefreshEntry->CurrentColumn, MenuRefreshEntry->CurrentRow, &OptionString[Index]);
+ FreePool (OptionString);
+ }
- OptionString = NULL;
- ProcessOptions (Selection, MenuRefreshEntry->MenuOption, FALSE, &OptionString);
+ //
+ // Question value may be changed, need invoke its Callback()
+ //
+ Status = ProcessCallBackFunction (Selection, Question, EFI_BROWSER_ACTION_CHANGING, FALSE);
- if (OptionString != NULL) {
- //
- // If leading spaces on OptionString - remove the spaces
- //
- for (Index = 0; OptionString[Index] == L' '; Index++)
- ;
+ return Status;
+}
- //
- // If old Text is longer than new string, need to clean the old string before paint the newer.
- // This option is no need for time/date opcode, because time/data opcode has fixed string length.
- //
- if ((MenuRefreshEntry->MenuOption->ThisTag->Operand != EFI_IFR_DATE_OP) &&
- (MenuRefreshEntry->MenuOption->ThisTag->Operand != EFI_IFR_TIME_OP)) {
- ClearLines (
- MenuRefreshEntry->CurrentColumn,
- MenuRefreshEntry->CurrentColumn + gOptionBlockWidth - 1,
- MenuRefreshEntry->CurrentRow,
- MenuRefreshEntry->CurrentRow,
- PcdGet8 (PcdBrowserFieldTextColor) | FIELD_BACKGROUND
- );
- }
+/**
+ Refresh the question which has refresh guid event attribute.
+
+ @param Event The event which has this function related.
+ @param Context The input context info related to this event or the status code return to the caller.
+**/
+VOID
+RefreshQuestionNotify(
+ IN EFI_EVENT Event,
+ IN VOID *Context
+ )
+{
+ MENU_REFRESH_ENTRY *MenuRefreshEntry;
+ UI_MENU_SELECTION *Selection;
- gST->ConOut->SetAttribute (gST->ConOut, MenuRefreshEntry->CurrentAttribute);
- PrintStringAt (MenuRefreshEntry->CurrentColumn, MenuRefreshEntry->CurrentRow, &OptionString[Index]);
- FreePool (OptionString);
- }
+ //
+ // Reset FormPackage update flag
+ //
+ mHiiPackageListUpdated = FALSE;
- //
- // Question value may be changed, need invoke its Callback()
- //
- Status = ProcessCallBackFunction(Selection, Question, EFI_BROWSER_ACTION_CHANGING, FALSE);
+ MenuRefreshEntry = (MENU_REFRESH_ENTRY *)Context;
+ ASSERT (MenuRefreshEntry != NULL);
+ Selection = MenuRefreshEntry->Selection;
+
+ RefreshQuestion (MenuRefreshEntry);
+
+ if (mHiiPackageListUpdated) {
+ //
+ // Package list is updated, force to reparse IFR binary of target Formset
+ //
+ mHiiPackageListUpdated = FALSE;
+ Selection->Action = UI_ACTION_REFRESH_FORMSET;
+ }
+}
+
+
+/**
+ Refresh screen.
+
+**/
+EFI_STATUS
+RefreshForm (
+ VOID
+ )
+{
+ MENU_REFRESH_ENTRY *MenuRefreshEntry;
+ EFI_STATUS Status;
+ UI_MENU_SELECTION *Selection;
+
+ if (gMenuRefreshHead != NULL) {
+ //
+ // call from refresh interval process.
+ //
+ MenuRefreshEntry = gMenuRefreshHead;
+ Selection = MenuRefreshEntry->Selection;
+ //
+ // Reset FormPackage update flag
+ //
+ mHiiPackageListUpdated = FALSE;
+
+ do {
+ Status = RefreshQuestion (MenuRefreshEntry);
if (EFI_ERROR (Status)) {
return Status;
}
@@ -1636,6 +1700,7 @@ UiDisplayMenu ( UI_CONTROL_FLAG ControlFlag;
EFI_SCREEN_DESCRIPTOR LocalScreen;
MENU_REFRESH_ENTRY *MenuRefreshEntry;
+ MENU_REFRESH_ENTRY *MenuUpdateEntry;
UI_SCREEN_OPERATION ScreenOperation;
UINT8 MinRefreshInterval;
UINTN BufferSize;
@@ -1873,6 +1938,34 @@ UiDisplayMenu ( }
//
+ // If Question has refresh guid, register the op-code.
+ //
+ if (!CompareGuid (&Statement->RefreshGuid, &gZeroGuid)) {
+ if (gMenuEventGuidRefreshHead == NULL) {
+ MenuUpdateEntry = AllocateZeroPool (sizeof (MENU_REFRESH_ENTRY));
+ gMenuEventGuidRefreshHead = MenuUpdateEntry;
+ } else {
+ MenuUpdateEntry = gMenuEventGuidRefreshHead;
+ while (MenuUpdateEntry->Next != NULL) {
+ MenuUpdateEntry = MenuUpdateEntry->Next;
+ }
+ MenuUpdateEntry->Next = AllocateZeroPool (sizeof (MENU_REFRESH_ENTRY));
+ }
+ ASSERT (MenuUpdateEntry != NULL);
+ Status = gBS->CreateEventEx (EVT_NOTIFY_SIGNAL, TPL_NOTIFY, RefreshQuestionNotify, MenuUpdateEntry, &Statement->RefreshGuid, &MenuUpdateEntry->Event);
+ ASSERT (!EFI_ERROR (Status));
+ MenuUpdateEntry->MenuOption = MenuOption;
+ MenuUpdateEntry->Selection = Selection;
+ MenuUpdateEntry->CurrentColumn = MenuOption->OptCol;
+ MenuUpdateEntry->CurrentRow = MenuOption->Row;
+ if (MenuOption->GrayOut) {
+ MenuUpdateEntry->CurrentAttribute = FIELD_TEXT_GRAYED | FIELD_BACKGROUND;
+ } else {
+ MenuUpdateEntry->CurrentAttribute = PcdGet8 (PcdBrowserFieldTextColor) | FIELD_BACKGROUND;
+ }
+ }
+
+ //
// If Question request refresh, register the op-code
//
if (Statement->RefreshInterval != 0) {
diff --git a/MdeModulePkg/Universal/SetupBrowserDxe/Ui.h b/MdeModulePkg/Universal/SetupBrowserDxe/Ui.h index a9f679b3d2..321bdaceab 100644 --- a/MdeModulePkg/Universal/SetupBrowserDxe/Ui.h +++ b/MdeModulePkg/Universal/SetupBrowserDxe/Ui.h @@ -178,6 +178,7 @@ struct _MENU_REFRESH_ENTRY { UINTN CurrentColumn;
UINTN CurrentRow;
UINTN CurrentAttribute;
+ EFI_EVENT Event;
};
typedef struct {
|