Lines Matching +full:watchdog +full:- +full:timer
1 /*-
2 * SPDX-License-Identifier: BSD-2-Clause
38 #include <sys/watchdog.h>
45 #define viawd_read_4(sc, off) bus_read_4((sc)->wd_res, (off))
47 bus_write_4((sc)->wd_res, (off), (val))
50 { DEVICEID_VT8251, "VIA VT8251 watchdog timer" },
51 { DEVICEID_CX700, "VIA CX700 watchdog timer" },
52 { DEVICEID_VX800, "VIA VX800 watchdog timer" },
53 { DEVICEID_VX855, "VIA VX855 watchdog timer" },
54 { DEVICEID_VX900, "VIA VX900 watchdog timer" },
82 sc->timeout = timeout; in viawd_tmr_set()
86 * Watchdog event handler - called by the framework to enable or disable
87 * the watchdog or change the initial timeout value.
95 /* Convert from power-of-two-ns to second. */ in viawd_event()
99 if (timeout != sc->timeout) in viawd_event()
115 for (id = viawd_devices; id->desc != NULL; id++) in viawd_find()
116 if (pci_get_device(dev) == id->device) in viawd_find()
128 if (device_find_child(parent, driver->name, DEVICE_UNIT_ANY) == NULL) in viawd_identify()
129 BUS_ADD_CHILD(parent, 0, driver->name, 0); in viawd_identify()
139 device_set_desc(dev, id->desc); in viawd_probe()
151 sc->dev = dev; in viawd_attach()
155 device_printf(dev, "Can not find watchdog device.\n"); in viawd_attach()
158 sc->sb_dev = sb_dev; in viawd_attach()
160 /* Get watchdog memory base. */ in viawd_attach()
164 "Watchdog disabled in BIOS or hardware\n"); in viawd_attach()
169 sc->wd_rid = VIAWD_CONFIG_BASE; in viawd_attach()
170 sc->wd_res = bus_alloc_resource_any(sb_dev, SYS_RES_MEMORY, &sc->wd_rid, in viawd_attach()
172 if (sc->wd_res == NULL) { in viawd_attach()
173 device_printf(dev, "Unable to map watchdog memory\n"); in viawd_attach()
176 if (rman_get_size(sc->wd_res) < VIAWD_MEM_LEN) { in viawd_attach()
177 device_printf(dev, "Bad size for watchdog memory: %#x\n", in viawd_attach()
178 (unsigned)rman_get_size(sc->wd_res)); in viawd_attach()
182 /* Check if watchdog fired last boot. */ in viawd_attach()
186 "ERROR: watchdog rebooted the system\n"); in viawd_attach()
191 /* Register the watchdog event handler. */ in viawd_attach()
192 sc->ev_tag = EVENTHANDLER_REGISTER(watchdog_list, viawd_event, sc, 0); in viawd_attach()
196 if (sc->wd_res != NULL) in viawd_attach()
198 sc->wd_rid, sc->wd_res); in viawd_attach()
211 if (sc->ev_tag != NULL) in viawd_detach()
212 EVENTHANDLER_DEREGISTER(watchdog_list, sc->ev_tag); in viawd_detach()
213 sc->ev_tag = NULL; in viawd_detach()
216 * Do not stop the watchdog on shutdown if active but bump the in viawd_detach()
217 * timer to avoid spurious reset. in viawd_detach()
224 "Keeping watchdog alive during shutdown for %d seconds\n", in viawd_detach()
228 if (sc->wd_res != NULL) in viawd_detach()
229 bus_release_resource(sc->sb_dev, SYS_RES_MEMORY, in viawd_detach()
230 sc->wd_rid, sc->wd_res); in viawd_detach()