* Watchdog event handler. */
| 477 | * Watchdog event handler. |
| 478 | */ |
| 479 | static void |
| 480 | mv_watchdog_event(void *arg, unsigned int cmd, int *error) |
| 481 | { |
| 482 | uint64_t ns; |
| 483 | uint64_t ticks; |
| 484 | |
| 485 | mtx_lock(&timer_softc->timer_mtx); |
| 486 | if (cmd == 0) { |
| 487 | if (timer_softc->config->watchdog_disable != NULL) |
| 488 | timer_softc->config->watchdog_disable(); |
| 489 | } else { |
| 490 | /* |
| 491 | * Watchdog timeout is in nanosecs, calculation according to |
| 492 | * watchdog(9) |
| 493 | */ |
| 494 | ns = (uint64_t)1 << (cmd & WD_INTERVAL); |
| 495 | ticks = (uint64_t)(ns * timer_softc->config->clock_src) / 1000000000; |
| 496 | if (ticks > MAX_WATCHDOG_TICKS) { |
| 497 | if (timer_softc->config->watchdog_disable != NULL) |
| 498 | timer_softc->config->watchdog_disable(); |
| 499 | } else { |
| 500 | mv_set_timer(WATCHDOG_TIMER_ARMV5, ticks); |
| 501 | if (timer_softc->config->watchdog_enable != NULL) |
| 502 | timer_softc->config->watchdog_enable(); |
| 503 | *error = 0; |
| 504 | } |
| 505 | } |
| 506 | mtx_unlock(&timer_softc->timer_mtx); |
| 507 | } |
| 508 | |
| 509 | static int |
| 510 | mv_timer_start(struct eventtimer *et, sbintime_t first, sbintime_t period) |
nothing calls this directly
no test coverage detected