[Intel-gfx] [PATCH 5/5] reg_access: Forcewake as necessary

Ben Widawsky ben at bwidawsk.net
Fri Feb 22 07:05:36 CET 2013


Don't try to be smart. Just poke all forcewake bits if it seems we need
it.

Signed-off-by: Ben Widawsky <ben at bwidawsk.net>
---
 tools/quick_dump/chipset.i     |  2 ++
 tools/quick_dump/reg_access.py | 23 +++++++++++++++++++++++
 2 files changed, 25 insertions(+)

diff --git a/tools/quick_dump/chipset.i b/tools/quick_dump/chipset.i
index e1f262d..36e7f4c 100644
--- a/tools/quick_dump/chipset.i
+++ b/tools/quick_dump/chipset.i
@@ -12,6 +12,7 @@ extern int intel_register_access_init(struct pci_device *pci_dev, int safe);
 extern uint32_t intel_register_read(uint32_t reg);
 extern uint32_t intel_register_write(uint32_t reg, uint32_t val);
 extern void intel_register_access_fini();
+extern int intel_register_access_needs_wake();
 extern unsigned short pcidev_to_devid(struct pci_device *pci_dev);
 %}
 
@@ -23,4 +24,5 @@ extern int intel_register_access_init(struct pci_device *pci_dev, int safe);
 extern uint32_t intel_register_read(uint32_t reg);
 extern uint32_t intel_register_write(uint32_t reg, uint32_t val);
 extern void intel_register_access_fini();
+extern int intel_register_access_needs_wake();
 extern unsigned short pcidev_to_devid(struct pci_device *pci_dev);
diff --git a/tools/quick_dump/reg_access.py b/tools/quick_dump/reg_access.py
index e064c99..b7f3100 100755
--- a/tools/quick_dump/reg_access.py
+++ b/tools/quick_dump/reg_access.py
@@ -9,12 +9,35 @@ def read(reg):
 def write(reg, val):
 	chipset.intel_register_write(reg, val)
 
+def gen6_forcewake_get():
+	write(0xa18c, 0x1)
+	read("0xa180")
+
+def mt_forcewake_get():
+	write(0xa188, 0x10001)
+	read("0xa180")
+
+def vlv_forcewake_get():
+	write(0x1300b0, 0x10001)
+	read("0x1300b4")
+
+# don't be clever, just try all possibilities
+def get_wake():
+	gen6_forcewake_get()
+	mt_forcewake_get()
+	vlv_forcewake_get()
+
 def init():
 	pci_dev = chipset.intel_get_pci_device()
 	ret = chipset.intel_register_access_init(pci_dev, 0)
 	if ret != 0:
 		print("Register access init failed");
 		return False
+
+	if chipset.intel_register_access_needs_wake():
+		print("Forcing forcewake. Don't expect your system to work after this.")
+		get_wake()
+
 	return True
 
 if __name__ == "__main__":
-- 
1.8.1.4




More information about the Intel-gfx mailing list