linux/drivers/watchdog/pcwd_pci.c

// SPDX-License-Identifier: GPL-2.0+
/*
 *	Berkshire PCI-PC Watchdog Card Driver
 *
 *	(c) Copyright 2003-2007 Wim Van Sebroeck <[email protected]>.
 *
 *	Based on source code of the following authors:
 *	  Ken Hollis <[email protected]>,
 *	  Lindsay Harris <[email protected]>,
 *	  Alan Cox <[email protected]>,
 *	  Matt Domsch <[email protected]>,
 *	  Rob Radez <[email protected]>
 *
 *	Neither Wim Van Sebroeck nor Iguana vzw. admit liability nor
 *	provide warranty for any of this software. This material is
 *	provided "AS-IS" and at no charge.
 */

/*
 *	A bells and whistles driver is available from:
 *	http://www.kernel.org/pub/linux/kernel/people/wim/pcwd/pcwd_pci/
 *
 *	More info available at
 *	http://www.berkprod.com/ or http://www.pcwatchdog.com/
 */

/*
 *	Includes, defines, variables, module parameters, ...
 */

#define pr_fmt(fmt)

#include <linux/module.h>	/* For module specific items */
#include <linux/moduleparam.h>	/* For new moduleparam's */
#include <linux/types.h>	/* For standard types (like size_t) */
#include <linux/errno.h>	/* For the -ENODEV/... values */
#include <linux/kernel.h>	/* For printk/panic/... */
#include <linux/delay.h>	/* For mdelay function */
#include <linux/miscdevice.h>	/* For struct miscdevice */
#include <linux/watchdog.h>	/* For the watchdog specific items */
#include <linux/notifier.h>	/* For notifier support */
#include <linux/reboot.h>	/* For reboot_notifier stuff */
#include <linux/init.h>		/* For __init/__exit/... */
#include <linux/fs.h>		/* For file operations */
#include <linux/pci.h>		/* For pci functions */
#include <linux/ioport.h>	/* For io-port access */
#include <linux/spinlock.h>	/* For spin_lock/spin_unlock/... */
#include <linux/uaccess.h>	/* For copy_to_user/put_user/... */
#include <linux/io.h>		/* For inb/outb/... */

/* Module and version information */
#define WATCHDOG_VERSION
#define WATCHDOG_DRIVER_NAME
#define WATCHDOG_NAME
#define DRIVER_VERSION

/* Stuff for the PCI ID's  */
#ifndef PCI_VENDOR_ID_QUICKLOGIC
#define PCI_VENDOR_ID_QUICKLOGIC
#endif

#ifndef PCI_DEVICE_ID_WATCHDOG_PCIPCWD
#define PCI_DEVICE_ID_WATCHDOG_PCIPCWD
#endif

/*
 * These are the defines that describe the control status bits for the
 * PCI-PC Watchdog card.
 */
/* Port 1 : Control Status #1 */
#define WD_PCI_WTRP
#define WD_PCI_HRBT
#define WD_PCI_TTRP
#define WD_PCI_RL2A
#define WD_PCI_RL1A
#define WD_PCI_R2DS
#define WD_PCI_RLY2
/* Port 2 : Control Status #2 */
#define WD_PCI_WDIS
#define WD_PCI_ENTP
#define WD_PCI_WRSP
#define WD_PCI_PCMD

/* according to documentation max. time to process a command for the pci
 * watchdog card is 100 ms, so we give it 150 ms to do it's job */
#define PCI_COMMAND_TIMEOUT

/* Watchdog's internal commands */
#define CMD_GET_STATUS
#define CMD_GET_FIRMWARE_VERSION
#define CMD_READ_WATCHDOG_TIMEOUT
#define CMD_WRITE_WATCHDOG_TIMEOUT
#define CMD_GET_CLEAR_RESET_COUNT

/* Watchdog's Dip Switch heartbeat values */
static const int heartbeat_tbl[] =;

/* We can only use 1 card due to the /dev/watchdog restriction */
static int cards_found;

/* internal variables */
static int temp_panic;
static unsigned long is_active;
static char expect_release;
/* this is private data for each PCI-PC watchdog card */
static struct {} pcipcwd_private;

/* module parameters */
#define QUIET
#define VERBOSE
#define DEBUG
static int debug =;
module_param(debug, int, 0);
MODULE_PARM_DESC();

#define WATCHDOG_HEARTBEAT
static int heartbeat =;
module_param(heartbeat, int, 0);
MODULE_PARM_DESC();

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

/*
 *	Internal functions
 */

static int send_command(int cmd, int *msb, int *lsb)
{}

static inline void pcipcwd_check_temperature_support(void)
{}

static int pcipcwd_get_option_switches(void)
{}

static void pcipcwd_show_card_info(void)
{}

static int pcipcwd_start(void)
{}

static int pcipcwd_stop(void)
{}

static int pcipcwd_keepalive(void)
{}

static int pcipcwd_set_heartbeat(int t)
{}

static int pcipcwd_get_status(int *status)
{}

static int pcipcwd_clear_status(void)
{}

static int pcipcwd_get_temperature(int *temperature)
{}

static int pcipcwd_get_timeleft(int *time_left)
{}

/*
 *	/dev/watchdog handling
 */

static ssize_t pcipcwd_write(struct file *file, const char __user *data,
			     size_t len, loff_t *ppos)
{}

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

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

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

/*
 *	/dev/temperature handling
 */

static ssize_t pcipcwd_temp_read(struct file *file, char __user *data,
				size_t len, loff_t *ppos)
{}

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

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

/*
 *	Notify system
 */

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

/*
 *	Kernel Interfaces
 */

static const struct file_operations pcipcwd_fops =;

static struct miscdevice pcipcwd_miscdev =;

static const struct file_operations pcipcwd_temp_fops =;

static struct miscdevice pcipcwd_temp_miscdev =;

static struct notifier_block pcipcwd_notifier =;

/*
 *	Init & exit routines
 */

static int pcipcwd_card_init(struct pci_dev *pdev,
		const struct pci_device_id *ent)
{}

static void pcipcwd_card_exit(struct pci_dev *pdev)
{}

static const struct pci_device_id pcipcwd_pci_tbl[] =;
MODULE_DEVICE_TABLE(pci, pcipcwd_pci_tbl);

static struct pci_driver pcipcwd_driver =;

module_pci_driver();

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