]>
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.
64 #include <platforms.h>
67 #include <fast_idle.h>
69 #include <mach/i386/vm_param.h>
72 #include <mach/vm_param.h>
73 #include <mach/vm_prot.h>
74 #include <mach/machine.h>
75 #include <mach/time_value.h>
77 #include <kern/assert.h>
78 #include <kern/debug.h>
79 #include <kern/misc_protos.h>
80 #include <kern/startup.h>
81 #include <kern/clock.h>
82 #include <kern/time_out.h>
83 #include <kern/cpu_data.h>
87 #include <i386/misc_protos.h>
88 #include <i386/rtclock_entries.h>
90 #include <pexpert/i386/boot.h>
92 #include <ddb/db_aout.h>
96 #include <i386/mp_desc.h>
101 #endif /* NCPUS > 1 */
103 #include <IOKit/IOPlatformExpert.h>
105 static void machine_conf(void);
106 #include <i386/cpuid.h>
114 if( PE_get_hotkey( kPEControlKey
))
115 halt_in_debugger
= halt_in_debugger
? 0 : 1;
118 if (PE_parse_boot_arg("debug", &boot_arg
)) {
119 if (boot_arg
& DB_HALT
) halt_in_debugger
=1;
120 if (boot_arg
& DB_PRT
) disableDebugOuput
=FALSE
;
121 if (boot_arg
& DB_SLOG
) systemLogDiags
=TRUE
;
122 if (boot_arg
& DB_NMI
) panicDebugging
=TRUE
;
123 if (boot_arg
& DB_LOG_PI_SCRN
) logPanicDataToScreen
=TRUE
;
127 hw_lock_init(&debugger_lock
); /* initialize debugger lock */
128 hw_lock_init(&pbtlock
); /* initialize print backtrace lock */
135 #if DB_MACHINE_COMMANDS
136 db_machine_commands_install(ppc_db_commands
);
137 #endif /* DB_MACHINE_COMMANDS */
140 if (boot_arg
& DB_KDB
)
141 current_debugger
= KDB_CUR_DB
;
144 * Cause a breakpoint trap to the debugger before proceeding
145 * any further if the proper option bit was specified in
148 if (halt_in_debugger
&& (current_debugger
== KDB_CUR_DB
)) {
149 Debugger("inline call to debugger(machine_startup)");
150 halt_in_debugger
= 0;
153 #endif /* MACH_KDB */
155 if (PE_parse_boot_arg("preempt", &boot_arg
)) {
156 extern int default_preemption_rate
;
158 default_preemption_rate
= boot_arg
;
160 if (PE_parse_boot_arg("unsafe", &boot_arg
)) {
161 extern int max_unsafe_quanta
;
163 max_unsafe_quanta
= boot_arg
;
165 if (PE_parse_boot_arg("poll", &boot_arg
)) {
166 extern int max_poll_quanta
;
168 max_poll_quanta
= boot_arg
;
170 if (PE_parse_boot_arg("yield", &boot_arg
)) {
171 extern int sched_poll_yield_shift
;
173 sched_poll_yield_shift
= boot_arg
;
179 ml_thrm_init(); /* Start thermal monitoring on this processor */
187 /* Should never return */
194 machine_info
.max_cpus
= NCPUS
;
195 machine_info
.avail_cpus
= 1;
196 machine_info
.memory_size
= mem_size
;
200 * Find devices. The system is alive.
210 * Display CPU identification
212 cpuid_cpu_display("CPU identification", 0);
213 cpuid_feature_display("CPU features", 0);
221 * Set up to use floating point.
226 * Configure clock devices.
237 halt_all_cpus(FALSE
);
240 int reset_mem_on_reboot
= 1;
243 * Halt the system or reboot.
246 halt_all_cpus(boolean_t reboot
)
250 * Tell the BIOS not to clear and test memory.
252 if (!reset_mem_on_reboot
)
253 *(unsigned short *)phystokv(0x472) = 0x1234;
255 printf("MACH Reboot\n");
256 PEHaltRestart( kPERestartCPU
);
258 printf("CPU halted\n");
259 PEHaltRestart( kPEHaltCPU
);
265 void fc_get(mach_timespec_t
*ts
);
266 #include <kern/clock.h>
267 #include <i386/rtclock_entries.h>
268 extern kern_return_t
sysclk_gettime(
269 mach_timespec_t
*cur_time
);
270 void fc_get(mach_timespec_t
*ts
) {
271 (void )sysclk_gettime(ts
);
278 printf("Debugger called: <%s>\n", message
);
286 display_syscall(int syscall
)
288 printf("System call happened %d\n", syscall
);
291 #if XPR_DEBUG && (NCPUS == 1)
293 extern kern_return_t
sysclk_gettime_interrupts_disabled(
294 mach_timespec_t
*cur_time
);
298 mach_timespec_t time
;
300 sysclk_gettime_interrupts_disabled(&time
);
301 return(time
.tv_sec
*1000000 + time
.tv_nsec
/1000);
303 #endif /* XPR_DEBUG && (NCPUS == 1) */
313 machine_boot_info(char *buf
, vm_size_t size
)