--- /dev/null
+/*++\r
+\r
+Copyright (c) 2004 - 2006, Intel Corporation \r
+All rights reserved. This program and the accompanying materials \r
+are licensed and made available under the terms and conditions of the BSD License \r
+which accompanies this distribution. The full text of the license may be found at \r
+http://opensource.org/licenses/bsd-license.php \r
+ \r
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, \r
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. \r
+\r
+Module Name:\r
+\r
+ LegacyBios.h\r
+ \r
+Abstract:\r
+\r
+ The EFI Legacy BIOS Protocol is used to abstract legacy Option ROM usage\r
+ under EFI and Legacy OS boot.\r
+\r
+ Note: The names for EFI_IA32_REGISTER_SET elements were picked to follow \r
+ well known naming conventions.\r
+\r
+ Thunk - A thunk is a transition from one processor mode to another. A Thunk\r
+ is a transition from native EFI mode to 16-bit mode. A reverse thunk\r
+ would be a transition from 16-bit mode to native EFI mode.\r
+\r
+\r
+ Note: Note: Note: Note: Note: Note: Note:\r
+\r
+ You most likely should not use this protocol! Find the EFI way to solve the\r
+ problem to make your code portable\r
+\r
+ Note: Note: Note: Note: Note: Note: Note:\r
+\r
+Revision History\r
+\r
+ The EFI Legacy BIOS Protocol is compliant with CSM spec 0.96.\r
+\r
+--*/\r
+\r
+#ifndef _EFI_LEGACY_BIOS_H\r
+#define _EFI_LEGACY_BIOS_H\r
+\r
+#define EFI_LEGACY_BIOS_PROTOCOL_GUID \\r
+ { \\r
+ 0xdb9a1e3d, 0x45cb, 0x4abb, 0x85, 0x3b, 0xe5, 0x38, 0x7f, 0xdb, 0x2e, 0x2d \\r
+ }\r
+\r
+EFI_FORWARD_DECLARATION (EFI_LEGACY_BIOS_PROTOCOL);\r
+\r
+//\r
+// Convert from 32-bit address (_Adr) to Segment:Offset 16-bit form\r
+//\r
+#define EFI_SEGMENT(_Adr) (UINT16) ((UINT16) (((UINTN) (_Adr)) >> 4) & 0xf000)\r
+#define EFI_OFFSET(_Adr) (UINT16) (((UINT16) ((UINTN) (_Adr))) & 0xffff)\r
+#define BYTE_GRANULARITY 0x01\r
+#define WORD_GRANULARITY 0x02\r
+#define DWORD_GRANULARITY 0x04\r
+#define QWORD_GRANULARITY 0x08\r
+#define PARAGRAPH_GRANULARITY 0x10\r
+\r
+#define CARRY_FLAG 0x01\r
+\r
+typedef struct {\r
+ UINT32 CF:1;\r
+ UINT32 Reserved1:1;\r
+ UINT32 PF:1;\r
+ UINT32 Reserved2:1;\r
+ UINT32 AF:1;\r
+ UINT32 Reserved3:1;\r
+ UINT32 ZF:1;\r
+ UINT32 SF:1;\r
+ UINT32 TF:1;\r
+ UINT32 IF:1;\r
+ UINT32 DF:1;\r
+ UINT32 OF:1;\r
+ UINT32 IOPL:2;\r
+ UINT32 NT:1;\r
+ UINT32 Reserved4:2;\r
+ UINT32 VM:1;\r
+ UINT32 Reserved5:14;\r
+} EFI_EFLAGS_REG;\r
+\r
+typedef struct {\r
+ UINT16 CF : 1;\r
+ UINT16 Reserved1 : 1;\r
+ UINT16 PF : 1;\r
+ UINT16 Reserved2 : 1;\r
+ UINT16 AF : 1;\r
+ UINT16 Reserved3 : 1;\r
+ UINT16 ZF : 1;\r
+ UINT16 SF : 1;\r
+ UINT16 TF : 1;\r
+ UINT16 IF : 1;\r
+ UINT16 DF : 1;\r
+ UINT16 OF : 1;\r
+ UINT16 IOPL : 2;\r
+ UINT16 NT : 1;\r
+ UINT16 Reserved4 : 1;\r
+} EFI_FLAGS_REG;\r
+\r
+typedef struct {\r
+ UINT32 EAX;\r
+ UINT32 EBX;\r
+ UINT32 ECX;\r
+ UINT32 EDX;\r
+ UINT32 ESI;\r
+ UINT32 EDI;\r
+ EFI_EFLAGS_REG EFlags;\r
+ UINT16 ES;\r
+ UINT16 CS;\r
+ UINT16 SS;\r
+ UINT16 DS;\r
+ UINT16 FS;\r
+ UINT16 GS;\r
+ UINT32 EBP;\r
+ UINT32 ESP;\r
+} EFI_DWORD_REGS;\r
+\r
+typedef struct {\r
+ UINT16 AX;\r
+ UINT16 ReservedAX;\r
+ UINT16 BX;\r
+ UINT16 ReservedBX;\r
+ UINT16 CX;\r
+ UINT16 ReservedCX;\r
+ UINT16 DX;\r
+ UINT16 ReservedDX;\r
+ UINT16 SI;\r
+ UINT16 ReservedSI;\r
+ UINT16 DI;\r
+ UINT16 ReservedDI;\r
+ EFI_FLAGS_REG Flags;\r
+ UINT16 ReservedFlags;\r
+ UINT16 ES;\r
+ UINT16 CS;\r
+ UINT16 SS;\r
+ UINT16 DS;\r
+ UINT16 FS;\r
+ UINT16 GS;\r
+ UINT16 BP;\r
+ UINT16 ReservedBP;\r
+ UINT16 SP;\r
+ UINT16 ReservedSP;\r
+} EFI_WORD_REGS;\r
+\r
+typedef struct {\r
+ UINT8 AL;\r
+ UINT8 AH;\r
+ UINT16 ReservedAX;\r
+ UINT8 BL;\r
+ UINT8 BH;\r
+ UINT16 ReservedBX;\r
+ UINT8 CL;\r
+ UINT8 CH;\r
+ UINT16 ReservedCX;\r
+ UINT8 DL;\r
+ UINT8 DH;\r
+ UINT16 ReservedDX;\r
+} EFI_BYTE_REGS;\r
+\r
+typedef union {\r
+ EFI_DWORD_REGS E;\r
+ EFI_WORD_REGS X;\r
+ EFI_BYTE_REGS H;\r
+} EFI_IA32_REGISTER_SET;\r
+\r
+#pragma pack(1)\r
+//\r
+// $EFI table created by Legacy16 code and consumed by EFI Legacy driver\r
+//\r
+typedef struct {\r
+ UINT32 Signature; // "$EFI"\r
+ UINT8 TableChecksum;\r
+ UINT8 TableLength;\r
+ UINT8 EfiMajorRevision;\r
+ UINT8 EfiMinorRevision;\r
+ UINT8 TableMajorRevision;\r
+ UINT8 TableMinorRevision;\r
+ UINT16 Reserved;\r
+ UINT16 Compatibility16CallSegment;\r
+ UINT16 Compatibility16CallOffset;\r
+\r
+ UINT16 PnPInstallationCheckSegment;\r
+ UINT16 PnPInstallationCheckOffset;\r
+\r
+ UINT32 EfiSystemTable; // IPF - CSM Integration\r
+ UINT32 OemIdStringPointer;\r
+ UINT32 AcpiRsdPtrPointer;\r
+ UINT16 OemRevision;\r
+ UINT32 E820Pointer;\r
+ UINT32 E820Length;\r
+ UINT32 IrqRoutingTablePointer;\r
+ UINT32 IrqRoutingTableLength;\r
+ UINT32 MpTablePtr;\r
+ UINT32 MpTableLength;\r
+ UINT16 OemIntSegment;\r
+ UINT16 OemIntOffset;\r
+ UINT16 Oem32Segment;\r
+ UINT16 Oem32Offset;\r
+ UINT16 Oem16Segment;\r
+ UINT16 Oem16Offset;\r
+ UINT16 TpmSegment;\r
+ UINT16 TpmOffset;\r
+ UINT32 IbvPointer;\r
+ UINT32 PciExpressBase;\r
+ UINT8 LastPciBus;\r
+\r
+} EFI_COMPATIBILITY16_TABLE;\r
+//\r
+// define maximum number of HDD system supports\r
+//\r
+#define MAX_HDD_ENTRIES 0x30\r
+\r
+typedef struct {\r
+ UINT16 Raw[256];\r
+} ATAPI_IDENTIFY;\r
+\r
+//\r
+// HDD_INFO status\r
+//\r
+#define HDD_PRIMARY 0x01\r
+#define HDD_SECONDARY 0x02\r
+#define HDD_MASTER_ATAPI_CDROM 0x04\r
+#define HDD_SLAVE_ATAPI_CDROM 0x08\r
+#define HDD_MASTER_IDE 0x20\r
+#define HDD_SLAVE_IDE 0x40\r
+#define HDD_MASTER_ATAPI_ZIPDISK 0x10\r
+#define HDD_SLAVE_ATAPI_ZIPDISK 0x80\r
+\r
+typedef struct {\r
+ UINT16 Status;\r
+ UINT32 Bus;\r
+ UINT32 Device;\r
+ UINT32 Function;\r
+ UINT16 CommandBaseAddress;\r
+ UINT16 ControlBaseAddress;\r
+ UINT16 BusMasterAddress;\r
+ UINT8 HddIrq;\r
+ ATAPI_IDENTIFY IdentifyDrive[2];\r
+} HDD_INFO;\r
+\r
+//\r
+// Parties data structures\r
+//\r
+typedef struct {\r
+ UINT8 DirectoryServiceValidity : 1;\r
+ UINT8 RabcaUsedFlag : 1;\r
+ UINT8 ExecuteHddDiagnosticsFlag : 1;\r
+ UINT8 Reserved : 5;\r
+} UDC_ATTRIBUTES;\r
+\r
+typedef struct {\r
+ UDC_ATTRIBUTES Attributes;\r
+ UINT8 DeviceNumber;\r
+ UINT8 BbsTableEntryNumberForParentDevice;\r
+ UINT8 BbsTableEntryNumberForBoot;\r
+ UINT8 BbsTableEntryNumberForHddDiag;\r
+ UINT8 BeerData[128];\r
+ UINT8 ServiceAreaData[64];\r
+} UD_TABLE;\r
+\r
+//\r
+// define BBS Device Types\r
+//\r
+#define BBS_FLOPPY 0x01\r
+#define BBS_HARDDISK 0x02\r
+#define BBS_CDROM 0x03\r
+#define BBS_PCMCIA 0x04\r
+#define BBS_USB 0x05\r
+#define BBS_EMBED_NETWORK 0x06\r
+#define BBS_BEV_DEVICE 0x80\r
+#define BBS_UNKNOWN 0xff\r
+\r
+typedef struct {\r
+ UINT16 OldPosition : 4;\r
+ UINT16 Reserved1 : 4;\r
+ UINT16 Enabled : 1;\r
+ UINT16 Failed : 1;\r
+ UINT16 MediaPresent : 2;\r
+ UINT16 Reserved2 : 4;\r
+} BBS_STATUS_FLAGS;\r
+\r
+#define MAX_BBS_ENTRIES 0x100\r
+//\r
+// BBS_IGNORE_ENTRY is placed in the BootPriority field if the entry is to\r
+// be skipped.\r
+// BBS_UNPRIORITIZED_ENTRY is placed in the BootPriority field before\r
+// priority has been assigned but indicates valid entry.\r
+// BBS_LOWEST_PRIORITY is normally used for removable media with no media\r
+// inserted. This allows the 16-bit CSM to allocate a drive letter to\r
+// the device.\r
+// BBS_DO_NOT_BOOT_FROM is used for devices that the 16-bit CSM is to assign\r
+// a drive letter to but never boot from.\r
+//\r
+// AdditionalIrq??Handler usage is IBV specific. The fields have been added\r
+// for:\r
+// 1. Saving non-BBS card info about IRQs taken by card.\r
+// 2. For BBS compliant cards that hook IRQs in order to have their SETUP\r
+// executed.\r
+//\r
+#define BBS_DO_NOT_BOOT_FROM 0xFFFC\r
+#define BBS_LOWEST_PRIORITY 0xFFFD\r
+#define BBS_UNPRIORITIZED_ENTRY 0xFFFE\r
+#define BBS_IGNORE_ENTRY 0xFFFF\r
+\r
+typedef struct {\r
+ UINT16 BootPriority;\r
+ UINT32 Bus;\r
+ UINT32 Device;\r
+ UINT32 Function;\r
+ UINT8 Class;\r
+ UINT8 SubClass;\r
+ UINT16 MfgStringOffset;\r
+ UINT16 MfgStringSegment;\r
+ UINT16 DeviceType;\r
+ BBS_STATUS_FLAGS StatusFlags;\r
+ UINT16 BootHandlerOffset;\r
+ UINT16 BootHandlerSegment;\r
+ UINT16 DescStringOffset;\r
+ UINT16 DescStringSegment;\r
+ UINT32 InitPerReserved;\r
+ UINT32 AdditionalIrq13Handler;\r
+ UINT32 AdditionalIrq18Handler;\r
+ UINT32 AdditionalIrq19Handler;\r
+ UINT32 AdditionalIrq40Handler;\r
+ UINT8 AssignedDriveNumber;\r
+ UINT32 AdditionalIrq41Handler;\r
+ UINT32 AdditionalIrq46Handler;\r
+ UINT32 IBV1;\r
+ UINT32 IBV2;\r
+} BBS_TABLE;\r
+\r
+#pragma pack()\r
+\r
+typedef\r
+BOOLEAN\r
+(EFIAPI *EFI_LEGACY_BIOS_INT86) (\r
+ IN EFI_LEGACY_BIOS_PROTOCOL * This,\r
+ IN UINT8 BiosInt,\r
+ IN OUT EFI_IA32_REGISTER_SET * Regs\r
+ )\r
+/*++\r
+\r
+ Routine Description:\r
+ Thunk to 16-bit real mode and execute a software interrupt with a vector \r
+ of BiosInt. Regs will contain the 16-bit register context on entry and \r
+ exit.\r
+\r
+ Arguments:\r
+ This - Protocol instance pointer.\r
+ BiosInt - Processor interrupt vector to invoke\r
+ Reg - Register contexted passed into (and returned) from thunk to \r
+ 16-bit mode\r
+\r
+ Returns:\r
+ FALSE - Thunk completed, and there were no BIOS errors in the target code.\r
+ See Regs for status.\r
+ TRUE - There was a BIOS erro in the target code.\r
+\r
+--*/\r
+;\r
+\r
+typedef\r
+BOOLEAN\r
+(EFIAPI *EFI_LEGACY_BIOS_FARCALL86) (\r
+ IN EFI_LEGACY_BIOS_PROTOCOL * This,\r
+ IN UINT16 Segment,\r
+ IN UINT16 Offset,\r
+ IN EFI_IA32_REGISTER_SET * Regs,\r
+ IN VOID *Stack,\r
+ IN UINTN StackSize\r
+ )\r
+/*++\r
+\r
+ Routine Description:\r
+ Thunk to 16-bit real mode and call Segment:Offset. Regs will contain the \r
+ 16-bit register context on entry and exit. Arguments can be passed on \r
+ the Stack argument\r
+\r
+ Arguments:\r
+ This - Protocol instance pointer.\r
+ Segment - Segemnt of 16-bit mode call\r
+ Offset - Offset of 16-bit mdoe call\r
+ Reg - Register contexted passed into (and returned) from thunk to \r
+ 16-bit mode\r
+ Stack - Caller allocated stack used to pass arguments\r
+ StackSize - Size of Stack in bytes\r
+\r
+ Returns:\r
+ FALSE - Thunk completed, and there were no BIOS errors in the target code.\r
+ See Regs for status.\r
+ TRUE - There was a BIOS erro in the target code.\r
+\r
+--*/\r
+;\r
+\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_LEGACY_BIOS_CHECK_ROM) (\r
+ IN EFI_LEGACY_BIOS_PROTOCOL * This,\r
+ IN EFI_HANDLE PciHandle,\r
+ OUT VOID **RomImage, OPTIONAL\r
+ OUT UINTN *RomSize, OPTIONAL\r
+ OUT UINTN *Flags\r
+\r
+ )\r
+/*++\r
+\r
+ Routine Description:\r
+ Test to see if a legacy PCI ROM exists for this device. Optionally return\r
+ the Legacy ROM instance for this PCI device.\r
+\r
+ Arguments:\r
+ This - Protocol instance pointer.\r
+ PciHandle - The PCI PC-AT OPROM from this devices ROM BAR will be loaded\r
+ RomImage - Return the legacy PCI ROM for this device\r
+ RomSize - Size of ROM Image\r
+ Flags - Indicates if ROM found and if PC-AT.\r
+\r
+ Returns:\r
+ EFI_SUCCESS - Legacy Option ROM availible for this device\r
+ EFI_UNSUPPORTED - Legacy Option ROM not supported.\r
+\r
+--*/\r
+;\r
+\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_LEGACY_BIOS_INSTALL_ROM) (\r
+ IN EFI_LEGACY_BIOS_PROTOCOL * This,\r
+ IN EFI_HANDLE PciHandle,\r
+ IN VOID **RomImage,\r
+ OUT UINTN *Flags,\r
+ OUT UINT8 *DiskStart, OPTIONAL\r
+ OUT UINT8 *DiskEnd, OPTIONAL\r
+ OUT VOID **RomShadowAddress, OPTIONAL\r
+ OUT UINT32 *ShadowedRomSize OPTIONAL\r
+ )\r
+/*++\r
+\r
+ Routine Description:\r
+ Load a legacy PC-AT OPROM on the PciHandle device. Return information\r
+ about how many disks were added by the OPROM and the shadow address and\r
+ size. DiskStart & DiskEnd are INT 13h drive letters. Thus 0x80 is C:\r
+\r
+ Arguments:\r
+ This - Protocol instance pointer.\r
+ PciHandle - The PCI PC-AT OPROM from this devices ROM BAR will be loaded.\r
+ This value is NULL if RomImage is non-NULL. This is the normal\r
+ case.\r
+ RomImage - A PCI PC-AT ROM image. This argument is non-NULL if there is\r
+ no hardware associated with the ROM and thus no PciHandle,\r
+ otherwise is must be NULL.\r
+ Example is PXE base code.\r
+ Flags - Return Status if ROM was found and if was Legacy OPROM.\r
+ DiskStart - Disk number of first device hooked by the ROM. If DiskStart\r
+ is the same as DiskEnd no disked were hooked.\r
+ DiskEnd - Disk number of the last device hooked by the ROM.\r
+ RomShadowAddress - Shadow address of PC-AT ROM\r
+ RomShadowSize - Size of RomShadowAddress in bytes\r
+\r
+ Returns:\r
+ EFI_SUCCESS - Thunk completed, see Regs for status.\r
+ EFI_INVALID_PARAMETER - PciHandle not found\r
+\r
+--*/\r
+;\r
+\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_LEGACY_BIOS_BOOT) (\r
+ IN EFI_LEGACY_BIOS_PROTOCOL * This,\r
+ IN BBS_BBS_DEVICE_PATH * BootOption,\r
+ IN UINT32 LoadOptionsSize,\r
+ IN VOID *LoadOptions\r
+ )\r
+/*++\r
+\r
+ Routine Description:\r
+ Attempt to legacy boot the BootOption. If the EFI contexted has been \r
+ compromised this function will not return.\r
+\r
+ Arguments:\r
+ This - Protocol instance pointer.\r
+ BootOption - EFI Device Path from BootXXXX variable.\r
+ LoadOptionSize - Size of LoadOption in size.\r
+ LoadOption - LoadOption from BootXXXX variable\r
+\r
+ Returns:\r
+ EFI_SUCCESS - Removable media not present\r
+\r
+--*/\r
+;\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_LEGACY_BIOS_UPDATE_KEYBOARD_LED_STATUS) (\r
+ IN EFI_LEGACY_BIOS_PROTOCOL * This,\r
+ IN UINT8 Leds\r
+ )\r
+/*++\r
+\r
+ Routine Description:\r
+ Update BDA with current Scroll, Num & Cap lock LEDS\r
+\r
+ Arguments:\r
+ This - Protocol instance pointer.\r
+ Leds - Status of current Scroll, Num & Cap lock LEDS\r
+ Bit 0 is Scroll Lock 0 = Not locked\r
+ Bit 1 is Num Lock\r
+ Bit 2 is Caps Lock\r
+\r
+ Returns:\r
+ EFI_SUCCESS - Removable media not present\r
+\r
+--*/\r
+;\r
+\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_LEGACY_BIOS_GET_BBS_INFO) (\r
+ IN EFI_LEGACY_BIOS_PROTOCOL * This,\r
+ OUT UINT16 *HddCount,\r
+ OUT HDD_INFO **HddInfo,\r
+ OUT UINT16 *BbsCount,\r
+ IN OUT BBS_TABLE **BbsTable\r
+ )\r
+/*++\r
+\r
+ Routine Description:\r
+ Retrieve legacy BBS info and assign boot priority.\r
+\r
+ Arguments:\r
+ This - Protocol instance pointer.\r
+ HddCount - Number of HDD_INFO structures\r
+ HddInfo - Onboard IDE controller information\r
+ BbsCount - Number of BBS_TABLE structures\r
+ BbsTable - List BBS entries\r
+\r
+ Returns:\r
+ EFI_SUCCESS - Tables returned\r
+\r
+--*/\r
+;\r
+\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_LEGACY_BIOS_PREPARE_TO_BOOT_EFI) (\r
+ IN EFI_LEGACY_BIOS_PROTOCOL * This,\r
+ OUT UINT16 *BbsCount,\r
+ OUT BBS_TABLE **BbsTable\r
+ )\r
+/*++\r
+\r
+ Routine Description:\r
+ Assign drive number to legacy HDD drives prior to booting an EFI\r
+ aware OS so the OS can access drives without an EFI driver.\r
+\r
+ Arguments:\r
+ This - Protocol instance pointer.\r
+ BbsCount - Number of BBS_TABLE structures\r
+ BbsTable - List BBS entries\r
+\r
+ Returns:\r
+ EFI_SUCCESS - Drive numbers assigned\r
+\r
+--*/\r
+;\r
+\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_LEGACY_BIOS_BOOT_UNCONVENTIONAL_DEVICE) (\r
+ IN EFI_LEGACY_BIOS_PROTOCOL * This,\r
+ IN UDC_ATTRIBUTES Attributes,\r
+ IN UINTN BbsEntry,\r
+ IN VOID *BeerData,\r
+ IN VOID *ServiceAreaData\r
+ )\r
+/*++\r
+\r
+ Routine Description:\r
+ To boot from an unconventional device like parties and/or execute\r
+ HDD diagnostics.\r
+\r
+ Arguments:\r
+ This - Protocol instance pointer.\r
+ Attributes - How to interpret the other input parameters\r
+ BbsEntry - The 0-based index into the BbsTable for the parent \r
+ device.\r
+ BeerData - Pointer to the 128 bytes of ram BEER data.\r
+ ServiceAreaData - Pointer to the 64 bytes of raw Service Area data. The\r
+ caller must provide a pointer to the specific Service\r
+ Area and not the start all Service Areas. \r
+ Returns:\r
+ EFI_INVALID_PARAMETER if error. Does NOT return if no error.\r
+\r
+--*/\r
+;\r
+\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_LEGACY_BIOS_SHADOW_ALL_LEGACY_OPROMS) (\r
+ IN EFI_LEGACY_BIOS_PROTOCOL * This\r
+ )\r
+/*++\r
+\r
+ Routine Description:\r
+ Shadow all legacy16 OPROMs that haven't been shadowed.\r
+ Warning: Use this with caution. This routine disconnects all EFI\r
+ drivers. If used externally then caller must re-connect EFI\r
+ drivers.\r
+ Arguments:\r
+\r
+ Returns:\r
+ EFI_SUCCESS - OPROMs shadowed\r
+\r
+--*/\r
+;\r
+\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_LEGACY_BIOS_GET_LEGACY_REGION) (\r
+ IN EFI_LEGACY_BIOS_PROTOCOL * This,\r
+ IN UINTN LegacyMemorySize,\r
+ IN UINTN Region,\r
+ IN UINTN Alignment,\r
+ OUT VOID **LegacyMemoryAddress\r
+ )\r
+/*++\r
+\r
+Routine Description:\r
+ Get a region from the LegacyBios for S3 usage.\r
+\r
+Arguments:\r
+ This - Protocol instance pointer.\r
+ LegacyMemorySize - Size of required region\r
+ Region - Region to use.\r
+ 00 = Either 0xE0000 or 0xF0000 block\r
+ Bit0 = 1 0xF0000 block\r
+ Bit1 = 1 0xE0000 block\r
+ Alignment - Address alignment. Bit mapped. First non-zero \r
+ bit from right is alignment.\r
+ LegacyMemoryAddress - Region Assigned\r
+\r
+Returns: \r
+\r
+ EFI_SUCCESS - Region assigned\r
+\r
+ Other - Region not assigned\r
+\r
+--*/\r
+;\r
+\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_LEGACY_BIOS_COPY_LEGACY_REGION) (\r
+ IN EFI_LEGACY_BIOS_PROTOCOL * This,\r
+ IN UINTN LegacyMemorySize,\r
+ IN VOID *LegacyMemoryAddress,\r
+ IN VOID *LegacyMemorySourceAddress\r
+ )\r
+/*++\r
+\r
+Routine Description:\r
+ Get a region from the LegacyBios for Tiano usage. Can only be invoked once.\r
+\r
+Arguments:\r
+ This - Protocol instance pointer.\r
+ LegacyMemorySize - Size of data to copy\r
+ LegacyMemoryAddress - Legacy Region destination address\r
+ Note: must be in region assigned by\r
+ LegacyBiosGetLegacyRegion\r
+ LegacyMemorySourceAddress - Source of data\r
+\r
+Returns: \r
+\r
+ EFI_SUCCESS - Region assigned\r
+ EFI_ACCESS_DENIED - Destination outside assigned region\r
+\r
+--*/\r
+;\r
+\r
+typedef struct _EFI_LEGACY_BIOS_PROTOCOL {\r
+ EFI_LEGACY_BIOS_INT86 Int86;\r
+ EFI_LEGACY_BIOS_FARCALL86 FarCall86;\r
+ EFI_LEGACY_BIOS_CHECK_ROM CheckPciRom;\r
+ EFI_LEGACY_BIOS_INSTALL_ROM InstallPciRom;\r
+ EFI_LEGACY_BIOS_BOOT LegacyBoot;\r
+ EFI_LEGACY_BIOS_UPDATE_KEYBOARD_LED_STATUS UpdateKeyboardLedStatus;\r
+ EFI_LEGACY_BIOS_GET_BBS_INFO GetBbsInfo;\r
+ EFI_LEGACY_BIOS_SHADOW_ALL_LEGACY_OPROMS ShadowAllLegacyOproms;\r
+ EFI_LEGACY_BIOS_PREPARE_TO_BOOT_EFI PrepareToBootEfi;\r
+ EFI_LEGACY_BIOS_GET_LEGACY_REGION GetLegacyRegion;\r
+ EFI_LEGACY_BIOS_COPY_LEGACY_REGION CopyLegacyRegion;\r
+ EFI_LEGACY_BIOS_BOOT_UNCONVENTIONAL_DEVICE BootUnconventionalDevice;\r
+} EFI_LEGACY_BIOS_PROTOCOL;\r
+\r
+extern EFI_GUID gEfiLegacyBiosProtocolGuid;\r
+\r
+#endif\r