Lines Matching +full:reset +full:- +full:time +full:- +full:sec
3 Copyright (c) 2001-2017, Intel Corporation
47 while (atomic_cmpset_int(&sc->bypass.low, 0, 1) == 0)
49 while (atomic_cmpset_int(&sc->bypass.high, 0, 1) == 0)
60 while (atomic_cmpset_int(&sc->bypass.high, 1, 0) == 0)
62 while (atomic_cmpset_int(&sc->bypass.low, 1, 0) == 0)
75 while (atomic_cmpset_int(&sc->bypass.high, 0, 1) == 0)
86 while (atomic_cmpset_int(&sc->bypass.high, 1, 0) == 0)
95 ixgbe_get_bypass_time(u32 *year, u32 *sec)
99 *year = 1970; /* time starts at 01/01/1970 */
101 *sec = current.tv_sec;
103 while(*sec > SEC_THIS_YEAR(*year)) {
104 *sec -= SEC_THIS_YEAR(*year);
118 struct ixgbe_hw *hw = &sc->hw;
127 if ((error = hw->mac.ops.bypass_rw(hw, cmd, &version) != 0))
131 if ((error = hw->mac.ops.bypass_rw(hw, cmd, &version) != 0))
158 struct ixgbe_hw *hw = &sc->hw;
164 error = hw->mac.ops.bypass_rw(hw, BYPASS_PAGE_CTL0, &state);
171 if ((error != 0) || (req->newptr == NULL))
184 if ((error = hw->mac.ops.bypass_set(hw, BYPASS_PAGE_CTL0,
188 error = hw->mac.ops.bypass_set(hw, BYPASS_PAGE_CTL0,
201 * 0 - no change for the event (NOP)
202 * 1 - go to Normal operation
203 * 2 - go to Bypass operation
204 * 3 - go to Isolate operation
219 struct ixgbe_hw *hw = &sc->hw;
225 error = hw->mac.ops.bypass_rw(hw, BYPASS_PAGE_CTL0, &timeout);
232 if ((error) || (req->newptr == NULL))
248 error = hw->mac.ops.bypass_set(hw, BYPASS_PAGE_CTL0,
262 struct ixgbe_hw *hw = &sc->hw;
267 error = hw->mac.ops.bypass_rw(hw, BYPASS_PAGE_CTL0, &main_on);
274 if ((error) || (req->newptr == NULL))
290 error = hw->mac.ops.bypass_set(hw, BYPASS_PAGE_CTL0,
304 struct ixgbe_hw *hw = &sc->hw;
309 error = hw->mac.ops.bypass_rw(hw, BYPASS_PAGE_CTL0, &main_off);
316 if ((error) || (req->newptr == NULL))
332 error = hw->mac.ops.bypass_set(hw, BYPASS_PAGE_CTL0,
346 struct ixgbe_hw *hw = &sc->hw;
351 error = hw->mac.ops.bypass_rw(hw, BYPASS_PAGE_CTL0, &aux_on);
358 if ((error) || (req->newptr == NULL))
374 error = hw->mac.ops.bypass_set(hw, BYPASS_PAGE_CTL0,
388 struct ixgbe_hw *hw = &sc->hw;
393 error = hw->mac.ops.bypass_rw(hw, BYPASS_PAGE_CTL0, &aux_off);
400 if ((error) || (req->newptr == NULL))
416 error = hw->mac.ops.bypass_set(hw, BYPASS_PAGE_CTL0,
424 * ixgbe_bp_wd_set - Set the Watchdog timer value
427 * - 0 will disable the watchdog
428 * - 1, 2, 3, 4, 8, 16, 32
429 * - anything else is invalid and will be ignored
435 struct ixgbe_hw *hw = &sc->hw;
442 error = hw->mac.ops.bypass_rw(hw, BYPASS_PAGE_CTL0, &tmp);
454 if ((error) || (req->newptr == NULL))
491 error = hw->mac.ops.bypass_set(hw, BYPASS_PAGE_CTL0, mask, arg);
498 * ixgbe_bp_wd_reset - Reset the Watchdog timer
506 struct ixgbe_hw *hw = &sc->hw;
507 u32 sec, year;
512 if ((error) || (req->newptr == NULL))
517 /* Resync the FW time while writing to CTL1 anyway */
518 ixgbe_get_bypass_time(&year, &sec);
520 cmd |= (sec & BYPASS_CTL1_TIME_M) | BYPASS_CTL1_VALID;
524 error = hw->mac.ops.bypass_rw(hw, cmd, &reset_wd);
526 /* Read until it matches what we wrote, or we time out */
532 if (hw->mac.ops.bypass_rw(hw, BYPASS_PAGE_CTL1, &reset_wd)) {
536 } while (!hw->mac.ops.bypass_valid_rd(cmd, reset_wd));
544 * ixgbe_bp_log - Display the bypass log
546 * You must pass a non-zero arg to sysctl
552 struct ixgbe_hw *hw = &sc->hw;
561 if ((error) || (req->newptr == NULL))
564 /* Keep the log display single-threaded */
565 while (atomic_cmpset_int(&sc->bypass.log, 0, 1) == 0)
573 error = hw->mac.ops.bypass_rw(hw, cmd, &status);
582 error = hw->mac.ops.bypass_rw(hw, cmd, &status);
602 error = hw->mac.ops.bypass_rd_eep(hw, log_off + i,
611 error = hw->mac.ops.bypass_rd_eep(hw,
628 head = head ? head - 1 : BYPASS_MAX_LOGS;
633 while (count--) {
635 u32 mon, days, hours, min, sec;
636 u32 time = eeprom[count].logs & BYPASS_LOG_TIME_M;
651 /* verify vaild data 1 - 6 */
656 * time is in sec's this year, so convert to something
659 ixgbe_get_bypass_time(&year, &sec);
660 days = time / SEC_PER_DAY;
661 for (i = 11; days < day_mon[LEAP_YR(year)][i]; i--)
663 mon = i + 1; /* display month as 1-12 */
664 time -= (day_mon[LEAP_YR(year)][i] * SEC_PER_DAY);
665 days = (time / SEC_PER_DAY) + 1; /* first day is 1 */
666 time %= SEC_PER_DAY;
667 hours = time / (60 * 60);
668 time %= (60 * 60);
669 min = time / 60;
670 sec = time % 60;
671 device_printf(sc->dev,
672 "UT %02d/%02d %02d:%02d:%02d %8.8s -> %7.7s\n",
673 mon, days, hours, min, sec, event_str[event],
682 error = hw->mac.ops.bypass_rw(hw, cmd, &status);
693 status = 0; /* reset */
695 while (atomic_cmpset_int(&sc->bypass.log, 1, 0) == 0)
701 status = 0; /* reset */
702 while (atomic_cmpset_int(&sc->bypass.log, 1, 0) == 0)
708 * ixgbe_bypass_init - Set up infrastructure for the bypass feature
710 * Do time and sysctl initialization here. This feature is
716 struct ixgbe_hw *hw = &sc->hw;
717 device_t dev = sc->dev;
720 u32 mask, value, sec, year;
722 if (!(sc->feat_cap & IXGBE_FEATURE_BYPASS))
725 /* First set up time for the hardware */
726 ixgbe_get_bypass_time(&year, &sec);
732 value = (sec & BYPASS_CTL1_TIME_M) |
737 hw->mac.ops.bypass_set(hw, BYPASS_PAGE_CTL1, mask, value);
793 sc, 0, ixgbe_bp_wd_reset, "S", "Bypass WD Reset");
795 sc->feat_en |= IXGBE_FEATURE_BYPASS;