]>
Commit | Line | Data |
---|---|---|
be35570d | 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, Intel Corporation \r | |
16 | All rights reserved. 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 | |
31 | extern 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 | |
53 | typedef\r | |
54 | VOID\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 | |
68 | typedef\r | |
69 | UINT8\r | |
70 | (EFIAPI *EFI_PCD_PROTOCOL_GET_EX_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 | |
84 | typedef\r | |
85 | UINT16\r | |
86 | (EFIAPI *EFI_PCD_PROTOCOL_GET_EX_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 | |
100 | typedef\r | |
101 | UINT32\r | |
102 | (EFIAPI *EFI_PCD_PROTOCOL_GET_EX_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 | |
117 | typedef\r | |
118 | UINT64\r | |
119 | (EFIAPI *EFI_PCD_PROTOCOL_GET_EX_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 | |
134 | typedef\r | |
135 | VOID *\r | |
136 | (EFIAPI *EFI_PCD_PROTOCOL_GET_EX_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 | |
150 | typedef\r | |
151 | BOOLEAN\r | |
152 | (EFIAPI *EFI_PCD_PROTOCOL_GET_EX_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 | |
166 | typedef\r | |
167 | UINTN\r | |
168 | (EFIAPI *EFI_PCD_PROTOCOL_GET_EX_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 | |
189 | typedef\r | |
190 | EFI_STATUS\r | |
191 | (EFIAPI *EFI_PCD_PROTOCOL_SET_EX_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 | |
213 | typedef\r | |
214 | EFI_STATUS\r | |
215 | (EFIAPI *EFI_PCD_PROTOCOL_SET_EX_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 | |
237 | typedef\r | |
238 | EFI_STATUS\r | |
239 | (EFIAPI *EFI_PCD_PROTOCOL_SET_EX_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 | |
261 | typedef\r | |
262 | EFI_STATUS\r | |
263 | (EFIAPI *EFI_PCD_PROTOCOL_SET_EX_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.\r | |
278 | @param[in] Buffer A pointer to the buffer containing the value to set for the PCD token.\r | |
279 | \r | |
280 | @retval EFI_SUCCESS The PCD service has set the value requested\r | |
281 | @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data being set was\r | |
282 | incompatible with a call to this function. Use GetSizeEx() to\r | |
283 | retrieve the size of the target data.\r | |
284 | @retval EFI_NOT_FOUND The PCD service could not find the requested token number.\r | |
285 | **/\r | |
286 | typedef\r | |
287 | EFI_STATUS\r | |
288 | (EFIAPI *EFI_PCD_PROTOCOL_SET_POINTER_EX)(\r | |
289 | IN CONST EFI_GUID *Guid,\r | |
290 | IN UINTN TokenNumber,\r | |
291 | IN UINTN SizeOfValue,\r | |
292 | IN VOID *Buffer\r | |
293 | );\r | |
294 | \r | |
295 | /**\r | |
296 | Sets a Boolean value for a given PCD token.\r | |
297 | \r | |
298 | When the PCD service sets a value, it will check to ensure that the size of the value being set is\r | |
299 | compatible with the Token's existing definition. If it is not, an error will be returned.\r | |
300 | \r | |
301 | @param[in] Guid The 128-bit unique value that designates the namespace from which to extract the value.\r | |
302 | @param[in] TokenNumber The PCD token number.\r | |
303 | @param[in] Value The value to set for the PCD token.\r | |
304 | \r | |
305 | @retval EFI_SUCCESS The PCD service has set the value requested\r | |
306 | @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data being set was\r | |
307 | incompatible with a call to this function. Use GetSizeEx() to\r | |
308 | retrieve the size of the target data.\r | |
309 | @retval EFI_NOT_FOUND The PCD service could not find the requested token number.\r | |
310 | **/\r | |
311 | typedef\r | |
312 | EFI_STATUS\r | |
313 | (EFIAPI *EFI_PCD_PROTOCOL_SET_EX_BOOLEAN)(\r | |
314 | IN CONST EFI_GUID *Guid,\r | |
315 | IN UINTN TokenNumber,\r | |
316 | IN BOOLEAN Value\r | |
317 | );\r | |
318 | \r | |
319 | typedef\r | |
320 | VOID\r | |
321 | (EFIAPI *EFI_PCD_PROTOCOL_CALLBACK)(\r | |
322 | IN EFI_GUID *Guid OPTIONAL,\r | |
323 | IN UINTN CallBackToken,\r | |
324 | IN VOID *TokenData,\r | |
325 | IN UINTN TokenDataSize\r | |
326 | );\r | |
327 | \r | |
328 | /**\r | |
329 | Specifies a function to be called anytime the value of a designated token is changed.\r | |
330 | \r | |
331 | @param[in] Guid The 128-bit unique value that designates the namespace from which to extract the value.\r | |
332 | @param[in] CallBackToken The PCD token number to monitor.\r | |
333 | @param[in] CallBackFunction The function prototype called when the value associated with the CallBackToken is set.\r | |
334 | \r | |
335 | @retval EFI_SUCCESS The PCD service has successfully established a call event for the CallBackToken requested.\r | |
336 | @retval EFI_NOT_FOUND The PCD service could not find the referenced token number.\r | |
337 | **/\r | |
338 | typedef\r | |
339 | EFI_STATUS\r | |
340 | (EFIAPI *EFI_PCD_PROTOCOL_CALLBACK_ON_SET)(\r | |
341 | IN CONST EFI_GUID *Guid OPTIONAL,\r | |
342 | IN UINTN CallBackToken,\r | |
343 | IN EFI_PCD_PROTOCOL_CALLBACK CallBackFunction\r | |
344 | );\r | |
345 | \r | |
346 | /**\r | |
347 | Cancels a callback function that was set through a previous call to the CallBackOnSet function.\r | |
348 | \r | |
349 | @param[in] Guid The 128-bit unique value that designates the namespace from which to extract the value.\r | |
350 | @param[in] CallBackToken The PCD token number to monitor.\r | |
351 | @param[in] CallBackFunction The function prototype called when the value associated with the CallBackToken is set.\r | |
352 | \r | |
353 | @retval EFI_SUCCESS The PCD service has successfully established a call event for the CallBackToken requested.\r | |
354 | @retval EFI_NOT_FOUND The PCD service could not find the referenced token number.\r | |
355 | **/\r | |
356 | typedef\r | |
357 | EFI_STATUS\r | |
358 | (EFIAPI *EFI_PCD_PROTOCOL_CANCEL_CALLBACK)(\r | |
359 | IN CONST EFI_GUID *Guid OPTIONAL,\r | |
360 | IN UINTN CallBackToken,\r | |
361 | IN EFI_PCD_PROTOCOL_CALLBACK CallBackFunction\r | |
362 | );\r | |
363 | \r | |
364 | /**\r | |
365 | Gets the next valid token number in a given namespace. This is useful since the PCD infrastructure\r | |
366 | contains a sparse list of token numbers, and one cannot a priori know what token numbers are valid\r | |
367 | in the database.\r | |
368 | \r | |
369 | @param[in] Guid The 128-bit unique value that designates the namespace from which to retrieve the next token.\r | |
370 | @param[in] TokenNumber A pointer to the PCD token number to use to find the subsequent token number. To\r | |
371 | retrieve the "first" token, have the pointer reference a TokenNumber value of 0.\r | |
372 | @retval EFI_SUCCESS The PCD service has retrieved the value requested\r | |
373 | @retval EFI_NOT_FOUND The PCD service could not find data from the requested token number. \r | |
374 | **/\r | |
375 | typedef\r | |
376 | EFI_STATUS\r | |
377 | (EFIAPI *EFI_PCD_PROTOCOL_GET_NEXT_TOKEN)(\r | |
378 | IN CONST EFI_GUID *Guid, OPTIONAL\r | |
379 | IN UINTN *TokenNumber\r | |
380 | );\r | |
381 | \r | |
382 | /**\r | |
383 | Gets the next valid token namespace for a given namespace. This is useful to traverse the valid\r | |
384 | token namespaces on a platform.\r | |
385 | \r | |
386 | @param[in, out] Guid An indirect pointer to EFI_GUID. On input it designates a known token namespace\r | |
387 | from which the search will start. On output, it designates the next valid token\r | |
388 | namespace on the platform. If *Guid is NULL, then the GUID of the first token\r | |
389 | space of the current platform is returned. If the search cannot locate the next valid\r | |
390 | token namespace, an error is returned and the value of *Guid is undefined.\r | |
391 | \r | |
392 | @retval EFI_SUCCESS The PCD service retrieved the value requested.\r | |
393 | @retval EFI_NOT_FOUND The PCD service could not find the next valid token namespace.\r | |
394 | **/\r | |
395 | typedef\r | |
396 | EFI_STATUS\r | |
397 | (EFIAPI *EFI_PCD_PROTOCOL_GET_NEXT_TOKEN_SPACE)(\r | |
398 | IN OUT CONST EFI_GUID **Guid\r | |
399 | );\r | |
400 | \r | |
401 | typedef struct _EFI_PCD_PROTOCOL {\r | |
402 | EFI_PCD_PROTOCOL_SET_SKU SetSku;\r | |
403 | EFI_PCD_PROTOCOL_GET_EX_8 Get8Ex;\r | |
404 | EFI_PCD_PROTOCOL_GET_EX_16 Get16Ex;\r | |
405 | EFI_PCD_PROTOCOL_GET_EX_32 Get32Ex;\r | |
406 | EFI_PCD_PROTOCOL_GET_EX_64 Get64Ex;\r | |
407 | EFI_PCD_PROTOCOL_GET_EX_POINTER GetPtrEx;\r | |
408 | EFI_PCD_PROTOCOL_GET_EX_BOOLEAN GetBoolEx;\r | |
409 | EFI_PCD_PROTOCOL_GET_EX_SIZE GetSizeEx;\r | |
410 | EFI_PCD_PROTOCOL_SET_EX_8 Set8Ex;\r | |
411 | EFI_PCD_PROTOCOL_SET_EX_16 Set16Ex;\r | |
412 | EFI_PCD_PROTOCOL_SET_EX_32 Set32Ex;\r | |
413 | EFI_PCD_PROTOCOL_SET_EX_64 Set64Ex;\r | |
414 | EFI_PCD_PROTOCOL_SET_EX_POINTER SetPtrEx;\r | |
415 | EFI_PCD_PROTOCOL_SET_EX_BOOLEAN SetBoolEx;\r | |
416 | EFI_PCD_PROTOCOL_CALLBACK_ON_SET CallbackOnSet;\r | |
417 | EFI_PCD_PROTOCOL_CANCEL_CALLBACK CancelCallback;\r | |
418 | EFI_PCD_PROTOCOL_GET_NEXT_TOKEN GetNextToken;\r | |
419 | EFI_PCD_PROTOCOL_GET_NEXT_TOKEN_SPACE GetNextTokenSpace;\r | |
420 | } EFI_PCD_PROTOCOL;\r | |
421 | \r | |
422 | #endif\r |