]> git.saurik.com Git - apple/xnu.git/blob - pexpert/pexpert/pexpert.h
xnu-344.12.2.tar.gz
[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 };
78
79 typedef struct clock_frequency_info_t clock_frequency_info_t;
80
81 extern clock_frequency_info_t gPEClockFrequencyInfo;
82
83 struct timebase_freq_t {
84 unsigned long timebase_num;
85 unsigned long timebase_den;
86 };
87
88 typedef void (*timebase_callback_func)(struct timebase_freq_t *timebase_freq);
89
90 void PE_register_timebase_callback(timebase_callback_func callback);
91
92 void PE_call_timebase_callback(void);
93
94 void PE_install_interrupt_handler(
95 void *nub, int source,
96 void *target, IOInterruptHandler handler, void *refCon);
97
98 void kprintf(
99 const char *fmt, ...);
100
101 void init_display_putc(unsigned char *baseaddr, int rowbytes, int height);
102 void display_putc(char c);
103
104 boolean_t PE_init_ethernet_debugger( void );
105
106 enum {
107 kPEReadTOD,
108 kPEWriteTOD
109 };
110 extern int (*PE_read_write_time_of_day)(
111 unsigned int options,
112 long * secs);
113
114 enum {
115 kPEWaitForInput = 0x00000001,
116 kPERawInput = 0x00000002
117 };
118 extern int (*PE_poll_input)(
119 unsigned int options,
120 char * c);
121
122 extern int (*PE_write_IIC)(
123 unsigned char addr,
124 unsigned char reg,
125 unsigned char data);
126
127 /* Private Stuff - eventually put in pexpertprivate.h */
128 enum {
129 kDebugTypeNone = 0,
130 kDebugTypeDisplay = 1,
131 kDebugTypeSerial = 2
132 };
133
134 struct PE_Video {
135 unsigned long v_baseAddr; /* Base address of video memory */
136 unsigned long v_rowBytes; /* Number of bytes per pixel row */
137 unsigned long v_width; /* Width */
138 unsigned long v_height; /* Height */
139 unsigned long v_depth; /* Pixel Depth */
140 unsigned long v_display; /* Text or Graphics */
141 char v_pixelFormat[64];
142 long v_resv[ 4 ];
143 };
144
145 typedef struct PE_Video PE_Video;
146
147 extern int PE_current_console(
148 PE_Video *info);
149
150 extern void PE_create_console(
151 void);
152
153 extern int PE_initialize_console(
154 PE_Video *newInfo,
155 int op);
156
157 #define kPEGraphicsMode 1
158 #define kPETextMode 2
159 #define kPETextScreen 3
160 #define kPEAcquireScreen 4
161 #define kPEReleaseScreen 5
162 #define kPEEnableScreen 6
163 #define kPEDisableScreen 7
164
165 extern void PE_display_icon( unsigned int flags,
166 const char * name );
167
168 typedef struct PE_state {
169 boolean_t initialized;
170 PE_Video video;
171 void *deviceTreeHead;
172 void *bootArgs;
173 #if __i386__
174 void *fakePPCBootArgs;
175 #endif
176 } PE_state_t;
177
178 extern PE_state_t PE_state;
179
180 extern char * PE_boot_args(
181 void);
182
183 extern boolean_t PE_parse_boot_arg(
184 char *arg_string,
185 void *arg_ptr);
186
187 enum {
188 kPEOptionKey = 0x3a,
189 kPECommandKey = 0x37,
190 kPEControlKey = 0x36,
191 kPEShiftKey = 0x38
192 };
193
194 extern boolean_t PE_get_hotkey(
195 unsigned char key);
196
197 extern kern_return_t PE_cpu_start(
198 cpu_id_t target,
199 vm_offset_t start_paddr,
200 vm_offset_t arg_paddr);
201
202 extern void PE_cpu_halt(
203 cpu_id_t target);
204
205 extern void PE_cpu_signal(
206 cpu_id_t source,
207 cpu_id_t target);
208
209 extern void PE_cpu_machine_init(
210 cpu_id_t target,
211 boolean_t boot);
212
213 extern void PE_cpu_machine_quiesce(
214 cpu_id_t target);
215
216 extern void pe_init_debug(void);
217
218 __END_DECLS
219
220 #endif /* _PEXPERT_PEXPERT_H_ */