X-Git-Url: https://git.proxmox.com/?a=blobdiff_plain;f=IntelFrameworkModulePkg%2FCsm%2FLegacyBiosDxe%2FLegacyBiosInterface.h;h=497a71190f27c7dfdb525807895b089948e0e2a4;hb=0a6f48249a601f88af124ae1ff6814b195b699c3;hp=71522a0ba4a5fd9499784cadd1aafb7bf833d4c8;hpb=befbc4f3fbfd3d5825fdc72fcadd4bbc85a8f8a0;p=mirror_edk2.git diff --git a/IntelFrameworkModulePkg/Csm/LegacyBiosDxe/LegacyBiosInterface.h b/IntelFrameworkModulePkg/Csm/LegacyBiosDxe/LegacyBiosInterface.h index 71522a0ba4..497a71190f 100644 --- a/IntelFrameworkModulePkg/Csm/LegacyBiosDxe/LegacyBiosInterface.h +++ b/IntelFrameworkModulePkg/Csm/LegacyBiosDxe/LegacyBiosInterface.h @@ -1,6 +1,6 @@ /** @file -Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.
+Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
This program and the accompanying materials are licensed and made available under the terms and conditions @@ -18,12 +18,16 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. #include +#include +#include +#include #include #include #include #include #include +#include #include #include @@ -41,6 +45,9 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. #include #include #include +#include +#include +#include #include #include @@ -93,6 +100,14 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. #define PROTECTED_MODE_BASE_VECTOR_MASTER 0x68 #define PROTECTED_MODE_BASE_VECTOR_SLAVE 0x70 +// +// When we call CSM16 functions, some CSM16 use es:[offset + 0xabcd] to get data passed from CSM32, +// offset + 0xabcd could overflow which exceeds 0xFFFF which is invalid in real mode. +// So this will keep offset as small as possible to avoid offset overflow in real mode. +// +#define NORMALIZE_EFI_SEGMENT(_Adr) (UINT16) (((UINTN) (_Adr)) >> 4) +#define NORMALIZE_EFI_OFFSET(_Adr) (UINT16) (((UINT16) ((UINTN) (_Adr))) & 0xf) + // // Trace defines // @@ -123,6 +138,10 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. #define LEGACY_PCI_TRACE_00E LEGACY_PCI_TRACE + 0x0E #define LEGACY_PCI_TRACE_00F LEGACY_PCI_TRACE + 0x0F +#define BDA_VIDEO_MODE 0x49 + +#define IDE_PI_REGISTER_PNE BIT0 +#define IDE_PI_REGISTER_SNE BIT2 typedef struct { UINTN PciSegment; @@ -466,7 +485,8 @@ typedef enum { EfiAcpiAddressRangeMemory = 1, EfiAcpiAddressRangeReserved = 2, EfiAcpiAddressRangeACPI = 3, - EfiAcpiAddressRangeNVS = 4 + EfiAcpiAddressRangeNVS = 4, + EfiAddressRangePersistentMemory = 7 } EFI_ACPI_MEMORY_TYPE; typedef struct { @@ -489,6 +509,8 @@ extern BBS_TABLE *mBbsTable; extern EFI_GENERIC_MEMORY_TEST_PROTOCOL *gGenMemoryTest; +extern BOOLEAN mEndOfDxe; + #define PORT_70 0x70 #define PORT_71 0x71 @@ -522,7 +544,7 @@ extern EFI_GENERIC_MEMORY_TEST_PROTOCOL *gGenMemoryTest; // // Timer 0, Read/Write LSB then MSB, Square wave output, binary count use. // -#define TIMER0_CONTROL_WORD 0x36 +#define TIMER0_CONTROL_WORD 0x36 #define LEGACY_BIOS_INSTANCE_SIGNATURE SIGNATURE_32 ('L', 'B', 'I', 'T') typedef struct { @@ -534,16 +556,16 @@ typedef struct { EFI_HANDLE ImageHandle; // - // CPU Architectural Protocol + // CPU Architectural Protocol // EFI_CPU_ARCH_PROTOCOL *Cpu; // - // Timer Architectural Protocol + // Timer Architectural Protocol // EFI_TIMER_ARCH_PROTOCOL *Timer; - BOOLEAN TimerUses8254; - + BOOLEAN TimerUses8254; + // // Protocol to Lock and Unlock 0xc0000 - 0xfffff // @@ -555,7 +577,7 @@ typedef struct { // Interrupt control for thunk and PCI IRQ // EFI_LEGACY_8259_PROTOCOL *Legacy8259; - + // // PCI Interrupt PIRQ control // @@ -651,7 +673,7 @@ typedef struct { // // Indicate that whether GenericLegacyBoot is entered or not // - BOOLEAN LegacyBootEntered; + BOOLEAN LegacyBootEntered; // // CSM16 PCI Interface Version @@ -807,7 +829,7 @@ LegacyBiosFarCall86 ( @param RomSize Size of ROM Image @param Flags Indicates if ROM found and if PC-AT. - @retval EFI_SUCCESS Legacy Option ROM availible for this device + @retval EFI_SUCCESS Legacy Option ROM available for this device @retval EFI_UNSUPPORTED Legacy Option ROM not supported. **/ @@ -1239,10 +1261,10 @@ GenerateSoftInit ( ); /** - Do an AllocatePages () of type AllocateMaxAddress for EfiBootServicesCode - memory. + Allocate memory for legacy usage. - @param AllocateType Allocated Legacy Memory Type + @param AllocateType The type of allocation to perform. + @param MemoryType The type of memory to allocate. @param StartPageAddress Start address of range @param Pages Number of pages to allocate @param Result Result of allocation @@ -1254,6 +1276,7 @@ GenerateSoftInit ( EFI_STATUS AllocateLegacyMemory ( IN EFI_ALLOCATE_TYPE AllocateType, + IN EFI_MEMORY_TYPE MemoryType, IN EFI_PHYSICAL_ADDRESS StartPageAddress, IN UINTN Pages, OUT EFI_PHYSICAL_ADDRESS *Result @@ -1327,7 +1350,7 @@ ShadowAndStartLegacy16 ( /** Checks the state of the floppy and if media is inserted. - + This routine checks the state of the floppy and if media is inserted. There are 3 cases: No floppy present - Set BBS entry to ignore @@ -1444,7 +1467,7 @@ LegacyCalculateWriteStandardCmosChecksum ( @param[out] OpromRevision Revision of the PCI Rom @param[out] ConfigUtilityCodeHeaderPointer of Configuration Utility Code Header - @return EFI_SUCCESS Legacy Option ROM availible for this device + @return EFI_SUCCESS Legacy Option ROM available for this device @return EFI_ALREADY_STARTED This device is already managed by its Oprom @return EFI_UNSUPPORTED Legacy Option ROM not supported. @@ -1506,4 +1529,20 @@ InternalLegacyBiosFarCall ( IN UINTN StackSize ); +/** + Load a legacy PC-AT OpROM for VGA controller. + + @param Private Driver private data. + + @retval EFI_SUCCESS Legacy ROM successfully installed for this device. + @retval EFI_DEVICE_ERROR No VGA device handle found, or native EFI video + driver cannot be successfully disconnected, or VGA + thunk driver cannot be successfully connected. + +**/ +EFI_STATUS +LegacyBiosInstallVgaRom ( + IN LEGACY_BIOS_INSTANCE *Private + ); + #endif