]> git.proxmox.com Git - mirror_edk2.git/blame - MdePkg/Include/Library/PcdLib.h
MdePkg PcdLib: Except for SizeOfBuffer is greater than the maximum size supported...
[mirror_edk2.git] / MdePkg / Include / Library / PcdLib.h
CommitLineData
fb3df220 1/** @file\r
50a64e5b 2 Provides library services to get and set Platform Configuration Database entries.\r
3\r
1a2f870c 4 PCD Library Class provides a PCD usage macro interface for all PCD types.\r
5 It should be included in any module that uses PCD. If a module uses dynamic/dynamicex\r
6 PCD, module should be linked to a PEIM/DXE library instance to access that PCD.\r
7 If a module uses PatchableInModule type PCD, it also needs the library instance to produce\r
8 LibPatchPcdSetPtr() interface. For FeatureFlag/Fixed PCD, the macro interface is\r
f754f721 9 translated to a variable or macro that is auto-generated by build tool in\r
50a64e5b 10 module's autogen.h/autogen.c.\r
64735d24 11 The PcdGetXX(), PcdSetXX(), PcdToken(), and PcdGetNextTokenSpace() operations are \r
12 only available prior to ExitBootServices(). If access to PCD values are required \r
13 at runtime, then their values must be collected prior to ExitBootServices().\r
14 There are no restrictions on the use of FeaturePcd(), FixedPcdGetXX(),\r
15 PatchPcdGetXX(), and PatchPcdSetXX().\r
50a64e5b 16\r
0befb08d 17Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.<BR>\r
9df063a0 18This program and the accompanying materials\r
50a64e5b 19are licensed and made available under the terms and conditions of the BSD License\r
20which accompanies this distribution. The full text of the license may be found at\r
21http://opensource.org/licenses/bsd-license.php\r
22\r
23THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
24WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
fb3df220 25\r
fb3df220 26**/\r
27\r
28#ifndef __PCD_LIB_H__\r
29#define __PCD_LIB_H__\r
30\r
c3665990 31#define PCD_MAX_SKU_ID 0x100\r
fb3df220 32\r
64735d24 33\r
34/**\r
35 Retrieves a token number based on a token name.\r
36\r
37 Returns the token number associated with the PCD token specified by TokenName.\r
38 If TokenName is not a valid token in the token space, then the module will not build.\r
39 If TokenName is not a feature flag, then the module will not build.\r
40\r
41 @param TokenName The name of the PCD token to retrieve the token number for.\r
42\r
43 @return The token number associated with the PCD.\r
44\r
45**/\r
fb3df220 46#define PcdToken(TokenName) _PCD_TOKEN_##TokenName\r
47\r
48\r
64735d24 49/**\r
50 Retrieves a Boolean PCD feature flag based on a token name.\r
51\r
52 Returns the Boolean value for the PCD feature flag specified by TokenName.\r
53 If TokenName is not a valid token in the token space, then the module will not build.\r
54 If TokenName is not a feature flag, then the module will not build.\r
55\r
56 @param TokenName The name of the PCD token to retrieve a current value for.\r
57\r
58 @return Boolean value for the PCD feature flag.\r
59\r
60**/\r
fb3df220 61#define FeaturePcdGet(TokenName) _PCD_GET_MODE_BOOL_##TokenName\r
62\r
63\r
64735d24 64/**\r
65 Retrieves an 8-bit fixed PCD token value based on a token name.\r
66\r
67 Returns the 8-bit value for the token specified by TokenName.\r
68 If TokenName is not a valid token in the token space, then the module will not build.\r
69 If TokenName is not a feature flag, then the module will not build.\r
70\r
71 @param TokenName The name of the PCD token to retrieve a current value for.\r
72\r
73 @return 8-bit value for the token specified by TokenName.\r
74\r
75**/\r
fb3df220 76#define FixedPcdGet8(TokenName) _PCD_VALUE_##TokenName\r
64735d24 77\r
78\r
79/**\r
80 Retrieves a 16-bit fixed PCD token value based on a token name.\r
81\r
82 Returns the 16-bit value for the token specified by TokenName.\r
83 If TokenName is not a valid token in the token space, then the module will not build.\r
84 If TokenName is not a feature flag, then the module will not build.\r
85\r
86 @param TokenName The name of the PCD token to retrieve a current value for.\r
87\r
88 @return 16-bit value for the token specified by TokenName.\r
89\r
90**/\r
fb3df220 91#define FixedPcdGet16(TokenName) _PCD_VALUE_##TokenName\r
64735d24 92\r
93\r
94/**\r
95 Retrieves a 32-bit fixed PCD token value based on a token name.\r
96\r
97 Returns the 32-bit value for the token specified by TokenName.\r
98 If TokenName is not a valid token in the token space, then the module will not build.\r
99 If TokenName is not a feature flag, then the module will not build.\r
100\r
101 @param TokenName The name of the PCD token to retrieve a current value for.\r
102\r
103 @return 32-bit value for the token specified by TokenName.\r
104\r
105**/\r
fb3df220 106#define FixedPcdGet32(TokenName) _PCD_VALUE_##TokenName\r
64735d24 107\r
108\r
109/**\r
110 Retrieves a 64-bit fixed PCD token value based on a token name.\r
111\r
112 Returns the 64-bit value for the token specified by TokenName.\r
113 If TokenName is not a valid token in the token space, then the module will not build.\r
114 If TokenName is not a feature flag, then the module will not build.\r
115\r
116 @param TokenName The name of the PCD token to retrieve a current value for.\r
117\r
118 @return 64-bit value for the token specified by TokenName.\r
119\r
120**/\r
fb3df220 121#define FixedPcdGet64(TokenName) _PCD_VALUE_##TokenName\r
64735d24 122\r
123\r
124/**\r
125 Retrieves a Boolean fixed PCD token value based on a token name.\r
126\r
127 Returns the Boolean value for the token specified by TokenName.\r
128 If TokenName is not a valid token in the token space, then the module will not build.\r
129 If TokenName is not a feature flag, then the module will not build.\r
130\r
131 @param TokenName The name of the PCD token to retrieve a current value for.\r
132\r
133 @return The Boolean value for the token. \r
134\r
135**/\r
fb3df220 136#define FixedPcdGetBool(TokenName) _PCD_VALUE_##TokenName\r
137\r
138\r
64735d24 139/**\r
140 Retrieves a pointer to a fixed PCD token buffer based on a token name.\r
141\r
142 Returns a pointer to the buffer for the token specified by TokenName.\r
143 If TokenName is not a valid token in the token space, then the module will not build.\r
144 If TokenName is not a feature flag, then the module will not build.\r
145\r
146 @param TokenName The name of the PCD token to retrieve a current value for.\r
147\r
148 @return A pointer to the buffer. \r
149\r
150**/\r
fb3df220 151#define FixedPcdGetPtr(TokenName) ((VOID *)_PCD_VALUE_##TokenName)\r
152\r
153\r
64735d24 154/**\r
155 Retrieves an 8-bit binary patchable PCD token value based on a token name.\r
156\r
157 Returns the 8-bit value for the token specified by TokenName.\r
158 If TokenName is not a valid token in the token space, then the module will not build.\r
159 If TokenName is not a feature flag, then the module will not build.\r
160\r
161 @param TokenName The name of the PCD token to retrieve a current value for.\r
162\r
163 @return An 8-bit binary patchable PCD token value.\r
164\r
165**/\r
fb3df220 166#define PatchPcdGet8(TokenName) _gPcd_BinaryPatch_##TokenName\r
64735d24 167\r
168/**\r
169 Retrieves a 16-bit binary patchable PCD token value based on a token name.\r
170\r
171 Returns the 16-bit value for the token specified by TokenName.\r
172 If TokenName is not a valid token in the token space, then the module will not build.\r
173 If TokenName is not a feature flag, then the module will not build.\r
174\r
175 @param TokenName The name of the PCD token to retrieve a current value for.\r
176\r
177 @return A 16-bit binary patchable PCD token value.\r
178\r
179**/\r
fb3df220 180#define PatchPcdGet16(TokenName) _gPcd_BinaryPatch_##TokenName\r
64735d24 181\r
182\r
183/**\r
184 Retrieves a 32-bit binary patchable PCD token value based on a token name.\r
185\r
186 Returns the 32-bit value for the token specified by TokenName.\r
187 If TokenName is not a valid token in the token space, then the module will not build.\r
188 If TokenName is not a feature flag, then the module will not build.\r
189\r
190 @param TokenName The name of the PCD token to retrieve a current value for.\r
191\r
192 @return A 32-bit binary patchable PCD token value.\r
193\r
194**/\r
fb3df220 195#define PatchPcdGet32(TokenName) _gPcd_BinaryPatch_##TokenName\r
64735d24 196\r
197\r
198/**\r
199 Retrieves a 64-bit binary patchable PCD token value based on a token name.\r
200\r
201 Returns the 64-bit value for the token specified by TokenName.\r
202 If TokenName is not a valid token in the token space, then the module will not build.\r
203 If TokenName is not a feature flag, then the module will not build.\r
204\r
205 @param TokenName The name of the PCD token to retrieve a current value for.\r
206\r
207 @return A 64-bit binary patchable PCD token value.\r
208\r
209**/\r
fb3df220 210#define PatchPcdGet64(TokenName) _gPcd_BinaryPatch_##TokenName\r
64735d24 211\r
212\r
213/**\r
214 Retrieves a Boolean binary patchable PCD token value based on a token name.\r
215\r
216 Returns the Boolean value for the token specified by TokenName.\r
217 If TokenName is not a valid token in the token space, then the module will not build.\r
218 If TokenName is not a feature flag, then the module will not build.\r
219\r
220 @param TokenName The name of the PCD token to retrieve a current value for.\r
221\r
222 @return The Boolean value for the token.\r
223\r
224**/\r
fb3df220 225#define PatchPcdGetBool(TokenName) _gPcd_BinaryPatch_##TokenName\r
64735d24 226\r
227\r
228/**\r
229 Retrieves a pointer to a binary patchable PCD token buffer based on a token name.\r
230\r
231 Returns a pointer to the buffer for the token specified by TokenName.\r
232 If TokenName is not a valid token in the token space, then the module will not build.\r
233 If TokenName is not a feature flag, then the module will not build.\r
234\r
235 @param TokenName The name of the PCD token to retrieve a current value for.\r
236\r
237 @return A pointer to the buffer for the token.\r
238\r
239**/\r
fb3df220 240#define PatchPcdGetPtr(TokenName) ((VOID *)_gPcd_BinaryPatch_##TokenName)\r
241\r
64735d24 242\r
243/**\r
244 Sets an 8-bit binary patchable PCD token value based on a token name.\r
245\r
246 Sets the 8-bit value for the token specified by TokenName. Value is returned.\r
247 If TokenName is not a valid token in the token space, then the module will not build.\r
248 If TokenName is not a feature flag, then the module will not build.\r
249\r
250 @param TokenName The name of the binary patchable PCD token to set the current value for.\r
251 @param Value The 8-bit value to set.\r
252 \r
7b5b3124 253 @return Return the Value that was set.\r
64735d24 254\r
255**/\r
fb3df220 256#define PatchPcdSet8(TokenName, Value) (_gPcd_BinaryPatch_##TokenName = (Value))\r
64735d24 257\r
258\r
259/**\r
260 Sets a 16-bit binary patchable PCD token value based on a token name.\r
261\r
262 Sets the 16-bit value for the token specified by TokenName. Value is returned.\r
263 If TokenName is not a valid token in the token space, then the module will not build.\r
264 If TokenName is not a feature flag, then the module will not build.\r
265\r
266 @param TokenName The name of the binary patchable PCD token to set the current value for.\r
267 @param Value The 16-bit value to set.\r
268\r
7b5b3124 269 @return Return the Value that was set.\r
64735d24 270\r
271**/\r
fb3df220 272#define PatchPcdSet16(TokenName, Value) (_gPcd_BinaryPatch_##TokenName = (Value))\r
64735d24 273\r
274\r
275/**\r
276 Sets a 32-bit binary patchable PCD token value based on a token name.\r
277\r
278 Sets the 32-bit value for the token specified by TokenName. Value is returned.\r
279 If TokenName is not a valid token in the token space, then the module will not build.\r
280 If TokenName is not a feature flag, then the module will not build.\r
281\r
282 @param TokenName The name of the binary patchable PCD token to set the current value for.\r
283 @param Value The 32-bit value to set.\r
284\r
7b5b3124 285 @return Return the Value that was set.\r
64735d24 286\r
287**/\r
fb3df220 288#define PatchPcdSet32(TokenName, Value) (_gPcd_BinaryPatch_##TokenName = (Value))\r
64735d24 289\r
290\r
291/**\r
292 Sets a 64-bit binary patchable PCD token value based on a token name.\r
293\r
294 Sets the 64-bit value for the token specified by TokenName. Value is returned.\r
295 If TokenName is not a valid token in the token space, then the module will not build.\r
296 If TokenName is not a feature flag, then the module will not build.\r
297\r
298 @param TokenName The name of the binary patchable PCD token to set the current value for.\r
299 @param Value The 64-bit value to set.\r
300\r
7b5b3124 301 @return Return the Value that was set.\r
64735d24 302\r
303**/\r
fb3df220 304#define PatchPcdSet64(TokenName, Value) (_gPcd_BinaryPatch_##TokenName = (Value))\r
64735d24 305\r
306\r
307/**\r
308 Sets a Boolean binary patchable PCD token value based on a token name.\r
309\r
310 Sets the Boolean value for the token specified by TokenName. Value is returned.\r
311 If TokenName is not a valid token in the token space, then the module will not build.\r
312 If TokenName is not a feature flag, then the module will not build.\r
313\r
314 @param TokenName The name of the binary patchable PCD token to set the current value for.\r
315 @param Value The boolean value to set.\r
316\r
7b5b3124 317 @return Return the Value that was set.\r
64735d24 318\r
319**/\r
fb3df220 320#define PatchPcdSetBool(TokenName, Value) (_gPcd_BinaryPatch_##TokenName = (Value))\r
64735d24 321\r
322\r
323/**\r
324 Sets a pointer to a binary patchable PCD token buffer based on a token name.\r
325\r
326 Sets the buffer for the token specified by TokenName. Buffer is returned. \r
327 If SizeOfBuffer is greater than the maximum size supported by TokenName, then set SizeOfBuffer\r
328 to the maximum size supported by TokenName and return NULL to indicate that the set operation \r
329 was not actually performed. If SizeOfBuffer is set to MAX_ADDRESS, then SizeOfBuffer must be \r
330 set to the maximum size supported by TokenName and NULL must be returned.\r
331 If TokenName is not a valid token in the token space, then the module will not build.\r
332 If TokenName is not a feature flag, then the module will not build.\r
333 \r
334 If SizeOfBuffer is NULL, then ASSERT().\r
335 If SizeOfBuffer > 0 and Buffer is NULL, then ASSERT().\r
336 \r
337 @param TokenName The name of the binary patchable PCD token to set the current value for.\r
338 @param SizeOfBuffer A pointer to the size, in bytes, of Buffer.\r
339 @param Buffer Pointer to the value to set.\r
340\r
7b5b3124 341 @return Return the pointer to the Buffer that was set.\r
64735d24 342\r
343**/\r
fb3df220 344#define PatchPcdSetPtr(TokenName, Size, Buffer) \\r
345 LibPatchPcdSetPtr ( \\r
346 _gPcd_BinaryPatch_##TokenName, \\r
347 (UINTN)_PCD_PATCHABLE_##TokenName##_SIZE, \\r
348 (Size), \\r
349 (Buffer) \\r
350 )\r
351\r
64735d24 352/**\r
353 Retrieves an 8-bit PCD token value based on a token name.\r
354 \r
355 Returns the 8-bit value for the token specified by TokenName.\r
356 If TokenName is not a valid token in the token space, then the module will not build.\r
357 \r
358 @param TokenName The name of the PCD token to retrieve a current value for.\r
359\r
360 @return 8-bit value for the token specified by TokenName.\r
361\r
362**/\r
fb3df220 363#define PcdGet8(TokenName) _PCD_GET_MODE_8_##TokenName\r
64735d24 364\r
365\r
366/**\r
367 Retrieves a 16-bit PCD token value based on a token name.\r
368\r
369 Returns the 16-bit value for the token specified by TokenName.\r
370 If TokenName is not a valid token in the token space, then the module will not build.\r
371\r
372 @param TokenName The name of the PCD token to retrieve a current value for.\r
373\r
374 @return 16-bit value for the token specified by TokenName.\r
375\r
376**/\r
fb3df220 377#define PcdGet16(TokenName) _PCD_GET_MODE_16_##TokenName\r
64735d24 378\r
379\r
380/**\r
381 Retrieves a 32-bit PCD token value based on a token name.\r
382\r
383 Returns the 32-bit value for the token specified by TokenName.\r
384 If TokenName is not a valid token in the token space, then the module will not build.\r
385\r
386 @param TokenName The name of the PCD token to retrieve a current value for.\r
387\r
388 @return 32-bit value for the token specified by TokenName.\r
389\r
390**/\r
fb3df220 391#define PcdGet32(TokenName) _PCD_GET_MODE_32_##TokenName\r
64735d24 392\r
393\r
394/**\r
395 Retrieves a 64-bit PCD token value based on a token name.\r
396\r
397 Returns the 64-bit value for the token specified by TokenName.\r
398 If TokenName is not a valid token in the token space, then the module will not build.\r
399\r
400 @param TokenName The name of the PCD token to retrieve a current value for.\r
401\r
402 @return 64-bit value for the token specified by TokenName.\r
403\r
404**/\r
fb3df220 405#define PcdGet64(TokenName) _PCD_GET_MODE_64_##TokenName\r
64735d24 406\r
407\r
408/**\r
409 Retrieves a pointer to a PCD token buffer based on a token name.\r
410\r
411 Returns a pointer to the buffer for the token specified by TokenName.\r
412 If TokenName is not a valid token in the token space, then the module will not build.\r
413\r
414 @param TokenName The name of the PCD token to retrieve a current value for.\r
415\r
416 @return A pointer to the buffer.\r
417\r
418**/\r
fb3df220 419#define PcdGetPtr(TokenName) _PCD_GET_MODE_PTR_##TokenName\r
64735d24 420\r
421\r
422/**\r
423 Retrieves a Boolean PCD token value based on a token name.\r
424\r
425 Returns the Boolean value for the token specified by TokenName.\r
426 If TokenName is not a valid token in the token space, then the module will not build.\r
427\r
428 @param TokenName The name of the PCD token to retrieve a current value for.\r
429\r
430 @return A Boolean PCD token value.\r
431\r
432**/\r
fb3df220 433#define PcdGetBool(TokenName) _PCD_GET_MODE_BOOL_##TokenName\r
434\r
64735d24 435\r
436/**\r
437 Sets an 8-bit PCD token value based on a token name.\r
438\r
439 Sets the 8-bit value for the token specified by TokenName. Value is returned.\r
440 If TokenName is not a valid token in the token space, then the module will not build.\r
441\r
0befb08d
SZ
442 If the set operation was not correctly performed, then ASSERT().\r
443\r
64735d24 444 @param TokenName The name of the PCD token to retrieve a current value for.\r
445 @param Value The 8-bit value to set.\r
446 \r
7b5b3124 447 @return Return the Value that was set.\r
64735d24 448\r
449**/\r
fb3df220 450#define PcdSet8(TokenName, Value) _PCD_SET_MODE_8_##TokenName ((Value))\r
64735d24 451\r
452\r
453/**\r
454 Sets a 16-bit PCD token value based on a token name.\r
455\r
456 Sets the 16-bit value for the token specified by TokenName. Value is returned.\r
457 If TokenName is not a valid token in the token space, then the module will not build.\r
458\r
0befb08d
SZ
459 If the set operation was not correctly performed, then ASSERT().\r
460\r
64735d24 461 @param TokenName The name of the PCD token to retrieve a current value for.\r
462 @param Value The 16-bit value to set.\r
463\r
7b5b3124 464 @return Return the Value that was set.\r
64735d24 465\r
466**/\r
fb3df220 467#define PcdSet16(TokenName, Value) _PCD_SET_MODE_16_##TokenName ((Value))\r
64735d24 468\r
469\r
470/**\r
471 Sets a 32-bit PCD token value based on a token name.\r
472\r
473 Sets the 32-bit value for the token specified by TokenName. Value is returned.\r
474 If TokenName is not a valid token in the token space, then the module will not build.\r
475\r
0befb08d
SZ
476 If the set operation was not correctly performed, then ASSERT().\r
477\r
64735d24 478 @param TokenName The name of the PCD token to retrieve a current value for.\r
479 @param Value The 32-bit value to set.\r
480\r
7b5b3124 481 @return Return the Value that was set.\r
64735d24 482\r
483**/\r
fb3df220 484#define PcdSet32(TokenName, Value) _PCD_SET_MODE_32_##TokenName ((Value))\r
64735d24 485\r
486\r
487/**\r
488 Sets a 64-bit PCD token value based on a token name.\r
489\r
490 Sets the 64-bit value for the token specified by TokenName. Value is returned.\r
491 If TokenName is not a valid token in the token space, then the module will not build.\r
492\r
493 @param TokenName The name of the PCD token to retrieve a current value for.\r
494 @param Value The 64-bit value to set.\r
495\r
7b5b3124 496 @return Return the Value that was set.\r
64735d24 497\r
498**/\r
fb3df220 499#define PcdSet64(TokenName, Value) _PCD_SET_MODE_64_##TokenName ((Value))\r
64735d24 500\r
501\r
502/**\r
503 Sets a pointer to a PCD token buffer based on a token name.\r
504\r
505 Sets the buffer for the token specified by TokenName. Buffer is returned. \r
506 If SizeOfBuffer is greater than the maximum size supported by TokenName, \r
507 then set SizeOfBuffer to the maximum size supported by TokenName and return NULL \r
508 to indicate that the set operation was not actually performed. If SizeOfBuffer \r
509 is set to MAX_ADDRESS, then SizeOfBuffer must be set to the maximum size supported \r
0befb08d 510 by TokenName and NULL must be returned, or ASSERT() if the set operation was not corretly performed.\r
64735d24 511 If TokenName is not a valid token in the token space, then the module will not build.\r
512 \r
513 If SizeOfBuffer is NULL, then ASSERT().\r
514 If SizeOfBuffer > 0 and Buffer is NULL, then ASSERT().\r
515 \r
516 @param TokenName The name of the PCD token to set the current value for.\r
517 @param SizeOfBuffer A pointer to the size, in bytes, of Buffer.\r
518 @param Buffer A pointer to the buffer to set.\r
519\r
7b5b3124 520 @return Return the pointer to the Buffer that was set.\r
64735d24 521\r
522**/\r
fb3df220 523#define PcdSetPtr(TokenName, SizeOfBuffer, Buffer) \\r
524 _PCD_SET_MODE_PTR_##TokenName ((SizeOfBuffer), (Buffer))\r
64735d24 525 \r
526/**\r
527 Sets a Boolean PCD token value based on a token name.\r
528\r
529 Sets the Boolean value for the token specified by TokenName. Value is returned. \r
530 If TokenName is not a valid token in the token space, then the module will not build.\r
531\r
0befb08d
SZ
532 If the set operation was not correctly performed, then ASSERT().\r
533\r
64735d24 534 @param TokenName The name of the PCD token to set the current value for.\r
535 @param Buffer The Boolean value to set.\r
536\r
7b5b3124 537 @return Return the Value that was set.\r
64735d24 538\r
539**/\r
fb3df220 540#define PcdSetBool(TokenName, Value) _PCD_SET_MODE_BOOL_##TokenName ((Value))\r
541\r
64735d24 542\r
419db80b
BF
543/**\r
544 Retrieves a token number based on a GUID and a token name.\r
545\r
546 Returns the token number for the token specified by Guid and TokenName.\r
547\r
548 @param Guid Pointer to a 128-bit unique value that designates \r
549 which namespace to retrieve a value from.\r
550 @param TokenName The name of the PCD token to retrieve a current value for. \r
551\r
552 @return Return the token number.\r
553\r
554**/\r
555#define PcdTokenEx(Guid,TokenName) _PCD_TOKEN_EX_##TokenName(Guid)\r
556\r
64735d24 557/**\r
558 Retrieves an 8-bit PCD token value based on a GUID and a token name.\r
559\r
560 Returns the 8-bit value for the token specified by Guid and TokenName.\r
561 If TokenName is not a valid token in the token space specified by Guid, \r
562 then the module will not build.\r
563 \r
564 If Guid is NULL, then ASSERT().\r
565\r
566 @param Guid Pointer to a 128-bit unique value that designates \r
567 which namespace to retrieve a value from.\r
568 @param TokenName The name of the PCD token to retrieve a current value for. \r
569\r
570 @return An 8-bit PCD token value.\r
571\r
572**/\r
419db80b 573#define PcdGetEx8(Guid, TokenName) LibPcdGetEx8 ((Guid), PcdTokenEx(Guid,TokenName))\r
64735d24 574\r
575/**\r
576 Retrieves a 16-bit PCD token value based on a GUID and a token name.\r
577\r
578 Returns the 16-bit value for the token specified by Guid and TokenName.\r
579 If TokenName is not a valid token in the token space specified by Guid, \r
580 then the module will not build.\r
581\r
582 If Guid is NULL, then ASSERT().\r
583\r
584 @param Guid Pointer to a 128-bit unique value that designates \r
585 which namespace to retrieve a value from.\r
586 @param TokenName The name of the PCD token to retrieve a current value for. \r
587\r
588 @return A 16-bit PCD token value.\r
589\r
590**/\r
419db80b 591#define PcdGetEx16(Guid, TokenName) LibPcdGetEx16 ((Guid), PcdTokenEx(Guid,TokenName))\r
64735d24 592\r
593\r
594/**\r
595 Retrieves a 32-bit PCD token value based on a GUID and a token name.\r
596\r
597 Returns the 32-bit value for the token specified by Guid and TokenName.\r
598 If TokenName is not a valid token in the token space specified by Guid, \r
599 then the module will not build.\r
600\r
601 If Guid is NULL, then ASSERT().\r
602\r
603 @param Guid Pointer to a 128-bit unique value that designates \r
604 which namespace to retrieve a value from.\r
605 @param TokenName The name of the PCD token to retrieve a current value for. \r
606\r
607 @return A 32-bit PCD token value.\r
608\r
609**/\r
419db80b 610#define PcdGetEx32(Guid, TokenName) LibPcdGetEx32 ((Guid), PcdTokenEx(Guid,TokenName))\r
64735d24 611\r
612\r
613/**\r
614 Retrieves a 64-bit PCD token value based on a GUID and a token name.\r
615\r
616 Returns the 64-bit value for the token specified by Guid and TokenName.\r
617 If TokenName is not a valid token in the token space specified by Guid, \r
618 then the module will not build.\r
619\r
620 If Guid is NULL, then ASSERT().\r
621\r
622 @param Guid Pointer to a 128-bit unique value that designates \r
623 which namespace to retrieve a value from.\r
624 @param TokenName The name of the PCD token to retrieve a current value for. \r
625\r
626 @return A 64-bit PCD token value.\r
627\r
628**/\r
419db80b 629#define PcdGetEx64(Guid, TokenName) LibPcdGetEx64 ((Guid), PcdTokenEx(Guid,TokenName))\r
64735d24 630\r
631\r
632/**\r
633 Retrieves a pointer to a PCD token buffer based on a GUID and a token name.\r
634\r
635 Returns a pointer to the buffer for the token specified by Guid and TokenName.\r
636 If TokenName is not a valid token in the token space specified by Guid, \r
637 then the module will not build.\r
638\r
639 If Guid is NULL, then ASSERT().\r
640\r
641 @param Guid Pointer to a 128-bit unique value that designates \r
642 which namespace to retrieve a value from.\r
643 @param TokenName The name of the PCD token to retrieve a current value for. \r
644\r
645 @return A pointer to a PCD token buffer.\r
646\r
647**/\r
419db80b 648#define PcdGetExPtr(Guid, TokenName) LibPcdGetExPtr ((Guid), PcdTokenEx(Guid,TokenName))\r
64735d24 649\r
650\r
651/**\r
652 Retrieves a Boolean PCD token value based on a GUID and a token name.\r
653\r
654 Returns the Boolean value for the token specified by Guid and TokenName.\r
655 If TokenName is not a valid token in the token space specified by Guid, \r
656 then the module will not build.\r
657\r
658 If Guid is NULL, then ASSERT().\r
659\r
660 @param Guid Pointer to a 128-bit unique value that designates \r
661 which namespace to retrieve a value from.\r
662 @param TokenName The name of the PCD token to retrieve a current value for. \r
663\r
664 @return A Boolean PCD token value.\r
665\r
666**/\r
419db80b 667#define PcdGetExBool(Guid, TokenName) LibPcdGetExBool ((Guid), PcdTokenEx(Guid,TokenName))\r
fb3df220 668\r
64735d24 669\r
670/**\r
671 Sets an 8-bit PCD token value based on a GUID and a token name.\r
672\r
673 Sets the 8-bit value for the token specified by Guid and TokenName. Value is returned.\r
674 If TokenName is not a valid token in the token space specified by Guid, \r
675 then the module will not build.\r
676\r
677 If Guid is NULL, then ASSERT().\r
0befb08d 678 If the set operation was not correctly performed, then ASSERT().\r
64735d24 679\r
680 @param Guid Pointer to a 128-bit unique value that designates \r
681 which namespace to retrieve a value from.\r
682 @param TokenName The name of the PCD token to set the current value for.\r
683 @param Value The 8-bit value to set. \r
684\r
7b5b3124 685 @return Return the Value that was set.\r
64735d24 686\r
687**/\r
419db80b 688#define PcdSetEx8(Guid, TokenName, Value) LibPcdSetEx8 ((Guid), PcdTokenEx(Guid,TokenName), (Value))\r
64735d24 689\r
690\r
691/**\r
692 Sets a 16-bit PCD token value based on a GUID and a token name.\r
693\r
694 Sets the 16-bit value for the token specified by Guid and TokenName. Value is returned.\r
695 If TokenName is not a valid token in the token space specified by Guid, \r
696 then the module will not build.\r
697\r
698 If Guid is NULL, then ASSERT().\r
0befb08d 699 If the set operation was not correctly performed, then ASSERT().\r
64735d24 700\r
701 @param Guid Pointer to a 128-bit unique value that designates \r
702 which namespace to retrieve a value from.\r
703 @param TokenName The name of the PCD token to set the current value for.\r
704 @param Value The 16-bit value to set. \r
705\r
7b5b3124 706 @return Return the Value that was set.\r
64735d24 707\r
708**/\r
419db80b 709#define PcdSetEx16(Guid, TokenName, Value) LibPcdSetEx16 ((Guid), PcdTokenEx(Guid,TokenName), (Value))\r
64735d24 710\r
711\r
712/**\r
713 Sets a 32-bit PCD token value based on a GUID and a token name.\r
714\r
715 Sets the 32-bit value for the token specified by Guid and TokenName. Value is returned.\r
716 If TokenName is not a valid token in the token space specified by Guid, \r
717 then the module will not build.\r
718\r
719 If Guid is NULL, then ASSERT().\r
0befb08d 720 If the set operation was not correctly performed, then ASSERT().\r
64735d24 721\r
722 @param Guid Pointer to a 128-bit unique value that designates \r
723 which namespace to retrieve a value from.\r
724 @param TokenName The name of the PCD token to set the current value for.\r
725 @param Value The 32-bit value to set. \r
726\r
7b5b3124 727 @return Return the Value that was set.\r
64735d24 728\r
729**/\r
419db80b 730#define PcdSetEx32(Guid, TokenName, Value) LibPcdSetEx32 ((Guid), PcdTokenEx(Guid,TokenName), (Value))\r
64735d24 731\r
732\r
733/**\r
734 Sets a 64-bit PCD token value based on a GUID and a token name.\r
735\r
736 Sets the 64-bit value for the token specified by Guid and TokenName. Value is returned.\r
737 If TokenName is not a valid token in the token space specified by Guid, \r
738 then the module will not build.\r
739\r
740 If Guid is NULL, then ASSERT().\r
0befb08d 741 If the set operation was not correctly performed, then ASSERT().\r
64735d24 742\r
743 @param Guid Pointer to a 128-bit unique value that designates \r
744 which namespace to retrieve a value from.\r
745 @param TokenName The name of the PCD token to set the current value for.\r
746 @param Value The 64-bit value to set. \r
747\r
7b5b3124 748 @return Return the Value that was set.\r
64735d24 749\r
750**/\r
419db80b 751#define PcdSetEx64(Guid, TokenName, Value) LibPcdSetEx64 ((Guid), PcdTokenEx(Guid,TokenName), (Value))\r
64735d24 752\r
753\r
754/**\r
755 Sets a pointer to a PCD token buffer based on a GUID and a token name.\r
756\r
757 Sets the buffer for the token specified by Guid and TokenName. Buffer is returned. \r
758 If SizeOfBuffer is greater than the maximum size supported by Guid and TokenName, \r
759 then set SizeOfBuffer to the maximum size supported by Guid and TokenName and return \r
760 NULL to indicate that the set operation was not actually performed. If SizeOfBuffer \r
761 is set to MAX_ADDRESS, then SizeOfBuffer must be set to the maximum size supported by\r
0befb08d 762 Guid and TokenName and NULL must be returned, or ASSERT() if the set operation was not corretly performed.\r
64735d24 763 If TokenName is not a valid token in the token space specified by Guid, \r
764 then the module will not build.\r
765 \r
766 If Guid is NULL, then ASSERT().\r
767 If SizeOfBuffer is NULL, then ASSERT().\r
768 If SizeOfBuffer > 0 and Buffer is NULL, then ASSERT().\r
769\r
770 @param Guid Pointer to a 128-bit unique value that designates \r
771 which namespace to retrieve a value from.\r
772 @param TokenName The name of the PCD token to set the current value for.\r
773 @param SizeOfBuffer A pointer to the size, in bytes, of Buffer. \r
7b5b3124 774 @param Buffer Pointer to the buffer to set.\r
64735d24 775 \r
7b5b3124 776 @return Return the pointer to the Buffer that was set.\r
64735d24 777\r
778**/\r
fb3df220 779#define PcdSetExPtr(Guid, TokenName, SizeOfBuffer, Buffer) \\r
419db80b 780 LibPcdSetExPtr ((Guid), PcdTokenEx(Guid,TokenName), (SizeOfBuffer), (Buffer))\r
64735d24 781\r
782\r
783/**\r
784 Sets a Boolean PCD token value based on a GUID and a token name.\r
785\r
786 Sets the Boolean value for the token specified by Guid and TokenName. Value is returned. \r
787 If TokenName is not a valid token in the token space specified by Guid, \r
788 then the module will not build.\r
789\r
790 If Guid is NULL, then ASSERT().\r
0befb08d 791 If the set operation was not correctly performed, then ASSERT().\r
64735d24 792\r
793 @param Guid Pointer to a 128-bit unique value that designates \r
794 which namespace to retrieve a value from.\r
795 @param TokenName The name of the PCD token to set the current value for. \r
796 @param Value The Boolean value to set.\r
797\r
7b5b3124 798 @return Return the Value that was set.\r
64735d24 799\r
800**/ \r
fb3df220 801#define PcdSetExBool(Guid, TokenName, Value) \\r
419db80b 802 LibPcdSetExBool((Guid), PcdTokenEx(Guid,TokenName), (Value))\r
fb3df220 803\r
804\r
805/**\r
64735d24 806 This function provides a means by which SKU support can be established in the PCD infrastructure.\r
807\r
fb3df220 808 Sets the current SKU in the PCD database to the value specified by SkuId. SkuId is returned.\r
b677694d 809 If SkuId >= PCD_MAX_SKU_ID, then ASSERT(). \r
fb3df220 810\r
b677694d 811 @param SkuId The SKU value that will be used when the PCD service retrieves and sets values\r
812 associated with a PCD token.\r
fb3df220 813\r
1a2f870c 814 @return Return the SKU ID that was set.\r
fb3df220 815\r
816**/\r
817UINTN\r
818EFIAPI\r
819LibPcdSetSku (\r
820 IN UINTN SkuId\r
821 );\r
822\r
823\r
824/**\r
64735d24 825 This function provides a means by which to retrieve a value for a given PCD token.\r
826 \r
fb3df220 827 Returns the 8-bit value for the token specified by TokenNumber. \r
828\r
2a254b90 829 @param[in] TokenNumber The PCD token number to retrieve a current value for.\r
fb3df220 830\r
f73e0ad2 831 @return Returns the 8-bit value for the token specified by TokenNumber. \r
fb3df220 832\r
833**/\r
834UINT8\r
835EFIAPI\r
836LibPcdGet8 (\r
837 IN UINTN TokenNumber\r
838 );\r
839\r
840\r
841/**\r
64735d24 842 This function provides a means by which to retrieve a value for a given PCD token.\r
843 \r
fb3df220 844 Returns the 16-bit value for the token specified by TokenNumber. \r
845\r
2a254b90 846 @param[in] TokenNumber The PCD token number to retrieve a current value for.\r
fb3df220 847\r
f73e0ad2 848 @return Returns the 16-bit value for the token specified by TokenNumber. \r
fb3df220 849\r
850**/\r
851UINT16\r
852EFIAPI\r
853LibPcdGet16 (\r
854 IN UINTN TokenNumber\r
855 );\r
856\r
857\r
858/**\r
64735d24 859 This function provides a means by which to retrieve a value for a given PCD token.\r
860 \r
fb3df220 861 Returns the 32-bit value for the token specified by TokenNumber. \r
862\r
863 @param[in] TokenNumber The PCD token number to retrieve a current value for.\r
864\r
f73e0ad2 865 @return Returns the 32-bit value for the token specified by TokenNumber.\r
fb3df220 866\r
867**/\r
868UINT32\r
869EFIAPI\r
870LibPcdGet32 (\r
871 IN UINTN TokenNumber\r
872 );\r
873\r
874\r
875/**\r
64735d24 876 This function provides a means by which to retrieve a value for a given PCD token.\r
877 \r
fb3df220 878 Returns the 64-bit value for the token specified by TokenNumber.\r
879\r
880 @param[in] TokenNumber The PCD token number to retrieve a current value for.\r
881\r
f73e0ad2 882 @return Returns the 64-bit value for the token specified by TokenNumber.\r
fb3df220 883\r
884**/\r
885UINT64\r
886EFIAPI\r
887LibPcdGet64 (\r
888 IN UINTN TokenNumber\r
889 );\r
890\r
891\r
892/**\r
64735d24 893 This function provides a means by which to retrieve a value for a given PCD token.\r
894 \r
fb3df220 895 Returns the pointer to the buffer of the token specified by TokenNumber.\r
896\r
897 @param[in] TokenNumber The PCD token number to retrieve a current value for.\r
898\r
f73e0ad2 899 @return Returns the pointer to the token specified by TokenNumber.\r
fb3df220 900\r
901**/\r
902VOID *\r
903EFIAPI\r
904LibPcdGetPtr (\r
905 IN UINTN TokenNumber\r
906 );\r
907\r
908\r
909/**\r
64735d24 910 This function provides a means by which to retrieve a value for a given PCD token.\r
911 \r
fb3df220 912 Returns the Boolean value of the token specified by TokenNumber. \r
913\r
914 @param[in] TokenNumber The PCD token number to retrieve a current value for.\r
915\r
f73e0ad2 916 @return Returns the Boolean value of the token specified by TokenNumber. \r
fb3df220 917\r
918**/\r
919BOOLEAN \r
920EFIAPI\r
921LibPcdGetBool (\r
922 IN UINTN TokenNumber\r
923 );\r
924\r
925\r
926/**\r
64735d24 927 This function provides a means by which to retrieve the size of a given PCD token.\r
fb3df220 928\r
929 @param[in] TokenNumber The PCD token number to retrieve a current value for.\r
930\r
f73e0ad2 931 @return Returns the size of the token specified by TokenNumber. \r
fb3df220 932\r
933**/\r
934UINTN\r
935EFIAPI\r
936LibPcdGetSize (\r
937 IN UINTN TokenNumber\r
938 );\r
939\r
940\r
941/**\r
64735d24 942 This function provides a means by which to retrieve a value for a given PCD token.\r
943 \r
fb3df220 944 Returns the 8-bit value for the token specified by TokenNumber and Guid.\r
64735d24 945 \r
fb3df220 946 If Guid is NULL, then ASSERT(). \r
947\r
b677694d 948 @param[in] Guid Pointer to a 128-bit unique value that designates \r
949 which namespace to retrieve a value from.\r
950 @param[in] TokenNumber The PCD token number to retrieve a current value for.\r
fb3df220 951\r
f73e0ad2 952 @return Return the UINT8.\r
fb3df220 953\r
954**/\r
955UINT8\r
956EFIAPI\r
957LibPcdGetEx8 (\r
958 IN CONST GUID *Guid,\r
959 IN UINTN TokenNumber\r
960 );\r
961\r
962\r
963/**\r
64735d24 964 This function provides a means by which to retrieve a value for a given PCD token.\r
965\r
fb3df220 966 Returns the 16-bit value for the token specified by TokenNumber and Guid.\r
64735d24 967 \r
fb3df220 968 If Guid is NULL, then ASSERT(). \r
969\r
b677694d 970 @param[in] Guid Pointer to a 128-bit unique value that designates \r
971 which namespace to retrieve a value from.\r
972 @param[in] TokenNumber The PCD token number to retrieve a current value for.\r
fb3df220 973\r
f73e0ad2 974 @return Return the UINT16.\r
fb3df220 975\r
976**/\r
977UINT16\r
978EFIAPI\r
979LibPcdGetEx16 (\r
980 IN CONST GUID *Guid,\r
981 IN UINTN TokenNumber\r
982 );\r
983\r
984\r
985/**\r
986 Returns the 32-bit value for the token specified by TokenNumber and Guid.\r
987 If Guid is NULL, then ASSERT(). \r
988\r
b677694d 989 @param[in] Guid Pointer to a 128-bit unique value that designates \r
990 which namespace to retrieve a value from.\r
991 @param[in] TokenNumber The PCD token number to retrieve a current value for.\r
fb3df220 992\r
f73e0ad2 993 @return Return the UINT32.\r
fb3df220 994\r
995**/\r
996UINT32\r
997EFIAPI\r
998LibPcdGetEx32 (\r
999 IN CONST GUID *Guid,\r
1000 IN UINTN TokenNumber\r
1001 );\r
1002\r
1003\r
1004/**\r
64735d24 1005 This function provides a means by which to retrieve a value for a given PCD token.\r
1006 \r
fb3df220 1007 Returns the 64-bit value for the token specified by TokenNumber and Guid.\r
64735d24 1008 \r
fb3df220 1009 If Guid is NULL, then ASSERT(). \r
1010\r
fb287b56 1011 @param[in] Guid Pointer to a 128-bit unique value that designates \r
1012 which namespace to retrieve a value from.\r
1013 @param[in] TokenNumber The PCD token number to retrieve a current value for.\r
fb3df220 1014\r
f73e0ad2 1015 @return Return the UINT64.\r
fb3df220 1016\r
1017**/\r
1018UINT64\r
1019EFIAPI\r
1020LibPcdGetEx64 (\r
1021 IN CONST GUID *Guid,\r
1022 IN UINTN TokenNumber\r
1023 );\r
1024\r
1025\r
1026/**\r
64735d24 1027 This function provides a means by which to retrieve a value for a given PCD token.\r
1028 \r
fb3df220 1029 Returns the pointer to the buffer of token specified by TokenNumber and Guid.\r
64735d24 1030 \r
fb3df220 1031 If Guid is NULL, then ASSERT(). \r
1032\r
fb287b56 1033 @param[in] Guid Pointer to a 128-bit unique value that designates \r
1034 which namespace to retrieve a value from.\r
1035 @param[in] TokenNumber The PCD token number to retrieve a current value for.\r
fb3df220 1036\r
f73e0ad2 1037 @return Return the VOID* pointer.\r
fb3df220 1038\r
1039**/\r
1040VOID *\r
1041EFIAPI\r
1042LibPcdGetExPtr (\r
1043 IN CONST GUID *Guid,\r
1044 IN UINTN TokenNumber\r
1045 );\r
1046\r
1047\r
1048/**\r
64735d24 1049 This function provides a means by which to retrieve a value for a given PCD token.\r
1050 \r
fb3df220 1051 Returns the Boolean value of the token specified by TokenNumber and Guid. \r
64735d24 1052 \r
fb3df220 1053 If Guid is NULL, then ASSERT(). \r
1054\r
fb287b56 1055 @param[in] Guid Pointer to a 128-bit unique value that designates \r
1056 which namespace to retrieve a value from.\r
1057 @param[in] TokenNumber The PCD token number to retrieve a current value for.\r
fb3df220 1058\r
f73e0ad2 1059 @return Return the BOOLEAN.\r
fb3df220 1060\r
1061**/\r
1062BOOLEAN\r
1063EFIAPI\r
1064LibPcdGetExBool (\r
1065 IN CONST GUID *Guid,\r
1066 IN UINTN TokenNumber\r
1067 );\r
1068\r
1069\r
1070/**\r
64735d24 1071 This function provides a means by which to retrieve the size of a given PCD token.\r
1072 \r
fb3df220 1073 Returns the size of the token specified by TokenNumber and Guid. \r
64735d24 1074 \r
fb3df220 1075 If Guid is NULL, then ASSERT(). \r
1076\r
fb287b56 1077 @param[in] Guid Pointer to a 128-bit unique value that designates \r
1078 which namespace to retrieve a value from.\r
1079 @param[in] TokenNumber The PCD token number to retrieve a current value for.\r
fb3df220 1080\r
f73e0ad2 1081 @return Return the size.\r
fb3df220 1082\r
1083**/\r
1084UINTN\r
1085EFIAPI\r
1086LibPcdGetExSize (\r
1087 IN CONST GUID *Guid,\r
1088 IN UINTN TokenNumber\r
1089 );\r
1090\r
1091\r
1092/**\r
64735d24 1093 This function provides a means by which to set a value for a given PCD token.\r
1094 \r
fb3df220 1095 Sets the 8-bit value for the token specified by TokenNumber \r
1096 to the value specified by Value. Value is returned.\r
0befb08d
SZ
1097\r
1098 If the set operation was not correctly performed, then ASSERT().\r
1099\r
fb287b56 1100 @param[in] TokenNumber The PCD token number to set a current value for.\r
1101 @param[in] Value The 8-bit value to set.\r
fb3df220 1102\r
502bfcef 1103 @return Return the Value that was set.\r
fb3df220 1104\r
1105**/\r
1106UINT8\r
1107EFIAPI\r
1108LibPcdSet8 (\r
1109 IN UINTN TokenNumber,\r
1110 IN UINT8 Value\r
1111 );\r
1112\r
1113\r
1114/**\r
64735d24 1115 This function provides a means by which to set a value for a given PCD token.\r
1116 \r
fb3df220 1117 Sets the 16-bit value for the token specified by TokenNumber \r
1118 to the value specified by Value. Value is returned.\r
0befb08d
SZ
1119\r
1120 If the set operation was not correctly performed, then ASSERT().\r
1121\r
fb287b56 1122 @param[in] TokenNumber The PCD token number to set a current value for.\r
1123 @param[in] Value The 16-bit value to set.\r
fb3df220 1124\r
502bfcef 1125 @return Return the Value that was set.\r
fb3df220 1126\r
1127**/\r
1128UINT16\r
1129EFIAPI\r
1130LibPcdSet16 (\r
1131 IN UINTN TokenNumber,\r
1132 IN UINT16 Value\r
1133 );\r
1134\r
1135\r
1136/**\r
64735d24 1137 This function provides a means by which to set a value for a given PCD token.\r
1138 \r
fb3df220 1139 Sets the 32-bit value for the token specified by TokenNumber \r
1140 to the value specified by Value. Value is returned.\r
0befb08d
SZ
1141\r
1142 If the set operation was not correctly performed, then ASSERT().\r
1143\r
fb287b56 1144 @param[in] TokenNumber The PCD token number to set a current value for.\r
1145 @param[in] Value The 32-bit value to set.\r
fb3df220 1146\r
502bfcef 1147 @return Return the Value that was set.\r
fb3df220 1148\r
1149**/\r
1150UINT32\r
1151EFIAPI\r
1152LibPcdSet32 (\r
1153 IN UINTN TokenNumber,\r
1154 IN UINT32 Value\r
1155 );\r
1156\r
1157\r
1158/**\r
64735d24 1159 This function provides a means by which to set a value for a given PCD token.\r
1160 \r
fb3df220 1161 Sets the 64-bit value for the token specified by TokenNumber \r
1162 to the value specified by Value. Value is returned.\r
0befb08d
SZ
1163\r
1164 If the set operation was not correctly performed, then ASSERT().\r
1165\r
fb287b56 1166 @param[in] TokenNumber The PCD token number to set a current value for.\r
1167 @param[in] Value The 64-bit value to set.\r
fb3df220 1168\r
502bfcef 1169 @return Return the Value that was set.\r
fb3df220 1170\r
1171**/\r
1172UINT64\r
1173EFIAPI\r
1174LibPcdSet64 (\r
1175 IN UINTN TokenNumber,\r
1176 IN UINT64 Value\r
1177 );\r
1178\r
1179\r
1180/**\r
64735d24 1181 This function provides a means by which to set a value for a given PCD token.\r
1182 \r
fb3df220 1183 Sets a buffer for the token specified by TokenNumber to the value \r
d3057543 1184 specified by Buffer and SizeOfBuffer. Buffer is returned. \r
1185 If SizeOfBuffer is greater than the maximum size support by TokenNumber, \r
1186 then set SizeOfBuffer to the maximum size supported by TokenNumber and \r
0befb08d
SZ
1187 return NULL to indicate that the set operation was not actually performed,\r
1188 or ASSERT() if the set operation was not corretly performed.\r
fb3df220 1189\r
d3057543 1190 If SizeOfBuffer is set to MAX_ADDRESS, then SizeOfBuffer must be set to the \r
fb3df220 1191 maximum size supported by TokenName and NULL must be returned.\r
1192 \r
d3057543 1193 If SizeOfBuffer is NULL, then ASSERT().\r
1194 If SizeOfBuffer > 0 and Buffer is NULL, then ASSERT().\r
fb3df220 1195 \r
2a254b90 1196 @param[in] TokenNumber The PCD token number to set a current value for.\r
2616448e 1197 @param[in, out] SizeOfBuffer The size, in bytes, of Buffer.\r
64735d24 1198 @param[in] Buffer A pointer to the buffer to set.\r
fb3df220 1199\r
502bfcef 1200 @return Return the pointer for the Buffer that was set.\r
fb3df220 1201\r
1202**/\r
64735d24 1203VOID *\r
fb3df220 1204EFIAPI\r
1205LibPcdSetPtr (\r
64735d24 1206 IN UINTN TokenNumber,\r
1207 IN OUT UINTN *SizeOfBuffer,\r
b52f6a1a 1208 IN CONST VOID *Buffer\r
fb3df220 1209 );\r
1210\r
1211\r
1212/**\r
64735d24 1213 This function provides a means by which to set a value for a given PCD token.\r
1214 \r
fb3df220 1215 Sets the Boolean value for the token specified by TokenNumber \r
1216 to the value specified by Value. Value is returned.\r
0befb08d
SZ
1217\r
1218 If the set operation was not correctly performed, then ASSERT().\r
1219\r
fb287b56 1220 @param[in] TokenNumber The PCD token number to set a current value for.\r
1221 @param[in] Value The boolean value to set.\r
fb3df220 1222\r
502bfcef 1223 @return Return the Value that was set.\r
fb3df220 1224\r
1225**/\r
1226BOOLEAN\r
1227EFIAPI\r
1228LibPcdSetBool (\r
1229 IN UINTN TokenNumber,\r
1230 IN BOOLEAN Value\r
1231 );\r
1232\r
1233\r
1234/**\r
64735d24 1235 This function provides a means by which to set a value for a given PCD token.\r
1236 \r
fb3df220 1237 Sets the 8-bit value for the token specified by TokenNumber and \r
1238 Guid to the value specified by Value. Value is returned.\r
0befb08d 1239\r
fb3df220 1240 If Guid is NULL, then ASSERT().\r
0befb08d
SZ
1241 If the set operation was not correctly performed, then ASSERT().\r
1242\r
fb287b56 1243 @param[in] Guid Pointer to a 128-bit unique value that \r
1244 designates which namespace to set a value from.\r
1245 @param[in] TokenNumber The PCD token number to set a current value for.\r
1246 @param[in] Value The 8-bit value to set.\r
fb3df220 1247\r
502bfcef 1248 @return Return the Value that was set.\r
fb3df220 1249\r
1250**/\r
1251UINT8\r
1252EFIAPI\r
1253LibPcdSetEx8 (\r
1254 IN CONST GUID *Guid,\r
1255 IN UINTN TokenNumber,\r
1256 IN UINT8 Value\r
1257 );\r
1258\r
1259\r
1260/**\r
64735d24 1261 This function provides a means by which to set a value for a given PCD token.\r
1262 \r
fb3df220 1263 Sets the 16-bit value for the token specified by TokenNumber and \r
1264 Guid to the value specified by Value. Value is returned.\r
0befb08d 1265\r
fb3df220 1266 If Guid is NULL, then ASSERT().\r
0befb08d
SZ
1267 If the set operation was not correctly performed, then ASSERT().\r
1268\r
fb287b56 1269 @param[in] Guid Pointer to a 128-bit unique value that \r
1270 designates which namespace to set a value from.\r
1271 @param[in] TokenNumber The PCD token number to set a current value for.\r
1272 @param[in] Value The 16-bit value to set.\r
fb3df220 1273\r
502bfcef 1274 @return Return the Value that was set.\r
fb3df220 1275\r
1276**/\r
1277UINT16\r
1278EFIAPI\r
1279LibPcdSetEx16 (\r
1280 IN CONST GUID *Guid,\r
1281 IN UINTN TokenNumber,\r
1282 IN UINT16 Value\r
1283 );\r
1284\r
1285\r
1286/**\r
64735d24 1287 This function provides a means by which to set a value for a given PCD token.\r
1288 \r
fb3df220 1289 Sets the 32-bit value for the token specified by TokenNumber and \r
1290 Guid to the value specified by Value. Value is returned.\r
0befb08d 1291\r
fb3df220 1292 If Guid is NULL, then ASSERT().\r
0befb08d
SZ
1293 If the set operation was not correctly performed, then ASSERT().\r
1294\r
fb287b56 1295 @param[in] Guid Pointer to a 128-bit unique value that \r
1296 designates which namespace to set a value from.\r
1297 @param[in] TokenNumber The PCD token number to set a current value for.\r
1298 @param[in] Value The 32-bit value to set.\r
fb3df220 1299\r
502bfcef 1300 @return Return the Value that was set.\r
fb3df220 1301\r
1302**/\r
1303UINT32\r
1304EFIAPI\r
1305LibPcdSetEx32 (\r
1306 IN CONST GUID *Guid,\r
1307 IN UINTN TokenNumber,\r
1308 IN UINT32 Value\r
1309 );\r
1310\r
1311\r
1312/**\r
64735d24 1313 This function provides a means by which to set a value for a given PCD token.\r
1314 \r
fb3df220 1315 Sets the 64-bit value for the token specified by TokenNumber and \r
1316 Guid to the value specified by Value. Value is returned.\r
0befb08d 1317\r
fb3df220 1318 If Guid is NULL, then ASSERT().\r
0befb08d
SZ
1319 If the set operation was not correctly performed, then ASSERT().\r
1320\r
fb287b56 1321 @param[in] Guid Pointer to a 128-bit unique value that \r
1322 designates which namespace to set a value from.\r
1323 @param[in] TokenNumber The PCD token number to set a current value for.\r
1324 @param[in] Value The 64-bit value to set.\r
fb3df220 1325\r
502bfcef 1326 @return Return the Value that was set.\r
fb3df220 1327\r
1328**/\r
1329UINT64\r
1330EFIAPI\r
1331LibPcdSetEx64 (\r
1332 IN CONST GUID *Guid,\r
1333 IN UINTN TokenNumber,\r
1334 IN UINT64 Value\r
1335 );\r
1336\r
1337\r
1338/**\r
64735d24 1339 This function provides a means by which to set a value for a given PCD token.\r
1340 \r
fb3df220 1341 Sets a buffer for the token specified by TokenNumber to the value specified by \r
d3057543 1342 Buffer and SizeOfBuffer. Buffer is returned. If SizeOfBuffer is greater than \r
1343 the maximum size support by TokenNumber, then set SizeOfBuffer to the maximum size \r
fb3df220 1344 supported by TokenNumber and return NULL to indicate that the set operation \r
0befb08d 1345 was not actually performed, or ASSERT() if the set operation was not corretly performed.\r
fb3df220 1346 \r
1347 If Guid is NULL, then ASSERT().\r
d3057543 1348 If SizeOfBuffer is NULL, then ASSERT().\r
1349 If SizeOfBuffer > 0 and Buffer is NULL, then ASSERT().\r
fb3df220 1350 \r
fb287b56 1351 @param[in] Guid Pointer to a 128-bit unique value that \r
1352 designates which namespace to set a value from.\r
1353 @param[in] TokenNumber The PCD token number to set a current value for.\r
1354 @param[in, out] SizeOfBuffer The size, in bytes, of Buffer.\r
1355 @param[in] Buffer A pointer to the buffer to set.\r
fb3df220 1356\r
502bfcef 1357 @return Return the pointer to the Buffer that was set.\r
fb3df220 1358\r
1359**/\r
1360VOID *\r
1361EFIAPI\r
1362LibPcdSetExPtr (\r
1363 IN CONST GUID *Guid,\r
1364 IN UINTN TokenNumber,\r
1365 IN OUT UINTN *SizeOfBuffer,\r
1366 IN VOID *Buffer\r
1367 );\r
1368\r
1369\r
1370/**\r
64735d24 1371 This function provides a means by which to set a value for a given PCD token.\r
1372 \r
fb3df220 1373 Sets the Boolean value for the token specified by TokenNumber and \r
1374 Guid to the value specified by Value. Value is returned.\r
0befb08d 1375\r
fb3df220 1376 If Guid is NULL, then ASSERT().\r
0befb08d
SZ
1377 If the set operation was not correctly performed, then ASSERT().\r
1378\r
fb287b56 1379 @param[in] Guid Pointer to a 128-bit unique value that \r
1380 designates which namespace to set a value from.\r
1381 @param[in] TokenNumber The PCD token number to set a current value for.\r
1382 @param[in] Value The Boolean value to set.\r
fb3df220 1383\r
502bfcef 1384 @return Return the Value that was set.\r
fb3df220 1385\r
1386**/\r
1387BOOLEAN\r
1388EFIAPI\r
1389LibPcdSetExBool (\r
1390 IN CONST GUID *Guid,\r
1391 IN UINTN TokenNumber,\r
1392 IN BOOLEAN Value\r
1393 );\r
1394\r
1395\r
1396/**\r
b677694d 1397 This notification function serves two purposes.\r
fb3df220 1398\r
1a2f870c 1399 Firstly, it notifies the module that did the registration that the value of this\r
b677694d 1400 PCD token has been set.\r
1a2f870c 1401 Secondly, it provides a mechanism for the module that did the registration to intercept\r
b677694d 1402 the set operation and override the value been set if necessary. After the invocation of\r
1403 the callback function, TokenData will be used by PCD service PEIM or driver to modify th\r
1404 internal data in PCD database. \r
fb3df220 1405\r
2a254b90 1406 @param[in] CallBackGuid The PCD token GUID being set.\r
1407 @param[in] CallBackToken The PCD token number being set.\r
1408 @param[in, out] TokenData A pointer to the token data being set.\r
1409 @param[in] TokenDataSize The size, in bytes, of the data being set.\r
fb3df220 1410\r
fb3df220 1411**/\r
1412typedef\r
1413VOID\r
78bf8f2d 1414(EFIAPI *PCD_CALLBACK)(\r
fb3df220 1415 IN CONST GUID *CallBackGuid, OPTIONAL\r
1416 IN UINTN CallBackToken,\r
1417 IN OUT VOID *TokenData,\r
1418 IN UINTN TokenDataSize\r
1419 );\r
1420\r
1421\r
1422/**\r
64735d24 1423 Set up a notification function that is called when a specified token is set.\r
1424 \r
fb3df220 1425 When the token specified by TokenNumber and Guid is set, \r
1426 then notification function specified by NotificationFunction is called. \r
b677694d 1427 If Guid is NULL, then the default token space is used.\r
fb3df220 1428 If NotificationFunction is NULL, then ASSERT().\r
1429\r
b677694d 1430 @param[in] Guid Pointer to a 128-bit unique value that designates which \r
1431 namespace to set a value from. If NULL, then the default \r
1432 token space is used.\r
1433 @param[in] TokenNumber The PCD token number to monitor.\r
fb287b56 1434 @param[in] NotificationFunction The function to call when the token \r
1435 specified by Guid and TokenNumber is set.\r
fb3df220 1436\r
1437**/\r
1438VOID\r
1439EFIAPI\r
1440LibPcdCallbackOnSet (\r
1441 IN CONST GUID *Guid, OPTIONAL\r
1442 IN UINTN TokenNumber,\r
1443 IN PCD_CALLBACK NotificationFunction\r
1444 );\r
1445\r
1446\r
1447/**\r
1448 Disable a notification function that was established with LibPcdCallbackonSet().\r
64735d24 1449 \r
b677694d 1450 Disable a notification function that was previously established with LibPcdCallbackOnSet().\r
64735d24 1451 If NotificationFunction is NULL, then ASSERT().\r
1452 If LibPcdCallbackOnSet() was not previously called with Guid, TokenNumber, \r
1453 and NotificationFunction, then ASSERT().\r
1454 \r
b677694d 1455 @param[in] Guid Specify the GUID token space.\r
1456 @param[in] TokenNumber Specify the token number.\r
fb3df220 1457 @param[in] NotificationFunction The callback function to be unregistered.\r
1458\r
fb3df220 1459**/\r
1460VOID\r
1461EFIAPI\r
1462LibPcdCancelCallback (\r
1463 IN CONST GUID *Guid, OPTIONAL\r
1464 IN UINTN TokenNumber,\r
1465 IN PCD_CALLBACK NotificationFunction\r
1466 );\r
1467\r
1468\r
1469/**\r
64735d24 1470 Retrieves the next token in a token space.\r
1471 \r
fb3df220 1472 Retrieves the next PCD token number from the token space specified by Guid. \r
1473 If Guid is NULL, then the default token space is used. If TokenNumber is 0, \r
1474 then the first token number is returned. Otherwise, the token number that \r
1475 follows TokenNumber in the token space is returned. If TokenNumber is the last \r
64735d24 1476 token number in the token space, then 0 is returned. \r
1477 \r
1478 If TokenNumber is not 0 and is not in the token space specified by Guid, then ASSERT().\r
fb3df220 1479\r
2a254b90 1480 @param[in] Guid Pointer to a 128-bit unique value that designates which namespace \r
1481 to set a value from. If NULL, then the default token space is used.\r
1482 @param[in] TokenNumber The previous PCD token number. If 0, then retrieves the first PCD \r
1483 token number.\r
fb3df220 1484\r
f73e0ad2 1485 @return The next valid token number.\r
fb3df220 1486\r
1487**/\r
1488UINTN \r
1489EFIAPI\r
1490LibPcdGetNextToken (\r
1491 IN CONST GUID *Guid, OPTIONAL\r
1492 IN UINTN TokenNumber\r
1493 );\r
1494\r
1495\r
1496\r
1497/**\r
64735d24 1498 Used to retrieve the list of available PCD token space GUIDs.\r
1499 \r
b677694d 1500 Returns the PCD token space GUID that follows TokenSpaceGuid in the list of token spaces\r
1501 in the platform.\r
1502 If TokenSpaceGuid is NULL, then a pointer to the first PCD token spaces returned.\r
1503 If TokenSpaceGuid is the last PCD token space GUID in the list, then NULL is returned.\r
fb3df220 1504 \r
b677694d 1505 @param TokenSpaceGuid Pointer to the a PCD token space GUID\r
fb3df220 1506\r
f73e0ad2 1507 @return The next valid token namespace.\r
fb3df220 1508\r
1509**/\r
b677694d 1510GUID *\r
fb3df220 1511EFIAPI\r
1512LibPcdGetNextTokenSpace (\r
64735d24 1513 IN CONST GUID *TokenSpaceGuid\r
fb3df220 1514 );\r
1515\r
1516\r
1517/**\r
64735d24 1518 Sets a value of a patchable PCD entry that is type pointer.\r
1519 \r
fb3df220 1520 Sets the PCD entry specified by PatchVariable to the value specified by Buffer \r
d3057543 1521 and SizeOfBuffer. Buffer is returned. If SizeOfBuffer is greater than \r
1522 MaximumDatumSize, then set SizeOfBuffer to MaximumDatumSize and return \r
fb3df220 1523 NULL to indicate that the set operation was not actually performed. \r
d3057543 1524 If SizeOfBuffer is set to MAX_ADDRESS, then SizeOfBuffer must be set to \r
fb3df220 1525 MaximumDatumSize and NULL must be returned.\r
1526 \r
1527 If PatchVariable is NULL, then ASSERT().\r
d3057543 1528 If SizeOfBuffer is NULL, then ASSERT().\r
1529 If SizeOfBuffer > 0 and Buffer is NULL, then ASSERT().\r
fb3df220 1530\r
1531 @param[in] PatchVariable A pointer to the global variable in a module that is \r
1532 the target of the set operation.\r
1533 @param[in] MaximumDatumSize The maximum size allowed for the PCD entry specified by PatchVariable.\r
1534 @param[in, out] SizeOfBuffer A pointer to the size, in bytes, of Buffer.\r
1535 @param[in] Buffer A pointer to the buffer to used to set the target variable.\r
f73e0ad2 1536 \r
502bfcef 1537 @return Return the pointer to the Buffer that was set.\r
fb3df220 1538\r
1539**/\r
1540VOID *\r
1541EFIAPI\r
1542LibPatchPcdSetPtr (\r
1543 IN VOID *PatchVariable,\r
1544 IN UINTN MaximumDatumSize,\r
1545 IN OUT UINTN *SizeOfBuffer,\r
1546 IN CONST VOID *Buffer\r
1547 );\r
1548\r
96d6d004
SZ
1549typedef enum {\r
1550 PCD_TYPE_8,\r
1551 PCD_TYPE_16,\r
1552 PCD_TYPE_32,\r
1553 PCD_TYPE_64,\r
1554 PCD_TYPE_BOOL,\r
1555 PCD_TYPE_PTR\r
1556} PCD_TYPE;\r
1557\r
1558typedef struct {\r
1559 ///\r
1560 /// The returned information associated with the requested TokenNumber. If\r
1561 /// TokenNumber is 0, then PcdType is set to PCD_TYPE_8.\r
1562 ///\r
1563 PCD_TYPE PcdType;\r
1564 ///\r
1565 /// The size of the data in bytes associated with the TokenNumber specified. If\r
1566 /// TokenNumber is 0, then PcdSize is set 0.\r
1567 ///\r
1568 UINTN PcdSize;\r
1569 ///\r
1570 /// The null-terminated ASCII string associated with a given token. If the\r
1571 /// TokenNumber specified was 0, then this field corresponds to the null-terminated\r
1572 /// ASCII string associated with the token's namespace Guid. If NULL, there is no\r
1573 /// name associated with this request.\r
1574 ///\r
1575 CHAR8 *PcdName;\r
1576} PCD_INFO;\r
1577\r
1578\r
1579/**\r
1580 Retrieve additional information associated with a PCD token.\r
1581\r
1582 This includes information such as the type of value the TokenNumber is associated with as well as possible\r
1583 human readable name that is associated with the token.\r
1584\r
1585 If TokenNumber is not in the default token space specified, then ASSERT().\r
1586\r
1587 @param[in] TokenNumber The PCD token number.\r
1588 @param[out] PcdInfo The returned information associated with the requested TokenNumber.\r
1589 The caller is responsible for freeing the buffer that is allocated by callee for PcdInfo->PcdName.\r
1590**/\r
1591VOID\r
1592EFIAPI\r
1593LibPcdGetInfo (\r
1594 IN UINTN TokenNumber,\r
1595 OUT PCD_INFO *PcdInfo\r
1596 );\r
1597\r
1598/**\r
1599 Retrieve additional information associated with a PCD token.\r
1600\r
1601 This includes information such as the type of value the TokenNumber is associated with as well as possible\r
1602 human readable name that is associated with the token.\r
1603\r
1604 If TokenNumber is not in the token space specified by Guid, then ASSERT().\r
1605\r
1606 @param[in] Guid The 128-bit unique value that designates the namespace from which to extract the value.\r
1607 @param[in] TokenNumber The PCD token number.\r
1608 @param[out] PcdInfo The returned information associated with the requested TokenNumber.\r
1609 The caller is responsible for freeing the buffer that is allocated by callee for PcdInfo->PcdName.\r
1610**/\r
1611VOID\r
1612EFIAPI\r
1613LibPcdGetInfoEx (\r
1614 IN CONST GUID *Guid,\r
1615 IN UINTN TokenNumber,\r
1616 OUT PCD_INFO *PcdInfo\r
1617 );\r
1618\r
1619/**\r
1620 Retrieve the currently set SKU Id.\r
1621\r
1622 If the sku id got >= PCD_MAX_SKU_ID, then ASSERT().\r
1623\r
1624 @return The currently set SKU Id. If the platform has not set at a SKU Id, then the\r
1625 default SKU Id value of 0 is returned. If the platform has set a SKU Id, then the currently set SKU\r
1626 Id is returned.\r
1627**/\r
1628UINTN\r
1629EFIAPI\r
1630LibPcdGetSku (\r
1631 VOID\r
1632 );\r
1633\r
fb3df220 1634#endif\r