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