Home | History | Annotate | Download | only in LegacyBios
      1 /*++
      2 
      3 Copyright (c) 2004 - 2007, 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 Module Name:
     13 
     14   LegacyBios.h
     15 
     16 Abstract:
     17 
     18   The EFI Legacy BIOS Protocol is used to abstract legacy Option ROM usage
     19   under EFI and Legacy OS boot.
     20 
     21   Note: The names for EFI_IA32_REGISTER_SET elements were picked to follow
     22   well known naming conventions.
     23 
     24   Thunk - A thunk is a transition from one processor mode to another. A Thunk
     25           is a transition from native EFI mode to 16-bit mode. A reverse thunk
     26           would be a transition from 16-bit mode to native EFI mode.
     27 
     28 
     29   Note: Note: Note: Note: Note: Note: Note:
     30 
     31   You most likely should not use this protocol! Find the EFI way to solve the
     32   problem to make your code portable
     33 
     34   Note: Note: Note: Note: Note: Note: Note:
     35 
     36 Revision History
     37 
     38   The EFI Legacy BIOS Protocol is compliant with CSM spec 0.96.
     39 
     40 --*/
     41 
     42 #ifndef _EFI_LEGACY_BIOS_H
     43 #define _EFI_LEGACY_BIOS_H
     44 
     45 #define EFI_LEGACY_BIOS_PROTOCOL_GUID \
     46   { \
     47     0xdb9a1e3d, 0x45cb, 0x4abb, {0x85, 0x3b, 0xe5, 0x38, 0x7f, 0xdb, 0x2e, 0x2d} \
     48   }
     49 
     50 EFI_FORWARD_DECLARATION (EFI_LEGACY_BIOS_PROTOCOL);
     51 
     52 //
     53 // Convert from 32-bit address (_Adr) to Segment:Offset 16-bit form
     54 //
     55 #define EFI_SEGMENT(_Adr)     (UINT16) ((UINT16) (((UINTN) (_Adr)) >> 4) & 0xf000)
     56 #define EFI_OFFSET(_Adr)      (UINT16) (((UINT16) ((UINTN) (_Adr))) & 0xffff)
     57 #define BYTE_GRANULARITY      0x01
     58 #define WORD_GRANULARITY      0x02
     59 #define DWORD_GRANULARITY     0x04
     60 #define QWORD_GRANULARITY     0x08
     61 #define PARAGRAPH_GRANULARITY 0x10
     62 
     63 #define CARRY_FLAG            0x01
     64 
     65 typedef struct {
     66   UINT32 CF:1;
     67   UINT32 Reserved1:1;
     68   UINT32 PF:1;
     69   UINT32 Reserved2:1;
     70   UINT32 AF:1;
     71   UINT32 Reserved3:1;
     72   UINT32 ZF:1;
     73   UINT32 SF:1;
     74   UINT32 TF:1;
     75   UINT32 IF:1;
     76   UINT32 DF:1;
     77   UINT32 OF:1;
     78   UINT32 IOPL:2;
     79   UINT32 NT:1;
     80   UINT32 Reserved4:2;
     81   UINT32 VM:1;
     82   UINT32 Reserved5:14;
     83 } EFI_EFLAGS_REG;
     84 
     85 typedef struct {
     86   UINT16  CF : 1;
     87   UINT16  Reserved1 : 1;
     88   UINT16  PF : 1;
     89   UINT16  Reserved2 : 1;
     90   UINT16  AF : 1;
     91   UINT16  Reserved3 : 1;
     92   UINT16  ZF : 1;
     93   UINT16  SF : 1;
     94   UINT16  TF : 1;
     95   UINT16  IF : 1;
     96   UINT16  DF : 1;
     97   UINT16  OF : 1;
     98   UINT16  IOPL : 2;
     99   UINT16  NT : 1;
    100   UINT16  Reserved4 : 1;
    101 } EFI_FLAGS_REG;
    102 
    103 typedef struct {
    104   UINT32         EAX;
    105   UINT32         EBX;
    106   UINT32         ECX;
    107   UINT32         EDX;
    108   UINT32         ESI;
    109   UINT32         EDI;
    110   EFI_EFLAGS_REG EFlags;
    111   UINT16         ES;
    112   UINT16         CS;
    113   UINT16         SS;
    114   UINT16         DS;
    115   UINT16         FS;
    116   UINT16         GS;
    117   UINT32         EBP;
    118   UINT32         ESP;
    119 } EFI_DWORD_REGS;
    120 
    121 typedef struct {
    122   UINT16        AX;
    123   UINT16        ReservedAX;
    124   UINT16        BX;
    125   UINT16        ReservedBX;
    126   UINT16        CX;
    127   UINT16        ReservedCX;
    128   UINT16        DX;
    129   UINT16        ReservedDX;
    130   UINT16        SI;
    131   UINT16        ReservedSI;
    132   UINT16        DI;
    133   UINT16        ReservedDI;
    134   EFI_FLAGS_REG Flags;
    135   UINT16        ReservedFlags;
    136   UINT16        ES;
    137   UINT16        CS;
    138   UINT16        SS;
    139   UINT16        DS;
    140   UINT16        FS;
    141   UINT16        GS;
    142   UINT16        BP;
    143   UINT16        ReservedBP;
    144   UINT16        SP;
    145   UINT16        ReservedSP;
    146 } EFI_WORD_REGS;
    147 
    148 typedef struct {
    149   UINT8   AL;
    150   UINT8   AH;
    151   UINT16  ReservedAX;
    152   UINT8   BL;
    153   UINT8   BH;
    154   UINT16  ReservedBX;
    155   UINT8   CL;
    156   UINT8   CH;
    157   UINT16  ReservedCX;
    158   UINT8   DL;
    159   UINT8   DH;
    160   UINT16  ReservedDX;
    161 } EFI_BYTE_REGS;
    162 
    163 typedef union {
    164   EFI_DWORD_REGS E;
    165   EFI_WORD_REGS  X;
    166   EFI_BYTE_REGS  H;
    167 } EFI_IA32_REGISTER_SET;
    168 
    169 #pragma pack(1)
    170 //
    171 // $EFI table created by Legacy16 code and consumed by EFI Legacy driver
    172 //
    173 typedef struct {
    174   UINT32  Signature;      // "$EFI"
    175   UINT8   TableChecksum;
    176   UINT8   TableLength;
    177   UINT8   EfiMajorRevision;
    178   UINT8   EfiMinorRevision;
    179   UINT8   TableMajorRevision;
    180   UINT8   TableMinorRevision;
    181   UINT16  Reserved;
    182   UINT16  Compatibility16CallSegment;
    183   UINT16  Compatibility16CallOffset;
    184 
    185   UINT16  PnPInstallationCheckSegment;
    186   UINT16  PnPInstallationCheckOffset;
    187 
    188   UINT32  EfiSystemTable; // IPF - CSM Integration
    189   UINT32  OemIdStringPointer;
    190   UINT32  AcpiRsdPtrPointer;
    191   UINT16  OemRevision;
    192   UINT32  E820Pointer;
    193   UINT32  E820Length;
    194   UINT32  IrqRoutingTablePointer;
    195   UINT32  IrqRoutingTableLength;
    196   UINT32  MpTablePtr;
    197   UINT32  MpTableLength;
    198   UINT16  OemIntSegment;
    199   UINT16  OemIntOffset;
    200   UINT16  Oem32Segment;
    201   UINT16  Oem32Offset;
    202   UINT16  Oem16Segment;
    203   UINT16  Oem16Offset;
    204   UINT16  TpmSegment;
    205   UINT16  TpmOffset;
    206   UINT32  IbvPointer;
    207   UINT32  PciExpressBase;
    208   UINT8   LastPciBus;
    209 
    210 } EFI_COMPATIBILITY16_TABLE;
    211 
    212 typedef enum {
    213   Compatibility16InitializeYourself     = 0x0000,
    214   Compatibility16UpdateBbs              = 0x0001,
    215   Compatibility16PrepareToBoot          = 0x0002,
    216   Compatibility16Boot                   = 0x0003,
    217   Compatibility16RetrieveLastBootDevice = 0x0004,
    218   Compatibility16DispatchOprom          = 0x0005,
    219   Compatibility16GetTableAddress        = 0x0006,
    220   Compatibility16SetKeyboardLeds        = 0x0007,
    221   Compatibility16InstallPciHandler      = 0x0008
    222 } EFI_COMPATIBILITY_FUNCTIONS;
    223 
    224 //
    225 // define maximum number of HDD system supports
    226 //
    227 #define MAX_HDD_ENTRIES 0x30
    228 
    229 typedef struct {
    230   UINT16  Raw[256];
    231 } ATAPI_IDENTIFY;
    232 
    233 //
    234 // HDD_INFO status
    235 //
    236 #define HDD_PRIMARY               0x01
    237 #define HDD_SECONDARY             0x02
    238 #define HDD_MASTER_ATAPI_CDROM    0x04
    239 #define HDD_SLAVE_ATAPI_CDROM     0x08
    240 #define HDD_MASTER_IDE            0x20
    241 #define HDD_SLAVE_IDE             0x40
    242 #define HDD_MASTER_ATAPI_ZIPDISK  0x10
    243 #define HDD_SLAVE_ATAPI_ZIPDISK   0x80
    244 
    245 typedef struct {
    246   UINT16          Status;
    247   UINT32          Bus;
    248   UINT32          Device;
    249   UINT32          Function;
    250   UINT16          CommandBaseAddress;
    251   UINT16          ControlBaseAddress;
    252   UINT16          BusMasterAddress;
    253   UINT8           HddIrq;
    254   ATAPI_IDENTIFY  IdentifyDrive[2];
    255 } HDD_INFO;
    256 
    257 //
    258 // Parties data structures
    259 //
    260 typedef struct {
    261   UINT8 DirectoryServiceValidity : 1;
    262   UINT8 RabcaUsedFlag : 1;
    263   UINT8 ExecuteHddDiagnosticsFlag : 1;
    264   UINT8 Reserved : 5;
    265 } UDC_ATTRIBUTES;
    266 
    267 typedef struct {
    268   UDC_ATTRIBUTES  Attributes;
    269   UINT8           DeviceNumber;
    270   UINT8           BbsTableEntryNumberForParentDevice;
    271   UINT8           BbsTableEntryNumberForBoot;
    272   UINT8           BbsTableEntryNumberForHddDiag;
    273   UINT8           BeerData[128];
    274   UINT8           ServiceAreaData[64];
    275 } UD_TABLE;
    276 
    277 //
    278 // define BBS Device Types
    279 //
    280 #define BBS_FLOPPY        0x01
    281 #define BBS_HARDDISK      0x02
    282 #define BBS_CDROM         0x03
    283 #define BBS_PCMCIA        0x04
    284 #define BBS_USB           0x05
    285 #define BBS_EMBED_NETWORK 0x06
    286 #define BBS_BEV_DEVICE    0x80
    287 #define BBS_UNKNOWN       0xff
    288 
    289 typedef struct {
    290   UINT16  OldPosition : 4;
    291   UINT16  Reserved1 : 4;
    292   UINT16  Enabled : 1;
    293   UINT16  Failed : 1;
    294   UINT16  MediaPresent : 2;
    295   UINT16  Reserved2 : 4;
    296 } BBS_STATUS_FLAGS;
    297 
    298 #define MAX_BBS_ENTRIES 0x100
    299 //
    300 // BBS_IGNORE_ENTRY is placed in the BootPriority field if the entry is to
    301 // be skipped.
    302 // BBS_UNPRIORITIZED_ENTRY is placed in the BootPriority field before
    303 // priority has been assigned but indicates valid entry.
    304 // BBS_LOWEST_PRIORITY is normally used for removable media with no media
    305 //   inserted. This allows the 16-bit CSM to allocate a drive letter to
    306 //   the device.
    307 // BBS_DO_NOT_BOOT_FROM is used for devices that the 16-bit CSM is to assign
    308 //   a drive letter to but never boot from.
    309 //
    310 // AdditionalIrq??Handler usage is IBV specific. The fields have been added
    311 // for:
    312 //   1. Saving non-BBS card info about IRQs taken by card.
    313 //   2. For BBS compliant cards that hook IRQs in order to have their SETUP
    314 //      executed.
    315 //
    316 #define BBS_DO_NOT_BOOT_FROM    0xFFFC
    317 #define BBS_LOWEST_PRIORITY     0xFFFD
    318 #define BBS_UNPRIORITIZED_ENTRY 0xFFFE
    319 #define BBS_IGNORE_ENTRY        0xFFFF
    320 
    321 typedef struct {
    322   UINT16            BootPriority;
    323   UINT32            Bus;
    324   UINT32            Device;
    325   UINT32            Function;
    326   UINT8             Class;
    327   UINT8             SubClass;
    328   UINT16            MfgStringOffset;
    329   UINT16            MfgStringSegment;
    330   UINT16            DeviceType;
    331   BBS_STATUS_FLAGS  StatusFlags;
    332   UINT16            BootHandlerOffset;
    333   UINT16            BootHandlerSegment;
    334   UINT16            DescStringOffset;
    335   UINT16            DescStringSegment;
    336   UINT32            InitPerReserved;
    337   UINT32            AdditionalIrq13Handler;
    338   UINT32            AdditionalIrq18Handler;
    339   UINT32            AdditionalIrq19Handler;
    340   UINT32            AdditionalIrq40Handler;
    341   UINT8             AssignedDriveNumber;
    342   UINT32            AdditionalIrq41Handler;
    343   UINT32            AdditionalIrq46Handler;
    344   UINT32            IBV1;
    345   UINT32            IBV2;
    346 } BBS_TABLE;
    347 
    348 #pragma pack()
    349 
    350 typedef
    351 BOOLEAN
    352 (EFIAPI *EFI_LEGACY_BIOS_INT86) (
    353   IN EFI_LEGACY_BIOS_PROTOCOL         * This,
    354   IN  UINT8                           BiosInt,
    355   IN OUT  EFI_IA32_REGISTER_SET       * Regs
    356   )
    357 /*++
    358 
    359   Routine Description:
    360     Thunk to 16-bit real mode and execute a software interrupt with a vector
    361     of BiosInt. Regs will contain the 16-bit register context on entry and
    362     exit.
    363 
    364   Arguments:
    365     This    - Protocol instance pointer.
    366     BiosInt - Processor interrupt vector to invoke
    367     Reg     - Register contexted passed into (and returned) from thunk to
    368               16-bit mode
    369 
    370   Returns:
    371     FALSE   - Thunk completed, and there were no BIOS errors in the target code.
    372               See Regs for status.
    373     TRUE    - There was a BIOS erro in the target code.
    374 
    375 --*/
    376 ;
    377 
    378 typedef
    379 BOOLEAN
    380 (EFIAPI *EFI_LEGACY_BIOS_FARCALL86) (
    381   IN EFI_LEGACY_BIOS_PROTOCOL         * This,
    382   IN  UINT16                          Segment,
    383   IN  UINT16                          Offset,
    384   IN  EFI_IA32_REGISTER_SET           * Regs,
    385   IN  VOID                            *Stack,
    386   IN  UINTN                           StackSize
    387   )
    388 /*++
    389 
    390   Routine Description:
    391     Thunk to 16-bit real mode and call Segment:Offset. Regs will contain the
    392     16-bit register context on entry and exit. Arguments can be passed on
    393     the Stack argument
    394 
    395   Arguments:
    396     This      - Protocol instance pointer.
    397     Segment   - Segemnt of 16-bit mode call
    398     Offset    - Offset of 16-bit mdoe call
    399     Reg       - Register contexted passed into (and returned) from thunk to
    400                 16-bit mode
    401     Stack     - Caller allocated stack used to pass arguments
    402     StackSize - Size of Stack in bytes
    403 
    404   Returns:
    405     FALSE     - Thunk completed, and there were no BIOS errors in the target code.
    406                 See Regs for status.
    407     TRUE      - There was a BIOS erro in the target code.
    408 
    409 --*/
    410 ;
    411 
    412 typedef
    413 EFI_STATUS
    414 (EFIAPI *EFI_LEGACY_BIOS_CHECK_ROM) (
    415   IN EFI_LEGACY_BIOS_PROTOCOL         * This,
    416   IN  EFI_HANDLE                      PciHandle,
    417   OUT VOID                            **RomImage, OPTIONAL
    418   OUT UINTN                           *RomSize, OPTIONAL
    419   OUT UINTN                           *Flags
    420 
    421   )
    422 /*++
    423 
    424   Routine Description:
    425     Test to see if a legacy PCI ROM exists for this device. Optionally return
    426     the Legacy ROM instance for this PCI device.
    427 
    428   Arguments:
    429     This      - Protocol instance pointer.
    430     PciHandle - The PCI PC-AT OPROM from this devices ROM BAR will be loaded
    431     RomImage  - Return the legacy PCI ROM for this device
    432     RomSize   - Size of ROM Image
    433     Flags     - Indicates if ROM found and if PC-AT.
    434 
    435   Returns:
    436     EFI_SUCCESS  - Legacy Option ROM available for this device
    437     EFI_UNSUPPORTED  - Legacy Option ROM not supported.
    438 
    439 --*/
    440 ;
    441 
    442 typedef
    443 EFI_STATUS
    444 (EFIAPI *EFI_LEGACY_BIOS_INSTALL_ROM) (
    445   IN EFI_LEGACY_BIOS_PROTOCOL         * This,
    446   IN  EFI_HANDLE                      PciHandle,
    447   IN  VOID                            **RomImage,
    448   OUT UINTN                           *Flags,
    449   OUT UINT8                           *DiskStart, OPTIONAL
    450   OUT UINT8                           *DiskEnd, OPTIONAL
    451   OUT VOID                            **RomShadowAddress, OPTIONAL
    452   OUT UINT32                          *ShadowedRomSize OPTIONAL
    453   )
    454 /*++
    455 
    456   Routine Description:
    457     Load a legacy PC-AT OPROM on the PciHandle device. Return information
    458     about how many disks were added by the OPROM and the shadow address and
    459     size. DiskStart & DiskEnd are INT 13h drive letters. Thus 0x80 is C:
    460 
    461   Arguments:
    462     This      - Protocol instance pointer.
    463     PciHandle - The PCI PC-AT OPROM from this devices ROM BAR will be loaded.
    464                 This value is NULL if RomImage is non-NULL. This is the normal
    465                 case.
    466     RomImage  - A PCI PC-AT ROM image. This argument is non-NULL if there is
    467                 no hardware associated with the ROM and thus no PciHandle,
    468                 otherwise is must be NULL.
    469                 Example is PXE base code.
    470     Flags     - Return Status if ROM was found and if was Legacy OPROM.
    471     DiskStart - Disk number of first device hooked by the ROM. If DiskStart
    472                 is the same as DiskEnd no disked were hooked.
    473     DiskEnd   - Disk number of the last device hooked by the ROM.
    474     RomShadowAddress  - Shadow address of PC-AT ROM
    475     RomShadowSize     - Size of RomShadowAddress in bytes
    476 
    477   Returns:
    478     EFI_SUCCESS  - Thunk completed, see Regs for status.
    479     EFI_INVALID_PARAMETER  - PciHandle not found
    480 
    481 --*/
    482 ;
    483 
    484 typedef
    485 EFI_STATUS
    486 (EFIAPI *EFI_LEGACY_BIOS_BOOT) (
    487   IN EFI_LEGACY_BIOS_PROTOCOL         * This,
    488   IN  BBS_BBS_DEVICE_PATH             * BootOption,
    489   IN  UINT32                          LoadOptionsSize,
    490   IN  VOID                            *LoadOptions
    491   )
    492 /*++
    493 
    494   Routine Description:
    495     Attempt to legacy boot the BootOption. If the EFI contexted has been
    496     compromised this function will not return.
    497 
    498   Arguments:
    499     This       - Protocol instance pointer.
    500     BootOption - EFI Device Path from BootXXXX variable.
    501     LoadOptionSize  - Size of LoadOption in size.
    502     LoadOption      - LoadOption from BootXXXX variable
    503 
    504   Returns:
    505     EFI_SUCCESS  - Removable media not present
    506 
    507 --*/
    508 ;
    509 typedef
    510 EFI_STATUS
    511 (EFIAPI *EFI_LEGACY_BIOS_UPDATE_KEYBOARD_LED_STATUS) (
    512   IN EFI_LEGACY_BIOS_PROTOCOL         * This,
    513   IN  UINT8                           Leds
    514   )
    515 /*++
    516 
    517   Routine Description:
    518     Update BDA with current Scroll, Num & Cap lock LEDS
    519 
    520   Arguments:
    521     This       - Protocol instance pointer.
    522     Leds       - Status of current Scroll, Num & Cap lock LEDS
    523                  Bit 0 is Scroll Lock  0 = Not locked
    524                  Bit 1 is Num Lock
    525                  Bit 2 is Caps Lock
    526 
    527   Returns:
    528     EFI_SUCCESS  - Removable media not present
    529 
    530 --*/
    531 ;
    532 
    533 typedef
    534 EFI_STATUS
    535 (EFIAPI *EFI_LEGACY_BIOS_GET_BBS_INFO) (
    536   IN EFI_LEGACY_BIOS_PROTOCOL         * This,
    537   OUT UINT16                          *HddCount,
    538   OUT HDD_INFO                        **HddInfo,
    539   OUT UINT16                          *BbsCount,
    540   IN OUT BBS_TABLE                    **BbsTable
    541   )
    542 /*++
    543 
    544   Routine Description:
    545     Retrieve legacy BBS info and assign boot priority.
    546 
    547   Arguments:
    548     This       - Protocol instance pointer.
    549     HddCount   - Number of HDD_INFO structures
    550     HddInfo    - Onboard IDE controller information
    551     BbsCount   - Number of BBS_TABLE structures
    552     BbsTable   - List BBS entries
    553 
    554   Returns:
    555     EFI_SUCCESS  - Tables returned
    556 
    557 --*/
    558 ;
    559 
    560 typedef
    561 EFI_STATUS
    562 (EFIAPI *EFI_LEGACY_BIOS_PREPARE_TO_BOOT_EFI) (
    563   IN EFI_LEGACY_BIOS_PROTOCOL         * This,
    564   OUT UINT16                          *BbsCount,
    565   OUT BBS_TABLE                       **BbsTable
    566   )
    567 /*++
    568 
    569   Routine Description:
    570     Assign drive number to legacy HDD drives prior to booting an EFI
    571     aware OS so the OS can access drives without an EFI driver.
    572 
    573   Arguments:
    574     This       - Protocol instance pointer.
    575     BbsCount   - Number of BBS_TABLE structures
    576     BbsTable   - List BBS entries
    577 
    578   Returns:
    579     EFI_SUCCESS  - Drive numbers assigned
    580 
    581 --*/
    582 ;
    583 
    584 typedef
    585 EFI_STATUS
    586 (EFIAPI *EFI_LEGACY_BIOS_BOOT_UNCONVENTIONAL_DEVICE) (
    587   IN EFI_LEGACY_BIOS_PROTOCOL         * This,
    588   IN UDC_ATTRIBUTES                   Attributes,
    589   IN UINTN                            BbsEntry,
    590   IN VOID                             *BeerData,
    591   IN VOID                             *ServiceAreaData
    592   )
    593 /*++
    594 
    595   Routine Description:
    596     To boot from an unconventional device like parties and/or execute
    597     HDD diagnostics.
    598 
    599   Arguments:
    600     This            - Protocol instance pointer.
    601     Attributes      - How to interpret the other input parameters
    602     BbsEntry        - The 0-based index into the BbsTable for the parent
    603                       device.
    604     BeerData        - Pointer to the 128 bytes of ram BEER data.
    605     ServiceAreaData - Pointer to the 64 bytes of raw Service Area data. The
    606                       caller must provide a pointer to the specific Service
    607                       Area and not the start all Service Areas.
    608   Returns:
    609     EFI_INVALID_PARAMETER if error. Does NOT return if no error.
    610 
    611 --*/
    612 ;
    613 
    614 typedef
    615 EFI_STATUS
    616 (EFIAPI *EFI_LEGACY_BIOS_SHADOW_ALL_LEGACY_OPROMS) (
    617   IN EFI_LEGACY_BIOS_PROTOCOL * This
    618   )
    619 /*++
    620 
    621   Routine Description:
    622     Shadow all legacy16 OPROMs that haven't been shadowed.
    623     Warning: Use this with caution. This routine disconnects all EFI
    624              drivers. If used externally then caller must re-connect EFI
    625              drivers.
    626   Arguments:
    627 
    628   Returns:
    629     EFI_SUCCESS  - OPROMs shadowed
    630 
    631 --*/
    632 ;
    633 
    634 typedef
    635 EFI_STATUS
    636 (EFIAPI *EFI_LEGACY_BIOS_GET_LEGACY_REGION) (
    637   IN EFI_LEGACY_BIOS_PROTOCOL * This,
    638   IN    UINTN                 LegacyMemorySize,
    639   IN    UINTN                 Region,
    640   IN    UINTN                 Alignment,
    641   OUT   VOID                  **LegacyMemoryAddress
    642   )
    643 /*++
    644 
    645 Routine Description:
    646   Get a region from the LegacyBios for S3 usage.
    647 
    648 Arguments:
    649     This                   - Protocol instance pointer.
    650     LegacyMemorySize     - Size of required region
    651     Region                 - Region to use.
    652                                  00 = Either 0xE0000 or 0xF0000 block
    653                                  Bit0 = 1 0xF0000 block
    654                                  Bit1 = 1 0xE0000 block
    655     Alignment             - Address alignment. Bit mapped. First non-zero
    656                             bit from right is alignment.
    657     LegacyMemoryAddress  - Region Assigned
    658 
    659 Returns:
    660 
    661   EFI_SUCCESS - Region assigned
    662 
    663   Other       - Region not assigned
    664 
    665 --*/
    666 ;
    667 
    668 typedef
    669 EFI_STATUS
    670 (EFIAPI *EFI_LEGACY_BIOS_COPY_LEGACY_REGION) (
    671   IN EFI_LEGACY_BIOS_PROTOCOL * This,
    672   IN    UINTN                 LegacyMemorySize,
    673   IN    VOID                  *LegacyMemoryAddress,
    674   IN    VOID                  *LegacyMemorySourceAddress
    675   )
    676 /*++
    677 
    678 Routine Description:
    679   Get a region from the LegacyBios for Tiano usage. Can only be invoked once.
    680 
    681 Arguments:
    682     This                         - Protocol instance pointer.
    683     LegacyMemorySize             - Size of data to copy
    684     LegacyMemoryAddress          - Legacy Region destination address
    685                                    Note: must be in region assigned by
    686                                          LegacyBiosGetLegacyRegion
    687     LegacyMemorySourceAddress    - Source of data
    688 
    689 Returns:
    690 
    691   EFI_SUCCESS        - Region assigned
    692   EFI_ACCESS_DENIED  - Destination outside assigned region
    693 
    694 --*/
    695 ;
    696 
    697 struct _EFI_LEGACY_BIOS_PROTOCOL {
    698   EFI_LEGACY_BIOS_INT86                       Int86;
    699   EFI_LEGACY_BIOS_FARCALL86                   FarCall86;
    700   EFI_LEGACY_BIOS_CHECK_ROM                   CheckPciRom;
    701   EFI_LEGACY_BIOS_INSTALL_ROM                 InstallPciRom;
    702   EFI_LEGACY_BIOS_BOOT                        LegacyBoot;
    703   EFI_LEGACY_BIOS_UPDATE_KEYBOARD_LED_STATUS  UpdateKeyboardLedStatus;
    704   EFI_LEGACY_BIOS_GET_BBS_INFO                GetBbsInfo;
    705   EFI_LEGACY_BIOS_SHADOW_ALL_LEGACY_OPROMS    ShadowAllLegacyOproms;
    706   EFI_LEGACY_BIOS_PREPARE_TO_BOOT_EFI         PrepareToBootEfi;
    707   EFI_LEGACY_BIOS_GET_LEGACY_REGION           GetLegacyRegion;
    708   EFI_LEGACY_BIOS_COPY_LEGACY_REGION          CopyLegacyRegion;
    709   EFI_LEGACY_BIOS_BOOT_UNCONVENTIONAL_DEVICE  BootUnconventionalDevice;
    710 };
    711 
    712 extern EFI_GUID gEfiLegacyBiosProtocolGuid;
    713 
    714 #endif
    715