]>
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_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@
32 * Mach Operating System
33 * Copyright (c) 1991,1990,1989, 1988 Carnegie Mellon University
34 * All Rights Reserved.
36 * Permission to use, copy, modify and distribute this software and its
37 * documentation is hereby granted, provided that both the copyright
38 * notice and this permission notice appear in all copies of the
39 * software, derivative works or modified versions, and any portions
40 * thereof, and that both notices appear in supporting documentation.
42 * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
43 * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
44 * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
46 * Carnegie Mellon requests users of this software to return to
48 * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
49 * School of Computer Science
50 * Carnegie Mellon University
51 * Pittsburgh PA 15213-3890
53 * any improvements or extensions that they make and grant Carnegie Mellon
54 * the rights to redistribute these changes.
62 * Author: Avadis Tevanian, Jr., Michael Wayne Young
64 * Copyright (C) 1986, Avadis Tevanian, Jr., Michael Wayne Young
66 * Basic initialization for I386 - ISA bus machines.
69 #include <platforms.h>
73 #include <mach/i386/vm_param.h>
76 #include <mach/vm_param.h>
77 #include <mach/vm_prot.h>
78 #include <mach/machine.h>
79 #include <mach/time_value.h>
81 #include <kern/assert.h>
82 #include <kern/debug.h>
83 #include <kern/misc_protos.h>
84 #include <kern/startup.h>
85 #include <kern/clock.h>
86 #include <kern/cpu_data.h>
87 #include <kern/machine.h>
91 #include <i386/misc_protos.h>
93 #include <i386/mtrr.h>
94 #include <i386/postcode.h>
95 #include <pexpert/i386/boot.h>
97 #include <ddb/db_aout.h>
100 #include <i386/mp_desc.h>
103 #include <IOKit/IOPlatformExpert.h>
105 void enable_bluebox(void);
106 void disable_bluebox(void);
108 static void machine_conf(void);
109 #include <i386/cpuid.h>
111 extern int default_preemption_rate
;
112 extern int max_unsafe_quanta
;
113 extern int max_poll_quanta
;
115 extern unsigned int panic_is_inited
;
123 if( PE_get_hotkey( kPEControlKey
))
124 halt_in_debugger
= halt_in_debugger
? 0 : 1;
127 if (PE_parse_boot_arg("debug", &boot_arg
)) {
128 if (boot_arg
& DB_HALT
) halt_in_debugger
=1;
129 if (boot_arg
& DB_PRT
) disableDebugOuput
=FALSE
;
130 if (boot_arg
& DB_SLOG
) systemLogDiags
=TRUE
;
131 if (boot_arg
& DB_NMI
) panicDebugging
=TRUE
;
132 if (boot_arg
& DB_LOG_PI_SCRN
) logPanicDataToScreen
=TRUE
;
136 hw_lock_init(&debugger_lock
); /* initialize debugger lock */
137 hw_lock_init(&pbtlock
); /* initialize print backtrace lock */
144 #if DB_MACHINE_COMMANDS
145 db_machine_commands_install(ppc_db_commands
);
146 #endif /* DB_MACHINE_COMMANDS */
149 if (boot_arg
& DB_KDB
)
150 current_debugger
= KDB_CUR_DB
;
153 * Cause a breakpoint trap to the debugger before proceeding
154 * any further if the proper option bit was specified in
157 if (halt_in_debugger
&& (current_debugger
== KDB_CUR_DB
)) {
158 Debugger("inline call to debugger(machine_startup)");
159 halt_in_debugger
= 0;
162 #endif /* MACH_KDB */
164 if (PE_parse_boot_arg("preempt", &boot_arg
)) {
165 default_preemption_rate
= boot_arg
;
167 if (PE_parse_boot_arg("unsafe", &boot_arg
)) {
168 max_unsafe_quanta
= boot_arg
;
170 if (PE_parse_boot_arg("poll", &boot_arg
)) {
171 max_poll_quanta
= boot_arg
;
173 if (PE_parse_boot_arg("yield", &boot_arg
)) {
174 sched_poll_yield_shift
= boot_arg
;
176 if (PE_parse_boot_arg("idlehalt", &boot_arg
)) {
183 ml_thrm_init(); /* Start thermal monitoring on this processor */
197 machine_info
.memory_size
= mem_size
;
201 * Find devices. The system is alive.
207 * Display CPU identification
209 cpuid_cpu_display("CPU identification", 0);
210 cpuid_feature_display("CPU features", 0);
216 * Set up to use floating point.
221 * Configure clock devices.
226 * Initialize MTRR from boot processor.
231 * Set up PAT for boot processor.
247 halt_all_cpus(FALSE
);
250 int reset_mem_on_reboot
= 1;
253 * Halt the system or reboot.
256 halt_all_cpus(boolean_t reboot
)
260 * Tell the BIOS not to clear and test memory.
262 #if 0 /* XXX fixme */
263 if (!reset_mem_on_reboot
)
264 *(unsigned short *)phystokv(0x472) = 0x1234;
267 printf("MACH Reboot\n");
268 PEHaltRestart( kPERestartCPU
);
270 printf("CPU halted\n");
271 PEHaltRestart( kPEHaltCPU
);
277 void fc_get(mach_timespec_t
*ts
);
278 #include <kern/clock.h>
279 extern kern_return_t
sysclk_gettime(
280 mach_timespec_t
*cur_time
);
281 void fc_get(mach_timespec_t
*ts
) {
282 (void )sysclk_gettime(ts
);
290 if (!panic_is_inited
) {
295 printf("Debugger called: <%s>\n", message
);
296 kprintf("Debugger called: <%s>\n", message
);
308 disable_bluebox(void)
313 machine_boot_info(char *buf
, __unused vm_size_t size
)