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 bool RootDomainUserClient::start( IOService
* provider
)
46 assert(OSDynamicCast(IOPMrootDomain
, provider
));
47 if(!super::start(provider
))
49 fOwner
= (IOPMrootDomain
*)provider
;
56 IOReturn
RootDomainUserClient::clientClose( void )
59 return kIOReturnSuccess
;
63 RootDomainUserClient::getTargetAndMethodForIndex( IOService
** targetP
, UInt32 index
)
65 static IOExternalMethod sMethods
[] = {
66 { // kPMSetAggressiveness, 0
67 0, (IOMethod
)&IOPMrootDomain::setAggressiveness
, kIOUCScalarIScalarO
, 2, 0
69 { // kPMGetAggressiveness, 1
70 0, (IOMethod
)&IOPMrootDomain::getAggressiveness
, kIOUCScalarIScalarO
, 1, 1
72 { // kPMSleepSystem, 2
73 0, (IOMethod
)&IOPMrootDomain::sleepSystem
, kIOUCScalarIScalarO
, 0, 0
75 { // kPMAllowPowerChange, 3
76 0, (IOMethod
)&IOPMrootDomain::allowPowerChange
, kIOUCScalarIScalarO
, 1, 0
78 { // kPMCancelPowerChange, 4
79 0, (IOMethod
)&IOPMrootDomain::cancelPowerChange
, kIOUCScalarIScalarO
, 1, 0
81 { // kPMShutdownSystem, 5
82 0, (IOMethod
)&IOPMrootDomain::shutdownSystem
, kIOUCScalarIScalarO
, 0, 0
84 { // kPMRestartSystem, 6
85 0, (IOMethod
)&IOPMrootDomain::restartSystem
, kIOUCScalarIScalarO
, 0, 0
87 { // kPMSetPreventative, 7
88 1, (IOMethod
) &RootDomainUserClient::setPreventative
, kIOUCScalarIScalarO
, 2, 0
92 if(index
>= kNumPMMethods
)
95 if (sMethods
[index
].object
)
100 return &sMethods
[index
];
105 RootDomainUserClient::setPreventative(UInt32 on_off
, UInt32 types_of_sleep
)