Make the EdkMoudlePkg build by allocate mCallbackFnTable at runtime as PCD_TOTAL_TOKE...
[mirror_edk2.git] / EdkModulePkg / Universal / PCD / Dxe / Service.c
1 /** @file
2 Private functions used by PCD DXE driver.s
3
4 Copyright (c) 2006, Intel Corporation
5 All rights reserved. This program and the accompanying materials
6 are licensed and made available under the terms and conditions of the BSD License
7 which accompanies this distribution. The full text of the license may be found at
8 http://opensource.org/licenses/bsd-license.php
9
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
12
13
14 Module Name: Service.c
15
16 **/
17 #include "Service.h"
18
19
20 //
21 // Build Tool will generate DXE_PCD_DB_INIT_VALUE in Autogen.h
22 // Compression Algorithm will take care of the size optimization.
23 //
24
25 PCD_DATABASE * mPcdDatabase;
26
27 LIST_ENTRY *mCallbackFnTable;
28
29 VOID *
30 GetWorker (
31 PCD_TOKEN_NUMBER TokenNumber,
32 UINTN GetSize
33 )
34 {
35 UINT32 *LocalTokenNumberTable;
36 UINT16 *SizeTable;
37 BOOLEAN IsPeiDb;
38 UINTN Size;
39 UINT32 Offset;
40 EFI_GUID *GuidTable;
41 UINT16 *StringTable;
42 EFI_GUID *Guid;
43 UINT16 *Name;
44 VARIABLE_HEAD *VariableHead;
45 EFI_STATUS Status;
46 UINTN DataSize;
47 VOID *Data;
48 VPD_HEAD *VpdHead;
49 UINT8 *PcdDb;
50 UINT16 StringTableIdx;
51 UINT32 LocalTokenNumber;
52
53
54 ASSERT (TokenNumber < PCD_TOTAL_TOKEN_NUMBER);
55
56 Size = DxePcdGetSize (TokenNumber);
57 ASSERT (GetSize == Size || GetSize == 0);
58
59
60 IsPeiDb = (TokenNumber <= PEI_LOCAL_TOKEN_NUMBER) ? TRUE : FALSE;
61
62 LocalTokenNumberTable = IsPeiDb ? mPcdDatabase->PeiDb.Init.LocalTokenNumberTable :
63 mPcdDatabase->DxeDb.Init.LocalTokenNumberTable;
64
65 SizeTable = IsPeiDb ? mPcdDatabase->PeiDb.Init.SizeTable:
66 mPcdDatabase->DxeDb.Init.SizeTable;
67
68 TokenNumber = IsPeiDb ? TokenNumber :
69 TokenNumber - PEI_LOCAL_TOKEN_NUMBER;
70
71 LocalTokenNumber = LocalTokenNumberTable[TokenNumber];
72
73 if ((LocalTokenNumber & PCD_TYPE_SKU_ENABLED) == PCD_TYPE_SKU_ENABLED) {
74 LocalTokenNumber = GetSkuEnabledTokenNumber (LocalTokenNumber & ~PCD_TYPE_SKU_ENABLED, Size, IsPeiDb);
75 }
76
77 PcdDb = IsPeiDb ? ((UINT8 *) &mPcdDatabase->PeiDb) : ((UINT8 *) &mPcdDatabase->DxeDb);
78 StringTable = IsPeiDb ? mPcdDatabase->PeiDb.Init.StringTable :
79 mPcdDatabase->DxeDb.Init.StringTable;
80
81 Offset = LocalTokenNumber & PCD_DATABASE_OFFSET_MASK;
82
83 switch (LocalTokenNumber & ~PCD_DATABASE_OFFSET_MASK) {
84 case PCD_TYPE_VPD:
85 VpdHead = (VPD_HEAD *) ((UINT8 *) PcdDb + Offset);
86 return (VOID *) (FixedPcdGet32(PcdVpdBaseAddress) + VpdHead->Offset);
87
88 case PCD_TYPE_HII:
89 GuidTable = IsPeiDb ? mPcdDatabase->PeiDb.Init.GuidTable :
90 mPcdDatabase->DxeDb.Init.GuidTable;
91
92 VariableHead = (VARIABLE_HEAD *) (PcdDb + Offset);
93
94 Guid = &(GuidTable[VariableHead->GuidTableIndex]);
95 Name = &(StringTable[VariableHead->StringIndex]);
96
97 Status = GetHiiVariable (Guid, Name, &Data, &DataSize);
98 ASSERT_EFI_ERROR (Status);
99 ASSERT (DataSize >= (UINTN) (VariableHead->Offset + Size));
100
101 return (UINT8 *) Data + VariableHead->Offset;
102
103 case PCD_TYPE_STRING:
104 StringTableIdx = (UINT16) *((UINT8 *) PcdDb + Offset);
105 return (VOID *) &StringTable[StringTableIdx];
106
107 case PCD_TYPE_DATA:
108 return (VOID *) ((UINT8 *) PcdDb + Offset);
109 break;
110
111 default:
112 ASSERT (FALSE);
113 break;
114
115 }
116
117 ASSERT (FALSE);
118
119 return NULL;
120
121 }
122
123
124
125 EFI_STATUS
126 DxeRegisterCallBackWorker (
127 IN PCD_TOKEN_NUMBER TokenNumber,
128 IN CONST GUID *Guid, OPTIONAL
129 IN PCD_PROTOCOL_CALLBACK CallBackFunction
130 )
131 {
132 CALLBACK_FN_ENTRY *FnTableEntry;
133 LIST_ENTRY *ListHead;
134 LIST_ENTRY *ListNode;
135
136 if (Guid != NULL) {
137 TokenNumber = GetExPcdTokenNumber (Guid, TokenNumber);
138 }
139
140 ListHead = &mCallbackFnTable[TokenNumber];
141 ListNode = GetFirstNode (ListHead);
142
143 while (ListNode != ListHead) {
144 FnTableEntry = CR_FNENTRY_FROM_LISTNODE(ListNode, CALLBACK_FN_ENTRY, Node);
145
146 if (FnTableEntry->CallbackFn == CallBackFunction) {
147 //
148 // We only allow a Callback function to be register once
149 // for a TokenNumber. So just return EFI_SUCCESS
150 //
151 return EFI_SUCCESS;
152 }
153 ListNode = GetNextNode (ListHead, ListNode);
154 }
155
156 FnTableEntry = AllocatePool (sizeof(CALLBACK_FN_ENTRY));
157 ASSERT (FnTableEntry != NULL);
158
159 FnTableEntry->CallbackFn = CallBackFunction;
160 InsertTailList (ListHead, &FnTableEntry->Node);
161
162 return EFI_SUCCESS;
163 }
164
165
166
167
168 EFI_STATUS
169 DxeUnRegisterCallBackWorker (
170 IN PCD_TOKEN_NUMBER TokenNumber,
171 IN CONST GUID *Guid, OPTIONAL
172 IN PCD_PROTOCOL_CALLBACK CallBackFunction
173 )
174 {
175 CALLBACK_FN_ENTRY *FnTableEntry;
176 LIST_ENTRY *ListHead;
177 LIST_ENTRY *ListNode;
178
179 if (Guid != NULL) {
180 TokenNumber = GetExPcdTokenNumber (Guid, TokenNumber);
181 }
182
183 ListHead = &mCallbackFnTable[TokenNumber];
184 ListNode = GetFirstNode (ListHead);
185
186 while (ListNode != ListHead) {
187 FnTableEntry = CR_FNENTRY_FROM_LISTNODE(ListNode, CALLBACK_FN_ENTRY, Node);
188
189 if (FnTableEntry->CallbackFn == CallBackFunction) {
190 //
191 // We only allow a Callback function to be register once
192 // for a TokenNumber. So we can safely remove the Node from
193 // the Link List and return EFI_SUCCESS.
194 //
195 RemoveEntryList (ListNode);
196 FreePool (FnTableEntry);
197
198 return EFI_SUCCESS;
199 }
200 ListNode = GetNextNode (ListHead, ListNode);
201 }
202
203 return EFI_INVALID_PARAMETER;
204 }
205
206
207
208 PCD_TOKEN_NUMBER
209 ExGetNextTokeNumber (
210 IN CONST EFI_GUID *Guid,
211 IN PCD_TOKEN_NUMBER TokenNumber,
212 IN EFI_GUID *GuidTable,
213 IN UINTN SizeOfGuidTable,
214 IN DYNAMICEX_MAPPING *ExMapTable,
215 IN UINTN SizeOfExMapTable
216 )
217 {
218 EFI_GUID *MatchGuid;
219 UINTN Idx;
220 UINTN GuidTableIdx;
221 BOOLEAN Found;
222
223 MatchGuid = ScanGuid (GuidTable, SizeOfGuidTable, Guid);
224 if (MatchGuid == NULL) {
225 return PCD_INVALID_TOKEN_NUMBER;
226 }
227
228 Found = FALSE;
229 GuidTableIdx = MatchGuid - GuidTable;
230 for (Idx = 0; Idx < SizeOfExMapTable; Idx++) {
231 if (ExMapTable[Idx].ExGuidIndex == GuidTableIdx) {
232 Found = TRUE;
233 break;
234 }
235 }
236
237 if (Found) {
238 if (TokenNumber == PCD_INVALID_TOKEN_NUMBER) {
239 return ExMapTable[Idx].ExTokenNumber;
240 }
241
242 for ( ; Idx < SizeOfExMapTable; Idx++) {
243 if (ExMapTable[Idx].ExTokenNumber == TokenNumber) {
244 Idx++;
245 if (Idx == SizeOfExMapTable) {
246 //
247 // Exceed the length of ExMap Table
248 //
249 return PCD_INVALID_TOKEN_NUMBER;
250 } else if (ExMapTable[Idx].ExGuidIndex == GuidTableIdx) {
251 //
252 // Found the next match
253 //
254 return ExMapTable[Idx].ExTokenNumber;
255 } else {
256 //
257 // Guid has been changed. It is the next Token Space Guid.
258 // We should flag no more TokenNumber.
259 //
260 return PCD_INVALID_TOKEN_NUMBER;
261 }
262 }
263 }
264 }
265
266 return PCD_INVALID_TOKEN_NUMBER;
267 }
268
269
270
271
272 VOID
273 BuildPcdDxeDataBase (
274 VOID
275 )
276 {
277 PEI_PCD_DATABASE *PeiDatabase;
278 EFI_HOB_GUID_TYPE *GuidHob;
279 UINTN Idx;
280
281 mPcdDatabase = AllocateZeroPool (sizeof(PCD_DATABASE));
282 ASSERT (mPcdDatabase != NULL);
283
284 GuidHob = GetFirstGuidHob (&gPcdDataBaseHobGuid);
285
286 if (GuidHob != NULL) {
287
288 //
289 // We will copy over the PEI phase's PCD Database.
290 //
291 // If no PEIMs use dynamic Pcd Entry, the Pcd Service PEIM
292 // should not be included at all. So the GuidHob could
293 // be NULL. If it is NULL, we just copy over the DXE Default
294 // Value to PCD Database.
295 //
296
297 PeiDatabase = (PEI_PCD_DATABASE *) GET_GUID_HOB_DATA (GuidHob);
298 //
299 // Copy PCD Entries refereneced in PEI phase to PCD DATABASE
300 //
301 CopyMem (&mPcdDatabase->PeiDb, PeiDatabase, sizeof (PEI_PCD_DATABASE));
302 }
303
304 //
305 // Copy PCD Entries with default value to PCD DATABASE
306 //
307 CopyMem (&mPcdDatabase->DxeDb.Init, &gDXEPcdDbInit, sizeof(DXE_PCD_DATABASE_INIT));
308
309
310 //
311 // Initialized the Callback Function Table
312 //
313
314 if (PCD_TOTAL_TOKEN_NUMBER != 0) {
315 mCallbackFnTable = AllocateZeroPool (PCD_TOTAL_TOKEN_NUMBER);
316 }
317
318 for (Idx = 0; Idx < PCD_TOTAL_TOKEN_NUMBER; Idx++) {
319 InitializeListHead (&mCallbackFnTable[Idx]);
320 }
321
322 return;
323 }
324
325
326
327 EFI_STATUS
328 GetHiiVariable (
329 IN EFI_GUID *VariableGuid,
330 IN UINT16 *VariableName,
331 OUT VOID ** VariableData,
332 OUT UINTN *VariableSize
333 )
334 {
335 UINTN Size;
336 EFI_STATUS Status;
337 VOID *Buffer;
338
339 Status = EfiGetVariable (
340 (UINT16 *)VariableName,
341 VariableGuid,
342 NULL,
343 &Size,
344 NULL
345 );
346 ASSERT (Status == EFI_BUFFER_TOO_SMALL);
347
348 Buffer = AllocatePool (Size);
349
350 ASSERT (Buffer != NULL);
351
352 Status = EfiGetVariable (
353 VariableName,
354 VariableGuid,
355 NULL,
356 &Size,
357 Buffer
358 );
359
360 return Status;
361
362 }
363
364
365 UINT32
366 GetSkuEnabledTokenNumber (
367 UINT32 LocalTokenNumber,
368 UINTN Size,
369 BOOLEAN IsPeiDb
370 )
371 {
372 SKU_HEAD *SkuHead;
373 SKU_ID *SkuIdTable;
374 INTN i;
375 UINT8 *Value;
376 SKU_ID *PhaseSkuIdTable;
377 UINT8 *PcdDb;
378
379 ASSERT ((LocalTokenNumber & PCD_TYPE_SKU_ENABLED) == 0);
380
381 PcdDb = IsPeiDb ? (UINT8 *) &mPcdDatabase->PeiDb : (UINT8 *) &mPcdDatabase->DxeDb;
382
383 SkuHead = (SKU_HEAD *) (PcdDb + (LocalTokenNumber & PCD_DATABASE_OFFSET_MASK));
384 Value = (UINT8 *) (PcdDb + SkuHead->SkuDataStartOffset);
385
386 PhaseSkuIdTable = IsPeiDb ? mPcdDatabase->PeiDb.Init.SkuIdTable :
387 mPcdDatabase->DxeDb.Init.SkuIdTable;
388
389 SkuIdTable = &PhaseSkuIdTable[SkuHead->SkuIdTableOffset];
390
391 for (i = 0; i < SkuIdTable[0]; i++) {
392 if (mPcdDatabase->PeiDb.Init.SystemSkuId == SkuIdTable[i + 1]) {
393 break;
394 }
395 }
396 ASSERT (i < SkuIdTable[0]);
397
398 switch (LocalTokenNumber & ~PCD_DATABASE_OFFSET_MASK) {
399 case PCD_TYPE_VPD:
400 Value = (UINT8 *) &(((VPD_HEAD *) Value)[i]);
401 return ((Value - PcdDb) | PCD_TYPE_VPD);
402
403 case PCD_TYPE_HII:
404 Value = (UINT8 *) &(((VARIABLE_HEAD *) Value)[i]);
405 return ((Value - PcdDb) | PCD_TYPE_HII);
406
407 case PCD_TYPE_DATA:
408 Value += Size * i;
409 return (Value - PcdDb);
410
411 default:
412 ASSERT (FALSE);
413 }
414
415 ASSERT (FALSE);
416
417 return 0;
418
419 }
420
421
422
423
424
425 VOID
426 InvokeCallbackOnSet (
427 UINT32 ExTokenNumber,
428 CONST EFI_GUID *Guid, OPTIONAL
429 UINTN TokenNumber,
430 VOID *Data,
431 UINTN Size
432 )
433 {
434 CALLBACK_FN_ENTRY *FnTableEntry;
435 LIST_ENTRY *ListHead;
436 LIST_ENTRY *ListNode;
437
438 ListHead = &mCallbackFnTable[TokenNumber];
439 ListNode = GetFirstNode (ListHead);
440
441 while (ListNode != ListHead) {
442 FnTableEntry = CR_FNENTRY_FROM_LISTNODE(ListNode, CALLBACK_FN_ENTRY, Node);
443
444 FnTableEntry->CallbackFn(Guid,
445 (Guid == NULL) ? TokenNumber : ExTokenNumber,
446 Data,
447 Size);
448
449 ListNode = GetNextNode (ListHead, ListNode);
450 }
451
452 return;
453 }
454
455
456
457
458 EFI_STATUS
459 SetWorker (
460 PCD_TOKEN_NUMBER TokenNumber,
461 VOID *Data,
462 UINTN Size,
463 BOOLEAN PtrType
464 )
465 {
466 UINT32 *LocalTokenNumberTable;
467 BOOLEAN IsPeiDb;
468 UINT32 LocalTokenNumber;
469 EFI_GUID *GuidTable;
470 UINT16 *StringTable;
471 EFI_GUID *Guid;
472 UINT16 *Name;
473 VOID *InternalData;
474 VARIABLE_HEAD *VariableHead;
475 UINTN Offset;
476 UINT8 *PcdDb;
477
478
479 ASSERT (TokenNumber < PCD_TOTAL_TOKEN_NUMBER);
480
481 if (PtrType) {
482 ASSERT (Size <= DxePcdGetSize (TokenNumber));
483 } else {
484 ASSERT (Size == DxePcdGetSize (TokenNumber));
485 }
486
487 IsPeiDb = (TokenNumber <= PEI_LOCAL_TOKEN_NUMBER) ? TRUE : FALSE;
488
489 LocalTokenNumberTable = IsPeiDb ? mPcdDatabase->PeiDb.Init.LocalTokenNumberTable :
490 mPcdDatabase->DxeDb.Init.LocalTokenNumberTable;
491
492 if ((TokenNumber < PEI_NEX_TOKEN_NUMBER) ||
493 (TokenNumber >= PEI_LOCAL_TOKEN_NUMBER || TokenNumber < (PEI_LOCAL_TOKEN_NUMBER + DXE_NEX_TOKEN_NUMBER))) {
494 InvokeCallbackOnSet (0, NULL, TokenNumber, Data, Size);
495 }
496
497 TokenNumber = IsPeiDb ? TokenNumber
498 : TokenNumber - PEI_LOCAL_TOKEN_NUMBER;
499
500 LocalTokenNumber = LocalTokenNumberTable[TokenNumber];
501
502 if ((LocalTokenNumber & PCD_TYPE_SKU_ENABLED) == PCD_TYPE_SKU_ENABLED) {
503 LocalTokenNumber = GetSkuEnabledTokenNumber (LocalTokenNumber & ~PCD_TYPE_SKU_ENABLED, Size, IsPeiDb);
504 }
505
506 Offset = LocalTokenNumber & PCD_DATABASE_OFFSET_MASK;
507
508 PcdDb = IsPeiDb ? ((UINT8 *) &mPcdDatabase->PeiDb) : ((UINT8 *) &mPcdDatabase->DxeDb);
509
510 StringTable = IsPeiDb ? mPcdDatabase->PeiDb.Init.StringTable :
511 mPcdDatabase->DxeDb.Init.StringTable;
512
513 InternalData = PcdDb + Offset;
514
515 switch (LocalTokenNumber & ~PCD_DATABASE_OFFSET_MASK) {
516 case PCD_TYPE_VPD:
517 ASSERT (FALSE);
518 return EFI_INVALID_PARAMETER;
519
520 case PCD_TYPE_STRING:
521 CopyMem (&StringTable[*((UINT16 *)InternalData)], Data, Size);
522 break;
523
524 case PCD_TYPE_HII:
525 //
526 // Bug Bug: Please implement this
527 //
528 GuidTable = IsPeiDb ? mPcdDatabase->PeiDb.Init.GuidTable :
529 mPcdDatabase->DxeDb.Init.GuidTable;
530
531 VariableHead = (VARIABLE_HEAD *) (PcdDb + Offset);
532
533 Guid = &(GuidTable[VariableHead->GuidTableIndex]);
534 Name = &(StringTable[VariableHead->StringIndex]);
535
536 return EFI_SUCCESS;
537
538 case PCD_TYPE_DATA:
539 if (PtrType) {
540 CopyMem (InternalData, Data, Size);
541 return EFI_SUCCESS;
542 }
543
544 switch (Size) {
545 case sizeof(UINT8):
546 *((UINT8 *) InternalData) = *((UINT8 *) Data);
547 return EFI_SUCCESS;
548
549 case sizeof(UINT16):
550 *((UINT16 *) InternalData) = *((UINT16 *) Data);
551 return EFI_SUCCESS;
552
553 case sizeof(UINT32):
554 *((UINT32 *) InternalData) = *((UINT32 *) Data);
555 return EFI_SUCCESS;
556
557 case sizeof(UINT64):
558 *((UINT64 *) InternalData) = *((UINT64 *) Data);
559 return EFI_SUCCESS;
560
561 default:
562 ASSERT (FALSE);
563 return EFI_NOT_FOUND;
564 }
565
566 default:
567 ASSERT (FALSE);
568 break;
569 }
570
571 ASSERT (FALSE);
572 return EFI_NOT_FOUND;
573 }
574
575
576
577
578
579 VOID *
580 ExGetWorker (
581 IN CONST EFI_GUID *Guid,
582 IN UINTN ExTokenNumber,
583 IN UINTN GetSize
584 )
585 {
586 return GetWorker(GetExPcdTokenNumber (Guid, ExTokenNumber), GetSize);
587 }
588
589
590
591
592
593 EFI_STATUS
594 ExSetWorker (
595 IN PCD_TOKEN_NUMBER ExTokenNumber,
596 IN CONST EFI_GUID *Guid,
597 VOID *Data,
598 UINTN SetSize,
599 BOOLEAN PtrType
600 )
601 {
602 PCD_TOKEN_NUMBER TokenNumber;
603
604 TokenNumber = GetExPcdTokenNumber (Guid, ExTokenNumber);
605
606 InvokeCallbackOnSet (ExTokenNumber, Guid, TokenNumber, Data, SetSize);
607
608 SetWorker (TokenNumber, Data, SetSize, PtrType);
609
610 return EFI_SUCCESS;
611
612 }
613
614
615
616
617 EFI_STATUS
618 SetHiiVariable (
619 IN EFI_GUID *VariableGuid,
620 IN UINT16 *VariableName,
621 IN CONST VOID *Data,
622 IN UINTN DataSize,
623 IN UINTN Offset
624 )
625 {
626 UINTN Size;
627 VOID *Buffer;
628 EFI_STATUS Status;
629 UINT32 Attribute;
630
631 Size = 0;
632
633 Status = EfiGetVariable (
634 (UINT16 *)VariableName,
635 VariableGuid,
636 &Attribute,
637 &Size,
638 NULL
639 );
640
641 ASSERT (Status == EFI_BUFFER_TOO_SMALL);
642
643 Buffer = AllocatePool (Size);
644
645 ASSERT (Buffer != NULL);
646
647 Status = EfiGetVariable (
648 VariableName,
649 VariableGuid,
650 &Attribute,
651 &Size,
652 Buffer
653 );
654
655
656 CopyMem ((UINT8 *)Buffer + Offset, Data, DataSize);
657
658 return EfiSetVariable (
659 VariableName,
660 VariableGuid,
661 Attribute,
662 Size,
663 Buffer
664 );
665
666 }
667
668
669
670
671
672 PCD_TOKEN_NUMBER
673 GetExPcdTokenNumber (
674 IN CONST EFI_GUID *Guid,
675 IN PCD_TOKEN_NUMBER ExTokenNumber
676 )
677 {
678 UINT32 i;
679 DYNAMICEX_MAPPING *ExMap;
680 EFI_GUID *GuidTable;
681 EFI_GUID *MatchGuid;
682 UINTN MatchGuidIdx;
683
684 ExMap = mPcdDatabase->PeiDb.Init.ExMapTable;
685 GuidTable = mPcdDatabase->PeiDb.Init.GuidTable;
686
687 MatchGuid = ScanGuid (GuidTable, sizeof(mPcdDatabase->PeiDb.Init.GuidTable), Guid);
688 ASSERT (MatchGuid != NULL);
689
690 MatchGuidIdx = MatchGuid - GuidTable;
691
692 for (i = 0; i < PEI_EXMAPPING_TABLE_SIZE; i++) {
693 if ((ExTokenNumber == ExMap[i].ExTokenNumber) &&
694 (MatchGuidIdx == ExMap[i].ExGuidIndex)) {
695 return ExMap[i].LocalTokenNumber;
696
697 }
698 }
699
700 ExMap = mPcdDatabase->DxeDb.Init.ExMapTable;
701 GuidTable = mPcdDatabase->DxeDb.Init.GuidTable;
702
703 MatchGuid = ScanGuid (GuidTable, sizeof(mPcdDatabase->DxeDb.Init.GuidTable), Guid);
704 ASSERT (MatchGuid != NULL);
705
706 MatchGuidIdx = MatchGuid - GuidTable;
707
708 for (i = 0; i < DXE_EXMAPPING_TABLE_SIZE; i++) {
709 if ((ExTokenNumber == ExMap[i].ExTokenNumber) &&
710 (MatchGuidIdx == ExMap[i].ExGuidIndex)) {
711 return ExMap[i].LocalTokenNumber + PEI_LOCAL_TOKEN_NUMBER;
712 }
713 }
714
715 ASSERT (FALSE);
716
717 return 0;
718 }
719