public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [PATCH 1/2] OvmfPkg/QemuVideoDxe: Add SubClass field to QEMU_VIDEO_CARD
@ 2018-05-17  9:21 Gerd Hoffmann
  2018-05-17  9:21 ` [PATCH 2/2] OvmfPkg/QemuVideoDxe: Enable DISPLAY_OTHER pci class for qemu stdvga Gerd Hoffmann
  2018-05-17 11:02 ` [PATCH 1/2] OvmfPkg/QemuVideoDxe: Add SubClass field to QEMU_VIDEO_CARD Laszlo Ersek
  0 siblings, 2 replies; 3+ messages in thread
From: Gerd Hoffmann @ 2018-05-17  9:21 UTC (permalink / raw)
  To: edk2-devel

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>
---
 OvmfPkg/QemuVideoDxe/Qemu.h   |  1 +
 OvmfPkg/QemuVideoDxe/Driver.c | 17 +++++++++++++----
 2 files changed, 14 insertions(+), 4 deletions(-)

diff --git a/OvmfPkg/QemuVideoDxe/Qemu.h b/OvmfPkg/QemuVideoDxe/Qemu.h
index 7fbb25b3ef..bc49f867a4 100644
--- a/OvmfPkg/QemuVideoDxe/Qemu.h
+++ b/OvmfPkg/QemuVideoDxe/Qemu.h
@@ -96,6 +96,7 @@ typedef enum {
 } QEMU_VIDEO_VARIANT;
 
 typedef struct {
+  UINT8                                 SubClass;
   UINT16                                VendorId;
   UINT16                                DeviceId;
   QEMU_VIDEO_VARIANT                    Variant;
diff --git a/OvmfPkg/QemuVideoDxe/Driver.c b/OvmfPkg/QemuVideoDxe/Driver.c
index 0dce80e59b..2d7ad43cb3 100644
--- a/OvmfPkg/QemuVideoDxe/Driver.c
+++ b/OvmfPkg/QemuVideoDxe/Driver.c
@@ -30,36 +30,43 @@ EFI_DRIVER_BINDING_PROTOCOL gQemuVideoDriverBinding = {
 
 QEMU_VIDEO_CARD gQemuVideoCardList[] = {
     {
+        PCI_CLASS_DISPLAY_VGA,
         CIRRUS_LOGIC_VENDOR_ID,
         CIRRUS_LOGIC_5430_DEVICE_ID,
         QEMU_VIDEO_CIRRUS_5430,
         L"Cirrus 5430"
     },{
+        PCI_CLASS_DISPLAY_VGA,
         CIRRUS_LOGIC_VENDOR_ID,
         CIRRUS_LOGIC_5430_ALTERNATE_DEVICE_ID,
         QEMU_VIDEO_CIRRUS_5430,
         L"Cirrus 5430"
     },{
+        PCI_CLASS_DISPLAY_VGA,
         CIRRUS_LOGIC_VENDOR_ID,
         CIRRUS_LOGIC_5446_DEVICE_ID,
         QEMU_VIDEO_CIRRUS_5446,
         L"Cirrus 5446"
     },{
+        PCI_CLASS_DISPLAY_VGA,
         0x1234,
         0x1111,
         QEMU_VIDEO_BOCHS_MMIO,
         L"QEMU Standard VGA"
     },{
+        PCI_CLASS_DISPLAY_VGA,
         0x1b36,
         0x0100,
         QEMU_VIDEO_BOCHS,
         L"QEMU QXL VGA"
     },{
+        PCI_CLASS_DISPLAY_VGA,
         0x1af4,
         0x1050,
         QEMU_VIDEO_BOCHS_MMIO,
         L"QEMU VirtIO VGA"
     },{
+        PCI_CLASS_DISPLAY_VGA,
         VMWARE_PCI_VENDOR_ID_VMWARE,
         VMWARE_PCI_DEVICE_ID_VMWARE_SVGA2,
         QEMU_VIDEO_VMWARE_SVGA,
@@ -71,6 +78,7 @@ QEMU_VIDEO_CARD gQemuVideoCardList[] = {
 
 static QEMU_VIDEO_CARD*
 QemuVideoDetect(
+  IN UINT8 SubClass,
   IN UINT16 VendorId,
   IN UINT16 DeviceId
   )
@@ -78,7 +86,8 @@ QemuVideoDetect(
   UINTN Index = 0;
 
   while (gQemuVideoCardList[Index].VendorId != 0) {
-    if (gQemuVideoCardList[Index].VendorId == VendorId &&
+    if (gQemuVideoCardList[Index].SubClass == SubClass &&
+        gQemuVideoCardList[Index].VendorId == VendorId &&
         gQemuVideoCardList[Index].DeviceId == DeviceId) {
       return gQemuVideoCardList + Index;
     }
@@ -141,10 +150,10 @@ QemuVideoControllerDriverSupported (
   }
 
   Status = EFI_UNSUPPORTED;
-  if (!IS_PCI_VGA (&Pci)) {
+  if (!IS_PCI_DISPLAY (&Pci)) {
     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) {
     DEBUG ((EFI_D_INFO, "QemuVideo: %s detected\n", Card->Name));
     Status = EFI_SUCCESS;
@@ -243,7 +252,7 @@ QemuVideoControllerDriverStart (
   //
   // 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) {
     Status = EFI_DEVICE_ERROR;
     goto ClosePciIo;
-- 
2.9.3



^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH 2/2] OvmfPkg/QemuVideoDxe: Enable DISPLAY_OTHER pci class for qemu stdvga
  2018-05-17  9:21 [PATCH 1/2] OvmfPkg/QemuVideoDxe: Add SubClass field to QEMU_VIDEO_CARD Gerd Hoffmann
@ 2018-05-17  9:21 ` Gerd Hoffmann
  2018-05-17 11:02 ` [PATCH 1/2] OvmfPkg/QemuVideoDxe: Add SubClass field to QEMU_VIDEO_CARD Laszlo Ersek
  1 sibling, 0 replies; 3+ messages in thread
From: Gerd Hoffmann @ 2018-05-17  9:21 UTC (permalink / raw)
  To: edk2-devel

This makes QemuVideo bind to the secondary-vga device.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 OvmfPkg/QemuVideoDxe/Driver.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/OvmfPkg/QemuVideoDxe/Driver.c b/OvmfPkg/QemuVideoDxe/Driver.c
index 2d7ad43cb3..73eb2cad05 100644
--- a/OvmfPkg/QemuVideoDxe/Driver.c
+++ b/OvmfPkg/QemuVideoDxe/Driver.c
@@ -54,6 +54,12 @@ QEMU_VIDEO_CARD gQemuVideoCardList[] = {
         QEMU_VIDEO_BOCHS_MMIO,
         L"QEMU Standard VGA"
     },{
+        PCI_CLASS_DISPLAY_OTHER,
+        0x1234,
+        0x1111,
+        QEMU_VIDEO_BOCHS_MMIO,
+        L"QEMU Standard VGA (secondary)"
+    },{
         PCI_CLASS_DISPLAY_VGA,
         0x1b36,
         0x0100,
-- 
2.9.3



^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH 1/2] OvmfPkg/QemuVideoDxe: Add SubClass field to QEMU_VIDEO_CARD
  2018-05-17  9:21 [PATCH 1/2] OvmfPkg/QemuVideoDxe: Add SubClass field to QEMU_VIDEO_CARD Gerd Hoffmann
  2018-05-17  9:21 ` [PATCH 2/2] OvmfPkg/QemuVideoDxe: Enable DISPLAY_OTHER pci class for qemu stdvga Gerd Hoffmann
@ 2018-05-17 11:02 ` Laszlo Ersek
  1 sibling, 0 replies; 3+ messages in thread
From: Laszlo Ersek @ 2018-05-17 11:02 UTC (permalink / raw)
  To: Gerd Hoffmann; +Cc: edk2-devel

On 05/17/18 11:21, Gerd Hoffmann wrote:
> 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>
> ---
>  OvmfPkg/QemuVideoDxe/Qemu.h   |  1 +
>  OvmfPkg/QemuVideoDxe/Driver.c | 17 +++++++++++++----
>  2 files changed, 14 insertions(+), 4 deletions(-)

series
Reviewed-by: Laszlo Ersek <lersek@redhat.com>

Commit range b22d093101b0..333f32ec23dd.

Thanks!
Laszlo


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2018-05-17 11:02 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-05-17  9:21 [PATCH 1/2] OvmfPkg/QemuVideoDxe: Add SubClass field to QEMU_VIDEO_CARD Gerd Hoffmann
2018-05-17  9:21 ` [PATCH 2/2] OvmfPkg/QemuVideoDxe: Enable DISPLAY_OTHER pci class for qemu stdvga Gerd Hoffmann
2018-05-17 11:02 ` [PATCH 1/2] OvmfPkg/QemuVideoDxe: Add SubClass field to QEMU_VIDEO_CARD Laszlo Ersek

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox