]> git.saurik.com Git - apple/xnu.git/blame_incremental - iokit/Drivers/platform/drvAppleI386Generic/AppleI386CPU.cpp
xnu-344.21.73.tar.gz
[apple/xnu.git] / iokit / Drivers / platform / drvAppleI386Generic / AppleI386CPU.cpp
... / ...
CommitLineData
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) 2000 Apple Computer, Inc. All rights reserved.
27 *
28 * AppleI386CPU.cpp
29 *
30 * March 6, 2000 jliu
31 * Created based on AppleCPU.
32 */
33
34#include "AppleI386CPU.h"
35
36/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
37
38#undef super
39#define super IOCPU
40
41OSDefineMetaClassAndStructors(AppleI386CPU, IOCPU);
42
43/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
44
45bool AppleI386CPU::start(IOService * provider)
46{
47// kern_return_t result;
48
49 if (!super::start(provider)) return false;
50
51 cpuIC = new AppleI386CPUInterruptController;
52 if (cpuIC == 0) return false;
53
54 if (cpuIC->initCPUInterruptController(1) != kIOReturnSuccess)
55 return false;
56
57 cpuIC->attach(this);
58
59 cpuIC->registerCPUInterruptController();
60
61#ifdef NOTYET
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;
66#endif
67
68 setCPUState(kIOCPUStateUninitalized);
69
70#ifdef NOTYET
71 processor_start(machProcessor);
72#endif
73
74 // Hack. Call initCPU() ourself since no one else will.
75 initCPU(true);
76
77 registerService();
78
79 return true;
80}
81
82void AppleI386CPU::initCPU(bool /*boot*/)
83{
84 cpuIC->enableCPUInterrupt(this);
85
86 setCPUState(kIOCPUStateRunning);
87}
88
89void AppleI386CPU::quiesceCPU(void)
90{
91}
92
93kern_return_t AppleI386CPU::startCPU(vm_offset_t /*start_paddr*/,
94 vm_offset_t /*arg_paddr*/)
95{
96 return KERN_FAILURE;
97}
98
99void AppleI386CPU::haltCPU(void)
100{
101}
102
103const OSSymbol * AppleI386CPU::getCPUName(void)
104{
105 return OSSymbol::withCStringNoCopy("Primary0");
106}
107
108/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
109
110/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
111
112#undef super
113#define super IOCPUInterruptController
114
115OSDefineMetaClassAndStructors(AppleI386CPUInterruptController,
116 IOCPUInterruptController);
117
118/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
119
120IOReturn AppleI386CPUInterruptController::handleInterrupt(void * /*refCon*/,
121 IOService * /*nub*/,
122 int source)
123{
124 IOInterruptVector * vector;
125
126 // Override the implementation in IOCPUInterruptController to
127 // dispatch interrupts the old way.
128 //
129 // source argument is ignored, use the first IOCPUInterruptController
130 // in the vector array.
131 //
132 vector = &vectors[0];
133
134 if (!vector->interruptRegistered)
135 return kIOReturnInvalid;
136
137 vector->handler(vector->target,
138 vector->refCon,
139 vector->nub,
140 source);
141
142 return kIOReturnSuccess;
143}