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