TianoCore EDK2 master
Loading...
Searching...
No Matches
HiiUtilityLib.c
Go to the documentation of this file.
1
12#include "HiiInternal.h"
13
31 IN EFI_HII_HANDLE Handle,
32 IN OUT EFI_GUID *FormSetGuid,
33 OUT HII_FORMSET *FormSet
34 )
35{
36 EFI_STATUS Status;
37 EFI_HANDLE DriverHandle;
38 EFI_HII_DATABASE_PROTOCOL *HiiDatabase;
39
40 if ((FormSetGuid == NULL) || (FormSet == NULL)) {
41 return EFI_INVALID_PARAMETER;
42 }
43
44 //
45 // Locate required Hii Database protocol
46 //
47 Status = gBS->LocateProtocol (
48 &gEfiHiiDatabaseProtocolGuid,
49 NULL,
50 (VOID **)&HiiDatabase
51 );
52 if (EFI_ERROR (Status)) {
53 return Status;
54 }
55
56 Status = GetIfrBinaryData (Handle, FormSetGuid, &FormSet->IfrBinaryLength, &FormSet->IfrBinaryData);
57 if (EFI_ERROR (Status)) {
58 return Status;
59 }
60
61 FormSet->Signature = HII_FORMSET_SIGNATURE;
62 FormSet->HiiHandle = Handle;
63 CopyMem (&FormSet->Guid, FormSetGuid, sizeof (EFI_GUID));
64 //
65 // Retrieve ConfigAccess Protocol associated with this HiiPackageList
66 //
67 Status = HiiDatabase->GetPackageListHandle (HiiDatabase, Handle, &DriverHandle);
68 if (EFI_ERROR (Status)) {
69 return Status;
70 }
71
72 FormSet->DriverHandle = DriverHandle;
73 Status = gBS->HandleProtocol (
74 DriverHandle,
75 &gEfiHiiConfigAccessProtocolGuid,
76 (VOID **)&FormSet->ConfigAccess
77 );
78 if (EFI_ERROR (Status)) {
79 //
80 // Configuration Driver don't attach ConfigAccess protocol to its HII package
81 // list, then there will be no configuration action required
82 //
83 FormSet->ConfigAccess = NULL;
84 }
85
86 Status = gBS->HandleProtocol (
87 DriverHandle,
88 &gEfiDevicePathProtocolGuid,
89 (VOID **)&FormSet->DevicePath
90 );
91 if (EFI_ERROR (Status)) {
92 //
93 // Configuration Driver don't attach ConfigAccess protocol to its HII package
94 // list, then there will be no configuration action required
95 //
96 FormSet->DevicePath = NULL;
97 }
98
99 //
100 // Parse the IFR binary OpCodes
101 //
102 Status = ParseOpCodes (FormSet);
103
104 return Status;
105}
106
113VOID
115 IN OUT HII_FORMSET *FormSet
116 )
117{
118 LIST_ENTRY *Link;
119 HII_FORMSET_STORAGE *Storage;
120 LIST_ENTRY *FormLink;
121 HII_STATEMENT *Question;
122 HII_FORM *Form;
123
124 if (FormSet == NULL) {
125 return;
126 }
127
128 //
129 // Load Storage for all questions with storage
130 //
131 Link = GetFirstNode (&FormSet->StorageListHead);
132 while (!IsNull (&FormSet->StorageListHead, Link)) {
133 Storage = HII_STORAGE_FROM_LINK (Link);
134 LoadFormSetStorage (FormSet, Storage);
135 Link = GetNextNode (&FormSet->StorageListHead, Link);
136 }
137
138 //
139 // Get Current Value for all no storage questions
140 //
141 FormLink = GetFirstNode (&FormSet->FormListHead);
142 while (!IsNull (&FormSet->FormListHead, FormLink)) {
143 Form = HII_FORM_FROM_LINK (FormLink);
144 Link = GetFirstNode (&Form->StatementListHead);
145 while (!IsNull (&Form->StatementListHead, Link)) {
146 Question = HII_STATEMENT_FROM_LINK (Link);
147 if (Question->Storage == NULL) {
148 RetrieveQuestion (FormSet, Form, Question);
149 }
150
151 Link = GetNextNode (&Form->StatementListHead, Link);
152 }
153
154 FormLink = GetNextNode (&FormSet->FormListHead, FormLink);
155 }
156}
157
164VOID
166 IN OUT HII_FORMSET *FormSet
167 )
168{
169 LIST_ENTRY *Link;
170 HII_FORMSET_STORAGE *Storage;
171 HII_FORMSET_DEFAULTSTORE *DefaultStore;
172 HII_FORM *Form;
173
174 if (FormSet->IfrBinaryData == NULL) {
175 //
176 // Uninitialized FormSet
177 //
178 FreePool (FormSet);
179 return;
180 }
181
182 //
183 // Free IFR binary buffer
184 //
185 FreePool (FormSet->IfrBinaryData);
186
187 //
188 // Free FormSet Storage
189 //
190 if (FormSet->StorageListHead.ForwardLink != NULL) {
191 while (!IsListEmpty (&FormSet->StorageListHead)) {
192 Link = GetFirstNode (&FormSet->StorageListHead);
193 Storage = HII_STORAGE_FROM_LINK (Link);
194 RemoveEntryList (&Storage->Link);
195
196 if (Storage != NULL) {
197 FreePool (Storage);
198 }
199 }
200 }
201
202 //
203 // Free FormSet Default Store
204 //
205 if (FormSet->DefaultStoreListHead.ForwardLink != NULL) {
206 while (!IsListEmpty (&FormSet->DefaultStoreListHead)) {
207 Link = GetFirstNode (&FormSet->DefaultStoreListHead);
208 DefaultStore = HII_FORMSET_DEFAULTSTORE_FROM_LINK (Link);
209 RemoveEntryList (&DefaultStore->Link);
210
211 FreePool (DefaultStore);
212 }
213 }
214
215 //
216 // Free Forms
217 //
218 if (FormSet->FormListHead.ForwardLink != NULL) {
219 while (!IsListEmpty (&FormSet->FormListHead)) {
220 Link = GetFirstNode (&FormSet->FormListHead);
221 Form = HII_FORM_FROM_LINK (Link);
222 RemoveEntryList (&Form->Link);
223
224 DestroyForm (FormSet, Form);
225 }
226 }
227
228 FreePool (FormSet);
229}
230
243 IN HII_FORMSET *FormSet,
244 IN HII_FORM *Form
245 )
246{
247 EFI_STATUS Status;
248 EFI_HII_CONFIG_ROUTING_PROTOCOL *HiiConfigRouting;
249 LIST_ENTRY *Link;
250 EFI_STRING ConfigResp;
251 EFI_STRING Progress;
252 HII_FORMSET_STORAGE *Storage;
253 HII_FORM_CONFIG_REQUEST *ConfigInfo;
254
255 if ((FormSet == NULL) || (Form == NULL)) {
256 return EFI_INVALID_PARAMETER;
257 }
258
259 Status = NoSubmitCheck (FormSet, &Form, NULL);
260 if (EFI_ERROR (Status)) {
261 return Status;
262 }
263
264 Link = GetFirstNode (&Form->ConfigRequestHead);
265 while (!IsNull (&Form->ConfigRequestHead, Link)) {
266 ConfigInfo = HII_FORM_CONFIG_REQUEST_FROM_LINK (Link);
267 Link = GetNextNode (&Form->ConfigRequestHead, Link);
268
269 Storage = ConfigInfo->Storage;
270 if (Storage->Type == EFI_HII_VARSTORE_EFI_VARIABLE) {
271 continue;
272 }
273
274 //
275 // Skip if there is no RequestElement
276 //
277 if (ConfigInfo->ElementCount == 0) {
278 continue;
279 }
280
281 Status = StorageToConfigResp (ConfigInfo->Storage, &ConfigResp, ConfigInfo->ConfigRequest);
282 if (EFI_ERROR (Status)) {
283 return Status;
284 }
285
286 Status = gBS->LocateProtocol (
287 &gEfiHiiConfigRoutingProtocolGuid,
288 NULL,
289 (VOID **)&HiiConfigRouting
290 );
291 if (EFI_ERROR (Status)) {
292 return Status;
293 }
294
295 Status = HiiConfigRouting->RouteConfig (
296 HiiConfigRouting,
297 ConfigResp,
298 &Progress
299 );
300
301 if (EFI_ERROR (Status)) {
302 FreePool (ConfigResp);
303 continue;
304 }
305
306 FreePool (ConfigResp);
307 }
308
309 return Status;
310}
311
326 IN HII_FORMSET *FormSet,
327 IN HII_FORM *Form,
328 IN OUT HII_STATEMENT *Question,
329 IN HII_STATEMENT_VALUE *QuestionValue
330 )
331{
332 UINT8 *Src;
333 UINTN BufferLen;
334 UINTN StorageWidth;
335 HII_FORMSET_STORAGE *Storage;
336 CHAR16 *ValueStr;
337 BOOLEAN IsBufferStorage;
338 UINT8 *TemBuffer;
339 CHAR16 *TemName;
340 CHAR16 *TemString;
341 UINTN Index;
343 EFI_STATUS Status;
344
345 if ((FormSet == NULL) || (Form == NULL) || (Question == NULL) || (QuestionValue == NULL)) {
346 return EFI_INVALID_PARAMETER;
347 }
348
349 Status = EFI_SUCCESS;
350 Node = NULL;
351
352 //
353 // If Question value is provided by an Expression, then it is read only
354 //
355 if ((Question->ValueExpression != NULL) || (Question->Value.Type != QuestionValue->Type)) {
356 return EFI_INVALID_PARAMETER;
357 }
358
359 //
360 // Before set question value, evaluate its write expression.
361 //
362 if ((Question->WriteExpression != NULL) && (Form->FormType == STANDARD_MAP_FORM_TYPE)) {
363 Status = EvaluateHiiExpression (FormSet, Form, Question->WriteExpression);
364 if (EFI_ERROR (Status)) {
365 return Status;
366 }
367 }
368
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;
374 Question->Value.Buffer = AllocateCopyPool (QuestionValue->BufferLen, QuestionValue->Buffer);
375 if (Question->Value.Buffer == NULL) {
376 return EFI_OUT_OF_RESOURCES;
377 }
378
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) {
385 return EFI_ABORTED;
386 }
387
388 Question->Value.BufferLen = Question->StorageWidth;
389 Question->Value.Buffer = AllocateZeroPool (Question->StorageWidth);
390 if (Question->Value.Buffer == NULL) {
391 FreePool (TemString);
392 return EFI_OUT_OF_RESOURCES;
393 }
394
395 CopyMem (Question->Value.Buffer, TemString, StrSize (TemString));
396 Src = Question->Value.Buffer;
397 FreePool (TemString);
398 } else {
399 CopyMem (&Question->Value.Value, &QuestionValue->Value, sizeof (EFI_IFR_TYPE_VALUE));
400 Src = (UINT8 *)&Question->Value.Value;
401 }
402
403 if ((Storage->Type == EFI_HII_VARSTORE_BUFFER) || (Storage->Type == EFI_HII_VARSTORE_EFI_VARIABLE_BUFFER)) {
404 IsBufferStorage = TRUE;
405 } else {
406 IsBufferStorage = FALSE;
407 }
408
409 if (IsBufferStorage) {
410 //
411 // If the Question refer to bit filed, copy the value in related bit filed to storage edit buffer.
412 //
413 if (Question->QuestionReferToBitField) {
414 SetBitsQuestionValue (Question, Storage->Buffer + Question->VarStoreInfo.VarOffset, (UINT32)(*Src));
415 } else {
416 CopyMem (Storage->Buffer + Question->VarStoreInfo.VarOffset, Src, StorageWidth);
417 }
418 } else {
419 if (Question->Value.Type == EFI_IFR_TYPE_STRING) {
420 //
421 // Allocate enough string buffer.
422 //
423 ValueStr = NULL;
424 BufferLen = ((StrLen ((CHAR16 *)Src) * 4) + 1) * sizeof (CHAR16);
425 ValueStr = AllocatePool (BufferLen);
426 if (ValueStr == NULL) {
427 if (Question->Value.Buffer != NULL) {
428 FreePool (Question->Value.Buffer);
429 }
430
431 return EFI_OUT_OF_RESOURCES;
432 }
433
434 //
435 // Convert Unicode String to Config String, e.g. "ABCD" => "0041004200430044"
436 //
437 TemName = (CHAR16 *)Src;
438 TemString = ValueStr;
439 for ( ; *TemName != L'\0'; TemName++) {
441 TemString,
442 BufferLen - ((UINTN)TemString - (UINTN)ValueStr),
443 PREFIX_ZERO | RADIX_HEX,
444 *TemName,
445 4
446 );
447 TemString += StrnLenS (TemString, (BufferLen - ((UINTN)TemString - (UINTN)ValueStr)) / sizeof (CHAR16));
448 }
449 } else {
450 BufferLen = StorageWidth * 2 + 1;
451 ValueStr = AllocateZeroPool (BufferLen * sizeof (CHAR16));
452 if (ValueStr == NULL) {
453 if (Question->Value.Buffer != NULL) {
454 FreePool (Question->Value.Buffer);
455 }
456
457 return EFI_OUT_OF_RESOURCES;
458 }
459
460 //
461 // Convert Buffer to Hex String
462 //
463 TemBuffer = Src + StorageWidth - 1;
464 TemString = ValueStr;
465 for (Index = 0; Index < StorageWidth; Index++, TemBuffer--) {
467 TemString,
468 BufferLen * sizeof (CHAR16) - ((UINTN)TemString - (UINTN)ValueStr),
469 PREFIX_ZERO | RADIX_HEX,
470 *TemBuffer,
471 2
472 );
473 TemString += StrnLenS (TemString, BufferLen - ((UINTN)TemString - (UINTN)ValueStr) / sizeof (CHAR16));
474 }
475 }
476
477 Status = SetValueByName (Storage, Question->VariableName, ValueStr, &Node);
478 FreePool (ValueStr);
479 if (EFI_ERROR (Status)) {
480 if (Question->Value.Buffer != NULL) {
481 FreePool (Question->Value.Buffer);
482 }
483
484 return Status;
485 }
486 }
487 } else {
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;
493 }
494
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) {
500 return EFI_ABORTED;
501 }
502
503 Question->Value.BufferLen = (UINT16)StrSize (TemString);
504 Question->Value.Buffer = AllocateZeroPool (QuestionValue->BufferLen);
505 if (Question->Value.Buffer == NULL) {
506 FreePool (TemString);
507 return EFI_OUT_OF_RESOURCES;
508 }
509
510 CopyMem (Question->Value.Buffer, TemString, StrSize (TemString));
511 FreePool (TemString);
512 } else {
513 CopyMem (&Question->Value.Value, &QuestionValue->Value, sizeof (EFI_IFR_TYPE_VALUE));
514 }
515 }
516
517 return Status;
518}
519
533 IN HII_FORMSET *FormSet,
534 IN HII_FORM *Form,
535 IN OUT HII_STATEMENT *Question
536 )
537{
538 EFI_STATUS Status;
539 EFI_HII_CONFIG_ROUTING_PROTOCOL *HiiConfigRouting;
540 EFI_BROWSER_ACTION_REQUEST ActionRequest;
541 HII_FORMSET_STORAGE *Storage;
542 HII_STATEMENT_VALUE *QuestionValue;
544 EFI_TIME EfiTime;
545 BOOLEAN Enabled;
546 BOOLEAN Pending;
547 UINT8 *Dst;
548 UINTN StorageWidth;
549 CHAR16 *ConfigRequest;
550 CHAR16 *Progress;
551 CHAR16 *Result;
552 CHAR16 *ValueStr;
553 UINTN Length;
554 BOOLEAN IsBufferStorage;
555 CHAR16 *NewHiiString;
556
557 if ((FormSet == NULL) || (Form == NULL) || (Question == NULL)) {
558 return NULL;
559 }
560
561 Status = EFI_SUCCESS;
562 ValueStr = NULL;
563 Result = NULL;
564
565 QuestionValue = AllocateZeroPool (sizeof (HII_STATEMENT_VALUE));
566 if (QuestionValue == NULL) {
567 return NULL;
568 }
569
570 QuestionValue->Type = Question->Value.Type;
571 QuestionValue->BufferLen = Question->Value.BufferLen;
572 if (QuestionValue->BufferLen != 0) {
573 QuestionValue->Buffer = AllocateZeroPool (QuestionValue->BufferLen);
574 if (QuestionValue->Buffer == NULL) {
575 FreePool (QuestionValue);
576 return NULL;
577 }
578 }
579
580 //
581 // Question value is provided by RTC
582 //
583 Storage = Question->Storage;
584 StorageWidth = Question->StorageWidth;
585
586 if (Storage == NULL) {
587 //
588 // It's a Question without storage, or RTC date/time
589 //
590 if ((Question->Operand == EFI_IFR_DATE_OP) || (Question->Operand == EFI_IFR_TIME_OP)) {
591 //
592 // Date and time define the same Flags bit
593 //
594 switch (Question->ExtraData.Flags & EFI_QF_DATE_STORAGE) {
595 case QF_DATE_STORAGE_TIME:
596
597 Status = gRT->GetTime (&EfiTime, NULL);
598 break;
599
600 case QF_DATE_STORAGE_WAKEUP:
601
602 Status = gRT->GetWakeupTime (&Enabled, &Pending, &EfiTime);
603 break;
604
605 case QF_DATE_STORAGE_NORMAL:
606 default:
607
608 goto ON_ERROR;
609 }
610
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;
616 } else {
617 QuestionValue->Value.time.Hour = 0xff;
618 QuestionValue->Value.time.Minute = 0xff;
619 QuestionValue->Value.time.Second = 0xff;
620 }
621
622 return QuestionValue;
623 }
624
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;
629 } else {
630 QuestionValue->Value.time.Hour = EfiTime.Hour;
631 QuestionValue->Value.time.Minute = EfiTime.Minute;
632 QuestionValue->Value.time.Second = EfiTime.Second;
633 }
634 } else {
635 if (((Question->QuestionFlags & EFI_IFR_FLAG_CALLBACK) != EFI_IFR_FLAG_CALLBACK) ||
636 (FormSet->ConfigAccess == NULL))
637 {
638 goto ON_ERROR;
639 }
640
641 if (QuestionValue->Type == EFI_IFR_TYPE_BUFFER) {
642 //
643 // For OrderedList, passing in the value buffer to Callback()
644 //
645 TypeValue = (EFI_IFR_TYPE_VALUE *)QuestionValue->Buffer;
646 } else {
647 TypeValue = &QuestionValue->Value;
648 }
649
650 ActionRequest = EFI_BROWSER_ACTION_REQUEST_NONE;
651 Status = FormSet->ConfigAccess->Callback (
652 FormSet->ConfigAccess,
653 EFI_BROWSER_ACTION_RETRIEVE,
654 Question->QuestionId,
655 QuestionValue->Type,
656 TypeValue,
657 &ActionRequest
658 );
659
660 if (!EFI_ERROR (Status) && (QuestionValue->Type == EFI_IFR_TYPE_STRING)) {
661 if (TypeValue->string == 0) {
662 goto ON_ERROR;
663 }
664
665 NewHiiString = GetTokenString (TypeValue->string, FormSet->HiiHandle);
666 if (NewHiiString == NULL) {
667 goto ON_ERROR;
668 }
669
670 QuestionValue->Buffer = AllocatePool (StrSize (NewHiiString));
671 if (QuestionValue->Buffer == NULL) {
673 goto ON_ERROR;
674 }
675
676 CopyMem (QuestionValue->Buffer, NewHiiString, StrSize (NewHiiString));
677 QuestionValue->BufferLen = (UINT16)StrSize (NewHiiString);
678
680 }
681 }
682
683 return QuestionValue;
684 }
685
686 //
687 // Question value is provided by EFI variable
688 //
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;
693 } else {
694 Dst = (UINT8 *)&QuestionValue->Value;
695 StorageWidth = sizeof (EFI_IFR_TYPE_VALUE);
696 }
697
698 Status = gRT->GetVariable (
699 Question->VariableName,
700 &Storage->Guid,
701 NULL,
702 &StorageWidth,
703 Dst
704 );
705
706 return QuestionValue;
707 }
708
709 Status = gBS->LocateProtocol (
710 &gEfiHiiConfigRoutingProtocolGuid,
711 NULL,
712 (VOID **)&HiiConfigRouting
713 );
714 if (EFI_ERROR (Status)) {
715 goto ON_ERROR;
716 }
717
718 if (QuestionValue->BufferLen != 0) {
719 Dst = QuestionValue->Buffer;
720 } else {
721 Dst = (UINT8 *)&QuestionValue->Value;
722 }
723
724 if ((Storage->Type == EFI_HII_VARSTORE_BUFFER) || (Storage->Type == EFI_HII_VARSTORE_EFI_VARIABLE_BUFFER)) {
725 IsBufferStorage = TRUE;
726 } else {
727 IsBufferStorage = FALSE;
728 }
729
730 Storage = GetFstStgFromVarId (FormSet, Question->VarStoreId);
731 if (Storage == NULL) {
732 goto ON_ERROR;
733 }
734
735 //
736 // <ConfigRequest> ::= <ConfigHdr> + <BlockName> || <ConfigHdr> + "&" + <VariableName>
737 //
738 if (IsBufferStorage) {
739 Length = StrLen (Storage->ConfigHdr);
740 Length += StrLen (Question->BlockName);
741 } else {
742 Length = StrLen (Storage->ConfigHdr);
743 Length += StrLen (Question->VariableName) + 1;
744 }
745
746 ConfigRequest = AllocatePool ((Length + 1) * sizeof (CHAR16));
747 if (ConfigRequest == NULL) {
748 goto ON_ERROR;
749 }
750
751 StrCpyS (ConfigRequest, Length + 1, Storage->ConfigHdr);
752 if (IsBufferStorage) {
753 StrCatS (ConfigRequest, Length + 1, Question->BlockName);
754 } else {
755 StrCatS (ConfigRequest, Length + 1, L"&");
756 StrCatS (ConfigRequest, Length + 1, Question->VariableName);
757 }
758
759 //
760 // Request current settings from Configuration Driver
761 //
762 Status = HiiConfigRouting->ExtractConfig (
763 HiiConfigRouting,
764 ConfigRequest,
765 &Progress,
766 &Result
767 );
768 FreePool (ConfigRequest);
769 if (EFI_ERROR (Status)) {
770 goto ON_ERROR;
771 }
772
773 if (IsBufferStorage) {
774 ValueStr = StrStr (Result, L"&VALUE");
775 if (ValueStr == NULL) {
776 FreePool (Result);
777 goto ON_ERROR;
778 }
779
780 ValueStr = ValueStr + 6;
781 } else {
782 ValueStr = Result + Length;
783 }
784
785 if (*ValueStr != '=') {
786 FreePool (Result);
787 goto ON_ERROR;
788 }
789
790 ValueStr++;
791 Status = BufferToQuestionValue (Question, ValueStr, QuestionValue);
792 if (EFI_ERROR (Status)) {
793 FreePool (Result);
794 goto ON_ERROR;
795 }
796
797 if (Result != NULL) {
798 FreePool (Result);
799 }
800
801 return QuestionValue;
802
803ON_ERROR:
804
805 if (QuestionValue->Buffer != NULL) {
806 FreePool (QuestionValue->Buffer);
807 }
808
809 FreePool (QuestionValue);
810
811 return NULL;
812}
UINT64 UINTN
BOOLEAN EFIAPI IsNull(IN CONST LIST_ENTRY *List, IN CONST LIST_ENTRY *Node)
Definition: LinkedList.c:443
UINTN EFIAPI StrSize(IN CONST CHAR16 *String)
Definition: String.c:72
BOOLEAN EFIAPI IsListEmpty(IN CONST LIST_ENTRY *ListHead)
Definition: LinkedList.c:403
RETURN_STATUS EFIAPI StrCpyS(OUT CHAR16 *Destination, IN UINTN DestMax, IN CONST CHAR16 *Source)
Definition: SafeString.c:226
LIST_ENTRY *EFIAPI GetNextNode(IN CONST LIST_ENTRY *List, IN CONST LIST_ENTRY *Node)
Definition: LinkedList.c:333
LIST_ENTRY *EFIAPI GetFirstNode(IN CONST LIST_ENTRY *List)
Definition: LinkedList.c:298
RETURN_STATUS EFIAPI StrCatS(IN OUT CHAR16 *Destination, IN UINTN DestMax, IN CONST CHAR16 *Source)
Definition: SafeString.c:405
UINTN EFIAPI StrnLenS(IN CONST CHAR16 *String, IN UINTN MaxSize)
Definition: SafeString.c:119
LIST_ENTRY *EFIAPI RemoveEntryList(IN CONST LIST_ENTRY *Entry)
Definition: LinkedList.c:590
UINTN EFIAPI StrLen(IN CONST CHAR16 *String)
Definition: String.c:30
CHAR16 *EFIAPI StrStr(IN CONST CHAR16 *String, IN CONST CHAR16 *SearchString)
Definition: String.c:224
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)
Definition: HiiString.c:211
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)
Definition: HiiUtilityLib.c:30
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)
Definition: IfrParse.c:1161
VOID DestroyForm(IN FORM_BROWSER_FORMSET *FormSet, IN OUT FORM_BROWSER_FORM *Form)
Definition: IfrParse.c:880
FORMSET_STORAGE * GetFstStgFromVarId(IN FORM_BROWSER_FORMSET *FormSet, IN EFI_VARSTORE_ID VarStoreId)
Definition: IfrParse.c:467
RETURN_STATUS EFIAPI UnicodeValueToStringS(IN OUT CHAR16 *Buffer, IN UINTN BufferSize, IN UINTN Flags, IN INT64 Value, IN UINTN Width)
Definition: PrintLib.c:652
EFI_RUNTIME_SERVICES * gRT
#define NULL
Definition: Base.h:319
#define TRUE
Definition: Base.h:301
#define FALSE
Definition: Base.h:307
#define IN
Definition: Base.h:279
#define OUT
Definition: Base.h:284
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)
Definition: Setup.c:1163
EFI_STATUS NoSubmitCheck(IN FORM_BROWSER_FORMSET *FormSet, IN OUT FORM_BROWSER_FORM **CurrentForm, OUT FORM_BROWSER_STATEMENT **Statement)
Definition: Setup.c:2406
EFI_STATUS GetIfrBinaryData(IN EFI_HII_HANDLE Handle, IN OUT EFI_GUID *FormSetGuid, OUT UINTN *BinaryLength, OUT UINT8 **BinaryData)
Definition: Setup.c:5843
VOID SetBitsQuestionValue(IN FORM_BROWSER_STATEMENT *Question, IN OUT UINT8 *Buffer, IN UINT32 Value)
Definition: Setup.c:1419
EFI_STATUS StorageToConfigResp(IN BROWSER_STORAGE *Storage, IN CHAR16 **ConfigResp, IN CHAR16 *ConfigRequest, IN BOOLEAN GetEditBuf)
Definition: Setup.c:1228
@ TypeValue
A flag that has some data following it with a space (IE "-a 1").
Definition: ShellLib.h:700
RETURN_STATUS EFI_STATUS
Definition: UefiBaseType.h:29
VOID * EFI_HANDLE
Definition: UefiBaseType.h:33
#define EFI_SUCCESS
Definition: UefiBaseType.h:112
EFI_BOOT_SERVICES * gBS
VOID * EFI_HII_HANDLE
HII_FORMSET_STORAGE * Storage
Point to the storage that store this question.
Definition: Base.h:213
Definition of HII_FORM_CONFIG_REQUEST.
Definition: HiiInternal.h:48
CHAR16 * ConfigRequest
<ConfigRequest> = <ConfigHdr> + <RequestElement>
Definition: HiiInternal.h:52
UINTN ElementCount
Number of <RequestElement> in the <ConfigRequest>
Definition: HiiInternal.h:54
LIST_ENTRY StatementListHead
List of Statements and Questions (HII_STATEMENT)
UINT8 * Buffer
Buffer storage.
Definition: HiiUtilityLib.h:79
EFI_GUID Guid
VarStore Guid.
Definition: HiiDatabase.h:144
UINT8 Type
Storage type.
Definition: HiiDatabase.h:143
CHAR16 * ConfigHdr
<ConfigHdr>
Definition: HiiUtilityLib.h:92