]>
Commit | Line | Data |
---|---|---|
1 | /* | |
2 | * Copyright (c) 1998-2000 Apple Computer, Inc. All rights reserved. | |
3 | * | |
4 | * @APPLE_LICENSE_HEADER_START@ | |
5 | * | |
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. | |
11 | * | |
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 | |
18 | * under the License. | |
19 | * | |
20 | * @APPLE_LICENSE_HEADER_END@ | |
21 | */ | |
22 | /* | |
23 | * Copyright (c) 1999 Apple Computer, Inc. All rights reserved. | |
24 | * | |
25 | */ | |
26 | ||
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> | |
32 | ||
33 | #define super IOUserClient | |
34 | ||
35 | /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ | |
36 | ||
37 | OSDefineMetaClassAndStructors(RootDomainUserClient, IOUserClient) | |
38 | ||
39 | /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ | |
40 | ||
41 | bool RootDomainUserClient::start( IOService * provider ) | |
42 | { | |
43 | assert(OSDynamicCast(IOPMrootDomain, provider)); | |
44 | if(!super::start(provider)) | |
45 | return false; | |
46 | fOwner = (IOPMrootDomain *)provider; | |
47 | ||
48 | ||
49 | return true; | |
50 | } | |
51 | ||
52 | ||
53 | IOReturn RootDomainUserClient::clientClose( void ) | |
54 | { | |
55 | detach(fOwner); | |
56 | return kIOReturnSuccess; | |
57 | } | |
58 | ||
59 | IOExternalMethod * | |
60 | RootDomainUserClient::getTargetAndMethodForIndex( IOService ** targetP, UInt32 index ) | |
61 | { | |
62 | static IOExternalMethod sMethods[] = { | |
63 | { // kPMSetAggressiveness, 0 | |
64 | 0, (IOMethod)&IOPMrootDomain::setAggressiveness, kIOUCScalarIScalarO, 2, 0 | |
65 | }, | |
66 | { // kPMGetAggressiveness, 1 | |
67 | 0, (IOMethod)&IOPMrootDomain::getAggressiveness, kIOUCScalarIScalarO, 1, 1 | |
68 | }, | |
69 | { // kPMSleepSystem, 2 | |
70 | 0, (IOMethod)&IOPMrootDomain::sleepSystem, kIOUCScalarIScalarO, 0, 0 | |
71 | }, | |
72 | { // kPMAllowPowerChange, 3 | |
73 | 0, (IOMethod)&IOPMrootDomain::allowPowerChange, kIOUCScalarIScalarO, 1, 0 | |
74 | }, | |
75 | { // kPMCancelPowerChange, 4 | |
76 | 0, (IOMethod)&IOPMrootDomain::cancelPowerChange, kIOUCScalarIScalarO, 1, 0 | |
77 | }, | |
78 | { // kPMShutdownSystem, 5 | |
79 | 0, (IOMethod)&IOPMrootDomain::shutdownSystem, kIOUCScalarIScalarO, 0, 0 | |
80 | }, | |
81 | { // kPMRestartSystem, 6 | |
82 | 0, (IOMethod)&IOPMrootDomain::restartSystem, kIOUCScalarIScalarO, 0, 0 | |
83 | }, | |
84 | { // kPMSetPreventative, 7 | |
85 | 1, (IOMethod) &RootDomainUserClient::setPreventative, kIOUCScalarIScalarO, 2, 0 | |
86 | }, | |
87 | }; | |
88 | ||
89 | if(index >= kNumPMMethods) | |
90 | return NULL; | |
91 | else { | |
92 | if (sMethods[index].object) | |
93 | *targetP = this; | |
94 | else | |
95 | *targetP = fOwner; | |
96 | ||
97 | return &sMethods[index]; | |
98 | } | |
99 | } | |
100 | ||
101 | void | |
102 | RootDomainUserClient::setPreventative(UInt32 on_off, UInt32 types_of_sleep) | |
103 | { | |
104 | return; | |
105 | } | |
106 |