40 if ((FormSetGuid ==
NULL) || (FormSet ==
NULL)) {
41 return EFI_INVALID_PARAMETER;
47 Status =
gBS->LocateProtocol (
48 &gEfiHiiDatabaseProtocolGuid,
52 if (EFI_ERROR (Status)) {
56 Status =
GetIfrBinaryData (Handle, FormSetGuid, &FormSet->IfrBinaryLength, &FormSet->IfrBinaryData);
57 if (EFI_ERROR (Status)) {
61 FormSet->Signature = HII_FORMSET_SIGNATURE;
62 FormSet->HiiHandle = Handle;
67 Status = HiiDatabase->GetPackageListHandle (HiiDatabase, Handle, &DriverHandle);
68 if (EFI_ERROR (Status)) {
72 FormSet->DriverHandle = DriverHandle;
73 Status =
gBS->HandleProtocol (
75 &gEfiHiiConfigAccessProtocolGuid,
76 (VOID **)&FormSet->ConfigAccess
78 if (EFI_ERROR (Status)) {
83 FormSet->ConfigAccess =
NULL;
86 Status =
gBS->HandleProtocol (
88 &gEfiDevicePathProtocolGuid,
89 (VOID **)&FormSet->DevicePath
91 if (EFI_ERROR (Status)) {
96 FormSet->DevicePath =
NULL;
124 if (FormSet ==
NULL) {
132 while (!
IsNull (&FormSet->StorageListHead, Link)) {
133 Storage = HII_STORAGE_FROM_LINK (Link);
135 Link =
GetNextNode (&FormSet->StorageListHead, Link);
142 while (!
IsNull (&FormSet->FormListHead, FormLink)) {
143 Form = HII_FORM_FROM_LINK (FormLink);
146 Question = HII_STATEMENT_FROM_LINK (Link);
154 FormLink =
GetNextNode (&FormSet->FormListHead, FormLink);
174 if (FormSet->IfrBinaryData ==
NULL) {
190 if (FormSet->StorageListHead.ForwardLink !=
NULL) {
193 Storage = HII_STORAGE_FROM_LINK (Link);
196 if (Storage !=
NULL) {
205 if (FormSet->DefaultStoreListHead.ForwardLink !=
NULL) {
206 while (!
IsListEmpty (&FormSet->DefaultStoreListHead)) {
208 DefaultStore = HII_FORMSET_DEFAULTSTORE_FROM_LINK (Link);
218 if (FormSet->FormListHead.ForwardLink !=
NULL) {
221 Form = HII_FORM_FROM_LINK (Link);
250 EFI_STRING ConfigResp;
255 if ((FormSet ==
NULL) || (Form ==
NULL)) {
256 return EFI_INVALID_PARAMETER;
260 if (EFI_ERROR (Status)) {
265 while (!
IsNull (&Form->ConfigRequestHead, Link)) {
266 ConfigInfo = HII_FORM_CONFIG_REQUEST_FROM_LINK (Link);
267 Link =
GetNextNode (&Form->ConfigRequestHead, Link);
269 Storage = ConfigInfo->Storage;
270 if (Storage->
Type == EFI_HII_VARSTORE_EFI_VARIABLE) {
282 if (EFI_ERROR (Status)) {
286 Status =
gBS->LocateProtocol (
287 &gEfiHiiConfigRoutingProtocolGuid,
289 (VOID **)&HiiConfigRouting
291 if (EFI_ERROR (Status)) {
295 Status = HiiConfigRouting->RouteConfig (
301 if (EFI_ERROR (Status)) {
337 BOOLEAN IsBufferStorage;
345 if ((FormSet ==
NULL) || (Form ==
NULL) || (Question ==
NULL) || (QuestionValue ==
NULL)) {
346 return EFI_INVALID_PARAMETER;
355 if ((Question->ValueExpression !=
NULL) || (Question->Value.Type != QuestionValue->Type)) {
356 return EFI_INVALID_PARAMETER;
362 if ((Question->WriteExpression !=
NULL) && (Form->FormType == STANDARD_MAP_FORM_TYPE)) {
364 if (EFI_ERROR (Status)) {
369 Storage = Question->Storage;
370 if (Storage !=
NULL) {
371 StorageWidth = Question->StorageWidth;
372 if (Question->Value.Type == EFI_IFR_TYPE_BUFFER) {
373 Question->Value.BufferLen = QuestionValue->BufferLen;
375 if (Question->Value.Buffer ==
NULL) {
376 return EFI_OUT_OF_RESOURCES;
379 Question->Value.BufferValueType = QuestionValue->BufferValueType;
380 Src = Question->Value.Buffer;
381 }
else if (Question->Value.Type == EFI_IFR_TYPE_STRING) {
382 Question->Value.Value.string = QuestionValue->Value.string;
383 TemString =
HiiGetString (FormSet->HiiHandle, QuestionValue->Value.string,
NULL);
384 if (TemString ==
NULL) {
388 Question->Value.BufferLen = Question->StorageWidth;
390 if (Question->Value.Buffer ==
NULL) {
392 return EFI_OUT_OF_RESOURCES;
396 Src = Question->Value.Buffer;
400 Src = (UINT8 *)&Question->Value.Value;
403 if ((Storage->
Type == EFI_HII_VARSTORE_BUFFER) || (Storage->
Type == EFI_HII_VARSTORE_EFI_VARIABLE_BUFFER)) {
404 IsBufferStorage =
TRUE;
406 IsBufferStorage =
FALSE;
409 if (IsBufferStorage) {
413 if (Question->QuestionReferToBitField) {
416 CopyMem (Storage->
Buffer + Question->VarStoreInfo.VarOffset, Src, StorageWidth);
419 if (Question->Value.Type == EFI_IFR_TYPE_STRING) {
424 BufferLen = ((
StrLen ((CHAR16 *)Src) * 4) + 1) *
sizeof (CHAR16);
426 if (ValueStr ==
NULL) {
427 if (Question->Value.Buffer !=
NULL) {
431 return EFI_OUT_OF_RESOURCES;
437 TemName = (CHAR16 *)Src;
438 TemString = ValueStr;
439 for ( ; *TemName != L
'\0'; TemName++) {
442 BufferLen - ((
UINTN)TemString - (
UINTN)ValueStr),
443 PREFIX_ZERO | RADIX_HEX,
447 TemString +=
StrnLenS (TemString, (BufferLen - ((
UINTN)TemString - (
UINTN)ValueStr)) /
sizeof (CHAR16));
450 BufferLen = StorageWidth * 2 + 1;
452 if (ValueStr ==
NULL) {
453 if (Question->Value.Buffer !=
NULL) {
457 return EFI_OUT_OF_RESOURCES;
463 TemBuffer = Src + StorageWidth - 1;
464 TemString = ValueStr;
465 for (Index = 0; Index < StorageWidth; Index++, TemBuffer--) {
468 BufferLen *
sizeof (CHAR16) - ((
UINTN)TemString - (
UINTN)ValueStr),
469 PREFIX_ZERO | RADIX_HEX,
473 TemString +=
StrnLenS (TemString, BufferLen - ((
UINTN)TemString - (
UINTN)ValueStr) /
sizeof (CHAR16));
477 Status =
SetValueByName (Storage, Question->VariableName, ValueStr, &Node);
479 if (EFI_ERROR (Status)) {
480 if (Question->Value.Buffer !=
NULL) {
488 if (Question->Value.Type == EFI_IFR_TYPE_BUFFER) {
489 Question->Value.BufferLen = QuestionValue->BufferLen;
490 Question->Value.Buffer =
AllocateCopyPool (QuestionValue->BufferLen, QuestionValue->Buffer);
491 if (Question->Value.Buffer ==
NULL) {
492 return EFI_OUT_OF_RESOURCES;
495 Question->Value.BufferValueType = QuestionValue->BufferValueType;
496 }
else if (Question->Value.Type == EFI_IFR_TYPE_STRING) {
497 Question->Value.Value.string = QuestionValue->Value.string;
498 TemString =
HiiGetString (FormSet->HiiHandle, QuestionValue->Value.string,
NULL);
499 if (TemString ==
NULL) {
503 Question->Value.BufferLen = (UINT16)
StrSize (TemString);
505 if (Question->Value.Buffer ==
NULL) {
507 return EFI_OUT_OF_RESOURCES;
540 EFI_BROWSER_ACTION_REQUEST ActionRequest;
549 CHAR16 *ConfigRequest;
554 BOOLEAN IsBufferStorage;
557 if ((FormSet ==
NULL) || (Form ==
NULL) || (Question ==
NULL)) {
566 if (QuestionValue ==
NULL) {
570 QuestionValue->
Type = Question->Value.Type;
571 QuestionValue->BufferLen = Question->Value.BufferLen;
572 if (QuestionValue->BufferLen != 0) {
583 Storage = Question->Storage;
584 StorageWidth = Question->StorageWidth;
586 if (Storage ==
NULL) {
590 if ((Question->Operand == EFI_IFR_DATE_OP) || (Question->Operand == EFI_IFR_TIME_OP)) {
594 switch (Question->ExtraData.Flags & EFI_QF_DATE_STORAGE) {
595 case QF_DATE_STORAGE_TIME:
597 Status =
gRT->GetTime (&EfiTime,
NULL);
600 case QF_DATE_STORAGE_WAKEUP:
602 Status =
gRT->GetWakeupTime (&Enabled, &Pending, &EfiTime);
605 case QF_DATE_STORAGE_NORMAL:
611 if (EFI_ERROR (Status)) {
612 if (Question->Operand == EFI_IFR_DATE_OP) {
613 QuestionValue->Value.date.Year = 0xff;
614 QuestionValue->Value.date.Month = 0xff;
615 QuestionValue->Value.date.Day = 0xff;
617 QuestionValue->Value.time.Hour = 0xff;
618 QuestionValue->Value.time.Minute = 0xff;
619 QuestionValue->Value.time.Second = 0xff;
622 return QuestionValue;
625 if (Question->Operand == EFI_IFR_DATE_OP) {
626 QuestionValue->Value.date.Year = EfiTime.Year;
627 QuestionValue->Value.date.Month = EfiTime.Month;
628 QuestionValue->Value.date.Day = EfiTime.Day;
630 QuestionValue->Value.time.Hour = EfiTime.Hour;
631 QuestionValue->Value.time.Minute = EfiTime.Minute;
632 QuestionValue->Value.time.Second = EfiTime.Second;
635 if (((Question->QuestionFlags & EFI_IFR_FLAG_CALLBACK) != EFI_IFR_FLAG_CALLBACK) ||
636 (FormSet->ConfigAccess ==
NULL))
641 if (QuestionValue->
Type == EFI_IFR_TYPE_BUFFER) {
650 ActionRequest = EFI_BROWSER_ACTION_REQUEST_NONE;
651 Status = FormSet->ConfigAccess->Callback (
652 FormSet->ConfigAccess,
653 EFI_BROWSER_ACTION_RETRIEVE,
654 Question->QuestionId,
660 if (!EFI_ERROR (Status) && (QuestionValue->
Type == EFI_IFR_TYPE_STRING)) {
683 return QuestionValue;
689 if (Storage->
Type == EFI_HII_VARSTORE_EFI_VARIABLE) {
690 if ((QuestionValue->
Type != EFI_IFR_TYPE_BUFFER) && (QuestionValue->
Type != EFI_IFR_TYPE_STRING)) {
691 Dst = QuestionValue->
Buffer;
692 StorageWidth = QuestionValue->BufferLen;
694 Dst = (UINT8 *)&QuestionValue->Value;
698 Status =
gRT->GetVariable (
699 Question->VariableName,
706 return QuestionValue;
709 Status =
gBS->LocateProtocol (
710 &gEfiHiiConfigRoutingProtocolGuid,
712 (VOID **)&HiiConfigRouting
714 if (EFI_ERROR (Status)) {
718 if (QuestionValue->BufferLen != 0) {
719 Dst = QuestionValue->
Buffer;
721 Dst = (UINT8 *)&QuestionValue->Value;
724 if ((Storage->
Type == EFI_HII_VARSTORE_BUFFER) || (Storage->
Type == EFI_HII_VARSTORE_EFI_VARIABLE_BUFFER)) {
725 IsBufferStorage =
TRUE;
727 IsBufferStorage =
FALSE;
731 if (Storage ==
NULL) {
738 if (IsBufferStorage) {
740 Length +=
StrLen (Question->BlockName);
743 Length +=
StrLen (Question->VariableName) + 1;
746 ConfigRequest =
AllocatePool ((Length + 1) *
sizeof (CHAR16));
747 if (ConfigRequest ==
NULL) {
752 if (IsBufferStorage) {
753 StrCatS (ConfigRequest, Length + 1, Question->BlockName);
755 StrCatS (ConfigRequest, Length + 1, L
"&");
756 StrCatS (ConfigRequest, Length + 1, Question->VariableName);
762 Status = HiiConfigRouting->ExtractConfig (
769 if (EFI_ERROR (Status)) {
773 if (IsBufferStorage) {
774 ValueStr =
StrStr (Result, L
"&VALUE");
775 if (ValueStr ==
NULL) {
780 ValueStr = ValueStr + 6;
782 ValueStr = Result + Length;
785 if (*ValueStr !=
'=') {
792 if (EFI_ERROR (Status)) {
797 if (Result !=
NULL) {
801 return QuestionValue;
BOOLEAN EFIAPI IsNull(IN CONST LIST_ENTRY *List, IN CONST LIST_ENTRY *Node)
UINTN EFIAPI StrSize(IN CONST CHAR16 *String)
BOOLEAN EFIAPI IsListEmpty(IN CONST LIST_ENTRY *ListHead)
RETURN_STATUS EFIAPI StrCpyS(OUT CHAR16 *Destination, IN UINTN DestMax, IN CONST CHAR16 *Source)
LIST_ENTRY *EFIAPI GetNextNode(IN CONST LIST_ENTRY *List, IN CONST LIST_ENTRY *Node)
LIST_ENTRY *EFIAPI GetFirstNode(IN CONST LIST_ENTRY *List)
RETURN_STATUS EFIAPI StrCatS(IN OUT CHAR16 *Destination, IN UINTN DestMax, IN CONST CHAR16 *Source)
UINTN EFIAPI StrnLenS(IN CONST CHAR16 *String, IN UINTN MaxSize)
LIST_ENTRY *EFIAPI RemoveEntryList(IN CONST LIST_ENTRY *Entry)
UINTN EFIAPI StrLen(IN CONST CHAR16 *String)
CHAR16 *EFIAPI StrStr(IN CONST CHAR16 *String, IN CONST CHAR16 *SearchString)
VOID *EFIAPI CopyMem(OUT VOID *DestinationBuffer, IN CONST VOID *SourceBuffer, IN UINTN Length)
VOID *EFIAPI AllocateZeroPool(IN UINTN AllocationSize)
VOID EFIAPI FreePool(IN VOID *Buffer)
VOID *EFIAPI AllocateCopyPool(IN UINTN AllocationSize, IN CONST VOID *Buffer)
EFI_STRING_ID NewHiiString(IN CHAR16 *String, IN EFI_HII_HANDLE HiiHandle)
VOID LoadFormSetStorage(IN HII_FORMSET *FormSet, IN HII_FORMSET_STORAGE *Storage)
CHAR16 * GetTokenString(IN EFI_STRING_ID Token, IN EFI_HII_HANDLE HiiHandle)
EFI_STATUS BufferToQuestionValue(IN HII_STATEMENT *Question, IN CHAR16 *Value, OUT HII_STATEMENT_VALUE *QuestionValue)
EFI_STRING EFIAPI HiiGetString(IN EFI_HII_HANDLE HiiHandle, IN EFI_STRING_ID StringId, IN CONST CHAR8 *Language OPTIONAL)
VOID DestroyFormSet(IN OUT HII_FORMSET *FormSet)
EFI_STATUS SetQuestionValue(IN HII_FORMSET *FormSet, IN HII_FORM *Form, IN OUT HII_STATEMENT *Question, IN HII_STATEMENT_VALUE *QuestionValue)
EFI_STATUS CreateFormSetFromHiiHandle(IN EFI_HII_HANDLE Handle, IN OUT EFI_GUID *FormSetGuid, OUT HII_FORMSET *FormSet)
HII_STATEMENT_VALUE * RetrieveQuestion(IN HII_FORMSET *FormSet, IN HII_FORM *Form, IN OUT HII_STATEMENT *Question)
VOID InitializeFormSet(IN OUT HII_FORMSET *FormSet)
EFI_STATUS SubmitForm(IN HII_FORMSET *FormSet, IN HII_FORM *Form)
EFI_STATUS EvaluateHiiExpression(IN HII_FORMSET *FormSet, IN HII_FORM *Form, IN OUT HII_EXPRESSION *Expression)
EFI_STATUS ParseOpCodes(IN FORM_BROWSER_FORMSET *FormSet)
VOID DestroyForm(IN FORM_BROWSER_FORMSET *FormSet, IN OUT FORM_BROWSER_FORM *Form)
FORMSET_STORAGE * GetFstStgFromVarId(IN FORM_BROWSER_FORMSET *FormSet, IN EFI_VARSTORE_ID VarStoreId)
RETURN_STATUS EFIAPI UnicodeValueToStringS(IN OUT CHAR16 *Buffer, IN UINTN BufferSize, IN UINTN Flags, IN INT64 Value, IN UINTN Width)
EFI_RUNTIME_SERVICES * gRT
VOID *EFIAPI AllocatePool(IN UINTN AllocationSize)
EFI_STATUS SetValueByName(IN BROWSER_STORAGE *Storage, IN CHAR16 *Name, IN CHAR16 *Value, IN GET_SET_QUESTION_VALUE_WITH SetValueTo, OUT NAME_VALUE_NODE **ReturnNode)
EFI_STATUS NoSubmitCheck(IN FORM_BROWSER_FORMSET *FormSet, IN OUT FORM_BROWSER_FORM **CurrentForm, OUT FORM_BROWSER_STATEMENT **Statement)
EFI_STATUS GetIfrBinaryData(IN EFI_HII_HANDLE Handle, IN OUT EFI_GUID *FormSetGuid, OUT UINTN *BinaryLength, OUT UINT8 **BinaryData)
VOID SetBitsQuestionValue(IN FORM_BROWSER_STATEMENT *Question, IN OUT UINT8 *Buffer, IN UINT32 Value)
EFI_STATUS StorageToConfigResp(IN BROWSER_STORAGE *Storage, IN CHAR16 **ConfigResp, IN CHAR16 *ConfigRequest, IN BOOLEAN GetEditBuf)
@ TypeValue
A flag that has some data following it with a space (IE "-a 1").
HII_FORMSET_STORAGE * Storage
Point to the storage that store this question.
Definition of HII_FORM_CONFIG_REQUEST.
CHAR16 * ConfigRequest
<ConfigRequest> = <ConfigHdr> + <RequestElement>
UINTN ElementCount
Number of <RequestElement> in the <ConfigRequest>
LIST_ENTRY StatementListHead
List of Statements and Questions (HII_STATEMENT)
UINT8 * Buffer
Buffer storage.
EFI_GUID Guid
VarStore Guid.
CHAR16 * ConfigHdr
<ConfigHdr>