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