]>
git.saurik.com Git - apple/xnu.git/blob - iokit/Drivers/platform/drvAppleRootDomain/RootDomainUserClient.cpp
e49d3b2932754cf161604969328db7eca432fed7
2 * Copyright (c) 1998-2000 Apple Computer, Inc. All rights reserved.
4 * @APPLE_LICENSE_HEADER_START@
6 * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved.
8 * This file contains Original Code and/or Modifications of Original Code
9 * as defined in and that are subject to the Apple Public Source License
10 * Version 2.0 (the 'License'). You may not use this file except in
11 * compliance with the License. Please obtain a copy of the License at
12 * http://www.opensource.apple.com/apsl/ and read it before using this
15 * The Original Code and all software distributed under the License are
16 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
17 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
18 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
19 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
20 * Please see the License for the specific language governing rights and
21 * limitations under the License.
23 * @APPLE_LICENSE_HEADER_END@
26 * Copyright (c) 1999 Apple Computer, Inc. All rights reserved.
30 #include <IOKit/assert.h>
31 #include <IOKit/IOLib.h>
32 #include <IOKit/IOBufferMemoryDescriptor.h>
33 #include "RootDomainUserClient.h"
34 #include <IOKit/pwr_mgt/IOPMLibDefs.h>
36 #define super IOUserClient
38 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
40 OSDefineMetaClassAndStructors(RootDomainUserClient
, IOUserClient
)
42 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
44 RootDomainUserClient
*RootDomainUserClient::withTask(task_t owningTask
)
46 RootDomainUserClient
*me
;
48 me
= new RootDomainUserClient
;
54 me
->fTask
= owningTask
;
59 bool RootDomainUserClient::start( IOService
* provider
)
61 assert(OSDynamicCast(IOPMrootDomain
, provider
));
62 if(!super::start(provider
))
64 fOwner
= (IOPMrootDomain
*)provider
;
66 // Got the owner, so initialize the call structures
67 fMethods
[kPMSetAggressiveness
].object
= provider
; // 0
68 fMethods
[kPMSetAggressiveness
].func
= (IOMethod
)&IOPMrootDomain::setAggressiveness
;
69 fMethods
[kPMSetAggressiveness
].count0
= 2;
70 fMethods
[kPMSetAggressiveness
].count1
= 0;
71 fMethods
[kPMSetAggressiveness
].flags
= kIOUCScalarIScalarO
;
73 fMethods
[kPMGetAggressiveness
].object
= provider
; // 1
74 fMethods
[kPMGetAggressiveness
].func
= (IOMethod
)&IOPMrootDomain::getAggressiveness
;
75 fMethods
[kPMGetAggressiveness
].count0
= 1;
76 fMethods
[kPMGetAggressiveness
].count1
= 1;
77 fMethods
[kPMGetAggressiveness
].flags
= kIOUCScalarIScalarO
;
79 fMethods
[kPMSleepSystem
].object
= provider
; // 2
80 fMethods
[kPMSleepSystem
].func
= (IOMethod
)&IOPMrootDomain::sleepSystem
;
81 fMethods
[kPMSleepSystem
].count0
= 0;
82 fMethods
[kPMSleepSystem
].count1
= 0;
83 fMethods
[kPMSleepSystem
].flags
= kIOUCScalarIScalarO
;
85 fMethods
[kPMAllowPowerChange
].object
= provider
; // 3
86 fMethods
[kPMAllowPowerChange
].func
= (IOMethod
)&IOPMrootDomain::allowPowerChange
;
87 fMethods
[kPMAllowPowerChange
].count0
= 1;
88 fMethods
[kPMAllowPowerChange
].count1
= 0;
89 fMethods
[kPMAllowPowerChange
].flags
= kIOUCScalarIScalarO
;
91 fMethods
[kPMCancelPowerChange
].object
= provider
; // 4
92 fMethods
[kPMCancelPowerChange
].func
= (IOMethod
)&IOPMrootDomain::cancelPowerChange
;
93 fMethods
[kPMCancelPowerChange
].count0
= 1;
94 fMethods
[kPMCancelPowerChange
].count1
= 0;
95 fMethods
[kPMCancelPowerChange
].flags
= kIOUCScalarIScalarO
;
97 fMethods
[kPMShutdownSystem
].object
= provider
; // 5
98 fMethods
[kPMShutdownSystem
].func
= (IOMethod
)&IOPMrootDomain::shutdownSystem
;
99 fMethods
[kPMShutdownSystem
].count0
= 0;
100 fMethods
[kPMShutdownSystem
].count1
= 0;
101 fMethods
[kPMShutdownSystem
].flags
= kIOUCScalarIScalarO
;
103 fMethods
[kPMRestartSystem
].object
= provider
; // 6
104 fMethods
[kPMRestartSystem
].func
= (IOMethod
)&IOPMrootDomain::restartSystem
;
105 fMethods
[kPMRestartSystem
].count0
= 0;
106 fMethods
[kPMRestartSystem
].count1
= 0;
107 fMethods
[kPMRestartSystem
].flags
= kIOUCScalarIScalarO
;
113 IOReturn
RootDomainUserClient::clientClose( void )
117 return kIOReturnSuccess
;
120 IOReturn
RootDomainUserClient::clientDied( void )
122 return( clientClose());
126 RootDomainUserClient::getExternalMethodForIndex( UInt32 index
)
128 if(index
>= kNumPMMethods
)
131 return &fMethods
[index
];
135 RootDomainUserClient::registerNotificationPort(
136 mach_port_t port
, UInt32 type
)
138 return kIOReturnUnsupported
;