]> git.proxmox.com Git - mirror_edk2.git/blobdiff - EmulatorPkg/Include/Ppi/EmuThunk.h
InOsEmuPkg: Rename package to EmulatorPkg & Sec to Host
[mirror_edk2.git] / EmulatorPkg / Include / Ppi / EmuThunk.h
diff --git a/EmulatorPkg/Include/Ppi/EmuThunk.h b/EmulatorPkg/Include/Ppi/EmuThunk.h
new file mode 100644 (file)
index 0000000..20cdc46
--- /dev/null
@@ -0,0 +1,127 @@
+/** @file\r
+  Emulator Thunk to abstract OS services from pure EFI code\r
+\r
+  Copyright (c) 2008 - 2011, Apple Inc. All rights reserved.<BR>\r
+  \r
+  This program and the accompanying materials\r
+  are licensed and made available under the terms and conditions of the BSD License\r
+  which accompanies this distribution.  The full text of the license may be found at\r
+  http://opensource.org/licenses/bsd-license.php\r
+\r
+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+\r
+**/\r
+\r
+#ifndef __EMU_THUNK_PPI_H__\r
+#define __EMU_THUNK_PPI_H__\r
+\r
+#define EMU_THUNK_PPI_GUID  \\r
+ { 0xB958B78C, 0x1D3E, 0xEE40, { 0x8B, 0xF4, 0xF0, 0x63, 0x2D, 0x06, 0x39, 0x16 } }\r
+\r
+\r
+\r
+/*++\r
+\r
+Routine Description:\r
+  This service is called from Index == 0 until it returns EFI_UNSUPPORTED.\r
+  It allows discontiguous memory regions to be supported by the emulator.\r
+\r
+Arguments:\r
+  Index      - Which memory region to use\r
+  MemoryBase - Return Base address of memory region\r
+  MemorySize - Return size in bytes of the memory region\r
+\r
+Returns:\r
+  EFI_SUCCESS - If memory region was mapped\r
+  EFI_UNSUPPORTED - If Index is not supported\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EMU_PEI_AUTOSCAN) (\r
+  IN  UINTN                 Index,\r
+  OUT EFI_PHYSICAL_ADDRESS  *MemoryBase,\r
+  OUT UINT64                *MemorySize\r
+  );\r
+\r
+\r
+/*++\r
+\r
+Routine Description:\r
+  Return the FD Size and base address. Since the FD is loaded from a \r
+  file into host memory only the SEC will know it's address.\r
+\r
+Arguments:\r
+  Index  - Which FD, starts at zero.\r
+  FdSize - Size of the FD in bytes\r
+  FdBase - Start address of the FD. Assume it points to an FV Header\r
+  FixUp  - Difference between actual FD address and build address\r
+\r
+Returns:\r
+  EFI_SUCCESS     - Return the Base address and size of the FV\r
+  EFI_UNSUPPORTED - Index does nto map to an FD in the system\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EMU_PEI_FD_INFORMATION) (\r
+  IN     UINTN                  Index,\r
+  IN OUT EFI_PHYSICAL_ADDRESS   *FdBase,\r
+  IN OUT UINT64                 *FdSize,\r
+  IN OUT EFI_PHYSICAL_ADDRESS   *FixUp\r
+  );\r
+\r
+\r
+/*++\r
+\r
+Routine Description:\r
+  Export of EMU_THUNK_PROTOCOL from the SEC.\r
+\r
+Returns:\r
+  EFI_SUCCESS - Data returned\r
+\r
+**/\r
+typedef\r
+VOID *\r
+(EFIAPI *EMU_PEI_THUNK_INTERFACE) (\r
+  VOID\r
+  );\r
+\r
+\r
+\r
+/*++\r
+\r
+Routine Description:\r
+  Loads and relocates a PE/COFF image into memory.\r
+\r
+Arguments:\r
+  Pe32Data         - The base address of the PE/COFF file that is to be loaded and relocated\r
+  ImageAddress     - The base address of the relocated PE/COFF image\r
+  ImageSize        - The size of the relocated PE/COFF image\r
+  EntryPoint       - The entry point of the relocated PE/COFF image\r
+\r
+Returns:\r
+  EFI_SUCCESS   - The file was loaded and relocated\r
+  EFI_OUT_OF_RESOURCES - There was not enough memory to load and relocate the PE/COFF file\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EMU_PEI_LOAD_FILE) (\r
+  VOID                  *Pe32Data,\r
+  EFI_PHYSICAL_ADDRESS  *ImageAddress,\r
+  UINT64                *ImageSize,\r
+  EFI_PHYSICAL_ADDRESS  *EntryPoint\r
+  );\r
+\r
+\r
+typedef struct {\r
+  EMU_PEI_AUTOSCAN                  MemoryAutoScan;\r
+  EMU_PEI_FD_INFORMATION            FirmwareDevices;\r
+  EMU_PEI_THUNK_INTERFACE           Thunk;\r
+} EMU_THUNK_PPI;\r
+\r
+extern EFI_GUID gEmuThunkPpiGuid;\r
+\r
+#endif\r