Commit Graph

66 Commits

Author SHA1 Message Date
Dimitry Andric
5207dac8ba Use NO_WCAST_ALIGN for usr.sbin/cpucontrol; because this is only built
for x86, any alignment warnings can be safely ignored.

MFC after:	1 week
2011-12-17 19:58:48 +00:00
Fabien Thomas
96ff3b75d4 Add VIA microde update support to cpuctl(4) and cpucontrol(8).
Support have been tested with X2 CPU and QuadCore CPU.

MFC after:	1 month
2011-12-12 12:30:44 +00:00
Stanislav Sedov
3b232eb663 - Save some space relying on the fact that all ioctl commands
prefixes are the same.

Suggested by:	"Carlos A. M. dos Santos" <unixmania@gmail.com>
2011-01-07 18:52:08 +00:00
Stanislav Sedov
f264409aea - Show textual representation of ioctl command in warning message
if ioctl(4) is failed besides the command number.

Suggested by:	delphij
MFC after:	2 weeks
2011-01-06 07:13:23 +00:00
Gavin Atkinson
acdfff93b6 Remove dead assignments, we overwrite the variable almost immediately.
Found by:	clang static analyzer
2010-06-19 16:29:23 +00:00
Ulrich Spörlein
0afc94c17a mdoc: move CAVEATS, BUGS and SECURITY CONSIDERATIONS sections to the
bottom of the manpages and order them consistently.

GNU groff doesn't care about the ordering, and doesn't even mention
CAVEATS and SECURITY CONSIDERATIONS as common sections and where to put
them.

Found by:	mdocml lint run
Reviewed by:	ru
2010-05-13 12:07:55 +00:00
Ed Schouten
71ccf09269 The last big commit: let usr.sbin/ use WARNS=6 by default. 2010-01-02 11:07:44 +00:00
Ed Schouten
10bc3a7f42 ANSIfy almost all applications that use WARNS=6.
I was considering committing all these patches one by one, but as
discussed with brooks@, there is no need to do this. If we ever
need/want to merge these changes back, it is still possible to do this
per application.
2009-12-29 22:53:27 +00:00
Antoine Brodin
13e403fdea (S)LIST_HEAD_INITIALIZER takes a (S)LIST_HEAD as an argument.
Fix some wrong usages.
Note: this does not affect generated binaries as this argument is not used.

PR:		137213
Submitted by:	Eygene Ryabinkin (initial version)
MFC after:	1 month
2009-12-28 22:56:30 +00:00
Stanislav Sedov
b2d758545b - Add support to atomically set/clear individual bits of a MSR register
via cpuctl(4) driver.  Two new CPUCTL_MSRSBIT and CPUCTL_MSRCBIT ioctl(2)
  calls treat the data field of the argument struct passed as a mask
  and set/clear bits of the MSR register according to the mask value.
- Allow user to perform atomic bitwise AND and OR operaions on MSR registers
  via cpucontrol(8) utility.  Two new operations ("&=" and "|=") have been
  added.  The first one applies bitwise AND operaion between the current
  contents of the MSR register and the mask, and the second performs bitwise
  OR.  The argument can be optionally prefixed with "~" inversion operator.
  This allows one to mimic the "clear bit" behavior by using the command
  like this:
      cpucontrol -m 0x10&=~0x02		# clear the second bit of TSC MSR

  Inversion operator support in all modes (assignment, OR, AND).

Approved by:	re (kib)
MFC after:	1 month
2009-06-30 12:35:47 +00:00
Christian Brueffer
2a72feb42b Correct the information about when the respective functionality first
appeared in FreeBSD.

PR:		133785
Submitted by:	Ulrich Spoerlein <uqs@spoerlein.net>
MFC after:	3 days
2009-04-23 08:37:56 +00:00
Daniel Gerzo
7848de15ac - use .Ex macro in EXIT STATUS section 2009-01-07 01:31:09 +00:00
Stanislav Sedov
63a07fdbc0 - Improve wording.
Approved by:	kib (mentor)
MFC after:	1 week
2009-01-04 15:49:30 +00:00
Christian Brueffer
6d85087649 Mdoc and wording improvements. 2008-12-30 20:16:33 +00:00
Stanislav Sedov
cbcc55799f - Fix error reporting.
Approved by:	kib
2008-08-12 09:47:50 +00:00
Stanislav Sedov
e085f869d5 - Add cpuctl(4) pseudo-device driver to provide access to some low-level
features of CPUs like reading/writing machine-specific registers,
  retrieving cpuid data, and updating microcode.
- Add cpucontrol(8) utility, that provides userland access to
  the features of cpuctl(4).
- Add subsequent manpages.

The cpuctl(4) device operates as follows. The pseudo-device node cpuctlX
is created for each cpu present in the systems. The pseudo-device minor
number corresponds to the cpu number in the system. The cpuctl(4) pseudo-
device allows a number of ioctl to be preformed, namely RDMSR/WRMSR/CPUID
and UPDATE. The first pair alows the caller to read/write machine-specific
registers from the correspondent CPU. cpuid data could be retrieved using
the CPUID call, and microcode updates are applied via UPDATE.

The permissions are inforced based on the pseudo-device file permissions.
RDMSR/CPUID will be allowed when the caller has read access to the device
node, while WRMSR/UPDATE will be granted only when the node is opened
for writing. There're also a number of priv(9) checks.

The cpucontrol(8) utility is intened to provide userland access to
the cpuctl(4) device features. The utility also allows one to apply
cpu microcode updates.

Currently only Intel and AMD cpus are supported and were tested.

Approved by:	kib
Reviewed by:	rpaulo, cokane, Peter Jeremy
MFC after:	1 month
2008-08-08 16:26:53 +00:00