]>
Commit | Line | Data |
---|---|---|
1c79356b A |
1 | /* |
2 | * Copyright (c) 2000 Apple Computer, Inc. All rights reserved. | |
3 | * | |
4 | * @APPLE_LICENSE_HEADER_START@ | |
5 | * | |
de355530 A |
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. | |
1c79356b | 11 | * |
de355530 A |
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 | |
1c79356b A |
14 | * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, |
15 | * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, | |
de355530 A |
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. | |
1c79356b A |
19 | * |
20 | * @APPLE_LICENSE_HEADER_END@ | |
21 | */ | |
22 | /* | |
23 | * @OSF_COPYRIGHT@ | |
24 | */ | |
25 | ||
26 | #ifndef _PPC_MACHINE_ROUTINES_H_ | |
27 | #define _PPC_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 | ||
9bccf70c | 34 | #include <sys/appleapiopts.h> |
1c79356b | 35 | |
9bccf70c A |
36 | /* Get Interrupts Enabled */ |
37 | boolean_t ml_get_interrupts_enabled(void); | |
1c79356b | 38 | |
9bccf70c A |
39 | /* Set Interrupts Enabled */ |
40 | boolean_t ml_set_interrupts_enabled(boolean_t enable); | |
1c79356b | 41 | |
9bccf70c A |
42 | /* Check if running at interrupt context */ |
43 | boolean_t ml_at_interrupt_context(void); | |
1c79356b | 44 | |
9bccf70c A |
45 | /* Generate a fake interrupt */ |
46 | void ml_cause_interrupt(void); | |
47 | ||
48 | /* Type for the IPI Hander */ | |
49 | typedef void (*ipi_handler_t)(void); | |
50 | ||
51 | /* Type for the Time Base Enable function */ | |
52 | typedef void (*time_base_enable_t)(cpu_id_t cpu_id, boolean_t enable); | |
53 | ||
54 | /* enables (or disables) the processor nap mode the function returns the previous value*/ | |
55 | boolean_t ml_enable_nap( | |
56 | int target_cpu, | |
57 | boolean_t nap_enabled); | |
58 | ||
59 | /* Put the processor to sleep */ | |
60 | void ml_ppc_sleep(void); | |
61 | void ml_get_timebase(unsigned long long *timstamp); | |
62 | void ml_sense__nmi(void); | |
63 | ||
64 | int ml_enable_cache_level(int cache_level, int enable); | |
1c79356b A |
65 | |
66 | void ml_static_mfree( | |
67 | vm_offset_t, | |
68 | vm_size_t); | |
69 | ||
1c79356b A |
70 | /* Init Interrupts */ |
71 | void ml_install_interrupt_handler( | |
72 | void *nub, | |
73 | int source, | |
74 | void *target, | |
75 | IOInterruptHandler handler, | |
76 | void *refCon); | |
77 | ||
9bccf70c | 78 | #ifdef __APPLE_API_UNSTABLE |
1c79356b | 79 | |
9bccf70c A |
80 | vm_offset_t |
81 | ml_static_ptovirt( | |
82 | vm_offset_t); | |
1c79356b | 83 | |
9bccf70c A |
84 | /* virtual to physical on wired pages */ |
85 | vm_offset_t ml_vtophys( | |
86 | vm_offset_t vaddr); | |
1c79356b A |
87 | |
88 | /* PCI config cycle probing */ | |
89 | boolean_t ml_probe_read( | |
90 | vm_offset_t paddr, | |
91 | unsigned int *val); | |
92 | ||
93 | /* Read physical address byte */ | |
94 | unsigned int ml_phys_read_byte( | |
95 | vm_offset_t paddr); | |
96 | ||
de355530 | 97 | /* Read physical address */ |
1c79356b A |
98 | unsigned int ml_phys_read( |
99 | vm_offset_t paddr); | |
100 | ||
101 | /* Write physical address byte */ | |
102 | void ml_phys_write_byte( | |
103 | vm_offset_t paddr, unsigned int data); | |
104 | ||
de355530 | 105 | /* Write physical address */ |
1c79356b A |
106 | void ml_phys_write( |
107 | vm_offset_t paddr, unsigned int data); | |
108 | ||
1c79356b A |
109 | /* Struct for ml_processor_register */ |
110 | struct ml_processor_info_t { | |
111 | cpu_id_t cpu_id; | |
112 | boolean_t boot_cpu; | |
113 | vm_offset_t start_paddr; | |
114 | boolean_t supports_nap; | |
115 | unsigned long l2cr_value; | |
116 | time_base_enable_t time_base_enable; | |
117 | }; | |
118 | ||
119 | typedef struct ml_processor_info_t ml_processor_info_t; | |
120 | ||
121 | /* Register a processor */ | |
122 | kern_return_t ml_processor_register( | |
123 | ml_processor_info_t *processor_info, | |
124 | processor_t *processor, | |
125 | ipi_handler_t *ipi_handler); | |
126 | ||
9bccf70c | 127 | #endif /* __APPLE_API_UNSTABLE */ |
1c79356b | 128 | |
9bccf70c A |
129 | #ifdef __APPLE_API_PRIVATE |
130 | #if defined(PEXPERT_KERNEL_PRIVATE) || defined(MACH_KERNEL_PRIVATE) | |
131 | /* IO memory map services */ | |
1c79356b | 132 | |
9bccf70c A |
133 | /* Map memory map IO space */ |
134 | vm_offset_t ml_io_map( | |
135 | vm_offset_t phys_addr, | |
136 | vm_size_t size); | |
1c79356b | 137 | |
9bccf70c A |
138 | /* boot memory allocation */ |
139 | vm_offset_t ml_static_malloc( | |
140 | vm_size_t size); | |
1c79356b | 141 | |
9bccf70c | 142 | #endif /* PEXPERT_KERNEL_PRIVATE || MACH_KERNEL_PRIVATE */ |
1c79356b A |
143 | |
144 | #ifdef MACH_KERNEL_PRIVATE | |
9bccf70c A |
145 | void ml_init_interrupt(void); |
146 | ||
147 | boolean_t fake_get_interrupts_enabled(void); | |
148 | ||
149 | boolean_t fake_set_interrupts_enabled( | |
150 | boolean_t enable); | |
151 | ||
de355530 A |
152 | /* check pending timers */ |
153 | void machine_clock_assist(void); | |
154 | ||
9bccf70c A |
155 | void machine_idle(void); |
156 | ||
157 | void machine_signal_idle( | |
158 | processor_t processor); | |
159 | ||
1c79356b A |
160 | void cacheInit(void); |
161 | ||
162 | void cacheDisable(void); | |
163 | ||
164 | void ml_thrm_init(void); | |
165 | unsigned int ml_read_temp(void); | |
166 | ||
167 | void ml_thrm_set( | |
168 | unsigned int low, | |
169 | unsigned int high); | |
170 | ||
171 | unsigned int ml_throttle( | |
172 | unsigned int); | |
1c79356b | 173 | |
9bccf70c A |
174 | #endif /* MACH_KERNEL_PRIVATE */ |
175 | ||
176 | void ml_thread_policy( | |
177 | thread_t thread, | |
178 | unsigned policy_id, | |
179 | unsigned policy_info); | |
180 | ||
181 | #define MACHINE_GROUP 0x00000001 | |
182 | #define MACHINE_NETWORK_GROUP 0x10000000 | |
183 | #define MACHINE_NETWORK_WORKLOOP 0x00000001 | |
184 | #define MACHINE_NETWORK_NETISR 0x00000002 | |
185 | ||
de355530 A |
186 | /* Struct for ml_ppc_get_cpu_info */ |
187 | struct ml_ppc_cpu_info_t { | |
9bccf70c A |
188 | unsigned long vector_unit; |
189 | unsigned long cache_line_size; | |
190 | unsigned long l1_icache_size; | |
191 | unsigned long l1_dcache_size; | |
192 | unsigned long l2_settings; | |
193 | unsigned long l2_cache_size; | |
194 | unsigned long l3_settings; | |
195 | unsigned long l3_cache_size; | |
196 | }; | |
197 | ||
de355530 | 198 | typedef struct ml_ppc_cpu_info_t ml_ppc_cpu_info_t; |
9bccf70c A |
199 | |
200 | /* Get processor info */ | |
de355530 | 201 | void ml_ppc_get_info(ml_ppc_cpu_info_t *cpu_info); |
1c79356b | 202 | |
d52fe63f | 203 | void ml_set_processor_speed(unsigned long speed); |
d12e1678 | 204 | void ml_set_processor_voltage(unsigned long voltage); |
d52fe63f | 205 | |
9bccf70c A |
206 | #endif /* __APPLE_API_PRIVATE */ |
207 | ||
1c79356b | 208 | #endif /* _PPC_MACHINE_ROUTINES_H_ */ |