xref: /illumos-gate/usr/src/uts/common/sys/devfm.h (revision 2a613b5974ae49c8b068a3998ff554f8c6f0f593)
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 (the "License").
6  * You may not use this file except in compliance with the License.
7  *
8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9  * or http://www.opensolaris.org/os/licensing.
10  * See the License for the specific language governing permissions
11  * and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL HEADER in each
14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15  * If applicable, add the following below this CDDL HEADER, with the
16  * fields enclosed by brackets "[]" replaced with your own identifying
17  * information: Portions Copyright [yyyy] [name of copyright owner]
18  *
19  * CDDL HEADER END
20  */
21 /*
22  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
23  * Use is subject to license terms.
24  * Copyright (c) 2018, Joyent, Inc.
25  */
26 
27 #ifndef	_SYS_DEVFM_H
28 #define	_SYS_DEVFM_H
29 
30 #include <sys/types.h>
31 #include <sys/nvpair.h>
32 
33 #ifdef	__cplusplus
34 extern "C" {
35 #endif
36 
37 #define	FM_IOC_MAXBUFSZ		32768
38 #define	FM_IOC_OUT_BUFSZ	32768
39 #define	FM_IOC_OUT_MAXBUFSZ	524288
40 #define	FM_DRV_VERSION		1
41 
42 #define	FM_VERSIONS_VERSION	"fm-versions-version"
43 #define	FM_PAGE_OP_VERSION	"page-operation-version"
44 #define	FM_CPU_OP_VERSION	"cpu-operation-version"
45 #define	FM_CPU_INFO_VERSION	"cpu-info-version"
46 #define	FM_TOPO_LEGACY_VERSION	"topo-legacy-version"
47 
48 /*
49  * FMA driver ioctl interfaces
50  */
51 #define	FM_IOC			(0xFA << 16)
52 #define	FM_IOC_VERSIONS		(FM_IOC | 1)
53 #define	FM_IOC_PAGE_RETIRE	(FM_IOC | 2)
54 #define	FM_IOC_PAGE_STATUS	(FM_IOC | 3)
55 #define	FM_IOC_PAGE_UNRETIRE	(FM_IOC | 4)
56 
57 #if defined(__x86)
58 #define	FM_IOC_PHYSCPU_INFO	(FM_IOC | 5)
59 #define	FM_IOC_CPU_RETIRE	(FM_IOC | 6)
60 #define	FM_IOC_CPU_STATUS	(FM_IOC | 7)
61 #define	FM_IOC_CPU_UNRETIRE	(FM_IOC | 8)
62 #define	FM_IOC_GENTOPO_LEGACY	(FM_IOC | 9)
63 #endif	/* __x86 */
64 
65 /*
66  * Types
67  */
68 typedef struct fm_ioc_data {
69 	uint32_t	fid_version;	/* interface version */
70 	size_t		fid_insz;	/* size of packed input nvlist */
71 	caddr_t		fid_inbuf;	/* buf containing packed input nvl */
72 	size_t		fid_outsz;	/* size of packed output nvlist */
73 	caddr_t		fid_outbuf;	/* buf containing packed output nvl */
74 } fm_ioc_data_t;
75 
76 #ifdef _KERNEL
77 typedef struct fm_ioc_data32 {
78 	uint32_t	fid_version;	/* interface version */
79 	size32_t	fid_insz;	/* size of packed input nvlist */
80 	caddr32_t	fid_inbuf;	/* buf containing packed input nvl */
81 	size32_t	fid_outsz;	/* size of packed output nvlist */
82 	caddr32_t	fid_outbuf;	/* buf containing packed output nvl */
83 } fm_ioc_data32_t;
84 #endif	/* _KERNEL */
85 
86 /*
87  * Constants
88  */
89 #define	FM_PAGE_RETIRE_FMRI		"fmri"
90 #define	FM_PHYSCPU_INFO_CPUS		"cpus"
91 #define	FM_CPU_RETIRE_CHIP_ID		"chip_id"
92 #define	FM_PHYSCPU_INFO_NPROCNODES	"procnodes_per_pkg"
93 #define	FM_PHYSCPU_INFO_PROCNODE_ID	"procnodeid"
94 #define	FM_CPU_RETIRE_CORE_ID		"core_id"
95 #define	FM_CPU_RETIRE_STRAND_ID		"strand_id"
96 #define	FM_CPU_RETIRE_OLDSTATUS		"oldstatus"
97 #define	FM_GENTOPO_LEGACY		"gentopolegacy"
98 
99 /*
100  * Properties set by FM_PHYSCPU_INFO
101  */
102 #define	FM_PHYSCPU_INFO_VENDOR_ID	"vendor_id"
103 #define	FM_PHYSCPU_INFO_FAMILY		"family"
104 #define	FM_PHYSCPU_INFO_MODEL		"model"
105 #define	FM_PHYSCPU_INFO_STEPPING	"stepping"
106 
107 /*
108  * When Multi-Chip-Module(MCM) support is added
109  * chip_id should map to the processor package
110  * and not the die in the processor package.
111  * This is for FMA; kernel's perception of
112  * chip_id could differ for MCM.
113  */
114 #define	FM_PHYSCPU_INFO_CHIP_ID		"chip_id"
115 
116 #define	FM_PHYSCPU_INFO_CORE_ID		"core_id"
117 #define	FM_PHYSCPU_INFO_STRAND_ID	"strand_id"
118 #define	FM_PHYSCPU_INFO_STRAND_APICID	"strand_initial_apicid"
119 #define	FM_PHYSCPU_INFO_SMBIOS_ID	"smbios_id"
120 #define	FM_PHYSCPU_INFO_CHIP_ROOTS	"chip_roots"
121 #define	FM_PHYSCPU_INFO_CHIP_REV	"chip_rev"
122 #define	FM_PHYSCPU_INFO_SOCKET_TYPE	"socket_type"
123 #define	FM_PHYSCPU_INFO_CPU_ID		"cpuid"
124 #define	FM_PHYSCPU_INFO_CHIP_IDENTSTR	"chip_identstr"
125 
126 #ifdef	__cplusplus
127 }
128 #endif
129 
130 #endif	/* _SYS_DEVFM_H */
131