1/* 2 * Copyright (c) 1998-2000 Apple Computer, Inc. All rights reserved. 3 * 4 * @APPLE_OSREFERENCE_LICENSE_HEADER_START@ 5 * 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. 14 * 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 20 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, 21 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, 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. 25 * 26 * @APPLE_OSREFERENCE_LICENSE_HEADER_END@ 27 */ 28/* 29 * Copyright (c) 1998 Apple Computer, Inc. All rights reserved. 30 * 31 * HISTORY 32 * 33 */ 34 35 36#ifndef _IOKIT_IOPOWERCONNECTION_H 37#define _IOKIT_IOPOWERCONNECTION_H 38 39#include <IOKit/IOService.h> 40#include <IOKit/pwr_mgt/IOPM.h> 41 42/*! @class IOPowerConnection 43 * Do not use IOPowerConnection. This class is an implementation detail defined 44 * for IOPM's management of the IORegistry IOPower plane. 45 * 46 * Only Kernel IOKit power management should reference the IOPowerConnection class. 47 */ 48 49class IOPowerConnection : public IOService 50{ 51 OSDeclareDefaultStructors(IOPowerConnection) 52 53protected: 54 /*! @field parentKnowsState true: parent knows state of its domain 55 used by child */ 56 bool stateKnown; 57 58 /*! @field currentPowerFlags power flags which describe the current state of the power domain 59 used by child */ 60 IOPMPowerFlags currentPowerFlags; 61 62 /*! @field desiredDomainState state number which corresponds to the child's desire 63 used by parent */ 64 unsigned long desiredDomainState; 65 66 /*! @field requestFlag set to true when desiredDomainState is set */ 67 bool requestFlag; 68 69 /*! @field preventIdleSleepFlag true if child has this bit set in its desired state 70 used by parent */ 71 unsigned long preventIdleSleepFlag; 72 73 /*! @field preventSystemSleepFlag true if child has this bit set in its desired state 74 used by parent */ 75 unsigned long preventSystemSleepFlag; 76 77 /*! @field awaitingAck true if child has not yet acked our notification 78 used by parent */ 79 bool awaitingAck; 80 81 /*! @field readyFlag true if the child has been added as a power child 82 used by parent */ 83 bool readyFlag; 84 85#ifdef XNU_KERNEL_PRIVATE 86public: 87 bool delayChildNotification; 88#endif 89 90public: 91 /*! @function setParentKnowsState 92 @abstract Sets the stateKnown variable. 93 @discussion Called by the parent when the object is created and called by the child when it discovers that the parent now knows its state. */ 94 void setParentKnowsState (bool ); 95 96 /*! @function setParentCurrentPowerFlags 97 @abstract Sets the currentPowerFlags variable. 98 @discussion Called by the parent when the object is created and called by the child when it discovers that the parent state is changing. */ 99 void setParentCurrentPowerFlags (IOPMPowerFlags ); 100 101 /*! @function parentKnowsState 102 @abstract Returns the stateKnown variable. */ 103 bool parentKnowsState (void ); 104 105 /*! @function parentCurrentPowerFlags 106 @abstract Returns the currentPowerFlags variable. */ 107 IOPMPowerFlags parentCurrentPowerFlags (void ); 108 109 /*! @function setDesiredDomainState 110 @abstract Sets the desiredDomainState variable. 111 @discussion Called by the parent. */ 112 void setDesiredDomainState (unsigned long ); 113 114 /*! @function getDesiredDomainState 115 @abstract Returns the desiredDomainState variable. 116 @discussion Called by the parent. */ 117 unsigned long getDesiredDomainState ( void ); 118 119 /*! @function setChildHasRequestedPower 120 @abstract Set the flag that says that the child has called requestPowerDomainState. 121 @discussion Called by the parent. */ 122 void setChildHasRequestedPower ( void ); 123 124 /*! @function childHasRequestedPower 125 @abstract Return the flag that says whether the child has called requestPowerDomainState. 126 @discussion Called by the PCI Aux Power Supply Driver to see if a device driver 127 is power managed. */ 128 bool childHasRequestedPower ( void ); 129 130 /*! @function setPreventIdleSleepFlag 131 @abstract Sets the preventIdleSleepFlag variable. 132 @discussion Called by the parent. */ 133 void setPreventIdleSleepFlag (unsigned long ); 134 135 /*! @function getPreventIdleSleepFlag 136 @abstract Returns the preventIdleSleepFlag variable. 137 @discussion Called by the parent. */ 138 bool getPreventIdleSleepFlag ( void ); 139 140 /*! @function setPreventSystemSleepFlag 141 @abstract Sets the preventSystemSleepFlag variable. 142 @discussion Called by the parent. */ 143 void setPreventSystemSleepFlag (unsigned long ); 144 145 /*! @function getPreventSystemSleepFlag 146 @abstract Returns the preventSystemSleepFlag variable. 147 @discussion Called by the parent. */ 148 bool getPreventSystemSleepFlag ( void ); 149 150 /*! @function setAwaitingAck 151 @abstract Sets the awaitingAck variable. 152 @discussion Called by the parent. */ 153 void setAwaitingAck ( bool ); 154 155 /*! @function getAwaitingAck 156 @abstract Returns the awaitingAck variable. 157 @discussion Called by the parent. */ 158 bool getAwaitingAck ( void ); 159 160 /*! @function setReadyFlag 161 @abstract Sets the readyFlag variable. 162 @discussion Called by the parent. */ 163 void setReadyFlag( bool flag ); 164 165 /*! @function getReadyFlag 166 @abstract Returns the readyFlag variable. 167 @discussion Called by the parent. */ 168 bool getReadyFlag( void ) const; 169}; 170 171#endif /* ! _IOKIT_IOPOWERCONNECTION_H */ 172 173