xref: /titanic_41/usr/src/uts/common/sys/processor.h (revision 4496171313bed39e96f21bc2f9faf2868e267ae3)
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 (c) 1984, 1986, 1987, 1988, 1989 AT&T
24  *	  All Rights Reserved
25  *
26  */
27 
28 /*
29  * Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
30  * Use is subject to license terms.
31  */
32 
33 #ifndef _SYS_PROCESSOR_H
34 #define	_SYS_PROCESSOR_H
35 
36 #pragma ident	"%Z%%M%	%I%	%E% SMI"
37 
38 #include <sys/types.h>
39 #include <sys/procset.h>
40 
41 #ifdef	__cplusplus
42 extern "C" {
43 #endif
44 
45 /*
46  * Definitions for p_online, processor_info & lgrp system calls.
47  */
48 
49 /*
50  * Type for an lgrpid
51  */
52 typedef uint16_t lgrpid_t;
53 
54 /*
55  * Type for processor name (CPU number).
56  */
57 typedef	int	processorid_t;
58 typedef int	chipid_t;
59 
60 /*
61  * Flags and return values for p_online(2), and pi_state for processor_info(2).
62  * These flags are *not* for in-kernel examination of CPU states.
63  * See <sys/cpuvar.h> for appropriate informational functions.
64  */
65 #define	P_OFFLINE	0x0001	/* processor is offline, as quiet as possible */
66 #define	P_ONLINE	0x0002	/* processor is online */
67 #define	P_STATUS	0x0003	/* value passed to p_online to request status */
68 #define	P_FAULTED	0x0004	/* processor is offline, in faulted state */
69 #define	P_POWEROFF	0x0005	/* processor is powered off */
70 #define	P_NOINTR	0x0006	/* processor is online, but no I/O interrupts */
71 #define	P_SPARE		0x0007	/* processor is offline, can be reactivated */
72 #define	P_BAD		P_FAULTED	/* unused but defined by USL */
73 #define	P_FORCED 	0x10000000	/* force processor offline */
74 
75 /*
76  * String names for processor states defined above.
77  */
78 #define	PS_OFFLINE	"off-line"
79 #define	PS_ONLINE	"on-line"
80 #define	PS_FAULTED	"faulted"
81 #define	PS_POWEROFF	"powered-off"
82 #define	PS_NOINTR	"no-intr"
83 #define	PS_SPARE	"spare"
84 
85 /*
86  * Structure filled in by processor_info(2).
87  *
88  * The string fields are guaranteed to contain a NULL.
89  *
90  * The pi_fputypes field contains a (possibly empty) comma-separated
91  * list of floating point identifier strings.
92  */
93 #define	PI_TYPELEN	16	/* max size of CPU type string */
94 #define	PI_FPUTYPE	32	/* max size of FPU types string */
95 
96 typedef struct {
97 	int	pi_state;  			/* processor state, see above */
98 	char	pi_processor_type[PI_TYPELEN];	/* ASCII CPU type */
99 	char	pi_fputypes[PI_FPUTYPE];	/* ASCII FPU types */
100 	int	pi_clock;			/* CPU clock freq in MHz */
101 } processor_info_t;
102 
103 /*
104  * Binding values for processor_bind(2)
105  */
106 #define	PBIND_NONE	-1	/* LWP/thread is not bound */
107 #define	PBIND_QUERY	-2	/* don't set, just return the binding */
108 
109 /*
110  * User-level system call interface prototypes
111  */
112 #ifndef _KERNEL
113 #ifdef __STDC__
114 
115 extern int	p_online(processorid_t processorid, int flag);
116 extern int	processor_info(processorid_t processorid,
117 		    processor_info_t *infop);
118 extern int	processor_bind(idtype_t idtype, id_t id,
119 		    processorid_t processorid, processorid_t *obind);
120 extern processorid_t getcpuid(void);
121 extern lgrpid_t gethomelgroup(void);
122 
123 #else
124 
125 extern int	p_online();
126 extern int	processor_info();
127 extern int	processor_bind();
128 extern processorid_t getcpuid();
129 extern lgrpid_t gethomelgroup();
130 
131 #endif /* __STDC__ */
132 
133 #else   /* _KERNEL */
134 
135 /*
136  * Internal interface prototypes
137  */
138 extern int	p_online_internal(processorid_t, int, int *);
139 
140 #endif /* !_KERNEL */
141 
142 #ifdef __cplusplus
143 }
144 #endif
145 
146 #endif	/* _SYS_PROCESSOR_H */
147