Check in the Pcd service Driver/PEIM according to the new way of generating PCD Database
[mirror_edk2.git] / EdkModulePkg / Universal / PCD / Dxe / Service.h
CommitLineData
878ddf1f 1/** @file\r
2Private functions used by PCD DXE driver.\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
878ddf1f 22\r
52e1905d 23#ifndef USE_AUTOGEN\r
24//\r
25// The following definition will be generated by build tool \r
26//\r
27\r
28//\r
29// Common definitions\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
73\r
74\r
75\r
76//\r
77// C Structure generate for PEI PCD Database\r
78//\r
79#define PEI_EXMAPPING_TABLE_SIZE 1\r
80#define PEI_GUID_TABLE_SIZE 1\r
81#define PEI_LOCAL_TOKEN_NUMBER 1\r
82#define PEI_EXTOKEN_NUMBER 1\r
83#define PEI_STRING_TABLE_SIZE 2\r
84#define PEI_SKUID_TABLE_SIZE 3\r
85#define PEI_SIZE_TABLE_SIZE 1\r
86\r
87#define PEI_DATABASE_EMPTRY FALSE\r
88#define PEI_DYNAMICEX_MAPPING_EMPTY FALSE\r
89#define PEI_GUID_TABLE_EMPTY FALSE\r
90#define PEI_STRINGTABLE_EMPTY FALSE\r
91#define PEI_SIZETABLE_EMPTY FALSE\r
92#define PEI_SKUID_TABLE_EMPTY FALSE\r
93\r
94\r
95typedef struct {\r
96\r
97 DYNAMICEX_MAPPING ExMapTable[PEI_EXMAPPING_TABLE_SIZE];\r
98 EFI_GUID GuidTable[PEI_GUID_TABLE_SIZE];\r
99\r
100 UINT32 LocalTokenNumberTable[PEI_LOCAL_TOKEN_NUMBER];\r
101\r
102\r
103 UINT16 StringTable[PEI_STRING_TABLE_SIZE];\r
104 UINT16 SizeTable[PEI_LOCAL_TOKEN_NUMBER];\r
105 \r
106 SKU_ID SkuIdTable[PEI_SKUID_TABLE_SIZE];\r
107 \r
108 SKU_ID SystemSkuId;\r
109\r
110} PEI_PCD_DATABASE_INIT;\r
111\r
112typedef struct {\r
113 UINT8 Dummy;\r
114} PEI_PCD_DATABASE_UNINIT;\r
115\r
116//\r
117// Following code should be generated for PCD DXE driver\r
118//\r
119\r
120#define DXE_EXMAPPING_TABLE_SIZE 1\r
121#define DXE_GUID_TABLE_SIZE 1\r
122#define DXE_TOKEN_NUMBER 1\r
123#define DXE_EXTOKEN_NUMBER 1\r
124#define DXE_STRING_TABLE_SIZE 2\r
125#define DXE_SKUID_TABLE_SIZE 3\r
126#define DXE_SIZE_TABLE_SIZE 1\r
127\r
128#define DXE_DATABASE_EMPTRY FALSE\r
129#define DXE_DYNAMICEX_MAPPING_EMPTY FALSE\r
130#define DXE_GUID_TABLE_EMPTY FALSE\r
131#define DXE_STRINGTABLE_EMPTY FALSE\r
132#define DXE_SIZETABLE_EMPTY FALSE\r
133#define DXE_SKUID_TABLE_EMPTY FALSE\r
134\r
135typedef struct {\r
136 DYNAMICEX_MAPPING ExMapTable[DXE_EXMAPPING_TABLE_SIZE];\r
137 EFI_GUID GuidTable[DXE_GUID_TABLE_SIZE];\r
138\r
139 UINT32 LocalTokenNumberTable[DXE_TOKEN_NUMBER];\r
140\r
141\r
142 UINT16 StringTable[DXE_STRING_TABLE_SIZE];\r
143 UINT16 SizeTable[DXE_TOKEN_NUMBER];\r
144 \r
145 SKU_ID SkuIdTable[DXE_SKUID_TABLE_SIZE];\r
146 \r
147} DXE_PCD_DATABASE_INIT;\r
148\r
149typedef struct {\r
150 UINT8 Dummy;\r
151} DXE_PCD_DATABASE_UNINIT;\r
152\r
153\r
154#define DXE_PCD_DB_INIT_VALUE \\r
155 /* ExMapTable */ \\r
156 { \\r
157 { /* ExTokenNumber */ 0x00000001, /* LocalTokenNumberIndex */ 0, /* ExGuidIndex */ 0} \\r
158 }, \\r
159 \\r
160 /* GuidTable */ \\r
161 { \\r
162 { 0xBB25CF6F, 0xF1D4, 0x11D2, {0x9A, 0x0C, 0x00, 0x90, 0x27, 0x3F, 0xC1, 0xFD }} \\r
163 }, \\r
164 \\r
165 /* LocalTokenNumberTable */ \\r
166 { \\r
167 0 \\r
168 }, \\r
169 \\r
170 /* StringTable */ \\r
171 { \\r
172 L"\0" \\r
173 }, \\r
174 \\r
175 /* SizeTable */ \\r
176 { \\r
177 4 \\r
178 }, \\r
179 \\r
180 /* SkuIdTable */ \\r
181 { \\r
182 /*MaxSku*/ 2, /*SkuId*/ 100, /*SkuId*/200 \\r
183 },\\r
184 \\r
185\r
186//\r
187// End of Autogen Code\r
188//\r
189#endif\r
190\r
191/*\r
192typedef struct {\r
193 PEI_PCD_DATABASE_INIT Init;\r
194 PEI_PCD_DATABASE_UNINIT Uninit;\r
195} PEI_PCD_DATABASE;\r
878ddf1f 196\r
52e1905d 197\r
198\r
199typedef struct {\r
200 DXE_PCD_DATABASE_INIT Init;\r
201 DXE_PCD_DATABASE_UNINIT Uninit;\r
202} DXE_PCD_DATABASE;\r
203\r
204\r
205typedef struct {\r
206 PEI_PCD_DATABASE PeiDb;\r
207 DXE_PCD_DATABASE DxeDb;\r
208} PCD_DATABASE;\r
209*/\r
210\r
211\r
212//\r
213// Internal Functions\r
214//\r
215\r
216EFI_STATUS\r
217SetWorker (\r
218 UINTN TokenNumber,\r
219 VOID *Data,\r
220 UINTN Size,\r
221 BOOLEAN PtrType\r
222 )\r
223;\r
224\r
225EFI_STATUS\r
226ExSetWorker (\r
227 IN UINT32 ExTokenNumber,\r
228 IN CONST EFI_GUID *Guid,\r
229 VOID *Data,\r
230 UINTN Size,\r
231 BOOLEAN PtrType\r
232 )\r
233;\r
234\r
235\r
236VOID *\r
237GetWorker (\r
238 UINTN TokenNumber\r
239 )\r
240;\r
241\r
242VOID *\r
243ExGetWorker (\r
244 IN CONST EFI_GUID *Guid,\r
245 IN UINTN ExTokenNumber,\r
246 IN UINTN GetSize\r
247 ) \r
248;\r
249\r
250UINT32\r
251GetSkuEnabledTokenNumber (\r
252 UINT32 LocalTokenNumber,\r
253 UINTN Size,\r
254 BOOLEAN IsPeiDb\r
255 ) \r
256;\r
257\r
258EFI_STATUS\r
259GetHiiVariable (\r
260 IN EFI_GUID *VariableGuid,\r
261 IN UINT16 *VariableName,\r
262 OUT VOID ** VariableData,\r
263 OUT UINTN *VariableSize\r
264 )\r
265;\r
878ddf1f 266\r
267EFI_STATUS\r
268DxeRegisterCallBackWorker (\r
269 IN UINTN TokenNumber,\r
270 IN CONST EFI_GUID *Guid, OPTIONAL\r
271 IN PCD_PROTOCOL_CALLBACK CallBackFunction,\r
272 IN BOOLEAN Reigster\r
273);\r
274\r
878ddf1f 275EFI_STATUS\r
276DxeGetNextTokenWorker (\r
277 IN OUT UINTN *Token,\r
278 IN CONST EFI_GUID *Guid OPTIONAL\r
279 );\r
280\r
281VOID\r
52e1905d 282BuildPcdDxeDataBase (\r
878ddf1f 283 VOID\r
284);\r
285\r
52e1905d 286\r
287typedef struct {\r
288 UINTN TokenNumber;\r
289 UINTN Size;\r
290 UINT32 LocalTokenNumberAlias;\r
291 BOOLEAN IsPeiDb;\r
292} EX_PCD_ENTRY_ATTRIBUTE;\r
293\r
294VOID\r
295GetExPcdTokenAttributes (\r
296 IN CONST EFI_GUID *Guid,\r
297 IN UINT32 ExTokenNumber,\r
298 OUT EX_PCD_ENTRY_ATTRIBUTE *ExAttr\r
299 )\r
300;\r
301\r
878ddf1f 302//\r
303// Protocol Interface function declaration.\r
304//\r
305EFI_STATUS\r
306EFIAPI\r
307DxePcdSetSku (\r
308 IN UINTN SkuId\r
309 )\r
310;\r
311\r
312\r
313UINT8\r
314EFIAPI\r
315DxePcdGet8 (\r
316 IN UINTN TokenNumber\r
317 )\r
318;\r
319\r
320\r
321UINT16\r
322EFIAPI\r
323DxePcdGet16 (\r
324 IN UINTN TokenNumber\r
325 )\r
326;\r
327\r
328\r
329UINT32\r
330EFIAPI\r
331DxePcdGet32 (\r
332 IN UINTN TokenNumber\r
333 )\r
334;\r
335\r
336\r
337UINT64\r
338EFIAPI\r
339DxePcdGet64 (\r
340 IN UINTN TokenNumber\r
341 )\r
342;\r
343\r
344\r
345VOID *\r
346EFIAPI\r
347DxePcdGetPtr (\r
348 IN UINTN TokenNumber\r
349 )\r
350;\r
351\r
352\r
353BOOLEAN\r
354EFIAPI\r
355DxePcdGetBool (\r
356 IN UINTN TokenNumber\r
357 )\r
358;\r
359\r
360\r
361UINTN\r
362EFIAPI\r
363DxePcdGetSize (\r
364 IN UINTN TokenNumber\r
365 )\r
366;\r
367\r
368\r
369UINT8\r
370EFIAPI\r
371DxePcdGet8Ex (\r
372 IN CONST EFI_GUID *Guid,\r
373 IN UINTN TokenNumber\r
374 )\r
375;\r
376\r
377\r
378UINT16\r
379EFIAPI\r
380DxePcdGet16Ex (\r
381 IN CONST EFI_GUID *Guid,\r
382 IN UINTN TokenNumber\r
383 )\r
384;\r
385\r
386\r
387UINT32\r
388EFIAPI\r
389DxePcdGet32Ex (\r
390 IN CONST EFI_GUID *Guid,\r
391 IN UINTN TokenNumber\r
392 )\r
393;\r
394\r
395\r
396\r
397UINT64\r
398EFIAPI\r
399DxePcdGet64Ex (\r
400 IN CONST EFI_GUID *Guid,\r
401 IN UINTN TokenNumber\r
402 )\r
403;\r
404\r
405\r
406\r
407VOID *\r
408EFIAPI\r
409DxePcdGetPtrEx (\r
410 IN CONST EFI_GUID *Guid,\r
411 IN UINTN TokenNumber\r
412 )\r
413;\r
414\r
415\r
416BOOLEAN\r
417EFIAPI\r
418DxePcdGetBoolEx (\r
419 IN CONST EFI_GUID *Guid,\r
420 IN UINTN TokenNumber\r
421 )\r
422;\r
423\r
424\r
425UINTN\r
426EFIAPI\r
427DxePcdGetSizeEx (\r
428 IN CONST EFI_GUID *Guid,\r
429 IN UINTN TokenNumber\r
430 )\r
431;\r
432\r
433\r
434EFI_STATUS\r
435EFIAPI\r
436DxePcdSet8 (\r
437 IN UINTN TokenNumber,\r
438 IN UINT8 Value\r
439 )\r
440;\r
441\r
442\r
443EFI_STATUS\r
444EFIAPI\r
445DxePcdSet16 (\r
446 IN UINTN TokenNumber,\r
447 IN UINT16 Value\r
448 )\r
449;\r
450\r
451\r
452EFI_STATUS\r
453EFIAPI\r
454DxePcdSet32 (\r
455 IN UINTN TokenNumber,\r
456 IN UINT32 Value\r
457 )\r
458;\r
459\r
460\r
461EFI_STATUS\r
462EFIAPI\r
463DxePcdSet64 (\r
464 IN UINTN TokenNumber,\r
465 IN UINT64 Value\r
466 )\r
467;\r
468\r
469\r
470EFI_STATUS\r
471EFIAPI\r
472DxePcdSetPtr (\r
473 IN UINTN TokenNumber,\r
474 IN CONST VOID *Value\r
475 )\r
476;\r
477\r
478\r
479EFI_STATUS\r
480EFIAPI\r
481DxePcdSetBool (\r
482 IN UINTN TokenNumber,\r
483 IN BOOLEAN Value\r
484 )\r
485;\r
486\r
487\r
488EFI_STATUS\r
489EFIAPI\r
490DxePcdSet8Ex (\r
491 IN CONST EFI_GUID *Guid,\r
492 IN UINTN TokenNumber,\r
493 IN UINT8 Value\r
494 )\r
495;\r
496\r
497\r
498EFI_STATUS\r
499EFIAPI\r
500DxePcdSet16Ex (\r
501 IN CONST EFI_GUID *Guid,\r
502 IN UINTN TokenNumber,\r
503 IN UINT16 Value\r
504 )\r
505;\r
506\r
507\r
508EFI_STATUS\r
509EFIAPI\r
510DxePcdSet32Ex (\r
511 IN CONST EFI_GUID *Guid,\r
512 IN UINTN TokenNumber,\r
513 IN UINT32 Value\r
514 )\r
515;\r
516\r
517\r
518EFI_STATUS\r
519EFIAPI\r
520DxePcdSet64Ex (\r
521 IN CONST EFI_GUID *Guid,\r
522 IN UINTN TokenNumber,\r
523 IN UINT64 Value\r
524 )\r
525;\r
526\r
527\r
528EFI_STATUS\r
529EFIAPI\r
530DxePcdSetPtrEx (\r
531 IN CONST EFI_GUID *Guid,\r
532 IN UINTN TokenNumber,\r
533 IN CONST VOID *Value\r
534 )\r
535;\r
536\r
537\r
538EFI_STATUS\r
539EFIAPI\r
540DxePcdSetBoolEx (\r
541 IN CONST EFI_GUID *Guid,\r
542 IN UINTN TokenNumber,\r
543 IN BOOLEAN Value\r
544 )\r
545;\r
546\r
547\r
548\r
549EFI_STATUS\r
550EFIAPI\r
551PcdRegisterCallBackOnSet (\r
552 IN UINTN TokenNumber,\r
553 IN CONST EFI_GUID *Guid, OPTIONAL\r
554 IN PCD_PROTOCOL_CALLBACK CallBackFunction\r
555 )\r
556;\r
557\r
558\r
559EFI_STATUS\r
560EFIAPI\r
561PcdUnRegisterCallBackOnSet (\r
562 IN UINTN TokenNumber,\r
563 IN CONST EFI_GUID *Guid, OPTIONAL\r
564 IN PCD_PROTOCOL_CALLBACK CallBackFunction\r
565 )\r
566;\r
567\r
568\r
569EFI_STATUS\r
570EFIAPI\r
571DxePcdGetNextToken (\r
572 IN CONST EFI_GUID *Guid, OPTIONAL\r
573 IN OUT UINTN *TokenNumber\r
574 )\r
575;\r
576\r
52e1905d 577EFI_STATUS\r
578SetWorkerByLocalTokenNumber (\r
579 UINT32 LocalTokenNumber,\r
580 VOID *Data,\r
581 UINTN Size,\r
582 BOOLEAN PtrType,\r
583 BOOLEAN IsPeiDb\r
584 )\r
585;\r
878ddf1f 586\r
52e1905d 587extern EFI_GUID gPcdDataBaseHobGuid;\r
878ddf1f 588\r
52e1905d 589extern PCD_DATABASE * gPcdDatabase;\r
878ddf1f 590\r
52e1905d 591extern DXE_PCD_DATABASE_INIT gDXEPcdDbInit;\r
878ddf1f 592\r
593#endif\r