Adding top-level Conf directory for next generation of EDK II build infrastructure...
[mirror_edk2.git] / EdkUnixPkg / Sec / SecMain.h
1 /*++
2
3 Copyright (c) 2006, Intel Corporation
4 All rights reserved. This program and the accompanying materials
5 are licensed and made available under the terms and conditions of the BSD License
6 which accompanies this distribution. The full text of the license may be found at
7 http://opensource.org/licenses/bsd-license.php
8
9 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
10 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
11
12
13 Module Name:
14 SecMain.h
15
16 Abstract:
17 Include file for host API based SEC
18
19 --*/
20
21 #include <stdio.h>
22
23
24 #define STACK_SIZE 0x20000
25
26 typedef struct {
27 EFI_PHYSICAL_ADDRESS Address;
28 UINT64 Size;
29 } UNIX_FD_INFO;
30
31 typedef struct {
32 EFI_PHYSICAL_ADDRESS Memory;
33 UINT64 Size;
34 } UNIX_SYSTEM_MEMORY;
35
36
37
38 EFI_STATUS
39 EFIAPI
40 SecWinNtPeiLoadFile (
41 VOID *Pe32Data, // TODO: add IN/OUT modifier to Pe32Data
42 EFI_PHYSICAL_ADDRESS *ImageAddress, // TODO: add IN/OUT modifier to ImageAddress
43 UINT64 *ImageSize, // TODO: add IN/OUT modifier to ImageSize
44 EFI_PHYSICAL_ADDRESS *EntryPoint // TODO: add IN/OUT modifier to EntryPoint
45 )
46 /*++
47
48 Routine Description:
49
50 TODO: Add function description
51
52 Arguments:
53
54 Pe32Data - TODO: add argument description
55 ImageAddress - TODO: add argument description
56 ImageSize - TODO: add argument description
57 EntryPoint - TODO: add argument description
58
59 Returns:
60
61 TODO: add return values
62
63 --*/
64 ;
65
66 EFI_STATUS
67 EFIAPI
68 SecWinNtPeiAutoScan (
69 IN UINTN Index,
70 OUT EFI_PHYSICAL_ADDRESS *MemoryBase,
71 OUT UINT64 *MemorySize
72 )
73 /*++
74
75 Routine Description:
76
77 TODO: Add function description
78
79 Arguments:
80
81 Index - TODO: add argument description
82 MemoryBase - TODO: add argument description
83 MemorySize - TODO: add argument description
84
85 Returns:
86
87 TODO: add return values
88
89 --*/
90 ;
91
92 VOID *
93 EFIAPI
94 SecWinNtWinNtThunkAddress (
95 VOID
96 )
97 /*++
98
99 Routine Description:
100
101 TODO: Add function description
102
103 Arguments:
104
105 InterfaceSize - TODO: add argument description
106 InterfaceBase - TODO: add argument description
107
108 Returns:
109
110 TODO: add return values
111
112 --*/
113 ;
114
115 EFI_STATUS
116 EFIAPI
117 SecWinNtWinNtFwhAddress (
118 IN OUT UINT64 *FwhSize,
119 IN OUT EFI_PHYSICAL_ADDRESS *FwhBase
120 )
121 /*++
122
123 Routine Description:
124
125 TODO: Add function description
126
127 Arguments:
128
129 FwhSize - TODO: add argument description
130 FwhBase - TODO: add argument description
131
132 Returns:
133
134 TODO: add return values
135
136 --*/
137 ;
138
139 EFI_STATUS
140 EFIAPI
141 SecPeiReportStatusCode (
142 IN EFI_PEI_SERVICES **PeiServices,
143 IN EFI_STATUS_CODE_TYPE CodeType,
144 IN EFI_STATUS_CODE_VALUE Value,
145 IN UINT32 Instance,
146 IN EFI_GUID * CallerId,
147 IN EFI_STATUS_CODE_DATA * Data OPTIONAL
148 )
149 /*++
150
151 Routine Description:
152
153 TODO: Add function description
154
155 Arguments:
156
157 PeiServices - TODO: add argument description
158 CodeType - TODO: add argument description
159 Value - TODO: add argument description
160 Instance - TODO: add argument description
161 CallerId - TODO: add argument description
162 Data - TODO: add argument description
163
164 Returns:
165
166 TODO: add return values
167
168 --*/
169 ;
170
171 INTN
172 EFIAPI
173 main (
174 IN INTN Argc,
175 IN CHAR8 **Argv,
176 IN CHAR8 **Envp
177 )
178 /*++
179
180 Routine Description:
181
182 TODO: Add function description
183
184 Arguments:
185
186 Argc - TODO: add argument description
187 Argv - TODO: add argument description
188 Envp - TODO: add argument description
189
190 Returns:
191
192 TODO: add return values
193
194 --*/
195 ;
196
197 VOID
198 SecLoadFromCore (
199 IN UINTN LargestRegion,
200 IN UINTN LargestRegionSize,
201 IN UINTN BootFirmwareVolumeBase,
202 IN VOID *PeiCoreFile
203 )
204 /*++
205
206 Routine Description:
207
208 TODO: Add function description
209
210 Arguments:
211
212 LargestRegion - TODO: add argument description
213 LargestRegionSize - TODO: add argument description
214 BootFirmwareVolumeBase - TODO: add argument description
215 PeiCoreFile - TODO: add argument description
216
217 Returns:
218
219 TODO: add return values
220
221 --*/
222 ;
223
224 EFI_STATUS
225 SecLoadFile (
226 IN VOID *Pe32Data,
227 IN EFI_PHYSICAL_ADDRESS *ImageAddress,
228 IN UINT64 *ImageSize,
229 IN EFI_PHYSICAL_ADDRESS *EntryPoint
230 )
231 /*++
232
233 Routine Description:
234
235 TODO: Add function description
236
237 Arguments:
238
239 Pe32Data - TODO: add argument description
240 ImageAddress - TODO: add argument description
241 ImageSize - TODO: add argument description
242 EntryPoint - TODO: add argument description
243
244 Returns:
245
246 TODO: add return values
247
248 --*/
249 ;
250
251 EFI_STATUS
252 SecFfsFindPeiCore (
253 IN EFI_FIRMWARE_VOLUME_HEADER *FwVolHeader,
254 OUT VOID **Pe32Data
255 )
256 /*++
257
258 Routine Description:
259
260 TODO: Add function description
261
262 Arguments:
263
264 FwVolHeader - TODO: add argument description
265 Pe32Data - TODO: add argument description
266
267 Returns:
268
269 TODO: add return values
270
271 --*/
272 ;
273
274 EFI_STATUS
275 SecFfsFindNextFile (
276 IN EFI_FV_FILETYPE SearchType,
277 IN EFI_FIRMWARE_VOLUME_HEADER *FwVolHeader,
278 IN OUT EFI_FFS_FILE_HEADER **FileHeader
279 )
280 /*++
281
282 Routine Description:
283
284 TODO: Add function description
285
286 Arguments:
287
288 SearchType - TODO: add argument description
289 FwVolHeader - TODO: add argument description
290 FileHeader - TODO: add argument description
291
292 Returns:
293
294 TODO: add return values
295
296 --*/
297 ;
298
299 EFI_STATUS
300 SecFfsFindSectionData (
301 IN EFI_SECTION_TYPE SectionType,
302 IN EFI_FFS_FILE_HEADER *FfsFileHeader,
303 IN OUT VOID **SectionData
304 )
305 /*++
306
307 Routine Description:
308
309 TODO: Add function description
310
311 Arguments:
312
313 SectionType - TODO: add argument description
314 FfsFileHeader - TODO: add argument description
315 SectionData - TODO: add argument description
316
317 Returns:
318
319 TODO: add return values
320
321 --*/
322 ;
323
324 EFI_STATUS
325 EFIAPI
326 SecWinNtPeCoffLoaderLoadAsDll (
327 IN CHAR8 *PdbFileName,
328 IN VOID **ImageEntryPoint,
329 OUT VOID **ModHandle
330 )
331 /*++
332
333 Routine Description:
334
335 TODO: Add function description
336
337 Arguments:
338
339 PdbFileName - TODO: add argument description
340 ImageEntryPoint - TODO: add argument description
341 ModHandle - TODO: add argument description
342
343 Returns:
344
345 TODO: add return values
346
347 --*/
348 ;
349
350 EFI_STATUS
351 EFIAPI
352 SecWinNtPeCoffLoaderFreeLibrary (
353 OUT VOID *ModHandle
354 )
355 /*++
356
357 Routine Description:
358
359 TODO: Add function description
360
361 Arguments:
362
363 ModHandle - TODO: add argument description
364
365 Returns:
366
367 TODO: add return values
368
369 --*/
370 ;
371
372 EFI_STATUS
373 EFIAPI
374 SecWinNtFdAddress (
375 IN UINTN Index,
376 IN OUT EFI_PHYSICAL_ADDRESS *FdBase,
377 IN OUT UINT64 *FdSize
378 )
379 /*++
380
381 Routine Description:
382
383 TODO: Add function description
384
385 Arguments:
386
387 Index - TODO: add argument description
388 FdBase - TODO: add argument description
389 FdSize - TODO: add argument description
390
391 Returns:
392
393 TODO: add return values
394
395 --*/
396 ;
397
398 EFI_STATUS
399 GetImageReadFunction (
400 IN PE_COFF_LOADER_IMAGE_CONTEXT *ImageContext,
401 IN EFI_PHYSICAL_ADDRESS *TopOfMemory
402 )
403 /*++
404
405 Routine Description:
406
407 TODO: Add function description
408
409 Arguments:
410
411 ImageContext - TODO: add argument description
412 TopOfMemory - TODO: add argument description
413
414 Returns:
415
416 TODO: add return values
417
418 --*/
419 ;
420
421 EFI_STATUS
422 EFIAPI
423 SecImageRead (
424 IN VOID *FileHandle,
425 IN UINTN FileOffset,
426 IN OUT UINTN *ReadSize,
427 OUT VOID *Buffer
428 )
429 /*++
430
431 Routine Description:
432
433 TODO: Add function description
434
435 Arguments:
436
437 FileHandle - TODO: add argument description
438 FileOffset - TODO: add argument description
439 ReadSize - TODO: add argument description
440 Buffer - TODO: add argument description
441
442 Returns:
443
444 TODO: add return values
445
446 --*/
447 ;
448
449 CHAR16 *
450 AsciiToUnicode (
451 IN CHAR8 *Ascii,
452 IN UINTN *StrLen OPTIONAL
453 )
454 /*++
455
456 Routine Description:
457
458 TODO: Add function description
459
460 Arguments:
461
462 Ascii - TODO: add argument description
463 StrLen - TODO: add argument description
464
465 Returns:
466
467 TODO: add return values
468
469 --*/
470 ;
471
472 UINTN
473 CountSeperatorsInString (
474 IN const CHAR16 *String,
475 IN CHAR16 Seperator
476 )
477 /*++
478
479 Routine Description:
480
481 TODO: Add function description
482
483 Arguments:
484
485 String - TODO: add argument description
486 Seperator - TODO: add argument description
487
488 Returns:
489
490 TODO: add return values
491
492 --*/
493 ;
494
495 EFI_STATUS
496 EFIAPI
497 SecNt32PeCoffGetImageInfo (
498 IN EFI_PEI_PE_COFF_LOADER_PROTOCOL *This,
499 IN OUT PE_COFF_LOADER_IMAGE_CONTEXT *ImageContext
500 );
501
502 EFI_STATUS
503 EFIAPI
504 SecNt32PeCoffLoadImage (
505 IN EFI_PEI_PE_COFF_LOADER_PROTOCOL *This,
506 IN OUT PE_COFF_LOADER_IMAGE_CONTEXT *ImageContext
507 );
508
509 EFI_STATUS
510 EFIAPI
511 SecNt32PeCoffRelocateImage (
512 IN EFI_PEI_PE_COFF_LOADER_PROTOCOL *This,
513 IN OUT PE_COFF_LOADER_IMAGE_CONTEXT *ImageContext
514 );
515
516 EFI_STATUS
517 EFIAPI
518 SecNt32PeCoffUnloadimage (
519 IN EFI_PEI_PE_COFF_LOADER_PROTOCOL *This,
520 IN PE_COFF_LOADER_IMAGE_CONTEXT *ImageContext
521 );
522
523
524 typedef struct {
525 EFI_PEI_PE_COFF_LOADER_PROTOCOL PeCoff;
526 VOID *ModHandle;
527 } EFI_PEI_PE_COFF_LOADER_PROTOCOL_INSTANCE;
528
529 extern EFI_UNIX_THUNK_PROTOCOL *gUnix;