1 /* SPDX-License-Identifier: GPL-2.0-only */
2 /****************************************************************************
3 * Driver for Solarflare network controllers and boards
4 * Copyright 2007-2013 Solarflare Communications Inc.
11 * enum ef4_loopback_mode - loopback modes
12 * @LOOPBACK_NONE: no loopback
13 * @LOOPBACK_DATA: data path loopback
14 * @LOOPBACK_GMAC: loopback within GMAC
15 * @LOOPBACK_XGMII: loopback after XMAC
16 * @LOOPBACK_XGXS: loopback within BPX after XGXS
17 * @LOOPBACK_XAUI: loopback within BPX before XAUI serdes
18 * @LOOPBACK_GMII: loopback within BPX after GMAC
19 * @LOOPBACK_SGMII: loopback within BPX within SGMII
20 * @LOOPBACK_XGBR: loopback within BPX within XGBR
21 * @LOOPBACK_XFI: loopback within BPX before XFI serdes
22 * @LOOPBACK_XAUI_FAR: loopback within BPX after XAUI serdes
23 * @LOOPBACK_GMII_FAR: loopback within BPX before SGMII
24 * @LOOPBACK_SGMII_FAR: loopback within BPX after SGMII
25 * @LOOPBACK_XFI_FAR: loopback after XFI serdes
26 * @LOOPBACK_GPHY: loopback within 1G PHY at unspecified level
27 * @LOOPBACK_PHYXS: loopback within 10G PHY at PHYXS level
28 * @LOOPBACK_PCS: loopback within 10G PHY at PCS level
29 * @LOOPBACK_PMAPMD: loopback within 10G PHY at PMAPMD level
30 * @LOOPBACK_XPORT: cross port loopback
31 * @LOOPBACK_XGMII_WS: wireside loopback excluding XMAC
32 * @LOOPBACK_XAUI_WS: wireside loopback within BPX within XAUI serdes
33 * @LOOPBACK_XAUI_WS_FAR: wireside loopback within BPX including XAUI serdes
34 * @LOOPBACK_XAUI_WS_NEAR: wireside loopback within BPX excluding XAUI serdes
35 * @LOOPBACK_GMII_WS: wireside loopback excluding GMAC
36 * @LOOPBACK_XFI_WS: wireside loopback excluding XFI serdes
37 * @LOOPBACK_XFI_WS_FAR: wireside loopback including XFI serdes
38 * @LOOPBACK_PHYXS_WS: wireside loopback within 10G PHY at PHYXS level
40 /* Please keep up-to-date w.r.t the following two #defines */
41 enum ef4_loopback_mode
{
52 LOOPBACK_XAUI_FAR
= 10,
53 LOOPBACK_GMII_FAR
= 11,
54 LOOPBACK_SGMII_FAR
= 12,
55 LOOPBACK_XFI_FAR
= 13,
61 LOOPBACK_XGMII_WS
= 19,
62 LOOPBACK_XAUI_WS
= 20,
63 LOOPBACK_XAUI_WS_FAR
= 21,
64 LOOPBACK_XAUI_WS_NEAR
= 22,
65 LOOPBACK_GMII_WS
= 23,
67 LOOPBACK_XFI_WS_FAR
= 25,
68 LOOPBACK_PHYXS_WS
= 26,
71 #define LOOPBACK_TEST_MAX LOOPBACK_PMAPMD
73 /* These loopbacks occur within the controller */
74 #define LOOPBACKS_INTERNAL ((1 << LOOPBACK_DATA) | \
75 (1 << LOOPBACK_GMAC) | \
76 (1 << LOOPBACK_XGMII)| \
77 (1 << LOOPBACK_XGXS) | \
78 (1 << LOOPBACK_XAUI) | \
79 (1 << LOOPBACK_GMII) | \
80 (1 << LOOPBACK_SGMII) | \
81 (1 << LOOPBACK_XGBR) | \
82 (1 << LOOPBACK_XFI) | \
83 (1 << LOOPBACK_XAUI_FAR) | \
84 (1 << LOOPBACK_GMII_FAR) | \
85 (1 << LOOPBACK_SGMII_FAR) | \
86 (1 << LOOPBACK_XFI_FAR) | \
87 (1 << LOOPBACK_XGMII_WS) | \
88 (1 << LOOPBACK_XAUI_WS) | \
89 (1 << LOOPBACK_XAUI_WS_FAR) | \
90 (1 << LOOPBACK_XAUI_WS_NEAR) | \
91 (1 << LOOPBACK_GMII_WS) | \
92 (1 << LOOPBACK_XFI_WS) | \
93 (1 << LOOPBACK_XFI_WS_FAR))
95 #define LOOPBACKS_WS ((1 << LOOPBACK_XGMII_WS) | \
96 (1 << LOOPBACK_XAUI_WS) | \
97 (1 << LOOPBACK_XAUI_WS_FAR) | \
98 (1 << LOOPBACK_XAUI_WS_NEAR) | \
99 (1 << LOOPBACK_GMII_WS) | \
100 (1 << LOOPBACK_XFI_WS) | \
101 (1 << LOOPBACK_XFI_WS_FAR) | \
102 (1 << LOOPBACK_PHYXS_WS))
104 #define LOOPBACKS_EXTERNAL(_efx) \
105 ((_efx)->loopback_modes & ~LOOPBACKS_INTERNAL & \
106 ~(1 << LOOPBACK_NONE))
108 #define LOOPBACK_MASK(_efx) \
109 (1 << (_efx)->loopback_mode)
111 #define LOOPBACK_INTERNAL(_efx) \
112 (!!(LOOPBACKS_INTERNAL & LOOPBACK_MASK(_efx)))
114 #define LOOPBACK_EXTERNAL(_efx) \
115 (!!(LOOPBACK_MASK(_efx) & LOOPBACKS_EXTERNAL(_efx)))
117 #define LOOPBACK_CHANGED(_from, _to, _mask) \
118 (!!((LOOPBACK_MASK(_from) ^ LOOPBACK_MASK(_to)) & (_mask)))
120 #define LOOPBACK_OUT_OF(_from, _to, _mask) \
121 ((LOOPBACK_MASK(_from) & (_mask)) && !(LOOPBACK_MASK(_to) & (_mask)))
123 /*****************************************************************************/
126 * enum reset_type - reset types
128 * %RESET_TYPE_INVSIBLE, %RESET_TYPE_ALL, %RESET_TYPE_WORLD and
129 * %RESET_TYPE_DISABLE specify the method/scope of the reset. The
130 * other valuesspecify reasons, which ef4_schedule_reset() will choose
133 * Reset methods are numbered in order of increasing scope.
135 * @RESET_TYPE_INVISIBLE: Reset datapath and MAC
136 * @RESET_TYPE_RECOVER_OR_ALL: Try to recover. Apply RESET_TYPE_ALL
138 * @RESET_TYPE_ALL: Reset datapath, MAC and PHY
139 * @RESET_TYPE_WORLD: Reset as much as possible
140 * @RESET_TYPE_RECOVER_OR_DISABLE: Try to recover. Apply RESET_TYPE_DISABLE if
142 * @RESET_TYPE_DATAPATH: Reset datapath only.
143 * @RESET_TYPE_DISABLE: Reset datapath, MAC and PHY; leave NIC disabled
144 * @RESET_TYPE_TX_WATCHDOG: reset due to TX watchdog
145 * @RESET_TYPE_INT_ERROR: reset due to internal error
146 * @RESET_TYPE_RX_RECOVERY: reset to recover from RX datapath errors
147 * @RESET_TYPE_DMA_ERROR: DMA error
148 * @RESET_TYPE_TX_SKIP: hardware completed empty tx descriptors
151 RESET_TYPE_INVISIBLE
,
152 RESET_TYPE_RECOVER_OR_ALL
,
155 RESET_TYPE_RECOVER_OR_DISABLE
,
158 RESET_TYPE_MAX_METHOD
,
159 RESET_TYPE_TX_WATCHDOG
,
160 RESET_TYPE_INT_ERROR
,
161 RESET_TYPE_RX_RECOVERY
,
162 RESET_TYPE_DMA_ERROR
,
167 #endif /* EF4_ENUM_H */