]> git.saurik.com Git - apple/xnu.git/blob - osfmk/mach/processor_info.h
afe7f2c0bfb3e98bec5734c684e0f46be2b72906
[apple/xnu.git] / osfmk / mach / processor_info.h
1 /*
2 * Copyright (c) 2000-2005 Apple Computer, Inc. All rights reserved.
3 *
4 * @APPLE_LICENSE_OSREFERENCE_HEADER_START@
5 *
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. The rights granted to you under the
10 * License may not be used to create, or enable the creation or
11 * redistribution of, unlawful or unlicensed copies of an Apple operating
12 * system, or to circumvent, violate, or enable the circumvention or
13 * violation of, any terms of an Apple operating system software license
14 * agreement.
15 *
16 * Please obtain a copy of the License at
17 * http://www.opensource.apple.com/apsl/ and read it before using this
18 * file.
19 *
20 * The Original Code and all software distributed under the License are
21 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
22 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
23 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
24 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
25 * Please see the License for the specific language governing rights and
26 * limitations under the License.
27 *
28 * @APPLE_LICENSE_OSREFERENCE_HEADER_END@
29 */
30 /*
31 * @OSF_COPYRIGHT@
32 */
33 /*
34 * Mach Operating System
35 * Copyright (c) 1991,1990,1989 Carnegie Mellon University
36 * All Rights Reserved.
37 *
38 * Permission to use, copy, modify and distribute this software and its
39 * documentation is hereby granted, provided that both the copyright
40 * notice and this permission notice appear in all copies of the
41 * software, derivative works or modified versions, and any portions
42 * thereof, and that both notices appear in supporting documentation.
43 *
44 * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
45 * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
46 * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
47 *
48 * Carnegie Mellon requests users of this software to return to
49 *
50 * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
51 * School of Computer Science
52 * Carnegie Mellon University
53 * Pittsburgh PA 15213-3890
54 *
55 * any improvements or extensions that they make and grant Carnegie Mellon
56 * the rights to redistribute these changes.
57 */
58 /*
59 */
60
61 /*
62 * File: mach/processor_info.h
63 * Author: David L. Black
64 * Date: 1988
65 *
66 * Data structure definitions for processor_info, processor_set_info
67 */
68
69 #ifndef _MACH_PROCESSOR_INFO_H_
70 #define _MACH_PROCESSOR_INFO_H_
71
72 #include <mach/message.h>
73 #include <mach/machine.h>
74 #include <mach/machine/processor_info.h>
75
76 /*
77 * Generic information structure to allow for expansion.
78 */
79 typedef integer_t *processor_info_t; /* varying array of int. */
80 typedef integer_t *processor_info_array_t; /* varying array of int */
81
82 #define PROCESSOR_INFO_MAX (1024) /* max array size */
83 typedef integer_t processor_info_data_t[PROCESSOR_INFO_MAX];
84
85
86 typedef integer_t *processor_set_info_t; /* varying array of int. */
87
88 #define PROCESSOR_SET_INFO_MAX (1024) /* max array size */
89 typedef integer_t processor_set_info_data_t[PROCESSOR_SET_INFO_MAX];
90
91 /*
92 * Currently defined information.
93 */
94 typedef int processor_flavor_t;
95 #define PROCESSOR_BASIC_INFO 1 /* basic information */
96 #define PROCESSOR_CPU_LOAD_INFO 2 /* cpu load information */
97 #define PROCESSOR_PM_REGS_INFO 0x10000001 /* performance monitor register info */
98 #define PROCESSOR_TEMPERATURE 0x10000002 /* Processor core temperature */
99
100 struct processor_basic_info {
101 cpu_type_t cpu_type; /* type of cpu */
102 cpu_subtype_t cpu_subtype; /* subtype of cpu */
103 boolean_t running; /* is processor running */
104 int slot_num; /* slot number */
105 boolean_t is_master; /* is this the master processor */
106 };
107
108 typedef struct processor_basic_info processor_basic_info_data_t;
109 typedef struct processor_basic_info *processor_basic_info_t;
110 #define PROCESSOR_BASIC_INFO_COUNT ((mach_msg_type_number_t) \
111 (sizeof(processor_basic_info_data_t)/sizeof(natural_t)))
112
113 struct processor_cpu_load_info { /* number of ticks while running... */
114 unsigned long cpu_ticks[CPU_STATE_MAX]; /* ... in the given mode */
115 };
116
117 typedef struct processor_cpu_load_info processor_cpu_load_info_data_t;
118 typedef struct processor_cpu_load_info *processor_cpu_load_info_t;
119 #define PROCESSOR_CPU_LOAD_INFO_COUNT ((mach_msg_type_number_t) \
120 (sizeof(processor_cpu_load_info_data_t)/sizeof(natural_t)))
121
122 /*
123 * Scaling factor for load_average, mach_factor.
124 */
125 #define LOAD_SCALE 1000
126
127 typedef int processor_set_flavor_t;
128 #define PROCESSOR_SET_BASIC_INFO 5 /* basic information */
129
130 struct processor_set_basic_info {
131 int processor_count; /* How many processors */
132 int default_policy; /* When others not enabled */
133 };
134
135 typedef struct processor_set_basic_info processor_set_basic_info_data_t;
136 typedef struct processor_set_basic_info *processor_set_basic_info_t;
137 #define PROCESSOR_SET_BASIC_INFO_COUNT ((mach_msg_type_number_t) \
138 (sizeof(processor_set_basic_info_data_t)/sizeof(natural_t)))
139
140 #define PROCESSOR_SET_LOAD_INFO 4 /* scheduling statistics */
141
142 struct processor_set_load_info {
143 int task_count; /* How many tasks */
144 int thread_count; /* How many threads */
145 integer_t load_average; /* Scaled */
146 integer_t mach_factor; /* Scaled */
147 };
148
149 typedef struct processor_set_load_info processor_set_load_info_data_t;
150 typedef struct processor_set_load_info *processor_set_load_info_t;
151 #define PROCESSOR_SET_LOAD_INFO_COUNT ((mach_msg_type_number_t) \
152 (sizeof(processor_set_load_info_data_t)/sizeof(natural_t)))
153
154 #ifdef PRIVATE
155
156 #define PROCESSOR_SET_ENABLED_POLICIES 3
157 #define PROCESSOR_SET_ENABLED_POLICIES_COUNT ((mach_msg_type_number_t) \
158 (sizeof(policy_t)/sizeof(natural_t)))
159
160 #define PROCESSOR_SET_TIMESHARE_DEFAULT 10
161 #define PROCESSOR_SET_TIMESHARE_LIMITS 11
162
163 #define PROCESSOR_SET_RR_DEFAULT 20
164 #define PROCESSOR_SET_RR_LIMITS 21
165
166 #define PROCESSOR_SET_FIFO_DEFAULT 30
167 #define PROCESSOR_SET_FIFO_LIMITS 31
168
169 #endif /* PRIVATE */
170
171 #endif /* _MACH_PROCESSOR_INFO_H_ */