blob: 113a3cf728fc58925560110589c7d5142b4db1ec (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
|
#!/usr/bin/env python3
import chipset
def read(reg):
reg = int(reg, 16)
val = chipset.intel_register_read(reg)
return val
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 dpio_read(reg):
reg = int(reg, 16)
val = chipset.intel_dpio_reg_read(reg)
return val
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_fakewake():
print("Forcing forcewake. Don't expect your system to work after this.")
get_wake()
return True
if __name__ == "__main__":
import sys
if init() == False:
sys.exit()
reg = sys.argv[1]
print(hex(read(reg)))
chipset.intel_register_access_fini()
|