1/*- 2 * Copyright (c) 2008-2011 Stanislav Sedov <stas@FreeBSD.org>. 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 15 unchanged lines hidden (view full) --- 24 */ 25 26/* 27 * This utility provides userland access to the cpuctl(4) pseudo-device 28 * features. 29 */ 30 31#include <sys/cdefs.h> |
32__FBSDID("$FreeBSD: head/usr.sbin/cpucontrol/cpucontrol.c 228436 2011-12-12 12:30:44Z fabient $"); |
33 34#include <assert.h> 35#include <stdio.h> 36#include <stdlib.h> 37#include <string.h> 38#include <unistd.h> 39#include <fcntl.h> 40#include <err.h> --- 5 unchanged lines hidden (view full) --- 46#include <sys/types.h> 47#include <sys/stat.h> 48#include <sys/ioctl.h> 49#include <sys/cpuctl.h> 50 51#include "cpucontrol.h" 52#include "amd.h" 53#include "intel.h" |
54#include "via.h" |
55 56int verbosity_level = 0; 57 58#define DEFAULT_DATADIR "/usr/local/share/cpucontrol" 59 60#define FLAG_I 0x01 61#define FLAG_M 0x02 62#define FLAG_U 0x04 --- 24 unchanged lines hidden (view full) --- 87static SLIST_HEAD(, datadir) datadirs = SLIST_HEAD_INITIALIZER(datadirs); 88 89struct ucode_handler { 90 ucode_probe_t *probe; 91 ucode_update_t *update; 92} handlers[] = { 93 { intel_probe, intel_update }, 94 { amd_probe, amd_update }, |
95 { via_probe, via_update }, |
96}; 97#define NHANDLERS (sizeof(handlers) / sizeof(*handlers)) 98 99static void usage(void); 100static int isdir(const char *path); 101static int do_cpuid(const char *cmdarg, const char *dev); 102static int do_msr(const char *cmdarg, const char *dev); 103static int do_update(const char *dev); --- 327 unchanged lines hidden --- |