public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Tan, Ming" <ming.tan@intel.com>
To: devel@edk2.groups.io
Cc: Liming Gao <gaoliming@byosoft.com.cn>, Dandan Bi <dandan.bi@intel.com>
Subject: [edk2-devel] [PATCH 3/3] MdeModulePkg/DriverSampleDxe: EFI_BROWSER_ACTION_REQUEST_QUESTION_APPLY
Date: Tue,  2 Jan 2024 11:27:32 +0800	[thread overview]
Message-ID: <20240102032732.3143-4-ming.tan@intel.com> (raw)
In-Reply-To: <20240102032732.3143-1-ming.tan@intel.com>

REF: UEFI_Spec_2_10_Aug29.pdf page 1695.

In 35.5.4 EFI_HII_CONFIG_ACCESS_PROTOCOL.CallBack():
If the callback function returns with the ActionRequest set to
_QUESTION_APPLY, then the Forms Browser will write the current modified
question value on the selected form to storage.

Update the DriverSampleDxe, add a new question "Question apply test".

Signed-off-by: Ming Tan <ming.tan@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Dandan Bi <dandan.bi@intel.com>
---
 .../Universal/DriverSampleDxe/DriverSample.c       | 14 ++++++++++++++
 .../Universal/DriverSampleDxe/NVDataStruc.h        |  1 +
 MdeModulePkg/Universal/DriverSampleDxe/Vfr.vfr     | 10 ++++++++++
 .../Universal/DriverSampleDxe/VfrStrings.uni       |  4 ++++
 4 files changed, 29 insertions(+)

diff --git a/MdeModulePkg/Universal/DriverSampleDxe/DriverSample.c b/MdeModulePkg/Universal/DriverSampleDxe/DriverSample.c
index 62ba52e940..cbc8900eb9 100644
--- a/MdeModulePkg/Universal/DriverSampleDxe/DriverSample.c
+++ b/MdeModulePkg/Universal/DriverSampleDxe/DriverSample.c
@@ -858,6 +858,7 @@ ExtractConfig (
   @retval EFI_INVALID_PARAMETER  Configuration is NULL.
   @retval EFI_NOT_FOUND          Routing data doesn't match any storage in this
                                  driver.
+  @retval EFI_DEVICE_ERROR       If value is 44, return error for testing.
 
 **/
 EFI_STATUS
@@ -1065,6 +1066,12 @@ RouteConfig (
     return Status;
   }
 
+
+  if (PrivateData->Configuration.QuestionApply == 44) {
+    // Return error for verify the error handling of caller.
+    return EFI_DEVICE_ERROR;
+  }
+
   //
   // Store Buffer Storage back to EFI variable
   //
@@ -1599,6 +1606,13 @@ DriverCallback (
           *ActionRequest = EFI_BROWSER_ACTION_REQUEST_FORM_DISCARD_EXIT;
           break;
 
+        case 0x1253:
+          //
+          // User change the value of "Question apply test".
+          //
+          *ActionRequest = EFI_BROWSER_ACTION_REQUEST_QUESTION_APPLY;
+          break;
+
         case 0x1231:
           //
           // 1. Check to see whether system support keyword.
diff --git a/MdeModulePkg/Universal/DriverSampleDxe/NVDataStruc.h b/MdeModulePkg/Universal/DriverSampleDxe/NVDataStruc.h
index 489d7bcbf3..3f5388946d 100644
--- a/MdeModulePkg/Universal/DriverSampleDxe/NVDataStruc.h
+++ b/MdeModulePkg/Universal/DriverSampleDxe/NVDataStruc.h
@@ -95,6 +95,7 @@ typedef struct {
   MY_EFI_UNION_DATA    MyUnionData;
   UINT8                QuestionXUefiKeywordRestStyle;
   UINT8                QuestionNonXUefiKeywordRestStyle;
+  UINT8                QuestionApply;
 } DRIVER_SAMPLE_CONFIGURATION;
 
 //
diff --git a/MdeModulePkg/Universal/DriverSampleDxe/Vfr.vfr b/MdeModulePkg/Universal/DriverSampleDxe/Vfr.vfr
index 5323e2b411..0c376fe9b7 100644
--- a/MdeModulePkg/Universal/DriverSampleDxe/Vfr.vfr
+++ b/MdeModulePkg/Universal/DriverSampleDxe/Vfr.vfr
@@ -513,6 +513,16 @@ formset
             default = 18,
     endnumeric;
 
+    numeric varid   = MyIfrNVData.QuestionApply,
+            questionid = 0x1253,
+            prompt  = STRING_TOKEN(STR_QUESTION_APPLY_TEST_PROMPT),
+            help    = STRING_TOKEN(STR_QUESTION_APPLY_TEST_HELP),
+            flags   = INTERACTIVE,
+            minimum = 0,
+            maximum = 255,
+            default = 19,
+    endnumeric;
+
     text
       help  = STRING_TOKEN(STR_POPUP_TEST_HELP),
       text  = STRING_TOKEN(STR_POPUP_TEST_PROMPT),
diff --git a/MdeModulePkg/Universal/DriverSampleDxe/VfrStrings.uni b/MdeModulePkg/Universal/DriverSampleDxe/VfrStrings.uni
index 8a3e286bec..ed906045fd 100644
--- a/MdeModulePkg/Universal/DriverSampleDxe/VfrStrings.uni
+++ b/MdeModulePkg/Universal/DriverSampleDxe/VfrStrings.uni
@@ -269,6 +269,10 @@
                                                      #language fr-FR "Submitted callback test"
 #string STR_SUBMITTED_CALLBACK_TEST_HELP             #language en-US "Change the value and press F10 to submit will pop up a dialogue to show SUBMITTED Callback has been triggered"
                                                      #language fr-FR "Change the value and press F10 to submit will pop up a dialogue to show SUBMITTED Callback has been triggered"
+#string STR_QUESTION_APPLY_TEST_PROMPT               #language en-US "Question apply test"
+                                                     #language fr-FR "Question apply test"
+#string STR_QUESTION_APPLY_TEST_HELP                 #language en-US "Change the value and it will be applied automaticlly. If set to 44, then return failed."
+                                                     #language fr-FR "Change the value and it will be applied automaticlly. If set to 44, then return failed."
 #string STR_POPUP_TEST_PROMPT                        #language en-US "Select it to invoke Hii Popup Protocol"
                                                      #language fr-FR "Select it to invoke Hii Popup Protocol"
 #string STR_POPUP_TEST_HELP                          #language en-US "Select this question will pop up a message box, then user can decide whether exit current form or not"
-- 
2.39.1.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#113025): https://edk2.groups.io/g/devel/message/113025
Mute This Topic: https://groups.io/mt/103475995/7686176
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io]
-=-=-=-=-=-=-=-=-=-=-=-



      parent reply	other threads:[~2024-01-02  3:28 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-02  3:27 [edk2-devel] [PATCH 0/3] Add support of EFI_BROWSER_ACTION_REQUEST_QUESTION_APPLY Tan, Ming
2024-01-02  3:27 ` [edk2-devel] [PATCH 1/3] MdePkg: Add EFI_BROWSER_ACTION_REQUEST_QUESTION_APPLY Tan, Ming
2024-01-02  3:27 ` [edk2-devel] [PATCH 2/3] MdeModulePkg/SetupBrowserDxe: EFI_BROWSER_ACTION_REQUEST_QUESTION_APPLY Tan, Ming
2024-01-02  3:27 ` Tan, Ming [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240102032732.3143-4-ming.tan@intel.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox