Commit Graph

12 Commits

Author SHA1 Message Date
Warner Losh
1d386b48a5 Remove $FreeBSD$: one-line .c pattern
Remove /^[\s*]*__FBSDID\("\$FreeBSD\$"\);?\s*\n/
2023-08-16 11:54:42 -06:00
Warner Losh
4d846d260e spdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSD
The SPDX folks have obsoleted the BSD-2-Clause-FreeBSD identifier. Catch
up to that fact and revert to their recommended match of BSD-2-Clause.

Discussed with:		pfg
MFC After:		3 days
Sponsored by:		Netflix
2023-05-12 10:44:03 -06:00
Dan Nelson
87799c5f85 cpucontrol: fix extended signature matching code to avoid fallthough
PR:		256502
MFC after:	1 week
2021-06-14 17:34:07 -04:00
Conrad Meyer
dee401e833 cpucontrol(8): De-duplicate common update logic
Every µcode-updater must open the cpucontrol devfs node RDWR, open a
firmware file, validate the FW file has a positive length, mmap it, etc.
De-duplicate that identical logic between every individual platform.

Also, constify references to the readonly-mapped firmware files while here.

Sponsored by:	Dell EMC Isilon
2018-11-14 00:21:49 +00:00
Ed Maste
09e24fbe18 cpucontrol: improve Intel microcode revision check
According to the Intel SDM (Volme 3, 9.11.7) the BIOS signature MSR
should be zeroed before executing cpuid (although in practice it does
not seem to matter).

PR:		192487
Submitted by:	Dan Lukes
Reported by:	Henrique de Moraes Holschuh
MFC after:	3 days
2018-05-12 15:34:35 +00:00
Konstantin Belousov
7028c31d21 Style. Remove useless return.
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2017-12-28 13:01:27 +00:00
Konstantin Belousov
298321a2e9 Complete r327264 by fixing yet another return without cleanup.
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2017-12-28 12:59:48 +00:00
Warner Losh
d79dc9b482 Use proper failure path rather than just returning.
CID: 1199354, 1006894, 1006893, 1006892
2017-12-28 05:33:24 +00:00
Pedro F. Giffuni
1de7b4b805 various: general adoption of SPDX licensing ID tags.
Mainly focus on files that use BSD 2-Clause license, however the tool I
was using misidentified many licenses so this was mostly a manual - error
prone - task.

The Software Package Data Exchange (SPDX) group provides a specification
to make it easier for automated tools to detect and summarize well known
opensource licenses. We are gradually adopting the specification, noting
that the tags are considered only advisory and do not, in any way,
superceed or replace the license texts.

No functional change intended.
2017-11-27 15:37:16 +00:00
Eitan Adler
bab89cefc7 Avoid clobbering errno with a call to fprintf
PR:		bin/173923
Submitted by:	Garrett Cooper <yanegomi@gmail.com>
Approved by:	cperciva
MFC After:	3 days
2013-01-16 05:00:51 +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
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