[Intel-gfx] [PATCH 1/2] drm/i915: add stepping macro

Jesse Barnes jbarnes at virtuousgeek.org
Wed May 21 20:42:25 CEST 2014


In some cases to enable or disable features & workarounds, we may need
to check the GPU stepping.  Add a macro to do that based on caching the
PCI revision ID reg.

Signed-off-by: Jesse Barnes <jbarnes at virtuousgeek.org>
---
 drivers/gpu/drm/i915/i915_dma.c | 2 ++
 drivers/gpu/drm/i915/i915_drv.h | 2 ++
 2 files changed, 4 insertions(+)

diff --git a/drivers/gpu/drm/i915/i915_dma.c b/drivers/gpu/drm/i915/i915_dma.c
index dea455b..9bcbbf2 100644
--- a/drivers/gpu/drm/i915/i915_dma.c
+++ b/drivers/gpu/drm/i915/i915_dma.c
@@ -1565,6 +1565,8 @@ int i915_driver_load(struct drm_device *dev, unsigned long flags)
 	device_info = (struct intel_device_info *)&dev_priv->info;
 	*device_info = *info;
 
+	pci_read_config_byte(dev->pdev, PCI_REVISION_ID, &dev_priv->stepping);
+
 	spin_lock_init(&dev_priv->irq_lock);
 	spin_lock_init(&dev_priv->gpu_error.lock);
 	spin_lock_init(&dev_priv->backlight_lock);
diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
index 5d5e57d..22d57b8 100644
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
@@ -1341,6 +1341,7 @@ struct drm_i915_private {
 	struct kmem_cache *slab;
 
 	const struct intel_device_info info;
+	u8 stepping;
 
 	int relative_constants_mode;
 
@@ -1867,6 +1868,7 @@ struct drm_i915_cmd_table {
 };
 
 #define INTEL_INFO(dev)	(&to_i915(dev)->info)
+#define INTEL_STEPPING(dev) (&to_i915(dev)->stepping)
 
 #define IS_I830(dev)		((dev)->pdev->device == 0x3577)
 #define IS_845G(dev)		((dev)->pdev->device == 0x2562)
-- 
1.8.4.2




More information about the Intel-gfx mailing list