Revise XML Schema to be valid.
[mirror_edk2.git] / EdkModulePkg / Universal / PCD / Dxe / Service.c
CommitLineData
878ddf1f 1/** @file\r
2Private functions used by PCD DXE driver.s\r
3\r
4Copyright (c) 2006, Intel Corporation\r
5All rights reserved. This program and the accompanying materials\r
6are licensed and made available under the terms and conditions of the BSD License\r
7which accompanies this distribution. The full text of the license may be found at\r
8http://opensource.org/licenses/bsd-license.php\r
9\r
10THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
11WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
12\r
13\r
14Module Name: Service.c\r
15\r
16**/\r
878ddf1f 17#include "Service.h"\r
18\r
878ddf1f 19\r
52e1905d 20//\r
21// Build Tool will generate DXE_PCD_DB_INIT_VALUE in Autogen.h\r
22// Compression Algorithm will take care of the size optimization.\r
23//\r
878ddf1f 24\r
52e1905d 25/*\r
26DXE_PCD_DATABASE_INIT gDXEPcdDbInit = {\r
27 DXE_PCD_DB_INIT_VALUE\r
28};\r
29*/\r
878ddf1f 30\r
52e1905d 31PCD_DATABASE * gPcdDatabase;\r
878ddf1f 32\r
52e1905d 33VOID *\r
34GetWorkerByLocalTokenNumber (\r
35 UINT32 LocalTokenNumber,\r
36 BOOLEAN IsPeiDb,\r
37 UINTN Size\r
38 ) \r
878ddf1f 39{\r
52e1905d 40 UINT32 Offset;\r
41 EFI_GUID *GuidTable;\r
42 UINT16 *StringTable;\r
43 EFI_GUID *Guid;\r
44 UINT16 *Name;\r
45 VARIABLE_HEAD *VariableHead;\r
46 EFI_STATUS Status;\r
47 UINTN DataSize;\r
48 VOID *Data;\r
49 VPD_HEAD *VpdHead;\r
50 UINT8 *PcdDb;\r
51 UINT16 StringTableIdx; \r
52\r
53 if ((LocalTokenNumber & PCD_TYPE_SKU_ENABLED) == PCD_TYPE_SKU_ENABLED) {\r
54 LocalTokenNumber = GetSkuEnabledTokenNumber (LocalTokenNumber & ~PCD_TYPE_SKU_ENABLED, Size, IsPeiDb);\r
55 }\r
56\r
57 PcdDb = IsPeiDb ? ((UINT8 *) &gPcdDatabase->PeiDb) : ((UINT8 *) &gPcdDatabase->DxeDb);\r
58 StringTable = IsPeiDb ? gPcdDatabase->PeiDb.Init.StringTable :\r
59 gPcdDatabase->DxeDb.Init.StringTable;\r
60 \r
61 Offset = LocalTokenNumber & PCD_DATABASE_OFFSET_MASK;\r
62 \r
63 switch (LocalTokenNumber & ~PCD_DATABASE_OFFSET_MASK) {\r
64 case PCD_TYPE_VPD:\r
65 VpdHead = (VPD_HEAD *) ((UINT8 *) PcdDb + Offset);\r
66 return (VOID *) (FixedPcdGet32(PcdVpdBaseAddress) + VpdHead->Offset);\r
67 \r
68 case PCD_TYPE_HII:\r
69 GuidTable = IsPeiDb ? gPcdDatabase->PeiDb.Init.GuidTable :\r
70 gPcdDatabase->DxeDb.Init.GuidTable;\r
71 \r
72 VariableHead = (VARIABLE_HEAD *) (PcdDb + Offset);\r
73 \r
74 Guid = &(GuidTable[VariableHead->GuidTableIndex]);\r
75 Name = &(StringTable[VariableHead->StringIndex]);\r
878ddf1f 76\r
52e1905d 77 Status = GetHiiVariable (Guid, Name, &Data, &DataSize);\r
78 ASSERT_EFI_ERROR (Status);\r
79 ASSERT (DataSize >= (UINTN) (VariableHead->Offset + Size));\r
878ddf1f 80\r
52e1905d 81 return (UINT8 *) Data + VariableHead->Offset;\r
878ddf1f 82\r
52e1905d 83 case PCD_TYPE_STRING:\r
84 StringTableIdx = (UINT16) *((UINT8 *) PcdDb + Offset);\r
85 return (VOID *) &StringTable[StringTableIdx];\r
878ddf1f 86\r
52e1905d 87 case PCD_TYPE_DATA:\r
88 return (VOID *) ((UINT8 *) PcdDb + Offset);\r
89 break;\r
878ddf1f 90\r
52e1905d 91 default:\r
92 ASSERT (FALSE);\r
93 break;\r
94 \r
95 }\r
878ddf1f 96\r
52e1905d 97 ASSERT (FALSE);\r
98 \r
99 return NULL;\r
100}\r
101 \r
102VOID *\r
103GetWorker (\r
104 UINTN TokenNumber\r
878ddf1f 105 )\r
106{\r
52e1905d 107 UINT32 *LocalTokenNumberTable;\r
108 UINT16 *SizeTable;\r
109 BOOLEAN IsPeiDb;\r
878ddf1f 110\r
52e1905d 111 ASSERT (TokenNumber < PCD_TOTAL_TOKEN_NUMBER);\r
112 \r
113 IsPeiDb = (TokenNumber <= PEI_LOCAL_TOKEN_NUMBER) ? TRUE : FALSE;\r
878ddf1f 114\r
52e1905d 115 LocalTokenNumberTable = IsPeiDb ? gPcdDatabase->PeiDb.Init.LocalTokenNumberTable : \r
116 gPcdDatabase->DxeDb.Init.LocalTokenNumberTable;\r
878ddf1f 117\r
52e1905d 118 SizeTable = IsPeiDb ? gPcdDatabase->PeiDb.Init.SizeTable: \r
119 gPcdDatabase->DxeDb.Init.SizeTable;\r
878ddf1f 120\r
52e1905d 121 TokenNumber = IsPeiDb ? TokenNumber :\r
122 TokenNumber - PEI_LOCAL_TOKEN_NUMBER;\r
123 return GetWorkerByLocalTokenNumber (LocalTokenNumberTable[TokenNumber], IsPeiDb, SizeTable[TokenNumber]);\r
124}\r
878ddf1f 125\r
878ddf1f 126\r
127\r
52e1905d 128EFI_STATUS\r
129DxeRegisterCallBackWorker (\r
130 IN UINTN TokenNumber,\r
131 IN CONST GUID *Guid, OPTIONAL\r
132 IN PCD_PROTOCOL_CALLBACK CallBackFunction,\r
133 IN BOOLEAN Register\r
134)\r
135{\r
136 \r
137 return EFI_SUCCESS;\r
878ddf1f 138}\r
139\r
140\r
52e1905d 141EFI_STATUS\r
142DxeGetNextTokenWorker (\r
143 IN OUT UINTN *TokenNumber,\r
144 IN CONST GUID *Guid OPTIONAL\r
878ddf1f 145 )\r
146{\r
52e1905d 147 return EFI_SUCCESS;\r
878ddf1f 148}\r
149\r
150\r
151\r
52e1905d 152VOID\r
153BuildPcdDxeDataBase (\r
154 VOID\r
155)\r
878ddf1f 156{\r
52e1905d 157 PEI_PCD_DATABASE *PeiDatabase;\r
158 EFI_HOB_GUID_TYPE *GuidHob;\r
878ddf1f 159\r
52e1905d 160 gPcdDatabase = AllocateZeroPool (sizeof(PCD_DATABASE));\r
161 ASSERT (gPcdDatabase != NULL);\r
878ddf1f 162\r
52e1905d 163 GuidHob = GetFirstGuidHob (&gPcdDataBaseHobGuid);\r
164 ASSERT (GuidHob != NULL);\r
878ddf1f 165\r
52e1905d 166 PeiDatabase = (PEI_PCD_DATABASE *) GET_GUID_HOB_DATA (GuidHob);\r
167 //\r
168 // Copy PCD Entries refereneced in PEI phase to PCD DATABASE\r
169 //\r
170 CopyMem (&gPcdDatabase->PeiDb, PeiDatabase, sizeof (PEI_PCD_DATABASE));\r
171\r
172 //\r
173 // Copy PCD Entries with default value to PCD DATABASE\r
174 //\r
175 CopyMem (&gPcdDatabase->DxeDb.Init, &gDXEPcdDbInit, sizeof(DXE_PCD_DATABASE_INIT));\r
176 \r
177 return;\r
878ddf1f 178}\r
179\r
180\r
181\r
52e1905d 182EFI_STATUS\r
183GetHiiVariable (\r
184 IN EFI_GUID *VariableGuid,\r
185 IN UINT16 *VariableName,\r
186 OUT VOID ** VariableData,\r
187 OUT UINTN *VariableSize\r
878ddf1f 188 )\r
189{\r
52e1905d 190 UINTN Size;\r
191 EFI_STATUS Status;\r
192 VOID *Buffer;\r
878ddf1f 193\r
52e1905d 194 Status = EfiGetVariable (\r
195 (UINT16 *)VariableName,\r
196 VariableGuid,\r
197 NULL,\r
198 &Size,\r
199 NULL\r
200 );\r
201 ASSERT (Status == EFI_BUFFER_TOO_SMALL);\r
878ddf1f 202\r
52e1905d 203 Buffer = AllocatePool (Size);\r
878ddf1f 204\r
52e1905d 205 ASSERT (Buffer != NULL);\r
878ddf1f 206\r
52e1905d 207 Status = EfiGetVariable (\r
208 VariableName,\r
209 VariableGuid,\r
210 NULL,\r
211 &Size,\r
212 Buffer\r
213 );\r
878ddf1f 214\r
52e1905d 215 return Status;\r
878ddf1f 216\r
878ddf1f 217}\r
218\r
219\r
52e1905d 220UINT32\r
221GetSkuEnabledTokenNumber (\r
222 UINT32 LocalTokenNumber,\r
223 UINTN Size,\r
224 BOOLEAN IsPeiDb\r
225 ) \r
226{\r
227 SKU_HEAD *SkuHead;\r
228 SKU_ID *SkuIdTable;\r
229 INTN i;\r
230 UINT8 *Value;\r
231 SKU_ID *PhaseSkuIdTable;\r
232 UINT8 *PcdDb;\r
878ddf1f 233\r
52e1905d 234 ASSERT ((LocalTokenNumber & PCD_TYPE_SKU_ENABLED) == 0);\r
878ddf1f 235\r
52e1905d 236 PcdDb = IsPeiDb ? (UINT8 *) &gPcdDatabase->PeiDb : (UINT8 *) &gPcdDatabase->DxeDb;\r
878ddf1f 237\r
52e1905d 238 SkuHead = (SKU_HEAD *) (PcdDb + (LocalTokenNumber & PCD_DATABASE_OFFSET_MASK));\r
239 Value = (UINT8 *) (PcdDb + SkuHead->SkuDataStartOffset); \r
878ddf1f 240\r
52e1905d 241 PhaseSkuIdTable = IsPeiDb ? gPcdDatabase->PeiDb.Init.SkuIdTable :\r
242 gPcdDatabase->DxeDb.Init.SkuIdTable;\r
243 \r
244 SkuIdTable = &PhaseSkuIdTable[SkuHead->SkuIdTableOffset];\r
245 \r
246 for (i = 0; i < SkuIdTable[0]; i++) {\r
247 if (gPcdDatabase->PeiDb.Init.SystemSkuId == SkuIdTable[i + 1]) {\r
248 break;\r
878ddf1f 249 }\r
878ddf1f 250 }\r
52e1905d 251 ASSERT (i < SkuIdTable[0]);\r
878ddf1f 252\r
52e1905d 253 switch (LocalTokenNumber & ~PCD_DATABASE_OFFSET_MASK) {\r
254 case PCD_TYPE_VPD:\r
255 Value = (UINT8 *) &(((VPD_HEAD *) Value)[i]);\r
256 return ((Value - PcdDb) | PCD_TYPE_VPD);\r
878ddf1f 257\r
52e1905d 258 case PCD_TYPE_HII:\r
259 Value = (UINT8 *) &(((VARIABLE_HEAD *) Value)[i]);\r
260 return ((Value - PcdDb) | PCD_TYPE_HII);\r
261 \r
262 case PCD_TYPE_DATA:\r
263 Value += Size * i;\r
264 return (Value - PcdDb);\r
265 \r
266 default:\r
267 ASSERT (FALSE);\r
268 }\r
269\r
270 ASSERT (FALSE);\r
271\r
272 return 0;\r
878ddf1f 273 \r
274}\r
275\r
878ddf1f 276\r
878ddf1f 277\r
878ddf1f 278\r
878ddf1f 279\r
52e1905d 280VOID\r
281InvokeCallbackOnSet (\r
282 UINT32 ExTokenNumber,\r
283 CONST EFI_GUID *Guid, OPTIONAL\r
284 UINTN TokenNumber,\r
285 VOID *Data,\r
286 UINTN Size\r
287 )\r
288{\r
289 return;\r
878ddf1f 290}\r
291\r
292\r
293\r
52e1905d 294\r
878ddf1f 295EFI_STATUS\r
52e1905d 296SetWorker (\r
297 UINTN TokenNumber,\r
298 VOID *Data,\r
299 UINTN Size,\r
300 BOOLEAN PtrType\r
878ddf1f 301 )\r
302{\r
52e1905d 303 UINT32 *LocalTokenNumberTable;\r
304 BOOLEAN IsPeiDb;\r
878ddf1f 305\r
878ddf1f 306\r
52e1905d 307 ASSERT (TokenNumber < PCD_TOTAL_TOKEN_NUMBER);\r
878ddf1f 308\r
52e1905d 309 if (PtrType) {\r
310 ASSERT (Size <= DxePcdGetSize (TokenNumber));\r
311 } else {\r
312 ASSERT (Size == DxePcdGetSize (TokenNumber));\r
878ddf1f 313 }\r
878ddf1f 314 \r
52e1905d 315 IsPeiDb = (TokenNumber <= PEI_LOCAL_TOKEN_NUMBER) ? TRUE : FALSE;\r
878ddf1f 316\r
52e1905d 317 LocalTokenNumberTable = IsPeiDb ? gPcdDatabase->PeiDb.Init.LocalTokenNumberTable : \r
318 gPcdDatabase->DxeDb.Init.LocalTokenNumberTable;\r
878ddf1f 319\r
52e1905d 320 TokenNumber = IsPeiDb ? TokenNumber\r
321 : TokenNumber - PEI_LOCAL_TOKEN_NUMBER;\r
878ddf1f 322 \r
52e1905d 323 InvokeCallbackOnSet (0, NULL, TokenNumber, Data, Size);\r
878ddf1f 324\r
52e1905d 325 return SetWorkerByLocalTokenNumber (LocalTokenNumberTable[TokenNumber], Data, Size, PtrType, IsPeiDb);\r
878ddf1f 326\r
52e1905d 327}\r
878ddf1f 328\r
878ddf1f 329\r
878ddf1f 330\r
331\r
332\r
52e1905d 333VOID *\r
334ExGetWorker (\r
335 IN CONST EFI_GUID *Guid,\r
336 IN UINTN ExTokenNumber,\r
337 IN UINTN GetSize\r
338 ) \r
878ddf1f 339{\r
52e1905d 340 EX_PCD_ENTRY_ATTRIBUTE Attr;\r
878ddf1f 341\r
52e1905d 342 GetExPcdTokenAttributes (Guid, ExTokenNumber, &Attr);\r
878ddf1f 343\r
52e1905d 344 ASSERT ((GetSize == Attr.Size) || (GetSize == 0));\r
878ddf1f 345\r
52e1905d 346 return GetWorkerByLocalTokenNumber (Attr.LocalTokenNumberAlias,\r
347 Attr.IsPeiDb,\r
348 Attr.Size\r
349 );\r
878ddf1f 350}\r
351\r
352\r
353\r
52e1905d 354\r
355\r
878ddf1f 356EFI_STATUS\r
52e1905d 357ExSetWorker (\r
358 IN UINT32 ExTokenNumber,\r
359 IN CONST EFI_GUID *Guid,\r
360 VOID *Data,\r
361 UINTN SetSize,\r
362 BOOLEAN PtrType\r
878ddf1f 363 )\r
364{\r
52e1905d 365 EX_PCD_ENTRY_ATTRIBUTE Attr;\r
878ddf1f 366\r
52e1905d 367 GetExPcdTokenAttributes (Guid, ExTokenNumber, &Attr);\r
878ddf1f 368\r
52e1905d 369 ASSERT (!PtrType && (SetSize == Attr.Size));\r
878ddf1f 370\r
52e1905d 371 ASSERT (PtrType && (SetSize <= Attr.Size));\r
878ddf1f 372\r
52e1905d 373 InvokeCallbackOnSet (ExTokenNumber, Guid, Attr.TokenNumber, Data, Attr.Size);\r
878ddf1f 374\r
52e1905d 375 SetWorkerByLocalTokenNumber (Attr.LocalTokenNumberAlias, Data, Attr.Size, PtrType, Attr.IsPeiDb);\r
878ddf1f 376\r
52e1905d 377 return EFI_SUCCESS;\r
378 \r
379}\r
878ddf1f 380\r
878ddf1f 381\r
878ddf1f 382\r
878ddf1f 383\r
52e1905d 384EFI_STATUS\r
385SetWorkerByLocalTokenNumber (\r
386 UINT32 LocalTokenNumber,\r
387 VOID *Data,\r
388 UINTN Size,\r
389 BOOLEAN PtrType,\r
390 BOOLEAN IsPeiDb\r
391 )\r
392{\r
393 EFI_GUID *GuidTable;\r
394 UINT16 *StringTable;\r
395 EFI_GUID *Guid;\r
396 UINT16 *Name;\r
397 VOID *InternalData;\r
398 VARIABLE_HEAD *VariableHead;\r
399 UINTN Offset;\r
400 UINT8 *PcdDb;\r
401\r
402\r
403 if ((LocalTokenNumber & PCD_TYPE_SKU_ENABLED) == PCD_TYPE_SKU_ENABLED) {\r
404 LocalTokenNumber = GetSkuEnabledTokenNumber (LocalTokenNumber & ~PCD_TYPE_SKU_ENABLED, Size, IsPeiDb);\r
405 }\r
878ddf1f 406\r
52e1905d 407 Offset = LocalTokenNumber & PCD_DATABASE_OFFSET_MASK;\r
878ddf1f 408\r
52e1905d 409 PcdDb = IsPeiDb ? ((UINT8 *) &gPcdDatabase->PeiDb) : ((UINT8 *) &gPcdDatabase->DxeDb);\r
878ddf1f 410\r
52e1905d 411 StringTable = IsPeiDb ? gPcdDatabase->PeiDb.Init.StringTable :\r
412 gPcdDatabase->DxeDb.Init.StringTable;\r
413 \r
414 InternalData = PcdDb + Offset;\r
878ddf1f 415\r
52e1905d 416 switch (LocalTokenNumber & ~PCD_DATABASE_OFFSET_MASK) {\r
417 case PCD_TYPE_VPD:\r
418 ASSERT (FALSE);\r
419 return EFI_INVALID_PARAMETER;\r
420 \r
421 case PCD_TYPE_STRING:\r
422 CopyMem (&StringTable[*((UINT16 *)InternalData)], Data, Size);\r
423 break;\r
878ddf1f 424\r
52e1905d 425 case PCD_TYPE_HII:\r
426 //\r
427 // Bug Bug: Please implement this\r
428 //\r
429 GuidTable = IsPeiDb ? gPcdDatabase->PeiDb.Init.GuidTable :\r
430 gPcdDatabase->DxeDb.Init.GuidTable;\r
431 \r
432 VariableHead = (VARIABLE_HEAD *) (PcdDb + Offset);\r
433 \r
434 Guid = &(GuidTable[VariableHead->GuidTableIndex]);\r
435 Name = &(StringTable[VariableHead->StringIndex]);\r
878ddf1f 436\r
52e1905d 437 return EFI_SUCCESS;\r
878ddf1f 438\r
52e1905d 439 case PCD_TYPE_DATA:\r
440 if (PtrType) {\r
441 CopyMem (InternalData, Data, Size);\r
442 return EFI_SUCCESS;\r
443 }\r
878ddf1f 444\r
52e1905d 445 switch (Size) {\r
446 case sizeof(UINT8):\r
447 *((UINT8 *) InternalData) = *((UINT8 *) Data);\r
448 return EFI_SUCCESS;\r
878ddf1f 449\r
52e1905d 450 case sizeof(UINT16):\r
451 *((UINT16 *) InternalData) = *((UINT16 *) Data);\r
452 return EFI_SUCCESS;\r
453\r
454 case sizeof(UINT32):\r
455 *((UINT32 *) InternalData) = *((UINT32 *) Data);\r
456 return EFI_SUCCESS;\r
457\r
458 case sizeof(UINT64):\r
459 *((UINT64 *) InternalData) = *((UINT64 *) Data);\r
460 return EFI_SUCCESS;\r
878ddf1f 461\r
52e1905d 462 default:\r
463 ASSERT (FALSE);\r
464 return EFI_NOT_FOUND;\r
465 }\r
466\r
467 default:\r
468 ASSERT (FALSE);\r
469 break;\r
470 }\r
471 \r
472 ASSERT (FALSE);\r
473 return EFI_NOT_FOUND;\r
878ddf1f 474}\r
475\r
476\r
477\r
478EFI_STATUS\r
479SetHiiVariable (\r
480 IN EFI_GUID *VariableGuid,\r
481 IN UINT16 *VariableName,\r
482 IN CONST VOID *Data,\r
483 IN UINTN DataSize,\r
484 IN UINTN Offset\r
485 )\r
486{\r
52e1905d 487 UINTN Size;\r
488 VOID *Buffer;\r
489 EFI_STATUS Status;\r
490 UINT32 Attribute;\r
878ddf1f 491\r
492 Size = 0;\r
493\r
494 Status = EfiGetVariable (\r
495 (UINT16 *)VariableName,\r
496 VariableGuid,\r
52e1905d 497 &Attribute,\r
878ddf1f 498 &Size,\r
499 NULL\r
500 );\r
501\r
502 ASSERT (Status == EFI_BUFFER_TOO_SMALL);\r
503\r
504 Buffer = AllocatePool (Size);\r
505\r
506 ASSERT (Buffer != NULL);\r
507\r
508 Status = EfiGetVariable (\r
509 VariableName,\r
510 VariableGuid,\r
52e1905d 511 &Attribute,\r
878ddf1f 512 &Size,\r
513 Buffer\r
514 );\r
515\r
516\r
517 CopyMem ((UINT8 *)Buffer + Offset, Data, DataSize);\r
518\r
519 return EfiSetVariable (\r
520 VariableName,\r
521 VariableGuid,\r
52e1905d 522 Attribute,\r
878ddf1f 523 Size,\r
524 Buffer\r
525 );\r
526\r
527}\r
528\r
52e1905d 529\r
530\r
531\r
532\r
533VOID\r
534GetExPcdTokenAttributes (\r
535 IN CONST EFI_GUID *Guid,\r
536 IN UINT32 ExTokenNumber,\r
537 OUT EX_PCD_ENTRY_ATTRIBUTE *ExAttr\r
538 )\r
539{\r
540 UINT32 i;\r
541 DYNAMICEX_MAPPING *ExMap;\r
542 EFI_GUID *GuidTable;\r
543 UINT16 *SizeTable;\r
544\r
545 ExMap = gPcdDatabase->PeiDb.Init.ExMapTable;\r
546 GuidTable = gPcdDatabase->PeiDb.Init.GuidTable;\r
547 SizeTable = gPcdDatabase->PeiDb.Init.SizeTable;\r
548 \r
549 for (i = 0; i < PEI_EXMAPPING_TABLE_SIZE; i++) {\r
550 if ((ExTokenNumber == ExMap[i].ExTokenNumber) &&\r
551 CompareGuid (Guid, (CONST EFI_GUID *) &GuidTable[ExMap[i].ExGuidIndex])\r
552 ) {\r
553\r
554 ExAttr->IsPeiDb = TRUE;\r
555 ExAttr->Size = SizeTable[i + PEI_NEX_TOKEN_NUMBER];\r
556 ExAttr->TokenNumber = i + PEI_NEX_TOKEN_NUMBER;\r
557 ExAttr->LocalTokenNumberAlias = ExMap[i].LocalTokenNumber;\r
558 return;\r
559\r
560 }\r
561 }\r
562 \r
563 ExMap = gPcdDatabase->DxeDb.Init.ExMapTable;\r
564 GuidTable = gPcdDatabase->DxeDb.Init.GuidTable;\r
565 SizeTable = gPcdDatabase->DxeDb.Init.SizeTable;\r
566 \r
567 for (i = 0; i < DXE_EXMAPPING_TABLE_SIZE; i++) {\r
568 if ((ExTokenNumber == ExMap[i].ExTokenNumber) &&\r
569 CompareGuid (Guid, (CONST EFI_GUID *) &GuidTable[ExMap[i].ExGuidIndex])\r
570 ) {\r
571\r
572 ExAttr->IsPeiDb = FALSE;\r
573 ExAttr->Size = SizeTable[i + DXE_NEX_TOKEN_NUMBER];\r
574 ExAttr->TokenNumber = i + DXE_NEX_TOKEN_NUMBER;\r
575 ExAttr->LocalTokenNumberAlias = ExMap[i].LocalTokenNumber;\r
576 return;\r
577\r
578 }\r
579 }\r
580\r
581 ASSERT (FALSE);\r
582\r
583 return;\r
584}\r
585\r