···229229 pcwd_private.supports_temp = 1;230230}231231232232+static inline char *get_firmware(void)233233+{234234+ int one, ten, hund, minor;235235+ char *ret;236236+237237+ ret = kmalloc(6, GFP_KERNEL);238238+ if(ret == NULL)239239+ return NULL;240240+241241+ if (set_command_mode()) {242242+ one = send_isa_command(CMD_ISA_VERSION_INTEGER);243243+ ten = send_isa_command(CMD_ISA_VERSION_TENTH);244244+ hund = send_isa_command(CMD_ISA_VERSION_HUNDRETH);245245+ minor = send_isa_command(CMD_ISA_VERSION_MINOR);246246+ sprintf(ret, "%c.%c%c%c", one, ten, hund, minor);247247+ }248248+ else249249+ sprintf(ret, "ERROR");250250+251251+ unset_command_mode();252252+ return(ret);253253+}254254+255255+static inline int pcwd_get_option_switches(void)256256+{257257+ int option_switches=0;258258+259259+ if (set_command_mode()) {260260+ /* Get switch settings */261261+ option_switches = send_isa_command(CMD_ISA_SWITCH_SETTINGS);262262+ }263263+264264+ unset_command_mode();265265+ return(option_switches);266266+}267267+268268+static void pcwd_show_card_info(void)269269+{270270+ char *firmware;271271+ int option_switches;272272+273273+ /* Get some extra info from the hardware (in command/debug/diag mode) */274274+ if (pcwd_private.revision == PCWD_REVISION_A)275275+ printk(KERN_INFO PFX "ISA-PC Watchdog (REV.A) detected at port 0x%04x\n", pcwd_private.io_addr);276276+ else if (pcwd_private.revision == PCWD_REVISION_C) {277277+ firmware = get_firmware();278278+ printk(KERN_INFO PFX "ISA-PC Watchdog (REV.C) detected at port 0x%04x (Firmware version: %s)\n",279279+ pcwd_private.io_addr, firmware);280280+ kfree(firmware);281281+ option_switches = pcwd_get_option_switches();282282+ printk(KERN_INFO PFX "Option switches (0x%02x): Temperature Reset Enable=%s, Power On Delay=%s\n",283283+ option_switches,284284+ ((option_switches & 0x10) ? "ON" : "OFF"),285285+ ((option_switches & 0x08) ? "ON" : "OFF"));286286+287287+ /* Reprogram internal heartbeat to 2 seconds */288288+ if (set_command_mode()) {289289+ send_isa_command(CMD_ISA_DELAY_TIME_2SECS);290290+ unset_command_mode();291291+ }292292+ }293293+294294+ if (pcwd_private.supports_temp)295295+ printk(KERN_INFO PFX "Temperature Option Detected\n");296296+297297+ if (pcwd_private.boot_status & WDIOF_CARDRESET)298298+ printk(KERN_INFO PFX "Previous reboot was caused by the card\n");299299+300300+ if (pcwd_private.boot_status & WDIOF_OVERHEAT) {301301+ printk(KERN_EMERG PFX "Card senses a CPU Overheat. Panicking!\n");302302+ printk(KERN_EMERG PFX "CPU Overheat\n");303303+ }304304+305305+ if (pcwd_private.boot_status == 0)306306+ printk(KERN_INFO PFX "No previous trip detected - Cold boot or reset\n");307307+}308308+232309static void pcwd_timer_ping(unsigned long data)233310{234311 int wdrst_stat;···721644 return r;722645}723646724724-static inline char *get_firmware(void)725725-{726726- int one, ten, hund, minor;727727- char *ret;728728-729729- ret = kmalloc(6, GFP_KERNEL);730730- if(ret == NULL)731731- return NULL;732732-733733- if (set_command_mode()) {734734- one = send_isa_command(CMD_ISA_VERSION_INTEGER);735735- ten = send_isa_command(CMD_ISA_VERSION_TENTH);736736- hund = send_isa_command(CMD_ISA_VERSION_HUNDRETH);737737- minor = send_isa_command(CMD_ISA_VERSION_MINOR);738738- sprintf(ret, "%c.%c%c%c", one, ten, hund, minor);739739- }740740- else741741- sprintf(ret, "ERROR");742742-743743- unset_command_mode();744744- return(ret);745745-}746746-747747-static inline int get_option_switches(void)748748-{749749- int rv=0;750750-751751- if (set_command_mode()) {752752- /* Get switch settings */753753- rv = send_isa_command(CMD_ISA_SWITCH_SETTINGS);754754- }755755-756756- unset_command_mode();757757- return(rv);758758-}759759-760647static int __devinit pcwatchdog_init(int base_addr)761648{762649 int ret;763763- char *firmware;764764- int option_switches;765650766651 cards_found++;767652 if (cards_found == 1)···771732 /* Check whether or not the card supports the temperature device */772733 pcwd_check_temperature_support();773734774774- /* Get some extra info from the hardware (in command/debug/diag mode) */775775- if (pcwd_private.revision == PCWD_REVISION_A)776776- printk(KERN_INFO PFX "ISA-PC Watchdog (REV.A) detected at port 0x%04x\n", pcwd_private.io_addr);777777- else if (pcwd_private.revision == PCWD_REVISION_C) {778778- firmware = get_firmware();779779- printk(KERN_INFO PFX "ISA-PC Watchdog (REV.C) detected at port 0x%04x (Firmware version: %s)\n",780780- pcwd_private.io_addr, firmware);781781- kfree(firmware);782782- option_switches = get_option_switches();783783- printk(KERN_INFO PFX "Option switches (0x%02x): Temperature Reset Enable=%s, Power On Delay=%s\n",784784- option_switches,785785- ((option_switches & 0x10) ? "ON" : "OFF"),786786- ((option_switches & 0x08) ? "ON" : "OFF"));787787-788788- /* Reprogram internal heartbeat to 2 seconds */789789- if (set_command_mode()) {790790- send_isa_command(CMD_ISA_DELAY_TIME_2SECS);791791- unset_command_mode();792792- }793793- } else {794794- /* Should NEVER happen, unless get_revision() fails. */795795- printk(KERN_INFO PFX "Unable to get revision\n");796796- release_region(pcwd_private.io_addr, (pcwd_private.revision == PCWD_REVISION_A) ? 2 : 4);797797- pcwd_private.io_addr = 0x0000;798798- return -1;799799- }800800-801801- if (pcwd_private.supports_temp)802802- printk(KERN_INFO PFX "Temperature Option Detected\n");803803-804804- if (pcwd_private.boot_status & WDIOF_CARDRESET)805805- printk(KERN_INFO PFX "Previous reboot was caused by the card\n");806806-807807- if (pcwd_private.boot_status & WDIOF_OVERHEAT) {808808- printk(KERN_EMERG PFX "Card senses a CPU Overheat. Panicking!\n");809809- printk(KERN_EMERG PFX "CPU Overheat\n");810810- }811811-812812- if (pcwd_private.boot_status == 0)813813- printk(KERN_INFO PFX "No previous trip detected - Cold boot or reset\n");735735+ /* Show info about the card itself */736736+ pcwd_show_card_info();814737815738 /* Check that the heartbeat value is within it's range ; if not reset to the default */816739 if (pcwd_set_heartbeat(heartbeat)) {