]> git.proxmox.com Git - mirror_edk2.git/commitdiff
Add new HiiLib API HiiCreateGotoExOpCode() to create UEFI231 IFR REF, REF2, REF3...
authorlgao4 <lgao4@6f19259b-4bc3-4df7-8a09-765794883524>
Wed, 27 Feb 2013 02:37:27 +0000 (02:37 +0000)
committerlgao4 <lgao4@6f19259b-4bc3-4df7-8a09-765794883524>
Wed, 27 Feb 2013 02:37:27 +0000 (02:37 +0000)
Signed-off-by: Liming Gao <liming.gao@intel.com>
Reviewed-by: Eric Dong <dong.eric@intel.com>
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@14146 6f19259b-4bc3-4df7-8a09-765794883524

MdeModulePkg/Include/Library/HiiLib.h
MdeModulePkg/Library/UefiHiiLib/HiiLib.c

index 7860ccbfc4f81b099877eb8da72cf135ff2985a5..1bdcbfe5627ac3c1b829cfa92c50451e54534cf2 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   Public include file for the HII Library\r
 \r
-Copyright (c) 2007 - 2011, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2007 - 2013, Intel Corporation. All rights reserved.<BR>\r
 This program and the accompanying materials are licensed and made available under \r
 the terms and conditions of the BSD License that accompanies this distribution.  \r
 The full text of the license may be found at\r
@@ -679,6 +679,49 @@ HiiCreateGotoOpCode (
   IN EFI_QUESTION_ID  QuestionId\r
   );\r
 \r
+/**\r
+  Create EFI_IFR_REF_OP, EFI_IFR_REF2_OP, EFI_IFR_REF3_OP and EFI_IFR_REF4_OP opcode.\r
+\r
+  When RefDevicePath is not zero, EFI_IFR_REF4 opcode will be created. \r
+  When RefDevicePath is zero and RefFormSetId is not NULL, EFI_IFR_REF3 opcode will be created.\r
+  When RefDevicePath is zero, RefFormSetId is NULL and RefQuestionId is not zero, EFI_IFR_REF2 opcode will be created.\r
+  When RefDevicePath is zero, RefFormSetId is NULL and RefQuestionId is zero, EFI_IFR_REF opcode will be created.\r
+\r
+  If OpCodeHandle is NULL, then ASSERT().\r
+  If any reserved bits are set in QuestionFlags, then ASSERT().\r
+\r
+  @param[in]  OpCodeHandle   The handle to the buffer of opcodes.\r
+  @param[in]  RefFormId      The Destination Form ID.\r
+  @param[in]  Prompt         The string ID for Prompt.\r
+  @param[in]  Help           The string ID for Help.\r
+  @param[in]  QuestionFlags  The flags in Question Header\r
+  @param[in]  QuestionId     Question ID.\r
+  @param[in]  RefQuestionId  The question on the form to which this link is referring. \r
+                             If its value is zero, then the link refers to the top of the form.\r
+  @param[in]  RefFormSetId   The form set to which this link is referring. If its value is NULL, and RefDevicePath is \r
+                             zero, then the link is to the current form set.\r
+  @param[in]  RefDevicePath  The string identifier that specifies the string containing the text representation of \r
+                             the device path to which the form set containing the form specified by FormId.\r
+                             If its value is zero, then the link refers to the current page.\r
+\r
+  @retval NULL   There is not enough space left in Buffer to add the opcode.\r
+  @retval Other  A pointer to the created opcode.\r
+\r
+**/\r
+UINT8 *\r
+EFIAPI\r
+HiiCreateGotoExOpCode (\r
+  IN VOID             *OpCodeHandle,\r
+  IN EFI_FORM_ID      RefFormId,\r
+  IN EFI_STRING_ID    Prompt,\r
+  IN EFI_STRING_ID    Help,\r
+  IN UINT8            QuestionFlags,\r
+  IN EFI_QUESTION_ID  QuestionId,\r
+  IN EFI_QUESTION_ID  RefQuestionId,\r
+  IN EFI_GUID         *RefFormSetId,    OPTIONAL\r
+  IN EFI_STRING_ID    RefDevicePath\r
+  );\r
+\r
 /**\r
   Create EFI_IFR_CHECKBOX_OP opcode.\r
 \r
index 0e7ddee35a92d3e475f566b5da9ede98217d06af..9590f8f14a295759aa681b4c5f70fd1bc034ec31 100644 (file)
@@ -2858,6 +2858,82 @@ HiiCreateGotoOpCode (
   return InternalHiiCreateOpCode (OpCodeHandle, &OpCode, EFI_IFR_REF_OP, sizeof (OpCode));\r
 }\r
 \r
+/**\r
+  Create EFI_IFR_REF_OP, EFI_IFR_REF2_OP, EFI_IFR_REF3_OP and EFI_IFR_REF4_OP opcode.\r
+\r
+  When RefDevicePath is not zero, EFI_IFR_REF4 opcode will be created. \r
+  When RefDevicePath is zero and RefFormSetId is not NULL, EFI_IFR_REF3 opcode will be created.\r
+  When RefDevicePath is zero, RefFormSetId is NULL and RefQuestionId is not zero, EFI_IFR_REF2 opcode will be created.\r
+  When RefDevicePath is zero, RefFormSetId is NULL and RefQuestionId is zero, EFI_IFR_REF opcode will be created.\r
+\r
+  If OpCodeHandle is NULL, then ASSERT().\r
+  If any reserved bits are set in QuestionFlags, then ASSERT().\r
+\r
+  @param[in]  OpCodeHandle   The handle to the buffer of opcodes.\r
+  @param[in]  RefFormId      The Destination Form ID.\r
+  @param[in]  Prompt         The string ID for Prompt.\r
+  @param[in]  Help           The string ID for Help.\r
+  @param[in]  QuestionFlags  The flags in Question Header\r
+  @param[in]  QuestionId     Question ID.\r
+  @param[in]  RefQuestionId  The question on the form to which this link is referring. \r
+                             If its value is zero, then the link refers to the top of the form.\r
+  @param[in]  RefFormSetId   The form set to which this link is referring. If its value is NULL, and RefDevicePath is \r
+                             zero, then the link is to the current form set.\r
+  @param[in]  RefDevicePath  The string identifier that specifies the string containing the text representation of \r
+                             the device path to which the form set containing the form specified by FormId.\r
+                             If its value is zero, then the link refers to the current page.\r
+\r
+  @retval NULL   There is not enough space left in Buffer to add the opcode.\r
+  @retval Other  A pointer to the created opcode.\r
+\r
+**/\r
+UINT8 *\r
+EFIAPI\r
+HiiCreateGotoExOpCode (\r
+  IN VOID             *OpCodeHandle,\r
+  IN EFI_FORM_ID      RefFormId,\r
+  IN EFI_STRING_ID    Prompt,\r
+  IN EFI_STRING_ID    Help,\r
+  IN UINT8            QuestionFlags,\r
+  IN EFI_QUESTION_ID  QuestionId,\r
+  IN EFI_QUESTION_ID  RefQuestionId,\r
+  IN EFI_GUID         *RefFormSetId,    OPTIONAL\r
+  IN EFI_STRING_ID    RefDevicePath\r
+  )\r
+{\r
+  EFI_IFR_REF4  OpCode;\r
+  UINTN         OpCodeSize;\r
+\r
+  ASSERT ((QuestionFlags & (~(EFI_IFR_FLAG_READ_ONLY | EFI_IFR_FLAG_CALLBACK | EFI_IFR_FLAG_RESET_REQUIRED))) == 0);\r
+\r
+  ZeroMem (&OpCode, sizeof (OpCode));\r
+  OpCode.Question.Header.Prompt = Prompt;\r
+  OpCode.Question.Header.Help   = Help;\r
+  OpCode.Question.QuestionId    = QuestionId;\r
+  OpCode.Question.Flags         = QuestionFlags;\r
+  OpCode.FormId                 = RefFormId;\r
+  OpCode.QuestionId             = RefQuestionId;\r
+  OpCode.DevicePath             = RefDevicePath;\r
+  if (RefFormSetId != NULL) {\r
+    CopyMem (&OpCode.FormSetId, RefFormSetId, sizeof (OpCode.FormSetId));\r
+  }\r
+\r
+  //\r
+  // Cacluate OpCodeSize based on the input Ref value.\r
+  // Try to use the small OpCode to save size.\r
+  //\r
+  OpCodeSize = sizeof (EFI_IFR_REF);\r
+  if (RefDevicePath != 0) {\r
+    OpCodeSize = sizeof (EFI_IFR_REF4);\r
+  } else if (RefFormSetId != NULL) {\r
+    OpCodeSize = sizeof (EFI_IFR_REF3);\r
+  } else if (RefQuestionId != 0) {\r
+    OpCodeSize = sizeof (EFI_IFR_REF2);\r
+  }\r
+\r
+  return InternalHiiCreateOpCode (OpCodeHandle, &OpCode, EFI_IFR_REF_OP, OpCodeSize);\r
+}\r
+\r
 /**\r
   Create EFI_IFR_CHECKBOX_OP opcode.\r
 \r