]> git.saurik.com Git - apple/xnu.git/blob - iokit/Drivers/platform/drvApplePlatformExpert/AppleCPU.cpp
1b825dd192efc215481f09a08eb2aa47da2ba538
[apple/xnu.git] / iokit / Drivers / platform / drvApplePlatformExpert / AppleCPU.cpp
1 /*
2 * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
3 *
4 * @APPLE_LICENSE_HEADER_START@
5 *
6 * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved.
7 *
8 * This file contains Original Code and/or Modifications of Original Code
9 * as defined in and that are subject to the Apple Public Source License
10 * Version 2.0 (the 'License'). You may not use this file except in
11 * compliance with the License. Please obtain a copy of the License at
12 * http://www.opensource.apple.com/apsl/ and read it before using this
13 * file.
14 *
15 * The Original Code and all software distributed under the License are
16 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
17 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
18 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
19 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
20 * Please see the License for the specific language governing rights and
21 * limitations under the License.
22 *
23 * @APPLE_LICENSE_HEADER_END@
24 */
25 /*
26 * Copyright (c) 1999 Apple Computer, Inc. All rights reserved.
27 *
28 * DRI: Josh de Cesare
29 *
30 */
31
32 #include "AppleCPU.h"
33
34 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
35
36 #undef super
37 #define super IOCPU
38
39 OSDefineMetaClassAndStructors(AppleCPU, IOCPU);
40
41 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
42
43 bool AppleCPU::start(IOService *provider)
44 {
45 kern_return_t result;
46 ml_processor_info_t processor_info;
47
48 if (!super::start(provider)) return false;
49
50 cpuIC = new IOCPUInterruptController;
51 if (cpuIC == 0) return false;
52
53 if (cpuIC->initCPUInterruptController(1) != kIOReturnSuccess) return false;
54 cpuIC->attach(this);
55
56 cpuIC->registerCPUInterruptController();
57
58 processor_info.cpu_id = (cpu_id_t)this;
59 processor_info.boot_cpu = true;
60 processor_info.start_paddr = 0;
61 processor_info.supports_nap = false;
62 processor_info.l2cr_value = 0;
63 processor_info.time_base_enable = 0;
64
65 // Register this CPU with mach.
66 result = ml_processor_register(&processor_info, &machProcessor,
67 &ipi_handler);
68 if (result == KERN_FAILURE) return false;
69
70 setCPUState(kIOCPUStateUninitalized);
71
72 processor_start(machProcessor);
73
74 registerService();
75
76 return true;
77 }
78
79 void AppleCPU::initCPU(bool boot)
80 {
81 if (boot) {
82 cpuIC->enableCPUInterrupt(this);
83 }
84
85 setCPUState(kIOCPUStateRunning);
86 }
87
88 void AppleCPU::quiesceCPU(void)
89 {
90 // Unsupported.
91 }
92
93 kern_return_t AppleCPU::startCPU(vm_offset_t /*start_paddr*/,
94 vm_offset_t /*arg_paddr*/)
95 {
96 return KERN_FAILURE;
97 }
98
99 void AppleCPU::haltCPU(void)
100 {
101 // Unsupported.
102 }
103
104 const OSSymbol *AppleCPU::getCPUName(void)
105 {
106 return OSSymbol::withCStringNoCopy("Primary0");
107 }
108
109 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */