2 * Copyright (c) 2000-2006 Apple Computer, Inc. All rights reserved.
4 * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. The rights granted to you under the License
10 * may not be used to create, or enable the creation or redistribution of,
11 * unlawful or unlicensed copies of an Apple operating system, or to
12 * circumvent, violate, or enable the circumvention or violation of, any
13 * terms of an Apple operating system software license agreement.
15 * Please obtain a copy of the License at
16 * http://www.opensource.apple.com/apsl/ and read it before using this file.
18 * The Original Code and all software distributed under the License are
19 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
20 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
21 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
22 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
23 * Please see the License for the specific language governing rights and
24 * limitations under the License.
26 * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
28 #ifndef _PEXPERT_PEXPERT_H_
29 #define _PEXPERT_PEXPERT_H_
31 #include <sys/cdefs.h>
33 #include <IOKit/IOInterrupts.h>
34 #include <kern/kern_types.h>
37 #include <mach/boolean.h>
38 #include <mach/kern_return.h>
39 #include <mach/machine/vm_types.h>
41 #ifdef PEXPERT_KERNEL_PRIVATE
42 #include <pexpert/protos.h>
44 #include <pexpert/boot.h>
46 #if defined(PEXPERT_KERNEL_PRIVATE) || defined(IOKIT_KERNEL_PRIVATE)
47 typedef void *cpu_id_t
;
49 typedef void *cpu_id_t
;
53 void PE_enter_debugger(
56 void PE_init_platform(
57 boolean_t vm_initialized
,
64 boolean_t vm_initialized
);
66 extern int32_t gPESerialBaud
;
68 unsigned int PE_init_taproot(vm_offset_t
*taddr
);
70 extern void (*PE_kputc
)(char c
);
73 boolean_t vm_initialized
);
75 extern void (*PE_putc
)(char c
);
80 struct clock_frequency_info_t
{
81 unsigned long bus_clock_rate_hz
;
82 unsigned long cpu_clock_rate_hz
;
83 unsigned long dec_clock_rate_hz
;
84 unsigned long bus_clock_rate_num
;
85 unsigned long bus_clock_rate_den
;
86 unsigned long bus_to_cpu_rate_num
;
87 unsigned long bus_to_cpu_rate_den
;
88 unsigned long bus_to_dec_rate_num
;
89 unsigned long bus_to_dec_rate_den
;
90 unsigned long timebase_frequency_hz
;
91 unsigned long timebase_frequency_num
;
92 unsigned long timebase_frequency_den
;
93 unsigned long long bus_frequency_hz
;
94 unsigned long long bus_frequency_min_hz
;
95 unsigned long long bus_frequency_max_hz
;
96 unsigned long long cpu_frequency_hz
;
97 unsigned long long cpu_frequency_min_hz
;
98 unsigned long long cpu_frequency_max_hz
;
99 unsigned long long prf_frequency_hz
;
100 unsigned long long prf_frequency_min_hz
;
101 unsigned long long prf_frequency_max_hz
;
102 unsigned long long mem_frequency_hz
;
103 unsigned long long mem_frequency_min_hz
;
104 unsigned long long mem_frequency_max_hz
;
105 unsigned long long fix_frequency_hz
;
108 typedef struct clock_frequency_info_t clock_frequency_info_t
;
110 extern clock_frequency_info_t gPEClockFrequencyInfo
;
112 struct timebase_freq_t
{
113 unsigned long timebase_num
;
114 unsigned long timebase_den
;
117 typedef void (*timebase_callback_func
)(struct timebase_freq_t
*timebase_freq
);
119 void PE_register_timebase_callback(timebase_callback_func callback
);
121 void PE_call_timebase_callback(void);
123 void PE_install_interrupt_handler(
124 void *nub
, int source
,
125 void *target
, IOInterruptHandler handler
, void *refCon
);
129 void kprintf(const char *fmt
, ...) __printflike(1,2);
132 #if CONFIG_NO_KPRINTF_STRINGS
133 #define kprintf(x, ...) do {} while (0)
136 void init_display_putc(unsigned char *baseaddr
, int rowbytes
, int height
);
137 void display_putc(char c
);
143 extern int (*PE_read_write_time_of_day
)(
144 unsigned int options
,
148 kPEWaitForInput
= 0x00000001,
149 kPERawInput
= 0x00000002
151 extern int (*PE_poll_input
)(
152 unsigned int options
,
155 extern int (*PE_write_IIC
)(
160 /* Private Stuff - eventually put in pexpertprivate.h */
163 kDebugTypeDisplay
= 1,
168 unsigned long v_baseAddr
; /* Base address of video memory */
169 unsigned long v_rowBytes
; /* Number of bytes per pixel row */
170 unsigned long v_width
; /* Width */
171 unsigned long v_height
; /* Height */
172 unsigned long v_depth
; /* Pixel Depth */
173 unsigned long v_display
; /* Text or Graphics */
174 char v_pixelFormat
[64];
175 unsigned long v_offset
; /* offset into video memory to start at */
176 unsigned long v_length
; /* length of video memory (0 for v_rowBytes * v_height) */
180 typedef struct PE_Video PE_Video
;
182 extern void initialize_screen(PE_Video
*, unsigned int);
184 extern int PE_current_console(
187 extern void PE_create_console(
190 extern int PE_initialize_console(
194 #define kPEGraphicsMode 1
195 #define kPETextMode 2
196 #define kPETextScreen 3
197 #define kPEAcquireScreen 4
198 #define kPEReleaseScreen 5
199 #define kPEEnableScreen 6
200 #define kPEDisableScreen 7
202 extern void PE_display_icon( unsigned int flags
,
205 typedef struct PE_state
{
206 boolean_t initialized
;
208 void *deviceTreeHead
;
210 #if defined(i386) || defined(arm)
211 void *fakePPCBootArgs
;
215 extern PE_state_t PE_state
;
217 extern char * PE_boot_args(
220 extern boolean_t
PE_parse_boot_arg(
221 const char *arg_string
,
224 extern boolean_t
PE_parse_boot_argn(
225 const char *arg_string
,
231 kPECommandKey
= 0x37,
232 kPEControlKey
= 0x36,
236 extern boolean_t
PE_get_hotkey(
239 extern kern_return_t
PE_cpu_start(
241 vm_offset_t start_paddr
,
242 vm_offset_t arg_paddr
);
244 extern void PE_cpu_halt(
247 extern void PE_cpu_signal(
251 extern void PE_cpu_machine_init(
255 extern void PE_cpu_machine_quiesce(
258 extern void pe_init_debug(void);
263 #endif /* _PEXPERT_PEXPERT_H_ */