xref: /NextBSD/sys/sys/mach/processor_info.h (revision 33da5adc555b3bc29986eeadca03829e4ad06b1e)
1 /*
2  * Copyright 1991-1998 by Open Software Foundation, Inc.
3  *              All Rights Reserved
4  *
5  * Permission to use, copy, modify, and distribute this software and
6  * its documentation for any purpose and without fee is hereby granted,
7  * provided that the above copyright notice appears in all copies and
8  * that both the copyright notice and this permission notice appear in
9  * supporting documentation.
10  *
11  * OSF DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE
12  * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
13  * FOR A PARTICULAR PURPOSE.
14  *
15  * IN NO EVENT SHALL OSF BE LIABLE FOR ANY SPECIAL, INDIRECT, OR
16  * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
17  * LOSS OF USE, DATA OR PROFITS, WHETHER IN ACTION OF CONTRACT,
18  * NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
19  * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
20  */
21 /*
22  * MkLinux
23  */
24 /* CMU_HIST */
25 /*
26  * Revision 2.4  91/05/14  16:58:46  mrt
27  * 	Correcting copyright
28  *
29  * Revision 2.3  91/02/05  17:35:31  mrt
30  * 	Changed to new Mach copyright
31  * 	[91/02/01  17:20:39  mrt]
32  *
33  * Revision 2.2  90/06/02  14:59:49  rpd
34  * 	Created for new host/processor technology.
35  * 	[90/03/26  23:51:38  rpd]
36  *
37  * 	Merge to X96
38  * 	[89/08/02  23:12:21  dlb]
39  *
40  * 	Add scheduling flavor of information.
41  * 	[89/07/25  18:52:18  dlb]
42  *
43  * 	Add load average and mach factor to processor set basic info.
44  * 	[89/02/09            dlb]
45  *
46  * Revision 2.3  89/10/15  02:05:54  rpd
47  * 	Minor cleanups.
48  *
49  * Revision 2.2  89/10/11  14:41:03  dlb
50  * 	Add scheduling flavor of information.
51  *
52  * 	Add load average and mach factor to processor set basic info.
53  * 	[89/02/09            dlb]
54  *
55  */
56 /* CMU_ENDHIST */
57 /*
58  * Mach Operating System
59  * Copyright (c) 1991,1990,1989 Carnegie Mellon University
60  * All Rights Reserved.
61  *
62  * Permission to use, copy, modify and distribute this software and its
63  * documentation is hereby granted, provided that both the copyright
64  * notice and this permission notice appear in all copies of the
65  * software, derivative works or modified versions, and any portions
66  * thereof, and that both notices appear in supporting documentation.
67  *
68  * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
69  * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
70  * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
71  *
72  * Carnegie Mellon requests users of this software to return to
73  *
74  *  Software Distribution Coordinator  or  Software.Distribution@CS.CMU.EDU
75  *  School of Computer Science
76  *  Carnegie Mellon University
77  *  Pittsburgh PA 15213-3890
78  *
79  * any improvements or extensions that they make and grant Carnegie Mellon
80  * the rights to redistribute these changes.
81  */
82 /*
83  */
84 
85 /*
86  *	File:	mach/processor_info.h
87  *	Author:	David L. Black
88  *	Date:	1988
89  *
90  *	Data structure definitions for processor_info, processor_set_info
91  */
92 
93 #ifndef	_MACH_PROCESSOR_INFO_H_
94 #define _MACH_PROCESSOR_INFO_H_
95 
96 #include <sys/mach/machine.h>
97 
98 /*
99  *	Generic information structure to allow for expansion.
100  */
101 typedef integer_t	*mach_processor_info_t;	/* varying array of int. */
102 typedef mach_processor_info_t *processor_info_array_t;
103 
104 #define PROCESSOR_INFO_MAX	(1024)	/* max array size */
105 typedef integer_t	processor_info_data_t[PROCESSOR_INFO_MAX];
106 
107 
108 typedef integer_t	*processor_set_info_t;	/* varying array of int. */
109 
110 #define PROCESSOR_SET_INFO_MAX	(1024)	/* max array size */
111 typedef integer_t	processor_set_info_data_t[PROCESSOR_SET_INFO_MAX];
112 
113 
114 typedef int	*processor_slot_t;	/* varying array of int. */
115 
116 /*
117  *	Currently defined information.
118  */
119 typedef int	processor_flavor_t;
120 #define	PROCESSOR_BASIC_INFO	1		/* basic information */
121 
122 struct processor_basic_info {
123 	cpu_type_t	cpu_type;	/* type of cpu */
124 	cpu_subtype_t	cpu_subtype;	/* subtype of cpu */
125 	boolean_t	running;	/* is processor running */
126 	int		slot_num;	/* slot number */
127 	boolean_t	is_master;	/* is this the master processor */
128 };
129 
130 typedef	struct processor_basic_info	processor_basic_info_data_t;
131 typedef struct processor_basic_info	*processor_basic_info_t;
132 #define PROCESSOR_BASIC_INFO_COUNT \
133 		(sizeof(processor_basic_info_data_t)/sizeof(natural_t))
134 
135 /*
136  *	Scaling factor for load_average, mach_factor.
137  */
138 #define	LOAD_SCALE	1000
139 
140 typedef	int	processor_set_flavor_t;
141 #define	PROCESSOR_SET_BASIC_INFO	5	/* basic information */
142 
143 struct processor_set_basic_info {
144 	int		processor_count;	/* How many processors */
145 	int		default_policy;		/* When others not enabled */
146 };
147 
148 typedef	struct processor_set_basic_info	processor_set_basic_info_data_t;
149 typedef struct processor_set_basic_info	*processor_set_basic_info_t;
150 #define PROCESSOR_SET_BASIC_INFO_COUNT \
151 		(sizeof(processor_set_basic_info_data_t)/sizeof(natural_t))
152 
153 #define PROCESSOR_SET_LOAD_INFO		4	/* scheduling statistics */
154 
155 struct processor_set_load_info {
156         int             task_count;             /* How many tasks */
157         int             thread_count;           /* How many threads */
158         integer_t       load_average;           /* Scaled */
159         integer_t       mach_factor;            /* Scaled */
160 };
161 
162 typedef struct processor_set_load_info processor_set_load_info_data_t;
163 typedef struct processor_set_load_info *processor_set_load_info_t;
164 #define PROCESSOR_SET_LOAD_INFO_COUNT	\
165                 (sizeof(processor_set_load_info_data_t)/sizeof(natural_t))
166 
167 
168 /*
169  *      New scheduling control interface
170  */
171 #define PROCESSOR_SET_ENABLED_POLICIES                   3
172 #define PROCESSOR_SET_ENABLED_POLICIES_COUNT	\
173 		(sizeof(policy_t)/sizeof(natural_t))
174 
175 #define PROCESSOR_SET_TIMESHARE_DEFAULT                 10
176 #define PROCESSOR_SET_TIMESHARE_LIMITS                  11
177 
178 #define PROCESSOR_SET_RR_DEFAULT                        20
179 #define PROCESSOR_SET_RR_LIMITS                         21
180 
181 #define PROCESSOR_SET_FIFO_DEFAULT                      30
182 #define PROCESSOR_SET_FIFO_LIMITS                       31
183 
184 #endif	/* _MACH_PROCESSOR_INFO_H_ */
185