Date: Tue, 24 Sep 2024 11:29:35 -0400 From: mike tancsa <mike@sentex.net> To: Chris6 via freebsd-hardware <freebsd-hardware@freebsd.org> Subject: Re: watchdog timer programming Message-ID: <9008b389-ab06-401d-9a95-84f849ca602a@sentex.net> In-Reply-To: <86plotbk5b.fsf@cthulhu.stephaner.labo.int> References: <3065debc-8d4f-4487-abbb-c9408810cea6@sentex.net> <86plotbk5b.fsf@cthulhu.stephaner.labo.int>
next in thread | previous in thread | raw e-mail | index | archive | help
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? Hi,    How do I check that ? > > Glancing at the code, this chip can be configured to use a specific > IRQ (its > default one is 0x40) and have an "NMI mode" (relying on an > explicitly configured IRQ). Maybe playing with the dev.itwd.irq and .nwi > tunables could get us some hints. > > Also this code from itwd's wd_func puzzle me a bit: > >   superio_write(dev, 0x73, val); >   if (superio_read(dev, 0x73) != val) >     superio_write(dev, 0x73, val); > > It let me think that we either are writing twice to the same I/O > port by mistake or the corresponding chip's register enforce a > specific protocol to modify it. If the later, the code don't seems > to be able to detect a "protocol error". > > 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 http://www.ite.com.tw/ 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 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. 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    ---Mike > > Regards,
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?9008b389-ab06-401d-9a95-84f849ca602a>