Add Linux Driver for Intel Langwell Watchdog
PATCH 1/1 Add Linux Driver for Intel Langwell Watchdog
This patch adds a Linux device driver for the Intel Langwell Watchdog device found on the Intel Mobile Internet device.
The purpose of the watchdog driver is to force a system reboot in the event that a critical system process either terminates or gets currupted so that it cannot perform its required duties.
This patch is referenced off the linux-next repository as pulled on Sunday, January 17, 2010
Date: January 17, 2010
--- drivers/watchdog/Kconfig | 7 + drivers/watchdog/Makefile | 1 + drivers/watchdog/langwell_watchdog.c | 551 ++++++++++++++++++++++++++++++++++ drivers/watchdog/langwell_watchdog.h | 60 ++++ 4 files changed, 619 insertions(+), 0 deletions(-) create mode 100644 drivers/watchdog/langwell_watchdog.c create mode 100644 drivers/watchdog/langwell_watchdog.h
drivers/watchdog/Kconfig +7 -0
@@ -448,6 +448,13 @@ config IBMASR To compile this driver as a module, choose M here: the module will be called ibmasr. +config LANGWELL_WATCHDOG + tristate "Intel Langwell Watchdog for Mobil Platforms" + depends on WATCHDOG + help + This driver is for the Intel Mobile Platform. If + in doubt, set it to N. + config WAFER_WDT tristate "ICP Single Board Computer Watchdog Timer" depends on X86
drivers/watchdog/Makefile +1 -0
@@ -96,6 +96,7 @@ obj-$(CONFIG_W83877F_WDT) += w83877f_wdt.o obj-$(CONFIG_W83977F_WDT) += w83977f_wdt.o obj-$(CONFIG_MACHZ_WDT) += machzwd.o obj-$(CONFIG_SBC_EPX_C3_WATCHDOG) += sbc_epx_c3.o +obj-$(CONFIG_LANGWELL_WATCHDOG) += langwell_watchdog.o # M32R Architecture
drivers/watchdog/langwell_watchdog.c new file +551 -0
551 lines not on this page · raw message
drivers/watchdog/langwell_watchdog.h new file +60 -0
60 lines not on this page · raw message
Signature · 1 line
1.6.0.6
Hi Mark,
Quoted 9 lines
This patch adds a Linux device driver for the Intel Langwell Watchdog device found on the Intel Mobile Internet device.
The purpose of the watchdog driver is to force a system reboot in the event that a critical system process either terminates or gets currupted so that it cannot perform its required duties.
This patch is referenced off the linux-next repository as pulled on Sunday, January 17, 2010
please skip this message or put it after the diffstat and ---. It has no useful information as commit message.
If we wanna provide extra details for the person applying these patches, then after the --- (like the diffstat) is a good place. These are showing up in the email and the archive, but are not part of the commit message when the patch gets applied.
Quoted 3 lines
Signed-off-by Mark Allyn <[email protected]>Date: January 17, 2010
What is this Date field for?
Regards
Marcel
drivers/watchdog/langwell_watchdog.c line 190
Quoted 4 lines
drivers/watchdog/langwell_watchdog.c new file +4
-0+/* send the threshold and soft_threshold via IPC to the Lincroft */ + reg_data.payload1 = watchdog_device.soft_threshold; + reg_data.payload2 = watchdog_device.threshold; +ipc_set_watchdog (®_data);
That still doesn't seem to be merged upstream - someone needs poking to at least get an IPC driver into staging.
drivers/watchdog/langwell_watchdog.c line 221
Quoted 10 lines
+ *
/dev/watchdoghandling
+ */drivers/watchdog/langwell_watchdog.c new file +8
-0+static int langwell_open (struct inode *inode,struct file *file) +{ +/* Miscdevice structure pointer already saved in private_data */ + +struct watchdog_reg_data reg_data; + +if (!capable (CAP_SYS_ADMIN )) +return -EPERM ;
File permissions will deal with that bit
drivers/watchdog/langwell_watchdog.c line 224
Quoted 3 lines
drivers/watchdog/langwell_watchdog.c new file +3
-0+ +if (test_and_set_bit (0 , &watchdog_device.driver_open)) +return -ENOTTY ;
EBUSY
Quoted 2 lines · Mark Allyn
This patch adds a Linux device driver for the Intel Langwell Watchdog device found on the Intel Mobile Internet device.
And it breaks the build, so how could we expect to apply it?
Please work to get the needed basic core upstream before adding drivers, otherwise it just does not work.
thanks,
greg k-h
Quoted 5 lines
drivers/watchdog/langwell_watchdog.c new file +4
-0+#include <linux/uaccess.h> +#include <linux/slab.h> +#include <linux/io.h> +#include <linux/interrupt.h>
drivers/watchdog/langwell_watchdog.c line 48
Quoted 10 lines
drivers/watchdog/langwell_watchdog.c new file +10
-0+#include <linux/delay.h> +#include <linux/sched.h> +#include <linux/signal.h> +#include <linux/sfi.h> +#include <linux/types.h> +#include <asm/irq.h> +#include <asm/atomic.h> + +/* See arch/x86/kernel/ipc_mrst.c */ +#include <asm/ipc_defs.h>
WTF?
Quoted 1 line
+/* #include <
asm/mrst.h> */
remove.
drivers/watchdog/langwell_watchdog.c line 65
Quoted 5 lines
drivers/watchdog/langwell_watchdog.c new file +5
-0+MODULE_PARM_DESC (timer_margin, +"Watchdog timer margin" +"Time between interrupt and resetting the system" +"The range is from 1 to 160" +"This is the time for all keep alives to arrive" );
In miliseconds or what?
Quoted 7 lines
drivers/watchdog/langwell_watchdog.c new file +7
-0+static int timer_set =DEFAULT_TIME ; +module_param (timer_set, int,0 ); + +MODULE_PARM_DESC (timer_set, +"Default Watchdog timer setting" +"Complete cycle time" + "The range is from 1 to 170"
drivers/watchdog/langwell_watchdog.c line 83
Quoted 10 lines
drivers/watchdog/langwell_watchdog.c new file +10
-0+ "This is the time for all keep alives to arrive"); + +/* driver will force boot on closure of device file */ +static int force_boot =1 ; + +module_param (force_boot, int,0 ); +MODULE_PARM_DESC (force_boot, +"A value of 1 means that the driver will reboot" +"the system if the /dev/watchdog device is closed" + );
I'd hope watchdogs were somehow standardized?
drivers/watchdog/langwell_watchdog.c line 93
Quoted 4 lines
drivers/watchdog/langwell_watchdog.c new file +4
-0+/* This is used to force reboot if anyone tries to close this device */ +static void watchdog_fire (void ) +{ +module_put (THIS_MODULE );
Why?
drivers/watchdog/langwell_watchdog.c line 105
Quoted 11 lines
drivers/watchdog/langwell_watchdog.c new file +11
-0+if (force_boot) { + printk(KERN_CRIT PFX "Initiating system reboot.\n"); +emergency_restart (); + printk(KERN_CRIT PFX "Reboot didn't ?????\n"); + } + +else { + printk(KERN_CRIT PFX "Reboot would have happend\n"); + printk(KERN_CRIT PFX "You now have force_boot set to 0\n"); + printk(KERN_CRIT PFX "I am not rebooting\n"); + }
Little chatty?
drivers/watchdog/langwell_watchdog.c line 118
Quoted 7 lines
drivers/watchdog/langwell_watchdog.c new file +7
-0+/* timer interrupt handler */ +irqreturn_t watchdog_timer_interrupt (int irq,void *dev_id) +{ +int int_status; + int_status =ioread32 (watchdog_device.timer_interrupt_status_addr); + +pr_debug ("Watchdog timer - irq 7 interrupt received\n" );
is it always irq 7?
Quoted 16 lines
drivers/watchdog/langwell_watchdog.c new file +16
-0+static int langwell_set_heartbeat (u32 t) +{ +struct watchdog_reg_data reg_data; + + watchdog_device.timer_set = t; + watchdog_device.threshold = + timer_margin * watchdog_device.mtmr_ptr->freq; + watchdog_device.soft_threshold = + (watchdog_device.timer_set - timer_margin) + * watchdog_device.mtmr_ptr->freq; + +pr_debug ("Watchdog timer - timer_margin is %x (hex) seconds\n" , + timer_margin); + +pr_debug ("Watchdog timer - following are in clock cycles\n" ); +
drivers/watchdog/langwell_watchdog.c line 182
Quoted 10 lines
drivers/watchdog/langwell_watchdog.c new file +10
-0+pr_debug ("Watchdog timer - there are %x (hex) clock cycles\n" , + watchdog_device.mtmr_ptr->freq); + +pr_debug ("Watchdog timer - per second\n" ); + +pr_debug ("Watchdog timer - thres is %x (hex) and warm is %x (hex)\n" , + watchdog_device.threshold, watchdog_device.soft_threshold); + +pr_debug ("Watchdog timer - setting timer_set is %x (hex) seconds\n" , + watchdog_device.timer_set);
Kill excessive debugging?
Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
drivers/watchdog/Kconfig config IBMASR · line 452
Quoted 7 lines
+++ b/drivers/watchdog/Kconfig
drivers/watchdog/Kconfig +2
-0@@ -448,6 +448,13 @@ config IBMASR To compile this driver as a module, choose M here: the module will be called ibmasr. +config LANGWELL_WATCHDOG + tristate "Intel Langwell Watchdog for Mobil Platforms"
typo?
Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html