|
|
1.1 ! root 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: RootDomainUserClient *RootDomainUserClient::withTask(task_t owningTask) ! 42: { ! 43: RootDomainUserClient *me; ! 44: ! 45: me = new RootDomainUserClient; ! 46: if(me) { ! 47: if(!me->init()) { ! 48: me->release(); ! 49: return NULL; ! 50: } ! 51: me->fTask = owningTask; ! 52: } ! 53: return me; ! 54: } ! 55: ! 56: bool RootDomainUserClient::start( IOService * provider ) ! 57: { ! 58: assert(OSDynamicCast(IOPMrootDomain, provider)); ! 59: if(!super::start(provider)) ! 60: return false; ! 61: fOwner = (IOPMrootDomain *)provider; ! 62: ! 63: // Got the owner, so initialize the call structures ! 64: fMethods[kPMSetAggressiveness].object = provider; ! 65: fMethods[kPMSetAggressiveness].func = (IOMethod)&IOPMrootDomain::setAggressiveness; ! 66: fMethods[kPMSetAggressiveness].count0 = 2; ! 67: fMethods[kPMSetAggressiveness].count1 = 0; ! 68: fMethods[kPMSetAggressiveness].flags = kIOUCScalarIScalarO; ! 69: ! 70: fMethods[kPMGetAggressiveness].object = provider; ! 71: fMethods[kPMGetAggressiveness].func = (IOMethod)&IOPMrootDomain::getAggressiveness; ! 72: fMethods[kPMGetAggressiveness].count0 = 1; ! 73: fMethods[kPMGetAggressiveness].count1 = 1; ! 74: fMethods[kPMGetAggressiveness].flags = kIOUCScalarIScalarO; ! 75: ! 76: fMethods[kPMSleepSystem].object = provider; ! 77: fMethods[kPMSleepSystem].func = (IOMethod)&IOPMrootDomain::sleepSystem; ! 78: fMethods[kPMSleepSystem].count0 = 0; ! 79: fMethods[kPMSleepSystem].count1 = 0; ! 80: fMethods[kPMSleepSystem].flags = kIOUCScalarIScalarO; ! 81: ! 82: fMethods[kPMWakeSystem].object = provider; ! 83: fMethods[kPMWakeSystem].func = (IOMethod)&IOPMrootDomain::wakeSystem; ! 84: fMethods[kPMWakeSystem].count0 = 0; ! 85: fMethods[kPMWakeSystem].count1 = 0; ! 86: fMethods[kPMWakeSystem].flags = kIOUCScalarIScalarO; ! 87: ! 88: return true; ! 89: } ! 90: ! 91: ! 92: IOReturn RootDomainUserClient::clientClose( void ) ! 93: { ! 94: detach( fOwner); ! 95: ! 96: return kIOReturnSuccess; ! 97: } ! 98: ! 99: IOReturn RootDomainUserClient::clientDied( void ) ! 100: { ! 101: return( clientClose()); ! 102: } ! 103: ! 104: IOExternalMethod * ! 105: RootDomainUserClient::getExternalMethodForIndex( UInt32 index ) ! 106: { ! 107: if(index >= kNumPMMethods) ! 108: return NULL; ! 109: else ! 110: return &fMethods[index]; ! 111: } ! 112: ! 113: IOReturn ! 114: RootDomainUserClient::registerNotificationPort( ! 115: mach_port_t port, UInt32 type ) ! 116: { ! 117: return kIOReturnUnsupported; ! 118: } ! 119:
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.