linux/drivers/watchdog/machzwd.c

// SPDX-License-Identifier: GPL-2.0-or-later
/*
 *  MachZ ZF-Logic Watchdog Timer driver for Linux
 *
 *  The author does NOT admit liability nor provide warranty for
 *  any of this software. This material is provided "AS-IS" in
 *  the hope that it may be useful for others.
 *
 *  Author: Fernando Fuganti <[email protected]>
 *
 *  Based on sbc60xxwdt.c by Jakob Oestergaard
 *
 *  We have two timers (wd#1, wd#2) driven by a 32 KHz clock with the
 *  following periods:
 *      wd#1 - 2 seconds;
 *      wd#2 - 7.2 ms;
 *  After the expiration of wd#1, it can generate a NMI, SCI, SMI, or
 *  a system RESET and it starts wd#2 that unconditionally will RESET
 *  the system when the counter reaches zero.
 *
 *  14-Dec-2001 Matt Domsch <[email protected]>
 *      Added nowayout module option to override CONFIG_WATCHDOG_NOWAYOUT
 */

#define pr_fmt(fmt)

#include <linux/module.h>
#include <linux/moduleparam.h>
#include <linux/types.h>
#include <linux/timer.h>
#include <linux/jiffies.h>
#include <linux/miscdevice.h>
#include <linux/watchdog.h>
#include <linux/fs.h>
#include <linux/ioport.h>
#include <linux/notifier.h>
#include <linux/reboot.h>
#include <linux/init.h>
#include <linux/io.h>
#include <linux/uaccess.h>


/* ports */
#define ZF_IOBASE
#define INDEX
#define DATA_B
#define DATA_W
#define DATA_D

/* indexes */			/* size */
#define ZFL_VERSION
#define CONTROL
#define STATUS
#define COUNTER_1
#define COUNTER_2
#define PULSE_LEN

/* controls */
#define ENABLE_WD1
#define ENABLE_WD2
#define RESET_WD1
#define RESET_WD2
#define GEN_SCI
#define GEN_NMI
#define GEN_SMI
#define GEN_RESET


/* utilities */

#define WD1
#define WD2

#define zf_writew(port, data)
#define zf_writeb(port, data)
#define zf_get_ZFL_version()


static unsigned short zf_readw(unsigned char port)
{}


MODULE_AUTHOR();
MODULE_DESCRIPTION();
MODULE_LICENSE();

static bool nowayout = WATCHDOG_NOWAYOUT;
module_param(nowayout, bool, 0);
MODULE_PARM_DESC();

#define PFX

static const struct watchdog_info zf_info =;


/*
 * action refers to action taken when watchdog resets
 * 0 = GEN_RESET
 * 1 = GEN_SMI
 * 2 = GEN_NMI
 * 3 = GEN_SCI
 * defaults to GEN_RESET (0)
 */
static int action;
module_param(action, int, 0);
MODULE_PARM_DESC();

static void zf_ping(struct timer_list *unused);

static int zf_action =;
static unsigned long zf_is_open;
static char zf_expect_close;
static DEFINE_SPINLOCK(zf_port_lock);
static DEFINE_TIMER(zf_timer, zf_ping);
static unsigned long next_heartbeat;


/* timeout for user land heart beat (10 seconds) */
#define ZF_USER_TIMEO

/* timeout for hardware watchdog (~500ms) */
#define ZF_HW_TIMEO

/* number of ticks on WD#1 (driven by a 32KHz clock, 2s) */
#define ZF_CTIMEOUT

#ifndef ZF_DEBUG
#define dprintk(format, args...)
#else
#define dprintk
#endif


static inline void zf_set_status(unsigned char new)
{}


/* CONTROL register functions */

static inline unsigned short zf_get_control(void)
{}

static inline void zf_set_control(unsigned short new)
{}


/* WD#? counter functions */
/*
 *	Just set counter value
 */

static inline void zf_set_timer(unsigned short new, unsigned char n)
{}

/*
 * stop hardware timer
 */
static void zf_timer_off(void)
{}


/*
 * start hardware timer
 */
static void zf_timer_on(void)
{}


static void zf_ping(struct timer_list *unused)
{}

static ssize_t zf_write(struct file *file, const char __user *buf, size_t count,
								loff_t *ppos)
{}

static long zf_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
{}

static int zf_open(struct inode *inode, struct file *file)
{}

static int zf_close(struct inode *inode, struct file *file)
{}

/*
 * Notifier for system down
 */

static int zf_notify_sys(struct notifier_block *this, unsigned long code,
								void *unused)
{}

static const struct file_operations zf_fops =;

static struct miscdevice zf_miscdev =;


/*
 * The device needs to learn about soft shutdowns in order to
 * turn the timebomb registers off.
 */
static struct notifier_block zf_notifier =;

static void __init zf_show_action(int act)
{}

static int __init zf_init(void)
{}


static void __exit zf_exit(void)
{}

module_init();
module_exit(zf_exit);