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