Annotation of XNU/iokit/Drivers/platform/drvApplePowerStarPE/PowerStar.cpp, revision 1.1

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 "PowerStar.h"
        !            32: #include "../drvAppleOHare/OHare.h"
        !            33: 
        !            34: /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
        !            35: 
        !            36: #define super ApplePlatformExpert
        !            37: 
        !            38: OSDefineMetaClassAndStructors(PowerStarPE, ApplePlatformExpert);
        !            39: 
        !            40: /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
        !            41: 
        !            42: bool PowerStarPE::start(IOService *provider)
        !            43: {
        !            44:   setFamily(1); // PowerStar...
        !            45:   
        !            46:   // See if it is a Hooper or Kanga.
        !            47:   if (IODTMatchNubWithKeys(provider, "('AAPL,3400/2400', 'AAPL,3500')")) {
        !            48:     configureEthernet(provider);
        !            49:   }
        !            50:   
        !            51:   return super::start(provider);
        !            52: }
        !            53: 
        !            54: bool PowerStarPE::platformAdjustService(IOService *service)
        !            55: {
        !            56:   if (!strcmp(service->getName(), "chips65550")) {
        !            57:     service->setProperty("Ignore VBL", "", 0);
        !            58:     return true;
        !            59:   }
        !            60:   
        !            61:   return true;
        !            62: }
        !            63: 
        !            64: void PowerStarPE::configureEthernet(IOService *provider)
        !            65: {
        !            66:   OSCollectionIterator *nodeList;
        !            67:   IORegistryEntry      *node, *enet, *ohare;
        !            68:   OSArray              *interruptNames, *interruptSources;
        !            69:   OSSymbol             *interruptControllerName;
        !            70:   OSString             *tmpString;
        !            71:   OSData               *tempData;
        !            72:   long                 tempSource;
        !            73:   
        !            74:   enet = 0;
        !            75:   ohare = 0;
        !            76:   
        !            77:   // Find the node for DEC21041.
        !            78:   nodeList = IODTFindMatchingEntries(provider, kIODTRecursive,
        !            79:                                     "'pci1011,14'");
        !            80:   if (nodeList) {
        !            81:     while ((node = (IORegistryEntry *)nodeList->getNextObject())) {
        !            82:       enet = node;
        !            83:     }
        !            84:     nodeList->release();
        !            85:   }
        !            86:   
        !            87:   if (enet == 0) return;
        !            88:   
        !            89:   // Set the 'Network Connection' property to '10BaseT'.
        !            90:   tmpString = OSString::withCStringNoCopy("10BaseT");
        !            91:   enet->setProperty("Network Connection", tmpString);
        !            92:   
        !            93:   // Add a 'built-in' property so IONetworkStack will treat it as built in.
        !            94:   enet->setProperty("built-in", "", 0);
        !            95:   
        !            96:   // If it is there, find the node for the second ohare.
        !            97:   nodeList = IODTFindMatchingEntries(provider, kIODTRecursive,
        !            98:                                     "'pci106b,7'");
        !            99:   if (nodeList) {
        !           100:     while ((node = (IORegistryEntry *)nodeList->getNextObject())) {
        !           101:       ohare = node;
        !           102:     }
        !           103:     nodeList->release();
        !           104:   }
        !           105:   
        !           106:   if (ohare == 0) return;
        !           107:   
        !           108:   interruptNames = OSDynamicCast(OSArray,
        !           109:                                 enet->getProperty(gIOInterruptControllersKey));
        !           110:   interruptControllerName = (OSSymbol *)OSSymbol::withCStringNoCopy("SecondaryInterruptController");
        !           111:   interruptNames->setObject(0, interruptControllerName);
        !           112:   interruptControllerName->release();
        !           113:   
        !           114:   interruptSources = OSDynamicCast(OSArray,
        !           115:                                enet->getProperty(gIOInterruptSpecifiersKey));
        !           116:   tempSource = 28;
        !           117:   tempData = OSData::withBytes(&tempSource, sizeof(tempSource));
        !           118:   interruptSources->setObject(0, tempData);
        !           119:   tempData->release();
        !           120: }

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.