[edk2] [PATCH v3 1/3] OvmfPkg: VMWare SVGA display device register definitions

Phil Dennis-Jordan posted 3 patches 7 years, 7 months ago
There is a newer version of this series
[edk2] [PATCH v3 1/3] OvmfPkg: VMWare SVGA display device register definitions
Posted by Phil Dennis-Jordan 7 years, 7 months ago
From: Phil Dennis-Jordan <phil@philjordan.eu>

This adds a header file defining symbolic constants for the VMWare SVGA
virtual display device in preparation for supporting it in
QemuVideoDxe.

It is mostly an extract of the file lib/vmware/svga_reg.h from commit
329dd537456f93a806841ec8a8213aed11395def of VMWare's vmware-svga
repository at git://git.code.sf.net/p/vmware-svga/git (See also
http://vmware-svga.sourceforge.net/ )

Only the bare essentials necessary for initialisation, modesetting and
framebuffer access have been kept from the original file; macro names
have been prefixed with VMWARE_SVGA_ instead of SVGA2_, and the enum
definition has been adapted to comply with EDK2 naming conventions.

The original file was released by VMWare under the MIT license, this
has been retained.

Cc: Jordan Justen <jordan.l.justen@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Phil Dennis-Jordan <phil@philjordan.eu>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
---

Notes:
    v2:
    - New, custom header file instead of importing VMWare's verbatim. [Laszlo]
    
    v3:
    - Prefixed macros with VMWARE_SVGA_ instead of SVGA2_ [Jordan, Laszlo]
    - Adjusted enum definition to comply with EDK2 convention [Jordan, Laszlo]
    - Tweaks to definitions of numeric constants [Laszlo]
    - Renamed the file to fit with convention [Jordan, Laszlo]
    - Dropped the "2" from SVGA2 wherever appropriate.

 OvmfPkg/Include/IndustryStandard/VmwareSvga.h | 104 ++++++++++++++++++++
 1 file changed, 104 insertions(+)

diff --git a/OvmfPkg/Include/IndustryStandard/VmwareSvga.h b/OvmfPkg/Include/IndustryStandard/VmwareSvga.h
new file mode 100644
index 000000000000..693d44bab6c3
--- /dev/null
+++ b/OvmfPkg/Include/IndustryStandard/VmwareSvga.h
@@ -0,0 +1,104 @@
+/** @file
+
+  Macro and enum definitions of a subset of port numbers, register identifiers
+  and values required for driving the VMWare SVGA virtual display adapter,
+  also implemented by Qemu.
+
+  This file's contents was extracted from file lib/vmware/svga_reg.h in commit
+  329dd537456f93a806841ec8a8213aed11395def of VMWare's vmware-svga repository:
+  git://git.code.sf.net/p/vmware-svga/git
+
+
+  Copyright 1998-2009 VMware, Inc.  All rights reserved.
+  Portions Copyright 2017 Phil Dennis-Jordan <phil@philjordan.eu>
+
+  Permission is hereby granted, free of charge, to any person
+  obtaining a copy of this software and associated documentation
+  files (the "Software"), to deal in the Software without
+  restriction, including without limitation the rights to use, copy,
+  modify, merge, publish, distribute, sublicense, and/or sell copies
+  of the Software, and to permit persons to whom the Software is
+  furnished to do so, subject to the following conditions:
+
+  The above copyright notice and this permission notice shall be
+  included in all copies or substantial portions of the Software.
+
+  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+  MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+  NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+  BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+  ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+  CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+  SOFTWARE.
+
+**/
+
+#ifndef _VMWARE_SVGA_H_
+#define _VMWARE_SVGA_H_
+
+#include <Base.h>
+
+//
+// IDs for recognising the device
+//
+#define VMWARE_PCI_VENDOR_ID_VMWARE            0x15AD
+#define VMWARE_PCI_DEVICE_ID_VMWARE_SVGA2      0x0405
+
+//
+// I/O port BAR offsets for register selection and read/write.
+//
+// The register index is written to the 32-bit index port, followed by a 32-bit
+// read or write on the value port to read or set that register's contents.
+//
+#define VMWARE_SVGA_INDEX_PORT         0x0
+#define VMWARE_SVGA_VALUE_PORT         0x1
+
+//
+// Some of the device's register indices for basic framebuffer functionality.
+//
+typedef enum {
+  VmwareSvgaRegId = 0,
+  VmwareSvgaRegEnable = 1,
+  VmwareSvgaRegWidth = 2,
+  VmwareSvgaRegHeight = 3,
+  VmwareSvgaRegMaxWidth = 4,
+  VmwareSvgaRegMaxHeight = 5,
+
+  VmwareSvgaRegBitsPerPixel = 7,
+
+  VmwareSvgaRegRedMask = 9,
+  VmwareSvgaRegGreenMask = 10,
+  VmwareSvgaRegBlueMask = 11,
+  VmwareSvgaRegBytesPerLine = 12,
+
+  VmwareSvgaRegFbOffset = 14,
+
+  VmwareSvgaRegFbSize = 16,
+  VmwareSvgaRegCapabilities = 17,
+
+  VmwareSvgaRegHostBitsPerPixel = 28,
+} VMWARE_SVGA_REGISTER;
+
+//
+// Values used with VmwareSvgaRegId for sanity-checking the device and getting
+// its version.
+//
+#define VMWARE_SVGA_MAGIC          0x900000U
+#define VMWARE_SVGA_MAKE_ID(ver)   (VMWARE_SVGA_MAGIC << 8 | (ver))
+
+#define VMWARE_SVGA_VERSION_2      2
+#define VMWARE_SVGA_ID_2           VMWARE_SVGA_MAKE_ID (VMWARE_SVGA_VERSION_2)
+
+#define VMWARE_SVGA_VERSION_1      1
+#define VMWARE_SVGA_ID_1           VMWARE_SVGA_MAKE_ID (VMWARE_SVGA_VERSION_1)
+
+#define VMWARE_SVGA_VERSION_0      0
+#define VMWARE_SVGA_ID_0           VMWARE_SVGA_MAKE_ID (VMWARE_SVGA_VERSION_0)
+
+//
+// One of the capability bits advertised by VmwareSvgaRegCapabilities.
+//
+#define VMWARE_SVGA_CAP_8BIT_EMULATION     BIT8
+
+#endif
-- 
2.3.2 (Apple Git-55)

_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel
Re: [edk2] [PATCH v3 1/3] OvmfPkg: VMWare SVGA display device register definitions
Posted by Laszlo Ersek 7 years, 7 months ago
On 04/05/17 11:57, Phil Dennis-Jordan wrote:
> From: Phil Dennis-Jordan <phil@philjordan.eu>
> 
> This adds a header file defining symbolic constants for the VMWare SVGA
> virtual display device in preparation for supporting it in
> QemuVideoDxe.
> 
> It is mostly an extract of the file lib/vmware/svga_reg.h from commit
> 329dd537456f93a806841ec8a8213aed11395def of VMWare's vmware-svga
> repository at git://git.code.sf.net/p/vmware-svga/git (See also
> http://vmware-svga.sourceforge.net/ )
> 
> Only the bare essentials necessary for initialisation, modesetting and
> framebuffer access have been kept from the original file; macro names
> have been prefixed with VMWARE_SVGA_ instead of SVGA2_, and the enum
> definition has been adapted to comply with EDK2 naming conventions.
> 
> The original file was released by VMWare under the MIT license, this
> has been retained.
> 
> Cc: Jordan Justen <jordan.l.justen@intel.com>
> Cc: Laszlo Ersek <lersek@redhat.com>
> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: Phil Dennis-Jordan <phil@philjordan.eu>
> Reviewed-by: Laszlo Ersek <lersek@redhat.com>
> ---
> 
> Notes:
>     v2:
>     - New, custom header file instead of importing VMWare's verbatim. [Laszlo]
>     
>     v3:
>     - Prefixed macros with VMWARE_SVGA_ instead of SVGA2_ [Jordan, Laszlo]
>     - Adjusted enum definition to comply with EDK2 convention [Jordan, Laszlo]
>     - Tweaks to definitions of numeric constants [Laszlo]
>     - Renamed the file to fit with convention [Jordan, Laszlo]
>     - Dropped the "2" from SVGA2 wherever appropriate.
> 
>  OvmfPkg/Include/IndustryStandard/VmwareSvga.h | 104 ++++++++++++++++++++
>  1 file changed, 104 insertions(+)
> 
> diff --git a/OvmfPkg/Include/IndustryStandard/VmwareSvga.h b/OvmfPkg/Include/IndustryStandard/VmwareSvga.h
> new file mode 100644
> index 000000000000..693d44bab6c3
> --- /dev/null
> +++ b/OvmfPkg/Include/IndustryStandard/VmwareSvga.h
> @@ -0,0 +1,104 @@
> +/** @file
> +
> +  Macro and enum definitions of a subset of port numbers, register identifiers
> +  and values required for driving the VMWare SVGA virtual display adapter,
> +  also implemented by Qemu.
> +
> +  This file's contents was extracted from file lib/vmware/svga_reg.h in commit
> +  329dd537456f93a806841ec8a8213aed11395def of VMWare's vmware-svga repository:
> +  git://git.code.sf.net/p/vmware-svga/git
> +
> +
> +  Copyright 1998-2009 VMware, Inc.  All rights reserved.
> +  Portions Copyright 2017 Phil Dennis-Jordan <phil@philjordan.eu>
> +
> +  Permission is hereby granted, free of charge, to any person
> +  obtaining a copy of this software and associated documentation
> +  files (the "Software"), to deal in the Software without
> +  restriction, including without limitation the rights to use, copy,
> +  modify, merge, publish, distribute, sublicense, and/or sell copies
> +  of the Software, and to permit persons to whom the Software is
> +  furnished to do so, subject to the following conditions:
> +
> +  The above copyright notice and this permission notice shall be
> +  included in all copies or substantial portions of the Software.
> +
> +  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
> +  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
> +  MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
> +  NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
> +  BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
> +  ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
> +  CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
> +  SOFTWARE.
> +
> +**/
> +
> +#ifndef _VMWARE_SVGA_H_
> +#define _VMWARE_SVGA_H_
> +
> +#include <Base.h>
> +
> +//
> +// IDs for recognising the device
> +//
> +#define VMWARE_PCI_VENDOR_ID_VMWARE            0x15AD
> +#define VMWARE_PCI_DEVICE_ID_VMWARE_SVGA2      0x0405
> +
> +//
> +// I/O port BAR offsets for register selection and read/write.
> +//
> +// The register index is written to the 32-bit index port, followed by a 32-bit
> +// read or write on the value port to read or set that register's contents.
> +//
> +#define VMWARE_SVGA_INDEX_PORT         0x0
> +#define VMWARE_SVGA_VALUE_PORT         0x1
> +
> +//
> +// Some of the device's register indices for basic framebuffer functionality.
> +//
> +typedef enum {
> +  VmwareSvgaRegId = 0,
> +  VmwareSvgaRegEnable = 1,
> +  VmwareSvgaRegWidth = 2,
> +  VmwareSvgaRegHeight = 3,
> +  VmwareSvgaRegMaxWidth = 4,
> +  VmwareSvgaRegMaxHeight = 5,
> +
> +  VmwareSvgaRegBitsPerPixel = 7,
> +
> +  VmwareSvgaRegRedMask = 9,
> +  VmwareSvgaRegGreenMask = 10,
> +  VmwareSvgaRegBlueMask = 11,
> +  VmwareSvgaRegBytesPerLine = 12,
> +
> +  VmwareSvgaRegFbOffset = 14,
> +
> +  VmwareSvgaRegFbSize = 16,
> +  VmwareSvgaRegCapabilities = 17,
> +
> +  VmwareSvgaRegHostBitsPerPixel = 28,
> +} VMWARE_SVGA_REGISTER;
> +
> +//
> +// Values used with VmwareSvgaRegId for sanity-checking the device and getting
> +// its version.
> +//
> +#define VMWARE_SVGA_MAGIC          0x900000U
> +#define VMWARE_SVGA_MAKE_ID(ver)   (VMWARE_SVGA_MAGIC << 8 | (ver))
> +
> +#define VMWARE_SVGA_VERSION_2      2
> +#define VMWARE_SVGA_ID_2           VMWARE_SVGA_MAKE_ID (VMWARE_SVGA_VERSION_2)
> +
> +#define VMWARE_SVGA_VERSION_1      1
> +#define VMWARE_SVGA_ID_1           VMWARE_SVGA_MAKE_ID (VMWARE_SVGA_VERSION_1)
> +
> +#define VMWARE_SVGA_VERSION_0      0
> +#define VMWARE_SVGA_ID_0           VMWARE_SVGA_MAKE_ID (VMWARE_SVGA_VERSION_0)
> +
> +//
> +// One of the capability bits advertised by VmwareSvgaRegCapabilities.
> +//
> +#define VMWARE_SVGA_CAP_8BIT_EMULATION     BIT8
> +
> +#endif
> 

Looks good to me, thanks!
Laszlo
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel