]> CyberLeo.Net >> Repos - FreeBSD/stable/10.git/blob - share/man/man4/cpuctl.4
MFC r315619: pet manlint.
[FreeBSD/stable/10.git] / share / man / man4 / cpuctl.4
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 20, 2014
28 .Dt CPUCTL 4
29 .Os
30 .Sh NAME
31 .Nm cpuctl
32 .Nd cpuctl pseudo device
33 .Sh SYNOPSIS
34 To compile this driver into the kernel,
35 place the following lines in your kernel
36 configuration file:
37 .Bd -ragged -offset indent
38 .Cd "device cpuctl"
39 .Ed
40 .Pp
41 Alternatively, to load the driver as a module
42 at boot time, place the following in
43 .Xr loader.conf 5 :
44 .Bd -literal -offset indent
45 cpuctl_load="YES"
46 .Ed
47 .Sh DESCRIPTION
48 The special device
49 .Pa /dev/cpuctl
50 presents interface to the system CPU.
51 It provides functionality to retrieve
52 CPUID information, read/write machine specific registers (MSR) and perform
53 CPU firmware updates.
54 .Pp
55 For each CPU present in the system, the special device
56 .Pa /dev/cpuctl%d
57 with the appropriate index will be created.
58 For multicore CPUs such a
59 special device will be created for each core.
60 .Pp
61 Currently, only i386 and amd64 processors are
62 supported.
63 .Sh IOCTL INTERFACE
64 All of the supported operations are invoked using the
65 .Xr ioctl 2
66 system call.
67 Currently, the following ioctls are defined:
68 .Bl -tag -width CPUCTL_CPUID_COUNT
69 .It Dv CPUCTL_RDMSR Fa cpuctl_msr_args_t *args
70 .It Dv CPUCTL_WRMSR Fa cpuctl_msr_args_t *args
71 Read/write CPU machine specific register.
72 The
73 .Vt cpuctl_msr_args_t
74 structure is defined in
75 .In sys/cpuctl.h
76 as:
77 .Bd -literal
78 typedef struct {
79         int             msr;    /* MSR to read */
80         uint64_t        data;
81 } cpuctl_msr_args_t;
82 .Ed
83 .It Dv CPUCTL_MSRSBIT Fa cpuctl_msr_args_t *args
84 .It Dv CPUCTL_MSRCBIT Fa cpuctl_msr_args_t *args
85 Set/clear MSR bits according to the mask given in the
86 .Va data
87 field.
88 .It Dv CPUCTL_CPUID Fa cpuctl_cpuid_args_t *args
89 Retrieve CPUID information.
90 Arguments are supplied in the following structure:
91 .Bd -literal
92 typedef struct {
93         int             level;          /* CPUID level */
94         uint32_t        data[4];
95 } cpuctl_cpuid_args_t;
96 .Ed
97 It is equivalent to the
98 .Dv CPUCTL_CPUID_COUNT
99 request with
100 .Va level_type
101 set to 0.
102 .It Dv CPUCTL_CPUID_COUNT Fa cpuctl_cpuid_count_args_t *args
103 Retrieve CPUID information.
104 Arguments are supplied in the following structure:
105 .Bd -literal
106 typedef struct {
107         int             level;          /* CPUID level */
108         int             level_type;     /* CPUID level type */
109         uint32_t        data[4];
110 } cpuctl_cpuid_count_args_t;
111 .Ed
112 The
113 .Va level
114 field indicates the CPUID level to retrieve,
115 it is loaded into the
116 .Va %eax
117 register before the CPUID instruction is executed,
118 The
119 .Va level_type
120 field indicates the CPUID level type to retrieve,
121 it is loaded into the
122 .Va %ecx
123 register.
124 .Pp
125 The
126 .Va data
127 field is used to store the received CPUID data.
128 That is,
129 .Va data[0]
130 contains the value of
131 .Va %eax
132 register after the CPUID instruction is executed,
133 .Va data[1]
134 is for
135 .Va %ebx ,
136 .Va data[2]
137 for
138 .Va %ecx ,
139 and
140 .Va data[3]
141 for
142 .Va %edx .
143 .It Dv CPUCTL_UPDATE cpuctl_update_args_t *args
144 Update CPU firmware (microcode).
145 The structure is defined in
146 .In sys/cpuctl.h
147 as:
148 .Bd -literal
149 typedef struct {
150         void    *data;
151         size_t  size;
152 } cpuctl_update_args_t;
153 .Ed
154 .Pp
155 The
156 .Va data
157 field should point to the firmware image of size
158 .Va size .
159 .El
160 .Pp
161 For additional information refer to
162 .Pa cpuctl.h .
163 .Sh FILES
164 .Bl -tag -width /dev/cpuctl -compact
165 .It Pa /dev/cpuctl
166 .El
167 .Sh ERRORS
168 .Bl -tag -width Er
169 .It Bq Er ENXIO
170 The operation requested is not supported by the device (e.g., unsupported
171 architecture or the CPU is disabled).
172 .It Bq Er EINVAL
173 Incorrect request was supplied, or microcode image is not correct.
174 .It Bq Er ENOMEM
175 No physical memory was available to complete the request.
176 .It Bq Er EFAULT
177 The firmware image address points outside the process address space.
178 .El
179 .Sh SEE ALSO
180 .Xr hwpmc 4 ,
181 .Xr cpucontrol 8
182 .Sh HISTORY
183 The
184 .Nm
185 driver first appeared in
186 .Fx 7.2 .
187 .Sh AUTHORS
188 The
189 .Nm
190 module and this manual page were written by
191 .An Stanislav Sedov Aq stas@FreeBSD.org .
192 .Sh BUGS
193 Yes, probably, report if any.