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