/*
- * Copyright (c) 2000-2005 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2000-2007 Apple Inc. All rights reserved.
*
- * @APPLE_LICENSE_HEADER_START@
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
*
- * 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. The rights granted to you under the License
+ * may not be used to create, or enable the creation or redistribution of,
+ * unlawful or unlicensed copies of an Apple operating system, or to
+ * circumvent, violate, or enable the circumvention or violation of, any
+ * terms of an Apple operating system software license agreement.
*
- * This Original Code and all software distributed under the License are
- * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * 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
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the
- * License for the specific language governing rights and limitations
- * under the License.
+ * 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.
*
- * @APPLE_LICENSE_HEADER_END@
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
*/
#include <mach/mach_types.h>
#include <ppc/mem.h>
#include <ppc/new_screen.h>
#include <ppc/proc_reg.h>
+#include <ppc/machine_cpu.h> /* for cpu_signal_handler() */
+#include <ppc/fpu_protos.h>
#include <kern/kern_types.h>
#include <kern/processor.h>
#include <kern/machine.h>
extern unsigned int sulckPatch_eieio;
extern unsigned int rwlesPatch_eieio;
extern unsigned int rwldPatch_eieio;
-#if !MACH_LDEBUG
-extern unsigned int entfsectPatch_isync;
-extern unsigned int retfsectPatch_isync;
-extern unsigned int retfsectPatch_eieio;
-#endif
struct patch_up {
unsigned int *addr;
{&sulckPatch_eieio, 0x60000000},
{&rwlesPatch_eieio, 0x60000000},
{&rwldPatch_eieio, 0x60000000},
-#if !MACH_LDEBUG
- {&entfsectPatch_isync, 0x60000000},
- {&retfsectPatch_isync, 0x60000000},
- {&retfsectPatch_eieio, 0x60000000},
-#endif
{NULL, 0x00000000}
};
proc_info->interrupts_enabled = TRUE;
(void) ml_set_interrupts_enabled(current_state);
- initialize_screen(0, kPEAcquireScreen);
+ initialize_screen(NULL, kPEAcquireScreen);
+}
+
+/*
+ * Routine: ml_nofault_copy
+ * Function: Perform a physical mode copy if the source and
+ * destination have valid translations in the kernel pmap.
+ * If translations are present, they are assumed to
+ * be wired; i.e. no attempt is made to guarantee that the
+ * translations obtained remained valid for
+ * the duration of their use.
+ */
+
+vm_size_t ml_nofault_copy(
+ vm_offset_t virtsrc, vm_offset_t virtdst, vm_size_t size)
+{
+ addr64_t cur_phys_dst, cur_phys_src;
+ uint32_t count, pindex, nbytes = 0;
+
+ while (size > 0) {
+ if (!(cur_phys_src = kvtophys(virtsrc)))
+ break;
+ if (!(cur_phys_dst = kvtophys(virtdst)))
+ break;
+ if (!mapping_phys_lookup((cur_phys_src>>12), &pindex) ||
+ !mapping_phys_lookup((cur_phys_dst>>12), &pindex))
+ break;
+ count = PAGE_SIZE - (cur_phys_src & PAGE_MASK);
+ if (count > (PAGE_SIZE - (cur_phys_dst & PAGE_MASK)))
+ count = PAGE_SIZE - (cur_phys_dst & PAGE_MASK);
+ if (count > size)
+ count = size;
+
+ bcopy_phys(cur_phys_src, cur_phys_dst, count);
+
+ nbytes += count;
+ virtsrc += count;
+ virtdst += count;
+ size -= count;
+ }
+
+ return nbytes;
}
/*
*/
void ml_thread_policy(
thread_t thread,
- unsigned policy_id,
+__unused unsigned policy_id,
unsigned policy_info)
{
-
- if ((policy_id == MACHINE_GROUP) &&
- ((PerProcTable[master_cpu].ppe_vaddr->pf.Available) & pfSMPcap))
- thread_bind(thread, master_processor);
-
if (policy_info & MACHINE_NETWORK_WORKLOOP) {
spl_t s = splsched();
}
if (!boot_processor) {
- (void)hw_atomic_add((uint32_t *)&saveanchor.savetarget, FreeListMin); /* saveareas for this processor */
- processor_init((struct processor *)proc_info->processor, proc_info->cpu_number);
+ (void)hw_atomic_add(&saveanchor.savetarget, FreeListMin); /* saveareas for this processor */
+ processor_init((struct processor *)proc_info->processor,
+ proc_info->cpu_number, processor_pset(master_processor));
}
*processor_out = (struct processor *)proc_info->processor;
mcpus_state |= MAX_CPUS_WAIT;
thread_sleep_mutex((event_t)&mcpus_state,
&mcpus_lock, THREAD_UNINT);
- } else
- mutex_unlock(&mcpus_lock);
+ }
+ mutex_unlock(&mcpus_lock);
return(machine_info.max_cpus);
}
void
ml_cpu_up(void)
{
- hw_atomic_add(&machine_info.physical_cpu, 1);
- hw_atomic_add(&machine_info.logical_cpu, 1);
+ (void)hw_atomic_add(&machine_info.physical_cpu, 1);
+ (void)hw_atomic_add(&machine_info.logical_cpu, 1);
}
/*
void
ml_cpu_down(void)
{
- hw_atomic_sub(&machine_info.physical_cpu, 1);
- hw_atomic_sub(&machine_info.logical_cpu, 1);
+ (void)hw_atomic_sub(&machine_info.physical_cpu, 1);
+ (void)hw_atomic_sub(&machine_info.logical_cpu, 1);
}
/*
}
-decl_simple_lock_data(, spsLock);
-
/*
* Routine: ml_set_processor_speed
* Function:
*/
for (i=200; i>0; i--) {
current_state = ml_set_interrupts_enabled(FALSE);
- if (cpu != cpu_number()) {
+ if (cpu != (unsigned)cpu_number()) {
if (PerProcTable[cpu].ppe_vaddr->cpu_flags & SignalReady)
/*
* Target cpu is off-line, skip
return((thread_t)(getPerProc()->old_thread));
}
-/*
- * Routine: set_be_bit
- * Function:
- */
-int
-set_be_bit(
- void)
-{
- boolean_t current_state;
-
- current_state = ml_set_interrupts_enabled(FALSE);
- getPerProc()->cpu_flags |= traceBE;
- (void) ml_set_interrupts_enabled(current_state);
- return(1);
-}
-
-/*
- * Routine: clr_be_bit
- * Function:
- */
-int
-clr_be_bit(
- void)
-{
- boolean_t current_state;
-
- current_state = ml_set_interrupts_enabled(FALSE);
- getPerProc()->cpu_flags &= ~traceBE;
- (void) ml_set_interrupts_enabled(current_state);
- return(1);
-}
-
-/*
- * Routine: be_tracing
- * Function:
- */
-int
-be_tracing(
- void)
-{
- return(getPerProc()->cpu_flags & traceBE);
-}
-
void ml_mem_backoff(void) {