2 * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
4 * @APPLE_OSREFERENCE_LICENSE_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 License
10 * may not be used to create, or enable the creation or redistribution of,
11 * unlawful or unlicensed copies of an Apple operating system, or to
12 * circumvent, violate, or enable the circumvention or violation of, any
13 * terms of an Apple operating system software license agreement.
15 * Please obtain a copy of the License at
16 * http://www.opensource.apple.com/apsl/ and read it before using this file.
18 * The Original Code and all software distributed under the License are
19 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
20 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
21 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
22 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
23 * Please see the License for the specific language governing rights and
24 * limitations under the License.
26 * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
31 * cpu specific routines
34 #include <kern/kalloc.h>
35 #include <kern/misc_protos.h>
36 #include <kern/machine.h>
37 #include <mach/processor_info.h>
39 #include <i386/machine_cpu.h>
40 #include <i386/machine_routines.h>
41 #include <i386/pmap.h>
42 #include <i386/misc_protos.h>
43 #include <i386/cpu_threads.h>
44 #include <vm/vm_kern.h>
47 struct processor processor_master
;
53 processor_info_t info
,
56 printf("cpu_control(%d,0x%x,%d) not implemented\n",
57 slot_num
, info
, count
);
58 return (KERN_FAILURE
);
64 __unused processor_flavor_t flavor
,
68 return (KERN_FAILURE
);
74 processor_flavor_t flavor
,
76 processor_info_t info
,
79 printf("cpu_info(%d,%d,0x%x,0x%x) not implemented\n",
80 flavor
, slot_num
, info
, count
);
81 return (KERN_FAILURE
);
87 cpu_data_t
*proc_info
= current_cpu_datap();
89 PE_cpu_machine_quiesce(proc_info
->cpu_id
);
97 cpu_data_t
*cdp
= current_cpu_datap();
101 cdp
->cpu_type
= CPU_TYPE_I386
;
102 cdp
->cpu_subtype
= CPU_SUBTYPE_PENTPRO
;
104 cdp
->cpu_type
= cpuid_cputype(0);
105 cdp
->cpu_subtype
= CPU_SUBTYPE_AT386
;
107 cdp
->cpu_running
= TRUE
;
116 if (cpu
== cpu_number()) {
121 * Should call out through PE.
122 * But take the shortcut here.
124 ret
= intel_startCPU(cpu
);
141 cpu
= get_cpu_number();
142 PE_cpu_machine_init(cpu_datap(cpu
)->cpu_id
, TRUE
);
144 if (cpu_datap(cpu
)->hibernate
)
146 cpu_datap(cpu
)->hibernate
= 0;
147 hibernate_machine_init();
154 cpu_processor_alloc(boolean_t is_boot_cpu
)
160 return &processor_master
;
162 ret
= kmem_alloc(kernel_map
, (vm_offset_t
*) &proc
, sizeof(*proc
));
163 if (ret
!= KERN_SUCCESS
)
166 bzero((void *) proc
, sizeof(*proc
));
171 cpu_processor_free(processor_t proc
)
173 if (proc
!= NULL
&& proc
!= &processor_master
)
174 kfree((void *) proc
, sizeof(*proc
));
178 current_processor(void)
180 return current_cpu_datap()->cpu_processor
;
187 return cpu_datap(cpu
)->cpu_processor
;
193 return (¤t_cpu_datap()->cpu_pending_ast
);
200 return (cpu_datap(slot_num
)->cpu_type
);
207 return (cpu_datap(slot_num
)->cpu_subtype
);
214 return (cpu_datap(slot_num
)->cpu_threadtype
);
220 return (current_cpu_datap()->cpu_type
);
226 return (current_cpu_datap()->cpu_subtype
);
232 return (current_cpu_datap()->cpu_threadtype
);