]> git.proxmox.com Git - mirror_edk2.git/blobdiff - EdkCompatibilityPkg/Compatibility/FrameworkHiiOnUefiHiiThunk/UefiIfrParser.c
Add new HII FormMap Opcode support
[mirror_edk2.git] / EdkCompatibilityPkg / Compatibility / FrameworkHiiOnUefiHiiThunk / UefiIfrParser.c
index 52b253a5590295dc5fdf99e21033ed5282f3e2ed..98754ec544735e84f40876a2f79a5a0d9834f74f 100644 (file)
@@ -408,9 +408,14 @@ IsExpressionOpCode (
   )\r
 {\r
   if (((Operand >= EFI_IFR_EQ_ID_VAL_OP) && (Operand <= EFI_IFR_NOT_OP)) ||\r
-      ((Operand >= EFI_IFR_MATCH_OP) && (Operand <= EFI_IFR_SPAN_OP)) ||\r
-      (Operand == EFI_IFR_CATENATE_OP)\r
-     ) {\r
+      ((Operand >= EFI_IFR_MATCH_OP) && (Operand <= EFI_IFR_SET_OP))  ||\r
+      ((Operand >= EFI_IFR_EQUAL_OP) && (Operand <= EFI_IFR_SPAN_OP)) ||\r
+      (Operand == EFI_IFR_CATENATE_OP) ||\r
+      (Operand == EFI_IFR_TO_LOWER_OP) ||\r
+      (Operand == EFI_IFR_TO_UPPER_OP) ||\r
+      (Operand == EFI_IFR_MAP_OP)      ||\r
+      (Operand == EFI_IFR_VERSION_OP)  ||\r
+      (Operand == EFI_IFR_SECURITY_OP)) {\r
     return TRUE;\r
   } else {\r
     return FALSE;\r
@@ -502,12 +507,14 @@ ParseOpCodes (
   UINT8                   OneOfType;\r
   EFI_IFR_ONE_OF          *OneOfOpcode;\r
   HII_THUNK_CONTEXT       *ThunkContext;\r
+  EFI_IFR_FORM_MAP_METHOD *MapMethod;\r
 \r
   mInScopeSubtitle = FALSE;\r
   mInScopeSuppress = FALSE;\r
   mInScopeGrayOut  = FALSE;\r
   CurrentDefault   = NULL;\r
   CurrentOption    = NULL;\r
+  MapMethod        = NULL;\r
   ThunkContext     = UefiHiiHandleToThunkContext ((CONST HII_THUNK_PRIVATE_DATA*) mHiiThunkPrivateData, FormSet->HiiHandle);\r
 \r
   //\r
@@ -592,6 +599,49 @@ ParseOpCodes (
       InsertTailList (&FormSet->FormListHead, &CurrentForm->Link);\r
       break;\r
 \r
+    case EFI_IFR_FORM_MAP_OP:\r
+      //\r
+      // Create a new Form Map for this FormSet\r
+      //\r
+      CurrentForm = AllocateZeroPool (sizeof (FORM_BROWSER_FORM));\r
+      CurrentForm->Signature = FORM_BROWSER_FORM_SIGNATURE;\r
+\r
+      InitializeListHead (&CurrentForm->StatementListHead);\r
+\r
+      CopyMem (&CurrentForm->FormId, &((EFI_IFR_FORM *) OpCodeData)->FormId, sizeof (UINT16));\r
+      MapMethod = (EFI_IFR_FORM_MAP_METHOD *) (OpCodeData + sizeof (EFI_IFR_FORM_MAP));\r
+\r
+      //\r
+      // FormMap Form must contain at least one Map Method.\r
+      //\r
+      if (((EFI_IFR_OP_HEADER *) OpCodeData)->Length < ((UINTN) (UINT8 *) (MapMethod + 1) - (UINTN) OpCodeData)) {\r
+        return EFI_INVALID_PARAMETER;\r
+      }\r
+\r
+      //\r
+      // Try to find the standard form map method.\r
+      //\r
+      while (((UINTN) (UINT8 *) MapMethod - (UINTN) OpCodeData) < ((EFI_IFR_OP_HEADER *) OpCodeData)->Length) {\r
+        if (CompareGuid ((EFI_GUID *) (VOID *) &MapMethod->MethodIdentifier, &gEfiHiiStandardFormGuid)) {\r
+          CopyMem (&CurrentForm->FormTitle, &MapMethod->MethodTitle, sizeof (EFI_STRING_ID));\r
+          break;\r
+        }\r
+        MapMethod ++;\r
+      }\r
+      //\r
+      // If the standard form map method is not found, the first map method title will be used.\r
+      //\r
+      if (CurrentForm->FormTitle == 0) {\r
+        MapMethod = (EFI_IFR_FORM_MAP_METHOD *) (OpCodeData + sizeof (EFI_IFR_FORM_MAP));\r
+        CopyMem (&CurrentForm->FormTitle, &MapMethod->MethodTitle, sizeof (EFI_STRING_ID));\r
+      }\r
+\r
+      //\r
+      // Insert into Form list of this FormSet\r
+      //\r
+      InsertTailList (&FormSet->FormListHead, &CurrentForm->Link);\r
+      break;\r
+\r
     //\r
     // Storage\r
     //\r
@@ -917,6 +967,8 @@ ParseOpCodes (
     // Expression\r
     //\r
     case EFI_IFR_VALUE_OP:\r
+    case EFI_IFR_READ_OP:\r
+    case EFI_IFR_WRITE_OP:\r
       break;\r
 \r
     case EFI_IFR_RULE_OP:\r
@@ -938,6 +990,7 @@ ParseOpCodes (
         break;\r
 \r
       case EFI_IFR_FORM_OP:\r
+      case EFI_IFR_FORM_MAP_OP:\r
         ImageId = &CurrentForm->ImageId;\r
         break;\r
 \r
@@ -1040,6 +1093,7 @@ ParseOpCodes (
         break;\r
 \r
       case EFI_IFR_FORM_OP:\r
+      case EFI_IFR_FORM_MAP_OP:\r
         //\r
         // End of Form\r
         //\r