MdeModulePkg: Add new HII action type EFI_BROWSER_ACTION_SUBMITTED
authorDandan Bi <dandan.bi@intel.com>
Tue, 23 Feb 2016 02:59:10 +0000 (10:59 +0800)
committerFeng Tian <feng.tian@intel.com>
Thu, 25 Feb 2016 06:42:24 +0000 (14:42 +0800)
Add new HII action type EFI_BROWSER_ACTION_SUBMITTED
to notify HII driver when its question values are submitted.

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>
MdeModulePkg/Universal/SetupBrowserDxe/Setup.c

index 89869ed4c78e017a9f64c46a125105376424501e..b357e29b3c6cce5a990b31d6b13c9f98ef26fc08 100644 (file)
@@ -2448,6 +2448,94 @@ SendDiscardInfoToDriver (
   }\r
 }\r
 \r
+/**\r
+  When submit the question value, call the callback function with Submitted type\r
+  to inform the hii driver.\r
+\r
+  @param  FormSet                FormSet data structure.\r
+  @param  Form                   Form data structure.\r
+\r
+**/\r
+VOID\r
+SubmitCallbackForForm (\r
+  IN FORM_BROWSER_FORMSET             *FormSet,\r
+  IN FORM_BROWSER_FORM                *Form\r
+  )\r
+{\r
+  LIST_ENTRY                  *Link;\r
+  FORM_BROWSER_STATEMENT      *Question;\r
+  EFI_IFR_TYPE_VALUE          *TypeValue;\r
+  EFI_BROWSER_ACTION_REQUEST  ActionRequest;\r
+\r
+  if (FormSet->ConfigAccess == NULL) {\r
+    return;\r
+  }\r
+\r
+  Link = GetFirstNode (&Form->StatementListHead);\r
+  while (!IsNull (&Form->StatementListHead, Link)) {\r
+    Question = FORM_BROWSER_STATEMENT_FROM_LINK (Link);\r
+    Link = GetNextNode (&Form->StatementListHead, Link);\r
+\r
+    if (Question->Storage == NULL || Question->Storage->Type == EFI_HII_VARSTORE_EFI_VARIABLE) {\r
+      continue;\r
+    }\r
+\r
+    if ((Question->QuestionFlags & EFI_IFR_FLAG_CALLBACK) != EFI_IFR_FLAG_CALLBACK) {\r
+       continue;\r
+    }\r
+\r
+    if (Question->Operand == EFI_IFR_PASSWORD_OP) {\r
+       continue;\r
+    }\r
+\r
+    if (Question->HiiValue.Type == EFI_IFR_TYPE_BUFFER) {\r
+      TypeValue = (EFI_IFR_TYPE_VALUE *) Question->BufferValue;\r
+    } else {\r
+      TypeValue = &Question->HiiValue.Value;\r
+    }\r
+\r
+    ActionRequest = EFI_BROWSER_ACTION_REQUEST_NONE;\r
+    FormSet->ConfigAccess->Callback (\r
+                             FormSet->ConfigAccess,\r
+                             EFI_BROWSER_ACTION_SUBMITTED,\r
+                             Question->QuestionId,\r
+                             Question->HiiValue.Type,\r
+                             TypeValue,\r
+                             &ActionRequest\r
+                             );\r
+  }\r
+}\r
+\r
+/**\r
+  When value set Success, call the submit callback function.\r
+\r
+  @param  FormSet                FormSet data structure.\r
+  @param  Form                   Form data structure.\r
+\r
+**/\r
+VOID\r
+SubmitCallback (\r
+  IN FORM_BROWSER_FORMSET             *FormSet,\r
+  IN FORM_BROWSER_FORM                *Form\r
+  )\r
+{\r
+  FORM_BROWSER_FORM       *CurrentForm;\r
+  LIST_ENTRY              *Link;\r
+\r
+  if (Form != NULL) {\r
+    SubmitCallbackForForm(FormSet, Form);\r
+    return;\r
+  }\r
+\r
+  Link = GetFirstNode (&FormSet->FormListHead);\r
+  while (!IsNull (&FormSet->FormListHead, Link)) {\r
+    CurrentForm = FORM_BROWSER_FORM_FROM_LINK (Link);\r
+    Link = GetNextNode (&FormSet->FormListHead, Link);\r
+\r
+    SubmitCallbackForForm(FormSet, CurrentForm);\r
+  }\r
+}\r
+\r
 /**\r
   Validate the HiiHandle.\r
 \r
@@ -3081,6 +3169,11 @@ SubmitForForm (
   //\r
   ValueChangeResetFlagUpdate(TRUE, FormSet, Form);\r
 \r
+  //\r
+  // 6 Call callback with Submitted type to inform the driver.\r
+  //\r
+  SubmitCallback (FormSet, Form);\r
+\r
   return Status;\r
 }\r
 \r
@@ -3255,6 +3348,11 @@ SubmitForFormSet (
   // \r
   ValueChangeResetFlagUpdate(TRUE, FormSet, NULL);\r
 \r
+  //\r
+  // 6. Call callback with Submitted type to inform the driver.\r
+  //\r
+  SubmitCallback (FormSet, NULL);\r
+\r
   return Status;\r
 }\r
 \r