+**/\r
+UINT8 *\r
+EFIAPI\r
+InternalHiiAppendOpCodes (\r
+ IN VOID *OpCodeHandle,\r
+ IN VOID *RawOpCodeHandle\r
+ )\r
+{\r
+ HII_LIB_OPCODE_BUFFER *RawOpCodeBuffer;\r
+\r
+ ASSERT (RawOpCodeHandle != NULL);\r
+\r
+ RawOpCodeBuffer = (HII_LIB_OPCODE_BUFFER *)RawOpCodeHandle;\r
+ return HiiCreateRawOpCodes (OpCodeHandle, RawOpCodeBuffer->Buffer, RawOpCodeBuffer->Position);\r
+}\r
+\r
+/**\r
+ Create EFI_IFR_END_OP opcode.\r
+\r
+ If OpCodeHandle is NULL, then ASSERT().\r
+\r
+ @param[in] OpCodeHandle Handle to the buffer of opcodes.\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
+HiiCreateEndOpCode (\r
+ IN VOID *OpCodeHandle\r
+ )\r
+{\r
+ EFI_IFR_END OpCode;\r
+\r
+ return InternalHiiCreateOpCode (OpCodeHandle, &OpCode, EFI_IFR_END_OP, sizeof (OpCode));\r
+}\r
+\r
+/**\r
+ Create EFI_IFR_ONE_OF_OPTION_OP opcode.\r
+\r
+ If OpCodeHandle is NULL, then ASSERT().\r
+ If Type is invalid, then ASSERT().\r
+ If Flags is invalid, then ASSERT().\r
+\r
+ @param[in] OpCodeHandle Handle to the buffer of opcodes.\r
+ @param[in] StringId StringId for the option\r
+ @param[in] Flags Flags for the option\r
+ @param[in] Type Type for the option\r
+ @param[in] Value Value for the option\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
+HiiCreateOneOfOptionOpCode (\r
+ IN VOID *OpCodeHandle,\r
+ IN UINT16 StringId,\r
+ IN UINT8 Flags,\r
+ IN UINT8 Type,\r
+ IN UINT64 Value\r
+ )\r
+{\r
+ EFI_IFR_ONE_OF_OPTION OpCode;\r
+\r
+ ASSERT (Type < EFI_IFR_TYPE_OTHER);\r
+\r
+ ZeroMem (&OpCode, sizeof (OpCode));\r
+ OpCode.Option = StringId;\r
+ OpCode.Flags = (UINT8) (Flags & (EFI_IFR_OPTION_DEFAULT | EFI_IFR_OPTION_DEFAULT_MFG));\r
+ OpCode.Type = Type;\r
+ CopyMem (&OpCode.Value, &Value, mHiiDefaultTypeToWidth[Type]);\r
+\r
+ return InternalHiiCreateOpCode (OpCodeHandle, &OpCode, EFI_IFR_ONE_OF_OPTION_OP, sizeof (OpCode));\r
+}\r
+\r
+/**\r
+ Create EFI_IFR_DEFAULT_OP opcode.\r
+\r
+ If OpCodeHandle is NULL, then ASSERT().\r
+ If Type is invalid, then ASSERT().\r
+\r
+ @param[in] OpCodeHandle Handle to the buffer of opcodes.\r
+ @param[in] DefaultId DefaultId for the default\r
+ @param[in] Type Type for the default\r
+ @param[in] Value Value for the default\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
+HiiCreateDefaultOpCode (\r
+ IN VOID *OpCodeHandle,\r
+ IN UINT16 DefaultId,\r
+ IN UINT8 Type,\r
+ IN UINT64 Value\r
+ )\r
+{\r
+ EFI_IFR_DEFAULT OpCode;\r
+\r
+ ASSERT (Type < EFI_IFR_TYPE_OTHER);\r
+\r
+ ZeroMem (&OpCode, sizeof (OpCode));\r
+ OpCode.Type = Type;\r
+ OpCode.DefaultId = DefaultId;\r
+ CopyMem (&OpCode.Value, &Value, mHiiDefaultTypeToWidth[Type]);\r
+\r
+ return InternalHiiCreateOpCode (OpCodeHandle, &OpCode, EFI_IFR_DEFAULT_OP, sizeof (OpCode));\r
+}\r
+\r
+/**\r
+ Create EFI_IFR_GUID opcode.\r
+\r
+ If OpCodeHandle is NULL, then ASSERT().\r
+ If Guid is NULL, then ASSERT().\r
+ If OpCodeSize < sizeof (EFI_IFR_GUID), then ASSERT().\r
+\r
+ @param[in] OpCodeHandle Handle to the buffer of opcodes.\r
+ @param[in] Guid Pointer to EFI_GUID of this guided opcode.\r
+ @param[in] GuidOpCode Pointer to an EFI_IFR_GUID opcode. This is an \r
+ optional parameter that may be NULL. If this\r
+ parameter is NULL, then the GUID extension \r
+ region of the created opcode is filled with zeros.\r
+ If this parameter is not NULL, then the GUID \r
+ extension region of GuidData will be copied to \r
+ the GUID extension region of the created opcode.\r
+ @param[in] OpCodeSize The size, in bytes, of created opcode. This value \r
+ must be >= sizeof(EFI_IFR_GUID).\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
+HiiCreateGuidOpCode (\r
+ IN VOID *OpCodeHandle,\r
+ IN CONST EFI_GUID *Guid,\r
+ IN CONST VOID *GuidOpCode, OPTIONAL\r
+ IN UINTN OpCodeSize\r
+ )\r
+{\r
+ EFI_IFR_GUID OpCode;\r
+ EFI_IFR_GUID *OpCodePointer;\r
+\r
+ ASSERT (Guid != NULL);\r
+ ASSERT (OpCodeSize >= sizeof (OpCode));\r
+\r
+ ZeroMem (&OpCode, sizeof (OpCode));\r
+ CopyGuid ((EFI_GUID *)(VOID *)&OpCode.Guid, Guid);\r
+\r
+ OpCodePointer = (EFI_IFR_GUID *)InternalHiiCreateOpCodeExtended (\r
+ OpCodeHandle, \r
+ &OpCode,\r
+ EFI_IFR_GUID_OP,\r
+ sizeof (OpCode),\r
+ OpCodeSize - sizeof (OpCode),\r
+ 0\r
+ );\r
+ if (OpCodePointer != NULL && GuidOpCode != NULL) {\r
+ CopyMem (OpCodePointer + 1, (EFI_IFR_GUID *)GuidOpCode + 1, OpCodeSize - sizeof (OpCode));\r
+ }\r
+ return (UINT8 *)OpCodePointer;\r
+}\r
+\r
+/**\r
+ Create EFI_IFR_ACTION_OP opcode.\r
+\r
+ If OpCodeHandle is NULL, then ASSERT().\r
+ If any reserved bits are set in QuestionFlags, then ASSERT().\r
+\r
+ @param[in] OpCodeHandle Handle to the buffer of opcodes.\r
+ @param[in] QuestionId Question ID\r
+ @param[in] Prompt String ID for Prompt\r
+ @param[in] Help String ID for Help\r
+ @param[in] QuestionFlags Flags in Question Header\r
+ @param[in] QuestionConfig String ID for configuration\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
+HiiCreateActionOpCode (\r
+ IN VOID *OpCodeHandle,\r
+ IN EFI_QUESTION_ID QuestionId,\r
+ IN EFI_STRING_ID Prompt,\r
+ IN EFI_STRING_ID Help,\r
+ IN UINT8 QuestionFlags,\r
+ IN EFI_STRING_ID QuestionConfig\r
+ )\r
+{\r
+ EFI_IFR_ACTION OpCode;\r
+\r
+ ASSERT ((QuestionFlags & (~(EFI_IFR_FLAG_READ_ONLY | EFI_IFR_FLAG_CALLBACK | EFI_IFR_FLAG_RESET_REQUIRED | EFI_IFR_FLAG_OPTIONS_ONLY))) == 0);\r
+\r
+ ZeroMem (&OpCode, sizeof (OpCode));\r
+ OpCode.Question.QuestionId = QuestionId;\r
+ OpCode.Question.Header.Prompt = Prompt;\r
+ OpCode.Question.Header.Help = Help;\r
+ OpCode.Question.Flags = QuestionFlags;\r
+ OpCode.QuestionConfig = QuestionConfig;\r
+\r
+ return InternalHiiCreateOpCode (OpCodeHandle, &OpCode, EFI_IFR_ACTION_OP, sizeof (OpCode));\r
+}\r
+\r
+/**\r
+ Create EFI_IFR_SUBTITLE_OP opcode.\r
+\r
+ If OpCodeHandle is NULL, then ASSERT().\r
+ If any reserved bits are set in Flags, then ASSERT().\r
+ If Scope > 1, then ASSERT().\r
+\r
+ @param[in] OpCodeHandle Handle to the buffer of opcodes.\r
+ @param[in] Prompt String ID for Prompt\r
+ @param[in] Help String ID for Help\r
+ @param[in] Flags Subtitle opcode flags\r
+ @param[in] Scope 1 if this opcpde is the beginning of a new scope.\r
+ 0 if this opcode is within the current scope.\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
+HiiCreateSubTitleOpCode (\r
+ IN VOID *OpCodeHandle,\r
+ IN EFI_STRING_ID Prompt,\r
+ IN EFI_STRING_ID Help,\r
+ IN UINT8 Flags,\r
+ IN UINT8 Scope\r
+ )\r
+{\r
+ EFI_IFR_SUBTITLE OpCode;\r
+\r
+ ASSERT (Scope <= 1);\r
+ ASSERT ((Flags & (~(EFI_IFR_FLAGS_HORIZONTAL))) == 0);\r
+\r
+ ZeroMem (&OpCode, sizeof (OpCode));\r
+ OpCode.Statement.Prompt = Prompt;\r
+ OpCode.Statement.Help = Help;\r
+ OpCode.Flags = Flags;\r
+\r
+ return InternalHiiCreateOpCodeExtended (\r
+ OpCodeHandle, \r
+ &OpCode,\r
+ EFI_IFR_SUBTITLE_OP, \r
+ sizeof (OpCode), \r
+ 0, \r
+ Scope\r
+ );\r
+}\r
+\r
+/**\r
+ Create EFI_IFR_REF_OP opcode.\r
+\r
+ If OpCodeHandle is NULL, then ASSERT().\r
+ If any reserved bits are set in QuestionFlags, then ASSERT().\r
+\r
+ @param[in] OpCodeHandle Handle to the buffer of opcodes.\r
+ @param[in] FormId Destination Form ID\r
+ @param[in] Prompt String ID for Prompt\r
+ @param[in] Help String ID for Help\r
+ @param[in] QuestionFlags Flags in Question Header\r
+ @param[in] QuestionId Question ID\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
+HiiCreateGotoOpCode (\r
+ IN VOID *OpCodeHandle,\r
+ IN EFI_FORM_ID FormId,\r
+ IN EFI_STRING_ID Prompt,\r
+ IN EFI_STRING_ID Help,\r
+ IN UINT8 QuestionFlags,\r
+ IN EFI_QUESTION_ID QuestionId\r
+ )\r
+{\r
+ EFI_IFR_REF OpCode;\r
+\r
+ ASSERT ((QuestionFlags & (~(EFI_IFR_FLAG_READ_ONLY | EFI_IFR_FLAG_CALLBACK | EFI_IFR_FLAG_RESET_REQUIRED | EFI_IFR_FLAG_OPTIONS_ONLY))) == 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 = FormId;\r
+\r
+ return InternalHiiCreateOpCode (OpCodeHandle, &OpCode, EFI_IFR_REF_OP, sizeof (OpCode));\r
+}\r
+\r
+/**\r
+ Create EFI_IFR_CHECKBOX_OP opcode.\r
+\r
+ If OpCodeHandle is NULL, then ASSERT().\r
+ If any reserved bits are set in QuestionFlags, then ASSERT().\r
+ If any reserved bits are set in CheckBoxFlags, then ASSERT().\r
+\r
+ @param[in] OpCodeHandle Handle to the buffer of opcodes.\r
+ @param[in] QuestionId Question ID\r
+ @param[in] VarStoreId Storage ID\r
+ @param[in] VarOffset Offset in Storage\r
+ @param[in] Prompt String ID for Prompt\r
+ @param[in] Help String ID for Help\r
+ @param[in] QuestionFlags Flags in Question Header\r
+ @param[in] CheckBoxFlags Flags for checkbox opcode\r
+ @param[in] DefaultsOpCodeHandle Handle for a buffer of DEFAULT opcodes. This\r
+ is an optional parameter that may be NULL.\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
+HiiCreateCheckBoxOpCode (\r
+ IN VOID *OpCodeHandle,\r
+ IN EFI_QUESTION_ID QuestionId,\r
+ IN EFI_VARSTORE_ID VarStoreId,\r
+ IN UINT16 VarOffset,\r
+ IN EFI_STRING_ID Prompt,\r
+ IN EFI_STRING_ID Help,\r
+ IN UINT8 QuestionFlags,\r
+ IN UINT8 CheckBoxFlags,\r
+ IN VOID *DefaultsOpCodeHandle OPTIONAL\r
+ )\r
+{\r
+ EFI_IFR_CHECKBOX OpCode;\r
+ UINTN Position;\r
+\r
+ ASSERT ((QuestionFlags & (~(EFI_IFR_FLAG_READ_ONLY | EFI_IFR_FLAG_CALLBACK | EFI_IFR_FLAG_RESET_REQUIRED | EFI_IFR_FLAG_OPTIONS_ONLY))) == 0);\r
+\r
+ ZeroMem (&OpCode, sizeof (OpCode));\r
+ OpCode.Question.QuestionId = QuestionId;\r
+ OpCode.Question.VarStoreId = VarStoreId;\r
+ OpCode.Question.VarStoreInfo.VarOffset = VarOffset;\r
+ OpCode.Question.Header.Prompt = Prompt;\r
+ OpCode.Question.Header.Help = Help;\r
+ OpCode.Question.Flags = QuestionFlags;\r
+ OpCode.Flags = CheckBoxFlags;\r
+\r
+ if (DefaultsOpCodeHandle == NULL) {\r
+ return InternalHiiCreateOpCode (OpCodeHandle, &OpCode, EFI_IFR_CHECKBOX_OP, sizeof (OpCode));\r
+ }\r
+\r
+ Position = InternalHiiOpCodeHandlePosition (OpCodeHandle);\r
+ InternalHiiCreateOpCodeExtended (OpCodeHandle, &OpCode, EFI_IFR_CHECKBOX_OP, sizeof (OpCode), 0, 1);\r
+ InternalHiiAppendOpCodes (OpCodeHandle, DefaultsOpCodeHandle);\r
+ HiiCreateEndOpCode (OpCodeHandle);\r
+ return InternalHiiOpCodeHandleBuffer (OpCodeHandle) + Position;\r
+}\r
+\r
+/**\r
+ Create EFI_IFR_NUMERIC_OP opcode.\r
+\r
+ If OpCodeHandle is NULL, then ASSERT().\r
+ If any reserved bits are set in QuestionFlags, then ASSERT().\r
+ If any reserved bits are set in NumericFlags, then ASSERT().\r
+\r
+ @param[in] OpCodeHandle Handle to the buffer of opcodes.\r
+ @param[in] QuestionId Question ID\r
+ @param[in] VarStoreId Storage ID\r
+ @param[in] VarOffset Offset in Storage\r
+ @param[in] Prompt String ID for Prompt\r
+ @param[in] Help String ID for Help\r
+ @param[in] QuestionFlags Flags in Question Header\r
+ @param[in] NumericFlags Flags for numeric opcode\r
+ @param[in] Minimum Numeric minimum value\r
+ @param[in] Maximum Numeric maximum value\r
+ @param[in] Step Numeric step for edit\r
+ @param[in] DefaultsOpCodeHandle Handle for a buffer of DEFAULT opcodes. This\r
+ is an optional parameter that may be NULL.\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
+HiiCreateNumericOpCode (\r
+ IN VOID *OpCodeHandle,\r
+ IN EFI_QUESTION_ID QuestionId,\r
+ IN EFI_VARSTORE_ID VarStoreId,\r
+ IN UINT16 VarOffset,\r
+ IN EFI_STRING_ID Prompt,\r
+ IN EFI_STRING_ID Help,\r
+ IN UINT8 QuestionFlags,\r
+ IN UINT8 NumericFlags,\r
+ IN UINT64 Minimum,\r
+ IN UINT64 Maximum,\r
+ IN UINT64 Step,\r
+ IN VOID *DefaultsOpCodeHandle OPTIONAL\r
+ )\r
+{\r
+ EFI_IFR_NUMERIC OpCode;\r
+ UINTN Position;\r
+\r
+ ASSERT ((QuestionFlags & (~(EFI_IFR_FLAG_READ_ONLY | EFI_IFR_FLAG_CALLBACK | EFI_IFR_FLAG_RESET_REQUIRED | EFI_IFR_FLAG_OPTIONS_ONLY))) == 0);\r
+\r
+ ZeroMem (&OpCode, sizeof (OpCode));\r
+ OpCode.Question.QuestionId = QuestionId;\r
+ OpCode.Question.VarStoreId = VarStoreId;\r
+ OpCode.Question.VarStoreInfo.VarOffset = VarOffset;\r
+ OpCode.Question.Header.Prompt = Prompt;\r
+ OpCode.Question.Header.Help = Help;\r
+ OpCode.Question.Flags = QuestionFlags;\r
+ OpCode.Flags = NumericFlags;\r
+\r
+ switch (NumericFlags & EFI_IFR_NUMERIC_SIZE) {\r
+ case EFI_IFR_NUMERIC_SIZE_1:\r
+ OpCode.data.u8.MinValue = (UINT8)Minimum;\r
+ OpCode.data.u8.MaxValue = (UINT8)Maximum;\r
+ OpCode.data.u8.Step = (UINT8)Step;\r
+ break;\r
+\r
+ case EFI_IFR_NUMERIC_SIZE_2:\r
+ OpCode.data.u16.MinValue = (UINT16)Minimum;\r
+ OpCode.data.u16.MaxValue = (UINT16)Maximum;\r
+ OpCode.data.u16.Step = (UINT16)Step;\r
+ break;\r
+\r
+ case EFI_IFR_NUMERIC_SIZE_4:\r
+ OpCode.data.u32.MinValue = (UINT32)Minimum;\r
+ OpCode.data.u32.MaxValue = (UINT32)Maximum;\r
+ OpCode.data.u32.Step = (UINT32)Step;\r
+ break;\r
+\r
+ case EFI_IFR_NUMERIC_SIZE_8:\r
+ OpCode.data.u64.MinValue = Minimum;\r
+ OpCode.data.u64.MaxValue = Maximum;\r
+ OpCode.data.u64.Step = Step;\r
+ break;\r
+ }\r
+\r
+ if (DefaultsOpCodeHandle == NULL) {\r
+ return InternalHiiCreateOpCode (OpCodeHandle, &OpCode, EFI_IFR_NUMERIC_OP, sizeof (OpCode));\r
+ }\r
+\r
+ Position = InternalHiiOpCodeHandlePosition (OpCodeHandle);\r
+ InternalHiiCreateOpCodeExtended (OpCodeHandle, &OpCode, EFI_IFR_NUMERIC_OP, sizeof (OpCode), 0, 1);\r
+ InternalHiiAppendOpCodes (OpCodeHandle, DefaultsOpCodeHandle);\r
+ HiiCreateEndOpCode (OpCodeHandle);\r
+ return InternalHiiOpCodeHandleBuffer (OpCodeHandle) + Position;\r
+}\r
+\r
+/**\r
+ Create EFI_IFR_STRING_OP opcode.\r
+\r
+ If OpCodeHandle is NULL, then ASSERT().\r
+ If any reserved bits are set in QuestionFlags, then ASSERT().\r
+ If any reserved bits are set in StringFlags, then ASSERT().\r
+\r
+ @param[in] OpCodeHandle Handle to the buffer of opcodes.\r
+ @param[in] QuestionId Question ID\r
+ @param[in] VarStoreId Storage ID\r
+ @param[in] VarOffset Offset in Storage\r
+ @param[in] Prompt String ID for Prompt\r
+ @param[in] Help String ID for Help\r
+ @param[in] QuestionFlags Flags in Question Header\r
+ @param[in] StringFlags Flags for string opcode\r
+ @param[in] MinSize String minimum length\r
+ @param[in] MaxSize String maximum length\r
+ @param[in] DefaultsOpCodeHandle Handle for a buffer of DEFAULT opcodes. This\r
+ is an optional parameter that may be NULL.\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
+HiiCreateStringOpCode (\r
+ IN VOID *OpCodeHandle,\r
+ IN EFI_QUESTION_ID QuestionId,\r
+ IN EFI_VARSTORE_ID VarStoreId,\r
+ IN UINT16 VarOffset,\r
+ IN EFI_STRING_ID Prompt,\r
+ IN EFI_STRING_ID Help,\r
+ IN UINT8 QuestionFlags,\r
+ IN UINT8 StringFlags,\r
+ IN UINT8 MinSize,\r
+ IN UINT8 MaxSize,\r
+ IN VOID *DefaultsOpCodeHandle OPTIONAL\r
+ )\r
+{\r
+ EFI_IFR_STRING OpCode;\r
+ UINTN Position;\r
+\r
+ ASSERT ((QuestionFlags & (~(EFI_IFR_FLAG_READ_ONLY | EFI_IFR_FLAG_CALLBACK | EFI_IFR_FLAG_RESET_REQUIRED | EFI_IFR_FLAG_OPTIONS_ONLY))) == 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.VarStoreId = VarStoreId;\r
+ OpCode.Question.VarStoreInfo.VarOffset = VarOffset;\r
+ OpCode.Question.Flags = QuestionFlags;\r
+ OpCode.MinSize = MinSize;\r
+ OpCode.MaxSize = MaxSize;\r
+ OpCode.Flags = (UINT8) (StringFlags & EFI_IFR_STRING_MULTI_LINE);\r
+\r
+ if (DefaultsOpCodeHandle == NULL) {\r
+ return InternalHiiCreateOpCode (OpCodeHandle, &OpCode, EFI_IFR_STRING_OP, sizeof (OpCode));\r
+ }\r
+\r
+ Position = InternalHiiOpCodeHandlePosition (OpCodeHandle);\r
+ InternalHiiCreateOpCodeExtended (OpCodeHandle, &OpCode, EFI_IFR_STRING_OP, sizeof (OpCode), 0, 1);\r
+ InternalHiiAppendOpCodes (OpCodeHandle, DefaultsOpCodeHandle);\r
+ HiiCreateEndOpCode (OpCodeHandle);\r
+ return InternalHiiOpCodeHandleBuffer (OpCodeHandle) + Position;\r
+}\r
+\r
+/**\r
+ Create EFI_IFR_ONE_OF_OP opcode.\r
+\r
+ If OpCodeHandle is NULL, then ASSERT().\r
+ If any reserved bits are set in QuestionFlags, then ASSERT().\r
+ If any reserved bits are set in OneOfFlags, then ASSERT().\r
+\r
+ @param[in] OpCodeHandle Handle to the buffer of opcodes.\r
+ @param[in] QuestionId Question ID\r
+ @param[in] VarStoreId Storage ID\r
+ @param[in] VarOffset Offset in Storage\r
+ @param[in] Prompt String ID for Prompt\r
+ @param[in] Help String ID for Help\r
+ @param[in] QuestionFlags Flags in Question Header\r
+ @param[in] OneOfFlags Flags for oneof opcode\r
+ @param[in] OptionsOpCodeHandle Handle for a buffer of ONE_OF_OPTION opcodes.\r
+ @param[in] DefaultsOpCodeHandle Handle for a buffer of DEFAULT opcodes. This\r
+ is an optional parameter that may be NULL.\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
+HiiCreateOneOfOpCode (\r
+ IN VOID *OpCodeHandle,\r
+ IN EFI_QUESTION_ID QuestionId,\r
+ IN EFI_VARSTORE_ID VarStoreId,\r
+ IN UINT16 VarOffset,\r
+ IN EFI_STRING_ID Prompt,\r
+ IN EFI_STRING_ID Help,\r
+ IN UINT8 QuestionFlags,\r
+ IN UINT8 OneOfFlags,\r
+ IN VOID *OptionsOpCodeHandle,\r
+ IN VOID *DefaultsOpCodeHandle OPTIONAL\r
+ )\r
+{\r
+ EFI_IFR_ONE_OF OpCode;\r
+ UINTN Position;\r
+\r
+ ASSERT (OptionsOpCodeHandle != NULL);\r
+ ASSERT ((QuestionFlags & (~(EFI_IFR_FLAG_READ_ONLY | EFI_IFR_FLAG_CALLBACK | EFI_IFR_FLAG_RESET_REQUIRED | EFI_IFR_FLAG_OPTIONS_ONLY))) == 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.VarStoreId = VarStoreId;\r
+ OpCode.Question.VarStoreInfo.VarOffset = VarOffset;\r
+ OpCode.Question.Flags = QuestionFlags;\r
+ OpCode.Flags = OneOfFlags;\r
+\r
+ Position = InternalHiiOpCodeHandlePosition (OpCodeHandle);\r
+ InternalHiiCreateOpCodeExtended (OpCodeHandle, &OpCode, EFI_IFR_ONE_OF_OP, sizeof (OpCode), 0, 1);\r
+ InternalHiiAppendOpCodes (OpCodeHandle, OptionsOpCodeHandle);\r
+ if (DefaultsOpCodeHandle != NULL) {\r
+ InternalHiiAppendOpCodes (OpCodeHandle, DefaultsOpCodeHandle);\r
+ }\r
+ HiiCreateEndOpCode (OpCodeHandle);\r
+ return InternalHiiOpCodeHandleBuffer (OpCodeHandle) + Position;\r
+}\r
+\r
+/**\r
+ Create EFI_IFR_ORDERED_LIST_OP opcode.\r
+\r
+ If OpCodeHandle is NULL, then ASSERT().\r
+ If any reserved bits are set in QuestionFlags, then ASSERT().\r
+ If any reserved bits are set in OrderedListFlags, then ASSERT().\r
+\r
+ @param[in] OpCodeHandle Handle to the buffer of opcodes.\r
+ @param[in] QuestionId Question ID\r
+ @param[in] VarStoreId Storage ID\r
+ @param[in] VarOffset Offset in Storage\r
+ @param[in] Prompt String ID for Prompt\r
+ @param[in] Help String ID for Help\r
+ @param[in] QuestionFlags Flags in Question Header\r
+ @param[in] OrderedListFlags Flags for ordered list opcode\r
+ @param[in] DataType Type for option value\r
+ @param[in] MaxContainers Maximum count for options in this ordered list\r
+ @param[in] OptionsOpCodeHandle Handle for a buffer of ONE_OF_OPTION opcodes.\r
+ @param[in] DefaultsOpCodeHandle Handle for a buffer of DEFAULT opcodes. This\r
+ is an optional parameter that may be NULL.\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
+HiiCreateOrderedListOpCode (\r
+ IN VOID *OpCodeHandle,\r
+ IN EFI_QUESTION_ID QuestionId,\r
+ IN EFI_VARSTORE_ID VarStoreId,\r
+ IN UINT16 VarOffset,\r
+ IN EFI_STRING_ID Prompt,\r
+ IN EFI_STRING_ID Help,\r
+ IN UINT8 QuestionFlags,\r
+ IN UINT8 OrderedListFlags,\r
+ IN UINT8 DataType,\r
+ IN UINT8 MaxContainers,\r
+ IN VOID *OptionsOpCodeHandle,\r
+ IN VOID *DefaultsOpCodeHandle OPTIONAL\r
+ )\r
+{\r
+ EFI_IFR_ORDERED_LIST OpCode;\r
+ UINTN Position;\r
+\r
+ ASSERT (OptionsOpCodeHandle != NULL);\r
+ ASSERT ((QuestionFlags & (~(EFI_IFR_FLAG_READ_ONLY | EFI_IFR_FLAG_CALLBACK | EFI_IFR_FLAG_RESET_REQUIRED | EFI_IFR_FLAG_OPTIONS_ONLY))) == 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.VarStoreId = VarStoreId;\r
+ OpCode.Question.VarStoreInfo.VarOffset = VarOffset;\r
+ OpCode.Question.Flags = QuestionFlags;\r
+ OpCode.MaxContainers = MaxContainers;\r
+ OpCode.Flags = OrderedListFlags;\r
+\r
+ Position = InternalHiiOpCodeHandlePosition (OpCodeHandle);\r
+ InternalHiiCreateOpCodeExtended (OpCodeHandle, &OpCode, EFI_IFR_ORDERED_LIST_OP, sizeof (OpCode), 0, 1);\r
+ InternalHiiAppendOpCodes (OpCodeHandle, OptionsOpCodeHandle);\r
+ if (DefaultsOpCodeHandle != NULL) {\r
+ InternalHiiAppendOpCodes (OpCodeHandle, DefaultsOpCodeHandle);\r
+ }\r
+ HiiCreateEndOpCode (OpCodeHandle);\r
+ return InternalHiiOpCodeHandleBuffer (OpCodeHandle) + Position;\r
+}\r
+\r
+/**\r
+ This is the internal worker function to update the data in\r
+ a form specified by FormSetGuid, FormId and Label.\r
+\r
+ @param FormSetGuid The optional Formset GUID.\r
+ @param FormId The Form ID.\r
+ @param Package The package header.\r
+\r
+ @param TempPacakge The resultant package.\r
+\r
+ @retval EFI_SUCCESS The function completes successfully.\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+InternalHiiUpdateFormPackageData (\r
+ IN EFI_GUID *FormSetGuid, OPTIONAL\r
+ IN EFI_FORM_ID FormId,\r
+ IN EFI_HII_PACKAGE_HEADER *Package,\r
+ IN HII_LIB_OPCODE_BUFFER *OpCodeBufferStart,\r
+ IN HII_LIB_OPCODE_BUFFER *OpCodeBufferEnd, OPTIONAL\r
+ OUT EFI_HII_PACKAGE_HEADER *TempPackage\r
+ )\r
+{\r
+ UINTN AddSize;\r
+ UINT8 *BufferPos;\r
+ EFI_HII_PACKAGE_HEADER PackageHeader;\r
+ UINTN Offset;\r
+ EFI_IFR_OP_HEADER *IfrOpHdr;\r
+ EFI_IFR_OP_HEADER *UpdateIfrOpHdr;\r
+ BOOLEAN GetFormSet;\r
+ BOOLEAN GetForm;\r
+ BOOLEAN Updated;\r
+ UINTN UpdatePackageLength;\r
+\r
+ CopyMem (TempPackage, Package, sizeof (EFI_HII_PACKAGE_HEADER));\r
+ UpdatePackageLength = sizeof (EFI_HII_PACKAGE_HEADER);\r
+ BufferPos = (UINT8 *) (TempPackage + 1);\r
+\r
+ CopyMem (&PackageHeader, Package, sizeof (EFI_HII_PACKAGE_HEADER));\r
+ IfrOpHdr = (EFI_IFR_OP_HEADER *)((UINT8 *) Package + sizeof (EFI_HII_PACKAGE_HEADER));\r
+ Offset = sizeof (EFI_HII_PACKAGE_HEADER);\r
+ GetFormSet = (BOOLEAN) ((FormSetGuid == NULL) ? TRUE : FALSE);\r
+ GetForm = FALSE;\r
+ Updated = FALSE;\r
+\r
+ while (Offset < PackageHeader.Length) {\r
+ CopyMem (BufferPos, IfrOpHdr, IfrOpHdr->Length);\r
+ BufferPos += IfrOpHdr->Length;\r
+ UpdatePackageLength += IfrOpHdr->Length;\r
+ \r
+ //\r
+ // Find the matched FormSet and Form\r
+ //\r
+ if ((IfrOpHdr->OpCode == EFI_IFR_FORM_SET_OP) && (FormSetGuid != NULL)) {\r
+ if (CompareGuid((GUID *)(VOID *)&((EFI_IFR_FORM_SET *) IfrOpHdr)->Guid, FormSetGuid)) {\r
+ GetFormSet = TRUE;\r
+ } else {\r
+ GetFormSet = FALSE;\r
+ }\r
+ } else if (IfrOpHdr->OpCode == EFI_IFR_FORM_OP) {\r
+ if (CompareMem (&((EFI_IFR_FORM *) IfrOpHdr)->FormId, &FormId, sizeof (EFI_FORM_ID)) == 0) {\r
+ GetForm = TRUE;\r
+ } else {\r
+ GetForm = FALSE;\r
+ }\r
+ }\r
+ \r
+ //\r
+ // The matched Form is found, and Update data in this form\r
+ //\r
+ if (GetFormSet && GetForm) {\r
+ UpdateIfrOpHdr = (EFI_IFR_OP_HEADER *) OpCodeBufferStart->Buffer;\r
+ if ((UpdateIfrOpHdr->Length == IfrOpHdr->Length) && \\r
+ (CompareMem (IfrOpHdr, UpdateIfrOpHdr, UpdateIfrOpHdr->Length) == 0)) {\r
+ //\r
+ // Remove the original data when End OpCode buffer exist.\r
+ //\r
+ if (OpCodeBufferEnd != NULL) {\r
+ Offset += IfrOpHdr->Length;\r
+ IfrOpHdr = (EFI_IFR_OP_HEADER *) ((UINT8 *) (IfrOpHdr) + IfrOpHdr->Length);\r
+ UpdateIfrOpHdr = (EFI_IFR_OP_HEADER *) OpCodeBufferEnd->Buffer;\r
+ while (Offset < PackageHeader.Length) {\r
+ //\r
+ // Search the matched end opcode\r
+ //\r
+ if ((UpdateIfrOpHdr->Length == IfrOpHdr->Length) && \\r
+ (CompareMem (IfrOpHdr, UpdateIfrOpHdr, UpdateIfrOpHdr->Length) == 0)) {\r
+ break;\r
+ }\r
+ //\r
+ // Go to the next Op-Code\r
+ //\r
+ Offset += IfrOpHdr->Length;\r
+ IfrOpHdr = (EFI_IFR_OP_HEADER *) ((UINT8 *) (IfrOpHdr) + IfrOpHdr->Length);\r
+ }\r
+ \r
+ if (Offset >= PackageHeader.Length) {\r
+ //\r
+ // The end opcode is not found.\r
+ //\r
+ return EFI_NOT_FOUND;\r
+ }\r
+ }\r
+\r
+ //\r
+ // Insert the updated data\r
+ //\r
+ AddSize = ((EFI_IFR_OP_HEADER *) OpCodeBufferStart->Buffer)->Length;\r
+ CopyMem (BufferPos, OpCodeBufferStart->Buffer + AddSize, OpCodeBufferStart->Position - AddSize);\r
+ BufferPos += OpCodeBufferStart->Position - AddSize;\r
+ UpdatePackageLength += OpCodeBufferStart->Position - AddSize;\r
+\r
+ if (OpCodeBufferEnd != NULL) {\r
+ //\r
+ // Add the end opcode\r
+ //\r
+ CopyMem (BufferPos, IfrOpHdr, IfrOpHdr->Length);\r
+ BufferPos += IfrOpHdr->Length;\r
+ UpdatePackageLength += IfrOpHdr->Length;\r
+ }\r
+\r
+ //\r
+ // Copy the left package data.\r
+ //\r
+ Offset += IfrOpHdr->Length;\r
+ CopyMem (BufferPos, (UINT8 *) Package + Offset, PackageHeader.Length - Offset);\r
+ UpdatePackageLength += PackageHeader.Length - Offset;\r
+\r
+ //\r
+ // Set update flag\r
+ //\r
+ Updated = TRUE;\r
+ break;\r
+ }\r
+ }\r
+\r
+ //\r
+ // Go to the next Op-Code\r
+ //\r
+ Offset += IfrOpHdr->Length;\r
+ IfrOpHdr = (EFI_IFR_OP_HEADER *) ((CHAR8 *) (IfrOpHdr) + IfrOpHdr->Length);\r
+ }\r
+ \r
+ if (!Updated) {\r
+ //\r
+ // The updated opcode buffer is not found.\r
+ //\r
+ return EFI_NOT_FOUND;\r
+ }\r
+ //\r
+ // Update the package length.\r
+ //\r
+ PackageHeader.Length = (UINT32) UpdatePackageLength;\r
+ CopyMem (TempPackage, &PackageHeader, sizeof (EFI_HII_PACKAGE_HEADER));\r
+\r
+ return EFI_SUCCESS;\r
+}\r
+\r
+/**\r
+ This function updates a form that has previously been registered with the HII \r
+ Database. This function will perform at most one update operation.\r
+ \r
+ The form to update is specified by Handle, FormSetGuid, and FormId. Binary \r
+ comparisons of IFR opcodes are performed from the beginning of the form being \r
+ updated until an IFR opcode is found that exactly matches the first IFR opcode \r
+ specifed by StartOpCodeHandle. The following rules are used to determine if\r
+ an insert, replace, or delete operation is performed.\r
+ \r
+ 1) If no matches are found, then NULL is returned. \r
+ 2) If a match is found, and EndOpCodeHandle is NULL, then all of the IFR opcodes\r
+ from StartOpcodeHandle except the first opcode are inserted immediately after \r
+ the matching IFR opcode in the form beng updated.\r
+ 3) If a match is found, and EndOpCodeHandle is not NULL, then a search is made \r
+ from the matching IFR opcode until an IFR opcode exatly matches the first \r
+ IFR opcode specified by EndOpCodeHandle. If no match is found for the first\r
+ IFR opcode specified by EndOpCodeHandle, then NULL is returned. If a match\r
+ is found, then all of the IFR opcodes between the start match and the end \r
+ match are deleted from the form being updated and all of the IFR opcodes\r
+ from StartOpcodeHandle except the first opcode are inserted immediately after \r
+ the matching start IFR opcode. If StartOpCcodeHandle only contains one\r
+ IFR instruction, then the result of ths operation will delete all of the IFR\r
+ opcodes between the start end matches.\r
+\r
+ If HiiHandle is NULL, then ASSERT().\r
+ If StartOpCodeHandle is NULL, then ASSERT().\r
+\r
+ @param[in] HiiHandle The HII Handle of the form to update.\r
+ @param[in] FormSetGuid The Formset GUID of the form to update. This\r
+ is an optional parameter that may be NULL.\r
+ If it is NULL, all FormSet will be updated.\r
+ @param[in] FormId The ID of the form to update.\r
+ @param[in] StartOpCodeHandle An OpCode Handle that contains the set of IFR \r
+ opcodes to be inserted or replaced in the form.\r
+ The first IFR instruction in StartOpCodeHandle \r
+ is used to find matching IFR opcode in the \r
+ form. \r
+ @param[in] EndOpCodeHandle An OpCcode Handle that contains the IFR opcode\r
+ that marks the end of a replace operation in\r
+ the form. This is an optional parameter that\r
+ may be NULL. If it is NULL, then an the IFR\r
+ opcodes specified by StartOpCodeHandle are \r
+ inserted into the form.\r
+ \r
+ @retval EFI_OUT_OF_RESOURCES No enough memory resource is allocated.\r
+ @retval EFI_NOT_FOUND The following cases will return EFI_NOT_FOUND.\r
+ 1) The form specified by HiiHandle, FormSetGuid, \r
+ and FormId could not be found in the HII Database.\r
+ 2) No IFR opcodes in the target form match the first\r
+ IFR opcode in StartOpCodeHandle.\r
+ 3) EndOpCOde is not NULL, and no IFR opcodes in the \r
+ target form following a matching start opcode match \r
+ the first IFR opcode in EndOpCodeHandle.\r
+ @retval EFI_SUCCESS The matched form is updated by StartOpcode.\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+HiiUpdateForm (\r
+ IN EFI_HII_HANDLE HiiHandle, \r
+ IN EFI_GUID *FormSetGuid, OPTIONAL\r
+ IN EFI_FORM_ID FormId,\r
+ IN VOID *StartOpcodeHandle,\r
+ IN VOID *EndOpcodeHandle OPTIONAL\r
+ )\r
+{\r
+ EFI_STATUS Status;\r
+ EFI_HII_PACKAGE_LIST_HEADER *HiiPackageList;\r
+ UINT32 PackageListLength; \r
+ UINT32 Offset;\r
+ EFI_HII_PACKAGE_LIST_HEADER *UpdatePackageList;\r
+ UINTN BufferSize;\r
+ UINT8 *UpdateBufferPos;\r
+ EFI_HII_PACKAGE_HEADER *Package;\r
+ EFI_HII_PACKAGE_HEADER *TempPacakge;\r
+ EFI_HII_PACKAGE_HEADER PackageHeader;\r
+ BOOLEAN Updated;\r
+ HII_LIB_OPCODE_BUFFER *OpCodeBufferStart;\r
+ HII_LIB_OPCODE_BUFFER *OpCodeBufferEnd;\r
+ \r
+ //\r
+ // Input update data can't be NULL.\r
+ //\r
+ ASSERT (HiiHandle != NULL);\r
+ ASSERT (StartOpcodeHandle != NULL);\r
+ UpdatePackageList = NULL;\r
+ TempPacakge = NULL;\r
+ HiiPackageList = NULL;\r
+ \r
+ //\r
+ // Restrive buffer data from Opcode Handle\r
+ //\r
+ OpCodeBufferStart = (HII_LIB_OPCODE_BUFFER *) StartOpcodeHandle;\r
+ OpCodeBufferEnd = (HII_LIB_OPCODE_BUFFER *) EndOpcodeHandle;\r
+ \r
+ //\r
+ // Get the orginal package list\r
+ //\r
+ BufferSize = 0;\r
+ HiiPackageList = NULL;\r
+ Status = gHiiDatabase->ExportPackageLists (gHiiDatabase, HiiHandle, &BufferSize, HiiPackageList);\r
+ //\r
+ // The return status should always be EFI_BUFFER_TOO_SMALL as input buffer's size is 0.\r
+ //\r
+ if (Status != EFI_BUFFER_TOO_SMALL) {\r
+ return Status;\r
+ }\r
+\r
+ HiiPackageList = AllocatePool (BufferSize);\r
+ if (HiiPackageList == NULL) {\r
+ Status = EFI_OUT_OF_RESOURCES;\r
+ goto Finish;\r
+ }\r
+\r
+ Status = gHiiDatabase->ExportPackageLists (gHiiDatabase, HiiHandle, &BufferSize, HiiPackageList);\r
+ if (EFI_ERROR (Status)) {\r
+ goto Finish;\r
+ }\r
+\r
+ //\r
+ // Calculate and allocate space for retrieval of IFR data\r
+ //\r
+ BufferSize += OpCodeBufferStart->Position;\r
+ UpdatePackageList = AllocateZeroPool (BufferSize);\r
+ if (UpdatePackageList == NULL) {\r
+ Status = EFI_OUT_OF_RESOURCES;\r
+ goto Finish;\r
+ }\r
+ \r
+ //\r
+ // Allocate temp buffer to store the temp updated package buffer\r
+ //\r
+ TempPacakge = AllocateZeroPool (BufferSize);\r
+ if (TempPacakge == NULL) {\r
+ Status = EFI_OUT_OF_RESOURCES;\r
+ goto Finish;\r
+ }\r
+\r
+ UpdateBufferPos = (UINT8 *) UpdatePackageList;\r
+\r
+ //\r
+ // Copy the package list header\r
+ //\r
+ CopyMem (UpdateBufferPos, HiiPackageList, sizeof (EFI_HII_PACKAGE_LIST_HEADER));\r
+ UpdateBufferPos += sizeof (EFI_HII_PACKAGE_LIST_HEADER);\r
+ \r
+ //\r
+ // Go through each package to find the matched pacakge and update one by one\r
+ //\r
+ Updated = FALSE;\r
+ Offset = sizeof (EFI_HII_PACKAGE_LIST_HEADER);\r
+ PackageListLength = ReadUnaligned32 (&HiiPackageList->PackageLength);\r
+ while (Offset < PackageListLength) {\r
+ Package = (EFI_HII_PACKAGE_HEADER *) (((UINT8 *) HiiPackageList) + Offset);\r
+ CopyMem (&PackageHeader, Package, sizeof (EFI_HII_PACKAGE_HEADER));\r
+ Offset += Package->Length;\r
+\r
+ if (Package->Type == EFI_HII_PACKAGE_FORMS) {\r
+ //\r
+ // Check this package is the matched package.\r
+ //\r
+ Status = InternalHiiUpdateFormPackageData (FormSetGuid, FormId, Package, OpCodeBufferStart, OpCodeBufferEnd, TempPacakge);\r
+ //\r
+ // The matched package is found. Its pacakge buffer will be updated by the input new data.\r
+ //\r
+ if (!EFI_ERROR(Status)) {\r
+ //\r
+ // Set Update Flag\r
+ // \r
+ Updated = TRUE;\r
+ //\r
+ // Add updated package buffer\r
+ //\r
+ Package = TempPacakge;\r
+ }\r
+ }\r
+\r
+ //\r
+ // Add pacakge buffer\r
+ //\r
+ CopyMem (&PackageHeader, Package, sizeof (EFI_HII_PACKAGE_HEADER));\r
+ CopyMem (UpdateBufferPos, Package, PackageHeader.Length);\r
+ UpdateBufferPos += PackageHeader.Length;\r
+ }\r
+ \r
+ if (Updated) {\r
+ //\r
+ // Update package list length\r
+ //\r
+ BufferSize = UpdateBufferPos - (UINT8 *) UpdatePackageList;\r
+ WriteUnaligned32 (&UpdatePackageList->PackageLength, (UINT32) BufferSize);\r
+ \r
+ //\r
+ // Update Pacakge to show form\r
+ //\r
+ Status = gHiiDatabase->UpdatePackageList (gHiiDatabase, HiiHandle, UpdatePackageList);\r
+ } else {\r
+ //\r
+ // Not matched form is found and updated.\r
+ //\r
+ Status = EFI_NOT_FOUND;\r
+ }\r
+\r
+Finish:\r
+ if (HiiPackageList != NULL) {\r
+ FreePool (HiiPackageList);\r
+ }\r
+ \r
+ if (UpdatePackageList != NULL) {\r
+ FreePool (UpdatePackageList);\r
+ }\r
+ \r
+ if (TempPacakge != NULL) {\r
+ FreePool (TempPacakge);\r
+ }\r
+\r
+ return Status; \r
+}\r