summaryrefslogtreecommitdiff
path: root/miniport
diff options
context:
space:
mode:
Diffstat (limited to 'miniport')
-rw-r--r--miniport/qxl.c107
-rw-r--r--miniport/qxl.h1
2 files changed, 104 insertions, 4 deletions
diff --git a/miniport/qxl.c b/miniport/qxl.c
index 68a20f0..ab4f4b0 100644
--- a/miniport/qxl.c
+++ b/miniport/qxl.c
@@ -19,12 +19,113 @@
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*/
+#include <ntdef.h>
+#include <windef.h>
+#include <miniport.h>
+#include <video.h>
#include "os_dep.h"
#include "qxl.h"
#if (WINVER < 0x0501)
#include "wdmhelper.h"
#endif
+#define ASSERT(x)
+
+#define PCI_TYPE0_ADDRESSES 6
+#define PCI_TYPE1_ADDRESSES 2
+#define PCI_TYPE2_ADDRESSES 5
+
+/* While MS WDK uses inheritance in C++, we cannot do this with gcc, as
+ inheritance, even from a struct renders the type non-POD. So we use
+ this hack */
+#define PCI_COMMON_HEADER_LAYOUT \
+ USHORT VendorID; \
+ USHORT DeviceID; \
+ USHORT Command; \
+ USHORT Status; \
+ UCHAR RevisionID; \
+ UCHAR ProgIf; \
+ UCHAR SubClass; \
+ UCHAR BaseClass; \
+ UCHAR CacheLineSize; \
+ UCHAR LatencyTimer; \
+ UCHAR HeaderType; \
+ UCHAR BIST; \
+ union { \
+ struct _PCI_HEADER_TYPE_0 { \
+ ULONG BaseAddresses[PCI_TYPE0_ADDRESSES]; \
+ ULONG CIS; \
+ USHORT SubVendorID; \
+ USHORT SubSystemID; \
+ ULONG ROMBaseAddress; \
+ UCHAR CapabilitiesPtr; \
+ UCHAR Reserved1[3]; \
+ ULONG Reserved2; \
+ UCHAR InterruptLine; \
+ UCHAR InterruptPin; \
+ UCHAR MinimumGrant; \
+ UCHAR MaximumLatency; \
+ } type0; \
+ struct _PCI_HEADER_TYPE_1 { \
+ ULONG BaseAddresses[PCI_TYPE1_ADDRESSES]; \
+ UCHAR PrimaryBus; \
+ UCHAR SecondaryBus; \
+ UCHAR SubordinateBus; \
+ UCHAR SecondaryLatency; \
+ UCHAR IOBase; \
+ UCHAR IOLimit; \
+ USHORT SecondaryStatus; \
+ USHORT MemoryBase; \
+ USHORT MemoryLimit; \
+ USHORT PrefetchBase; \
+ USHORT PrefetchLimit; \
+ ULONG PrefetchBaseUpper32; \
+ ULONG PrefetchLimitUpper32; \
+ USHORT IOBaseUpper16; \
+ USHORT IOLimitUpper16; \
+ UCHAR CapabilitiesPtr; \
+ UCHAR Reserved1[3]; \
+ ULONG ROMBaseAddress; \
+ UCHAR InterruptLine; \
+ UCHAR InterruptPin; \
+ USHORT BridgeControl; \
+ } type1; \
+ struct _PCI_HEADER_TYPE_2 { \
+ ULONG SocketRegistersBaseAddress; \
+ UCHAR CapabilitiesPtr; \
+ UCHAR Reserved; \
+ USHORT SecondaryStatus; \
+ UCHAR PrimaryBus; \
+ UCHAR SecondaryBus; \
+ UCHAR SubordinateBus; \
+ UCHAR SecondaryLatency; \
+ struct { \
+ ULONG Base; \
+ ULONG Limit; \
+ } Range[PCI_TYPE2_ADDRESSES-1]; \
+ UCHAR InterruptLine; \
+ UCHAR InterruptPin; \
+ USHORT BridgeControl; \
+ } type2; \
+ } u;
+
+
+typedef struct _PCI_COMMON_HEADER {
+ PCI_COMMON_HEADER_LAYOUT
+} PCI_COMMON_HEADER, *PPCI_COMMON_HEADER;
+
+#ifdef __cplusplus
+typedef struct _PCI_COMMON_CONFIG {
+ PCI_COMMON_HEADER_LAYOUT
+ UCHAR DeviceSpecific[192];
+} PCI_COMMON_CONFIG, *PPCI_COMMON_CONFIG;
+#else
+typedef struct _PCI_COMMON_CONFIG {
+ PCI_COMMON_HEADER foo;
+ UCHAR DeviceSpecific[192];
+} PCI_COMMON_CONFIG, *PPCI_COMMON_CONFIG;
+#endif
+
VP_STATUS FindAdapter(PVOID dev_extension,
PVOID reserved,
PWSTR arg_str,
@@ -321,19 +422,19 @@ VP_STATUS Prob(QXLExtension *dev, VIDEO_PORT_CONFIG_INFO *conf_info,
return ERROR_INVALID_PARAMETER;
}
- if (pci_conf.VendorID != REDHAT_PCI_VENDOR_ID) {
+ if (pci_conf.foo.VendorID != REDHAT_PCI_VENDOR_ID) {
DEBUG_PRINT((0, "%s: bad vendor id 0x%x expectes 0x%x\n",
__FUNCTION__, pci_conf.VendorID, REDHAT_PCI_VENDOR_ID));
return ERROR_INVALID_PARAMETER;
}
- if (pci_conf.DeviceID != QXL_DEVICE_ID_STABLE) {
+ if (pci_conf.foo.DeviceID != QXL_DEVICE_ID_STABLE) {
DEBUG_PRINT((0, "%s: bad vendor id 0x%x expectes 0x%x\n",
__FUNCTION__, pci_conf.DeviceID, QXL_DEVICE_ID_STABLE));
return ERROR_INVALID_PARAMETER;
}
- if (pci_conf.RevisionID < QXL_REVISION_STABLE_V06) {
+ if (pci_conf.foo.RevisionID < QXL_REVISION_STABLE_V06) {
DEBUG_PRINT((0, "%s: bad revision 0x%x expectes at least 0x%x\n",
__FUNCTION__, pci_conf.RevisionID, QXL_REVISION_STABLE_V06));
return ERROR_INVALID_PARAMETER;
diff --git a/miniport/qxl.h b/miniport/qxl.h
index a65d590..eaf5ce2 100644
--- a/miniport/qxl.h
+++ b/miniport/qxl.h
@@ -21,7 +21,6 @@
#include "winerror.h"
#include "devioctl.h"
-#include "miniport.h"
#include "ntddvdeo.h"
#include "video.h"