2010-01-16 21:53:55 +01:00
|
|
|
#ifndef __WATCHDOG_H__
|
|
|
|
#define __WATCHDOG_H__
|
|
|
|
|
2012-11-15 12:06:41 +01:00
|
|
|
#include "kernel/kernel.h"
|
2010-04-02 00:22:33 +02:00
|
|
|
#include "arch_watchdog.h"
|
2010-01-16 21:53:55 +01:00
|
|
|
|
|
|
|
extern int watchdog_enabled; /* if set to non-zero the watch dog is enabled */
|
|
|
|
extern unsigned watchdog_local_timer_ticks; /* is timer still ticking? */
|
|
|
|
|
|
|
|
/*
|
|
|
|
* as the implementation is not only architecture dependent but like in x86 case
|
|
|
|
* very much model specific, we need to keep a collection of methods that
|
|
|
|
* implement it in runtime after the correct arch/model was detected
|
|
|
|
*/
|
|
|
|
|
2010-09-23 12:49:45 +02:00
|
|
|
typedef void (* arch_watchdog_method_t)(const unsigned);
|
|
|
|
typedef int (* arch_watchdog_profile_init_t)(const unsigned);
|
2010-01-16 21:53:55 +01:00
|
|
|
|
|
|
|
struct arch_watchdog {
|
2010-09-23 12:49:45 +02:00
|
|
|
arch_watchdog_method_t init; /* initial setup */
|
|
|
|
arch_watchdog_method_t reinit; /* reinit after a tick */
|
|
|
|
arch_watchdog_profile_init_t profile_init;
|
2010-09-23 16:42:30 +02:00
|
|
|
u64_t resetval;
|
|
|
|
u64_t watchdog_resetval;
|
|
|
|
u64_t profile_resetval;
|
2010-01-16 21:53:55 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
extern struct arch_watchdog *watchdog;
|
|
|
|
|
2010-09-23 12:49:45 +02:00
|
|
|
/* let the arch code do whatever it needs to setup or quit the watchdog */
|
2010-01-16 21:53:55 +01:00
|
|
|
int arch_watchdog_init(void);
|
2010-09-23 12:49:45 +02:00
|
|
|
void arch_watchdog_stop(void);
|
2013-08-26 18:43:05 +02:00
|
|
|
|
|
|
|
#ifdef __i386__
|
2010-01-16 21:53:55 +01:00
|
|
|
/* if the watchdog detects lockup, let the arch code to handle it */
|
2010-03-27 15:31:00 +01:00
|
|
|
void arch_watchdog_lockup(const struct nmi_frame * frame);
|
2010-01-16 21:53:55 +01:00
|
|
|
|
|
|
|
/* generic NMI handler. Takes one agument which points to where the arch
|
|
|
|
* specific low level handler dumped CPU information and can be inspected by the
|
|
|
|
* arch specific code of the watchdog implementaion */
|
|
|
|
void nmi_watchdog_handler(struct nmi_frame * frame);
|
2013-08-26 18:43:05 +02:00
|
|
|
#endif
|
2010-01-16 21:53:55 +01:00
|
|
|
|
2010-09-23 12:49:45 +02:00
|
|
|
/*
|
|
|
|
* start and stop profiling using the NMI watchdog
|
|
|
|
*/
|
|
|
|
int nmi_watchdog_start_profiling(const unsigned freq);
|
|
|
|
void nmi_watchdog_stop_profiling(void);
|
|
|
|
|
2010-01-16 21:53:55 +01:00
|
|
|
#endif /* __WATCHDOG_H__ */
|