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@
25 * cpu specific routines
28 #include <kern/kalloc.h>
29 #include <kern/misc_protos.h>
30 #include <kern/machine.h>
31 #include <mach/processor_info.h>
33 #include <i386/machine_cpu.h>
34 #include <i386/machine_routines.h>
35 #include <i386/pmap.h>
36 #include <i386/misc_protos.h>
37 #include <i386/cpu_threads.h>
38 #include <vm/vm_kern.h>
41 struct processor processor_master
;
47 processor_info_t info
,
50 printf("cpu_control(%d,0x%x,%d) not implemented\n",
51 slot_num
, info
, count
);
52 return (KERN_FAILURE
);
58 __unused processor_flavor_t flavor
,
62 return (KERN_FAILURE
);
68 processor_flavor_t flavor
,
70 processor_info_t info
,
73 printf("cpu_info(%d,%d,0x%x,0x%x) not implemented\n",
74 flavor
, slot_num
, info
, count
);
75 return (KERN_FAILURE
);
81 cpu_data_t
*proc_info
= current_cpu_datap();
83 PE_cpu_machine_quiesce(proc_info
->cpu_id
);
91 cpu_data_t
*cdp
= current_cpu_datap();
95 cdp
->cpu_type
= CPU_TYPE_I386
;
96 cdp
->cpu_subtype
= CPU_SUBTYPE_PENTPRO
;
98 cdp
->cpu_type
= cpuid_cputype(0);
99 cdp
->cpu_subtype
= CPU_SUBTYPE_AT386
;
101 cdp
->cpu_running
= TRUE
;
110 if (cpu
== cpu_number()) {
115 * Should call out through PE.
116 * But take the shortcut here.
118 ret
= intel_startCPU(cpu
);
135 cpu
= get_cpu_number();
136 PE_cpu_machine_init(cpu_datap(cpu
)->cpu_id
, TRUE
);
138 if (cpu_datap(cpu
)->hibernate
)
140 cpu_datap(cpu
)->hibernate
= 0;
141 hibernate_machine_init();
148 cpu_processor_alloc(boolean_t is_boot_cpu
)
154 return &processor_master
;
156 ret
= kmem_alloc(kernel_map
, (vm_offset_t
*) &proc
, sizeof(*proc
));
157 if (ret
!= KERN_SUCCESS
)
160 bzero((void *) proc
, sizeof(*proc
));
165 cpu_processor_free(processor_t proc
)
167 if (proc
!= NULL
&& proc
!= &processor_master
)
168 kfree((void *) proc
, sizeof(*proc
));
172 current_processor(void)
174 return current_cpu_datap()->cpu_processor
;
181 return cpu_datap(cpu
)->cpu_processor
;
187 return (¤t_cpu_datap()->cpu_pending_ast
);
194 return (cpu_datap(slot_num
)->cpu_type
);
201 return (cpu_datap(slot_num
)->cpu_subtype
);
208 return (cpu_datap(slot_num
)->cpu_threadtype
);
214 return (current_cpu_datap()->cpu_type
);
220 return (current_cpu_datap()->cpu_subtype
);
226 return (current_cpu_datap()->cpu_threadtype
);