xref: /illumos-gate/usr/src/uts/common/sys/cpuid_drv.h (revision 13b136d3061155363c62c9f6568d25b8b27da8f6)
1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License, Version 1.0 only
6  * (the "License").  You may not use this file except in compliance
7  * with the License.
8  *
9  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10  * or http://www.opensolaris.org/os/licensing.
11  * See the License for the specific language governing permissions
12  * and limitations under the License.
13  *
14  * When distributing Covered Code, include this CDDL HEADER in each
15  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16  * If applicable, add the following below this CDDL HEADER, with the
17  * fields enclosed by brackets "[]" replaced with your own identifying
18  * information: Portions Copyright [yyyy] [name of copyright owner]
19  *
20  * CDDL HEADER END
21  */
22 /*
23  * Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
24  * Use is subject to license terms.
25  */
26 /*
27  * Copyright 2019 Joyent, Inc.
28  */
29 
30 #ifndef	_SYS_CPUID_DRV_H
31 #define	_SYS_CPUID_DRV_H
32 
33 #include <sys/types.h>
34 
35 #ifdef __cplusplus
36 extern "C" {
37 #endif
38 
39 /*
40  * /dev names:
41  *	/dev/cpu/			- containing directory
42  *		self/			- describes current cpu
43  *			cpuid		- cpu identification
44  */
45 
46 #define	CPUID_DRIVER_NAME	"cpuid"
47 #define	CPUID_DRIVER_SELF_NODE	"self"
48 
49 #define	CPUID_DIR_NAME		"cpu"
50 #define	CPUID_SELF_DIR_NAME	"self"
51 #define	CPUID_NAME		"cpuid"
52 #define	CPUID_SELF_NAME		\
53 	CPUID_DIR_NAME "/" CPUID_SELF_DIR_NAME "/" CPUID_NAME
54 
55 /*
56  * This minor number corresponds to the cpu we're running on at
57  * the time we invoke its interfaces.
58  */
59 #define	CPUID_SELF_CPUID_MINOR	((minor_t)0x3fffful)
60 
61 /*
62  * ioctl numbers: not an exported interface
63  */
64 #define	CPUID_IOC		(('c'<<24)|('i'<<16)|('d'<<8))
65 
66 #define	CPUID_GET_HWCAP		(CPUID_IOC|0)
67 #define	CPUID_RDMSR		(CPUID_IOC|1)
68 
69 struct cpuid_get_hwcap {
70 	char *cgh_archname;
71 	uint_t cgh_hwcap[2];
72 };
73 
74 struct cpuid_rdmsr {
75 	uint64_t cr_msr_nr;
76 	uint64_t cr_msr_val;
77 };
78 
79 #if defined(_SYSCALL32_IMPL)
80 
81 #include <sys/types32.h>
82 
83 struct cpuid_get_hwcap32 {
84 	caddr32_t cgh_archname;
85 	uint32_t cgh_hwcap[2];
86 };
87 
88 #endif	/* _SYSCALL32_IMPL */
89 
90 #ifdef __cplusplus
91 }
92 #endif
93 
94 #endif	/* _SYS_CPUID_DRV_H */
95