Update of /cvsroot/leaf/devel/etitl/kernel/drivers/char
In directory sc8-pr-cvs1:/tmp/cvs-serv13002
Modified Files:
wd1100.c
Log Message:
- module parameter support
- processor model 9 and more support
- fixed bug in reboot_reason
Index: wd1100.c
===================================================================
RCS file: /cvsroot/leaf/devel/etitl/kernel/drivers/char/wd1100.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** wd1100.c 31 Aug 2003 18:24:20 -0000 1.1
--- wd1100.c 11 Sep 2003 19:53:33 -0000 1.2
***************
*** 11,14 ****
--- 11,19 ----
* 2 of the License, or (at your option) any later version.
*
+ * 09/10/2003
+ * - Module parameter support
+ * - Modern processor support
+ * added by Erich Titl [EMAIL PROTECTED]
+ *
*/
***************
*** 37,41 ****
#include <asm/processor.h>
! /* #define DEBUG_WD1100 */
static int proc_wd_timeout(ctl_table *ctl,
--- 42,48 ----
#include <asm/processor.h>
! /*
! #define DEBUG_WD1100
! */
static int proc_wd_timeout(ctl_table *ctl,
***************
*** 69,72 ****
--- 76,87 ----
/**************************************************************************/
+ #define GCB_LOCATION 0x1234 // just a dummy value
+
+ int gcb = GCB_LOCATION;
+ MODULE_PARM (gcb, "i");
+ MODULE_PARM_DESC (gcb, "The GCB location (default is to look into the scratch pad)");
+
+ /**************************************************************************/
+
/* XXX To-do: DEV_WATCHDOG must be in include/linux/sysctl.h */
enum
***************
*** 154,163 ****
static int reboot_reason(void)
{
! static int result;
static int fetched = 0;
if (!fetched)
{
- unsigned char sr;
sr = inb(cpu_base + CPU_WDSTS_REG);
--- 169,177 ----
static int reboot_reason(void)
{
! unsigned static char sr;
static int fetched = 0;
if (!fetched)
{
sr = inb(cpu_base + CPU_WDSTS_REG);
***************
*** 167,171 ****
}
! return (result);
}
--- 181,185 ----
}
! return ((sr & 0x01) ? 1 : 0);
}
***************
*** 216,219 ****
--- 230,235 ----
struct file *file)
{
+
+ int i;
spin_lock(&wd_lock);
if (in_use)
***************
*** 234,238 ****
*/
! outw(0xfc, cpu_base + CPU_WDCNFG_REG);
/* Start the watchdog: It won't run until we write the TO reg. */
--- 250,257 ----
*/
! i = inw(cpu_base + CPU_WDCNFG_REG);
! // keep the high order 7 bits of the config register
! // clear bit 8 and write 0xfc to the low order 8 bits
! outw((i & 0xfe00) | 0x00fc, cpu_base + CPU_WDCNFG_REG);
/* Start the watchdog: It won't run until we write the TO reg. */
***************
*** 261,264 ****
--- 280,286 ----
* watchdog on close.
*/
+ #ifdef DEBUG_WD1100
+ printk(KERN_INFO "wd1100.c: releasing wd1100 sysctl_wd_graceful =
%x\n",sysctl_wd_graceful);
+ #endif
if (sysctl_wd_graceful)
outw(0, cpu_base + CPU_WDCNFG_REG);
***************
*** 307,333 ****
unsigned int cw;
! if ((strcmp(boot_cpu_data.x86_vendor_id, "Geode by NSC") != 0)
! || (boot_cpu_data.x86_model != 4))
{
! printk(KERN_WARNING "wd1100.c: This is not an SC1100 processor!\n");
return (0);
}
! /* get the CONFIG BLOCK ADDRESS from scratch pad register */
! dev = pci_find_device(SC1100_F5_VENDOR_ID,SC1100_F5_DEVICE_ID,0);
! if (dev == NULL)
{
! printk(KERN_ERR "wd1100.c: Can not find bridge device.\n");
! return (0);
}
! pci_read_config_dword(dev, 0x64, &cw);
! cpu_base = (unsigned short )cw;
#ifdef DEBUG_WD1100
! printk("wd1100.c: CPU base = 0x%X\n", (unsigned int )cpu_base);
#endif
printk(KERN_INFO "SC1x00 Watchdog driver by Inprimis Technolgies.\n");
/*
* We must call reboot_reason() to reset the flag in the WD.
--- 329,379 ----
unsigned int cw;
! if (strcmp(boot_cpu_data.x86_vendor_id, "Geode by NSC") != 0)
{
! printk(KERN_ERR "wd1100.c: This is not an SC1100 processor!\n");
return (0);
}
! switch (boot_cpu_data.x86_model)
{
! case 4: // those are the models we know
! case 9:
! break;
! default:
! printk(KERN_WARNING "wd1100.c: unknown model value %d, trying
anyway\n",boot_cpu_data.x86_model);
! break;
}
! if (gcb == GCB_LOCATION) // this is the assigned dummy value
! {
! #ifdef DEBUG_WD1100
! printk(KERN_INFO "wd1100.c: fetching the value for gcb from scratch pad\n");
! #endif
! /* get the CONFIG BLOCK ADDRESS from scratch pad register */
! dev = pci_find_device(SC1100_F5_VENDOR_ID,SC1100_F5_DEVICE_ID,0);
! if (dev == NULL)
! {
! printk(KERN_ERR "wd1100.c: Can not find bridge device.\n");
! return (0);
! }
!
! // read a double word at offset 0x64 into cw
! pci_read_config_dword(dev, 0x64, &cw);
! cpu_base = (unsigned short )cw;
! }
! else // it is not the default value, just use it
! {
! #ifdef DEBUG_WD1100
! printk(KERN_INFO "wd1100.c: using the assigned value for gcb \n");
! #endif
! cpu_base = (unsigned short) gcb;
! }
#ifdef DEBUG_WD1100
! printk(KERN_INFO "wd1100.c: CPU base = 0x%X\n", (unsigned int )cpu_base);
#endif
printk(KERN_INFO "SC1x00 Watchdog driver by Inprimis Technolgies.\n");
+ printk(KERN_INFO "wd1100.c: a few hacks by [EMAIL PROTECTED]");
/*
* We must call reboot_reason() to reset the flag in the WD.
-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
Leaf-cvs-commits mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/leaf-cvs-commits