]>
Commit | Line | Data |
---|---|---|
1c79356b A |
1 | /* |
2 | * Copyright (c) 2000 Apple Computer, Inc. All rights reserved. | |
3 | * | |
4 | * @APPLE_LICENSE_HEADER_START@ | |
5 | * | |
d7e50217 | 6 | * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved. |
1c79356b | 7 | * |
d7e50217 A |
8 | * This file contains Original Code and/or Modifications of Original Code |
9 | * as defined in and that are subject to the Apple Public Source License | |
10 | * Version 2.0 (the 'License'). You may not use this file except in | |
11 | * compliance with the License. Please obtain a copy of the License at | |
12 | * http://www.opensource.apple.com/apsl/ and read it before using this | |
13 | * file. | |
14 | * | |
15 | * The Original Code and all software distributed under the License are | |
16 | * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER | |
1c79356b A |
17 | * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, |
18 | * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, | |
d7e50217 A |
19 | * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. |
20 | * Please see the License for the specific language governing rights and | |
21 | * limitations under the License. | |
1c79356b A |
22 | * |
23 | * @APPLE_LICENSE_HEADER_END@ | |
24 | */ | |
25 | #include <i386/machine_routines.h> | |
26 | #include <i386/io_map_entries.h> | |
27 | #include <kern/cpu_data.h> | |
9bccf70c | 28 | #include <kern/thread_act.h> |
1c79356b A |
29 | |
30 | /* IO memory map services */ | |
31 | ||
32 | /* Map memory map IO space */ | |
33 | vm_offset_t ml_io_map( | |
34 | vm_offset_t phys_addr, | |
35 | vm_size_t size) | |
36 | { | |
37 | return(io_map(phys_addr,size)); | |
38 | } | |
39 | ||
40 | /* boot memory allocation */ | |
41 | vm_offset_t ml_static_malloc( | |
42 | vm_size_t size) | |
43 | { | |
44 | return((vm_offset_t)NULL); | |
45 | } | |
46 | ||
47 | vm_offset_t | |
48 | ml_static_ptovirt( | |
49 | vm_offset_t paddr) | |
50 | { | |
51 | return phystokv(paddr); | |
52 | } | |
53 | ||
54 | void | |
55 | ml_static_mfree( | |
56 | vm_offset_t vaddr, | |
57 | vm_size_t size) | |
58 | { | |
59 | return; | |
60 | } | |
61 | ||
62 | /* virtual to physical on wired pages */ | |
63 | vm_offset_t ml_vtophys( | |
64 | vm_offset_t vaddr) | |
65 | { | |
66 | return kvtophys(vaddr); | |
67 | } | |
68 | ||
69 | /* Interrupt handling */ | |
70 | ||
71 | /* Get Interrupts Enabled */ | |
72 | boolean_t ml_get_interrupts_enabled(void) | |
73 | { | |
74 | unsigned long flags; | |
75 | ||
76 | __asm__ volatile("pushf; popl %0" : "=r" (flags)); | |
77 | return (flags & EFL_IF) != 0; | |
78 | } | |
79 | ||
80 | /* Set Interrupts Enabled */ | |
81 | boolean_t ml_set_interrupts_enabled(boolean_t enable) | |
82 | { | |
83 | unsigned long flags; | |
84 | ||
85 | __asm__ volatile("pushf; popl %0" : "=r" (flags)); | |
86 | ||
87 | if (enable) | |
88 | __asm__ volatile("sti"); | |
89 | else | |
90 | __asm__ volatile("cli"); | |
91 | ||
92 | return (flags & EFL_IF) != 0; | |
93 | } | |
94 | ||
95 | /* Check if running at interrupt context */ | |
96 | boolean_t ml_at_interrupt_context(void) | |
97 | { | |
98 | return get_interrupt_level() != 0; | |
99 | } | |
100 | ||
101 | /* Generate a fake interrupt */ | |
102 | void ml_cause_interrupt(void) | |
103 | { | |
104 | panic("ml_cause_interrupt not defined yet on Intel"); | |
105 | } | |
106 | ||
d52fe63f A |
107 | void ml_thread_policy( |
108 | thread_t thread, | |
109 | unsigned policy_id, | |
110 | unsigned policy_info) | |
111 | { | |
112 | return; | |
113 | } | |
114 | ||
1c79356b A |
115 | /* Initialize Interrupts */ |
116 | void ml_install_interrupt_handler( | |
117 | void *nub, | |
118 | int source, | |
119 | void *target, | |
120 | IOInterruptHandler handler, | |
121 | void *refCon) | |
122 | { | |
123 | boolean_t current_state; | |
124 | ||
125 | current_state = ml_get_interrupts_enabled(); | |
126 | ||
127 | PE_install_interrupt_handler(nub, source, target, | |
128 | (IOInterruptHandler) handler, refCon); | |
129 | ||
130 | (void) ml_set_interrupts_enabled(current_state); | |
131 | } | |
132 | ||
133 | void | |
134 | machine_signal_idle( | |
135 | processor_t processor) | |
136 | { | |
137 | } | |
138 | ||
d7e50217 A |
139 | void |
140 | ml_cpu_get_info(ml_cpu_info_t *cpu_info) | |
141 | { | |
142 | } | |
143 | ||
144 | void | |
145 | ml_init_max_cpus(unsigned long max_cpus) | |
146 | { | |
147 | } | |
148 | ||
149 | int | |
150 | ml_get_max_cpus(void) | |
151 | { | |
152 | return(machine_info.max_cpus); | |
153 | } | |
154 | ||
155 | int | |
156 | ml_get_current_cpus(void) | |
157 | { | |
158 | return machine_info.avail_cpus; | |
159 | } | |
160 | ||
1c79356b A |
161 | /* Stubs for pc tracing mechanism */ |
162 | ||
163 | int *pc_trace_buf; | |
164 | int pc_trace_cnt = 0; | |
165 | ||
166 | int | |
167 | set_be_bit() | |
168 | { | |
169 | return(0); | |
170 | } | |
171 | ||
172 | int | |
173 | clr_be_bit() | |
174 | { | |
175 | return(0); | |
176 | } | |
177 | ||
178 | int | |
179 | be_tracing() | |
180 | { | |
181 | return(0); | |
182 | } | |
9bccf70c A |
183 | |
184 | #undef current_act | |
185 | thread_act_t | |
186 | current_act(void) | |
187 | { | |
188 | return(current_act_fast()); | |
189 | } |