]>
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 * 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.
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
20 * @APPLE_LICENSE_HEADER_END@
26 * Mach Operating System
27 * Copyright (c) 1991,1990,1989, 1988 Carnegie Mellon University
28 * All Rights Reserved.
30 * Permission to use, copy, modify and distribute this software and its
31 * documentation is hereby granted, provided that both the copyright
32 * notice and this permission notice appear in all copies of the
33 * software, derivative works or modified versions, and any portions
34 * thereof, and that both notices appear in supporting documentation.
36 * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
37 * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
38 * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
40 * Carnegie Mellon requests users of this software to return to
42 * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
43 * School of Computer Science
44 * Carnegie Mellon University
45 * Pittsburgh PA 15213-3890
47 * any improvements or extensions that they make and grant Carnegie Mellon
48 * the rights to redistribute these changes.
56 * Author: Avadis Tevanian, Jr., Michael Wayne Young
58 * Copyright (C) 1986, Avadis Tevanian, Jr., Michael Wayne Young
60 * Basic initialization for I386 - ISA bus machines.
63 #include <platforms.h>
67 #include <mach/i386/vm_param.h>
70 #include <mach/vm_param.h>
71 #include <mach/vm_prot.h>
72 #include <mach/machine.h>
73 #include <mach/time_value.h>
75 #include <kern/assert.h>
76 #include <kern/debug.h>
77 #include <kern/misc_protos.h>
78 #include <kern/startup.h>
79 #include <kern/clock.h>
80 #include <kern/cpu_data.h>
81 #include <kern/machine.h>
85 #include <i386/misc_protos.h>
87 #include <i386/mtrr.h>
88 #include <i386/postcode.h>
89 #include <pexpert/i386/boot.h>
91 #include <ddb/db_aout.h>
94 #include <i386/mp_desc.h>
97 #include <IOKit/IOPlatformExpert.h>
99 void enable_bluebox(void);
100 void disable_bluebox(void);
102 static void machine_conf(void);
103 #include <i386/cpuid.h>
105 extern int default_preemption_rate
;
106 extern int max_unsafe_quanta
;
107 extern int max_poll_quanta
;
109 extern unsigned int panic_is_inited
;
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 default_preemption_rate
= boot_arg
;
161 if (PE_parse_boot_arg("unsafe", &boot_arg
)) {
162 max_unsafe_quanta
= boot_arg
;
164 if (PE_parse_boot_arg("poll", &boot_arg
)) {
165 max_poll_quanta
= boot_arg
;
167 if (PE_parse_boot_arg("yield", &boot_arg
)) {
168 sched_poll_yield_shift
= boot_arg
;
170 if (PE_parse_boot_arg("idlehalt", &boot_arg
)) {
177 ml_thrm_init(); /* Start thermal monitoring on this processor */
191 machine_info
.memory_size
= mem_size
;
195 * Find devices. The system is alive.
201 * Display CPU identification
203 cpuid_cpu_display("CPU identification", 0);
204 cpuid_feature_display("CPU features", 0);
210 * Set up to use floating point.
215 * Configure clock devices.
220 * Initialize MTRR from boot processor.
225 * Set up PAT for boot processor.
241 halt_all_cpus(FALSE
);
244 int reset_mem_on_reboot
= 1;
247 * Halt the system or reboot.
250 halt_all_cpus(boolean_t reboot
)
254 * Tell the BIOS not to clear and test memory.
256 #if 0 /* XXX fixme */
257 if (!reset_mem_on_reboot
)
258 *(unsigned short *)phystokv(0x472) = 0x1234;
261 printf("MACH Reboot\n");
262 PEHaltRestart( kPERestartCPU
);
264 printf("CPU halted\n");
265 PEHaltRestart( kPEHaltCPU
);
271 void fc_get(mach_timespec_t
*ts
);
272 #include <kern/clock.h>
273 extern kern_return_t
sysclk_gettime(
274 mach_timespec_t
*cur_time
);
275 void fc_get(mach_timespec_t
*ts
) {
276 (void )sysclk_gettime(ts
);
284 if (!panic_is_inited
) {
289 printf("Debugger called: <%s>\n", message
);
290 kprintf("Debugger called: <%s>\n", message
);
302 disable_bluebox(void)
307 machine_boot_info(char *buf
, __unused vm_size_t size
)