1 /******************************************************************************
3 Copyright (c) 2001-2017, Intel Corporation
6 Redistribution and use in source and binary forms, with or without
7 modification, are permitted provided that the following conditions are met:
9 1. Redistributions of source code must retain the above copyright notice,
10 this list of conditions and the following disclaimer.
12 2. Redistributions in binary form must reproduce the above copyright
13 notice, this list of conditions and the following disclaimer in the
14 documentation and/or other materials provided with the distribution.
16 3. Neither the name of the Intel Corporation nor the names of its
17 contributors may be used to endorse or promote products derived from
18 this software without specific prior written permission.
20 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23 ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
24 LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
25 CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
26 SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
27 INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
28 CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
29 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
30 POSSIBILITY OF SUCH DAMAGE.
32 ******************************************************************************/
38 /************************************************************************
39 * ixgbe_bypass_mutex_enter
41 * Mutex support for the bypass feature. Using a dual lock
42 * to facilitate a privileged access to the watchdog update
44 ************************************************************************/
46 ixgbe_bypass_mutex_enter(struct adapter *adapter)
48 while (atomic_cmpset_int(&adapter->bypass.low, 0, 1) == 0)
50 while (atomic_cmpset_int(&adapter->bypass.high, 0, 1) == 0)
53 } /* ixgbe_bypass_mutex_enter */
55 /************************************************************************
56 * ixgbe_bypass_mutex_clear
57 ************************************************************************/
59 ixgbe_bypass_mutex_clear(struct adapter *adapter)
61 while (atomic_cmpset_int(&adapter->bypass.high, 1, 0) == 0)
63 while (atomic_cmpset_int(&adapter->bypass.low, 1, 0) == 0)
66 } /* ixgbe_bypass_mutex_clear */
68 /************************************************************************
69 * ixgbe_bypass_wd_mutex_enter
71 * Watchdog entry is allowed to simply grab the high priority
72 ************************************************************************/
74 ixgbe_bypass_wd_mutex_enter(struct adapter *adapter)
76 while (atomic_cmpset_int(&adapter->bypass.high, 0, 1) == 0)
79 } /* ixgbe_bypass_wd_mutex_enter */
81 /************************************************************************
82 * ixgbe_bypass_wd_mutex_clear
83 ************************************************************************/
85 ixgbe_bypass_wd_mutex_clear(struct adapter *adapter)
87 while (atomic_cmpset_int(&adapter->bypass.high, 1, 0) == 0)
90 } /* ixgbe_bypass_wd_mutex_clear */
92 /************************************************************************
93 * ixgbe_get_bypass_time
94 ************************************************************************/
96 ixgbe_get_bypass_time(u32 *year, u32 *sec)
98 struct timespec current;
100 *year = 1970; /* time starts at 01/01/1970 */
102 *sec = current.tv_sec;
104 while(*sec > SEC_THIS_YEAR(*year)) {
105 *sec -= SEC_THIS_YEAR(*year);
108 } /* ixgbe_get_bypass_time */
110 /************************************************************************
113 * Display the feature version
114 ************************************************************************/
116 ixgbe_bp_version(SYSCTL_HANDLER_ARGS)
118 struct adapter *adapter = (struct adapter *) arg1;
119 struct ixgbe_hw *hw = &adapter->hw;
121 static int version = 0;
124 ixgbe_bypass_mutex_enter(adapter);
125 cmd = BYPASS_PAGE_CTL2 | BYPASS_WE;
126 cmd |= (BYPASS_EEPROM_VER_ADD << BYPASS_CTL2_OFFSET_SHIFT) &
127 BYPASS_CTL2_OFFSET_M;
128 if ((error = hw->mac.ops.bypass_rw(hw, cmd, &version) != 0))
132 if ((error = hw->mac.ops.bypass_rw(hw, cmd, &version) != 0))
134 ixgbe_bypass_mutex_clear(adapter);
135 version &= BYPASS_CTL2_DATA_M;
136 error = sysctl_handle_int(oidp, &version, 0, req);
139 ixgbe_bypass_mutex_clear(adapter);
142 } /* ixgbe_bp_version */
144 /************************************************************************
147 * Show/Set the Bypass State:
152 * With no argument the state is displayed,
153 * passing a value will set it.
154 ************************************************************************/
156 ixgbe_bp_set_state(SYSCTL_HANDLER_ARGS)
158 struct adapter *adapter = (struct adapter *) arg1;
159 struct ixgbe_hw *hw = &adapter->hw;
161 static int state = 0;
163 /* Get the current state */
164 ixgbe_bypass_mutex_enter(adapter);
165 error = hw->mac.ops.bypass_rw(hw,
166 BYPASS_PAGE_CTL0, &state);
167 ixgbe_bypass_mutex_clear(adapter);
170 state = (state >> BYPASS_STATUS_OFF_SHIFT) & 0x3;
172 error = sysctl_handle_int(oidp, &state, 0, req);
173 if ((error != 0) || (req->newptr == NULL))
176 /* Sanity check new state */
185 ixgbe_bypass_mutex_enter(adapter);
186 if ((error = hw->mac.ops.bypass_set(hw, BYPASS_PAGE_CTL0,
187 BYPASS_MODE_OFF_M, state) != 0))
189 /* Set AUTO back on so FW can receive events */
190 error = hw->mac.ops.bypass_set(hw, BYPASS_PAGE_CTL0,
191 BYPASS_MODE_OFF_M, BYPASS_AUTO);
193 ixgbe_bypass_mutex_clear(adapter);
196 } /* ixgbe_bp_set_state */
198 /************************************************************************
199 * The following routines control the operational
200 * "rules" of the feature, what behavior will occur
201 * when particular events occur.
203 * 0 - no change for the event (NOP)
204 * 1 - go to Normal operation
205 * 2 - go to Bypass operation
206 * 3 - go to Isolate operation
207 * Calling the entry with no argument just displays
208 * the current rule setting.
209 ************************************************************************/
211 /************************************************************************
214 * This is to set the Rule for the watchdog,
215 * not the actual watchdog timeout value.
216 ************************************************************************/
218 ixgbe_bp_timeout(SYSCTL_HANDLER_ARGS)
220 struct adapter *adapter = (struct adapter *) arg1;
221 struct ixgbe_hw *hw = &adapter->hw;
223 static int timeout = 0;
225 /* Get the current value */
226 ixgbe_bypass_mutex_enter(adapter);
227 error = hw->mac.ops.bypass_rw(hw, BYPASS_PAGE_CTL0, &timeout);
228 ixgbe_bypass_mutex_clear(adapter);
231 timeout = (timeout >> BYPASS_WDTIMEOUT_SHIFT) & 0x3;
233 error = sysctl_handle_int(oidp, &timeout, 0, req);
234 if ((error) || (req->newptr == NULL))
237 /* Sanity check on the setting */
248 /* Set the new state */
249 ixgbe_bypass_mutex_enter(adapter);
250 error = hw->mac.ops.bypass_set(hw, BYPASS_PAGE_CTL0,
251 BYPASS_WDTIMEOUT_M, timeout << BYPASS_WDTIMEOUT_SHIFT);
252 ixgbe_bypass_mutex_clear(adapter);
255 } /* ixgbe_bp_timeout */
257 /************************************************************************
259 ************************************************************************/
261 ixgbe_bp_main_on(SYSCTL_HANDLER_ARGS)
263 struct adapter *adapter = (struct adapter *) arg1;
264 struct ixgbe_hw *hw = &adapter->hw;
266 static int main_on = 0;
268 ixgbe_bypass_mutex_enter(adapter);
269 error = hw->mac.ops.bypass_rw(hw, BYPASS_PAGE_CTL0, &main_on);
270 main_on = (main_on >> BYPASS_MAIN_ON_SHIFT) & 0x3;
271 ixgbe_bypass_mutex_clear(adapter);
275 error = sysctl_handle_int(oidp, &main_on, 0, req);
276 if ((error) || (req->newptr == NULL))
279 /* Sanity check on the setting */
290 /* Set the new state */
291 ixgbe_bypass_mutex_enter(adapter);
292 error = hw->mac.ops.bypass_set(hw, BYPASS_PAGE_CTL0,
293 BYPASS_MAIN_ON_M, main_on << BYPASS_MAIN_ON_SHIFT);
294 ixgbe_bypass_mutex_clear(adapter);
297 } /* ixgbe_bp_main_on */
299 /************************************************************************
301 ************************************************************************/
303 ixgbe_bp_main_off(SYSCTL_HANDLER_ARGS)
305 struct adapter *adapter = (struct adapter *) arg1;
306 struct ixgbe_hw *hw = &adapter->hw;
308 static int main_off = 0;
310 ixgbe_bypass_mutex_enter(adapter);
311 error = hw->mac.ops.bypass_rw(hw, BYPASS_PAGE_CTL0, &main_off);
312 ixgbe_bypass_mutex_clear(adapter);
315 main_off = (main_off >> BYPASS_MAIN_OFF_SHIFT) & 0x3;
317 error = sysctl_handle_int(oidp, &main_off, 0, req);
318 if ((error) || (req->newptr == NULL))
321 /* Sanity check on the setting */
332 /* Set the new state */
333 ixgbe_bypass_mutex_enter(adapter);
334 error = hw->mac.ops.bypass_set(hw, BYPASS_PAGE_CTL0,
335 BYPASS_MAIN_OFF_M, main_off << BYPASS_MAIN_OFF_SHIFT);
336 ixgbe_bypass_mutex_clear(adapter);
339 } /* ixgbe_bp_main_off */
341 /************************************************************************
343 ************************************************************************/
345 ixgbe_bp_aux_on(SYSCTL_HANDLER_ARGS)
347 struct adapter *adapter = (struct adapter *) arg1;
348 struct ixgbe_hw *hw = &adapter->hw;
350 static int aux_on = 0;
352 ixgbe_bypass_mutex_enter(adapter);
353 error = hw->mac.ops.bypass_rw(hw, BYPASS_PAGE_CTL0, &aux_on);
354 ixgbe_bypass_mutex_clear(adapter);
357 aux_on = (aux_on >> BYPASS_AUX_ON_SHIFT) & 0x3;
359 error = sysctl_handle_int(oidp, &aux_on, 0, req);
360 if ((error) || (req->newptr == NULL))
363 /* Sanity check on the setting */
374 /* Set the new state */
375 ixgbe_bypass_mutex_enter(adapter);
376 error = hw->mac.ops.bypass_set(hw, BYPASS_PAGE_CTL0,
377 BYPASS_AUX_ON_M, aux_on << BYPASS_AUX_ON_SHIFT);
378 ixgbe_bypass_mutex_clear(adapter);
381 } /* ixgbe_bp_aux_on */
383 /************************************************************************
385 ************************************************************************/
387 ixgbe_bp_aux_off(SYSCTL_HANDLER_ARGS)
389 struct adapter *adapter = (struct adapter *) arg1;
390 struct ixgbe_hw *hw = &adapter->hw;
392 static int aux_off = 0;
394 ixgbe_bypass_mutex_enter(adapter);
395 error = hw->mac.ops.bypass_rw(hw, BYPASS_PAGE_CTL0, &aux_off);
396 ixgbe_bypass_mutex_clear(adapter);
399 aux_off = (aux_off >> BYPASS_AUX_OFF_SHIFT) & 0x3;
401 error = sysctl_handle_int(oidp, &aux_off, 0, req);
402 if ((error) || (req->newptr == NULL))
405 /* Sanity check on the setting */
416 /* Set the new state */
417 ixgbe_bypass_mutex_enter(adapter);
418 error = hw->mac.ops.bypass_set(hw, BYPASS_PAGE_CTL0,
419 BYPASS_AUX_OFF_M, aux_off << BYPASS_AUX_OFF_SHIFT);
420 ixgbe_bypass_mutex_clear(adapter);
423 } /* ixgbe_bp_aux_off */
425 /************************************************************************
426 * ixgbe_bp_wd_set - Set the Watchdog timer value
428 * Valid settings are:
429 * - 0 will disable the watchdog
430 * - 1, 2, 3, 4, 8, 16, 32
431 * - anything else is invalid and will be ignored
432 ************************************************************************/
434 ixgbe_bp_wd_set(SYSCTL_HANDLER_ARGS)
436 struct adapter *adapter = (struct adapter *) arg1;
437 struct ixgbe_hw *hw = &adapter->hw;
439 static int timeout = 0;
442 /* Get the current hardware value */
443 ixgbe_bypass_mutex_enter(adapter);
444 error = hw->mac.ops.bypass_rw(hw, BYPASS_PAGE_CTL0, &tmp);
445 ixgbe_bypass_mutex_clear(adapter);
449 * If armed keep the displayed value,
450 * else change the display to zero.
452 if ((tmp & (0x1 << BYPASS_WDT_ENABLE_SHIFT)) == 0)
455 error = sysctl_handle_int(oidp, &timeout, 0, req);
456 if ((error) || (req->newptr == NULL))
459 arg = 0x1 << BYPASS_WDT_ENABLE_SHIFT;
460 mask = BYPASS_WDT_ENABLE_M | BYPASS_WDT_VALUE_M;
462 case 0: /* disables the timer */
463 arg = BYPASS_PAGE_CTL0;
464 mask = BYPASS_WDT_ENABLE_M;
467 arg |= BYPASS_WDT_1_5 << BYPASS_WDT_TIME_SHIFT;
470 arg |= BYPASS_WDT_2 << BYPASS_WDT_TIME_SHIFT;
473 arg |= BYPASS_WDT_3 << BYPASS_WDT_TIME_SHIFT;
476 arg |= BYPASS_WDT_4 << BYPASS_WDT_TIME_SHIFT;
479 arg |= BYPASS_WDT_8 << BYPASS_WDT_TIME_SHIFT;
482 arg |= BYPASS_WDT_16 << BYPASS_WDT_TIME_SHIFT;
485 arg |= BYPASS_WDT_32 << BYPASS_WDT_TIME_SHIFT;
491 /* Set the new watchdog */
492 ixgbe_bypass_mutex_enter(adapter);
493 error = hw->mac.ops.bypass_set(hw, BYPASS_PAGE_CTL0, mask, arg);
494 ixgbe_bypass_mutex_clear(adapter);
497 } /* ixgbe_bp_wd_set */
499 /************************************************************************
500 * ixgbe_bp_wd_reset - Reset the Watchdog timer
502 * To activate this it must be called with any argument.
503 ************************************************************************/
505 ixgbe_bp_wd_reset(SYSCTL_HANDLER_ARGS)
507 struct adapter *adapter = (struct adapter *) arg1;
508 struct ixgbe_hw *hw = &adapter->hw;
510 int cmd, count = 0, error = 0;
513 error = sysctl_handle_int(oidp, &reset_wd, 0, req);
514 if ((error) || (req->newptr == NULL))
517 cmd = BYPASS_PAGE_CTL1 | BYPASS_WE | BYPASS_CTL1_WDT_PET;
519 /* Resync the FW time while writing to CTL1 anyway */
520 ixgbe_get_bypass_time(&year, &sec);
522 cmd |= (sec & BYPASS_CTL1_TIME_M) | BYPASS_CTL1_VALID;
523 cmd |= BYPASS_CTL1_OFFTRST;
525 ixgbe_bypass_wd_mutex_enter(adapter);
526 error = hw->mac.ops.bypass_rw(hw, cmd, &reset_wd);
528 /* Read until it matches what we wrote, or we time out */
531 error = IXGBE_BYPASS_FW_WRITE_FAILURE;
534 error = hw->mac.ops.bypass_rw(hw, BYPASS_PAGE_CTL1, &reset_wd);
536 error = IXGBE_ERR_INVALID_ARGUMENT;
539 } while (!hw->mac.ops.bypass_valid_rd(cmd, reset_wd));
542 ixgbe_bypass_wd_mutex_clear(adapter);
544 } /* ixgbe_bp_wd_reset */
546 /************************************************************************
547 * ixgbe_bp_log - Display the bypass log
549 * You must pass a non-zero arg to sysctl
550 ************************************************************************/
552 ixgbe_bp_log(SYSCTL_HANDLER_ARGS)
554 struct adapter *adapter = (struct adapter *) arg1;
555 struct ixgbe_hw *hw = &adapter->hw;
557 u32 log_off, count = 0;
558 static int status = 0;
560 struct ixgbe_bypass_eeprom eeprom[BYPASS_MAX_LOGS];
563 error = sysctl_handle_int(oidp, &status, 0, req);
564 if ((error) || (req->newptr == NULL))
567 /* Keep the log display single-threaded */
568 while (atomic_cmpset_int(&adapter->bypass.log, 0, 1) == 0)
571 ixgbe_bypass_mutex_enter(adapter);
573 /* Find Current head of the log eeprom offset */
574 cmd = BYPASS_PAGE_CTL2 | BYPASS_WE;
575 cmd |= (0x1 << BYPASS_CTL2_OFFSET_SHIFT) & BYPASS_CTL2_OFFSET_M;
576 error = hw->mac.ops.bypass_rw(hw, cmd, &status);
580 /* wait for the write to stick */
583 /* Now read the results */
585 error = hw->mac.ops.bypass_rw(hw, cmd, &status);
589 ixgbe_bypass_mutex_clear(adapter);
591 base = status & BYPASS_CTL2_DATA_M;
592 head = (status & BYPASS_CTL2_HEAD_M) >> BYPASS_CTL2_HEAD_SHIFT;
594 /* address of the first log */
595 log_off = base + (head * 5);
597 /* extract all the log entries */
598 while (count < BYPASS_MAX_LOGS) {
599 eeprom[count].logs = 0;
600 eeprom[count].actions = 0;
602 /* Log 5 bytes store in on u32 and a u8 */
603 for (i = 0; i < 4; i++) {
604 ixgbe_bypass_mutex_enter(adapter);
605 error = hw->mac.ops.bypass_rd_eep(hw, log_off + i,
607 ixgbe_bypass_mutex_clear(adapter);
610 eeprom[count].logs += data << (8 * i);
613 ixgbe_bypass_mutex_enter(adapter);
614 error = hw->mac.ops.bypass_rd_eep(hw,
615 log_off + i, &eeprom[count].actions);
616 ixgbe_bypass_mutex_clear(adapter);
620 /* Quit if not a unread log */
621 if (!(eeprom[count].logs & BYPASS_LOG_CLEAR_M))
624 * Log looks good so store the address where it's
625 * Unread Log bit is so we can clear it after safely
626 * pulling out all of the log data.
628 eeprom[count].clear_off = log_off;
631 head = head ? head - 1 : BYPASS_MAX_LOGS;
632 log_off = base + (head * 5);
635 /* reverse order (oldest first) for output */
638 u32 mon, days, hours, min, sec;
639 u32 time = eeprom[count].logs & BYPASS_LOG_TIME_M;
640 u32 event = (eeprom[count].logs & BYPASS_LOG_EVENT_M) >>
641 BYPASS_LOG_EVENT_SHIFT;
642 u8 action = eeprom[count].actions & BYPASS_LOG_ACTION_M;
643 u16 day_mon[2][13] = {
644 {0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334, 365},
645 {0, 31, 59, 91, 121, 152, 182, 213, 244, 274, 305, 335, 366}
647 char *event_str[] = {"unknown", "main on", "aux on",
648 "main off", "aux off", "WDT", "user" };
649 char *action_str[] = {"ignore", "normal", "bypass", "isolate",};
651 /* verify vaild data 1 - 6 */
652 if (event < BYPASS_EVENT_MAIN_ON || event > BYPASS_EVENT_USR)
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 */
667 hours = time / (60 * 60);
671 device_printf(adapter->dev,
672 "UT %02d/%02d %02d:%02d:%02d %8.8s -> %7.7s\n",
673 mon, days, hours, min, sec, event_str[event],
675 cmd = BYPASS_PAGE_CTL2 | BYPASS_WE | BYPASS_CTL2_RW;
676 cmd |= ((eeprom[count].clear_off + 3)
677 << BYPASS_CTL2_OFFSET_SHIFT) & BYPASS_CTL2_OFFSET_M;
678 cmd |= ((eeprom[count].logs & ~BYPASS_LOG_CLEAR_M) >> 24);
680 ixgbe_bypass_mutex_enter(adapter);
682 error = hw->mac.ops.bypass_rw(hw, cmd, &status);
684 /* wait for the write to stick */
687 ixgbe_bypass_mutex_clear(adapter);
693 status = 0; /* reset */
694 /* Another log command can now run */
695 while (atomic_cmpset_int(&adapter->bypass.log, 1, 0) == 0)
700 ixgbe_bypass_mutex_clear(adapter);
701 status = 0; /* reset */
702 while (atomic_cmpset_int(&adapter->bypass.log, 1, 0) == 0)
707 /************************************************************************
708 * ixgbe_bypass_init - Set up infrastructure for the bypass feature
710 * Do time and sysctl initialization here. This feature is
711 * only enabled for the first port of a bypass adapter.
712 ************************************************************************/
714 ixgbe_bypass_init(struct adapter *adapter)
716 struct ixgbe_hw *hw = &adapter->hw;
717 device_t dev = adapter->dev;
718 struct sysctl_oid *bp_node;
719 struct sysctl_oid_list *bp_list;
720 u32 mask, value, sec, year;
722 if (!(adapter->feat_cap & IXGBE_FEATURE_BYPASS))
725 /* First set up time for the hardware */
726 ixgbe_get_bypass_time(&year, &sec);
728 mask = BYPASS_CTL1_TIME_M
729 | BYPASS_CTL1_VALID_M
730 | BYPASS_CTL1_OFFTRST_M;
732 value = (sec & BYPASS_CTL1_TIME_M)
734 | BYPASS_CTL1_OFFTRST;
736 ixgbe_bypass_mutex_enter(adapter);
737 hw->mac.ops.bypass_set(hw, BYPASS_PAGE_CTL1, mask, value);
738 ixgbe_bypass_mutex_clear(adapter);
740 /* Now set up the SYSCTL infrastructure */
743 * The log routine is kept separate from the other
744 * children so a general display command like:
745 * `sysctl dev.ix.0.bypass` will not show the log.
747 SYSCTL_ADD_PROC(device_get_sysctl_ctx(dev),
748 SYSCTL_CHILDREN(device_get_sysctl_tree(dev)),
749 OID_AUTO, "bypass_log",
750 CTLTYPE_INT | CTLFLAG_RW | CTLFLAG_NEEDGIANT,
751 adapter, 0, ixgbe_bp_log, "I", "Bypass Log");
753 /* All other setting are hung from the 'bypass' node */
754 bp_node = SYSCTL_ADD_NODE(device_get_sysctl_ctx(dev),
755 SYSCTL_CHILDREN(device_get_sysctl_tree(dev)),
756 OID_AUTO, "bypass", CTLFLAG_RD | CTLFLAG_MPSAFE, NULL, "Bypass");
758 bp_list = SYSCTL_CHILDREN(bp_node);
760 SYSCTL_ADD_PROC(device_get_sysctl_ctx(dev), bp_list,
761 OID_AUTO, "version", CTLTYPE_INT | CTLFLAG_RD | CTLFLAG_NEEDGIANT,
762 adapter, 0, ixgbe_bp_version, "I", "Bypass Version");
764 SYSCTL_ADD_PROC(device_get_sysctl_ctx(dev), bp_list,
765 OID_AUTO, "state", CTLTYPE_INT | CTLFLAG_RW | CTLFLAG_NEEDGIANT,
766 adapter, 0, ixgbe_bp_set_state, "I", "Bypass State");
768 SYSCTL_ADD_PROC(device_get_sysctl_ctx(dev), bp_list,
769 OID_AUTO, "timeout", CTLTYPE_INT | CTLFLAG_RW | CTLFLAG_NEEDGIANT,
770 adapter, 0, ixgbe_bp_timeout, "I", "Bypass Timeout");
772 SYSCTL_ADD_PROC(device_get_sysctl_ctx(dev), bp_list,
773 OID_AUTO, "main_on", CTLTYPE_INT | CTLFLAG_RW | CTLFLAG_NEEDGIANT,
774 adapter, 0, ixgbe_bp_main_on, "I", "Bypass Main On");
776 SYSCTL_ADD_PROC(device_get_sysctl_ctx(dev), bp_list,
777 OID_AUTO, "main_off", CTLTYPE_INT | CTLFLAG_RW | CTLFLAG_NEEDGIANT,
778 adapter, 0, ixgbe_bp_main_off, "I", "Bypass Main Off");
780 SYSCTL_ADD_PROC(device_get_sysctl_ctx(dev), bp_list,
781 OID_AUTO, "aux_on", CTLTYPE_INT | CTLFLAG_RW | CTLFLAG_NEEDGIANT,
782 adapter, 0, ixgbe_bp_aux_on, "I", "Bypass Aux On");
784 SYSCTL_ADD_PROC(device_get_sysctl_ctx(dev), bp_list,
785 OID_AUTO, "aux_off", CTLTYPE_INT | CTLFLAG_RW | CTLFLAG_NEEDGIANT,
786 adapter, 0, ixgbe_bp_aux_off, "I", "Bypass Aux Off");
788 SYSCTL_ADD_PROC(device_get_sysctl_ctx(dev), bp_list,
789 OID_AUTO, "wd_set", CTLTYPE_INT | CTLFLAG_RW | CTLFLAG_NEEDGIANT,
790 adapter, 0, ixgbe_bp_wd_set, "I", "Set BP Watchdog");
792 SYSCTL_ADD_PROC(device_get_sysctl_ctx(dev), bp_list,
793 OID_AUTO, "wd_reset", CTLTYPE_INT | CTLFLAG_WR | CTLFLAG_NEEDGIANT,
794 adapter, 0, ixgbe_bp_wd_reset, "S", "Bypass WD Reset");
796 adapter->feat_en |= IXGBE_FEATURE_BYPASS;
797 } /* ixgbe_bypass_init */