summaryrefslogtreecommitdiffstats
path: root/woferclock/woferclock_cpu
blob: 66b4efbe8d2519a8138584212ec13c7bd21c4ef5 (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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
#!/bin/bash
#
# Copyright (c) 2018 Raptor Engineering, LLC
# Released under the terms of the AGPL v3
#
# Provided WITHOUT WARRANTY OF ANY KIND, to the
# maximum extent possible under law.  Modify at
# your sole risk!

set -e

echo "======================================================================"
echo "Welcome to WoFerClock!"
echo ""
echo "This program is free software, developed by Raptor Engineering, LLC"
echo "for use with the Talos II line of POWER9 machines:"
echo ""
echo "https://www.raptorcs.com/TALOSII"
echo ""
echo "======================================================================"
echo "WARNING"
echo "======================================================================"
echo "This program will alter the Vital Product Data (VPD) of your CPU(s)"
echo ""
echo "We strongly recommend you back up the original VPD image(s) in the"
echo "unlikely event the VPD of your CPU(s) is corrupted.  These images"
echo "will be available in the vpd_backup directory after this program"
echo "has completed execution"
echo ""
echo "======================================================================"
echo "Raptor Engineering, LLC, Raptor Computing Systems, LLC, IBM, and"
echo "affiliated entities disclaim all liability resulting from the use"
echo "or misuse of this program.  You accept all risk associated with"
echo "modification of clock and/or power data, including, without"
echo "restriction, hardware damage, data corruption, and/or loss of"
echo "business resulting from the use of this program."
echo ""
echo "CPU and/or mainboard damage incurred as a result of attempted"
echo "overclocking may void any and all warranty(s) for the damaged"
echo "component(s)."
echo ""
echo "======================================================================"
echo "Do you accept these terms and wish to proceed at your own risk? [y/N]"
echo "======================================================================"

read -r -p "" INPUT
if [[ "$INPUT" != "Y" && "$INPUT" != "y" ]]; then
	echo "Exiting..."
	exit 1
fi

# Clean up possibly stale output files if present
rm -rf vpd_out

echo "======================================================================"
read -r -p "Core count of installed CPU(s): " CORE_COUNT
if [[ "$INPUT" == "" ]]; then
	CORE_COUNT=24
fi

# Defaults
NEW_ULTRATURBO_MHZ=4200
VOLTAGE_MULTIPLIER=1.00

# Reasonable defaults
# Partly validated on initial silicon
# NOT GUARANTEED, starting point ONLY!
if [[ "$CORE_COUNT" == "4" ]]; then
	NEW_ULTRATURBO_MHZ=4200
	VOLTAGE_MULTIPLIER=1.142
fi
if [[ "$CORE_COUNT" == "8" ]]; then
	NEW_ULTRATURBO_MHZ=4400
	VOLTAGE_MULTIPLIER=1.142
fi
if [[ "$CORE_COUNT" == "18" ]]; then
	NEW_ULTRATURBO_MHZ=4200
	VOLTAGE_MULTIPLIER=1.1
fi
if [[ "$CORE_COUNT" == "22" ]]; then
	NEW_ULTRATURBO_MHZ=4200
	VOLTAGE_MULTIPLIER=1.05
fi

echo "======================================================================"
echo "Targetting bucket 5 with a new Ultra Turbo frequency of ${NEW_ULTRATURBO_MHZ}MHz"
echo "Voltage multiplier: ${VOLTAGE_MULTIPLIER}"
echo "======================================================================"
./list_i2c_busses

echo "======================================================================"
read -r -p "MVPD I2C bus of your first CPU (typically 0, <ENTER> to skip): " I2C_BUS_0

if [[ "$I2C_BUS_0" != "" ]]; then
	mkdir -p vpd_backup
	echo -n "Reading VPD..."
	set +e
	./read_vpd "${I2C_BUS_0}" 0x50 vpd_backup/cpu0.bin
	RETCODE=$?
	set -e
	if [[ $RETCODE != 0 ]]; then
		echo "Exiting..."
		exit 1
	fi
	echo "done!"

	mkdir -p vpd_out
	echo "Modifying VPD"
	./copy_buckets ${NEW_ULTRATURBO_MHZ} ${VOLTAGE_MULTIPLIER} `realpath vpd_backup` cpu0 vpd_out/cpu0
	echo "Done!"
fi

echo "======================================================================"
./list_i2c_busses

echo "======================================================================"
read -r -p "MVPD I2C bus of your second CPU (<ENTER> to skip): " I2C_BUS_1

if [[ "$I2C_BUS_1" != "" ]]; then
	mkdir -p vpd_backup
	echo -n "Reading VPD..."
	set +e
	./read_vpd "${I2C_BUS_1}" 0x50 vpd_backup/cpu1.bin
	RETCODE=$?
	set -e
	if [[ $RETCODE != 0 ]]; then
		echo "Exiting..."
		exit 1
	fi
	echo "done!"

	mkdir -p vpd_out
	echo "Modifying VPD"
	./copy_buckets ${NEW_ULTRATURBO_MHZ} ${VOLTAGE_MULTIPLIER} `realpath vpd_backup` cpu1 vpd_out/cpu1
	echo "Done!"
fi

echo "======================================================================"
echo "Ready to write new VPD image(s).  Continue? [y/N]"
echo "======================================================================"

read -r -p "" INPUT
if [[ "$INPUT" != "Y" && "$INPUT" != "y" ]]; then
	echo "Exiting..."
	exit 1
fi

if [[ "$I2C_BUS_0" != "" ]]; then
	echo "Writing CPU 0 VPD..."
	./write_vpd "${I2C_BUS_0}" 0x50 vpd_out/cpu0.bin
fi

if [[ "$I2C_BUS_1" != "" ]]; then
	echo "Writing CPU 1 VPD"
	./write_vpd "${I2C_BUS_1}" 0x50 vpd_out/cpu1.bin
fi

echo "======================================================================"
echo "VPD image(s) have been updated successfully!"
echo ""
echo "NOTE: Your system will continue to use the old clocking data until you"
echo "load the aggressive variant of the Talos II PNOR.  If your system will"
echo "not IPL or is unstable at the higher clocks, reloading the stock PNOR"
echo "will restore your system back to the original clock speeds"
echo ""
echo "Thank you for using WoFerClock!"
echo "======================================================================"
OpenPOWER on IntegriCloud