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