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
42class IOPowerConnection : public IOService
43{
44    OSDeclareDefaultStructors(IOPowerConnection)
45
46protected:
47    /*! @field parentKnowsState	true: parent knows state of its domain
48					used by child */
49    bool            stateKnown;
50
51    /*! @field currentPowerFlags	power flags which describe  the current state of the power domain
52					used by child */
53    IOPMPowerFlags 	currentPowerFlags;
54
55    /*! @field desiredDomainState	state number which corresponds to the child's desire
56					used by parent */
57    unsigned long	desiredDomainState;
58
59    /*! @field requestFlag		set to true when desiredDomainState is set */
60    bool            requestFlag;
61
62    /*! @field preventIdleSleepFlag	true if child has this bit set in its desired state
63					used by parent */
64    unsigned long	preventIdleSleepFlag;
65
66    /*! @field preventSystemSleepFlag	true if child has this bit set in its desired state
67					used by parent */
68    unsigned long	preventSystemSleepFlag;
69
70    /*! @field awaitingAck		true if child has not yet acked our notification
71					used by parent */
72    bool            awaitingAck;
73
74    /*! @field readyFlag		true if the child has been added as a power child
75					used by parent */
76	bool            readyFlag;
77
78#ifdef XNU_KERNEL_PRIVATE
79public:
80    bool            delayChildNotification;
81#endif
82
83public:
84    /*! @function setParentKnowsState
85        @abstract Sets the stateKnown variable.
86        @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. */
87    void setParentKnowsState (bool );
88
89    /*! @function setParentCurrentPowerFlags
90        @abstract Sets the currentPowerFlags variable.
91        @discussion Called by the parent when the object is created and called by the child when it discovers that the parent state is changing. */
92    void setParentCurrentPowerFlags (IOPMPowerFlags );
93
94    /*! @function parentKnowsState
95        @abstract Returns the stateKnown variable. */
96    bool parentKnowsState (void );
97
98    /*! @function parentCurrentPowerFlags
99        @abstract Returns the currentPowerFlags variable. */
100    IOPMPowerFlags parentCurrentPowerFlags (void );
101
102    /*! @function setDesiredDomainState
103        @abstract Sets the desiredDomainState variable.
104        @discussion Called by the parent. */
105    void setDesiredDomainState (unsigned long );
106
107    /*! @function getDesiredDomainState
108        @abstract Returns the desiredDomainState variable.
109    @discussion Called by the parent. */
110    unsigned long getDesiredDomainState ( void );
111
112    /*! @function setChildHasRequestedPower
113        @abstract Set the flag that says that the child has called requestPowerDomainState.
114    @discussion Called by the parent. */
115    void setChildHasRequestedPower ( void );
116
117    /*! @function childHasRequestedPower
118        @abstract Return the flag that says whether the child has called requestPowerDomainState.
119    @discussion Called by the PCI Aux Power Supply Driver to see if a device driver
120        is power managed. */
121    bool childHasRequestedPower ( void );
122
123    /*! @function setPreventIdleSleepFlag
124        @abstract Sets the preventIdleSleepFlag variable.
125        @discussion Called by the parent. */
126    void setPreventIdleSleepFlag (unsigned long );
127
128    /*! @function getPreventIdleSleepFlag
129        @abstract Returns the preventIdleSleepFlag variable.
130    @discussion Called by the parent. */
131    bool getPreventIdleSleepFlag ( void );
132
133    /*! @function setPreventSystemSleepFlag
134        @abstract Sets the preventSystemSleepFlag variable.
135        @discussion Called by the parent. */
136    void setPreventSystemSleepFlag (unsigned long );
137
138    /*! @function getPreventSystemSleepFlag
139        @abstract Returns the preventSystemSleepFlag variable.
140        @discussion Called by the parent. */
141    bool getPreventSystemSleepFlag ( void );
142
143    /*! @function setAwaitingAck
144        @abstract Sets the awaitingAck variable.
145        @discussion Called by the parent. */
146    void setAwaitingAck ( bool );
147
148    /*! @function getAwaitingAck
149        @abstract Returns the awaitingAck variable.
150        @discussion Called by the parent. */
151    bool getAwaitingAck ( void );
152
153    /*! @function setReadyFlag
154        @abstract Sets the readyFlag variable.
155        @discussion Called by the parent. */
156	void setReadyFlag( bool flag );
157
158    /*! @function getReadyFlag
159        @abstract Returns the readyFlag variable.
160        @discussion Called by the parent. */
161	bool getReadyFlag( void ) const;
162};
163
164#endif /* ! _IOKIT_IOPOWERCONNECTION_H */
165
166