bool IOFireWirePCRSpace::init(IOFireWireBus *bus) { //IOLog( "IOFireWirePCRSpace::init (0x%08X)\n",(int) this); if(!IOFWPseudoAddressSpace::initFixed(bus, FWAddress(kCSRRegisterSpaceBaseAddressHi, kPCRBaseAddress), sizeof(fBuf), simpleReader, NULL, this)) return false; fDesc = IOMemoryDescriptor::withAddress(fBuf, sizeof(fBuf), kIODirectionOutIn); if (fDesc == NULL) { return false; } IOReturn status = fDesc->prepare(); if( status != kIOReturnSuccess ) { fDesc->release(); fDesc = NULL; return false; } // Output Master Control - 400 Mbit, broadcast channel base 63, 31 output plugs fBuf[0] = OSSwapHostToBigInt32((2 << kIOFWPCRDataRatePhase) | (63 << kIOFWPCRBroadcastBasePhase) | (0xff << kIOFWPCRExtensionPhase) | (31 << kIOFWPCRNumPlugsPhase)); // Input Master Control - 400 Mbit, 31 output plugs fBuf[32] = OSSwapHostToBigInt32((2 << kIOFWPCRDataRatePhase) | (0xff << kIOFWPCRExtensionPhase) | (31 << kIOFWPCRNumPlugsPhase)); fAVCTargetSpace = NULL; // Register for messages from IOFireWireLocalNode to detect bus-resets! IOFireWireController *pFireWireController = OSDynamicCast(IOFireWireController, bus); if (pFireWireController) { IOFireWireLocalNode *pFireWireLocalNode = (pFireWireController)->getLocalNode(pFireWireController); if (pFireWireLocalNode) { // Register with the IOFireWireBus for messages fNotifier = pFireWireLocalNode->registerInterest(gIOGeneralInterest,MyServiceInterestHandler,this,this); } } // Get the pointert to the IOFireWireAVCTargetSpace // Note: This will create it, if it doesn't already exist. fAVCTargetSpace = IOFireWireAVCTargetSpace::getAVCTargetSpace((IOFireWireController*)bus); if(fAVCTargetSpace) fAVCTargetSpace->activateWithUserClient((IOFireWireAVCProtocolUserClient*)0xFFFFFFFF); return true; }
bool IOFireWireIRM::initWithController(IOFireWireController * control) { IOReturn status = kIOReturnSuccess; bool success = OSObject::init(); FWPANICASSERT( success == true ); fControl = control; fIRMNodeID = kFWBadNodeID; fOurNodeID = kFWBadNodeID; fGeneration = 0; // // create BROADCAST_CHANNEL register // fBroadcastChannelBuffer = OSSwapHostToBigInt32( kBroadcastChannelInitialValues ); fBroadcastChannelAddressSpace = IOFWPseudoAddressSpace::simpleRWFixed( fControl, FWAddress(kCSRRegisterSpaceBaseAddressHi, kCSRBroadcastChannel), sizeof(fBroadcastChannelBuffer), &fBroadcastChannelBuffer ); FWPANICASSERT( fBroadcastChannelAddressSpace != NULL ); status = fBroadcastChannelAddressSpace->activate(); FWPANICASSERT( status == kIOReturnSuccess ); // // create lock command // fLockCmdInUse = false; fLockCmd = OSTypeAlloc( IOFWCompareAndSwapCommand ); FWPANICASSERT( fLockCmd != NULL ); fLockCmd->initAll( fControl, 0, FWAddress(), NULL, NULL, 0, IOFireWireIRM::lockCompleteStatic, this ); FWLOCALKLOG(( "IOFireWireIRM::initWithController() - IRM intialized\n" )); return true; }
IOFireWirePCRSpace * IOFireWirePCRSpace::getPCRAddressSpace(IOFireWireBus *bus) { IOFWAddressSpace *existing; IOFireWirePCRSpace *space; //IOLog( "IOFireWirePCRSpace::getPCRAddressSpace\n"); existing = bus->getAddressSpace(FWAddress(kCSRRegisterSpaceBaseAddressHi, kPCRBaseAddress)); if(existing && OSDynamicCast(IOFireWirePCRSpace, existing)) { existing->retain(); return OSDynamicCast(IOFireWirePCRSpace, existing); } space = new IOFireWirePCRSpace; if(space) { if(!space->init(bus)) { space->release(); space = NULL; } } return space; }
} #ifndef __LP64__ ROSETTA_ONLY( { UInt32 i; for( i = 0; i < mSegmentCount; i++ ) { mSegments[i].location = OSSwapInt32( mSegments[i].location ); mSegments[i].length = OSSwapInt32( mSegments[i].length ); } } ); #endif mFWAddress = FWAddress(0, mSegments[0].location, 0) ; } PhysicalAddressSpace::~PhysicalAddressSpace() { // call user client to delete our addr space ref here (if not yet released) uint32_t outputCnt = 0; const uint64_t inputs[1]= {(const uint64_t)mKernPhysicalAddrSpaceRef}; IOConnectCallScalarMethod(mUserClient.GetUserClientConnection(), kReleaseUserObject, inputs,1, NULL,&outputCnt); delete[] mSegments ;