]>
Commit | Line | Data |
---|---|---|
1 | /** @file\r | |
2 | Implementation of PcdLib class library for DXE phase.\r | |
3 | \r | |
4 | Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>\r | |
5 | SPDX-License-Identifier: BSD-2-Clause-Patent\r | |
6 | \r | |
7 | \r | |
8 | **/\r | |
9 | \r | |
10 | #include <PiDxe.h>\r | |
11 | \r | |
12 | #include <Protocol/Pcd.h>\r | |
13 | #include <Protocol/PiPcd.h>\r | |
14 | #include <Protocol/PcdInfo.h>\r | |
15 | #include <Protocol/PiPcdInfo.h>\r | |
16 | \r | |
17 | #include <Library/PcdLib.h>\r | |
18 | #include <Library/DebugLib.h>\r | |
19 | #include <Library/UefiBootServicesTableLib.h>\r | |
20 | #include <Library/BaseMemoryLib.h>\r | |
21 | \r | |
22 | PCD_PROTOCOL *mPcd = NULL;\r | |
23 | EFI_PCD_PROTOCOL *mPiPcd = NULL;\r | |
24 | GET_PCD_INFO_PROTOCOL *mPcdInfo = NULL;\r | |
25 | EFI_GET_PCD_INFO_PROTOCOL *mPiPcdInfo = NULL;\r | |
26 | \r | |
27 | /**\r | |
28 | Retrieves the PI PCD protocol from the handle database.\r | |
29 | \r | |
30 | @retval EFI_PCD_PROTOCOL * The pointer to the EFI_PCD_PROTOCOL.\r | |
31 | **/\r | |
32 | EFI_PCD_PROTOCOL *\r | |
33 | EFIAPI\r | |
34 | GetPiPcdProtocol (\r | |
35 | VOID\r | |
36 | )\r | |
37 | {\r | |
38 | EFI_STATUS Status;\r | |
39 | \r | |
40 | if (mPiPcd == NULL) {\r | |
41 | //\r | |
42 | // PI Pcd protocol defined in PI 1.2 vol3 should be installed before the module\r | |
43 | // access DynamicEx type PCD.\r | |
44 | //\r | |
45 | Status = gBS->LocateProtocol (&gEfiPcdProtocolGuid, NULL, (VOID **)&mPiPcd);\r | |
46 | ASSERT_EFI_ERROR (Status);\r | |
47 | ASSERT (mPiPcd != NULL);\r | |
48 | }\r | |
49 | \r | |
50 | return mPiPcd;\r | |
51 | }\r | |
52 | \r | |
53 | /**\r | |
54 | Retrieves the PCD protocol from the handle database.\r | |
55 | \r | |
56 | @retval PCD_PROTOCOL * The pointer to the PCD_PROTOCOL.\r | |
57 | **/\r | |
58 | PCD_PROTOCOL *\r | |
59 | EFIAPI\r | |
60 | GetPcdProtocol (\r | |
61 | VOID\r | |
62 | )\r | |
63 | {\r | |
64 | EFI_STATUS Status;\r | |
65 | \r | |
66 | if (mPcd == NULL) {\r | |
67 | //\r | |
68 | // PCD protocol need to be installed before the module access Dynamic type PCD.\r | |
69 | // But dynamic type PCD is not required in PI 1.2 specification.\r | |
70 | //\r | |
71 | Status = gBS->LocateProtocol (&gPcdProtocolGuid, NULL, (VOID **)&mPcd);\r | |
72 | ASSERT_EFI_ERROR (Status);\r | |
73 | ASSERT (mPcd != NULL);\r | |
74 | }\r | |
75 | \r | |
76 | return mPcd;\r | |
77 | }\r | |
78 | \r | |
79 | /**\r | |
80 | Retrieves the PI PCD info protocol from the handle database.\r | |
81 | \r | |
82 | @retval EFI_GET_PCD_INFO_PROTOCOL * The pointer to the EFI_GET_PCD_INFO_PROTOCOL defined in PI 1.2.1 Vol 3.\r | |
83 | **/\r | |
84 | EFI_GET_PCD_INFO_PROTOCOL *\r | |
85 | GetPiPcdInfoProtocolPointer (\r | |
86 | VOID\r | |
87 | )\r | |
88 | {\r | |
89 | EFI_STATUS Status;\r | |
90 | \r | |
91 | if (mPiPcdInfo == NULL) {\r | |
92 | Status = gBS->LocateProtocol (&gEfiGetPcdInfoProtocolGuid, NULL, (VOID **)&mPiPcdInfo);\r | |
93 | ASSERT_EFI_ERROR (Status);\r | |
94 | ASSERT (mPiPcdInfo != NULL);\r | |
95 | }\r | |
96 | \r | |
97 | return mPiPcdInfo;\r | |
98 | }\r | |
99 | \r | |
100 | /**\r | |
101 | Retrieves the PCD info protocol from the handle database.\r | |
102 | \r | |
103 | @retval GET_PCD_INFO_PROTOCOL * The pointer to the GET_PCD_INFO_PROTOCOL.\r | |
104 | **/\r | |
105 | GET_PCD_INFO_PROTOCOL *\r | |
106 | GetPcdInfoProtocolPointer (\r | |
107 | VOID\r | |
108 | )\r | |
109 | {\r | |
110 | EFI_STATUS Status;\r | |
111 | \r | |
112 | if (mPcdInfo == NULL) {\r | |
113 | Status = gBS->LocateProtocol (&gGetPcdInfoProtocolGuid, NULL, (VOID **)&mPcdInfo);\r | |
114 | ASSERT_EFI_ERROR (Status);\r | |
115 | ASSERT (mPcdInfo != NULL);\r | |
116 | }\r | |
117 | \r | |
118 | return mPcdInfo;\r | |
119 | }\r | |
120 | \r | |
121 | /**\r | |
122 | This function provides a means by which SKU support can be established in the PCD infrastructure.\r | |
123 | \r | |
124 | Sets the current SKU in the PCD database to the value specified by SkuId. SkuId is returned.\r | |
125 | \r | |
126 | @param SkuId The SKU value that will be used when the PCD service retrieves and sets values\r | |
127 | associated with a PCD token.\r | |
128 | \r | |
129 | @return Return the SKU ID that just be set.\r | |
130 | \r | |
131 | **/\r | |
132 | UINTN\r | |
133 | EFIAPI\r | |
134 | LibPcdSetSku (\r | |
135 | IN UINTN SkuId\r | |
136 | )\r | |
137 | {\r | |
138 | GetPcdProtocol ()->SetSku (SkuId);\r | |
139 | \r | |
140 | return SkuId;\r | |
141 | }\r | |
142 | \r | |
143 | /**\r | |
144 | This function provides a means by which to retrieve a value for a given PCD token.\r | |
145 | \r | |
146 | Returns the 8-bit value for the token specified by TokenNumber.\r | |
147 | \r | |
148 | @param[in] TokenNumber The PCD token number to retrieve a current value for.\r | |
149 | \r | |
150 | @return Returns the 8-bit value for the token specified by TokenNumber.\r | |
151 | \r | |
152 | **/\r | |
153 | UINT8\r | |
154 | EFIAPI\r | |
155 | LibPcdGet8 (\r | |
156 | IN UINTN TokenNumber\r | |
157 | )\r | |
158 | {\r | |
159 | return GetPcdProtocol ()->Get8 (TokenNumber);\r | |
160 | }\r | |
161 | \r | |
162 | /**\r | |
163 | This function provides a means by which to retrieve a value for a given PCD token.\r | |
164 | \r | |
165 | Returns the 16-bit value for 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 | @return Returns the 16-bit value for the token specified by TokenNumber.\r | |
170 | \r | |
171 | **/\r | |
172 | UINT16\r | |
173 | EFIAPI\r | |
174 | LibPcdGet16 (\r | |
175 | IN UINTN TokenNumber\r | |
176 | )\r | |
177 | {\r | |
178 | return GetPcdProtocol ()->Get16 (TokenNumber);\r | |
179 | }\r | |
180 | \r | |
181 | /**\r | |
182 | This function provides a means by which to retrieve a value for a given PCD token.\r | |
183 | \r | |
184 | Returns the 32-bit value for 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 | @return Returns the 32-bit value for the token specified by TokenNumber.\r | |
189 | \r | |
190 | **/\r | |
191 | UINT32\r | |
192 | EFIAPI\r | |
193 | LibPcdGet32 (\r | |
194 | IN UINTN TokenNumber\r | |
195 | )\r | |
196 | {\r | |
197 | return GetPcdProtocol ()->Get32 (TokenNumber);\r | |
198 | }\r | |
199 | \r | |
200 | /**\r | |
201 | This function provides a means by which to retrieve a value for a given PCD token.\r | |
202 | \r | |
203 | Returns the 64-bit value for the token specified by TokenNumber.\r | |
204 | \r | |
205 | @param[in] TokenNumber The PCD token number to retrieve a current value for.\r | |
206 | \r | |
207 | @return Returns the 64-bit value for the token specified by TokenNumber.\r | |
208 | \r | |
209 | **/\r | |
210 | UINT64\r | |
211 | EFIAPI\r | |
212 | LibPcdGet64 (\r | |
213 | IN UINTN TokenNumber\r | |
214 | )\r | |
215 | {\r | |
216 | return GetPcdProtocol ()->Get64 (TokenNumber);\r | |
217 | }\r | |
218 | \r | |
219 | /**\r | |
220 | This function provides a means by which to retrieve a value for a given PCD token.\r | |
221 | \r | |
222 | Returns the pointer to the buffer of the token specified by TokenNumber.\r | |
223 | \r | |
224 | @param[in] TokenNumber The PCD token number to retrieve a current value for.\r | |
225 | \r | |
226 | @return Returns the pointer to the token specified by TokenNumber.\r | |
227 | \r | |
228 | **/\r | |
229 | VOID *\r | |
230 | EFIAPI\r | |
231 | LibPcdGetPtr (\r | |
232 | IN UINTN TokenNumber\r | |
233 | )\r | |
234 | {\r | |
235 | return GetPcdProtocol ()->GetPtr (TokenNumber);\r | |
236 | }\r | |
237 | \r | |
238 | /**\r | |
239 | This function provides a means by which to retrieve a value for a given PCD token.\r | |
240 | \r | |
241 | Returns the Boolean value of the token specified by TokenNumber.\r | |
242 | \r | |
243 | @param[in] TokenNumber The PCD token number to retrieve a current value for.\r | |
244 | \r | |
245 | @return Returns the Boolean value of the token specified by TokenNumber.\r | |
246 | \r | |
247 | **/\r | |
248 | BOOLEAN\r | |
249 | EFIAPI\r | |
250 | LibPcdGetBool (\r | |
251 | IN UINTN TokenNumber\r | |
252 | )\r | |
253 | {\r | |
254 | return GetPcdProtocol ()->GetBool (TokenNumber);\r | |
255 | }\r | |
256 | \r | |
257 | /**\r | |
258 | This function provides a means by which to retrieve the size of a given PCD token.\r | |
259 | \r | |
260 | @param[in] TokenNumber The PCD token number to retrieve a current value for.\r | |
261 | \r | |
262 | @return Returns the size of the token specified by TokenNumber.\r | |
263 | \r | |
264 | **/\r | |
265 | UINTN\r | |
266 | EFIAPI\r | |
267 | LibPcdGetSize (\r | |
268 | IN UINTN TokenNumber\r | |
269 | )\r | |
270 | {\r | |
271 | return GetPcdProtocol ()->GetSize (TokenNumber);\r | |
272 | }\r | |
273 | \r | |
274 | /**\r | |
275 | This function provides a means by which to retrieve a value for a given PCD token.\r | |
276 | \r | |
277 | Returns the 8-bit value for the token specified by TokenNumber and Guid.\r | |
278 | \r | |
279 | If Guid is NULL, then ASSERT().\r | |
280 | \r | |
281 | @param[in] Guid The pointer to a 128-bit unique value that designates\r | |
282 | which namespace to retrieve a value from.\r | |
283 | @param[in] TokenNumber The PCD token number to retrieve a current value for.\r | |
284 | \r | |
285 | @return Return the UINT8.\r | |
286 | \r | |
287 | **/\r | |
288 | UINT8\r | |
289 | EFIAPI\r | |
290 | LibPcdGetEx8 (\r | |
291 | IN CONST GUID *Guid,\r | |
292 | IN UINTN TokenNumber\r | |
293 | )\r | |
294 | {\r | |
295 | ASSERT (Guid != NULL);\r | |
296 | \r | |
297 | return GetPiPcdProtocol ()->Get8 (Guid, TokenNumber);\r | |
298 | }\r | |
299 | \r | |
300 | /**\r | |
301 | This function provides a means by which to retrieve a value for a given PCD token.\r | |
302 | \r | |
303 | Returns the 16-bit value for the token specified by TokenNumber and Guid.\r | |
304 | \r | |
305 | If Guid is NULL, then ASSERT().\r | |
306 | \r | |
307 | @param[in] Guid The pointer to a 128-bit unique value that designates\r | |
308 | which namespace to retrieve a value from.\r | |
309 | @param[in] TokenNumber The PCD token number to retrieve a current value for.\r | |
310 | \r | |
311 | @return Return the UINT16.\r | |
312 | \r | |
313 | **/\r | |
314 | UINT16\r | |
315 | EFIAPI\r | |
316 | LibPcdGetEx16 (\r | |
317 | IN CONST GUID *Guid,\r | |
318 | IN UINTN TokenNumber\r | |
319 | )\r | |
320 | {\r | |
321 | ASSERT (Guid != NULL);\r | |
322 | \r | |
323 | return GetPiPcdProtocol ()->Get16 (Guid, TokenNumber);\r | |
324 | }\r | |
325 | \r | |
326 | /**\r | |
327 | Returns the 32-bit value for the token specified by TokenNumber and Guid.\r | |
328 | If Guid is NULL, then ASSERT().\r | |
329 | \r | |
330 | @param[in] Guid The pointer to a 128-bit unique value that designates\r | |
331 | which namespace to retrieve a value from.\r | |
332 | @param[in] TokenNumber The PCD token number to retrieve a current value for.\r | |
333 | \r | |
334 | @return Return the UINT32.\r | |
335 | \r | |
336 | **/\r | |
337 | UINT32\r | |
338 | EFIAPI\r | |
339 | LibPcdGetEx32 (\r | |
340 | IN CONST GUID *Guid,\r | |
341 | IN UINTN TokenNumber\r | |
342 | )\r | |
343 | {\r | |
344 | ASSERT (Guid != NULL);\r | |
345 | \r | |
346 | return GetPiPcdProtocol ()->Get32 (Guid, TokenNumber);\r | |
347 | }\r | |
348 | \r | |
349 | /**\r | |
350 | This function provides a means by which to retrieve a value for a given PCD token.\r | |
351 | \r | |
352 | Returns the 64-bit value for the token specified by TokenNumber and Guid.\r | |
353 | \r | |
354 | If Guid is NULL, then ASSERT().\r | |
355 | \r | |
356 | @param[in] Guid The pointer to a 128-bit unique value that designates\r | |
357 | which namespace to retrieve a value from.\r | |
358 | @param[in] TokenNumber The PCD token number to retrieve a current value for.\r | |
359 | \r | |
360 | @return Return the UINT64.\r | |
361 | \r | |
362 | **/\r | |
363 | UINT64\r | |
364 | EFIAPI\r | |
365 | LibPcdGetEx64 (\r | |
366 | IN CONST GUID *Guid,\r | |
367 | IN UINTN TokenNumber\r | |
368 | )\r | |
369 | {\r | |
370 | ASSERT (Guid != NULL);\r | |
371 | \r | |
372 | return GetPiPcdProtocol ()->Get64 (Guid, TokenNumber);\r | |
373 | }\r | |
374 | \r | |
375 | /**\r | |
376 | This function provides a means by which to retrieve a value for a given PCD token.\r | |
377 | \r | |
378 | Returns the pointer to the buffer of token specified by TokenNumber and Guid.\r | |
379 | \r | |
380 | If Guid is NULL, then ASSERT().\r | |
381 | \r | |
382 | @param[in] Guid The pointer to a 128-bit unique value that designates\r | |
383 | which namespace to retrieve a value from.\r | |
384 | @param[in] TokenNumber The PCD token number to retrieve a current value for.\r | |
385 | \r | |
386 | @return Return the VOID* pointer.\r | |
387 | \r | |
388 | **/\r | |
389 | VOID *\r | |
390 | EFIAPI\r | |
391 | LibPcdGetExPtr (\r | |
392 | IN CONST GUID *Guid,\r | |
393 | IN UINTN TokenNumber\r | |
394 | )\r | |
395 | {\r | |
396 | ASSERT (Guid != NULL);\r | |
397 | \r | |
398 | return GetPiPcdProtocol ()->GetPtr (Guid, TokenNumber);\r | |
399 | }\r | |
400 | \r | |
401 | /**\r | |
402 | This function provides a means by which to retrieve a value for a given PCD token.\r | |
403 | \r | |
404 | Returns the Boolean value of the token specified by TokenNumber and Guid.\r | |
405 | \r | |
406 | If Guid is NULL, then ASSERT().\r | |
407 | \r | |
408 | @param[in] Guid The pointer to a 128-bit unique value that designates\r | |
409 | which namespace to retrieve a value from.\r | |
410 | @param[in] TokenNumber The PCD token number to retrieve a current value for.\r | |
411 | \r | |
412 | @return Return the BOOLEAN.\r | |
413 | \r | |
414 | **/\r | |
415 | BOOLEAN\r | |
416 | EFIAPI\r | |
417 | LibPcdGetExBool (\r | |
418 | IN CONST GUID *Guid,\r | |
419 | IN UINTN TokenNumber\r | |
420 | )\r | |
421 | {\r | |
422 | ASSERT (Guid != NULL);\r | |
423 | \r | |
424 | return GetPiPcdProtocol ()->GetBool (Guid, TokenNumber);\r | |
425 | }\r | |
426 | \r | |
427 | /**\r | |
428 | This function provides a means by which to retrieve the size of a given PCD token.\r | |
429 | \r | |
430 | Returns the size of the token specified by TokenNumber and Guid.\r | |
431 | \r | |
432 | If Guid is NULL, then ASSERT().\r | |
433 | \r | |
434 | @param[in] Guid The pointer to a 128-bit unique value that designates\r | |
435 | which namespace to retrieve a value from.\r | |
436 | @param[in] TokenNumber The PCD token number to retrieve a current value for.\r | |
437 | \r | |
438 | @return Return the size.\r | |
439 | \r | |
440 | **/\r | |
441 | UINTN\r | |
442 | EFIAPI\r | |
443 | LibPcdGetExSize (\r | |
444 | IN CONST GUID *Guid,\r | |
445 | IN UINTN TokenNumber\r | |
446 | )\r | |
447 | {\r | |
448 | ASSERT (Guid != NULL);\r | |
449 | \r | |
450 | return GetPiPcdProtocol ()->GetSize (Guid, TokenNumber);\r | |
451 | }\r | |
452 | \r | |
453 | /**\r | |
454 | This function provides a means by which to set a value for a given PCD token.\r | |
455 | \r | |
456 | Sets the 8-bit value for the token specified by TokenNumber\r | |
457 | to the value specified by Value.\r | |
458 | \r | |
459 | @param[in] TokenNumber The PCD token number to set a current value for.\r | |
460 | @param[in] Value The 8-bit value to set.\r | |
461 | \r | |
462 | @return The status of the set operation.\r | |
463 | \r | |
464 | **/\r | |
465 | RETURN_STATUS\r | |
466 | EFIAPI\r | |
467 | LibPcdSet8S (\r | |
468 | IN UINTN TokenNumber,\r | |
469 | IN UINT8 Value\r | |
470 | )\r | |
471 | {\r | |
472 | return GetPcdProtocol ()->Set8 (TokenNumber, Value);\r | |
473 | }\r | |
474 | \r | |
475 | /**\r | |
476 | This function provides a means by which to set a value for a given PCD token.\r | |
477 | \r | |
478 | Sets the 16-bit value for the token specified by TokenNumber\r | |
479 | to the value specified by Value.\r | |
480 | \r | |
481 | @param[in] TokenNumber The PCD token number to set a current value for.\r | |
482 | @param[in] Value The 16-bit value to set.\r | |
483 | \r | |
484 | @return The status of the set operation.\r | |
485 | \r | |
486 | **/\r | |
487 | RETURN_STATUS\r | |
488 | EFIAPI\r | |
489 | LibPcdSet16S (\r | |
490 | IN UINTN TokenNumber,\r | |
491 | IN UINT16 Value\r | |
492 | )\r | |
493 | {\r | |
494 | return GetPcdProtocol ()->Set16 (TokenNumber, Value);\r | |
495 | }\r | |
496 | \r | |
497 | /**\r | |
498 | This function provides a means by which to set a value for a given PCD token.\r | |
499 | \r | |
500 | Sets the 32-bit value for the token specified by TokenNumber\r | |
501 | to the value specified by Value.\r | |
502 | \r | |
503 | @param[in] TokenNumber The PCD token number to set a current value for.\r | |
504 | @param[in] Value The 32-bit value to set.\r | |
505 | \r | |
506 | @return The status of the set operation.\r | |
507 | \r | |
508 | **/\r | |
509 | RETURN_STATUS\r | |
510 | EFIAPI\r | |
511 | LibPcdSet32S (\r | |
512 | IN UINTN TokenNumber,\r | |
513 | IN UINT32 Value\r | |
514 | )\r | |
515 | {\r | |
516 | return GetPcdProtocol ()->Set32 (TokenNumber, Value);\r | |
517 | }\r | |
518 | \r | |
519 | /**\r | |
520 | This function provides a means by which to set a value for a given PCD token.\r | |
521 | \r | |
522 | Sets the 64-bit value for the token specified by TokenNumber\r | |
523 | to the value specified by Value.\r | |
524 | \r | |
525 | @param[in] TokenNumber The PCD token number to set a current value for.\r | |
526 | @param[in] Value The 64-bit value to set.\r | |
527 | \r | |
528 | @return The status of the set operation.\r | |
529 | \r | |
530 | **/\r | |
531 | RETURN_STATUS\r | |
532 | EFIAPI\r | |
533 | LibPcdSet64S (\r | |
534 | IN UINTN TokenNumber,\r | |
535 | IN UINT64 Value\r | |
536 | )\r | |
537 | {\r | |
538 | return GetPcdProtocol ()->Set64 (TokenNumber, Value);\r | |
539 | }\r | |
540 | \r | |
541 | /**\r | |
542 | This function provides a means by which to set a value for a given PCD token.\r | |
543 | \r | |
544 | Sets a buffer for the token specified by TokenNumber to the value specified\r | |
545 | by Buffer and SizeOfBuffer. If SizeOfBuffer is greater than the maximum size\r | |
546 | support by TokenNumber, then set SizeOfBuffer to the maximum size supported by\r | |
547 | TokenNumber and return EFI_INVALID_PARAMETER to indicate that the set operation\r | |
548 | was not actually performed.\r | |
549 | \r | |
550 | If SizeOfBuffer is set to MAX_ADDRESS, then SizeOfBuffer must be set to the\r | |
551 | maximum size supported by TokenName and EFI_INVALID_PARAMETER must be returned.\r | |
552 | \r | |
553 | If SizeOfBuffer is NULL, then ASSERT().\r | |
554 | If SizeOfBuffer > 0 and Buffer is NULL, then ASSERT().\r | |
555 | \r | |
556 | @param[in] TokenNumber The PCD token number to set a current value for.\r | |
557 | @param[in, out] SizeOfBuffer The size, in bytes, of Buffer.\r | |
558 | @param[in] Buffer A pointer to the buffer to set.\r | |
559 | \r | |
560 | @return The status of the set operation.\r | |
561 | \r | |
562 | **/\r | |
563 | RETURN_STATUS\r | |
564 | EFIAPI\r | |
565 | LibPcdSetPtrS (\r | |
566 | IN UINTN TokenNumber,\r | |
567 | IN OUT UINTN *SizeOfBuffer,\r | |
568 | IN CONST VOID *Buffer\r | |
569 | )\r | |
570 | {\r | |
571 | ASSERT (SizeOfBuffer != NULL);\r | |
572 | \r | |
573 | if (*SizeOfBuffer > 0) {\r | |
574 | ASSERT (Buffer != NULL);\r | |
575 | }\r | |
576 | \r | |
577 | return GetPcdProtocol ()->SetPtr (TokenNumber, SizeOfBuffer, (VOID *)Buffer);\r | |
578 | }\r | |
579 | \r | |
580 | /**\r | |
581 | This function provides a means by which to set a value for a given PCD token.\r | |
582 | \r | |
583 | Sets the boolean value for the token specified by TokenNumber\r | |
584 | to the value specified by Value.\r | |
585 | \r | |
586 | @param[in] TokenNumber The PCD token number to set a current value for.\r | |
587 | @param[in] Value The boolean value to set.\r | |
588 | \r | |
589 | @return The status of the set operation.\r | |
590 | \r | |
591 | **/\r | |
592 | RETURN_STATUS\r | |
593 | EFIAPI\r | |
594 | LibPcdSetBoolS (\r | |
595 | IN UINTN TokenNumber,\r | |
596 | IN BOOLEAN Value\r | |
597 | )\r | |
598 | {\r | |
599 | return GetPcdProtocol ()->SetBool (TokenNumber, Value);\r | |
600 | }\r | |
601 | \r | |
602 | /**\r | |
603 | This function provides a means by which to set a value for a given PCD token.\r | |
604 | \r | |
605 | Sets the 8-bit value for the token specified by TokenNumber\r | |
606 | to the value specified by Value.\r | |
607 | \r | |
608 | If Guid is NULL, then ASSERT().\r | |
609 | \r | |
610 | @param[in] Guid The pointer to a 128-bit unique value that\r | |
611 | designates which namespace to set a value from.\r | |
612 | @param[in] TokenNumber The PCD token number to set a current value for.\r | |
613 | @param[in] Value The 8-bit value to set.\r | |
614 | \r | |
615 | @return The status of the set operation.\r | |
616 | \r | |
617 | **/\r | |
618 | RETURN_STATUS\r | |
619 | EFIAPI\r | |
620 | LibPcdSetEx8S (\r | |
621 | IN CONST GUID *Guid,\r | |
622 | IN UINTN TokenNumber,\r | |
623 | IN UINT8 Value\r | |
624 | )\r | |
625 | {\r | |
626 | ASSERT (Guid != NULL);\r | |
627 | \r | |
628 | return GetPiPcdProtocol ()->Set8 (Guid, TokenNumber, Value);\r | |
629 | }\r | |
630 | \r | |
631 | /**\r | |
632 | This function provides a means by which to set a value for a given PCD token.\r | |
633 | \r | |
634 | Sets the 16-bit value for the token specified by TokenNumber\r | |
635 | to the value specified by Value.\r | |
636 | \r | |
637 | If Guid is NULL, then ASSERT().\r | |
638 | \r | |
639 | @param[in] Guid The pointer to a 128-bit unique value that\r | |
640 | designates which namespace to set a value from.\r | |
641 | @param[in] TokenNumber The PCD token number to set a current value for.\r | |
642 | @param[in] Value The 16-bit value to set.\r | |
643 | \r | |
644 | @return The status of the set operation.\r | |
645 | \r | |
646 | **/\r | |
647 | RETURN_STATUS\r | |
648 | EFIAPI\r | |
649 | LibPcdSetEx16S (\r | |
650 | IN CONST GUID *Guid,\r | |
651 | IN UINTN TokenNumber,\r | |
652 | IN UINT16 Value\r | |
653 | )\r | |
654 | {\r | |
655 | ASSERT (Guid != NULL);\r | |
656 | \r | |
657 | return GetPiPcdProtocol ()->Set16 (Guid, TokenNumber, Value);\r | |
658 | }\r | |
659 | \r | |
660 | /**\r | |
661 | This function provides a means by which to set a value for a given PCD token.\r | |
662 | \r | |
663 | Sets the 32-bit value for the token specified by TokenNumber\r | |
664 | to the value specified by Value.\r | |
665 | \r | |
666 | If Guid is NULL, then ASSERT().\r | |
667 | \r | |
668 | @param[in] Guid The pointer to a 128-bit unique value that\r | |
669 | designates which namespace to set a value from.\r | |
670 | @param[in] TokenNumber The PCD token number to set a current value for.\r | |
671 | @param[in] Value The 32-bit value to set.\r | |
672 | \r | |
673 | @return The status of the set operation.\r | |
674 | \r | |
675 | **/\r | |
676 | RETURN_STATUS\r | |
677 | EFIAPI\r | |
678 | LibPcdSetEx32S (\r | |
679 | IN CONST GUID *Guid,\r | |
680 | IN UINTN TokenNumber,\r | |
681 | IN UINT32 Value\r | |
682 | )\r | |
683 | {\r | |
684 | ASSERT (Guid != NULL);\r | |
685 | \r | |
686 | return GetPiPcdProtocol ()->Set32 (Guid, TokenNumber, Value);\r | |
687 | }\r | |
688 | \r | |
689 | /**\r | |
690 | This function provides a means by which to set a value for a given PCD token.\r | |
691 | \r | |
692 | Sets the 64-bit value for the token specified by TokenNumber\r | |
693 | to the value specified by Value.\r | |
694 | \r | |
695 | If Guid is NULL, then ASSERT().\r | |
696 | \r | |
697 | @param[in] Guid The pointer to a 128-bit unique value that\r | |
698 | designates which namespace to set a value from.\r | |
699 | @param[in] TokenNumber The PCD token number to set a current value for.\r | |
700 | @param[in] Value The 64-bit value to set.\r | |
701 | \r | |
702 | @return The status of the set operation.\r | |
703 | \r | |
704 | **/\r | |
705 | RETURN_STATUS\r | |
706 | EFIAPI\r | |
707 | LibPcdSetEx64S (\r | |
708 | IN CONST GUID *Guid,\r | |
709 | IN UINTN TokenNumber,\r | |
710 | IN UINT64 Value\r | |
711 | )\r | |
712 | {\r | |
713 | ASSERT (Guid != NULL);\r | |
714 | \r | |
715 | return GetPiPcdProtocol ()->Set64 (Guid, TokenNumber, Value);\r | |
716 | }\r | |
717 | \r | |
718 | /**\r | |
719 | This function provides a means by which to set a value for a given PCD token.\r | |
720 | \r | |
721 | Sets a buffer for the token specified by TokenNumber to the value specified by\r | |
722 | Buffer and SizeOfBuffer. If SizeOfBuffer is greater than the maximum size\r | |
723 | support by TokenNumber, then set SizeOfBuffer to the maximum size supported by\r | |
724 | TokenNumber and return EFI_INVALID_PARAMETER to indicate that the set operation\r | |
725 | was not actually performed.\r | |
726 | \r | |
727 | If Guid is NULL, then ASSERT().\r | |
728 | If SizeOfBuffer is NULL, then ASSERT().\r | |
729 | If SizeOfBuffer > 0 and Buffer is NULL, then ASSERT().\r | |
730 | \r | |
731 | @param[in] Guid Pointer to a 128-bit unique value that\r | |
732 | designates which namespace to set a value from.\r | |
733 | @param[in] TokenNumber The PCD token number to set a current value for.\r | |
734 | @param[in, out] SizeOfBuffer The size, in bytes, of Buffer.\r | |
735 | @param[in] Buffer A pointer to the buffer to set.\r | |
736 | \r | |
737 | @return The status of the set operation.\r | |
738 | \r | |
739 | **/\r | |
740 | RETURN_STATUS\r | |
741 | EFIAPI\r | |
742 | LibPcdSetExPtrS (\r | |
743 | IN CONST GUID *Guid,\r | |
744 | IN UINTN TokenNumber,\r | |
745 | IN OUT UINTN *SizeOfBuffer,\r | |
746 | IN VOID *Buffer\r | |
747 | )\r | |
748 | {\r | |
749 | ASSERT (Guid != NULL);\r | |
750 | \r | |
751 | ASSERT (SizeOfBuffer != NULL);\r | |
752 | \r | |
753 | if (*SizeOfBuffer > 0) {\r | |
754 | ASSERT (Buffer != NULL);\r | |
755 | }\r | |
756 | \r | |
757 | return GetPiPcdProtocol ()->SetPtr (Guid, TokenNumber, SizeOfBuffer, Buffer);\r | |
758 | }\r | |
759 | \r | |
760 | /**\r | |
761 | This function provides a means by which to set a value for a given PCD token.\r | |
762 | \r | |
763 | Sets the boolean value for the token specified by TokenNumber\r | |
764 | to the value specified by Value.\r | |
765 | \r | |
766 | If Guid is NULL, then ASSERT().\r | |
767 | \r | |
768 | @param[in] Guid The pointer to a 128-bit unique value that\r | |
769 | designates which namespace to set a value from.\r | |
770 | @param[in] TokenNumber The PCD token number to set a current value for.\r | |
771 | @param[in] Value The boolean value to set.\r | |
772 | \r | |
773 | @return The status of the set operation.\r | |
774 | \r | |
775 | **/\r | |
776 | RETURN_STATUS\r | |
777 | EFIAPI\r | |
778 | LibPcdSetExBoolS (\r | |
779 | IN CONST GUID *Guid,\r | |
780 | IN UINTN TokenNumber,\r | |
781 | IN BOOLEAN Value\r | |
782 | )\r | |
783 | {\r | |
784 | ASSERT (Guid != NULL);\r | |
785 | \r | |
786 | return GetPiPcdProtocol ()->SetBool (Guid, TokenNumber, Value);\r | |
787 | }\r | |
788 | \r | |
789 | /**\r | |
790 | Set up a notification function that is called when a specified token is set.\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 The 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 | **/\r | |
805 | VOID\r | |
806 | EFIAPI\r | |
807 | LibPcdCallbackOnSet (\r | |
808 | IN CONST GUID *Guid OPTIONAL,\r | |
809 | IN UINTN TokenNumber,\r | |
810 | IN PCD_CALLBACK NotificationFunction\r | |
811 | )\r | |
812 | {\r | |
813 | EFI_STATUS Status;\r | |
814 | \r | |
815 | ASSERT (NotificationFunction != NULL);\r | |
816 | \r | |
817 | Status = GetPiPcdProtocol ()->CallbackOnSet (Guid, TokenNumber, (EFI_PCD_PROTOCOL_CALLBACK)NotificationFunction);\r | |
818 | ASSERT_EFI_ERROR (Status);\r | |
819 | \r | |
820 | return;\r | |
821 | }\r | |
822 | \r | |
823 | /**\r | |
824 | Disable a notification function that was established with LibPcdCallbackonSet().\r | |
825 | \r | |
826 | Disable a notification function that was previously established with LibPcdCallbackOnSet().\r | |
827 | If NotificationFunction is NULL, then ASSERT().\r | |
828 | If LibPcdCallbackOnSet() was not previously called with Guid, TokenNumber,\r | |
829 | and NotificationFunction, then ASSERT().\r | |
830 | \r | |
831 | @param[in] Guid Specify the GUID token space.\r | |
832 | @param[in] TokenNumber Specify the token number.\r | |
833 | @param[in] NotificationFunction The callback function to be unregistered.\r | |
834 | \r | |
835 | **/\r | |
836 | VOID\r | |
837 | EFIAPI\r | |
838 | LibPcdCancelCallback (\r | |
839 | IN CONST GUID *Guid OPTIONAL,\r | |
840 | IN UINTN TokenNumber,\r | |
841 | IN PCD_CALLBACK NotificationFunction\r | |
842 | )\r | |
843 | {\r | |
844 | EFI_STATUS Status;\r | |
845 | \r | |
846 | ASSERT (NotificationFunction != NULL);\r | |
847 | \r | |
848 | Status = GetPiPcdProtocol ()->CancelCallback (Guid, TokenNumber, (EFI_PCD_PROTOCOL_CALLBACK)NotificationFunction);\r | |
849 | ASSERT_EFI_ERROR (Status);\r | |
850 | \r | |
851 | return;\r | |
852 | }\r | |
853 | \r | |
854 | /**\r | |
855 | Retrieves the next token in a token space.\r | |
856 | \r | |
857 | Retrieves the next PCD token number from the token space specified by Guid.\r | |
858 | If Guid is NULL, then the default token space is used. If TokenNumber is 0,\r | |
859 | then the first token number is returned. Otherwise, the token number that\r | |
860 | follows TokenNumber in the token space is returned. If TokenNumber is the last\r | |
861 | token number in the token space, then 0 is returned.\r | |
862 | \r | |
863 | If TokenNumber is not 0 and is not in the token space specified by Guid, then ASSERT().\r | |
864 | \r | |
865 | @param[in] Guid The pointer to a 128-bit unique value that designates which namespace\r | |
866 | to set a value from. If NULL, then the default token space is used.\r | |
867 | @param[in] TokenNumber The previous PCD token number. If 0, then retrieves the first PCD\r | |
868 | token number.\r | |
869 | \r | |
870 | @return The next valid token number.\r | |
871 | \r | |
872 | **/\r | |
873 | UINTN\r | |
874 | EFIAPI\r | |
875 | LibPcdGetNextToken (\r | |
876 | IN CONST GUID *Guid OPTIONAL,\r | |
877 | IN UINTN TokenNumber\r | |
878 | )\r | |
879 | {\r | |
880 | EFI_STATUS Status;\r | |
881 | \r | |
882 | Status = GetPiPcdProtocol ()->GetNextToken (Guid, &TokenNumber);\r | |
883 | ASSERT (!EFI_ERROR (Status) || TokenNumber == 0);\r | |
884 | \r | |
885 | return TokenNumber;\r | |
886 | }\r | |
887 | \r | |
888 | /**\r | |
889 | Used to retrieve the list of available PCD token space GUIDs.\r | |
890 | \r | |
891 | Returns the PCD token space GUID that follows TokenSpaceGuid in the list of token spaces\r | |
892 | in the platform.\r | |
893 | If TokenSpaceGuid is NULL, then a pointer to the first PCD token spaces returned.\r | |
894 | If TokenSpaceGuid is the last PCD token space GUID in the list, then NULL is returned.\r | |
895 | \r | |
896 | @param TokenSpaceGuid The pointer to the a PCD token space GUID.\r | |
897 | \r | |
898 | @return The next valid token namespace.\r | |
899 | \r | |
900 | **/\r | |
901 | GUID *\r | |
902 | EFIAPI\r | |
903 | LibPcdGetNextTokenSpace (\r | |
904 | IN CONST GUID *TokenSpaceGuid\r | |
905 | )\r | |
906 | {\r | |
907 | GetPiPcdProtocol ()->GetNextTokenSpace (&TokenSpaceGuid);\r | |
908 | \r | |
909 | return (GUID *)TokenSpaceGuid;\r | |
910 | }\r | |
911 | \r | |
912 | /**\r | |
913 | Sets a value of a patchable PCD entry that is type pointer.\r | |
914 | \r | |
915 | Sets the PCD entry specified by PatchVariable to the value specified by Buffer\r | |
916 | and SizeOfBuffer. Buffer is returned. If SizeOfBuffer is greater than\r | |
917 | MaximumDatumSize, then set SizeOfBuffer to MaximumDatumSize and return\r | |
918 | NULL to indicate that the set operation was not actually performed.\r | |
919 | If SizeOfBuffer is set to MAX_ADDRESS, then SizeOfBuffer must be set to\r | |
920 | MaximumDatumSize and NULL must be returned.\r | |
921 | \r | |
922 | If PatchVariable is NULL, then ASSERT().\r | |
923 | If SizeOfBuffer is NULL, then ASSERT().\r | |
924 | If SizeOfBuffer > 0 and Buffer is NULL, then ASSERT().\r | |
925 | \r | |
926 | @param[out] PatchVariable A pointer to the global variable in a module that is\r | |
927 | the target of the set operation.\r | |
928 | @param[in] MaximumDatumSize The maximum size allowed for the PCD entry specified by PatchVariable.\r | |
929 | @param[in, out] SizeOfBuffer A pointer to the size, in bytes, of Buffer.\r | |
930 | @param[in] Buffer A pointer to the buffer to used to set the target variable.\r | |
931 | \r | |
932 | @return Return the pointer to the buffer been set.\r | |
933 | \r | |
934 | **/\r | |
935 | VOID *\r | |
936 | EFIAPI\r | |
937 | LibPatchPcdSetPtr (\r | |
938 | OUT VOID *PatchVariable,\r | |
939 | IN UINTN MaximumDatumSize,\r | |
940 | IN OUT UINTN *SizeOfBuffer,\r | |
941 | IN CONST VOID *Buffer\r | |
942 | )\r | |
943 | {\r | |
944 | ASSERT (PatchVariable != NULL);\r | |
945 | ASSERT (SizeOfBuffer != NULL);\r | |
946 | \r | |
947 | if (*SizeOfBuffer > 0) {\r | |
948 | ASSERT (Buffer != NULL);\r | |
949 | }\r | |
950 | \r | |
951 | if ((*SizeOfBuffer > MaximumDatumSize) ||\r | |
952 | (*SizeOfBuffer == MAX_ADDRESS))\r | |
953 | {\r | |
954 | *SizeOfBuffer = MaximumDatumSize;\r | |
955 | return NULL;\r | |
956 | }\r | |
957 | \r | |
958 | CopyMem (PatchVariable, Buffer, *SizeOfBuffer);\r | |
959 | \r | |
960 | return (VOID *)Buffer;\r | |
961 | }\r | |
962 | \r | |
963 | /**\r | |
964 | Sets a value of a patchable PCD entry that is type pointer.\r | |
965 | \r | |
966 | Sets the PCD entry specified by PatchVariable to the value specified\r | |
967 | by Buffer and SizeOfBuffer. If SizeOfBuffer is greater than MaximumDatumSize,\r | |
968 | then set SizeOfBuffer to MaximumDatumSize and return RETURN_INVALID_PARAMETER\r | |
969 | to indicate that the set operation was not actually performed.\r | |
970 | If SizeOfBuffer is set to MAX_ADDRESS, then SizeOfBuffer must be set to\r | |
971 | MaximumDatumSize and RETURN_INVALID_PARAMETER must be returned.\r | |
972 | \r | |
973 | If PatchVariable is NULL, then ASSERT().\r | |
974 | If SizeOfBuffer is NULL, then ASSERT().\r | |
975 | If SizeOfBuffer > 0 and Buffer is NULL, then ASSERT().\r | |
976 | \r | |
977 | @param[out] PatchVariable A pointer to the global variable in a module that is\r | |
978 | the target of the set operation.\r | |
979 | @param[in] MaximumDatumSize The maximum size allowed for the PCD entry specified by PatchVariable.\r | |
980 | @param[in, out] SizeOfBuffer A pointer to the size, in bytes, of Buffer.\r | |
981 | @param[in] Buffer A pointer to the buffer to used to set the target variable.\r | |
982 | \r | |
983 | @return The status of the set operation.\r | |
984 | \r | |
985 | **/\r | |
986 | RETURN_STATUS\r | |
987 | EFIAPI\r | |
988 | LibPatchPcdSetPtrS (\r | |
989 | OUT VOID *PatchVariable,\r | |
990 | IN UINTN MaximumDatumSize,\r | |
991 | IN OUT UINTN *SizeOfBuffer,\r | |
992 | IN CONST VOID *Buffer\r | |
993 | )\r | |
994 | {\r | |
995 | ASSERT (PatchVariable != NULL);\r | |
996 | ASSERT (SizeOfBuffer != NULL);\r | |
997 | \r | |
998 | if (*SizeOfBuffer > 0) {\r | |
999 | ASSERT (Buffer != NULL);\r | |
1000 | }\r | |
1001 | \r | |
1002 | if ((*SizeOfBuffer > MaximumDatumSize) ||\r | |
1003 | (*SizeOfBuffer == MAX_ADDRESS))\r | |
1004 | {\r | |
1005 | *SizeOfBuffer = MaximumDatumSize;\r | |
1006 | return RETURN_INVALID_PARAMETER;\r | |
1007 | }\r | |
1008 | \r | |
1009 | CopyMem (PatchVariable, Buffer, *SizeOfBuffer);\r | |
1010 | \r | |
1011 | return RETURN_SUCCESS;\r | |
1012 | }\r | |
1013 | \r | |
1014 | /**\r | |
1015 | Sets a value and size of a patchable PCD entry that is type pointer.\r | |
1016 | \r | |
1017 | Sets the PCD entry specified by PatchVariable to the value specified by Buffer\r | |
1018 | and SizeOfBuffer. Buffer is returned. If SizeOfBuffer is greater than\r | |
1019 | MaximumDatumSize, then set SizeOfBuffer to MaximumDatumSize and return\r | |
1020 | NULL to indicate that the set operation was not actually performed.\r | |
1021 | If SizeOfBuffer is set to MAX_ADDRESS, then SizeOfBuffer must be set to\r | |
1022 | MaximumDatumSize and NULL must be returned.\r | |
1023 | \r | |
1024 | If PatchVariable is NULL, then ASSERT().\r | |
1025 | If SizeOfPatchVariable is NULL, then ASSERT().\r | |
1026 | If SizeOfBuffer is NULL, then ASSERT().\r | |
1027 | If SizeOfBuffer > 0 and Buffer is NULL, then ASSERT().\r | |
1028 | \r | |
1029 | @param[out] PatchVariable A pointer to the global variable in a module that is\r | |
1030 | the target of the set operation.\r | |
1031 | @param[out] SizeOfPatchVariable A pointer to the size, in bytes, of PatchVariable.\r | |
1032 | @param[in] MaximumDatumSize The maximum size allowed for the PCD entry specified by PatchVariable.\r | |
1033 | @param[in, out] SizeOfBuffer A pointer to the size, in bytes, of Buffer.\r | |
1034 | @param[in] Buffer A pointer to the buffer to used to set the target variable.\r | |
1035 | \r | |
1036 | @return Return the pointer to the buffer been set.\r | |
1037 | \r | |
1038 | **/\r | |
1039 | VOID *\r | |
1040 | EFIAPI\r | |
1041 | LibPatchPcdSetPtrAndSize (\r | |
1042 | OUT VOID *PatchVariable,\r | |
1043 | OUT UINTN *SizeOfPatchVariable,\r | |
1044 | IN UINTN MaximumDatumSize,\r | |
1045 | IN OUT UINTN *SizeOfBuffer,\r | |
1046 | IN CONST VOID *Buffer\r | |
1047 | )\r | |
1048 | {\r | |
1049 | ASSERT (PatchVariable != NULL);\r | |
1050 | ASSERT (SizeOfPatchVariable != NULL);\r | |
1051 | ASSERT (SizeOfBuffer != NULL);\r | |
1052 | \r | |
1053 | if (*SizeOfBuffer > 0) {\r | |
1054 | ASSERT (Buffer != NULL);\r | |
1055 | }\r | |
1056 | \r | |
1057 | if ((*SizeOfBuffer > MaximumDatumSize) ||\r | |
1058 | (*SizeOfBuffer == MAX_ADDRESS))\r | |
1059 | {\r | |
1060 | *SizeOfBuffer = MaximumDatumSize;\r | |
1061 | return NULL;\r | |
1062 | }\r | |
1063 | \r | |
1064 | CopyMem (PatchVariable, Buffer, *SizeOfBuffer);\r | |
1065 | *SizeOfPatchVariable = *SizeOfBuffer;\r | |
1066 | \r | |
1067 | return (VOID *)Buffer;\r | |
1068 | }\r | |
1069 | \r | |
1070 | /**\r | |
1071 | Sets a value and size of a patchable PCD entry that is type pointer.\r | |
1072 | \r | |
1073 | Sets the PCD entry specified by PatchVariable to the value specified\r | |
1074 | by Buffer and SizeOfBuffer. If SizeOfBuffer is greater than MaximumDatumSize,\r | |
1075 | then set SizeOfBuffer to MaximumDatumSize and return RETURN_INVALID_PARAMETER\r | |
1076 | to indicate that the set operation was not actually performed.\r | |
1077 | If SizeOfBuffer is set to MAX_ADDRESS, then SizeOfBuffer must be set to\r | |
1078 | MaximumDatumSize and RETURN_INVALID_PARAMETER must be returned.\r | |
1079 | \r | |
1080 | If PatchVariable is NULL, then ASSERT().\r | |
1081 | If SizeOfPatchVariable is NULL, then ASSERT().\r | |
1082 | If SizeOfBuffer is NULL, then ASSERT().\r | |
1083 | If SizeOfBuffer > 0 and Buffer is NULL, then ASSERT().\r | |
1084 | \r | |
1085 | @param[out] PatchVariable A pointer to the global variable in a module that is\r | |
1086 | the target of the set operation.\r | |
1087 | @param[out] SizeOfPatchVariable A pointer to the size, in bytes, of PatchVariable.\r | |
1088 | @param[in] MaximumDatumSize The maximum size allowed for the PCD entry specified by PatchVariable.\r | |
1089 | @param[in, out] SizeOfBuffer A pointer to the size, in bytes, of Buffer.\r | |
1090 | @param[in] Buffer A pointer to the buffer to used to set the target variable.\r | |
1091 | \r | |
1092 | @return The status of the set operation.\r | |
1093 | \r | |
1094 | **/\r | |
1095 | RETURN_STATUS\r | |
1096 | EFIAPI\r | |
1097 | LibPatchPcdSetPtrAndSizeS (\r | |
1098 | OUT VOID *PatchVariable,\r | |
1099 | OUT UINTN *SizeOfPatchVariable,\r | |
1100 | IN UINTN MaximumDatumSize,\r | |
1101 | IN OUT UINTN *SizeOfBuffer,\r | |
1102 | IN CONST VOID *Buffer\r | |
1103 | )\r | |
1104 | {\r | |
1105 | ASSERT (PatchVariable != NULL);\r | |
1106 | ASSERT (SizeOfPatchVariable != NULL);\r | |
1107 | ASSERT (SizeOfBuffer != NULL);\r | |
1108 | \r | |
1109 | if (*SizeOfBuffer > 0) {\r | |
1110 | ASSERT (Buffer != NULL);\r | |
1111 | }\r | |
1112 | \r | |
1113 | if ((*SizeOfBuffer > MaximumDatumSize) ||\r | |
1114 | (*SizeOfBuffer == MAX_ADDRESS))\r | |
1115 | {\r | |
1116 | *SizeOfBuffer = MaximumDatumSize;\r | |
1117 | return RETURN_INVALID_PARAMETER;\r | |
1118 | }\r | |
1119 | \r | |
1120 | CopyMem (PatchVariable, Buffer, *SizeOfBuffer);\r | |
1121 | *SizeOfPatchVariable = *SizeOfBuffer;\r | |
1122 | \r | |
1123 | return RETURN_SUCCESS;\r | |
1124 | }\r | |
1125 | \r | |
1126 | /**\r | |
1127 | Retrieve additional information associated with a PCD token.\r | |
1128 | \r | |
1129 | This includes information such as the type of value the TokenNumber is associated with as well as possible\r | |
1130 | human readable name that is associated with the token.\r | |
1131 | \r | |
1132 | If TokenNumber is not in the default token space specified, then ASSERT().\r | |
1133 | \r | |
1134 | @param[in] TokenNumber The PCD token number.\r | |
1135 | @param[out] PcdInfo The returned information associated with the requested TokenNumber.\r | |
1136 | The caller is responsible for freeing the buffer that is allocated by callee for PcdInfo->PcdName.\r | |
1137 | **/\r | |
1138 | VOID\r | |
1139 | EFIAPI\r | |
1140 | LibPcdGetInfo (\r | |
1141 | IN UINTN TokenNumber,\r | |
1142 | OUT PCD_INFO *PcdInfo\r | |
1143 | )\r | |
1144 | {\r | |
1145 | EFI_STATUS Status;\r | |
1146 | \r | |
1147 | Status = GetPcdInfoProtocolPointer ()->GetInfo (TokenNumber, (EFI_PCD_INFO *)PcdInfo);\r | |
1148 | ASSERT_EFI_ERROR (Status);\r | |
1149 | }\r | |
1150 | \r | |
1151 | /**\r | |
1152 | Retrieve additional information associated with a PCD token.\r | |
1153 | \r | |
1154 | This includes information such as the type of value the TokenNumber is associated with as well as possible\r | |
1155 | human readable name that is associated with the token.\r | |
1156 | \r | |
1157 | If TokenNumber is not in the token space specified by Guid, then ASSERT().\r | |
1158 | \r | |
1159 | @param[in] Guid The 128-bit unique value that designates the namespace from which to extract the value.\r | |
1160 | @param[in] TokenNumber The PCD token number.\r | |
1161 | @param[out] PcdInfo The returned information associated with the requested TokenNumber.\r | |
1162 | The caller is responsible for freeing the buffer that is allocated by callee for PcdInfo->PcdName.\r | |
1163 | **/\r | |
1164 | VOID\r | |
1165 | EFIAPI\r | |
1166 | LibPcdGetInfoEx (\r | |
1167 | IN CONST GUID *Guid,\r | |
1168 | IN UINTN TokenNumber,\r | |
1169 | OUT PCD_INFO *PcdInfo\r | |
1170 | )\r | |
1171 | {\r | |
1172 | EFI_STATUS Status;\r | |
1173 | \r | |
1174 | Status = GetPiPcdInfoProtocolPointer ()->GetInfo (Guid, TokenNumber, (EFI_PCD_INFO *)PcdInfo);\r | |
1175 | ASSERT_EFI_ERROR (Status);\r | |
1176 | }\r | |
1177 | \r | |
1178 | /**\r | |
1179 | Retrieve the currently set SKU Id.\r | |
1180 | \r | |
1181 | @return The currently set SKU Id. If the platform has not set at a SKU Id, then the\r | |
1182 | default SKU Id value of 0 is returned. If the platform has set a SKU Id, then the currently set SKU\r | |
1183 | Id is returned.\r | |
1184 | **/\r | |
1185 | UINTN\r | |
1186 | EFIAPI\r | |
1187 | LibPcdGetSku (\r | |
1188 | VOID\r | |
1189 | )\r | |
1190 | {\r | |
1191 | return GetPiPcdInfoProtocolPointer ()->GetSku ();\r | |
1192 | }\r |