xref: /freebsd/usr.sbin/cpucontrol/cpucontrol.8 (revision 01c2b8ac0d5d7a787a7853f0988b505d26cf8136)
1e085f869SStanislav Sedov.\" Copyright (c) 2006, 2008 Stanislav Sedov <stas@FreeBSD.org>.
2e085f869SStanislav Sedov.\" All rights reserved.
3e085f869SStanislav Sedov.\"
4e085f869SStanislav Sedov.\" Redistribution and use in source and binary forms, with or without
5e085f869SStanislav Sedov.\" modification, are permitted provided that the following conditions
6e085f869SStanislav Sedov.\" are met:
7e085f869SStanislav Sedov.\" 1. Redistributions of source code must retain the above copyright
8e085f869SStanislav Sedov.\"    notice, this list of conditions and the following disclaimer.
9e085f869SStanislav Sedov.\" 2. Redistributions in binary form must reproduce the above copyright
10e085f869SStanislav Sedov.\"    notice, this list of conditions and the following disclaimer in the
11e085f869SStanislav Sedov.\"    documentation and/or other materials provided with the distribution.
12e085f869SStanislav Sedov.\"
13e085f869SStanislav Sedov.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
14e085f869SStanislav Sedov.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15e085f869SStanislav Sedov.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
16e085f869SStanislav Sedov.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
17e085f869SStanislav Sedov.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
18e085f869SStanislav Sedov.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
19e085f869SStanislav Sedov.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
20e085f869SStanislav Sedov.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
21e085f869SStanislav Sedov.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
22e085f869SStanislav Sedov.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
23e085f869SStanislav Sedov.\" SUCH DAMAGE.
24e085f869SStanislav Sedov.\"
25e085f869SStanislav Sedov.\" $FreeBSD$
26e085f869SStanislav Sedov.\"
27b2d75854SStanislav Sedov.Dd June 30, 2009
28e085f869SStanislav Sedov.Dt CPUCONTROL 8
29e085f869SStanislav Sedov.Os
30e085f869SStanislav Sedov.Sh NAME
31e085f869SStanislav Sedov.Nm cpucontrol
32e085f869SStanislav Sedov.Nd control utility for the
33e085f869SStanislav Sedov.Xr cpuctl 4
34344c81a1SWarren Blockdevice
35e085f869SStanislav Sedov.Sh SYNOPSIS
36e085f869SStanislav Sedov.Nm
37e085f869SStanislav Sedov.Op Fl vh
38b2d75854SStanislav Sedov.Fl m Ar msr
39b2d75854SStanislav Sedov.Bk
40b2d75854SStanislav Sedov.Ar device
41b2d75854SStanislav Sedov.Ek
42b2d75854SStanislav Sedov.Nm
43b2d75854SStanislav Sedov.Op Fl vh
44b2d75854SStanislav Sedov.Fl m Ar msr Ns = Ns Ar value
45b2d75854SStanislav Sedov.Bk
46b2d75854SStanislav Sedov.Ar device
47b2d75854SStanislav Sedov.Ek
48b2d75854SStanislav Sedov.Nm
49b2d75854SStanislav Sedov.Op Fl vh
50b2d75854SStanislav Sedov.Fl m Ar msr Ns &= Ns Ar mask
51b2d75854SStanislav Sedov.Bk
52b2d75854SStanislav Sedov.Ar device
53b2d75854SStanislav Sedov.Ek
54b2d75854SStanislav Sedov.Nm
55b2d75854SStanislav Sedov.Op Fl vh
56b2d75854SStanislav Sedov.Fl m Ar msr Ns |= Ns Ar mask
57e085f869SStanislav Sedov.Bk
58e085f869SStanislav Sedov.Ar device
59e085f869SStanislav Sedov.Ek
60e085f869SStanislav Sedov.Nm
61e085f869SStanislav Sedov.Op Fl vh
62e085f869SStanislav Sedov.Fl i Ar level
63e085f869SStanislav Sedov.Bk
64e085f869SStanislav Sedov.Ar device
65e085f869SStanislav Sedov.Ek
66e085f869SStanislav Sedov.Nm
67e085f869SStanislav Sedov.Op Fl vh
68aa1cb750SAttilio Rao.Fl i Ar level,level_type
69aa1cb750SAttilio Rao.Bk
70aa1cb750SAttilio Rao.Ar device
71aa1cb750SAttilio Rao.Ek
72aa1cb750SAttilio Rao.Nm
73aa1cb750SAttilio Rao.Op Fl vh
74e085f869SStanislav Sedov.Op Fl d Ar datadir
75e085f869SStanislav Sedov.Fl u
76e085f869SStanislav Sedov.Bk
77e085f869SStanislav Sedov.Ar device
78e085f869SStanislav Sedov.Ek
79e085f869SStanislav Sedov.Sh DESCRIPTION
80e085f869SStanislav SedovThe
81e085f869SStanislav Sedov.Nm
826d850876SChristian Bruefferutility can be used to read and write arbitrary machine-specific
836d850876SChristian BruefferCPU registers via the
84e085f869SStanislav Sedov.Xr cpuctl 4
856d850876SChristian Bruefferspecial device.
866d850876SChristian BruefferIt can also be used to apply CPU firmware updates.
87e085f869SStanislav Sedov.Pp
88e085f869SStanislav SedovThe following options are available:
89e085f869SStanislav Sedov.Bl -tag -width indent
90e085f869SStanislav Sedov.It Fl d Ar datadir
916d850876SChristian BruefferWhere to look for microcode images.
926d850876SChristian BruefferThe option can be specified multiple times.
93e085f869SStanislav Sedov.It Fl m Ar msr Ns Op = Ns Ar value
94b2d75854SStanislav SedovShow value of the specified MSR.
95b2d75854SStanislav SedovMSR register number should be given as a hexadecimal number.
96b2d75854SStanislav Sedov.It Fl m Ar msr Ns = Ns Ar value
97b2d75854SStanislav SedovStore the
98b2d75854SStanislav Sedov.Ar value
99b2d75854SStanislav Sedovin the specified MSR register.
100b2d75854SStanislav SedovThe
101b2d75854SStanislav Sedov.Ar value
102b2d75854SStanislav Sedovargument can be prefixed with ~ operator.
103b2d75854SStanislav SedovIn this case the inverted value of argument will be stored in the register.
104b2d75854SStanislav Sedov.It Fl m Ar msr Ns &= Ns Ar mask
105b2d75854SStanislav SedovStore the result of bitwise AND operation between
106b2d75854SStanislav Sedov.Ar mask
107b2d75854SStanislav Sedovand the current MSR value in the MSR register.
108b2d75854SStanislav SedovThe
109b2d75854SStanislav Sedov.Ar mask
110b2d75854SStanislav Sedovargument can be prefixed with ~ operator.
111b2d75854SStanislav SedovIn this case the inverted value of mask will be used.
112b2d75854SStanislav Sedov.It Fl m Ar msr Ns |= Ns Ar mask
113b2d75854SStanislav SedovStore the result of bitwise OR operation between
114b2d75854SStanislav Sedov.Ar mask
115b2d75854SStanislav Sedovand the current MSR value in the MSR register.
116b2d75854SStanislav SedovThe
117b2d75854SStanislav Sedov.Ar mask
118b2d75854SStanislav Sedovargument can be prefixed with ~ operator.
119b2d75854SStanislav SedovIn this case the inverted value of mask will be used.
120e085f869SStanislav Sedov.It Fl i Ar level
1216d850876SChristian BruefferRetrieve CPUID info.
1226d850876SChristian BruefferLevel should be given as a hex number.
123aa1cb750SAttilio Rao.It Fl i Ar level,level_type
124aa1cb750SAttilio RaoRetrieve CPUID info.
125aa1cb750SAttilio RaoLevel and level_type should be given as hex numbers.
126e085f869SStanislav Sedov.It Fl u
1276d850876SChristian BruefferApply CPU firmware updates.
1286d850876SChristian BruefferThe
129e085f869SStanislav Sedov.Nm
130e085f869SStanislav Sedovutility will walk through the configured data directories
13163a07fdbSStanislav Sedovand apply all firmware updates available for this CPU.
132e085f869SStanislav Sedov.It Fl v
133e085f869SStanislav SedovIncrease the verbosity level.
134e085f869SStanislav Sedov.It Fl h
135e085f869SStanislav SedovShow help message.
136e085f869SStanislav Sedov.El
137e085f869SStanislav Sedov.Sh EXIT STATUS
1387848de15SDaniel Gerzo.Ex -std
139e085f869SStanislav Sedov.Sh EXAMPLES
140e085f869SStanislav SedovThe command
141e085f869SStanislav Sedov.Pp
142e085f869SStanislav Sedov.Dq Li "cpucontrol -m 0x10 /dev/cpuctl0"
143e085f869SStanislav Sedov.Pp
144e085f869SStanislav Sedovwill read the contents of TSC MSR from CPU 0.
145e085f869SStanislav Sedov.Pp
146e085f869SStanislav SedovTo set the CPU 0 TSC MSR register value to 0x1 issue
147e085f869SStanislav Sedov.Pp
148b2d75854SStanislav Sedov.Dq Li "cpucontrol -m 0x10=0x1 /dev/cpuctl0" .
149b2d75854SStanislav Sedov.Pp
150b2d75854SStanislav SedovThe following command will clear the second bit of TSC register:
151b2d75854SStanislav Sedov.Pp
152b2d75854SStanislav Sedov.Dq Li "cpucontrol -m 0x10&=~0x02 /dev/cpuctl0" .
153b2d75854SStanislav Sedov.Pp
154b2d75854SStanislav SedovThe following command will set the forth and second bit of TSC register:
155b2d75854SStanislav Sedov.Pp
156b2d75854SStanislav Sedov.Dq Li "cpucontrol -m 0x10|=0x0a /dev/cpuctl0" .
157e085f869SStanislav Sedov.Pp
158e085f869SStanislav SedovThe command
159e085f869SStanislav Sedov.Pp
160e085f869SStanislav Sedov.Dq Li "cpucontrol -i 0x1 /dev/cpuctl1"
161e085f869SStanislav Sedov.Pp
162e085f869SStanislav Sedovwill retrieve the CPUID level 0x1 from CPU 1.
163e085f869SStanislav Sedov.Pp
1646d850876SChristian BruefferTo perform firmware updates on CPU 0 from images located at
165e085f869SStanislav Sedov.Pa /usr/local/share/cpuctl/
166e085f869SStanislav Sedovuse the following command:
167e085f869SStanislav Sedov.Pp
168e085f869SStanislav Sedov.Dq Li "cpucontrol -d /usr/local/share/cpuctl/ -u /dev/cpuctl0"
169e085f869SStanislav Sedov.Sh SEE ALSO
170e085f869SStanislav Sedov.Xr cpuctl 4
17163a07fdbSStanislav Sedov.Sh HISTORY
17263a07fdbSStanislav SedovThe
17363a07fdbSStanislav Sedov.Nm
17463a07fdbSStanislav Sedovutility first appeared in
1752a72feb4SChristian Brueffer.Fx 7.2 .
176e085f869SStanislav Sedov.Sh AUTHORS
177e085f869SStanislav SedovThe
178e085f869SStanislav Sedov.Nm
179e085f869SStanislav Sedovutility and this manual page was written by
180*01c2b8acSBaptiste Daroussin.An Stanislav Sedov Aq Mt stas@FreeBSD.org .
1810afc94c1SUlrich Spörlein.Sh BUGS
1820afc94c1SUlrich SpörleinYes, probably, report if any.
183