Example #1
0
int
start_def_pager( __unused char *bs_device )
{
/*
	MACH_PORT_FACE		master_device_port;
*/
/*
	MACH_PORT_FACE		security_port;
*/
	__unused static char here[] = "main";




	/* setup read buffers, etc */
	default_pager_initialize();

#ifndef MACH_KERNEL	
	default_pager();
#endif

	if (DEFAULT_PAGER_IS_ACTIVE) {
		/* start the backing store monitor, it runs on a callout thread */
		default_pager_backing_store_monitor_callout = 
			thread_call_allocate(default_pager_backing_store_monitor, NULL);
		if (!default_pager_backing_store_monitor_callout)
			panic("can't start backing store monitor thread");
		thread_call_enter(default_pager_backing_store_monitor_callout);
	}

	return (0);
}
Example #2
0
void checkACStatusUpdate()
{
    cancelACStatusUpdate();
    isStatusThreadCanCancel = false;
    isStatusThreadCancelled = false;
    statusThread = thread_call_allocate(checkACStatusThread, NULL);
    thread_call_enter(statusThread);
}
bool IOEthernetInterface::inputEvent( UInt32 type, void * data )
{
    if ((type == kIONetworkEventTypeLinkUp)   ||
        (type == kIONetworkEventTypeLinkDown) ||
        (type == kIONetworkEventWakeOnLANSupportChanged))
    {
        IONetworkController * ctr = getController();

        if (ctr && !ctr->isInactive())
        {
            // reportInterfaceWakeFlags() callout
            retain();
            ctr->retain();
            if (thread_call_enter( _inputEventThreadCall ) == TRUE)
            {
                release();
                ctr->release();
            }
        }
    }

    if ((type == kIONetworkEventTypeLinkUp) ||
        (type == kIONetworkEventTypeLinkDown))
    {
        ifnet_t ifp = getIfnet();
        const IONetworkLinkEventData * linkData =
            (const IONetworkLinkEventData *) data;

        if (ifp && linkData)
        {
            if ((IOMediumGetNetworkType(linkData->linkType) == kIOMediumEthernet))
            {
                // Ethernet drivers typically don't report link quality,
                // do it for them based on link status.
                if (type == kIONetworkEventTypeLinkUp)
                {
                    ifnet_set_link_quality(ifp, IFNET_LQM_THRESH_GOOD);
                }
                else
                {
                    ifnet_set_link_quality(ifp, IFNET_LQM_THRESH_OFF);
                }
            }
        }
    }

    return super::inputEvent(type, data);
}
Example #4
0
int
start_def_pager( __unused char *bs_device )
{
/*
	MACH_PORT_FACE		master_device_port;
*/
/*
	MACH_PORT_FACE		security_port;
	MACH_PORT_FACE		root_ledger_wired;
	MACH_PORT_FACE		root_ledger_paged;
*/
	__unused static char here[] = "main";



/*
	default_pager_host_port = ipc_port_make_send(realhost.host_priv_self);
	master_device_port = ipc_port_make_send(master_device_port);
	root_ledger_wired = ipc_port_make_send(root_wired_ledger_port);
	root_ledger_paged = ipc_port_make_send(root_paged_ledger_port);
	security_port = ipc_port_make_send(realhost.host_security_self);
*/


#if NORMA_VM
	norma_mk = 1;
#else
	norma_mk = 0;
#endif


	/* setup read buffers, etc */
	default_pager_initialize();

#ifndef MACH_KERNEL	
	default_pager();
#endif

	/* start the backing store monitor, it runs on a callout thread */
	default_pager_backing_store_monitor_callout = 
		thread_call_allocate(default_pager_backing_store_monitor, NULL);
	if (!default_pager_backing_store_monitor_callout)
		panic("can't start backing store monitor thread");
	thread_call_enter(default_pager_backing_store_monitor_callout);
	
	return (0);
}
Example #5
0
void darwin_iwi3945::queue_te(int num, thread_call_func_t func, thread_call_param_t par, UInt32 timei, bool start)
{
	if (tlink[num]) queue_td(num,NULL);
	//IWI_DEBUG("queue_te0 %d\n",tlink[num]);
	if (!tlink[num]) tlink[num]=thread_call_allocate(func,this);
	//IWI_DEBUG("queue_te1 %d\n",tlink[num]);
	uint64_t timei2;
	if (timei) clock_interval_to_deadline(timei,kMillisecondScale,&timei2);
	//IWI_DEBUG("queue_te time %d %d\n",timei,timei2);
	int r;
	if (start==true && tlink[num])
	{
		if (!par && !timei)	r=thread_call_enter(tlink[num]);
		if (!par && timei)	r=thread_call_enter_delayed(tlink[num],timei2);
		if (par && !timei)	r=thread_call_enter1(tlink[num],par);
		if (par && timei)	r=thread_call_enter1_delayed(tlink[num],par,timei2);
	}
	//IWI_DEBUG("queue_te result %d\n",r);
}
Example #6
0
IOReturn IrDAComm::Stop(void)
{
    int i;
    IOReturn rc = kIOReturnSuccess;
    
    XTRACE(kLogStop, 0, this);
    require(fGate, Fail);
    require(fIrDA, Fail);           // sanity
    require(fDriver, Fail);         // sanity
    
    if (fState != kIrDACommStateStopped) {          // if not already stopped
	boolean_t bt;
	
	if (fDriver->getWorkLoop()->inGate())   {       // if we have the gate, just call it
	    rc = fGate->runAction(&DoSomething, (void *)cmdStopEvent, nil, nil, nil);       
	    check(rc == kIOReturnSuccess);
	}
	else {                                          // we don't have the gate, run stop in another thread and wait for it
	    bt = thread_call_enter(fStop_thread);       // run stop logic in another thread
	    check(bt == false);                         // true here means it was already running and we're confused

	    for (i = 0 ; i < 10; i++) {                 // max wait of a second (should be more than enough)
		XTRACE(kLogStop1, i, fState);
		if (fState == kIrDACommStateStopped &&              // if ircomm is stopped and the irlap link is down
		    fIrDA->IsLAPConnected() == false) break;        // then we're really stopped
		IOSleep(100);                                       // wait 1/10 of a second per state poll
	    }
	}
	check(fState == kIrDACommStateStopped);     // this will fail if in broken-beam, just debugging
	
	rc = fGate->runAction(&DoSomething, (void *)cmdStop, nil, nil, nil);
	check(rc == kIOReturnSuccess);
    }

Fail:
    fState = kIrDACommStateStopped;     // it's really stopped now, regardless of above
    XTRACE(kLogStop, 0xffff, 0xffff);

    return rc;
}
Example #7
0
IOReturn darwin_iwi4965::setPowerState(unsigned long powerStateOrdinal, IOService *policyMaker) {
    // The default return value is for an implied acknowledgement.
    // If the appropriate thread wasn't allocated earlier in
    // registerWithPolicyMaker(), then this is what will be returned.

    IOReturn result = IOPMAckImplied;
 IOLog("power state (%d)\n", powerStateOrdinal);
    // There's nothing to do if our current power state is the one
    // we're being asked to change to.
    if (_pmPowerState == powerStateOrdinal) {
        return result;
    }

    switch (powerStateOrdinal) {
        case kWiFiControllerPowerStateOff:
			IOLog("power state off\n");
            // The driver is being told to turn off the device for some reason.
            // It saves whatever state and context it needs to and then shuts
            // off the device.
            //
            // It may take some time to turn off the HW, so the driver spawns
            // a thread to power down the device and returns immediately to
            // the policy-maker giving an upper bound on the time it will need
            // to complete the power state transition.

            if (_powerOffThreadCall) {
                // Prevent the object from being freed while a call is pending.
                // If thread_call_enter() returns TRUE, then a call is already
                // pending, and the extra retain is dropped.
                
                retain();
                if (thread_call_enter(_powerOffThreadCall) == TRUE) {
                    release();
                }
                result = kFiveSeconds;
            }
            break;

        case kWiFiControllerPowerStateOn:
			IOLog("power state on\n");
            // The driver is being told to turn on the device.  It does so
            // and then restores any state or context which it has previously
            // saved.
            //
            // It may take some time to turn on the HW, so the driver spawns
            // a thread to power up the device and returns immediately to
            // the policy-maker giving an upper bound on the time it will need
            // to complete the power state transition.


            if (_powerOnThreadCall) {
                // Prevent the object from being freed while a call is pending.
                // If thread_call_enter() returns TRUE, then a call is already
                // pending, and the extra retain is dropped.

                retain();
                if (thread_call_enter(_powerOnThreadCall) == TRUE) {
                    release();
                }
                result = kFiveSeconds;
            }
            break;
        
        default:
            IOLog("invalid power state (%ld)", powerStateOrdinal);
            break;
    }

    return result;
}
Example #8
0
File: clock.c Project: Prajna/xnu
/*
 *	clock_wakeup_calendar:
 *
 *	Interface to power management, used
 *	to initiate the reset of the calendar
 *	on wake from sleep event.
 */
void
clock_wakeup_calendar(void)
{
	thread_call_enter(&calend_wakecall);
}
void AppleACPIBatteryDevice::waitingForSystemStartup()
{
    thread_call_t t = thread_call_allocate((thread_call_func_t)startThread, this);
    thread_call_enter(t);
}