summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Widawsky <ben@bwidawsk.net>2013-05-23 11:09:55 -0700
committerBen Widawsky <ben@bwidawsk.net>2013-05-23 11:12:32 -0700
commit57bc7631e161a7bdcf7f68e1a46049dcb49c2256 (patch)
tree79dd4f3c8b21e86c3d5f8f3068ac0aaefffd9e75
parenta08d62257dbdc8f4d3f5e655e0ba7bd192af37ff (diff)
lib/intel_mmio: Fix the fix
commit 16e44f5499e1754dfb10fc62b22675f5aa6ac781 Author: Daniel Vetter <daniel.vetter@ffwll.ch> Date: Wed Apr 3 00:22:41 2013 +0200 lib: fixup register access on gen2/3 THis fix was incorrect for a few reasons: 1. It didn't reflect the state in mmio_data.safe 2. It skipped forcewake on gen6+ which is both incorrect and unnecessary (for gen<6). 3. It had 2 goto done, the second of which was impossible to hit. Signed-off-by: Ben Widawsky <ben@bwidawsk.net>
-rw-r--r--lib/intel_mmio.c13
1 files changed, 5 insertions, 8 deletions
diff --git a/lib/intel_mmio.c b/lib/intel_mmio.c
index 7c26a29e..21a84d48 100644
--- a/lib/intel_mmio.c
+++ b/lib/intel_mmio.c
@@ -191,18 +191,15 @@ intel_register_access_init(struct pci_device *pci_dev, int safe)
if (mmio_data.inited)
return -1;
- if (intel_gen(pci_dev->device_id) >= 6)
- goto done;
- mmio_data.safe = safe != 0 ? true : false;
+ mmio_data.safe = (safe != 0 && pci_dev->device_id >= 4) ? true : false;
mmio_data.i915_devid = pci_dev->device_id;
- if (mmio_data.safe && intel_gen(pci_dev->device_id) >= 4)
+ if (mmio_data.safe)
mmio_data.map = intel_get_register_map(mmio_data.i915_devid);
- if (intel_gen(pci_dev->device_id) >= 6)
- goto done;
-
- /* Find where the forcewake lock is */
+ /* Find where the forcewake lock is. Forcewake doesn't exist
+ * gen < 6, but the debugfs should do the right things for us.
+ */
ret = find_debugfs_path("/sys/kernel/debug/dri");
if (ret) {
ret = find_debugfs_path("/debug/dri");