OvmfPkg/QemuVideoDxe: Add SubClass field to QEMU_VIDEO_CARD

Then check for PCI_CLASS_DISPLAY_VGA using the new field.
This allows to enable/disable non-vga display classes per
card entry.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
This commit is contained in:
Gerd Hoffmann 2018-05-17 11:21:32 +02:00 committed by Laszlo Ersek
parent b22d093101
commit 70dbd16361
2 changed files with 14 additions and 4 deletions

View File

@ -30,36 +30,43 @@ EFI_DRIVER_BINDING_PROTOCOL gQemuVideoDriverBinding = {
QEMU_VIDEO_CARD gQemuVideoCardList[] = { QEMU_VIDEO_CARD gQemuVideoCardList[] = {
{ {
PCI_CLASS_DISPLAY_VGA,
CIRRUS_LOGIC_VENDOR_ID, CIRRUS_LOGIC_VENDOR_ID,
CIRRUS_LOGIC_5430_DEVICE_ID, CIRRUS_LOGIC_5430_DEVICE_ID,
QEMU_VIDEO_CIRRUS_5430, QEMU_VIDEO_CIRRUS_5430,
L"Cirrus 5430" L"Cirrus 5430"
},{ },{
PCI_CLASS_DISPLAY_VGA,
CIRRUS_LOGIC_VENDOR_ID, CIRRUS_LOGIC_VENDOR_ID,
CIRRUS_LOGIC_5430_ALTERNATE_DEVICE_ID, CIRRUS_LOGIC_5430_ALTERNATE_DEVICE_ID,
QEMU_VIDEO_CIRRUS_5430, QEMU_VIDEO_CIRRUS_5430,
L"Cirrus 5430" L"Cirrus 5430"
},{ },{
PCI_CLASS_DISPLAY_VGA,
CIRRUS_LOGIC_VENDOR_ID, CIRRUS_LOGIC_VENDOR_ID,
CIRRUS_LOGIC_5446_DEVICE_ID, CIRRUS_LOGIC_5446_DEVICE_ID,
QEMU_VIDEO_CIRRUS_5446, QEMU_VIDEO_CIRRUS_5446,
L"Cirrus 5446" L"Cirrus 5446"
},{ },{
PCI_CLASS_DISPLAY_VGA,
0x1234, 0x1234,
0x1111, 0x1111,
QEMU_VIDEO_BOCHS_MMIO, QEMU_VIDEO_BOCHS_MMIO,
L"QEMU Standard VGA" L"QEMU Standard VGA"
},{ },{
PCI_CLASS_DISPLAY_VGA,
0x1b36, 0x1b36,
0x0100, 0x0100,
QEMU_VIDEO_BOCHS, QEMU_VIDEO_BOCHS,
L"QEMU QXL VGA" L"QEMU QXL VGA"
},{ },{
PCI_CLASS_DISPLAY_VGA,
0x1af4, 0x1af4,
0x1050, 0x1050,
QEMU_VIDEO_BOCHS_MMIO, QEMU_VIDEO_BOCHS_MMIO,
L"QEMU VirtIO VGA" L"QEMU VirtIO VGA"
},{ },{
PCI_CLASS_DISPLAY_VGA,
VMWARE_PCI_VENDOR_ID_VMWARE, VMWARE_PCI_VENDOR_ID_VMWARE,
VMWARE_PCI_DEVICE_ID_VMWARE_SVGA2, VMWARE_PCI_DEVICE_ID_VMWARE_SVGA2,
QEMU_VIDEO_VMWARE_SVGA, QEMU_VIDEO_VMWARE_SVGA,
@ -71,6 +78,7 @@ QEMU_VIDEO_CARD gQemuVideoCardList[] = {
static QEMU_VIDEO_CARD* static QEMU_VIDEO_CARD*
QemuVideoDetect( QemuVideoDetect(
IN UINT8 SubClass,
IN UINT16 VendorId, IN UINT16 VendorId,
IN UINT16 DeviceId IN UINT16 DeviceId
) )
@ -78,7 +86,8 @@ QemuVideoDetect(
UINTN Index = 0; UINTN Index = 0;
while (gQemuVideoCardList[Index].VendorId != 0) { while (gQemuVideoCardList[Index].VendorId != 0) {
if (gQemuVideoCardList[Index].VendorId == VendorId && if (gQemuVideoCardList[Index].SubClass == SubClass &&
gQemuVideoCardList[Index].VendorId == VendorId &&
gQemuVideoCardList[Index].DeviceId == DeviceId) { gQemuVideoCardList[Index].DeviceId == DeviceId) {
return gQemuVideoCardList + Index; return gQemuVideoCardList + Index;
} }
@ -141,10 +150,10 @@ QemuVideoControllerDriverSupported (
} }
Status = EFI_UNSUPPORTED; Status = EFI_UNSUPPORTED;
if (!IS_PCI_VGA (&Pci)) { if (!IS_PCI_DISPLAY (&Pci)) {
goto Done; goto Done;
} }
Card = QemuVideoDetect(Pci.Hdr.VendorId, Pci.Hdr.DeviceId); Card = QemuVideoDetect(Pci.Hdr.ClassCode[1], Pci.Hdr.VendorId, Pci.Hdr.DeviceId);
if (Card != NULL) { if (Card != NULL) {
DEBUG ((EFI_D_INFO, "QemuVideo: %s detected\n", Card->Name)); DEBUG ((EFI_D_INFO, "QemuVideo: %s detected\n", Card->Name));
Status = EFI_SUCCESS; Status = EFI_SUCCESS;
@ -243,7 +252,7 @@ QemuVideoControllerDriverStart (
// //
// Determine card variant. // Determine card variant.
// //
Card = QemuVideoDetect(Pci.Hdr.VendorId, Pci.Hdr.DeviceId); Card = QemuVideoDetect(Pci.Hdr.ClassCode[1], Pci.Hdr.VendorId, Pci.Hdr.DeviceId);
if (Card == NULL) { if (Card == NULL) {
Status = EFI_DEVICE_ERROR; Status = EFI_DEVICE_ERROR;
goto ClosePciIo; goto ClosePciIo;

View File

@ -96,6 +96,7 @@ typedef enum {
} QEMU_VIDEO_VARIANT; } QEMU_VIDEO_VARIANT;
typedef struct { typedef struct {
UINT8 SubClass;
UINT16 VendorId; UINT16 VendorId;
UINT16 DeviceId; UINT16 DeviceId;
QEMU_VIDEO_VARIANT Variant; QEMU_VIDEO_VARIANT Variant;