Skip to content

Commit b552a58

Browse files
author
r4m0n
committed
Adding C6 state enable/disable
1 parent 79ed1fc commit b552a58

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed

README.md

+2
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ Requires root access and the msr kernel module loaded (just run "modprobe msr" a
2020
-f FID, --fid FID FID to set (in hex)
2121
-d DID, --did DID DID to set (in hex)
2222
-v VID, --vid VID VID to set (in hex)
23+
--c6-enable Enable C-State C6
24+
--c6-disable Disable C-State C6
2325

2426

2527
## togglecode.py

zenstates.py

+15-1
Original file line numberDiff line numberDiff line change
@@ -66,12 +66,16 @@ def hex(x):
6666
parser.add_argument('-f', '--fid', default=-1, type=hex, help='FID to set (in hex)')
6767
parser.add_argument('-d', '--did', default=-1, type=hex, help='DID to set (in hex)')
6868
parser.add_argument('-v', '--vid', default=-1, type=hex, help='VID to set (in hex)')
69+
parser.add_argument('--c6-enable', action='store_true', help='Enable C-State C6')
70+
parser.add_argument('--c6-disable', action='store_true', help='Disable C-State C6')
6971

7072
args = parser.parse_args()
7173

7274
if args.list:
7375
for p in range(len(pstates)):
7476
print('P' + str(p) + " - " + pstate2str(readmsr(pstates[p])))
77+
print('C6 State - Package - ' + ('Enabled' if readmsr(0xC0010292) & (1 << 32) else 'Disabled'))
78+
print('C6 State - Core - ' + ('Enabled' if readmsr(0xC0010296) & ((1 << 22) | (1 << 14) | (1 << 6)) == ((1 << 22) | (1 << 14) | (1 << 6)) else 'Disabled'))
7579

7680
if args.pstate >= 0:
7781
new = old = readmsr(pstates[args.pstate])
@@ -99,5 +103,15 @@ def hex(x):
99103
print('New P' + str(args.pstate) + ': ' + pstate2str(new))
100104
writemsr(pstates[args.pstate], new)
101105

102-
if not args.list and args.pstate == -1:
106+
if args.c6_enable:
107+
writemsr(0xC0010292, readmsr(0xC0010292) | (1 << 32))
108+
writemsr(0xC0010296, readmsr(0xC0010296) | ((1 << 22) | (1 << 14) | (1 << 6)))
109+
print('Enabling C6 state')
110+
111+
if args.c6_disable:
112+
writemsr(0xC0010292, readmsr(0xC0010292) & ~(1 << 32))
113+
writemsr(0xC0010296, readmsr(0xC0010296) & ~((1 << 22) | (1 << 14) | (1 << 6)))
114+
print('Disabling C6 state')
115+
116+
if not args.list and args.pstate == -1 and not args.c6_enable and not args.c6_disable:
103117
parser.print_help()

0 commit comments

Comments
 (0)