]>
git.saurik.com Git - apple/xnu.git/blob - osfmk/i386/AT386/model_dep.c
b90ed07364b281ee59e593d67e98bf7b0b5608ab
2 * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
4 * @APPLE_LICENSE_OSREFERENCE_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
10 * License may not be used to create, or enable the creation or
11 * redistribution of, unlawful or unlicensed copies of an Apple operating
12 * system, or to circumvent, violate, or enable the circumvention or
13 * violation of, any terms of an Apple operating system software license
16 * Please obtain a copy of the License at
17 * http://www.opensource.apple.com/apsl/ and read it before using this
20 * The Original Code and all software distributed under the License are
21 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
22 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
23 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
24 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
25 * Please see the License for the specific language governing rights and
26 * limitations under the License.
28 * @APPLE_LICENSE_OSREFERENCE_HEADER_END@
34 * Mach Operating System
35 * Copyright (c) 1991,1990,1989, 1988 Carnegie Mellon University
36 * All Rights Reserved.
38 * Permission to use, copy, modify and distribute this software and its
39 * documentation is hereby granted, provided that both the copyright
40 * notice and this permission notice appear in all copies of the
41 * software, derivative works or modified versions, and any portions
42 * thereof, and that both notices appear in supporting documentation.
44 * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
45 * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
46 * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
48 * Carnegie Mellon requests users of this software to return to
50 * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
51 * School of Computer Science
52 * Carnegie Mellon University
53 * Pittsburgh PA 15213-3890
55 * any improvements or extensions that they make and grant Carnegie Mellon
56 * the rights to redistribute these changes.
64 * Author: Avadis Tevanian, Jr., Michael Wayne Young
66 * Copyright (C) 1986, Avadis Tevanian, Jr., Michael Wayne Young
68 * Basic initialization for I386 - ISA bus machines.
71 #include <platforms.h>
75 #include <mach/i386/vm_param.h>
78 #include <mach/vm_param.h>
79 #include <mach/vm_prot.h>
80 #include <mach/machine.h>
81 #include <mach/time_value.h>
83 #include <kern/assert.h>
84 #include <kern/debug.h>
85 #include <kern/misc_protos.h>
86 #include <kern/startup.h>
87 #include <kern/clock.h>
88 #include <kern/cpu_data.h>
89 #include <kern/machine.h>
93 #include <i386/misc_protos.h>
95 #include <i386/mtrr.h>
96 #include <i386/postcode.h>
97 #include <pexpert/i386/boot.h>
99 #include <ddb/db_aout.h>
100 #endif /* MACH_KDB */
102 #include <i386/mp_desc.h>
105 #include <IOKit/IOPlatformExpert.h>
107 void enable_bluebox(void);
108 void disable_bluebox(void);
110 static void machine_conf(void);
111 #include <i386/cpuid.h>
113 extern int default_preemption_rate
;
114 extern int max_unsafe_quanta
;
115 extern int max_poll_quanta
;
117 extern unsigned int panic_is_inited
;
125 if( PE_get_hotkey( kPEControlKey
))
126 halt_in_debugger
= halt_in_debugger
? 0 : 1;
129 if (PE_parse_boot_arg("debug", &boot_arg
)) {
130 if (boot_arg
& DB_HALT
) halt_in_debugger
=1;
131 if (boot_arg
& DB_PRT
) disableDebugOuput
=FALSE
;
132 if (boot_arg
& DB_SLOG
) systemLogDiags
=TRUE
;
133 if (boot_arg
& DB_NMI
) panicDebugging
=TRUE
;
134 if (boot_arg
& DB_LOG_PI_SCRN
) logPanicDataToScreen
=TRUE
;
138 hw_lock_init(&debugger_lock
); /* initialize debugger lock */
139 hw_lock_init(&pbtlock
); /* initialize print backtrace lock */
146 #if DB_MACHINE_COMMANDS
147 db_machine_commands_install(ppc_db_commands
);
148 #endif /* DB_MACHINE_COMMANDS */
151 if (boot_arg
& DB_KDB
)
152 current_debugger
= KDB_CUR_DB
;
155 * Cause a breakpoint trap to the debugger before proceeding
156 * any further if the proper option bit was specified in
159 if (halt_in_debugger
&& (current_debugger
== KDB_CUR_DB
)) {
160 Debugger("inline call to debugger(machine_startup)");
161 halt_in_debugger
= 0;
164 #endif /* MACH_KDB */
166 if (PE_parse_boot_arg("preempt", &boot_arg
)) {
167 default_preemption_rate
= boot_arg
;
169 if (PE_parse_boot_arg("unsafe", &boot_arg
)) {
170 max_unsafe_quanta
= boot_arg
;
172 if (PE_parse_boot_arg("poll", &boot_arg
)) {
173 max_poll_quanta
= boot_arg
;
175 if (PE_parse_boot_arg("yield", &boot_arg
)) {
176 sched_poll_yield_shift
= boot_arg
;
178 if (PE_parse_boot_arg("idlehalt", &boot_arg
)) {
185 ml_thrm_init(); /* Start thermal monitoring on this processor */
199 machine_info
.memory_size
= mem_size
;
203 * Find devices. The system is alive.
209 * Display CPU identification
211 cpuid_cpu_display("CPU identification", 0);
212 cpuid_feature_display("CPU features", 0);
218 * Set up to use floating point.
223 * Configure clock devices.
228 * Initialize MTRR from boot processor.
233 * Set up PAT for boot processor.
249 halt_all_cpus(FALSE
);
252 int reset_mem_on_reboot
= 1;
255 * Halt the system or reboot.
258 halt_all_cpus(boolean_t reboot
)
262 * Tell the BIOS not to clear and test memory.
264 #if 0 /* XXX fixme */
265 if (!reset_mem_on_reboot
)
266 *(unsigned short *)phystokv(0x472) = 0x1234;
269 printf("MACH Reboot\n");
270 PEHaltRestart( kPERestartCPU
);
272 printf("CPU halted\n");
273 PEHaltRestart( kPEHaltCPU
);
279 void fc_get(mach_timespec_t
*ts
);
280 #include <kern/clock.h>
281 extern kern_return_t
sysclk_gettime(
282 mach_timespec_t
*cur_time
);
283 void fc_get(mach_timespec_t
*ts
) {
284 (void )sysclk_gettime(ts
);
292 if (!panic_is_inited
) {
297 printf("Debugger called: <%s>\n", message
);
298 kprintf("Debugger called: <%s>\n", message
);
310 disable_bluebox(void)
315 machine_boot_info(char *buf
, __unused vm_size_t size
)