]> git.proxmox.com Git - mirror_edk2.git/commitdiff
Fill all EFI_IFR_DATA_ARRAY fields before call FormCallBack function.
authorlgao4 <lgao4@6f19259b-4bc3-4df7-8a09-765794883524>
Thu, 23 Jul 2009 09:27:17 +0000 (09:27 +0000)
committerlgao4 <lgao4@6f19259b-4bc3-4df7-8a09-765794883524>
Thu, 23 Jul 2009 09:27:17 +0000 (09:27 +0000)
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@8982 6f19259b-4bc3-4df7-8a09-765794883524

EdkCompatibilityPkg/Compatibility/FrameworkHiiOnUefiHiiThunk/ConfigAccess.c

index a96ca84272536deb8a17698b594a98510396ef62..806759dc56f881bae2b8600940991317f8884d88 100644 (file)
@@ -83,14 +83,15 @@ GetFirstStorageOfFormSet (
 }\r
 \r
 /**\r
 }\r
 \r
 /**\r
-  Get the EFI_IFR_VARSTORE where the Question's value is stored.\r
+  Get the FORM_BROWSER_STATEMENT that matches the Question's value.\r
     \r
   @param FormSet                  The Form Set.\r
     \r
   @param FormSet                  The Form Set.\r
+  @param QuestionId               QuestionId\r
    \r
    \r
-  @retval FORMSET_STORAGE *       The EFI_IFR_VARSTORE where the Question's value is stored.\r
-  @retval NULL                    If the Form Set does not have EFI_IFR_VARSTORE.\r
+  @retval FORM_BROWSER_STATEMENT*   FORM_BROWSER_STATEMENT that match Question's value.\r
+  @retval NULL                      If the Form Set does not have EFI_IFR_VARSTORE.\r
 **/\r
 **/\r
-FORMSET_STORAGE *\r
+FORM_BROWSER_STATEMENT *\r
 GetStorageFromQuestionId (\r
   IN CONST FORM_BROWSER_FORMSET * FormSet,\r
   IN       EFI_QUESTION_ID        QuestionId\r
 GetStorageFromQuestionId (\r
   IN CONST FORM_BROWSER_FORMSET * FormSet,\r
   IN       EFI_QUESTION_ID        QuestionId\r
@@ -115,7 +116,7 @@ GetStorageFromQuestionId (
         // UEFI Question ID is unique in a FormSet.\r
         //\r
         ASSERT (Statement->Storage->Type == EFI_HII_VARSTORE_BUFFER);\r
         // UEFI Question ID is unique in a FormSet.\r
         //\r
         ASSERT (Statement->Storage->Type == EFI_HII_VARSTORE_BUFFER);\r
-        return Statement->Storage;\r
+        return Statement;\r
       }\r
       StatementList = GetNextNode (&Form->StatementListHead, StatementList);\r
     }\r
       }\r
       StatementList = GetNextNode (&Form->StatementListHead, StatementList);\r
     }\r
@@ -674,6 +675,7 @@ CreateIfrDataArray (
   FORMSET_STORAGE                   *BufferStorage;\r
   UINTN                             Size;\r
   EFI_STRING                        String;\r
   FORMSET_STORAGE                   *BufferStorage;\r
   UINTN                             Size;\r
   EFI_STRING                        String;\r
+  FORM_BROWSER_STATEMENT            *Statement;\r
 \r
   *NvMapAllocated = FALSE;\r
 \r
 \r
   *NvMapAllocated = FALSE;\r
 \r
@@ -707,19 +709,25 @@ CreateIfrDataArray (
 \r
   IfrDataArray = AllocateZeroPool (sizeof (EFI_IFR_DATA_ARRAY) + sizeof (EFI_IFR_DATA_ENTRY) + Size);\r
   ASSERT (IfrDataArray != NULL);\r
 \r
   IfrDataArray = AllocateZeroPool (sizeof (EFI_IFR_DATA_ARRAY) + sizeof (EFI_IFR_DATA_ENTRY) + Size);\r
   ASSERT (IfrDataArray != NULL);\r
+  IfrDataArray->EntryCount = 1;\r
+  IfrDataEntry             = (EFI_IFR_DATA_ENTRY *) (IfrDataArray + 1);\r
 \r
 \r
-  BufferStorage  = GetStorageFromQuestionId (ConfigAccess->ThunkContext->FormSet, QuestionId);\r
+  Statement = GetStorageFromQuestionId (ConfigAccess->ThunkContext->FormSet, QuestionId);\r
 \r
 \r
-  if (BufferStorage == NULL) {\r
+  if (Statement == NULL || Statement->Storage == NULL) {\r
     //\r
     // The QuestionId is not associated with a Buffer Storage.\r
     // Try to get the first Buffer Storage then.\r
     //\r
     BufferStorage = GetFirstStorageOfFormSet (ConfigAccess->ThunkContext->FormSet);\r
     //\r
     // The QuestionId is not associated with a Buffer Storage.\r
     // Try to get the first Buffer Storage then.\r
     //\r
     BufferStorage = GetFirstStorageOfFormSet (ConfigAccess->ThunkContext->FormSet);\r
+  } else {\r
+    BufferStorage        = Statement->Storage;\r
+    IfrDataEntry->OpCode = Statement->Operand;\r
   }\r
   \r
   if (BufferStorage != NULL) {\r
   }\r
   \r
   if (BufferStorage != NULL) {\r
-    BrowserDataSize = BufferStorage->Size;\r
+    BrowserDataSize      = BufferStorage->Size;\r
+    IfrDataEntry->Length = (UINT8) (sizeof (EFI_IFR_DATA_ENTRY) + Size);\r
 \r
     if (ConfigAccess->ThunkContext->NvMapOverride == NULL) {\r
       *NvMapAllocated = TRUE;\r
 \r
     if (ConfigAccess->ThunkContext->NvMapOverride == NULL) {\r
       *NvMapAllocated = TRUE;\r
@@ -730,7 +738,6 @@ CreateIfrDataArray (
     }\r
     \r
     ASSERT (HiiGetBrowserData (&BufferStorage->Guid, BufferStorage->Name, BrowserDataSize, (UINT8 *) IfrDataArray->NvRamMap));\r
     }\r
     \r
     ASSERT (HiiGetBrowserData (&BufferStorage->Guid, BufferStorage->Name, BrowserDataSize, (UINT8 *) IfrDataArray->NvRamMap));\r
-    IfrDataEntry = (EFI_IFR_DATA_ENTRY *) (IfrDataArray + 1);\r
 \r
     switch (Type) {\r
       case EFI_IFR_TYPE_NUM_SIZE_8:\r
 \r
     switch (Type) {\r
       case EFI_IFR_TYPE_NUM_SIZE_8:\r
@@ -789,18 +796,21 @@ SyncBrowserDataForNvMapOverride (
   FORMSET_STORAGE   *BufferStorage;\r
   BOOLEAN           CheckFlag;\r
   UINTN             BrowserDataSize;\r
   FORMSET_STORAGE   *BufferStorage;\r
   BOOLEAN           CheckFlag;\r
   UINTN             BrowserDataSize;\r
+  FORM_BROWSER_STATEMENT *Statement;\r
 \r
   if (ConfigAccess->ThunkContext->NvMapOverride != NULL) {\r
 \r
 \r
   if (ConfigAccess->ThunkContext->NvMapOverride != NULL) {\r
 \r
-    BufferStorage = GetStorageFromQuestionId (ConfigAccess->ThunkContext->FormSet, QuestionId);\r
+    Statement = GetStorageFromQuestionId (ConfigAccess->ThunkContext->FormSet, QuestionId);\r
 \r
 \r
-    if (BufferStorage == NULL) {\r
+    if (Statement == NULL || Statement->Storage == NULL) {\r
       //\r
       // QuestionId is a statement without Storage.\r
       // 1) It is a Goto. \r
       // \r
       //\r
       BufferStorage = GetFirstStorageOfFormSet (ConfigAccess->ThunkContext->FormSet);\r
       //\r
       // QuestionId is a statement without Storage.\r
       // 1) It is a Goto. \r
       // \r
       //\r
       BufferStorage = GetFirstStorageOfFormSet (ConfigAccess->ThunkContext->FormSet);\r
+    } else {\r
+      BufferStorage = Statement->Storage;\r
     }\r
 \r
     //\r
     }\r
 \r
     //\r