summaryrefslogtreecommitdiff
path: root/OvmfPkg/Include/IndustryStandard/LegacyVgaBios.h
diff options
context:
space:
mode:
authorLaszlo Ersek <lersek@redhat.com>2014-05-20 16:33:00 +0000
committerjljusten <jljusten@6f19259b-4bc3-4df7-8a09-765794883524>2014-05-20 16:33:00 +0000
commit90803342b1b6060f1ddbb1aaea54fdf86a7ff9ad (patch)
tree612d067be44c0fd0a8420d337108e0d6ab614a40 /OvmfPkg/Include/IndustryStandard/LegacyVgaBios.h
parentd8f36fb56834e26a03e8993ca76d2f3870dd0b39 (diff)
downloadedk2-platforms-90803342b1b6060f1ddbb1aaea54fdf86a7ff9ad.tar.xz
OvmfPkg: QemuVideoDxe: Int10h stub for Windows 7 & 2008 (stdvga, QXL)
The Windows 2008 R2 SP1 (and Windows 7) UEFI guest's default video driver dereferences the real mode Int10h vector, loads the pointed-to handler code, and executes what it thinks to be VGA BIOS services in an internal real-mode emulator. Consequently, video mode switching doesn't work in Windows 2008 R2 SP1 when it runs on the pure UEFI build of OVMF, making the guest uninstallable. This patch adds a VGABIOS "shim" to QemuVideoDxe. For the first stdvga or QXL card bound, an extremely stripped down VGABIOS imitation is installed in the C segment. It provides a real implementation for the few services that are in fact necessary for the win2k8r2sp1 UEFI guest, plus some fakes that the guest invokes but whose effect is not important. The C segment is not present in the UEFI memory map prepared by OVMF. We never add memory space that would cover it (either in PEI, in the form of memory resource descriptor HOBs, or in DXE, via gDS->AddMemorySpace()). This way the handler body is invisible to all non-buggy UEFI guests, and the rest of edk2. The Int10h real-mode IVT entry is covered with a Boot Services Code page, making that too unaccessible to the rest of edk2. (Thus UEFI guest OSes different from the Windows 2008 family can reclaim the page. The Windows 2008 family accesses the page at zero regardless of the allocation type.) The patch is the result of collaboration: Initial proof of concept IVT entry installation and handler skeleton (in NASM) by Jordan Justen. Service tracing and implementation, data collection/analysis, and C coding by yours truly. Last minute changes by Gerd Hoffmann: - Use OEM mode number (0xf1) instead of standard 800x600 mode (0x143). The resolution of the OEM mode (0xf1) is not standardized; the guest can't expect anything from it in advance. - Use 1024x768 rather than 800x600 for more convenience in the Windows 2008 R2 SP1 guest during OS installation, and after normal boot until the QXL XDDM guest driver is installed. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Laszlo Ersek <lersek@redhat.com> Reviewed-by: Jordan Justen <jordan.l.justen@intel.com> Reviewed-by: Gerd Hoffmann <kraxel@redhat.com> git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@15540 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'OvmfPkg/Include/IndustryStandard/LegacyVgaBios.h')
-rw-r--r--OvmfPkg/Include/IndustryStandard/LegacyVgaBios.h97
1 files changed, 97 insertions, 0 deletions
diff --git a/OvmfPkg/Include/IndustryStandard/LegacyVgaBios.h b/OvmfPkg/Include/IndustryStandard/LegacyVgaBios.h
new file mode 100644
index 0000000000..d55d1283f4
--- /dev/null
+++ b/OvmfPkg/Include/IndustryStandard/LegacyVgaBios.h
@@ -0,0 +1,97 @@
+/** @file
+ Type definitions related to the VBE (VESA BIOS Extension, Int10h AH=4Fh)
+ services GET INFORMATION (AL=00h) and GET MODE INFORMATION (AL=01h).
+
+ For reference, see Ralf Brown's Interrupt List:
+ <http://www.cs.cmu.edu/~ralf/files.html>
+ <http://www.ctyme.com/rbrown.htm>
+
+ Copyright (C) 2014, Red Hat, Inc.
+
+ 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
+ http://opensource.org/licenses/bsd-license.php
+
+ THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, WITHOUT
+ WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+**/
+
+#ifndef __LEGACY_VGA_BIOS_H__
+#define __LEGACY_VGA_BIOS_H__
+
+#include <Base.h>
+
+#pragma pack (1)
+typedef struct {
+ UINT8 Signature[4];
+ UINT16 VesaVersion;
+ UINT32 OemNameAddress;
+ UINT32 Capabilities;
+ UINT32 ModeListAddress;
+ UINT16 VideoMem64K;
+ UINT16 OemSoftwareVersion;
+ UINT32 VendorNameAddress;
+ UINT32 ProductNameAddress;
+ UINT32 ProductRevAddress;
+} VBE_INFO_BASE;
+
+typedef struct {
+ VBE_INFO_BASE Base;
+ UINT8 Buffer[256 - sizeof (VBE_INFO_BASE)];
+} VBE_INFO;
+
+typedef struct {
+ UINT16 ModeAttr;
+ UINT8 WindowAAttr;
+ UINT8 WindowBAttr;
+ UINT16 WindowGranularityKB;
+ UINT16 WindowSizeKB;
+ UINT16 WindowAStartSegment;
+ UINT16 WindowBStartSegment;
+ UINT32 WindowPositioningAddress;
+ UINT16 BytesPerScanLine;
+
+ UINT16 Width;
+ UINT16 Height;
+ UINT8 CharCellWidth;
+ UINT8 CharCellHeight;
+ UINT8 NumPlanes;
+ UINT8 BitsPerPixel;
+ UINT8 NumBanks;
+ UINT8 MemoryModel;
+ UINT8 BankSizeKB;
+ UINT8 NumImagePagesLessOne;
+ UINT8 Vbe3;
+
+ UINT8 RedMaskSize;
+ UINT8 RedMaskPos;
+ UINT8 GreenMaskSize;
+ UINT8 GreenMaskPos;
+ UINT8 BlueMaskSize;
+ UINT8 BlueMaskPos;
+ UINT8 ReservedMaskSize;
+ UINT8 ReservedMaskPos;
+ UINT8 DirectColorModeInfo;
+
+ UINT32 LfbAddress;
+ UINT32 OffScreenAddress;
+ UINT16 OffScreenSizeKB;
+
+ UINT16 BytesPerScanLineLinear;
+ UINT8 NumImagesLessOneBanked;
+ UINT8 NumImagesLessOneLinear;
+ UINT8 RedMaskSizeLinear;
+ UINT8 RedMaskPosLinear;
+ UINT8 GreenMaskSizeLinear;
+ UINT8 GreenMaskPosLinear;
+ UINT8 BlueMaskSizeLinear;
+ UINT8 BlueMaskPosLinear;
+ UINT8 ReservedMaskSizeLinear;
+ UINT8 ReservedMaskPosLinear;
+ UINT32 MaxPixelClockHz;
+ UINT8 Reserved[190];
+} VBE_MODE_INFO;
+#pragma pack ()
+
+#endif