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