]> git.proxmox.com Git - mirror_edk2.git/blame - MdePkg/Include/Library/PcdLib.h
Code Scrub of MdePkg/Inlcude/Library
[mirror_edk2.git] / MdePkg / Include / Library / PcdLib.h
CommitLineData
fb3df220 1/** @file\r
2PCD Library Class Interface Declarations\r
3\r
4Copyright (c) 2006 - 2007, 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
fb3df220 13**/\r
14\r
15#ifndef __PCD_LIB_H__\r
16#define __PCD_LIB_H__\r
17\r
2a254b90 18#include <Base.h>\r
19\r
fb3df220 20#define PCD_INVALID_TOKEN_NUMBER ((UINTN) 0)\r
21\r
22#define PcdToken(TokenName) _PCD_TOKEN_##TokenName\r
23\r
24\r
25//\r
26// Feature Flag is in the form of a global constant\r
27//\r
28#define FeaturePcdGet(TokenName) _PCD_GET_MODE_BOOL_##TokenName\r
29\r
30\r
31//\r
32// Fixed is fixed at build time\r
33//\r
34#define FixedPcdGet8(TokenName) _PCD_VALUE_##TokenName\r
35#define FixedPcdGet16(TokenName) _PCD_VALUE_##TokenName\r
36#define FixedPcdGet32(TokenName) _PCD_VALUE_##TokenName\r
37#define FixedPcdGet64(TokenName) _PCD_VALUE_##TokenName\r
38#define FixedPcdGetBool(TokenName) _PCD_VALUE_##TokenName\r
39\r
40\r
41#define FixedPcdGetPtr(TokenName) ((VOID *)_PCD_VALUE_##TokenName)\r
42\r
43\r
44//\r
45// (Binary) Patch is in the form of a global variable\r
46//\r
47#define PatchPcdGet8(TokenName) _gPcd_BinaryPatch_##TokenName\r
48#define PatchPcdGet16(TokenName) _gPcd_BinaryPatch_##TokenName\r
49#define PatchPcdGet32(TokenName) _gPcd_BinaryPatch_##TokenName\r
50#define PatchPcdGet64(TokenName) _gPcd_BinaryPatch_##TokenName\r
51#define PatchPcdGetBool(TokenName) _gPcd_BinaryPatch_##TokenName\r
52#define PatchPcdGetPtr(TokenName) ((VOID *)_gPcd_BinaryPatch_##TokenName)\r
53\r
54#define PatchPcdSet8(TokenName, Value) (_gPcd_BinaryPatch_##TokenName = (Value))\r
55#define PatchPcdSet16(TokenName, Value) (_gPcd_BinaryPatch_##TokenName = (Value))\r
56#define PatchPcdSet32(TokenName, Value) (_gPcd_BinaryPatch_##TokenName = (Value))\r
57#define PatchPcdSet64(TokenName, Value) (_gPcd_BinaryPatch_##TokenName = (Value))\r
58#define PatchPcdSetBool(TokenName, Value) (_gPcd_BinaryPatch_##TokenName = (Value))\r
59#define PatchPcdSetPtr(TokenName, Size, Buffer) \\r
60 LibPatchPcdSetPtr ( \\r
61 _gPcd_BinaryPatch_##TokenName, \\r
62 (UINTN)_PCD_PATCHABLE_##TokenName##_SIZE, \\r
63 (Size), \\r
64 (Buffer) \\r
65 )\r
66\r
67//\r
68// Dynamic is via the protocol with only the TokenNumber as argument\r
69// It can also be Patch or Fixed type based on a build option\r
70//\r
71#define PcdGet8(TokenName) _PCD_GET_MODE_8_##TokenName\r
72#define PcdGet16(TokenName) _PCD_GET_MODE_16_##TokenName\r
73#define PcdGet32(TokenName) _PCD_GET_MODE_32_##TokenName\r
74#define PcdGet64(TokenName) _PCD_GET_MODE_64_##TokenName\r
75#define PcdGetPtr(TokenName) _PCD_GET_MODE_PTR_##TokenName\r
76#define PcdGetBool(TokenName) _PCD_GET_MODE_BOOL_##TokenName\r
77\r
78//\r
79// Dynamic Set\r
80//\r
81#define PcdSet8(TokenName, Value) _PCD_SET_MODE_8_##TokenName ((Value))\r
82#define PcdSet16(TokenName, Value) _PCD_SET_MODE_16_##TokenName ((Value))\r
83#define PcdSet32(TokenName, Value) _PCD_SET_MODE_32_##TokenName ((Value))\r
84#define PcdSet64(TokenName, Value) _PCD_SET_MODE_64_##TokenName ((Value))\r
85#define PcdSetPtr(TokenName, SizeOfBuffer, Buffer) \\r
86 _PCD_SET_MODE_PTR_##TokenName ((SizeOfBuffer), (Buffer))\r
87#define PcdSetBool(TokenName, Value) _PCD_SET_MODE_BOOL_##TokenName ((Value))\r
88\r
89//\r
90// Dynamic Ex is to support binary distribution\r
91//\r
92#define PcdGetEx8(Guid, TokenName) LibPcdGetEx8 ((Guid), _PCD_TOKEN_##TokenName)\r
93#define PcdGetEx16(Guid, TokenName) LibPcdGetEx16 ((Guid), _PCD_TOKEN_##TokenName)\r
94#define PcdGetEx32(Guid, TokenName) LibPcdGetEx32 ((Guid), _PCD_TOKEN_##TokenName)\r
95#define PcdGetEx64(Guid, TokenName) LibPcdGetEx64 ((Guid), _PCD_TOKEN_##TokenName)\r
96#define PcdGetExPtr(Guid, TokenName) LibPcdGetExPtr ((Guid), _PCD_TOKEN_##TokenName)\r
97#define PcdGetExBool(Guid, TokenName) LibPcdGetExBool ((Guid), _PCD_TOKEN_##TokenName)\r
98\r
99//\r
100// Dynamic Set Ex\r
101//\r
102#define PcdSetEx8(Guid, TokenName, Value) LibPcdSetEx8 ((Guid), _PCD_TOKEN_##TokenName, (Value))\r
103#define PcdSetEx16(Guid, TokenName, Value) LibPcdSetEx16 ((Guid), _PCD_TOKEN_##TokenName, (Value))\r
104#define PcdSetEx32(Guid, TokenName, Value) LibPcdSetEx32 ((Guid), _PCD_TOKEN_##TokenName, (Value))\r
105#define PcdSetEx64(Guid, TokenName, Value) LibPcdSetEx64 ((Guid), _PCD_TOKEN_##TokenName, (Value))\r
106#define PcdSetExPtr(Guid, TokenName, SizeOfBuffer, Buffer) \\r
107 LibPcdSetExPtr ((Guid), _PCD_TOKEN_##TokenName, (SizeOfBuffer), (Buffer))\r
108#define PcdSetExBool(Guid, TokenName, Value) \\r
109 LibPcdSetExBool((Guid), _PCD_TOKEN_##TokenName, (Value))\r
110\r
111\r
112/**\r
113 Sets the current SKU in the PCD database to the value specified by SkuId. SkuId is returned.\r
114\r
115 @param[in] SkuId The SKU value that will be used when the PCD service will retrieve and \r
116 set values associated with a PCD token.\r
117\r
118 @retval SKU_ID Return the SKU ID that just be set.\r
119\r
120**/\r
121UINTN\r
122EFIAPI\r
123LibPcdSetSku (\r
124 IN UINTN SkuId\r
125 );\r
126\r
127\r
128/**\r
129 Returns the 8-bit value for the token specified by TokenNumber. \r
130\r
2a254b90 131 @param[in] TokenNumber The PCD token number to retrieve a current value for.\r
fb3df220 132\r
133 @retval UINT8 Returns the 8-bit value for the token specified by TokenNumber. \r
134\r
135**/\r
136UINT8\r
137EFIAPI\r
138LibPcdGet8 (\r
139 IN UINTN TokenNumber\r
140 );\r
141\r
142\r
143/**\r
144 Returns the 16-bit value for the token specified by TokenNumber. \r
145\r
2a254b90 146 @param[in] TokenNumber The PCD token number to retrieve a current value for.\r
fb3df220 147\r
148 @retval UINT16 Returns the 16-bit value for the token specified by TokenNumber. \r
149\r
150**/\r
151UINT16\r
152EFIAPI\r
153LibPcdGet16 (\r
154 IN UINTN TokenNumber\r
155 );\r
156\r
157\r
158/**\r
159 Returns the 32-bit value for the token specified by TokenNumber. \r
160\r
161 @param[in] TokenNumber The PCD token number to retrieve a current value for.\r
162\r
163 @retval UINT32 Returns the 32-bit value for the token specified by TokenNumber.\r
164\r
165**/\r
166UINT32\r
167EFIAPI\r
168LibPcdGet32 (\r
169 IN UINTN TokenNumber\r
170 );\r
171\r
172\r
173/**\r
174 Returns the 64-bit value for the token specified by TokenNumber.\r
175\r
176 @param[in] TokenNumber The PCD token number to retrieve a current value for.\r
177\r
178 @retval UINT64 Returns the 64-bit value for the token specified by TokenNumber.\r
179\r
180**/\r
181UINT64\r
182EFIAPI\r
183LibPcdGet64 (\r
184 IN UINTN TokenNumber\r
185 );\r
186\r
187\r
188/**\r
189 Returns the pointer to the buffer of the token specified by TokenNumber.\r
190\r
191 @param[in] TokenNumber The PCD token number to retrieve a current value for.\r
192\r
193 @retval VOID* Returns the pointer to the token specified by TokenNumber.\r
194\r
195**/\r
196VOID *\r
197EFIAPI\r
198LibPcdGetPtr (\r
199 IN UINTN TokenNumber\r
200 );\r
201\r
202\r
203/**\r
204 Returns the Boolean value of the token specified by TokenNumber. \r
205\r
206 @param[in] TokenNumber The PCD token number to retrieve a current value for.\r
207\r
208 @retval BOOLEAN Returns the Boolean value of the token specified by TokenNumber. \r
209\r
210**/\r
211BOOLEAN \r
212EFIAPI\r
213LibPcdGetBool (\r
214 IN UINTN TokenNumber\r
215 );\r
216\r
217\r
218/**\r
219 Returns the size of the token specified by TokenNumber. \r
220\r
221 @param[in] TokenNumber The PCD token number to retrieve a current value for.\r
222\r
223 @retval UINTN Returns the size of the token specified by TokenNumber. \r
224\r
225**/\r
226UINTN\r
227EFIAPI\r
228LibPcdGetSize (\r
229 IN UINTN TokenNumber\r
230 );\r
231\r
232\r
233/**\r
234 Returns the 8-bit value for the token specified by TokenNumber and Guid.\r
235 If Guid is NULL, then ASSERT(). \r
236\r
237 @param[in] Guid Pointer to a 128-bit unique value that designates \r
238 which namespace to retrieve a value from.\r
239 @param[in] TokenNumber The PCD token number to retrieve a current value for.\r
240\r
241 @retval UINT8 Return the UINT8.\r
242\r
243**/\r
244UINT8\r
245EFIAPI\r
246LibPcdGetEx8 (\r
247 IN CONST GUID *Guid,\r
248 IN UINTN TokenNumber\r
249 );\r
250\r
251\r
252/**\r
253 Returns the 16-bit value for the token specified by TokenNumber and Guid.\r
254 If Guid is NULL, then ASSERT(). \r
255\r
256 @param[in] Guid Pointer to a 128-bit unique value that designates \r
257 which namespace to retrieve a value from.\r
258 @param[in] TokenNumber The PCD token number to retrieve a current value for.\r
259\r
260 @retval UINT16 Return the UINT16.\r
261\r
262**/\r
263UINT16\r
264EFIAPI\r
265LibPcdGetEx16 (\r
266 IN CONST GUID *Guid,\r
267 IN UINTN TokenNumber\r
268 );\r
269\r
270\r
271/**\r
272 Returns the 32-bit value for the token specified by TokenNumber and Guid.\r
273 If Guid is NULL, then ASSERT(). \r
274\r
275 @param[in] Guid Pointer to a 128-bit unique value that designates \r
276 which namespace to retrieve a value from.\r
277 @param[in] TokenNumber The PCD token number to retrieve a current value for.\r
278\r
279 @retval UINT32 Return the UINT32.\r
280\r
281**/\r
282UINT32\r
283EFIAPI\r
284LibPcdGetEx32 (\r
285 IN CONST GUID *Guid,\r
286 IN UINTN TokenNumber\r
287 );\r
288\r
289\r
290/**\r
291 Returns the 64-bit value for the token specified by TokenNumber and Guid.\r
292 If Guid is NULL, then ASSERT(). \r
293\r
294 @param[in] Guid Pointer to a 128-bit unique value that designates \r
295 which namespace to retrieve a value from.\r
296 @param[in] TokenNumber The PCD token number to retrieve a current value for.\r
297\r
298 @retval UINT64 Return the UINT64.\r
299\r
300**/\r
301UINT64\r
302EFIAPI\r
303LibPcdGetEx64 (\r
304 IN CONST GUID *Guid,\r
305 IN UINTN TokenNumber\r
306 );\r
307\r
308\r
309/**\r
310 Returns the pointer to the buffer of token specified by TokenNumber and Guid.\r
311 If Guid is NULL, then ASSERT(). \r
312\r
313 @param[in] Guid Pointer to a 128-bit unique value that designates \r
314 which namespace to retrieve a value from.\r
315 @param[in] TokenNumber The PCD token number to retrieve a current value for.\r
316\r
317 @retval VOID* Return the VOID* pointer.\r
318\r
319**/\r
320VOID *\r
321EFIAPI\r
322LibPcdGetExPtr (\r
323 IN CONST GUID *Guid,\r
324 IN UINTN TokenNumber\r
325 );\r
326\r
327\r
328/**\r
329 Returns the Boolean value of the token specified by TokenNumber and Guid. \r
330 If Guid is NULL, then ASSERT(). \r
331\r
332 @param[in] Guid Pointer to a 128-bit unique value that designates \r
333 which namespace to retrieve a value from.\r
334 @param[in] TokenNumber The PCD token number to retrieve a current value for.\r
335\r
336 @retval BOOLEAN Return the BOOLEAN.\r
337\r
338**/\r
339BOOLEAN\r
340EFIAPI\r
341LibPcdGetExBool (\r
342 IN CONST GUID *Guid,\r
343 IN UINTN TokenNumber\r
344 );\r
345\r
346\r
347/**\r
348 Returns the size of the token specified by TokenNumber and Guid. \r
349 If Guid is NULL, then ASSERT(). \r
350\r
351 @param[in] Guid Pointer to a 128-bit unique value that designates \r
352 which namespace to retrieve a value from.\r
353 @param[in] TokenNumber The PCD token number to retrieve a current value for.\r
354\r
355 @retval UINTN Return the size.\r
356\r
357**/\r
358UINTN\r
359EFIAPI\r
360LibPcdGetExSize (\r
361 IN CONST GUID *Guid,\r
362 IN UINTN TokenNumber\r
363 );\r
364\r
365\r
366/**\r
367 Sets the 8-bit value for the token specified by TokenNumber \r
368 to the value specified by Value. Value is returned.\r
369 \r
370 @param[in] TokenNumber The PCD token number to set a current value for.\r
371 @param[in] Value The 8-bit value to set.\r
372\r
373 @retval UINT8 Return the value been set.\r
374\r
375**/\r
376UINT8\r
377EFIAPI\r
378LibPcdSet8 (\r
379 IN UINTN TokenNumber,\r
380 IN UINT8 Value\r
381 );\r
382\r
383\r
384/**\r
385 Sets the 16-bit value for the token specified by TokenNumber \r
386 to the value specified by Value. Value is returned.\r
387 \r
388 @param[in] TokenNumber The PCD token number to set a current value for.\r
389 @param[in] Value The 16-bit value to set.\r
390\r
391 @retval UINT16 Return the value been set.\r
392\r
393**/\r
394UINT16\r
395EFIAPI\r
396LibPcdSet16 (\r
397 IN UINTN TokenNumber,\r
398 IN UINT16 Value\r
399 );\r
400\r
401\r
402/**\r
403 Sets the 32-bit value for the token specified by TokenNumber \r
404 to the value specified by Value. Value is returned.\r
405 \r
406 @param[in] TokenNumber The PCD token number to set a current value for.\r
407 @param[in] Value The 32-bit value to set.\r
408\r
409 @retval UINT32 Return the value been set.\r
410\r
411**/\r
412UINT32\r
413EFIAPI\r
414LibPcdSet32 (\r
415 IN UINTN TokenNumber,\r
416 IN UINT32 Value\r
417 );\r
418\r
419\r
420/**\r
421 Sets the 64-bit value for the token specified by TokenNumber \r
422 to the value specified by Value. Value is returned.\r
423 \r
424 @param[in] TokenNumber The PCD token number to set a current value for.\r
425 @param[in] Value The 64-bit value to set.\r
426\r
427 @retval UINT64 Return the value been set.\r
428\r
429**/\r
430UINT64\r
431EFIAPI\r
432LibPcdSet64 (\r
433 IN UINTN TokenNumber,\r
434 IN UINT64 Value\r
435 );\r
436\r
437\r
438/**\r
439 Sets a buffer for the token specified by TokenNumber to the value \r
440 specified by Buffer and SizeOfValue. Buffer is returned. \r
441 If SizeOfValue is greater than the maximum size support by TokenNumber, \r
442 then set SizeOfValue to the maximum size supported by TokenNumber and \r
443 return NULL to indicate that the set operation was not actually performed. \r
444\r
445 If SizeOfValue is set to MAX_ADDRESS, then SizeOfValue must be set to the \r
446 maximum size supported by TokenName and NULL must be returned.\r
447 \r
448 If SizeOfValue is NULL, then ASSERT().\r
449 If SizeOfValue > 0 and Buffer is NULL, then ASSERT().\r
450 \r
2a254b90 451 @param[in] TokenNumber The PCD token number to set a current value for.\r
452 @param[in,out] SizeOfBuffer The size, in bytes, of Buffer.\r
453 @param[in] Buffer Value A pointer to the buffer to set.\r
fb3df220 454\r
455 @retval VOID* Return the pointer for the buffer been set.\r
456\r
457**/\r
458VOID*\r
459EFIAPI\r
460LibPcdSetPtr (\r
461 IN UINTN TokenNumber,\r
462 IN OUT UINTN *SizeOfBuffer,\r
463 IN VOID *Buffer\r
464 );\r
465\r
466\r
467/**\r
468 Sets the Boolean value for the token specified by TokenNumber \r
469 to the value specified by Value. Value is returned.\r
470 \r
471 @param[in] TokenNumber The PCD token number to set a current value for.\r
472 @param[in] Value The boolean value to set.\r
473\r
474 @retval BOOLEAN Return the value been set.\r
475\r
476**/\r
477BOOLEAN\r
478EFIAPI\r
479LibPcdSetBool (\r
480 IN UINTN TokenNumber,\r
481 IN BOOLEAN Value\r
482 );\r
483\r
484\r
485/**\r
486 Sets the 8-bit value for the token specified by TokenNumber and \r
487 Guid to the value specified by Value. Value is returned.\r
488 If Guid is NULL, then ASSERT().\r
489 \r
490 @param[in] Guid Pointer to a 128-bit unique value that \r
491 designates which namespace to set a value from.\r
492 @param[in] TokenNumber The PCD token number to set a current value for.\r
493 @param[in] Value The 8-bit value to set.\r
494\r
495 @retval UINT8 Return the value been set.\r
496\r
497**/\r
498UINT8\r
499EFIAPI\r
500LibPcdSetEx8 (\r
501 IN CONST GUID *Guid,\r
502 IN UINTN TokenNumber,\r
503 IN UINT8 Value\r
504 );\r
505\r
506\r
507/**\r
508 Sets the 16-bit value for the token specified by TokenNumber and \r
509 Guid to the value specified by Value. Value is returned.\r
510 If Guid is NULL, then ASSERT().\r
511 \r
512 @param[in] Guid Pointer to a 128-bit unique value that \r
513 designates which namespace to set a value from.\r
514 @param[in] TokenNumber The PCD token number to set a current value for.\r
515 @param[in] Value The 16-bit value to set.\r
516\r
517 @retval UINT8 Return the value been set.\r
518\r
519**/\r
520UINT16\r
521EFIAPI\r
522LibPcdSetEx16 (\r
523 IN CONST GUID *Guid,\r
524 IN UINTN TokenNumber,\r
525 IN UINT16 Value\r
526 );\r
527\r
528\r
529/**\r
530 Sets the 32-bit value for the token specified by TokenNumber and \r
531 Guid to the value specified by Value. Value is returned.\r
532 If Guid is NULL, then ASSERT().\r
533 \r
534 @param[in] Guid Pointer to a 128-bit unique value that \r
535 designates which namespace to set a value from.\r
536 @param[in] TokenNumber The PCD token number to set a current value for.\r
537 @param[in] Value The 32-bit value to set.\r
538\r
539 @retval UINT32 Return the value been set.\r
540\r
541**/\r
542UINT32\r
543EFIAPI\r
544LibPcdSetEx32 (\r
545 IN CONST GUID *Guid,\r
546 IN UINTN TokenNumber,\r
547 IN UINT32 Value\r
548 );\r
549\r
550\r
551/**\r
552 Sets the 64-bit value for the token specified by TokenNumber and \r
553 Guid to the value specified by Value. Value is returned.\r
554 If Guid is NULL, then ASSERT().\r
555 \r
556 @param[in] Guid Pointer to a 128-bit unique value that \r
557 designates which namespace to set a value from.\r
558 @param[in] TokenNumber The PCD token number to set a current value for.\r
559 @param[in] Value The 64-bit value to set.\r
560\r
561 @retval UINT64 Return the value been set.\r
562\r
563**/\r
564UINT64\r
565EFIAPI\r
566LibPcdSetEx64 (\r
567 IN CONST GUID *Guid,\r
568 IN UINTN TokenNumber,\r
569 IN UINT64 Value\r
570 );\r
571\r
572\r
573/**\r
574 Sets a buffer for the token specified by TokenNumber to the value specified by \r
575 Buffer and SizeOfValue. Buffer is returned. If SizeOfValue is greater than \r
576 the maximum size support by TokenNumber, then set SizeOfValue to the maximum size \r
577 supported by TokenNumber and return NULL to indicate that the set operation \r
578 was not actually performed. \r
579 \r
580 If Guid is NULL, then ASSERT().\r
581 If SizeOfValue is NULL, then ASSERT().\r
582 If SizeOfValue > 0 and Buffer is NULL, then ASSERT().\r
583 \r
584 @param[in] Guid Pointer to a 128-bit unique value that \r
585 designates which namespace to set a value from.\r
586 @param[in] TokenNumber The PCD token number to set a current value for.\r
587 @param[in, out] SizeOfBuffer The size, in bytes, of Buffer.\r
588 @param[in] Buffer A pointer to the buffer to set.\r
589\r
590 @retval VOID * Return the pinter to the buffer been set.\r
591\r
592**/\r
593VOID *\r
594EFIAPI\r
595LibPcdSetExPtr (\r
596 IN CONST GUID *Guid,\r
597 IN UINTN TokenNumber,\r
598 IN OUT UINTN *SizeOfBuffer,\r
599 IN VOID *Buffer\r
600 );\r
601\r
602\r
603/**\r
604 Sets the Boolean value for the token specified by TokenNumber and \r
605 Guid to the value specified by Value. Value is returned.\r
606 If Guid is NULL, then ASSERT().\r
607 \r
608 @param[in] Guid Pointer to a 128-bit unique value that \r
609 designates which namespace to set a value from.\r
610 @param[in] TokenNumber The PCD token number to set a current value for.\r
611 @param[in] Value The Boolean value to set.\r
612\r
613 @retval Boolean Return the value been set.\r
614\r
615**/\r
616BOOLEAN\r
617EFIAPI\r
618LibPcdSetExBool (\r
619 IN CONST GUID *Guid,\r
620 IN UINTN TokenNumber,\r
621 IN BOOLEAN Value\r
622 );\r
623\r
624\r
625/**\r
626 When the token specified by TokenNumber and Guid is set, \r
627 then notification function specified by NotificationFunction is called. \r
628 If Guid is NULL, then the default token space is used. \r
629 If NotificationFunction is NULL, then ASSERT().\r
630\r
631 This notification function serves two purposes. Firstly, it notifies the module which \r
632 did the registration that the value of this PCD token has been set. Secondly, \r
633 it provides a mechanism for the module which did the registration to intercept \r
634 the set operation and override the value been set if necessary. After the invocation \r
635 of the callback function, TokenData will be used by PCD service PEIM or driver to \r
636 modify the internal data in PCD database. \r
637\r
638\r
2a254b90 639 @param[in] CallBackGuid The PCD token GUID being set.\r
640 @param[in] CallBackToken The PCD token number being set.\r
641 @param[in, out] TokenData A pointer to the token data being set.\r
642 @param[in] TokenDataSize The size, in bytes, of the data being set.\r
fb3df220 643\r
644 @retval VOID\r
645\r
646**/\r
647typedef\r
648VOID\r
649(EFIAPI *PCD_CALLBACK) (\r
650 IN CONST GUID *CallBackGuid, OPTIONAL\r
651 IN UINTN CallBackToken,\r
652 IN OUT VOID *TokenData,\r
653 IN UINTN TokenDataSize\r
654 );\r
655\r
656\r
657/**\r
658 When the token specified by TokenNumber and Guid is set, \r
659 then notification function specified by NotificationFunction is called. \r
660 If Guid is NULL, then the default token space is used. \r
661 If NotificationFunction is NULL, then ASSERT().\r
662\r
663 @param[in] Guid Pointer to a 128-bit unique value that designates which \r
664 namespace to set a value from. If NULL, then the default \r
665 token space is used.\r
666 @param[in] TokenNumber The PCD token number to monitor.\r
667 @param[in] NotificationFunction The function to call when the token \r
668 specified by Guid and TokenNumber is set.\r
669\r
670 @retval VOID\r
671\r
672**/\r
673VOID\r
674EFIAPI\r
675LibPcdCallbackOnSet (\r
676 IN CONST GUID *Guid, OPTIONAL\r
677 IN UINTN TokenNumber,\r
678 IN PCD_CALLBACK NotificationFunction\r
679 );\r
680\r
681\r
682/**\r
683 Disable a notification function that was established with LibPcdCallbackonSet().\r
684\r
685 @param[in] Guid Specify the GUID token space.\r
686 @param[in] TokenNumber Specify the token number.\r
687 @param[in] NotificationFunction The callback function to be unregistered.\r
688\r
689 @retval VOID\r
690\r
691**/\r
692VOID\r
693EFIAPI\r
694LibPcdCancelCallback (\r
695 IN CONST GUID *Guid, OPTIONAL\r
696 IN UINTN TokenNumber,\r
697 IN PCD_CALLBACK NotificationFunction\r
698 );\r
699\r
700\r
701/**\r
702 Retrieves the next PCD token number from the token space specified by Guid. \r
703 If Guid is NULL, then the default token space is used. If TokenNumber is 0, \r
704 then the first token number is returned. Otherwise, the token number that \r
705 follows TokenNumber in the token space is returned. If TokenNumber is the last \r
706 token number in the token space, then 0 is returned. If TokenNumber is not 0 and \r
707 is not in the token space specified by Guid, then ASSERT().\r
708\r
2a254b90 709 @param[in] Guid Pointer to a 128-bit unique value that designates which namespace \r
710 to set a value from. If NULL, then the default token space is used.\r
711 @param[in] TokenNumber The previous PCD token number. If 0, then retrieves the first PCD \r
712 token number.\r
fb3df220 713\r
714 @retval UINTN The next valid token number.\r
715\r
716**/\r
717UINTN \r
718EFIAPI\r
719LibPcdGetNextToken (\r
720 IN CONST GUID *Guid, OPTIONAL\r
721 IN UINTN TokenNumber\r
722 );\r
723\r
724\r
725\r
726/**\r
727 Retrieves the next PCD token space from a token space specified by Guid.\r
728 Guid of NULL is reserved to mark the default local token namespace on the current\r
729 platform. If Guid is NULL, then the GUID of the first non-local token space of the \r
730 current platform is returned. If Guid is the last non-local token space, \r
731 then NULL is returned. \r
732\r
733 If Guid is not NULL and is not a valid token space in the current platform, then ASSERT().\r
734\r
735\r
736 \r
737 @param[in] Guid Pointer to a 128-bit unique value that designates from which namespace \r
738 to start the search.\r
739\r
740 @retval CONST GUID * The next valid token namespace.\r
741\r
742**/\r
743GUID * \r
744EFIAPI\r
745LibPcdGetNextTokenSpace (\r
746 IN CONST GUID *Guid\r
747 );\r
748\r
749\r
750/**\r
751 Sets the PCD entry specified by PatchVariable to the value specified by Buffer \r
752 and SizeOfValue. Buffer is returned. If SizeOfValue is greater than \r
753 MaximumDatumSize, then set SizeOfValue to MaximumDatumSize and return \r
754 NULL to indicate that the set operation was not actually performed. \r
755 If SizeOfValue is set to MAX_ADDRESS, then SizeOfValue must be set to \r
756 MaximumDatumSize and NULL must be returned.\r
757 \r
758 If PatchVariable is NULL, then ASSERT().\r
759 If SizeOfValue is NULL, then ASSERT().\r
760 If SizeOfValue > 0 and Buffer is NULL, then ASSERT().\r
761\r
762 @param[in] PatchVariable A pointer to the global variable in a module that is \r
763 the target of the set operation.\r
764 @param[in] MaximumDatumSize The maximum size allowed for the PCD entry specified by PatchVariable.\r
765 @param[in, out] SizeOfBuffer A pointer to the size, in bytes, of Buffer.\r
766 @param[in] Buffer A pointer to the buffer to used to set the target variable.\r
767\r
768**/\r
769VOID *\r
770EFIAPI\r
771LibPatchPcdSetPtr (\r
772 IN VOID *PatchVariable,\r
773 IN UINTN MaximumDatumSize,\r
774 IN OUT UINTN *SizeOfBuffer,\r
775 IN CONST VOID *Buffer\r
776 );\r
777\r
778#endif\r