Add Lock for cirtical section in PCD database processing routines as 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//\r
4acf8ce7 22// Please make sure the PCD Serivce PEIM Version is consistent with\r
23// the version of PCD Database generation tool\r
52e1905d 24//\r
58f1099f 25#define PCD_DXE_SERVICE_DRIVER_VERSION 2\r
52e1905d 26\r
27//\r
4acf8ce7 28// PCD_DXE_DATABASE_GENTOOL_VERSION is defined in Autogen.h\r
29// and generated by PCD Database generation tool.\r
52e1905d 30//\r
4acf8ce7 31#if (PCD_DXE_SERVICE_PEIM_VERSION != PCD_DXE_DATABASE_GENTOOL_VERSION)\r
32 #error "Please make sure the version of PCD Service DXE Driver and PCD DXE Database Generation Tool matches"\r
52e1905d 33#endif\r
34\r
878ddf1f 35//\r
36// Protocol Interface function declaration.\r
37//\r
00b7af13 38VOID\r
878ddf1f 39EFIAPI\r
40DxePcdSetSku (\r
8a43e8dd 41 IN UINTN SkuId\r
878ddf1f 42 )\r
43;\r
44\r
45\r
46UINT8\r
47EFIAPI\r
48DxePcdGet8 (\r
8a43e8dd 49 IN UINTN TokenNumber\r
878ddf1f 50 )\r
51;\r
52\r
53\r
54UINT16\r
55EFIAPI\r
56DxePcdGet16 (\r
8a43e8dd 57 IN UINTN TokenNumber\r
878ddf1f 58 )\r
59;\r
60\r
61\r
62UINT32\r
63EFIAPI\r
64DxePcdGet32 (\r
8a43e8dd 65 IN UINTN TokenNumber\r
878ddf1f 66 )\r
67;\r
68\r
69\r
70UINT64\r
71EFIAPI\r
72DxePcdGet64 (\r
8a43e8dd 73 IN UINTN TokenNumber\r
878ddf1f 74 )\r
75;\r
76\r
77\r
78VOID *\r
79EFIAPI\r
80DxePcdGetPtr (\r
8a43e8dd 81 IN UINTN TokenNumber\r
878ddf1f 82 )\r
83;\r
84\r
85\r
86BOOLEAN\r
87EFIAPI\r
88DxePcdGetBool (\r
8a43e8dd 89 IN UINTN TokenNumber\r
878ddf1f 90 )\r
91;\r
92\r
93\r
94UINTN\r
95EFIAPI\r
96DxePcdGetSize (\r
8a43e8dd 97 IN UINTN TokenNumber\r
878ddf1f 98 )\r
99;\r
100\r
101\r
102UINT8\r
103EFIAPI\r
104DxePcdGet8Ex (\r
105 IN CONST EFI_GUID *Guid,\r
8a43e8dd 106 IN UINTN TokenNumber\r
878ddf1f 107 )\r
108;\r
109\r
110\r
111UINT16\r
112EFIAPI\r
113DxePcdGet16Ex (\r
114 IN CONST EFI_GUID *Guid,\r
8a43e8dd 115 IN UINTN TokenNumber\r
878ddf1f 116 )\r
117;\r
118\r
119\r
120UINT32\r
121EFIAPI\r
122DxePcdGet32Ex (\r
123 IN CONST EFI_GUID *Guid,\r
8a43e8dd 124 IN UINTN TokenNumber\r
878ddf1f 125 )\r
126;\r
127\r
128\r
129\r
130UINT64\r
131EFIAPI\r
132DxePcdGet64Ex (\r
133 IN CONST EFI_GUID *Guid,\r
8a43e8dd 134 IN UINTN TokenNumber\r
878ddf1f 135 )\r
136;\r
137\r
138\r
139\r
140VOID *\r
141EFIAPI\r
142DxePcdGetPtrEx (\r
143 IN CONST EFI_GUID *Guid,\r
8a43e8dd 144 IN UINTN TokenNumber\r
878ddf1f 145 )\r
146;\r
147\r
148\r
149BOOLEAN\r
150EFIAPI\r
151DxePcdGetBoolEx (\r
152 IN CONST EFI_GUID *Guid,\r
8a43e8dd 153 IN UINTN TokenNumber\r
878ddf1f 154 )\r
155;\r
156\r
157\r
158UINTN\r
159EFIAPI\r
160DxePcdGetSizeEx (\r
161 IN CONST EFI_GUID *Guid,\r
8a43e8dd 162 IN UINTN TokenNumber\r
878ddf1f 163 )\r
164;\r
165\r
166\r
167EFI_STATUS\r
168EFIAPI\r
169DxePcdSet8 (\r
8a43e8dd 170 IN UINTN TokenNumber,\r
878ddf1f 171 IN UINT8 Value\r
172 )\r
173;\r
174\r
175\r
176EFI_STATUS\r
177EFIAPI\r
178DxePcdSet16 (\r
8a43e8dd 179 IN UINTN TokenNumber,\r
878ddf1f 180 IN UINT16 Value\r
181 )\r
182;\r
183\r
184\r
185EFI_STATUS\r
186EFIAPI\r
187DxePcdSet32 (\r
8a43e8dd 188 IN UINTN TokenNumber,\r
878ddf1f 189 IN UINT32 Value\r
190 )\r
191;\r
192\r
193\r
194EFI_STATUS\r
195EFIAPI\r
196DxePcdSet64 (\r
8a43e8dd 197 IN UINTN TokenNumber,\r
878ddf1f 198 IN UINT64 Value\r
199 )\r
200;\r
201\r
202\r
203EFI_STATUS\r
204EFIAPI\r
205DxePcdSetPtr (\r
1de04b4f 206 IN UINTN TokenNumber,\r
207 IN UINTN *SizeOfBuffer,\r
208 IN VOID *Buffer\r
878ddf1f 209 )\r
210;\r
211\r
212\r
213EFI_STATUS\r
214EFIAPI\r
215DxePcdSetBool (\r
8a43e8dd 216 IN UINTN TokenNumber,\r
878ddf1f 217 IN BOOLEAN Value\r
218 )\r
219;\r
220\r
221\r
222EFI_STATUS\r
223EFIAPI\r
224DxePcdSet8Ex (\r
225 IN CONST EFI_GUID *Guid,\r
8a43e8dd 226 IN UINTN TokenNumber,\r
878ddf1f 227 IN UINT8 Value\r
228 )\r
229;\r
230\r
231\r
232EFI_STATUS\r
233EFIAPI\r
234DxePcdSet16Ex (\r
235 IN CONST EFI_GUID *Guid,\r
8a43e8dd 236 IN UINTN TokenNumber,\r
878ddf1f 237 IN UINT16 Value\r
238 )\r
239;\r
240\r
241\r
242EFI_STATUS\r
243EFIAPI\r
244DxePcdSet32Ex (\r
245 IN CONST EFI_GUID *Guid,\r
8a43e8dd 246 IN UINTN TokenNumber,\r
878ddf1f 247 IN UINT32 Value\r
248 )\r
249;\r
250\r
251\r
252EFI_STATUS\r
253EFIAPI\r
254DxePcdSet64Ex (\r
255 IN CONST EFI_GUID *Guid,\r
8a43e8dd 256 IN UINTN TokenNumber,\r
878ddf1f 257 IN UINT64 Value\r
258 )\r
259;\r
260\r
261\r
262EFI_STATUS\r
263EFIAPI\r
264DxePcdSetPtrEx (\r
1de04b4f 265 IN CONST EFI_GUID *Guid,\r
266 IN UINTN TokenNumber,\r
267 IN OUT UINTN *SizeOfBuffer,\r
268 IN VOID *Buffer\r
878ddf1f 269 )\r
270;\r
271\r
272\r
273EFI_STATUS\r
274EFIAPI\r
275DxePcdSetBoolEx (\r
4c114006 276 IN CONST EFI_GUID *Guid,\r
8a43e8dd 277 IN UINTN TokenNumber,\r
878ddf1f 278 IN BOOLEAN Value\r
279 )\r
280;\r
281\r
282\r
283\r
284EFI_STATUS\r
285EFIAPI\r
4c114006 286DxeRegisterCallBackOnSet (\r
4c114006 287 IN CONST EFI_GUID *Guid, OPTIONAL\r
2a870f53 288 IN UINTN TokenNumber,\r
878ddf1f 289 IN PCD_PROTOCOL_CALLBACK CallBackFunction\r
290 )\r
291;\r
292\r
293\r
294EFI_STATUS\r
295EFIAPI\r
4c114006 296DxeUnRegisterCallBackOnSet (\r
00b7af13 297 IN CONST EFI_GUID *Guid, OPTIONAL\r
2a870f53 298 IN UINTN TokenNumber,\r
878ddf1f 299 IN PCD_PROTOCOL_CALLBACK CallBackFunction\r
300 )\r
301;\r
302\r
303\r
304EFI_STATUS\r
305EFIAPI\r
306DxePcdGetNextToken (\r
307 IN CONST EFI_GUID *Guid, OPTIONAL\r
8a43e8dd 308 IN OUT UINTN *TokenNumber\r
878ddf1f 309 )\r
310;\r
311\r
c24ba2f6 312\r
313\r
314EFI_STATUS\r
315EFIAPI\r
316DxePcdGetNextTokenSpace (\r
317 IN OUT CONST EFI_GUID **Guid\r
318 )\r
319;\r
320\r
321\r
322typedef struct {\r
323 LIST_ENTRY Node;\r
324 PCD_PROTOCOL_CALLBACK CallbackFn;\r
325} CALLBACK_FN_ENTRY;\r
326\r
327#define CR_FNENTRY_FROM_LISTNODE(Record, Type, Field) _CR(Record, Type, Field)\r
328\r
329//\r
330// Internal Functions\r
331//\r
332\r
333EFI_STATUS\r
334SetValueWorker (\r
335 IN UINTN TokenNumber,\r
336 IN VOID *Data,\r
337 IN UINTN Size\r
338 )\r
339;\r
340\r
341EFI_STATUS\r
342SetWorker (\r
343 IN UINTN TokenNumber,\r
344 IN VOID *Data,\r
345 IN OUT UINTN *Size,\r
346 IN BOOLEAN PtrType\r
347 )\r
348;\r
349\r
350\r
351EFI_STATUS\r
352ExSetValueWorker (\r
353 IN UINTN ExTokenNumber,\r
354 IN CONST EFI_GUID *Guid,\r
355 IN VOID *Data,\r
356 IN UINTN SetSize\r
357 )\r
358;\r
359\r
360\r
361\r
362EFI_STATUS\r
363ExSetWorker (\r
364 IN UINTN ExTokenNumber,\r
365 IN CONST EFI_GUID *Guid,\r
366 IN VOID *Data,\r
367 IN OUT UINTN *Size,\r
368 IN BOOLEAN PtrType\r
369 )\r
370;\r
371\r
372\r
373VOID *\r
374GetWorker (\r
375 IN UINTN TokenNumber,\r
376 IN UINTN GetSize\r
377 )\r
378;\r
379\r
380VOID *\r
381ExGetWorker (\r
382 IN CONST EFI_GUID *Guid,\r
383 IN UINTN ExTokenNumber,\r
384 IN UINTN GetSize\r
385 ) \r
386;\r
387\r
388UINT32\r
389GetSkuEnabledTokenNumber (\r
390 UINT32 LocalTokenNumber,\r
391 UINTN Size,\r
392 BOOLEAN IsPeiDb\r
393 ) \r
394;\r
395\r
396EFI_STATUS\r
397GetHiiVariable (\r
398 IN EFI_GUID *VariableGuid,\r
399 IN UINT16 *VariableName,\r
2b21a971 400 OUT UINT8 **VariableData,\r
c24ba2f6 401 OUT UINTN *VariableSize\r
402 )\r
403;\r
404\r
405EFI_STATUS\r
406SetHiiVariable (\r
407 IN EFI_GUID *VariableGuid,\r
408 IN UINT16 *VariableName,\r
409 IN CONST VOID *Data,\r
410 IN UINTN DataSize,\r
411 IN UINTN Offset\r
412 )\r
413;\r
414\r
415EFI_STATUS\r
416DxeRegisterCallBackWorker (\r
417 IN UINTN TokenNumber,\r
418 IN CONST EFI_GUID *Guid, OPTIONAL\r
419 IN PCD_PROTOCOL_CALLBACK CallBackFunction\r
420);\r
421\r
422EFI_STATUS\r
423DxeUnRegisterCallBackWorker (\r
424 IN UINTN TokenNumber,\r
425 IN CONST EFI_GUID *Guid, OPTIONAL\r
426 IN PCD_PROTOCOL_CALLBACK CallBackFunction\r
427);\r
428\r
429VOID\r
430BuildPcdDxeDataBase (\r
431 VOID\r
432);\r
433\r
434\r
435UINTN \r
436GetExPcdTokenNumber (\r
437 IN CONST EFI_GUID *Guid,\r
438 IN UINT32 ExTokenNumber\r
439 )\r
440;\r
441\r
442\r
443\r
2b21a971 444EFI_STATUS \r
4c114006 445ExGetNextTokeNumber (\r
2b21a971 446 IN CONST EFI_GUID *Guid,\r
447 IN OUT UINTN *TokenNumber,\r
448 IN EFI_GUID *GuidTable,\r
449 IN UINTN SizeOfGuidTable,\r
450 IN DYNAMICEX_MAPPING *ExMapTable,\r
451 IN UINTN SizeOfExMapTable\r
4c114006 452 )\r
453;\r
454\r
c24ba2f6 455\r
456UINTN\r
457GetPtrTypeSize (\r
458 IN UINTN LocalTokenNumberTableIdx,\r
459 OUT UINTN *MaxSize\r
460 )\r
461;\r
462\r
463\r
464\r
465BOOLEAN\r
466SetPtrTypeSize (\r
467 IN UINTN LocalTokenNumberTableIdx,\r
468 IN OUT UINTN *CurrentSize\r
469 )\r
470;\r
471\r
52e1905d 472extern EFI_GUID gPcdDataBaseHobGuid;\r
878ddf1f 473\r
4c114006 474extern PCD_DATABASE * mPcdDatabase;\r
878ddf1f 475\r
52e1905d 476extern DXE_PCD_DATABASE_INIT gDXEPcdDbInit;\r
878ddf1f 477\r
a696a78c 478extern EFI_LOCK mPcdDatabaseLock;\r
479\r
878ddf1f 480#endif\r