]>
git.saurik.com Git - apple/xnu.git/blob - osfmk/i386/AT386/model_dep.c
2 * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
4 * @APPLE_LICENSE_HEADER_START@
6 * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved.
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
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
17 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
18 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
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.
23 * @APPLE_LICENSE_HEADER_END@
29 * Mach Operating System
30 * Copyright (c) 1991,1990,1989, 1988 Carnegie Mellon University
31 * All Rights Reserved.
33 * Permission to use, copy, modify and distribute this software and its
34 * documentation is hereby granted, provided that both the copyright
35 * notice and this permission notice appear in all copies of the
36 * software, derivative works or modified versions, and any portions
37 * thereof, and that both notices appear in supporting documentation.
39 * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
40 * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
41 * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
43 * Carnegie Mellon requests users of this software to return to
45 * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
46 * School of Computer Science
47 * Carnegie Mellon University
48 * Pittsburgh PA 15213-3890
50 * any improvements or extensions that they make and grant Carnegie Mellon
51 * the rights to redistribute these changes.
59 * Author: Avadis Tevanian, Jr., Michael Wayne Young
61 * Copyright (C) 1986, Avadis Tevanian, Jr., Michael Wayne Young
63 * Basic initialization for I386 - ISA bus machines.
67 #include <platforms.h>
70 #include <fast_idle.h>
72 #include <mach/i386/vm_param.h>
75 #include <mach/vm_param.h>
76 #include <mach/vm_prot.h>
77 #include <mach/machine.h>
78 #include <mach/time_value.h>
80 #include <kern/assert.h>
81 #include <kern/debug.h>
82 #include <kern/misc_protos.h>
83 #include <kern/startup.h>
84 #include <kern/clock.h>
85 #include <kern/time_out.h>
86 #include <kern/cpu_data.h>
90 #include <i386/misc_protos.h>
91 #include <i386/rtclock_entries.h>
93 #include <pexpert/i386/boot.h>
95 #include <ddb/db_aout.h>
99 #include <i386/mp_desc.h>
104 #endif /* NCPUS > 1 */
106 #include <IOKit/IOPlatformExpert.h>
108 static void machine_conf(void);
109 #include <i386/cpuid.h>
117 if( PE_get_hotkey( kPEControlKey
))
118 halt_in_debugger
= halt_in_debugger
? 0 : 1;
121 if (PE_parse_boot_arg("debug", &boot_arg
)) {
122 if (boot_arg
& DB_HALT
) halt_in_debugger
=1;
123 if (boot_arg
& DB_PRT
) disableDebugOuput
=FALSE
;
124 if (boot_arg
& DB_SLOG
) systemLogDiags
=TRUE
;
125 if (boot_arg
& DB_NMI
) panicDebugging
=TRUE
;
126 if (boot_arg
& DB_LOG_PI_SCRN
) logPanicDataToScreen
=TRUE
;
130 hw_lock_init(&debugger_lock
); /* initialize debugger lock */
131 hw_lock_init(&pbtlock
); /* initialize print backtrace lock */
138 #if DB_MACHINE_COMMANDS
139 db_machine_commands_install(ppc_db_commands
);
140 #endif /* DB_MACHINE_COMMANDS */
143 if (boot_arg
& DB_KDB
)
144 current_debugger
= KDB_CUR_DB
;
147 * Cause a breakpoint trap to the debugger before proceeding
148 * any further if the proper option bit was specified in
151 if (halt_in_debugger
&& (current_debugger
== KDB_CUR_DB
)) {
152 Debugger("inline call to debugger(machine_startup)");
153 halt_in_debugger
= 0;
156 #endif /* MACH_KDB */
158 if (PE_parse_boot_arg("preempt", &boot_arg
)) {
159 extern int default_preemption_rate
;
161 default_preemption_rate
= boot_arg
;
163 if (PE_parse_boot_arg("unsafe", &boot_arg
)) {
164 extern int max_unsafe_quanta
;
166 max_unsafe_quanta
= boot_arg
;
168 if (PE_parse_boot_arg("poll", &boot_arg
)) {
169 extern int max_poll_quanta
;
171 max_poll_quanta
= boot_arg
;
173 if (PE_parse_boot_arg("yield", &boot_arg
)) {
174 extern int sched_poll_yield_shift
;
176 sched_poll_yield_shift
= boot_arg
;
182 ml_thrm_init(); /* Start thermal monitoring on this processor */
190 /* Should never return */
197 machine_info
.max_cpus
= NCPUS
;
198 machine_info
.avail_cpus
= 1;
199 machine_info
.memory_size
= mem_size
;
203 * Find devices. The system is alive.
213 * Display CPU identification
215 cpuid_cpu_display("CPU identification", 0);
216 cpuid_feature_display("CPU features", 0);
224 * Set up to use floating point.
229 * Configure clock devices.
240 halt_all_cpus(FALSE
);
243 int reset_mem_on_reboot
= 1;
246 * Halt the system or reboot.
249 halt_all_cpus(boolean_t reboot
)
253 * Tell the BIOS not to clear and test memory.
255 if (!reset_mem_on_reboot
)
256 *(unsigned short *)phystokv(0x472) = 0x1234;
258 printf("MACH Reboot\n");
259 PEHaltRestart( kPERestartCPU
);
261 printf("CPU halted\n");
262 PEHaltRestart( kPEHaltCPU
);
268 void fc_get(mach_timespec_t
*ts
);
269 #include <kern/clock.h>
270 #include <i386/rtclock_entries.h>
271 extern kern_return_t
sysclk_gettime(
272 mach_timespec_t
*cur_time
);
273 void fc_get(mach_timespec_t
*ts
) {
274 (void )sysclk_gettime(ts
);
281 printf("Debugger called: <%s>\n", message
);
289 display_syscall(int syscall
)
291 printf("System call happened %d\n", syscall
);
294 #if XPR_DEBUG && (NCPUS == 1)
296 extern kern_return_t
sysclk_gettime_interrupts_disabled(
297 mach_timespec_t
*cur_time
);
301 mach_timespec_t time
;
303 sysclk_gettime_interrupts_disabled(&time
);
304 return(time
.tv_sec
*1000000 + time
.tv_nsec
/1000);
306 #endif /* XPR_DEBUG && (NCPUS == 1) */
316 machine_boot_info(char *buf
, vm_size_t size
)