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