コード例 #1
0
/***********************************************************************
F* Function:     void wd_handler(unsigned long ptr) P*A*Z*
 *
P* Parameters:   unsigned long ptr
P*                - Parameter passed in from the timer invocation, ignored
P*
P* Returnvalue:  none
 *
Z* Intention:    This is the core functionality of the watchdog.  It is
Z*               called from the timer wd_timer and handles the necessary
Z*               processing, including resetting the hardware watchdog.
Z*               When chains are registered, they override the
Z*               default behaviour and are processed in process_mon_chains().
 *
D* Design:       Haider / [email protected]
C* Coding:       Haider / [email protected]
V* Verification: [email protected] / [email protected]
 ***********************************************************************/
void wd_handler(unsigned long ptr)
{
	debugk("%s: timer_count=%ld jiffies\n", __FUNCTION__, timer_count);

	if ((timer_count == 0) && enabled) {
		printk("WD: Reseting system...\n");
		BUG_ON(wd_hw_functions.wd_machine_restart == NULL);
		wd_hw_functions.wd_machine_restart();
	} else if ((timer_count > 0) || (!enabled)) {

		/* execute WD service sequence */
		BUG_ON(wd_hw_functions.wd_kick == NULL);
		wd_hw_functions.wd_kick();

		wd_timer.expires = jiffies + timer_period;
		add_timer(&wd_timer);	/* ...re-activate timer */

		/*
		 * process the monitor list
		 */
		process_mon_chains();

		/*
		 * don't timeout if disabled
		 */
		if (!enabled)
			return;

		/* don't timeout if interface was never opened */
		if (!opened)
			return;
		/*
		 * don't timeout if new interface is used or if device
		 * is not opened
		 */
		if (((timeout_open_only && (!device_open)) || mon_chains))
			return;

		/* decrement variable for timer-control */
		if (timer_count > timer_period)
			timer_count -= timer_period;
		else
			timer_count = 0;

		if (timer_count == 0)
			printk("WD: watchdog about to expire\n");
	}

	return;
}
コード例 #2
0
ファイル: wdt_mpc8xx.c プロジェクト: leonsh/eldk30ppc
/***********************************************************************
F* Function:     void wdt_mpc8xx_handler (unsigned long ptr) P*A*Z*
 *
P* Parameters:   unsigned long ptr
P*                - Parameter passed in from the timer invocation, ignored
P*
P* Returnvalue:  none
 *
Z* Intention:    This is the core functionality of the watchdog.  It is
Z*               called from the timer wd_timer and handles the necessary
Z*               processing, including resetting the hardware watchdog.
Z*               When chains are registered, they override the
Z*               default behaviour and are processed in process_mon_chains().
 *
D* Design:       Haider / [email protected]
C* Coding:       Haider / [email protected]
V* Verification: [email protected] / [email protected]
 ***********************************************************************/
void wdt_mpc8xx_handler (unsigned long ptr)
{

#ifndef CONFIG_LWMON	/* This produces too much output on the LWMON */
	debugk ("%s: timer_count=%d jiffies\n", __FUNCTION__, timer_count);
#endif

	/*
	 * Signal arch/ppc/kernel/time.c that this driver has taken
	 * over the responsibility to trigger the watchdog
	 */
	wdt_mpc8xx_is_ready = 1;

	if ((timer_count == 0) && enabled) {	/* try "graceful" shutdown */
		printk ("WDT_8xx: Reset system...\n");
#ifdef CONFIG_8xx
		m8xx_restart (NULL);
#else
		machine_restart (NULL);
#endif
	}

	if ((timer_count > 0) || (!enabled)) {

		/* execute WDT service sequence */
		wdt_mpc8xx_reset ();

		wd_timer.expires = jiffies + timer_period;
		add_timer (&wd_timer);	/* ...re-activate timer */

		/*
		 * process the monitor list
		 */
		process_mon_chains();

		/*
		 * don't timeout if disabled
		 */
		if (!enabled)
			return;

		/*
		 * don't timeout if new interface is used or if device
		 * is not opened
		 */
		if ((timeout_open_only && (!device_open)) || mon_chains)
			return;

		/* decrement variable for timer-control */
		if (timer_count > timer_period)
			timer_count -= timer_period;
		else
			timer_count = 0;

		if (timer_count == 0) {
			printk ("WDT_8xx: watchdog about to expire\n");
		}
	}

	return;
}