X-Git-Url: https://git.saurik.com/apple/xnu.git/blobdiff_plain/55e303ae13a4cf49d70f2294092726f2fffb9ef2..6601e61aa18bf4f09af135ff61fc7f4771d23b06:/osfmk/i386/AT386/model_dep.c diff --git a/osfmk/i386/AT386/model_dep.c b/osfmk/i386/AT386/model_dep.c index c4c220264..588e59611 100644 --- a/osfmk/i386/AT386/model_dep.c +++ b/osfmk/i386/AT386/model_dep.c @@ -3,22 +3,19 @@ * * @APPLE_LICENSE_HEADER_START@ * - * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved. + * The contents of this file constitute Original Code as defined in and + * are subject to the Apple Public Source License Version 1.1 (the + * "License"). You may not use this file except in compliance with the + * License. Please obtain a copy of the License at + * http://www.apple.com/publicsource and read it before using this file. * - * This file contains Original Code and/or Modifications of Original Code - * as defined in and that are subject to the Apple Public Source License - * Version 2.0 (the 'License'). You may not use this file except in - * compliance with the License. Please obtain a copy of the License at - * http://www.opensource.apple.com/apsl/ and read it before using this - * file. - * - * The Original Code and all software distributed under the License are - * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER + * This Original Code and all software distributed under the License are + * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. - * Please see the License for the specific language governing rights and - * limitations under the License. + * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the + * License for the specific language governing rights and limitations + * under the License. * * @APPLE_LICENSE_HEADER_END@ */ @@ -63,11 +60,9 @@ * Basic initialization for I386 - ISA bus machines. */ -#include #include #include #include -#include #include @@ -82,32 +77,37 @@ #include #include #include -#include #include +#include #include #include #include #include -#include #include +#include +#include #include #if MACH_KDB #include #endif /* MACH_KDB */ -#if NCPUS > 1 #include -#endif /* NCPUS */ - -#if NCPUS > 1 #include -#endif /* NCPUS > 1 */ #include +void enable_bluebox(void); +void disable_bluebox(void); + static void machine_conf(void); #include +extern int default_preemption_rate; +extern int max_unsafe_quanta; +extern int max_poll_quanta; +extern int idlehalt; +extern unsigned int panic_is_inited; + void machine_startup() { @@ -156,25 +156,20 @@ machine_startup() #endif /* MACH_KDB */ if (PE_parse_boot_arg("preempt", &boot_arg)) { - extern int default_preemption_rate; - default_preemption_rate = boot_arg; } if (PE_parse_boot_arg("unsafe", &boot_arg)) { - extern int max_unsafe_quanta; - max_unsafe_quanta = boot_arg; } if (PE_parse_boot_arg("poll", &boot_arg)) { - extern int max_poll_quanta; - max_poll_quanta = boot_arg; } if (PE_parse_boot_arg("yield", &boot_arg)) { - extern int sched_poll_yield_shift; - sched_poll_yield_shift = boot_arg; } + if (PE_parse_boot_arg("idlehalt", &boot_arg)) { + idlehalt = boot_arg; + } machine_conf(); @@ -185,17 +180,14 @@ machine_startup() /* * Start the system. */ - setup_main(); - - /* Should never return */ + kernel_bootstrap(); + /*NOTREACHED*/ } static void machine_conf(void) { - machine_info.max_cpus = NCPUS; - machine_info.avail_cpus = 1; machine_info.memory_size = mem_size; } @@ -205,10 +197,6 @@ machine_conf(void) void machine_init(void) { - int unit; - const char *p; - int n; - /* * Display CPU identification */ @@ -216,9 +204,7 @@ machine_init(void) cpuid_feature_display("CPU features", 0); -#if NCPUS > 1 smp_init(); -#endif /* * Set up to use floating point. @@ -229,6 +215,21 @@ machine_init(void) * Configure clock devices. */ clock_config(); + + /* + * Initialize MTRR from boot processor. + */ + mtrr_init(); + + /* + * Set up PAT for boot processor. + */ + pat_init(); + + /* + * Free lowmem pages + */ + x86_lowmem_free(); } /* @@ -252,8 +253,10 @@ halt_all_cpus(boolean_t reboot) /* * Tell the BIOS not to clear and test memory. */ +#if 0 /* XXX fixme */ if (!reset_mem_on_reboot) *(unsigned short *)phystokv(0x472) = 0x1234; +#endif printf("MACH Reboot\n"); PEHaltRestart( kPERestartCPU ); @@ -267,7 +270,6 @@ halt_all_cpus(boolean_t reboot) /*XXX*/ void fc_get(mach_timespec_t *ts); #include -#include extern kern_return_t sysclk_gettime( mach_timespec_t *cur_time); void fc_get(mach_timespec_t *ts) { @@ -278,7 +280,14 @@ void Debugger( const char *message) { + + if (!panic_is_inited) { + postcode(PANIC_HLT); + asm("hlt"); + } + printf("Debugger called: <%s>\n", message); + kprintf("Debugger called: <%s>\n", message); draw_panic_dialog(); @@ -286,34 +295,16 @@ Debugger( } void -display_syscall(int syscall) +enable_bluebox(void) { - printf("System call happened %d\n", syscall); } - -#if XPR_DEBUG && (NCPUS == 1) - -extern kern_return_t sysclk_gettime_interrupts_disabled( - mach_timespec_t *cur_time); - -int xpr_time(void) -{ - mach_timespec_t time; - - sysclk_gettime_interrupts_disabled(&time); - return(time.tv_sec*1000000 + time.tv_nsec/1000); -} -#endif /* XPR_DEBUG && (NCPUS == 1) */ - -enable_bluebox() -{ -} -disable_bluebox() +void +disable_bluebox(void) { } char * -machine_boot_info(char *buf, vm_size_t size) +machine_boot_info(char *buf, __unused vm_size_t size) { *buf ='\0'; return buf;