* ip22 watchdog timer
@ 2002-02-08 17:27 Guido Guenther
2002-02-15 4:56 ` Ralf Baechle
0 siblings, 1 reply; 12+ messages in thread
From: Guido Guenther @ 2002-02-08 17:27 UTC (permalink / raw)
To: linux-mips; +Cc: ralf
[-- Attachment #1: Type: text/plain, Size: 86 bytes --]
Hi,
attached is an updated patch for the ip22 watchdog timer. Please apply.
-- Guido
[-- Attachment #2: indydog-2001-02-08.diff --]
[-- Type: text/plain, Size: 6432 bytes --]
diff -Naur kernel-source-2.4.17.clean/Documentation/Configure.help kernel-source-2.4.17/Documentation/Configure.help
--- kernel-source-2.4.17.clean/Documentation/Configure.help Wed Mar 26 05:57:18 2003
+++ kernel-source-2.4.17/Documentation/Configure.help Wed Mar 26 18:50:52 2003
@@ -3129,6 +3129,13 @@
via the file /proc/rtc and its behaviour is set by various ioctls on
/dev/rtc.
+Indy/I2 Hardware Watchdog
+CONFIG_INDYDOG
+ Hardwaredriver for the Indy's/I2's watchdog. This is a
+ watchdog timer that will reboot the machine after a 60 second
+ timer expired and no process has written to /dev/watchdog during
+ that time.
+
Support the Bell Technologies HUB6 card
CONFIG_HUB6
Say Y here to enable support in the dumb serial driver to support
diff -Naur kernel-source-2.4.17.clean/arch/mips/config.in kernel-source-2.4.17/arch/mips/config.in
--- kernel-source-2.4.17.clean/arch/mips/config.in Wed Mar 26 05:57:19 2003
+++ kernel-source-2.4.17/arch/mips/config.in Wed Mar 26 19:03:33 2003
@@ -574,6 +574,11 @@
fi
# we always need the dummy console to make the serial console I2 happy
define_bool CONFIG_DUMMY_CONSOLE y
+ bool 'Watchdog Timer Support' CONFIG_WATCHDOG
+ if [ "$CONFIG_WATCHDOG" != "n" ]; then
+ bool ' Disable watchdog shutdown on close' CONFIG_WATCHDOG_NOWAYOUT
+ tristate ' Indy/I2 Hardware Watchdog' CONFIG_INDYDOG
+ fi
endmenu
fi
diff -Naur kernel-source-2.4.17.clean/arch/mips/sgi-ip22/ip22-mc.c kernel-source-2.4.17/arch/mips/sgi-ip22/ip22-mc.c
--- kernel-source-2.4.17.clean/arch/mips/sgi-ip22/ip22-mc.c Wed Mar 26 05:57:28 2003
+++ kernel-source-2.4.17/arch/mips/sgi-ip22/ip22-mc.c Wed Mar 26 18:38:55 2003
@@ -82,6 +82,14 @@
* interrupts are first enabled etc.
*/
+ /* Step 0: Make sure we turn off the watchdog in case it's
+ * still running (which might be the case after a
+ * soft reboot).
+ */
+ tmpreg = mcmisc_regs->cpuctrl0;
+ tmpreg &= ~SGIMC_CCTRL0_WDOG;
+ mcmisc_regs->cpuctrl0 = tmpreg;
+
/* Step 1: The CPU/GIO error status registers will not latch
* up a new error status until the register has been
* cleared by the cpu. These status registers are
diff -Naur kernel-source-2.4.17.clean/drivers/char/Makefile kernel-source-2.4.17/drivers/char/Makefile
--- kernel-source-2.4.17.clean/drivers/char/Makefile Wed Mar 26 05:57:32 2003
+++ kernel-source-2.4.17/drivers/char/Makefile Wed Mar 26 18:38:47 2003
@@ -245,6 +245,7 @@
obj-$(CONFIG_SH_WDT) += shwdt.o
obj-$(CONFIG_EUROTECH_WDT) += eurotechwdt.o
obj-$(CONFIG_SOFT_WATCHDOG) += softdog.o
+obj-$(CONFIG_INDYDOG) += indydog.o
subdir-$(CONFIG_MWAVE) += mwave
ifeq ($(CONFIG_MWAVE),y)
diff -Naur kernel-source-2.4.17.clean/drivers/char/indydog.c kernel-source-2.4.17/drivers/char/indydog.c
--- kernel-source-2.4.17.clean/drivers/char/indydog.c Thu Jan 1 01:00:00 1970
+++ kernel-source-2.4.17/drivers/char/indydog.c Wed Mar 26 20:33:59 2003
@@ -0,0 +1,158 @@
+/*
+ * IndyDog 0.0.2 A Hardware Watchdog Device for SGI IP22
+ *
+ * (c) Copyright 2001 Guido Guenther <agx@sigxcpu.org>, All Rights Reserved.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version
+ * 2 of the License, or (at your option) any later version.
+ *
+ * based on softdog.c by Alan Cox <alan@redhat.com>
+ */
+
+#include <linux/module.h>
+#include <linux/config.h>
+#include <linux/types.h>
+#include <linux/kernel.h>
+#include <linux/fs.h>
+#include <linux/mm.h>
+#include <linux/miscdevice.h>
+#include <linux/watchdog.h>
+#include <linux/smp_lock.h>
+#include <linux/init.h>
+#include <asm/uaccess.h>
+#include <asm/sgi/sgimc.h>
+
+static int indydog_alive;
+static struct sgimc_misc_ctrl *mcmisc_regs;
+
+static void indydog_ping()
+{
+ mcmisc_regs->watchdogt = 0;
+}
+
+
+/*
+ * Allow only one person to hold it open
+ */
+
+static int indydog_open(struct inode *inode, struct file *file)
+{
+ u32 mc_ctrl0;
+
+ if(indydog_alive)
+ return -EBUSY;
+#ifdef CONFIG_WATCHDOG_NOWAYOUT
+ MOD_INC_USE_COUNT;
+#endif
+ /*
+ * Activate timer
+ */
+ mcmisc_regs = (struct sgimc_misc_ctrl *)(KSEG1+0x1fa00000);
+
+ mc_ctrl0 = mcmisc_regs->cpuctrl0 | SGIMC_CCTRL0_WDOG;
+ mcmisc_regs->cpuctrl0 = mc_ctrl0;
+ indydog_ping();
+
+ indydog_alive=1;
+ printk("Started watchdog timer.\n");
+ return 0;
+}
+
+static int indydog_release(struct inode *inode, struct file *file)
+{
+ /*
+ * Shut off the timer.
+ * Lock it in if it's a module and we defined ...NOWAYOUT
+ */
+ lock_kernel();
+#ifndef CONFIG_WATCHDOG_NOWAYOUT
+ {
+ u32 mc_ctrl0 = mcmisc_regs->cpuctrl0;
+ mc_ctrl0 &= ~SGIMC_CCTRL0_WDOG;
+ mcmisc_regs->cpuctrl0 = mc_ctrl0;
+ printk("Stopped watchdog timer.\n");
+ }
+#endif
+ indydog_alive=0;
+ unlock_kernel();
+ return 0;
+}
+
+static ssize_t indydog_write(struct file *file, const char *data, size_t len, loff_t *ppos)
+{
+ /* Can't seek (pwrite) on this device */
+ if (ppos != &file->f_pos)
+ return -ESPIPE;
+
+ /*
+ * Refresh the timer.
+ */
+ if(len) {
+ indydog_ping();
+ return 1;
+ }
+ return 0;
+}
+
+static int indydog_ioctl(struct inode *inode, struct file *file,
+ unsigned int cmd, unsigned long arg)
+{
+ static struct watchdog_info ident = {
+ identity: "Hardware Watchdog for SGI IP22",
+ };
+ switch (cmd) {
+ default:
+ return -ENOIOCTLCMD;
+ case WDIOC_GETSUPPORT:
+ if(copy_to_user((struct watchdog_info *)arg, &ident, sizeof(ident)))
+ return -EFAULT;
+ return 0;
+ case WDIOC_GETSTATUS:
+ case WDIOC_GETBOOTSTATUS:
+ return put_user(0,(int *)arg);
+ case WDIOC_KEEPALIVE:
+ indydog_ping();
+ return 0;
+ }
+}
+
+static struct file_operations indydog_fops = {
+ owner: THIS_MODULE,
+ write: indydog_write,
+ ioctl: indydog_ioctl,
+ open: indydog_open,
+ release: indydog_release,
+};
+
+static struct miscdevice indydog_miscdev = {
+ minor: WATCHDOG_MINOR,
+ name: "watchdog",
+ fops: &indydog_fops,
+};
+
+static const char banner[] __initdata = KERN_INFO "Hardware Watchdog Timer for SGI IP22: 0.0.2\n";
+
+static int __init watchdog_init(void)
+{
+ int ret;
+
+ ret = misc_register(&indydog_miscdev);
+
+ if (ret)
+ return ret;
+
+ printk(banner);
+
+ return 0;
+}
+
+static void __exit watchdog_exit(void)
+{
+ misc_deregister(&indydog_miscdev);
+}
+
+module_init(watchdog_init);
+module_exit(watchdog_exit);
+MODULE_LICENSE("GPL");
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: ip22 watchdog timer
2002-02-08 17:27 ip22 watchdog timer Guido Guenther
@ 2002-02-15 4:56 ` Ralf Baechle
2002-02-15 12:06 ` Guido Guenther
0 siblings, 1 reply; 12+ messages in thread
From: Ralf Baechle @ 2002-02-15 4:56 UTC (permalink / raw)
To: linux-mips
On Fri, Feb 08, 2002 at 06:27:11PM +0100, Guido Guenther wrote:
> attached is an updated patch for the ip22 watchdog timer. Please apply.
Patch doesn't apply cleanly.
***************
*** 574,579 ****
fi
# we always need the dummy console to make the serial console I2 happy
define_bool CONFIG_DUMMY_CONSOLE y
endmenu
fi
--- 574,584 ----
fi
# we always need the dummy console to make the serial console I2 happy
define_bool CONFIG_DUMMY_CONSOLE y
+ bool 'Watchdog Timer Support' CONFIG_WATCHDOG
+ if [ "$CONFIG_WATCHDOG" != "n" ]; then
+ bool ' Disable watchdog shutdown on close' CONFIG_WATCHDOG_NOWAYOUT
+ tristate ' Indy/I2 Hardware Watchdog' CONFIG_INDYDOG
+ fi
endmenu
fi
Anyway, the comment about the I2 looks suspicious ...
Ralf
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: ip22 watchdog timer
2002-02-15 4:56 ` Ralf Baechle
@ 2002-02-15 12:06 ` Guido Guenther
2002-02-15 14:17 ` Maciej W. Rozycki
0 siblings, 1 reply; 12+ messages in thread
From: Guido Guenther @ 2002-02-15 12:06 UTC (permalink / raw)
To: Ralf Baechle; +Cc: linux-mips
[-- Attachment #1: Type: text/plain, Size: 419 bytes --]
On Fri, Feb 15, 2002 at 05:56:20AM +0100, Ralf Baechle wrote:
> On Fri, Feb 08, 2002 at 06:27:11PM +0100, Guido Guenther wrote:
>
> > attached is an updated patch for the ip22 watchdog timer. Please apply.
>
> Patch doesn't apply cleanly.
Artifacts of my other IP22 patches, I moved the config stuff to the
other watchdog drivers in drivers/char/Config.in now. Applies cleanly on
fresh 2.4.17 CVS checkout.
-- Guido
[-- Attachment #2: indydog-2002-02-15.diff --]
[-- Type: text/plain, Size: 6213 bytes --]
diff --exclude=CVS -Naur linux-2.4.17.orig/Documentation/Configure.help linux-2.4.17/Documentation/Configure.help
--- linux-2.4.17.orig/Documentation/Configure.help Sat Dec 29 06:37:46 2001
+++ linux-2.4.17/Documentation/Configure.help Fri Feb 15 09:55:06 2002
@@ -3129,6 +3129,13 @@
via the file /proc/rtc and its behaviour is set by various ioctls on
/dev/rtc.
+Indy/I2 Hardware Watchdog
+CONFIG_INDYDOG
+ Hardwaredriver for the Indy's/I2's watchdog. This is a
+ watchdog timer that will reboot the machine after a 60 second
+ timer expired and no process has written to /dev/watchdog during
+ that time.
+
Support the Bell Technologies HUB6 card
CONFIG_HUB6
Say Y here to enable support in the dumb serial driver to support
diff --exclude=CVS -Naur linux-2.4.17.orig/arch/mips/sgi-ip22/ip22-mc.c linux-2.4.17/arch/mips/sgi-ip22/ip22-mc.c
--- linux-2.4.17.orig/arch/mips/sgi-ip22/ip22-mc.c Tue Nov 27 16:57:11 2001
+++ linux-2.4.17/arch/mips/sgi-ip22/ip22-mc.c Fri Feb 15 09:55:07 2002
@@ -82,6 +82,14 @@
* interrupts are first enabled etc.
*/
+ /* Step 0: Make sure we turn off the watchdog in case it's
+ * still running (which might be the case after a
+ * soft reboot).
+ */
+ tmpreg = mcmisc_regs->cpuctrl0;
+ tmpreg &= ~SGIMC_CCTRL0_WDOG;
+ mcmisc_regs->cpuctrl0 = tmpreg;
+
/* Step 1: The CPU/GIO error status registers will not latch
* up a new error status until the register has been
* cleared by the cpu. These status registers are
diff --exclude=CVS -Naur linux-2.4.17.orig/drivers/char/Config.in linux-2.4.17/drivers/char/Config.in
--- linux-2.4.17.orig/drivers/char/Config.in Sun Dec 2 12:34:40 2001
+++ linux-2.4.17/drivers/char/Config.in Fri Feb 15 10:00:59 2002
@@ -199,6 +199,7 @@
tristate ' SBC-60XX Watchdog Timer' CONFIG_60XX_WDT
tristate ' W83877F (EMACS) Watchdog Timer' CONFIG_W83877F_WDT
tristate ' ZF MachZ Watchdog' CONFIG_MACHZ_WDT
+ tristate ' Indy/I2 Hardware Watchdog' CONFIG_INDYDOG
fi
endmenu
diff --exclude=CVS -Naur linux-2.4.17.orig/drivers/char/Makefile linux-2.4.17/drivers/char/Makefile
--- linux-2.4.17.orig/drivers/char/Makefile Mon Jan 7 04:33:54 2002
+++ linux-2.4.17/drivers/char/Makefile Fri Feb 15 09:55:07 2002
@@ -245,6 +245,7 @@
obj-$(CONFIG_SH_WDT) += shwdt.o
obj-$(CONFIG_EUROTECH_WDT) += eurotechwdt.o
obj-$(CONFIG_SOFT_WATCHDOG) += softdog.o
+obj-$(CONFIG_INDYDOG) += indydog.o
subdir-$(CONFIG_MWAVE) += mwave
ifeq ($(CONFIG_MWAVE),y)
diff --exclude=CVS -Naur linux-2.4.17.orig/drivers/char/indydog.c linux-2.4.17/drivers/char/indydog.c
--- linux-2.4.17.orig/drivers/char/indydog.c Thu Jan 1 01:00:00 1970
+++ linux-2.4.17/drivers/char/indydog.c Fri Feb 15 09:55:07 2002
@@ -0,0 +1,158 @@
+/*
+ * IndyDog 0.2 A Hardware Watchdog Device for SGI IP22
+ *
+ * (c) Copyright 2002 Guido Guenther <agx@sigxcpu.org>, All Rights Reserved.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version
+ * 2 of the License, or (at your option) any later version.
+ *
+ * based on softdog.c by Alan Cox <alan@redhat.com>
+ */
+
+#include <linux/module.h>
+#include <linux/config.h>
+#include <linux/types.h>
+#include <linux/kernel.h>
+#include <linux/fs.h>
+#include <linux/mm.h>
+#include <linux/miscdevice.h>
+#include <linux/watchdog.h>
+#include <linux/smp_lock.h>
+#include <linux/init.h>
+#include <asm/uaccess.h>
+#include <asm/sgi/sgimc.h>
+
+static int indydog_alive;
+static struct sgimc_misc_ctrl *mcmisc_regs;
+
+static void indydog_ping()
+{
+ mcmisc_regs->watchdogt = 0;
+}
+
+
+/*
+ * Allow only one person to hold it open
+ */
+
+static int indydog_open(struct inode *inode, struct file *file)
+{
+ u32 mc_ctrl0;
+
+ if(indydog_alive)
+ return -EBUSY;
+#ifdef CONFIG_WATCHDOG_NOWAYOUT
+ MOD_INC_USE_COUNT;
+#endif
+ /*
+ * Activate timer
+ */
+ mcmisc_regs = (struct sgimc_misc_ctrl *)(KSEG1+0x1fa00000);
+
+ mc_ctrl0 = mcmisc_regs->cpuctrl0 | SGIMC_CCTRL0_WDOG;
+ mcmisc_regs->cpuctrl0 = mc_ctrl0;
+ indydog_ping();
+
+ indydog_alive=1;
+ printk("Started watchdog timer.\n");
+ return 0;
+}
+
+static int indydog_release(struct inode *inode, struct file *file)
+{
+ /*
+ * Shut off the timer.
+ * Lock it in if it's a module and we defined ...NOWAYOUT
+ */
+ lock_kernel();
+#ifndef CONFIG_WATCHDOG_NOWAYOUT
+ {
+ u32 mc_ctrl0 = mcmisc_regs->cpuctrl0;
+ mc_ctrl0 &= ~SGIMC_CCTRL0_WDOG;
+ mcmisc_regs->cpuctrl0 = mc_ctrl0;
+ printk("Stopped watchdog timer.\n");
+ }
+#endif
+ indydog_alive=0;
+ unlock_kernel();
+ return 0;
+}
+
+static ssize_t indydog_write(struct file *file, const char *data, size_t len, loff_t *ppos)
+{
+ /* Can't seek (pwrite) on this device */
+ if (ppos != &file->f_pos)
+ return -ESPIPE;
+
+ /*
+ * Refresh the timer.
+ */
+ if(len) {
+ indydog_ping();
+ return 1;
+ }
+ return 0;
+}
+
+static int indydog_ioctl(struct inode *inode, struct file *file,
+ unsigned int cmd, unsigned long arg)
+{
+ static struct watchdog_info ident = {
+ identity: "Hardware Watchdog for SGI IP22",
+ };
+ switch (cmd) {
+ default:
+ return -ENOIOCTLCMD;
+ case WDIOC_GETSUPPORT:
+ if(copy_to_user((struct watchdog_info *)arg, &ident, sizeof(ident)))
+ return -EFAULT;
+ return 0;
+ case WDIOC_GETSTATUS:
+ case WDIOC_GETBOOTSTATUS:
+ return put_user(0,(int *)arg);
+ case WDIOC_KEEPALIVE:
+ indydog_ping();
+ return 0;
+ }
+}
+
+static struct file_operations indydog_fops = {
+ owner: THIS_MODULE,
+ write: indydog_write,
+ ioctl: indydog_ioctl,
+ open: indydog_open,
+ release: indydog_release,
+};
+
+static struct miscdevice indydog_miscdev = {
+ minor: WATCHDOG_MINOR,
+ name: "watchdog",
+ fops: &indydog_fops,
+};
+
+static const char banner[] __initdata = KERN_INFO "Hardware Watchdog Timer for SGI IP22: 0.2\n";
+
+static int __init watchdog_init(void)
+{
+ int ret;
+
+ ret = misc_register(&indydog_miscdev);
+
+ if (ret)
+ return ret;
+
+ printk(banner);
+
+ return 0;
+}
+
+static void __exit watchdog_exit(void)
+{
+ misc_deregister(&indydog_miscdev);
+}
+
+module_init(watchdog_init);
+module_exit(watchdog_exit);
+MODULE_LICENSE("GPL");
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: ip22 watchdog timer
2002-02-15 12:06 ` Guido Guenther
@ 2002-02-15 14:17 ` Maciej W. Rozycki
2002-02-15 14:21 ` Ralf Baechle
2002-02-15 15:42 ` Guido Guenther
0 siblings, 2 replies; 12+ messages in thread
From: Maciej W. Rozycki @ 2002-02-15 14:17 UTC (permalink / raw)
To: Guido Guenther; +Cc: Ralf Baechle, linux-mips
On Fri, 15 Feb 2002, Guido Guenther wrote:
> diff --exclude=CVS -Naur linux-2.4.17.orig/drivers/char/Config.in
> linux-2.4.17/drivers/char/Config.in
> --- linux-2.4.17.orig/drivers/char/Config.in Sun Dec 2 12:34:40 2001
> +++ linux-2.4.17/drivers/char/Config.in Fri Feb 15 10:00:59 2002
> @@ -199,6 +199,7 @@
> tristate ' SBC-60XX Watchdog Timer' CONFIG_60XX_WDT
> tristate ' W83877F (EMACS) Watchdog Timer' CONFIG_W83877F_WDT
> tristate ' ZF MachZ Watchdog' CONFIG_MACHZ_WDT
> + tristate ' Indy/I2 Hardware Watchdog' CONFIG_INDYDOG
> fi
> endmenu
This looks suspicious. Haven't you meant "dep_tristate"? Especially as
indydog.c doesn't seem to make any effort to validate it's running on the
system it thinks it is before poking random memory locations. It won't
probably even compile for a non-MIPS kernel.
BTW, why do people insist on sending patches as attachments -- it makes
commenting them helly twisted, sigh...
--
+ Maciej W. Rozycki, Technical University of Gdansk, Poland +
+--------------------------------------------------------------+
+ e-mail: macro@ds2.pg.gda.pl, PGP key available +
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: ip22 watchdog timer
2002-02-15 14:17 ` Maciej W. Rozycki
@ 2002-02-15 14:21 ` Ralf Baechle
2002-02-15 14:41 ` Maciej W. Rozycki
2002-02-15 20:33 ` Jim Paris
2002-02-15 15:42 ` Guido Guenther
1 sibling, 2 replies; 12+ messages in thread
From: Ralf Baechle @ 2002-02-15 14:21 UTC (permalink / raw)
To: Maciej W. Rozycki; +Cc: Guido Guenther, linux-mips
On Fri, Feb 15, 2002 at 03:17:17PM +0100, Maciej W. Rozycki wrote:
> This looks suspicious. Haven't you meant "dep_tristate"? Especially as
> indydog.c doesn't seem to make any effort to validate it's running on the
> system it thinks it is before poking random memory locations. It won't
> probably even compile for a non-MIPS kernel.
>
> BTW, why do people insist on sending patches as attachments -- it makes
> commenting them helly twisted, sigh...
How true. MIME - broken solution for a broken design ;) More serious,
MIME makes sense when using a MUA that garbles patches like Netscape or
certain versions of Pine.
Ralf (Prolly still be using Mutt + vi in 5 years ...)
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: ip22 watchdog timer
2002-02-15 14:21 ` Ralf Baechle
@ 2002-02-15 14:41 ` Maciej W. Rozycki
2002-02-15 15:06 ` Ralf Baechle
2002-02-15 20:33 ` Jim Paris
1 sibling, 1 reply; 12+ messages in thread
From: Maciej W. Rozycki @ 2002-02-15 14:41 UTC (permalink / raw)
To: Ralf Baechle; +Cc: Guido Guenther, linux-mips
On Fri, 15 Feb 2002, Ralf Baechle wrote:
> > BTW, why do people insist on sending patches as attachments -- it makes
> > commenting them helly twisted, sigh...
>
> How true. MIME - broken solution for a broken design ;) More serious,
Why broken? It's not broken for what it was invented to, i.e. for
passing unsafe characters via SMTP. Source patches do not qualify as
containing such.
> MIME makes sense when using a MUA that garbles patches like Netscape or
> certain versions of Pine.
MIME is not a solution for broken MUAs or MDAs and was not intended as
one, definitely. Pine got broken quite recently (it eats white space at
line ends; that may be circumvented by using `patch -l' and may actually
be advantageous in not adding white space there if present in the patch;
the drawback is `patch' doesn't eat white space to be removed either) and
there is a patch available (the package I have at my site doesn't have it
applied, though, I admit; the next version should). The ancient version
I'm using here seems safe as is.
--
+ Maciej W. Rozycki, Technical University of Gdansk, Poland +
+--------------------------------------------------------------+
+ e-mail: macro@ds2.pg.gda.pl, PGP key available +
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: ip22 watchdog timer
2002-02-15 14:41 ` Maciej W. Rozycki
@ 2002-02-15 15:06 ` Ralf Baechle
2002-02-15 21:02 ` Matthew Dharm
0 siblings, 1 reply; 12+ messages in thread
From: Ralf Baechle @ 2002-02-15 15:06 UTC (permalink / raw)
To: Maciej W. Rozycki; +Cc: Guido Guenther, linux-mips
On Fri, Feb 15, 2002 at 03:41:49PM +0100, Maciej W. Rozycki wrote:
> > How true. MIME - broken solution for a broken design ;) More serious,
>
> Why broken? It's not broken for what it was invented to, i.e. for
> passing unsafe characters via SMTP. Source patches do not qualify as
> containing such.
The transition time from pre-MIME to MIME was pretty painful. If you'd
have gone through the same pains that I did during the MIME introduction
you'd probably understand why I call it a broken fix for a broken system.
Fortunately now that the childhood problems have been solved MIME looks
alot saner but still I prefer plaintext for patches.
Ralf
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: ip22 watchdog timer
2002-02-15 14:17 ` Maciej W. Rozycki
2002-02-15 14:21 ` Ralf Baechle
@ 2002-02-15 15:42 ` Guido Guenther
2002-02-15 16:19 ` Maciej W. Rozycki
1 sibling, 1 reply; 12+ messages in thread
From: Guido Guenther @ 2002-02-15 15:42 UTC (permalink / raw)
To: Maciej W. Rozycki; +Cc: Ralf Baechle, linux-mips
On Fri, Feb 15, 2002 at 03:17:17PM +0100, Maciej W. Rozycki wrote:
> > linux-2.4.17/drivers/char/Config.in
> > --- linux-2.4.17.orig/drivers/char/Config.in Sun Dec 2 12:34:40 2001
> > +++ linux-2.4.17/drivers/char/Config.in Fri Feb 15 10:00:59 2002
> > @@ -199,6 +199,7 @@
> > tristate ' SBC-60XX Watchdog Timer' CONFIG_60XX_WDT
> > tristate ' W83877F (EMACS) Watchdog Timer' CONFIG_W83877F_WDT
> > tristate ' ZF MachZ Watchdog' CONFIG_MACHZ_WDT
> > + tristate ' Indy/I2 Hardware Watchdog' CONFIG_INDYDOG
> > fi
> > endmenu
>
> This looks suspicious. Haven't you meant "dep_tristate"? Especially as
> indydog.c doesn't seem to make any effort to validate it's running on the
> system it thinks it is before poking random memory locations. It won't
> probably even compile for a non-MIPS kernel.
Oh yes. Thanks. I missed that when moving it out of IP22 specific stuff.
While we're at this: The machine selection in config.in is of type bool. Shouldn't this
be of type "choice"? Do we really support several(arbitrary) machine selections in
one kernel?
-- Guido
Does this look better?
diff --exclude=CVS -Naur linux-2.4.17.orig/Documentation/Configure.help linux-2.4.17/Documentation/Configure.help
--- linux-2.4.17.orig/Documentation/Configure.help Sat Dec 29 06:37:46 2001
+++ linux-2.4.17/Documentation/Configure.help Fri Feb 15 09:55:06 2002
@@ -3129,6 +3129,13 @@
via the file /proc/rtc and its behaviour is set by various ioctls on
/dev/rtc.
+Indy/I2 Hardware Watchdog
+CONFIG_INDYDOG
+ Hardwaredriver for the Indy's/I2's watchdog. This is a
+ watchdog timer that will reboot the machine after a 60 second
+ timer expired and no process has written to /dev/watchdog during
+ that time.
+
Support the Bell Technologies HUB6 card
CONFIG_HUB6
Say Y here to enable support in the dumb serial driver to support
diff --exclude=CVS -Naur linux-2.4.17.orig/arch/mips/sgi-ip22/ip22-mc.c linux-2.4.17/arch/mips/sgi-ip22/ip22-mc.c
--- linux-2.4.17.orig/arch/mips/sgi-ip22/ip22-mc.c Tue Nov 27 16:57:11 2001
+++ linux-2.4.17/arch/mips/sgi-ip22/ip22-mc.c Fri Feb 15 09:55:07 2002
@@ -82,6 +82,14 @@
* interrupts are first enabled etc.
*/
+ /* Step 0: Make sure we turn off the watchdog in case it's
+ * still running (which might be the case after a
+ * soft reboot).
+ */
+ tmpreg = mcmisc_regs->cpuctrl0;
+ tmpreg &= ~SGIMC_CCTRL0_WDOG;
+ mcmisc_regs->cpuctrl0 = tmpreg;
+
/* Step 1: The CPU/GIO error status registers will not latch
* up a new error status until the register has been
* cleared by the cpu. These status registers are
diff --exclude=CVS -Naur linux-2.4.17.orig/drivers/char/Config.in linux-2.4.17/drivers/char/Config.in
--- linux-2.4.17.orig/drivers/char/Config.in Sun Dec 2 12:34:40 2001
+++ linux-2.4.17/drivers/char/Config.in Fri Feb 15 10:00:59 2002
@@ -199,6 +199,7 @@
tristate ' SBC-60XX Watchdog Timer' CONFIG_60XX_WDT
tristate ' W83877F (EMACS) Watchdog Timer' CONFIG_W83877F_WDT
tristate ' ZF MachZ Watchdog' CONFIG_MACHZ_WDT
+ dep_tristate ' Indy/I2 Hardware Watchdog' CONFIG_INDYDOG $CONFIG_SGI_IP22
fi
endmenu
diff --exclude=CVS -Naur linux-2.4.17.orig/drivers/char/Makefile linux-2.4.17/drivers/char/Makefile
--- linux-2.4.17.orig/drivers/char/Makefile Mon Jan 7 04:33:54 2002
+++ linux-2.4.17/drivers/char/Makefile Fri Feb 15 09:55:07 2002
@@ -245,6 +245,7 @@
obj-$(CONFIG_SH_WDT) += shwdt.o
obj-$(CONFIG_EUROTECH_WDT) += eurotechwdt.o
obj-$(CONFIG_SOFT_WATCHDOG) += softdog.o
+obj-$(CONFIG_INDYDOG) += indydog.o
subdir-$(CONFIG_MWAVE) += mwave
ifeq ($(CONFIG_MWAVE),y)
diff --exclude=CVS -Naur linux-2.4.17.orig/drivers/char/indydog.c linux-2.4.17/drivers/char/indydog.c
--- linux-2.4.17.orig/drivers/char/indydog.c Thu Jan 1 01:00:00 1970
+++ linux-2.4.17/drivers/char/indydog.c Fri Feb 15 09:55:07 2002
@@ -0,0 +1,158 @@
+/*
+ * IndyDog 0.2 A Hardware Watchdog Device for SGI IP22
+ *
+ * (c) Copyright 2002 Guido Guenther <agx@sigxcpu.org>, All Rights Reserved.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version
+ * 2 of the License, or (at your option) any later version.
+ *
+ * based on softdog.c by Alan Cox <alan@redhat.com>
+ */
+
+#include <linux/module.h>
+#include <linux/config.h>
+#include <linux/types.h>
+#include <linux/kernel.h>
+#include <linux/fs.h>
+#include <linux/mm.h>
+#include <linux/miscdevice.h>
+#include <linux/watchdog.h>
+#include <linux/smp_lock.h>
+#include <linux/init.h>
+#include <asm/uaccess.h>
+#include <asm/sgi/sgimc.h>
+
+static int indydog_alive;
+static struct sgimc_misc_ctrl *mcmisc_regs;
+
+static void indydog_ping()
+{
+ mcmisc_regs->watchdogt = 0;
+}
+
+
+/*
+ * Allow only one person to hold it open
+ */
+
+static int indydog_open(struct inode *inode, struct file *file)
+{
+ u32 mc_ctrl0;
+
+ if(indydog_alive)
+ return -EBUSY;
+#ifdef CONFIG_WATCHDOG_NOWAYOUT
+ MOD_INC_USE_COUNT;
+#endif
+ /*
+ * Activate timer
+ */
+ mcmisc_regs = (struct sgimc_misc_ctrl *)(KSEG1+0x1fa00000);
+
+ mc_ctrl0 = mcmisc_regs->cpuctrl0 | SGIMC_CCTRL0_WDOG;
+ mcmisc_regs->cpuctrl0 = mc_ctrl0;
+ indydog_ping();
+
+ indydog_alive=1;
+ printk("Started watchdog timer.\n");
+ return 0;
+}
+
+static int indydog_release(struct inode *inode, struct file *file)
+{
+ /*
+ * Shut off the timer.
+ * Lock it in if it's a module and we defined ...NOWAYOUT
+ */
+ lock_kernel();
+#ifndef CONFIG_WATCHDOG_NOWAYOUT
+ {
+ u32 mc_ctrl0 = mcmisc_regs->cpuctrl0;
+ mc_ctrl0 &= ~SGIMC_CCTRL0_WDOG;
+ mcmisc_regs->cpuctrl0 = mc_ctrl0;
+ printk("Stopped watchdog timer.\n");
+ }
+#endif
+ indydog_alive=0;
+ unlock_kernel();
+ return 0;
+}
+
+static ssize_t indydog_write(struct file *file, const char *data, size_t len, loff_t *ppos)
+{
+ /* Can't seek (pwrite) on this device */
+ if (ppos != &file->f_pos)
+ return -ESPIPE;
+
+ /*
+ * Refresh the timer.
+ */
+ if(len) {
+ indydog_ping();
+ return 1;
+ }
+ return 0;
+}
+
+static int indydog_ioctl(struct inode *inode, struct file *file,
+ unsigned int cmd, unsigned long arg)
+{
+ static struct watchdog_info ident = {
+ identity: "Hardware Watchdog for SGI IP22",
+ };
+ switch (cmd) {
+ default:
+ return -ENOIOCTLCMD;
+ case WDIOC_GETSUPPORT:
+ if(copy_to_user((struct watchdog_info *)arg, &ident, sizeof(ident)))
+ return -EFAULT;
+ return 0;
+ case WDIOC_GETSTATUS:
+ case WDIOC_GETBOOTSTATUS:
+ return put_user(0,(int *)arg);
+ case WDIOC_KEEPALIVE:
+ indydog_ping();
+ return 0;
+ }
+}
+
+static struct file_operations indydog_fops = {
+ owner: THIS_MODULE,
+ write: indydog_write,
+ ioctl: indydog_ioctl,
+ open: indydog_open,
+ release: indydog_release,
+};
+
+static struct miscdevice indydog_miscdev = {
+ minor: WATCHDOG_MINOR,
+ name: "watchdog",
+ fops: &indydog_fops,
+};
+
+static const char banner[] __initdata = KERN_INFO "Hardware Watchdog Timer for SGI IP22: 0.2\n";
+
+static int __init watchdog_init(void)
+{
+ int ret;
+
+ ret = misc_register(&indydog_miscdev);
+
+ if (ret)
+ return ret;
+
+ printk(banner);
+
+ return 0;
+}
+
+static void __exit watchdog_exit(void)
+{
+ misc_deregister(&indydog_miscdev);
+}
+
+module_init(watchdog_init);
+module_exit(watchdog_exit);
+MODULE_LICENSE("GPL");
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: ip22 watchdog timer
2002-02-15 15:42 ` Guido Guenther
@ 2002-02-15 16:19 ` Maciej W. Rozycki
0 siblings, 0 replies; 12+ messages in thread
From: Maciej W. Rozycki @ 2002-02-15 16:19 UTC (permalink / raw)
To: Guido Guenther; +Cc: Ralf Baechle, linux-mips
On Fri, 15 Feb 2002, Guido Guenther wrote:
> While we're at this: The machine selection in config.in is of type bool. Shouldn't this
> be of type "choice"? Do we really support several(arbitrary) machine selections in
> one kernel?
Not at this time, AFAIK, but the intent is to do one day, I believe, at
least for ones that it's possible.
> Does this look better?
OK for me.
--
+ Maciej W. Rozycki, Technical University of Gdansk, Poland +
+--------------------------------------------------------------+
+ e-mail: macro@ds2.pg.gda.pl, PGP key available +
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: ip22 watchdog timer
2002-02-15 14:21 ` Ralf Baechle
2002-02-15 14:41 ` Maciej W. Rozycki
@ 2002-02-15 20:33 ` Jim Paris
1 sibling, 0 replies; 12+ messages in thread
From: Jim Paris @ 2002-02-15 20:33 UTC (permalink / raw)
To: Ralf Baechle; +Cc: Maciej W. Rozycki, Guido Guenther, linux-mips
> > BTW, why do people insist on sending patches as attachments -- it makes
> > commenting them helly twisted, sigh...
>
> How true. MIME - broken solution for a broken design ;) More serious,
> MIME makes sense when using a MUA that garbles patches like Netscape or
> certain versions of Pine.
>
> Ralf (Prolly still be using Mutt + vi in 5 years ...)
Patches as attachments are actually really convenient with Mutt.
You can view them seperately, extract and save them easily, etc.
To comment on both the original message and the attachments: use
view-attachments (v), use tag-entry (t) on all of the parts you want
quoted in your reply, and then use tag-prefix & reply (;r)
(or ;g or whatever).
But I digress :)
-jim
^ permalink raw reply [flat|nested] 12+ messages in thread
* RE: ip22 watchdog timer
2002-02-15 15:06 ` Ralf Baechle
@ 2002-02-15 21:02 ` Matthew Dharm
2002-02-15 21:02 ` Matthew Dharm
0 siblings, 1 reply; 12+ messages in thread
From: Matthew Dharm @ 2002-02-15 21:02 UTC (permalink / raw)
To: Ralf Baechle, Maciej W. Rozycki; +Cc: Guido Guenther, linux-mips
Oddly enough, I have the exact opposite attitude...
I will barely accept inlined patches (to the usb-storage driver, which
I maintain). About 85-90% of the inlined patches I get won't apply
cleanly because of whitespace mangling. MIME-attachments (of type
text/plain) seem to have a _much_ higher success rate.
Yes, the transition was painful. Heck, it still is. Some versions of
Outlook still don't understand the RFC-compliant way of attaching a
digital signature to a message -- I get complaints from people every
so often that all they see is a blank message with two attachments,
one of which is the "message" itself, and the other is my signature.
Matt
--
Matthew D. Dharm Senior Software Designer
Momentum Computer Inc. 1815 Aston Ave. Suite 107
(760) 431-8663 X-115 Carlsbad, CA 92008-7310
Momentum Works For You www.momenco.com
> -----Original Message-----
> From: owner-linux-mips@oss.sgi.com
> [mailto:owner-linux-mips@oss.sgi.com]On Behalf Of Ralf Baechle
> Sent: Friday, February 15, 2002 7:06 AM
> To: Maciej W. Rozycki
> Cc: Guido Guenther; linux-mips@oss.sgi.com
> Subject: Re: ip22 watchdog timer
>
>
> On Fri, Feb 15, 2002 at 03:41:49PM +0100, Maciej W. Rozycki wrote:
>
> > > How true. MIME - broken solution for a broken design
> ;) More serious,
> >
> > Why broken? It's not broken for what it was invented
> to, i.e. for
> > passing unsafe characters via SMTP. Source patches do
> not qualify as
> > containing such.
>
> The transition time from pre-MIME to MIME was pretty
> painful. If you'd
> have gone through the same pains that I did during the MIME
> introduction
> you'd probably understand why I call it a broken fix for a
> broken system.
> Fortunately now that the childhood problems have been
> solved MIME looks
> alot saner but still I prefer plaintext for patches.
>
> Ralf
>
^ permalink raw reply [flat|nested] 12+ messages in thread
* RE: ip22 watchdog timer
2002-02-15 21:02 ` Matthew Dharm
@ 2002-02-15 21:02 ` Matthew Dharm
0 siblings, 0 replies; 12+ messages in thread
From: Matthew Dharm @ 2002-02-15 21:02 UTC (permalink / raw)
To: Ralf Baechle, Maciej W. Rozycki; +Cc: Guido Guenther, linux-mips
Oddly enough, I have the exact opposite attitude...
I will barely accept inlined patches (to the usb-storage driver, which
I maintain). About 85-90% of the inlined patches I get won't apply
cleanly because of whitespace mangling. MIME-attachments (of type
text/plain) seem to have a _much_ higher success rate.
Yes, the transition was painful. Heck, it still is. Some versions of
Outlook still don't understand the RFC-compliant way of attaching a
digital signature to a message -- I get complaints from people every
so often that all they see is a blank message with two attachments,
one of which is the "message" itself, and the other is my signature.
Matt
--
Matthew D. Dharm Senior Software Designer
Momentum Computer Inc. 1815 Aston Ave. Suite 107
(760) 431-8663 X-115 Carlsbad, CA 92008-7310
Momentum Works For You www.momenco.com
> -----Original Message-----
> From: owner-linux-mips@oss.sgi.com
> [mailto:owner-linux-mips@oss.sgi.com]On Behalf Of Ralf Baechle
> Sent: Friday, February 15, 2002 7:06 AM
> To: Maciej W. Rozycki
> Cc: Guido Guenther; linux-mips@oss.sgi.com
> Subject: Re: ip22 watchdog timer
>
>
> On Fri, Feb 15, 2002 at 03:41:49PM +0100, Maciej W. Rozycki wrote:
>
> > > How true. MIME - broken solution for a broken design
> ;) More serious,
> >
> > Why broken? It's not broken for what it was invented
> to, i.e. for
> > passing unsafe characters via SMTP. Source patches do
> not qualify as
> > containing such.
>
> The transition time from pre-MIME to MIME was pretty
> painful. If you'd
> have gone through the same pains that I did during the MIME
> introduction
> you'd probably understand why I call it a broken fix for a
> broken system.
> Fortunately now that the childhood problems have been
> solved MIME looks
> alot saner but still I prefer plaintext for patches.
>
> Ralf
>
^ permalink raw reply [flat|nested] 12+ messages in thread
end of thread, other threads:[~2002-02-15 22:02 UTC | newest]
Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-02-08 17:27 ip22 watchdog timer Guido Guenther
2002-02-15 4:56 ` Ralf Baechle
2002-02-15 12:06 ` Guido Guenther
2002-02-15 14:17 ` Maciej W. Rozycki
2002-02-15 14:21 ` Ralf Baechle
2002-02-15 14:41 ` Maciej W. Rozycki
2002-02-15 15:06 ` Ralf Baechle
2002-02-15 21:02 ` Matthew Dharm
2002-02-15 21:02 ` Matthew Dharm
2002-02-15 20:33 ` Jim Paris
2002-02-15 15:42 ` Guido Guenther
2002-02-15 16:19 ` Maciej W. Rozycki
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox