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

2014-05-21 Thread Jesse Barnes
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 jbar...@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

___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx


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

2014-05-21 Thread Chris Wilson
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

-- 
Chris Wilson, Intel Open Source Technology Centre
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx


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

2014-05-21 Thread Jesse Barnes
On Wed, 21 May 2014 19:50:53 +0100
Chris Wilson ch...@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.

-- 
Jesse Barnes, Intel Open Source Technology Center
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx