From 57bc7631e161a7bdcf7f68e1a46049dcb49c2256 Mon Sep 17 00:00:00 2001 From: Ben Widawsky Date: Thu, 23 May 2013 11:09:55 -0700 Subject: lib/intel_mmio: Fix the fix commit 16e44f5499e1754dfb10fc62b22675f5aa6ac781 Author: Daniel Vetter 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 --- lib/intel_mmio.c | 13 +++++-------- 1 file 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"); -- cgit v1.2.3