]>
Commit | Line | Data |
---|---|---|
1 | /** @file\r | |
2 | Private functions used by PCD DXE driver.\r | |
3 | \r | |
4 | Copyright (c) 2006 - 2007, Intel Corporation\r | |
5 | All rights reserved. This program and the accompanying materials\r | |
6 | are licensed and made available under the terms and conditions of the BSD License\r | |
7 | which accompanies this distribution. The full text of the license may be found at\r | |
8 | http://opensource.org/licenses/bsd-license.php\r | |
9 | \r | |
10 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r | |
11 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r | |
12 | \r | |
13 | **/\r | |
14 | \r | |
15 | #ifndef _PCD_DXE_SERVICE_H_\r | |
16 | #define _PCD_DXE_SERVICE_H_\r | |
17 | \r | |
18 | #include <PiDxe.h>\r | |
19 | #include <Guid/PcdDataBaseHobGuid.h>\r | |
20 | #include <Protocol/Pcd.h>\r | |
21 | #include <Library/BaseLib.h>\r | |
22 | #include <Library/DebugLib.h>\r | |
23 | #include <Library/UefiLib.h>\r | |
24 | #include <Library/UefiDriverEntryPoint.h>\r | |
25 | #include <Library/PcdLib.h>\r | |
26 | #include <Library/HobLib.h>\r | |
27 | #include <Library/MemoryAllocationLib.h>\r | |
28 | #include <Library/UefiBootServicesTableLib.h>\r | |
29 | #include <Library/BaseMemoryLib.h>\r | |
30 | #include <Library/UefiRuntimeServicesTableLib.h>\r | |
31 | \r | |
32 | //\r | |
33 | // Protocol Interface function declaration.\r | |
34 | //\r | |
35 | /**\r | |
36 | Sets the SKU value for subsequent calls to set or get PCD token values.\r | |
37 | \r | |
38 | SetSku() sets the SKU Id to be used for subsequent calls to set or get PCD values. \r | |
39 | SetSku() is normally called only once by the system.\r | |
40 | \r | |
41 | For each item (token), the database can hold a single value that applies to all SKUs, \r | |
42 | or multiple values, where each value is associated with a specific SKU Id. Items with multiple, \r | |
43 | SKU-specific values are called SKU enabled. \r | |
44 | \r | |
45 | The SKU Id of zero is reserved as a default. The valid SkuId range is 1 to 255. \r | |
46 | For tokens that are not SKU enabled, the system ignores any set SKU Id and works with the \r | |
47 | single value for that token. For SKU-enabled tokens, the system will use the SKU Id set by the \r | |
48 | last call to SetSku(). If no SKU Id is set or the currently set SKU Id isn't valid for the specified token, \r | |
49 | the system uses the default SKU Id. If the system attempts to use the default SKU Id and no value has been \r | |
50 | set for that Id, the results are unpredictable.\r | |
51 | \r | |
52 | @param[in] SkuId The SKU value that will be used when the PCD service will retrieve and \r | |
53 | set values associated with a PCD token.\r | |
54 | \r | |
55 | **/\r | |
56 | VOID\r | |
57 | EFIAPI\r | |
58 | DxePcdSetSku (\r | |
59 | IN UINTN SkuId\r | |
60 | );\r | |
61 | \r | |
62 | /**\r | |
63 | Retrieves an 8-bit value for a given PCD token.\r | |
64 | \r | |
65 | Retrieves the current byte-sized value for a PCD token number. \r | |
66 | If the TokenNumber is invalid, the results are unpredictable.\r | |
67 | \r | |
68 | @param[in] TokenNumber The PCD token number. \r | |
69 | \r | |
70 | @return The UINT8 value.\r | |
71 | \r | |
72 | **/\r | |
73 | UINT8\r | |
74 | EFIAPI\r | |
75 | DxePcdGet8 (\r | |
76 | IN UINTN TokenNumber\r | |
77 | );\r | |
78 | \r | |
79 | /**\r | |
80 | Retrieves an 16-bit value for a given PCD token.\r | |
81 | \r | |
82 | Retrieves the current 16-bits value for a PCD token number. \r | |
83 | If the TokenNumber is invalid, the results are unpredictable.\r | |
84 | \r | |
85 | @param[in] TokenNumber The PCD token number. \r | |
86 | \r | |
87 | @return The UINT16 value.\r | |
88 | \r | |
89 | **/\r | |
90 | UINT16\r | |
91 | EFIAPI\r | |
92 | DxePcdGet16 (\r | |
93 | IN UINTN TokenNumber\r | |
94 | );\r | |
95 | \r | |
96 | /**\r | |
97 | Retrieves an 32-bit value for a given PCD token.\r | |
98 | \r | |
99 | Retrieves the current 32-bits value for a PCD token number. \r | |
100 | If the TokenNumber is invalid, the results are unpredictable.\r | |
101 | \r | |
102 | @param[in] TokenNumber The PCD token number. \r | |
103 | \r | |
104 | @return The UINT32 value.\r | |
105 | \r | |
106 | **/\r | |
107 | UINT32\r | |
108 | EFIAPI\r | |
109 | DxePcdGet32 (\r | |
110 | IN UINTN TokenNumber\r | |
111 | );\r | |
112 | \r | |
113 | /**\r | |
114 | Retrieves an 64-bit value for a given PCD token.\r | |
115 | \r | |
116 | Retrieves the current 64-bits value for a PCD token number. \r | |
117 | If the TokenNumber is invalid, the results are unpredictable.\r | |
118 | \r | |
119 | @param[in] TokenNumber The PCD token number. \r | |
120 | \r | |
121 | @return The UINT64 value.\r | |
122 | \r | |
123 | **/\r | |
124 | UINT64\r | |
125 | EFIAPI\r | |
126 | DxePcdGet64 (\r | |
127 | IN UINTN TokenNumber\r | |
128 | );\r | |
129 | \r | |
130 | /**\r | |
131 | Retrieves a pointer to a value for a given PCD token.\r | |
132 | \r | |
133 | Retrieves the current pointer to the buffer for a PCD token number. \r | |
134 | Do not make any assumptions about the alignment of the pointer that \r | |
135 | is returned by this function call. If the TokenNumber is invalid, \r | |
136 | the results are unpredictable.\r | |
137 | \r | |
138 | @param[in] TokenNumber The PCD token number. \r | |
139 | \r | |
140 | @return The pointer to the buffer to be retrieved.\r | |
141 | \r | |
142 | **/\r | |
143 | VOID *\r | |
144 | EFIAPI\r | |
145 | DxePcdGetPtr (\r | |
146 | IN UINTN TokenNumber\r | |
147 | );\r | |
148 | \r | |
149 | /**\r | |
150 | Retrieves a Boolean value for a given PCD token.\r | |
151 | \r | |
152 | Retrieves the current boolean value for a PCD token number. \r | |
153 | Do not make any assumptions about the alignment of the pointer that \r | |
154 | is returned by this function call. If the TokenNumber is invalid, \r | |
155 | the results are unpredictable.\r | |
156 | \r | |
157 | @param[in] TokenNumber The PCD token number. \r | |
158 | \r | |
159 | @return The Boolean value.\r | |
160 | \r | |
161 | **/\r | |
162 | BOOLEAN\r | |
163 | EFIAPI\r | |
164 | DxePcdGetBool (\r | |
165 | IN UINTN TokenNumber\r | |
166 | );\r | |
167 | \r | |
168 | /**\r | |
169 | Retrieves the size of the value for a given PCD token.\r | |
170 | \r | |
171 | Retrieves the current size of a particular PCD token. \r | |
172 | If the TokenNumber is invalid, the results are unpredictable.\r | |
173 | \r | |
174 | @param[in] TokenNumber The PCD token number. \r | |
175 | \r | |
176 | @return The size of the value for the PCD token.\r | |
177 | \r | |
178 | **/\r | |
179 | UINTN\r | |
180 | EFIAPI\r | |
181 | DxePcdGetSize (\r | |
182 | IN UINTN TokenNumber\r | |
183 | );\r | |
184 | \r | |
185 | /**\r | |
186 | Retrieves an 8-bit value for a given PCD token.\r | |
187 | \r | |
188 | Retrieves the 8-bit value of a particular PCD token. \r | |
189 | If the TokenNumber is invalid or the token space\r | |
190 | specified by Guid does not exist, the results are \r | |
191 | unpredictable.\r | |
192 | \r | |
193 | @param[in] Guid The token space for the token number.\r | |
194 | @param[in] TokenNumber The PCD token number. \r | |
195 | \r | |
196 | @return The size 8-bit value for the PCD token.\r | |
197 | \r | |
198 | **/\r | |
199 | UINT8\r | |
200 | EFIAPI\r | |
201 | DxePcdGet8Ex (\r | |
202 | IN CONST EFI_GUID *Guid,\r | |
203 | IN UINTN TokenNumber\r | |
204 | );\r | |
205 | \r | |
206 | /**\r | |
207 | Retrieves an 16-bit value for a given PCD token.\r | |
208 | \r | |
209 | Retrieves the 16-bit value of a particular PCD token. \r | |
210 | If the TokenNumber is invalid or the token space\r | |
211 | specified by Guid does not exist, the results are \r | |
212 | unpredictable.\r | |
213 | \r | |
214 | @param[in] Guid The token space for the token number.\r | |
215 | @param[in] TokenNumber The PCD token number. \r | |
216 | \r | |
217 | @return The size 16-bit value for the PCD token.\r | |
218 | \r | |
219 | **/\r | |
220 | UINT16\r | |
221 | EFIAPI\r | |
222 | DxePcdGet16Ex (\r | |
223 | IN CONST EFI_GUID *Guid,\r | |
224 | IN UINTN TokenNumber\r | |
225 | );\r | |
226 | \r | |
227 | /**\r | |
228 | Retrieves an 32-bit value for a given PCD token.\r | |
229 | \r | |
230 | Retrieves the 32-bit value of a particular PCD token. \r | |
231 | If the TokenNumber is invalid or the token space\r | |
232 | specified by Guid does not exist, the results are \r | |
233 | unpredictable.\r | |
234 | \r | |
235 | @param[in] Guid The token space for the token number.\r | |
236 | @param[in] TokenNumber The PCD token number. \r | |
237 | \r | |
238 | @return The size 32-bit value for the PCD token.\r | |
239 | \r | |
240 | **/\r | |
241 | UINT32\r | |
242 | EFIAPI\r | |
243 | DxePcdGet32Ex (\r | |
244 | IN CONST EFI_GUID *Guid,\r | |
245 | IN UINTN TokenNumber\r | |
246 | );\r | |
247 | \r | |
248 | /**\r | |
249 | Retrieves an 64-bit value for a given PCD token.\r | |
250 | \r | |
251 | Retrieves the 64-bit value of a particular PCD token. \r | |
252 | If the TokenNumber is invalid or the token space\r | |
253 | specified by Guid does not exist, the results are \r | |
254 | unpredictable.\r | |
255 | \r | |
256 | @param[in] Guid The token space for the token number.\r | |
257 | @param[in] TokenNumber The PCD token number. \r | |
258 | \r | |
259 | @return The size 64-bit value for the PCD token.\r | |
260 | \r | |
261 | **/\r | |
262 | UINT64\r | |
263 | EFIAPI\r | |
264 | DxePcdGet64Ex (\r | |
265 | IN CONST EFI_GUID *Guid,\r | |
266 | IN UINTN TokenNumber\r | |
267 | );\r | |
268 | \r | |
269 | /**\r | |
270 | Retrieves a pointer to a value for a given PCD token.\r | |
271 | \r | |
272 | Retrieves the current pointer to the buffer for a PCD token number. \r | |
273 | Do not make any assumptions about the alignment of the pointer that \r | |
274 | is returned by this function call. If the TokenNumber is invalid, \r | |
275 | the results are unpredictable.\r | |
276 | \r | |
277 | @param[in] Guid The token space for the token number.\r | |
278 | @param[in] TokenNumber The PCD token number. \r | |
279 | \r | |
280 | @return The pointer to the buffer to be retrieved.\r | |
281 | \r | |
282 | **/\r | |
283 | VOID *\r | |
284 | EFIAPI\r | |
285 | DxePcdGetPtrEx (\r | |
286 | IN CONST EFI_GUID *Guid,\r | |
287 | IN UINTN TokenNumber\r | |
288 | );\r | |
289 | \r | |
290 | /**\r | |
291 | Retrieves an Boolean value for a given PCD token.\r | |
292 | \r | |
293 | Retrieves the Boolean value of a particular PCD token. \r | |
294 | If the TokenNumber is invalid or the token space\r | |
295 | specified by Guid does not exist, the results are \r | |
296 | unpredictable.\r | |
297 | \r | |
298 | @param[in] Guid The token space for the token number.\r | |
299 | @param[in] TokenNumber The PCD token number. \r | |
300 | \r | |
301 | @return The size Boolean value for the PCD token.\r | |
302 | \r | |
303 | **/\r | |
304 | BOOLEAN\r | |
305 | EFIAPI\r | |
306 | DxePcdGetBoolEx (\r | |
307 | IN CONST EFI_GUID *Guid,\r | |
308 | IN UINTN TokenNumber\r | |
309 | );\r | |
310 | \r | |
311 | /**\r | |
312 | Retrieves the size of the value for a given PCD token.\r | |
313 | \r | |
314 | Retrieves the current size of a particular PCD token. \r | |
315 | If the TokenNumber is invalid, the results are unpredictable.\r | |
316 | \r | |
317 | @param[in] Guid The token space for the token number.\r | |
318 | @param[in] TokenNumber The PCD token number. \r | |
319 | \r | |
320 | @return The size of the value for the PCD token.\r | |
321 | \r | |
322 | **/\r | |
323 | UINTN\r | |
324 | EFIAPI\r | |
325 | DxePcdGetSizeEx (\r | |
326 | IN CONST EFI_GUID *Guid,\r | |
327 | IN UINTN TokenNumber\r | |
328 | );\r | |
329 | \r | |
330 | /**\r | |
331 | Sets an 8-bit value for a given PCD token.\r | |
332 | \r | |
333 | When the PCD service sets a value, it will check to ensure that the \r | |
334 | size of the value being set is compatible with the Token's existing definition. \r | |
335 | If it is not, an error will be returned.\r | |
336 | \r | |
337 | @param[in] TokenNumber The PCD token number. \r | |
338 | @param[in] Value The value to set for the PCD token.\r | |
339 | \r | |
340 | @retval EFI_SUCCESS Procedure returned successfully.\r | |
341 | @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data \r | |
342 | being set was incompatible with a call to this function. \r | |
343 | Use GetSize() to retrieve the size of the target data.\r | |
344 | @retval EFI_NOT_FOUND The PCD service could not find the requested token number.\r | |
345 | \r | |
346 | **/\r | |
347 | EFI_STATUS\r | |
348 | EFIAPI\r | |
349 | DxePcdSet8 (\r | |
350 | IN UINTN TokenNumber,\r | |
351 | IN UINT8 Value\r | |
352 | );\r | |
353 | \r | |
354 | /**\r | |
355 | Sets an 16-bit value for a given PCD token.\r | |
356 | \r | |
357 | When the PCD service sets a value, it will check to ensure that the \r | |
358 | size of the value being set is compatible with the Token's existing definition. \r | |
359 | If it is not, an error will be returned.\r | |
360 | \r | |
361 | @param[in] TokenNumber The PCD token number. \r | |
362 | @param[in] Value The value to set for the PCD token.\r | |
363 | \r | |
364 | @retval EFI_SUCCESS Procedure returned successfully.\r | |
365 | @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data \r | |
366 | being set was incompatible with a call to this function. \r | |
367 | Use GetSize() to retrieve the size of the target data.\r | |
368 | @retval EFI_NOT_FOUND The PCD service could not find the requested token number.\r | |
369 | \r | |
370 | **/\r | |
371 | EFI_STATUS\r | |
372 | EFIAPI\r | |
373 | DxePcdSet16 (\r | |
374 | IN UINTN TokenNumber,\r | |
375 | IN UINT16 Value\r | |
376 | );\r | |
377 | \r | |
378 | /**\r | |
379 | Sets an 32-bit value for a given PCD token.\r | |
380 | \r | |
381 | When the PCD service sets a value, it will check to ensure that the \r | |
382 | size of the value being set is compatible with the Token's existing definition. \r | |
383 | If it is not, an error will be returned.\r | |
384 | \r | |
385 | @param[in] TokenNumber The PCD token number. \r | |
386 | @param[in] Value The value to set for the PCD token.\r | |
387 | \r | |
388 | @retval EFI_SUCCESS Procedure returned successfully.\r | |
389 | @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data \r | |
390 | being set was incompatible with a call to this function. \r | |
391 | Use GetSize() to retrieve the size of the target data.\r | |
392 | @retval EFI_NOT_FOUND The PCD service could not find the requested token number.\r | |
393 | \r | |
394 | **/\r | |
395 | EFI_STATUS\r | |
396 | EFIAPI\r | |
397 | DxePcdSet32 (\r | |
398 | IN UINTN TokenNumber,\r | |
399 | IN UINT32 Value\r | |
400 | );\r | |
401 | \r | |
402 | /**\r | |
403 | Sets an 64-bit value for a given PCD token.\r | |
404 | \r | |
405 | When the PCD service sets a value, it will check to ensure that the \r | |
406 | size of the value being set is compatible with the Token's existing definition. \r | |
407 | If it is not, an error will be returned.\r | |
408 | \r | |
409 | @param[in] TokenNumber The PCD token number. \r | |
410 | @param[in] Value The value to set for the PCD token.\r | |
411 | \r | |
412 | @retval EFI_SUCCESS Procedure returned successfully.\r | |
413 | @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data \r | |
414 | being set was incompatible with a call to this function. \r | |
415 | Use GetSize() to retrieve the size of the target data.\r | |
416 | @retval EFI_NOT_FOUND The PCD service could not find the requested token number.\r | |
417 | \r | |
418 | **/\r | |
419 | EFI_STATUS\r | |
420 | EFIAPI\r | |
421 | DxePcdSet64 (\r | |
422 | IN UINTN TokenNumber,\r | |
423 | IN UINT64 Value\r | |
424 | );\r | |
425 | \r | |
426 | \r | |
427 | /**\r | |
428 | Sets a value of a specified size for a given PCD token.\r | |
429 | \r | |
430 | When the PCD service sets a value, it will check to ensure that the \r | |
431 | size of the value being set is compatible with the Token's existing definition. \r | |
432 | If it is not, an error will be returned.\r | |
433 | \r | |
434 | @param[in] TokenNumber The PCD token number. \r | |
435 | @param[in, out] SizeOfBuffer A pointer to the length of the value being set for the PCD token. \r | |
436 | On input, if the SizeOfValue is greater than the maximum size supported \r | |
437 | for this TokenNumber then the output value of SizeOfValue will reflect \r | |
438 | the maximum size supported for this TokenNumber.\r | |
439 | @param[in] Buffer The buffer to set for the PCD token.\r | |
440 | \r | |
441 | @retval EFI_SUCCESS Procedure returned successfully.\r | |
442 | @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data \r | |
443 | being set was incompatible with a call to this function. \r | |
444 | Use GetSize() to retrieve the size of the target data.\r | |
445 | @retval EFI_NOT_FOUND The PCD service could not find the requested token number.\r | |
446 | \r | |
447 | **/\r | |
448 | EFI_STATUS\r | |
449 | EFIAPI\r | |
450 | DxePcdSetPtr (\r | |
451 | IN UINTN TokenNumber,\r | |
452 | IN OUT UINTN *SizeOfBuffer,\r | |
453 | IN VOID *Buffer\r | |
454 | );\r | |
455 | \r | |
456 | /**\r | |
457 | Sets an Boolean value for a given PCD token.\r | |
458 | \r | |
459 | When the PCD service sets a value, it will check to ensure that the \r | |
460 | size of the value being set is compatible with the Token's existing definition. \r | |
461 | If it is not, an error will be returned.\r | |
462 | \r | |
463 | @param[in] TokenNumber The PCD token number. \r | |
464 | @param[in] Value The value to set for the PCD token.\r | |
465 | \r | |
466 | @retval EFI_SUCCESS Procedure returned successfully.\r | |
467 | @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data \r | |
468 | being set was incompatible with a call to this function. \r | |
469 | Use GetSize() to retrieve the size of the target data.\r | |
470 | @retval EFI_NOT_FOUND The PCD service could not find the requested token number.\r | |
471 | \r | |
472 | **/\r | |
473 | EFI_STATUS\r | |
474 | EFIAPI\r | |
475 | DxePcdSetBool (\r | |
476 | IN UINTN TokenNumber,\r | |
477 | IN BOOLEAN Value\r | |
478 | );\r | |
479 | \r | |
480 | \r | |
481 | /**\r | |
482 | Sets an 8-bit value for a given PCD token.\r | |
483 | \r | |
484 | When the PCD service sets a value, it will check to ensure that the \r | |
485 | size of the value being set is compatible with the Token's existing definition. \r | |
486 | If it is not, an error will be returned.\r | |
487 | \r | |
488 | @param[in] Guid The 128-bit unique value that designates the namespace from which to extract the value.\r | |
489 | @param[in] TokenNumber The PCD token number. \r | |
490 | @param[in] Value The value to set for the PCD token.\r | |
491 | \r | |
492 | @retval EFI_SUCCESS Procedure returned successfully.\r | |
493 | @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data \r | |
494 | being set was incompatible with a call to this function. \r | |
495 | Use GetSize() to retrieve the size of the target data.\r | |
496 | @retval EFI_NOT_FOUND The PCD service could not find the requested token number.\r | |
497 | \r | |
498 | **/\r | |
499 | EFI_STATUS\r | |
500 | EFIAPI\r | |
501 | DxePcdSet8Ex (\r | |
502 | IN CONST EFI_GUID *Guid,\r | |
503 | IN UINTN TokenNumber,\r | |
504 | IN UINT8 Value\r | |
505 | );\r | |
506 | \r | |
507 | /**\r | |
508 | Sets an 16-bit value for a given PCD token.\r | |
509 | \r | |
510 | When the PCD service sets a value, it will check to ensure that the \r | |
511 | size of the value being set is compatible with the Token's existing definition. \r | |
512 | If it is not, an error will be returned.\r | |
513 | \r | |
514 | @param[in] Guid The 128-bit unique value that designates the namespace from which to extract the value.\r | |
515 | @param[in] TokenNumber The PCD token number. \r | |
516 | @param[in] Value The value to set for the PCD token.\r | |
517 | \r | |
518 | @retval EFI_SUCCESS Procedure returned successfully.\r | |
519 | @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data \r | |
520 | being set was incompatible with a call to this function. \r | |
521 | Use GetSize() to retrieve the size of the target data.\r | |
522 | @retval EFI_NOT_FOUND The PCD service could not find the requested token number.\r | |
523 | \r | |
524 | **/\r | |
525 | EFI_STATUS\r | |
526 | EFIAPI\r | |
527 | DxePcdSet16Ex (\r | |
528 | IN CONST EFI_GUID *Guid,\r | |
529 | IN UINTN TokenNumber,\r | |
530 | IN UINT16 Value\r | |
531 | );\r | |
532 | \r | |
533 | /**\r | |
534 | Sets an 32-bit value for a given PCD token.\r | |
535 | \r | |
536 | When the PCD service sets a value, it will check to ensure that the \r | |
537 | size of the value being set is compatible with the Token's existing definition. \r | |
538 | If it is not, an error will be returned.\r | |
539 | \r | |
540 | @param[in] Guid The 128-bit unique value that designates the namespace from which to extract the value.\r | |
541 | @param[in] TokenNumber The PCD token number. \r | |
542 | @param[in] Value The value to set for the PCD token.\r | |
543 | \r | |
544 | @retval EFI_SUCCESS Procedure returned successfully.\r | |
545 | @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data \r | |
546 | being set was incompatible with a call to this function. \r | |
547 | Use GetSize() to retrieve the size of the target data.\r | |
548 | @retval EFI_NOT_FOUND The PCD service could not find the requested token number.\r | |
549 | \r | |
550 | **/\r | |
551 | EFI_STATUS\r | |
552 | EFIAPI\r | |
553 | DxePcdSet32Ex (\r | |
554 | IN CONST EFI_GUID *Guid,\r | |
555 | IN UINTN TokenNumber,\r | |
556 | IN UINT32 Value\r | |
557 | );\r | |
558 | \r | |
559 | /**\r | |
560 | Sets an 64-bit value for a given PCD token.\r | |
561 | \r | |
562 | When the PCD service sets a value, it will check to ensure that the \r | |
563 | size of the value being set is compatible with the Token's existing definition. \r | |
564 | If it is not, an error will be returned.\r | |
565 | \r | |
566 | @param[in] Guid The 128-bit unique value that designates the namespace from which to extract the value.\r | |
567 | @param[in] TokenNumber The PCD token number. \r | |
568 | @param[in] Value The value to set for the PCD token.\r | |
569 | \r | |
570 | @retval EFI_SUCCESS Procedure returned successfully.\r | |
571 | @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data \r | |
572 | being set was incompatible with a call to this function. \r | |
573 | Use GetSize() to retrieve the size of the target data.\r | |
574 | @retval EFI_NOT_FOUND The PCD service could not find the requested token number.\r | |
575 | \r | |
576 | **/\r | |
577 | EFI_STATUS\r | |
578 | EFIAPI\r | |
579 | DxePcdSet64Ex (\r | |
580 | IN CONST EFI_GUID *Guid,\r | |
581 | IN UINTN TokenNumber,\r | |
582 | IN UINT64 Value\r | |
583 | );\r | |
584 | \r | |
585 | /**\r | |
586 | Sets a value of a specified size for a given PCD token.\r | |
587 | \r | |
588 | When the PCD service sets a value, it will check to ensure that the \r | |
589 | size of the value being set is compatible with the Token's existing definition. \r | |
590 | If it is not, an error will be returned.\r | |
591 | \r | |
592 | @param[in] Guid The 128-bit unique value that designates the namespace from which to extract the value.\r | |
593 | @param[in] TokenNumber The PCD token number. \r | |
594 | @param[in, out] SizeOfBuffer A pointer to the length of the value being set for the PCD token. \r | |
595 | On input, if the SizeOfValue is greater than the maximum size supported \r | |
596 | for this TokenNumber then the output value of SizeOfValue will reflect \r | |
597 | the maximum size supported for this TokenNumber.\r | |
598 | @param[in] Buffer The buffer to set for the PCD token.\r | |
599 | \r | |
600 | @retval EFI_SUCCESS Procedure returned successfully.\r | |
601 | @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data \r | |
602 | being set was incompatible with a call to this function. \r | |
603 | Use GetSize() to retrieve the size of the target data.\r | |
604 | @retval EFI_NOT_FOUND The PCD service could not find the requested token number.\r | |
605 | \r | |
606 | **/\r | |
607 | EFI_STATUS\r | |
608 | EFIAPI\r | |
609 | DxePcdSetPtrEx (\r | |
610 | IN CONST EFI_GUID *Guid,\r | |
611 | IN UINTN TokenNumber,\r | |
612 | IN OUT UINTN *SizeOfBuffer,\r | |
613 | IN VOID *Buffer\r | |
614 | );\r | |
615 | \r | |
616 | /**\r | |
617 | Sets an Boolean value for a given PCD token.\r | |
618 | \r | |
619 | When the PCD service sets a value, it will check to ensure that the \r | |
620 | size of the value being set is compatible with the Token's existing definition. \r | |
621 | If it is not, an error will be returned.\r | |
622 | \r | |
623 | @param[in] Guid The 128-bit unique value that designates the namespace from which to extract the value.\r | |
624 | @param[in] TokenNumber The PCD token number. \r | |
625 | @param[in] Value The value to set for the PCD token.\r | |
626 | \r | |
627 | @retval EFI_SUCCESS Procedure returned successfully.\r | |
628 | @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data \r | |
629 | being set was incompatible with a call to this function. \r | |
630 | Use GetSize() to retrieve the size of the target data.\r | |
631 | @retval EFI_NOT_FOUND The PCD service could not find the requested token number.\r | |
632 | \r | |
633 | **/\r | |
634 | EFI_STATUS\r | |
635 | EFIAPI\r | |
636 | DxePcdSetBoolEx (\r | |
637 | IN CONST EFI_GUID *Guid,\r | |
638 | IN UINTN TokenNumber,\r | |
639 | IN BOOLEAN Value\r | |
640 | );\r | |
641 | \r | |
642 | /**\r | |
643 | Specifies a function to be called anytime the value of a designated token is changed.\r | |
644 | \r | |
645 | @param[in] Guid The 128-bit unique value that designates the namespace from which to extract the value.\r | |
646 | @param[in] TokenNumber The PCD token number. \r | |
647 | @param[in] CallBackFunction The function prototype called when the value associated with the CallBackToken is set. \r | |
648 | \r | |
649 | @retval EFI_SUCCESS The PCD service has successfully established a call event \r | |
650 | for the CallBackToken requested.\r | |
651 | @retval EFI_NOT_FOUND The PCD service could not find the referenced token number.\r | |
652 | \r | |
653 | **/\r | |
654 | EFI_STATUS\r | |
655 | EFIAPI\r | |
656 | DxeRegisterCallBackOnSet (\r | |
657 | IN CONST EFI_GUID *Guid, OPTIONAL\r | |
658 | IN UINTN TokenNumber,\r | |
659 | IN PCD_PROTOCOL_CALLBACK CallBackFunction\r | |
660 | );\r | |
661 | \r | |
662 | /**\r | |
663 | Cancels a previously set callback function for a particular PCD token number.\r | |
664 | \r | |
665 | @param[in] Guid The 128-bit unique value that designates the namespace from which to extract the value.\r | |
666 | @param[in] TokenNumber The PCD token number. \r | |
667 | @param[in] CallBackFunction The function prototype called when the value associated with the CallBackToken is set. \r | |
668 | \r | |
669 | @retval EFI_SUCCESS The PCD service has successfully established a call event \r | |
670 | for the CallBackToken requested.\r | |
671 | @retval EFI_NOT_FOUND The PCD service could not find the referenced token number.\r | |
672 | \r | |
673 | **/\r | |
674 | EFI_STATUS\r | |
675 | EFIAPI\r | |
676 | DxeUnRegisterCallBackOnSet (\r | |
677 | IN CONST EFI_GUID *Guid, OPTIONAL\r | |
678 | IN UINTN TokenNumber,\r | |
679 | IN PCD_PROTOCOL_CALLBACK CallBackFunction\r | |
680 | );\r | |
681 | \r | |
682 | /**\r | |
683 | Retrieves the next valid PCD token for a given namespace.\r | |
684 | \r | |
685 | @param[in] Guid The 128-bit unique value that designates the namespace from which to extract the value.\r | |
686 | @param[in, out] TokenNumber A pointer to the PCD token number to use to find the subsequent token number. \r | |
687 | If the input token namespace or token number does not exist on the platform, \r | |
688 | an error is returned and the value of *TokenNumber is undefined. To retrieve the "first" token, \r | |
689 | have the pointer reference a TokenNumber value of 0. If the input token number is 0 and \r | |
690 | there is no valid token number for this token namespace, *TokenNumber will be assigned to \r | |
691 | 0 and the function return EFI_SUCCESS. If the token number is the last valid token number, \r | |
692 | *TokenNumber will be assigned to 0 and the function return EFI_SUCCESS.\r | |
693 | \r | |
694 | @retval EFI_SUCCESS The PCD service retrieved the next valid token number. Or the input token number \r | |
695 | is already the last valid token number in the PCD database. \r | |
696 | In the later case, *TokenNumber is updated with the value of 0.\r | |
697 | @retval EFI_NOT_FOUND If this input token number and token namespace does not exist on the platform.\r | |
698 | \r | |
699 | **/\r | |
700 | EFI_STATUS\r | |
701 | EFIAPI\r | |
702 | DxePcdGetNextToken (\r | |
703 | IN CONST EFI_GUID *Guid, OPTIONAL\r | |
704 | IN OUT UINTN *TokenNumber\r | |
705 | );\r | |
706 | \r | |
707 | /**\r | |
708 | Get next token space in PCD database according to given token space guid.\r | |
709 | \r | |
710 | This routine is enable only when feature flag PCD PcdDxePcdDatabaseTraverseEnabled \r | |
711 | is TRUE.\r | |
712 | \r | |
713 | @param Guid Given token space guid. If NULL, then Guid will be set to \r | |
714 | the first PCD token space in PCD database, If not NULL, then\r | |
715 | Guid will be set to next PCD token space.\r | |
716 | \r | |
717 | @retval EFI_UNSUPPORTED If feature flag PCD PcdDxePcdDatabaseTraverseEnabled is FALSE.\r | |
718 | @retval EFI_NOT_FOUND If PCD database has no token space table or can not find given\r | |
719 | token space in PCD database.\r | |
720 | @retval EFI_SUCCESS Success to get next token space guid.\r | |
721 | **/\r | |
722 | EFI_STATUS\r | |
723 | EFIAPI\r | |
724 | DxePcdGetNextTokenSpace (\r | |
725 | IN OUT CONST EFI_GUID **Guid\r | |
726 | );\r | |
727 | \r | |
728 | typedef struct {\r | |
729 | LIST_ENTRY Node;\r | |
730 | PCD_PROTOCOL_CALLBACK CallbackFn;\r | |
731 | } CALLBACK_FN_ENTRY;\r | |
732 | \r | |
733 | #define CR_FNENTRY_FROM_LISTNODE(Record, Type, Field) BASE_CR(Record, Type, Field)\r | |
734 | \r | |
735 | //\r | |
736 | // Internal Functions\r | |
737 | //\r | |
738 | \r | |
739 | /**\r | |
740 | Wrapper function for setting non-pointer type value for a PCD entry.\r | |
741 | \r | |
742 | @param TokenNumber Pcd token number autogenerated by build tools.\r | |
743 | @param Data Value want to be set for PCD entry\r | |
744 | @param Size Size of value.\r | |
745 | \r | |
746 | @return status of SetWorker.\r | |
747 | \r | |
748 | **/\r | |
749 | EFI_STATUS\r | |
750 | SetValueWorker (\r | |
751 | IN UINTN TokenNumber,\r | |
752 | IN VOID *Data,\r | |
753 | IN UINTN Size\r | |
754 | );\r | |
755 | \r | |
756 | /**\r | |
757 | Set value for an PCD entry\r | |
758 | \r | |
759 | @param TokenNumber Pcd token number autogenerated by build tools.\r | |
760 | @param Data Value want to be set for PCD entry\r | |
761 | @param Size Size of value.\r | |
762 | @param PtrType If TRUE, the type of PCD entry's value is Pointer.\r | |
763 | If False, the type of PCD entry's value is not Pointer.\r | |
764 | \r | |
765 | @retval EFI_INVALID_PARAMETER If this PCD type is VPD, VPD PCD can not be set.\r | |
766 | @retval EFI_INVALID_PARAMETER If Size can not be set to size table.\r | |
767 | @retval EFI_NOT_FOUND If value type of PCD entry is intergrate, but not in\r | |
768 | range of UINT8, UINT16, UINT32, UINT64\r | |
769 | @retval EFI_NOT_FOUND Can not find the PCD type according to token number. \r | |
770 | **/\r | |
771 | EFI_STATUS\r | |
772 | SetWorker (\r | |
773 | IN UINTN TokenNumber,\r | |
774 | IN VOID *Data,\r | |
775 | IN OUT UINTN *Size,\r | |
776 | IN BOOLEAN PtrType\r | |
777 | );\r | |
778 | \r | |
779 | /**\r | |
780 | Wrapper function for set PCD value for non-Pointer type dynamic-ex PCD.\r | |
781 | \r | |
782 | @param ExTokenNumber Token number for dynamic-ex PCD.\r | |
783 | @param Guid Token space guid for dynamic-ex PCD.\r | |
784 | @param Data Value want to be set.\r | |
785 | @param SetSize The size of value.\r | |
786 | \r | |
787 | @return status of ExSetWorker().\r | |
788 | \r | |
789 | **/\r | |
790 | EFI_STATUS\r | |
791 | ExSetValueWorker (\r | |
792 | IN UINTN ExTokenNumber,\r | |
793 | IN CONST EFI_GUID *Guid,\r | |
794 | IN VOID *Data,\r | |
795 | IN UINTN SetSize\r | |
796 | );\r | |
797 | \r | |
798 | /**\r | |
799 | Set value for a dynamic PCD entry.\r | |
800 | \r | |
801 | This routine find the local token number according to dynamic-ex PCD's token \r | |
802 | space guid and token number firstly, and invoke callback function if this PCD\r | |
803 | entry registered callback function. Finally, invoken general SetWorker to set\r | |
804 | PCD value.\r | |
805 | \r | |
806 | @param ExTokenNumber Dynamic-ex PCD token number.\r | |
807 | @param Guid Token space guid for dynamic-ex PCD.\r | |
808 | @param Data PCD value want to be set\r | |
809 | @param SetSize Size of value.\r | |
810 | @param PtrType If TRUE, this PCD entry is pointer type.\r | |
811 | If FALSE, this PCD entry is not pointer type.\r | |
812 | \r | |
813 | @return status of SetWorker().\r | |
814 | \r | |
815 | **/\r | |
816 | EFI_STATUS\r | |
817 | ExSetWorker (\r | |
818 | IN UINTN ExTokenNumber,\r | |
819 | IN CONST EFI_GUID *Guid,\r | |
820 | IN VOID *Data,\r | |
821 | IN OUT UINTN *Size,\r | |
822 | IN BOOLEAN PtrType\r | |
823 | );\r | |
824 | \r | |
825 | /**\r | |
826 | Get the PCD entry pointer in PCD database.\r | |
827 | \r | |
828 | This routine will visit PCD database to find the PCD entry according to given\r | |
829 | token number. The given token number is autogened by build tools and it will be \r | |
830 | translated to local token number. Local token number contains PCD's type and \r | |
831 | offset of PCD entry in PCD database.\r | |
832 | \r | |
833 | @param TokenNumber Token's number, it is autogened by build tools\r | |
834 | @param GetSize The size of token's value\r | |
835 | \r | |
836 | @return PCD entry pointer in PCD database\r | |
837 | \r | |
838 | **/\r | |
839 | VOID *\r | |
840 | GetWorker (\r | |
841 | IN UINTN TokenNumber,\r | |
842 | IN UINTN GetSize\r | |
843 | );\r | |
844 | \r | |
845 | /**\r | |
846 | Wrapper function for get PCD value for dynamic-ex PCD.\r | |
847 | \r | |
848 | @param Guid Token space guid for dynamic-ex PCD.\r | |
849 | @param ExTokenNumber Token number for dynamic-ex PCD.\r | |
850 | @param GetSize The size of dynamic-ex PCD value.\r | |
851 | \r | |
852 | @return PCD entry in PCD database.\r | |
853 | \r | |
854 | **/\r | |
855 | VOID *\r | |
856 | ExGetWorker (\r | |
857 | IN CONST EFI_GUID *Guid,\r | |
858 | IN UINTN ExTokenNumber,\r | |
859 | IN UINTN GetSize\r | |
860 | );\r | |
861 | \r | |
862 | /**\r | |
863 | Find the local token number according to system SKU ID.\r | |
864 | \r | |
865 | @param LocalTokenNumber PCD token number\r | |
866 | @param Size The size of PCD entry.\r | |
867 | @param IsPeiDb If TRUE, the PCD entry is initialized in PEI phase.\r | |
868 | If False, the PCD entry is initialized in DXE phase.\r | |
869 | \r | |
870 | @return Token number according to system SKU ID.\r | |
871 | \r | |
872 | **/\r | |
873 | UINT32\r | |
874 | GetSkuEnabledTokenNumber (\r | |
875 | UINT32 LocalTokenNumber,\r | |
876 | UINTN Size,\r | |
877 | BOOLEAN IsPeiDb\r | |
878 | );\r | |
879 | \r | |
880 | /**\r | |
881 | Get Variable which contains HII type PCD entry.\r | |
882 | \r | |
883 | @param VariableGuid Variable's guid\r | |
884 | @param VariableName Variable's unicode name string\r | |
885 | @param VariableData Variable's data pointer, \r | |
886 | @param VariableSize Variable's size.\r | |
887 | \r | |
888 | @return the status of gRT->GetVariable\r | |
889 | **/\r | |
890 | EFI_STATUS\r | |
891 | GetHiiVariable (\r | |
892 | IN EFI_GUID *VariableGuid,\r | |
893 | IN UINT16 *VariableName,\r | |
894 | OUT UINT8 **VariableData,\r | |
895 | OUT UINTN *VariableSize\r | |
896 | );\r | |
897 | \r | |
898 | /**\r | |
899 | Set value for HII-type PCD.\r | |
900 | \r | |
901 | A HII-type PCD's value is stored in a variable. Setting/Getting the value of \r | |
902 | HII-type PCD is to visit this variable.\r | |
903 | \r | |
904 | @param VariableGuid Guid of variable which stored value of a HII-type PCD.\r | |
905 | @param VariableName Unicode name of variable which stored value of a HII-type PCD.\r | |
906 | @param Data Value want to be set.\r | |
907 | @param DataSize Size of value\r | |
908 | @param Offset Value offset of HII-type PCD in variable.\r | |
909 | \r | |
910 | @return status of GetVariable()/SetVariable().\r | |
911 | \r | |
912 | **/\r | |
913 | EFI_STATUS\r | |
914 | SetHiiVariable (\r | |
915 | IN EFI_GUID *VariableGuid,\r | |
916 | IN UINT16 *VariableName,\r | |
917 | IN CONST VOID *Data,\r | |
918 | IN UINTN DataSize,\r | |
919 | IN UINTN Offset\r | |
920 | );\r | |
921 | \r | |
922 | /**\r | |
923 | Register the callback function for a PCD entry.\r | |
924 | \r | |
925 | This routine will register a callback function to a PCD entry by given token number\r | |
926 | and token space guid.\r | |
927 | \r | |
928 | @param TokenNumber PCD token's number, it is autogened by build tools.\r | |
929 | @param Guid PCD token space's guid, \r | |
930 | if not NULL, this PCD is dynamicEx type PCD.\r | |
931 | @param CallBackFunction Callback function pointer\r | |
932 | \r | |
933 | @return EFI_SUCCESS Always success for registering callback function.\r | |
934 | \r | |
935 | **/\r | |
936 | EFI_STATUS\r | |
937 | DxeRegisterCallBackWorker (\r | |
938 | IN UINTN TokenNumber,\r | |
939 | IN CONST EFI_GUID *Guid, OPTIONAL\r | |
940 | IN PCD_PROTOCOL_CALLBACK CallBackFunction\r | |
941 | );\r | |
942 | \r | |
943 | /**\r | |
944 | UnRegister the callback function for a PCD entry.\r | |
945 | \r | |
946 | This routine will unregister a callback function to a PCD entry by given token number\r | |
947 | and token space guid.\r | |
948 | \r | |
949 | @param TokenNumber PCD token's number, it is autogened by build tools.\r | |
950 | @param Guid PCD token space's guid.\r | |
951 | if not NULL, this PCD is dynamicEx type PCD.\r | |
952 | @param CallBackFunction Callback function pointer\r | |
953 | \r | |
954 | @retval EFI_SUCCESS Callback function is success to be unregister.\r | |
955 | @retval EFI_INVALID_PARAMETER Can not find the PCD entry by given token number.\r | |
956 | **/\r | |
957 | EFI_STATUS\r | |
958 | DxeUnRegisterCallBackWorker (\r | |
959 | IN UINTN TokenNumber,\r | |
960 | IN CONST EFI_GUID *Guid, OPTIONAL\r | |
961 | IN PCD_PROTOCOL_CALLBACK CallBackFunction\r | |
962 | );\r | |
963 | \r | |
964 | /**\r | |
965 | Initialize the PCD database in DXE phase.\r | |
966 | \r | |
967 | PCD database in DXE phase also contains PCD database in PEI phase which is copied\r | |
968 | from GUID Hob.\r | |
969 | \r | |
970 | **/\r | |
971 | VOID\r | |
972 | BuildPcdDxeDataBase (\r | |
973 | VOID\r | |
974 | );\r | |
975 | \r | |
976 | /**\r | |
977 | Get local token number according to dynamic-ex PCD's {token space guid:token number}\r | |
978 | \r | |
979 | A dynamic-ex type PCD, developer must provide pair of token space guid: token number\r | |
980 | in DEC file. PCD database maintain a mapping table that translate pair of {token\r | |
981 | space guid: token number} to local token number.\r | |
982 | \r | |
983 | @param Guid Token space guid for dynamic-ex PCD entry.\r | |
984 | @param ExTokenNumber Dynamic-ex PCD token number.\r | |
985 | \r | |
986 | @return local token number for dynamic-ex PCD.\r | |
987 | \r | |
988 | **/\r | |
989 | UINTN\r | |
990 | GetExPcdTokenNumber (\r | |
991 | IN CONST EFI_GUID *Guid,\r | |
992 | IN UINT32 ExTokenNumber\r | |
993 | );\r | |
994 | \r | |
995 | /**\r | |
996 | Get next token number in given token space.\r | |
997 | \r | |
998 | This routine is used for dynamicEx type PCD. It will firstly scan token space\r | |
999 | table to get token space according to given token space guid. Then scan given \r | |
1000 | token number in found token space, if found, then return next token number in \r | |
1001 | this token space.\r | |
1002 | \r | |
1003 | @param Guid Token space guid. Next token number will be scaned in \r | |
1004 | this token space.\r | |
1005 | @param TokenNumber Token number. \r | |
1006 | If PCD_INVALID_TOKEN_NUMBER, return first token number in \r | |
1007 | token space table.\r | |
1008 | If not PCD_INVALID_TOKEN_NUMBER, return next token number\r | |
1009 | in token space table.\r | |
1010 | @param GuidTable Token space guid table. It will be used for scan token space\r | |
1011 | by given token space guid.\r | |
1012 | @param SizeOfGuidTable The size of guid table.\r | |
1013 | @param ExMapTable DynamicEx token number mapping table.\r | |
1014 | @param SizeOfExMapTable The size of dynamicEx token number mapping table.\r | |
1015 | \r | |
1016 | @retval EFI_NOT_FOUND Can not given token space or token number.\r | |
1017 | @retval EFI_SUCCESS Success to get next token number.\r | |
1018 | \r | |
1019 | **/\r | |
1020 | EFI_STATUS\r | |
1021 | ExGetNextTokeNumber (\r | |
1022 | IN CONST EFI_GUID *Guid,\r | |
1023 | IN OUT UINTN *TokenNumber,\r | |
1024 | IN EFI_GUID *GuidTable,\r | |
1025 | IN UINTN SizeOfGuidTable,\r | |
1026 | IN DYNAMICEX_MAPPING *ExMapTable,\r | |
1027 | IN UINTN SizeOfExMapTable\r | |
1028 | );\r | |
1029 | \r | |
1030 | /**\r | |
1031 | Get size of POINTER type PCD value.\r | |
1032 | \r | |
1033 | @param LocalTokenNumberTableIdx Index of local token number in local token number table.\r | |
1034 | @param MaxSize Maximum size of POINTER type PCD value.\r | |
1035 | \r | |
1036 | @return size of POINTER type PCD value.\r | |
1037 | \r | |
1038 | **/\r | |
1039 | UINTN\r | |
1040 | GetPtrTypeSize (\r | |
1041 | IN UINTN LocalTokenNumberTableIdx,\r | |
1042 | OUT UINTN *MaxSize\r | |
1043 | );\r | |
1044 | \r | |
1045 | /**\r | |
1046 | Set size of POINTER type PCD value. The size should not exceed the maximum size\r | |
1047 | of this PCD value.\r | |
1048 | \r | |
1049 | @param LocalTokenNumberTableIdx Index of local token number in local token number table.\r | |
1050 | @param CurrentSize Size of POINTER type PCD value.\r | |
1051 | \r | |
1052 | @retval TRUE Success to set size of PCD value.\r | |
1053 | @retval FALSE Fail to set size of PCD value.\r | |
1054 | **/\r | |
1055 | BOOLEAN\r | |
1056 | SetPtrTypeSize (\r | |
1057 | IN UINTN LocalTokenNumberTableIdx,\r | |
1058 | IN OUT UINTN *CurrentSize\r | |
1059 | );\r | |
1060 | \r | |
1061 | extern PCD_DATABASE * mPcdDatabase;\r | |
1062 | \r | |
1063 | extern DXE_PCD_DATABASE_INIT gDXEPcdDbInit;\r | |
1064 | \r | |
1065 | extern EFI_LOCK mPcdDatabaseLock;\r | |
1066 | \r | |
1067 | #endif\r | |
1068 | \r | |
1069 | ////////////////////////////////////////////////////////////////////////////////////////////////////\r | |
1070 | /// ///\r | |
1071 | /// Following code is an example for auto-generated PCD database to hold all dynamic/dynamicex ///\r | |
1072 | /// PCD's value for one given platform. And following sample comes from autogen.h/autogen.c of ///\r | |
1073 | /// PCD Dxe driver for NT32 platform. ///\r | |
1074 | /// ///\r | |
1075 | /// The PCD database is stored into a big structure - PCD_DATABASE which is consisted of ///\r | |
1076 | /// PEI PCD database structure and DXE PCD database structure. ///\r | |
1077 | /// ///\r | |
1078 | ////////////////////////////////////////////////////////////////////////////////////////////////////\r | |
1079 | \r | |
1080 | // //\r | |
1081 | // // Common definitions\r | |
1082 | // //\r | |
1083 | // typedef UINT8 SKU_ID;\r | |
1084 | // \r | |
1085 | // //\r | |
1086 | // // A PCD offset value is consisted as follows:\r | |
1087 | // // 32 ------------- 28 ---------- 24 -------- 0\r | |
1088 | // // | PCD type mask | Datum Type | Offset |\r | |
1089 | // // -------------------------------------------\r | |
1090 | // \r | |
1091 | // #define PCD_TYPE_SHIFT 28 // 28 ~ 32 bit hold PCD type information\r | |
1092 | // \r | |
1093 | // #define PCD_TYPE_DATA (0x0 << PCD_TYPE_SHIFT)\r | |
1094 | // #define PCD_TYPE_HII (0x8 << PCD_TYPE_SHIFT)\r | |
1095 | // #define PCD_TYPE_VPD (0x4 << PCD_TYPE_SHIFT)\r | |
1096 | // #define PCD_TYPE_SKU_ENABLED (0x2 << PCD_TYPE_SHIFT)\r | |
1097 | // #define PCD_TYPE_STRING (0x1 << PCD_TYPE_SHIFT)\r | |
1098 | // \r | |
1099 | // #define PCD_TYPE_ALL_SET (PCD_TYPE_DATA | PCD_TYPE_HII | PCD_TYPE_VPD | PCD_TYPE_SKU_ENABLED | PCD_TYPE_STRING)\r | |
1100 | // \r | |
1101 | // #define PCD_DATUM_TYPE_SHIFT 24 // 24 ~ 28 bit hold datum type information\r | |
1102 | // \r | |
1103 | // #define PCD_DATUM_TYPE_POINTER (0x0 << PCD_DATUM_TYPE_SHIFT)\r | |
1104 | // #define PCD_DATUM_TYPE_UINT8 (0x1 << PCD_DATUM_TYPE_SHIFT)\r | |
1105 | // #define PCD_DATUM_TYPE_UINT16 (0x2 << PCD_DATUM_TYPE_SHIFT)\r | |
1106 | // #define PCD_DATUM_TYPE_UINT32 (0x4 << PCD_DATUM_TYPE_SHIFT)\r | |
1107 | // #define PCD_DATUM_TYPE_UINT64 (0x8 << PCD_DATUM_TYPE_SHIFT)\r | |
1108 | // \r | |
1109 | // #define PCD_DATUM_TYPE_ALL_SET (PCD_DATUM_TYPE_POINTER | \\r | |
1110 | // PCD_DATUM_TYPE_UINT8 | \\r | |
1111 | // PCD_DATUM_TYPE_UINT16 | \\r | |
1112 | // PCD_DATUM_TYPE_UINT32 | \\r | |
1113 | // PCD_DATUM_TYPE_UINT64)\r | |
1114 | // \r | |
1115 | // #define PCD_DATABASE_OFFSET_MASK (~(PCD_TYPE_ALL_SET | PCD_DATUM_TYPE_ALL_SET))\r | |
1116 | // \r | |
1117 | // typedef struct {\r | |
1118 | // UINT32 ExTokenNumber;\r | |
1119 | // UINT16 LocalTokenNumber; // PCD Number of this particular platform build\r | |
1120 | // UINT16 ExGuidIndex; // Index of GuidTable\r | |
1121 | // } DYNAMICEX_MAPPING;\r | |
1122 | // \r | |
1123 | // typedef struct {\r | |
1124 | // UINT32 SkuDataStartOffset; //We have to use offsetof MACRO as we don't know padding done by compiler\r | |
1125 | // UINT32 SkuIdTableOffset; //Offset from the PCD_DB\r | |
1126 | // } SKU_HEAD;\r | |
1127 | // \r | |
1128 | // typedef struct {\r | |
1129 | // UINT16 GuidTableIndex; // Offset in Guid Table in units of GUID.\r | |
1130 | // UINT16 StringIndex; // Offset in String Table in units of UINT16.\r | |
1131 | // UINT16 Offset; // Offset in Variable\r | |
1132 | // UINT16 DefaultValueOffset; // Offset of the Default Value\r | |
1133 | // } VARIABLE_HEAD;\r | |
1134 | // \r | |
1135 | // typedef struct {\r | |
1136 | // UINT32 Offset;\r | |
1137 | // } VPD_HEAD;\r | |
1138 | // \r | |
1139 | // typedef UINT16 STRING_HEAD;\r | |
1140 | // \r | |
1141 | // typedef UINT16 SIZE_INFO;\r | |
1142 | // \r | |
1143 | // #define offsetof(s,m) (UINT32) (UINTN) &(((s *)0)->m)\r | |
1144 | // \r | |
1145 | // \r | |
1146 | // #define PEI_GUID_TABLE_SIZE 1\r | |
1147 | // #define PEI_STRING_TABLE_SIZE 1\r | |
1148 | // #define PEI_SKUID_TABLE_SIZE 1\r | |
1149 | // #define PEI_LOCAL_TOKEN_NUMBER_TABLE_SIZE 3\r | |
1150 | // #define PEI_LOCAL_TOKEN_NUMBER 3\r | |
1151 | // #define PEI_EXMAPPING_TABLE_SIZE 1\r | |
1152 | // #define PEI_EX_TOKEN_NUMBER 0\r | |
1153 | // #define PEI_SIZE_TABLE_SIZE 2\r | |
1154 | // #define PEI_GUID_TABLE_EMPTY TRUE\r | |
1155 | // #define PEI_STRING_TABLE_EMPTY TRUE\r | |
1156 | // #define PEI_SKUID_TABLE_EMPTY TRUE\r | |
1157 | // #define PEI_DATABASE_EMPTY FALSE\r | |
1158 | // #define PEI_EXMAP_TABLE_EMPTY TRUE\r | |
1159 | // \r | |
1160 | // //\r | |
1161 | // // PEI database structure for dynamic/dynamicex PCD which has default value.\r | |
1162 | // //\r | |
1163 | // typedef struct {\r | |
1164 | // \r | |
1165 | // \r | |
1166 | // \r | |
1167 | // \r | |
1168 | // \r | |
1169 | // DYNAMICEX_MAPPING ExMapTable[PEI_EXMAPPING_TABLE_SIZE]; // table for mapping dynamicex token number to local token number\r | |
1170 | // UINT32 LocalTokenNumberTable[PEI_LOCAL_TOKEN_NUMBER_TABLE_SIZE]; // table for local token number\r | |
1171 | // GUID GuidTable[PEI_GUID_TABLE_SIZE]; // table for token guid\r | |
1172 | // \r | |
1173 | // \r | |
1174 | // UINT16 StringTable[1]; /* _ */ // table for unicode string type PCD's value\r | |
1175 | // \r | |
1176 | // SIZE_INFO SizeTable[PEI_SIZE_TABLE_SIZE]; // table for PCD size information\r | |
1177 | // \r | |
1178 | // \r | |
1179 | // \r | |
1180 | // \r | |
1181 | // \r | |
1182 | // \r | |
1183 | // UINT8 SkuIdTable[PEI_SKUID_TABLE_SIZE]; // table for SKU IDs \r | |
1184 | // SKU_ID SystemSkuId; // system SKU ID\r | |
1185 | // } PEI_PCD_DATABASE_INIT;\r | |
1186 | // \r | |
1187 | // //\r | |
1188 | // // PEI database structure for dynamic/dynamicex PCD which has no default value.\r | |
1189 | // //\r | |
1190 | // typedef struct {\r | |
1191 | // \r | |
1192 | // \r | |
1193 | // UINT32 PcdFlashNvStorageVariableBase_a1aff049_fdeb_442a_b320_13ab4cb72bbc[1]; // PCD entry for PcdFlashNvStorageVariableBase\r | |
1194 | // UINT32 PcdFlashNvStorageFtwSpareBase_a1aff049_fdeb_442a_b320_13ab4cb72bbc[1]; // PCD entry for PcdFlashNvStorageFtwSpareBase\r | |
1195 | // UINT32 PcdFlashNvStorageFtwWorkingBase_a1aff049_fdeb_442a_b320_13ab4cb72bbc[1]; // PCD entry for PcdFlashNvStorageFtwWorkingBase\r | |
1196 | // \r | |
1197 | // \r | |
1198 | // \r | |
1199 | // \r | |
1200 | // } PEI_PCD_DATABASE_UNINIT;\r | |
1201 | // \r | |
1202 | // #define PCD_PEI_SERVICE_DRIVER_VERSION 2\r | |
1203 | // \r | |
1204 | // typedef struct {\r | |
1205 | // PEI_PCD_DATABASE_INIT Init;\r | |
1206 | // PEI_PCD_DATABASE_UNINIT Uninit;\r | |
1207 | // } PEI_PCD_DATABASE;\r | |
1208 | // \r | |
1209 | // #define PEI_NEX_TOKEN_NUMBER (PEI_LOCAL_TOKEN_NUMBER - PEI_EX_TOKEN_NUMBER)\r | |
1210 | // \r | |
1211 | // #define DXE_GUID_TABLE_SIZE 1\r | |
1212 | // #define DXE_STRING_TABLE_SIZE 212\r | |
1213 | // #define DXE_SKUID_TABLE_SIZE 1\r | |
1214 | // #define DXE_LOCAL_TOKEN_NUMBER_TABLE_SIZE 9\r | |
1215 | // #define DXE_LOCAL_TOKEN_NUMBER 9\r | |
1216 | // #define DXE_EXMAPPING_TABLE_SIZE 1\r | |
1217 | // #define DXE_EX_TOKEN_NUMBER 0\r | |
1218 | // #define DXE_SIZE_TABLE_SIZE 16\r | |
1219 | // #define DXE_GUID_TABLE_EMPTY TRUE\r | |
1220 | // #define DXE_STRING_TABLE_EMPTY FALSE\r | |
1221 | // #define DXE_SKUID_TABLE_EMPTY TRUE\r | |
1222 | // #define DXE_DATABASE_EMPTY FALSE\r | |
1223 | // #define DXE_EXMAP_TABLE_EMPTY TRUE\r | |
1224 | // \r | |
1225 | // typedef struct {\r | |
1226 | // \r | |
1227 | // \r | |
1228 | // \r | |
1229 | // \r | |
1230 | // \r | |
1231 | // DYNAMICEX_MAPPING ExMapTable[DXE_EXMAPPING_TABLE_SIZE];\r | |
1232 | // UINT32 LocalTokenNumberTable[DXE_LOCAL_TOKEN_NUMBER_TABLE_SIZE];\r | |
1233 | // GUID GuidTable[DXE_GUID_TABLE_SIZE];\r | |
1234 | // STRING_HEAD PcdWinNtMemorySize_0d79a645_1d91_40a6_a81f_61e6982b32b4[1];\r | |
1235 | // STRING_HEAD PcdWinNtGop_0d79a645_1d91_40a6_a81f_61e6982b32b4[1];\r | |
1236 | // STRING_HEAD PcdWinNtSerialPort_0d79a645_1d91_40a6_a81f_61e6982b32b4[1];\r | |
1237 | // STRING_HEAD PcdWinNtVirtualDisk_0d79a645_1d91_40a6_a81f_61e6982b32b4[1];\r | |
1238 | // STRING_HEAD PcdWinNtUga_0d79a645_1d91_40a6_a81f_61e6982b32b4[1];\r | |
1239 | // STRING_HEAD PcdWinNtPhysicalDisk_0d79a645_1d91_40a6_a81f_61e6982b32b4[1];\r | |
1240 | // STRING_HEAD PcdWinNtFileSystem_0d79a645_1d91_40a6_a81f_61e6982b32b4[1];\r | |
1241 | // STRING_HEAD PcdWinNtConsole_0d79a645_1d91_40a6_a81f_61e6982b32b4[1];\r | |
1242 | // \r | |
1243 | // \r | |
1244 | // UINT16 StringTable[6]; /* PcdWinNtMemorySize_0d79a645_1d91_40a6_a81f_61e6982b32b4 */\r | |
1245 | // UINT16 StringTable_1[26]; /* PcdWinNtGop_0d79a645_1d91_40a6_a81f_61e6982b32b4 */\r | |
1246 | // UINT16 StringTable_2[10]; /* PcdWinNtSerialPort_0d79a645_1d91_40a6_a81f_61e6982b32b4 */\r | |
1247 | // UINT16 StringTable_3[13]; /* PcdWinNtVirtualDisk_0d79a645_1d91_40a6_a81f_61e6982b32b4 */\r | |
1248 | // UINT16 StringTable_4[26]; /* PcdWinNtUga_0d79a645_1d91_40a6_a81f_61e6982b32b4 */\r | |
1249 | // UINT16 StringTable_5[51]; /* PcdWinNtPhysicalDisk_0d79a645_1d91_40a6_a81f_61e6982b32b4 */\r | |
1250 | // UINT16 StringTable_6[54]; /* PcdWinNtFileSystem_0d79a645_1d91_40a6_a81f_61e6982b32b4 */\r | |
1251 | // UINT16 StringTable_7[26]; /* PcdWinNtConsole_0d79a645_1d91_40a6_a81f_61e6982b32b4 */\r | |
1252 | // \r | |
1253 | // SIZE_INFO SizeTable[DXE_SIZE_TABLE_SIZE];\r | |
1254 | // UINT16 PcdPlatformBootTimeOutDefault_a1aff049_fdeb_442a_b320_13ab4cb72bbc[1];\r | |
1255 | // \r | |
1256 | // \r | |
1257 | // \r | |
1258 | // \r | |
1259 | // \r | |
1260 | // \r | |
1261 | // UINT8 SkuIdTable[DXE_SKUID_TABLE_SIZE];\r | |
1262 | // \r | |
1263 | // } DXE_PCD_DATABASE_INIT;\r | |
1264 | // \r | |
1265 | // typedef struct {\r | |
1266 | // UINT8 dummy; /* PCD_DATABASE_UNINIT is emptry */\r | |
1267 | // \r | |
1268 | // \r | |
1269 | // \r | |
1270 | // \r | |
1271 | // \r | |
1272 | // } DXE_PCD_DATABASE_UNINIT;\r | |
1273 | // \r | |
1274 | // #define PCD_DXE_SERVICE_DRIVER_VERSION 2\r | |
1275 | // \r | |
1276 | // typedef struct {\r | |
1277 | // DXE_PCD_DATABASE_INIT Init;\r | |
1278 | // DXE_PCD_DATABASE_UNINIT Uninit;\r | |
1279 | // } DXE_PCD_DATABASE;\r | |
1280 | // \r | |
1281 | // #define DXE_NEX_TOKEN_NUMBER (DXE_LOCAL_TOKEN_NUMBER - DXE_EX_TOKEN_NUMBER)\r | |
1282 | // \r | |
1283 | // typedef struct {\r | |
1284 | // PEI_PCD_DATABASE PeiDb;\r | |
1285 | // DXE_PCD_DATABASE DxeDb;\r | |
1286 | // } PCD_DATABASE;\r | |
1287 | // \r | |
1288 | // #define PCD_TOTAL_TOKEN_NUMBER (PEI_LOCAL_TOKEN_NUMBER + DXE_LOCAL_TOKEN_NUMBER)\r | |
1289 | // \r | |
1290 | // \r | |
1291 | // DXE_PCD_DATABASE_INIT gDXEPcdDbInit = {\r | |
1292 | // \r | |
1293 | // \r | |
1294 | // \r | |
1295 | // \r | |
1296 | // /* VPD */\r | |
1297 | // \r | |
1298 | // /* ExMapTable */\r | |
1299 | // {\r | |
1300 | // { 0, 0, 0 },\r | |
1301 | // \r | |
1302 | // },\r | |
1303 | // /* LocalTokenNumberTable */\r | |
1304 | // {\r | |
1305 | // offsetof(DXE_PCD_DATABASE, Init.PcdWinNtMemorySize_0d79a645_1d91_40a6_a81f_61e6982b32b4) | PCD_DATUM_TYPE_POINTER | PCD_TYPE_STRING,\r | |
1306 | // offsetof(DXE_PCD_DATABASE, Init.PcdWinNtGop_0d79a645_1d91_40a6_a81f_61e6982b32b4) | PCD_DATUM_TYPE_POINTER | PCD_TYPE_STRING,\r | |
1307 | // offsetof(DXE_PCD_DATABASE, Init.PcdWinNtSerialPort_0d79a645_1d91_40a6_a81f_61e6982b32b4) | PCD_DATUM_TYPE_POINTER | PCD_TYPE_STRING,\r | |
1308 | // offsetof(DXE_PCD_DATABASE, Init.PcdWinNtVirtualDisk_0d79a645_1d91_40a6_a81f_61e6982b32b4) | PCD_DATUM_TYPE_POINTER | PCD_TYPE_STRING,\r | |
1309 | // offsetof(DXE_PCD_DATABASE, Init.PcdWinNtUga_0d79a645_1d91_40a6_a81f_61e6982b32b4) | PCD_DATUM_TYPE_POINTER | PCD_TYPE_STRING,\r | |
1310 | // offsetof(DXE_PCD_DATABASE, Init.PcdWinNtPhysicalDisk_0d79a645_1d91_40a6_a81f_61e6982b32b4) | PCD_DATUM_TYPE_POINTER | PCD_TYPE_STRING,\r | |
1311 | // offsetof(DXE_PCD_DATABASE, Init.PcdWinNtFileSystem_0d79a645_1d91_40a6_a81f_61e6982b32b4) | PCD_DATUM_TYPE_POINTER | PCD_TYPE_STRING,\r | |
1312 | // offsetof(DXE_PCD_DATABASE, Init.PcdWinNtConsole_0d79a645_1d91_40a6_a81f_61e6982b32b4) | PCD_DATUM_TYPE_POINTER | PCD_TYPE_STRING,\r | |
1313 | // offsetof(DXE_PCD_DATABASE, Init.PcdPlatformBootTimeOutDefault_a1aff049_fdeb_442a_b320_13ab4cb72bbc) | PCD_TYPE_DATA | PCD_DATUM_TYPE_UINT16,\r | |
1314 | //\r | |
1315 | // },\r | |
1316 | // /* GuidTable */\r | |
1317 | // {\r | |
1318 | // {0x00000000, 0x0000, 0x0000, {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}},\r | |
1319 | // \r | |
1320 | // },\r | |
1321 | // { 0 }, /* PcdWinNtMemorySize_0d79a645_1d91_40a6_a81f_61e6982b32b4[1] */\r | |
1322 | // { 6 }, /* PcdWinNtGop_0d79a645_1d91_40a6_a81f_61e6982b32b4[1] */\r | |
1323 | // { 32 }, /* PcdWinNtSerialPort_0d79a645_1d91_40a6_a81f_61e6982b32b4[1] */\r | |
1324 | // { 42 }, /* PcdWinNtVirtualDisk_0d79a645_1d91_40a6_a81f_61e6982b32b4[1] */\r | |
1325 | // { 55 }, /* PcdWinNtUga_0d79a645_1d91_40a6_a81f_61e6982b32b4[1] */\r | |
1326 | // { 81 }, /* PcdWinNtPhysicalDisk_0d79a645_1d91_40a6_a81f_61e6982b32b4[1] */\r | |
1327 | // { 132 }, /* PcdWinNtFileSystem_0d79a645_1d91_40a6_a81f_61e6982b32b4[1] */\r | |
1328 | // { 186 }, /* PcdWinNtConsole_0d79a645_1d91_40a6_a81f_61e6982b32b4[1] */\r | |
1329 | //\r | |
1330 | //\r | |
1331 | // /* StringTable */\r | |
1332 | // L"64!64", /* PcdWinNtMemorySize_0d79a645_1d91_40a6_a81f_61e6982b32b4 */\r | |
1333 | // L"UGA Window 1!UGA Window 2", /* PcdWinNtGop_0d79a645_1d91_40a6_a81f_61e6982b32b4 */\r | |
1334 | // L"COM1!COM2", /* PcdWinNtSerialPort_0d79a645_1d91_40a6_a81f_61e6982b32b4 */\r | |
1335 | // L"FW;40960;512", /* PcdWinNtVirtualDisk_0d79a645_1d91_40a6_a81f_61e6982b32b4 */\r | |
1336 | // L"UGA Window 1!UGA Window 2", /* PcdWinNtUga_0d79a645_1d91_40a6_a81f_61e6982b32b4 */\r | |
1337 | // L"a:RW;2880;512!d:RO;307200;2048!j:RW;262144;512", /* PcdWinNtPhysicalDisk_0d79a645_1d91_40a6_a81f_61e6982b32b4 */\r | |
1338 | // L".!..\\..\\..\\..\\EdkShellBinPkg\\Bin\\Ia32\\Apps", /* PcdWinNtFileSystem_0d79a645_1d91_40a6_a81f_61e6982b32b4 */\r | |
1339 | // L"Bus Driver Console Window", /* PcdWinNtConsole_0d79a645_1d91_40a6_a81f_61e6982b32b4 */\r | |
1340 | \r | |
1341 | // /* SizeTable */\r | |
1342 | // {\r | |
1343 | // 10, 10, /* PcdWinNtMemorySize_0d79a645_1d91_40a6_a81f_61e6982b32b4 */\r | |
1344 | // 50, 50, /* PcdWinNtGop_0d79a645_1d91_40a6_a81f_61e6982b32b4 */\r | |
1345 | // 18, 18, /* PcdWinNtSerialPort_0d79a645_1d91_40a6_a81f_61e6982b32b4 */\r | |
1346 | // 24, 24, /* PcdWinNtVirtualDisk_0d79a645_1d91_40a6_a81f_61e6982b32b4 */\r | |
1347 | // 50, 50, /* PcdWinNtUga_0d79a645_1d91_40a6_a81f_61e6982b32b4 */\r | |
1348 | // 100, 92, /* PcdWinNtPhysicalDisk_0d79a645_1d91_40a6_a81f_61e6982b32b4 */\r | |
1349 | // 106, 98, /* PcdWinNtFileSystem_0d79a645_1d91_40a6_a81f_61e6982b32b4 */\r | |
1350 | // 50, 50, /* PcdWinNtConsole_0d79a645_1d91_40a6_a81f_61e6982b32b4 */\r | |
1351 | //\r | |
1352 | // },\r | |
1353 | // { 10 }, /* PcdPlatformBootTimeOutDefault_a1aff049_fdeb_442a_b320_13ab4cb72bbc[1] */\r | |
1354 | //\r | |
1355 | //\r | |
1356 | //\r | |
1357 | //\r | |
1358 | //\r | |
1359 | //\r | |
1360 | // /* SkuIdTable */\r | |
1361 | // { 0, },\r | |
1362 | // \r | |
1363 | //};\r | |
1364 | \r |