コード例 #1
0
void BrcmPatchRAM::stop(IOService* provider)
{
    uint64_t stop_time, nano_secs;
    clock_get_uptime(&stop_time);
    absolutetime_to_nanoseconds(stop_time - wake_time, &nano_secs);
    uint64_t milli_secs = nano_secs / 1000000;
    AlwaysLog("Time since wake %llu.%llu seconds.\n", milli_secs / 1000, milli_secs % 1000);


    DebugLog("stop\n");

    OSSafeReleaseNULL(mFirmwareStore);

    IOWorkLoop* workLoop = getWorkLoop();
    if (workLoop)
    {
        if (mTimer)
        {
            mTimer->cancelTimeout();
            workLoop->removeEventSource(mTimer);
            mTimer->release();
            mTimer = NULL;
        }
        if (mWorkSource)
        {
            workLoop->removeEventSource(mWorkSource);
            mWorkSource->release();
            mWorkSource = NULL;
            mWorkPending = 0;
        }
    }

    PMstop();

    if (mCompletionLock)
    {
        IOLockFree(mCompletionLock);
        mCompletionLock = NULL;
    }
    if (mWorkLock)
    {
        IOLockFree(mWorkLock);
        mWorkLock = NULL;
    }

    OSSafeReleaseNULL(mDevice);

    super::stop(provider);
}
コード例 #2
0
bool BrcmPatchRAM::start(IOService *provider)
{
    DebugLog("start\n");

    if (!super::start(provider))
        return false;
    
    // add interrupt source for delayed actions...
    IOWorkLoop* workLoop = getWorkLoop();
    if (!workLoop)
        return false;
    mWorkSource = IOInterruptEventSource::interruptEventSource(this, OSMemberFunctionCast(IOInterruptEventAction, this, &BrcmPatchRAM::processWorkQueue));
    if (!mWorkSource)
        return false;
    workLoop->addEventSource(mWorkSource);
    mWorkPending = 0;

    // add timer for firmware load in the case no re-probe after wake
    mTimer = IOTimerEventSource::timerEventSource(this, OSMemberFunctionCast(IOTimerEventSource::Action, this, &BrcmPatchRAM::onTimerEvent));
    if (!mTimer)
    {
        workLoop->removeEventSource(mWorkSource);
        mWorkSource->release();
        mWorkSource = NULL;
        return false;
    }
    workLoop->addEventSource(mTimer);

    // register for power state notifications
    PMinit();
    registerPowerDriver(this, myTwoStates, 2);
    provider->joinPMtree(this);
    
    return true;
}
コード例 #3
0
void IOHIDEventSystemUserClient::stop( IOService * provider )
{
    IOWorkLoop * workLoop = getWorkLoop();
    if (workLoop && commandGate)
    {
        workLoop->removeEventSource(commandGate);
    }
}
コード例 #4
0
void SoftU2FUserClient::stop(IOService *provider) {
  IOLog("%s[%p]::%s(%p)\n", getName(), this, __FUNCTION__, provider);

  IOWorkLoop *workLoop = getWorkLoop();
  if (workLoop && _commandGate)
    workLoop->removeEventSource(_commandGate);

  super::stop(provider);
}
コード例 #5
0
void ACPIBacklightPanel::stop( IOService * provider )
{
    DbgLog("%s::%s()\n", this->getName(),__FUNCTION__);

    IOWorkLoop* workLoop = getWorkLoop();
    if (workLoop)
    {
        if (_workSource)
        {
            workLoop->removeEventSource(_workSource);
            _workSource->release();
            _workSource = NULL;
        }
        if (_smoothTimer)
        {
            workLoop->removeEventSource(_smoothTimer);
            _smoothTimer->release();
            _smoothTimer = NULL;
        }
        if (_cmdGate)
        {
            workLoop->removeEventSource(_cmdGate);
            _cmdGate->release();
            _cmdGate = NULL;
        }
    }
    _extended = false;

    if (_lock)
    {
        IORecursiveLockFree(_lock);
        _lock = NULL;
    }

#if 0
    OSSafeReleaseNULL(_provider);
#endif

    _backlightHandler = NULL;

    super::stop(provider);
}
コード例 #6
0
void IOFireWireSBP2LUN::free( void )
{
	FWKLOG( ( "IOFireWireSBP2LUN<%p> : free\n", this ) );

	//
	// free unreleased orbs
	//
	
//	flushAllManagementORBs();
		
	if( fORBSetIterator )			
		fORBSetIterator->release();

	if( fORBSet )
		fORBSet->release();

    //
    // release login set
    //
    
	if( fLoginSetIterator )			
		fLoginSetIterator->release();

	if( fLoginSet )
		fLoginSet->release();

	//
	// destroy command gate
	//
	
	if( fGate != NULL )
	{
		IOWorkLoop * workLoop = NULL;

		workLoop = fGate->getWorkLoop();
		workLoop->removeEventSource( fGate );
		workLoop->release();

		fGate->release();
		fGate = NULL;
	}
	
	if( fProviderTarget )
	{
		fProviderTarget->release();
		fProviderTarget = NULL;
	}
			
	IOService::free();
}
コード例 #7
0
ファイル: IOCommandPool.cpp プロジェクト: JackieXie168/xnu
void
IOCommandPool::free(void)
{
    if (fSerializer) {
        // remove our event source from owner's workloop
        IOWorkLoop *wl = fSerializer->getWorkLoop();
        if (wl)
            wl->removeEventSource(fSerializer);

        fSerializer->release();
        fSerializer = 0;
    }

    // Tell our superclass to cleanup too
    super::free();
}
コード例 #8
0
bool org_virtualbox_VBoxGuest::disableVmmDevInterrupts(void)
{
    IOWorkLoop *pWorkLoop = (IOWorkLoop *)getWorkLoop();

    if (!pWorkLoop)
        return false;

    if (!m_pInterruptSrc)
        return false;

    m_pInterruptSrc->disable();
    pWorkLoop->removeEventSource(m_pInterruptSrc);
    m_pInterruptSrc->release();
    m_pInterruptSrc = NULL;

    return true;
}
コード例 #9
0
bool BrcmPatchRAM::start(IOService *provider)
{
    DebugLog("start\n");

    if (!super::start(provider))
        return false;

    // place version/build info in ioreg properties RM,Build and RM,Version
    char buf[128];
    snprintf(buf, sizeof(buf), "%s %s", OSKextGetCurrentIdentifier(), OSKextGetCurrentVersionString());
    setProperty("RM,Version", buf);
#ifdef DEBUG
    setProperty("RM,Build", "Debug-" LOGNAME);
#else
    setProperty("RM,Build", "Release-" LOGNAME);
#endif

   // add interrupt source for delayed actions...
    IOWorkLoop* workLoop = getWorkLoop();
    if (!workLoop)
        return false;
    mWorkSource = IOInterruptEventSource::interruptEventSource(this, OSMemberFunctionCast(IOInterruptEventAction, this, &BrcmPatchRAM::processWorkQueue));
    if (!mWorkSource)
        return false;
    workLoop->addEventSource(mWorkSource);
    mWorkPending = 0;

    // add timer for firmware load in the case no re-probe after wake
    mTimer = IOTimerEventSource::timerEventSource(this, OSMemberFunctionCast(IOTimerEventSource::Action, this, &BrcmPatchRAM::onTimerEvent));
    if (!mTimer)
    {
        workLoop->removeEventSource(mWorkSource);
        mWorkSource->release();
        mWorkSource = NULL;
        return false;
    }
    workLoop->addEventSource(mTimer);

    // register for power state notifications
    PMinit();
    registerPowerDriver(this, myTwoStates, 2);
    provider->joinPMtree(this);
    
    return true;
}
コード例 #10
0
// Shut down the driver
void WirelessHIDDevice::handleStop(IOService *provider)
{
    WirelessDevice *device = OSDynamicCast(WirelessDevice, provider);

    if (device != NULL)
        device->RegisterWatcher(NULL, NULL, NULL);

    if (serialTimer != NULL) {
        serialTimer->cancelTimeout();
        IOWorkLoop *workloop = getWorkLoop();
        if (workloop != NULL)
            workloop->removeEventSource(serialTimer);
        serialTimer->release();
        serialTimer = NULL;
    }
    
    super::handleStop(provider);
}
コード例 #11
0
void BatteryTracker::stop(IOService* provider)
{
    DEBUG_LOG("BatteryTracker::stop: entering stop\n");
    
    OSSafeReleaseNULL(m_pBatteryList);
    if (NULL != m_pLock)
    {
        IORecursiveLockFree(m_pLock);
        m_pLock = NULL;
    }
    if (m_pCmdGate)
    {
        IOWorkLoop* pWorkLoop = getWorkLoop();
        if (pWorkLoop)
            pWorkLoop->removeEventSource(m_pCmdGate);
        m_pCmdGate->release();
        m_pCmdGate = NULL;
    }
    
    IOService::stop(provider);
}
コード例 #12
0
void AppleSmartBatteryManager::stop(IOService *provider)
{
	DEBUG_LOG("AppleSmartBatteryManager::stop: called\n");
	
    fBattery->detach(this);
    
    fBattery->free();
    fBattery->stop(this);
    fBattery->terminate();
    fBattery = NULL;
    
    IOWorkLoop *wl = getWorkLoop();
    if (wl) {
        wl->removeEventSource(fBatteryGate);
    }

    fBatteryGate->free();
    fBatteryGate = NULL;
    
	PMstop();
    
    super::stop(provider);
}
コード例 #13
0
ファイル: IrDAComm.cpp プロジェクト: JeremyAgost/osx-10.9
void IrDAComm::free()
{
    IOWorkLoop *workloop;
    
    XTRACE(kLogFree, 0, this);
    
    this->Stop();       // make sure we're stopped before releasing memory

    if (fDriver) {
	workloop = fDriver->getWorkLoop();
	if (workloop) {
	    if (fGate)
		workloop->removeEventSource(fGate);
	    //if (fTimerSrc)
	    //  workloop->removeEventSource(fTimerSrc);
	}
    }

#define FREE(x) { if (x) { (x)->release(); x = nil; }}

    FREE(fGate);
    FREE(fTimer);
    FREE(fIrComm);          // free the ircomm object before the rest of irda ...
    FREE(fIrDA);
    
#undef FREE

#define THREAD_FREE(x) do { if (x) {               \
			    thread_call_cancel(x); \
			    thread_call_free(x);   \
			    x = NULL; } } while(0)
    
    THREAD_FREE(fStop_thread);
#undef THREAD_FREE
    
    super::free();      // we're done, call super
}
コード例 #14
0
void ApplePS2Mouse::stop(IOService * provider)
{
  //
  // The driver has been instructed to stop.  Note that we must break all
  // connections to other service objects now (ie. no registered actions,
  // no pointers and retains to objects, etc), if any.
  //

  assert(_device == provider);

  //
  // Disable the mouse itself, so that it may stop reporting mouse events.
  //

  setMouseEnable(false);

  // free up the command gate
  IOWorkLoop* pWorkLoop = getWorkLoop();
  if (pWorkLoop)
  {
    if (_cmdGate)
    {
      pWorkLoop->removeEventSource(_cmdGate);
      _cmdGate->release();
      _cmdGate = 0;
    }
    if (_buttonTimer)
    {
      pWorkLoop->removeEventSource(_buttonTimer);
      _buttonTimer->release();
      _buttonTimer = 0;
    }
  }
    
  //
  // Uninstall the interrupt handler.
  //

  if ( _interruptHandlerInstalled )  _device->uninstallInterruptAction();
  _interruptHandlerInstalled = false;

  //
  // Uninstall the power control handler.
  //

  if ( _powerControlHandlerInstalled ) _device->uninstallPowerControlAction();
  _powerControlHandlerInstalled = false;

  //
  // Uinstall message handler.
  //
  if (_messageHandlerInstalled)
  {
    _device->uninstallMessageAction();
    _messageHandlerInstalled = false;
  }
    
  //
  // Release the pointer to the provider object.
  //

  OSSafeReleaseNULL(_device);;

  super::stop(provider);
}
コード例 #15
0
void BrcmPatchRAM::stop(IOService* provider)
{
#ifdef DEBUG
    uint64_t stop_time, nano_secs;
    clock_get_uptime(&stop_time);
    absolutetime_to_nanoseconds(stop_time - wake_time, &nano_secs);
    uint64_t milli_secs = nano_secs / 1000000;
    AlwaysLog("Time since wake %llu.%llu seconds.\n", milli_secs / 1000, milli_secs % 1000);
#endif

    DebugLog("stop\n");

#if 0
#ifndef TARGET_ELCAPITAN
//REVIEW: so kext can be unloaded with kextunload -p
    // unload native bluetooth driver
    IOReturn result = gIOCatalogue->terminateDriversForModule(brcmBundleIdentifier, false);
    if (result != kIOReturnSuccess)
        AlwaysLog("[%04x:%04x]: failure terminating native Broadcom bluetooth (%08x)\n", mVendorId, mProductId, result);
    else
        DebugLog("[%04x:%04x]: success terminating native Broadcom bluetooth\n", mVendorId, mProductId);

    // unpublish native bluetooth personality
    removePersonality();
#endif
#endif

    mStopping = true;

    // allow firmware load already started to finish
    IOLockLock(mLoadFirmwareLock);

    OSSafeReleaseNULL(mFirmwareStore);

    IOWorkLoop* workLoop = getWorkLoop();
    if (workLoop)
    {
        if (mTimer)
        {
            mTimer->cancelTimeout();
            workLoop->removeEventSource(mTimer);
            mTimer->release();
            mTimer = NULL;
        }
        if (mWorkSource)
        {
            workLoop->removeEventSource(mWorkSource);
            mWorkSource->release();
            mWorkSource = NULL;
            mWorkPending = 0;
        }
    }

    PMstop();

    if (mCompletionLock)
    {
        IOLockFree(mCompletionLock);
        mCompletionLock = NULL;
    }
#ifndef NON_RESIDENT
    if (mWorkLock)
    {
        IOLockFree(mWorkLock);
        mWorkLock = NULL;
    }

    IOLockUnlock(mLoadFirmwareLock);
#endif // #ifndef NON_RESIDENT

    mDevice.setDevice(NULL);

    mStopping = false;

    super::stop(provider);
}
コード例 #16
0
void
IOATABlockStorageDriver::free ( void )
{

	IOWorkLoop *	workLoop;
	
	if ( fCommandPool != NULL )
	{
		
		deallocateATACommandObjects ( );
		fCommandPool->release ( );
		fCommandPool = NULL;
		
	}
		
	if ( fCommandGate != NULL )
	{
		
		workLoop = getWorkLoop ( );
		if ( workLoop != NULL )
		{
		
			workLoop->removeEventSource ( fCommandGate );
		
		}
		
		fCommandGate->release ( );
		fCommandGate = NULL;
		
	}
	
	if ( fPowerManagementThread != NULL )
	{
		
		thread_call_free ( fPowerManagementThread );
		
	}
	
	if ( reserved != NULL )
	{
		
		// Release all memory/objects associated with the reserved fields.
		if ( fPowerDownNotifier != NULL )
		{
			
			// remove() will also call release() on this object (IONotifier).
			// See IONotifier.h for more info.
			fPowerDownNotifier->remove ( );
			fPowerDownNotifier = NULL;
			
		}
		
		IOFree ( reserved, sizeof ( ExpansionData ) );
		reserved = NULL;
		
	}
	
	if ( fDeviceIdentifyBuffer != NULL )
	{
		
		fDeviceIdentifyBuffer->complete ( );
		fDeviceIdentifyBuffer->release ( );
		fDeviceIdentifyBuffer = NULL;
		
	}
	
	super::free ( );
	
}