Support Framework IFR SELECT OP code.
authorlgao4 <lgao4@6f19259b-4bc3-4df7-8a09-765794883524>
Sun, 14 Mar 2010 07:07:46 +0000 (07:07 +0000)
committerlgao4 <lgao4@6f19259b-4bc3-4df7-8a09-765794883524>
Sun, 14 Mar 2010 07:07:46 +0000 (07:07 +0000)
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk@10240 6f19259b-4bc3-4df7-8a09-765794883524

edk2/EdkCompatibilityPkg/Compatibility/FrameworkHiiOnUefiHiiThunk/OpcodeCreation.c

index 27969d2..0692c2a 100644 (file)
@@ -860,9 +860,19 @@ FwUpdateDataToUefiUpdateData (
   UINTN                                Index;\r
   UINTN                                DataCount;\r
   UINT8                                *OpCodeBuffer;\r
+  LIST_ENTRY                           *StorageList;\r
+  FORMSET_STORAGE                      *Storage;\r
+  FORM_BROWSER_FORMSET                 *FormSet;\r
+  CHAR16                               *DefaultVarStoreName;\r
+  UINT16                               DefaultVarStoreId;\r
+  EFI_IFR_VARSTORE_SELECT              *SelectVarOp;\r
 \r
   FwOpCode = (FRAMEWORK_EFI_IFR_OP_HEADER *) &FwUpdateData->Data;\r
 \r
+  FormSet = ThunkContext->FormSet;\r
+  DefaultVarStoreId   = FormSet->DefaultVarStoreId;\r
+  DefaultVarStoreName = FormSet->OriginalDefaultVarStoreName;\r
+\r
   for (Index = 0; Index < FwUpdateData->DataCount; Index += DataCount) {\r
     switch (FwOpCode->OpCode) {\r
       case FRAMEWORK_EFI_IFR_SUBTITLE_OP:\r
@@ -926,6 +936,31 @@ FwUpdateDataToUefiUpdateData (
         OpCodeBuffer = F2UCreateNumericOpCode (UefiOpCodeHandle, ThunkContext, (FRAMEWORK_EFI_IFR_NUMERIC *) FwOpCode);\r
         DataCount = 1;\r
         break;\r
+      \r
+      case EFI_IFR_VARSTORE_SELECT_OP:\r
+        OpCodeBuffer = (UINT8 *) FwOpCode;\r
+        SelectVarOp  = (EFI_IFR_VARSTORE_SELECT *) FwOpCode;\r
+        //\r
+        // Check whether the selected VarId is in StorageList.\r
+        //\r
+        StorageList = GetFirstNode (&FormSet->StorageListHead);\r
+        while (!IsNull (&FormSet->StorageListHead, StorageList)) {\r
+          Storage = FORMSET_STORAGE_FROM_LINK (StorageList);\r
+          if (Storage->VarStoreId == SelectVarOp->VarId) {\r
+            break;\r
+          }\r
+          StorageList = GetNextNode (&FormSet->StorageListHead, StorageList);\r
+        }\r
+        ASSERT (!IsNull (&FormSet->StorageListHead, StorageList));\r
+        //\r
+        // Change VarStoreId to the selected VarId.\r
+        //\r
+        FormSet->DefaultVarStoreId = SelectVarOp->VarId;\r
+        if (SelectVarOp->VarId == DefaultVarStoreId)  {\r
+          FormSet->OriginalDefaultVarStoreName = DefaultVarStoreName;\r
+        }\r
+        DataCount = 1;\r
+        break;\r
 \r
       default:\r
         ASSERT (FALSE);\r
@@ -939,6 +974,11 @@ FwUpdateDataToUefiUpdateData (
     FwOpCode = (FRAMEWORK_EFI_IFR_OP_HEADER *)((UINT8 *) FwOpCode + FwOpCode->Length);\r
   }\r
 \r
+  //\r
+  // Revert FromSet default varstore ID.\r
+  //\r
+  FormSet->DefaultVarStoreId           = DefaultVarStoreId;\r
+  FormSet->OriginalDefaultVarStoreName = DefaultVarStoreName;\r
   return EFI_SUCCESS;\r
 }\r
 \r