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@
23 * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
28 * Created based on AppleCPU.
31 #include "AppleI386CPU.h"
33 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
38 OSDefineMetaClassAndStructors(AppleI386CPU
, IOCPU
);
40 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
42 bool AppleI386CPU::start(IOService
* provider
)
44 // kern_return_t result;
46 if (!super::start(provider
)) return false;
48 cpuIC
= new AppleI386CPUInterruptController
;
49 if (cpuIC
== 0) return false;
51 if (cpuIC
->initCPUInterruptController(1) != kIOReturnSuccess
)
56 cpuIC
->registerCPUInterruptController();
59 // Register this CPU with mach.
60 result
= ml_processor_register((cpu_id_t
)this, 0,
61 &machProcessor
, &ipi_handler
, true);
62 if (result
== KERN_FAILURE
) return false;
65 setCPUState(kIOCPUStateUninitalized
);
68 processor_start(machProcessor
);
71 // Hack. Call initCPU() ourself since no one else will.
79 void AppleI386CPU::initCPU(bool /*boot*/)
81 cpuIC
->enableCPUInterrupt(this);
83 setCPUState(kIOCPUStateRunning
);
86 void AppleI386CPU::quiesceCPU(void)
90 kern_return_t
AppleI386CPU::startCPU(vm_offset_t
/*start_paddr*/,
91 vm_offset_t
/*arg_paddr*/)
96 void AppleI386CPU::haltCPU(void)
100 const OSSymbol
* AppleI386CPU::getCPUName(void)
102 return OSSymbol::withCStringNoCopy("Primary0");
105 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
107 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
110 #define super IOCPUInterruptController
112 OSDefineMetaClassAndStructors(AppleI386CPUInterruptController
,
113 IOCPUInterruptController
);
115 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
117 IOReturn
AppleI386CPUInterruptController::handleInterrupt(void * /*refCon*/,
121 IOInterruptVector
* vector
;
123 // Override the implementation in IOCPUInterruptController to
124 // dispatch interrupts the old way.
126 // source argument is ignored, use the first IOCPUInterruptController
127 // in the vector array.
129 vector
= &vectors
[0];
131 if (!vector
->interruptRegistered
)
132 return kIOReturnInvalid
;
134 vector
->handler(vector
->target
,
139 return kIOReturnSuccess
;