1270866Simp/*-
2270866Simp * Copyright (c) 2006-2008 Stanislav Sedov <stas@FreeBSD.org>
3270866Simp * All rights reserved.
4270866Simp *
5270866Simp * Redistribution and use in source and binary forms, with or without
6270866Simp * modification, are permitted provided that the following conditions
7270866Simp * are met:
8270866Simp * 1. Redistributions of source code must retain the above copyright
9270866Simp *    notice, this list of conditions and the following disclaimer.
10270866Simp * 2. Redistributions in binary form must reproduce the above copyright
11270866Simp *    notice, this list of conditions and the following disclaimer in the
12270866Simp *    documentation and/or other materials provided with the distribution.
13270866Simp *
14270866Simp * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
15270866Simp * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16270866Simp * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17270866Simp * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
18270866Simp * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19270866Simp * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20270866Simp * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21270866Simp * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22270866Simp * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23270866Simp * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24270866Simp * SUCH DAMAGE.
25270866Simp *
26270866Simp * $FreeBSD$
27270866Simp */
28270866Simp
29270866Simp#ifndef _CPUCTL_H_
30270866Simp#define	_CPUCTL_H_
31270866Simp
32270866Simptypedef struct {
33270866Simp	int		msr;	/* MSR to read */
34270866Simp	uint64_t	data;
35270866Simp} cpuctl_msr_args_t;
36270866Simp
37270866Simptypedef struct {
38270866Simp	int		level;		/* CPUID level */
39270866Simp	uint32_t	data[4];
40270866Simp} cpuctl_cpuid_args_t;
41270866Simp
42270866Simptypedef struct {
43270866Simp	int		level;		/* CPUID level */
44270866Simp	int		level_type;	/* CPUID level type */
45270866Simp	uint32_t	data[4];
46270866Simp} cpuctl_cpuid_count_args_t;
47270866Simp
48270866Simptypedef struct {
49270866Simp	void	*data;
50270866Simp	size_t	size;
51270866Simp} cpuctl_update_args_t;
52270866Simp
53270866Simp#define	CPUCTL_RDMSR	_IOWR('c', 1, cpuctl_msr_args_t)
54270866Simp#define	CPUCTL_WRMSR	_IOWR('c', 2, cpuctl_msr_args_t)
55270866Simp#define	CPUCTL_CPUID	_IOWR('c', 3, cpuctl_cpuid_args_t)
56270866Simp#define	CPUCTL_UPDATE	_IOWR('c', 4, cpuctl_update_args_t)
57270866Simp#define	CPUCTL_MSRSBIT	_IOWR('c', 5, cpuctl_msr_args_t)
58270866Simp#define	CPUCTL_MSRCBIT	_IOWR('c', 6, cpuctl_msr_args_t)
59270866Simp#define	CPUCTL_CPUID_COUNT _IOWR('c', 7, cpuctl_cpuid_count_args_t)
60270866Simp
61270866Simp#endif /* _CPUCTL_H_ */
62270866Simp