]> git.proxmox.com Git - mirror_edk2.git/blobdiff - OvmfPkg/Csm/Include/Protocol/LegacyBiosPlatform.h
OvmfPkg: Copy the required CSM components from framework packages
[mirror_edk2.git] / OvmfPkg / Csm / Include / Protocol / LegacyBiosPlatform.h
diff --git a/OvmfPkg/Csm/Include/Protocol/LegacyBiosPlatform.h b/OvmfPkg/Csm/Include/Protocol/LegacyBiosPlatform.h
new file mode 100644 (file)
index 0000000..0a164da
--- /dev/null
@@ -0,0 +1,755 @@
+/** @file\r
+  The EFI Legacy BIOS Patform Protocol is used to mate a Legacy16\r
+  implementation with this EFI code. The EFI driver that produces\r
+  the Legacy BIOS protocol is generic and consumes this protocol.\r
+  A driver that matches the Legacy16 produces this protocol\r
+\r
+Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.<BR>\r
+SPDX-License-Identifier: BSD-2-Clause-Patent\r
+\r
+  @par Revision Reference:\r
+  This protocol is defined in Framework for EFI Compatibility Support Module spec\r
+  Version 0.97.\r
+\r
+**/\r
+\r
+#ifndef _EFI_LEGACY_BIOS_PLATFORM_H_\r
+#define _EFI_LEGACY_BIOS_PLATFORM_H_\r
+\r
+///\r
+/// Legacy BIOS Platform depends on HDD_INFO and EFI_COMPATIBILITY16_TABLE that\r
+/// are defined with the Legacy BIOS Protocol\r
+///\r
+#include <Protocol/LegacyBios.h>\r
+\r
+#define EFI_LEGACY_BIOS_PLATFORM_PROTOCOL_GUID \\r
+  { \\r
+    0x783658a3, 0x4172, 0x4421, {0xa2, 0x99, 0xe0, 0x9, 0x7, 0x9c, 0xc, 0xb4 } \\r
+  }\r
+\r
+typedef struct _EFI_LEGACY_BIOS_PLATFORM_PROTOCOL EFI_LEGACY_BIOS_PLATFORM_PROTOCOL;\r
+\r
+/**\r
+  This enum specifies the Mode param values for GetPlatformInfo()\r
+**/\r
+typedef enum {\r
+  ///\r
+  /// This mode is invoked twice. The first invocation has LegacySegment and\r
+  /// LegacyOffset set to 0. The mode returns the MP table address in EFI memory, along with its size.\r
+  /// The second invocation has LegacySegment and LegacyOffset set to the location\r
+  /// in the 0xF0000 or 0xE0000 block to which the MP table is to be copied. The second\r
+  /// invocation allows any MP table address fixes to occur in the EFI memory copy of the\r
+  /// MP table. The caller, not EfiGetPlatformBinaryMpTable, copies the modified MP\r
+  /// table to the allocated region in 0xF0000 or 0xE0000 block after the second invocation.\r
+  ///\r
+  /// The function parameters associated with this mode are:\r
+  ///\r
+  ///   Table Pointer to the MP table.\r
+  ///\r
+  ///   TableSize Size in bytes of the MP table.\r
+  ///\r
+  ///   Location Location to place table. 0x00. Either 0xE0000 or 0xF0000 64 KB blocks.\r
+  ///     Bit 0 = 1 0xF0000 64 KB block.\r
+  ///     Bit 1 = 1 0xE0000 64 KB block.\r
+  ///     Multiple bits can be set.\r
+  ///\r
+  ///   Alignment Bit-mapped address alignment granularity.\r
+  ///     The first nonzero bit from the right is the address granularity.\r
+  ///\r
+  //    LegacySegment Segment in which EfiCompatibility code will place the MP table.\r
+  ///\r
+  ///   LegacyOffset Offset in which EfiCompatibility code will place the MP table.\r
+  ///\r
+  /// The return values associated with this mode are:\r
+  ///\r
+  ///   EFI_SUCCESS The MP table was returned.\r
+  ///\r
+  ///   EFI_UNSUPPORTED The MP table is not supported on this platform.\r
+  ///\r
+  EfiGetPlatformBinaryMpTable      = 0,\r
+  ///\r
+  /// This mode returns a block of data. The content and usage is IBV or OEM defined.\r
+  /// OEMs or IBVs normally use this function for nonstandard Compatibility16 runtime soft\r
+  /// INTs. It is the responsibility of this routine to coalesce multiple OEM 16 bit functions, if\r
+  /// they exist, into one coherent package that is understandable by the Compatibility16 code.\r
+  /// This function is invoked twice. The first invocation has LegacySegment and\r
+  /// LegacyOffset set to 0. The function returns the table address in EFI memory, as well as its size.\r
+  /// The second invocation has LegacySegment and LegacyOffset set to the location\r
+  /// in the 0xF0000 or 0xE0000 block to which the data (table) is to be copied. The second\r
+  /// invocation allows any data (table) address fixes to occur in the EFI memory copy of\r
+  /// the table. The caller, not GetOemIntData(), copies the modified data (table) to the\r
+  /// allocated region in 0xF0000 or 0xE0000 block after the second invocation.\r
+  ///\r
+  /// The function parameters associated with this mode are:\r
+  ///\r
+  ///   Table Pointer to OEM legacy 16 bit code or data.\r
+  ///\r
+  ///   TableSize Size of data.\r
+  ///\r
+  ///   Location Location to place table. 0x00. Either 0xE0000 or 0xF0000 64 KB blocks.\r
+  ///       Bit 0 = 1 0xF0000 64 KB block.\r
+  ///       Bit 1 = 1 0xE0000 64 KB block.\r
+  ///       Multiple bits can be set.\r
+  ///\r
+  ///   Alignment Bit mapped address alignment granularity.\r
+  ///     The first nonzero bit from the right is the address granularity.\r
+  ///\r
+  ///   LegacySegment Segment in which EfiCompatibility code will place the table or data.\r
+  ///\r
+  ///   LegacyOffset Offset in which EfiCompatibility code will place the table or data.\r
+  ///\r
+  /// The return values associated with this mode are:\r
+  ///\r
+  ///   EFI_SUCCESS The data was returned successfully.\r
+  ///\r
+  ///   EFI_UNSUPPORTED Oem INT is not supported on this platform.\r
+  ///\r
+  EfiGetPlatformBinaryOemIntData   = 1,\r
+  ///\r
+  /// This mode returns a block of data. The content and usage is IBV defined. OEMs or\r
+  /// IBVs normally use this mode for nonstandard Compatibility16 runtime 16 bit routines. It\r
+  /// is the responsibility of this routine to coalesce multiple OEM 16 bit functions, if they\r
+  /// exist, into one coherent package that is understandable by the Compatibility16 code.\r
+  ///\r
+  /// Example usage: A legacy mobile BIOS that has a pre-existing runtime\r
+  /// interface to return the battery status to calling applications.\r
+  ///\r
+  /// This mode is invoked twice. The first invocation has LegacySegment and\r
+  /// LegacyOffset set to 0. The mode returns the table address in EFI memory and its size.\r
+  /// The second invocation has LegacySegment and LegacyOffset set to the location\r
+  /// in the 0xF0000 or 0xE0000 block to which the table is to be copied. The second\r
+  /// invocation allows any table address fixes to occur in the EFI memory copy of the table.\r
+  /// The caller, not EfiGetPlatformBinaryOem16Data, copies the modified table to\r
+  /// the allocated region in 0xF0000 or 0xE0000 block after the second invocation.\r
+  ///\r
+  /// The function parameters associated with this mode are:\r
+  ///\r
+  ///   Table Pointer to OEM legacy 16 bit code or data.\r
+  ///\r
+  ///   TableSize Size of data.\r
+  ///\r
+  ///   Location Location to place the table. 0x00. Either 0xE0000 or 0xF0000 64 KB blocks.\r
+  ///      Bit 0 = 1 0xF0000 64 KB block.\r
+  ///      Bit 1 = 1 0xE0000 64 KB block.\r
+  ///      Multiple bits can be set.\r
+  ///\r
+  ///   Alignment Bit mapped address alignment granularity.\r
+  ///     The first nonzero bit from the right is the address granularity.\r
+  ///\r
+  ///   LegacySegment Segment in which EfiCompatibility code will place the table or data.\r
+  ///\r
+  ///   LegacyOffset Offset in which EfiCompatibility code will place the table or data.\r
+  ///\r
+  /// The return values associated with this mode are:\r
+  ///\r
+  ///   EFI_SUCCESS The data was returned successfully.\r
+  ///\r
+  ///   EFI_UNSUPPORTED Oem16 is not supported on this platform.\r
+  ///\r
+  EfiGetPlatformBinaryOem16Data    = 2,\r
+///\r
+/// This mode returns a block of data. The content and usage are IBV defined. OEMs or\r
+/// IBVs normally use this mode for nonstandard Compatibility16 runtime 32 bit routines. It\r
+/// is the responsibility of this routine to coalesce multiple OEM 32 bit functions, if they\r
+/// exist, into one coherent package that is understandable by the Compatibility16 code.\r
+///\r
+/// Example usage: A legacy mobile BIOS that has a pre existing runtime\r
+/// interface to return the battery status to calling applications.\r
+///\r
+/// This mode is invoked twice. The first invocation has LegacySegment and\r
+/// LegacyOffset set to 0. The mode returns the table address in EFI memory and its size.\r
+///\r
+/// The second invocation has LegacySegment and LegacyOffset set to the location\r
+/// in the 0xF0000 or 0xE0000 block to which the table is to be copied. The second\r
+/// invocation allows any table address fix ups to occur in the EFI memory copy of the table.\r
+/// The caller, not EfiGetPlatformBinaryOem32Data, copies the modified table to\r
+/// the allocated region in 0xF0000 or 0xE0000 block after the second invocation..\r
+///\r
+/// Note: There are two generic mechanisms by which this mode can be used.\r
+/// Mechanism 1: This mode returns the data and the Legacy BIOS Protocol copies\r
+/// the data into the F0000 or E0000 block in the Compatibility16 code. The\r
+/// EFI_COMPATIBILITY16_TABLE entries Oem32Segment and Oem32Offset can\r
+/// be viewed as two UINT16 entries.\r
+/// Mechanism 2: This mode directly fills in the EFI_COMPATIBILITY16_TABLE with\r
+/// a pointer to the INT15 E820 region containing the 32 bit code. It returns\r
+/// EFI_UNSUPPORTED. The EFI_COMPATIBILITY16_TABLE entries,\r
+/// Oem32Segment and Oem32Offset, can be viewed as two UINT16 entries or\r
+/// as a single UINT32 entry as determined by the IBV.\r
+///\r
+/// The function parameters associated with this mode are:\r
+///\r
+///   TableSize Size of data.\r
+///\r
+///   Location Location to place the table. 0x00 or 0xE0000 or 0xF0000 64 KB blocks.\r
+///       Bit 0 = 1 0xF0000 64 KB block.\r
+///       Bit 1 = 1 0xE0000 64 KB block.\r
+///       Multiple bits can be set.\r
+///\r
+///   Alignment Bit mapped address alignment granularity.\r
+///       The first nonzero bit from the right is the address granularity.\r
+///\r
+///   LegacySegment Segment in which EfiCompatibility code will place the table or data.\r
+///\r
+///   LegacyOffset Offset in which EfiCompatibility code will place the table or data.\r
+///\r
+/// The return values associated with this mode are:\r
+///   EFI_SUCCESS The data was returned successfully.\r
+///   EFI_UNSUPPORTED Oem32 is not supported on this platform.\r
+///\r
+EfiGetPlatformBinaryOem32Data    = 3,\r
+  ///\r
+  /// This mode returns a TPM binary image for the onboard TPM device.\r
+  ///\r
+  /// The function parameters associated with this mode are:\r
+  ///\r
+  ///   Table TPM binary image for the onboard TPM device.\r
+  ///\r
+  ///   TableSize Size of BinaryImage in bytes.\r
+  ///\r
+  ///   Location Location to place the table. 0x00. Either 0xE0000 or 0xF0000 64 KB blocks.\r
+  ///      Bit 0 = 1 0xF0000 64 KB block.\r
+  ///      Bit 1 = 1 0xE0000 64 KB block.\r
+  ///      Multiple bits can be set.\r
+  ///\r
+  ///   Alignment Bit mapped address alignment granularity.\r
+  ///     The first nonzero bit from the right is the address granularity.\r
+  ///\r
+  ///   LegacySegment Segment in which EfiCompatibility code will place the table or data.\r
+  ///\r
+  ///   LegacyOffset Offset in which EfiCompatibility code will place the table or data.\r
+  ///\r
+  /// The return values associated with this mode are:\r
+  ///\r
+  ///   EFI_SUCCESS BinaryImage is valid.\r
+  ///\r
+  ///   EFI_UNSUPPORTED Mode is not supported on this platform.\r
+  ///\r
+  ///   EFI_NOT_FOUND No BinaryImage was found.\r
+  ///\r
+  EfiGetPlatformBinaryTpmBinary    = 4,\r
+  ///\r
+  /// The mode finds the Compatibility16 Rom Image.\r
+  ///\r
+  /// The function parameters associated with this mode are:\r
+  ///\r
+  ///    System ROM image for the platform.\r
+  ///\r
+  ///    TableSize Size of Table in bytes.\r
+  ///\r
+  ///    Location Ignored.\r
+  ///\r
+  ///    Alignment Ignored.\r
+  ///\r
+  ///    LegacySegment Ignored.\r
+  ///\r
+  ///    LegacyOffset Ignored.\r
+  ///\r
+  /// The return values associated with this mode are:\r
+  ///\r
+  ///    EFI_SUCCESS ROM image found.\r
+  ///\r
+  ///    EFI_NOT_FOUND ROM not found.\r
+  ///\r
+  EfiGetPlatformBinarySystemRom    = 5,\r
+  ///\r
+  /// This mode returns the Base address of PciExpress memory mapped configuration\r
+  /// address space.\r
+  ///\r
+  /// The function parameters associated with this mode are:\r
+  ///\r
+  ///    Table System ROM image for the platform.\r
+  ///\r
+  ///    TableSize Size of Table in bytes.\r
+  ///\r
+  ///    Location Ignored.\r
+  ///\r
+  ///    Alignment Ignored.\r
+  ///\r
+  ///    LegacySegment Ignored.\r
+  ///\r
+  ///    LegacyOffset Ignored.\r
+  ///\r
+  /// The return values associated with this mode are:\r
+  ///\r
+  ///   EFI_SUCCESS Address is valid.\r
+  ///\r
+  ///   EFI_UNSUPPORTED System does not PciExpress.\r
+  ///\r
+  EfiGetPlatformPciExpressBase     = 6,\r
+  ///\r
+  EfiGetPlatformPmmSize            = 7,\r
+  ///\r
+  EfiGetPlatformEndOpromShadowAddr = 8,\r
+  ///\r
+} EFI_GET_PLATFORM_INFO_MODE;\r
+\r
+/**\r
+  This enum specifies the Mode param values for GetPlatformHandle().\r
+**/\r
+typedef enum {\r
+  ///\r
+  /// This mode returns the Compatibility16 policy for the device that should be the VGA\r
+  /// controller used during a Compatibility16 boot.\r
+  ///\r
+  /// The function parameters associated with this mode are:\r
+  ///\r
+  ///   Type 0x00.\r
+  ///\r
+  ///   HandleBuffer Buffer of all VGA handles found.\r
+  ///\r
+  ///   HandleCount Number of VGA handles found.\r
+  ///\r
+  ///   AdditionalData NULL.\r
+  ///\r
+  EfiGetPlatformVgaHandle       = 0,\r
+  ///\r
+  /// This mode returns the Compatibility16 policy for the device that should be the IDE\r
+  /// controller used during a Compatibility16 boot.\r
+  ///\r
+  /// The function parameters associated with this mode are:\r
+  ///\r
+  ///   Type 0x00.\r
+  ///\r
+  ///   HandleBuffer Buffer of all IDE handles found.\r
+  ///\r
+  ///   HandleCount Number of IDE handles found.\r
+  ///\r
+  ///   AdditionalData Pointer to HddInfo.\r
+  ///     Information about all onboard IDE controllers.\r
+  ///\r
+  EfiGetPlatformIdeHandle       = 1,\r
+  ///\r
+  /// This mode returns the Compatibility16 policy for the device that should be the ISA bus\r
+  /// controller used during a Compatibility16 boot.\r
+  ///\r
+  /// The function parameters associated with this mode are:\r
+  ///\r
+  ///   Type 0x00.\r
+  ///\r
+  ///   HandleBuffer Buffer of all ISA bus handles found.\r
+  ///\r
+  ///   HandleCount Number of ISA bus handles found.\r
+  ///\r
+  ///   AdditionalData NULL.\r
+  ///\r
+  EfiGetPlatformIsaBusHandle    = 2,\r
+  ///\r
+  /// This mode returns the Compatibility16 policy for the device that should be the USB\r
+  /// device used during a Compatibility16 boot.\r
+  ///\r
+  /// The function parameters associated with this mode are:\r
+  ///\r
+  ///   Type 0x00.\r
+  ///\r
+  ///   HandleBuffer Buffer of all USB handles found.\r
+  ///\r
+  ///   HandleCount Number of USB bus handles found.\r
+  ///\r
+  ///   AdditionalData NULL.\r
+  ///\r
+  EfiGetPlatformUsbHandle       = 3\r
+} EFI_GET_PLATFORM_HANDLE_MODE;\r
+\r
+/**\r
+  This enum specifies the Mode param values for PlatformHooks().\r
+  Note: Any OEM defined hooks start with 0x8000.\r
+**/\r
+typedef enum {\r
+  ///\r
+  /// This mode allows any preprocessing before scanning OpROMs.\r
+  ///\r
+  /// The function parameters associated with this mode are:\r
+  ///\r
+  ///     Type 0.\r
+  ///\r
+  ///     DeviceHandle Handle of device OpROM is associated with.\r
+  ///\r
+  ///     ShadowAddress Address where OpROM is shadowed.\r
+  ///\r
+  ///     Compatibility16Table NULL.\r
+  ///\r
+  ///     AdditionalData NULL.\r
+  ///\r
+  EfiPlatformHookPrepareToScanRom = 0,\r
+  ///\r
+  /// This mode shadows legacy OpROMS that may not have a physical device associated with\r
+  /// them. It returns EFI_SUCCESS if the ROM was shadowed.\r
+  ///\r
+  /// The function parameters associated with this mode are:\r
+  ///\r
+  ///     Type 0.\r
+  ///\r
+  ///     DeviceHandle 0.\r
+  ///\r
+  ///     ShadowAddress First free OpROM area, after other OpROMs have been dispatched..\r
+  ///\r
+  ///     Compatibility16Table Pointer to the Compatability16 Table.\r
+  ///\r
+  ///       AdditionalData NULL.\r
+  ///\r
+  EfiPlatformHookShadowServiceRoms= 1,\r
+  ///\r
+  /// This mode allows platform to perform any required operation after an OpROM has\r
+  /// completed its initialization.\r
+  ///\r
+  /// The function parameters associated with this mode are:\r
+  ///\r
+  ///       Type 0.\r
+  ///\r
+  ///       DeviceHandle Handle of device OpROM is associated with.\r
+  ///\r
+  ///       ShadowAddress Address where OpROM is shadowed.\r
+  ///\r
+  ///       Compatibility16Table NULL.\r
+  ///\r
+  ///       AdditionalData NULL.\r
+  ///\r
+  EfiPlatformHookAfterRomInit     = 2\r
+} EFI_GET_PLATFORM_HOOK_MODE;\r
+\r
+///\r
+/// This IRQ has not been assigned to PCI.\r
+///\r
+#define PCI_UNUSED        0x00\r
+///\r
+/// This IRQ has been assigned to PCI.\r
+///\r
+#define PCI_USED          0xFF\r
+///\r
+/// This IRQ has been used by an SIO legacy device and cannot be used by PCI.\r
+///\r
+#define LEGACY_USED       0xFE\r
+\r
+#pragma pack(1)\r
+\r
+typedef struct {\r
+  ///\r
+  /// IRQ for this entry.\r
+  ///\r
+  UINT8 Irq;\r
+  ///\r
+  /// Status of this IRQ.\r
+  ///\r
+  /// PCI_UNUSED 0x00. This IRQ has not been assigned to PCI.\r
+  ///\r
+  /// PCI_USED 0xFF. This IRQ has been assigned to PCI.\r
+  ///\r
+  /// LEGACY_USED 0xFE. This IRQ has been used by an SIO legacy\r
+  /// device and cannot be used by PCI.\r
+  ///\r
+  UINT8 Used;\r
+} EFI_LEGACY_IRQ_PRIORITY_TABLE_ENTRY;\r
+\r
+//\r
+// Define PIR table structures\r
+//\r
+#define EFI_LEGACY_PIRQ_TABLE_SIGNATURE SIGNATURE_32 ('$', 'P', 'I', 'R')\r
+\r
+typedef struct {\r
+  ///\r
+  /// $PIR.\r
+  ///\r
+  UINT32  Signature;\r
+  ///\r
+  /// 0x00.\r
+  ///\r
+  UINT8   MinorVersion;\r
+  ///\r
+  /// 0x01 for table version 1.0.\r
+  ///\r
+  UINT8   MajorVersion;\r
+  ///\r
+  /// 0x20 + RoutingTableEntries * 0x10.\r
+  ///\r
+  UINT16  TableSize;\r
+  ///\r
+  /// PCI interrupt router bus.\r
+  ///\r
+  UINT8   Bus;\r
+  ///\r
+  /// PCI interrupt router device/function.\r
+  ///\r
+  UINT8   DevFun;\r
+  ///\r
+  /// If nonzero, bit map of IRQs reserved for PCI.\r
+  ///\r
+  UINT16  PciOnlyIrq;\r
+  ///\r
+  /// Vendor ID of a compatible PCI interrupt router.\r
+  ///\r
+  UINT16  CompatibleVid;\r
+  ///\r
+  /// Device ID of a compatible PCI interrupt router.\r
+  ///\r
+  UINT16  CompatibleDid;\r
+  ///\r
+  /// If nonzero, a value passed directly to the IRQ miniport's Initialize function.\r
+  ///\r
+  UINT32  Miniport;\r
+  ///\r
+  /// Reserved for future usage.\r
+  ///\r
+  UINT8   Reserved[11];\r
+  ///\r
+  /// This byte plus the sum of all other bytes in the LocalPirqTable equal 0x00.\r
+  ///\r
+  UINT8   Checksum;\r
+} EFI_LEGACY_PIRQ_TABLE_HEADER;\r
+\r
+\r
+typedef struct {\r
+  ///\r
+  /// If nonzero, a value assigned by the IBV.\r
+  ///\r
+  UINT8   Pirq;\r
+  ///\r
+  /// If nonzero, the IRQs that can be assigned to this device.\r
+  ///\r
+  UINT16  IrqMask;\r
+} EFI_LEGACY_PIRQ_ENTRY;\r
+\r
+typedef struct {\r
+  ///\r
+  /// PCI bus of the entry.\r
+  ///\r
+  UINT8                 Bus;\r
+  ///\r
+  /// PCI device of this entry.\r
+  ///\r
+  UINT8                 Device;\r
+  ///\r
+  /// An IBV value and IRQ mask for PIRQ pins A through D.\r
+  ///\r
+  EFI_LEGACY_PIRQ_ENTRY PirqEntry[4];\r
+  ///\r
+  /// If nonzero, the slot number assigned by the board manufacturer.\r
+  ///\r
+  UINT8                 Slot;\r
+  ///\r
+  /// Reserved for future use.\r
+  ///\r
+  UINT8                 Reserved;\r
+} EFI_LEGACY_IRQ_ROUTING_ENTRY;\r
+\r
+#pragma pack()\r
+\r
+\r
+/**\r
+  Finds the binary data or other platform information.\r
+\r
+  @param  This                  The protocol instance pointer.\r
+  @param  Mode                  Specifies what data to return. See See EFI_GET_PLATFORM_INFO_MODE enum.\r
+  @param  Table                 Mode specific.  See EFI_GET_PLATFORM_INFO_MODE enum.\r
+  @param  TableSize              Mode specific.  See EFI_GET_PLATFORM_INFO_MODE enum.\r
+  @param  Location               Mode specific.  See EFI_GET_PLATFORM_INFO_MODE enum.\r
+  @param  Alignment             Mode specific.  See EFI_GET_PLATFORM_INFO_MODE enum.\r
+  @param  LegacySegment         Mode specific.  See EFI_GET_PLATFORM_INFO_MODE enum.\r
+  @param  LegacyOffset          Mode specific.  See EFI_GET_PLATFORM_INFO_MODE enum.\r
+\r
+  @retval EFI_SUCCESS           Data returned successfully.\r
+  @retval EFI_UNSUPPORTED       Mode is not supported on the platform.\r
+  @retval EFI_NOT_FOUND         Binary image or table not found.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_LEGACY_BIOS_PLATFORM_GET_PLATFORM_INFO)(\r
+  IN EFI_LEGACY_BIOS_PLATFORM_PROTOCOL   *This,\r
+  IN EFI_GET_PLATFORM_INFO_MODE          Mode,\r
+  OUT VOID                               **Table,\r
+  OUT UINTN                              *TableSize,\r
+  OUT UINTN                              *Location,\r
+  OUT UINTN                              *Alignment,\r
+  IN  UINT16                             LegacySegment,\r
+  IN  UINT16                             LegacyOffset\r
+  );\r
+\r
+/**\r
+  Returns a buffer of handles for the requested subfunction.\r
+\r
+  @param  This                  The protocol instance pointer.\r
+  @param  Mode                  Specifies what handle to return. See EFI_GET_PLATFORM_HANDLE_MODE enum.\r
+  @param  Type                  Mode specific. See EFI_GET_PLATFORM_HANDLE_MODE enum.\r
+  @param  HandleBuffer          Mode specific. See EFI_GET_PLATFORM_HANDLE_MODE enum.\r
+  @param  HandleCount           Mode specific. See EFI_GET_PLATFORM_HANDLE_MODE enum.\r
+  @param  AdditionalData        Mode specific. See EFI_GET_PLATFORM_HANDLE_MODE enum.\r
+\r
+  @retval EFI_SUCCESS           Handle is valid.\r
+  @retval EFI_UNSUPPORTED       Mode is not supported on the platform.\r
+  @retval EFI_NOT_FOUND         Handle is not known.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_LEGACY_BIOS_PLATFORM_GET_PLATFORM_HANDLE)(\r
+  IN EFI_LEGACY_BIOS_PLATFORM_PROTOCOL   *This,\r
+  IN EFI_GET_PLATFORM_HANDLE_MODE        Mode,\r
+  IN UINT16                              Type,\r
+  OUT EFI_HANDLE                         **HandleBuffer,\r
+  OUT UINTN                              *HandleCount,\r
+  IN  VOID                               **AdditionalData OPTIONAL\r
+  );\r
+\r
+/**\r
+  Load and initialize the Legacy BIOS SMM handler.\r
+\r
+  @param  This                   The protocol instance pointer.\r
+  @param  EfiToLegacy16BootTable A pointer to Legacy16 boot table.\r
+\r
+  @retval EFI_SUCCESS           SMM code loaded.\r
+  @retval EFI_DEVICE_ERROR      SMM code failed to load\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_LEGACY_BIOS_PLATFORM_SMM_INIT)(\r
+  IN EFI_LEGACY_BIOS_PLATFORM_PROTOCOL   *This,\r
+  IN  VOID                               *EfiToLegacy16BootTable\r
+  );\r
+\r
+/**\r
+  Allows platform to perform any required action after a LegacyBios operation.\r
+  Invokes the specific sub function specified by Mode.\r
+\r
+  @param  This                  The protocol instance pointer.\r
+  @param  Mode                  Specifies what handle to return. See EFI_GET_PLATFORM_HOOK_MODE enum.\r
+  @param  Type                  Mode specific.  See EFI_GET_PLATFORM_HOOK_MODE enum.\r
+  @param  DeviceHandle          Mode specific.  See EFI_GET_PLATFORM_HOOK_MODE enum.\r
+  @param  ShadowAddress         Mode specific.  See EFI_GET_PLATFORM_HOOK_MODE enum.\r
+  @param  Compatibility16Table  Mode specific.  See EFI_GET_PLATFORM_HOOK_MODE enum.\r
+  @param  AdditionalData        Mode specific.  See EFI_GET_PLATFORM_HOOK_MODE enum.\r
+\r
+  @retval EFI_SUCCESS           The operation performed successfully. Mode specific.\r
+  @retval EFI_UNSUPPORTED       Mode is not supported on the platform.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_LEGACY_BIOS_PLATFORM_HOOKS)(\r
+  IN EFI_LEGACY_BIOS_PLATFORM_PROTOCOL   *This,\r
+  IN EFI_GET_PLATFORM_HOOK_MODE          Mode,\r
+  IN UINT16                              Type,\r
+  IN  EFI_HANDLE                         DeviceHandle, OPTIONAL\r
+  IN  OUT UINTN                          *ShadowAddress, OPTIONAL\r
+  IN  EFI_COMPATIBILITY16_TABLE          *Compatibility16Table, OPTIONAL\r
+  OUT  VOID                               **AdditionalData OPTIONAL\r
+  );\r
+\r
+/**\r
+  Returns information associated with PCI IRQ routing.\r
+  This function returns the following information associated with PCI IRQ routing:\r
+    * An IRQ routing table and number of entries in the table.\r
+    * The $PIR table and its size.\r
+    * A list of PCI IRQs and the priority order to assign them.\r
+\r
+  @param  This                    The protocol instance pointer.\r
+  @param  RoutingTable            The pointer to PCI IRQ Routing table.\r
+                                  This location is the $PIR table minus the header.\r
+  @param  RoutingTableEntries     The number of entries in table.\r
+  @param  LocalPirqTable          $PIR table.\r
+  @param  PirqTableSize           $PIR table size.\r
+  @param  LocalIrqPriorityTable   A list of interrupts in priority order to assign.\r
+  @param  IrqPriorityTableEntries The number of entries in the priority table.\r
+\r
+  @retval EFI_SUCCESS           Data was successfully returned.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_LEGACY_BIOS_PLATFORM_GET_ROUTING_TABLE)(\r
+  IN EFI_LEGACY_BIOS_PLATFORM_PROTOCOL   *This,\r
+  OUT VOID                               **RoutingTable,\r
+  OUT UINTN                              *RoutingTableEntries,\r
+  OUT VOID                               **LocalPirqTable, OPTIONAL\r
+  OUT UINTN                              *PirqTableSize, OPTIONAL\r
+  OUT VOID                               **LocalIrqPriorityTable, OPTIONAL\r
+  OUT UINTN                              *IrqPriorityTableEntries OPTIONAL\r
+  );\r
+\r
+/**\r
+  Translates the given PIRQ accounting for bridge.\r
+  This function translates the given PIRQ back through all buses, if required,\r
+  and returns the true PIRQ and associated IRQ.\r
+\r
+  @param  This                  The protocol instance pointer.\r
+  @param  PciBus                The PCI bus number for this device.\r
+  @param  PciDevice             The PCI device number for this device.\r
+  @param  PciFunction           The PCI function number for this device.\r
+  @param  Pirq                  Input is PIRQ reported by device, and output is true PIRQ.\r
+  @param  PciIrq                The IRQ already assigned to the PIRQ, or the IRQ to be\r
+                                assigned to the PIRQ.\r
+\r
+  @retval EFI_SUCCESS           The PIRQ was translated.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_LEGACY_BIOS_PLATFORM_TRANSLATE_PIRQ)(\r
+  IN EFI_LEGACY_BIOS_PLATFORM_PROTOCOL   *This,\r
+  IN  UINTN                              PciBus,\r
+  IN  UINTN                              PciDevice,\r
+  IN  UINTN                              PciFunction,\r
+  IN  OUT UINT8                          *Pirq,\r
+  OUT UINT8                              *PciIrq\r
+  );\r
+\r
+/**\r
+  Attempt to legacy boot the BootOption. If the EFI contexted has been\r
+  compromised this function will not return.\r
+\r
+  @param  This                   The protocol instance pointer.\r
+  @param  BbsDevicePath          The EFI Device Path from BootXXXX variable.\r
+  @param  BbsTable               The Internal BBS table.\r
+  @param  LoadOptionSize         The size of LoadOption in size.\r
+  @param  LoadOption             The LoadOption from BootXXXX variable\r
+  @param  EfiToLegacy16BootTable A pointer to BootTable structure\r
+\r
+  @retval EFI_SUCCESS           Ready to boot.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_LEGACY_BIOS_PLATFORM_PREPARE_TO_BOOT)(\r
+  IN EFI_LEGACY_BIOS_PLATFORM_PROTOCOL   *This,\r
+  IN  BBS_BBS_DEVICE_PATH                *BbsDevicePath,\r
+  IN  VOID                               *BbsTable,\r
+  IN  UINT32                             LoadOptionsSize,\r
+  IN  VOID                               *LoadOptions,\r
+  IN  VOID                               *EfiToLegacy16BootTable\r
+  );\r
+\r
+/**\r
+  This protocol abstracts the platform portion of the traditional BIOS.\r
+**/\r
+struct _EFI_LEGACY_BIOS_PLATFORM_PROTOCOL {\r
+  ///\r
+  ///  Gets binary data or other platform information.\r
+  ///\r
+  EFI_LEGACY_BIOS_PLATFORM_GET_PLATFORM_INFO    GetPlatformInfo;\r
+  ///\r
+  ///  Returns a buffer of all handles matching the requested subfunction.\r
+  ///\r
+  EFI_LEGACY_BIOS_PLATFORM_GET_PLATFORM_HANDLE  GetPlatformHandle;\r
+  ///\r
+  ///  Loads and initializes the traditional BIOS SMM handler.\r
+  EFI_LEGACY_BIOS_PLATFORM_SMM_INIT             SmmInit;\r
+  ///\r
+  ///  Allows platform to perform any required actions after a LegacyBios operation.\r
+  ///\r
+  EFI_LEGACY_BIOS_PLATFORM_HOOKS                PlatformHooks;\r
+  ///\r
+  ///  Gets $PIR table.\r
+  EFI_LEGACY_BIOS_PLATFORM_GET_ROUTING_TABLE    GetRoutingTable;\r
+  ///\r
+  ///  Translates the given PIRQ to the final value after traversing any PCI bridges.\r
+  ///\r
+  EFI_LEGACY_BIOS_PLATFORM_TRANSLATE_PIRQ       TranslatePirq;\r
+  ///\r
+  ///  Final platform function before the system attempts to boot to a traditional OS.\r
+  ///\r
+  EFI_LEGACY_BIOS_PLATFORM_PREPARE_TO_BOOT      PrepareToBoot;\r
+};\r
+\r
+extern EFI_GUID gEfiLegacyBiosPlatformProtocolGuid;\r
+\r
+#endif\r