]> git.proxmox.com Git - mirror_edk2.git/blame_incremental - MdePkg/Include/Protocol/PiPcd.h
Update the copyright notice format
[mirror_edk2.git] / MdePkg / Include / Protocol / PiPcd.h
... / ...
CommitLineData
1/** @file\r
2 Platform Configuration Database (PCD) Protocol defined in PI 1.2 Vol3\r
3\r
4 A platform database that contains a variety of current platform settings or\r
5 directives that can be accessed by a driver or application.\r
6 PI PCD protocol only provide the accessing interfaces for Dynamic-Ex type PCD.\r
7\r
8 Callers to this protocol must be at a TPL_APPLICATION task priority level.\r
9 This is the base PCD service API that provides an abstraction for accessing configuration content in\r
10 the platform. It a seamless mechanism for extracting information regardless of where the\r
11 information is stored (such as in Read-only data, or an EFI Variable).\r
12 This protocol allows access to data through size-granular APIs and provides a mechanism for a\r
13 firmware component to monitor specific settings and be alerted when a setting is changed.\r
14\r
15 Copyright (c) 2009 - 2010, Intel Corporation. All rights reserved.<BR>\r
16 This program and the accompanying materials\r
17 are licensed and made available under the terms and conditions of the BSD License\r
18 which accompanies this distribution. The full text of the license may be found at\r
19 http://opensource.org/licenses/bsd-license.php\r
20\r
21 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
22 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
23\r
24 @par Revision Reference:\r
25 PI Version 1.2 Vol 3.\r
26**/\r
27\r
28#ifndef __PI_PCD_H__\r
29#define __PI_PCD_H__\r
30\r
31extern EFI_GUID gEfiPcdProtocolGuid;\r
32\r
33#define EFI_PCD_PROTOCOL_GUID \\r
34 { 0x13a3f0f6, 0x264a, 0x3ef0, { 0xf2, 0xe0, 0xde, 0xc5, 0x12, 0x34, 0x2f, 0x34 } }\r
35\r
36#define EFI_PCD_INVALID_TOKEN_NUMBER ((UINTN) 0)\r
37\r
38/**\r
39 SetSku() sets the SKU Id to be used for subsequent calls to set or get PCD values. SetSku() is\r
40 normally called only once by the system.\r
41 For each item (token), the database can hold a single value that applies to all SKUs, or multiple\r
42 values, where each value is associated with a specific SKU Id. Items with multiple, SKU-specific\r
43 values are called SKU enabled.\r
44 The SKU Id of zero is reserved as a default. The valid SkuId range is 1 to 255. For tokens that are\r
45 not SKU enabled, the system ignores any set SKU Id and works with the single value for that token.\r
46 For SKU-enabled tokens, the system will use the SKU Id set by the last call to SetSku(). If no SKU\r
47 Id is set or the currently set SKU Id isn't valid for the specified token, the system uses the default\r
48 SKU Id. If the system attempts to use the default SKU Id and no value has been set for that Id, the\r
49 results are unpredictable.\r
50\r
51 @param[in] SkuId The SKU value to set.\r
52**/\r
53typedef\r
54VOID\r
55(EFIAPI *EFI_PCD_PROTOCOL_SET_SKU)(\r
56 IN UINTN SkuId\r
57);\r
58\r
59/**\r
60 Retrieves an 8-bit value for a given PCD token.\r
61 If the TokenNumber is invalid, the results are unpredictable.\r
62\r
63 @param[in] Guid The 128-bit unique value that designates the namespace from which to extract the value.\r
64 @param[in] TokenNumber The PCD token number.\r
65\r
66 @return 8-bit value for a given PCD token.\r
67**/\r
68typedef\r
69UINT8\r
70(EFIAPI *EFI_PCD_PROTOCOL_GET_8)(\r
71 IN CONST EFI_GUID *Guid,\r
72 IN UINTN TokenNumber\r
73);\r
74\r
75/**\r
76 Retrieves the current word-sized value for a PCD token number.\r
77 If the TokenNumber is invalid, the results are unpredictable.\r
78\r
79 @param[in] Guid The 128-bit unique value that designates the namespace from which to extract the value.\r
80 @param[in] TokenNumber The PCD token number.\r
81\r
82 @return word-sized value for a given PCD token.\r
83**/\r
84typedef\r
85UINT16\r
86(EFIAPI *EFI_PCD_PROTOCOL_GET_16)(\r
87 IN CONST EFI_GUID *Guid,\r
88 IN UINTN TokenNumber\r
89);\r
90\r
91/**\r
92 Retrieves the current 32-bit sized value for a PCD token number.\r
93 If the TokenNumber is invalid, the results are unpredictable.\r
94\r
95 @param[in] Guid The 128-bit unique value that designates the namespace from which to extract the value.\r
96 @param[in] TokenNumber The PCD token number.\r
97\r
98 @return 32-bit value for a given PCD token.\r
99**/\r
100typedef\r
101UINT32\r
102(EFIAPI *EFI_PCD_PROTOCOL_GET_32)(\r
103 IN CONST EFI_GUID *Guid,\r
104 IN UINTN TokenNumber\r
105);\r
106\r
107/**\r
108 Retrieves the 64-bit sized value for a PCD token number.\r
109 If the TokenNumber is invalid, the results are unpredictable.\r
110\r
111 @param[in] Guid The 128-bit unique value that designates the namespace from which to extract the value.\r
112 @param[in] TokenNumber The PCD token number.\r
113\r
114 @return 64-bit value for a given PCD token.\r
115\r
116**/\r
117typedef\r
118UINT64\r
119(EFIAPI *EFI_PCD_PROTOCOL_GET_64)(\r
120 IN CONST EFI_GUID *Guid,\r
121 IN UINTN TokenNumber\r
122);\r
123\r
124/**\r
125 Retrieves the current pointer to the value for a PCD token number. Do not make any assumptions\r
126 about the alignment of the pointer that is returned by this function call. If the TokenNumber is\r
127 invalid, the results are unpredictable.\r
128\r
129 @param[in] Guid The 128-bit unique value that designates the namespace from which to extract the value.\r
130 @param[in] TokenNumber The PCD token number.\r
131\r
132 @return pointer to a value for a given PCD token.\r
133**/\r
134typedef\r
135VOID *\r
136(EFIAPI *EFI_PCD_PROTOCOL_GET_POINTER)(\r
137 IN CONST EFI_GUID *Guid,\r
138 IN UINTN TokenNumber\r
139);\r
140\r
141/**\r
142 Retrieves the current BOOLEAN-sized value for a PCD token number. If the TokenNumber is\r
143 invalid, the results are unpredictable.\r
144\r
145 @param[in] Guid The 128-bit unique value that designates the namespace from which to extract the value.\r
146 @param[in] TokenNumber The PCD token number.\r
147\r
148 @return Boolean value for a given PCD token.\r
149**/\r
150typedef\r
151BOOLEAN\r
152(EFIAPI *EFI_PCD_PROTOCOL_GET_BOOLEAN)(\r
153 IN CONST EFI_GUID *Guid,\r
154 IN UINTN TokenNumber\r
155);\r
156\r
157/**\r
158 Retrieves the current size of a particular PCD token. If the TokenNumber is invalid, the results are\r
159 unpredictable.\r
160\r
161 @param[in] Guid The 128-bit unique value that designates the namespace from which to extract the value.\r
162 @param[in] TokenNumber The PCD token number.\r
163\r
164 @return the size of the value for a given PCD token.\r
165**/\r
166typedef\r
167UINTN\r
168(EFIAPI *EFI_PCD_PROTOCOL_GET_SIZE)(\r
169 IN CONST EFI_GUID *Guid,\r
170 IN UINTN TokenNumber\r
171);\r
172\r
173/**\r
174 Sets an 8-bit value for a given PCD token.\r
175\r
176 When the PCD service sets a value, it will check to ensure that the size of the value being set is\r
177 compatible with the Token's existing definition. If it is not, an error will be returned.\r
178\r
179 @param[in] Guid The 128-bit unique value that designates the namespace from which to extract the value.\r
180 @param[in] TokenNumber The PCD token number.\r
181 @param[in] Value The value to set for the PCD token.\r
182\r
183 @retval EFI_SUCCESS The PCD service has set the value requested\r
184 @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data being set was\r
185 incompatible with a call to this function. Use GetSizeEx() to\r
186 retrieve the size of the target data.\r
187 @retval EFI_NOT_FOUND The PCD service could not find the requested token number.\r
188**/\r
189typedef\r
190EFI_STATUS\r
191(EFIAPI *EFI_PCD_PROTOCOL_SET_8)(\r
192 IN CONST EFI_GUID *Guid,\r
193 IN UINTN TokenNumber,\r
194 IN UINT8 Value\r
195);\r
196\r
197/**\r
198 Sets an 16-bit value for a given PCD token.\r
199\r
200 When the PCD service sets a value, it will check to ensure that the size of the value being set is\r
201 compatible with the Token's existing definition. If it is not, an error will be returned.\r
202\r
203 @param[in] Guid The 128-bit unique value that designates the namespace from which to extract the value.\r
204 @param[in] TokenNumber The PCD token number.\r
205 @param[in] Value The value to set for the PCD token.\r
206\r
207 @retval EFI_SUCCESS The PCD service has set the value requested\r
208 @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data being set was\r
209 incompatible with a call to this function. Use GetSizeEx() to\r
210 retrieve the size of the target data.\r
211 @retval EFI_NOT_FOUND The PCD service could not find the requested token number.\r
212**/\r
213typedef\r
214EFI_STATUS\r
215(EFIAPI *EFI_PCD_PROTOCOL_SET_16)(\r
216 IN CONST EFI_GUID *Guid,\r
217 IN UINTN TokenNumber,\r
218 IN UINT16 Value\r
219);\r
220\r
221/**\r
222 Sets an 32-bit value for a given PCD token.\r
223\r
224 When the PCD service sets a value, it will check to ensure that the size of the value being set is\r
225 compatible with the Token's existing definition. If it is not, an error will be returned.\r
226\r
227 @param[in] Guid The 128-bit unique value that designates the namespace from which to extract the value.\r
228 @param[in] TokenNumber The PCD token number.\r
229 @param[in] Value The value to set for the PCD token.\r
230\r
231 @retval EFI_SUCCESS The PCD service has set the value requested\r
232 @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data being set was\r
233 incompatible with a call to this function. Use GetSizeEx() to\r
234 retrieve the size of the target data.\r
235 @retval EFI_NOT_FOUND The PCD service could not find the requested token number.\r
236**/\r
237typedef\r
238EFI_STATUS\r
239(EFIAPI *EFI_PCD_PROTOCOL_SET_32)(\r
240 IN CONST EFI_GUID *Guid,\r
241 IN UINTN TokenNumber,\r
242 IN UINT32 Value\r
243);\r
244\r
245/**\r
246 Sets an 64-bit value for a given PCD token.\r
247\r
248 When the PCD service sets a value, it will check to ensure that the size of the value being set is\r
249 compatible with the Token's existing definition. If it is not, an error will be returned.\r
250\r
251 @param[in] Guid The 128-bit unique value that designates the namespace from which to extract the value.\r
252 @param[in] TokenNumber The PCD token number.\r
253 @param[in] Value The value to set for the PCD token.\r
254\r
255 @retval EFI_SUCCESS The PCD service has set the value requested\r
256 @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data being set was\r
257 incompatible with a call to this function. Use GetSizeEx() to\r
258 retrieve the size of the target data.\r
259 @retval EFI_NOT_FOUND The PCD service could not find the requested token number.\r
260**/\r
261typedef\r
262EFI_STATUS\r
263(EFIAPI *EFI_PCD_PROTOCOL_SET_64)(\r
264 IN CONST EFI_GUID *Guid,\r
265 IN UINTN TokenNumber,\r
266 IN UINT64 Value\r
267);\r
268\r
269/**\r
270 Sets a value of a specified size for a given PCD token.\r
271\r
272 When the PCD service sets a value, it will check to ensure that the size of the value being set is\r
273 compatible with the Token's existing definition. If it is not, an error will be returned.\r
274\r
275 @param[in] Guid The 128-bit unique value that designates the namespace from which to extract the value.\r
276 @param[in] TokenNumber The PCD token number.\r
277 @param[in] SizeOfValue The length of the value being set for the PCD token. If too large of a length is\r
278 specified, upon return from this function the value of SizeOfValue will\r
279 reflect the maximum size for the PCD token.\r
280 @param[in] Buffer A pointer to the buffer containing the value to set for the PCD token.\r
281\r
282 @retval EFI_SUCCESS The PCD service has set the value requested\r
283 @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data being set was\r
284 incompatible with a call to this function. Use GetSizeEx() to\r
285 retrieve the size of the target data.\r
286 @retval EFI_NOT_FOUND The PCD service could not find the requested token number.\r
287**/\r
288typedef\r
289EFI_STATUS\r
290(EFIAPI *EFI_PCD_PROTOCOL_SET_POINTER)(\r
291 IN CONST EFI_GUID *Guid,\r
292 IN UINTN TokenNumber,\r
293 IN OUT UINTN *SizeOfValue,\r
294 IN VOID *Buffer\r
295);\r
296\r
297/**\r
298 Sets a Boolean value for a given PCD token.\r
299\r
300 When the PCD service sets a value, it will check to ensure that the size of the value being set is\r
301 compatible with the Token's existing definition. If it is not, an error will be returned.\r
302\r
303 @param[in] Guid The 128-bit unique value that designates the namespace from which to extract the value.\r
304 @param[in] TokenNumber The PCD token number.\r
305 @param[in] Value The value to set for the PCD token.\r
306\r
307 @retval EFI_SUCCESS The PCD service has set the value requested\r
308 @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data being set was\r
309 incompatible with a call to this function. Use GetSizeEx() to\r
310 retrieve the size of the target data.\r
311 @retval EFI_NOT_FOUND The PCD service could not find the requested token number.\r
312**/\r
313typedef\r
314EFI_STATUS\r
315(EFIAPI *EFI_PCD_PROTOCOL_SET_BOOLEAN)(\r
316 IN CONST EFI_GUID *Guid,\r
317 IN UINTN TokenNumber,\r
318 IN BOOLEAN Value\r
319);\r
320\r
321typedef\r
322VOID\r
323(EFIAPI *EFI_PCD_PROTOCOL_CALLBACK)(\r
324 IN EFI_GUID *Guid OPTIONAL,\r
325 IN UINTN CallBackToken,\r
326 IN OUT VOID *TokenData,\r
327 IN UINTN TokenDataSize\r
328);\r
329\r
330/**\r
331 Specifies a function to be called anytime the value of a designated token is changed.\r
332\r
333 @param[in] Guid The 128-bit unique value that designates the namespace from which to extract the value.\r
334 @param[in] CallBackToken The PCD token number to monitor.\r
335 @param[in] CallBackFunction The function prototype called when the value associated with the CallBackToken is set.\r
336\r
337 @retval EFI_SUCCESS The PCD service has successfully established a call event for the CallBackToken requested.\r
338 @retval EFI_NOT_FOUND The PCD service could not find the referenced token number.\r
339**/\r
340typedef\r
341EFI_STATUS\r
342(EFIAPI *EFI_PCD_PROTOCOL_CALLBACK_ON_SET)(\r
343 IN CONST EFI_GUID *Guid OPTIONAL,\r
344 IN UINTN CallBackToken,\r
345 IN EFI_PCD_PROTOCOL_CALLBACK CallBackFunction\r
346);\r
347\r
348/**\r
349 Cancels a callback function that was set through a previous call to the CallBackOnSet function.\r
350\r
351 @param[in] Guid The 128-bit unique value that designates the namespace from which to extract the value.\r
352 @param[in] CallBackToken The PCD token number to monitor.\r
353 @param[in] CallBackFunction The function prototype called when the value associated with the CallBackToken is set.\r
354\r
355 @retval EFI_SUCCESS The PCD service has successfully established a call event for the CallBackToken requested.\r
356 @retval EFI_NOT_FOUND The PCD service could not find the referenced token number.\r
357**/\r
358typedef\r
359EFI_STATUS\r
360(EFIAPI *EFI_PCD_PROTOCOL_CANCEL_CALLBACK)(\r
361 IN CONST EFI_GUID *Guid OPTIONAL,\r
362 IN UINTN CallBackToken,\r
363 IN EFI_PCD_PROTOCOL_CALLBACK CallBackFunction\r
364);\r
365\r
366/**\r
367 Gets the next valid token number in a given namespace. This is useful since the PCD infrastructure\r
368 contains a sparse list of token numbers, and one cannot a priori know what token numbers are valid\r
369 in the database.\r
370\r
371 @param[in] Guid The 128-bit unique value that designates the namespace from which to retrieve the next token.\r
372 @param[in] TokenNumber A pointer to the PCD token number to use to find the subsequent token number. To\r
373 retrieve the "first" token, have the pointer reference a TokenNumber value of 0.\r
374 @retval EFI_SUCCESS The PCD service has retrieved the value requested\r
375 @retval EFI_NOT_FOUND The PCD service could not find data from the requested token number.\r
376**/\r
377typedef\r
378EFI_STATUS\r
379(EFIAPI *EFI_PCD_PROTOCOL_GET_NEXT_TOKEN)(\r
380 IN CONST EFI_GUID *Guid, OPTIONAL\r
381 IN UINTN *TokenNumber\r
382);\r
383\r
384/**\r
385 Gets the next valid token namespace for a given namespace. This is useful to traverse the valid\r
386 token namespaces on a platform.\r
387\r
388 @param[in, out] Guid An indirect pointer to EFI_GUID. On input it designates a known token namespace\r
389 from which the search will start. On output, it designates the next valid token\r
390 namespace on the platform. If *Guid is NULL, then the GUID of the first token\r
391 space of the current platform is returned. If the search cannot locate the next valid\r
392 token namespace, an error is returned and the value of *Guid is undefined.\r
393\r
394 @retval EFI_SUCCESS The PCD service retrieved the value requested.\r
395 @retval EFI_NOT_FOUND The PCD service could not find the next valid token namespace.\r
396**/\r
397typedef\r
398EFI_STATUS\r
399(EFIAPI *EFI_PCD_PROTOCOL_GET_NEXT_TOKEN_SPACE)(\r
400 IN OUT CONST EFI_GUID **Guid\r
401);\r
402\r
403typedef struct _EFI_PCD_PROTOCOL {\r
404 EFI_PCD_PROTOCOL_SET_SKU SetSku;\r
405 EFI_PCD_PROTOCOL_GET_8 Get8;\r
406 EFI_PCD_PROTOCOL_GET_16 Get16;\r
407 EFI_PCD_PROTOCOL_GET_32 Get32;\r
408 EFI_PCD_PROTOCOL_GET_64 Get64;\r
409 EFI_PCD_PROTOCOL_GET_POINTER GetPtr;\r
410 EFI_PCD_PROTOCOL_GET_BOOLEAN GetBool;\r
411 EFI_PCD_PROTOCOL_GET_SIZE GetSize;\r
412 EFI_PCD_PROTOCOL_SET_8 Set8;\r
413 EFI_PCD_PROTOCOL_SET_16 Set16;\r
414 EFI_PCD_PROTOCOL_SET_32 Set32;\r
415 EFI_PCD_PROTOCOL_SET_64 Set64;\r
416 EFI_PCD_PROTOCOL_SET_POINTER SetPtr;\r
417 EFI_PCD_PROTOCOL_SET_BOOLEAN SetBool;\r
418 EFI_PCD_PROTOCOL_CALLBACK_ON_SET CallbackOnSet;\r
419 EFI_PCD_PROTOCOL_CANCEL_CALLBACK CancelCallback;\r
420 EFI_PCD_PROTOCOL_GET_NEXT_TOKEN GetNextToken;\r
421 EFI_PCD_PROTOCOL_GET_NEXT_TOKEN_SPACE GetNextTokenSpace;\r
422} EFI_PCD_PROTOCOL;\r
423\r
424#endif\r