summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYonit Halperin <yhalperi@redhat.com>2013-05-23 13:01:25 -0400
committerYonit Halperin <yhalperi@redhat.com>2013-05-23 13:01:25 -0400
commit6220ad872ed8db016d6649fa1edadbe8da72d849 (patch)
treea3b2426bb9011e2dc8a4a84a722c5a14bccb3424
parentdc445864e8d0d633392e9821fd1f522cec4e93da (diff)
enable CheckHardware and also check if qxl revision is valid
-rw-r--r--C++/bdd.cxx38
1 files changed, 22 insertions, 16 deletions
diff --git a/C++/bdd.cxx b/C++/bdd.cxx
index 9922701..18bd288 100644
--- a/C++/bdd.cxx
+++ b/C++/bdd.cxx
@@ -331,8 +331,8 @@ NTSTATUS BASIC_DISPLAY_DRIVER::StartDevice(_In_ DXGK_START_INFO* pDxgkStartIn
}
}
}
-// TODO: Uncomment the line below after updating the TODOs in the function CheckHardware
-// Status = CheckHardware();
+
+ Status = CheckHardware();
if (!NT_SUCCESS(Status))
{
return Status;
@@ -627,27 +627,33 @@ NTSTATUS BASIC_DISPLAY_DRIVER::CheckHardware()
if (!NT_SUCCESS(Status))
{
+ LogMessage("%s: DxgkCbReadDeviceSpace failed with status 0x%I64x", __FUNCTION__, Status);
BDD_LOG_ERROR1("DxgkCbReadDeviceSpace failed with status 0x%I64x", Status);
return Status;
}
+ LogMessage("%s: vendor-id=0x%x device-id=0x%x revision-id=0x%x\n", __FUNCTION__, Header.VendorID, Header.DeviceID, Header.RevisionID);
+ if (BytesRead < sizeof(PCI_COMMON_HEADER)) {
+ LogMessage("%s: read pci header size %lu expected %lu\n", __FUNCTION__, BytesRead, sizeof(PCI_COMMON_HEADER));
+ return STATUS_GRAPHICS_DRIVER_MISMATCH;
+ }
- VendorID = Header.VendorID;
- DeviceID = Header.DeviceID;
-
-#endif
+ if (Header.VendorID != REDHAT_PCI_VENDOR_ID) {
+ LogMessage("%s: Bad vendor id 0x%x expected 0x%x\n", __FUNCTION__, Header.VendorID, REDHAT_PCI_VENDOR_ID);
+ return STATUS_GRAPHICS_DRIVER_MISMATCH;
+ }
- // TODO: Replace 0x1414 with your Vendor ID
- if (VendorID == 0x1414)
- {
- switch (DeviceID)
- {
- // TODO: Replace the case statements below with the Device IDs supported by this driver
- case 0x0000:
- case 0xFFFF: return STATUS_SUCCESS;
- }
+ if (Header.DeviceID != QXL_DEVICE_ID_STABLE) {
+ LogMessage("%s: Bad device id 0x%x expected 0x%x\n", __FUNCTION__, Header.DeviceID, QXL_DEVICE_ID_STABLE);
+ return STATUS_GRAPHICS_DRIVER_MISMATCH;
}
- return STATUS_GRAPHICS_DRIVER_MISMATCH;
+ // TODO: change revision threshold in case we will require a higher pci revision
+ if (Header.RevisionID < QXL_REVISION_STABLE_V06) {
+ LogMessage("%s: Bad revision 0x%x expects at least 0x%x\n", __FUNCTION__, Header.RevisionID, QXL_REVISION_STABLE_V06);
+ return STATUS_GRAPHICS_DRIVER_MISMATCH;
+ }
+ m_pci_revision = Header.RevisionID;
+ return STATUS_SUCCESS;
}
// Even though Sample Basic Display Driver does not support hardware cursors, and reports such