]>
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 | |
4276d5da | 517 | UINTN Size;\r |
3534cbb7 | 518 | \r |
519 | if (*SizeOfBuffer > 0) {\r | |
520 | ASSERT (Buffer != NULL);\r | |
521 | }\r | |
878ddf1f | 522 | \r |
4276d5da | 523 | Size = LibPcdGetSize (TokenNumber);\r |
524 | \r | |
525 | if (*SizeOfBuffer > Size) {\r | |
526 | *SizeOfBuffer = Size;\r | |
527 | return NULL;\r | |
528 | }\r | |
529 | \r | |
530 | Status = mPcd->SetPtr (TokenNumber, *SizeOfBuffer, Buffer);\r | |
878ddf1f | 531 | \r |
532 | ASSERT_EFI_ERROR (Status);\r | |
533 | \r | |
b16ef805 | 534 | return Buffer;\r |
878ddf1f | 535 | }\r |
536 | \r | |
537 | \r | |
538 | \r | |
539 | /**\r | |
540 | Sets the Boolean value for the token specified by TokenNumber \r | |
541 | to the value specified by Value. Value is returned.\r | |
542 | \r | |
543 | @param[in] TokenNumber The PCD token number to set a current value for.\r | |
544 | @param[in] Value The boolean value to set.\r | |
545 | \r | |
546 | @retval BOOLEAN Return the value been set.\r | |
547 | \r | |
548 | **/\r | |
549 | BOOLEAN\r | |
550 | EFIAPI\r | |
551 | LibPcdSetBool (\r | |
8a43e8dd | 552 | IN UINTN TokenNumber,\r |
878ddf1f | 553 | IN BOOLEAN Value\r |
554 | )\r | |
555 | {\r | |
556 | EFI_STATUS Status;\r | |
557 | \r | |
558 | Status = mPcd->SetBool (TokenNumber, Value);\r | |
559 | \r | |
560 | ASSERT_EFI_ERROR (Status);\r | |
561 | \r | |
562 | return Value;\r | |
563 | }\r | |
564 | \r | |
565 | \r | |
566 | \r | |
567 | /**\r | |
568 | Sets the 8-bit value for the token specified by TokenNumber and \r | |
569 | Guid to the value specified by Value. Value is returned.\r | |
570 | If Guid is NULL, then ASSERT().\r | |
571 | \r | |
572 | @param[in] Guid Pointer to a 128-bit unique value that \r | |
573 | designates which namespace to set a value from.\r | |
574 | @param[in] TokenNumber The PCD token number to set a current value for.\r | |
575 | @param[in] Value The 8-bit value to set.\r | |
576 | \r | |
577 | @retval UINT8 Return the value been set.\r | |
578 | \r | |
579 | **/\r | |
580 | UINT8\r | |
581 | EFIAPI\r | |
582 | LibPcdSetEx8 (\r | |
583 | IN CONST GUID *Guid,\r | |
8a43e8dd | 584 | IN UINTN TokenNumber,\r |
878ddf1f | 585 | IN UINT8 Value\r |
586 | )\r | |
587 | {\r | |
588 | EFI_STATUS Status;\r | |
589 | \r | |
590 | ASSERT (Guid != NULL);\r | |
591 | \r | |
592 | Status = mPcd->Set8Ex (Guid, TokenNumber, Value);\r | |
593 | \r | |
594 | ASSERT_EFI_ERROR (Status);\r | |
595 | \r | |
596 | return Value;\r | |
597 | }\r | |
598 | \r | |
599 | \r | |
600 | \r | |
601 | /**\r | |
602 | Sets the 16-bit value for the token specified by TokenNumber and \r | |
603 | Guid to the value specified by Value. Value is returned.\r | |
604 | If Guid is NULL, then ASSERT().\r | |
605 | \r | |
606 | @param[in] Guid Pointer to a 128-bit unique value that \r | |
607 | designates which namespace to set a value from.\r | |
608 | @param[in] TokenNumber The PCD token number to set a current value for.\r | |
609 | @param[in] Value The 16-bit value to set.\r | |
610 | \r | |
611 | @retval UINT8 Return the value been set.\r | |
612 | \r | |
613 | **/\r | |
614 | UINT16\r | |
615 | EFIAPI\r | |
616 | LibPcdSetEx16 (\r | |
617 | IN CONST GUID *Guid,\r | |
8a43e8dd | 618 | IN UINTN TokenNumber,\r |
878ddf1f | 619 | IN UINT16 Value\r |
620 | )\r | |
621 | {\r | |
622 | EFI_STATUS Status;\r | |
623 | \r | |
624 | ASSERT (Guid != NULL);\r | |
625 | \r | |
626 | Status = mPcd->Set16Ex (Guid, TokenNumber, Value);\r | |
627 | \r | |
628 | ASSERT_EFI_ERROR (Status);\r | |
629 | \r | |
630 | return Value;\r | |
631 | }\r | |
632 | \r | |
633 | \r | |
634 | \r | |
635 | /**\r | |
636 | Sets the 32-bit value for the token specified by TokenNumber and \r | |
637 | Guid to the value specified by Value. Value is returned.\r | |
638 | If Guid is NULL, then ASSERT().\r | |
639 | \r | |
640 | @param[in] Guid Pointer to a 128-bit unique value that \r | |
641 | designates which namespace to set a value from.\r | |
642 | @param[in] TokenNumber The PCD token number to set a current value for.\r | |
643 | @param[in] Value The 32-bit value to set.\r | |
644 | \r | |
645 | @retval UINT32 Return the value been set.\r | |
646 | \r | |
647 | **/\r | |
648 | UINT32\r | |
649 | EFIAPI\r | |
650 | LibPcdSetEx32 (\r | |
651 | IN CONST GUID *Guid,\r | |
8a43e8dd | 652 | IN UINTN TokenNumber,\r |
878ddf1f | 653 | IN UINT32 Value\r |
654 | )\r | |
655 | {\r | |
656 | EFI_STATUS Status;\r | |
657 | \r | |
658 | ASSERT (Guid != NULL);\r | |
659 | \r | |
660 | Status = mPcd->Set32Ex (Guid, TokenNumber, Value);\r | |
661 | \r | |
662 | ASSERT_EFI_ERROR (Status);\r | |
663 | \r | |
664 | return Value;\r | |
665 | }\r | |
666 | \r | |
667 | \r | |
668 | \r | |
669 | /**\r | |
670 | Sets the 64-bit value for the token specified by TokenNumber and \r | |
671 | Guid to the value specified by Value. Value is returned.\r | |
672 | If Guid is NULL, then ASSERT().\r | |
673 | \r | |
674 | @param[in] Guid Pointer to a 128-bit unique value that \r | |
675 | designates which namespace to set a value from.\r | |
676 | @param[in] TokenNumber The PCD token number to set a current value for.\r | |
677 | @param[in] Value The 64-bit value to set.\r | |
678 | \r | |
679 | @retval UINT64 Return the value been set.\r | |
680 | \r | |
681 | **/\r | |
682 | UINT64\r | |
683 | EFIAPI\r | |
684 | LibPcdSetEx64 (\r | |
685 | IN CONST GUID *Guid,\r | |
8a43e8dd | 686 | IN UINTN TokenNumber,\r |
878ddf1f | 687 | IN UINT64 Value\r |
688 | )\r | |
689 | {\r | |
690 | EFI_STATUS Status;\r | |
691 | \r | |
692 | ASSERT (Guid != NULL);\r | |
693 | \r | |
694 | Status = mPcd->Set64Ex (Guid, TokenNumber, Value);\r | |
695 | \r | |
696 | ASSERT_EFI_ERROR (Status);\r | |
697 | \r | |
698 | return Value;\r | |
699 | }\r | |
700 | \r | |
701 | \r | |
702 | \r | |
703 | /**\r | |
4276d5da | 704 | Sets a buffer for the token specified by TokenNumber to the value specified by \r |
705 | Buffer and SizeOfValue. Buffer is returned. If SizeOfValue is greater than \r | |
706 | the maximum size support by TokenNumber, then set SizeOfValue to the maximum size \r | |
707 | supported by TokenNumber and return NULL to indicate that the set operation \r | |
708 | was not actually performed. \r | |
709 | \r | |
710 | If SizeOfValue > 0 and Buffer is NULL, then ASSERT().\r | |
878ddf1f | 711 | \r |
712 | @param[in] Guid Pointer to a 128-bit unique value that \r | |
713 | designates which namespace to set a value from.\r | |
714 | @param[in] TokenNumber The PCD token number to set a current value for.\r | |
4276d5da | 715 | @param[in, out] SizeOfBuffer The size, in bytes, of Buffer.\r |
716 | @param[in] Buffer A pointer to the buffer to set.\r | |
878ddf1f | 717 | \r |
4276d5da | 718 | @retval VOID * Return the pinter to the buffer been set.\r |
878ddf1f | 719 | \r |
720 | **/\r | |
721 | VOID *\r | |
722 | EFIAPI\r | |
723 | LibPcdSetExPtr (\r | |
4276d5da | 724 | IN CONST GUID *Guid,\r |
725 | IN UINTN TokenNumber,\r | |
726 | IN OUT UINTN *SizeOfBuffer,\r | |
727 | IN VOID *Buffer\r | |
878ddf1f | 728 | )\r |
729 | {\r | |
4276d5da | 730 | EFI_STATUS Status;\r |
731 | UINTN Size;\r | |
878ddf1f | 732 | \r |
bb5545b6 | 733 | ASSERT (Guid != NULL);\r |
734 | \r | |
735 | ASSERT (SizeOfBuffer != NULL);\r | |
736 | \r | |
3534cbb7 | 737 | if (*SizeOfBuffer > 0) {\r |
738 | ASSERT (Buffer != NULL);\r | |
739 | }\r | |
878ddf1f | 740 | \r |
bb5545b6 | 741 | \r |
4276d5da | 742 | Size = LibPcdGetExSize (Guid, TokenNumber);\r |
743 | if (*SizeOfBuffer > Size) {\r | |
744 | *SizeOfBuffer = Size;\r | |
745 | return NULL;\r | |
746 | }\r | |
747 | \r | |
748 | Status = mPcd->SetPtrEx (Guid, TokenNumber, *SizeOfBuffer, Buffer);\r | |
878ddf1f | 749 | \r |
750 | ASSERT_EFI_ERROR (Status);\r | |
751 | \r | |
b16ef805 | 752 | return Buffer;\r |
878ddf1f | 753 | }\r |
754 | \r | |
755 | \r | |
756 | \r | |
757 | /**\r | |
758 | Sets the Boolean value for the token specified by TokenNumber and \r | |
759 | Guid to the value specified by Value. Value is returned.\r | |
760 | If Guid is NULL, then ASSERT().\r | |
761 | \r | |
762 | @param[in] Guid Pointer to a 128-bit unique value that \r | |
763 | designates which namespace to set a value from.\r | |
764 | @param[in] TokenNumber The PCD token number to set a current value for.\r | |
765 | @param[in] Value The Boolean value to set.\r | |
766 | \r | |
767 | @retval Boolean Return the value been set.\r | |
768 | \r | |
769 | **/\r | |
770 | BOOLEAN\r | |
771 | EFIAPI\r | |
772 | LibPcdSetExBool (\r | |
773 | IN CONST GUID *Guid,\r | |
8a43e8dd | 774 | IN UINTN TokenNumber,\r |
878ddf1f | 775 | IN BOOLEAN Value\r |
776 | )\r | |
777 | {\r | |
778 | EFI_STATUS Status;\r | |
779 | \r | |
780 | ASSERT (Guid != NULL);\r | |
781 | \r | |
782 | Status = mPcd->SetBoolEx (Guid, TokenNumber, Value);\r | |
783 | \r | |
784 | ASSERT_EFI_ERROR (Status);\r | |
785 | \r | |
786 | return Value;\r | |
787 | }\r | |
788 | \r | |
789 | \r | |
790 | \r | |
791 | /**\r | |
792 | When the token specified by TokenNumber and Guid is set, \r | |
793 | then notification function specified by NotificationFunction is called. \r | |
794 | If Guid is NULL, then the default token space is used. \r | |
795 | If NotificationFunction is NULL, then ASSERT().\r | |
796 | \r | |
797 | @param[in] Guid Pointer to a 128-bit unique value that designates which \r | |
798 | namespace to set a value from. If NULL, then the default \r | |
799 | token space is used.\r | |
800 | @param[in] TokenNumber The PCD token number to monitor.\r | |
801 | @param[in] NotificationFunction The function to call when the token \r | |
802 | specified by Guid and TokenNumber is set.\r | |
803 | \r | |
804 | @retval VOID\r | |
805 | \r | |
806 | **/\r | |
807 | VOID\r | |
808 | EFIAPI\r | |
809 | LibPcdCallbackOnSet (\r | |
810 | IN CONST GUID *Guid, OPTIONAL\r | |
8a43e8dd | 811 | IN UINTN TokenNumber,\r |
878ddf1f | 812 | IN PCD_CALLBACK NotificationFunction\r |
813 | )\r | |
814 | {\r | |
815 | EFI_STATUS Status;\r | |
816 | \r | |
817 | ASSERT (NotificationFunction != NULL);\r | |
818 | \r | |
819 | Status = mPcd->CallbackOnSet (TokenNumber, Guid, NotificationFunction);\r | |
820 | \r | |
821 | ASSERT_EFI_ERROR (Status);\r | |
822 | \r | |
823 | return;\r | |
824 | }\r | |
825 | \r | |
826 | \r | |
827 | \r | |
828 | /**\r | |
829 | Disable a notification function that was established with LibPcdCallbackonSet().\r | |
830 | If NotificationFunction is NULL, then ASSERT().\r | |
831 | \r | |
832 | @param[in] Guid Specify the GUID token space.\r | |
833 | @param[in] TokenNumber Specify the token number.\r | |
834 | @param[in] NotificationFunction The callback function to be unregistered.\r | |
835 | \r | |
836 | @retval VOID\r | |
837 | \r | |
838 | **/\r | |
839 | VOID\r | |
840 | EFIAPI\r | |
841 | LibPcdCancelCallback (\r | |
842 | IN CONST GUID *Guid, OPTIONAL\r | |
8a43e8dd | 843 | IN UINTN TokenNumber,\r |
878ddf1f | 844 | IN PCD_CALLBACK NotificationFunction\r |
845 | )\r | |
846 | {\r | |
847 | EFI_STATUS Status;\r | |
848 | \r | |
849 | ASSERT (NotificationFunction != NULL);\r | |
850 | \r | |
851 | Status = mPcd->CancelCallback (TokenNumber, Guid, NotificationFunction);\r | |
852 | \r | |
853 | ASSERT_EFI_ERROR (Status);\r | |
854 | \r | |
855 | return;\r | |
856 | }\r | |
857 | \r | |
858 | \r | |
859 | \r | |
860 | /**\r | |
861 | Retrieves the next PCD token number from the token space specified by Guid. \r | |
862 | If Guid is NULL, then the default token space is used. If TokenNumber is 0, \r | |
863 | then the first token number is returned. Otherwise, the token number that \r | |
864 | follows TokenNumber in the token space is returned. If TokenNumber is the last \r | |
865 | token number in the token space, then 0 is returned. If TokenNumber is not 0 and \r | |
866 | is not in the token space specified by Guid, then ASSERT().\r | |
867 | \r | |
868 | @param[in] Pointer to a 128-bit unique value that designates which namespace \r | |
869 | to set a value from. If NULL, then the default token space is used.\r | |
870 | @param[in] The previous PCD token number. If 0, then retrieves the first PCD \r | |
871 | token number.\r | |
872 | \r | |
8a43e8dd | 873 | @retval UINTN The next valid token number.\r |
878ddf1f | 874 | \r |
875 | **/\r | |
8a43e8dd | 876 | UINTN \r |
878ddf1f | 877 | EFIAPI\r |
878 | LibPcdGetNextToken (\r | |
879 | IN CONST GUID *Guid, OPTIONAL\r | |
8a43e8dd | 880 | IN UINTN TokenNumber\r |
878ddf1f | 881 | )\r |
882 | {\r | |
883 | EFI_STATUS Status;\r | |
884 | \r | |
b16ef805 | 885 | Status = mPcd->GetNextToken (Guid, &TokenNumber);\r |
878ddf1f | 886 | \r |
887 | ASSERT_EFI_ERROR (Status);\r | |
888 | \r | |
b16ef805 | 889 | return TokenNumber;\r |
878ddf1f | 890 | }\r |
891 | \r | |
4276d5da | 892 | \r |
893 | \r | |
894 | /**\r | |
895 | Retrieves the next PCD token space from a token space specified by Guid.\r | |
896 | Guid of NULL is reserved to mark the default local token namespace on the current\r | |
897 | platform. If Guid is NULL, then the GUID of the first non-local token space of the \r | |
898 | current platform is returned. If Guid is the last non-local token space, \r | |
899 | then NULL is returned. \r | |
900 | \r | |
901 | If Guid is not NULL and is not a valid token space in the current platform, then ASSERT().\r | |
902 | \r | |
903 | \r | |
904 | \r | |
905 | @param[in] Pointer to a 128-bit unique value that designates from which namespace \r | |
906 | to start the search.\r | |
907 | \r | |
908 | @retval CONST GUID * The next valid token namespace.\r | |
909 | \r | |
910 | **/\r | |
bb5545b6 | 911 | GUID * \r |
4276d5da | 912 | EFIAPI\r |
913 | LibPcdGetNextTokenSpace (\r | |
914 | IN CONST GUID *Guid\r | |
915 | )\r | |
916 | {\r | |
917 | EFI_STATUS Status;\r | |
918 | \r | |
919 | Status = mPcd->GetNextTokenSpace (&Guid);\r | |
920 | \r | |
921 | ASSERT_EFI_ERROR (Status);\r | |
922 | \r | |
bb5545b6 | 923 | return (GUID *) Guid;\r |
4276d5da | 924 | }\r |
925 | \r | |
1eb73ab5 | 926 | \r |
927 | /**\r | |
928 | Sets the PCD entry specified by PatchVariable to the value specified by Buffer \r | |
929 | and SizeOfValue. Buffer is returned. If SizeOfValue is greater than \r | |
930 | MaximumDatumSize, then set SizeOfValue to MaximumDatumSize and return \r | |
931 | NULL to indicate that the set operation was not actually performed. \r | |
932 | If SizeOfValue is set to MAX_ADDRESS, then SizeOfValue must be set to \r | |
933 | MaximumDatumSize and NULL must be returned.\r | |
934 | \r | |
935 | If PatchVariable is NULL, then ASSERT().\r | |
936 | If SizeOfValue is NULL, then ASSERT().\r | |
937 | If SizeOfValue > 0 and Buffer is NULL, then ASSERT().\r | |
938 | \r | |
939 | @param[in] PatchVariable A pointer to the global variable in a module that is \r | |
940 | the target of the set operation.\r | |
941 | @param[in] MaximumDatumSize The maximum size allowed for the PCD entry specified by PatchVariable.\r | |
942 | @param[in, out] SizeOfBuffer A pointer to the size, in bytes, of Buffer.\r | |
943 | @param[in] Buffer A pointer to the buffer to used to set the target variable.\r | |
944 | \r | |
945 | **/\r | |
946 | VOID *\r | |
947 | EFIAPI\r | |
948 | LibPatchPcdSetPtr (\r | |
949 | IN VOID *PatchVariable,\r | |
950 | IN UINTN MaximumDatumSize,\r | |
951 | IN OUT UINTN *SizeOfBuffer,\r | |
952 | IN CONST VOID *Buffer\r | |
953 | )\r | |
954 | {\r | |
955 | ASSERT (PatchVariable != NULL);\r | |
956 | ASSERT (SizeOfBuffer != NULL);\r | |
957 | \r | |
958 | if (*SizeOfBuffer > 0) {\r | |
959 | ASSERT (Buffer != NULL);\r | |
960 | }\r | |
961 | \r | |
962 | if ((*SizeOfBuffer > MaximumDatumSize) ||\r | |
963 | (*SizeOfBuffer == MAX_ADDRESS)) {\r | |
964 | *SizeOfBuffer = MaximumDatumSize;\r | |
965 | return NULL;\r | |
966 | }\r | |
967 | \r | |
968 | CopyMem (PatchVariable, Buffer, *SizeOfBuffer);\r | |
969 | \r | |
970 | return (VOID *) Buffer;\r | |
971 | }\r | |
972 | \r | |
973 | \r | |
974 | \r |