diff mbox

[1/2] drm/i915: add stepping macro

Message ID 1400697746-7511-1-git-send-email-jbarnes@virtuousgeek.org (mailing list archive)
State New, archived
Headers show

Commit Message

Jesse Barnes May 21, 2014, 6:42 p.m. UTC
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@virtuousgeek.org>
---
 drivers/gpu/drm/i915/i915_dma.c | 2 ++
 drivers/gpu/drm/i915/i915_drv.h | 2 ++
 2 files changed, 4 insertions(+)

Comments

Chris Wilson May 21, 2014, 6:50 p.m. UTC | #1
On Wed, May 21, 2014 at 11:42:25AM -0700, Jesse Barnes wrote:
> 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.

What about just using dev->pdev->revision like we already do?
-Chris
Jesse Barnes May 21, 2014, 7:43 p.m. UTC | #2
On Wed, 21 May 2014 19:50:53 +0100
Chris Wilson <chris@chris-wilson.co.uk> wrote:

> On Wed, May 21, 2014 at 11:42:25AM -0700, Jesse Barnes wrote:
> > 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.
> 
> What about just using dev->pdev->revision like we already do?

Oh missed that, was looking for stepping comments and didn't see it.
Yeah that's fine.
diff mbox

Patch

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)