public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [PATCH 0/4] OvmfPkg: simply use the Bochs interface for vmsvga
@ 2018-10-24  6:40 yuchenlin
  2018-10-24  6:40 ` [PATCH 1/4] Revert "OvmfPkg/QemuVideoDxe: VMWare SVGA device support" yuchenlin
                   ` (4 more replies)
  0 siblings, 5 replies; 12+ messages in thread
From: yuchenlin @ 2018-10-24  6:40 UTC (permalink / raw)
  To: edk2-devel
  Cc: jordan.l.justen, lersek, ard.biesheuvel, anthony.perard,
	julien.grall, phil, kraxel, yuchenlin

From: yuchenlin <yuchenlin@synology.com>

In this series, replace the original vmsvga driver to Bochs
interface.

Simply revert vmsvga driver implementation. After it, use Bochs
interface for initializing vmsvga.

Because of the PCI BARs difference between std vga and vmsvga.
We can not simply recognize the "QEMU VMWare SVGA" as the
QEMU_VIDEO_BOCHS_MMIO variant.

BAR  |    std vga     |  vmsvga
---------------------------------
0    |   Framebuffer  | I/O space
1    |   Reserved     | Framebuffer
2    |   MMIO         | FIFO

To overcome this problem, we remain variant QEMU_VIDEO_VMWARE_SVGA,
and use it for:

(1) Get framebuffer from correct PCI BAR
(2) Prevent using BAR2 for MMIO

We have tested on qemu before and after commit 104bd1dc70 and all worked.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: yuchenlin <yuchenlin@synology.com>

yuchenlin (4):
  Revert "OvmfPkg/QemuVideoDxe: VMWare SVGA device support"
  Revert "OvmfPkg/QemuVideoDxe: Helper functions for unaligned port
    I/O."
  Revert "OvmfPkg/QemuVideoDxe: list "UnalignedIoInternal.h" in the INF
    file"
  OvmfPkg: simply use the Bochs interface for vmsvga

 OvmfPkg/QemuVideoDxe/Driver.c                 | 137 ++-------------
 OvmfPkg/QemuVideoDxe/Gop.c                    |  68 +-------
 OvmfPkg/QemuVideoDxe/Initialize.c             | 157 ------------------
 OvmfPkg/QemuVideoDxe/Qemu.h                   |  27 ---
 OvmfPkg/QemuVideoDxe/QemuVideoDxe.inf         |   7 -
 OvmfPkg/QemuVideoDxe/UnalignedIoGcc.c         |  70 --------
 OvmfPkg/QemuVideoDxe/UnalignedIoIcc.c         |  80 ---------
 OvmfPkg/QemuVideoDxe/UnalignedIoInternal.h    |  59 -------
 OvmfPkg/QemuVideoDxe/UnalignedIoMsc.c         |  78 ---------
 OvmfPkg/QemuVideoDxe/UnalignedIoUnsupported.c |  66 --------
 10 files changed, 17 insertions(+), 732 deletions(-)
 delete mode 100644 OvmfPkg/QemuVideoDxe/UnalignedIoGcc.c
 delete mode 100644 OvmfPkg/QemuVideoDxe/UnalignedIoIcc.c
 delete mode 100644 OvmfPkg/QemuVideoDxe/UnalignedIoInternal.h
 delete mode 100644 OvmfPkg/QemuVideoDxe/UnalignedIoMsc.c
 delete mode 100644 OvmfPkg/QemuVideoDxe/UnalignedIoUnsupported.c

-- 
2.18.0



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

* [PATCH 1/4] Revert "OvmfPkg/QemuVideoDxe: VMWare SVGA device support"
  2018-10-24  6:40 [PATCH 0/4] OvmfPkg: simply use the Bochs interface for vmsvga yuchenlin
@ 2018-10-24  6:40 ` yuchenlin
  2018-11-01 18:58   ` Philippe Mathieu-Daudé
  2018-10-24  6:40 ` [PATCH 2/4] Revert "OvmfPkg/QemuVideoDxe: Helper functions for unaligned port I/O." yuchenlin
                   ` (3 subsequent siblings)
  4 siblings, 1 reply; 12+ messages in thread
From: yuchenlin @ 2018-10-24  6:40 UTC (permalink / raw)
  To: edk2-devel
  Cc: jordan.l.justen, lersek, ard.biesheuvel, anthony.perard,
	julien.grall, phil, kraxel, yuchenlin

From: yuchenlin <yuchenlin@synology.com>

This reverts commit c137d95081690d4877fbeb5f1856972e84ac32f2.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: yuchenlin <yuchenlin@synology.com>
---
 OvmfPkg/QemuVideoDxe/Driver.c     | 135 +------------------------
 OvmfPkg/QemuVideoDxe/Gop.c        |  65 +------------
 OvmfPkg/QemuVideoDxe/Initialize.c | 157 ------------------------------
 OvmfPkg/QemuVideoDxe/Qemu.h       |  29 ------
 4 files changed, 7 insertions(+), 379 deletions(-)

diff --git a/OvmfPkg/QemuVideoDxe/Driver.c b/OvmfPkg/QemuVideoDxe/Driver.c
index 73eb2cad05..2304afd1e6 100644
--- a/OvmfPkg/QemuVideoDxe/Driver.c
+++ b/OvmfPkg/QemuVideoDxe/Driver.c
@@ -14,10 +14,8 @@
 
 **/
 
-#include <IndustryStandard/VmwareSvga.h>
-#include <IndustryStandard/Acpi.h>
 #include "Qemu.h"
-#include "UnalignedIoInternal.h"
+#include <IndustryStandard/Acpi.h>
 
 EFI_DRIVER_BINDING_PROTOCOL gQemuVideoDriverBinding = {
   QemuVideoControllerDriverSupported,
@@ -71,12 +69,6 @@ QEMU_VIDEO_CARD gQemuVideoCardList[] = {
         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,
-        L"QEMU VMWare SVGA"
     },{
         0 /* end of list */
     }
@@ -264,7 +256,6 @@ QemuVideoControllerDriverStart (
     goto ClosePciIo;
   }
   Private->Variant = Card->Variant;
-  Private->FrameBufferVramBarIndex = PCI_BAR_IDX0;
 
   //
   // IsQxl is based on the detected Card->Variant, which at a later point might
@@ -339,58 +330,6 @@ QemuVideoControllerDriverStart (
     }
   }
 
-  //
-  // Check if accessing Vmware SVGA interface works
-  //
-  if (Private->Variant == QEMU_VIDEO_VMWARE_SVGA) {
-    EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR *IoDesc;
-    UINT32                            TargetId;
-    UINT32                            SvgaIdRead;
-
-    IoDesc = NULL;
-    Status = Private->PciIo->GetBarAttributes (
-                               Private->PciIo,
-                               PCI_BAR_IDX0,
-                               NULL,
-                               (VOID**) &IoDesc
-                               );
-    if (EFI_ERROR (Status) ||
-        IoDesc->ResType != ACPI_ADDRESS_SPACE_TYPE_IO ||
-        IoDesc->AddrRangeMin > MAX_UINT16 + 1 - (VMWARE_SVGA_VALUE_PORT + 4)) {
-      if (IoDesc != NULL) {
-        FreePool (IoDesc);
-      }
-      Status = EFI_DEVICE_ERROR;
-      goto RestoreAttributes;
-    }
-    Private->VmwareSvgaBasePort = (UINT16) IoDesc->AddrRangeMin;
-    FreePool (IoDesc);
-
-    TargetId = VMWARE_SVGA_ID_2;
-    while (TRUE) {
-      VmwareSvgaWrite (Private, VmwareSvgaRegId, TargetId);
-      SvgaIdRead = VmwareSvgaRead (Private, VmwareSvgaRegId);
-      if ((SvgaIdRead == TargetId) || (TargetId <= VMWARE_SVGA_ID_0)) {
-        break;
-      }
-      TargetId--;
-    }
-
-    if (SvgaIdRead != TargetId) {
-      DEBUG ((
-        DEBUG_ERROR,
-        "QemuVideo: QEMU_VIDEO_VMWARE_SVGA ID mismatch "
-        "(got 0x%x, base address 0x%x)\n",
-        SvgaIdRead,
-        Private->VmwareSvgaBasePort
-        ));
-      Status = EFI_DEVICE_ERROR;
-      goto RestoreAttributes;
-    }
-
-    Private->FrameBufferVramBarIndex = PCI_BAR_IDX1;
-  }
-
   //
   // Get ParentDevicePath
   //
@@ -446,9 +385,6 @@ QemuVideoControllerDriverStart (
   case QEMU_VIDEO_BOCHS:
     Status = QemuVideoBochsModeSetup (Private, IsQxl);
     break;
-  case QEMU_VIDEO_VMWARE_SVGA:
-    Status = QemuVideoVmwareSvgaModeSetup (Private);
-    break;
   default:
     ASSERT (FALSE);
     Status = EFI_DEVICE_ERROR;
@@ -510,9 +446,6 @@ DestructQemuVideoGraphics:
 
 FreeModeData:
   FreePool (Private->ModeData);
-  if (Private->VmwareSvgaModeInfo != NULL) {
-    FreePool (Private->VmwareSvgaModeInfo);
-  }
 
 UninstallGopDevicePath:
   gBS->UninstallProtocolInterface (Private->Handle,
@@ -634,9 +567,6 @@ QemuVideoControllerDriverStop (
         );
 
   FreePool (Private->ModeData);
-  if (Private->VmwareSvgaModeInfo != NULL) {
-    FreePool (Private->VmwareSvgaModeInfo);
-  }
   gBS->UninstallProtocolInterface (Private->Handle,
          &gEfiDevicePathProtocolGuid, Private->GopDevicePath);
   FreePool (Private->GopDevicePath);
@@ -834,7 +764,7 @@ ClearScreen (
   Private->PciIo->Mem.Write (
                         Private->PciIo,
                         EfiPciIoWidthFillUint32,
-                        Private->FrameBufferVramBarIndex,
+                        0,
                         0,
                         0x400000 >> 2,
                         &Color
@@ -971,38 +901,6 @@ BochsRead (
   return Data;
 }
 
-VOID
-VmwareSvgaWrite (
-  QEMU_VIDEO_PRIVATE_DATA   *Private,
-  UINT16                    Register,
-  UINT32                    Value
-  )
-{
-  UnalignedIoWrite32 (
-    Private->VmwareSvgaBasePort + VMWARE_SVGA_INDEX_PORT,
-    Register
-    );
-  UnalignedIoWrite32 (
-    Private->VmwareSvgaBasePort + VMWARE_SVGA_VALUE_PORT,
-    Value
-    );
-}
-
-UINT32
-VmwareSvgaRead (
-  QEMU_VIDEO_PRIVATE_DATA   *Private,
-  UINT16                    Register
-  )
-{
-  UnalignedIoWrite32 (
-    Private->VmwareSvgaBasePort + VMWARE_SVGA_INDEX_PORT,
-    Register
-    );
-  return UnalignedIoRead32 (
-           Private->VmwareSvgaBasePort + VMWARE_SVGA_VALUE_PORT
-           );
-}
-
 VOID
 VgaOutb (
   QEMU_VIDEO_PRIVATE_DATA  *Private,
@@ -1057,35 +955,6 @@ InitializeBochsGraphicsMode (
   ClearScreen (Private);
 }
 
-VOID
-InitializeVmwareSvgaGraphicsMode (
-  QEMU_VIDEO_PRIVATE_DATA  *Private,
-  QEMU_VIDEO_BOCHS_MODES   *ModeData
-  )
-{
-  UINT32 Capabilities;
-
-  VmwareSvgaWrite (Private, VmwareSvgaRegWidth, ModeData->Width);
-  VmwareSvgaWrite (Private, VmwareSvgaRegHeight, ModeData->Height);
-
-  Capabilities = VmwareSvgaRead (
-                   Private,
-                   VmwareSvgaRegCapabilities
-                   );
-  if ((Capabilities & VMWARE_SVGA_CAP_8BIT_EMULATION) != 0) {
-    VmwareSvgaWrite (
-      Private,
-      VmwareSvgaRegBitsPerPixel,
-      ModeData->ColorDepth
-      );
-  }
-
-  VmwareSvgaWrite (Private, VmwareSvgaRegEnable, 1);
-
-  SetDefaultPalette (Private);
-  ClearScreen (Private);
-}
-
 EFI_STATUS
 EFIAPI
 InitializeQemuVideo (
diff --git a/OvmfPkg/QemuVideoDxe/Gop.c b/OvmfPkg/QemuVideoDxe/Gop.c
index c9941ef138..d490fa7a2e 100644
--- a/OvmfPkg/QemuVideoDxe/Gop.c
+++ b/OvmfPkg/QemuVideoDxe/Gop.c
@@ -13,7 +13,6 @@
 
 **/
 
-#include <IndustryStandard/VmwareSvga.h>
 #include "Qemu.h"
 
 STATIC
@@ -79,46 +78,6 @@ QemuVideoCompleteModeData (
   return EFI_SUCCESS;
 }
 
-STATIC
-EFI_STATUS
-QemuVideoVmwareSvgaCompleteModeData (
-  IN  QEMU_VIDEO_PRIVATE_DATA           *Private,
-  OUT EFI_GRAPHICS_OUTPUT_PROTOCOL_MODE *Mode
-  )
-{
-  EFI_STATUS                            Status;
-  EFI_GRAPHICS_OUTPUT_MODE_INFORMATION  *Info;
-  EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR     *FrameBufDesc;
-  UINT32                                BytesPerLine, FbOffset, BytesPerPixel;
-
-  Info = Mode->Info;
-  CopyMem (Info, &Private->VmwareSvgaModeInfo[Mode->Mode], sizeof (*Info));
-  BytesPerPixel = Private->ModeData[Mode->Mode].ColorDepth / 8;
-  BytesPerLine = Info->PixelsPerScanLine * BytesPerPixel;
-
-  FbOffset = VmwareSvgaRead (Private, VmwareSvgaRegFbOffset);
-
-  Status = Private->PciIo->GetBarAttributes (
-                             Private->PciIo,
-                             PCI_BAR_IDX1,
-                             NULL,
-                             (VOID**) &FrameBufDesc
-                             );
-  if (EFI_ERROR (Status)) {
-    return EFI_DEVICE_ERROR;
-  }
-
-  Mode->FrameBufferBase = FrameBufDesc->AddrRangeMin + FbOffset;
-  Mode->FrameBufferSize = BytesPerLine * Info->VerticalResolution;
-  Mode->FrameBufferSize = EFI_PAGES_TO_SIZE (
-                            EFI_SIZE_TO_PAGES (Mode->FrameBufferSize)
-                            );
-
-  FreePool (FrameBufDesc);
-  return Status;
-}
-
-
 //
 // Graphics Output Protocol Member Functions
 //
@@ -167,14 +126,10 @@ Routine Description:
 
   *SizeOfInfo = sizeof (EFI_GRAPHICS_OUTPUT_MODE_INFORMATION);
 
-  if (Private->Variant == QEMU_VIDEO_VMWARE_SVGA) {
-    CopyMem (*Info, &Private->VmwareSvgaModeInfo[ModeNumber], sizeof (**Info));
-  } else {
-    ModeData = &Private->ModeData[ModeNumber];
-    (*Info)->HorizontalResolution = ModeData->HorizontalResolution;
-    (*Info)->VerticalResolution   = ModeData->VerticalResolution;
-    QemuVideoCompleteModeInfo (ModeData, *Info);
-  }
+  ModeData = &Private->ModeData[ModeNumber];
+  (*Info)->HorizontalResolution = ModeData->HorizontalResolution;
+  (*Info)->VerticalResolution   = ModeData->VerticalResolution;
+  QemuVideoCompleteModeInfo (ModeData, *Info);
 
   return EFI_SUCCESS;
 }
@@ -224,12 +179,6 @@ Routine Description:
   case QEMU_VIDEO_BOCHS:
     InitializeBochsGraphicsMode (Private, &QemuVideoBochsModes[ModeData->InternalModeIndex]);
     break;
-  case QEMU_VIDEO_VMWARE_SVGA:
-    InitializeVmwareSvgaGraphicsMode (
-      Private,
-      &QemuVideoBochsModes[ModeData->InternalModeIndex]
-      );
-    break;
   default:
     ASSERT (FALSE);
     return EFI_DEVICE_ERROR;
@@ -240,11 +189,7 @@ Routine Description:
   This->Mode->Info->VerticalResolution = ModeData->VerticalResolution;
   This->Mode->SizeOfInfo = sizeof(EFI_GRAPHICS_OUTPUT_MODE_INFORMATION);
 
-  if (Private->Variant == QEMU_VIDEO_VMWARE_SVGA) {
-    QemuVideoVmwareSvgaCompleteModeData (Private, This->Mode);
-  } else {
-    QemuVideoCompleteModeData (Private, This->Mode);
-  }
+  QemuVideoCompleteModeData (Private, This->Mode);
 
   //
   // Re-initialize the frame buffer configure when mode changes.
diff --git a/OvmfPkg/QemuVideoDxe/Initialize.c b/OvmfPkg/QemuVideoDxe/Initialize.c
index 357124d628..d5d8cfef96 100644
--- a/OvmfPkg/QemuVideoDxe/Initialize.c
+++ b/OvmfPkg/QemuVideoDxe/Initialize.c
@@ -13,7 +13,6 @@
 
 **/
 
-#include <IndustryStandard/VmwareSvga.h>
 #include "Qemu.h"
 
 
@@ -347,159 +346,3 @@ QemuVideoBochsModeSetup (
   return EFI_SUCCESS;
 }
 
-EFI_STATUS
-QemuVideoVmwareSvgaModeSetup (
-  QEMU_VIDEO_PRIVATE_DATA *Private
-  )
-{
-  EFI_STATUS                            Status;
-  UINT32                                FbSize;
-  UINT32                                MaxWidth, MaxHeight;
-  UINT32                                Capabilities;
-  UINT32                                BitsPerPixel;
-  UINT32                                Index;
-  QEMU_VIDEO_MODE_DATA                  *ModeData;
-  QEMU_VIDEO_BOCHS_MODES                *VideoMode;
-  EFI_GRAPHICS_OUTPUT_MODE_INFORMATION  *ModeInfo;
-
-  VmwareSvgaWrite (Private, VmwareSvgaRegEnable, 0);
-
-  Private->ModeData =
-    AllocatePool (sizeof (Private->ModeData[0]) * QEMU_VIDEO_BOCHS_MODE_COUNT);
-  if (Private->ModeData == NULL) {
-    Status = EFI_OUT_OF_RESOURCES;
-    goto ModeDataAllocError;
-  }
-
-  Private->VmwareSvgaModeInfo =
-    AllocatePool (
-      sizeof (Private->VmwareSvgaModeInfo[0]) * QEMU_VIDEO_BOCHS_MODE_COUNT
-      );
-  if (Private->VmwareSvgaModeInfo == NULL) {
-    Status = EFI_OUT_OF_RESOURCES;
-    goto ModeInfoAllocError;
-  }
-
-  FbSize =       VmwareSvgaRead (Private, VmwareSvgaRegFbSize);
-  MaxWidth =     VmwareSvgaRead (Private, VmwareSvgaRegMaxWidth);
-  MaxHeight =    VmwareSvgaRead (Private, VmwareSvgaRegMaxHeight);
-  Capabilities = VmwareSvgaRead (Private, VmwareSvgaRegCapabilities);
-  if ((Capabilities & VMWARE_SVGA_CAP_8BIT_EMULATION) != 0) {
-    BitsPerPixel = VmwareSvgaRead (
-                     Private,
-                     VmwareSvgaRegHostBitsPerPixel
-                     );
-    VmwareSvgaWrite (
-      Private,
-      VmwareSvgaRegBitsPerPixel,
-      BitsPerPixel
-      );
-  } else {
-    BitsPerPixel = VmwareSvgaRead (
-                     Private,
-                     VmwareSvgaRegBitsPerPixel
-                     );
-  }
-
-  if (FbSize == 0       ||
-      MaxWidth == 0     ||
-      MaxHeight == 0    ||
-      BitsPerPixel == 0 ||
-      BitsPerPixel % 8 != 0) {
-    Status = EFI_DEVICE_ERROR;
-    goto Rollback;
-  }
-
-  ModeData = Private->ModeData;
-  ModeInfo = Private->VmwareSvgaModeInfo;
-  VideoMode = &QemuVideoBochsModes[0];
-  for (Index = 0; Index < QEMU_VIDEO_BOCHS_MODE_COUNT; Index++) {
-    UINTN RequiredFbSize;
-
-    RequiredFbSize = (UINTN) VideoMode->Width * VideoMode->Height *
-                     (BitsPerPixel / 8);
-    if (RequiredFbSize <= FbSize     &&
-        VideoMode->Width <= MaxWidth &&
-        VideoMode->Height <= MaxHeight) {
-      UINT32  BytesPerLine;
-      UINT32  RedMask, GreenMask, BlueMask, PixelMask;
-
-      VmwareSvgaWrite (
-        Private,
-        VmwareSvgaRegWidth,
-        VideoMode->Width
-        );
-      VmwareSvgaWrite (
-        Private,
-        VmwareSvgaRegHeight,
-        VideoMode->Height
-        );
-
-      ModeData->InternalModeIndex    = Index;
-      ModeData->HorizontalResolution = VideoMode->Width;
-      ModeData->VerticalResolution   = VideoMode->Height;
-      ModeData->ColorDepth           = BitsPerPixel;
-
-      //
-      // Setting VmwareSvgaRegWidth/VmwareSvgaRegHeight actually changes
-      // the device's display mode, so we save all properties of each mode up
-      // front to avoid inadvertent mode changes later.
-      //
-      ModeInfo->Version = 0;
-      ModeInfo->HorizontalResolution = ModeData->HorizontalResolution;
-      ModeInfo->VerticalResolution   = ModeData->VerticalResolution;
-
-      ModeInfo->PixelFormat = PixelBitMask;
-
-      RedMask   = VmwareSvgaRead (Private, VmwareSvgaRegRedMask);
-      ModeInfo->PixelInformation.RedMask = RedMask;
-
-      GreenMask = VmwareSvgaRead (Private, VmwareSvgaRegGreenMask);
-      ModeInfo->PixelInformation.GreenMask = GreenMask;
-
-      BlueMask  = VmwareSvgaRead (Private, VmwareSvgaRegBlueMask);
-      ModeInfo->PixelInformation.BlueMask = BlueMask;
-
-      //
-      // Reserved mask is whatever bits in the pixel not containing RGB data,
-      // so start with binary 1s for every bit in the pixel, then mask off
-      // bits already used for RGB. Special case 32 to avoid undefined
-      // behaviour in the shift.
-      //
-      if (BitsPerPixel == 32) {
-        if (BlueMask == 0xff && GreenMask == 0xff00 && RedMask == 0xff0000) {
-          ModeInfo->PixelFormat = PixelBlueGreenRedReserved8BitPerColor;
-        } else if (BlueMask == 0xff0000 &&
-                   GreenMask == 0xff00 &&
-                   RedMask == 0xff) {
-          ModeInfo->PixelFormat = PixelRedGreenBlueReserved8BitPerColor;
-        }
-        PixelMask = MAX_UINT32;
-      } else {
-        PixelMask = (1u << BitsPerPixel) - 1;
-      }
-      ModeInfo->PixelInformation.ReservedMask =
-        PixelMask & ~(RedMask | GreenMask | BlueMask);
-
-      BytesPerLine = VmwareSvgaRead (Private, VmwareSvgaRegBytesPerLine);
-      ModeInfo->PixelsPerScanLine = BytesPerLine / (BitsPerPixel / 8);
-
-      ModeData++;
-      ModeInfo++;
-    }
-    VideoMode++;
-  }
-  Private->MaxMode = ModeData - Private->ModeData;
-  return EFI_SUCCESS;
-
-Rollback:
-  FreePool (Private->VmwareSvgaModeInfo);
-  Private->VmwareSvgaModeInfo = NULL;
-
-ModeInfoAllocError:
-  FreePool (Private->ModeData);
-  Private->ModeData = NULL;
-
-ModeDataAllocError:
-  return Status;
-}
diff --git a/OvmfPkg/QemuVideoDxe/Qemu.h b/OvmfPkg/QemuVideoDxe/Qemu.h
index bc49f867a4..d7da761705 100644
--- a/OvmfPkg/QemuVideoDxe/Qemu.h
+++ b/OvmfPkg/QemuVideoDxe/Qemu.h
@@ -92,7 +92,6 @@ typedef enum {
   QEMU_VIDEO_CIRRUS_5446,
   QEMU_VIDEO_BOCHS,
   QEMU_VIDEO_BOCHS_MMIO,
-  QEMU_VIDEO_VMWARE_SVGA,
 } QEMU_VIDEO_VARIANT;
 
 typedef struct {
@@ -117,13 +116,10 @@ typedef struct {
   //
   UINTN                                 MaxMode;
   QEMU_VIDEO_MODE_DATA                  *ModeData;
-  EFI_GRAPHICS_OUTPUT_MODE_INFORMATION  *VmwareSvgaModeInfo;
 
   QEMU_VIDEO_VARIANT                    Variant;
   FRAME_BUFFER_CONFIGURE                *FrameBufferBltConfigure;
   UINTN                                 FrameBufferBltConfigureSize;
-  UINT8                                 FrameBufferVramBarIndex;
-  UINT16                                VmwareSvgaBasePort;
 } QEMU_VIDEO_PRIVATE_DATA;
 
 ///
@@ -507,34 +503,9 @@ QemuVideoBochsModeSetup (
   BOOLEAN                  IsQxl
   );
 
-EFI_STATUS
-QemuVideoVmwareSvgaModeSetup (
-  QEMU_VIDEO_PRIVATE_DATA *Private
-  );
-
 VOID
 InstallVbeShim (
   IN CONST CHAR16         *CardName,
   IN EFI_PHYSICAL_ADDRESS FrameBufferBase
   );
-
-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
-  );
-
 #endif
-- 
2.18.0



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

* [PATCH 2/4] Revert "OvmfPkg/QemuVideoDxe: Helper functions for unaligned port I/O."
  2018-10-24  6:40 [PATCH 0/4] OvmfPkg: simply use the Bochs interface for vmsvga yuchenlin
  2018-10-24  6:40 ` [PATCH 1/4] Revert "OvmfPkg/QemuVideoDxe: VMWare SVGA device support" yuchenlin
@ 2018-10-24  6:40 ` yuchenlin
  2018-10-24  6:40 ` [PATCH 3/4] Revert "OvmfPkg/QemuVideoDxe: list "UnalignedIoInternal.h" in the INF file" yuchenlin
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 12+ messages in thread
From: yuchenlin @ 2018-10-24  6:40 UTC (permalink / raw)
  To: edk2-devel
  Cc: jordan.l.justen, lersek, ard.biesheuvel, anthony.perard,
	julien.grall, phil, kraxel, yuchenlin

From: yuchenlin <yuchenlin@synology.com>

This reverts commit 05a5379458725234de8a05780fcb5da2c12680e4.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: yuchenlin <yuchenlin@synology.com>
---
 OvmfPkg/QemuVideoDxe/QemuVideoDxe.inf         |  6 --
 OvmfPkg/QemuVideoDxe/UnalignedIoGcc.c         | 70 ----------------
 OvmfPkg/QemuVideoDxe/UnalignedIoIcc.c         | 80 -------------------
 OvmfPkg/QemuVideoDxe/UnalignedIoInternal.h    | 59 --------------
 OvmfPkg/QemuVideoDxe/UnalignedIoMsc.c         | 78 ------------------
 OvmfPkg/QemuVideoDxe/UnalignedIoUnsupported.c | 66 ---------------
 6 files changed, 359 deletions(-)
 delete mode 100644 OvmfPkg/QemuVideoDxe/UnalignedIoGcc.c
 delete mode 100644 OvmfPkg/QemuVideoDxe/UnalignedIoIcc.c
 delete mode 100644 OvmfPkg/QemuVideoDxe/UnalignedIoInternal.h
 delete mode 100644 OvmfPkg/QemuVideoDxe/UnalignedIoMsc.c
 delete mode 100644 OvmfPkg/QemuVideoDxe/UnalignedIoUnsupported.c

diff --git a/OvmfPkg/QemuVideoDxe/QemuVideoDxe.inf b/OvmfPkg/QemuVideoDxe/QemuVideoDxe.inf
index a04ed537dd..c071fafa4e 100644
--- a/OvmfPkg/QemuVideoDxe/QemuVideoDxe.inf
+++ b/OvmfPkg/QemuVideoDxe/QemuVideoDxe.inf
@@ -42,15 +42,9 @@
   UnalignedIoInternal.h
 
 [Sources.Ia32, Sources.X64]
-  UnalignedIoGcc.c    | GCC
-  UnalignedIoIcc.c    | INTEL
-  UnalignedIoMsc.c    | MSFT
   VbeShim.c
   VbeShim.h
 
-[Sources.EBC]
-  UnalignedIoUnsupported.c
-
 [Packages]
   MdePkg/MdePkg.dec
   MdeModulePkg/MdeModulePkg.dec
diff --git a/OvmfPkg/QemuVideoDxe/UnalignedIoGcc.c b/OvmfPkg/QemuVideoDxe/UnalignedIoGcc.c
deleted file mode 100644
index 105d55d3b9..0000000000
--- a/OvmfPkg/QemuVideoDxe/UnalignedIoGcc.c
+++ /dev/null
@@ -1,70 +0,0 @@
-/** @file
-  Unaligned Port I/O. This file has compiler specifics for GCC as there is no
-  ANSI C standard for doing IO.
-
-  Based on IoLibGcc.c.
-
-  Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
-  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.
-
-**/
-
-
-#include "UnalignedIoInternal.h"
-
-/**
-  Performs a 32-bit write to the specified, possibly unaligned I/O-type
-  address.
-
-  Writes the 32-bit I/O port specified by Port with the value specified by
-  Value and returns Value. This function must guarantee that all I/O read and
-  write operations are serialized.
-
-  If 32-bit unaligned I/O port operations are not supported, then ASSERT().
-
-  @param[in]  Port   I/O port address
-  @param[in]  Value  32-bit word to write
-
-  @return The value written to the I/O port.
-
-**/
-UINT32
-UnalignedIoWrite32 (
-  IN      UINTN                     Port,
-  IN      UINT32                    Value
-  )
-{
-  __asm__ __volatile__ ( "outl %0, %1" : : "a" (Value), "d" ((UINT16)Port) );
-  return Value;
-}
-
-/**
-  Reads a 32-bit word from the specified, possibly unaligned I/O-type address.
-
-  Reads the 32-bit I/O port specified by Port. The 32-bit read value is
-  returned. This function must guarantee that all I/O read and write operations
-  are serialized.
-
-  If 32-bit unaligned I/O port operations are not supported, then ASSERT().
-
-  @param[in]  Port  The I/O port to read.
-
-  @return The value read.
-
-**/
-UINT32
-UnalignedIoRead32 (
-  IN      UINTN                     Port
-  )
-{
-  UINT32 Data;
-  __asm__ __volatile__ ( "inl %1, %0" : "=a" (Data) : "d" ((UINT16)Port) );
-  return Data;
-}
-
diff --git a/OvmfPkg/QemuVideoDxe/UnalignedIoIcc.c b/OvmfPkg/QemuVideoDxe/UnalignedIoIcc.c
deleted file mode 100644
index 79f3e446dd..0000000000
--- a/OvmfPkg/QemuVideoDxe/UnalignedIoIcc.c
+++ /dev/null
@@ -1,80 +0,0 @@
-/** @file
-  Unaligned port I/O. This file has compiler specifics for ICC as there
-  is no ANSI C standard for doing IO.
-
-  Based on IoLibIcc.c.
-
-  Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR>
-  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.
-
-**/
-
-
-#include "UnalignedIoInternal.h"
-
-/**
-  Performs a 32-bit write to the specified, possibly unaligned I/O-type
-  address.
-
-  Writes the 32-bit I/O port specified by Port with the value specified by
-  Value and returns Value. This function must guarantee that all I/O read and
-  write operations are serialized.
-
-  If 32-bit unaligned I/O port operations are not supported, then ASSERT().
-
-  @param[in]  Port   I/O port address
-  @param[in]  Value  32-bit word to write
-
-  @return The value written to the I/O port.
-
-**/
-UINT32
-UnalignedIoWrite32 (
-  IN      UINTN                     Port,
-  IN      UINT32                    Value
-  )
-{
-  __asm {
-    mov eax, dword ptr [Value]
-    mov dx, word ptr [Port]
-    out dx, eax
-  }
-
-  return Value;
-}
-
-/**
-  Reads a 32-bit word from the specified, possibly unaligned I/O-type address.
-
-  Reads the 32-bit I/O port specified by Port. The 32-bit read value is
-  returned. This function must guarantee that all I/O read and write operations
-  are serialized.
-
-  If 32-bit unaligned I/O port operations are not supported, then ASSERT().
-
-  @param[in]  Port  The I/O port to read.
-
-  @return The value read.
-
-**/
-UINT32
-UnalignedIoRead32 (
-  IN      UINTN                     Port
-  )
-{
-  UINT32 Data;
-
-  __asm {
-    mov dx, word ptr [Port]
-    in  eax, dx
-    mov dword ptr [Data], eax
-  }
-
-  return Data;
-}
diff --git a/OvmfPkg/QemuVideoDxe/UnalignedIoInternal.h b/OvmfPkg/QemuVideoDxe/UnalignedIoInternal.h
deleted file mode 100644
index 234de6c21b..0000000000
--- a/OvmfPkg/QemuVideoDxe/UnalignedIoInternal.h
+++ /dev/null
@@ -1,59 +0,0 @@
-/** @file
-  Unaligned port I/O, with implementations for various x86 compilers and a
-  dummy for platforms which do not support unaligned port I/O.
-
-  Copyright (c) 2017, Phil Dennis-Jordan.<BR>
-  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 _UNALIGNED_IO_INTERNAL_H_
-#define _UNALIGNED_IO_INTERNAL_H_
-
-/**
-  Performs a 32-bit write to the specified, possibly unaligned I/O-type address.
-
-  Writes the 32-bit I/O port specified by Port with the value specified by Value
-  and returns Value. This function must guarantee that all I/O read and write
-  operations are serialized.
-
-  If 32-bit unaligned I/O port operations are not supported, then ASSERT().
-
-  @param[in]  Port   I/O port address
-  @param[in]  Value  32-bit word to write
-
-  @return The value written to the I/O port.
-
-**/
-UINT32
-UnalignedIoWrite32 (
-  IN      UINTN                     Port,
-  IN      UINT32                    Value
-  );
-
-/**
-  Reads a 32-bit word from the specified, possibly unaligned I/O-type address.
-
-  Reads the 32-bit I/O port specified by Port. The 32-bit read value is
-  returned. This function must guarantee that all I/O read and write operations
-  are serialized.
-
-  If 32-bit unaligned I/O port operations are not supported, then ASSERT().
-
-  @param[in]  Port  The I/O port to read.
-
-  @return The value read.
-
-**/
-UINT32
-UnalignedIoRead32 (
-  IN      UINTN                     Port
-  );
-
-#endif
diff --git a/OvmfPkg/QemuVideoDxe/UnalignedIoMsc.c b/OvmfPkg/QemuVideoDxe/UnalignedIoMsc.c
deleted file mode 100644
index a466baee84..0000000000
--- a/OvmfPkg/QemuVideoDxe/UnalignedIoMsc.c
+++ /dev/null
@@ -1,78 +0,0 @@
-/** @file
-  Unaligned port I/O. This file has compiler specifics for Microsoft C as there
-  is no ANSI C standard for doing IO.
-
-  Based on IoLibMsc.c
-
-  Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
-  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.
-
-**/
-
-
-#include "UnalignedIoInternal.h"
-
-unsigned long  _inpd (unsigned short port);
-unsigned long  _outpd (unsigned short port, unsigned long dataword );
-void          _ReadWriteBarrier (void);
-
-/**
-  Performs a 32-bit write to the specified, possibly unaligned I/O-type
-  address.
-
-  Writes the 32-bit I/O port specified by Port with the value specified by
-  Value and returns Value. This function must guarantee that all I/O read and
-  write operations are serialized.
-
-  If 32-bit unaligned I/O port operations are not supported, then ASSERT().
-
-  @param[in]  Port   I/O port address
-  @param[in]  Value  32-bit word to write
-
-  @return The value written to the I/O port.
-
-**/
-UINT32
-UnalignedIoWrite32 (
-  IN      UINTN                     Port,
-  IN      UINT32                    Value
-  )
-{
-  _ReadWriteBarrier ();
-  _outpd ((UINT16)Port, Value);
-  _ReadWriteBarrier ();
-  return Value;
-}
-
-/**
-  Reads a 32-bit word from the specified, possibly unaligned I/O-type address.
-
-  Reads the 32-bit I/O port specified by Port. The 32-bit read value is
-  returned. This function must guarantee that all I/O read and write operations
-  are serialized.
-
-  If 32-bit unaligned I/O port operations are not supported, then ASSERT().
-
-  @param[in]  Port  The I/O port to read.
-
-  @return The value read.
-
-**/
-UINT32
-UnalignedIoRead32 (
-  IN      UINTN                     Port
-  )
-{
-  UINT32                            Value;
-
-  _ReadWriteBarrier ();
-  Value = _inpd ((UINT16)Port);
-  _ReadWriteBarrier ();
-  return Value;
-}
diff --git a/OvmfPkg/QemuVideoDxe/UnalignedIoUnsupported.c b/OvmfPkg/QemuVideoDxe/UnalignedIoUnsupported.c
deleted file mode 100644
index 57560ab38f..0000000000
--- a/OvmfPkg/QemuVideoDxe/UnalignedIoUnsupported.c
+++ /dev/null
@@ -1,66 +0,0 @@
-/** @file
-  Unaligned port I/O dummy implementation for platforms which do not support it.
-
-  Copyright (c) 2017, Phil Dennis-Jordan.<BR>
-  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.
-
-**/
-
-
-#include <Library/DebugLib.h>
-#include "UnalignedIoInternal.h"
-
-/**
-  Performs a 32-bit write to the specified, possibly unaligned I/O-type
-  address.
-
-  Writes the 32-bit I/O port specified by Port with the value specified by
-  Value and returns Value. This function must guarantee that all I/O read and
-  write operations are serialized.
-
-  If 32-bit unaligned I/O port operations are not supported, then ASSERT().
-
-  @param[in]  Port   I/O port address
-  @param[in]  Value  32-bit word to write
-
-  @return The value written to the I/O port.
-
-**/
-UINT32
-UnalignedIoWrite32 (
-  IN      UINTN                     Port,
-  IN      UINT32                    Value
-  )
-{
-  ASSERT (FALSE);
-  return Value;
-}
-
-/**
-  Reads a 32-bit word from the specified, possibly unaligned I/O-type address.
-
-  Reads the 32-bit I/O port specified by Port. The 32-bit read value is
-  returned. This function must guarantee that all I/O read and write operations
-  are serialized.
-
-  If 32-bit unaligned I/O port operations are not supported, then ASSERT().
-
-  @param[in]  Port  The I/O port to read.
-
-  @return The value read.
-
-**/
-UINT32
-UnalignedIoRead32 (
-  IN      UINTN                     Port
-  )
-{
-  ASSERT (FALSE);
-  return 0;
-}
-- 
2.18.0



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

* [PATCH 3/4] Revert "OvmfPkg/QemuVideoDxe: list "UnalignedIoInternal.h" in the INF file"
  2018-10-24  6:40 [PATCH 0/4] OvmfPkg: simply use the Bochs interface for vmsvga yuchenlin
  2018-10-24  6:40 ` [PATCH 1/4] Revert "OvmfPkg/QemuVideoDxe: VMWare SVGA device support" yuchenlin
  2018-10-24  6:40 ` [PATCH 2/4] Revert "OvmfPkg/QemuVideoDxe: Helper functions for unaligned port I/O." yuchenlin
@ 2018-10-24  6:40 ` yuchenlin
  2018-10-24  6:40 ` [PATCH 4/4] OvmfPkg: simply use the Bochs interface for vmsvga yuchenlin
  2018-11-01 19:02 ` [PATCH 0/4] " Philippe Mathieu-Daudé
  4 siblings, 0 replies; 12+ messages in thread
From: yuchenlin @ 2018-10-24  6:40 UTC (permalink / raw)
  To: edk2-devel
  Cc: jordan.l.justen, lersek, ard.biesheuvel, anthony.perard,
	julien.grall, phil, kraxel, yuchenlin

From: yuchenlin <yuchenlin@synology.com>

This reverts commit b2959e9f1a57279506ca46d56bc424fd7fa6b62a.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: yuchenlin <yuchenlin@synology.com>
---
 OvmfPkg/QemuVideoDxe/QemuVideoDxe.inf | 1 -
 1 file changed, 1 deletion(-)

diff --git a/OvmfPkg/QemuVideoDxe/QemuVideoDxe.inf b/OvmfPkg/QemuVideoDxe/QemuVideoDxe.inf
index c071fafa4e..e5575622dc 100644
--- a/OvmfPkg/QemuVideoDxe/QemuVideoDxe.inf
+++ b/OvmfPkg/QemuVideoDxe/QemuVideoDxe.inf
@@ -39,7 +39,6 @@
   Gop.c
   Initialize.c
   Qemu.h
-  UnalignedIoInternal.h
 
 [Sources.Ia32, Sources.X64]
   VbeShim.c
-- 
2.18.0



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

* [PATCH 4/4] OvmfPkg: simply use the Bochs interface for vmsvga
  2018-10-24  6:40 [PATCH 0/4] OvmfPkg: simply use the Bochs interface for vmsvga yuchenlin
                   ` (2 preceding siblings ...)
  2018-10-24  6:40 ` [PATCH 3/4] Revert "OvmfPkg/QemuVideoDxe: list "UnalignedIoInternal.h" in the INF file" yuchenlin
@ 2018-10-24  6:40 ` yuchenlin
  2018-10-24  9:16   ` Gerd Hoffmann
  2018-11-01 18:54   ` Philippe Mathieu-Daudé
  2018-11-01 19:02 ` [PATCH 0/4] " Philippe Mathieu-Daudé
  4 siblings, 2 replies; 12+ messages in thread
From: yuchenlin @ 2018-10-24  6:40 UTC (permalink / raw)
  To: edk2-devel
  Cc: jordan.l.justen, lersek, ard.biesheuvel, anthony.perard,
	julien.grall, phil, kraxel, yuchenlin

From: yuchenlin <yuchenlin@synology.com>

BAR  |    std vga     |  vmsvga
---------------------------------
0    |   Framebuffer  | I/O space
1    |   Reserved     | Framebuffer
2    |   MMIO         | FIFO

Because of the PCI BARs difference between std vga and
vmsvga, we can not simply recognize the "QEMU VMWare SVGA"
as the QEMU_VIDEO_BOCHS_MMIO variant.

Instead, we remain variant QEMU_VIDEO_VMWARE_SVGA, and use
it for:

(1) Get framebuffer from correct PCI BAR
(2) Prevent using BAR2 for MMIO

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: yuchenlin <yuchenlin@synology.com>
---
 OvmfPkg/QemuVideoDxe/Driver.c | 16 +++++++++++++++-
 OvmfPkg/QemuVideoDxe/Gop.c    |  3 ++-
 OvmfPkg/QemuVideoDxe/Qemu.h   |  2 ++
 3 files changed, 19 insertions(+), 2 deletions(-)

diff --git a/OvmfPkg/QemuVideoDxe/Driver.c b/OvmfPkg/QemuVideoDxe/Driver.c
index 2304afd1e6..a1785c2285 100644
--- a/OvmfPkg/QemuVideoDxe/Driver.c
+++ b/OvmfPkg/QemuVideoDxe/Driver.c
@@ -16,6 +16,7 @@
 
 #include "Qemu.h"
 #include <IndustryStandard/Acpi.h>
+#include <IndustryStandard/VmwareSvga.h>
 
 EFI_DRIVER_BINDING_PROTOCOL gQemuVideoDriverBinding = {
   QemuVideoControllerDriverSupported,
@@ -69,6 +70,12 @@ QEMU_VIDEO_CARD gQemuVideoCardList[] = {
         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,
+        L"QEMU VMWare SVGA"
     },{
         0 /* end of list */
     }
@@ -256,6 +263,11 @@ QemuVideoControllerDriverStart (
     goto ClosePciIo;
   }
   Private->Variant = Card->Variant;
+  Private->FrameBufferVramBarIndex = PCI_BAR_IDX0;
+  if (Private->Variant == QEMU_VIDEO_VMWARE_SVGA) {
+    Private->FrameBufferVramBarIndex = PCI_BAR_IDX1;
+  }
+
 
   //
   // IsQxl is based on the detected Card->Variant, which at a later point might
@@ -320,7 +332,8 @@ QemuVideoControllerDriverStart (
   // Check if accessing the bochs interface works.
   //
   if (Private->Variant == QEMU_VIDEO_BOCHS_MMIO ||
-      Private->Variant == QEMU_VIDEO_BOCHS) {
+      Private->Variant == QEMU_VIDEO_BOCHS ||
+      Private->Variant == QEMU_VIDEO_VMWARE_SVGA) {
     UINT16 BochsId;
     BochsId = BochsRead(Private, VBE_DISPI_INDEX_ID);
     if ((BochsId & 0xFFF0) != VBE_DISPI_ID0) {
@@ -383,6 +396,7 @@ QemuVideoControllerDriverStart (
     break;
   case QEMU_VIDEO_BOCHS_MMIO:
   case QEMU_VIDEO_BOCHS:
+  case QEMU_VIDEO_VMWARE_SVGA:
     Status = QemuVideoBochsModeSetup (Private, IsQxl);
     break;
   default:
diff --git a/OvmfPkg/QemuVideoDxe/Gop.c b/OvmfPkg/QemuVideoDxe/Gop.c
index d490fa7a2e..3abc5eeb36 100644
--- a/OvmfPkg/QemuVideoDxe/Gop.c
+++ b/OvmfPkg/QemuVideoDxe/Gop.c
@@ -60,7 +60,7 @@ QemuVideoCompleteModeData (
 
   Private->PciIo->GetBarAttributes (
                         Private->PciIo,
-                        0,
+                        Private->FrameBufferVramBarIndex,
                         NULL,
                         (VOID**) &FrameBufDesc
                         );
@@ -177,6 +177,7 @@ Routine Description:
     break;
   case QEMU_VIDEO_BOCHS_MMIO:
   case QEMU_VIDEO_BOCHS:
+  case QEMU_VIDEO_VMWARE_SVGA:
     InitializeBochsGraphicsMode (Private, &QemuVideoBochsModes[ModeData->InternalModeIndex]);
     break;
   default:
diff --git a/OvmfPkg/QemuVideoDxe/Qemu.h b/OvmfPkg/QemuVideoDxe/Qemu.h
index d7da761705..3aac9eeca6 100644
--- a/OvmfPkg/QemuVideoDxe/Qemu.h
+++ b/OvmfPkg/QemuVideoDxe/Qemu.h
@@ -92,6 +92,7 @@ typedef enum {
   QEMU_VIDEO_CIRRUS_5446,
   QEMU_VIDEO_BOCHS,
   QEMU_VIDEO_BOCHS_MMIO,
+  QEMU_VIDEO_VMWARE_SVGA,
 } QEMU_VIDEO_VARIANT;
 
 typedef struct {
@@ -120,6 +121,7 @@ typedef struct {
   QEMU_VIDEO_VARIANT                    Variant;
   FRAME_BUFFER_CONFIGURE                *FrameBufferBltConfigure;
   UINTN                                 FrameBufferBltConfigureSize;
+  UINT8                                 FrameBufferVramBarIndex;
 } QEMU_VIDEO_PRIVATE_DATA;
 
 ///
-- 
2.18.0



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

* Re: [PATCH 4/4] OvmfPkg: simply use the Bochs interface for vmsvga
  2018-10-24  6:40 ` [PATCH 4/4] OvmfPkg: simply use the Bochs interface for vmsvga yuchenlin
@ 2018-10-24  9:16   ` Gerd Hoffmann
  2018-11-01 18:54   ` Philippe Mathieu-Daudé
  1 sibling, 0 replies; 12+ messages in thread
From: Gerd Hoffmann @ 2018-10-24  9:16 UTC (permalink / raw)
  To: yuchenlin
  Cc: edk2-devel, jordan.l.justen, lersek, ard.biesheuvel,
	anthony.perard, julien.grall, phil

On Wed, Oct 24, 2018 at 02:40:08PM +0800, yuchenlin@synology.com wrote:
> From: yuchenlin <yuchenlin@synology.com>
> 
> BAR  |    std vga     |  vmsvga
> ---------------------------------
> 0    |   Framebuffer  | I/O space
> 1    |   Reserved     | Framebuffer
> 2    |   MMIO         | FIFO
> 
> Because of the PCI BARs difference between std vga and
> vmsvga, we can not simply recognize the "QEMU VMWare SVGA"
> as the QEMU_VIDEO_BOCHS_MMIO variant.
> 
> Instead, we remain variant QEMU_VIDEO_VMWARE_SVGA, and use
> it for:
> 
> (1) Get framebuffer from correct PCI BAR
> (2) Prevent using BAR2 for MMIO

looks good to me.  seavgabios uses the same logic.

cheers,
  Gerd



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

* Re: [PATCH 4/4] OvmfPkg: simply use the Bochs interface for vmsvga
  2018-10-24  6:40 ` [PATCH 4/4] OvmfPkg: simply use the Bochs interface for vmsvga yuchenlin
  2018-10-24  9:16   ` Gerd Hoffmann
@ 2018-11-01 18:54   ` Philippe Mathieu-Daudé
  2018-11-02  2:05     ` yuchenlin
  1 sibling, 1 reply; 12+ messages in thread
From: Philippe Mathieu-Daudé @ 2018-11-01 18:54 UTC (permalink / raw)
  To: yuchenlin, edk2-devel; +Cc: phil, jordan.l.justen, anthony.perard, lersek

Hi Yu-chen Lin,

On 24/10/18 8:40, yuchenlin@synology.com wrote:
> From: yuchenlin <yuchenlin@synology.com>
> 
> BAR  |    std vga     |  vmsvga
> ---------------------------------
> 0    |   Framebuffer  | I/O space
> 1    |   Reserved     | Framebuffer
> 2    |   MMIO         | FIFO
> 
> Because of the PCI BARs difference between std vga and
> vmsvga, we can not simply recognize the "QEMU VMWare SVGA"
> as the QEMU_VIDEO_BOCHS_MMIO variant.
> 
> Instead, we remain variant QEMU_VIDEO_VMWARE_SVGA, and use
> it for:
> 
> (1) Get framebuffer from correct PCI BAR
> (2) Prevent using BAR2 for MMIO
> 
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: yuchenlin <yuchenlin@synology.com>
> ---
>   OvmfPkg/QemuVideoDxe/Driver.c | 16 +++++++++++++++-
>   OvmfPkg/QemuVideoDxe/Gop.c    |  3 ++-
>   OvmfPkg/QemuVideoDxe/Qemu.h   |  2 ++
>   3 files changed, 19 insertions(+), 2 deletions(-)
> 
> diff --git a/OvmfPkg/QemuVideoDxe/Driver.c b/OvmfPkg/QemuVideoDxe/Driver.c
> index 2304afd1e6..a1785c2285 100644
> --- a/OvmfPkg/QemuVideoDxe/Driver.c
> +++ b/OvmfPkg/QemuVideoDxe/Driver.c
> @@ -16,6 +16,7 @@
>   
>   #include "Qemu.h"
>   #include <IndustryStandard/Acpi.h>
> +#include <IndustryStandard/VmwareSvga.h>
>   
>   EFI_DRIVER_BINDING_PROTOCOL gQemuVideoDriverBinding = {
>     QemuVideoControllerDriverSupported,
> @@ -69,6 +70,12 @@ QEMU_VIDEO_CARD gQemuVideoCardList[] = {
>           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,
> +        L"QEMU VMWare SVGA"

Looks OK.

>       },{
>           0 /* end of list */
>       }
> @@ -256,6 +263,11 @@ QemuVideoControllerDriverStart (
>       goto ClosePciIo;
>     }
>     Private->Variant = Card->Variant;
> +  Private->FrameBufferVramBarIndex = PCI_BAR_IDX0;
> +  if (Private->Variant == QEMU_VIDEO_VMWARE_SVGA) {
> +    Private->FrameBufferVramBarIndex = PCI_BAR_IDX1;

OK, but why not use an 'else' clause?

> +  }
> +
>   
>     //
>     // IsQxl is based on the detected Card->Variant, which at a later point might
> @@ -320,7 +332,8 @@ QemuVideoControllerDriverStart (
>     // Check if accessing the bochs interface works.
>     //
>     if (Private->Variant == QEMU_VIDEO_BOCHS_MMIO ||
> -      Private->Variant == QEMU_VIDEO_BOCHS) {
> +      Private->Variant == QEMU_VIDEO_BOCHS ||
> +      Private->Variant == QEMU_VIDEO_VMWARE_SVGA) {
>       UINT16 BochsId;
>       BochsId = BochsRead(Private, VBE_DISPI_INDEX_ID);
>       if ((BochsId & 0xFFF0) != VBE_DISPI_ID0) {
> @@ -383,6 +396,7 @@ QemuVideoControllerDriverStart (
>       break;
>     case QEMU_VIDEO_BOCHS_MMIO:
>     case QEMU_VIDEO_BOCHS:
> +  case QEMU_VIDEO_VMWARE_SVGA:
>       Status = QemuVideoBochsModeSetup (Private, IsQxl);
>       break;
>     default:
> diff --git a/OvmfPkg/QemuVideoDxe/Gop.c b/OvmfPkg/QemuVideoDxe/Gop.c
> index d490fa7a2e..3abc5eeb36 100644
> --- a/OvmfPkg/QemuVideoDxe/Gop.c
> +++ b/OvmfPkg/QemuVideoDxe/Gop.c
> @@ -60,7 +60,7 @@ QemuVideoCompleteModeData (
>   
>     Private->PciIo->GetBarAttributes (
>                           Private->PciIo,
> -                        0,
> +                        Private->FrameBufferVramBarIndex,

OK

>                           NULL,
>                           (VOID**) &FrameBufDesc
>                           );
> @@ -177,6 +177,7 @@ Routine Description:
>       break;
>     case QEMU_VIDEO_BOCHS_MMIO:
>     case QEMU_VIDEO_BOCHS:
> +  case QEMU_VIDEO_VMWARE_SVGA:
>       InitializeBochsGraphicsMode (Private, &QemuVideoBochsModes[ModeData->InternalModeIndex]);
>       break;
>     default:
> diff --git a/OvmfPkg/QemuVideoDxe/Qemu.h b/OvmfPkg/QemuVideoDxe/Qemu.h
> index d7da761705..3aac9eeca6 100644
> --- a/OvmfPkg/QemuVideoDxe/Qemu.h
> +++ b/OvmfPkg/QemuVideoDxe/Qemu.h
> @@ -92,6 +92,7 @@ typedef enum {
>     QEMU_VIDEO_CIRRUS_5446,
>     QEMU_VIDEO_BOCHS,
>     QEMU_VIDEO_BOCHS_MMIO,
> +  QEMU_VIDEO_VMWARE_SVGA,
>   } QEMU_VIDEO_VARIANT;
>   
>   typedef struct {
> @@ -120,6 +121,7 @@ typedef struct {
>     QEMU_VIDEO_VARIANT                    Variant;
>     FRAME_BUFFER_CONFIGURE                *FrameBufferBltConfigure;
>     UINTN                                 FrameBufferBltConfigureSize;
> +  UINT8                                 FrameBufferVramBarIndex;
>   } QEMU_VIDEO_PRIVATE_DATA;
>   
>   ///
> 


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

* Re: [PATCH 1/4] Revert "OvmfPkg/QemuVideoDxe: VMWare SVGA device support"
  2018-10-24  6:40 ` [PATCH 1/4] Revert "OvmfPkg/QemuVideoDxe: VMWare SVGA device support" yuchenlin
@ 2018-11-01 18:58   ` Philippe Mathieu-Daudé
  2018-11-02  2:09     ` yuchenlin
  0 siblings, 1 reply; 12+ messages in thread
From: Philippe Mathieu-Daudé @ 2018-11-01 18:58 UTC (permalink / raw)
  To: yuchenlin, edk2-devel; +Cc: phil, jordan.l.justen, anthony.perard, lersek

Hi Yu-chen Lin,

On 24/10/18 8:40, yuchenlin@synology.com wrote:
> From: yuchenlin <yuchenlin@synology.com>
> 
> This reverts commit c137d95081690d4877fbeb5f1856972e84ac32f2.

Can we have a comment here about why we need to revert this patch?
(same for patches 2 and 3).

> 
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: yuchenlin <yuchenlin@synology.com>
> ---
>   OvmfPkg/QemuVideoDxe/Driver.c     | 135 +------------------------
>   OvmfPkg/QemuVideoDxe/Gop.c        |  65 +------------
>   OvmfPkg/QemuVideoDxe/Initialize.c | 157 ------------------------------
>   OvmfPkg/QemuVideoDxe/Qemu.h       |  29 ------
>   4 files changed, 7 insertions(+), 379 deletions(-)
> 
> diff --git a/OvmfPkg/QemuVideoDxe/Driver.c b/OvmfPkg/QemuVideoDxe/Driver.c
> index 73eb2cad05..2304afd1e6 100644
> --- a/OvmfPkg/QemuVideoDxe/Driver.c
> +++ b/OvmfPkg/QemuVideoDxe/Driver.c
> @@ -14,10 +14,8 @@
>   
>   **/
>   
> -#include <IndustryStandard/VmwareSvga.h>
> -#include <IndustryStandard/Acpi.h>
>   #include "Qemu.h"
> -#include "UnalignedIoInternal.h"
> +#include <IndustryStandard/Acpi.h>
>   
>   EFI_DRIVER_BINDING_PROTOCOL gQemuVideoDriverBinding = {
>     QemuVideoControllerDriverSupported,
> @@ -71,12 +69,6 @@ QEMU_VIDEO_CARD gQemuVideoCardList[] = {
>           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,
> -        L"QEMU VMWare SVGA"
>       },{
>           0 /* end of list */
>       }
> @@ -264,7 +256,6 @@ QemuVideoControllerDriverStart (
>       goto ClosePciIo;
>     }
>     Private->Variant = Card->Variant;
> -  Private->FrameBufferVramBarIndex = PCI_BAR_IDX0;
>   
>     //
>     // IsQxl is based on the detected Card->Variant, which at a later point might
> @@ -339,58 +330,6 @@ QemuVideoControllerDriverStart (
>       }
>     }
>   
> -  //
> -  // Check if accessing Vmware SVGA interface works
> -  //
> -  if (Private->Variant == QEMU_VIDEO_VMWARE_SVGA) {
> -    EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR *IoDesc;
> -    UINT32                            TargetId;
> -    UINT32                            SvgaIdRead;
> -
> -    IoDesc = NULL;
> -    Status = Private->PciIo->GetBarAttributes (
> -                               Private->PciIo,
> -                               PCI_BAR_IDX0,
> -                               NULL,
> -                               (VOID**) &IoDesc
> -                               );
> -    if (EFI_ERROR (Status) ||
> -        IoDesc->ResType != ACPI_ADDRESS_SPACE_TYPE_IO ||
> -        IoDesc->AddrRangeMin > MAX_UINT16 + 1 - (VMWARE_SVGA_VALUE_PORT + 4)) {
> -      if (IoDesc != NULL) {
> -        FreePool (IoDesc);
> -      }
> -      Status = EFI_DEVICE_ERROR;
> -      goto RestoreAttributes;
> -    }
> -    Private->VmwareSvgaBasePort = (UINT16) IoDesc->AddrRangeMin;
> -    FreePool (IoDesc);
> -
> -    TargetId = VMWARE_SVGA_ID_2;
> -    while (TRUE) {
> -      VmwareSvgaWrite (Private, VmwareSvgaRegId, TargetId);
> -      SvgaIdRead = VmwareSvgaRead (Private, VmwareSvgaRegId);
> -      if ((SvgaIdRead == TargetId) || (TargetId <= VMWARE_SVGA_ID_0)) {
> -        break;
> -      }
> -      TargetId--;
> -    }
> -
> -    if (SvgaIdRead != TargetId) {
> -      DEBUG ((
> -        DEBUG_ERROR,
> -        "QemuVideo: QEMU_VIDEO_VMWARE_SVGA ID mismatch "
> -        "(got 0x%x, base address 0x%x)\n",
> -        SvgaIdRead,
> -        Private->VmwareSvgaBasePort
> -        ));
> -      Status = EFI_DEVICE_ERROR;
> -      goto RestoreAttributes;
> -    }
> -
> -    Private->FrameBufferVramBarIndex = PCI_BAR_IDX1;
> -  }
> -
>     //
>     // Get ParentDevicePath
>     //
> @@ -446,9 +385,6 @@ QemuVideoControllerDriverStart (
>     case QEMU_VIDEO_BOCHS:
>       Status = QemuVideoBochsModeSetup (Private, IsQxl);
>       break;
> -  case QEMU_VIDEO_VMWARE_SVGA:
> -    Status = QemuVideoVmwareSvgaModeSetup (Private);
> -    break;
>     default:
>       ASSERT (FALSE);
>       Status = EFI_DEVICE_ERROR;
> @@ -510,9 +446,6 @@ DestructQemuVideoGraphics:
>   
>   FreeModeData:
>     FreePool (Private->ModeData);
> -  if (Private->VmwareSvgaModeInfo != NULL) {
> -    FreePool (Private->VmwareSvgaModeInfo);
> -  }
>   
>   UninstallGopDevicePath:
>     gBS->UninstallProtocolInterface (Private->Handle,
> @@ -634,9 +567,6 @@ QemuVideoControllerDriverStop (
>           );
>   
>     FreePool (Private->ModeData);
> -  if (Private->VmwareSvgaModeInfo != NULL) {
> -    FreePool (Private->VmwareSvgaModeInfo);
> -  }
>     gBS->UninstallProtocolInterface (Private->Handle,
>            &gEfiDevicePathProtocolGuid, Private->GopDevicePath);
>     FreePool (Private->GopDevicePath);
> @@ -834,7 +764,7 @@ ClearScreen (
>     Private->PciIo->Mem.Write (
>                           Private->PciIo,
>                           EfiPciIoWidthFillUint32,
> -                        Private->FrameBufferVramBarIndex,
> +                        0,
>                           0,
>                           0x400000 >> 2,
>                           &Color
> @@ -971,38 +901,6 @@ BochsRead (
>     return Data;
>   }
>   
> -VOID
> -VmwareSvgaWrite (
> -  QEMU_VIDEO_PRIVATE_DATA   *Private,
> -  UINT16                    Register,
> -  UINT32                    Value
> -  )
> -{
> -  UnalignedIoWrite32 (
> -    Private->VmwareSvgaBasePort + VMWARE_SVGA_INDEX_PORT,
> -    Register
> -    );
> -  UnalignedIoWrite32 (
> -    Private->VmwareSvgaBasePort + VMWARE_SVGA_VALUE_PORT,
> -    Value
> -    );
> -}
> -
> -UINT32
> -VmwareSvgaRead (
> -  QEMU_VIDEO_PRIVATE_DATA   *Private,
> -  UINT16                    Register
> -  )
> -{
> -  UnalignedIoWrite32 (
> -    Private->VmwareSvgaBasePort + VMWARE_SVGA_INDEX_PORT,
> -    Register
> -    );
> -  return UnalignedIoRead32 (
> -           Private->VmwareSvgaBasePort + VMWARE_SVGA_VALUE_PORT
> -           );
> -}
> -
>   VOID
>   VgaOutb (
>     QEMU_VIDEO_PRIVATE_DATA  *Private,
> @@ -1057,35 +955,6 @@ InitializeBochsGraphicsMode (
>     ClearScreen (Private);
>   }
>   
> -VOID
> -InitializeVmwareSvgaGraphicsMode (
> -  QEMU_VIDEO_PRIVATE_DATA  *Private,
> -  QEMU_VIDEO_BOCHS_MODES   *ModeData
> -  )
> -{
> -  UINT32 Capabilities;
> -
> -  VmwareSvgaWrite (Private, VmwareSvgaRegWidth, ModeData->Width);
> -  VmwareSvgaWrite (Private, VmwareSvgaRegHeight, ModeData->Height);
> -
> -  Capabilities = VmwareSvgaRead (
> -                   Private,
> -                   VmwareSvgaRegCapabilities
> -                   );
> -  if ((Capabilities & VMWARE_SVGA_CAP_8BIT_EMULATION) != 0) {
> -    VmwareSvgaWrite (
> -      Private,
> -      VmwareSvgaRegBitsPerPixel,
> -      ModeData->ColorDepth
> -      );
> -  }
> -
> -  VmwareSvgaWrite (Private, VmwareSvgaRegEnable, 1);
> -
> -  SetDefaultPalette (Private);
> -  ClearScreen (Private);
> -}
> -
>   EFI_STATUS
>   EFIAPI
>   InitializeQemuVideo (
> diff --git a/OvmfPkg/QemuVideoDxe/Gop.c b/OvmfPkg/QemuVideoDxe/Gop.c
> index c9941ef138..d490fa7a2e 100644
> --- a/OvmfPkg/QemuVideoDxe/Gop.c
> +++ b/OvmfPkg/QemuVideoDxe/Gop.c
> @@ -13,7 +13,6 @@
>   
>   **/
>   
> -#include <IndustryStandard/VmwareSvga.h>
>   #include "Qemu.h"
>   
>   STATIC
> @@ -79,46 +78,6 @@ QemuVideoCompleteModeData (
>     return EFI_SUCCESS;
>   }
>   
> -STATIC
> -EFI_STATUS
> -QemuVideoVmwareSvgaCompleteModeData (
> -  IN  QEMU_VIDEO_PRIVATE_DATA           *Private,
> -  OUT EFI_GRAPHICS_OUTPUT_PROTOCOL_MODE *Mode
> -  )
> -{
> -  EFI_STATUS                            Status;
> -  EFI_GRAPHICS_OUTPUT_MODE_INFORMATION  *Info;
> -  EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR     *FrameBufDesc;
> -  UINT32                                BytesPerLine, FbOffset, BytesPerPixel;
> -
> -  Info = Mode->Info;
> -  CopyMem (Info, &Private->VmwareSvgaModeInfo[Mode->Mode], sizeof (*Info));
> -  BytesPerPixel = Private->ModeData[Mode->Mode].ColorDepth / 8;
> -  BytesPerLine = Info->PixelsPerScanLine * BytesPerPixel;
> -
> -  FbOffset = VmwareSvgaRead (Private, VmwareSvgaRegFbOffset);
> -
> -  Status = Private->PciIo->GetBarAttributes (
> -                             Private->PciIo,
> -                             PCI_BAR_IDX1,
> -                             NULL,
> -                             (VOID**) &FrameBufDesc
> -                             );
> -  if (EFI_ERROR (Status)) {
> -    return EFI_DEVICE_ERROR;
> -  }
> -
> -  Mode->FrameBufferBase = FrameBufDesc->AddrRangeMin + FbOffset;
> -  Mode->FrameBufferSize = BytesPerLine * Info->VerticalResolution;
> -  Mode->FrameBufferSize = EFI_PAGES_TO_SIZE (
> -                            EFI_SIZE_TO_PAGES (Mode->FrameBufferSize)
> -                            );
> -
> -  FreePool (FrameBufDesc);
> -  return Status;
> -}
> -
> -
>   //
>   // Graphics Output Protocol Member Functions
>   //
> @@ -167,14 +126,10 @@ Routine Description:
>   
>     *SizeOfInfo = sizeof (EFI_GRAPHICS_OUTPUT_MODE_INFORMATION);
>   
> -  if (Private->Variant == QEMU_VIDEO_VMWARE_SVGA) {
> -    CopyMem (*Info, &Private->VmwareSvgaModeInfo[ModeNumber], sizeof (**Info));
> -  } else {
> -    ModeData = &Private->ModeData[ModeNumber];
> -    (*Info)->HorizontalResolution = ModeData->HorizontalResolution;
> -    (*Info)->VerticalResolution   = ModeData->VerticalResolution;
> -    QemuVideoCompleteModeInfo (ModeData, *Info);
> -  }
> +  ModeData = &Private->ModeData[ModeNumber];
> +  (*Info)->HorizontalResolution = ModeData->HorizontalResolution;
> +  (*Info)->VerticalResolution   = ModeData->VerticalResolution;
> +  QemuVideoCompleteModeInfo (ModeData, *Info);
>   
>     return EFI_SUCCESS;
>   }
> @@ -224,12 +179,6 @@ Routine Description:
>     case QEMU_VIDEO_BOCHS:
>       InitializeBochsGraphicsMode (Private, &QemuVideoBochsModes[ModeData->InternalModeIndex]);
>       break;
> -  case QEMU_VIDEO_VMWARE_SVGA:
> -    InitializeVmwareSvgaGraphicsMode (
> -      Private,
> -      &QemuVideoBochsModes[ModeData->InternalModeIndex]
> -      );
> -    break;
>     default:
>       ASSERT (FALSE);
>       return EFI_DEVICE_ERROR;
> @@ -240,11 +189,7 @@ Routine Description:
>     This->Mode->Info->VerticalResolution = ModeData->VerticalResolution;
>     This->Mode->SizeOfInfo = sizeof(EFI_GRAPHICS_OUTPUT_MODE_INFORMATION);
>   
> -  if (Private->Variant == QEMU_VIDEO_VMWARE_SVGA) {
> -    QemuVideoVmwareSvgaCompleteModeData (Private, This->Mode);
> -  } else {
> -    QemuVideoCompleteModeData (Private, This->Mode);
> -  }
> +  QemuVideoCompleteModeData (Private, This->Mode);
>   
>     //
>     // Re-initialize the frame buffer configure when mode changes.
> diff --git a/OvmfPkg/QemuVideoDxe/Initialize.c b/OvmfPkg/QemuVideoDxe/Initialize.c
> index 357124d628..d5d8cfef96 100644
> --- a/OvmfPkg/QemuVideoDxe/Initialize.c
> +++ b/OvmfPkg/QemuVideoDxe/Initialize.c
> @@ -13,7 +13,6 @@
>   
>   **/
>   
> -#include <IndustryStandard/VmwareSvga.h>
>   #include "Qemu.h"
>   
>   
> @@ -347,159 +346,3 @@ QemuVideoBochsModeSetup (
>     return EFI_SUCCESS;
>   }
>   
> -EFI_STATUS
> -QemuVideoVmwareSvgaModeSetup (
> -  QEMU_VIDEO_PRIVATE_DATA *Private
> -  )
> -{
> -  EFI_STATUS                            Status;
> -  UINT32                                FbSize;
> -  UINT32                                MaxWidth, MaxHeight;
> -  UINT32                                Capabilities;
> -  UINT32                                BitsPerPixel;
> -  UINT32                                Index;
> -  QEMU_VIDEO_MODE_DATA                  *ModeData;
> -  QEMU_VIDEO_BOCHS_MODES                *VideoMode;
> -  EFI_GRAPHICS_OUTPUT_MODE_INFORMATION  *ModeInfo;
> -
> -  VmwareSvgaWrite (Private, VmwareSvgaRegEnable, 0);
> -
> -  Private->ModeData =
> -    AllocatePool (sizeof (Private->ModeData[0]) * QEMU_VIDEO_BOCHS_MODE_COUNT);
> -  if (Private->ModeData == NULL) {
> -    Status = EFI_OUT_OF_RESOURCES;
> -    goto ModeDataAllocError;
> -  }
> -
> -  Private->VmwareSvgaModeInfo =
> -    AllocatePool (
> -      sizeof (Private->VmwareSvgaModeInfo[0]) * QEMU_VIDEO_BOCHS_MODE_COUNT
> -      );
> -  if (Private->VmwareSvgaModeInfo == NULL) {
> -    Status = EFI_OUT_OF_RESOURCES;
> -    goto ModeInfoAllocError;
> -  }
> -
> -  FbSize =       VmwareSvgaRead (Private, VmwareSvgaRegFbSize);
> -  MaxWidth =     VmwareSvgaRead (Private, VmwareSvgaRegMaxWidth);
> -  MaxHeight =    VmwareSvgaRead (Private, VmwareSvgaRegMaxHeight);
> -  Capabilities = VmwareSvgaRead (Private, VmwareSvgaRegCapabilities);
> -  if ((Capabilities & VMWARE_SVGA_CAP_8BIT_EMULATION) != 0) {
> -    BitsPerPixel = VmwareSvgaRead (
> -                     Private,
> -                     VmwareSvgaRegHostBitsPerPixel
> -                     );
> -    VmwareSvgaWrite (
> -      Private,
> -      VmwareSvgaRegBitsPerPixel,
> -      BitsPerPixel
> -      );
> -  } else {
> -    BitsPerPixel = VmwareSvgaRead (
> -                     Private,
> -                     VmwareSvgaRegBitsPerPixel
> -                     );
> -  }
> -
> -  if (FbSize == 0       ||
> -      MaxWidth == 0     ||
> -      MaxHeight == 0    ||
> -      BitsPerPixel == 0 ||
> -      BitsPerPixel % 8 != 0) {
> -    Status = EFI_DEVICE_ERROR;
> -    goto Rollback;
> -  }
> -
> -  ModeData = Private->ModeData;
> -  ModeInfo = Private->VmwareSvgaModeInfo;
> -  VideoMode = &QemuVideoBochsModes[0];
> -  for (Index = 0; Index < QEMU_VIDEO_BOCHS_MODE_COUNT; Index++) {
> -    UINTN RequiredFbSize;
> -
> -    RequiredFbSize = (UINTN) VideoMode->Width * VideoMode->Height *
> -                     (BitsPerPixel / 8);
> -    if (RequiredFbSize <= FbSize     &&
> -        VideoMode->Width <= MaxWidth &&
> -        VideoMode->Height <= MaxHeight) {
> -      UINT32  BytesPerLine;
> -      UINT32  RedMask, GreenMask, BlueMask, PixelMask;
> -
> -      VmwareSvgaWrite (
> -        Private,
> -        VmwareSvgaRegWidth,
> -        VideoMode->Width
> -        );
> -      VmwareSvgaWrite (
> -        Private,
> -        VmwareSvgaRegHeight,
> -        VideoMode->Height
> -        );
> -
> -      ModeData->InternalModeIndex    = Index;
> -      ModeData->HorizontalResolution = VideoMode->Width;
> -      ModeData->VerticalResolution   = VideoMode->Height;
> -      ModeData->ColorDepth           = BitsPerPixel;
> -
> -      //
> -      // Setting VmwareSvgaRegWidth/VmwareSvgaRegHeight actually changes
> -      // the device's display mode, so we save all properties of each mode up
> -      // front to avoid inadvertent mode changes later.
> -      //
> -      ModeInfo->Version = 0;
> -      ModeInfo->HorizontalResolution = ModeData->HorizontalResolution;
> -      ModeInfo->VerticalResolution   = ModeData->VerticalResolution;
> -
> -      ModeInfo->PixelFormat = PixelBitMask;
> -
> -      RedMask   = VmwareSvgaRead (Private, VmwareSvgaRegRedMask);
> -      ModeInfo->PixelInformation.RedMask = RedMask;
> -
> -      GreenMask = VmwareSvgaRead (Private, VmwareSvgaRegGreenMask);
> -      ModeInfo->PixelInformation.GreenMask = GreenMask;
> -
> -      BlueMask  = VmwareSvgaRead (Private, VmwareSvgaRegBlueMask);
> -      ModeInfo->PixelInformation.BlueMask = BlueMask;
> -
> -      //
> -      // Reserved mask is whatever bits in the pixel not containing RGB data,
> -      // so start with binary 1s for every bit in the pixel, then mask off
> -      // bits already used for RGB. Special case 32 to avoid undefined
> -      // behaviour in the shift.
> -      //
> -      if (BitsPerPixel == 32) {
> -        if (BlueMask == 0xff && GreenMask == 0xff00 && RedMask == 0xff0000) {
> -          ModeInfo->PixelFormat = PixelBlueGreenRedReserved8BitPerColor;
> -        } else if (BlueMask == 0xff0000 &&
> -                   GreenMask == 0xff00 &&
> -                   RedMask == 0xff) {
> -          ModeInfo->PixelFormat = PixelRedGreenBlueReserved8BitPerColor;
> -        }
> -        PixelMask = MAX_UINT32;
> -      } else {
> -        PixelMask = (1u << BitsPerPixel) - 1;
> -      }
> -      ModeInfo->PixelInformation.ReservedMask =
> -        PixelMask & ~(RedMask | GreenMask | BlueMask);
> -
> -      BytesPerLine = VmwareSvgaRead (Private, VmwareSvgaRegBytesPerLine);
> -      ModeInfo->PixelsPerScanLine = BytesPerLine / (BitsPerPixel / 8);
> -
> -      ModeData++;
> -      ModeInfo++;
> -    }
> -    VideoMode++;
> -  }
> -  Private->MaxMode = ModeData - Private->ModeData;
> -  return EFI_SUCCESS;
> -
> -Rollback:
> -  FreePool (Private->VmwareSvgaModeInfo);
> -  Private->VmwareSvgaModeInfo = NULL;
> -
> -ModeInfoAllocError:
> -  FreePool (Private->ModeData);
> -  Private->ModeData = NULL;
> -
> -ModeDataAllocError:
> -  return Status;
> -}
> diff --git a/OvmfPkg/QemuVideoDxe/Qemu.h b/OvmfPkg/QemuVideoDxe/Qemu.h
> index bc49f867a4..d7da761705 100644
> --- a/OvmfPkg/QemuVideoDxe/Qemu.h
> +++ b/OvmfPkg/QemuVideoDxe/Qemu.h
> @@ -92,7 +92,6 @@ typedef enum {
>     QEMU_VIDEO_CIRRUS_5446,
>     QEMU_VIDEO_BOCHS,
>     QEMU_VIDEO_BOCHS_MMIO,
> -  QEMU_VIDEO_VMWARE_SVGA,
>   } QEMU_VIDEO_VARIANT;
>   
>   typedef struct {
> @@ -117,13 +116,10 @@ typedef struct {
>     //
>     UINTN                                 MaxMode;
>     QEMU_VIDEO_MODE_DATA                  *ModeData;
> -  EFI_GRAPHICS_OUTPUT_MODE_INFORMATION  *VmwareSvgaModeInfo;
>   
>     QEMU_VIDEO_VARIANT                    Variant;
>     FRAME_BUFFER_CONFIGURE                *FrameBufferBltConfigure;
>     UINTN                                 FrameBufferBltConfigureSize;
> -  UINT8                                 FrameBufferVramBarIndex;
> -  UINT16                                VmwareSvgaBasePort;
>   } QEMU_VIDEO_PRIVATE_DATA;
>   
>   ///
> @@ -507,34 +503,9 @@ QemuVideoBochsModeSetup (
>     BOOLEAN                  IsQxl
>     );
>   
> -EFI_STATUS
> -QemuVideoVmwareSvgaModeSetup (
> -  QEMU_VIDEO_PRIVATE_DATA *Private
> -  );
> -
>   VOID
>   InstallVbeShim (
>     IN CONST CHAR16         *CardName,
>     IN EFI_PHYSICAL_ADDRESS FrameBufferBase
>     );
> -
> -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
> -  );
> -
>   #endif
> 


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

* Re: [PATCH 0/4] OvmfPkg: simply use the Bochs interface for vmsvga
  2018-10-24  6:40 [PATCH 0/4] OvmfPkg: simply use the Bochs interface for vmsvga yuchenlin
                   ` (3 preceding siblings ...)
  2018-10-24  6:40 ` [PATCH 4/4] OvmfPkg: simply use the Bochs interface for vmsvga yuchenlin
@ 2018-11-01 19:02 ` Philippe Mathieu-Daudé
  2018-11-02  2:12   ` yuchenlin
  4 siblings, 1 reply; 12+ messages in thread
From: Philippe Mathieu-Daudé @ 2018-11-01 19:02 UTC (permalink / raw)
  To: yuchenlin, edk2-devel; +Cc: phil, jordan.l.justen, anthony.perard, lersek

Hi Yu-chen Lin,

On 24/10/18 8:40, yuchenlin@synology.com wrote:
> From: yuchenlin <yuchenlin@synology.com>
> 
> In this series, replace the original vmsvga driver to Bochs
> interface.

This is the 'v2' of your previous patch 'OvmfPkg: initialize bochs when 
initializing vmsvga':
https://lists.01.org/pipermail/edk2-devel/2018-October/031235.html

Keeping different versions and referencing previous series helps when 
reviewing.

> 
> Simply revert vmsvga driver implementation. After it, use Bochs
> interface for initializing vmsvga.
> 
> Because of the PCI BARs difference between std vga and vmsvga.
> We can not simply recognize the "QEMU VMWare SVGA" as the
> QEMU_VIDEO_BOCHS_MMIO variant.
> 
> BAR  |    std vga     |  vmsvga
> ---------------------------------
> 0    |   Framebuffer  | I/O space
> 1    |   Reserved     | Framebuffer
> 2    |   MMIO         | FIFO
> 
> To overcome this problem, we remain variant QEMU_VIDEO_VMWARE_SVGA,
> and use it for:
> 
> (1) Get framebuffer from correct PCI BAR
> (2) Prevent using BAR2 for MMIO
> 
> We have tested on qemu before and after commit 104bd1dc70 and all worked.

Did you also test against QEMU v2.9.1?

> 
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: yuchenlin <yuchenlin@synology.com>
> 
> yuchenlin (4):
>    Revert "OvmfPkg/QemuVideoDxe: VMWare SVGA device support"
>    Revert "OvmfPkg/QemuVideoDxe: Helper functions for unaligned port
>      I/O."
>    Revert "OvmfPkg/QemuVideoDxe: list "UnalignedIoInternal.h" in the INF
>      file"
>    OvmfPkg: simply use the Bochs interface for vmsvga
> 
>   OvmfPkg/QemuVideoDxe/Driver.c                 | 137 ++-------------
>   OvmfPkg/QemuVideoDxe/Gop.c                    |  68 +-------
>   OvmfPkg/QemuVideoDxe/Initialize.c             | 157 ------------------
>   OvmfPkg/QemuVideoDxe/Qemu.h                   |  27 ---
>   OvmfPkg/QemuVideoDxe/QemuVideoDxe.inf         |   7 -
>   OvmfPkg/QemuVideoDxe/UnalignedIoGcc.c         |  70 --------
>   OvmfPkg/QemuVideoDxe/UnalignedIoIcc.c         |  80 ---------
>   OvmfPkg/QemuVideoDxe/UnalignedIoInternal.h    |  59 -------
>   OvmfPkg/QemuVideoDxe/UnalignedIoMsc.c         |  78 ---------
>   OvmfPkg/QemuVideoDxe/UnalignedIoUnsupported.c |  66 --------
>   10 files changed, 17 insertions(+), 732 deletions(-)
>   delete mode 100644 OvmfPkg/QemuVideoDxe/UnalignedIoGcc.c
>   delete mode 100644 OvmfPkg/QemuVideoDxe/UnalignedIoIcc.c
>   delete mode 100644 OvmfPkg/QemuVideoDxe/UnalignedIoInternal.h
>   delete mode 100644 OvmfPkg/QemuVideoDxe/UnalignedIoMsc.c
>   delete mode 100644 OvmfPkg/QemuVideoDxe/UnalignedIoUnsupported.c
> 


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

* Re: [PATCH 4/4] OvmfPkg: simply use the Bochs interface for vmsvga
  2018-11-01 18:54   ` Philippe Mathieu-Daudé
@ 2018-11-02  2:05     ` yuchenlin
  0 siblings, 0 replies; 12+ messages in thread
From: yuchenlin @ 2018-11-02  2:05 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé
  Cc: edk2-devel, phil, jordan.l.justen, anthony.perard, lersek

On 2018-11-02 02:54, Philippe Mathieu-Daudé wrote:
> Hi Yu-chen Lin,
> 
> On 24/10/18 8:40, yuchenlin@synology.com wrote:
>> From: yuchenlin <yuchenlin@synology.com>
>> 
>> BAR  |    std vga     |  vmsvga
>> ---------------------------------
>> 0    |   Framebuffer  | I/O space
>> 1    |   Reserved     | Framebuffer
>> 2    |   MMIO         | FIFO
>> 
>> Because of the PCI BARs difference between std vga and
>> vmsvga, we can not simply recognize the "QEMU VMWare SVGA"
>> as the QEMU_VIDEO_BOCHS_MMIO variant.
>> 
>> Instead, we remain variant QEMU_VIDEO_VMWARE_SVGA, and use
>> it for:
>> 
>> (1) Get framebuffer from correct PCI BAR
>> (2) Prevent using BAR2 for MMIO
>> 
>> Contributed-under: TianoCore Contribution Agreement 1.1
>> Signed-off-by: yuchenlin <yuchenlin@synology.com>
>> ---
>>   OvmfPkg/QemuVideoDxe/Driver.c | 16 +++++++++++++++-
>>   OvmfPkg/QemuVideoDxe/Gop.c    |  3 ++-
>>   OvmfPkg/QemuVideoDxe/Qemu.h   |  2 ++
>>   3 files changed, 19 insertions(+), 2 deletions(-)
>> 
>> diff --git a/OvmfPkg/QemuVideoDxe/Driver.c 
>> b/OvmfPkg/QemuVideoDxe/Driver.c
>> index 2304afd1e6..a1785c2285 100644
>> --- a/OvmfPkg/QemuVideoDxe/Driver.c
>> +++ b/OvmfPkg/QemuVideoDxe/Driver.c
>> @@ -16,6 +16,7 @@
>>     #include "Qemu.h"
>>   #include <IndustryStandard/Acpi.h>
>> +#include <IndustryStandard/VmwareSvga.h>
>>     EFI_DRIVER_BINDING_PROTOCOL gQemuVideoDriverBinding = {
>>     QemuVideoControllerDriverSupported,
>> @@ -69,6 +70,12 @@ QEMU_VIDEO_CARD gQemuVideoCardList[] = {
>>           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,
>> +        L"QEMU VMWare SVGA"
> 
> Looks OK.
> 
>>       },{
>>           0 /* end of list */
>>       }
>> @@ -256,6 +263,11 @@ QemuVideoControllerDriverStart (
>>       goto ClosePciIo;
>>     }
>>     Private->Variant = Card->Variant;
>> +  Private->FrameBufferVramBarIndex = PCI_BAR_IDX0;
>> +  if (Private->Variant == QEMU_VIDEO_VMWARE_SVGA) {
>> +    Private->FrameBufferVramBarIndex = PCI_BAR_IDX1;
> 
> OK, but why not use an 'else' clause?

Will do

Thanks,
yuchenlin

> 
>> +  }
>> +
>>       //
>>     // IsQxl is based on the detected Card->Variant, which at a later 
>> point might
>> @@ -320,7 +332,8 @@ QemuVideoControllerDriverStart (
>>     // Check if accessing the bochs interface works.
>>     //
>>     if (Private->Variant == QEMU_VIDEO_BOCHS_MMIO ||
>> -      Private->Variant == QEMU_VIDEO_BOCHS) {
>> +      Private->Variant == QEMU_VIDEO_BOCHS ||
>> +      Private->Variant == QEMU_VIDEO_VMWARE_SVGA) {
>>       UINT16 BochsId;
>>       BochsId = BochsRead(Private, VBE_DISPI_INDEX_ID);
>>       if ((BochsId & 0xFFF0) != VBE_DISPI_ID0) {
>> @@ -383,6 +396,7 @@ QemuVideoControllerDriverStart (
>>       break;
>>     case QEMU_VIDEO_BOCHS_MMIO:
>>     case QEMU_VIDEO_BOCHS:
>> +  case QEMU_VIDEO_VMWARE_SVGA:
>>       Status = QemuVideoBochsModeSetup (Private, IsQxl);
>>       break;
>>     default:
>> diff --git a/OvmfPkg/QemuVideoDxe/Gop.c b/OvmfPkg/QemuVideoDxe/Gop.c
>> index d490fa7a2e..3abc5eeb36 100644
>> --- a/OvmfPkg/QemuVideoDxe/Gop.c
>> +++ b/OvmfPkg/QemuVideoDxe/Gop.c
>> @@ -60,7 +60,7 @@ QemuVideoCompleteModeData (
>>       Private->PciIo->GetBarAttributes (
>>                           Private->PciIo,
>> -                        0,
>> +                        Private->FrameBufferVramBarIndex,
> 
> OK
> 
>>                           NULL,
>>                           (VOID**) &FrameBufDesc
>>                           );
>> @@ -177,6 +177,7 @@ Routine Description:
>>       break;
>>     case QEMU_VIDEO_BOCHS_MMIO:
>>     case QEMU_VIDEO_BOCHS:
>> +  case QEMU_VIDEO_VMWARE_SVGA:
>>       InitializeBochsGraphicsMode (Private, 
>> &QemuVideoBochsModes[ModeData->InternalModeIndex]);
>>       break;
>>     default:
>> diff --git a/OvmfPkg/QemuVideoDxe/Qemu.h b/OvmfPkg/QemuVideoDxe/Qemu.h
>> index d7da761705..3aac9eeca6 100644
>> --- a/OvmfPkg/QemuVideoDxe/Qemu.h
>> +++ b/OvmfPkg/QemuVideoDxe/Qemu.h
>> @@ -92,6 +92,7 @@ typedef enum {
>>     QEMU_VIDEO_CIRRUS_5446,
>>     QEMU_VIDEO_BOCHS,
>>     QEMU_VIDEO_BOCHS_MMIO,
>> +  QEMU_VIDEO_VMWARE_SVGA,
>>   } QEMU_VIDEO_VARIANT;
>>     typedef struct {
>> @@ -120,6 +121,7 @@ typedef struct {
>>     QEMU_VIDEO_VARIANT                    Variant;
>>     FRAME_BUFFER_CONFIGURE                *FrameBufferBltConfigure;
>>     UINTN                                 FrameBufferBltConfigureSize;
>> +  UINT8                                 FrameBufferVramBarIndex;
>>   } QEMU_VIDEO_PRIVATE_DATA;
>>     ///
>> 



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

* Re: [PATCH 1/4] Revert "OvmfPkg/QemuVideoDxe: VMWare SVGA device support"
  2018-11-01 18:58   ` Philippe Mathieu-Daudé
@ 2018-11-02  2:09     ` yuchenlin
  0 siblings, 0 replies; 12+ messages in thread
From: yuchenlin @ 2018-11-02  2:09 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé
  Cc: edk2-devel, phil, jordan.l.justen, anthony.perard, lersek

On 2018-11-02 02:58, Philippe Mathieu-Daudé wrote:
> Hi Yu-chen Lin,
> 
> On 24/10/18 8:40, yuchenlin@synology.com wrote:
>> From: yuchenlin <yuchenlin@synology.com>
>> 
>> This reverts commit c137d95081690d4877fbeb5f1856972e84ac32f2.
> 
> Can we have a comment here about why we need to revert this patch?
> (same for patches 2 and 3).
> 

Will do

Thanks,
yuchenlin

>> 
>> Contributed-under: TianoCore Contribution Agreement 1.1
>> Signed-off-by: yuchenlin <yuchenlin@synology.com>
>> ---
>>   OvmfPkg/QemuVideoDxe/Driver.c     | 135 +------------------------
>>   OvmfPkg/QemuVideoDxe/Gop.c        |  65 +------------
>>   OvmfPkg/QemuVideoDxe/Initialize.c | 157 
>> ------------------------------
>>   OvmfPkg/QemuVideoDxe/Qemu.h       |  29 ------
>>   4 files changed, 7 insertions(+), 379 deletions(-)
>> 
>> diff --git a/OvmfPkg/QemuVideoDxe/Driver.c 
>> b/OvmfPkg/QemuVideoDxe/Driver.c
>> index 73eb2cad05..2304afd1e6 100644
>> --- a/OvmfPkg/QemuVideoDxe/Driver.c
>> +++ b/OvmfPkg/QemuVideoDxe/Driver.c
>> @@ -14,10 +14,8 @@
>>     **/
>>   -#include <IndustryStandard/VmwareSvga.h>
>> -#include <IndustryStandard/Acpi.h>
>>   #include "Qemu.h"
>> -#include "UnalignedIoInternal.h"
>> +#include <IndustryStandard/Acpi.h>
>>     EFI_DRIVER_BINDING_PROTOCOL gQemuVideoDriverBinding = {
>>     QemuVideoControllerDriverSupported,
>> @@ -71,12 +69,6 @@ QEMU_VIDEO_CARD gQemuVideoCardList[] = {
>>           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,
>> -        L"QEMU VMWare SVGA"
>>       },{
>>           0 /* end of list */
>>       }
>> @@ -264,7 +256,6 @@ QemuVideoControllerDriverStart (
>>       goto ClosePciIo;
>>     }
>>     Private->Variant = Card->Variant;
>> -  Private->FrameBufferVramBarIndex = PCI_BAR_IDX0;
>>       //
>>     // IsQxl is based on the detected Card->Variant, which at a later 
>> point might
>> @@ -339,58 +330,6 @@ QemuVideoControllerDriverStart (
>>       }
>>     }
>>   -  //
>> -  // Check if accessing Vmware SVGA interface works
>> -  //
>> -  if (Private->Variant == QEMU_VIDEO_VMWARE_SVGA) {
>> -    EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR *IoDesc;
>> -    UINT32                            TargetId;
>> -    UINT32                            SvgaIdRead;
>> -
>> -    IoDesc = NULL;
>> -    Status = Private->PciIo->GetBarAttributes (
>> -                               Private->PciIo,
>> -                               PCI_BAR_IDX0,
>> -                               NULL,
>> -                               (VOID**) &IoDesc
>> -                               );
>> -    if (EFI_ERROR (Status) ||
>> -        IoDesc->ResType != ACPI_ADDRESS_SPACE_TYPE_IO ||
>> -        IoDesc->AddrRangeMin > MAX_UINT16 + 1 - 
>> (VMWARE_SVGA_VALUE_PORT + 4)) {
>> -      if (IoDesc != NULL) {
>> -        FreePool (IoDesc);
>> -      }
>> -      Status = EFI_DEVICE_ERROR;
>> -      goto RestoreAttributes;
>> -    }
>> -    Private->VmwareSvgaBasePort = (UINT16) IoDesc->AddrRangeMin;
>> -    FreePool (IoDesc);
>> -
>> -    TargetId = VMWARE_SVGA_ID_2;
>> -    while (TRUE) {
>> -      VmwareSvgaWrite (Private, VmwareSvgaRegId, TargetId);
>> -      SvgaIdRead = VmwareSvgaRead (Private, VmwareSvgaRegId);
>> -      if ((SvgaIdRead == TargetId) || (TargetId <= VMWARE_SVGA_ID_0)) 
>> {
>> -        break;
>> -      }
>> -      TargetId--;
>> -    }
>> -
>> -    if (SvgaIdRead != TargetId) {
>> -      DEBUG ((
>> -        DEBUG_ERROR,
>> -        "QemuVideo: QEMU_VIDEO_VMWARE_SVGA ID mismatch "
>> -        "(got 0x%x, base address 0x%x)\n",
>> -        SvgaIdRead,
>> -        Private->VmwareSvgaBasePort
>> -        ));
>> -      Status = EFI_DEVICE_ERROR;
>> -      goto RestoreAttributes;
>> -    }
>> -
>> -    Private->FrameBufferVramBarIndex = PCI_BAR_IDX1;
>> -  }
>> -
>>     //
>>     // Get ParentDevicePath
>>     //
>> @@ -446,9 +385,6 @@ QemuVideoControllerDriverStart (
>>     case QEMU_VIDEO_BOCHS:
>>       Status = QemuVideoBochsModeSetup (Private, IsQxl);
>>       break;
>> -  case QEMU_VIDEO_VMWARE_SVGA:
>> -    Status = QemuVideoVmwareSvgaModeSetup (Private);
>> -    break;
>>     default:
>>       ASSERT (FALSE);
>>       Status = EFI_DEVICE_ERROR;
>> @@ -510,9 +446,6 @@ DestructQemuVideoGraphics:
>>     FreeModeData:
>>     FreePool (Private->ModeData);
>> -  if (Private->VmwareSvgaModeInfo != NULL) {
>> -    FreePool (Private->VmwareSvgaModeInfo);
>> -  }
>>     UninstallGopDevicePath:
>>     gBS->UninstallProtocolInterface (Private->Handle,
>> @@ -634,9 +567,6 @@ QemuVideoControllerDriverStop (
>>           );
>>       FreePool (Private->ModeData);
>> -  if (Private->VmwareSvgaModeInfo != NULL) {
>> -    FreePool (Private->VmwareSvgaModeInfo);
>> -  }
>>     gBS->UninstallProtocolInterface (Private->Handle,
>>            &gEfiDevicePathProtocolGuid, Private->GopDevicePath);
>>     FreePool (Private->GopDevicePath);
>> @@ -834,7 +764,7 @@ ClearScreen (
>>     Private->PciIo->Mem.Write (
>>                           Private->PciIo,
>>                           EfiPciIoWidthFillUint32,
>> -                        Private->FrameBufferVramBarIndex,
>> +                        0,
>>                           0,
>>                           0x400000 >> 2,
>>                           &Color
>> @@ -971,38 +901,6 @@ BochsRead (
>>     return Data;
>>   }
>>   -VOID
>> -VmwareSvgaWrite (
>> -  QEMU_VIDEO_PRIVATE_DATA   *Private,
>> -  UINT16                    Register,
>> -  UINT32                    Value
>> -  )
>> -{
>> -  UnalignedIoWrite32 (
>> -    Private->VmwareSvgaBasePort + VMWARE_SVGA_INDEX_PORT,
>> -    Register
>> -    );
>> -  UnalignedIoWrite32 (
>> -    Private->VmwareSvgaBasePort + VMWARE_SVGA_VALUE_PORT,
>> -    Value
>> -    );
>> -}
>> -
>> -UINT32
>> -VmwareSvgaRead (
>> -  QEMU_VIDEO_PRIVATE_DATA   *Private,
>> -  UINT16                    Register
>> -  )
>> -{
>> -  UnalignedIoWrite32 (
>> -    Private->VmwareSvgaBasePort + VMWARE_SVGA_INDEX_PORT,
>> -    Register
>> -    );
>> -  return UnalignedIoRead32 (
>> -           Private->VmwareSvgaBasePort + VMWARE_SVGA_VALUE_PORT
>> -           );
>> -}
>> -
>>   VOID
>>   VgaOutb (
>>     QEMU_VIDEO_PRIVATE_DATA  *Private,
>> @@ -1057,35 +955,6 @@ InitializeBochsGraphicsMode (
>>     ClearScreen (Private);
>>   }
>>   -VOID
>> -InitializeVmwareSvgaGraphicsMode (
>> -  QEMU_VIDEO_PRIVATE_DATA  *Private,
>> -  QEMU_VIDEO_BOCHS_MODES   *ModeData
>> -  )
>> -{
>> -  UINT32 Capabilities;
>> -
>> -  VmwareSvgaWrite (Private, VmwareSvgaRegWidth, ModeData->Width);
>> -  VmwareSvgaWrite (Private, VmwareSvgaRegHeight, ModeData->Height);
>> -
>> -  Capabilities = VmwareSvgaRead (
>> -                   Private,
>> -                   VmwareSvgaRegCapabilities
>> -                   );
>> -  if ((Capabilities & VMWARE_SVGA_CAP_8BIT_EMULATION) != 0) {
>> -    VmwareSvgaWrite (
>> -      Private,
>> -      VmwareSvgaRegBitsPerPixel,
>> -      ModeData->ColorDepth
>> -      );
>> -  }
>> -
>> -  VmwareSvgaWrite (Private, VmwareSvgaRegEnable, 1);
>> -
>> -  SetDefaultPalette (Private);
>> -  ClearScreen (Private);
>> -}
>> -
>>   EFI_STATUS
>>   EFIAPI
>>   InitializeQemuVideo (
>> diff --git a/OvmfPkg/QemuVideoDxe/Gop.c b/OvmfPkg/QemuVideoDxe/Gop.c
>> index c9941ef138..d490fa7a2e 100644
>> --- a/OvmfPkg/QemuVideoDxe/Gop.c
>> +++ b/OvmfPkg/QemuVideoDxe/Gop.c
>> @@ -13,7 +13,6 @@
>>     **/
>>   -#include <IndustryStandard/VmwareSvga.h>
>>   #include "Qemu.h"
>>     STATIC
>> @@ -79,46 +78,6 @@ QemuVideoCompleteModeData (
>>     return EFI_SUCCESS;
>>   }
>>   -STATIC
>> -EFI_STATUS
>> -QemuVideoVmwareSvgaCompleteModeData (
>> -  IN  QEMU_VIDEO_PRIVATE_DATA           *Private,
>> -  OUT EFI_GRAPHICS_OUTPUT_PROTOCOL_MODE *Mode
>> -  )
>> -{
>> -  EFI_STATUS                            Status;
>> -  EFI_GRAPHICS_OUTPUT_MODE_INFORMATION  *Info;
>> -  EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR     *FrameBufDesc;
>> -  UINT32                                BytesPerLine, FbOffset, 
>> BytesPerPixel;
>> -
>> -  Info = Mode->Info;
>> -  CopyMem (Info, &Private->VmwareSvgaModeInfo[Mode->Mode], sizeof 
>> (*Info));
>> -  BytesPerPixel = Private->ModeData[Mode->Mode].ColorDepth / 8;
>> -  BytesPerLine = Info->PixelsPerScanLine * BytesPerPixel;
>> -
>> -  FbOffset = VmwareSvgaRead (Private, VmwareSvgaRegFbOffset);
>> -
>> -  Status = Private->PciIo->GetBarAttributes (
>> -                             Private->PciIo,
>> -                             PCI_BAR_IDX1,
>> -                             NULL,
>> -                             (VOID**) &FrameBufDesc
>> -                             );
>> -  if (EFI_ERROR (Status)) {
>> -    return EFI_DEVICE_ERROR;
>> -  }
>> -
>> -  Mode->FrameBufferBase = FrameBufDesc->AddrRangeMin + FbOffset;
>> -  Mode->FrameBufferSize = BytesPerLine * Info->VerticalResolution;
>> -  Mode->FrameBufferSize = EFI_PAGES_TO_SIZE (
>> -                            EFI_SIZE_TO_PAGES (Mode->FrameBufferSize)
>> -                            );
>> -
>> -  FreePool (FrameBufDesc);
>> -  return Status;
>> -}
>> -
>> -
>>   //
>>   // Graphics Output Protocol Member Functions
>>   //
>> @@ -167,14 +126,10 @@ Routine Description:
>>       *SizeOfInfo = sizeof (EFI_GRAPHICS_OUTPUT_MODE_INFORMATION);
>>   -  if (Private->Variant == QEMU_VIDEO_VMWARE_SVGA) {
>> -    CopyMem (*Info, &Private->VmwareSvgaModeInfo[ModeNumber], sizeof 
>> (**Info));
>> -  } else {
>> -    ModeData = &Private->ModeData[ModeNumber];
>> -    (*Info)->HorizontalResolution = ModeData->HorizontalResolution;
>> -    (*Info)->VerticalResolution   = ModeData->VerticalResolution;
>> -    QemuVideoCompleteModeInfo (ModeData, *Info);
>> -  }
>> +  ModeData = &Private->ModeData[ModeNumber];
>> +  (*Info)->HorizontalResolution = ModeData->HorizontalResolution;
>> +  (*Info)->VerticalResolution   = ModeData->VerticalResolution;
>> +  QemuVideoCompleteModeInfo (ModeData, *Info);
>>       return EFI_SUCCESS;
>>   }
>> @@ -224,12 +179,6 @@ Routine Description:
>>     case QEMU_VIDEO_BOCHS:
>>       InitializeBochsGraphicsMode (Private, 
>> &QemuVideoBochsModes[ModeData->InternalModeIndex]);
>>       break;
>> -  case QEMU_VIDEO_VMWARE_SVGA:
>> -    InitializeVmwareSvgaGraphicsMode (
>> -      Private,
>> -      &QemuVideoBochsModes[ModeData->InternalModeIndex]
>> -      );
>> -    break;
>>     default:
>>       ASSERT (FALSE);
>>       return EFI_DEVICE_ERROR;
>> @@ -240,11 +189,7 @@ Routine Description:
>>     This->Mode->Info->VerticalResolution = 
>> ModeData->VerticalResolution;
>>     This->Mode->SizeOfInfo = 
>> sizeof(EFI_GRAPHICS_OUTPUT_MODE_INFORMATION);
>>   -  if (Private->Variant == QEMU_VIDEO_VMWARE_SVGA) {
>> -    QemuVideoVmwareSvgaCompleteModeData (Private, This->Mode);
>> -  } else {
>> -    QemuVideoCompleteModeData (Private, This->Mode);
>> -  }
>> +  QemuVideoCompleteModeData (Private, This->Mode);
>>       //
>>     // Re-initialize the frame buffer configure when mode changes.
>> diff --git a/OvmfPkg/QemuVideoDxe/Initialize.c 
>> b/OvmfPkg/QemuVideoDxe/Initialize.c
>> index 357124d628..d5d8cfef96 100644
>> --- a/OvmfPkg/QemuVideoDxe/Initialize.c
>> +++ b/OvmfPkg/QemuVideoDxe/Initialize.c
>> @@ -13,7 +13,6 @@
>>     **/
>>   -#include <IndustryStandard/VmwareSvga.h>
>>   #include "Qemu.h"
>>     @@ -347,159 +346,3 @@ QemuVideoBochsModeSetup (
>>     return EFI_SUCCESS;
>>   }
>>   -EFI_STATUS
>> -QemuVideoVmwareSvgaModeSetup (
>> -  QEMU_VIDEO_PRIVATE_DATA *Private
>> -  )
>> -{
>> -  EFI_STATUS                            Status;
>> -  UINT32                                FbSize;
>> -  UINT32                                MaxWidth, MaxHeight;
>> -  UINT32                                Capabilities;
>> -  UINT32                                BitsPerPixel;
>> -  UINT32                                Index;
>> -  QEMU_VIDEO_MODE_DATA                  *ModeData;
>> -  QEMU_VIDEO_BOCHS_MODES                *VideoMode;
>> -  EFI_GRAPHICS_OUTPUT_MODE_INFORMATION  *ModeInfo;
>> -
>> -  VmwareSvgaWrite (Private, VmwareSvgaRegEnable, 0);
>> -
>> -  Private->ModeData =
>> -    AllocatePool (sizeof (Private->ModeData[0]) * 
>> QEMU_VIDEO_BOCHS_MODE_COUNT);
>> -  if (Private->ModeData == NULL) {
>> -    Status = EFI_OUT_OF_RESOURCES;
>> -    goto ModeDataAllocError;
>> -  }
>> -
>> -  Private->VmwareSvgaModeInfo =
>> -    AllocatePool (
>> -      sizeof (Private->VmwareSvgaModeInfo[0]) * 
>> QEMU_VIDEO_BOCHS_MODE_COUNT
>> -      );
>> -  if (Private->VmwareSvgaModeInfo == NULL) {
>> -    Status = EFI_OUT_OF_RESOURCES;
>> -    goto ModeInfoAllocError;
>> -  }
>> -
>> -  FbSize =       VmwareSvgaRead (Private, VmwareSvgaRegFbSize);
>> -  MaxWidth =     VmwareSvgaRead (Private, VmwareSvgaRegMaxWidth);
>> -  MaxHeight =    VmwareSvgaRead (Private, VmwareSvgaRegMaxHeight);
>> -  Capabilities = VmwareSvgaRead (Private, VmwareSvgaRegCapabilities);
>> -  if ((Capabilities & VMWARE_SVGA_CAP_8BIT_EMULATION) != 0) {
>> -    BitsPerPixel = VmwareSvgaRead (
>> -                     Private,
>> -                     VmwareSvgaRegHostBitsPerPixel
>> -                     );
>> -    VmwareSvgaWrite (
>> -      Private,
>> -      VmwareSvgaRegBitsPerPixel,
>> -      BitsPerPixel
>> -      );
>> -  } else {
>> -    BitsPerPixel = VmwareSvgaRead (
>> -                     Private,
>> -                     VmwareSvgaRegBitsPerPixel
>> -                     );
>> -  }
>> -
>> -  if (FbSize == 0       ||
>> -      MaxWidth == 0     ||
>> -      MaxHeight == 0    ||
>> -      BitsPerPixel == 0 ||
>> -      BitsPerPixel % 8 != 0) {
>> -    Status = EFI_DEVICE_ERROR;
>> -    goto Rollback;
>> -  }
>> -
>> -  ModeData = Private->ModeData;
>> -  ModeInfo = Private->VmwareSvgaModeInfo;
>> -  VideoMode = &QemuVideoBochsModes[0];
>> -  for (Index = 0; Index < QEMU_VIDEO_BOCHS_MODE_COUNT; Index++) {
>> -    UINTN RequiredFbSize;
>> -
>> -    RequiredFbSize = (UINTN) VideoMode->Width * VideoMode->Height *
>> -                     (BitsPerPixel / 8);
>> -    if (RequiredFbSize <= FbSize     &&
>> -        VideoMode->Width <= MaxWidth &&
>> -        VideoMode->Height <= MaxHeight) {
>> -      UINT32  BytesPerLine;
>> -      UINT32  RedMask, GreenMask, BlueMask, PixelMask;
>> -
>> -      VmwareSvgaWrite (
>> -        Private,
>> -        VmwareSvgaRegWidth,
>> -        VideoMode->Width
>> -        );
>> -      VmwareSvgaWrite (
>> -        Private,
>> -        VmwareSvgaRegHeight,
>> -        VideoMode->Height
>> -        );
>> -
>> -      ModeData->InternalModeIndex    = Index;
>> -      ModeData->HorizontalResolution = VideoMode->Width;
>> -      ModeData->VerticalResolution   = VideoMode->Height;
>> -      ModeData->ColorDepth           = BitsPerPixel;
>> -
>> -      //
>> -      // Setting VmwareSvgaRegWidth/VmwareSvgaRegHeight actually 
>> changes
>> -      // the device's display mode, so we save all properties of each 
>> mode up
>> -      // front to avoid inadvertent mode changes later.
>> -      //
>> -      ModeInfo->Version = 0;
>> -      ModeInfo->HorizontalResolution = 
>> ModeData->HorizontalResolution;
>> -      ModeInfo->VerticalResolution   = ModeData->VerticalResolution;
>> -
>> -      ModeInfo->PixelFormat = PixelBitMask;
>> -
>> -      RedMask   = VmwareSvgaRead (Private, VmwareSvgaRegRedMask);
>> -      ModeInfo->PixelInformation.RedMask = RedMask;
>> -
>> -      GreenMask = VmwareSvgaRead (Private, VmwareSvgaRegGreenMask);
>> -      ModeInfo->PixelInformation.GreenMask = GreenMask;
>> -
>> -      BlueMask  = VmwareSvgaRead (Private, VmwareSvgaRegBlueMask);
>> -      ModeInfo->PixelInformation.BlueMask = BlueMask;
>> -
>> -      //
>> -      // Reserved mask is whatever bits in the pixel not containing 
>> RGB data,
>> -      // so start with binary 1s for every bit in the pixel, then 
>> mask off
>> -      // bits already used for RGB. Special case 32 to avoid 
>> undefined
>> -      // behaviour in the shift.
>> -      //
>> -      if (BitsPerPixel == 32) {
>> -        if (BlueMask == 0xff && GreenMask == 0xff00 && RedMask == 
>> 0xff0000) {
>> -          ModeInfo->PixelFormat = 
>> PixelBlueGreenRedReserved8BitPerColor;
>> -        } else if (BlueMask == 0xff0000 &&
>> -                   GreenMask == 0xff00 &&
>> -                   RedMask == 0xff) {
>> -          ModeInfo->PixelFormat = 
>> PixelRedGreenBlueReserved8BitPerColor;
>> -        }
>> -        PixelMask = MAX_UINT32;
>> -      } else {
>> -        PixelMask = (1u << BitsPerPixel) - 1;
>> -      }
>> -      ModeInfo->PixelInformation.ReservedMask =
>> -        PixelMask & ~(RedMask | GreenMask | BlueMask);
>> -
>> -      BytesPerLine = VmwareSvgaRead (Private, 
>> VmwareSvgaRegBytesPerLine);
>> -      ModeInfo->PixelsPerScanLine = BytesPerLine / (BitsPerPixel / 
>> 8);
>> -
>> -      ModeData++;
>> -      ModeInfo++;
>> -    }
>> -    VideoMode++;
>> -  }
>> -  Private->MaxMode = ModeData - Private->ModeData;
>> -  return EFI_SUCCESS;
>> -
>> -Rollback:
>> -  FreePool (Private->VmwareSvgaModeInfo);
>> -  Private->VmwareSvgaModeInfo = NULL;
>> -
>> -ModeInfoAllocError:
>> -  FreePool (Private->ModeData);
>> -  Private->ModeData = NULL;
>> -
>> -ModeDataAllocError:
>> -  return Status;
>> -}
>> diff --git a/OvmfPkg/QemuVideoDxe/Qemu.h b/OvmfPkg/QemuVideoDxe/Qemu.h
>> index bc49f867a4..d7da761705 100644
>> --- a/OvmfPkg/QemuVideoDxe/Qemu.h
>> +++ b/OvmfPkg/QemuVideoDxe/Qemu.h
>> @@ -92,7 +92,6 @@ typedef enum {
>>     QEMU_VIDEO_CIRRUS_5446,
>>     QEMU_VIDEO_BOCHS,
>>     QEMU_VIDEO_BOCHS_MMIO,
>> -  QEMU_VIDEO_VMWARE_SVGA,
>>   } QEMU_VIDEO_VARIANT;
>>     typedef struct {
>> @@ -117,13 +116,10 @@ typedef struct {
>>     //
>>     UINTN                                 MaxMode;
>>     QEMU_VIDEO_MODE_DATA                  *ModeData;
>> -  EFI_GRAPHICS_OUTPUT_MODE_INFORMATION  *VmwareSvgaModeInfo;
>>       QEMU_VIDEO_VARIANT                    Variant;
>>     FRAME_BUFFER_CONFIGURE                *FrameBufferBltConfigure;
>>     UINTN                                 FrameBufferBltConfigureSize;
>> -  UINT8                                 FrameBufferVramBarIndex;
>> -  UINT16                                VmwareSvgaBasePort;
>>   } QEMU_VIDEO_PRIVATE_DATA;
>>     ///
>> @@ -507,34 +503,9 @@ QemuVideoBochsModeSetup (
>>     BOOLEAN                  IsQxl
>>     );
>>   -EFI_STATUS
>> -QemuVideoVmwareSvgaModeSetup (
>> -  QEMU_VIDEO_PRIVATE_DATA *Private
>> -  );
>> -
>>   VOID
>>   InstallVbeShim (
>>     IN CONST CHAR16         *CardName,
>>     IN EFI_PHYSICAL_ADDRESS FrameBufferBase
>>     );
>> -
>> -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
>> -  );
>> -
>>   #endif
>> 



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

* Re: [PATCH 0/4] OvmfPkg: simply use the Bochs interface for vmsvga
  2018-11-01 19:02 ` [PATCH 0/4] " Philippe Mathieu-Daudé
@ 2018-11-02  2:12   ` yuchenlin
  0 siblings, 0 replies; 12+ messages in thread
From: yuchenlin @ 2018-11-02  2:12 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé
  Cc: edk2-devel, phil, jordan.l.justen, anthony.perard, lersek

On 2018-11-02 03:02, Philippe Mathieu-Daudé wrote:
> Hi Yu-chen Lin,
> 
> On 24/10/18 8:40, yuchenlin@synology.com wrote:
>> From: yuchenlin <yuchenlin@synology.com>
>> 
>> In this series, replace the original vmsvga driver to Bochs
>> interface.
> 
> This is the 'v2' of your previous patch 'OvmfPkg: initialize bochs
> when initializing vmsvga':
> https://lists.01.org/pipermail/edk2-devel/2018-October/031235.html
> 
> Keeping different versions and referencing previous series helps when 
> reviewing.
> 

Sorry for that.
I will add v2 (or v3?) next time.

Thanks,
yuchenlin

>> 
>> Simply revert vmsvga driver implementation. After it, use Bochs
>> interface for initializing vmsvga.
>> 
>> Because of the PCI BARs difference between std vga and vmsvga.
>> We can not simply recognize the "QEMU VMWare SVGA" as the
>> QEMU_VIDEO_BOCHS_MMIO variant.
>> 
>> BAR  |    std vga     |  vmsvga
>> ---------------------------------
>> 0    |   Framebuffer  | I/O space
>> 1    |   Reserved     | Framebuffer
>> 2    |   MMIO         | FIFO
>> 
>> To overcome this problem, we remain variant QEMU_VIDEO_VMWARE_SVGA,
>> and use it for:
>> 
>> (1) Get framebuffer from correct PCI BAR
>> (2) Prevent using BAR2 for MMIO
>> 
>> We have tested on qemu before and after commit 104bd1dc70 and all 
>> worked.
> 
> Did you also test against QEMU v2.9.1?
> 

No, but I tested it in QEMU v2.9.0.

Thanks,
yuchenlin

>> 
>> Contributed-under: TianoCore Contribution Agreement 1.1
>> Signed-off-by: yuchenlin <yuchenlin@synology.com>
>> 
>> yuchenlin (4):
>>    Revert "OvmfPkg/QemuVideoDxe: VMWare SVGA device support"
>>    Revert "OvmfPkg/QemuVideoDxe: Helper functions for unaligned port
>>      I/O."
>>    Revert "OvmfPkg/QemuVideoDxe: list "UnalignedIoInternal.h" in the 
>> INF
>>      file"
>>    OvmfPkg: simply use the Bochs interface for vmsvga
>> 
>>   OvmfPkg/QemuVideoDxe/Driver.c                 | 137 ++-------------
>>   OvmfPkg/QemuVideoDxe/Gop.c                    |  68 +-------
>>   OvmfPkg/QemuVideoDxe/Initialize.c             | 157 
>> ------------------
>>   OvmfPkg/QemuVideoDxe/Qemu.h                   |  27 ---
>>   OvmfPkg/QemuVideoDxe/QemuVideoDxe.inf         |   7 -
>>   OvmfPkg/QemuVideoDxe/UnalignedIoGcc.c         |  70 --------
>>   OvmfPkg/QemuVideoDxe/UnalignedIoIcc.c         |  80 ---------
>>   OvmfPkg/QemuVideoDxe/UnalignedIoInternal.h    |  59 -------
>>   OvmfPkg/QemuVideoDxe/UnalignedIoMsc.c         |  78 ---------
>>   OvmfPkg/QemuVideoDxe/UnalignedIoUnsupported.c |  66 --------
>>   10 files changed, 17 insertions(+), 732 deletions(-)
>>   delete mode 100644 OvmfPkg/QemuVideoDxe/UnalignedIoGcc.c
>>   delete mode 100644 OvmfPkg/QemuVideoDxe/UnalignedIoIcc.c
>>   delete mode 100644 OvmfPkg/QemuVideoDxe/UnalignedIoInternal.h
>>   delete mode 100644 OvmfPkg/QemuVideoDxe/UnalignedIoMsc.c
>>   delete mode 100644 OvmfPkg/QemuVideoDxe/UnalignedIoUnsupported.c
>> 



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

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

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-10-24  6:40 [PATCH 0/4] OvmfPkg: simply use the Bochs interface for vmsvga yuchenlin
2018-10-24  6:40 ` [PATCH 1/4] Revert "OvmfPkg/QemuVideoDxe: VMWare SVGA device support" yuchenlin
2018-11-01 18:58   ` Philippe Mathieu-Daudé
2018-11-02  2:09     ` yuchenlin
2018-10-24  6:40 ` [PATCH 2/4] Revert "OvmfPkg/QemuVideoDxe: Helper functions for unaligned port I/O." yuchenlin
2018-10-24  6:40 ` [PATCH 3/4] Revert "OvmfPkg/QemuVideoDxe: list "UnalignedIoInternal.h" in the INF file" yuchenlin
2018-10-24  6:40 ` [PATCH 4/4] OvmfPkg: simply use the Bochs interface for vmsvga yuchenlin
2018-10-24  9:16   ` Gerd Hoffmann
2018-11-01 18:54   ` Philippe Mathieu-Daudé
2018-11-02  2:05     ` yuchenlin
2018-11-01 19:02 ` [PATCH 0/4] " Philippe Mathieu-Daudé
2018-11-02  2:12   ` yuchenlin

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