2011-04-12 17:08:51 +02:00
|
|
|
/** @file
|
|
|
|
QEMU Video Controller Driver
|
|
|
|
|
2016-10-11 07:26:27 +02:00
|
|
|
Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.<BR>
|
2011-06-07 10:07:55 +02:00
|
|
|
This program and the accompanying materials
|
2011-04-12 17:08:51 +02:00
|
|
|
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.
|
|
|
|
|
|
|
|
**/
|
|
|
|
|
|
|
|
//
|
|
|
|
// QEMU Video Controller Driver
|
|
|
|
//
|
|
|
|
|
|
|
|
#ifndef _QEMU_H_
|
|
|
|
#define _QEMU_H_
|
|
|
|
|
|
|
|
|
|
|
|
#include <Uefi.h>
|
|
|
|
#include <Protocol/GraphicsOutput.h>
|
|
|
|
#include <Protocol/PciIo.h>
|
|
|
|
#include <Protocol/DriverSupportedEfiVersion.h>
|
|
|
|
#include <Protocol/DevicePath.h>
|
|
|
|
|
|
|
|
#include <Library/DebugLib.h>
|
|
|
|
#include <Library/UefiDriverEntryPoint.h>
|
|
|
|
#include <Library/UefiLib.h>
|
|
|
|
#include <Library/PcdLib.h>
|
|
|
|
#include <Library/MemoryAllocationLib.h>
|
|
|
|
#include <Library/UefiBootServicesTableLib.h>
|
|
|
|
#include <Library/BaseMemoryLib.h>
|
|
|
|
#include <Library/DevicePathLib.h>
|
|
|
|
#include <Library/TimerLib.h>
|
2016-10-11 07:26:27 +02:00
|
|
|
#include <Library/FrameBufferBltLib.h>
|
2011-04-12 17:08:51 +02:00
|
|
|
|
|
|
|
#include <IndustryStandard/Pci.h>
|
2016-10-11 07:26:27 +02:00
|
|
|
#include <IndustryStandard/Acpi.h>
|
2011-04-12 17:08:51 +02:00
|
|
|
|
|
|
|
//
|
|
|
|
// QEMU Video PCI Configuration Header values
|
|
|
|
//
|
|
|
|
#define CIRRUS_LOGIC_VENDOR_ID 0x1013
|
|
|
|
#define CIRRUS_LOGIC_5430_DEVICE_ID 0x00a8
|
|
|
|
#define CIRRUS_LOGIC_5430_ALTERNATE_DEVICE_ID 0x00a0
|
|
|
|
#define CIRRUS_LOGIC_5446_DEVICE_ID 0x00b8
|
|
|
|
|
|
|
|
//
|
|
|
|
// QEMU Vide Graphical Mode Data
|
|
|
|
//
|
|
|
|
typedef struct {
|
2014-03-03 09:40:59 +01:00
|
|
|
UINT32 InternalModeIndex; // points into card-specific mode table
|
2011-04-12 17:08:51 +02:00
|
|
|
UINT32 HorizontalResolution;
|
|
|
|
UINT32 VerticalResolution;
|
|
|
|
UINT32 ColorDepth;
|
|
|
|
} QEMU_VIDEO_MODE_DATA;
|
|
|
|
|
|
|
|
#define PIXEL_RED_SHIFT 0
|
|
|
|
#define PIXEL_GREEN_SHIFT 3
|
|
|
|
#define PIXEL_BLUE_SHIFT 6
|
|
|
|
|
|
|
|
#define PIXEL_RED_MASK (BIT7 | BIT6 | BIT5)
|
|
|
|
#define PIXEL_GREEN_MASK (BIT4 | BIT3 | BIT2)
|
|
|
|
#define PIXEL_BLUE_MASK (BIT1 | BIT0)
|
|
|
|
|
|
|
|
#define PIXEL_TO_COLOR_BYTE(pixel, mask, shift) ((UINT8) ((pixel & mask) << shift))
|
|
|
|
#define PIXEL_TO_RED_BYTE(pixel) PIXEL_TO_COLOR_BYTE(pixel, PIXEL_RED_MASK, PIXEL_RED_SHIFT)
|
|
|
|
#define PIXEL_TO_GREEN_BYTE(pixel) PIXEL_TO_COLOR_BYTE(pixel, PIXEL_GREEN_MASK, PIXEL_GREEN_SHIFT)
|
|
|
|
#define PIXEL_TO_BLUE_BYTE(pixel) PIXEL_TO_COLOR_BYTE(pixel, PIXEL_BLUE_MASK, PIXEL_BLUE_SHIFT)
|
|
|
|
|
|
|
|
#define RGB_BYTES_TO_PIXEL(Red, Green, Blue) \
|
|
|
|
(UINT8) ( (((Red) >> PIXEL_RED_SHIFT) & PIXEL_RED_MASK) | \
|
|
|
|
(((Green) >> PIXEL_GREEN_SHIFT) & PIXEL_GREEN_MASK) | \
|
|
|
|
(((Blue) >> PIXEL_BLUE_SHIFT) & PIXEL_BLUE_MASK) )
|
|
|
|
|
|
|
|
#define PIXEL24_RED_MASK 0x00ff0000
|
|
|
|
#define PIXEL24_GREEN_MASK 0x0000ff00
|
|
|
|
#define PIXEL24_BLUE_MASK 0x000000ff
|
|
|
|
|
|
|
|
#define GRAPHICS_OUTPUT_INVALIDE_MODE_NUMBER 0xffff
|
|
|
|
|
|
|
|
//
|
|
|
|
// QEMU Video Private Data Structure
|
|
|
|
//
|
|
|
|
#define QEMU_VIDEO_PRIVATE_DATA_SIGNATURE SIGNATURE_32 ('Q', 'V', 'I', 'D')
|
|
|
|
|
2012-11-27 20:11:11 +01:00
|
|
|
typedef enum {
|
|
|
|
QEMU_VIDEO_CIRRUS_5430 = 1,
|
|
|
|
QEMU_VIDEO_CIRRUS_5446,
|
2012-11-27 20:11:29 +01:00
|
|
|
QEMU_VIDEO_BOCHS,
|
2012-11-27 20:11:45 +01:00
|
|
|
QEMU_VIDEO_BOCHS_MMIO,
|
2017-04-07 08:25:58 +02:00
|
|
|
QEMU_VIDEO_VMWARE_SVGA,
|
2012-11-27 20:11:11 +01:00
|
|
|
} QEMU_VIDEO_VARIANT;
|
|
|
|
|
|
|
|
typedef struct {
|
2018-05-17 11:21:32 +02:00
|
|
|
UINT8 SubClass;
|
2012-11-27 20:11:11 +01:00
|
|
|
UINT16 VendorId;
|
|
|
|
UINT16 DeviceId;
|
|
|
|
QEMU_VIDEO_VARIANT Variant;
|
|
|
|
CHAR16 *Name;
|
|
|
|
} QEMU_VIDEO_CARD;
|
|
|
|
|
2011-04-12 17:08:51 +02:00
|
|
|
typedef struct {
|
|
|
|
UINT64 Signature;
|
|
|
|
EFI_HANDLE Handle;
|
|
|
|
EFI_PCI_IO_PROTOCOL *PciIo;
|
|
|
|
UINT64 OriginalPciAttributes;
|
|
|
|
EFI_GRAPHICS_OUTPUT_PROTOCOL GraphicsOutput;
|
|
|
|
EFI_DEVICE_PATH_PROTOCOL *GopDevicePath;
|
2014-03-03 09:40:59 +01:00
|
|
|
|
|
|
|
//
|
2016-10-12 10:28:09 +02:00
|
|
|
// The next two fields match the client-visible
|
|
|
|
// EFI_GRAPHICS_OUTPUT_PROTOCOL_MODE.MaxMode field.
|
2014-03-03 09:40:59 +01:00
|
|
|
//
|
2011-04-12 17:08:51 +02:00
|
|
|
UINTN MaxMode;
|
|
|
|
QEMU_VIDEO_MODE_DATA *ModeData;
|
2017-04-07 08:25:58 +02:00
|
|
|
EFI_GRAPHICS_OUTPUT_MODE_INFORMATION *VmwareSvgaModeInfo;
|
2014-03-03 09:40:59 +01:00
|
|
|
|
2012-11-27 20:11:11 +01:00
|
|
|
QEMU_VIDEO_VARIANT Variant;
|
2016-10-11 07:26:27 +02:00
|
|
|
FRAME_BUFFER_CONFIGURE *FrameBufferBltConfigure;
|
|
|
|
UINTN FrameBufferBltConfigureSize;
|
2017-04-07 08:25:58 +02:00
|
|
|
UINT8 FrameBufferVramBarIndex;
|
|
|
|
UINT16 VmwareSvgaBasePort;
|
2011-04-12 17:08:51 +02:00
|
|
|
} QEMU_VIDEO_PRIVATE_DATA;
|
|
|
|
|
|
|
|
///
|
2014-03-03 09:40:59 +01:00
|
|
|
/// Card-specific Video Mode structures
|
2011-04-12 17:08:51 +02:00
|
|
|
///
|
|
|
|
typedef struct {
|
|
|
|
UINT32 Width;
|
|
|
|
UINT32 Height;
|
|
|
|
UINT32 ColorDepth;
|
|
|
|
UINT8 *CrtcSettings;
|
|
|
|
UINT16 *SeqSettings;
|
|
|
|
UINT8 MiscSetting;
|
2012-11-27 20:11:11 +01:00
|
|
|
} QEMU_VIDEO_CIRRUS_MODES;
|
2011-04-12 17:08:51 +02:00
|
|
|
|
2012-11-27 20:11:29 +01:00
|
|
|
typedef struct {
|
|
|
|
UINT32 Width;
|
|
|
|
UINT32 Height;
|
|
|
|
UINT32 ColorDepth;
|
|
|
|
} QEMU_VIDEO_BOCHS_MODES;
|
|
|
|
|
2011-04-12 17:08:51 +02:00
|
|
|
#define QEMU_VIDEO_PRIVATE_DATA_FROM_GRAPHICS_OUTPUT_THIS(a) \
|
|
|
|
CR(a, QEMU_VIDEO_PRIVATE_DATA, GraphicsOutput, QEMU_VIDEO_PRIVATE_DATA_SIGNATURE)
|
|
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
// Global Variables
|
|
|
|
//
|
|
|
|
extern UINT8 AttributeController[];
|
|
|
|
extern UINT8 GraphicsController[];
|
|
|
|
extern UINT8 Crtc_640_480_256_60[];
|
|
|
|
extern UINT16 Seq_640_480_256_60[];
|
|
|
|
extern UINT8 Crtc_800_600_256_60[];
|
|
|
|
extern UINT16 Seq_800_600_256_60[];
|
|
|
|
extern UINT8 Crtc_1024_768_256_60[];
|
|
|
|
extern UINT16 Seq_1024_768_256_60[];
|
2012-11-27 20:11:11 +01:00
|
|
|
extern QEMU_VIDEO_CIRRUS_MODES QemuVideoCirrusModes[];
|
2012-11-27 20:11:29 +01:00
|
|
|
extern QEMU_VIDEO_BOCHS_MODES QemuVideoBochsModes[];
|
2011-04-12 17:08:51 +02:00
|
|
|
extern EFI_DRIVER_BINDING_PROTOCOL gQemuVideoDriverBinding;
|
|
|
|
extern EFI_COMPONENT_NAME_PROTOCOL gQemuVideoComponentName;
|
|
|
|
extern EFI_COMPONENT_NAME2_PROTOCOL gQemuVideoComponentName2;
|
|
|
|
extern EFI_DRIVER_SUPPORTED_EFI_VERSION_PROTOCOL gQemuVideoDriverSupportedEfiVersion;
|
|
|
|
|
|
|
|
//
|
|
|
|
// Io Registers defined by VGA
|
|
|
|
//
|
|
|
|
#define CRTC_ADDRESS_REGISTER 0x3d4
|
|
|
|
#define CRTC_DATA_REGISTER 0x3d5
|
|
|
|
#define SEQ_ADDRESS_REGISTER 0x3c4
|
|
|
|
#define SEQ_DATA_REGISTER 0x3c5
|
|
|
|
#define GRAPH_ADDRESS_REGISTER 0x3ce
|
|
|
|
#define GRAPH_DATA_REGISTER 0x3cf
|
|
|
|
#define ATT_ADDRESS_REGISTER 0x3c0
|
|
|
|
#define MISC_OUTPUT_REGISTER 0x3c2
|
|
|
|
#define INPUT_STATUS_1_REGISTER 0x3da
|
|
|
|
#define DAC_PIXEL_MASK_REGISTER 0x3c6
|
|
|
|
#define PALETTE_INDEX_REGISTER 0x3c8
|
|
|
|
#define PALETTE_DATA_REGISTER 0x3c9
|
|
|
|
|
2012-11-27 20:11:29 +01:00
|
|
|
#define VBE_DISPI_IOPORT_INDEX 0x01CE
|
|
|
|
#define VBE_DISPI_IOPORT_DATA 0x01D0
|
|
|
|
|
|
|
|
#define VBE_DISPI_INDEX_ID 0x0
|
|
|
|
#define VBE_DISPI_INDEX_XRES 0x1
|
|
|
|
#define VBE_DISPI_INDEX_YRES 0x2
|
|
|
|
#define VBE_DISPI_INDEX_BPP 0x3
|
|
|
|
#define VBE_DISPI_INDEX_ENABLE 0x4
|
|
|
|
#define VBE_DISPI_INDEX_BANK 0x5
|
|
|
|
#define VBE_DISPI_INDEX_VIRT_WIDTH 0x6
|
|
|
|
#define VBE_DISPI_INDEX_VIRT_HEIGHT 0x7
|
|
|
|
#define VBE_DISPI_INDEX_X_OFFSET 0x8
|
|
|
|
#define VBE_DISPI_INDEX_Y_OFFSET 0x9
|
|
|
|
#define VBE_DISPI_INDEX_VIDEO_MEMORY_64K 0xa
|
|
|
|
|
|
|
|
#define VBE_DISPI_ID0 0xB0C0
|
|
|
|
#define VBE_DISPI_ID1 0xB0C1
|
|
|
|
#define VBE_DISPI_ID2 0xB0C2
|
|
|
|
#define VBE_DISPI_ID3 0xB0C3
|
|
|
|
#define VBE_DISPI_ID4 0xB0C4
|
|
|
|
#define VBE_DISPI_ID5 0xB0C5
|
|
|
|
|
|
|
|
#define VBE_DISPI_DISABLED 0x00
|
|
|
|
#define VBE_DISPI_ENABLED 0x01
|
|
|
|
#define VBE_DISPI_GETCAPS 0x02
|
|
|
|
#define VBE_DISPI_8BIT_DAC 0x20
|
|
|
|
#define VBE_DISPI_LFB_ENABLED 0x40
|
|
|
|
#define VBE_DISPI_NOCLEARMEM 0x80
|
2011-04-12 17:08:51 +02:00
|
|
|
|
|
|
|
//
|
|
|
|
// Graphics Output Hardware abstraction internal worker functions
|
|
|
|
//
|
|
|
|
EFI_STATUS
|
|
|
|
QemuVideoGraphicsOutputConstructor (
|
|
|
|
QEMU_VIDEO_PRIVATE_DATA *Private
|
|
|
|
);
|
|
|
|
|
|
|
|
EFI_STATUS
|
|
|
|
QemuVideoGraphicsOutputDestructor (
|
|
|
|
QEMU_VIDEO_PRIVATE_DATA *Private
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
// EFI_DRIVER_BINDING_PROTOCOL Protocol Interface
|
|
|
|
//
|
|
|
|
/**
|
|
|
|
TODO: Add function description
|
|
|
|
|
|
|
|
@param This TODO: add argument description
|
|
|
|
@param Controller TODO: add argument description
|
|
|
|
@param RemainingDevicePath TODO: add argument description
|
|
|
|
|
|
|
|
TODO: add return values
|
|
|
|
|
|
|
|
**/
|
|
|
|
EFI_STATUS
|
|
|
|
EFIAPI
|
|
|
|
QemuVideoControllerDriverSupported (
|
|
|
|
IN EFI_DRIVER_BINDING_PROTOCOL *This,
|
|
|
|
IN EFI_HANDLE Controller,
|
|
|
|
IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
|
|
|
|
);
|
|
|
|
|
|
|
|
/**
|
|
|
|
TODO: Add function description
|
|
|
|
|
|
|
|
@param This TODO: add argument description
|
|
|
|
@param Controller TODO: add argument description
|
|
|
|
@param RemainingDevicePath TODO: add argument description
|
|
|
|
|
|
|
|
TODO: add return values
|
|
|
|
|
|
|
|
**/
|
|
|
|
EFI_STATUS
|
|
|
|
EFIAPI
|
|
|
|
QemuVideoControllerDriverStart (
|
|
|
|
IN EFI_DRIVER_BINDING_PROTOCOL *This,
|
|
|
|
IN EFI_HANDLE Controller,
|
|
|
|
IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
|
|
|
|
);
|
|
|
|
|
|
|
|
/**
|
|
|
|
TODO: Add function description
|
|
|
|
|
|
|
|
@param This TODO: add argument description
|
|
|
|
@param Controller TODO: add argument description
|
|
|
|
@param NumberOfChildren TODO: add argument description
|
|
|
|
@param ChildHandleBuffer TODO: add argument description
|
|
|
|
|
|
|
|
TODO: add return values
|
|
|
|
|
|
|
|
**/
|
|
|
|
EFI_STATUS
|
|
|
|
EFIAPI
|
|
|
|
QemuVideoControllerDriverStop (
|
|
|
|
IN EFI_DRIVER_BINDING_PROTOCOL *This,
|
|
|
|
IN EFI_HANDLE Controller,
|
|
|
|
IN UINTN NumberOfChildren,
|
|
|
|
IN EFI_HANDLE *ChildHandleBuffer
|
|
|
|
);
|
|
|
|
|
|
|
|
//
|
|
|
|
// EFI Component Name Functions
|
|
|
|
//
|
|
|
|
/**
|
|
|
|
Retrieves a Unicode string that is the user readable name of the driver.
|
|
|
|
|
|
|
|
This function retrieves the user readable name of a driver in the form of a
|
|
|
|
Unicode string. If the driver specified by This has a user readable name in
|
|
|
|
the language specified by Language, then a pointer to the driver name is
|
|
|
|
returned in DriverName, and EFI_SUCCESS is returned. If the driver specified
|
|
|
|
by This does not support the language specified by Language,
|
|
|
|
then EFI_UNSUPPORTED is returned.
|
|
|
|
|
|
|
|
@param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or
|
|
|
|
EFI_COMPONENT_NAME_PROTOCOL instance.
|
|
|
|
|
|
|
|
@param Language[in] A pointer to a Null-terminated ASCII string
|
|
|
|
array indicating the language. This is the
|
|
|
|
language of the driver name that the caller is
|
|
|
|
requesting, and it must match one of the
|
|
|
|
languages specified in SupportedLanguages. The
|
|
|
|
number of languages supported by a driver is up
|
|
|
|
to the driver writer. Language is specified
|
|
|
|
in RFC 4646 or ISO 639-2 language code format.
|
|
|
|
|
|
|
|
@param DriverName[out] A pointer to the Unicode string to return.
|
|
|
|
This Unicode string is the name of the
|
|
|
|
driver specified by This in the language
|
|
|
|
specified by Language.
|
|
|
|
|
|
|
|
@retval EFI_SUCCESS The Unicode string for the Driver specified by
|
|
|
|
This and the language specified by Language was
|
|
|
|
returned in DriverName.
|
|
|
|
|
|
|
|
@retval EFI_INVALID_PARAMETER Language is NULL.
|
|
|
|
|
|
|
|
@retval EFI_INVALID_PARAMETER DriverName is NULL.
|
|
|
|
|
|
|
|
@retval EFI_UNSUPPORTED The driver specified by This does not support
|
|
|
|
the language specified by Language.
|
|
|
|
|
|
|
|
**/
|
|
|
|
EFI_STATUS
|
|
|
|
EFIAPI
|
|
|
|
QemuVideoComponentNameGetDriverName (
|
|
|
|
IN EFI_COMPONENT_NAME_PROTOCOL *This,
|
|
|
|
IN CHAR8 *Language,
|
|
|
|
OUT CHAR16 **DriverName
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
Retrieves a Unicode string that is the user readable name of the controller
|
|
|
|
that is being managed by a driver.
|
|
|
|
|
|
|
|
This function retrieves the user readable name of the controller specified by
|
|
|
|
ControllerHandle and ChildHandle in the form of a Unicode string. If the
|
|
|
|
driver specified by This has a user readable name in the language specified by
|
|
|
|
Language, then a pointer to the controller name is returned in ControllerName,
|
|
|
|
and EFI_SUCCESS is returned. If the driver specified by This is not currently
|
|
|
|
managing the controller specified by ControllerHandle and ChildHandle,
|
|
|
|
then EFI_UNSUPPORTED is returned. If the driver specified by This does not
|
|
|
|
support the language specified by Language, then EFI_UNSUPPORTED is returned.
|
|
|
|
|
|
|
|
@param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or
|
|
|
|
EFI_COMPONENT_NAME_PROTOCOL instance.
|
|
|
|
|
|
|
|
@param ControllerHandle[in] The handle of a controller that the driver
|
|
|
|
specified by This is managing. This handle
|
|
|
|
specifies the controller whose name is to be
|
|
|
|
returned.
|
|
|
|
|
|
|
|
@param ChildHandle[in] The handle of the child controller to retrieve
|
|
|
|
the name of. This is an optional parameter that
|
|
|
|
may be NULL. It will be NULL for device
|
|
|
|
drivers. It will also be NULL for a bus drivers
|
|
|
|
that wish to retrieve the name of the bus
|
|
|
|
controller. It will not be NULL for a bus
|
|
|
|
driver that wishes to retrieve the name of a
|
|
|
|
child controller.
|
|
|
|
|
|
|
|
@param Language[in] A pointer to a Null-terminated ASCII string
|
|
|
|
array indicating the language. This is the
|
|
|
|
language of the driver name that the caller is
|
|
|
|
requesting, and it must match one of the
|
|
|
|
languages specified in SupportedLanguages. The
|
|
|
|
number of languages supported by a driver is up
|
|
|
|
to the driver writer. Language is specified in
|
|
|
|
RFC 4646 or ISO 639-2 language code format.
|
|
|
|
|
|
|
|
@param ControllerName[out] A pointer to the Unicode string to return.
|
|
|
|
This Unicode string is the name of the
|
|
|
|
controller specified by ControllerHandle and
|
|
|
|
ChildHandle in the language specified by
|
|
|
|
Language from the point of view of the driver
|
|
|
|
specified by This.
|
|
|
|
|
|
|
|
@retval EFI_SUCCESS The Unicode string for the user readable name in
|
|
|
|
the language specified by Language for the
|
|
|
|
driver specified by This was returned in
|
|
|
|
DriverName.
|
|
|
|
|
|
|
|
@retval EFI_INVALID_PARAMETER ControllerHandle is not a valid EFI_HANDLE.
|
|
|
|
|
|
|
|
@retval EFI_INVALID_PARAMETER ChildHandle is not NULL and it is not a valid
|
|
|
|
EFI_HANDLE.
|
|
|
|
|
|
|
|
@retval EFI_INVALID_PARAMETER Language is NULL.
|
|
|
|
|
|
|
|
@retval EFI_INVALID_PARAMETER ControllerName is NULL.
|
|
|
|
|
|
|
|
@retval EFI_UNSUPPORTED The driver specified by This is not currently
|
|
|
|
managing the controller specified by
|
|
|
|
ControllerHandle and ChildHandle.
|
|
|
|
|
|
|
|
@retval EFI_UNSUPPORTED The driver specified by This does not support
|
|
|
|
the language specified by Language.
|
|
|
|
|
|
|
|
**/
|
|
|
|
EFI_STATUS
|
|
|
|
EFIAPI
|
|
|
|
QemuVideoComponentNameGetControllerName (
|
|
|
|
IN EFI_COMPONENT_NAME_PROTOCOL *This,
|
|
|
|
IN EFI_HANDLE ControllerHandle,
|
|
|
|
IN EFI_HANDLE ChildHandle OPTIONAL,
|
|
|
|
IN CHAR8 *Language,
|
|
|
|
OUT CHAR16 **ControllerName
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
// Local Function Prototypes
|
|
|
|
//
|
|
|
|
VOID
|
2012-11-27 20:11:11 +01:00
|
|
|
InitializeCirrusGraphicsMode (
|
2011-04-12 17:08:51 +02:00
|
|
|
QEMU_VIDEO_PRIVATE_DATA *Private,
|
2012-11-27 20:11:11 +01:00
|
|
|
QEMU_VIDEO_CIRRUS_MODES *ModeData
|
2011-04-12 17:08:51 +02:00
|
|
|
);
|
|
|
|
|
2012-11-27 20:11:29 +01:00
|
|
|
VOID
|
|
|
|
InitializeBochsGraphicsMode (
|
|
|
|
QEMU_VIDEO_PRIVATE_DATA *Private,
|
|
|
|
QEMU_VIDEO_BOCHS_MODES *ModeData
|
|
|
|
);
|
|
|
|
|
2011-04-12 17:08:51 +02:00
|
|
|
VOID
|
|
|
|
SetPaletteColor (
|
|
|
|
QEMU_VIDEO_PRIVATE_DATA *Private,
|
|
|
|
UINTN Index,
|
|
|
|
UINT8 Red,
|
|
|
|
UINT8 Green,
|
|
|
|
UINT8 Blue
|
|
|
|
);
|
|
|
|
|
|
|
|
VOID
|
|
|
|
SetDefaultPalette (
|
|
|
|
QEMU_VIDEO_PRIVATE_DATA *Private
|
|
|
|
);
|
|
|
|
|
|
|
|
VOID
|
|
|
|
DrawLogo (
|
|
|
|
QEMU_VIDEO_PRIVATE_DATA *Private,
|
|
|
|
UINTN ScreenWidth,
|
|
|
|
UINTN ScreenHeight
|
|
|
|
);
|
|
|
|
|
|
|
|
VOID
|
|
|
|
outb (
|
|
|
|
QEMU_VIDEO_PRIVATE_DATA *Private,
|
|
|
|
UINTN Address,
|
|
|
|
UINT8 Data
|
|
|
|
);
|
|
|
|
|
|
|
|
VOID
|
|
|
|
outw (
|
|
|
|
QEMU_VIDEO_PRIVATE_DATA *Private,
|
|
|
|
UINTN Address,
|
|
|
|
UINT16 Data
|
|
|
|
);
|
|
|
|
|
|
|
|
UINT8
|
|
|
|
inb (
|
|
|
|
QEMU_VIDEO_PRIVATE_DATA *Private,
|
|
|
|
UINTN Address
|
|
|
|
);
|
|
|
|
|
|
|
|
UINT16
|
|
|
|
inw (
|
|
|
|
QEMU_VIDEO_PRIVATE_DATA *Private,
|
|
|
|
UINTN Address
|
|
|
|
);
|
|
|
|
|
2012-11-27 20:11:29 +01:00
|
|
|
VOID
|
|
|
|
BochsWrite (
|
|
|
|
QEMU_VIDEO_PRIVATE_DATA *Private,
|
|
|
|
UINT16 Reg,
|
|
|
|
UINT16 Data
|
|
|
|
);
|
|
|
|
|
|
|
|
UINT16
|
|
|
|
BochsRead (
|
|
|
|
QEMU_VIDEO_PRIVATE_DATA *Private,
|
|
|
|
UINT16 Reg
|
|
|
|
);
|
|
|
|
|
2012-11-27 20:11:45 +01:00
|
|
|
VOID
|
|
|
|
VgaOutb (
|
|
|
|
QEMU_VIDEO_PRIVATE_DATA *Private,
|
|
|
|
UINTN Reg,
|
|
|
|
UINT8 Data
|
|
|
|
);
|
|
|
|
|
2011-04-12 17:08:51 +02:00
|
|
|
EFI_STATUS
|
2012-11-27 20:11:11 +01:00
|
|
|
QemuVideoCirrusModeSetup (
|
2011-04-12 17:08:51 +02:00
|
|
|
QEMU_VIDEO_PRIVATE_DATA *Private
|
|
|
|
);
|
|
|
|
|
2012-11-27 20:11:29 +01:00
|
|
|
EFI_STATUS
|
|
|
|
QemuVideoBochsModeSetup (
|
OvmfPkg: QemuVideoDxe: work around misreported QXL framebuffer size
When setting up the list of GOP modes offered on QEMU's stdvga ("VGA") and
QXL ("qxl-vga") video devices, QemuVideoBochsModeSetup() filters those
modes against the available framebuffer size. (Refer to SVN r15288 / git
commit ec88061e.)
The VBE_DISPI_INDEX_VIDEO_MEMORY_64K register of both stdvga and QXL is
supposed to report the size of the drawable, VGA-compatibility
framebuffer. Instead, up to and including qemu-2.1, this register actually
reports the full video RAM (PCI BAR 0) size.
In case of stdvga, this happens to be correct, because on that card the
full PCI BAR 0 is usable for drawing; there is no difference between
"drawable framebuffer size" and "video RAM (PCI BAR 0) size".
However, on the QXL card, only an initial portion of the video RAM is
suitable for drawing, as compatibility framebuffer; and the value
currently reported by VBE_DISPI_INDEX_VIDEO_MEMORY_64K overshoots the
valid size. Beyond the drawable range, the video RAM contains buffers and
structures for the QXL guest-host protocol.
Luckily, the size of the drawable QXL framebuffer can also be read from a
register in the QXL ROM BAR (PCI BAR 2), so let's retrieve it from there.
Without this fix, OVMF offers too large resolutions on the QXL card (up to
the full size of the video RAM). If a GOP client selects such a resolution
and draws into the video RAM past the compatibility segment, then the
guest corrupts its communication structures (which is invalid guest
behavior).
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@15978 6f19259b-4bc3-4df7-8a09-765794883524
2014-08-29 19:27:20 +02:00
|
|
|
QEMU_VIDEO_PRIVATE_DATA *Private,
|
|
|
|
BOOLEAN IsQxl
|
2012-11-27 20:11:29 +01:00
|
|
|
);
|
|
|
|
|
2017-04-07 08:25:58 +02:00
|
|
|
EFI_STATUS
|
|
|
|
QemuVideoVmwareSvgaModeSetup (
|
|
|
|
QEMU_VIDEO_PRIVATE_DATA *Private
|
|
|
|
);
|
|
|
|
|
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
2014-05-20 18:33:00 +02:00
|
|
|
VOID
|
|
|
|
InstallVbeShim (
|
|
|
|
IN CONST CHAR16 *CardName,
|
|
|
|
IN EFI_PHYSICAL_ADDRESS FrameBufferBase
|
|
|
|
);
|
2017-04-07 08:25:58 +02:00
|
|
|
|
|
|
|
VOID
|
|
|
|
VmwareSvgaWrite (
|
|
|
|
QEMU_VIDEO_PRIVATE_DATA *Private,
|
|
|
|
UINT16 Register,
|
|
|
|
UINT32 Value
|
|
|
|
);
|
|
|
|
|
|
|
|
UINT32
|
|
|
|
VmwareSvgaRead (
|
|
|
|
QEMU_VIDEO_PRIVATE_DATA *Private,
|
|
|
|
UINT16 Register
|
|
|
|
);
|
|
|
|
|
|
|
|
VOID
|
|
|
|
InitializeVmwareSvgaGraphicsMode (
|
|
|
|
QEMU_VIDEO_PRIVATE_DATA *Private,
|
|
|
|
QEMU_VIDEO_BOCHS_MODES *ModeData
|
|
|
|
);
|
|
|
|
|
2011-04-12 17:08:51 +02:00
|
|
|
#endif
|