Re: watchdog timer programming

From: Stephane Rochoy <stephane.rochoy_at_stormshield.eu>
Date: Wed, 25 Sep 2024 07:13:20 UTC
mike tancsa <mike@sentex.net> writes:

> On 9/24/2024 2:46 AM, Stephane Rochoy wrote:
>>
>> mike tancsa <mike@sentex.net> writes:
>>
>>> I am trying to get
>>>
>>> superio0: <ITE IT8613 SuperIO (revision 0x0c)> at port 
>>> 0x2e-0x2f on isa0
>>> itwd0: <Watchdog Timer on ITE SuperIO> at WDT ldn 0x07 on 
>>> superio0
>>> itwd0: Configured for system reset on timeout
>>>
>>> working on FreeBSD.  The driver seems to load / attach fine, 
>>> but it does
>>> not want to reboot the box.  Adding a #define DIAGNOSTICS 1
>>>
>>> shows
>>>
>>> itwd0: <Watchdog Timer on ITE SuperIO> at WDT ldn 0x07 on 
>>> superio0
>>> itwd0: Configured for system reset on timeout
>>> itwd0: setting timeout to 4
>>> itwd0: setting timeout to 4
>>> itwd0: setting timeout to 4
>>> itwd0: setting timeout to 4
>>> itwd0: setting timeout to 4
>>> itwd0: setting timeout to 4
>>>
>>> when I do
>>>
>>>  watchdogd -t 3
>>>  killall -9 watchdogd
>>>
>>> but never a reboot :(
>>>
>>> Any idea how to get this hardware working ?
>>
>> Do you know if, at least, the pre-timeout is working?
>
>     How do I check that ?

Using --pretimeout and --pretimeout-action. See watchdogd(8) for
more details.

>> By the way, do you have the datasheet of the ITE chip? (I know 
>> I
>> must be very optimistic to ask such a question ;))
>
> I dont have the datasheet sadly. However, they do seem to be at
> …
> and are publicly available according to the
> Linux driver.
>
> I did load up ubuntu on the box, and the watchdog does seem to 
> work
> correctly.   sysctl doesnt seem to allow for setting those 
> values

The .nmi and .irq are FreeBSD-specific I guess. And they have to
be set via loader.conf(5). Note sysctl != tunable but tunable is,
most of the time, made available as sysctl.

> sysctl -A dev.itwd
> dev.itwd.0.%parent: superio0
> dev.itwd.0.%pnpinfo: type=WDT
> dev.itwd.0.%location: ldn=0x07
> dev.itwd.0.%driver: itwd
> dev.itwd.0.%desc: Watchdog Timer on ITE SuperIO
> dev.itwd.%parent:
>
> On linux,
> modprobe it87_wdt
> ] it87_wdt: Chip IT8613 revision 12 initialized. timeout=60 sec
> (nowayout=0 testmode=0)
>
> wdctl
> Device:        /dev/watchdog0
> Identity:      IT87 WDT [version 1]
> Timeout:       60 seconds
> Pre-timeout:    0 seconds
> FLAG           DESCRIPTION               STATUS BOOT-STATUS
> KEEPALIVEPING  Keep alive ping reply          1           0
> MAGICCLOSE     Supports magic close char      0           0
> SETTIMEOUT     Set timeout (in seconds)       0           0
>
> The code is at
> https://github.com/torvalds/linux/blob/master/drivers/watchdog/it87_wdt.c
> if that helps shed any light.

So chip is IT8613.

> i tried defining the irq and playing with the nmi at 1 or 0, and 
> still
> no luck. e.g. setting it to 0x05 and nmi 0, kldload (with boot 
> verbose)
> and then starting up watchdogd -t 8... wait 9 seconds,  and then 
> killall
> -9 watchdogd, still does not reboot the box
>
> itwd0: <Watchdog Timer on ITE SuperIO> at WDT ldn 0x07 on 
> superio0
> ioapic0: routing intpin 5 (ISA IRQ 5) to lapic 0 vector 56
> itwd0: Using IRQ5 to signal timeout
> itwd0: setting timeout to 8
> itwd0: setting timeout to 8
> itwd0: setting timeout to 8
> itwd0: setting timeout to 8
> itwd0: setting timeout to 8
> itwd0: setting timeout to 8
> itwd0: got interrupt, wdt status = 1
>
> Same with irq at 0x0f with and without nmi=0 or 1.
>
> itwd0: <Watchdog Timer on ITE SuperIO> at WDT ldn 0x07 on 
> superio0
> itwd0: Using IRQ15 to signal timeout
> itwd0: setting timeout to 16
> itwd0: setting timeout to 16
> itwd0: setting timeout to 16
> itwd0: setting timeout to 16
> itwd0: setting timeout to 4
> itwd0: setting timeout to 4
> itwd0: setting timeout to 4
> itwd0: setting timeout to 4
> itwd0: setting timeout to 4
> itwd0: setting timeout to 4
> itwd0: setting timeout to 4
> itwd0: setting timeout to 4

OK no luck. The Linux driver don't seems to set IRQ either.

Regards,
-- 
Stéphane Rochoy
O: Stormshield