]> git.saurik.com Git - apple/xnu.git/blob - pexpert/pexpert/pexpert.h
39d1bd98a0ed207001b471ce71bd5faff34f9ee1
[apple/xnu.git] / pexpert / pexpert / pexpert.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 #ifndef _PEXPERT_PEXPERT_H_
23 #define _PEXPERT_PEXPERT_H_
24
25 #include <sys/cdefs.h>
26
27 #include <IOKit/IOInterrupts.h>
28 #include <kern/kern_types.h>
29
30 __BEGIN_DECLS
31 #include <mach/boolean.h>
32 #include <mach/kern_return.h>
33 #include <mach/machine/vm_types.h>
34
35 #ifdef PEXPERT_KERNEL_PRIVATE
36 #include <pexpert/protos.h>
37 #endif
38 #include <pexpert/boot.h>
39
40 #if defined(PEXPERT_KERNEL_PRIVATE) || defined(IOKIT_KERNEL_PRIVATE)
41 typedef void *cpu_id_t;
42 #else
43 typedef void *cpu_id_t;
44 #endif
45
46
47 void PE_enter_debugger(
48 char *cause);
49
50 void PE_init_platform(
51 boolean_t vm_initialized,
52 void *args);
53
54 void PE_init_kprintf(
55 boolean_t vm_initialized);
56
57 extern void (*PE_kputc)(char c);
58
59 void PE_init_printf(
60 boolean_t vm_initialized);
61
62 extern void (*PE_putc)(char c);
63
64 void PE_init_iokit(
65 void);
66
67 struct clock_frequency_info_t {
68 unsigned long bus_clock_rate_hz;
69 unsigned long cpu_clock_rate_hz;
70 unsigned long dec_clock_rate_hz;
71 unsigned long bus_clock_rate_num;
72 unsigned long bus_clock_rate_den;
73 unsigned long bus_to_cpu_rate_num;
74 unsigned long bus_to_cpu_rate_den;
75 unsigned long bus_to_dec_rate_num;
76 unsigned long bus_to_dec_rate_den;
77 unsigned long timebase_frequency_hz;
78 unsigned long timebase_frequency_num;
79 unsigned long timebase_frequency_den;
80 };
81
82 typedef struct clock_frequency_info_t clock_frequency_info_t;
83
84 extern clock_frequency_info_t gPEClockFrequencyInfo;
85
86 struct timebase_freq_t {
87 unsigned long timebase_num;
88 unsigned long timebase_den;
89 };
90
91 typedef void (*timebase_callback_func)(struct timebase_freq_t *timebase_freq);
92
93 void PE_register_timebase_callback(timebase_callback_func callback);
94
95 void PE_call_timebase_callback(void);
96
97 void PE_install_interrupt_handler(
98 void *nub, int source,
99 void *target, IOInterruptHandler handler, void *refCon);
100
101 void kprintf(
102 const char *fmt, ...);
103
104 void init_display_putc(unsigned char *baseaddr, int rowbytes, int height);
105 void display_putc(char c);
106
107 boolean_t PE_init_ethernet_debugger( void );
108
109 enum {
110 kPEReadTOD,
111 kPEWriteTOD
112 };
113 extern int (*PE_read_write_time_of_day)(
114 unsigned int options,
115 long * secs);
116
117 enum {
118 kPEWaitForInput = 0x00000001,
119 kPERawInput = 0x00000002
120 };
121 extern int (*PE_poll_input)(
122 unsigned int options,
123 char * c);
124
125 extern int (*PE_write_IIC)(
126 unsigned char addr,
127 unsigned char reg,
128 unsigned char data);
129
130 /* Private Stuff - eventually put in pexpertprivate.h */
131 enum {
132 kDebugTypeNone = 0,
133 kDebugTypeDisplay = 1,
134 kDebugTypeSerial = 2
135 };
136
137 struct PE_Video {
138 unsigned long v_baseAddr; /* Base address of video memory */
139 unsigned long v_rowBytes; /* Number of bytes per pixel row */
140 unsigned long v_width; /* Width */
141 unsigned long v_height; /* Height */
142 unsigned long v_depth; /* Pixel Depth */
143 unsigned long v_display; /* Text or Graphics */
144 char v_pixelFormat[64];
145 long v_resv[ 4 ];
146 };
147
148 typedef struct PE_Video PE_Video;
149
150 extern int PE_current_console(
151 PE_Video *info);
152
153 extern void PE_create_console(
154 void);
155
156 extern int PE_initialize_console(
157 PE_Video *newInfo,
158 int op);
159
160 #define kPEGraphicsMode 1
161 #define kPETextMode 2
162 #define kPETextScreen 3
163 #define kPEAcquireScreen 4
164 #define kPEReleaseScreen 5
165 #define kPEEnableScreen 6
166 #define kPEDisableScreen 7
167
168 extern void PE_display_icon( unsigned int flags,
169 const char * name );
170
171 typedef struct PE_state {
172 boolean_t initialized;
173 PE_Video video;
174 void *deviceTreeHead;
175 void *bootArgs;
176 #if __i386__
177 void *fakePPCBootArgs;
178 #endif
179 } PE_state_t;
180
181 extern PE_state_t PE_state;
182
183 extern char * PE_boot_args(
184 void);
185
186 extern boolean_t PE_parse_boot_arg(
187 char *arg_string,
188 void *arg_ptr);
189
190 enum {
191 kPEOptionKey = 0x3a,
192 kPECommandKey = 0x37,
193 kPEControlKey = 0x36,
194 kPEShiftKey = 0x38
195 };
196
197 extern boolean_t PE_get_hotkey(
198 unsigned char key);
199
200 extern kern_return_t PE_cpu_start(
201 cpu_id_t target,
202 vm_offset_t start_paddr,
203 vm_offset_t arg_paddr);
204
205 extern void PE_cpu_halt(
206 cpu_id_t target);
207
208 extern void PE_cpu_signal(
209 cpu_id_t source,
210 cpu_id_t target);
211
212 extern void PE_cpu_machine_init(
213 cpu_id_t target,
214 boolean_t boot);
215
216 extern void PE_cpu_machine_quiesce(
217 cpu_id_t target);
218
219 extern void pe_init_debug(void);
220
221 __END_DECLS
222
223 #endif /* _PEXPERT_PEXPERT_H_ */