Esempio n. 1
0
/*
 * Suspend
 */
LOCAL ER do_suspend( void )
{
	ER	ercd;

	/* Stop accepting device registration/unregistration */
	LockREG();

	/* Suspend processing of device except for disks */
	ercd = sendevt_alldevice(TDV_SUSPEND, FALSE);
#ifdef DEBUG
	if ( ercd < E_OK ) {
		DEBUG_PRINT(("2. do_suspend -> sendevt_alldevice ercd = %d\n", ercd));
	}
#endif

	/* Suspend processing of disk device */
	ercd = sendevt_alldevice(TDV_SUSPEND, TRUE);
#ifdef DEBUG
	if ( ercd < E_OK ) {
		DEBUG_PRINT(("3. do_suspend -> sendevt_alldevice ercd = %d\n", ercd));
	}
#endif

	/* Stop accepting new requests */
	LockDM();

	/*
	 * Insert code to transit to suspend state here
	 */

	/*
	 * Insert code executed on returning from suspend state
	 */


	/* Resume accepting requests */
	UnlockDM();

	/* Resume processing of disk device */
	ercd = sendevt_alldevice(TDV_RESUME, TRUE);
#ifdef DEBUG
	if ( ercd < E_OK ) {
		DEBUG_PRINT(("7. do_suspend -> sendevt_alldevice ercd = %d\n", ercd));
	}
#endif

	/* Resume processing of device except for disks */
	ercd = sendevt_alldevice(TDV_RESUME, FALSE);
#ifdef DEBUG
	if ( ercd < E_OK ) {
		DEBUG_PRINT(("8. do_suspend -> sendevt_alldevice ercd = %d\n", ercd));
	}
#endif

	/* Resume accepting device registration/unregistration */
	UnlockREG();

	return ercd;
}
Esempio n. 2
0
/*
 * Suspend
 */
LOCAL ER do_suspend( void )
{
	ER	ercd;

	/* Stop accepting device registration/unregistration */
	LockREG();

	/* Processing before starting subsystem suspend */
	ercd = tk_evt_ssy(0, TSEVT_SUSPEND_BEGIN, 0, 0);
	ERCD_PRINT(("1. do_suspend -> tk_evt_ssy ercd = %d\n", ercd));

	/* Suspend processing of device except for disks */
	ercd = sendevt_alldevice(TDV_SUSPEND, FALSE);
	ERCD_PRINT(("2. do_suspend -> sendevt_alldevice ercd = %d\n", ercd));

	/* Suspend processing of disk device */
	ercd = sendevt_alldevice(TDV_SUSPEND, TRUE);
	ERCD_PRINT(("3. do_suspend -> sendevt_alldevice ercd = %d\n", ercd));

	/* Stop accepting new requests */
	LockDM();

	/* Processing after completion of subsystem suspend */
	ercd = tk_evt_ssy(0, TSEVT_SUSPEND_DONE, 0, 0);
	ERCD_PRINT(("4. do_suspend -> tk_evt_ssy ercd = %d\n", ercd));

	/* Transit to suspend state */
	ercd = tk_set_pow(TPW_DOSUSPEND);
	ERCD_PRINT(("5. do_suspend -> tk_set_pow ercd = %d\n", ercd));

	/* Return from suspend state */

	/* Processing before starting subsystem resume */
	ercd = tk_evt_ssy(0, TSEVT_RESUME_BEGIN, 0, 0);
	ERCD_PRINT(("6. do_suspend -> tk_evt_ssy ercd = %d\n", ercd));

	/* Resume accepting requests */
	UnlockDM();

	/* Resume processing of disk device */
	ercd = sendevt_alldevice(TDV_RESUME, TRUE);
	ERCD_PRINT(("7. do_suspend -> sendevt_alldevice ercd = %d\n", ercd));

	/* Resume processing of device except for disks */
	ercd = sendevt_alldevice(TDV_RESUME, FALSE);
	ERCD_PRINT(("8. do_suspend -> sendevt_alldevice ercd = %d\n", ercd));

	/* Resume accepting device registration/unregistration */
	UnlockREG();

	/* Processing after completion of subsystem resume */
	ercd = tk_evt_ssy(0, TSEVT_RESUME_DONE, 0, 0);
	ERCD_PRINT(("9. do_suspend -> tk_evt_ssy ercd = %d\n", ercd));

	return ercd;
}