1 .\" Copyright (c) 2006-2008 Stanislav Sedov <stas@FreeBSD.org>
2 .\" All rights reserved.
4 .\" Redistribution and use in source and binary forms, with or without
5 .\" modification, are permitted provided that the following conditions
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.
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
30 .Nd cpuctl pseudo device
32 To compile this driver into the kernel,
33 place the following lines in your kernel
35 .Bd -ragged -offset indent
39 Alternatively, to load the driver as a module
40 at boot time, place the following in
42 .Bd -literal -offset indent
48 presents interface to the system CPU.
49 It provides functionality to retrieve
50 CPUID information, read/write machine specific registers (MSR) and perform
53 For each CPU present in the system, the special device
55 with the appropriate index will be created.
56 For multicore CPUs such a
57 special device will be created for each core.
59 Currently, only i386 and amd64 processors are
62 All of the supported operations are invoked using the
65 Currently, the following ioctls are defined:
66 .Bl -tag -width CPUCTL_CPUID_COUNT
67 .It Dv CPUCTL_RDMSR Fa cpuctl_msr_args_t *args
68 .It Dv CPUCTL_WRMSR Fa cpuctl_msr_args_t *args
69 Read/write CPU machine specific register.
72 structure is defined in
77 int msr; /* MSR to read */
81 .It Dv CPUCTL_MSRSBIT Fa cpuctl_msr_args_t *args
82 .It Dv CPUCTL_MSRCBIT Fa cpuctl_msr_args_t *args
83 Set/clear MSR bits according to the mask given in the
86 .It Dv CPUCTL_CPUID Fa cpuctl_cpuid_args_t *args
87 Retrieve CPUID information.
88 Arguments are supplied in the following structure:
91 int level; /* CPUID level */
93 } cpuctl_cpuid_args_t;
95 It is equivalent to the
96 .Dv CPUCTL_CPUID_COUNT
100 .It Dv CPUCTL_CPUID_COUNT Fa cpuctl_cpuid_count_args_t *args
101 Retrieve CPUID information.
102 Arguments are supplied in the following structure:
105 int level; /* CPUID level */
106 int level_type; /* CPUID level type */
108 } cpuctl_cpuid_count_args_t;
112 field indicates the CPUID level to retrieve,
113 it is loaded into the
115 register before the CPUID instruction is executed,
118 field indicates the CPUID level type to retrieve,
119 it is loaded into the
125 field is used to store the received CPUID data.
128 contains the value of
130 register after the CPUID instruction is executed,
141 .It Dv CPUCTL_UPDATE cpuctl_update_args_t *args
142 Update CPU firmware (microcode).
143 The structure is defined in
150 } cpuctl_update_args_t;
155 field should point to the firmware image of size
159 For additional information refer to
162 .Bl -tag -width /dev/cpuctl -compact
168 The operation requested is not supported by the device (e.g., unsupported
169 architecture or the CPU is disabled).
171 Incorrect request was supplied, or microcode image is not correct.
173 No physical memory was available to complete the request.
175 The firmware image address points outside the process address space.
183 driver first appeared in
188 module and this manual page were written by
189 .An Stanislav Sedov Aq Mt stas@FreeBSD.org .
191 Yes, probably, report if any.