]> git.saurik.com Git - apple/xnu.git/blob - osfmk/i386/machine_routines.h
xnu-344.2.tar.gz
[apple/xnu.git] / osfmk / i386 / machine_routines.h
1 /*
2 * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
3 *
4 * @APPLE_LICENSE_HEADER_START@
5 *
6 * The contents of this file constitute Original Code as defined in and
7 * are subject to the Apple Public Source License Version 1.1 (the
8 * "License"). You may not use this file except in compliance with the
9 * License. Please obtain a copy of the License at
10 * http://www.apple.com/publicsource and read it before using this file.
11 *
12 * This Original Code and all software distributed under the License are
13 * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
14 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
15 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the
17 * License for the specific language governing rights and limitations
18 * under the License.
19 *
20 * @APPLE_LICENSE_HEADER_END@
21 */
22 /*
23 * @OSF_COPYRIGHT@
24 */
25
26 #ifndef _I386_MACHINE_ROUTINES_H_
27 #define _I386_MACHINE_ROUTINES_H_
28
29 #include <mach/mach_types.h>
30 #include <mach/boolean.h>
31 #include <kern/kern_types.h>
32 #include <pexpert/pexpert.h>
33
34 #include <sys/appleapiopts.h>
35
36 /* Interrupt handling */
37
38 /* Get Interrupts Enabled */
39 boolean_t ml_get_interrupts_enabled(void);
40
41 /* Set Interrupts Enabled */
42 boolean_t ml_set_interrupts_enabled(boolean_t enable);
43
44 /* Check if running at interrupt context */
45 boolean_t ml_at_interrupt_context(void);
46
47 /* Generate a fake interrupt */
48 void ml_cause_interrupt(void);
49
50 void ml_get_timebase(unsigned long long *timestamp);
51
52 /* Type for the IPI Hander */
53 typedef void (*ipi_handler_t)(void);
54
55 /* Register a processor */
56 kern_return_t ml_processor_register(
57 cpu_id_t cpu_id,
58 vm_offset_t start_paddr,
59 processor_t *processor,
60 ipi_handler_t *ipi_handler,
61 boolean_t boot_cpu);
62
63 /* Initialize Interrupts */
64 void ml_install_interrupt_handler(
65 void *nub,
66 int source,
67 void *target,
68 IOInterruptHandler handler,
69 void *refCon);
70
71 #ifdef __APPLE_API_UNSTABLE
72 vm_offset_t
73 ml_static_ptovirt(
74 vm_offset_t);
75
76 void ml_static_mfree(
77 vm_offset_t,
78 vm_size_t);
79
80 /* virtual to physical on wired pages */
81 vm_offset_t ml_vtophys(
82 vm_offset_t vaddr);
83
84 #endif /* __APPLE_API_UNSTABLE */
85
86 #ifdef __APPLE_API_PRIVATE
87 #if defined(PEXPERT_KERNEL_PRIVATE) || defined(MACH_KERNEL_PRIVATE)
88 /* IO memory map services */
89
90 /* Map memory map IO space */
91 vm_offset_t ml_io_map(
92 vm_offset_t phys_addr,
93 vm_size_t size);
94
95 /* boot memory allocation */
96 vm_offset_t ml_static_malloc(
97 vm_size_t size);
98
99 #endif /* PEXPERT_KERNEL_PRIVATE || MACH_KERNEL_PRIVATE */
100
101 #ifdef MACH_KERNEL_PRIVATE
102 /* check pending timers */
103 #define machine_clock_assist()
104
105 void machine_idle(void);
106
107 void machine_signal_idle(
108 processor_t processor);
109 #endif /* MACH_KERNEL_PRIVATE */
110
111 void ml_thread_policy(
112 thread_t thread,
113 unsigned policy_id,
114 unsigned policy_info);
115
116 #define MACHINE_GROUP 0x00000001
117 #define MACHINE_NETWORK_GROUP 0x10000000
118 #define MACHINE_NETWORK_WORKLOOP 0x00000001
119 #define MACHINE_NETWORK_NETISR 0x00000002
120
121 #endif /* __APPLE_API_PRIVATE */
122
123 #endif /* _I386_MACHINE_ROUTINES_H_ */