]> git.proxmox.com Git - mirror_edk2.git/blame_incremental - MdePkg/Include/Protocol/Pcd.h
Sync BaseTool trunk (version r2610) into EDKII BaseTools.
[mirror_edk2.git] / MdePkg / Include / Protocol / Pcd.h
... / ...
CommitLineData
1/** @file\r
2 Native Platform Configuration Database (PCD) Protocol\r
3\r
4 Different with the EFI_PCD_PROTOCOL defined in PI 1.2 specification, the native\r
5 PCD protocol provide interfaces for dynamic and dynamic-ex type PCD. \r
6 The interfaces in dynamic type PCD do not require the token space guid as parameter,\r
7 but interfaces in dynamic-ex type PCD require token space guid as parameter.\r
8 \r
9Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>\r
10This program and the accompanying materials are licensed and made available under \r
11the terms and conditions of the BSD License that accompanies this distribution. \r
12The full text of the license may be found at\r
13http://opensource.org/licenses/bsd-license.php. \r
14 \r
15THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, \r
16WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. \r
17\r
18**/\r
19\r
20#ifndef __PCD_H__\r
21#define __PCD_H__\r
22\r
23extern EFI_GUID gPcdProtocolGuid;\r
24\r
25#define PCD_PROTOCOL_GUID \\r
26 { 0x11b34006, 0xd85b, 0x4d0a, { 0xa2, 0x90, 0xd5, 0xa5, 0x71, 0x31, 0xe, 0xf7 } }\r
27\r
28#define PCD_INVALID_TOKEN_NUMBER ((UINTN) 0)\r
29\r
30\r
31/**\r
32 Sets the SKU value for subsequent calls to set or get PCD token values.\r
33\r
34 SetSku() sets the SKU Id to be used for subsequent calls to set or get PCD values. \r
35 SetSku() is normally called only once by the system.\r
36\r
37 For each item (token), the database can hold a single value that applies to all SKUs, \r
38 or multiple values, where each value is associated with a specific SKU Id. Items with multiple, \r
39 SKU-specific values are called SKU enabled. \r
40 \r
41 The SKU Id of zero is reserved as a default. The valid SkuId range is 1 to 255. \r
42 For tokens that are not SKU enabled, the system ignores any set SKU Id and works with the \r
43 single value for that token. For SKU-enabled tokens, the system will use the SKU Id set by the \r
44 last call to SetSku(). If no SKU Id is set or the currently set SKU Id isn't valid for the specified token, \r
45 the system uses the default SKU Id. If the system attempts to use the default SKU Id and no value has been \r
46 set for that Id, the results are unpredictable.\r
47\r
48 @param[in] SkuId The SKU value that will be used when the PCD service will retrieve and \r
49 set values associated with a PCD token.\r
50\r
51\r
52**/\r
53typedef \r
54VOID\r
55(EFIAPI *PCD_PROTOCOL_SET_SKU)(\r
56 IN UINTN SkuId\r
57 );\r
58\r
59\r
60\r
61/**\r
62 Retrieves an 8-bit value for a given PCD token.\r
63\r
64 Retrieves the current byte-sized value for a PCD token number. \r
65 If the TokenNumber is invalid, the results are unpredictable.\r
66 \r
67 @param[in] TokenNumber The PCD token number. \r
68\r
69 @return The UINT8 value.\r
70 \r
71**/\r
72typedef\r
73UINT8\r
74(EFIAPI *PCD_PROTOCOL_GET8)(\r
75 IN UINTN TokenNumber\r
76 );\r
77\r
78\r
79\r
80/**\r
81 Retrieves a 16-bit value for a given PCD token.\r
82\r
83 Retrieves the current 16-bit value for a PCD token number. \r
84 If the TokenNumber is invalid, the results are unpredictable.\r
85 \r
86 @param[in] TokenNumber The PCD token number. \r
87\r
88 @return The UINT16 value.\r
89 \r
90**/\r
91typedef\r
92UINT16\r
93(EFIAPI *PCD_PROTOCOL_GET16)(\r
94 IN UINTN TokenNumber\r
95 );\r
96\r
97\r
98\r
99/**\r
100 Retrieves a 32-bit value for a given PCD token.\r
101\r
102 Retrieves the current 32-bit value for a PCD token number. \r
103 If the TokenNumber is invalid, the results are unpredictable.\r
104 \r
105 @param[in] TokenNumber The PCD token number. \r
106\r
107 @return The UINT32 value.\r
108 \r
109**/\r
110typedef\r
111UINT32\r
112(EFIAPI *PCD_PROTOCOL_GET32)(\r
113 IN UINTN TokenNumber\r
114 );\r
115\r
116\r
117\r
118/**\r
119 Retrieves a 64-bit value for a given PCD token.\r
120\r
121 Retrieves the current 64-bit value for a PCD token number. \r
122 If the TokenNumber is invalid, the results are unpredictable.\r
123 \r
124 @param[in] TokenNumber The PCD token number. \r
125\r
126 @return The UINT64 value.\r
127 \r
128**/\r
129typedef\r
130UINT64\r
131(EFIAPI *PCD_PROTOCOL_GET64)(\r
132 IN UINTN TokenNumber\r
133 );\r
134\r
135\r
136\r
137/**\r
138 Retrieves a pointer to a value for a given PCD token.\r
139\r
140 Retrieves the current pointer to the buffer for a PCD token number. \r
141 Do not make any assumptions about the alignment of the pointer that \r
142 is returned by this function call. If the TokenNumber is invalid, \r
143 the results are unpredictable.\r
144\r
145 @param[in] TokenNumber The PCD token number. \r
146\r
147 @return The pointer to the buffer to be retrived.\r
148 \r
149**/\r
150typedef\r
151VOID *\r
152(EFIAPI *PCD_PROTOCOL_GET_POINTER)(\r
153 IN UINTN TokenNumber\r
154 );\r
155\r
156\r
157\r
158/**\r
159 Retrieves a Boolean value for a given PCD token.\r
160\r
161 Retrieves the current boolean value for a PCD token number. \r
162 Do not make any assumptions about the alignment of the pointer that \r
163 is returned by this function call. If the TokenNumber is invalid, \r
164 the results are unpredictable.\r
165\r
166 @param[in] TokenNumber The PCD token number. \r
167\r
168 @return The Boolean value.\r
169 \r
170**/\r
171typedef\r
172BOOLEAN\r
173(EFIAPI *PCD_PROTOCOL_GET_BOOLEAN)(\r
174 IN UINTN TokenNumber\r
175 );\r
176\r
177\r
178\r
179/**\r
180 Retrieves the size of the value for a given PCD token.\r
181\r
182 Retrieves the current size of a particular PCD token. \r
183 If the TokenNumber is invalid, the results are unpredictable.\r
184\r
185 @param[in] TokenNumber The PCD token number. \r
186\r
187 @return The size of the value for the PCD token.\r
188 \r
189**/\r
190typedef\r
191UINTN\r
192(EFIAPI *PCD_PROTOCOL_GET_SIZE)(\r
193 IN UINTN TokenNumber\r
194 );\r
195\r
196\r
197\r
198/**\r
199 Retrieves an 8-bit value for a given PCD token.\r
200\r
201 Retrieves the 8-bit value of a particular PCD token. \r
202 If the TokenNumber is invalid or the token space\r
203 specified by Guid does not exist, the results are \r
204 unpredictable.\r
205\r
206 @param[in] Guid The token space for the token number.\r
207 @param[in] TokenNumber The PCD token number. \r
208\r
209 @return The size 8-bit value for the PCD token.\r
210 \r
211**/\r
212typedef\r
213UINT8\r
214(EFIAPI *PCD_PROTOCOL_GET_EX_8)(\r
215 IN CONST EFI_GUID *Guid,\r
216 IN UINTN TokenNumber\r
217 );\r
218\r
219\r
220\r
221/**\r
222 Retrieves a 16-bit value for a given PCD token.\r
223\r
224 Retrieves the 16-bit value of a particular PCD token. \r
225 If the TokenNumber is invalid or the token space\r
226 specified by Guid does not exist, the results are \r
227 unpredictable.\r
228\r
229 @param[in] Guid The token space for the token number.\r
230 @param[in] TokenNumber The PCD token number. \r
231\r
232 @return The size 16-bit value for the PCD token.\r
233 \r
234**/\r
235typedef\r
236UINT16\r
237(EFIAPI *PCD_PROTOCOL_GET_EX_16)(\r
238 IN CONST EFI_GUID *Guid,\r
239 IN UINTN TokenNumber\r
240 );\r
241\r
242\r
243\r
244/**\r
245 Retrieves a 32-bit value for a given PCD token.\r
246\r
247 Retrieves the 32-bit value of a particular PCD token. \r
248 If the TokenNumber is invalid or the token space\r
249 specified by Guid does not exist, the results are \r
250 unpredictable.\r
251\r
252 @param[in] Guid The token space for the token number.\r
253 @param[in] TokenNumber The PCD token number. \r
254\r
255 @return The size 32-bit value for the PCD token.\r
256 \r
257**/\r
258typedef\r
259UINT32\r
260(EFIAPI *PCD_PROTOCOL_GET_EX_32)(\r
261 IN CONST EFI_GUID *Guid,\r
262 IN UINTN TokenNumber\r
263 );\r
264\r
265\r
266\r
267/**\r
268 Retrieves an 64-bit value for a given PCD token.\r
269\r
270 Retrieves the 64-bit value of a particular PCD token. \r
271 If the TokenNumber is invalid or the token space\r
272 specified by Guid does not exist, the results are \r
273 unpredictable.\r
274\r
275 @param[in] Guid The token space for the token number.\r
276 @param[in] TokenNumber The PCD token number. \r
277\r
278 @return The size 64-bit value for the PCD token.\r
279 \r
280**/\r
281typedef\r
282UINT64\r
283(EFIAPI *PCD_PROTOCOL_GET_EX_64)(\r
284 IN CONST EFI_GUID *Guid,\r
285 IN UINTN TokenNumber\r
286 );\r
287\r
288\r
289\r
290/**\r
291 Retrieves a pointer to a value for a given PCD token.\r
292\r
293 Retrieves the current pointer to the buffer for a PCD token number. \r
294 Do not make any assumptions about the alignment of the pointer that \r
295 is returned by this function call. If the TokenNumber is invalid, \r
296 the results are 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 pointer to the buffer to be retrieved.\r
302 \r
303**/\r
304typedef\r
305VOID *\r
306(EFIAPI *PCD_PROTOCOL_GET_EX_POINTER)(\r
307 IN CONST EFI_GUID *Guid,\r
308 IN UINTN TokenNumber\r
309 );\r
310\r
311\r
312\r
313/**\r
314 Retrieves a Boolean value for a given PCD token.\r
315\r
316 Retrieves the Boolean value of a particular PCD token. \r
317 If the TokenNumber is invalid or the token space\r
318 specified by Guid does not exist, the results are \r
319 unpredictable.\r
320\r
321 @param[in] Guid The token space for the token number.\r
322 @param[in] TokenNumber The PCD token number. \r
323\r
324 @return The size Boolean value for the PCD token.\r
325 \r
326**/\r
327typedef\r
328BOOLEAN\r
329(EFIAPI *PCD_PROTOCOL_GET_EX_BOOLEAN)(\r
330 IN CONST EFI_GUID *Guid,\r
331 IN UINTN TokenNumber\r
332 );\r
333\r
334\r
335\r
336/**\r
337 Retrieves the size of the value for a given PCD token.\r
338\r
339 Retrieves the current size of a particular PCD token. \r
340 If the TokenNumber is invalid, the results are unpredictable.\r
341\r
342 @param[in] Guid The token space for the token number.\r
343 @param[in] TokenNumber The PCD token number. \r
344\r
345 @return The size of the value for the PCD token.\r
346 \r
347**/\r
348typedef\r
349UINTN\r
350(EFIAPI *PCD_PROTOCOL_GET_EX_SIZE)(\r
351 IN CONST EFI_GUID *Guid,\r
352 IN UINTN TokenNumber\r
353 );\r
354\r
355\r
356\r
357/**\r
358 Sets an 8-bit value for a given PCD token.\r
359\r
360 When the PCD service sets a value, it will check to ensure that the \r
361 size of the value being set is compatible with the Token's existing definition. \r
362 If it is not, an error will be returned.\r
363\r
364 @param[in] TokenNumber The PCD token number. \r
365 @param[in] Value The value to set for the PCD token.\r
366\r
367 @retval EFI_SUCCESS The procedure returned successfully.\r
368 @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data \r
369 being set was incompatible with a call to this function. \r
370 Use GetSize() to retrieve the size of the target data.\r
371 @retval EFI_NOT_FOUND The PCD service could not find the requested token number.\r
372 \r
373**/\r
374typedef\r
375EFI_STATUS\r
376(EFIAPI *PCD_PROTOCOL_SET8)(\r
377 IN UINTN TokenNumber,\r
378 IN UINT8 Value\r
379 );\r
380\r
381\r
382\r
383/**\r
384 Sets a 16-bit value for a given PCD token.\r
385\r
386 When the PCD service sets a value, it will check to ensure that the \r
387 size of the value being set is compatible with the Token's existing definition. \r
388 If it is not, an error will be returned.\r
389\r
390 @param[in] TokenNumber The PCD token number. \r
391 @param[in] Value The value to set for the PCD token.\r
392\r
393 @retval EFI_SUCCESS The procedure returned successfully.\r
394 @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data \r
395 being set was incompatible with a call to this function. \r
396 Use GetSize() to retrieve the size of the target data.\r
397 @retval EFI_NOT_FOUND The PCD service could not find the requested token number.\r
398 \r
399**/\r
400typedef\r
401EFI_STATUS\r
402(EFIAPI *PCD_PROTOCOL_SET16)(\r
403 IN UINTN TokenNumber,\r
404 IN UINT16 Value\r
405 );\r
406\r
407\r
408\r
409/**\r
410 Sets a 32-bit value for a given PCD token.\r
411\r
412 When the PCD service sets a value, it will check to ensure that the \r
413 size of the value being set is compatible with the Token's existing definition. \r
414 If it is not, an error will be returned.\r
415\r
416 @param[in] TokenNumber The PCD token number. \r
417 @param[in] Value The value to set for the PCD token.\r
418\r
419 @retval EFI_SUCCESS The procedure returned successfully.\r
420 @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data \r
421 being set was incompatible with a call to this function. \r
422 Use GetSize() to retrieve the size of the target data.\r
423 @retval EFI_NOT_FOUND The PCD service could not find the requested token number.\r
424 \r
425**/\r
426typedef\r
427EFI_STATUS\r
428(EFIAPI *PCD_PROTOCOL_SET32)(\r
429 IN UINTN TokenNumber,\r
430 IN UINT32 Value\r
431 );\r
432\r
433\r
434\r
435/**\r
436 Sets a 64-bit value for a given PCD token.\r
437\r
438 When the PCD service sets a value, it will check to ensure that the \r
439 size of the value being set is compatible with the Token's existing definition. \r
440 If it is not, an error will be returned.\r
441\r
442 @param[in] TokenNumber The PCD token number. \r
443 @param[in] Value The value to set for the PCD token.\r
444\r
445 @retval EFI_SUCCESS The procedure returned successfully.\r
446 @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data \r
447 being set was incompatible with a call to this function. \r
448 Use GetSize() to retrieve the size of the target data.\r
449 @retval EFI_NOT_FOUND The PCD service could not find the requested token number.\r
450 \r
451**/\r
452typedef\r
453EFI_STATUS\r
454(EFIAPI *PCD_PROTOCOL_SET64)(\r
455 IN UINTN TokenNumber,\r
456 IN UINT64 Value\r
457 );\r
458\r
459\r
460\r
461/**\r
462 Sets a value of a specified size for a given PCD token.\r
463\r
464 When the PCD service sets a value, it will check to ensure that the \r
465 size of the value being set is compatible with the Token's existing definition. \r
466 If it is not, an error will be returned.\r
467\r
468 @param[in] TokenNumber The PCD token number. \r
469 @param[in, out] SizeOfBuffer A pointer to the length of the value being set for the PCD token. \r
470 On input, if the SizeOfValue is greater than the maximum size supported \r
471 for this TokenNumber then the output value of SizeOfValue will reflect \r
472 the maximum size supported for this TokenNumber.\r
473 @param[in] Buffer The buffer to set for the PCD token.\r
474\r
475 @retval EFI_SUCCESS The procedure returned successfully.\r
476 @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data \r
477 being set was incompatible with a call to this function. \r
478 Use GetSize() to retrieve the size of the target data.\r
479 @retval EFI_NOT_FOUND The PCD service could not find the requested token number.\r
480 \r
481**/\r
482typedef\r
483EFI_STATUS\r
484(EFIAPI *PCD_PROTOCOL_SET_POINTER)(\r
485 IN UINTN TokenNumber,\r
486 IN OUT UINTN *SizeOfBuffer,\r
487 IN VOID *Buffer\r
488 );\r
489\r
490\r
491\r
492/**\r
493 Sets a Boolean value for a given PCD token.\r
494\r
495 When the PCD service sets a value, it will check to ensure that the \r
496 size of the value being set is compatible with the Token's existing definition. \r
497 If it is not, an error will be returned.\r
498\r
499 @param[in] TokenNumber The PCD token number. \r
500 @param[in] Value The value to set for the PCD token.\r
501\r
502 @retval EFI_SUCCESS The procedure returned successfully.\r
503 @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data \r
504 being set was incompatible with a call to this function. \r
505 Use GetSize() to retrieve the size of the target data.\r
506 @retval EFI_NOT_FOUND The PCD service could not find the requested token number.\r
507 \r
508**/\r
509typedef\r
510EFI_STATUS\r
511(EFIAPI *PCD_PROTOCOL_SET_BOOLEAN)(\r
512 IN UINTN TokenNumber,\r
513 IN BOOLEAN Value\r
514 );\r
515\r
516\r
517\r
518/**\r
519 Sets an 8-bit value for a given PCD token.\r
520\r
521 When the PCD service sets a value, it will check to ensure that the \r
522 size of the value being set is compatible with the Token's existing definition. \r
523 If it is not, an error will be returned.\r
524\r
525 @param[in] Guid The 128-bit unique value that designates the namespace from which to extract the value.\r
526 @param[in] TokenNumber The PCD token number. \r
527 @param[in] Value The value to set for the PCD token.\r
528\r
529 @retval EFI_SUCCESS The procedure returned successfully.\r
530 @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data \r
531 being set was incompatible with a call to this function. \r
532 Use GetSize() to retrieve the size of the target data.\r
533 @retval EFI_NOT_FOUND The PCD service could not find the requested token number.\r
534 \r
535**/\r
536typedef\r
537EFI_STATUS\r
538(EFIAPI *PCD_PROTOCOL_SET_EX_8)(\r
539 IN CONST EFI_GUID *Guid,\r
540 IN UINTN TokenNumber,\r
541 IN UINT8 Value\r
542 );\r
543\r
544\r
545\r
546/**\r
547 Sets an 16-bit value for a given PCD token.\r
548\r
549 When the PCD service sets a value, it will check to ensure that the \r
550 size of the value being set is compatible with the Token's existing definition. \r
551 If it is not, an error will be returned.\r
552\r
553 @param[in] Guid The 128-bit unique value that designates the namespace from which to extract the value.\r
554 @param[in] TokenNumber The PCD token number. \r
555 @param[in] Value The value to set for the PCD token.\r
556\r
557 @retval EFI_SUCCESS The procedure returned successfully.\r
558 @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data \r
559 being set was incompatible with a call to this function. \r
560 Use GetSize() to retrieve the size of the target data.\r
561 @retval EFI_NOT_FOUND The PCD service could not find the requested token number.\r
562 \r
563**/\r
564typedef\r
565EFI_STATUS\r
566(EFIAPI *PCD_PROTOCOL_SET_EX_16)(\r
567 IN CONST EFI_GUID *Guid,\r
568 IN UINTN TokenNumber,\r
569 IN UINT16 Value\r
570 );\r
571\r
572\r
573\r
574/**\r
575 Sets a 32-bit value for a given PCD token.\r
576\r
577 When the PCD service sets a value, it will check to ensure that the \r
578 size of the value being set is compatible with the Token's existing definition. \r
579 If it is not, an error will be returned.\r
580\r
581 @param[in] Guid The 128-bit unique value that designates the namespace from which to extract the value.\r
582 @param[in] TokenNumber The PCD token number. \r
583 @param[in] Value The value to set for the PCD token.\r
584\r
585 @retval EFI_SUCCESS The procedure returned successfully.\r
586 @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data \r
587 being set was incompatible with a call to this function. \r
588 Use GetSize() to retrieve the size of the target data.\r
589 @retval EFI_NOT_FOUND The PCD service could not find the requested token number.\r
590 \r
591**/\r
592typedef\r
593EFI_STATUS\r
594(EFIAPI *PCD_PROTOCOL_SET_EX_32)(\r
595 IN CONST EFI_GUID *Guid,\r
596 IN UINTN TokenNumber,\r
597 IN UINT32 Value\r
598 );\r
599\r
600\r
601\r
602/**\r
603 Sets a 64-bit value for a given PCD token.\r
604\r
605 When the PCD service sets a value, it will check to ensure that the \r
606 size of the value being set is compatible with the Token's existing definition. \r
607 If it is not, an error will be returned.\r
608\r
609 @param[in] Guid The 128-bit unique value that designates the namespace from which to extract the value.\r
610 @param[in] TokenNumber The PCD token number. \r
611 @param[in] Value The value to set for the PCD token.\r
612\r
613 @retval EFI_SUCCESS The procedure returned successfully.\r
614 @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data \r
615 being set was incompatible with a call to this function. \r
616 Use GetSize() to retrieve the size of the target data.\r
617 @retval EFI_NOT_FOUND The PCD service could not find the requested token number.\r
618 \r
619**/\r
620typedef\r
621EFI_STATUS\r
622(EFIAPI *PCD_PROTOCOL_SET_EX_64)(\r
623 IN CONST EFI_GUID *Guid,\r
624 IN UINTN TokenNumber,\r
625 IN UINT64 Value\r
626 );\r
627\r
628\r
629\r
630/**\r
631 Sets a value of a specified size for a given PCD token.\r
632\r
633 When the PCD service sets a value, it will check to ensure that the \r
634 size of the value being set is compatible with the Token's existing definition. \r
635 If it is not, an error will be returned.\r
636\r
637 @param[in] Guid The 128-bit unique value that designates the namespace from which to extract the value.\r
638 @param[in] TokenNumber The PCD token number. \r
639 @param[in, out] SizeOfBuffer A pointer to the length of the value being set for the PCD token. \r
640 On input, if the SizeOfValue is greater than the maximum size supported \r
641 for this TokenNumber then the output value of SizeOfValue will reflect \r
642 the maximum size supported for this TokenNumber.\r
643 @param[in] Buffer The buffer to set for the PCD token.\r
644\r
645 @retval EFI_SUCCESS The procedure returned successfully.\r
646 @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data \r
647 being set was incompatible with a call to this function. \r
648 Use GetSize() to retrieve the size of the target data.\r
649 @retval EFI_NOT_FOUND The PCD service could not find the requested token number.\r
650 \r
651**/\r
652typedef\r
653EFI_STATUS\r
654(EFIAPI *PCD_PROTOCOL_SET_EX_POINTER)(\r
655 IN CONST EFI_GUID *Guid,\r
656 IN UINTN TokenNumber,\r
657 IN OUT UINTN *SizeOfBuffer,\r
658 IN VOID *Buffer\r
659 );\r
660\r
661\r
662\r
663/**\r
664 Sets a Boolean value for a given PCD token.\r
665\r
666 When the PCD service sets a value, it will check to ensure that the \r
667 size of the value being set is compatible with the Token's existing definition. \r
668 If it is not, an error will be returned.\r
669\r
670 @param[in] Guid The 128-bit unique value that designates the namespace from which to extract the value.\r
671 @param[in] TokenNumber The PCD token number. \r
672 @param[in] Value The value to set for the PCD token.\r
673\r
674 @retval EFI_SUCCESS The procedure returned successfully.\r
675 @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data \r
676 being set was incompatible with a call to this function. \r
677 Use GetSize() to retrieve the size of the target data.\r
678 @retval EFI_NOT_FOUND The PCD service could not find the requested token number.\r
679 \r
680**/\r
681typedef\r
682EFI_STATUS\r
683(EFIAPI *PCD_PROTOCOL_SET_EX_BOOLEAN)(\r
684 IN CONST EFI_GUID *Guid,\r
685 IN UINTN TokenNumber,\r
686 IN BOOLEAN Value\r
687 );\r
688 \r
689\r
690\r
691/**\r
692 Callback on SET function prototype definition.\r
693\r
694 This notification function serves two purposes. \r
695 Firstly, it notifies the module which did the registration that the value \r
696 of this PCD token has been set. Secondly, it provides a mechanism for the \r
697 module that did the registration to intercept the set operation and override \r
698 the value that has been set, if necessary. After the invocation of the callback function, \r
699 TokenData will be used by PCD service DXE driver to modify the internal data in \r
700 PCD database.\r
701\r
702 @param[in] CallBackGuid The PCD token GUID being set.\r
703 @param[in] CallBackToken The PCD token number being set.\r
704 @param[in, out] TokenData A pointer to the token data being set.\r
705 @param[in] TokenDataSize The size, in bytes, of the data being set.\r
706\r
707 @retval VOID\r
708\r
709**/\r
710typedef\r
711VOID\r
712(EFIAPI *PCD_PROTOCOL_CALLBACK)(\r
713 IN CONST EFI_GUID *CallBackGuid, OPTIONAL\r
714 IN UINTN CallBackToken,\r
715 IN OUT VOID *TokenData,\r
716 IN UINTN TokenDataSize\r
717 );\r
718\r
719\r
720\r
721/**\r
722 Specifies a function to be called anytime the value of a designated token is changed.\r
723\r
724 @param[in] TokenNumber The PCD token number. \r
725 @param[in] Guid The 128-bit unique value that designates the namespace from which to extract the value.\r
726 @param[in] CallBackFunction The function prototype called when the value associated with the CallBackToken is set. \r
727\r
728 @retval EFI_SUCCESS The PCD service has successfully established a call event \r
729 for the CallBackToken requested.\r
730 @retval EFI_NOT_FOUND The PCD service could not find the referenced token number.\r
731\r
732**/\r
733typedef\r
734EFI_STATUS\r
735(EFIAPI *PCD_PROTOCOL_CALLBACK_ONSET)(\r
736 IN CONST EFI_GUID *Guid, OPTIONAL\r
737 IN UINTN TokenNumber,\r
738 IN PCD_PROTOCOL_CALLBACK CallBackFunction\r
739 );\r
740\r
741\r
742\r
743/**\r
744 Cancels a previously set callback function for a particular PCD token number.\r
745\r
746 @param[in] TokenNumber The PCD token number. \r
747 @param[in] Guid The 128-bit unique value that designates the namespace from which to extract the value.\r
748 @param[in] CallBackFunction The function prototype called when the value associated with the CallBackToken is set. \r
749\r
750 @retval EFI_SUCCESS The PCD service has successfully established a call event \r
751 for the CallBackToken requested.\r
752 @retval EFI_NOT_FOUND The PCD service could not find the referenced token number.\r
753\r
754**/\r
755typedef\r
756EFI_STATUS\r
757(EFIAPI *PCD_PROTOCOL_CANCEL_CALLBACK)(\r
758 IN CONST EFI_GUID *Guid, OPTIONAL\r
759 IN UINTN TokenNumber,\r
760 IN PCD_PROTOCOL_CALLBACK CallBackFunction\r
761 );\r
762\r
763\r
764\r
765/**\r
766 Retrieves the next valid token number in a given namespace. \r
767 \r
768 This is useful since the PCD infrastructure contains a sparse list of token numbers, \r
769 and one cannot know without examination or by deduction what token numbers are valid in the database. \r
770 \r
771 If TokenNumber is 0 and Guid is not NULL, then the first token from the token space specified by Guid is returned. \r
772 If TokenNumber is not 0 and Guid is not NULL, then the next token in the token space specified by Guid is returned. \r
773 If TokenNumber is 0 and Guid is NULL, then the first token in the default token space is returned. \r
774 If TokenNumber is not 0 and Guid is NULL, then the next token in the default token space is returned. \r
775 The token numbers in the default token space may not be related to token numbers in token spaces that are named by Guid. \r
776 If the next token number can be retrieved, then it is returned in TokenNumber, and EFI_SUCCESS is returned. \r
777 If TokenNumber represents the last token number in the token space specified by Guid, then EFI_NOT_FOUND is returned. \r
778 If TokenNumber is not present in the token space specified by Guid, then EFI_NOT_FOUND is returned.\r
779\r
780\r
781 @param[in] Guid The 128-bit unique value that designates the namespace from which to retrieve the next token. \r
782 This is an optional parameter that may be NULL. If this parameter is NULL, then a request is \r
783 being made to retrieve tokens from the default token space.\r
784 @param[in,out] TokenNumber \r
785 A pointer to the PCD token number to use to find the subsequent token number. \r
786\r
787 @retval EFI_SUCCESS The PCD service retrieved the next valid token number. Or the input token number \r
788 is already the last valid token number in the PCD database. \r
789 In the later case, *TokenNumber is updated with the value of 0.\r
790 @retval EFI_NOT_FOUND If this input token number and token namespace does not exist on the platform.\r
791\r
792**/\r
793typedef \r
794EFI_STATUS\r
795(EFIAPI *PCD_PROTOCOL_GET_NEXT_TOKEN)(\r
796 IN CONST EFI_GUID *Guid, OPTIONAL\r
797 IN OUT UINTN *TokenNumber\r
798 );\r
799\r
800\r
801\r
802/**\r
803 Retrieves the next valid PCD token namespace for a given namespace.\r
804\r
805 @param[in, out] Guid An indirect pointer to EFI_GUID. On input it designates \r
806 a known token namespace from which the search will start. On output, \r
807 it designates the next valid token namespace on the platform. If the input \r
808 token namespace does not exist on the platform, an error is returned and \r
809 the value of *Guid is undefined. If *Guid is NULL, then the GUID of the \r
810 first token space of the current platform is assigned to *Guid the function \r
811 return EFI_SUCCESS. If *Guid is NULL and there is no namespace exist in \r
812 the platform other than the default (NULL) token namespace, *Guid is unchanged \r
813 and the function return EFI_SUCCESS. If this input token namespace is the last \r
814 namespace on the platform, *Guid will be assigned to NULL and the function return \r
815 EFI_SUCCESS. \r
816\r
817 @retval EFI_SUCCESS The PCD service retrieved the next valid token space Guid. \r
818 Or, the input token space Guid is already the last valid token space Guid \r
819 in the PCD database. In the later case, *Guid is updated with the value of NULL.\r
820 @retval EFI_NOT_FOUND If the input token namespace does not exist on the platform.\r
821\r
822**/\r
823typedef \r
824EFI_STATUS\r
825(EFIAPI *PCD_PROTOCOL_GET_NEXT_TOKENSPACE)(\r
826 IN OUT CONST EFI_GUID **Guid\r
827 );\r
828\r
829///\r
830/// This service abstracts the ability to set/get Platform Configuration Database (PCD).\r
831///\r
832typedef struct {\r
833 PCD_PROTOCOL_SET_SKU SetSku;\r
834\r
835 PCD_PROTOCOL_GET8 Get8;\r
836 PCD_PROTOCOL_GET16 Get16;\r
837 PCD_PROTOCOL_GET32 Get32;\r
838 PCD_PROTOCOL_GET64 Get64;\r
839 PCD_PROTOCOL_GET_POINTER GetPtr;\r
840 PCD_PROTOCOL_GET_BOOLEAN GetBool;\r
841 PCD_PROTOCOL_GET_SIZE GetSize;\r
842\r
843 PCD_PROTOCOL_GET_EX_8 Get8Ex;\r
844 PCD_PROTOCOL_GET_EX_16 Get16Ex;\r
845 PCD_PROTOCOL_GET_EX_32 Get32Ex;\r
846 PCD_PROTOCOL_GET_EX_64 Get64Ex;\r
847 PCD_PROTOCOL_GET_EX_POINTER GetPtrEx;\r
848 PCD_PROTOCOL_GET_EX_BOOLEAN GetBoolEx;\r
849 PCD_PROTOCOL_GET_EX_SIZE GetSizeEx;\r
850\r
851 PCD_PROTOCOL_SET8 Set8;\r
852 PCD_PROTOCOL_SET16 Set16;\r
853 PCD_PROTOCOL_SET32 Set32;\r
854 PCD_PROTOCOL_SET64 Set64;\r
855 PCD_PROTOCOL_SET_POINTER SetPtr;\r
856 PCD_PROTOCOL_SET_BOOLEAN SetBool;\r
857\r
858 PCD_PROTOCOL_SET_EX_8 Set8Ex;\r
859 PCD_PROTOCOL_SET_EX_16 Set16Ex;\r
860 PCD_PROTOCOL_SET_EX_32 Set32Ex;\r
861 PCD_PROTOCOL_SET_EX_64 Set64Ex;\r
862 PCD_PROTOCOL_SET_EX_POINTER SetPtrEx;\r
863 PCD_PROTOCOL_SET_EX_BOOLEAN SetBoolEx;\r
864\r
865 PCD_PROTOCOL_CALLBACK_ONSET CallbackOnSet;\r
866 PCD_PROTOCOL_CANCEL_CALLBACK CancelCallback;\r
867 PCD_PROTOCOL_GET_NEXT_TOKEN GetNextToken;\r
868 PCD_PROTOCOL_GET_NEXT_TOKENSPACE GetNextTokenSpace;\r
869} PCD_PROTOCOL;\r
870\r
871#endif\r