xref: /freebsd/sys/sys/cpuctl.h (revision b2d75854)
1e085f869SStanislav Sedov /*-
2e085f869SStanislav Sedov  * Copyright (c) 2006-2008 Stanislav Sedov <stas@FreeBSD.org>
3e085f869SStanislav Sedov  * All rights reserved.
4e085f869SStanislav Sedov  *
5e085f869SStanislav Sedov  * Redistribution and use in source and binary forms, with or without
6e085f869SStanislav Sedov  * modification, are permitted provided that the following conditions
7e085f869SStanislav Sedov  * are met:
8e085f869SStanislav Sedov  * 1. Redistributions of source code must retain the above copyright
9e085f869SStanislav Sedov  *    notice, this list of conditions and the following disclaimer.
10e085f869SStanislav Sedov  * 2. Redistributions in binary form must reproduce the above copyright
11e085f869SStanislav Sedov  *    notice, this list of conditions and the following disclaimer in the
12e085f869SStanislav Sedov  *    documentation and/or other materials provided with the distribution.
13e085f869SStanislav Sedov  *
14e085f869SStanislav Sedov  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
15e085f869SStanislav Sedov  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16e085f869SStanislav Sedov  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17e085f869SStanislav Sedov  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
18e085f869SStanislav Sedov  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19e085f869SStanislav Sedov  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20e085f869SStanislav Sedov  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21e085f869SStanislav Sedov  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22e085f869SStanislav Sedov  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23e085f869SStanislav Sedov  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24e085f869SStanislav Sedov  * SUCH DAMAGE.
25e085f869SStanislav Sedov  *
26e085f869SStanislav Sedov  * $FreeBSD$
27e085f869SStanislav Sedov  */
28e085f869SStanislav Sedov 
29e085f869SStanislav Sedov #ifndef _CPUCTL_H_
30e085f869SStanislav Sedov #define	_CPUCTL_H_
31e085f869SStanislav Sedov 
32e085f869SStanislav Sedov typedef struct {
33e085f869SStanislav Sedov 	int		msr;	/* MSR to read */
34e085f869SStanislav Sedov 	uint64_t	data;
35e085f869SStanislav Sedov } cpuctl_msr_args_t;
36e085f869SStanislav Sedov 
37e085f869SStanislav Sedov typedef struct {
38e085f869SStanislav Sedov 	int		level;	/* CPUID level */
39e085f869SStanislav Sedov 	uint32_t	data[4];
40e085f869SStanislav Sedov } cpuctl_cpuid_args_t;
41e085f869SStanislav Sedov 
42e085f869SStanislav Sedov typedef struct {
43e085f869SStanislav Sedov 	void	*data;
44e085f869SStanislav Sedov 	size_t	size;
45e085f869SStanislav Sedov } cpuctl_update_args_t;
46e085f869SStanislav Sedov 
47e085f869SStanislav Sedov #define	CPUCTL_RDMSR	_IOWR('c', 1, cpuctl_msr_args_t)
48e085f869SStanislav Sedov #define	CPUCTL_WRMSR	_IOWR('c', 2, cpuctl_msr_args_t)
49e085f869SStanislav Sedov #define	CPUCTL_CPUID	_IOWR('c', 3, cpuctl_cpuid_args_t)
50e085f869SStanislav Sedov #define	CPUCTL_UPDATE	_IOWR('c', 4, cpuctl_update_args_t)
51b2d75854SStanislav Sedov #define	CPUCTL_MSRSBIT	_IOWR('c', 5, cpuctl_msr_args_t)
52b2d75854SStanislav Sedov #define	CPUCTL_MSRCBIT	_IOWR('c', 6, cpuctl_msr_args_t)
53e085f869SStanislav Sedov 
54e085f869SStanislav Sedov #endif /* _CPUCTL_H_ */
55