2 * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
4 * @APPLE_LICENSE_HEADER_START@
6 * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved.
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
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.
23 * @APPLE_LICENSE_HEADER_END@
26 * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
31 * Created based on AppleCPU.
34 #include "AppleI386CPU.h"
36 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
41 OSDefineMetaClassAndStructors(AppleI386CPU
, IOCPU
);
43 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
45 bool AppleI386CPU::start(IOService
* provider
)
47 // kern_return_t result;
49 if (!super::start(provider
)) return false;
51 cpuIC
= new AppleI386CPUInterruptController
;
52 if (cpuIC
== 0) return false;
54 if (cpuIC
->initCPUInterruptController(1) != kIOReturnSuccess
)
59 cpuIC
->registerCPUInterruptController();
62 // Register this CPU with mach.
63 result
= ml_processor_register((cpu_id_t
)this, 0,
64 &machProcessor
, &ipi_handler
, true);
65 if (result
== KERN_FAILURE
) return false;
68 setCPUState(kIOCPUStateUninitalized
);
71 processor_start(machProcessor
);
74 // Hack. Call initCPU() ourself since no one else will.
82 void AppleI386CPU::initCPU(bool /*boot*/)
84 cpuIC
->enableCPUInterrupt(this);
86 setCPUState(kIOCPUStateRunning
);
89 void AppleI386CPU::quiesceCPU(void)
93 kern_return_t
AppleI386CPU::startCPU(vm_offset_t
/*start_paddr*/,
94 vm_offset_t
/*arg_paddr*/)
99 void AppleI386CPU::haltCPU(void)
103 const OSSymbol
* AppleI386CPU::getCPUName(void)
105 return OSSymbol::withCStringNoCopy("Primary0");
108 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
110 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
113 #define super IOCPUInterruptController
115 OSDefineMetaClassAndStructors(AppleI386CPUInterruptController
,
116 IOCPUInterruptController
);
118 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
120 IOReturn
AppleI386CPUInterruptController::handleInterrupt(void * /*refCon*/,
124 IOInterruptVector
* vector
;
126 // Override the implementation in IOCPUInterruptController to
127 // dispatch interrupts the old way.
129 // source argument is ignored, use the first IOCPUInterruptController
130 // in the vector array.
132 vector
= &vectors
[0];
134 if (!vector
->interruptRegistered
)
135 return kIOReturnInvalid
;
137 vector
->handler(vector
->target
,
142 return kIOReturnSuccess
;