]>
git.saurik.com Git - apple/xnu.git/blob - iokit/Drivers/platform/drvAppleRootDomain/RootDomainUserClient.cpp
35fd5aa28e62566d065a4758edc78ba04ed669a6
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 RootDomainUserClient
*RootDomainUserClient::withTask(task_t owningTask
)
43 RootDomainUserClient
*me
;
45 me
= new RootDomainUserClient
;
51 me
->fTask
= owningTask
;
56 bool RootDomainUserClient::start( IOService
* provider
)
58 assert(OSDynamicCast(IOPMrootDomain
, provider
));
59 if(!super::start(provider
))
61 fOwner
= (IOPMrootDomain
*)provider
;
63 // Got the owner, so initialize the call structures
64 fMethods
[kPMSetAggressiveness
].object
= provider
; // 0
65 fMethods
[kPMSetAggressiveness
].func
= (IOMethod
)&IOPMrootDomain::setAggressiveness
;
66 fMethods
[kPMSetAggressiveness
].count0
= 2;
67 fMethods
[kPMSetAggressiveness
].count1
= 0;
68 fMethods
[kPMSetAggressiveness
].flags
= kIOUCScalarIScalarO
;
70 fMethods
[kPMGetAggressiveness
].object
= provider
; // 1
71 fMethods
[kPMGetAggressiveness
].func
= (IOMethod
)&IOPMrootDomain::getAggressiveness
;
72 fMethods
[kPMGetAggressiveness
].count0
= 1;
73 fMethods
[kPMGetAggressiveness
].count1
= 1;
74 fMethods
[kPMGetAggressiveness
].flags
= kIOUCScalarIScalarO
;
76 fMethods
[kPMSleepSystem
].object
= provider
; // 2
77 fMethods
[kPMSleepSystem
].func
= (IOMethod
)&IOPMrootDomain::sleepSystem
;
78 fMethods
[kPMSleepSystem
].count0
= 0;
79 fMethods
[kPMSleepSystem
].count1
= 0;
80 fMethods
[kPMSleepSystem
].flags
= kIOUCScalarIScalarO
;
82 fMethods
[kPMAllowPowerChange
].object
= provider
; // 3
83 fMethods
[kPMAllowPowerChange
].func
= (IOMethod
)&IOPMrootDomain::allowPowerChange
;
84 fMethods
[kPMAllowPowerChange
].count0
= 1;
85 fMethods
[kPMAllowPowerChange
].count1
= 0;
86 fMethods
[kPMAllowPowerChange
].flags
= kIOUCScalarIScalarO
;
88 fMethods
[kPMCancelPowerChange
].object
= provider
; // 4
89 fMethods
[kPMCancelPowerChange
].func
= (IOMethod
)&IOPMrootDomain::cancelPowerChange
;
90 fMethods
[kPMCancelPowerChange
].count0
= 1;
91 fMethods
[kPMCancelPowerChange
].count1
= 0;
92 fMethods
[kPMCancelPowerChange
].flags
= kIOUCScalarIScalarO
;
94 fMethods
[kPMShutdownSystem
].object
= provider
; // 5
95 fMethods
[kPMShutdownSystem
].func
= (IOMethod
)&IOPMrootDomain::shutdownSystem
;
96 fMethods
[kPMShutdownSystem
].count0
= 0;
97 fMethods
[kPMShutdownSystem
].count1
= 0;
98 fMethods
[kPMShutdownSystem
].flags
= kIOUCScalarIScalarO
;
100 fMethods
[kPMRestartSystem
].object
= provider
; // 6
101 fMethods
[kPMRestartSystem
].func
= (IOMethod
)&IOPMrootDomain::restartSystem
;
102 fMethods
[kPMRestartSystem
].count0
= 0;
103 fMethods
[kPMRestartSystem
].count1
= 0;
104 fMethods
[kPMRestartSystem
].flags
= kIOUCScalarIScalarO
;
110 IOReturn
RootDomainUserClient::clientClose( void )
114 return kIOReturnSuccess
;
117 IOReturn
RootDomainUserClient::clientDied( void )
119 return( clientClose());
123 RootDomainUserClient::getExternalMethodForIndex( UInt32 index
)
125 if(index
>= kNumPMMethods
)
128 return &fMethods
[index
];
132 RootDomainUserClient::registerNotificationPort(
133 mach_port_t port
, UInt32 type
)
135 return kIOReturnUnsupported
;