]>
Commit | Line | Data |
---|---|---|
1c79356b A |
1 | /* |
2 | * Copyright (c) 1998-2000 Apple Computer, Inc. All rights reserved. | |
3 | * | |
4 | * @APPLE_LICENSE_HEADER_START@ | |
5 | * | |
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. | |
11 | * | |
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 | |
18 | * under the License. | |
19 | * | |
20 | * @APPLE_LICENSE_HEADER_END@ | |
21 | */ | |
22 | #ifndef _IOKIT_ROOTDOMAIN_H | |
23 | #define _IOKIT_ROOTDOMAIN_H | |
24 | ||
25 | #include <IOKit/IOService.h> | |
26 | #include <IOKit/pwr_mgt/IOPM.h> | |
27 | ||
28 | class RootDomainUserClient; | |
29 | ||
d52fe63f A |
30 | #define kRootDomainSupportedFeatures "Supported Features" |
31 | ||
1c79356b A |
32 | enum { |
33 | kRootDomainSleepNotSupported = 0x00000000, | |
34 | kRootDomainSleepSupported = 0x00000001, | |
0b4e3aa0 A |
35 | kFrameBufferDeepSleepSupported = 0x00000002, |
36 | kPCICantSleep = 0x00000004 | |
1c79356b A |
37 | }; |
38 | ||
39 | extern "C" | |
40 | { | |
41 | IONotifier * registerSleepWakeInterest(IOServiceInterestHandler, void *, void * = 0); | |
0b4e3aa0 | 42 | IONotifier * registerPrioritySleepWakeInterest(IOServiceInterestHandler handler, void * self, void * ref = 0); |
1c79356b | 43 | IOReturn acknowledgeSleepWakeNotification(void * ); |
0b4e3aa0 A |
44 | IOReturn vetoSleepWakeNotification(void * PMrefcon); |
45 | IOReturn rootDomainRestart ( void ); | |
46 | IOReturn rootDomainShutdown ( void ); | |
1c79356b A |
47 | } |
48 | ||
d52fe63f | 49 | #define IOPM_ROOTDOMAIN_REV 2 |
1c79356b A |
50 | |
51 | class IOPMrootDomain: public IOService | |
52 | { | |
53 | OSDeclareDefaultStructors(IOPMrootDomain) | |
54 | ||
55 | public: | |
56 | ||
0b4e3aa0 A |
57 | class IOService * wrangler; // we tickle the wrangler on button presses, etc |
58 | ||
59 | static IOPMrootDomain * construct( void ); | |
60 | virtual bool start( IOService * provider ); | |
1c79356b A |
61 | virtual IOReturn newUserClient ( task_t, void *, UInt32, IOUserClient ** ); |
62 | virtual IOReturn setAggressiveness ( unsigned long, unsigned long ); | |
63 | virtual IOReturn youAreRoot ( void ); | |
64 | virtual IOReturn sleepSystem ( void ); | |
9bccf70c | 65 | virtual IOReturn setProperties ( OSObject * ); |
0b4e3aa0 A |
66 | IOReturn shutdownSystem ( void ); |
67 | IOReturn restartSystem ( void ); | |
1c79356b A |
68 | virtual IOReturn receivePowerNotification (UInt32 msg); |
69 | virtual void setSleepSupported( IOOptionBits flags ); | |
70 | virtual IOOptionBits getSleepSupported(); | |
0b4e3aa0 A |
71 | virtual IOReturn requestPowerDomainState ( IOPMPowerFlags, IOPowerConnection *, unsigned long ); |
72 | virtual void handleSleepTimerExpiration ( void ); | |
d52fe63f | 73 | void stopIgnoringClamshellEventsDuringWakeup ( void ); |
0b4e3aa0 | 74 | void wakeFromDoze( void ); |
9bccf70c | 75 | void broadcast_it (unsigned long, unsigned long ); |
d52fe63f | 76 | void publishFeature( const char *feature ); |
1c79356b | 77 | |
9bccf70c A |
78 | // Override of these methods for logging purposes. |
79 | virtual IOReturn changePowerStateTo ( unsigned long ordinal ); | |
80 | virtual IOReturn changePowerStateToPriv ( unsigned long ordinal ); | |
81 | ||
1c79356b A |
82 | private: |
83 | ||
0b4e3aa0 A |
84 | class IORootParent * patriarch; // points to our parent |
85 | long sleepSlider; // pref: idle time before idle sleep | |
86 | long longestNonSleepSlider; // pref: longest of other idle times | |
87 | long extraSleepDelay; // sleepSlider - longestNonSleepSlider | |
88 | thread_call_t extraSleepTimer; // used to wait between say display idle and system idle | |
d52fe63f A |
89 | thread_call_t clamshellWakeupIgnore; // Used to ignore clamshell close events while we're waking from sleep |
90 | ||
1c79356b A |
91 | virtual void powerChangeDone ( unsigned long ); |
92 | virtual void command_received ( void *, void * , void * , void *); | |
93 | virtual bool tellChangeDown ( unsigned long stateNum); | |
94 | virtual bool askChangeDown ( unsigned long stateNum); | |
95 | virtual void tellChangeUp ( unsigned long ); | |
96 | virtual void tellNoChangeDown ( unsigned long ); | |
0b4e3aa0 A |
97 | void reportUserInput ( void ); |
98 | static IOReturn sysPowerDownHandler( void * target, void * refCon, | |
99 | UInt32 messageType, IOService * service, | |
100 | void * messageArgument, vm_size_t argSize ); | |
101 | ||
102 | static IOReturn displayWranglerNotification( void * target, void * refCon, | |
103 | UInt32 messageType, IOService * service, | |
104 | void * messageArgument, vm_size_t argSize ); | |
105 | ||
106 | static bool displayWranglerPublished( void * target, void * refCon, | |
107 | IOService * newService); | |
108 | ||
109 | void setQuickSpinDownTimeout ( void ); | |
110 | void adjustPowerState( void ); | |
111 | void restoreUserSpinDownTimeout ( void ); | |
1c79356b | 112 | |
d52fe63f | 113 | |
0b4e3aa0 A |
114 | unsigned int user_spindown; // User's selected disk spindown value |
115 | ||
116 | unsigned int systemBooting:1; | |
117 | unsigned int ignoringClamshell:1; | |
118 | unsigned int allowSleep:1; | |
119 | unsigned int sleepIsSupported:1; | |
120 | unsigned int canSleep:1; | |
121 | unsigned int idleSleepPending:1; | |
122 | unsigned int sleepASAP:1; | |
d52fe63f A |
123 | unsigned int desktopMode:1; |
124 | ||
125 | unsigned int acAdaptorConnect:1; | |
126 | unsigned int ignoringClamshellDuringWakeup:1; | |
127 | unsigned int reservedA:6; | |
128 | unsigned char reservedB[3]; | |
129 | ||
0b4e3aa0 | 130 | thread_call_t diskSyncCalloutEntry; |
1c79356b A |
131 | IOOptionBits platformSleepSupport; |
132 | }; | |
133 | ||
134 | class IORootParent: public IOService | |
135 | { | |
136 | OSDeclareDefaultStructors(IORootParent) | |
0b4e3aa0 A |
137 | |
138 | private: | |
139 | unsigned long mostRecentChange; | |
1c79356b A |
140 | |
141 | public: | |
142 | ||
143 | bool start ( IOService * nub ); | |
144 | void shutDownSystem ( void ); | |
0b4e3aa0 | 145 | void restartSystem ( void ); |
1c79356b | 146 | void sleepSystem ( void ); |
0b4e3aa0 A |
147 | void dozeSystem ( void ); |
148 | void sleepToDoze ( void ); | |
1c79356b A |
149 | void wakeSystem ( void ); |
150 | }; | |
151 | ||
152 | ||
153 | #endif /* _IOKIT_ROOTDOMAIN_H */ |