]> git.saurik.com Git - apple/xnu.git/blame - osfmk/kern/machine.h
xnu-4903.270.47.tar.gz
[apple/xnu.git] / osfmk / kern / machine.h
CommitLineData
1c79356b 1/*
593a1d5f 2 * Copyright (c) 2000-2008 Apple Inc. All rights reserved.
1c79356b 3 *
2d21ac55 4 * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
0a7de745 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.
0a7de745 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.
0a7de745 17 *
2d21ac55
A
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.
0a7de745 25 *
2d21ac55 26 * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
1c79356b
A
27 */
28/*
29 * @OSF_COPYRIGHT@
30 */
31
0a7de745
A
32#ifndef _KERN_MACHINE_H_
33#define _KERN_MACHINE_H_
1c79356b 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
0a7de745 42#include <kern/sched_urgency.h>
1c79356b
A
43
44/*
45 * Machine support declarations.
46 */
47
0a7de745
A
48extern void processor_up(
49 processor_t processor);
1c79356b 50
0a7de745
A
51extern void processor_offline(
52 processor_t processor);
55e303ae 53
0a7de745 54extern void processor_start_thread(void *machine_param);
91447636 55
1c79356b
A
56/*
57 * Must be implemented in machine dependent code.
58 */
59
60/* Initialize machine dependent ast code */
91447636 61extern void init_ast_check(
0a7de745 62 processor_t processor);
1c79356b
A
63
64/* Cause check for ast */
91447636 65extern void cause_ast_check(
0a7de745 66 processor_t processor);
1c79356b 67
91447636 68extern kern_return_t cpu_control(
0a7de745
A
69 int slot_num,
70 processor_info_t info,
71 unsigned int count);
1c79356b 72
0a7de745 73extern void cpu_sleep(void);
1c79356b 74
91447636 75extern kern_return_t cpu_start(
0a7de745 76 int slot_num);
91447636
A
77
78extern void cpu_exit_wait(
0a7de745
A
79 int slot_num);
80
81extern boolean_t cpu_can_exit(
82 int slot_num);
91447636
A
83
84extern kern_return_t cpu_info(
0a7de745
A
85 processor_flavor_t flavor,
86 int slot_num,
87 processor_info_t info,
88 unsigned int *count);
91447636
A
89
90extern kern_return_t cpu_info_count(
0a7de745
A
91 processor_flavor_t flavor,
92 unsigned int *count);
91447636 93
0a7de745
A
94extern thread_t machine_processor_shutdown(
95 thread_t thread,
96 void (*doshutdown)(processor_t),
97 processor_t processor);
91447636
A
98
99extern void machine_idle(void);
100
4b17d6b6
A
101extern void machine_track_platform_idle(boolean_t);
102
3e170ce0 103/* Signals a processor to bring it out of idle */
91447636 104extern void machine_signal_idle(
0a7de745 105 processor_t processor);
91447636 106
3e170ce0
A
107/* Signals a processor to bring it out of idle unless canceled */
108extern void machine_signal_idle_deferred(
0a7de745 109 processor_t processor);
3e170ce0
A
110
111/* Cancels an outstanding machine_signal_idle_deferred, if this is supported */
112extern void machine_signal_idle_cancel(
0a7de745 113 processor_t processor);
3e170ce0 114
91447636
A
115extern void halt_cpu(void);
116
117extern void halt_all_cpus(
0a7de745 118 boolean_t reboot);
91447636
A
119
120extern char *machine_boot_info(
0a7de745
A
121 char *buf,
122 vm_size_t buf_len);
91447636
A
123
124/*
125 * Machine-dependent routine to fill in an array with up to callstack_max
126 * levels of return pc information.
127 */
128extern void machine_callstack(
0a7de745
A
129 uintptr_t *buf,
130 vm_size_t callstack_max);
1c79356b 131
91447636 132extern void consider_machine_collect(void);
1c79356b 133
3e170ce0
A
134/*
135 * Machine-dependent routine to inform platform layer and external
136 * CPU power management about context switches
137 */
138
0a7de745
A
139extern void machine_thread_going_on_core(thread_t new_thread,
140 thread_urgency_t urgency,
141 uint64_t sched_latency,
142 uint64_t same_pri_latency,
143 uint64_t dispatch_time);
3e170ce0 144
0a7de745
A
145extern void machine_thread_going_off_core(thread_t old_thread, boolean_t thread_terminating,
146 uint64_t last_dispatch, boolean_t thread_runnable);
3e170ce0
A
147
148extern void machine_max_runnable_latency(uint64_t bg_max_latency,
0a7de745
A
149 uint64_t default_max_latency,
150 uint64_t realtime_max_latency);
3e170ce0 151
5ba3f43e
A
152extern void machine_work_interval_notify(thread_t thread, struct kern_work_interval_args* kwi_args);
153
a39ff7e2 154
5ba3f43e
A
155extern void machine_perfcontrol_deadline_passed(uint64_t deadline);
156
157extern void machine_switch_perfcontrol_context(perfcontrol_event event,
0a7de745
A
158 uint64_t timestamp,
159 uint32_t flags,
160 uint64_t new_thread_same_pri_latency,
161 thread_t old,
162 thread_t new);
5ba3f43e
A
163
164extern void machine_switch_perfcontrol_state_update(perfcontrol_event event,
0a7de745
A
165 uint64_t timestamp,
166 uint32_t flags,
167 thread_t thread);
5ba3f43e 168
3e170ce0 169
0a7de745 170#endif /* _KERN_MACHINE_H_ */