]> git.proxmox.com Git - mirror_edk2.git/blame - MdeModulePkg/Universal/PCD/Dxe/Pcd.c
Patch to remove STATIC modifier. This is on longer recommended by EFI Framework codin...
[mirror_edk2.git] / MdeModulePkg / Universal / PCD / Dxe / Pcd.c
CommitLineData
80408db0 1/** @file\r
2ab6330e 2 PCD DXE driver manage all PCD entry initialized in PEI phase and DXE phase, and\r
3 produce the implementation of PCD protocol.\r
80408db0 4\r
5Copyright (c) 2006 - 2007, Intel Corporation\r
6All rights reserved. This program and the accompanying materials\r
7are licensed and made available under the terms and conditions of the BSD License\r
8which accompanies this distribution. The full text of the license may be found at\r
9http://opensource.org/licenses/bsd-license.php\r
10\r
11THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
12WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
13\r
14\r
15Module Name: Pcd.c\r
16\r
17**/\r
18\r
80408db0 19#include "Service.h"\r
20\r
2ab6330e 21//\r
22// Just pre-allocate a memory buffer that is big enough to\r
23// host all distinct TokenSpace guid in both\r
24// PEI ExMap and DXE ExMap.\r
25//\r
fe1e36e5 26EFI_GUID *TmpTokenSpaceBuffer[PEI_EXMAPPING_TABLE_SIZE + DXE_EXMAPPING_TABLE_SIZE] = { 0 };\r
2ab6330e 27\r
28///\r
29/// PCD database lock.\r
30///\r
80408db0 31EFI_LOCK mPcdDatabaseLock = EFI_INITIALIZE_LOCK_VARIABLE(TPL_CALLBACK);\r
32\r
33PCD_PROTOCOL mPcdInstance = {\r
34 DxePcdSetSku,\r
35\r
36 DxePcdGet8,\r
37 DxePcdGet16,\r
38 DxePcdGet32,\r
39 DxePcdGet64,\r
40 DxePcdGetPtr,\r
41 DxePcdGetBool,\r
42 DxePcdGetSize,\r
43\r
44 DxePcdGet8Ex,\r
45 DxePcdGet16Ex,\r
46 DxePcdGet32Ex,\r
47 DxePcdGet64Ex,\r
48 DxePcdGetPtrEx,\r
49 DxePcdGetBoolEx,\r
50 DxePcdGetSizeEx,\r
51\r
52 DxePcdSet8,\r
53 DxePcdSet16,\r
54 DxePcdSet32,\r
55 DxePcdSet64,\r
56 DxePcdSetPtr,\r
57 DxePcdSetBool,\r
58\r
59 DxePcdSet8Ex,\r
60 DxePcdSet16Ex,\r
61 DxePcdSet32Ex,\r
62 DxePcdSet64Ex,\r
63 DxePcdSetPtrEx,\r
64 DxePcdSetBoolEx,\r
65\r
66 DxeRegisterCallBackOnSet,\r
67 DxeUnRegisterCallBackOnSet,\r
68 DxePcdGetNextToken,\r
69 DxePcdGetNextTokenSpace\r
70};\r
71\r
72\r
73//\r
74// Static global to reduce the code size\r
75//\r
fe1e36e5 76EFI_HANDLE mNewHandle = NULL;\r
80408db0 77\r
2ab6330e 78/**\r
79 Main entry for PCD DXE driver.\r
80 \r
81 This routine initialize the PCD database and install PCD_PROTOCOL.\r
82 \r
83 @param ImageHandle Image handle for PCD DXE driver.\r
84 @param SystemTable Pointer to SystemTable.\r
85\r
86 @return Status of gBS->InstallProtocolInterface()\r
87\r
88**/\r
80408db0 89EFI_STATUS\r
90EFIAPI\r
91PcdDxeInit (\r
92 IN EFI_HANDLE ImageHandle,\r
93 IN EFI_SYSTEM_TABLE *SystemTable\r
94 )\r
95{\r
96 EFI_STATUS Status;\r
97\r
98 //\r
99 // Make sure the Pcd Protocol is not already installed in the system\r
100 //\r
101\r
102 ASSERT_PROTOCOL_ALREADY_INSTALLED (NULL, &gPcdProtocolGuid);\r
103\r
104 BuildPcdDxeDataBase ();\r
105\r
106 Status = gBS->InstallProtocolInterface (\r
107 &mNewHandle,\r
108 &gPcdProtocolGuid,\r
109 EFI_NATIVE_INTERFACE,\r
110 &mPcdInstance\r
111 );\r
112\r
113 ASSERT_EFI_ERROR (Status);\r
114\r
115 return EFI_SUCCESS;\r
116\r
117}\r
118\r
2ab6330e 119/**\r
120 Sets the SKU value for subsequent calls to set or get PCD token values.\r
121\r
122 SetSku() sets the SKU Id to be used for subsequent calls to set or get PCD values. \r
123 SetSku() is normally called only once by the system.\r
124\r
125 For each item (token), the database can hold a single value that applies to all SKUs, \r
126 or multiple values, where each value is associated with a specific SKU Id. Items with multiple, \r
127 SKU-specific values are called SKU enabled. \r
128 \r
129 The SKU Id of zero is reserved as a default. The valid SkuId range is 1 to 255. \r
130 For tokens that are not SKU enabled, the system ignores any set SKU Id and works with the \r
131 single value for that token. For SKU-enabled tokens, the system will use the SKU Id set by the \r
132 last call to SetSku(). If no SKU Id is set or the currently set SKU Id isn't valid for the specified token, \r
133 the system uses the default SKU Id. If the system attempts to use the default SKU Id and no value has been \r
134 set for that Id, the results are unpredictable.\r
135\r
136 @param[in] SkuId The SKU value that will be used when the PCD service will retrieve and \r
137 set values associated with a PCD token.\r
138\r
139 @retval VOID\r
80408db0 140\r
2ab6330e 141**/\r
80408db0 142VOID\r
143EFIAPI\r
144DxePcdSetSku (\r
145 IN UINTN SkuId\r
146 )\r
147{\r
148 mPcdDatabase->PeiDb.Init.SystemSkuId = (SKU_ID) SkuId;\r
149 \r
150 return;\r
151}\r
152\r
2ab6330e 153/**\r
154 Retrieves an 8-bit value for a given PCD token.\r
80408db0 155\r
2ab6330e 156 Retrieves the current byte-sized value for a PCD token number. \r
157 If the TokenNumber is invalid, the results are unpredictable.\r
158 \r
159 @param[in] TokenNumber The PCD token number. \r
80408db0 160\r
2ab6330e 161 @return The UINT8 value.\r
162 \r
163**/\r
80408db0 164UINT8\r
165EFIAPI\r
166DxePcdGet8 (\r
167 IN UINTN TokenNumber\r
168 )\r
169{\r
170 return *((UINT8 *) GetWorker (TokenNumber, sizeof (UINT8)));\r
171}\r
172\r
2ab6330e 173/**\r
174 Retrieves an 16-bit value for a given PCD token.\r
80408db0 175\r
2ab6330e 176 Retrieves the current 16-bits value for a PCD token number. \r
177 If the TokenNumber is invalid, the results are unpredictable.\r
178 \r
179 @param[in] TokenNumber The PCD token number. \r
80408db0 180\r
2ab6330e 181 @return The UINT16 value.\r
182 \r
183**/\r
80408db0 184UINT16\r
185EFIAPI\r
186DxePcdGet16 (\r
187 IN UINTN TokenNumber\r
188 )\r
189{\r
190 return ReadUnaligned16 (GetWorker (TokenNumber, sizeof (UINT16)));\r
191}\r
192\r
2ab6330e 193/**\r
194 Retrieves an 32-bit value for a given PCD token.\r
80408db0 195\r
2ab6330e 196 Retrieves the current 32-bits value for a PCD token number. \r
197 If the TokenNumber is invalid, the results are unpredictable.\r
198 \r
199 @param[in] TokenNumber The PCD token number. \r
80408db0 200\r
2ab6330e 201 @return The UINT32 value.\r
202 \r
203**/\r
80408db0 204UINT32\r
205EFIAPI\r
206DxePcdGet32 (\r
207 IN UINTN TokenNumber\r
208 )\r
209{\r
210 return ReadUnaligned32 (GetWorker (TokenNumber, sizeof (UINT32)));\r
211}\r
212\r
2ab6330e 213/**\r
214 Retrieves an 64-bit value for a given PCD token.\r
80408db0 215\r
2ab6330e 216 Retrieves the current 64-bits value for a PCD token number. \r
217 If the TokenNumber is invalid, the results are unpredictable.\r
218 \r
219 @param[in] TokenNumber The PCD token number. \r
80408db0 220\r
2ab6330e 221 @return The UINT64 value.\r
222 \r
223**/\r
80408db0 224UINT64\r
225EFIAPI\r
226DxePcdGet64 (\r
227 IN UINTN TokenNumber\r
228 )\r
229{\r
230 return ReadUnaligned64(GetWorker (TokenNumber, sizeof (UINT64)));\r
231}\r
232\r
2ab6330e 233/**\r
234 Retrieves a pointer to a value for a given PCD token.\r
80408db0 235\r
2ab6330e 236 Retrieves the current pointer to the buffer for a PCD token number. \r
237 Do not make any assumptions about the alignment of the pointer that \r
238 is returned by this function call. If the TokenNumber is invalid, \r
239 the results are unpredictable.\r
80408db0 240\r
2ab6330e 241 @param[in] TokenNumber The PCD token number. \r
242\r
243 @return The pointer to the buffer to be retrived.\r
244 \r
245**/\r
80408db0 246VOID *\r
247EFIAPI\r
248DxePcdGetPtr (\r
249 IN UINTN TokenNumber\r
250 )\r
251{\r
252 return GetWorker (TokenNumber, 0);\r
253}\r
254\r
2ab6330e 255/**\r
256 Retrieves a Boolean value for a given PCD token.\r
257\r
258 Retrieves the current boolean value for a PCD token number. \r
259 Do not make any assumptions about the alignment of the pointer that \r
260 is returned by this function call. If the TokenNumber is invalid, \r
261 the results are unpredictable.\r
80408db0 262\r
2ab6330e 263 @param[in] TokenNumber The PCD token number. \r
80408db0 264\r
2ab6330e 265 @return The Boolean value.\r
266 \r
267**/\r
80408db0 268BOOLEAN\r
269EFIAPI\r
270DxePcdGetBool (\r
271 IN UINTN TokenNumber\r
272 )\r
273{\r
274 return *((BOOLEAN *) GetWorker (TokenNumber, sizeof (BOOLEAN)));\r
275}\r
276\r
2ab6330e 277/**\r
278 Retrieves the size of the value for a given PCD token.\r
80408db0 279\r
2ab6330e 280 Retrieves the current size of a particular PCD token. \r
281 If the TokenNumber is invalid, the results are unpredictable.\r
80408db0 282\r
2ab6330e 283 @param[in] TokenNumber The PCD token number. \r
284\r
285 @return The size of the value for the PCD token.\r
286 \r
287**/\r
80408db0 288UINTN\r
289EFIAPI\r
290DxePcdGetSize (\r
291 IN UINTN TokenNumber\r
292 )\r
293{\r
294 UINTN Size;\r
295 UINT32 *LocalTokenNumberTable;\r
296 BOOLEAN IsPeiDb;\r
297 UINTN MaxSize;\r
298 UINTN TmpTokenNumber;\r
299 //\r
300 // TokenNumber Zero is reserved as PCD_INVALID_TOKEN_NUMBER.\r
301 // We have to decrement TokenNumber by 1 to make it usable\r
302 // as the array index.\r
303 //\r
304 TokenNumber--;\r
305\r
306 //\r
307 // Backup the TokenNumber passed in as GetPtrTypeSize need the original TokenNumber\r
308 // \r
309 TmpTokenNumber = TokenNumber;\r
310\r
311 // EBC compiler is very choosy. It may report warning about comparison\r
312 // between UINTN and 0 . So we add 1 in each size of the \r
313 // comparison.\r
314 ASSERT (TokenNumber + 1 < PCD_TOTAL_TOKEN_NUMBER + 1);\r
315\r
316 // EBC compiler is very choosy. It may report warning about comparison\r
317 // between UINTN and 0 . So we add 1 in each size of the \r
318 // comparison.\r
319 IsPeiDb = (BOOLEAN) (TokenNumber + 1 < PEI_LOCAL_TOKEN_NUMBER + 1);\r
320 \r
321 TokenNumber = IsPeiDb ? TokenNumber : \r
322 (TokenNumber - PEI_LOCAL_TOKEN_NUMBER);\r
323\r
324 LocalTokenNumberTable = IsPeiDb ? mPcdDatabase->PeiDb.Init.LocalTokenNumberTable \r
325 : mPcdDatabase->DxeDb.Init.LocalTokenNumberTable;\r
326\r
327 Size = (LocalTokenNumberTable[TokenNumber] & PCD_DATUM_TYPE_ALL_SET) >> PCD_DATUM_TYPE_SHIFT;\r
328\r
329 if (Size == 0) {\r
330 //\r
331 // For pointer type, we need to scan the SIZE_TABLE to get the current size.\r
332 //\r
333 return GetPtrTypeSize (TmpTokenNumber, &MaxSize);\r
334 } else {\r
335 return Size;\r
336 }\r
337\r
338}\r
339\r
2ab6330e 340/**\r
341 Retrieves an 8-bit value for a given PCD token.\r
342\r
343 Retrieves the 8-bit value of a particular PCD token. \r
344 If the TokenNumber is invalid or the token space\r
345 specified by Guid does not exist, the results are \r
346 unpredictable.\r
80408db0 347\r
2ab6330e 348 @param[in] Guid The token space for the token number.\r
349 @param[in] ExTokenNumber The PCD token number. \r
80408db0 350\r
2ab6330e 351 @return The size 8-bit value for the PCD token.\r
352 \r
353**/\r
80408db0 354UINT8\r
355EFIAPI\r
356DxePcdGet8Ex (\r
357 IN CONST EFI_GUID *Guid,\r
2ab6330e 358 IN UINTN ExTokenNumber\r
80408db0 359 )\r
360{\r
361 return *((UINT8 *) ExGetWorker (Guid, ExTokenNumber, sizeof(UINT8)));\r
362}\r
363\r
2ab6330e 364/**\r
365 Retrieves an 16-bit value for a given PCD token.\r
366\r
367 Retrieves the 16-bit value of a particular PCD token. \r
368 If the TokenNumber is invalid or the token space\r
369 specified by Guid does not exist, the results are \r
370 unpredictable.\r
80408db0 371\r
2ab6330e 372 @param[in] Guid The token space for the token number.\r
373 @param[in] ExTokenNumber The PCD token number. \r
80408db0 374\r
2ab6330e 375 @return The size 16-bit value for the PCD token.\r
376 \r
377**/\r
80408db0 378UINT16\r
379EFIAPI\r
380DxePcdGet16Ex (\r
381 IN CONST EFI_GUID *Guid,\r
382 IN UINTN ExTokenNumber\r
383 )\r
384{\r
385 return ReadUnaligned16 (ExGetWorker (Guid, ExTokenNumber, sizeof(UINT16)));\r
386}\r
387\r
2ab6330e 388/**\r
389 Retrieves an 32-bit value for a given PCD token.\r
390\r
391 Retrieves the 32-bit value of a particular PCD token. \r
392 If the TokenNumber is invalid or the token space\r
393 specified by Guid does not exist, the results are \r
394 unpredictable.\r
80408db0 395\r
2ab6330e 396 @param[in] Guid The token space for the token number.\r
397 @param[in] ExTokenNumber The PCD token number. \r
80408db0 398\r
2ab6330e 399 @return The size 32-bit value for the PCD token.\r
400 \r
401**/\r
80408db0 402UINT32\r
403EFIAPI\r
404DxePcdGet32Ex (\r
405 IN CONST EFI_GUID *Guid,\r
406 IN UINTN ExTokenNumber\r
407 )\r
408{\r
409 return ReadUnaligned32 (ExGetWorker (Guid, ExTokenNumber, sizeof(UINT32)));\r
410}\r
411\r
2ab6330e 412/**\r
413 Retrieves an 64-bit value for a given PCD token.\r
80408db0 414\r
2ab6330e 415 Retrieves the 64-bit value of a particular PCD token. \r
416 If the TokenNumber is invalid or the token space\r
417 specified by Guid does not exist, the results are \r
418 unpredictable.\r
80408db0 419\r
2ab6330e 420 @param[in] Guid The token space for the token number.\r
421 @param[in] ExTokenNumber The PCD token number. \r
422\r
423 @return The size 64-bit value for the PCD token.\r
424 \r
425**/\r
80408db0 426UINT64\r
427EFIAPI\r
428DxePcdGet64Ex (\r
429 IN CONST EFI_GUID *Guid,\r
430 IN UINTN ExTokenNumber\r
431 )\r
432{\r
433 return ReadUnaligned64 (ExGetWorker (Guid, ExTokenNumber, sizeof(UINT64)));\r
434}\r
435\r
2ab6330e 436/**\r
437 Retrieves a pointer to a value for a given PCD token.\r
438\r
439 Retrieves the current pointer to the buffer for a PCD token number. \r
440 Do not make any assumptions about the alignment of the pointer that \r
441 is returned by this function call. If the TokenNumber is invalid, \r
442 the results are unpredictable.\r
80408db0 443\r
2ab6330e 444 @param[in] Guid The token space for the token number.\r
445 @param[in] ExTokenNumber The PCD token number. \r
80408db0 446\r
2ab6330e 447 @return The pointer to the buffer to be retrived.\r
448 \r
449**/\r
80408db0 450VOID *\r
451EFIAPI\r
452DxePcdGetPtrEx (\r
453 IN CONST EFI_GUID *Guid,\r
454 IN UINTN ExTokenNumber\r
455 )\r
456{\r
457 return ExGetWorker (Guid, ExTokenNumber, 0);\r
458}\r
459\r
2ab6330e 460/**\r
461 Retrieves an Boolean value for a given PCD token.\r
80408db0 462\r
2ab6330e 463 Retrieves the Boolean value of a particular PCD token. \r
464 If the TokenNumber is invalid or the token space\r
465 specified by Guid does not exist, the results are \r
466 unpredictable.\r
80408db0 467\r
2ab6330e 468 @param[in] Guid The token space for the token number.\r
469 @param[in] ExTokenNumber The PCD token number. \r
470\r
471 @return The size Boolean value for the PCD token.\r
472 \r
473**/\r
80408db0 474BOOLEAN\r
475EFIAPI\r
476DxePcdGetBoolEx (\r
477 IN CONST EFI_GUID *Guid,\r
478 IN UINTN ExTokenNumber\r
479 )\r
480{\r
481 return *((BOOLEAN *) ExGetWorker (Guid, ExTokenNumber, sizeof(BOOLEAN)));\r
482}\r
483\r
2ab6330e 484/**\r
485 Retrieves the size of the value for a given PCD token.\r
486\r
487 Retrieves the current size of a particular PCD token. \r
488 If the TokenNumber is invalid, the results are unpredictable.\r
80408db0 489\r
2ab6330e 490 @param[in] Guid The token space for the token number.\r
491 @param[in] ExTokenNumber The PCD token number. \r
80408db0 492\r
2ab6330e 493 @return The size of the value for the PCD token.\r
494 \r
495**/\r
80408db0 496UINTN\r
497EFIAPI\r
498DxePcdGetSizeEx (\r
499 IN CONST EFI_GUID *Guid,\r
500 IN UINTN ExTokenNumber\r
501 )\r
502{\r
503 return DxePcdGetSize(GetExPcdTokenNumber (Guid, (UINT32) ExTokenNumber));\r
504}\r
505\r
2ab6330e 506/**\r
507 Sets an 8-bit value for a given PCD token.\r
508\r
509 When the PCD service sets a value, it will check to ensure that the \r
510 size of the value being set is compatible with the Token's existing definition. \r
511 If it is not, an error will be returned.\r
80408db0 512\r
2ab6330e 513 @param[in] TokenNumber The PCD token number. \r
514 @param[in] Value The value to set for the PCD token.\r
80408db0 515\r
2ab6330e 516 @retval EFI_SUCCESS Procedure returned successfully.\r
517 @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data \r
518 being set was incompatible with a call to this function. \r
519 Use GetSize() to retrieve the size of the target data.\r
520 @retval EFI_NOT_FOUND The PCD service could not find the requested token number.\r
521 \r
522**/\r
80408db0 523EFI_STATUS\r
524EFIAPI\r
525DxePcdSet8 (\r
526 IN UINTN TokenNumber,\r
527 IN UINT8 Value\r
528 )\r
529{\r
530 return SetValueWorker (TokenNumber, &Value, sizeof (Value));\r
531}\r
532\r
2ab6330e 533/**\r
534 Sets an 16-bit value for a given PCD token.\r
80408db0 535\r
2ab6330e 536 When the PCD service sets a value, it will check to ensure that the \r
537 size of the value being set is compatible with the Token's existing definition. \r
538 If it is not, an error will be returned.\r
80408db0 539\r
2ab6330e 540 @param[in] TokenNumber The PCD token number. \r
541 @param[in] Value The value to set for the PCD token.\r
542\r
543 @retval EFI_SUCCESS Procedure returned successfully.\r
544 @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data \r
545 being set was incompatible with a call to this function. \r
546 Use GetSize() to retrieve the size of the target data.\r
547 @retval EFI_NOT_FOUND The PCD service could not find the requested token number.\r
548 \r
549**/\r
80408db0 550EFI_STATUS\r
551EFIAPI\r
552DxePcdSet16 (\r
553 IN UINTN TokenNumber,\r
554 IN UINT16 Value\r
555 )\r
556{\r
557 return SetValueWorker (TokenNumber, &Value, sizeof (Value));\r
558}\r
559\r
2ab6330e 560/**\r
561 Sets an 32-bit value for a given PCD token.\r
562\r
563 When the PCD service sets a value, it will check to ensure that the \r
564 size of the value being set is compatible with the Token's existing definition. \r
565 If it is not, an error will be returned.\r
80408db0 566\r
2ab6330e 567 @param[in] TokenNumber The PCD token number. \r
568 @param[in] Value The value to set for the PCD token.\r
80408db0 569\r
2ab6330e 570 @retval EFI_SUCCESS Procedure returned successfully.\r
571 @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data \r
572 being set was incompatible with a call to this function. \r
573 Use GetSize() to retrieve the size of the target data.\r
574 @retval EFI_NOT_FOUND The PCD service could not find the requested token number.\r
575 \r
576**/\r
80408db0 577EFI_STATUS\r
578EFIAPI\r
579DxePcdSet32 (\r
580 IN UINTN TokenNumber,\r
581 IN UINT32 Value\r
582 )\r
583{\r
584 return SetValueWorker (TokenNumber, &Value, sizeof (Value));\r
585}\r
586\r
2ab6330e 587/**\r
588 Sets an 64-bit value for a given PCD token.\r
80408db0 589\r
2ab6330e 590 When the PCD service sets a value, it will check to ensure that the \r
591 size of the value being set is compatible with the Token's existing definition. \r
592 If it is not, an error will be returned.\r
80408db0 593\r
2ab6330e 594 @param[in] TokenNumber The PCD token number. \r
595 @param[in] Value The value to set for the PCD token.\r
596\r
597 @retval EFI_SUCCESS Procedure returned successfully.\r
598 @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data \r
599 being set was incompatible with a call to this function. \r
600 Use GetSize() to retrieve the size of the target data.\r
601 @retval EFI_NOT_FOUND The PCD service could not find the requested token number.\r
602 \r
603**/\r
80408db0 604EFI_STATUS\r
605EFIAPI\r
606DxePcdSet64 (\r
607 IN UINTN TokenNumber,\r
608 IN UINT64 Value\r
609 )\r
610{\r
611 return SetValueWorker (TokenNumber, &Value, sizeof (Value));\r
612}\r
613\r
2ab6330e 614/**\r
615 Sets a value of a specified size for a given PCD token.\r
616\r
617 When the PCD service sets a value, it will check to ensure that the \r
618 size of the value being set is compatible with the Token's existing definition. \r
619 If it is not, an error will be returned.\r
620\r
621 @param[in] TokenNumber The PCD token number. \r
622 @param[in, out] SizeOfBuffer A pointer to the length of the value being set for the PCD token. \r
623 On input, if the SizeOfValue is greater than the maximum size supported \r
624 for this TokenNumber then the output value of SizeOfValue will reflect \r
625 the maximum size supported for this TokenNumber.\r
626 @param[in] Buffer The buffer to set for the PCD token.\r
627\r
628 @retval EFI_SUCCESS Procedure returned successfully.\r
629 @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data \r
630 being set was incompatible with a call to this function. \r
631 Use GetSize() to retrieve the size of the target data.\r
632 @retval EFI_NOT_FOUND The PCD service could not find the requested token number.\r
633 \r
634**/\r
80408db0 635EFI_STATUS\r
636EFIAPI\r
637DxePcdSetPtr (\r
638 IN UINTN TokenNumber,\r
639 IN OUT UINTN *SizeOfBuffer,\r
640 IN VOID *Buffer\r
641 )\r
642{\r
643 return SetWorker (TokenNumber, Buffer, SizeOfBuffer, TRUE);\r
644}\r
645\r
2ab6330e 646/**\r
647 Sets an Boolean value for a given PCD token.\r
80408db0 648\r
2ab6330e 649 When the PCD service sets a value, it will check to ensure that the \r
650 size of the value being set is compatible with the Token's existing definition. \r
651 If it is not, an error will be returned.\r
80408db0 652\r
2ab6330e 653 @param[in] TokenNumber The PCD token number. \r
654 @param[in] Value The value to set for the PCD token.\r
655\r
656 @retval EFI_SUCCESS Procedure returned successfully.\r
657 @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data \r
658 being set was incompatible with a call to this function. \r
659 Use GetSize() to retrieve the size of the target data.\r
660 @retval EFI_NOT_FOUND The PCD service could not find the requested token number.\r
661 \r
662**/\r
80408db0 663EFI_STATUS\r
664EFIAPI\r
665DxePcdSetBool (\r
666 IN UINTN TokenNumber,\r
667 IN BOOLEAN Value\r
668 )\r
669{\r
670 return SetValueWorker (TokenNumber, &Value, sizeof (Value));\r
671}\r
672\r
2ab6330e 673/**\r
674 Sets an 8-bit value for a given PCD token.\r
675\r
676 When the PCD service sets a value, it will check to ensure that the \r
677 size of the value being set is compatible with the Token's existing definition. \r
678 If it is not, an error will be returned.\r
80408db0 679\r
2ab6330e 680 @param[in] Guid The 128-bit unique value that designates the namespace from which to extract the value.\r
681 @param[in] ExTokenNumber The PCD token number. \r
682 @param[in] Value The value to set for the PCD token.\r
80408db0 683\r
2ab6330e 684 @retval EFI_SUCCESS Procedure returned successfully.\r
685 @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data \r
686 being set was incompatible with a call to this function. \r
687 Use GetSize() to retrieve the size of the target data.\r
688 @retval EFI_NOT_FOUND The PCD service could not find the requested token number.\r
689 \r
690**/\r
80408db0 691EFI_STATUS\r
692EFIAPI\r
693DxePcdSet8Ex (\r
694 IN CONST EFI_GUID *Guid,\r
695 IN UINTN ExTokenNumber,\r
696 IN UINT8 Value\r
697 )\r
698{\r
699 return ExSetValueWorker (ExTokenNumber, Guid, &Value, sizeof (Value));\r
700}\r
701\r
2ab6330e 702/**\r
703 Sets an 16-bit value for a given PCD token.\r
80408db0 704\r
2ab6330e 705 When the PCD service sets a value, it will check to ensure that the \r
706 size of the value being set is compatible with the Token's existing definition. \r
707 If it is not, an error will be returned.\r
80408db0 708\r
2ab6330e 709 @param[in] Guid The 128-bit unique value that designates the namespace from which to extract the value.\r
710 @param[in] ExTokenNumber The PCD token number. \r
711 @param[in] Value The value to set for the PCD token.\r
712\r
713 @retval EFI_SUCCESS Procedure returned successfully.\r
714 @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data \r
715 being set was incompatible with a call to this function. \r
716 Use GetSize() to retrieve the size of the target data.\r
717 @retval EFI_NOT_FOUND The PCD service could not find the requested token number.\r
718 \r
719**/\r
80408db0 720EFI_STATUS\r
721EFIAPI\r
722DxePcdSet16Ex (\r
723 IN CONST EFI_GUID *Guid,\r
724 IN UINTN ExTokenNumber,\r
725 IN UINT16 Value\r
726 )\r
727{\r
728 return ExSetValueWorker (ExTokenNumber, Guid, &Value, sizeof (Value));\r
729}\r
730\r
2ab6330e 731/**\r
732 Sets an 32-bit value for a given PCD token.\r
733\r
734 When the PCD service sets a value, it will check to ensure that the \r
735 size of the value being set is compatible with the Token's existing definition. \r
736 If it is not, an error will be returned.\r
80408db0 737\r
2ab6330e 738 @param[in] Guid The 128-bit unique value that designates the namespace from which to extract the value.\r
739 @param[in] ExTokenNumber The PCD token number. \r
740 @param[in] Value The value to set for the PCD token.\r
80408db0 741\r
2ab6330e 742 @retval EFI_SUCCESS Procedure returned successfully.\r
743 @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data \r
744 being set was incompatible with a call to this function. \r
745 Use GetSize() to retrieve the size of the target data.\r
746 @retval EFI_NOT_FOUND The PCD service could not find the requested token number.\r
747 \r
748**/\r
80408db0 749EFI_STATUS\r
750EFIAPI\r
751DxePcdSet32Ex (\r
752 IN CONST EFI_GUID *Guid,\r
753 IN UINTN ExTokenNumber,\r
754 IN UINT32 Value\r
755 )\r
756{\r
757 return ExSetValueWorker (ExTokenNumber, Guid, &Value, sizeof (Value));\r
758}\r
759\r
2ab6330e 760/**\r
761 Sets an 64-bit value for a given PCD token.\r
762\r
763 When the PCD service sets a value, it will check to ensure that the \r
764 size of the value being set is compatible with the Token's existing definition. \r
765 If it is not, an error will be returned.\r
80408db0 766\r
2ab6330e 767 @param[in] Guid The 128-bit unique value that designates the namespace from which to extract the value.\r
768 @param[in] ExTokenNumber The PCD token number. \r
769 @param[in] Value The value to set for the PCD token.\r
80408db0 770\r
2ab6330e 771 @retval EFI_SUCCESS Procedure returned successfully.\r
772 @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data \r
773 being set was incompatible with a call to this function. \r
774 Use GetSize() to retrieve the size of the target data.\r
775 @retval EFI_NOT_FOUND The PCD service could not find the requested token number.\r
776 \r
777**/\r
80408db0 778EFI_STATUS\r
779EFIAPI\r
780DxePcdSet64Ex (\r
781 IN CONST EFI_GUID *Guid,\r
782 IN UINTN ExTokenNumber,\r
783 IN UINT64 Value\r
784 )\r
785{\r
786 return ExSetValueWorker (ExTokenNumber, Guid, &Value, sizeof (Value));\r
787}\r
788\r
2ab6330e 789/**\r
790 Sets a value of a specified size for a given PCD token.\r
791\r
792 When the PCD service sets a value, it will check to ensure that the \r
793 size of the value being set is compatible with the Token's existing definition. \r
794 If it is not, an error will be returned.\r
795\r
796 @param[in] Guid The 128-bit unique value that designates the namespace from which to extract the value.\r
797 @param[in] ExTokenNumber The PCD token number. \r
798 @param[in, out] SizeOfBuffer A pointer to the length of the value being set for the PCD token. \r
799 On input, if the SizeOfValue is greater than the maximum size supported \r
800 for this TokenNumber then the output value of SizeOfValue will reflect \r
801 the maximum size supported for this TokenNumber.\r
802 @param[in] Buffer The buffer to set for the PCD token.\r
803\r
804 @retval EFI_SUCCESS Procedure returned successfully.\r
805 @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data \r
806 being set was incompatible with a call to this function. \r
807 Use GetSize() to retrieve the size of the target data.\r
808 @retval EFI_NOT_FOUND The PCD service could not find the requested token number.\r
809 \r
810**/\r
80408db0 811EFI_STATUS\r
812EFIAPI\r
813DxePcdSetPtrEx (\r
814 IN CONST EFI_GUID *Guid,\r
815 IN UINTN ExTokenNumber,\r
816 IN OUT UINTN *SizeOfBuffer,\r
817 IN VOID *Buffer\r
818 )\r
819{\r
820 return ExSetWorker(ExTokenNumber, Guid, Buffer, SizeOfBuffer, TRUE);\r
821}\r
822\r
2ab6330e 823/**\r
824 Sets an Boolean value for a given PCD token.\r
80408db0 825\r
2ab6330e 826 When the PCD service sets a value, it will check to ensure that the \r
827 size of the value being set is compatible with the Token's existing definition. \r
828 If it is not, an error will be returned.\r
80408db0 829\r
2ab6330e 830 @param[in] Guid The 128-bit unique value that designates the namespace from which to extract the value.\r
831 @param[in] ExTokenNumber The PCD token number. \r
832 @param[in] Value The value to set for the PCD token.\r
833\r
834 @retval EFI_SUCCESS Procedure returned successfully.\r
835 @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data \r
836 being set was incompatible with a call to this function. \r
837 Use GetSize() to retrieve the size of the target data.\r
838 @retval EFI_NOT_FOUND The PCD service could not find the requested token number.\r
839 \r
840**/\r
80408db0 841EFI_STATUS\r
842EFIAPI\r
843DxePcdSetBoolEx (\r
844 IN CONST EFI_GUID *Guid,\r
845 IN UINTN ExTokenNumber,\r
846 IN BOOLEAN Value\r
847 )\r
848{\r
849 return ExSetValueWorker (ExTokenNumber, Guid, &Value, sizeof (Value));\r
850}\r
851\r
2ab6330e 852/**\r
853 Specifies a function to be called anytime the value of a designated token is changed.\r
80408db0 854\r
2ab6330e 855 @param[in] Guid The 128-bit unique value that designates the namespace from which to extract the value.\r
856 @param[in] TokenNumber The PCD token number. \r
857 @param[in] CallBackFunction The function prototype called when the value associated with the CallBackToken is set. \r
80408db0 858\r
2ab6330e 859 @retval EFI_SUCCESS The PCD service has successfully established a call event \r
860 for the CallBackToken requested.\r
861 @retval EFI_NOT_FOUND The PCD service could not find the referenced token number.\r
80408db0 862\r
2ab6330e 863**/\r
80408db0 864EFI_STATUS\r
865EFIAPI\r
866DxeRegisterCallBackOnSet (\r
867 IN CONST EFI_GUID *Guid, OPTIONAL\r
868 IN UINTN TokenNumber,\r
869 IN PCD_PROTOCOL_CALLBACK CallBackFunction\r
870 )\r
871{\r
872 EFI_STATUS Status;\r
873 \r
874 ASSERT (CallBackFunction != NULL);\r
875 \r
876 //\r
877 // Aquire lock to prevent reentrance from TPL_CALLBACK level\r
878 //\r
879 EfiAcquireLock (&mPcdDatabaseLock);\r
880\r
881 Status = DxeRegisterCallBackWorker (TokenNumber, Guid, CallBackFunction);\r
882\r
883 EfiReleaseLock (&mPcdDatabaseLock);\r
884 \r
885 return Status;\r
886}\r
887\r
2ab6330e 888/**\r
889 Cancels a previously set callback function for a particular PCD token number.\r
80408db0 890\r
2ab6330e 891 @param[in] Guid The 128-bit unique value that designates the namespace from which to extract the value.\r
892 @param[in] TokenNumber The PCD token number. \r
893 @param[in] CallBackFunction The function prototype called when the value associated with the CallBackToken is set. \r
80408db0 894\r
2ab6330e 895 @retval EFI_SUCCESS The PCD service has successfully established a call event \r
896 for the CallBackToken requested.\r
897 @retval EFI_NOT_FOUND The PCD service could not find the referenced token number.\r
898\r
899**/\r
80408db0 900EFI_STATUS\r
901EFIAPI\r
902DxeUnRegisterCallBackOnSet (\r
903 IN CONST EFI_GUID *Guid, OPTIONAL\r
904 IN UINTN TokenNumber,\r
905 IN PCD_PROTOCOL_CALLBACK CallBackFunction\r
906 )\r
907{\r
908 EFI_STATUS Status;\r
909 \r
910 ASSERT (CallBackFunction != NULL);\r
911\r
912 //\r
913 // Aquire lock to prevent reentrance from TPL_CALLBACK level\r
914 //\r
915 EfiAcquireLock (&mPcdDatabaseLock);\r
916 \r
917 Status = DxeUnRegisterCallBackWorker (TokenNumber, Guid, CallBackFunction);\r
918\r
919 EfiReleaseLock (&mPcdDatabaseLock);\r
920 \r
921 return Status;\r
922}\r
923\r
2ab6330e 924/**\r
925 Retrieves the next valid PCD token for a given namespace.\r
80408db0 926\r
2ab6330e 927 @param[in] Guid The 128-bit unique value that designates the namespace from which to extract the value.\r
928 @param[in, out] TokenNumber A pointer to the PCD token number to use to find the subsequent token number. \r
929 If the input token namespace or token number does not exist on the platform, \r
930 an error is returned and the value of *TokenNumber is undefined. To retrieve the "first" token, \r
931 have the pointer reference a TokenNumber value of 0. If the input token number is 0 and \r
932 there is no valid token number for this token namespace, *TokenNumber will be assigned to \r
933 0 and the function return EFI_SUCCESS. If the token number is the last valid token number, \r
934 *TokenNumber will be assigned to 0 and the function return EFI_SUCCESS.\r
80408db0 935\r
2ab6330e 936 @retval EFI_SUCCESS The PCD service retrieved the next valid token number. Or the input token number \r
937 is already the last valid token number in the PCD database. \r
938 In the later case, *TokenNumber is updated with the value of 0.\r
939 @retval EFI_NOT_FOUND If this input token number and token namespace does not exist on the platform.\r
940\r
941**/\r
80408db0 942EFI_STATUS\r
943EFIAPI\r
944DxePcdGetNextToken (\r
945 IN CONST EFI_GUID *Guid, OPTIONAL\r
946 IN OUT UINTN *TokenNumber\r
947 )\r
948{\r
949 EFI_STATUS Status;\r
950 BOOLEAN PeiExMapTableEmpty;\r
951 BOOLEAN DxeExMapTableEmpty;\r
952\r
953 if (!FeaturePcdGet (PcdDxePcdDatabaseTraverseEnabled)) {\r
954 return EFI_UNSUPPORTED;\r
955 }\r
956\r
957 Status = EFI_NOT_FOUND;\r
958 PeiExMapTableEmpty = PEI_EXMAP_TABLE_EMPTY;\r
959 DxeExMapTableEmpty = DXE_EXMAP_TABLE_EMPTY;\r
960\r
961 //\r
962 // Scan the local token space\r
963 //\r
964 if (Guid == NULL) {\r
965 // EBC compiler is very choosy. It may report warning about comparison\r
966 // between UINTN and 0 . So we add 1 in each size of the \r
967 // comparison.\r
968 if (((*TokenNumber + 1 > PEI_NEX_TOKEN_NUMBER + 1) && (*TokenNumber + 1 < PEI_LOCAL_TOKEN_NUMBER + 1)) ||\r
969 ((*TokenNumber + 1 > (PEI_LOCAL_TOKEN_NUMBER + DXE_NEX_TOKEN_NUMBER + 1)))) {\r
970 return EFI_NOT_FOUND;\r
971 }\r
972 \r
973 (*TokenNumber)++;\r
974 if ((*TokenNumber + 1 > PEI_NEX_TOKEN_NUMBER + 1) &&\r
975 (*TokenNumber <= PEI_LOCAL_TOKEN_NUMBER)) {\r
976 //\r
977 // The first Non-Ex type Token Number for DXE PCD \r
978 // database is PEI_LOCAL_TOKEN_NUMBER\r
979 //\r
980 *TokenNumber = PEI_LOCAL_TOKEN_NUMBER;\r
981 } else if (*TokenNumber + 1 > DXE_NEX_TOKEN_NUMBER + PEI_LOCAL_TOKEN_NUMBER + 1) {\r
982 *TokenNumber = PCD_INVALID_TOKEN_NUMBER;\r
983 }\r
984 return EFI_SUCCESS;\r
985 }\r
986\r
987 if (PeiExMapTableEmpty && DxeExMapTableEmpty) {\r
988 *TokenNumber = PCD_INVALID_TOKEN_NUMBER;\r
989 return EFI_NOT_FOUND;\r
990 }\r
991\r
992 if (!PeiExMapTableEmpty) {\r
993 Status = ExGetNextTokeNumber (\r
994 Guid,\r
995 TokenNumber,\r
996 mPcdDatabase->PeiDb.Init.GuidTable,\r
997 sizeof(mPcdDatabase->PeiDb.Init.GuidTable),\r
998 mPcdDatabase->PeiDb.Init.ExMapTable,\r
999 sizeof(mPcdDatabase->PeiDb.Init.ExMapTable)\r
1000 );\r
1001 }\r
1002\r
1003 if (Status == EFI_SUCCESS) {\r
1004 return Status;\r
1005 }\r
1006\r
1007 if (!DxeExMapTableEmpty) {\r
1008 Status = ExGetNextTokeNumber (\r
1009 Guid,\r
1010 TokenNumber,\r
1011 mPcdDatabase->DxeDb.Init.GuidTable,\r
1012 sizeof(mPcdDatabase->DxeDb.Init.GuidTable),\r
1013 mPcdDatabase->DxeDb.Init.ExMapTable,\r
1014 sizeof(mPcdDatabase->DxeDb.Init.ExMapTable)\r
1015 );\r
1016 }\r
1017\r
1018 return Status;\r
1019}\r
1020\r
2ab6330e 1021/**\r
1022 Get all token space guid table which is different with given token space guid.\r
1023\r
1024 @param ExMapTableSize The size of guid table\r
1025 @param ExMapTable Token space guid table that want to be scaned.\r
1026 @param GuidTable Guid table\r
1027\r
1028 @return all token space guid table which is different with given token space guid.\r
1029\r
1030**/\r
80408db0 1031EFI_GUID **\r
1032GetDistinctTokenSpace (\r
1033 IN OUT UINTN *ExMapTableSize,\r
1034 IN DYNAMICEX_MAPPING *ExMapTable,\r
1035 IN EFI_GUID *GuidTable\r
1036 )\r
1037{\r
1038 EFI_GUID **DistinctTokenSpace;\r
1039 UINTN OldGuidIndex;\r
1040 UINTN TsIdx;\r
1041 UINTN Idx;\r
1042\r
1043\r
1044 DistinctTokenSpace = AllocateZeroPool (*ExMapTableSize * sizeof (EFI_GUID *));\r
1045 ASSERT (DistinctTokenSpace != NULL);\r
1046\r
1047 TsIdx = 0;\r
1048 OldGuidIndex = ExMapTable[0].ExGuidIndex;\r
1049 DistinctTokenSpace[TsIdx] = &GuidTable[OldGuidIndex];\r
1050 for (Idx = 1; Idx < *ExMapTableSize; Idx++) {\r
1051 if (ExMapTable[Idx].ExGuidIndex != OldGuidIndex) {\r
1052 OldGuidIndex = ExMapTable[Idx].ExGuidIndex;\r
1053 DistinctTokenSpace[++TsIdx] = &GuidTable[OldGuidIndex];\r
1054 }\r
1055 }\r
1056\r
1057 //\r
1058 // The total number of Distinct Token Space\r
1059 // is TsIdx + 1 because we use TsIdx as a index\r
1060 // to the DistinctTokenSpace[]\r
1061 //\r
1062 *ExMapTableSize = TsIdx + 1;\r
1063 return DistinctTokenSpace;\r
1064 \r
1065}\r
1066 \r
2ab6330e 1067/**\r
1068 Get next token space in PCD database according to given token space guid.\r
1069 \r
1070 This routine is enable only when feature flag PCD PcdDxePcdDatabaseTraverseEnabled \r
1071 is TRUE.\r
1072 \r
1073 @param Guid Given token space guid. If NULL, then Guid will be set to \r
1074 the first PCD token space in PCD database, If not NULL, then\r
1075 Guid will be set to next PCD token space.\r
1076\r
1077 @retval EFI_UNSUPPORTED If feature flag PCD PcdDxePcdDatabaseTraverseEnabled is FALSE.\r
1078 @retval EFI_NOT_FOUND If PCD database has no token space table or can not find given\r
1079 token space in PCD database.\r
1080 @retval EFI_SUCCESS Success to get next token space guid.\r
1081**/\r
80408db0 1082EFI_STATUS\r
1083EFIAPI\r
1084DxePcdGetNextTokenSpace (\r
1085 IN OUT CONST EFI_GUID **Guid\r
1086 )\r
1087{\r
1088 UINTN Idx;\r
1089 UINTN Idx2;\r
1090 UINTN Idx3;\r
1091 UINTN PeiTokenSpaceTableSize;\r
1092 UINTN DxeTokenSpaceTableSize;\r
1093 EFI_GUID **PeiTokenSpaceTable;\r
1094 EFI_GUID **DxeTokenSpaceTable;\r
1095 BOOLEAN Match;\r
1096 BOOLEAN PeiExMapTableEmpty;\r
1097 BOOLEAN DxeExMapTableEmpty;\r
1098\r
1099 if (!FeaturePcdGet (PcdDxePcdDatabaseTraverseEnabled)) {\r
1100 return EFI_UNSUPPORTED;\r
1101 }\r
1102\r
1103 ASSERT (Guid != NULL);\r
1104 \r
1105 PeiExMapTableEmpty = PEI_EXMAP_TABLE_EMPTY;\r
1106 DxeExMapTableEmpty = DXE_EXMAP_TABLE_EMPTY;\r
1107\r
1108 if (PeiExMapTableEmpty && DxeExMapTableEmpty) {\r
1109 if (*Guid != NULL) {\r
1110 return EFI_NOT_FOUND;\r
1111 } else {\r
1112 return EFI_SUCCESS;\r
1113 }\r
1114 }\r
1115 \r
1116 \r
1117 if (TmpTokenSpaceBuffer[0] == NULL) {\r
1118 PeiTokenSpaceTableSize = 0;\r
1119\r
1120 if (!PeiExMapTableEmpty) {\r
1121 PeiTokenSpaceTableSize = PEI_EXMAPPING_TABLE_SIZE;\r
1122 PeiTokenSpaceTable = GetDistinctTokenSpace (&PeiTokenSpaceTableSize,\r
1123 mPcdDatabase->PeiDb.Init.ExMapTable,\r
1124 mPcdDatabase->PeiDb.Init.GuidTable\r
1125 );\r
1126 CopyMem (TmpTokenSpaceBuffer, PeiTokenSpaceTable, sizeof (EFI_GUID*) * PeiTokenSpaceTableSize);\r
1127 }\r
1128\r
1129 if (!DxeExMapTableEmpty) {\r
1130 DxeTokenSpaceTableSize = DXE_EXMAPPING_TABLE_SIZE;\r
1131 DxeTokenSpaceTable = GetDistinctTokenSpace (&DxeTokenSpaceTableSize,\r
1132 mPcdDatabase->DxeDb.Init.ExMapTable,\r
1133 mPcdDatabase->DxeDb.Init.GuidTable\r
1134 );\r
1135\r
1136 //\r
1137 // Make sure EFI_GUID in DxeTokenSpaceTable does not exist in PeiTokenSpaceTable\r
1138 //\r
1139 for (Idx2 = 0, Idx3 = PeiTokenSpaceTableSize; Idx2 < DxeTokenSpaceTableSize; Idx2++) {\r
1140 Match = FALSE;\r
1141 for (Idx = 0; Idx < PeiTokenSpaceTableSize; Idx++) {\r
1142 if (CompareGuid (TmpTokenSpaceBuffer[Idx], DxeTokenSpaceTable[Idx2])) {\r
1143 Match = TRUE;\r
1144 break;\r
1145 }\r
1146 }\r
1147 if (!Match) {\r
1148 TmpTokenSpaceBuffer[Idx3++] = DxeTokenSpaceTable[Idx2];\r
1149 }\r
1150 }\r
1151 }\r
1152 }\r
1153\r
1154 if (*Guid == NULL) {\r
1155 *Guid = TmpTokenSpaceBuffer[0];\r
1156 return EFI_SUCCESS;\r
1157 }\r
1158 \r
1159 for (Idx = 0; Idx < (PEI_EXMAPPING_TABLE_SIZE + DXE_EXMAPPING_TABLE_SIZE); Idx++) {\r
1160 if(CompareGuid (*Guid, TmpTokenSpaceBuffer[Idx])) {\r
1161 Idx++;\r
1162 *Guid = TmpTokenSpaceBuffer[Idx];\r
1163 return EFI_SUCCESS;\r
1164 }\r
1165 }\r
1166\r
1167 return EFI_NOT_FOUND;\r
80408db0 1168}\r
1169\r
1170\r