]>
Commit | Line | Data |
---|---|---|
e386b444 | 1 | /** @file\r |
2 | Implementation of PcdLib class library for PEI phase.\r | |
3 | \r | |
373ade0e | 4 | Copyright (c) 2006 - 2008, Intel Corporation<BR>\r |
e386b444 | 5 | All rights reserved. This program and the accompanying materials \r |
6 | are licensed and made available under the terms and conditions of the BSD License \r | |
7 | which accompanies this distribution. The full text of the license may be found at \r | |
8 | http://opensource.org/licenses/bsd-license.php \r | |
9 | \r | |
10 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, \r | |
11 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. \r | |
12 | \r | |
13 | \r | |
e386b444 | 14 | **/\r |
15 | \r | |
16 | \r | |
17 | \r | |
c892d846 | 18 | \r |
c7d265a9 | 19 | #include <PiPei.h>\r |
c892d846 | 20 | \r |
c7d265a9 | 21 | #include <Ppi/Pcd.h>\r |
c892d846 | 22 | \r |
1c280088 | 23 | #include <Library/PeiServicesLib.h>\r |
c7d265a9 | 24 | #include <Library/PcdLib.h>\r |
25 | #include <Library/DebugLib.h>\r | |
c7d265a9 | 26 | #include <Library/BaseMemoryLib.h>\r |
e386b444 | 27 | \r |
28 | /**\r | |
a72bd1ec | 29 | Retrieve the PCD_PPI pointer.\r |
e386b444 | 30 | \r |
a72bd1ec | 31 | This function is to locate PCD_PPI PPI via PeiService. \r |
32 | If fail to locate PCD_PPI, then ASSERT_EFI_ERROR().\r | |
33 | \r | |
e386b444 | 34 | @retval PCD_PPI * The pointer to the PCD_PPI.\r |
35 | \r | |
36 | **/\r | |
e386b444 | 37 | PCD_PPI *\r |
a72bd1ec | 38 | GetPcdPpiPointer (\r |
e386b444 | 39 | VOID\r |
40 | ) \r | |
41 | {\r | |
42 | EFI_STATUS Status;\r | |
43 | PCD_PPI *PcdPpi;\r | |
1c280088 | 44 | \r |
45 | Status = PeiServicesLocatePpi (&gPcdPpiGuid, 0, NULL, (VOID **)&PcdPpi);\r | |
e386b444 | 46 | ASSERT_EFI_ERROR (Status);\r |
47 | \r | |
48 | return PcdPpi;\r | |
49 | }\r | |
50 | \r | |
e386b444 | 51 | /**\r |
0c3437e0 | 52 | This function provides a means by which SKU support can be established in the PCD infrastructure.\r |
53 | \r | |
e386b444 | 54 | Sets the current SKU in the PCD database to the value specified by SkuId. SkuId is returned.\r |
0c3437e0 | 55 | \r |
56 | @param[in] SkuId The SKU value that will be used when the PCD service will retrieve and \r | |
57 | set values associated with a PCD token.\r | |
58 | \r | |
59 | If SkuId >= 0x100, then ASSERT(). \r | |
e386b444 | 60 | \r |
f73e0ad2 | 61 | @return Return the SKU ID that just be set.\r |
e386b444 | 62 | \r |
63 | **/\r | |
64 | UINTN\r | |
65 | EFIAPI\r | |
66 | LibPcdSetSku (\r | |
0c3437e0 | 67 | IN UINTN SkuId\r |
e386b444 | 68 | )\r |
69 | {\r | |
70 | \r | |
a72bd1ec | 71 | ASSERT (SkuId < PCD_MAX_SKU_ID);\r |
e386b444 | 72 | \r |
a72bd1ec | 73 | GetPcdPpiPointer()->SetSku (SkuId);\r |
e386b444 | 74 | \r |
75 | return SkuId;\r | |
76 | }\r | |
77 | \r | |
78 | \r | |
79 | \r | |
80 | /**\r | |
0c3437e0 | 81 | This function provides a means by which to retrieve a value for a given PCD token.\r |
82 | \r | |
e386b444 | 83 | Returns the 8-bit value for the token specified by TokenNumber. \r |
84 | \r | |
63e4dba9 | 85 | @param[in] TokenNumber The PCD token number to retrieve a current value for.\r |
e386b444 | 86 | \r |
f73e0ad2 | 87 | @return Returns the 8-bit value for the token specified by TokenNumber. \r |
e386b444 | 88 | \r |
89 | **/\r | |
90 | UINT8\r | |
91 | EFIAPI\r | |
92 | LibPcdGet8 (\r | |
0c3437e0 | 93 | IN UINTN TokenNumber\r |
e386b444 | 94 | )\r |
95 | {\r | |
a72bd1ec | 96 | return (GetPcdPpiPointer ())->Get8 (TokenNumber);\r |
e386b444 | 97 | }\r |
98 | \r | |
99 | \r | |
100 | \r | |
101 | /**\r | |
0c3437e0 | 102 | This function provides a means by which to retrieve a value for a given PCD token.\r |
103 | \r | |
e386b444 | 104 | Returns the 16-bit value for the token specified by TokenNumber. \r |
105 | \r | |
0c3437e0 | 106 | @param[in] TokenNumber The PCD token number to retrieve a current value for.\r |
e386b444 | 107 | \r |
f73e0ad2 | 108 | @return Returns the 16-bit value for the token specified by TokenNumber. \r |
e386b444 | 109 | \r |
110 | **/\r | |
111 | UINT16\r | |
112 | EFIAPI\r | |
113 | LibPcdGet16 (\r | |
0c3437e0 | 114 | IN UINTN TokenNumber\r |
e386b444 | 115 | )\r |
116 | {\r | |
a72bd1ec | 117 | return (GetPcdPpiPointer ())->Get16 (TokenNumber);\r |
e386b444 | 118 | }\r |
119 | \r | |
120 | \r | |
121 | \r | |
122 | /**\r | |
0c3437e0 | 123 | This function provides a means by which to retrieve a value for a given PCD token.\r |
124 | \r | |
e386b444 | 125 | Returns the 32-bit value for the token specified by TokenNumber. \r |
126 | \r | |
127 | @param[in] TokenNumber The PCD token number to retrieve a current value for.\r | |
128 | \r | |
f73e0ad2 | 129 | @return Returns the 32-bit value for the token specified by TokenNumber.\r |
e386b444 | 130 | \r |
131 | **/\r | |
132 | UINT32\r | |
133 | EFIAPI\r | |
134 | LibPcdGet32 (\r | |
0c3437e0 | 135 | IN UINTN TokenNumber\r |
e386b444 | 136 | )\r |
137 | {\r | |
a72bd1ec | 138 | return (GetPcdPpiPointer ())->Get32 (TokenNumber);\r |
e386b444 | 139 | }\r |
140 | \r | |
141 | \r | |
142 | \r | |
143 | /**\r | |
0c3437e0 | 144 | This function provides a means by which to retrieve a value for a given PCD token.\r |
145 | \r | |
e386b444 | 146 | Returns the 64-bit value for the token specified by TokenNumber.\r |
147 | \r | |
148 | @param[in] TokenNumber The PCD token number to retrieve a current value for.\r | |
149 | \r | |
f73e0ad2 | 150 | @return Returns the 64-bit value for the token specified by TokenNumber.\r |
e386b444 | 151 | \r |
152 | **/\r | |
153 | UINT64\r | |
154 | EFIAPI\r | |
155 | LibPcdGet64 (\r | |
0c3437e0 | 156 | IN UINTN TokenNumber\r |
e386b444 | 157 | )\r |
158 | {\r | |
a72bd1ec | 159 | return (GetPcdPpiPointer ())->Get64 (TokenNumber);\r |
e386b444 | 160 | }\r |
161 | \r | |
162 | \r | |
163 | \r | |
164 | /**\r | |
0c3437e0 | 165 | This function provides a means by which to retrieve a value for a given PCD token.\r |
166 | \r | |
e386b444 | 167 | Returns the pointer to the buffer of the token specified by TokenNumber.\r |
168 | \r | |
169 | @param[in] TokenNumber The PCD token number to retrieve a current value for.\r | |
170 | \r | |
f73e0ad2 | 171 | @return Returns the pointer to the token specified by TokenNumber.\r |
e386b444 | 172 | \r |
173 | **/\r | |
174 | VOID *\r | |
175 | EFIAPI\r | |
176 | LibPcdGetPtr (\r | |
0c3437e0 | 177 | IN UINTN TokenNumber\r |
e386b444 | 178 | )\r |
179 | {\r | |
a72bd1ec | 180 | return (GetPcdPpiPointer ())->GetPtr (TokenNumber);\r |
e386b444 | 181 | }\r |
182 | \r | |
183 | \r | |
184 | \r | |
185 | /**\r | |
0c3437e0 | 186 | This function provides a means by which to retrieve a value for a given PCD token.\r |
187 | \r | |
e386b444 | 188 | Returns the Boolean value of the token specified by TokenNumber. \r |
189 | \r | |
190 | @param[in] TokenNumber The PCD token number to retrieve a current value for.\r | |
191 | \r | |
f73e0ad2 | 192 | @return Returns the Boolean value of the token specified by TokenNumber. \r |
e386b444 | 193 | \r |
194 | **/\r | |
195 | BOOLEAN \r | |
196 | EFIAPI\r | |
197 | LibPcdGetBool (\r | |
0c3437e0 | 198 | IN UINTN TokenNumber\r |
e386b444 | 199 | )\r |
200 | {\r | |
a72bd1ec | 201 | return (GetPcdPpiPointer ())->GetBool (TokenNumber);\r |
e386b444 | 202 | }\r |
203 | \r | |
204 | \r | |
205 | \r | |
206 | /**\r | |
0c3437e0 | 207 | This function provides a means by which to retrieve the size of a given PCD token.\r |
e386b444 | 208 | \r |
209 | @param[in] TokenNumber The PCD token number to retrieve a current value for.\r | |
210 | \r | |
f73e0ad2 | 211 | @return Returns the size of the token specified by TokenNumber. \r |
e386b444 | 212 | \r |
213 | **/\r | |
214 | UINTN\r | |
215 | EFIAPI\r | |
216 | LibPcdGetSize (\r | |
0c3437e0 | 217 | IN UINTN TokenNumber\r |
e386b444 | 218 | )\r |
219 | {\r | |
a72bd1ec | 220 | return (GetPcdPpiPointer ())->GetSize (TokenNumber);\r |
e386b444 | 221 | }\r |
222 | \r | |
223 | \r | |
224 | \r | |
225 | /**\r | |
0c3437e0 | 226 | This function provides a means by which to retrieve a value for a given PCD token.\r |
227 | \r | |
e386b444 | 228 | Returns the 8-bit value for the token specified by TokenNumber and Guid.\r |
0c3437e0 | 229 | \r |
e386b444 | 230 | If Guid is NULL, then ASSERT(). \r |
231 | \r | |
232 | @param[in] Guid Pointer to a 128-bit unique value that designates \r | |
233 | which namespace to retrieve a value from.\r | |
234 | @param[in] TokenNumber The PCD token number to retrieve a current value for.\r | |
235 | \r | |
f73e0ad2 | 236 | @return Return the UINT8.\r |
e386b444 | 237 | \r |
238 | **/\r | |
239 | UINT8\r | |
240 | EFIAPI\r | |
241 | LibPcdGetEx8 (\r | |
242 | IN CONST GUID *Guid,\r | |
243 | IN UINTN TokenNumber\r | |
244 | )\r | |
245 | {\r | |
e386b444 | 246 | ASSERT (Guid != NULL);\r |
247 | \r | |
a72bd1ec | 248 | return (GetPcdPpiPointer ())->Get8Ex (Guid, TokenNumber);\r |
e386b444 | 249 | }\r |
250 | \r | |
251 | \r | |
252 | \r | |
253 | /**\r | |
0c3437e0 | 254 | This function provides a means by which to retrieve a value for a given PCD token.\r |
255 | \r | |
e386b444 | 256 | Returns the 16-bit value for the token specified by TokenNumber and Guid.\r |
0c3437e0 | 257 | \r |
e386b444 | 258 | If Guid is NULL, then ASSERT(). \r |
259 | \r | |
260 | @param[in] Guid Pointer to a 128-bit unique value that designates \r | |
261 | which namespace to retrieve a value from.\r | |
262 | @param[in] TokenNumber The PCD token number to retrieve a current value for.\r | |
263 | \r | |
f73e0ad2 | 264 | @return Return the UINT16.\r |
e386b444 | 265 | \r |
266 | **/\r | |
267 | UINT16\r | |
268 | EFIAPI\r | |
269 | LibPcdGetEx16 (\r | |
270 | IN CONST GUID *Guid,\r | |
271 | IN UINTN TokenNumber\r | |
272 | )\r | |
273 | {\r | |
e386b444 | 274 | \r |
275 | ASSERT (Guid != NULL);\r | |
276 | \r | |
a72bd1ec | 277 | return (GetPcdPpiPointer ())->Get16Ex (Guid, TokenNumber);\r |
e386b444 | 278 | }\r |
279 | \r | |
280 | \r | |
281 | \r | |
282 | /**\r | |
283 | Returns the 32-bit value for the token specified by TokenNumber and Guid.\r | |
284 | If Guid is NULL, then ASSERT(). \r | |
285 | \r | |
286 | @param[in] Guid Pointer to a 128-bit unique value that designates \r | |
287 | which namespace to retrieve a value from.\r | |
288 | @param[in] TokenNumber The PCD token number to retrieve a current value for.\r | |
289 | \r | |
f73e0ad2 | 290 | @return Return the UINT32.\r |
e386b444 | 291 | \r |
292 | **/\r | |
293 | UINT32\r | |
294 | EFIAPI\r | |
295 | LibPcdGetEx32 (\r | |
296 | IN CONST GUID *Guid,\r | |
297 | IN UINTN TokenNumber\r | |
298 | )\r | |
299 | {\r | |
e386b444 | 300 | ASSERT (Guid != NULL);\r |
301 | \r | |
a72bd1ec | 302 | return (GetPcdPpiPointer ())->Get32Ex (Guid, TokenNumber);\r |
e386b444 | 303 | }\r |
304 | \r | |
305 | \r | |
306 | \r | |
307 | \r | |
308 | /**\r | |
0c3437e0 | 309 | This function provides a means by which to retrieve a value for a given PCD token.\r |
310 | \r | |
e386b444 | 311 | Returns the 64-bit value for the token specified by TokenNumber and Guid.\r |
0c3437e0 | 312 | \r |
e386b444 | 313 | If Guid is NULL, then ASSERT(). \r |
314 | \r | |
0c3437e0 | 315 | @param[in] Guid Pointer to a 128-bit unique value that designates \r |
316 | which namespace to retrieve a value from.\r | |
317 | @param[in] TokenNumber The PCD token number to retrieve a current value for.\r | |
e386b444 | 318 | \r |
f73e0ad2 | 319 | @return Return the UINT64.\r |
e386b444 | 320 | \r |
321 | **/\r | |
322 | UINT64\r | |
323 | EFIAPI\r | |
324 | LibPcdGetEx64 (\r | |
325 | IN CONST GUID *Guid,\r | |
326 | IN UINTN TokenNumber\r | |
327 | )\r | |
328 | {\r | |
e386b444 | 329 | ASSERT (Guid != NULL);\r |
a72bd1ec | 330 | return (GetPcdPpiPointer ())->Get64Ex (Guid, TokenNumber);\r |
e386b444 | 331 | }\r |
332 | \r | |
333 | \r | |
334 | \r | |
335 | /**\r | |
0c3437e0 | 336 | This function provides a means by which to retrieve a value for a given PCD token.\r |
337 | \r | |
338 | Returns the pointer to the buffer of token specified by TokenNumber and Guid.\r | |
339 | \r | |
e386b444 | 340 | If Guid is NULL, then ASSERT(). \r |
341 | \r | |
0c3437e0 | 342 | @param[in] Guid Pointer to a 128-bit unique value that designates \r |
343 | which namespace to retrieve a value from.\r | |
344 | @param[in] TokenNumber The PCD token number to retrieve a current value for.\r | |
e386b444 | 345 | \r |
f73e0ad2 | 346 | @return Return the VOID* pointer.\r |
e386b444 | 347 | \r |
348 | **/\r | |
349 | VOID *\r | |
350 | EFIAPI\r | |
351 | LibPcdGetExPtr (\r | |
352 | IN CONST GUID *Guid,\r | |
353 | IN UINTN TokenNumber\r | |
354 | )\r | |
355 | {\r | |
e386b444 | 356 | ASSERT (Guid != NULL);\r |
357 | \r | |
a72bd1ec | 358 | return (GetPcdPpiPointer ())->GetPtrEx (Guid, TokenNumber);\r |
e386b444 | 359 | }\r |
360 | \r | |
361 | \r | |
362 | \r | |
363 | /**\r | |
0c3437e0 | 364 | This function provides a means by which to retrieve a value for a given PCD token.\r |
365 | \r | |
e386b444 | 366 | Returns the Boolean value of the token specified by TokenNumber and Guid. \r |
0c3437e0 | 367 | \r |
e386b444 | 368 | If Guid is NULL, then ASSERT(). \r |
369 | \r | |
0c3437e0 | 370 | @param[in] Guid Pointer to a 128-bit unique value that designates \r |
371 | which namespace to retrieve a value from.\r | |
372 | @param[in] TokenNumber The PCD token number to retrieve a current value for.\r | |
e386b444 | 373 | \r |
f73e0ad2 | 374 | @return Return the BOOLEAN.\r |
e386b444 | 375 | \r |
376 | **/\r | |
377 | BOOLEAN\r | |
378 | EFIAPI\r | |
379 | LibPcdGetExBool (\r | |
380 | IN CONST GUID *Guid,\r | |
381 | IN UINTN TokenNumber\r | |
382 | )\r | |
383 | {\r | |
e386b444 | 384 | ASSERT (Guid != NULL);\r |
a72bd1ec | 385 | return (GetPcdPpiPointer ())->GetBoolEx (Guid, TokenNumber);\r |
e386b444 | 386 | }\r |
387 | \r | |
388 | \r | |
389 | \r | |
390 | /**\r | |
0c3437e0 | 391 | This function provides a means by which to retrieve the size of a given PCD token.\r |
392 | \r | |
e386b444 | 393 | Returns the size of the token specified by TokenNumber and Guid. \r |
0c3437e0 | 394 | \r |
e386b444 | 395 | If Guid is NULL, then ASSERT(). \r |
396 | \r | |
0c3437e0 | 397 | @param[in] Guid Pointer to a 128-bit unique value that designates \r |
398 | which namespace to retrieve a value from.\r | |
399 | @param[in] TokenNumber The PCD token number to retrieve a current value for.\r | |
e386b444 | 400 | \r |
f73e0ad2 | 401 | @return Return the size.\r |
e386b444 | 402 | \r |
403 | **/\r | |
404 | UINTN\r | |
405 | EFIAPI\r | |
406 | LibPcdGetExSize (\r | |
407 | IN CONST GUID *Guid,\r | |
408 | IN UINTN TokenNumber\r | |
409 | )\r | |
410 | {\r | |
e386b444 | 411 | ASSERT (Guid != NULL);\r |
a72bd1ec | 412 | return (GetPcdPpiPointer ())->GetSizeEx (Guid, TokenNumber);\r |
e386b444 | 413 | }\r |
414 | \r | |
415 | \r | |
416 | \r | |
417 | /**\r | |
0c3437e0 | 418 | This function provides a means by which to set a value for a given PCD token.\r |
419 | \r | |
e386b444 | 420 | Sets the 8-bit value for the token specified by TokenNumber \r |
421 | to the value specified by Value. Value is returned.\r | |
422 | \r | |
0c3437e0 | 423 | @param[in] TokenNumber The PCD token number to set a current value for.\r |
424 | @param[in] Value The 8-bit value to set.\r | |
e386b444 | 425 | \r |
f73e0ad2 | 426 | @return Return the value been set.\r |
e386b444 | 427 | \r |
428 | **/\r | |
429 | UINT8\r | |
430 | EFIAPI\r | |
431 | LibPcdSet8 (\r | |
432 | IN UINTN TokenNumber,\r | |
433 | IN UINT8 Value\r | |
434 | )\r | |
435 | {\r | |
436 | EFI_STATUS Status;\r | |
e386b444 | 437 | \r |
a72bd1ec | 438 | Status = (GetPcdPpiPointer ())->Set8 (TokenNumber, Value);\r |
e386b444 | 439 | \r |
440 | ASSERT_EFI_ERROR (Status);\r | |
441 | \r | |
442 | return Value;\r | |
443 | }\r | |
444 | \r | |
445 | \r | |
446 | \r | |
447 | /**\r | |
0c3437e0 | 448 | This function provides a means by which to set a value for a given PCD token.\r |
449 | \r | |
e386b444 | 450 | Sets the 16-bit value for the token specified by TokenNumber \r |
451 | to the value specified by Value. Value is returned.\r | |
452 | \r | |
0c3437e0 | 453 | @param[in] TokenNumber The PCD token number to set a current value for.\r |
454 | @param[in] Value The 16-bit value to set.\r | |
e386b444 | 455 | \r |
f73e0ad2 | 456 | @return Return the value been set.\r |
e386b444 | 457 | \r |
458 | **/\r | |
459 | UINT16\r | |
460 | EFIAPI\r | |
461 | LibPcdSet16 (\r | |
462 | IN UINTN TokenNumber,\r | |
463 | IN UINT16 Value\r | |
464 | )\r | |
465 | {\r | |
466 | EFI_STATUS Status;\r | |
e386b444 | 467 | \r |
a72bd1ec | 468 | Status = (GetPcdPpiPointer ())->Set16 (TokenNumber, Value);\r |
e386b444 | 469 | \r |
470 | ASSERT_EFI_ERROR (Status);\r | |
471 | \r | |
472 | return Value;\r | |
473 | }\r | |
474 | \r | |
475 | \r | |
476 | \r | |
477 | /**\r | |
0c3437e0 | 478 | This function provides a means by which to set a value for a given PCD token.\r |
479 | \r | |
e386b444 | 480 | Sets the 32-bit value for the token specified by TokenNumber \r |
481 | to the value specified by Value. Value is returned.\r | |
482 | \r | |
0c3437e0 | 483 | @param[in] TokenNumber The PCD token number to set a current value for.\r |
484 | @param[in] Value The 32-bit value to set.\r | |
e386b444 | 485 | \r |
f73e0ad2 | 486 | @return Return the value been set.\r |
e386b444 | 487 | \r |
488 | **/\r | |
489 | UINT32\r | |
490 | EFIAPI\r | |
491 | LibPcdSet32 (\r | |
492 | IN UINTN TokenNumber,\r | |
0c3437e0 | 493 | IN UINT32 Value\r |
e386b444 | 494 | )\r |
495 | {\r | |
496 | EFI_STATUS Status;\r | |
e386b444 | 497 | \r |
a72bd1ec | 498 | Status = (GetPcdPpiPointer ())->Set32 (TokenNumber, Value);\r |
e386b444 | 499 | \r |
500 | ASSERT_EFI_ERROR (Status);\r | |
501 | \r | |
502 | return Value;\r | |
503 | }\r | |
504 | \r | |
505 | \r | |
506 | \r | |
507 | /**\r | |
0c3437e0 | 508 | This function provides a means by which to set a value for a given PCD token.\r |
509 | \r | |
e386b444 | 510 | Sets the 64-bit value for the token specified by TokenNumber \r |
511 | to the value specified by Value. Value is returned.\r | |
512 | \r | |
0c3437e0 | 513 | @param[in] TokenNumber The PCD token number to set a current value for.\r |
514 | @param[in] Value The 64-bit value to set.\r | |
e386b444 | 515 | \r |
f73e0ad2 | 516 | @return Return the value been set.\r |
e386b444 | 517 | \r |
518 | **/\r | |
519 | UINT64\r | |
520 | EFIAPI\r | |
521 | LibPcdSet64 (\r | |
522 | IN UINTN TokenNumber,\r | |
0c3437e0 | 523 | IN UINT64 Value\r |
e386b444 | 524 | )\r |
525 | {\r | |
526 | EFI_STATUS Status;\r | |
e386b444 | 527 | \r |
a72bd1ec | 528 | Status = (GetPcdPpiPointer ())->Set64 (TokenNumber, Value);\r |
e386b444 | 529 | \r |
530 | ASSERT_EFI_ERROR (Status);\r | |
531 | \r | |
532 | return Value;\r | |
533 | }\r | |
534 | \r | |
535 | \r | |
536 | \r | |
537 | /**\r | |
0c3437e0 | 538 | This function provides a means by which to set a value for a given PCD token.\r |
e386b444 | 539 | \r |
0c3437e0 | 540 | Sets a buffer for the token specified by TokenNumber to the value \r |
541 | specified by Buffer and SizeOfBuffer. Buffer is returned. \r | |
542 | If SizeOfBuffer is greater than the maximum size support by TokenNumber, \r | |
543 | then set SizeOfBuffer to the maximum size supported by TokenNumber and \r | |
544 | return NULL to indicate that the set operation was not actually performed. \r | |
545 | \r | |
546 | If SizeOfBuffer is set to MAX_ADDRESS, then SizeOfBuffer must be set to the \r | |
547 | maximum size supported by TokenName and NULL must be returned.\r | |
e386b444 | 548 | \r |
0c3437e0 | 549 | If SizeOfBuffer is NULL, then ASSERT().\r |
a72bd1ec | 550 | If SizeOfBuffer > 0 and Buffer is NULL, then ASSERT().\r |
e386b444 | 551 | \r |
0c3437e0 | 552 | @param[in] TokenNumber The PCD token number to set a current value for.\r |
553 | @param[in, out] SizeOfBuffer The size, in bytes, of Buffer.\r | |
554 | @param[in] Buffer A pointer to the buffer to set.\r | |
e386b444 | 555 | \r |
f73e0ad2 | 556 | @return Return the pointer for the buffer been set.\r |
e386b444 | 557 | \r |
558 | **/\r | |
559 | VOID *\r | |
560 | EFIAPI\r | |
561 | LibPcdSetPtr (\r | |
0c3437e0 | 562 | IN UINTN TokenNumber,\r |
563 | IN OUT UINTN *SizeOfBuffer,\r | |
564 | IN CONST VOID *Buffer\r | |
e386b444 | 565 | )\r |
566 | {\r | |
567 | EFI_STATUS Status;\r | |
e386b444 | 568 | \r |
569 | ASSERT (SizeOfBuffer != NULL);\r | |
570 | \r | |
571 | if (*SizeOfBuffer > 0) {\r | |
572 | ASSERT (Buffer != NULL);\r | |
573 | }\r | |
e386b444 | 574 | \r |
b52f6a1a | 575 | Status = (GetPcdPpiPointer ())->SetPtr (TokenNumber, SizeOfBuffer, (VOID *) Buffer);\r |
e386b444 | 576 | \r |
577 | if (EFI_ERROR (Status)) {\r | |
578 | return NULL;\r | |
579 | }\r | |
580 | \r | |
b52f6a1a | 581 | return (VOID *) Buffer;\r |
e386b444 | 582 | }\r |
583 | \r | |
584 | \r | |
585 | \r | |
586 | /**\r | |
0c3437e0 | 587 | This function provides a means by which to set a value for a given PCD token.\r |
588 | \r | |
e386b444 | 589 | Sets the Boolean value for the token specified by TokenNumber \r |
590 | to the value specified by Value. Value is returned.\r | |
591 | \r | |
0c3437e0 | 592 | @param[in] TokenNumber The PCD token number to set a current value for.\r |
593 | @param[in] Value The boolean value to set.\r | |
e386b444 | 594 | \r |
f73e0ad2 | 595 | @return Return the value been set.\r |
e386b444 | 596 | \r |
597 | **/\r | |
598 | BOOLEAN\r | |
599 | EFIAPI\r | |
600 | LibPcdSetBool (\r | |
601 | IN UINTN TokenNumber,\r | |
602 | IN BOOLEAN Value\r | |
603 | )\r | |
604 | {\r | |
605 | EFI_STATUS Status;\r | |
e386b444 | 606 | \r |
a72bd1ec | 607 | Status = (GetPcdPpiPointer ())->SetBool (TokenNumber, Value);\r |
e386b444 | 608 | \r |
609 | ASSERT_EFI_ERROR (Status);\r | |
610 | \r | |
611 | return Value;\r | |
612 | }\r | |
613 | \r | |
614 | \r | |
615 | \r | |
616 | /**\r | |
0c3437e0 | 617 | This function provides a means by which to set a value for a given PCD token.\r |
618 | \r | |
e386b444 | 619 | Sets the 8-bit value for the token specified by TokenNumber and \r |
620 | Guid to the value specified by Value. Value is returned.\r | |
0c3437e0 | 621 | \r |
e386b444 | 622 | If Guid is NULL, then ASSERT().\r |
623 | \r | |
0c3437e0 | 624 | @param[in] Guid Pointer to a 128-bit unique value that \r |
625 | designates which namespace to set a value from.\r | |
626 | @param[in] TokenNumber The PCD token number to set a current value for.\r | |
627 | @param[in] Value The 8-bit value to set.\r | |
e386b444 | 628 | \r |
f73e0ad2 | 629 | @return Return the value been set.\r |
e386b444 | 630 | \r |
631 | **/\r | |
632 | UINT8\r | |
633 | EFIAPI\r | |
634 | LibPcdSetEx8 (\r | |
635 | IN CONST GUID *Guid,\r | |
636 | IN UINTN TokenNumber,\r | |
637 | IN UINT8 Value\r | |
638 | )\r | |
639 | {\r | |
640 | EFI_STATUS Status;\r | |
e386b444 | 641 | \r |
642 | ASSERT (Guid != NULL);\r | |
643 | \r | |
a72bd1ec | 644 | Status = (GetPcdPpiPointer ())->Set8Ex (Guid, TokenNumber, Value);\r |
e386b444 | 645 | \r |
646 | ASSERT_EFI_ERROR (Status);\r | |
647 | \r | |
648 | return Value;\r | |
649 | }\r | |
650 | \r | |
651 | \r | |
652 | \r | |
653 | /**\r | |
0c3437e0 | 654 | This function provides a means by which to set a value for a given PCD token.\r |
655 | \r | |
e386b444 | 656 | Sets the 16-bit value for the token specified by TokenNumber and \r |
657 | Guid to the value specified by Value. Value is returned.\r | |
0c3437e0 | 658 | \r |
e386b444 | 659 | If Guid is NULL, then ASSERT().\r |
660 | \r | |
0c3437e0 | 661 | @param[in] Guid Pointer to a 128-bit unique value that \r |
662 | designates which namespace to set a value from.\r | |
663 | @param[in] TokenNumber The PCD token number to set a current value for.\r | |
664 | @param[in] Value The 16-bit value to set.\r | |
e386b444 | 665 | \r |
f73e0ad2 | 666 | @return Return the value been set.\r |
e386b444 | 667 | \r |
668 | **/\r | |
669 | UINT16\r | |
670 | EFIAPI\r | |
671 | LibPcdSetEx16 (\r | |
672 | IN CONST GUID *Guid,\r | |
673 | IN UINTN TokenNumber,\r | |
674 | IN UINT16 Value\r | |
675 | )\r | |
676 | {\r | |
677 | EFI_STATUS Status;\r | |
e386b444 | 678 | ASSERT (Guid != NULL);\r |
a72bd1ec | 679 | Status = (GetPcdPpiPointer ())->Set16Ex (Guid, TokenNumber, Value);\r |
e386b444 | 680 | \r |
681 | ASSERT_EFI_ERROR (Status);\r | |
682 | \r | |
683 | return Value;\r | |
684 | }\r | |
685 | \r | |
686 | \r | |
687 | \r | |
688 | /**\r | |
0c3437e0 | 689 | This function provides a means by which to set a value for a given PCD token.\r |
690 | \r | |
e386b444 | 691 | Sets the 32-bit value for the token specified by TokenNumber and \r |
692 | Guid to the value specified by Value. Value is returned.\r | |
0c3437e0 | 693 | \r |
e386b444 | 694 | If Guid is NULL, then ASSERT().\r |
695 | \r | |
0c3437e0 | 696 | @param[in] Guid Pointer to a 128-bit unique value that \r |
697 | designates which namespace to set a value from.\r | |
698 | @param[in] TokenNumber The PCD token number to set a current value for.\r | |
699 | @param[in] Value The 32-bit value to set.\r | |
e386b444 | 700 | \r |
f73e0ad2 | 701 | @return Return the value been set.\r |
e386b444 | 702 | \r |
703 | **/\r | |
704 | UINT32\r | |
705 | EFIAPI\r | |
706 | LibPcdSetEx32 (\r | |
707 | IN CONST GUID *Guid,\r | |
708 | IN UINTN TokenNumber,\r | |
0c3437e0 | 709 | IN UINT32 Value\r |
e386b444 | 710 | )\r |
711 | {\r | |
712 | EFI_STATUS Status;\r | |
e386b444 | 713 | \r |
a72bd1ec | 714 | ASSERT (Guid != NULL);\r |
e386b444 | 715 | \r |
a72bd1ec | 716 | Status = (GetPcdPpiPointer ())->Set32Ex (Guid, TokenNumber, Value);\r |
e386b444 | 717 | \r |
718 | ASSERT_EFI_ERROR (Status);\r | |
719 | \r | |
720 | return Value;\r | |
721 | }\r | |
722 | \r | |
723 | \r | |
724 | \r | |
725 | /**\r | |
0c3437e0 | 726 | This function provides a means by which to set a value for a given PCD token.\r |
727 | \r | |
e386b444 | 728 | Sets the 64-bit value for the token specified by TokenNumber and \r |
729 | Guid to the value specified by Value. Value is returned.\r | |
730 | If Guid is NULL, then ASSERT().\r | |
731 | \r | |
0c3437e0 | 732 | @param[in] Guid Pointer to a 128-bit unique value that \r |
733 | designates which namespace to set a value from.\r | |
734 | @param[in] TokenNumber The PCD token number to set a current value for.\r | |
735 | @param[in] Value The 64-bit value to set.\r | |
e386b444 | 736 | \r |
f73e0ad2 | 737 | @return Return the value been set.\r |
e386b444 | 738 | \r |
739 | **/\r | |
740 | UINT64\r | |
741 | EFIAPI\r | |
742 | LibPcdSetEx64 (\r | |
743 | IN CONST GUID *Guid,\r | |
744 | IN UINTN TokenNumber,\r | |
745 | IN UINT64 Value\r | |
746 | )\r | |
747 | {\r | |
748 | EFI_STATUS Status;\r | |
e386b444 | 749 | ASSERT (Guid != NULL);\r |
e386b444 | 750 | \r |
a72bd1ec | 751 | Status = (GetPcdPpiPointer ())->Set64Ex (Guid, TokenNumber, Value);\r |
e386b444 | 752 | \r |
753 | ASSERT_EFI_ERROR (Status);\r | |
754 | \r | |
755 | return Value;\r | |
756 | }\r | |
757 | \r | |
758 | \r | |
759 | \r | |
760 | /**\r | |
0c3437e0 | 761 | This function provides a means by which to set a value for a given PCD token.\r |
762 | \r | |
e386b444 | 763 | Sets a buffer for the token specified by TokenNumber to the value specified by \r |
a72bd1ec | 764 | Buffer and SizeOfBuffer. Buffer is returned. If SizeOfBuffer is greater than \r |
765 | the maximum size support by TokenNumber, then set SizeOfBuffer to the maximum size \r | |
e386b444 | 766 | supported by TokenNumber and return NULL to indicate that the set operation \r |
767 | was not actually performed. \r | |
768 | \r | |
0c3437e0 | 769 | If Guid is NULL, then ASSERT().\r |
770 | If SizeOfBuffer is NULL, then ASSERT().\r | |
a72bd1ec | 771 | If SizeOfBuffer > 0 and Buffer is NULL, then ASSERT().\r |
e386b444 | 772 | \r |
0c3437e0 | 773 | @param[in] Guid Pointer to a 128-bit unique value that \r |
774 | designates which namespace to set a value from.\r | |
775 | @param[in] TokenNumber The PCD token number to set a current value for.\r | |
776 | @param[in, out] SizeOfBuffer The size, in bytes, of Buffer.\r | |
777 | @param[in] Buffer A pointer to the buffer to set.\r | |
e386b444 | 778 | \r |
f73e0ad2 | 779 | @return Return the pinter to the buffer been set.\r |
e386b444 | 780 | \r |
781 | **/\r | |
782 | VOID *\r | |
783 | EFIAPI\r | |
784 | LibPcdSetExPtr (\r | |
785 | IN CONST GUID *Guid,\r | |
786 | IN UINTN TokenNumber,\r | |
787 | IN OUT UINTN *SizeOfBuffer,\r | |
788 | IN VOID *Buffer\r | |
789 | )\r | |
790 | {\r | |
791 | EFI_STATUS Status;\r | |
a72bd1ec | 792 | ASSERT (SizeOfBuffer != NULL);\r |
e386b444 | 793 | if (*SizeOfBuffer > 0) {\r |
794 | ASSERT (Buffer != NULL);\r | |
795 | }\r | |
796 | ASSERT (Guid != NULL);\r | |
e386b444 | 797 | \r |
a72bd1ec | 798 | Status = (GetPcdPpiPointer ())->SetPtrEx (Guid, TokenNumber, SizeOfBuffer, Buffer);\r |
e386b444 | 799 | \r |
800 | if (EFI_ERROR (Status)) {\r | |
801 | return NULL;\r | |
802 | }\r | |
803 | \r | |
804 | return Buffer;\r | |
805 | }\r | |
806 | \r | |
807 | \r | |
808 | \r | |
809 | /**\r | |
0c3437e0 | 810 | This function provides a means by which to set a value for a given PCD token.\r |
811 | \r | |
e386b444 | 812 | Sets the Boolean value for the token specified by TokenNumber and \r |
813 | Guid to the value specified by Value. Value is returned.\r | |
0c3437e0 | 814 | \r |
e386b444 | 815 | If Guid is NULL, then ASSERT().\r |
816 | \r | |
0c3437e0 | 817 | @param[in] Guid Pointer to a 128-bit unique value that \r |
818 | designates which namespace to set a value from.\r | |
819 | @param[in] TokenNumber The PCD token number to set a current value for.\r | |
820 | @param[in] Value The Boolean value to set.\r | |
e386b444 | 821 | \r |
f73e0ad2 | 822 | @return Return the value been set.\r |
e386b444 | 823 | \r |
824 | **/\r | |
825 | BOOLEAN\r | |
826 | EFIAPI\r | |
827 | LibPcdSetExBool (\r | |
828 | IN CONST GUID *Guid,\r | |
829 | IN UINTN TokenNumber,\r | |
830 | IN BOOLEAN Value\r | |
831 | )\r | |
832 | {\r | |
833 | EFI_STATUS Status;\r | |
e386b444 | 834 | \r |
835 | ASSERT (Guid != NULL);\r | |
a72bd1ec | 836 | Status = (GetPcdPpiPointer ())->SetBoolEx (Guid, TokenNumber, Value);\r |
e386b444 | 837 | \r |
838 | ASSERT_EFI_ERROR (Status);\r | |
839 | \r | |
840 | return Value;\r | |
841 | }\r | |
842 | \r | |
843 | \r | |
844 | \r | |
845 | /**\r | |
0c3437e0 | 846 | Set up a notification function that is called when a specified token is set.\r |
847 | \r | |
e386b444 | 848 | When the token specified by TokenNumber and Guid is set, \r |
849 | then notification function specified by NotificationFunction is called. \r | |
850 | If Guid is NULL, then the default token space is used. \r | |
0c3437e0 | 851 | \r |
e386b444 | 852 | If NotificationFunction is NULL, then ASSERT().\r |
0c3437e0 | 853 | \r |
854 | @param[in] Guid Pointer to a 128-bit unique value that designates which \r | |
855 | namespace to set a value from. If NULL, then the default \r | |
856 | token space is used.\r | |
857 | @param[in] TokenNumber The PCD token number to monitor.\r | |
858 | @param[in] NotificationFunction The function to call when the token \r | |
859 | specified by Guid and TokenNumber is set.\r | |
e386b444 | 860 | \r |
e386b444 | 861 | **/\r |
862 | VOID\r | |
863 | EFIAPI\r | |
864 | LibPcdCallbackOnSet (\r | |
865 | IN CONST GUID *Guid, OPTIONAL\r | |
866 | IN UINTN TokenNumber,\r | |
867 | IN PCD_CALLBACK NotificationFunction\r | |
868 | )\r | |
869 | {\r | |
870 | EFI_STATUS Status;\r | |
e386b444 | 871 | \r |
a72bd1ec | 872 | Status = (GetPcdPpiPointer ())->CallbackOnSet (Guid, TokenNumber, NotificationFunction);\r |
e386b444 | 873 | \r |
874 | ASSERT_EFI_ERROR (Status);\r | |
875 | \r | |
876 | return;\r | |
877 | }\r | |
878 | \r | |
879 | \r | |
880 | \r | |
881 | /**\r | |
882 | Disable a notification function that was established with LibPcdCallbackonSet().\r | |
0c3437e0 | 883 | \r |
884 | Disable a notification function that was previously established with LibPcdCallbackOnSet(). \r | |
885 | \r | |
e386b444 | 886 | If NotificationFunction is NULL, then ASSERT().\r |
0c3437e0 | 887 | If LibPcdCallbackOnSet() was not previously called with Guid, TokenNumber, \r |
888 | and NotificationFunction, then ASSERT().\r | |
a72bd1ec | 889 | \r |
0c3437e0 | 890 | @param[in] Guid Specify the GUID token space.\r |
891 | @param[in] TokenNumber Specify the token number.\r | |
e386b444 | 892 | @param[in] NotificationFunction The callback function to be unregistered.\r |
893 | \r | |
e386b444 | 894 | **/\r |
895 | VOID\r | |
896 | EFIAPI\r | |
897 | LibPcdCancelCallback (\r | |
898 | IN CONST GUID *Guid, OPTIONAL\r | |
899 | IN UINTN TokenNumber,\r | |
900 | IN PCD_CALLBACK NotificationFunction\r | |
901 | )\r | |
902 | {\r | |
903 | EFI_STATUS Status;\r | |
e386b444 | 904 | \r |
a72bd1ec | 905 | Status = (GetPcdPpiPointer ())->CancelCallback (Guid, TokenNumber, NotificationFunction);\r |
e386b444 | 906 | \r |
907 | ASSERT_EFI_ERROR (Status);\r | |
908 | \r | |
909 | return;\r | |
910 | }\r | |
911 | \r | |
912 | \r | |
913 | \r | |
914 | /**\r | |
0c3437e0 | 915 | Retrieves the next token in a token space.\r |
916 | \r | |
e386b444 | 917 | Retrieves the next PCD token number from the token space specified by Guid. \r |
918 | If Guid is NULL, then the default token space is used. If TokenNumber is 0, \r | |
919 | then the first token number is returned. Otherwise, the token number that \r | |
920 | follows TokenNumber in the token space is returned. If TokenNumber is the last \r | |
0c3437e0 | 921 | token number in the token space, then 0 is returned. \r |
a72bd1ec | 922 | \r |
0c3437e0 | 923 | If TokenNumber is not 0 and is not in the token space specified by Guid, then ASSERT().\r |
924 | \r | |
925 | @param[in] Guid Pointer to a 128-bit unique value that designates which namespace \r | |
926 | to set a value from. If NULL, then the default token space is used.\r | |
927 | @param[in] TokenNumber The previous PCD token number. If 0, then retrieves the first PCD \r | |
928 | token number.\r | |
e386b444 | 929 | \r |
f73e0ad2 | 930 | @return The next valid token number.\r |
e386b444 | 931 | \r |
932 | **/\r | |
0c3437e0 | 933 | UINTN \r |
e386b444 | 934 | EFIAPI\r |
935 | LibPcdGetNextToken (\r | |
0c3437e0 | 936 | IN CONST GUID *Guid, OPTIONAL\r |
937 | IN UINTN TokenNumber\r | |
e386b444 | 938 | )\r |
939 | {\r | |
940 | EFI_STATUS Status;\r | |
e386b444 | 941 | \r |
a72bd1ec | 942 | Status = (GetPcdPpiPointer ())->GetNextToken (Guid, &TokenNumber);\r |
e386b444 | 943 | \r |
944 | ASSERT_EFI_ERROR (Status);\r | |
945 | \r | |
946 | return TokenNumber;\r | |
947 | }\r | |
948 | \r | |
949 | \r | |
950 | /**\r | |
64735d24 | 951 | Used to retrieve the list of available PCD token space GUIDs.\r |
952 | \r | |
e386b444 | 953 | Retrieves the next PCD token space from a token space specified by Guid.\r |
954 | Guid of NULL is reserved to mark the default local token namespace on the current\r | |
955 | platform. If Guid is NULL, then the GUID of the first non-local token space of the \r | |
956 | current platform is returned. If Guid is the last non-local token space, \r | |
957 | then NULL is returned. \r | |
0c3437e0 | 958 | \r |
e386b444 | 959 | If Guid is not NULL and is not a valid token space in the current platform, then ASSERT().\r |
960 | \r | |
961 | \r | |
962 | \r | |
63e4dba9 | 963 | @param[in] Guid Pointer to a 128-bit unique value that designates from which namespace \r |
964 | to start the search.\r | |
e386b444 | 965 | \r |
f73e0ad2 | 966 | @return The next valid token namespace.\r |
e386b444 | 967 | \r |
968 | **/\r | |
969 | GUID * \r | |
970 | EFIAPI\r | |
971 | LibPcdGetNextTokenSpace (\r | |
64735d24 | 972 | IN CONST GUID *TokenSpaceGuid\r |
e386b444 | 973 | )\r |
974 | {\r | |
975 | EFI_STATUS Status;\r | |
e386b444 | 976 | \r |
64735d24 | 977 | Status = (GetPcdPpiPointer ())->GetNextTokenSpace (&TokenSpaceGuid);\r |
e386b444 | 978 | \r |
979 | ASSERT_EFI_ERROR (Status);\r | |
980 | \r | |
64735d24 | 981 | return (GUID *) TokenSpaceGuid;\r |
e386b444 | 982 | }\r |
983 | \r | |
984 | \r | |
985 | \r | |
986 | /**\r | |
9638ba6d | 987 | Sets a value of a patchable PCD entry that is type pointer.\r |
988 | \r | |
e386b444 | 989 | Sets the PCD entry specified by PatchVariable to the value specified by Buffer \r |
a72bd1ec | 990 | and SizeOfBuffer. Buffer is returned. If SizeOfBuffer is greater than \r |
991 | MaximumDatumSize, then set SizeOfBuffer to MaximumDatumSize and return \r | |
e386b444 | 992 | NULL to indicate that the set operation was not actually performed. \r |
a72bd1ec | 993 | If SizeOfBuffer is set to MAX_ADDRESS, then SizeOfBuffer must be set to \r |
e386b444 | 994 | MaximumDatumSize and NULL must be returned.\r |
995 | \r | |
996 | If PatchVariable is NULL, then ASSERT().\r | |
a72bd1ec | 997 | If SizeOfBuffer is NULL, then ASSERT().\r |
998 | If SizeOfBuffer > 0 and Buffer is NULL, then ASSERT().\r | |
e386b444 | 999 | \r |
1000 | @param[in] PatchVariable A pointer to the global variable in a module that is \r | |
1001 | the target of the set operation.\r | |
1002 | @param[in] MaximumDatumSize The maximum size allowed for the PCD entry specified by PatchVariable.\r | |
1003 | @param[in, out] SizeOfBuffer A pointer to the size, in bytes, of Buffer.\r | |
1004 | @param[in] Buffer A pointer to the buffer to used to set the target variable.\r | |
f73e0ad2 | 1005 | \r |
9638ba6d | 1006 | @return Return the pointer to the buffer been set.\r |
e386b444 | 1007 | \r |
1008 | **/\r | |
1009 | VOID *\r | |
1010 | EFIAPI\r | |
1011 | LibPatchPcdSetPtr (\r | |
1012 | IN VOID *PatchVariable,\r | |
1013 | IN UINTN MaximumDatumSize,\r | |
1014 | IN OUT UINTN *SizeOfBuffer,\r | |
1015 | IN CONST VOID *Buffer\r | |
1016 | )\r | |
1017 | {\r | |
1018 | ASSERT (PatchVariable != NULL);\r | |
1019 | ASSERT (SizeOfBuffer != NULL);\r | |
1020 | \r | |
1021 | if (*SizeOfBuffer > 0) {\r | |
1022 | ASSERT (Buffer != NULL);\r | |
1023 | }\r | |
1024 | \r | |
1025 | if ((*SizeOfBuffer > MaximumDatumSize) ||\r | |
1026 | (*SizeOfBuffer == MAX_ADDRESS)) {\r | |
1027 | *SizeOfBuffer = MaximumDatumSize;\r | |
1028 | return NULL;\r | |
1029 | }\r | |
1030 | \r | |
1031 | CopyMem (PatchVariable, Buffer, *SizeOfBuffer);\r | |
1032 | \r | |
1033 | return (VOID *) Buffer;\r | |
1034 | }\r | |
1035 | \r | |
1036 | \r |