]>
Commit | Line | Data |
---|---|---|
1c79356b A |
1 | /* |
2 | * Copyright (c) 2000 Apple Computer, Inc. All rights reserved. | |
3 | * | |
4 | * @APPLE_LICENSE_HEADER_START@ | |
5 | * | |
ff6e181a A |
6 | * This file contains Original Code and/or Modifications of Original Code |
7 | * as defined in and that are subject to the Apple Public Source License | |
8 | * Version 2.0 (the 'License'). You may not use this file except in | |
9 | * compliance with the License. Please obtain a copy of the License at | |
10 | * http://www.opensource.apple.com/apsl/ and read it before using this | |
11 | * file. | |
1c79356b | 12 | * |
ff6e181a A |
13 | * The Original Code and all software distributed under the License are |
14 | * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER | |
1c79356b A |
15 | * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, |
16 | * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, | |
ff6e181a A |
17 | * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. |
18 | * Please see the License for the specific language governing rights and | |
19 | * limitations under the License. | |
1c79356b A |
20 | * |
21 | * @APPLE_LICENSE_HEADER_END@ | |
22 | */ | |
23 | /* | |
24 | * Copyright (c) 1999 Apple Computer, Inc. All rights reserved. | |
25 | * | |
26 | * DRI: Josh de Cesare | |
27 | * | |
28 | */ | |
29 | ||
30 | #ifndef _IOKIT_CPU_H | |
31 | #define _IOKIT_CPU_H | |
32 | ||
33 | extern "C" { | |
34 | #include <machine/machine_routines.h> | |
35 | #include <pexpert/pexpert.h> | |
36 | } | |
37 | ||
38 | #include <IOKit/IOService.h> | |
39 | #include <IOKit/IOInterruptController.h> | |
40 | ||
41 | enum { | |
42 | kIOCPUStateUnregistered = 0, | |
43 | kIOCPUStateUninitalized, | |
44 | kIOCPUStateStopped, | |
45 | kIOCPUStateRunning, | |
46 | kIOCPUStateCount | |
47 | }; | |
48 | ||
49 | class IOCPUInterruptController; | |
50 | ||
51 | extern IOCPUInterruptController *gIOCPUInterruptController; | |
52 | ||
53 | class IOCPU : public IOService | |
54 | { | |
55 | OSDeclareAbstractStructors(IOCPU); | |
56 | ||
57 | private: | |
58 | OSArray *_cpuGroup; | |
59 | UInt32 _cpuNumber; | |
60 | UInt32 _cpuState; | |
61 | ||
62 | protected: | |
63 | IOService *cpuNub; | |
64 | processor_t machProcessor; | |
65 | ipi_handler_t ipi_handler; | |
66 | ||
67 | struct ExpansionData { }; | |
68 | ExpansionData *reserved; | |
69 | ||
70 | virtual void setCPUNumber(UInt32 cpuNumber); | |
71 | virtual void setCPUState(UInt32 cpuState); | |
72 | ||
73 | public: | |
74 | static void initCPUs(void); | |
75 | ||
76 | virtual bool start(IOService *provider); | |
91447636 A |
77 | virtual OSObject *getProperty(const OSSymbol *aKey) const; |
78 | virtual bool setProperty(const OSSymbol *aKey, OSObject *anObject); | |
79 | virtual bool serializeProperties(OSSerialize *serialize) const; | |
1c79356b A |
80 | virtual IOReturn setProperties(OSObject *properties); |
81 | virtual void initCPU(bool boot) = 0; | |
82 | virtual void quiesceCPU(void) = 0; | |
83 | virtual kern_return_t startCPU(vm_offset_t start_paddr, | |
84 | vm_offset_t arg_paddr) = 0; | |
85 | virtual void haltCPU(void) = 0; | |
86 | virtual void signalCPU(IOCPU *target); | |
87 | virtual void enableCPUTimeBase(bool enable); | |
88 | ||
89 | virtual UInt32 getCPUNumber(void); | |
90 | virtual UInt32 getCPUState(void); | |
91 | virtual OSArray *getCPUGroup(void); | |
92 | virtual UInt32 getCPUGroupSize(void); | |
93 | virtual processor_t getMachProcessor(void); | |
94 | ||
95 | virtual const OSSymbol *getCPUName(void) = 0; | |
96 | ||
97 | OSMetaClassDeclareReservedUnused(IOCPU, 0); | |
98 | OSMetaClassDeclareReservedUnused(IOCPU, 1); | |
99 | OSMetaClassDeclareReservedUnused(IOCPU, 2); | |
100 | OSMetaClassDeclareReservedUnused(IOCPU, 3); | |
101 | OSMetaClassDeclareReservedUnused(IOCPU, 4); | |
102 | OSMetaClassDeclareReservedUnused(IOCPU, 5); | |
103 | OSMetaClassDeclareReservedUnused(IOCPU, 6); | |
104 | OSMetaClassDeclareReservedUnused(IOCPU, 7); | |
105 | }; | |
106 | ||
107 | void IOCPUSleepKernel(void); | |
108 | ||
109 | ||
110 | class IOCPUInterruptController : public IOInterruptController | |
111 | { | |
112 | OSDeclareDefaultStructors(IOCPUInterruptController); | |
113 | ||
114 | private: | |
115 | int enabledCPUs; | |
116 | ||
117 | protected: | |
118 | int numCPUs; | |
119 | IOCPU **cpus; | |
120 | ||
121 | struct ExpansionData { }; | |
122 | ExpansionData *reserved; | |
123 | ||
124 | public: | |
125 | virtual IOReturn initCPUInterruptController(int sources); | |
126 | virtual void registerCPUInterruptController(void); | |
127 | virtual void setCPUInterruptProperties(IOService *service); | |
128 | virtual void enableCPUInterrupt(IOCPU *cpu); | |
129 | ||
130 | virtual IOReturn registerInterrupt(IOService *nub, int source, | |
131 | void *target, | |
132 | IOInterruptHandler handler, | |
133 | void *refCon); | |
134 | ||
135 | virtual IOReturn getInterruptType(IOService *nub, int source, | |
136 | int *interruptType); | |
137 | ||
138 | virtual IOReturn enableInterrupt(IOService *nub, int source); | |
139 | virtual IOReturn disableInterrupt(IOService *nub, int source); | |
140 | virtual IOReturn causeInterrupt(IOService *nub, int source); | |
141 | ||
142 | virtual IOReturn handleInterrupt(void *refCon, IOService *nub, | |
143 | int source); | |
144 | ||
145 | OSMetaClassDeclareReservedUnused(IOCPUInterruptController, 0); | |
146 | OSMetaClassDeclareReservedUnused(IOCPUInterruptController, 1); | |
147 | OSMetaClassDeclareReservedUnused(IOCPUInterruptController, 2); | |
148 | OSMetaClassDeclareReservedUnused(IOCPUInterruptController, 3); | |
149 | OSMetaClassDeclareReservedUnused(IOCPUInterruptController, 4); | |
150 | OSMetaClassDeclareReservedUnused(IOCPUInterruptController, 5); | |
151 | }; | |
152 | ||
153 | #endif /* ! _IOKIT_CPU_H */ |