|
|
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: extern "C" { ! 30: #include <machine/machine_routines.h> ! 31: } ! 32: ! 33: #include <IOKit/IODeviceTreeSupport.h> ! 34: ! 35: #include "Gossamer.h" ! 36: ! 37: /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ ! 38: ! 39: #define super ApplePlatformExpert ! 40: ! 41: OSDefineMetaClassAndStructors(GossamerPE, ApplePlatformExpert); ! 42: ! 43: /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ ! 44: ! 45: bool GossamerPE::start(IOService *provider) ! 46: { ! 47: unsigned int tmpVal; ! 48: ! 49: setFamily(2); // Gossamer... ! 50: ! 51: // Set the machine type. ! 52: if (IODTMatchNubWithKeys(provider, "'AAPL,Gossamer'")) ! 53: machineType = kGossamerTypeGossamer; ! 54: else if (IODTMatchNubWithKeys(provider, "'AAPL,PowerMac G3'")) ! 55: machineType = kGossamerTypeSilk; ! 56: else if (IODTMatchNubWithKeys(provider, "'AAPL,PowerBook1998'")) ! 57: machineType = kGossamerTypeWallstreet; ! 58: else if (IODTMatchNubWithKeys(provider, "'iMac,1'")) ! 59: machineType = kGossamerTypeiMac; ! 60: else if (IODTMatchNubWithKeys(provider, "('PowerMac1,1', 'PowerMac1,2')")) ! 61: machineType = kGossamerTypeYosemite; ! 62: else if (IODTMatchNubWithKeys(provider, "'PowerBook1,1'")) ! 63: machineType = kGossamerType101; ! 64: ! 65: // Find out if this an all in one. ! 66: allInOne = 0; ! 67: if (ml_probe_read(kGossamerMachineIDReg, &tmpVal)) { ! 68: switch (machineType) { ! 69: case kGossamerTypeGossamer : ! 70: case kGossamerTypeSilk : ! 71: if (!(tmpVal & kGossamerAllInOneMask)) allInOne = 1; ! 72: break; ! 73: ! 74: case kGossamerTypeiMac : ! 75: allInOne = 1; ! 76: break; ! 77: } ! 78: } ! 79: ! 80: return super::start(provider); ! 81: } ! 82: ! 83: ! 84: static unsigned long gossamerSpeed[] = { 66820000, 1 }; ! 85: static unsigned long yosemiteSpeed[] = { 99730000, 1 }; ! 86: ! 87: void GossamerPE::getDefaultBusSpeeds(int *numSpeeds, ! 88: unsigned long **speedList) ! 89: { ! 90: if ((numSpeeds == 0) || (speedList == 0)) return; ! 91: ! 92: switch (machineType) { ! 93: case kGossamerTypeGossamer : ! 94: case kGossamerTypeSilk : ! 95: *numSpeeds = 1; ! 96: *speedList = gossamerSpeed; ! 97: break; ! 98: ! 99: case kGossamerTypeYosemite : ! 100: *numSpeeds = 1; ! 101: *speedList = yosemiteSpeed; ! 102: break; ! 103: ! 104: default : ! 105: *numSpeeds = 0; ! 106: *speedList = 0; ! 107: break; ! 108: } ! 109: } ! 110: ! 111: ! 112: bool GossamerPE::platformAdjustService(IOService *service) ! 113: { ! 114: long tmpNum; ! 115: OSData *tmpData; ! 116: ! 117: // Add the extra sound properties for Gossamer AIO ! 118: if (allInOne && ((machineType == kGossamerTypeGossamer) || ! 119: (machineType == kGossamerTypeSilk))) { ! 120: if (!strcmp(service->getName(), "sound")) { ! 121: tmpNum = 3; ! 122: tmpData = OSData::withBytes(&tmpNum, sizeof(tmpNum)); ! 123: if (tmpData) { ! 124: service->setProperty("#-detects", tmpData); ! 125: service->setProperty("#-outputs", tmpData); ! 126: tmpData->release(); ! 127: } ! 128: return true; ! 129: } ! 130: } ! 131: ! 132: // Set the loop snoop property for Wallstreet or Mainstreet. ! 133: if (machineType == kGossamerTypeWallstreet) { ! 134: if (IODTMatchNubWithKeys(service, "('grackle', 'MOT,PPC106')")) { ! 135: // Add the property for set loop snoop. ! 136: service->setProperty("set-loop-snoop", service); ! 137: return true; ! 138: } ! 139: } ! 140: ! 141: // Publish out the dual display heads on 101. ! 142: if (machineType == kGossamerType101) { ! 143: if (!strcmp(service->getName(), "ATY,LTProParent")) { ! 144: if (kIOReturnSuccess == IONDRVLibrariesInitialize(service)) { ! 145: createNubs(this, service->getChildIterator( gIODTPlane )); ! 146: } ! 147: return true; ! 148: } ! 149: } ! 150: ! 151: return true; ! 152: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.