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