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