Home | History | Annotate | Download | only in LegacyBiosPlatform
      1 /*++
      2 
      3 Copyright (c) 1999 - 2006, Intel Corporation. All rights reserved.<BR>
      4 This program and the accompanying materials
      5 are licensed and made available under the terms and conditions of the BSD License
      6 which accompanies this distribution.  The full text of the license may be found at
      7 http://opensource.org/licenses/bsd-license.php
      8 
      9 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
     10 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
     11 
     12 
     13 Module Name:
     14 
     15   LegacyBiosPlatform.h
     16 
     17 Abstract:
     18 
     19   The EFI Legacy BIOS Patform Protocol is used to mate a Legacy16
     20   implementation with this EFI code. The EFI driver that produces
     21   the Legacy BIOS protocol is generic and consumes this protocol.
     22   A driver that matches the Legacy16 produces this protocol
     23 
     24 Revision History
     25 
     26   The EFI Legacy BIOS Platform Protocol is compliant with CSM spec 0.96.
     27 
     28 --*/
     29 
     30 #ifndef _EFI_LEGACY_BIOS_PLATFORM_H
     31 #define _EFI_LEGACY_BIOS_PLATFORM_H
     32 
     33 #define EFI_LEGACY_BIOS_PLATFORM_PROTOCOL_GUID \
     34   { \
     35     0x783658a3, 0x4172, 0x4421, {0xa2, 0x99, 0xe0, 0x9, 0x7, 0x9c, 0xc, 0xb4} \
     36   }
     37 
     38 EFI_FORWARD_DECLARATION (EFI_LEGACY_BIOS_PLATFORM_PROTOCOL);
     39 
     40 #include "Tiano.h"
     41 #include EFI_PROTOCOL_DEFINITION (LegacyBios)
     42 
     43 #pragma pack(1)
     44 //
     45 // Define structures for GetOemIntData
     46 //  Note:
     47 //    OemIntDataElenent is an array of structures from 0 to Count-1.
     48 //    RawData is an array of bytes from 0 to RamDataLength-1.
     49 //
     50 typedef struct {
     51   UINT16  Int;
     52   UINT16  Ax;
     53   UINT32  RawDataLength;
     54   UINT8   RawData[1];
     55 } EFI_OEM_INT_DATA_ELEMENT;
     56 
     57 typedef struct {
     58   UINT16                    Count;
     59   EFI_OEM_INT_DATA_ELEMENT  OemIntDataElement[1];
     60 } EFI_OEM_INT_DATA;
     61 #pragma pack()
     62 
     63 typedef enum {
     64   EfiGetPlatformBinaryMpTable        = 0,
     65   EfiGetPlatformBinaryOemIntData     = 1,
     66   EfiGetPlatformBinaryOem16Data      = 2,
     67   EfiGetPlatformBinaryOem32Data      = 3,
     68   EfiGetPlatformBinaryTpmBinary      = 4,
     69   EfiGetPlatformBinarySystemRom      = 5,
     70   EfiGetPlatformPciExpressBase       = 6,
     71   EfiGetPlatformPmmSize              = 7,
     72   EfiGetPlatformEndOfOpromShadowAddr = 8
     73 } EFI_GET_PLATFORM_INFO_MODE;
     74 
     75 typedef enum {
     76   EfiGetPlatformVgaHandle       = 0,
     77   EfiGetPlatformIdeHandle       = 1,
     78   EfiGetPlatformIsaBusHandle    = 2,
     79   EfiGetPlatformUsbHandle       = 3
     80 } EFI_GET_PLATFORM_HANDLE_MODE;
     81 
     82 typedef enum {
     83   EfiPlatformHookPrepareToScanRom = 0,
     84   EfiPlatformHookShadowServiceRoms= 1,
     85   EfiPlatformHookAfterRomInit     = 2
     86 } EFI_GET_PLATFORM_HOOK_MODE;
     87 
     88 typedef
     89 EFI_STATUS
     90 (EFIAPI *EFI_LEGACY_BIOS_PLATFORM_GET_PLATFORM_INFO) (
     91   IN EFI_LEGACY_BIOS_PLATFORM_PROTOCOL   * This,
     92   IN EFI_GET_PLATFORM_INFO_MODE          Mode,
     93   OUT VOID                               **Table,
     94   OUT UINTN                              *TableSize,
     95   OUT UINTN                              *Location,
     96   OUT UINTN                              *Alignment,
     97   IN  UINT16                             LegacySegment,
     98   IN  UINT16                             LegacyOffset
     99   )
    100 /*++
    101 
    102   Routine Description:
    103     Return a System ROM image for the platform
    104 
    105   Arguments:
    106     This                   - Protocol instance pointer.
    107     Mode                   - Specifies what data to return
    108     Table                  - Pointer to MP table.
    109     TableSize              - Size in bytes of table.
    110     Location               - Legacy region requested
    111                                0x00 = Any location
    112                                Bit 0 = 0xF0000 region
    113                                Bit 1 = 0xE0000 region
    114                                Multiple bits can be set
    115     Alignment              - Address alignment for allocation.
    116                              Bit mapped. First non-zero bit from right
    117                              is alignment.
    118 
    119     LegacySegment          - Segment in LegacyBios where Table is stored
    120     LegacyOffset           - Offset in LegacyBios where Table is stored
    121 
    122   Returns:
    123     EFI_SUCCESS     - Data was returned successfully.
    124     EFI_UNSUPPORTED - Mode is not supported on the platform.
    125     EFI_NOT_FOUND   - Binary image or table not found.
    126 
    127 --*/
    128 ;
    129 
    130 typedef
    131 EFI_STATUS
    132 (EFIAPI *EFI_LEGACY_BIOS_PLATFORM_GET_PLATFORM_HANDLE) (
    133   IN EFI_LEGACY_BIOS_PLATFORM_PROTOCOL   * This,
    134   IN EFI_GET_PLATFORM_HANDLE_MODE        Mode,
    135   IN UINT16                              Type,
    136   OUT EFI_HANDLE                         **HandleBuffer,
    137   OUT UINTN                              *HandleCount,
    138   IN  VOID                               **AdditionalData OPTIONAL
    139   )
    140 /*++
    141 
    142   Routine Description:
    143     Return the Legacy16 policy for which device should be the VGA controller
    144     used during a Legacy16 boot.
    145 
    146   Arguments:
    147     This             - Protocol instance pointer.
    148     Mode             - Specifies what handle to return.
    149     Type             - Type from Device Path for Handle to represent.
    150     HandleBuffer     - Handles of the device/controller in priority order
    151                        with HandleBuffer[0] highest priority.
    152     HandleCount      - Number of handles in the buffer.
    153     AdditionalData   - Mode specific.
    154 
    155 
    156   Returns:
    157     EFI_SUCCESS     - Handle is valid
    158     EFI_UNSUPPORTED - Mode is not supported on the platform.
    159     EFI_NOT_FOUND   - Handle is not known
    160 
    161 --*/
    162 ;
    163 
    164 typedef
    165 EFI_STATUS
    166 (EFIAPI *EFI_LEGACY_BIOS_PLATFORM_SMM_INIT) (
    167   IN EFI_LEGACY_BIOS_PLATFORM_PROTOCOL   * This,
    168   IN  VOID                               *EfiToLegacy16BootTable
    169   );
    170 
    171 /*++
    172 
    173   Routine Description:
    174     Load and initialize the Legacy BIOS SMM handler.
    175 
    176   Arguments:
    177     This                   - Protocol instance pointer.
    178     EfiToLegacy16BootTable - Pointer to Legacy16 boot table.
    179   Returns:
    180     EFI_SUCCESS      - SMM code loaded.
    181     EFI_DEVICE_ERROR - SMM code failed to load
    182 
    183 --*/
    184 ;
    185 
    186 typedef
    187 EFI_STATUS
    188 (EFIAPI *EFI_LEGACY_BIOS_PLATFORM_HOOKS) (
    189   IN EFI_LEGACY_BIOS_PLATFORM_PROTOCOL   * This,
    190   IN EFI_GET_PLATFORM_HOOK_MODE          Mode,
    191   IN UINT16                              Type,
    192   IN  EFI_HANDLE                         DeviceHandle,
    193   IN  OUT UINTN                          *ShadowAddress,
    194   IN  EFI_COMPATIBILITY16_TABLE          * Compatibility16Table,
    195   IN  VOID                               **AdditionalData OPTIONAL
    196   )
    197 /*++
    198 
    199   Routine Description:
    200     Prepare to scan a ROM.
    201 
    202   Arguments:
    203     This                   - Protocol instance pointer.
    204     Handle                 - Device handle
    205     ShadowAddress          - Address that ROM is shadowed at prior to
    206                              initialization or first free ROM address,
    207                              depending upon mode.
    208     Compatibility16Table   - Pointer to Compatibility16Table.
    209     AdditionalData   - Mode specific.
    210 
    211 
    212   Returns:
    213     EFI_SUCCESS     - RomImage is valid
    214     EFI_UNSUPPORTED - Mode is not supported on the platform or platform
    215                       policy is to not install this OPROM.
    216 --*/
    217 ;
    218 
    219 typedef
    220 EFI_STATUS
    221 (EFIAPI *EFI_LEGACY_BIOS_PLATFORM_GET_ROUTING_TABLE) (
    222   IN EFI_LEGACY_BIOS_PLATFORM_PROTOCOL   * This,
    223   OUT VOID                               **RoutingTable,
    224   OUT UINTN                              *RoutingTableEntries,
    225   OUT VOID                               **LocalPirqTable, OPTIONAL
    226   OUT UINTN                              *PirqTableSize, OPTIONAL
    227   OUT VOID                               **LocalIrqPriorityTable, OPTIONAL
    228   OUT UINTN                              *IrqPriorityTableEntries OPTIONAL
    229   )
    230 /*++
    231 
    232   Routine Description:
    233       1. List of IRQ routing entries and number of entries.
    234       2. Pointer to Entire $PIR table and length.
    235       3. List of IRQs to assign to PCI in priority.
    236 
    237   Arguments:
    238     This                - Protocol instance pointer.
    239     RoutingTable        - Pointer to PCI IRQ Routing table.
    240     RoutingTableEntries - Number of entries in table.
    241     LocalPirqTable         - $PIR table
    242     PirqTableSize          - $PIR table size
    243     LocalIrqPriorityTable  - List of interrupts in priority order to assign
    244     IrqPriorityTableEntries- Number of entries in priority table
    245 
    246   Returns:
    247     EFI_SUCCESS   - Table pointer returned
    248 
    249 --*/
    250 ;
    251 
    252 typedef
    253 EFI_STATUS
    254 (EFIAPI *EFI_LEGACY_BIOS_PLATFORM_TRANSLATE_PIRQ) (
    255   IN EFI_LEGACY_BIOS_PLATFORM_PROTOCOL   * This,
    256   IN  UINTN                              PciBus,
    257   IN  UINTN                              PciDevice,
    258   IN  UINTN                              PciFunction,
    259   IN  OUT UINT8                          *Pirq,
    260   OUT UINT8                              *PciIrq
    261   )
    262 /*++
    263 
    264   Routine Description:
    265     Translate the PIRQ reported by the PCI device into the true PIRQ
    266     from the internal IRQ routing information and IRQ assigned or to be
    267     assigned to device.
    268 
    269   Arguments:
    270     This        - Protocol instance pointer.
    271                   Base as defined below is the bus,device, function in
    272                   IRQ routing table.
    273     PciBus      - Base Bus for this device.
    274     PciDevice   - Base Device for this device.
    275     PciFunction - Base Function for this device.
    276     Pirq        - Input is PIRQ reported by device, output is true PIRQ.
    277     PciIrq      - The IRQ already assigned to the PIRQ or the IRQ to be
    278                   assigned to the PIRQ.
    279 
    280   Returns:
    281     EFI_SUCCESS  - Irq translated
    282 
    283 --*/
    284 ;
    285 
    286 typedef
    287 EFI_STATUS
    288 (EFIAPI *EFI_LEGACY_BIOS_PLATFORM_PREPARE_TO_BOOT) (
    289   IN EFI_LEGACY_BIOS_PLATFORM_PROTOCOL   * This,
    290   IN  BBS_BBS_DEVICE_PATH                * BbsDevicePath,
    291   IN  VOID                               *BbsTable,
    292   IN  UINT32                             LoadOptionsSize,
    293   IN  VOID                               *LoadOptions,
    294   IN  VOID                               *EfiToLegacy16BootTable
    295   )
    296 /*++
    297 
    298   Routine Description:
    299     Attempt to legacy boot the BootOption. If the EFI contexted has been
    300     compromised this function will not return.
    301 
    302   Arguments:
    303     This                      - Protocol instance pointer.
    304     BbsDevicePath             - EFI Device Path from BootXXXX variable.
    305     BbsTable                  - Internal BBS table.
    306     LoadOptionSize            - Size of LoadOption in size.
    307     LoadOption                - LoadOption from BootXXXX variable
    308     EfiToLegacy16BootTable    - Pointer to BootTable structure
    309 
    310   Returns:
    311     EFI_SUCCESS     - Removable media not present
    312 
    313 --*/
    314 ;
    315 
    316 struct _EFI_LEGACY_BIOS_PLATFORM_PROTOCOL {
    317   EFI_LEGACY_BIOS_PLATFORM_GET_PLATFORM_INFO    GetPlatformInfo;
    318   EFI_LEGACY_BIOS_PLATFORM_GET_PLATFORM_HANDLE  GetPlatformHandle;
    319   EFI_LEGACY_BIOS_PLATFORM_SMM_INIT             SmmInit;
    320   EFI_LEGACY_BIOS_PLATFORM_HOOKS                PlatformHooks;
    321   EFI_LEGACY_BIOS_PLATFORM_GET_ROUTING_TABLE    GetRoutingTable;
    322   EFI_LEGACY_BIOS_PLATFORM_TRANSLATE_PIRQ       TranslatePirq;
    323   EFI_LEGACY_BIOS_PLATFORM_PREPARE_TO_BOOT      PrepareToBoot;
    324 };
    325 
    326 extern EFI_GUID gEfiLegacyBiosPlatformProtocolGuid;
    327 
    328 #endif
    329