Home | History | Annotate | Download | only in Protocol
      1 /** @file
      2   The EFI Legacy BIOS Patform Protocol is used to mate a Legacy16
      3   implementation with this EFI code. The EFI driver that produces
      4   the Legacy BIOS protocol is generic and consumes this protocol.
      5   A driver that matches the Legacy16 produces this protocol
      6 
      7 Copyright (c) 2007 - 2011, Intel Corporation. All rights reserved.<BR>
      8 This program and the accompanying materials are licensed and made available under
      9 the terms and conditions of the BSD License that accompanies this distribution.
     10 The full text of the license may be found at
     11 http://opensource.org/licenses/bsd-license.php.
     12 
     13 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
     14 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
     15 
     16   @par Revision Reference:
     17   This protocol is defined in Framework for EFI Compatibility Support Module spec
     18   Version 0.97.
     19 
     20 **/
     21 
     22 #ifndef _EFI_LEGACY_BIOS_PLATFORM_H_
     23 #define _EFI_LEGACY_BIOS_PLATFORM_H_
     24 
     25 ///
     26 /// Legacy BIOS Platform depends on HDD_INFO and EFI_COMPATIBILITY16_TABLE that
     27 /// are defined with the Legacy BIOS Protocol
     28 ///
     29 #include <Protocol/LegacyBios.h>
     30 
     31 #define EFI_LEGACY_BIOS_PLATFORM_PROTOCOL_GUID \
     32   { \
     33     0x783658a3, 0x4172, 0x4421, {0xa2, 0x99, 0xe0, 0x9, 0x7, 0x9c, 0xc, 0xb4 } \
     34   }
     35 
     36 typedef struct _EFI_LEGACY_BIOS_PLATFORM_PROTOCOL EFI_LEGACY_BIOS_PLATFORM_PROTOCOL;
     37 
     38 /**
     39   This enum specifies the Mode param values for GetPlatformInfo()
     40 **/
     41 typedef enum {
     42   ///
     43   /// This mode is invoked twice. The first invocation has LegacySegment and
     44   /// LegacyOffset set to 0. The mode returns the MP table address in EFI memory, along with its size.
     45   /// The second invocation has LegacySegment and LegacyOffset set to the location
     46   /// in the 0xF0000 or 0xE0000 block to which the MP table is to be copied. The second
     47   /// invocation allows any MP table address fixes to occur in the EFI memory copy of the
     48   /// MP table. The caller, not EfiGetPlatformBinaryMpTable, copies the modified MP
     49   /// table to the allocated region in 0xF0000 or 0xE0000 block after the second invocation.
     50   ///
     51   /// The function parameters associated with this mode are:
     52   ///
     53   ///   Table Pointer to the MP table.
     54   ///
     55   ///   TableSize Size in bytes of the MP table.
     56   ///
     57   ///   Location Location to place table. 0x00. Either 0xE0000 or 0xF0000 64 KB blocks.
     58   ///     Bit 0 = 1 0xF0000 64 KB block.
     59   ///     Bit 1 = 1 0xE0000 64 KB block.
     60   ///     Multiple bits can be set.
     61   ///
     62   ///   Alignment Bit-mapped address alignment granularity.
     63   ///     The first nonzero bit from the right is the address granularity.
     64   ///
     65   //    LegacySegment Segment in which EfiCompatibility code will place the MP table.
     66   ///
     67   ///   LegacyOffset Offset in which EfiCompatibility code will place the MP table.
     68   ///
     69   /// The return values associated with this mode are:
     70   ///
     71   ///   EFI_SUCCESS The MP table was returned.
     72   ///
     73   ///   EFI_UNSUPPORTED The MP table is not supported on this platform.
     74   ///
     75   EfiGetPlatformBinaryMpTable      = 0,
     76   ///
     77   /// This mode returns a block of data. The content and usage is IBV or OEM defined.
     78   /// OEMs or IBVs normally use this function for nonstandard Compatibility16 runtime soft
     79   /// INTs. It is the responsibility of this routine to coalesce multiple OEM 16 bit functions, if
     80   /// they exist, into one coherent package that is understandable by the Compatibility16 code.
     81   /// This function is invoked twice. The first invocation has LegacySegment and
     82   /// LegacyOffset set to 0. The function returns the table address in EFI memory, as well as its size.
     83   /// The second invocation has LegacySegment and LegacyOffset set to the location
     84   /// in the 0xF0000 or 0xE0000 block to which the data (table) is to be copied. The second
     85   /// invocation allows any data (table) address fixes to occur in the EFI memory copy of
     86   /// the table. The caller, not GetOemIntData(), copies the modified data (table) to the
     87   /// allocated region in 0xF0000 or 0xE0000 block after the second invocation.
     88   ///
     89   /// The function parameters associated with this mode are:
     90   ///
     91   ///   Table Pointer to OEM legacy 16 bit code or data.
     92   ///
     93   ///   TableSize Size of data.
     94   ///
     95   ///   Location Location to place table. 0x00. Either 0xE0000 or 0xF0000 64 KB blocks.
     96   ///       Bit 0 = 1 0xF0000 64 KB block.
     97   ///       Bit 1 = 1 0xE0000 64 KB block.
     98   ///       Multiple bits can be set.
     99   ///
    100   ///   Alignment Bit mapped address alignment granularity.
    101   ///     The first nonzero bit from the right is the address granularity.
    102   ///
    103   ///   LegacySegment Segment in which EfiCompatibility code will place the table or data.
    104   ///
    105   ///   LegacyOffset Offset in which EfiCompatibility code will place the table or data.
    106   ///
    107   /// The return values associated with this mode are:
    108   ///
    109   ///   EFI_SUCCESS The data was returned successfully.
    110   ///
    111   ///   EFI_UNSUPPORTED Oem INT is not supported on this platform.
    112   ///
    113   EfiGetPlatformBinaryOemIntData   = 1,
    114   ///
    115   /// This mode returns a block of data. The content and usage is IBV defined. OEMs or
    116   /// IBVs normally use this mode for nonstandard Compatibility16 runtime 16 bit routines. It
    117   /// is the responsibility of this routine to coalesce multiple OEM 16 bit functions, if they
    118   /// exist, into one coherent package that is understandable by the Compatibility16 code.
    119   ///
    120   /// Example usage: A legacy mobile BIOS that has a pre-existing runtime
    121   /// interface to return the battery status to calling applications.
    122   ///
    123   /// This mode is invoked twice. The first invocation has LegacySegment and
    124   /// LegacyOffset set to 0. The mode returns the table address in EFI memory and its size.
    125   /// The second invocation has LegacySegment and LegacyOffset set to the location
    126   /// in the 0xF0000 or 0xE0000 block to which the table is to be copied. The second
    127   /// invocation allows any table address fixes to occur in the EFI memory copy of the table.
    128   /// The caller, not EfiGetPlatformBinaryOem16Data, copies the modified table to
    129   /// the allocated region in 0xF0000 or 0xE0000 block after the second invocation.
    130   ///
    131   /// The function parameters associated with this mode are:
    132   ///
    133   ///   Table Pointer to OEM legacy 16 bit code or data.
    134   ///
    135   ///   TableSize Size of data.
    136   ///
    137   ///   Location Location to place the table. 0x00. Either 0xE0000 or 0xF0000 64 KB blocks.
    138   ///      Bit 0 = 1 0xF0000 64 KB block.
    139   ///      Bit 1 = 1 0xE0000 64 KB block.
    140   ///      Multiple bits can be set.
    141   ///
    142   ///   Alignment Bit mapped address alignment granularity.
    143   ///     The first nonzero bit from the right is the address granularity.
    144   ///
    145   ///   LegacySegment Segment in which EfiCompatibility code will place the table or data.
    146   ///
    147   ///   LegacyOffset Offset in which EfiCompatibility code will place the table or data.
    148   ///
    149   /// The return values associated with this mode are:
    150   ///
    151   ///   EFI_SUCCESS The data was returned successfully.
    152   ///
    153   ///   EFI_UNSUPPORTED Oem16 is not supported on this platform.
    154   ///
    155   EfiGetPlatformBinaryOem16Data    = 2,
    156 ///
    157 /// This mode returns a block of data. The content and usage are IBV defined. OEMs or
    158 /// IBVs normally use this mode for nonstandard Compatibility16 runtime 32 bit routines. It
    159 /// is the responsibility of this routine to coalesce multiple OEM 32 bit functions, if they
    160 /// exist, into one coherent package that is understandable by the Compatibility16 code.
    161 ///
    162 /// Example usage: A legacy mobile BIOS that has a pre existing runtime
    163 /// interface to return the battery status to calling applications.
    164 ///
    165 /// This mode is invoked twice. The first invocation has LegacySegment and
    166 /// LegacyOffset set to 0. The mode returns the table address in EFI memory and its size.
    167 ///
    168 /// The second invocation has LegacySegment and LegacyOffset set to the location
    169 /// in the 0xF0000 or 0xE0000 block to which the table is to be copied. The second
    170 /// invocation allows any table address fix ups to occur in the EFI memory copy of the table.
    171 /// The caller, not EfiGetPlatformBinaryOem32Data, copies the modified table to
    172 /// the allocated region in 0xF0000 or 0xE0000 block after the second invocation..
    173 ///
    174 /// Note: There are two generic mechanisms by which this mode can be used.
    175 /// Mechanism 1: This mode returns the data and the Legacy BIOS Protocol copies
    176 /// the data into the F0000 or E0000 block in the Compatibility16 code. The
    177 /// EFI_COMPATIBILITY16_TABLE entries Oem32Segment and Oem32Offset can
    178 /// be viewed as two UINT16 entries.
    179 /// Mechanism 2: This mode directly fills in the EFI_COMPATIBILITY16_TABLE with
    180 /// a pointer to the INT15 E820 region containing the 32 bit code. It returns
    181 /// EFI_UNSUPPORTED. The EFI_COMPATIBILITY16_TABLE entries,
    182 /// Oem32Segment and Oem32Offset, can be viewed as two UINT16 entries or
    183 /// as a single UINT32 entry as determined by the IBV.
    184 ///
    185 /// The function parameters associated with this mode are:
    186 ///
    187 ///   TableSize Size of data.
    188 ///
    189 ///   Location Location to place the table. 0x00 or 0xE0000 or 0xF0000 64 KB blocks.
    190 ///       Bit 0 = 1 0xF0000 64 KB block.
    191 ///       Bit 1 = 1 0xE0000 64 KB block.
    192 ///       Multiple bits can be set.
    193 ///
    194 ///   Alignment Bit mapped address alignment granularity.
    195 ///       The first nonzero bit from the right is the address granularity.
    196 ///
    197 ///   LegacySegment Segment in which EfiCompatibility code will place the table or data.
    198 ///
    199 ///   LegacyOffset Offset in which EfiCompatibility code will place the table or data.
    200 ///
    201 /// The return values associated with this mode are:
    202 ///   EFI_SUCCESS The data was returned successfully.
    203 ///   EFI_UNSUPPORTED Oem32 is not supported on this platform.
    204 ///
    205 EfiGetPlatformBinaryOem32Data    = 3,
    206   ///
    207   /// This mode returns a TPM binary image for the onboard TPM device.
    208   ///
    209   /// The function parameters associated with this mode are:
    210   ///
    211   ///   Table TPM binary image for the onboard TPM device.
    212   ///
    213   ///   TableSize Size of BinaryImage in bytes.
    214   ///
    215   ///   Location Location to place the table. 0x00. Either 0xE0000 or 0xF0000 64 KB blocks.
    216   ///      Bit 0 = 1 0xF0000 64 KB block.
    217   ///      Bit 1 = 1 0xE0000 64 KB block.
    218   ///      Multiple bits can be set.
    219   ///
    220   ///   Alignment Bit mapped address alignment granularity.
    221   ///     The first nonzero bit from the right is the address granularity.
    222   ///
    223   ///   LegacySegment Segment in which EfiCompatibility code will place the table or data.
    224   ///
    225   ///   LegacyOffset Offset in which EfiCompatibility code will place the table or data.
    226   ///
    227   /// The return values associated with this mode are:
    228   ///
    229   ///   EFI_SUCCESS BinaryImage is valid.
    230   ///
    231   ///   EFI_UNSUPPORTED Mode is not supported on this platform.
    232   ///
    233   ///   EFI_NOT_FOUND No BinaryImage was found.
    234   ///
    235   EfiGetPlatformBinaryTpmBinary    = 4,
    236   ///
    237   /// The mode finds the Compatibility16 Rom Image.
    238   ///
    239   /// The function parameters associated with this mode are:
    240   ///
    241   ///    System ROM image for the platform.
    242   ///
    243   ///    TableSize Size of Table in bytes.
    244   ///
    245   ///    Location Ignored.
    246   ///
    247   ///    Alignment Ignored.
    248   ///
    249   ///    LegacySegment Ignored.
    250   ///
    251   ///    LegacyOffset Ignored.
    252   ///
    253   /// The return values associated with this mode are:
    254   ///
    255   ///    EFI_SUCCESS ROM image found.
    256   ///
    257   ///    EFI_NOT_FOUND ROM not found.
    258   ///
    259   EfiGetPlatformBinarySystemRom    = 5,
    260   ///
    261   /// This mode returns the Base address of PciExpress memory mapped configuration
    262   /// address space.
    263   ///
    264   /// The function parameters associated with this mode are:
    265   ///
    266   ///    Table System ROM image for the platform.
    267   ///
    268   ///    TableSize Size of Table in bytes.
    269   ///
    270   ///    Location Ignored.
    271   ///
    272   ///    Alignment Ignored.
    273   ///
    274   ///    LegacySegment Ignored.
    275   ///
    276   ///    LegacyOffset Ignored.
    277   ///
    278   /// The return values associated with this mode are:
    279   ///
    280   ///   EFI_SUCCESS Address is valid.
    281   ///
    282   ///   EFI_UNSUPPORTED System does not PciExpress.
    283   ///
    284   EfiGetPlatformPciExpressBase     = 6,
    285   ///
    286   EfiGetPlatformPmmSize            = 7,
    287   ///
    288   EfiGetPlatformEndOpromShadowAddr = 8,
    289   ///
    290 } EFI_GET_PLATFORM_INFO_MODE;
    291 
    292 /**
    293   This enum specifies the Mode param values for GetPlatformHandle().
    294 **/
    295 typedef enum {
    296   ///
    297   /// This mode returns the Compatibility16 policy for the device that should be the VGA
    298   /// controller used during a Compatibility16 boot.
    299   ///
    300   /// The function parameters associated with this mode are:
    301   ///
    302   ///   Type 0x00.
    303   ///
    304   ///   HandleBuffer Buffer of all VGA handles found.
    305   ///
    306   ///   HandleCount Number of VGA handles found.
    307   ///
    308   ///   AdditionalData NULL.
    309   ///
    310   EfiGetPlatformVgaHandle       = 0,
    311   ///
    312   /// This mode returns the Compatibility16 policy for the device that should be the IDE
    313   /// controller used during a Compatibility16 boot.
    314   ///
    315   /// The function parameters associated with this mode are:
    316   ///
    317   ///   Type 0x00.
    318   ///
    319   ///   HandleBuffer Buffer of all IDE handles found.
    320   ///
    321   ///   HandleCount Number of IDE handles found.
    322   ///
    323   ///   AdditionalData Pointer to HddInfo.
    324   ///     Information about all onboard IDE controllers.
    325   ///
    326   EfiGetPlatformIdeHandle       = 1,
    327   ///
    328   /// This mode returns the Compatibility16 policy for the device that should be the ISA bus
    329   /// controller used during a Compatibility16 boot.
    330   ///
    331   /// The function parameters associated with this mode are:
    332   ///
    333   ///   Type 0x00.
    334   ///
    335   ///   HandleBuffer Buffer of all ISA bus handles found.
    336   ///
    337   ///   HandleCount Number of ISA bus handles found.
    338   ///
    339   ///   AdditionalData NULL.
    340   ///
    341   EfiGetPlatformIsaBusHandle    = 2,
    342   ///
    343   /// This mode returns the Compatibility16 policy for the device that should be the USB
    344   /// device used during a Compatibility16 boot.
    345   ///
    346   /// The function parameters associated with this mode are:
    347   ///
    348   ///   Type 0x00.
    349   ///
    350   ///   HandleBuffer Buffer of all USB handles found.
    351   ///
    352   ///   HandleCount Number of USB bus handles found.
    353   ///
    354   ///   AdditionalData NULL.
    355   ///
    356   EfiGetPlatformUsbHandle       = 3
    357 } EFI_GET_PLATFORM_HANDLE_MODE;
    358 
    359 /**
    360   This enum specifies the Mode param values for PlatformHooks().
    361   Note: Any OEM defined hooks start with 0x8000.
    362 **/
    363 typedef enum {
    364   ///
    365   /// This mode allows any preprocessing before scanning OpROMs.
    366   ///
    367   /// The function parameters associated with this mode are:
    368   ///
    369   ///     Type 0.
    370   ///
    371   ///     DeviceHandle Handle of device OpROM is associated with.
    372   ///
    373   ///     ShadowAddress Address where OpROM is shadowed.
    374   ///
    375   ///     Compatibility16Table NULL.
    376   ///
    377   ///     AdditionalData NULL.
    378   ///
    379   EfiPlatformHookPrepareToScanRom = 0,
    380   ///
    381   /// This mode shadows legacy OpROMS that may not have a physical device associated with
    382   /// them. It returns EFI_SUCCESS if the ROM was shadowed.
    383   ///
    384   /// The function parameters associated with this mode are:
    385   ///
    386   ///     Type 0.
    387   ///
    388   ///     DeviceHandle 0.
    389   ///
    390   ///     ShadowAddress First free OpROM area, after other OpROMs have been dispatched..
    391   ///
    392   ///     Compatibility16Table Pointer to the Compatability16 Table.
    393   ///
    394   ///       AdditionalData NULL.
    395   ///
    396   EfiPlatformHookShadowServiceRoms= 1,
    397   ///
    398   /// This mode allows platform to perform any required operation after an OpROM has
    399   /// completed its initialization.
    400   ///
    401   /// The function parameters associated with this mode are:
    402   ///
    403   ///       Type 0.
    404   ///
    405   ///       DeviceHandle Handle of device OpROM is associated with.
    406   ///
    407   ///       ShadowAddress Address where OpROM is shadowed.
    408   ///
    409   ///       Compatibility16Table NULL.
    410   ///
    411   ///       AdditionalData NULL.
    412   ///
    413   EfiPlatformHookAfterRomInit     = 2
    414 } EFI_GET_PLATFORM_HOOK_MODE;
    415 
    416 ///
    417 /// This IRQ has not been assigned to PCI.
    418 ///
    419 #define PCI_UNUSED        0x00
    420 ///
    421 /// This IRQ has been assigned to PCI.
    422 ///
    423 #define PCI_USED          0xFF
    424 ///
    425 /// This IRQ has been used by an SIO legacy device and cannot be used by PCI.
    426 ///
    427 #define LEGACY_USED       0xFE
    428 
    429 #pragma pack(1)
    430 
    431 typedef struct {
    432   ///
    433   /// IRQ for this entry.
    434   ///
    435   UINT8 Irq;
    436   ///
    437   /// Status of this IRQ.
    438   ///
    439   /// PCI_UNUSED 0x00. This IRQ has not been assigned to PCI.
    440   ///
    441   /// PCI_USED 0xFF. This IRQ has been assigned to PCI.
    442   ///
    443   /// LEGACY_USED 0xFE. This IRQ has been used by an SIO legacy
    444   /// device and cannot be used by PCI.
    445   ///
    446   UINT8 Used;
    447 } EFI_LEGACY_IRQ_PRIORITY_TABLE_ENTRY;
    448 
    449 //
    450 // Define PIR table structures
    451 //
    452 #define EFI_LEGACY_PIRQ_TABLE_SIGNATURE SIGNATURE_32 ('$', 'P', 'I', 'R')
    453 
    454 typedef struct {
    455   ///
    456   /// $PIR.
    457   ///
    458   UINT32  Signature;
    459   ///
    460   /// 0x00.
    461   ///
    462   UINT8   MinorVersion;
    463   ///
    464   /// 0x01 for table version 1.0.
    465   ///
    466   UINT8   MajorVersion;
    467   ///
    468   /// 0x20 + RoutingTableEntries * 0x10.
    469   ///
    470   UINT16  TableSize;
    471   ///
    472   /// PCI interrupt router bus.
    473   ///
    474   UINT8   Bus;
    475   ///
    476   /// PCI interrupt router device/function.
    477   ///
    478   UINT8   DevFun;
    479   ///
    480   /// If nonzero, bit map of IRQs reserved for PCI.
    481   ///
    482   UINT16  PciOnlyIrq;
    483   ///
    484   /// Vendor ID of a compatible PCI interrupt router.
    485   ///
    486   UINT16  CompatibleVid;
    487   ///
    488   /// Device ID of a compatible PCI interrupt router.
    489   ///
    490   UINT16  CompatibleDid;
    491   ///
    492   /// If nonzero, a value passed directly to the IRQ miniport's Initialize function.
    493   ///
    494   UINT32  Miniport;
    495   ///
    496   /// Reserved for future usage.
    497   ///
    498   UINT8   Reserved[11];
    499   ///
    500   /// This byte plus the sum of all other bytes in the LocalPirqTable equal 0x00.
    501   ///
    502   UINT8   Checksum;
    503 } EFI_LEGACY_PIRQ_TABLE_HEADER;
    504 
    505 
    506 typedef struct {
    507   ///
    508   /// If nonzero, a value assigned by the IBV.
    509   ///
    510   UINT8   Pirq;
    511   ///
    512   /// If nonzero, the IRQs that can be assigned to this device.
    513   ///
    514   UINT16  IrqMask;
    515 } EFI_LEGACY_PIRQ_ENTRY;
    516 
    517 typedef struct {
    518   ///
    519   /// PCI bus of the entry.
    520   ///
    521   UINT8                 Bus;
    522   ///
    523   /// PCI device of this entry.
    524   ///
    525   UINT8                 Device;
    526   ///
    527   /// An IBV value and IRQ mask for PIRQ pins A through D.
    528   ///
    529   EFI_LEGACY_PIRQ_ENTRY PirqEntry[4];
    530   ///
    531   /// If nonzero, the slot number assigned by the board manufacturer.
    532   ///
    533   UINT8                 Slot;
    534   ///
    535   /// Reserved for future use.
    536   ///
    537   UINT8                 Reserved;
    538 } EFI_LEGACY_IRQ_ROUTING_ENTRY;
    539 
    540 #pragma pack()
    541 
    542 
    543 /**
    544   Finds the binary data or other platform information.
    545 
    546   @param  This                  The protocol instance pointer.
    547   @param  Mode                  Specifies what data to return. See See EFI_GET_PLATFORM_INFO_MODE enum.
    548   @param  Table                 Mode specific.  See EFI_GET_PLATFORM_INFO_MODE enum.
    549   @param  TableSize            	Mode specific.  See EFI_GET_PLATFORM_INFO_MODE enum.
    550   @param  Location             	Mode specific.  See EFI_GET_PLATFORM_INFO_MODE enum.
    551   @param  Alignment             Mode specific.  See EFI_GET_PLATFORM_INFO_MODE enum.
    552   @param  LegacySegment         Mode specific.  See EFI_GET_PLATFORM_INFO_MODE enum.
    553   @param  LegacyOffset          Mode specific.  See EFI_GET_PLATFORM_INFO_MODE enum.
    554 
    555   @retval EFI_SUCCESS           Data returned successfully.
    556   @retval EFI_UNSUPPORTED       Mode is not supported on the platform.
    557   @retval EFI_NOT_FOUND         Binary image or table not found.
    558 
    559 **/
    560 typedef
    561 EFI_STATUS
    562 (EFIAPI *EFI_LEGACY_BIOS_PLATFORM_GET_PLATFORM_INFO)(
    563   IN EFI_LEGACY_BIOS_PLATFORM_PROTOCOL   *This,
    564   IN EFI_GET_PLATFORM_INFO_MODE          Mode,
    565   OUT VOID                               **Table,
    566   OUT UINTN                              *TableSize,
    567   OUT UINTN                              *Location,
    568   OUT UINTN                              *Alignment,
    569   IN  UINT16                             LegacySegment,
    570   IN  UINT16                             LegacyOffset
    571   );
    572 
    573 /**
    574   Returns a buffer of handles for the requested subfunction.
    575 
    576   @param  This                  The protocol instance pointer.
    577   @param  Mode                  Specifies what handle to return. See EFI_GET_PLATFORM_HANDLE_MODE enum.
    578   @param  Type                  Mode specific. See EFI_GET_PLATFORM_HANDLE_MODE enum.
    579   @param  HandleBuffer          Mode specific. See EFI_GET_PLATFORM_HANDLE_MODE enum.
    580   @param  HandleCount           Mode specific. See EFI_GET_PLATFORM_HANDLE_MODE enum.
    581   @param  AdditionalData        Mode specific. See EFI_GET_PLATFORM_HANDLE_MODE enum.
    582 
    583   @retval EFI_SUCCESS           Handle is valid.
    584   @retval EFI_UNSUPPORTED       Mode is not supported on the platform.
    585   @retval EFI_NOT_FOUND         Handle is not known.
    586 
    587 **/
    588 typedef
    589 EFI_STATUS
    590 (EFIAPI *EFI_LEGACY_BIOS_PLATFORM_GET_PLATFORM_HANDLE)(
    591   IN EFI_LEGACY_BIOS_PLATFORM_PROTOCOL   *This,
    592   IN EFI_GET_PLATFORM_HANDLE_MODE        Mode,
    593   IN UINT16                              Type,
    594   OUT EFI_HANDLE                         **HandleBuffer,
    595   OUT UINTN                              *HandleCount,
    596   IN  VOID                               **AdditionalData OPTIONAL
    597   );
    598 
    599 /**
    600   Load and initialize the Legacy BIOS SMM handler.
    601 
    602   @param  This                   The protocol instance pointer.
    603   @param  EfiToLegacy16BootTable A pointer to Legacy16 boot table.
    604 
    605   @retval EFI_SUCCESS           SMM code loaded.
    606   @retval EFI_DEVICE_ERROR      SMM code failed to load
    607 
    608 **/
    609 typedef
    610 EFI_STATUS
    611 (EFIAPI *EFI_LEGACY_BIOS_PLATFORM_SMM_INIT)(
    612   IN EFI_LEGACY_BIOS_PLATFORM_PROTOCOL   *This,
    613   IN  VOID                               *EfiToLegacy16BootTable
    614   );
    615 
    616 /**
    617   Allows platform to perform any required action after a LegacyBios operation.
    618   Invokes the specific sub function specified by Mode.
    619 
    620   @param  This                  The protocol instance pointer.
    621   @param  Mode                  Specifies what handle to return. See EFI_GET_PLATFORM_HOOK_MODE enum.
    622   @param  Type                  Mode specific.  See EFI_GET_PLATFORM_HOOK_MODE enum.
    623   @param  DeviceHandle          Mode specific.  See EFI_GET_PLATFORM_HOOK_MODE enum.
    624   @param  ShadowAddress         Mode specific.  See EFI_GET_PLATFORM_HOOK_MODE enum.
    625   @param  Compatibility16Table  Mode specific.  See EFI_GET_PLATFORM_HOOK_MODE enum.
    626   @param  AdditionalData        Mode specific.  See EFI_GET_PLATFORM_HOOK_MODE enum.
    627 
    628   @retval EFI_SUCCESS           The operation performed successfully. Mode specific.
    629   @retval EFI_UNSUPPORTED       Mode is not supported on the platform.
    630 
    631 **/
    632 typedef
    633 EFI_STATUS
    634 (EFIAPI *EFI_LEGACY_BIOS_PLATFORM_HOOKS)(
    635   IN EFI_LEGACY_BIOS_PLATFORM_PROTOCOL   *This,
    636   IN EFI_GET_PLATFORM_HOOK_MODE          Mode,
    637   IN UINT16                              Type,
    638   IN  EFI_HANDLE                         DeviceHandle, OPTIONAL
    639   IN  OUT UINTN                          *ShadowAddress, OPTIONAL
    640   IN  EFI_COMPATIBILITY16_TABLE          *Compatibility16Table, OPTIONAL
    641   OUT  VOID                               **AdditionalData OPTIONAL
    642   );
    643 
    644 /**
    645   Returns information associated with PCI IRQ routing.
    646   This function returns the following information associated with PCI IRQ routing:
    647     * An IRQ routing table and number of entries in the table.
    648     * The $PIR table and its size.
    649     * A list of PCI IRQs and the priority order to assign them.
    650 
    651   @param  This                    The protocol instance pointer.
    652   @param  RoutingTable            The pointer to PCI IRQ Routing table.
    653                                   This location is the $PIR table minus the header.
    654   @param  RoutingTableEntries     The number of entries in table.
    655   @param  LocalPirqTable          $PIR table.
    656   @param  PirqTableSize           $PIR table size.
    657   @param  LocalIrqPriorityTable   A list of interrupts in priority order to assign.
    658   @param  IrqPriorityTableEntries The number of entries in the priority table.
    659 
    660   @retval EFI_SUCCESS           Data was successfully returned.
    661 
    662 **/
    663 typedef
    664 EFI_STATUS
    665 (EFIAPI *EFI_LEGACY_BIOS_PLATFORM_GET_ROUTING_TABLE)(
    666   IN EFI_LEGACY_BIOS_PLATFORM_PROTOCOL   *This,
    667   OUT VOID                               **RoutingTable,
    668   OUT UINTN                              *RoutingTableEntries,
    669   OUT VOID                               **LocalPirqTable, OPTIONAL
    670   OUT UINTN                              *PirqTableSize, OPTIONAL
    671   OUT VOID                               **LocalIrqPriorityTable, OPTIONAL
    672   OUT UINTN                              *IrqPriorityTableEntries OPTIONAL
    673   );
    674 
    675 /**
    676   Translates the given PIRQ accounting for bridge.
    677   This function translates the given PIRQ back through all buses, if required,
    678   and returns the true PIRQ and associated IRQ.
    679 
    680   @param  This                  The protocol instance pointer.
    681   @param  PciBus                The PCI bus number for this device.
    682   @param  PciDevice             The PCI device number for this device.
    683   @param  PciFunction           The PCI function number for this device.
    684   @param  Pirq                  Input is PIRQ reported by device, and output is true PIRQ.
    685   @param  PciIrq                The IRQ already assigned to the PIRQ, or the IRQ to be
    686                                 assigned to the PIRQ.
    687 
    688   @retval EFI_SUCCESS           The PIRQ was translated.
    689 
    690 **/
    691 typedef
    692 EFI_STATUS
    693 (EFIAPI *EFI_LEGACY_BIOS_PLATFORM_TRANSLATE_PIRQ)(
    694   IN EFI_LEGACY_BIOS_PLATFORM_PROTOCOL   *This,
    695   IN  UINTN                              PciBus,
    696   IN  UINTN                              PciDevice,
    697   IN  UINTN                              PciFunction,
    698   IN  OUT UINT8                          *Pirq,
    699   OUT UINT8                              *PciIrq
    700   );
    701 
    702 /**
    703   Attempt to legacy boot the BootOption. If the EFI contexted has been
    704   compromised this function will not return.
    705 
    706   @param  This                   The protocol instance pointer.
    707   @param  BbsDevicePath          The EFI Device Path from BootXXXX variable.
    708   @param  BbsTable               The Internal BBS table.
    709   @param  LoadOptionSize         The size of LoadOption in size.
    710   @param  LoadOption             The LoadOption from BootXXXX variable
    711   @param  EfiToLegacy16BootTable A pointer to BootTable structure
    712 
    713   @retval EFI_SUCCESS           Ready to boot.
    714 
    715 **/
    716 typedef
    717 EFI_STATUS
    718 (EFIAPI *EFI_LEGACY_BIOS_PLATFORM_PREPARE_TO_BOOT)(
    719   IN EFI_LEGACY_BIOS_PLATFORM_PROTOCOL   *This,
    720   IN  BBS_BBS_DEVICE_PATH                *BbsDevicePath,
    721   IN  VOID                               *BbsTable,
    722   IN  UINT32                             LoadOptionsSize,
    723   IN  VOID                               *LoadOptions,
    724   IN  VOID                               *EfiToLegacy16BootTable
    725   );
    726 
    727 /**
    728   This protocol abstracts the platform portion of the traditional BIOS.
    729 **/
    730 struct _EFI_LEGACY_BIOS_PLATFORM_PROTOCOL {
    731   ///
    732   ///  Gets binary data or other platform information.
    733   ///
    734   EFI_LEGACY_BIOS_PLATFORM_GET_PLATFORM_INFO    GetPlatformInfo;
    735   ///
    736   ///  Returns a buffer of all handles matching the requested subfunction.
    737   ///
    738   EFI_LEGACY_BIOS_PLATFORM_GET_PLATFORM_HANDLE  GetPlatformHandle;
    739   ///
    740   ///  Loads and initializes the traditional BIOS SMM handler.
    741   EFI_LEGACY_BIOS_PLATFORM_SMM_INIT             SmmInit;
    742   ///
    743   ///  Allows platform to perform any required actions after a LegacyBios operation.
    744   ///
    745   EFI_LEGACY_BIOS_PLATFORM_HOOKS                PlatformHooks;
    746   ///
    747   ///  Gets $PIR table.
    748   EFI_LEGACY_BIOS_PLATFORM_GET_ROUTING_TABLE    GetRoutingTable;
    749   ///
    750   ///  Translates the given PIRQ to the final value after traversing any PCI bridges.
    751   ///
    752   EFI_LEGACY_BIOS_PLATFORM_TRANSLATE_PIRQ       TranslatePirq;
    753   ///
    754   ///  Final platform function before the system attempts to boot to a traditional OS.
    755   ///
    756   EFI_LEGACY_BIOS_PLATFORM_PREPARE_TO_BOOT      PrepareToBoot;
    757 };
    758 
    759 extern EFI_GUID gEfiLegacyBiosPlatformProtocolGuid;
    760 
    761 #endif
    762