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