X-Git-Url: https://git.proxmox.com/?a=blobdiff_plain;f=DuetPkg%2FBiosVideoThunkDxe%2FBiosVideo.c;h=f7b33e9351fbc9cacf2f5ea0d5e274909c54cf98;hb=67319626746e9bb373a95f38746c32408cc1681e;hp=6a8e55a0347c60f41565d0d19feca7fa9471246f;hpb=fe74f17339e9d91f4886cc2406f9ea0bc4d4388c;p=mirror_edk2.git diff --git a/DuetPkg/BiosVideoThunkDxe/BiosVideo.c b/DuetPkg/BiosVideoThunkDxe/BiosVideo.c index 6a8e55a034..f7b33e9351 100644 --- a/DuetPkg/BiosVideoThunkDxe/BiosVideo.c +++ b/DuetPkg/BiosVideoThunkDxe/BiosVideo.c @@ -2,7 +2,7 @@ BiosVideo driver produce EFI_GRAPHIC_OUTPUT_PROTOCOL via LegacyBios Video rom. -Copyright (c) 2006 - 2008, Intel Corporation +Copyright (c) 2006 - 2009, Intel Corporation All rights reserved. This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License which accompanies this distribution. The full text of the license may be found at @@ -599,7 +599,7 @@ BiosVideoChildHandleUninstall ( ) { EFI_STATUS Status; - EFI_IA32_REGISTER_SET Regs; + IA32_REGISTER_SET Regs; EFI_GRAPHICS_OUTPUT_PROTOCOL *GraphicsOutput; EFI_VGA_MINI_PORT_PROTOCOL *VgaMiniPort; BIOS_VIDEO_DEV *BiosVideoPrivate; @@ -854,7 +854,7 @@ ParseEdidData ( // CheckSum = 0; for (Index = 0; Index < VESA_BIOS_EXTENSIONS_EDID_BLOCK_SIZE; Index ++) { - CheckSum = CheckSum + EdidBuffer[Index]; + CheckSum = (UINT8)(CheckSum + EdidBuffer[Index]); } if (CheckSum != 0) { return FALSE; @@ -890,26 +890,26 @@ ParseEdidData ( // // A valid Standard Timing // - HorizontalResolution = BufferIndex[0] * 8 + 248; - AspectRatio = BufferIndex[1] >> 6; + HorizontalResolution = (UINT8) (BufferIndex[0] * 8 + 248); + AspectRatio = (UINT8) (BufferIndex[1] >> 6); switch (AspectRatio) { case 0: - VerticalResolution = HorizontalResolution / 16 * 10; + VerticalResolution = (UINT8) (HorizontalResolution / 16 * 10); break; case 1: - VerticalResolution = HorizontalResolution / 4 * 3; + VerticalResolution = (UINT8) (HorizontalResolution / 4 * 3); break; case 2: - VerticalResolution = HorizontalResolution / 5 * 4; + VerticalResolution = (UINT8) (HorizontalResolution / 5 * 4); break; case 3: - VerticalResolution = HorizontalResolution / 16 * 9; + VerticalResolution = (UINT8) (HorizontalResolution / 16 * 9); break; default: - VerticalResolution = HorizontalResolution / 4 * 3; + VerticalResolution = (UINT8) (HorizontalResolution / 4 * 3); break; } - RefreshRate = (BufferIndex[1] & 0x1f) + 60; + RefreshRate = (UINT8) ((BufferIndex[1] & 0x1f) + 60); TempTiming.HorizontalResolution = HorizontalResolution; TempTiming.VerticalResolution = VerticalResolution; TempTiming.RefreshRate = RefreshRate; @@ -1031,7 +1031,7 @@ BiosVideoCheckForVbe ( ) { EFI_STATUS Status; - EFI_IA32_REGISTER_SET Regs; + IA32_REGISTER_SET Regs; UINT16 *ModeNumberPtr; BOOLEAN ModeFound; BOOLEAN EdidFound; @@ -1088,15 +1088,30 @@ BiosVideoCheckForVbe ( // // Test to see if the Video Adapter is compliant with VBE 3.0 // + // INT 10 - VESA SuperVGA BIOS (VBE) - GET SuperVGA INFORMATION + // + // AX = 4F00h + // ES:DI -> buffer for SuperVGA information (see #00077) + // Return: AL = 4Fh if function supported + // AH = status + // 00h successful + // ES:DI buffer filled + // 01h failed + // ---VBE v2.0--- + // 02h function not supported by current hardware configuration + // 03h function invalid in current video mode + // Desc: determine whether VESA BIOS extensions are present and the capabilities + // supported by the display adapter + // gBS->SetMem (&Regs, sizeof (Regs), 0); Regs.X.AX = VESA_BIOS_EXTENSIONS_RETURN_CONTROLLER_INFORMATION; gBS->SetMem (BiosVideoPrivate->VbeInformationBlock, sizeof (VESA_BIOS_EXTENSIONS_INFORMATION_BLOCK), 0); BiosVideoPrivate->VbeInformationBlock->VESASignature = VESA_BIOS_EXTENSIONS_VBE2_SIGNATURE; - Regs.X.ES = EFI_SEGMENT ((UINTN) BiosVideoPrivate->VbeInformationBlock); + Regs.E.ES = EFI_SEGMENT ((UINTN) BiosVideoPrivate->VbeInformationBlock); Regs.X.DI = EFI_OFFSET ((UINTN) BiosVideoPrivate->VbeInformationBlock); LegacyBiosInt86 (BiosVideoPrivate, 0x10, &Regs); - + Status = EFI_DEVICE_ERROR; // @@ -1121,12 +1136,25 @@ BiosVideoCheckForVbe ( // // Read EDID information // + // INT 10 - VESA VBE/DC (Display Data Channel) - READ EDID + // + // AX = 4F15h + // BL = 01h + // CX = 0000h + // DX = 0000h + // ES:DI -> 128-byte buffer for EDID record (see #00127) + // Return: AL = 4Fh if function supported + // AH = status + // 00h successful + // ES:DI buffer filled + // 01h failed (e.g. non-DDC monitor) + // gBS->SetMem (&Regs, sizeof (Regs), 0); Regs.X.AX = VESA_BIOS_EXTENSIONS_EDID; Regs.X.BX = 1; Regs.X.CX = 0; Regs.X.DX = 0; - Regs.X.ES = EFI_SEGMENT ((UINTN) BiosVideoPrivate->VbeEdidDataBlock); + Regs.E.ES = EFI_SEGMENT ((UINTN) BiosVideoPrivate->VbeEdidDataBlock); Regs.X.DI = EFI_OFFSET ((UINTN) BiosVideoPrivate->VbeEdidDataBlock); LegacyBiosInt86 (BiosVideoPrivate, 0x10, &Regs); @@ -1202,11 +1230,23 @@ BiosVideoCheckForVbe ( // // Get the information about the mode // + // INT 10 - VESA SuperVGA BIOS - GET SuperVGA MODE INFORMATION + // + // AX = 4F01h + // CX = SuperVGA video mode (see #04082 for bitfields) + // ES:DI -> 256-byte buffer for mode information (see #00079) + // Return: AL = 4Fh if function supported + // AH = status + // 00h successful + // ES:DI buffer filled + // 01h failed + // Desc: determine the attributes of the specified video mode + // gBS->SetMem (&Regs, sizeof (Regs), 0); Regs.X.AX = VESA_BIOS_EXTENSIONS_RETURN_MODE_INFORMATION; Regs.X.CX = *ModeNumberPtr; gBS->SetMem (BiosVideoPrivate->VbeModeInformationBlock, sizeof (VESA_BIOS_EXTENSIONS_MODE_INFORMATION_BLOCK), 0); - Regs.X.ES = EFI_SEGMENT ((UINTN) BiosVideoPrivate->VbeModeInformationBlock); + Regs.E.ES = EFI_SEGMENT ((UINTN) BiosVideoPrivate->VbeModeInformationBlock); Regs.X.DI = EFI_OFFSET ((UINTN) BiosVideoPrivate->VbeModeInformationBlock); LegacyBiosInt86 (BiosVideoPrivate, 0x10, &Regs); @@ -1622,7 +1662,7 @@ BiosVideoGraphicsOutputSetMode ( { EFI_STATUS Status; BIOS_VIDEO_DEV *BiosVideoPrivate; - EFI_IA32_REGISTER_SET Regs; + IA32_REGISTER_SET Regs; BIOS_VIDEO_MODE_DATA *ModeData; BiosVideoPrivate = BIOS_VIDEO_DEV_FROM_GRAPHICS_OUTPUT_THIS (This); @@ -1635,10 +1675,6 @@ BiosVideoGraphicsOutputSetMode ( return EFI_UNSUPPORTED; } - if (ModeNumber == This->Mode->Mode) { - return EFI_SUCCESS; - } - ModeData = &BiosVideoPrivate->ModeData[ModeNumber]; if (BiosVideoPrivate->LineBuffer) { @@ -1705,8 +1741,9 @@ BiosVideoGraphicsOutputSetMode ( Regs.X.AX = VESA_BIOS_EXTENSIONS_SET_MODE; Regs.X.BX = (UINT16) (ModeData->VbeModeNumber | VESA_BIOS_EXTENSIONS_MODE_NUMBER_LINEAR_FRAME_BUFFER); gBS->SetMem (BiosVideoPrivate->VbeCrtcInformationBlock, sizeof (VESA_BIOS_EXTENSIONS_CRTC_INFORMATION_BLOCK), 0); - Regs.X.ES = EFI_SEGMENT ((UINTN) BiosVideoPrivate->VbeCrtcInformationBlock); + Regs.E.ES = EFI_SEGMENT ((UINTN) BiosVideoPrivate->VbeCrtcInformationBlock); Regs.X.DI = EFI_OFFSET ((UINTN) BiosVideoPrivate->VbeCrtcInformationBlock); + LegacyBiosInt86 (BiosVideoPrivate, 0x10, &Regs); // @@ -2328,7 +2365,7 @@ BiosVideoGraphicsOutputVgaBlt ( EFI_TPL OriginalTPL; UINT8 *MemAddress; UINTN BytesPerScanLine; - UINTN BytesPerBitPlane; + //UINTN BytesPerBitPlane; UINTN Bit; UINTN Index; UINTN Index1; @@ -2360,7 +2397,7 @@ BiosVideoGraphicsOutputVgaBlt ( PciIo = BiosVideoPrivate->PciIo; MemAddress = BiosVideoPrivate->ModeData[CurrentMode].LinearFrameBuffer; BytesPerScanLine = BiosVideoPrivate->ModeData[CurrentMode].BytesPerScanLine >> 3; - BytesPerBitPlane = BytesPerScanLine * BiosVideoPrivate->ModeData[CurrentMode].VerticalResolution; + //BytesPerBitPlane = BytesPerScanLine * BiosVideoPrivate->ModeData[CurrentMode].VerticalResolution; VgaFrameBuffer = BiosVideoPrivate->VgaFrameBuffer; if (This == NULL || ((UINTN) BltOperation) >= EfiGraphicsOutputBltOperationMax) { @@ -2499,7 +2536,7 @@ BiosVideoGraphicsOutputVgaBlt ( LeftMask = mVgaLeftMaskTable[DestinationX & 0x07]; RightMask = mVgaRightMaskTable[(DestinationX + Width - 1) & 0x07]; if (Bytes == 0) { - LeftMask &= RightMask; + LeftMask = (UINT8) (LeftMask & RightMask); RightMask = 0; } @@ -2728,7 +2765,7 @@ BiosVideoVgaMiniPortSetMode ( ) { BIOS_VIDEO_DEV *BiosVideoPrivate; - EFI_IA32_REGISTER_SET Regs; + IA32_REGISTER_SET Regs; if (This == NULL) { return EFI_INVALID_PARAMETER;