diff options
author | Christophe Fergeau <cfergeau@redhat.com> | 2012-02-21 22:44:27 +0100 |
---|---|---|
committer | Christophe Fergeau <cfergeau@redhat.com> | 2012-02-21 22:44:36 +0100 |
commit | 13864a4590abb666f83a03eae16f11847988e34a (patch) | |
tree | 59ba6c8af224f3fb300cf4043db21b53ebb9881e | |
parent | 62fb67acfb3bc7309098accccbe297aa9ddeb1a8 (diff) |
mingw hacks, needs to be split/cleanupmingw
-rw-r--r-- | include/os_dep.h | 2 | ||||
-rw-r--r-- | include/qxl_driver.h | 2 | ||||
-rw-r--r-- | miniport/qxl.c | 107 | ||||
-rw-r--r-- | miniport/qxl.h | 1 |
4 files changed, 108 insertions, 4 deletions
diff --git a/include/os_dep.h b/include/os_dep.h index ad229e2..6b5006c 100644 --- a/include/os_dep.h +++ b/include/os_dep.h @@ -23,6 +23,7 @@ #define OS_DEP_H #if (WINVER < 0x0501) //Definitions for Win2K +#ifndef __MINGW32__ typedef signed char INT8, *PINT8; typedef signed short INT16, *PINT16; typedef signed int INT32, *PINT32; @@ -31,6 +32,7 @@ typedef unsigned char UINT8, *PUINT8; typedef unsigned short UINT16, *PUINT16; typedef unsigned int UINT32, *PUINT32; typedef unsigned __int64 UINT64, *PUINT64; +#endif #define SIZE_OF_W2K_VIDEO_HW_INITIALIZATION_DATA 0x50 diff --git a/include/qxl_driver.h b/include/qxl_driver.h index f425af0..9548c33 100644 --- a/include/qxl_driver.h +++ b/include/qxl_driver.h @@ -28,6 +28,8 @@ #include "wdmhelper.h" #endif +#define _inline inline + enum { FIRST_AVIL_IOCTL_FUNC = 0x800, QXL_GET_INFO_FUNC = FIRST_AVIL_IOCTL_FUNC 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" |