]>
Commit | Line | Data |
---|---|---|
949f388f | 1 | /** @file\r |
2 | Emulator Thunk to abstract OS services from pure EFI code\r | |
3 | \r | |
4 | Copyright (c) 2008 - 2011, Apple Inc. All rights reserved.<BR>\r | |
22f73b6d | 5 | Copyright (c) 2022, Intel Corporation. All rights reserved.<BR>\r |
e3ba31da | 6 | SPDX-License-Identifier: BSD-2-Clause-Patent\r |
949f388f | 7 | \r |
8 | **/\r | |
9 | \r | |
10 | #ifndef __EMU_THUNK_PPI_H__\r | |
11 | #define __EMU_THUNK_PPI_H__\r | |
12 | \r | |
13 | #define EMU_THUNK_PPI_GUID \\r | |
14 | { 0xB958B78C, 0x1D3E, 0xEE40, { 0x8B, 0xF4, 0xF0, 0x63, 0x2D, 0x06, 0x39, 0x16 } }\r | |
15 | \r | |
949f388f | 16 | /*++\r |
17 | \r | |
18 | Routine Description:\r | |
19 | This service is called from Index == 0 until it returns EFI_UNSUPPORTED.\r | |
afa99fac | 20 | It allows discontinuous memory regions to be supported by the emulator.\r |
949f388f | 21 | \r |
22 | Arguments:\r | |
23 | Index - Which memory region to use\r | |
24 | MemoryBase - Return Base address of memory region\r | |
25 | MemorySize - Return size in bytes of the memory region\r | |
26 | \r | |
27 | Returns:\r | |
28 | EFI_SUCCESS - If memory region was mapped\r | |
29 | EFI_UNSUPPORTED - If Index is not supported\r | |
30 | \r | |
31 | **/\r | |
32 | typedef\r | |
33 | EFI_STATUS\r | |
a550d468 | 34 | (EFIAPI *EMU_PEI_AUTOSCAN)(\r |
949f388f | 35 | IN UINTN Index,\r |
36 | OUT EFI_PHYSICAL_ADDRESS *MemoryBase,\r | |
37 | OUT UINT64 *MemorySize\r | |
38 | );\r | |
39 | \r | |
949f388f | 40 | /*++\r |
41 | \r | |
42 | Routine Description:\r | |
d18d8a1d | 43 | Return the FD Size and base address. Since the FD is loaded from a\r |
949f388f | 44 | file into host memory only the SEC will know it's address.\r |
45 | \r | |
46 | Arguments:\r | |
47 | Index - Which FD, starts at zero.\r | |
48 | FdSize - Size of the FD in bytes\r | |
49 | FdBase - Start address of the FD. Assume it points to an FV Header\r | |
50 | FixUp - Difference between actual FD address and build address\r | |
51 | \r | |
52 | Returns:\r | |
53 | EFI_SUCCESS - Return the Base address and size of the FV\r | |
54 | EFI_UNSUPPORTED - Index does nto map to an FD in the system\r | |
55 | \r | |
56 | **/\r | |
57 | typedef\r | |
58 | EFI_STATUS\r | |
a550d468 | 59 | (EFIAPI *EMU_PEI_FD_INFORMATION)(\r |
949f388f | 60 | IN UINTN Index,\r |
61 | IN OUT EFI_PHYSICAL_ADDRESS *FdBase,\r | |
62 | IN OUT UINT64 *FdSize,\r | |
63 | IN OUT EFI_PHYSICAL_ADDRESS *FixUp\r | |
64 | );\r | |
65 | \r | |
949f388f | 66 | /*++\r |
67 | \r | |
68 | Routine Description:\r | |
69 | Export of EMU_THUNK_PROTOCOL from the SEC.\r | |
70 | \r | |
71 | Returns:\r | |
72 | EFI_SUCCESS - Data returned\r | |
73 | \r | |
74 | **/\r | |
75 | typedef\r | |
76 | VOID *\r | |
a550d468 | 77 | (EFIAPI *EMU_PEI_THUNK_INTERFACE)(\r |
949f388f | 78 | VOID\r |
79 | );\r | |
80 | \r | |
949f388f | 81 | /*++\r |
82 | \r | |
83 | Routine Description:\r | |
84 | Loads and relocates a PE/COFF image into memory.\r | |
85 | \r | |
86 | Arguments:\r | |
87 | Pe32Data - The base address of the PE/COFF file that is to be loaded and relocated\r | |
88 | ImageAddress - The base address of the relocated PE/COFF image\r | |
89 | ImageSize - The size of the relocated PE/COFF image\r | |
90 | EntryPoint - The entry point of the relocated PE/COFF image\r | |
91 | \r | |
92 | Returns:\r | |
93 | EFI_SUCCESS - The file was loaded and relocated\r | |
94 | EFI_OUT_OF_RESOURCES - There was not enough memory to load and relocate the PE/COFF file\r | |
95 | \r | |
96 | **/\r | |
97 | typedef\r | |
98 | EFI_STATUS\r | |
a550d468 | 99 | (EFIAPI *EMU_PEI_LOAD_FILE)(\r |
949f388f | 100 | VOID *Pe32Data,\r |
101 | EFI_PHYSICAL_ADDRESS *ImageAddress,\r | |
102 | UINT64 *ImageSize,\r | |
103 | EFI_PHYSICAL_ADDRESS *EntryPoint\r | |
104 | );\r | |
105 | \r | |
949f388f | 106 | typedef struct {\r |
a550d468 MK |
107 | EMU_PEI_AUTOSCAN MemoryAutoScan;\r |
108 | EMU_PEI_FD_INFORMATION FirmwareDevices;\r | |
109 | EMU_PEI_THUNK_INTERFACE Thunk;\r | |
8a485e4b ZL |
110 | INTN Argc;\r |
111 | CHAR8 **Argv;\r | |
112 | CHAR8 **Envp;\r | |
22f73b6d ZL |
113 | UINTN PersistentMemorySize;\r |
114 | UINT8 PersistentMemory[0];\r | |
949f388f | 115 | } EMU_THUNK_PPI;\r |
116 | \r | |
a550d468 | 117 | extern EFI_GUID gEmuThunkPpiGuid;\r |
949f388f | 118 | \r |
119 | #endif\r |