legacybios.h

来自「EFI BIOS是Intel提出的下一代的BIOS标准。这里上传的Edk源代码是」· C头文件 代码 · 共 702 行 · 第 1/2 页

H
702
字号
    This    - Protocol instance pointer.
    BiosInt - Processor interrupt vector to invoke
    Reg     - Register contexted passed into (and returned) from thunk to 
              16-bit mode

  Returns:
    FALSE   - Thunk completed, and there were no BIOS errors in the target code.
              See Regs for status.
    TRUE    - There was a BIOS erro in the target code.

--*/
;

typedef
BOOLEAN
(EFIAPI *EFI_LEGACY_BIOS_FARCALL86) (
  IN EFI_LEGACY_BIOS_PROTOCOL         * This,
  IN  UINT16                          Segment,
  IN  UINT16                          Offset,
  IN  EFI_IA32_REGISTER_SET           * Regs,
  IN  VOID                            *Stack,
  IN  UINTN                           StackSize
  )
/*++

  Routine Description:
    Thunk to 16-bit real mode and call Segment:Offset. Regs will contain the 
    16-bit register context on entry and exit. Arguments can be passed on 
    the Stack argument

  Arguments:
    This      - Protocol instance pointer.
    Segment   - Segemnt of 16-bit mode call
    Offset    - Offset of 16-bit mdoe call
    Reg       - Register contexted passed into (and returned) from thunk to 
                16-bit mode
    Stack     - Caller allocated stack used to pass arguments
    StackSize - Size of Stack in bytes

  Returns:
    FALSE     - Thunk completed, and there were no BIOS errors in the target code.
                See Regs for status.
    TRUE      - There was a BIOS erro in the target code.

--*/
;

typedef
EFI_STATUS
(EFIAPI *EFI_LEGACY_BIOS_CHECK_ROM) (
  IN EFI_LEGACY_BIOS_PROTOCOL         * This,
  IN  EFI_HANDLE                      PciHandle,
  OUT VOID                            **RomImage, OPTIONAL
  OUT UINTN                           *RomSize, OPTIONAL
  OUT UINTN                           *Flags

  )
/*++

  Routine Description:
    Test to see if a legacy PCI ROM exists for this device. Optionally return
    the Legacy ROM instance for this PCI device.

  Arguments:
    This      - Protocol instance pointer.
    PciHandle - The PCI PC-AT OPROM from this devices ROM BAR will be loaded
    RomImage  - Return the legacy PCI ROM for this device
    RomSize   - Size of ROM Image
    Flags     - Indicates if ROM found and if PC-AT.

  Returns:
    EFI_SUCCESS  - Legacy Option ROM availible for this device
    EFI_UNSUPPORTED  - Legacy Option ROM not supported.

--*/
;

typedef
EFI_STATUS
(EFIAPI *EFI_LEGACY_BIOS_INSTALL_ROM) (
  IN EFI_LEGACY_BIOS_PROTOCOL         * This,
  IN  EFI_HANDLE                      PciHandle,
  IN  VOID                            **RomImage,
  OUT UINTN                           *Flags,
  OUT UINT8                           *DiskStart, OPTIONAL
  OUT UINT8                           *DiskEnd, OPTIONAL
  OUT VOID                            **RomShadowAddress, OPTIONAL
  OUT UINT32                          *ShadowedRomSize OPTIONAL
  )
/*++

  Routine Description:
    Load a legacy PC-AT OPROM on the PciHandle device. Return information
    about how many disks were added by the OPROM and the shadow address and
    size. DiskStart & DiskEnd are INT 13h drive letters. Thus 0x80 is C:

  Arguments:
    This      - Protocol instance pointer.
    PciHandle - The PCI PC-AT OPROM from this devices ROM BAR will be loaded.
                This value is NULL if RomImage is non-NULL. This is the normal
                case.
    RomImage  - A PCI PC-AT ROM image. This argument is non-NULL if there is
                no hardware associated with the ROM and thus no PciHandle,
                otherwise is must be NULL.
                Example is PXE base code.
    Flags     - Return Status if ROM was found and if was Legacy OPROM.
    DiskStart - Disk number of first device hooked by the ROM. If DiskStart
                is the same as DiskEnd no disked were hooked.
    DiskEnd   - Disk number of the last device hooked by the ROM.
    RomShadowAddress  - Shadow address of PC-AT ROM
    RomShadowSize     - Size of RomShadowAddress in bytes

  Returns:
    EFI_SUCCESS  - Thunk completed, see Regs for status.
    EFI_INVALID_PARAMETER  - PciHandle not found

--*/
;

typedef
EFI_STATUS
(EFIAPI *EFI_LEGACY_BIOS_BOOT) (
  IN EFI_LEGACY_BIOS_PROTOCOL         * This,
  IN  BBS_BBS_DEVICE_PATH             * BootOption,
  IN  UINT32                          LoadOptionsSize,
  IN  VOID                            *LoadOptions
  )
/*++

  Routine Description:
    Attempt to legacy boot the BootOption. If the EFI contexted has been 
    compromised this function will not return.

  Arguments:
    This       - Protocol instance pointer.
    BootOption - EFI Device Path from BootXXXX variable.
    LoadOptionSize  - Size of LoadOption in size.
    LoadOption      - LoadOption from BootXXXX variable

  Returns:
    EFI_SUCCESS  - Removable media not present

--*/
;
typedef
EFI_STATUS
(EFIAPI *EFI_LEGACY_BIOS_UPDATE_KEYBOARD_LED_STATUS) (
  IN EFI_LEGACY_BIOS_PROTOCOL         * This,
  IN  UINT8                           Leds
  )
/*++

  Routine Description:
    Update BDA with current Scroll, Num & Cap lock LEDS

  Arguments:
    This       - Protocol instance pointer.
    Leds       - Status of current Scroll, Num & Cap lock LEDS
                 Bit 0 is Scroll Lock  0 = Not locked
                 Bit 1 is Num Lock
                 Bit 2 is Caps Lock

  Returns:
    EFI_SUCCESS  - Removable media not present

--*/
;

typedef
EFI_STATUS
(EFIAPI *EFI_LEGACY_BIOS_GET_BBS_INFO) (
  IN EFI_LEGACY_BIOS_PROTOCOL         * This,
  OUT UINT16                          *HddCount,
  OUT HDD_INFO                        **HddInfo,
  OUT UINT16                          *BbsCount,
  IN OUT BBS_TABLE                    **BbsTable
  )
/*++

  Routine Description:
    Retrieve legacy BBS info and assign boot priority.

  Arguments:
    This       - Protocol instance pointer.
    HddCount   - Number of HDD_INFO structures
    HddInfo    - Onboard IDE controller information
    BbsCount   - Number of BBS_TABLE structures
    BbsTable   - List BBS entries

  Returns:
    EFI_SUCCESS  - Tables returned

--*/
;

typedef
EFI_STATUS
(EFIAPI *EFI_LEGACY_BIOS_PREPARE_TO_BOOT_EFI) (
  IN EFI_LEGACY_BIOS_PROTOCOL         * This,
  OUT UINT16                          *BbsCount,
  OUT BBS_TABLE                       **BbsTable
  )
/*++

  Routine Description:
    Assign drive number to legacy HDD drives prior to booting an EFI
    aware OS so the OS can access drives without an EFI driver.

  Arguments:
    This       - Protocol instance pointer.
    BbsCount   - Number of BBS_TABLE structures
    BbsTable   - List BBS entries

  Returns:
    EFI_SUCCESS  - Drive numbers assigned

--*/
;

typedef
EFI_STATUS
(EFIAPI *EFI_LEGACY_BIOS_BOOT_UNCONVENTIONAL_DEVICE) (
  IN EFI_LEGACY_BIOS_PROTOCOL         * This,
  IN UDC_ATTRIBUTES                   Attributes,
  IN UINTN                            BbsEntry,
  IN VOID                             *BeerData,
  IN VOID                             *ServiceAreaData
  )
/*++

  Routine Description:
    To boot from an unconventional device like parties and/or execute
    HDD diagnostics.

  Arguments:
    This            - Protocol instance pointer.
    Attributes      - How to interpret the other input parameters
    BbsEntry        - The 0-based index into the BbsTable for the parent 
                      device.
    BeerData        - Pointer to the 128 bytes of ram BEER data.
    ServiceAreaData - Pointer to the 64 bytes of raw Service Area data. The
                      caller must provide a pointer to the specific Service
                      Area and not the start all Service Areas. 
  Returns:
    EFI_INVALID_PARAMETER if error. Does NOT return if no error.

--*/
;

typedef
EFI_STATUS
(EFIAPI *EFI_LEGACY_BIOS_SHADOW_ALL_LEGACY_OPROMS) (
  IN EFI_LEGACY_BIOS_PROTOCOL * This
  )
/*++

  Routine Description:
    Shadow all legacy16 OPROMs that haven't been shadowed.
    Warning: Use this with caution. This routine disconnects all EFI
             drivers. If used externally then caller must re-connect EFI
             drivers.
  Arguments:

  Returns:
    EFI_SUCCESS  - OPROMs shadowed

--*/
;

typedef
EFI_STATUS
(EFIAPI *EFI_LEGACY_BIOS_GET_LEGACY_REGION) (
  IN EFI_LEGACY_BIOS_PROTOCOL * This,
  IN    UINTN                 LegacyMemorySize,
  IN    UINTN                 Region,
  IN    UINTN                 Alignment,
  OUT   VOID                  **LegacyMemoryAddress
  )
/*++

Routine Description:
  Get a region from the LegacyBios for S3 usage.

Arguments:
    This                   - Protocol instance pointer.
    LegacyMemorySize     - Size of required region
    Region                 - Region to use.
                                 00 = Either 0xE0000 or 0xF0000 block
                                 Bit0 = 1 0xF0000 block
                                 Bit1 = 1 0xE0000 block
    Alignment             - Address alignment. Bit mapped. First non-zero 
                            bit from right is alignment.
    LegacyMemoryAddress  - Region Assigned

Returns: 

  EFI_SUCCESS - Region assigned

  Other       - Region not assigned

--*/
;

typedef
EFI_STATUS
(EFIAPI *EFI_LEGACY_BIOS_COPY_LEGACY_REGION) (
  IN EFI_LEGACY_BIOS_PROTOCOL * This,
  IN    UINTN                 LegacyMemorySize,
  IN    VOID                  *LegacyMemoryAddress,
  IN    VOID                  *LegacyMemorySourceAddress
  )
/*++

Routine Description:
  Get a region from the LegacyBios for Tiano usage. Can only be invoked once.

Arguments:
    This                         - Protocol instance pointer.
    LegacyMemorySize             - Size of data to copy
    LegacyMemoryAddress          - Legacy Region destination address
                                   Note: must be in region assigned by
                                         LegacyBiosGetLegacyRegion
    LegacyMemorySourceAddress    - Source of data

Returns: 

  EFI_SUCCESS        - Region assigned
  EFI_ACCESS_DENIED  - Destination outside assigned region

--*/
;

typedef struct _EFI_LEGACY_BIOS_PROTOCOL {
  EFI_LEGACY_BIOS_INT86                       Int86;
  EFI_LEGACY_BIOS_FARCALL86                   FarCall86;
  EFI_LEGACY_BIOS_CHECK_ROM                   CheckPciRom;
  EFI_LEGACY_BIOS_INSTALL_ROM                 InstallPciRom;
  EFI_LEGACY_BIOS_BOOT                        LegacyBoot;
  EFI_LEGACY_BIOS_UPDATE_KEYBOARD_LED_STATUS  UpdateKeyboardLedStatus;
  EFI_LEGACY_BIOS_GET_BBS_INFO                GetBbsInfo;
  EFI_LEGACY_BIOS_SHADOW_ALL_LEGACY_OPROMS    ShadowAllLegacyOproms;
  EFI_LEGACY_BIOS_PREPARE_TO_BOOT_EFI         PrepareToBootEfi;
  EFI_LEGACY_BIOS_GET_LEGACY_REGION           GetLegacyRegion;
  EFI_LEGACY_BIOS_COPY_LEGACY_REGION          CopyLegacyRegion;
  EFI_LEGACY_BIOS_BOOT_UNCONVENTIONAL_DEVICE  BootUnconventionalDevice;
} EFI_LEGACY_BIOS_PROTOCOL;

extern EFI_GUID gEfiLegacyBiosProtocolGuid;

#endif

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?