1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
|
/**@file
This file contains the keyboard processing code to the HII database.
Copyright (c) 2006 - 2008, Intel Corporation
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
#include "HiiDatabase.h"
#include "HiiHandle.h"
EFI_GUID gFrameworkHiiCompatbilityGuid = EFI_IFR_FRAMEWORK_GUID;
EFI_GUID gTianoHiiIfrGuid = EFI_IFR_TIANO_GUID;
EFI_HII_HANDLE
FwHiiHandleToUefiHiiHandle (
IN CONST HII_THUNK_PRIVATE_DATA *Private,
IN FRAMEWORK_EFI_HII_HANDLE FwHiiHandle
)
{
HII_THUNK_CONTEXT *ThunkContext;
ASSERT (FwHiiHandle != (FRAMEWORK_EFI_HII_HANDLE) 0);
ASSERT (Private != NULL);
ThunkContext = FwHiiHandleToThunkContext (Private, FwHiiHandle);
if (ThunkContext != NULL) {
return ThunkContext->UefiHiiHandle;
}
return (EFI_HII_HANDLE) NULL;
}
HII_THUNK_CONTEXT *
FwHiiHandleToThunkContext (
IN CONST HII_THUNK_PRIVATE_DATA *Private,
IN FRAMEWORK_EFI_HII_HANDLE FwHiiHandle
)
{
LIST_ENTRY *Link;
HII_THUNK_CONTEXT *ThunkContext;
Link = GetFirstNode (&Private->ThunkContextListHead);
while (!IsNull (&Private->ThunkContextListHead, Link)) {
ThunkContext = HII_THUNK_CONTEXT_FROM_LINK (Link);
if (FwHiiHandle == ThunkContext->FwHiiHandle) {
return ThunkContext;
}
Link = GetNextNode (&Private->ThunkContextListHead, Link);
}
return NULL;
}
HII_THUNK_CONTEXT *
UefiHiiHandleToThunkContext (
IN CONST HII_THUNK_PRIVATE_DATA *Private,
IN EFI_HII_HANDLE UefiHiiHandle
)
{
LIST_ENTRY *Link;
HII_THUNK_CONTEXT *ThunkContext;
Link = GetFirstNode (&Private->ThunkContextListHead);
while (!IsNull (&Private->ThunkContextListHead, Link)) {
ThunkContext = HII_THUNK_CONTEXT_FROM_LINK (Link);
if (UefiHiiHandle == ThunkContext->UefiHiiHandle) {
return ThunkContext;
}
Link = GetNextNode (&Private->ThunkContextListHead, Link);
}
return NULL;
}
HII_THUNK_CONTEXT *
TagGuidToIfrPackThunkContext (
IN CONST HII_THUNK_PRIVATE_DATA *Private,
IN CONST EFI_GUID *Guid
)
{
LIST_ENTRY *Link;
HII_THUNK_CONTEXT *ThunkContext;
Link = GetFirstNode (&Private->ThunkContextListHead);
while (!IsNull (&Private->ThunkContextListHead, Link)) {
ThunkContext = HII_THUNK_CONTEXT_FROM_LINK (Link);
if (CompareGuid (Guid, &ThunkContext->TagGuid) && (ThunkContext->IfrPackageCount != 0)) {
return ThunkContext;
}
Link = GetNextNode (&Private->ThunkContextListHead, Link);
}
return NULL;
}
VOID
DestroyThunkContextForUefiHiiHandle (
IN HII_THUNK_PRIVATE_DATA *Private,
IN EFI_HII_HANDLE UefiHiiHandle
)
{
HII_THUNK_CONTEXT *ThunkContext;
ThunkContext = UefiHiiHandleToThunkContext (Private, UefiHiiHandle);
ASSERT (ThunkContext != NULL);
DestroyThunkContext (ThunkContext);
}
/**
This function create a HII_THUNK_CONTEXT for a package list registered
by a module calling EFI_HII_DATABASE_PROTOCOL.NewPackageList. It records
the PackageListGuid in EFI_HII_PACKAGE_LIST_HEADER in the TagGuid in
HII_THUNK_CONTEXT created. This TagGuid will be used as a key to s
**/
HII_THUNK_CONTEXT *
CreateThunkContextForUefiHiiHandle (
IN EFI_HII_HANDLE UefiHiiHandle
)
{
EFI_STATUS Status;
EFI_GUID PackageGuid;
HII_THUNK_CONTEXT *ThunkContext;
ThunkContext = AllocateZeroPool (sizeof (*ThunkContext));
ASSERT (ThunkContext != NULL);
ThunkContext->Signature = HII_THUNK_CONTEXT_SIGNATURE;
Status = AllocateHiiHandle (&ThunkContext->FwHiiHandle);
if (EFI_ERROR (Status)) {
return NULL;
}
ThunkContext->UefiHiiHandle = UefiHiiHandle;
Status = HiiLibExtractGuidFromHiiHandle (UefiHiiHandle, &PackageGuid);
ASSERT_EFI_ERROR (Status);
CopyGuid(&ThunkContext->TagGuid, &PackageGuid);
InitializeListHead (&ThunkContext->QuestionIdMapListHead);
InitializeListHead (&ThunkContext->OneOfOptionMapListHead);
return ThunkContext;
}
UINTN
GetPackageCountByType (
IN CONST EFI_HII_PACKAGE_LIST_HEADER *PackageListHeader,
IN UINT8 PackageType
)
{
UINTN Count;
EFI_HII_PACKAGE_HEADER *PackageHeader;
PackageHeader = (EFI_HII_PACKAGE_HEADER *) ((UINT8 *) PackageListHeader + sizeof (EFI_HII_PACKAGE_LIST_HEADER));
Count = 0;
while (PackageHeader->Type != EFI_HII_PACKAGE_END) {
if (PackageHeader->Type == PackageType ) {
Count++;
}
PackageHeader = (EFI_HII_PACKAGE_HEADER *) ((UINT8 *) PackageHeader + PackageHeader->Length);
}
return Count;
}
LIST_ENTRY *
GetOneOfOptionMapEntryListHead (
IN CONST HII_THUNK_CONTEXT *ThunkContext,
IN UINT16 QuestionId
)
{
LIST_ENTRY *Link;
ONE_OF_OPTION_MAP *Map;
Link = GetFirstNode (&ThunkContext->OneOfOptionMapListHead);
while (!IsNull (&ThunkContext->OneOfOptionMapListHead, Link)) {
Map = ONE_OF_OPTION_MAP_FROM_LINK (Link);
if (QuestionId == Map->QuestionId) {
return &Map->OneOfOptionMapEntryListHead;
}
Link = GetNextNode (&ThunkContext->OneOfOptionMapListHead, Link);
}
return NULL;
}
EFI_HII_PACKAGE_HEADER *
GetIfrPackage (
IN CONST EFI_HII_PACKAGES *Packages
)
{
UINTN Index;
TIANO_AUTOGEN_PACKAGES_HEADER **TianoAutogenPackageHdrArray;
ASSERT (Packages != NULL);
TianoAutogenPackageHdrArray = (TIANO_AUTOGEN_PACKAGES_HEADER **) (((UINT8 *) &Packages->GuidId) + sizeof (Packages->GuidId));
for (Index = 0; Index < Packages->NumberOfPackages; Index++) {
//
// The current UEFI HII build tool generate a binary in the format defined by
// TIANO_AUTOGEN_PACKAGES_HEADER. We assume that all packages generated in
// this binary is with same package type. So the returned IfrPackageCount and StringPackageCount
// may not be the exact number of valid package number in the binary generated
// by HII Build tool.
//
switch (TianoAutogenPackageHdrArray[Index]->PackageHeader.Type) {
case EFI_HII_PACKAGE_FORM:
return &TianoAutogenPackageHdrArray[Index]->PackageHeader;
break;
case EFI_HII_PACKAGE_STRINGS:
case EFI_HII_PACKAGE_SIMPLE_FONTS:
break;
//
// The following fonts are invalid for a module that using Framework to UEFI thunk layer.
//
case EFI_HII_PACKAGE_KEYBOARD_LAYOUT:
case EFI_HII_PACKAGE_FONTS:
case EFI_HII_PACKAGE_IMAGES:
default:
ASSERT (FALSE);
return NULL;
break;
}
}
return NULL;
}
VOID
GetFormSetGuid (
IN EFI_HII_PACKAGE_HEADER *Package,
OUT EFI_GUID *FormSetGuid
)
{
UINTN Offset;
EFI_IFR_OP_HEADER *OpCode;
EFI_IFR_FORM_SET *FormSet;
Offset = sizeof (EFI_HII_PACKAGE_HEADER);
while (Offset < Package->Length) {
OpCode = (EFI_IFR_OP_HEADER *)((UINT8 *) Package + Offset);
switch (OpCode->OpCode) {
case EFI_IFR_FORM_SET_OP:
FormSet = (EFI_IFR_FORM_SET *) OpCode;
CopyMem (FormSetGuid, &FormSet->Guid, sizeof (EFI_GUID));
return;
default:
break;
}
Offset += OpCode->Length;
}
//
// A proper IFR must have a formset opcode.
//
ASSERT (FALSE);
}
VOID
GetAttributesOfFirstFormSet (
IN OUT HII_THUNK_CONTEXT *ThunkContext
)
{
EFI_STATUS Status;
EFI_HII_PACKAGE_LIST_HEADER *List;
EFI_HII_PACKAGE_HEADER *Package;
UINTN Size;
EFI_IFR_OP_HEADER *OpCode;
UINTN Offset;
EFI_IFR_GUID_CLASS *Class;
EFI_IFR_FORM_SET *FormSet;
EFI_IFR_GUID_SUBCLASS *SubClass;
Status = HiiLibExportPackageLists (ThunkContext->UefiHiiHandle, &List, &Size);
ASSERT_EFI_ERROR (Status);
//
// There must be at least one EFI_HII_PACKAGE_FORM in the package list.
//
ASSERT (GetPackageCountByType (List, EFI_HII_PACKAGE_FORM) >= 1);
//
// Skip the package list header.
//
Package = (EFI_HII_PACKAGE_HEADER *) (List + 1);
while (Package->Type != EFI_HII_PACKAGE_END) {
if (Package->Type == EFI_HII_PACKAGE_FORM) {
//
// Skip the package header
//
Offset = sizeof (EFI_HII_PACKAGE_HEADER);
while (Offset < Package->Length) {
OpCode = (EFI_IFR_OP_HEADER *)((UINT8 *) Package + Offset);
switch (OpCode->OpCode) {
case EFI_IFR_FORM_SET_OP:
FormSet = (EFI_IFR_FORM_SET *) OpCode;
ThunkContext->FormSetTitle = FormSet->FormSetTitle;
ThunkContext->FormSetHelp = FormSet->Help;
break;
case EFI_IFR_GUID_OP:
Class = (EFI_IFR_GUID_CLASS*) OpCode;
if (CompareMem (&Class->Guid, &gTianoHiiIfrGuid, sizeof (EFI_GUID)) == 0) {
Class = (EFI_IFR_GUID_CLASS *) OpCode;
switch (Class->ExtendOpCode) {
case EFI_IFR_EXTEND_OP_CLASS:
ThunkContext->FormSetClass = Class->Class;
break;
case EFI_IFR_EXTEND_OP_SUBCLASS:
SubClass = (EFI_IFR_GUID_SUBCLASS *) OpCode;
ThunkContext->FormSetSubClass = SubClass->SubClass;
break;
default:
break;
}
}
break;
default:
break;
}
Offset += OpCode->Length;
}
//
// The attributes of first FormSet is ready now.
//
FreePool (List);
return;
break;
}
Package = (EFI_HII_PACKAGE_HEADER *) ((UINT8 *) Package + Package->Length);
}
}
EFI_STATUS
CreateQuestionIdMap (
IN OUT HII_THUNK_CONTEXT *ThunkContext
)
{
EFI_STATUS Status;
EFI_HII_PACKAGE_LIST_HEADER *List;
EFI_HII_PACKAGE_HEADER *Package;
UINTN Size;
EFI_IFR_OP_HEADER *OpCode;
UINTN Offset;
QUESTION_ID_MAP *IdMap;
EFI_IFR_VARSTORE *VarStore;
EFI_IFR_FORM_SET *FormSet;
EFI_IFR_QUESTION_HEADER *Question;
LIST_ENTRY *QuestionIdMapEntryListHead;
LIST_ENTRY *OneOfOptinMapEntryListHead;
QUESTION_ID_MAP_ENTRY *IdMapEntry;
EFI_IFR_GUID_OPTIONKEY *OptionMap;
ONE_OF_OPTION_MAP *OneOfOptionMap;
ONE_OF_OPTION_MAP_ENTRY *OneOfOptionMapEntry;
EFI_IFR_GUID_CLASS *Class;
EFI_IFR_GUID_SUBCLASS *SubClass;
UINT8 OneOfType;
EFI_IFR_ONE_OF *OneOfOpcode;
//
// Set to a invalid value.
//
OneOfType = (UINT8) -1;
Status = HiiLibExportPackageLists (ThunkContext->UefiHiiHandle, &List, &Size);
if (EFI_ERROR (Status)) {
return Status;
}
//
// Get all VarStoreId and build the the QuestionId map.
// EFI_IFR_QUESTION_HEADER.VarStoreInfo.VarOffset -> Framework Question ID
// EFI_IFR_QUESTION_HEADER.QuestionId -> UEFI Question ID
//
//
// Skip the package list header.
//
Package = (EFI_HII_PACKAGE_HEADER *) (List + 1);
while (Package->Type != EFI_HII_PACKAGE_END) {
if (Package->Type == EFI_HII_PACKAGE_FORM) {
//
// Skip the package header
//
Offset = sizeof (EFI_HII_PACKAGE_HEADER);
while (Offset < Package->Length) {
OpCode = (EFI_IFR_OP_HEADER *)((UINT8 *) Package + Offset);
switch (OpCode->OpCode) {
case EFI_IFR_FORM_SET_OP:
FormSet = (EFI_IFR_FORM_SET *) OpCode;
ThunkContext->FormSetTitle = FormSet->FormSetTitle;
ThunkContext->FormSetHelp = FormSet->Help;
break;
case EFI_IFR_VARSTORE_OP:
//
// IFR built from Framework VFR only has UEFI Buffer Type Storage
//
VarStore = (EFI_IFR_VARSTORE *) OpCode;
IdMap = AllocateZeroPool (sizeof (QUESTION_ID_MAP));
ASSERT (IdMap != NULL);
IdMap->Signature = QUESTION_ID_MAP_SIGNATURE;
IdMap->VarStoreId = VarStore->VarStoreId;
IdMap->VarSize = VarStore->Size;
InitializeListHead (&IdMap->MapEntryListHead);
InsertTailList (&ThunkContext->QuestionIdMapListHead, &IdMap->Link);
break;
case EFI_IFR_NUMERIC_OP:
case EFI_IFR_CHECKBOX_OP:
case EFI_IFR_ONE_OF_OP:
case EFI_IFR_ORDERED_LIST_OP:
case EFI_IFR_STRING_OP:
//case EFI_IFR_PASSWORD_OP:
Question = (EFI_IFR_QUESTION_HEADER *)(OpCode + 1);
QuestionIdMapEntryListHead = GetMapEntryListHead (ThunkContext, Question->VarStoreId);
if (QuestionIdMapEntryListHead != NULL) {
//
// If the Question is using Buffer (EFI_IFR_VARSTORE_OP) type VarStore.
//
IdMapEntry = AllocateZeroPool (sizeof (QUESTION_ID_MAP_ENTRY));
ASSERT (IdMapEntry != NULL);
IdMapEntry->FwQId = Question->VarStoreInfo.VarOffset;
IdMapEntry->UefiQid = Question->QuestionId;
IdMapEntry->Signature = QUESTION_ID_MAP_ENTRY_SIGNATURE;
InsertTailList (QuestionIdMapEntryListHead, &IdMapEntry->Link);
}
if (OpCode->OpCode == EFI_IFR_ONE_OF_OP) {
OneOfOpcode = (EFI_IFR_ONE_OF *) OpCode;
OneOfType = OneOfOpcode->Flags & EFI_IFR_NUMERIC_SIZE;
}
break;
case EFI_IFR_GUID_OP:
OptionMap = (EFI_IFR_GUID_OPTIONKEY *) OpCode;
if (CompareMem (&OptionMap->Guid, &gFrameworkHiiCompatbilityGuid, sizeof (EFI_GUID)) == 0) {
if (OptionMap->ExtendOpCode == EFI_IFR_EXTEND_OP_OPTIONKEY) {
OneOfOptinMapEntryListHead = GetOneOfOptionMapEntryListHead (ThunkContext, OptionMap->QuestionId);
if (OneOfOptinMapEntryListHead == NULL) {
OneOfOptionMap = AllocateZeroPool (sizeof (ONE_OF_OPTION_MAP));
ASSERT (OneOfOptionMap != NULL);
OneOfOptionMap->Signature = ONE_OF_OPTION_MAP_SIGNATURE;
OneOfOptionMap->QuestionId = OptionMap->QuestionId;
//
// Make sure OneOfType is initialized.
//
ASSERT (OneOfType != (UINT8) -1);
OneOfOptionMap->ValueType = OneOfType;
InitializeListHead (&OneOfOptionMap->OneOfOptionMapEntryListHead);
OneOfOptinMapEntryListHead = &OneOfOptionMap->OneOfOptionMapEntryListHead;
InsertTailList (&ThunkContext->OneOfOptionMapListHead, &OneOfOptionMap->Link);
}
OneOfOptionMapEntry = AllocateZeroPool (sizeof (ONE_OF_OPTION_MAP_ENTRY));
ASSERT (OneOfOptionMapEntry != NULL);
OneOfOptionMapEntry->Signature = ONE_OF_OPTION_MAP_ENTRY_SIGNATURE;
OneOfOptionMapEntry->FwKey = OptionMap->KeyValue;
CopyMem (&OneOfOptionMapEntry->Value, &OptionMap->OptionValue, sizeof (EFI_IFR_TYPE_VALUE));
InsertTailList (OneOfOptinMapEntryListHead, &OneOfOptionMapEntry->Link);
}
} else if (CompareMem (&OptionMap->Guid, &gTianoHiiIfrGuid, sizeof (EFI_GUID)) == 0) {
Class = (EFI_IFR_GUID_CLASS *) OpCode;
switch (Class->ExtendOpCode) {
case EFI_IFR_EXTEND_OP_CLASS:
ThunkContext->FormSetClass = Class->Class;
break;
case EFI_IFR_EXTEND_OP_SUBCLASS:
SubClass = (EFI_IFR_GUID_SUBCLASS *) OpCode;
ThunkContext->FormSetSubClass = SubClass->SubClass;
break;
default:
break;
}
}
break;
default:
break;
}
Offset += OpCode->Length;
}
//
// Only Form Package is in a Package List.
//
break;
}
Package = (EFI_HII_PACKAGE_HEADER *) (UINT8 *) Package + Package->Length;
}
FreePool (List);
return EFI_SUCCESS;
}
LIST_ENTRY *
GetMapEntryListHead (
IN CONST HII_THUNK_CONTEXT *ThunkContext,
IN UINT16 VarStoreId
)
{
LIST_ENTRY *Link;
QUESTION_ID_MAP *Map;
Link = GetFirstNode (&ThunkContext->QuestionIdMapListHead);
while (!IsNull (&ThunkContext->QuestionIdMapListHead, Link)) {
Map = QUESTION_ID_MAP_FROM_LINK (Link);
if (VarStoreId == Map->VarStoreId) {
return &Map->MapEntryListHead;
}
Link = GetNextNode (&ThunkContext->QuestionIdMapListHead, Link);
}
return NULL;
}
HII_THUNK_CONTEXT *
CreateThunkContext (
IN HII_THUNK_PRIVATE_DATA *Private,
IN UINTN StringPackageCount,
IN UINTN IfrPackageCount
)
{
EFI_STATUS Status;
HII_THUNK_CONTEXT *ThunkContext;
ThunkContext = AllocateZeroPool (sizeof (HII_THUNK_CONTEXT));
ASSERT (ThunkContext != NULL);
ThunkContext->Signature = HII_THUNK_CONTEXT_SIGNATURE;
ThunkContext->IfrPackageCount = IfrPackageCount;
ThunkContext->StringPackageCount = StringPackageCount;
Status = AllocateHiiHandle (&ThunkContext->FwHiiHandle);
if (EFI_ERROR (Status)) {
return NULL;
}
InitializeListHead (&ThunkContext->QuestionIdMapListHead);
InitializeListHead (&ThunkContext->OneOfOptionMapListHead);
return ThunkContext;
}
VOID
DestroyThunkContext (
IN HII_THUNK_CONTEXT *ThunkContext
)
{
ASSERT (ThunkContext != NULL);
FreeHiiHandle (ThunkContext->FwHiiHandle);
DestroyQuestionIdMap (&ThunkContext->QuestionIdMapListHead);
DestoryOneOfOptionMap (&ThunkContext->OneOfOptionMapListHead);
RemoveEntryList (&ThunkContext->Link);
FreePool (ThunkContext);
}
VOID
DestroyQuestionIdMap (
IN LIST_ENTRY *QuestionIdMapListHead
)
{
QUESTION_ID_MAP *IdMap;
QUESTION_ID_MAP_ENTRY *IdMapEntry;
LIST_ENTRY *Link;
LIST_ENTRY *Link2;
while (!IsListEmpty (QuestionIdMapListHead)) {
Link = GetFirstNode (QuestionIdMapListHead);
IdMap = QUESTION_ID_MAP_FROM_LINK (Link);
while (!IsListEmpty (&IdMap->MapEntryListHead)) {
Link2 = GetFirstNode (&IdMap->MapEntryListHead);
IdMapEntry = QUESTION_ID_MAP_ENTRY_FROM_LINK (Link2);
RemoveEntryList (Link2);
FreePool (IdMapEntry);
}
RemoveEntryList (Link);
FreePool (IdMap);
}
}
VOID
DestoryOneOfOptionMap (
IN LIST_ENTRY *OneOfOptionMapListHead
)
{
ONE_OF_OPTION_MAP *Map;
ONE_OF_OPTION_MAP_ENTRY *MapEntry;
LIST_ENTRY *Link;
LIST_ENTRY *Link2;
while (!IsListEmpty (OneOfOptionMapListHead)) {
Link = GetFirstNode (OneOfOptionMapListHead);
Map = ONE_OF_OPTION_MAP_FROM_LINK (Link);
while (!IsListEmpty (&Map->OneOfOptionMapEntryListHead)) {
Link2 = GetFirstNode (&Map->OneOfOptionMapEntryListHead);
MapEntry = ONE_OF_OPTION_MAP_ENTRY_FROM_LINK (Link2);
RemoveEntryList (Link2);
FreePool (MapEntry);
}
RemoveEntryList (Link);
FreePool (Map);
}
}
|