]>
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 | |
23 | @param[in] ImageHandle The firmware allocated handle for the EFI image. \r | |
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 | |
b16ef805 | 60 | mPcd->SetSku (SkuId);\r |
878ddf1f | 61 | \r |
62 | return SkuId;\r | |
63 | }\r | |
64 | \r | |
65 | \r | |
66 | \r | |
67 | /**\r | |
68 | Returns the 8-bit value for the token specified by TokenNumber. \r | |
69 | \r | |
70 | @param[in] The PCD token number to retrieve a current value for.\r | |
71 | \r | |
72 | @retval UINT8 Returns the 8-bit value for the token specified by TokenNumber. \r | |
73 | \r | |
74 | **/\r | |
75 | UINT8\r | |
76 | EFIAPI\r | |
77 | LibPcdGet8 (\r | |
8a43e8dd | 78 | IN UINTN TokenNumber\r |
878ddf1f | 79 | )\r |
80 | {\r | |
81 | return mPcd->Get8 (TokenNumber);\r | |
82 | }\r | |
83 | \r | |
84 | \r | |
85 | \r | |
86 | /**\r | |
87 | Returns the 16-bit value for the token specified by TokenNumber. \r | |
88 | \r | |
89 | @param[in] The PCD token number to retrieve a current value for.\r | |
90 | \r | |
91 | @retval UINT16 Returns the 16-bit value for the token specified by TokenNumber. \r | |
92 | \r | |
93 | **/\r | |
94 | UINT16\r | |
95 | EFIAPI\r | |
96 | LibPcdGet16 (\r | |
8a43e8dd | 97 | IN UINTN TokenNumber\r |
878ddf1f | 98 | )\r |
99 | {\r | |
100 | return mPcd->Get16 (TokenNumber);\r | |
101 | }\r | |
102 | \r | |
103 | \r | |
104 | \r | |
105 | /**\r | |
106 | Returns the 32-bit value for the token specified by TokenNumber. \r | |
107 | \r | |
108 | @param[in] TokenNumber The PCD token number to retrieve a current value for.\r | |
109 | \r | |
110 | @retval UINT32 Returns the 32-bit value for the token specified by TokenNumber.\r | |
111 | \r | |
112 | **/\r | |
113 | UINT32\r | |
114 | EFIAPI\r | |
115 | LibPcdGet32 (\r | |
8a43e8dd | 116 | IN UINTN TokenNumber\r |
878ddf1f | 117 | )\r |
118 | {\r | |
119 | return mPcd->Get32 (TokenNumber);\r | |
120 | }\r | |
121 | \r | |
122 | \r | |
123 | \r | |
124 | /**\r | |
125 | Returns the 64-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 | |
129 | @retval UINT64 Returns the 64-bit value for the token specified by TokenNumber.\r | |
130 | \r | |
131 | **/\r | |
132 | UINT64\r | |
133 | EFIAPI\r | |
134 | LibPcdGet64 (\r | |
8a43e8dd | 135 | IN UINTN TokenNumber\r |
878ddf1f | 136 | )\r |
137 | {\r | |
138 | return mPcd->Get64 (TokenNumber);\r | |
139 | }\r | |
140 | \r | |
141 | \r | |
142 | \r | |
143 | /**\r | |
144 | Returns the pointer to the buffer of the token specified by TokenNumber.\r | |
145 | \r | |
146 | @param[in] TokenNumber The PCD token number to retrieve a current value for.\r | |
147 | \r | |
148 | @retval VOID* Returns the pointer to the token specified by TokenNumber.\r | |
149 | \r | |
150 | **/\r | |
151 | VOID *\r | |
152 | EFIAPI\r | |
153 | LibPcdGetPtr (\r | |
8a43e8dd | 154 | IN UINTN TokenNumber\r |
878ddf1f | 155 | )\r |
156 | {\r | |
157 | return mPcd->GetPtr (TokenNumber);\r | |
158 | }\r | |
159 | \r | |
160 | \r | |
161 | \r | |
162 | /**\r | |
163 | Returns the Boolean value of the token specified by TokenNumber. \r | |
164 | \r | |
165 | @param[in] TokenNumber The PCD token number to retrieve a current value for.\r | |
166 | \r | |
167 | @retval BOOLEAN Returns the Boolean value of the token specified by TokenNumber. \r | |
168 | \r | |
169 | **/\r | |
170 | BOOLEAN \r | |
171 | EFIAPI\r | |
172 | LibPcdGetBool (\r | |
8a43e8dd | 173 | IN UINTN TokenNumber\r |
878ddf1f | 174 | )\r |
175 | {\r | |
176 | return mPcd->GetBool (TokenNumber);\r | |
177 | }\r | |
178 | \r | |
179 | \r | |
180 | \r | |
181 | /**\r | |
182 | Returns the size of the token specified by TokenNumber. \r | |
183 | \r | |
184 | @param[in] TokenNumber The PCD token number to retrieve a current value for.\r | |
185 | \r | |
186 | @retval UINTN Returns the size of the token specified by TokenNumber. \r | |
187 | \r | |
188 | **/\r | |
189 | UINTN\r | |
190 | EFIAPI\r | |
191 | LibPcdGetSize (\r | |
8a43e8dd | 192 | IN UINTN TokenNumber\r |
878ddf1f | 193 | )\r |
194 | {\r | |
195 | return mPcd->GetSize (TokenNumber);\r | |
196 | }\r | |
197 | \r | |
198 | \r | |
199 | \r | |
200 | /**\r | |
201 | Returns the 8-bit value for the token specified by TokenNumber and Guid.\r | |
202 | If Guid is NULL, then ASSERT(). \r | |
203 | \r | |
204 | @param[in] Guid Pointer to a 128-bit unique value that designates \r | |
205 | which namespace to retrieve a value from.\r | |
206 | @param[in] TokenNumber The PCD token number to retrieve a current value for.\r | |
207 | \r | |
208 | @retval UINT8 Return the UINT8.\r | |
209 | \r | |
210 | **/\r | |
211 | UINT8\r | |
212 | EFIAPI\r | |
213 | LibPcdGetEx8 (\r | |
214 | IN CONST GUID *Guid,\r | |
8a43e8dd | 215 | IN UINTN TokenNumber\r |
878ddf1f | 216 | )\r |
217 | {\r | |
218 | ASSERT (Guid != NULL);\r | |
219 | \r | |
220 | return mPcd->Get8Ex (Guid, TokenNumber);\r | |
221 | }\r | |
222 | \r | |
223 | \r | |
224 | /**\r | |
225 | Returns the 16-bit value for the token specified by TokenNumber and Guid.\r | |
226 | If Guid is NULL, then ASSERT(). \r | |
227 | \r | |
228 | @param[in] Guid Pointer to a 128-bit unique value that designates \r | |
229 | which namespace to retrieve a value from.\r | |
230 | @param[in] TokenNumber The PCD token number to retrieve a current value for.\r | |
231 | \r | |
232 | @retval UINT16 Return the UINT16.\r | |
233 | \r | |
234 | **/\r | |
235 | UINT16\r | |
236 | EFIAPI\r | |
237 | LibPcdGetEx16 (\r | |
238 | IN CONST GUID *Guid,\r | |
8a43e8dd | 239 | IN UINTN TokenNumber\r |
878ddf1f | 240 | )\r |
241 | {\r | |
242 | ASSERT (Guid != NULL);\r | |
243 | \r | |
244 | return mPcd->Get16Ex (Guid, TokenNumber);\r | |
245 | }\r | |
246 | \r | |
247 | \r | |
248 | /**\r | |
249 | Returns the 32-bit value for the token specified by TokenNumber and Guid.\r | |
250 | If Guid is NULL, then ASSERT(). \r | |
251 | \r | |
252 | @param[in] Guid Pointer to a 128-bit unique value that designates \r | |
253 | which namespace to retrieve a value from.\r | |
254 | @param[in] TokenNumber The PCD token number to retrieve a current value for.\r | |
255 | \r | |
256 | @retval UINT32 Return the UINT32.\r | |
257 | \r | |
258 | **/\r | |
259 | UINT32\r | |
260 | EFIAPI\r | |
261 | LibPcdGetEx32 (\r | |
262 | IN CONST GUID *Guid,\r | |
8a43e8dd | 263 | IN UINTN TokenNumber\r |
878ddf1f | 264 | )\r |
265 | {\r | |
266 | ASSERT (Guid != NULL);\r | |
267 | \r | |
268 | return mPcd->Get32Ex (Guid, TokenNumber);\r | |
269 | }\r | |
270 | \r | |
271 | \r | |
272 | \r | |
273 | /**\r | |
274 | Returns the 64-bit value for the token specified by TokenNumber and Guid.\r | |
275 | If Guid is NULL, then ASSERT(). \r | |
276 | \r | |
277 | @param[in] Guid Pointer to a 128-bit unique value that designates \r | |
278 | which namespace to retrieve a value from.\r | |
279 | @param[in] TokenNumber The PCD token number to retrieve a current value for.\r | |
280 | \r | |
281 | @retval UINT64 Return the UINT64.\r | |
282 | \r | |
283 | **/\r | |
284 | UINT64\r | |
285 | EFIAPI\r | |
286 | LibPcdGetEx64 (\r | |
287 | IN CONST GUID *Guid,\r | |
8a43e8dd | 288 | IN UINTN TokenNumber\r |
878ddf1f | 289 | )\r |
290 | {\r | |
291 | ASSERT (Guid != NULL);\r | |
292 | \r | |
293 | return mPcd->Get64Ex (Guid, TokenNumber);\r | |
294 | }\r | |
295 | \r | |
296 | \r | |
297 | \r | |
298 | /**\r | |
299 | Returns the pointer to the token specified by TokenNumber and Guid.\r | |
300 | If Guid is NULL, then ASSERT(). \r | |
301 | \r | |
302 | @param[in] Guid Pointer to a 128-bit unique value that designates \r | |
303 | which namespace to retrieve a value from.\r | |
304 | @param[in] TokenNumber The PCD token number to retrieve a current value for.\r | |
305 | \r | |
306 | @retval VOID* Return the VOID* pointer.\r | |
307 | \r | |
308 | **/\r | |
309 | VOID *\r | |
310 | EFIAPI\r | |
311 | LibPcdGetExPtr (\r | |
312 | IN CONST GUID *Guid,\r | |
8a43e8dd | 313 | IN UINTN TokenNumber\r |
878ddf1f | 314 | )\r |
315 | {\r | |
316 | ASSERT (Guid != NULL);\r | |
317 | \r | |
318 | return mPcd->GetPtrEx (Guid, TokenNumber);\r | |
319 | }\r | |
320 | \r | |
321 | \r | |
322 | \r | |
323 | /**\r | |
324 | Returns the Boolean value of the token specified by TokenNumber and Guid. \r | |
325 | If Guid is NULL, then ASSERT(). \r | |
326 | \r | |
327 | @param[in] Guid Pointer to a 128-bit unique value that designates \r | |
328 | which namespace to retrieve a value from.\r | |
329 | @param[in] TokenNumber The PCD token number to retrieve a current value for.\r | |
330 | \r | |
331 | @retval BOOLEAN Return the BOOLEAN.\r | |
332 | \r | |
333 | **/\r | |
334 | BOOLEAN\r | |
335 | EFIAPI\r | |
336 | LibPcdGetExBool (\r | |
337 | IN CONST GUID *Guid,\r | |
8a43e8dd | 338 | IN UINTN TokenNumber\r |
878ddf1f | 339 | )\r |
340 | {\r | |
341 | ASSERT (Guid != NULL);\r | |
342 | \r | |
343 | return mPcd->GetBoolEx (Guid, TokenNumber);\r | |
344 | }\r | |
345 | \r | |
346 | \r | |
347 | \r | |
348 | /**\r | |
349 | Returns the size of the token specified by TokenNumber and Guid. \r | |
350 | If Guid is NULL, then ASSERT(). \r | |
351 | \r | |
352 | @param[in] Guid Pointer to a 128-bit unique value that designates \r | |
353 | which namespace to retrieve a value from.\r | |
354 | @param[in] TokenNumber The PCD token number to retrieve a current value for.\r | |
355 | \r | |
356 | @retval UINTN Return the size.\r | |
357 | \r | |
358 | **/\r | |
359 | UINTN\r | |
360 | EFIAPI\r | |
361 | LibPcdGetExSize (\r | |
362 | IN CONST GUID *Guid,\r | |
8a43e8dd | 363 | IN UINTN TokenNumber\r |
878ddf1f | 364 | )\r |
365 | {\r | |
366 | ASSERT (Guid != NULL);\r | |
367 | \r | |
368 | return mPcd->GetSizeEx (Guid, TokenNumber);\r | |
369 | }\r | |
370 | \r | |
371 | \r | |
372 | \r | |
373 | /**\r | |
374 | Sets the 8-bit value for the token specified by TokenNumber \r | |
375 | to the value specified by Value. Value is returned.\r | |
376 | \r | |
377 | @param[in] TokenNumber The PCD token number to set a current value for.\r | |
378 | @param[in] Value The 8-bit value to set.\r | |
379 | \r | |
380 | @retval UINT8 Return the value been set.\r | |
381 | \r | |
382 | **/\r | |
383 | UINT8\r | |
384 | EFIAPI\r | |
385 | LibPcdSet8 (\r | |
8a43e8dd | 386 | IN UINTN TokenNumber,\r |
878ddf1f | 387 | IN UINT8 Value\r |
388 | )\r | |
389 | {\r | |
390 | EFI_STATUS Status;\r | |
391 | \r | |
392 | Status = mPcd->Set8 (TokenNumber, Value);\r | |
393 | \r | |
394 | ASSERT_EFI_ERROR (Status);\r | |
395 | \r | |
396 | return Value;\r | |
397 | }\r | |
398 | \r | |
399 | \r | |
400 | \r | |
401 | /**\r | |
402 | Sets the 16-bit value for the token specified by TokenNumber \r | |
403 | to the value specified by Value. Value is returned.\r | |
404 | \r | |
405 | @param[in] TokenNumber The PCD token number to set a current value for.\r | |
406 | @param[in] Value The 16-bit value to set.\r | |
407 | \r | |
408 | @retval UINT16 Return the value been set.\r | |
409 | \r | |
410 | **/\r | |
411 | UINT16\r | |
412 | EFIAPI\r | |
413 | LibPcdSet16 (\r | |
8a43e8dd | 414 | IN UINTN TokenNumber,\r |
878ddf1f | 415 | IN UINT16 Value\r |
416 | )\r | |
417 | {\r | |
418 | EFI_STATUS Status;\r | |
419 | \r | |
420 | Status = mPcd->Set16 (TokenNumber, Value);\r | |
421 | \r | |
422 | ASSERT_EFI_ERROR (Status);\r | |
423 | \r | |
424 | return Value;\r | |
425 | }\r | |
426 | \r | |
427 | \r | |
428 | \r | |
429 | /**\r | |
430 | Sets the 32-bit value for the token specified by TokenNumber \r | |
431 | to the value specified by Value. Value is returned.\r | |
432 | \r | |
433 | @param[in] TokenNumber The PCD token number to set a current value for.\r | |
434 | @param[in] Value The 32-bit value to set.\r | |
435 | \r | |
436 | @retval UINT32 Return the value been set.\r | |
437 | \r | |
438 | **/\r | |
439 | UINT32\r | |
440 | EFIAPI\r | |
441 | LibPcdSet32 (\r | |
8a43e8dd | 442 | IN UINTN TokenNumber,\r |
878ddf1f | 443 | IN UINT32 Value\r |
444 | )\r | |
445 | {\r | |
446 | EFI_STATUS Status;\r | |
447 | Status = mPcd->Set32 (TokenNumber, Value);\r | |
448 | \r | |
449 | ASSERT_EFI_ERROR (Status);\r | |
450 | \r | |
451 | return Value;\r | |
452 | }\r | |
453 | \r | |
454 | \r | |
455 | \r | |
456 | /**\r | |
457 | Sets the 64-bit value for the token specified by TokenNumber \r | |
458 | to the value specified by Value. Value is returned.\r | |
459 | \r | |
460 | @param[in] TokenNumber The PCD token number to set a current value for.\r | |
461 | @param[in] Value The 64-bit value to set.\r | |
462 | \r | |
463 | @retval UINT64 Return the value been set.\r | |
464 | \r | |
465 | **/\r | |
466 | UINT64\r | |
467 | EFIAPI\r | |
468 | LibPcdSet64 (\r | |
8a43e8dd | 469 | IN UINTN TokenNumber,\r |
878ddf1f | 470 | IN UINT64 Value\r |
471 | )\r | |
472 | {\r | |
473 | EFI_STATUS Status;\r | |
474 | \r | |
475 | Status = mPcd->Set64 (TokenNumber, Value);\r | |
476 | \r | |
477 | ASSERT_EFI_ERROR (Status);\r | |
478 | \r | |
479 | return Value;\r | |
480 | }\r | |
481 | \r | |
482 | \r | |
483 | \r | |
484 | /**\r | |
485 | Sets a buffer for the token specified by TokenNumber to \r | |
486 | the value specified by Value. Value is returned.\r | |
487 | If Value is NULL, then ASSERT().\r | |
488 | \r | |
489 | @param[in] TokenNumber The PCD token number to set a current value for.\r | |
490 | @param[in] Value A pointer to the buffer to set.\r | |
491 | \r | |
492 | @retval VOID* Return the pointer for the buffer been set.\r | |
493 | \r | |
494 | **/\r | |
495 | VOID *\r | |
496 | EFIAPI\r | |
497 | LibPcdSetPtr (\r | |
8a43e8dd | 498 | IN UINTN TokenNumber,\r |
b16ef805 | 499 | IN UINTN SizeOfBuffer,\r |
500 | IN VOID *Buffer\r | |
878ddf1f | 501 | )\r |
502 | {\r | |
503 | EFI_STATUS Status;\r | |
504 | \r | |
b16ef805 | 505 | ASSERT (Buffer != NULL);\r |
878ddf1f | 506 | \r |
b16ef805 | 507 | Status = mPcd->SetPtr (TokenNumber, SizeOfBuffer, Buffer);\r |
878ddf1f | 508 | \r |
509 | ASSERT_EFI_ERROR (Status);\r | |
510 | \r | |
b16ef805 | 511 | return Buffer;\r |
878ddf1f | 512 | }\r |
513 | \r | |
514 | \r | |
515 | \r | |
516 | /**\r | |
517 | Sets the Boolean value for the token specified by TokenNumber \r | |
518 | to the value specified by Value. Value is returned.\r | |
519 | \r | |
520 | @param[in] TokenNumber The PCD token number to set a current value for.\r | |
521 | @param[in] Value The boolean value to set.\r | |
522 | \r | |
523 | @retval BOOLEAN Return the value been set.\r | |
524 | \r | |
525 | **/\r | |
526 | BOOLEAN\r | |
527 | EFIAPI\r | |
528 | LibPcdSetBool (\r | |
8a43e8dd | 529 | IN UINTN TokenNumber,\r |
878ddf1f | 530 | IN BOOLEAN Value\r |
531 | )\r | |
532 | {\r | |
533 | EFI_STATUS Status;\r | |
534 | \r | |
535 | Status = mPcd->SetBool (TokenNumber, Value);\r | |
536 | \r | |
537 | ASSERT_EFI_ERROR (Status);\r | |
538 | \r | |
539 | return Value;\r | |
540 | }\r | |
541 | \r | |
542 | \r | |
543 | \r | |
544 | /**\r | |
545 | Sets the 8-bit value for the token specified by TokenNumber and \r | |
546 | Guid to the value specified by Value. Value is returned.\r | |
547 | If Guid is NULL, then ASSERT().\r | |
548 | \r | |
549 | @param[in] Guid Pointer to a 128-bit unique value that \r | |
550 | designates which namespace to set a value from.\r | |
551 | @param[in] TokenNumber The PCD token number to set a current value for.\r | |
552 | @param[in] Value The 8-bit value to set.\r | |
553 | \r | |
554 | @retval UINT8 Return the value been set.\r | |
555 | \r | |
556 | **/\r | |
557 | UINT8\r | |
558 | EFIAPI\r | |
559 | LibPcdSetEx8 (\r | |
560 | IN CONST GUID *Guid,\r | |
8a43e8dd | 561 | IN UINTN TokenNumber,\r |
878ddf1f | 562 | IN UINT8 Value\r |
563 | )\r | |
564 | {\r | |
565 | EFI_STATUS Status;\r | |
566 | \r | |
567 | ASSERT (Guid != NULL);\r | |
568 | \r | |
569 | Status = mPcd->Set8Ex (Guid, TokenNumber, Value);\r | |
570 | \r | |
571 | ASSERT_EFI_ERROR (Status);\r | |
572 | \r | |
573 | return Value;\r | |
574 | }\r | |
575 | \r | |
576 | \r | |
577 | \r | |
578 | /**\r | |
579 | Sets the 16-bit value for the token specified by TokenNumber and \r | |
580 | Guid to the value specified by Value. Value is returned.\r | |
581 | If Guid is NULL, then ASSERT().\r | |
582 | \r | |
583 | @param[in] Guid Pointer to a 128-bit unique value that \r | |
584 | designates which namespace to set a value from.\r | |
585 | @param[in] TokenNumber The PCD token number to set a current value for.\r | |
586 | @param[in] Value The 16-bit value to set.\r | |
587 | \r | |
588 | @retval UINT8 Return the value been set.\r | |
589 | \r | |
590 | **/\r | |
591 | UINT16\r | |
592 | EFIAPI\r | |
593 | LibPcdSetEx16 (\r | |
594 | IN CONST GUID *Guid,\r | |
8a43e8dd | 595 | IN UINTN TokenNumber,\r |
878ddf1f | 596 | IN UINT16 Value\r |
597 | )\r | |
598 | {\r | |
599 | EFI_STATUS Status;\r | |
600 | \r | |
601 | ASSERT (Guid != NULL);\r | |
602 | \r | |
603 | Status = mPcd->Set16Ex (Guid, TokenNumber, Value);\r | |
604 | \r | |
605 | ASSERT_EFI_ERROR (Status);\r | |
606 | \r | |
607 | return Value;\r | |
608 | }\r | |
609 | \r | |
610 | \r | |
611 | \r | |
612 | /**\r | |
613 | Sets the 32-bit value for the token specified by TokenNumber and \r | |
614 | Guid to the value specified by Value. Value is returned.\r | |
615 | If Guid is NULL, then ASSERT().\r | |
616 | \r | |
617 | @param[in] Guid Pointer to a 128-bit unique value that \r | |
618 | designates which namespace to set a value from.\r | |
619 | @param[in] TokenNumber The PCD token number to set a current value for.\r | |
620 | @param[in] Value The 32-bit value to set.\r | |
621 | \r | |
622 | @retval UINT32 Return the value been set.\r | |
623 | \r | |
624 | **/\r | |
625 | UINT32\r | |
626 | EFIAPI\r | |
627 | LibPcdSetEx32 (\r | |
628 | IN CONST GUID *Guid,\r | |
8a43e8dd | 629 | IN UINTN TokenNumber,\r |
878ddf1f | 630 | IN UINT32 Value\r |
631 | )\r | |
632 | {\r | |
633 | EFI_STATUS Status;\r | |
634 | \r | |
635 | ASSERT (Guid != NULL);\r | |
636 | \r | |
637 | Status = mPcd->Set32Ex (Guid, TokenNumber, Value);\r | |
638 | \r | |
639 | ASSERT_EFI_ERROR (Status);\r | |
640 | \r | |
641 | return Value;\r | |
642 | }\r | |
643 | \r | |
644 | \r | |
645 | \r | |
646 | /**\r | |
647 | Sets the 64-bit value for the token specified by TokenNumber and \r | |
648 | Guid to the value specified by Value. Value is returned.\r | |
649 | If Guid is NULL, then ASSERT().\r | |
650 | \r | |
651 | @param[in] Guid Pointer to a 128-bit unique value that \r | |
652 | designates which namespace to set a value from.\r | |
653 | @param[in] TokenNumber The PCD token number to set a current value for.\r | |
654 | @param[in] Value The 64-bit value to set.\r | |
655 | \r | |
656 | @retval UINT64 Return the value been set.\r | |
657 | \r | |
658 | **/\r | |
659 | UINT64\r | |
660 | EFIAPI\r | |
661 | LibPcdSetEx64 (\r | |
662 | IN CONST GUID *Guid,\r | |
8a43e8dd | 663 | IN UINTN TokenNumber,\r |
878ddf1f | 664 | IN UINT64 Value\r |
665 | )\r | |
666 | {\r | |
667 | EFI_STATUS Status;\r | |
668 | \r | |
669 | ASSERT (Guid != NULL);\r | |
670 | \r | |
671 | Status = mPcd->Set64Ex (Guid, TokenNumber, Value);\r | |
672 | \r | |
673 | ASSERT_EFI_ERROR (Status);\r | |
674 | \r | |
675 | return Value;\r | |
676 | }\r | |
677 | \r | |
678 | \r | |
679 | \r | |
680 | /**\r | |
681 | Sets a buffer for the token specified by TokenNumber and \r | |
682 | Guid to the value specified by Value. Value is returned.\r | |
683 | If Guid is NULL, then ASSERT().\r | |
684 | If Value is NULL, then ASSERT().\r | |
685 | \r | |
686 | @param[in] Guid Pointer to a 128-bit unique value that \r | |
687 | designates which namespace to set a value from.\r | |
688 | @param[in] TokenNumber The PCD token number to set a current value for.\r | |
689 | @param[in] Value The 8-bit value to set.\r | |
690 | \r | |
691 | @retval VOID * Return the value been set.\r | |
692 | \r | |
693 | **/\r | |
694 | VOID *\r | |
695 | EFIAPI\r | |
696 | LibPcdSetExPtr (\r | |
697 | IN CONST GUID *Guid,\r | |
8a43e8dd | 698 | IN UINTN TokenNumber,\r |
b16ef805 | 699 | IN UINTN SizeOfBuffer,\r |
700 | IN VOID *Buffer\r | |
878ddf1f | 701 | )\r |
702 | {\r | |
703 | EFI_STATUS Status;\r | |
704 | \r | |
705 | ASSERT (Guid != NULL);\r | |
b16ef805 | 706 | ASSERT (Buffer != NULL);\r |
878ddf1f | 707 | \r |
b16ef805 | 708 | Status = mPcd->SetPtrEx (Guid, TokenNumber, SizeOfBuffer, Buffer);\r |
878ddf1f | 709 | \r |
710 | ASSERT_EFI_ERROR (Status);\r | |
711 | \r | |
b16ef805 | 712 | return Buffer;\r |
878ddf1f | 713 | }\r |
714 | \r | |
715 | \r | |
716 | \r | |
717 | /**\r | |
718 | Sets the Boolean value for the token specified by TokenNumber and \r | |
719 | Guid to the value specified by Value. Value is returned.\r | |
720 | If Guid is NULL, then ASSERT().\r | |
721 | \r | |
722 | @param[in] Guid Pointer to a 128-bit unique value that \r | |
723 | designates which namespace to set a value from.\r | |
724 | @param[in] TokenNumber The PCD token number to set a current value for.\r | |
725 | @param[in] Value The Boolean value to set.\r | |
726 | \r | |
727 | @retval Boolean Return the value been set.\r | |
728 | \r | |
729 | **/\r | |
730 | BOOLEAN\r | |
731 | EFIAPI\r | |
732 | LibPcdSetExBool (\r | |
733 | IN CONST GUID *Guid,\r | |
8a43e8dd | 734 | IN UINTN TokenNumber,\r |
878ddf1f | 735 | IN BOOLEAN Value\r |
736 | )\r | |
737 | {\r | |
738 | EFI_STATUS Status;\r | |
739 | \r | |
740 | ASSERT (Guid != NULL);\r | |
741 | \r | |
742 | Status = mPcd->SetBoolEx (Guid, TokenNumber, Value);\r | |
743 | \r | |
744 | ASSERT_EFI_ERROR (Status);\r | |
745 | \r | |
746 | return Value;\r | |
747 | }\r | |
748 | \r | |
749 | \r | |
750 | \r | |
751 | /**\r | |
752 | When the token specified by TokenNumber and Guid is set, \r | |
753 | then notification function specified by NotificationFunction is called. \r | |
754 | If Guid is NULL, then the default token space is used. \r | |
755 | If NotificationFunction is NULL, then ASSERT().\r | |
756 | \r | |
757 | @param[in] Guid Pointer to a 128-bit unique value that designates which \r | |
758 | namespace to set a value from. If NULL, then the default \r | |
759 | token space is used.\r | |
760 | @param[in] TokenNumber The PCD token number to monitor.\r | |
761 | @param[in] NotificationFunction The function to call when the token \r | |
762 | specified by Guid and TokenNumber is set.\r | |
763 | \r | |
764 | @retval VOID\r | |
765 | \r | |
766 | **/\r | |
767 | VOID\r | |
768 | EFIAPI\r | |
769 | LibPcdCallbackOnSet (\r | |
770 | IN CONST GUID *Guid, OPTIONAL\r | |
8a43e8dd | 771 | IN UINTN TokenNumber,\r |
878ddf1f | 772 | IN PCD_CALLBACK NotificationFunction\r |
773 | )\r | |
774 | {\r | |
775 | EFI_STATUS Status;\r | |
776 | \r | |
777 | ASSERT (NotificationFunction != NULL);\r | |
778 | \r | |
779 | Status = mPcd->CallbackOnSet (TokenNumber, Guid, NotificationFunction);\r | |
780 | \r | |
781 | ASSERT_EFI_ERROR (Status);\r | |
782 | \r | |
783 | return;\r | |
784 | }\r | |
785 | \r | |
786 | \r | |
787 | \r | |
788 | /**\r | |
789 | Disable a notification function that was established with LibPcdCallbackonSet().\r | |
790 | If NotificationFunction is NULL, then ASSERT().\r | |
791 | \r | |
792 | @param[in] Guid Specify the GUID token space.\r | |
793 | @param[in] TokenNumber Specify the token number.\r | |
794 | @param[in] NotificationFunction The callback function to be unregistered.\r | |
795 | \r | |
796 | @retval VOID\r | |
797 | \r | |
798 | **/\r | |
799 | VOID\r | |
800 | EFIAPI\r | |
801 | LibPcdCancelCallback (\r | |
802 | IN CONST GUID *Guid, OPTIONAL\r | |
8a43e8dd | 803 | IN UINTN TokenNumber,\r |
878ddf1f | 804 | IN PCD_CALLBACK NotificationFunction\r |
805 | )\r | |
806 | {\r | |
807 | EFI_STATUS Status;\r | |
808 | \r | |
809 | ASSERT (NotificationFunction != NULL);\r | |
810 | \r | |
811 | Status = mPcd->CancelCallback (TokenNumber, Guid, NotificationFunction);\r | |
812 | \r | |
813 | ASSERT_EFI_ERROR (Status);\r | |
814 | \r | |
815 | return;\r | |
816 | }\r | |
817 | \r | |
818 | \r | |
819 | \r | |
820 | /**\r | |
821 | Retrieves the next PCD token number from the token space specified by Guid. \r | |
822 | If Guid is NULL, then the default token space is used. If TokenNumber is 0, \r | |
823 | then the first token number is returned. Otherwise, the token number that \r | |
824 | follows TokenNumber in the token space is returned. If TokenNumber is the last \r | |
825 | token number in the token space, then 0 is returned. If TokenNumber is not 0 and \r | |
826 | is not in the token space specified by Guid, then ASSERT().\r | |
827 | \r | |
828 | @param[in] Pointer to a 128-bit unique value that designates which namespace \r | |
829 | to set a value from. If NULL, then the default token space is used.\r | |
830 | @param[in] The previous PCD token number. If 0, then retrieves the first PCD \r | |
831 | token number.\r | |
832 | \r | |
8a43e8dd | 833 | @retval UINTN The next valid token number.\r |
878ddf1f | 834 | \r |
835 | **/\r | |
8a43e8dd | 836 | UINTN \r |
878ddf1f | 837 | EFIAPI\r |
838 | LibPcdGetNextToken (\r | |
839 | IN CONST GUID *Guid, OPTIONAL\r | |
8a43e8dd | 840 | IN UINTN TokenNumber\r |
878ddf1f | 841 | )\r |
842 | {\r | |
843 | EFI_STATUS Status;\r | |
844 | \r | |
b16ef805 | 845 | Status = mPcd->GetNextToken (Guid, &TokenNumber);\r |
878ddf1f | 846 | \r |
847 | ASSERT_EFI_ERROR (Status);\r | |
848 | \r | |
b16ef805 | 849 | return TokenNumber;\r |
878ddf1f | 850 | }\r |
851 | \r |