]> git.proxmox.com Git - mirror_edk2.git/blame - EmulatorPkg/Include/Ppi/EmuThunk.h
EmulatorPkg: Replace BSD License with BSD+Patent License
[mirror_edk2.git] / EmulatorPkg / Include / Ppi / EmuThunk.h
CommitLineData
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
d18d8a1d 5\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
16\r
17\r
18/*++\r
19\r
20Routine Description:\r
21 This service is called from Index == 0 until it returns EFI_UNSUPPORTED.\r
afa99fac 22 It allows discontinuous memory regions to be supported by the emulator.\r
949f388f 23\r
24Arguments:\r
25 Index - Which memory region to use\r
26 MemoryBase - Return Base address of memory region\r
27 MemorySize - Return size in bytes of the memory region\r
28\r
29Returns:\r
30 EFI_SUCCESS - If memory region was mapped\r
31 EFI_UNSUPPORTED - If Index is not supported\r
32\r
33**/\r
34typedef\r
35EFI_STATUS\r
36(EFIAPI *EMU_PEI_AUTOSCAN) (\r
37 IN UINTN Index,\r
38 OUT EFI_PHYSICAL_ADDRESS *MemoryBase,\r
39 OUT UINT64 *MemorySize\r
40 );\r
41\r
42\r
43/*++\r
44\r
45Routine Description:\r
d18d8a1d 46 Return the FD Size and base address. Since the FD is loaded from a\r
949f388f 47 file into host memory only the SEC will know it's address.\r
48\r
49Arguments:\r
50 Index - Which FD, starts at zero.\r
51 FdSize - Size of the FD in bytes\r
52 FdBase - Start address of the FD. Assume it points to an FV Header\r
53 FixUp - Difference between actual FD address and build address\r
54\r
55Returns:\r
56 EFI_SUCCESS - Return the Base address and size of the FV\r
57 EFI_UNSUPPORTED - Index does nto map to an FD in the system\r
58\r
59**/\r
60typedef\r
61EFI_STATUS\r
62(EFIAPI *EMU_PEI_FD_INFORMATION) (\r
63 IN UINTN Index,\r
64 IN OUT EFI_PHYSICAL_ADDRESS *FdBase,\r
65 IN OUT UINT64 *FdSize,\r
66 IN OUT EFI_PHYSICAL_ADDRESS *FixUp\r
67 );\r
68\r
69\r
70/*++\r
71\r
72Routine Description:\r
73 Export of EMU_THUNK_PROTOCOL from the SEC.\r
74\r
75Returns:\r
76 EFI_SUCCESS - Data returned\r
77\r
78**/\r
79typedef\r
80VOID *\r
81(EFIAPI *EMU_PEI_THUNK_INTERFACE) (\r
82 VOID\r
83 );\r
84\r
85\r
86\r
87/*++\r
88\r
89Routine Description:\r
90 Loads and relocates a PE/COFF image into memory.\r
91\r
92Arguments:\r
93 Pe32Data - The base address of the PE/COFF file that is to be loaded and relocated\r
94 ImageAddress - The base address of the relocated PE/COFF image\r
95 ImageSize - The size of the relocated PE/COFF image\r
96 EntryPoint - The entry point of the relocated PE/COFF image\r
97\r
98Returns:\r
99 EFI_SUCCESS - The file was loaded and relocated\r
100 EFI_OUT_OF_RESOURCES - There was not enough memory to load and relocate the PE/COFF file\r
101\r
102**/\r
103typedef\r
104EFI_STATUS\r
105(EFIAPI *EMU_PEI_LOAD_FILE) (\r
106 VOID *Pe32Data,\r
107 EFI_PHYSICAL_ADDRESS *ImageAddress,\r
108 UINT64 *ImageSize,\r
109 EFI_PHYSICAL_ADDRESS *EntryPoint\r
110 );\r
111\r
112\r
113typedef struct {\r
114 EMU_PEI_AUTOSCAN MemoryAutoScan;\r
115 EMU_PEI_FD_INFORMATION FirmwareDevices;\r
116 EMU_PEI_THUNK_INTERFACE Thunk;\r
949f388f 117} EMU_THUNK_PPI;\r
118\r
119extern EFI_GUID gEmuThunkPpiGuid;\r
120\r
121#endif\r