2 * Copyright (c) 1998-2000 Apple Computer, Inc. All rights reserved.
4 * @APPLE_LICENSE_HEADER_START@
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.
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
20 * @APPLE_LICENSE_HEADER_END@
23 * Copyright (c) 1999 Apple Computer, Inc. All rights reserved.
27 #include <IOKit/assert.h>
28 #include <IOKit/IOLib.h>
29 #include <IOKit/IOBufferMemoryDescriptor.h>
30 #include "RootDomainUserClient.h"
31 #include <IOKit/pwr_mgt/IOPMLibDefs.h>
33 #define super IOUserClient
35 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
37 OSDefineMetaClassAndStructors(RootDomainUserClient
, IOUserClient
)
39 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
41 bool RootDomainUserClient::start( IOService
* provider
)
43 assert(OSDynamicCast(IOPMrootDomain
, provider
));
44 if(!super::start(provider
))
46 fOwner
= (IOPMrootDomain
*)provider
;
53 IOReturn
RootDomainUserClient::clientClose( void )
56 return kIOReturnSuccess
;
60 RootDomainUserClient::getTargetAndMethodForIndex( IOService
** targetP
, UInt32 index
)
62 static IOExternalMethod sMethods
[] = {
63 { // kPMSetAggressiveness, 0
64 0, (IOMethod
)&IOPMrootDomain::setAggressiveness
, kIOUCScalarIScalarO
, 2, 0
66 { // kPMGetAggressiveness, 1
67 0, (IOMethod
)&IOPMrootDomain::getAggressiveness
, kIOUCScalarIScalarO
, 1, 1
69 { // kPMSleepSystem, 2
70 0, (IOMethod
)&IOPMrootDomain::sleepSystem
, kIOUCScalarIScalarO
, 0, 0
72 { // kPMAllowPowerChange, 3
73 0, (IOMethod
)&IOPMrootDomain::allowPowerChange
, kIOUCScalarIScalarO
, 1, 0
75 { // kPMCancelPowerChange, 4
76 0, (IOMethod
)&IOPMrootDomain::cancelPowerChange
, kIOUCScalarIScalarO
, 1, 0
78 { // kPMShutdownSystem, 5
79 0, (IOMethod
)&IOPMrootDomain::shutdownSystem
, kIOUCScalarIScalarO
, 0, 0
81 { // kPMRestartSystem, 6
82 0, (IOMethod
)&IOPMrootDomain::restartSystem
, kIOUCScalarIScalarO
, 0, 0
84 { // kPMSetPreventative, 7
85 1, (IOMethod
) &RootDomainUserClient::setPreventative
, kIOUCScalarIScalarO
, 2, 0
89 if(index
>= kNumPMMethods
)
92 if (sMethods
[index
].object
)
97 return &sMethods
[index
];
102 RootDomainUserClient::setPreventative(UInt32 on_off
, UInt32 types_of_sleep
)