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.
29 #include <IOKit/IODeviceTreeSupport.h>
31 #include "PowerExpress.h"
33 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
35 #define super ApplePlatformExpert
37 OSDefineMetaClassAndStructors(PowerExpressPE
, ApplePlatformExpert
);
39 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
41 bool PowerExpressPE::start(IOService
*provider
)
45 setChipSetType(kChipSetTypePowerExpress
);
47 tmpData
= OSDynamicCast(OSData
, getProperty("senses"));
48 if (tmpData
) senseArray
= (long *)tmpData
->getBytesNoCopy();
50 return super::start(provider
);
53 bool PowerExpressPE::platformAdjustService(IOService
*service
)
55 long cnt
, numInterrupts
, sourceNumbers
[2];
57 OSArray
*controllers
, *specifiers
;
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));
75 specifiers
->setObject(cnt
, tmpData
);
83 if (IODTMatchNubWithKeys(service
, "open-pic")) {
84 service
->setProperty("InterruptControllerName",
85 gIODTDefaultInterruptController
);