Commit 2891b6ad authored by Wim Van Sebroeck's avatar Wim Van Sebroeck

[WATCHDOG] pcwd.c firmware-info patch

Get the firmware version into the private data struct
of the ISA-PC watchdog card.
Signed-off-by: default avatarWim Van Sebroeck <wim@iguana.be>
parent 4206f0c4
...@@ -146,6 +146,7 @@ static atomic_t open_allowed = ATOMIC_INIT(1); ...@@ -146,6 +146,7 @@ static atomic_t open_allowed = ATOMIC_INIT(1);
static char expect_close; static char expect_close;
static int temp_panic; static int temp_panic;
static struct { /* this is private data for each ISA-PC watchdog card */ static struct { /* this is private data for each ISA-PC watchdog card */
char fw_ver_str[6]; /* The cards firmware version */
int revision; /* The card's revision */ int revision; /* The card's revision */
int supports_temp; /* Wether or not the card has a temperature device */ int supports_temp; /* Wether or not the card has a temperature device */
int command_mode; /* Wether or not the card is in command mode */ int command_mode; /* Wether or not the card is in command mode */
...@@ -238,27 +239,22 @@ static inline void pcwd_check_temperature_support(void) ...@@ -238,27 +239,22 @@ static inline void pcwd_check_temperature_support(void)
pcwd_private.supports_temp = 1; pcwd_private.supports_temp = 1;
} }
static inline char *get_firmware(void) static inline void pcwd_get_firmware(void)
{ {
int one, ten, hund, minor; int one, ten, hund, minor;
char *ret;
ret = kmalloc(6, GFP_KERNEL); sprintf(pcwd_private.fw_ver_str, "ERROR");
if(ret == NULL)
return NULL;
if (set_command_mode()) { if (set_command_mode()) {
one = send_isa_command(CMD_ISA_VERSION_INTEGER); one = send_isa_command(CMD_ISA_VERSION_INTEGER);
ten = send_isa_command(CMD_ISA_VERSION_TENTH); ten = send_isa_command(CMD_ISA_VERSION_TENTH);
hund = send_isa_command(CMD_ISA_VERSION_HUNDRETH); hund = send_isa_command(CMD_ISA_VERSION_HUNDRETH);
minor = send_isa_command(CMD_ISA_VERSION_MINOR); minor = send_isa_command(CMD_ISA_VERSION_MINOR);
sprintf(ret, "%c.%c%c%c", one, ten, hund, minor); sprintf(pcwd_private.fw_ver_str, "%c.%c%c%c", one, ten, hund, minor);
} }
else
sprintf(ret, "ERROR");
unset_command_mode(); unset_command_mode();
return(ret);
return;
} }
static inline int pcwd_get_option_switches(void) static inline int pcwd_get_option_switches(void)
...@@ -276,17 +272,15 @@ static inline int pcwd_get_option_switches(void) ...@@ -276,17 +272,15 @@ static inline int pcwd_get_option_switches(void)
static void pcwd_show_card_info(void) static void pcwd_show_card_info(void)
{ {
char *firmware;
int option_switches; int option_switches;
/* Get some extra info from the hardware (in command/debug/diag mode) */ /* Get some extra info from the hardware (in command/debug/diag mode) */
if (pcwd_private.revision == PCWD_REVISION_A) if (pcwd_private.revision == PCWD_REVISION_A)
printk(KERN_INFO PFX "ISA-PC Watchdog (REV.A) detected at port 0x%04x\n", pcwd_private.io_addr); printk(KERN_INFO PFX "ISA-PC Watchdog (REV.A) detected at port 0x%04x\n", pcwd_private.io_addr);
else if (pcwd_private.revision == PCWD_REVISION_C) { else if (pcwd_private.revision == PCWD_REVISION_C) {
firmware = get_firmware(); pcwd_get_firmware();
printk(KERN_INFO PFX "ISA-PC Watchdog (REV.C) detected at port 0x%04x (Firmware version: %s)\n", printk(KERN_INFO PFX "ISA-PC Watchdog (REV.C) detected at port 0x%04x (Firmware version: %s)\n",
pcwd_private.io_addr, firmware); pcwd_private.io_addr, pcwd_private.fw_ver_str);
kfree(firmware);
option_switches = pcwd_get_option_switches(); option_switches = pcwd_get_option_switches();
printk(KERN_INFO PFX "Option switches (0x%02x): Temperature Reset Enable=%s, Power On Delay=%s\n", printk(KERN_INFO PFX "Option switches (0x%02x): Temperature Reset Enable=%s, Power On Delay=%s\n",
option_switches, option_switches,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment