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