|
|
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: * DRI: Josh de Cesare ! 26: * ! 27: */ ! 28: ! 29: #include <IOKit/IODeviceTreeSupport.h> ! 30: ! 31: #include "PowerExpress.h" ! 32: ! 33: /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ ! 34: ! 35: #define super ApplePlatformExpert ! 36: ! 37: OSDefineMetaClassAndStructors(PowerExpressPE, ApplePlatformExpert); ! 38: ! 39: /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ ! 40: ! 41: bool PowerExpressPE::start(IOService *provider) ! 42: { ! 43: OSData *tmpData; ! 44: ! 45: setFamily(3); // PowerExpress... ! 46: ! 47: tmpData = OSDynamicCast(OSData, getProperty("senses")); ! 48: if (tmpData) senseArray = (long *)tmpData->getBytesNoCopy(); ! 49: ! 50: return super::start(provider); ! 51: } ! 52: ! 53: bool PowerExpressPE::platformAdjustService(IOService *service) ! 54: { ! 55: long cnt, numInterrupts, sourceNumbers[2]; ! 56: OSData *tmpData; ! 57: OSArray *controllers, *specifiers; ! 58: OSSymbol *controller; ! 59: ! 60: // Fix up the interrupt data. ! 61: controllers = OSDynamicCast(OSArray, service->getProperty(gIOInterruptControllersKey)); ! 62: specifiers = OSDynamicCast(OSArray, service->getProperty(gIOInterruptSpecifiersKey)); ! 63: if (controllers && specifiers) { ! 64: numInterrupts = specifiers->getCount(); ! 65: for (cnt = 0; cnt < numInterrupts; cnt++) { ! 66: // Only change interrupts for MPIC. ! 67: controller = OSDynamicCast(OSSymbol, controllers->getObject(cnt)); ! 68: if (controller == gIODTDefaultInterruptController) { ! 69: tmpData = OSDynamicCast(OSData, specifiers->getObject(cnt)); ! 70: if (tmpData && (tmpData->getLength() == 4)) { ! 71: sourceNumbers[0] = *(long *)tmpData->getBytesNoCopy(); ! 72: sourceNumbers[1] = senseArray[sourceNumbers[0]]; ! 73: tmpData = OSData::withBytes(sourceNumbers, 2 * sizeof(long)); ! 74: if (tmpData) { ! 75: specifiers->setObject(cnt, tmpData); ! 76: tmpData->release(); ! 77: } ! 78: } ! 79: } ! 80: } ! 81: } ! 82: ! 83: return true; ! 84: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.