Sync up Pcd Library Instances and PCD Driver/PEIM with Pcd spec 0.51 and Mde 0.51
[mirror_edk2.git] / EdkModulePkg / Universal / PCD / Pei / Service.h
CommitLineData
878ddf1f 1/** @file\r
2Private functions used by PCD PEIM.\r
3\r
4Copyright (c) 2006, Intel Corporation \r
5All rights reserved. This program and the accompanying materials \r
6are licensed and made available under the terms and conditions of the BSD License \r
7which accompanies this distribution. The full text of the license may be found at \r
8http://opensource.org/licenses/bsd-license.php \r
9 \r
10THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, \r
11WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. \r
12\r
13\r
14Module Name: Service.h\r
15\r
16**/\r
17\r
18#ifndef _SERVICE_H\r
19#define _SERVICE_H\r
20\r
52e1905d 21#define USE_AUTOGEN\r
22\r
23#ifndef USE_AUTOGEN\r
24//\r
25// The following definition will be generated by build tool \r
878ddf1f 26//\r
52e1905d 27\r
878ddf1f 28//\r
52e1905d 29// Common definitions that is shared by PEI and DXE PCD database\r
30//\r
31#define PCD_TYPE_SHIFT 24\r
32\r
33\r
34#define PCD_TYPE_DATA (0x00 << PCD_TYPE_SHIFT)\r
35#define PCD_TYPE_HII (0x80 << PCD_TYPE_SHIFT)\r
36#define PCD_TYPE_VPD (0x40 << PCD_TYPE_SHIFT)\r
37#define PCD_TYPE_SKU_ENABLED (0x20 << PCD_TYPE_SHIFT)\r
38\r
39\r
40#define PCD_DATABASE_OFFSET_MASK (~(PCD_TYPE_HII | PCD_TYPE_VPD | PCD_TYPE_SKU_ENABLED))\r
41\r
42typedef struct {\r
43 UINT32 ExTokenNumber;\r
44 UINT32 LocalTokenNumber; // PCD Number of this particular platform build\r
45 UINT16 ExGuidIndex; // Index of GuidTable\r
46} DYNAMICEX_MAPPING;\r
47\r
48\r
49typedef struct {\r
50 UINT32 SkuDataStartOffset; //We have to use offsetof MACRO as we don't know padding done by compiler\r
51 UINT32 SkuIdTableOffset; //Offset from the PCD_DB\r
52} SKU_HEAD;\r
53\r
54\r
55typedef struct {\r
56 UINT16 GuidTableIndex; // Offset in Guid Table in units of GUID.\r
57 UINT16 StringIndex; // Offset in String Table in units of UINT16.\r
58 UINT16 Offset; // Offset in Variable\r
59} VARIABLE_HEAD ;\r
60\r
61\r
62typedef struct {\r
63 UINT32 Offset;\r
64} VPD_HEAD;\r
65\r
66typedef struct {\r
67 UINT32 LocalTokenNumber;\r
68 UINT16 TokenNumber;\r
69 UINT16 Size;\r
70} SIZEINFO;\r
71\r
72#define offsetof(s,m) (UINT32)&(((s *)0)->m)\r
878ddf1f 73\r
878ddf1f 74\r
52e1905d 75\r
76\r
77\r
78//\r
79// C Structure generate for PEI PCD Database\r
878ddf1f 80//\r
52e1905d 81#define PEI_EXMAPPING_TABLE_SIZE 1\r
82#define PEI_GUID_TABLE_SIZE 1\r
83#define PEI_LOCAL_TOKEN_NUMBER 1\r
84#define PEI_STRING_TABLE_SIZE 2\r
85#define PEI_SKUID_TABLE_SIZE 3\r
86\r
87\r
88#define PEI_DATABASE_EMPTRY FALSE\r
89#define PEI_EXMAP_TABLE_EMPTY FALSE\r
90#define PEI_GUID_TABLE_EMPTY FALSE\r
91#define PEI_STRINGTABLE_EMPTY FALSE\r
92#define PEI_SIZETABLE_EMPTY FALSE\r
93#define PEI_SKUID_TABLE_EMPTY FALSE\r
94\r
95\r
96typedef struct {\r
97\r
98 DYNAMICEX_MAPPING ExMapTable[PEI_EXMAPPING_TABLE_SIZE];\r
99 EFI_GUID GuidTable[PEI_GUID_TABLE_SIZE];\r
100\r
101 UINT32 LocalTokenNumberTable[PEI_LOCAL_TOKEN_NUMBER];\r
102\r
103\r
104 UINT16 StringTable[PEI_STRING_TABLE_SIZE];\r
105 UINT16 SizeTable[PEI_LOCAL_TOKEN_NUMBER];\r
106\r
107 UINT8 SkuIdTable[PEI_SKUID_TABLE_SIZE];\r
108 \r
109 SKU_ID SystemSkuId;\r
110\r
111} PEI_PCD_DATABASE_INIT;\r
112\r
113typedef struct {\r
114 UINT8 Dummy;\r
115} PEI_PCD_DATABASE_UNINIT;\r
116\r
117#define PEI_PCD_DB_INIT_VALUE \\r
118 /* ExMapTable */ \\r
119 { \\r
120 { /* ExTokenNumber */ 0x00000001, /* LocalTokenNumberIndex */ 0, /* ExGuidIndex */ 0} \\r
121 }, \\r
122 \\r
123 /* GuidTable */ \\r
124 { \\r
125 { 0xBB25CF6F, 0xF1D4, 0x11D2, {0x9A, 0x0C, 0x00, 0x90, 0x27, 0x3F, 0xC1, 0xFD }} \\r
126 }, \\r
127 \\r
128 /* LocalTokenNumberTable */ \\r
129 { \\r
130 0 \\r
131 }, \\r
132 \\r
133 /* StringTable */ \\r
134 { \\r
135 L"\0" \\r
136 }, \\r
137 \\r
138 /* SizeTable */ \\r
139 { \\r
140 4 \\r
141 }, \\r
142 \\r
143 /* SkuIdTable */ \\r
144 { \\r
145 /*MaxSku*/ 2, /*SkuId*/ 100, /*SkuId*/200 \\r
146 },\\r
147 \\r
148 /* SystemSkuId */ \\r
149 0 \\r
150\r
151\r
878ddf1f 152//\r
52e1905d 153// End of Autogen Code\r
154//\r
155#endif\r
878ddf1f 156\r
52e1905d 157/*\r
158typedef struct {\r
159 PEI_PCD_DATABASE_INIT Init;\r
160 PEI_PCD_DATABASE_UNINIT Uninit;\r
161} PEI_PCD_DATABASE;\r
162*/\r
878ddf1f 163\r
164/* Internal Function definitions */\r
165\r
52e1905d 166PEI_PCD_DATABASE *\r
167GetPcdDatabase (\r
168 VOID\r
169 )\r
170;\r
878ddf1f 171\r
172EFI_STATUS\r
52e1905d 173SetWorker (\r
174 IN UINTN TokenNumber,\r
175 IN VOID *Data,\r
176 IN UINTN Size,\r
177 IN BOOLEAN PtrType\r
178 )\r
179;\r
878ddf1f 180\r
52e1905d 181EFI_STATUS\r
182SetWorkerByLocalTokenNumber (\r
183 UINT32 LocalTokenNumber,\r
184 VOID *Data,\r
185 UINTN Size,\r
186 BOOLEAN PtrType\r
187 )\r
188;\r
189\r
190EFI_STATUS\r
191ExSetWorker (\r
192 IN UINT32 ExTokenNumber,\r
193 IN CONST EFI_GUID *Guid,\r
194 VOID *Data,\r
195 UINTN Size,\r
196 BOOLEAN PtrType\r
197 )\r
198;\r
199\r
200VOID *\r
201GetWorker (\r
202 UINTN TokenNumber,\r
203 UINTN GetSize\r
204 )\r
205;\r
206\r
207VOID *\r
208ExGetWorker (\r
209 IN CONST EFI_GUID *Guid,\r
210 IN UINT32 ExTokenNumber,\r
211 IN UINTN GetSize\r
212 )\r
213;\r
214\r
215typedef struct {\r
216 UINTN TokenNumber;\r
217 UINTN Size;\r
218 UINT32 LocalTokenNumberAlias;\r
219} EX_PCD_ENTRY_ATTRIBUTE;\r
220\r
221VOID\r
222GetExPcdTokenAttributes (\r
223 IN CONST EFI_GUID *Guid,\r
224 IN UINT32 ExTokenNumber,\r
225 OUT EX_PCD_ENTRY_ATTRIBUTE *ExAttr\r
226 )\r
227;\r
878ddf1f 228\r
229EFI_STATUS\r
230PeiRegisterCallBackWorker (\r
231 IN UINTN TokenNumber,\r
232 IN CONST GUID *Guid, OPTIONAL\r
233 IN PCD_PPI_CALLBACK CallBackFunction,\r
234 IN BOOLEAN Register\r
235);\r
236\r
878ddf1f 237VOID\r
238BuildPcdDatabase (\r
52e1905d 239 VOID\r
878ddf1f 240 )\r
241;\r
242\r
243\r
244extern EFI_GUID gPcdImageFileGuid;\r
245\r
246//\r
247// PPI Interface Implementation Declaration.\r
248//\r
249EFI_STATUS\r
250EFIAPI\r
251PeiPcdSetSku (\r
252 IN UINTN SkuId\r
253 )\r
254;\r
255\r
256\r
257UINT8\r
258EFIAPI\r
259PeiPcdGet8 (\r
260 IN UINTN TokenNumber\r
261 )\r
262;\r
263\r
264\r
265UINT16\r
266EFIAPI\r
267PeiPcdGet16 (\r
268 IN UINTN TokenNumber\r
269 )\r
270;\r
271\r
272\r
273UINT32\r
274EFIAPI\r
275PeiPcdGet32 (\r
276 IN UINTN TokenNumber\r
277 )\r
278;\r
279\r
280\r
281UINT64\r
282EFIAPI\r
283PeiPcdGet64 (\r
284 IN UINTN TokenNumber\r
285 )\r
286;\r
287\r
288\r
289VOID *\r
290EFIAPI\r
291PeiPcdGetPtr (\r
292 IN UINTN TokenNumber\r
293 )\r
294;\r
295\r
296\r
297BOOLEAN\r
298EFIAPI\r
299PeiPcdGetBool (\r
300 IN UINTN TokenNumber\r
301 )\r
302;\r
303\r
304\r
305UINTN\r
306EFIAPI\r
307PeiPcdGetSize (\r
308 IN UINTN TokenNumber\r
309 )\r
310;\r
311\r
312\r
313UINT8\r
314EFIAPI\r
315PeiPcdGet8Ex (\r
316 IN CONST EFI_GUID *Guid,\r
317 IN UINTN TokenNumber\r
318 )\r
319;\r
320\r
321\r
322UINT16\r
323EFIAPI\r
324PeiPcdGet16Ex (\r
325 IN CONST EFI_GUID *Guid,\r
326 IN UINTN TokenNumber\r
327 )\r
328;\r
329\r
330UINT32\r
331EFIAPI\r
332PeiPcdGet32Ex (\r
333 IN CONST EFI_GUID *Guid,\r
334 IN UINTN TokenNumber\r
335 )\r
336;\r
337\r
338\r
339UINT64\r
340EFIAPI\r
341PeiPcdGet64Ex (\r
342 IN CONST EFI_GUID *Guid,\r
343 IN UINTN TokenNumber\r
344 )\r
345;\r
346\r
347\r
348VOID *\r
349EFIAPI\r
350PeiPcdGetPtrEx (\r
351 IN CONST EFI_GUID *Guid,\r
352 IN UINTN TokenNumber\r
353 )\r
354;\r
355\r
356\r
357BOOLEAN\r
358EFIAPI\r
359PeiPcdGetBoolEx (\r
360 IN CONST EFI_GUID *Guid,\r
361 IN UINTN TokenNumber\r
362 )\r
363;\r
364\r
365\r
366UINTN\r
367EFIAPI\r
368PeiPcdGetSizeEx (\r
369 IN CONST EFI_GUID *Guid,\r
370 IN UINTN TokenNumber\r
371 )\r
372;\r
373\r
374\r
375EFI_STATUS\r
376EFIAPI\r
377PeiPcdSet8 (\r
378 IN UINTN TokenNumber,\r
379 IN UINT8 Value\r
380 )\r
381;\r
382\r
383\r
384EFI_STATUS\r
385EFIAPI\r
386PeiPcdSet16 (\r
387 IN UINTN TokenNumber,\r
388 IN UINT16 Value\r
389 )\r
390;\r
391\r
392\r
393EFI_STATUS\r
394EFIAPI\r
395PeiPcdSet32 (\r
396 IN UINTN TokenNumber,\r
397 IN UINT32 Value\r
398 )\r
399;\r
400\r
401\r
402EFI_STATUS\r
403EFIAPI\r
404PeiPcdSet64 (\r
405 IN UINTN TokenNumber,\r
406 IN UINT64 Value\r
407 )\r
408;\r
409\r
410EFI_STATUS\r
411EFIAPI\r
412PeiPcdSetPtr (\r
413 IN UINTN TokenNumber,\r
414 IN CONST VOID *Value\r
415 )\r
416;\r
417\r
418\r
419EFI_STATUS\r
420EFIAPI\r
421PeiPcdSetBool (\r
422 IN UINTN TokenNumber,\r
423 IN BOOLEAN Value\r
424 )\r
425;\r
426\r
427\r
428EFI_STATUS\r
429EFIAPI\r
430PeiPcdSet8Ex (\r
431 IN CONST EFI_GUID *Guid,\r
432 IN UINTN TokenNumber,\r
433 IN UINT8 Value\r
434 )\r
435;\r
436\r
437EFI_STATUS\r
438EFIAPI\r
439PeiPcdSet16Ex (\r
440 IN CONST EFI_GUID *Guid,\r
441 IN UINTN TokenNumber,\r
442 IN UINT16 Value\r
443 )\r
444;\r
445\r
446\r
447EFI_STATUS\r
448EFIAPI\r
449PeiPcdSet32Ex (\r
450 IN CONST EFI_GUID *Guid,\r
451 IN UINTN TokenNumber,\r
452 IN UINT32 Value\r
453 )\r
454;\r
455\r
456\r
457EFI_STATUS\r
458EFIAPI\r
459PeiPcdSet64Ex (\r
460 IN CONST EFI_GUID *Guid,\r
461 IN UINTN TokenNumber,\r
462 IN UINT64 Value\r
463 )\r
464;\r
465\r
466\r
467EFI_STATUS\r
468EFIAPI\r
469PeiPcdSetPtrEx (\r
470 IN CONST EFI_GUID *Guid,\r
471 IN UINTN TokenNumber,\r
472 IN CONST VOID *Value\r
473 )\r
474;\r
475\r
476\r
477EFI_STATUS\r
478EFIAPI\r
479PeiPcdSetBoolEx (\r
480 IN CONST EFI_GUID *Guid,\r
481 IN UINTN TokenNumber,\r
482 IN BOOLEAN Value\r
483 )\r
484;\r
485\r
486\r
487\r
488EFI_STATUS\r
489EFIAPI\r
490PcdRegisterCallBackOnSet (\r
491 IN UINTN TokenNumber,\r
492 IN CONST EFI_GUID *Guid, OPTIONAL\r
493 IN PCD_PPI_CALLBACK CallBackFunction\r
494 )\r
495;\r
496\r
497\r
498EFI_STATUS\r
499EFIAPI\r
500PcdUnRegisterCallBackOnSet (\r
501 IN UINTN TokenNumber,\r
502 IN CONST EFI_GUID *Guid, OPTIONAL\r
503 IN PCD_PPI_CALLBACK CallBackFunction\r
504 )\r
505;\r
506\r
507\r
508EFI_STATUS\r
509EFIAPI\r
510PeiPcdGetNextToken (\r
511 IN CONST EFI_GUID *Guid, OPTIONAL\r
512 IN OUT UINTN *TokenNumber\r
513 )\r
514;\r
52e1905d 515\r
516extern EFI_GUID gPcdDataBaseHobGuid;\r
517\r
518extern EFI_GUID gPcdPeiCallbackFnTableHobGuid;\r
519\r
520extern PEI_PCD_DATABASE_INIT gPEIPcdDbInit;\r
521\r
878ddf1f 522#endif\r