]>
Commit | Line | Data |
---|---|---|
1c79356b | 1 | /* |
593a1d5f | 2 | * Copyright (c) 2000-2008 Apple Inc. All rights reserved. |
1c79356b | 3 | * |
2d21ac55 | 4 | * @APPLE_OSREFERENCE_LICENSE_HEADER_START@ |
1c79356b | 5 | * |
2d21ac55 A |
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 License | |
10 | * may not be used to create, or enable the creation or redistribution of, | |
11 | * unlawful or unlicensed copies of an Apple operating system, or to | |
12 | * circumvent, violate, or enable the circumvention or violation of, any | |
13 | * terms of an Apple operating system software license agreement. | |
8f6c56a5 | 14 | * |
2d21ac55 A |
15 | * Please obtain a copy of the License at |
16 | * http://www.opensource.apple.com/apsl/ and read it before using this file. | |
17 | * | |
18 | * The Original Code and all software distributed under the License are | |
19 | * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER | |
8f6c56a5 A |
20 | * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, |
21 | * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, | |
2d21ac55 A |
22 | * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. |
23 | * Please see the License for the specific language governing rights and | |
24 | * limitations under the License. | |
8f6c56a5 | 25 | * |
2d21ac55 | 26 | * @APPLE_OSREFERENCE_LICENSE_HEADER_END@ |
1c79356b A |
27 | */ |
28 | /* | |
29 | * @OSF_COPYRIGHT@ | |
30 | */ | |
31 | ||
32 | #ifndef _KERN_MACHINE_H_ | |
33 | #define _KERN_MACHINE_H_ | |
34 | ||
1c79356b A |
35 | #include <mach/kern_return.h> |
36 | #include <mach/processor_info.h> | |
37 | #include <kern/kern_types.h> | |
5ba3f43e A |
38 | #include <kern/thread_group.h> |
39 | ||
40 | #include <kern/work_interval.h> | |
41 | ||
1c79356b A |
42 | |
43 | /* | |
44 | * Machine support declarations. | |
45 | */ | |
46 | ||
91447636 A |
47 | extern void processor_up( |
48 | processor_t processor); | |
1c79356b | 49 | |
55e303ae A |
50 | extern void processor_offline( |
51 | processor_t processor); | |
52 | ||
593a1d5f | 53 | extern void processor_start_thread(void *machine_param); |
91447636 | 54 | |
1c79356b A |
55 | /* |
56 | * Must be implemented in machine dependent code. | |
57 | */ | |
58 | ||
59 | /* Initialize machine dependent ast code */ | |
91447636 A |
60 | extern void init_ast_check( |
61 | processor_t processor); | |
1c79356b A |
62 | |
63 | /* Cause check for ast */ | |
91447636 A |
64 | extern void cause_ast_check( |
65 | processor_t processor); | |
1c79356b | 66 | |
91447636 A |
67 | extern kern_return_t cpu_control( |
68 | int slot_num, | |
69 | processor_info_t info, | |
70 | unsigned int count); | |
1c79356b | 71 | |
91447636 | 72 | extern void cpu_sleep(void); |
1c79356b | 73 | |
91447636 A |
74 | extern kern_return_t cpu_start( |
75 | int slot_num); | |
76 | ||
77 | extern void cpu_exit_wait( | |
78 | int slot_num); | |
79 | ||
80 | extern kern_return_t cpu_info( | |
81 | processor_flavor_t flavor, | |
82 | int slot_num, | |
83 | processor_info_t info, | |
84 | unsigned int *count); | |
85 | ||
86 | extern kern_return_t cpu_info_count( | |
87 | processor_flavor_t flavor, | |
88 | unsigned int *count); | |
89 | ||
90 | extern thread_t machine_processor_shutdown( | |
91 | thread_t thread, | |
92 | void (*doshutdown)(processor_t), | |
93 | processor_t processor); | |
94 | ||
95 | extern void machine_idle(void); | |
96 | ||
4b17d6b6 A |
97 | extern void machine_track_platform_idle(boolean_t); |
98 | ||
3e170ce0 | 99 | /* Signals a processor to bring it out of idle */ |
91447636 A |
100 | extern void machine_signal_idle( |
101 | processor_t processor); | |
102 | ||
3e170ce0 A |
103 | /* Signals a processor to bring it out of idle unless canceled */ |
104 | extern void machine_signal_idle_deferred( | |
105 | processor_t processor); | |
106 | ||
107 | /* Cancels an outstanding machine_signal_idle_deferred, if this is supported */ | |
108 | extern void machine_signal_idle_cancel( | |
109 | processor_t processor); | |
110 | ||
91447636 A |
111 | extern void halt_cpu(void); |
112 | ||
113 | extern void halt_all_cpus( | |
114 | boolean_t reboot); | |
115 | ||
116 | extern char *machine_boot_info( | |
117 | char *buf, | |
118 | vm_size_t buf_len); | |
119 | ||
120 | /* | |
121 | * Machine-dependent routine to fill in an array with up to callstack_max | |
122 | * levels of return pc information. | |
123 | */ | |
124 | extern void machine_callstack( | |
39236c6e | 125 | uintptr_t *buf, |
91447636 | 126 | vm_size_t callstack_max); |
1c79356b | 127 | |
91447636 | 128 | extern void consider_machine_collect(void); |
1c79356b | 129 | |
3e170ce0 A |
130 | /* |
131 | * Machine-dependent routine to inform platform layer and external | |
132 | * CPU power management about context switches | |
133 | */ | |
134 | ||
135 | extern void machine_thread_going_on_core(thread_t new_thread, | |
136 | int urgency, | |
d190cdc3 | 137 | uint64_t sched_latency, |
5ba3f43e | 138 | uint64_t same_pri_latency, |
d190cdc3 | 139 | uint64_t dispatch_time); |
3e170ce0 | 140 | |
d190cdc3 | 141 | extern void machine_thread_going_off_core(thread_t old_thread, boolean_t thread_terminating, uint64_t last_dispatch); |
3e170ce0 A |
142 | |
143 | extern void machine_max_runnable_latency(uint64_t bg_max_latency, | |
144 | uint64_t default_max_latency, | |
145 | uint64_t realtime_max_latency); | |
146 | ||
5ba3f43e A |
147 | extern void machine_work_interval_notify(thread_t thread, struct kern_work_interval_args* kwi_args); |
148 | ||
a39ff7e2 | 149 | |
5ba3f43e A |
150 | extern void machine_perfcontrol_deadline_passed(uint64_t deadline); |
151 | ||
152 | extern void machine_switch_perfcontrol_context(perfcontrol_event event, | |
153 | uint64_t timestamp, | |
154 | uint32_t flags, | |
155 | uint64_t new_thread_same_pri_latency, | |
156 | thread_t old, | |
157 | thread_t new); | |
158 | ||
159 | extern void machine_switch_perfcontrol_state_update(perfcontrol_event event, | |
160 | uint64_t timestamp, | |
161 | uint32_t flags, | |
162 | thread_t thread); | |
163 | ||
3e170ce0 | 164 | |
1c79356b | 165 | #endif /* _KERN_MACHINE_H_ */ |