Initial import.
[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
21VOID \r
22DxeGetPcdEntryWorker (\r
23 IN UINTN Token,\r
24 IN CONST EFI_GUID *Guid, OPTIONAL\r
25 IN PCD_DATA_TYPE Type,\r
26 OUT VOID *Data\r
27 );\r
28\r
29EFI_STATUS \r
30DxeSetPcdEntryWorker (\r
31 IN UINTN Token,\r
32 IN CONST EFI_GUID *Guid, OPTIONAL\r
33 IN PCD_DATA_TYPE Type,\r
34 IN CONST VOID *Data\r
35 );\r
36\r
37UINTN\r
38DxeGetPcdEntrySizeWorker (\r
39 IN UINTN Token,\r
40 IN CONST EFI_GUID *Guid OPTIONAL\r
41 );\r
42\r
43EFI_STATUS\r
44DxeRegisterCallBackWorker (\r
45 IN UINTN TokenNumber,\r
46 IN CONST EFI_GUID *Guid, OPTIONAL\r
47 IN PCD_PROTOCOL_CALLBACK CallBackFunction,\r
48 IN BOOLEAN Reigster\r
49);\r
50\r
51EFI_STATUS\r
52DxeSetSku (\r
53 UINTN Id\r
54);\r
55\r
56EFI_STATUS\r
57DxeGetNextTokenWorker (\r
58 IN OUT UINTN *Token,\r
59 IN CONST EFI_GUID *Guid OPTIONAL\r
60 );\r
61\r
62VOID\r
63InitPcdDxeDataBase (\r
64 VOID\r
65);\r
66\r
67//\r
68// Protocol Interface function declaration.\r
69//\r
70EFI_STATUS\r
71EFIAPI\r
72DxePcdSetSku (\r
73 IN UINTN SkuId\r
74 )\r
75;\r
76\r
77\r
78UINT8\r
79EFIAPI\r
80DxePcdGet8 (\r
81 IN UINTN TokenNumber\r
82 )\r
83;\r
84\r
85\r
86UINT16\r
87EFIAPI\r
88DxePcdGet16 (\r
89 IN UINTN TokenNumber\r
90 )\r
91;\r
92\r
93\r
94UINT32\r
95EFIAPI\r
96DxePcdGet32 (\r
97 IN UINTN TokenNumber\r
98 )\r
99;\r
100\r
101\r
102UINT64\r
103EFIAPI\r
104DxePcdGet64 (\r
105 IN UINTN TokenNumber\r
106 )\r
107;\r
108\r
109\r
110VOID *\r
111EFIAPI\r
112DxePcdGetPtr (\r
113 IN UINTN TokenNumber\r
114 )\r
115;\r
116\r
117\r
118BOOLEAN\r
119EFIAPI\r
120DxePcdGetBool (\r
121 IN UINTN TokenNumber\r
122 )\r
123;\r
124\r
125\r
126UINTN\r
127EFIAPI\r
128DxePcdGetSize (\r
129 IN UINTN TokenNumber\r
130 )\r
131;\r
132\r
133\r
134UINT8\r
135EFIAPI\r
136DxePcdGet8Ex (\r
137 IN CONST EFI_GUID *Guid,\r
138 IN UINTN TokenNumber\r
139 )\r
140;\r
141\r
142\r
143UINT16\r
144EFIAPI\r
145DxePcdGet16Ex (\r
146 IN CONST EFI_GUID *Guid,\r
147 IN UINTN TokenNumber\r
148 )\r
149;\r
150\r
151\r
152UINT32\r
153EFIAPI\r
154DxePcdGet32Ex (\r
155 IN CONST EFI_GUID *Guid,\r
156 IN UINTN TokenNumber\r
157 )\r
158;\r
159\r
160\r
161\r
162UINT64\r
163EFIAPI\r
164DxePcdGet64Ex (\r
165 IN CONST EFI_GUID *Guid,\r
166 IN UINTN TokenNumber\r
167 )\r
168;\r
169\r
170\r
171\r
172VOID *\r
173EFIAPI\r
174DxePcdGetPtrEx (\r
175 IN CONST EFI_GUID *Guid,\r
176 IN UINTN TokenNumber\r
177 )\r
178;\r
179\r
180\r
181BOOLEAN\r
182EFIAPI\r
183DxePcdGetBoolEx (\r
184 IN CONST EFI_GUID *Guid,\r
185 IN UINTN TokenNumber\r
186 )\r
187;\r
188\r
189\r
190UINTN\r
191EFIAPI\r
192DxePcdGetSizeEx (\r
193 IN CONST EFI_GUID *Guid,\r
194 IN UINTN TokenNumber\r
195 )\r
196;\r
197\r
198\r
199EFI_STATUS\r
200EFIAPI\r
201DxePcdSet8 (\r
202 IN UINTN TokenNumber,\r
203 IN UINT8 Value\r
204 )\r
205;\r
206\r
207\r
208EFI_STATUS\r
209EFIAPI\r
210DxePcdSet16 (\r
211 IN UINTN TokenNumber,\r
212 IN UINT16 Value\r
213 )\r
214;\r
215\r
216\r
217EFI_STATUS\r
218EFIAPI\r
219DxePcdSet32 (\r
220 IN UINTN TokenNumber,\r
221 IN UINT32 Value\r
222 )\r
223;\r
224\r
225\r
226EFI_STATUS\r
227EFIAPI\r
228DxePcdSet64 (\r
229 IN UINTN TokenNumber,\r
230 IN UINT64 Value\r
231 )\r
232;\r
233\r
234\r
235EFI_STATUS\r
236EFIAPI\r
237DxePcdSetPtr (\r
238 IN UINTN TokenNumber,\r
239 IN CONST VOID *Value\r
240 )\r
241;\r
242\r
243\r
244EFI_STATUS\r
245EFIAPI\r
246DxePcdSetBool (\r
247 IN UINTN TokenNumber,\r
248 IN BOOLEAN Value\r
249 )\r
250;\r
251\r
252\r
253EFI_STATUS\r
254EFIAPI\r
255DxePcdSet8Ex (\r
256 IN CONST EFI_GUID *Guid,\r
257 IN UINTN TokenNumber,\r
258 IN UINT8 Value\r
259 )\r
260;\r
261\r
262\r
263EFI_STATUS\r
264EFIAPI\r
265DxePcdSet16Ex (\r
266 IN CONST EFI_GUID *Guid,\r
267 IN UINTN TokenNumber,\r
268 IN UINT16 Value\r
269 )\r
270;\r
271\r
272\r
273EFI_STATUS\r
274EFIAPI\r
275DxePcdSet32Ex (\r
276 IN CONST EFI_GUID *Guid,\r
277 IN UINTN TokenNumber,\r
278 IN UINT32 Value\r
279 )\r
280;\r
281\r
282\r
283EFI_STATUS\r
284EFIAPI\r
285DxePcdSet64Ex (\r
286 IN CONST EFI_GUID *Guid,\r
287 IN UINTN TokenNumber,\r
288 IN UINT64 Value\r
289 )\r
290;\r
291\r
292\r
293EFI_STATUS\r
294EFIAPI\r
295DxePcdSetPtrEx (\r
296 IN CONST EFI_GUID *Guid,\r
297 IN UINTN TokenNumber,\r
298 IN CONST VOID *Value\r
299 )\r
300;\r
301\r
302\r
303EFI_STATUS\r
304EFIAPI\r
305DxePcdSetBoolEx (\r
306 IN CONST EFI_GUID *Guid,\r
307 IN UINTN TokenNumber,\r
308 IN BOOLEAN Value\r
309 )\r
310;\r
311\r
312\r
313\r
314EFI_STATUS\r
315EFIAPI\r
316PcdRegisterCallBackOnSet (\r
317 IN UINTN TokenNumber,\r
318 IN CONST EFI_GUID *Guid, OPTIONAL\r
319 IN PCD_PROTOCOL_CALLBACK CallBackFunction\r
320 )\r
321;\r
322\r
323\r
324EFI_STATUS\r
325EFIAPI\r
326PcdUnRegisterCallBackOnSet (\r
327 IN UINTN TokenNumber,\r
328 IN CONST EFI_GUID *Guid, OPTIONAL\r
329 IN PCD_PROTOCOL_CALLBACK CallBackFunction\r
330 )\r
331;\r
332\r
333\r
334EFI_STATUS\r
335EFIAPI\r
336DxePcdGetNextToken (\r
337 IN CONST EFI_GUID *Guid, OPTIONAL\r
338 IN OUT UINTN *TokenNumber\r
339 )\r
340;\r
341\r
342\r
343/*\r
344 This DXE_PCD_DATABASE layout. The difference of DXE_PCD_DATABASE\r
345 and PEI_PCD_DATABASE is as follows:\r
346\r
347 1) No PCD_CALL_BACK_TABLE; DXE_PCD_DATABASE maintain a LinkList for the\r
348 callback function registered.\r
349\r
350 ---------------------------\r
351 | LIST_ENTRY GuidSpaceHead|\r
352 ---------------------------\r
353 | PCD_DATABASE_HEADER |\r
354 ---------------------------\r
355 | GUID_TABLE | Aligned on GUID (128 bits)\r
356 ---------------------------\r
357 | PCD_INDEX_TABLE | Aligned on PCD_INDEX (see PCD_INDEX's declaration)\r
358 ---------------------------\r
359 | IMAGE_STRING_TABLE | Aligned on 16 Bits\r
360 ---------------------------\r
361 | IMAGE_PCD_INDEX | Unaligned\r
362 ---------------------------\r
363 | Data Defaults | Unaligned\r
364 ---------------------------\r
365 | Data Buffer |\r
366 | for entries without |\r
367 | defaults |\r
368 ---------------------------\r
369\r
370*/\r
371\r
372\r
373typedef struct {\r
374 LIST_ENTRY ListNode;\r
375 LIST_ENTRY TokenSpaceHead;\r
376 CONST EFI_GUID *GuidSpace;\r
377} PCD_GUID_SPACE;\r
378\r
379typedef struct {\r
380 LIST_ENTRY ListNode;\r
381 LIST_ENTRY CallbackListHead;\r
382 UINTN TokeNumber;\r
383} PCD_TOKEN_SPACE;\r
384\r
385typedef struct {\r
386 LIST_ENTRY ListNode;\r
387 PCD_PROTOCOL_CALLBACK CallbackFunction;\r
388} PCD_CALLBACK_ENTRY;\r
389\r
390#define PCD_GUID_SPACE_FROM_LISTNODE(a) \\r
391 _CR(a, PCD_GUID_SPACE, ListNode)\r
392\r
393#define PCD_TOKEN_SPACE_FROM_LISTNODE(a) \\r
394 _CR(a, PCD_TOKEN_SPACE, ListNode)\r
395\r
396#define PCD_CALLBACK_ENTRY_FROM_LISTNODE(a) \\r
397 _CR(a, PCD_CALLBACK_ENTRY, ListNode)\r
398\r
399#endif\r