Merge remote branch 'origin/master' into drm-intel-next
[pandora-kernel.git] / drivers / gpu / drm / i915 / i915_drv.c
index cc03537..5c51e45 100644 (file)
@@ -188,6 +188,35 @@ const static struct pci_device_id pciidlist[] = {
 MODULE_DEVICE_TABLE(pci, pciidlist);
 #endif
 
+#define INTEL_PCH_DEVICE_ID_MASK       0xff00
+#define INTEL_PCH_CPT_DEVICE_ID_TYPE   0x1c00
+
+void intel_detect_pch (struct drm_device *dev)
+{
+       struct drm_i915_private *dev_priv = dev->dev_private;
+       struct pci_dev *pch;
+
+       /*
+        * The reason to probe ISA bridge instead of Dev31:Fun0 is to
+        * make graphics device passthrough work easy for VMM, that only
+        * need to expose ISA bridge to let driver know the real hardware
+        * underneath. This is a requirement from virtualization team.
+        */
+       pch = pci_get_class(PCI_CLASS_BRIDGE_ISA << 8, NULL);
+       if (pch) {
+               if (pch->vendor == PCI_VENDOR_ID_INTEL) {
+                       int id;
+                       id = pch->device & INTEL_PCH_DEVICE_ID_MASK;
+
+                       if (id == INTEL_PCH_CPT_DEVICE_ID_TYPE) {
+                               dev_priv->pch_type = PCH_CPT;
+                               DRM_DEBUG_KMS("Found CougarPoint PCH\n");
+                       }
+               }
+               pci_dev_put(pch);
+       }
+}
+
 static int i915_drm_freeze(struct drm_device *dev)
 {
        struct drm_i915_private *dev_priv = dev->dev_private;