Ben Hutchings | 8ceee66 | 2008-04-27 12:55:59 +0100 | [diff] [blame] | 1 | /**************************************************************************** |
| 2 | * Driver for Solarflare Solarstorm network controllers and boards |
Ben Hutchings | 906bb26 | 2009-11-29 15:16:19 +0000 | [diff] [blame] | 3 | * Copyright 2007-2009 Solarflare Communications Inc. |
Ben Hutchings | 8ceee66 | 2008-04-27 12:55:59 +0100 | [diff] [blame] | 4 | * |
| 5 | * This program is free software; you can redistribute it and/or modify it |
| 6 | * under the terms of the GNU General Public License version 2 as published |
| 7 | * by the Free Software Foundation, incorporated herein by reference. |
| 8 | */ |
| 9 | |
| 10 | #ifndef EFX_ENUM_H |
| 11 | #define EFX_ENUM_H |
| 12 | |
Ben Hutchings | 3273c2e | 2008-05-07 13:36:19 +0100 | [diff] [blame] | 13 | /** |
| 14 | * enum efx_loopback_mode - loopback modes |
| 15 | * @LOOPBACK_NONE: no loopback |
Ben Hutchings | e58f69f | 2009-11-29 15:08:41 +0000 | [diff] [blame] | 16 | * @LOOPBACK_DATA: data path loopback |
| 17 | * @LOOPBACK_GMAC: loopback within GMAC |
| 18 | * @LOOPBACK_XGMII: loopback after XMAC |
| 19 | * @LOOPBACK_XGXS: loopback within BPX after XGXS |
| 20 | * @LOOPBACK_XAUI: loopback within BPX before XAUI serdes |
| 21 | * @LOOPBACK_GMII: loopback within BPX after GMAC |
| 22 | * @LOOPBACK_SGMII: loopback within BPX within SGMII |
| 23 | * @LOOPBACK_XGBR: loopback within BPX within XGBR |
| 24 | * @LOOPBACK_XFI: loopback within BPX before XFI serdes |
| 25 | * @LOOPBACK_XAUI_FAR: loopback within BPX after XAUI serdes |
| 26 | * @LOOPBACK_GMII_FAR: loopback within BPX before SGMII |
| 27 | * @LOOPBACK_SGMII_FAR: loopback within BPX after SGMII |
| 28 | * @LOOPBACK_XFI_FAR: loopback after XFI serdes |
Ben Hutchings | 177dfcd | 2008-12-12 21:50:08 -0800 | [diff] [blame] | 29 | * @LOOPBACK_GPHY: loopback within 1G PHY at unspecified level |
| 30 | * @LOOPBACK_PHYXS: loopback within 10G PHY at PHYXS level |
| 31 | * @LOOPBACK_PCS: loopback within 10G PHY at PCS level |
| 32 | * @LOOPBACK_PMAPMD: loopback within 10G PHY at PMAPMD level |
Ben Hutchings | e58f69f | 2009-11-29 15:08:41 +0000 | [diff] [blame] | 33 | * @LOOPBACK_XPORT: cross port loopback |
| 34 | * @LOOPBACK_XGMII_WS: wireside loopback excluding XMAC |
| 35 | * @LOOPBACK_XAUI_WS: wireside loopback within BPX within XAUI serdes |
| 36 | * @LOOPBACK_XAUI_WS_FAR: wireside loopback within BPX including XAUI serdes |
| 37 | * @LOOPBACK_XAUI_WS_NEAR: wireside loopback within BPX excluding XAUI serdes |
| 38 | * @LOOPBACK_GMII_WS: wireside loopback excluding GMAC |
| 39 | * @LOOPBACK_XFI_WS: wireside loopback excluding XFI serdes |
| 40 | * @LOOPBACK_XFI_WS_FAR: wireside loopback including XFI serdes |
| 41 | * @LOOPBACK_PHYXS_WS: wireside loopback within 10G PHY at PHYXS level |
Ben Hutchings | 3273c2e | 2008-05-07 13:36:19 +0100 | [diff] [blame] | 42 | */ |
Ben Hutchings | e58f69f | 2009-11-29 15:08:41 +0000 | [diff] [blame] | 43 | /* Please keep up-to-date w.r.t the following two #defines */ |
Ben Hutchings | 3273c2e | 2008-05-07 13:36:19 +0100 | [diff] [blame] | 44 | enum efx_loopback_mode { |
| 45 | LOOPBACK_NONE = 0, |
Ben Hutchings | e58f69f | 2009-11-29 15:08:41 +0000 | [diff] [blame] | 46 | LOOPBACK_DATA = 1, |
| 47 | LOOPBACK_GMAC = 2, |
| 48 | LOOPBACK_XGMII = 3, |
| 49 | LOOPBACK_XGXS = 4, |
| 50 | LOOPBACK_XAUI = 5, |
| 51 | LOOPBACK_GMII = 6, |
| 52 | LOOPBACK_SGMII = 7, |
| 53 | LOOPBACK_XGBR = 8, |
| 54 | LOOPBACK_XFI = 9, |
| 55 | LOOPBACK_XAUI_FAR = 10, |
| 56 | LOOPBACK_GMII_FAR = 11, |
| 57 | LOOPBACK_SGMII_FAR = 12, |
| 58 | LOOPBACK_XFI_FAR = 13, |
| 59 | LOOPBACK_GPHY = 14, |
| 60 | LOOPBACK_PHYXS = 15, |
| 61 | LOOPBACK_PCS = 16, |
| 62 | LOOPBACK_PMAPMD = 17, |
| 63 | LOOPBACK_XPORT = 18, |
| 64 | LOOPBACK_XGMII_WS = 19, |
| 65 | LOOPBACK_XAUI_WS = 20, |
| 66 | LOOPBACK_XAUI_WS_FAR = 21, |
| 67 | LOOPBACK_XAUI_WS_NEAR = 22, |
| 68 | LOOPBACK_GMII_WS = 23, |
| 69 | LOOPBACK_XFI_WS = 24, |
| 70 | LOOPBACK_XFI_WS_FAR = 25, |
| 71 | LOOPBACK_PHYXS_WS = 26, |
Ben Hutchings | 3273c2e | 2008-05-07 13:36:19 +0100 | [diff] [blame] | 72 | LOOPBACK_MAX |
| 73 | }; |
Ben Hutchings | 3273c2e | 2008-05-07 13:36:19 +0100 | [diff] [blame] | 74 | #define LOOPBACK_TEST_MAX LOOPBACK_PMAPMD |
| 75 | |
Ben Hutchings | 3273c2e | 2008-05-07 13:36:19 +0100 | [diff] [blame] | 76 | /* These loopbacks occur within the controller */ |
Ben Hutchings | e58f69f | 2009-11-29 15:08:41 +0000 | [diff] [blame] | 77 | #define LOOPBACKS_INTERNAL ((1 << LOOPBACK_DATA) | \ |
| 78 | (1 << LOOPBACK_GMAC) | \ |
| 79 | (1 << LOOPBACK_XGMII)| \ |
| 80 | (1 << LOOPBACK_XGXS) | \ |
| 81 | (1 << LOOPBACK_XAUI) | \ |
| 82 | (1 << LOOPBACK_GMII) | \ |
| 83 | (1 << LOOPBACK_SGMII) | \ |
| 84 | (1 << LOOPBACK_SGMII) | \ |
| 85 | (1 << LOOPBACK_XGBR) | \ |
| 86 | (1 << LOOPBACK_XFI) | \ |
| 87 | (1 << LOOPBACK_XAUI_FAR) | \ |
| 88 | (1 << LOOPBACK_GMII_FAR) | \ |
| 89 | (1 << LOOPBACK_SGMII_FAR) | \ |
| 90 | (1 << LOOPBACK_XFI_FAR) | \ |
| 91 | (1 << LOOPBACK_XGMII_WS) | \ |
| 92 | (1 << LOOPBACK_XAUI_WS) | \ |
| 93 | (1 << LOOPBACK_XAUI_WS_FAR) | \ |
| 94 | (1 << LOOPBACK_XAUI_WS_NEAR) | \ |
| 95 | (1 << LOOPBACK_GMII_WS) | \ |
| 96 | (1 << LOOPBACK_XFI_WS) | \ |
| 97 | (1 << LOOPBACK_XFI_WS_FAR)) |
| 98 | |
| 99 | #define LOOPBACKS_WS ((1 << LOOPBACK_XGMII_WS) | \ |
| 100 | (1 << LOOPBACK_XAUI_WS) | \ |
| 101 | (1 << LOOPBACK_XAUI_WS_FAR) | \ |
| 102 | (1 << LOOPBACK_XAUI_WS_NEAR) | \ |
| 103 | (1 << LOOPBACK_GMII_WS) | \ |
| 104 | (1 << LOOPBACK_XFI_WS) | \ |
| 105 | (1 << LOOPBACK_XFI_WS_FAR) | \ |
| 106 | (1 << LOOPBACK_PHYXS_WS)) |
| 107 | |
| 108 | #define LOOPBACKS_EXTERNAL(_efx) \ |
| 109 | ((_efx)->loopback_modes & ~LOOPBACKS_INTERNAL & \ |
| 110 | ~(1 << LOOPBACK_NONE)) |
Ben Hutchings | 3273c2e | 2008-05-07 13:36:19 +0100 | [diff] [blame] | 111 | |
| 112 | #define LOOPBACK_MASK(_efx) \ |
| 113 | (1 << (_efx)->loopback_mode) |
| 114 | |
Ben Hutchings | dc8cfa5 | 2008-09-01 12:46:50 +0100 | [diff] [blame] | 115 | #define LOOPBACK_INTERNAL(_efx) \ |
Ben Hutchings | 177dfcd | 2008-12-12 21:50:08 -0800 | [diff] [blame] | 116 | (!!(LOOPBACKS_INTERNAL & LOOPBACK_MASK(_efx))) |
Ben Hutchings | 3273c2e | 2008-05-07 13:36:19 +0100 | [diff] [blame] | 117 | |
Ben Hutchings | e58f69f | 2009-11-29 15:08:41 +0000 | [diff] [blame] | 118 | #define LOOPBACK_EXTERNAL(_efx) \ |
| 119 | (!!(LOOPBACK_MASK(_efx) & LOOPBACKS_EXTERNAL(_efx))) |
| 120 | |
Ben Hutchings | e6fa2eb | 2008-12-12 22:00:17 -0800 | [diff] [blame] | 121 | #define LOOPBACK_CHANGED(_from, _to, _mask) \ |
| 122 | (!!((LOOPBACK_MASK(_from) ^ LOOPBACK_MASK(_to)) & (_mask))) |
| 123 | |
Ben Hutchings | dc8cfa5 | 2008-09-01 12:46:50 +0100 | [diff] [blame] | 124 | #define LOOPBACK_OUT_OF(_from, _to, _mask) \ |
| 125 | ((LOOPBACK_MASK(_from) & (_mask)) && !(LOOPBACK_MASK(_to) & (_mask))) |
Ben Hutchings | 3273c2e | 2008-05-07 13:36:19 +0100 | [diff] [blame] | 126 | |
Ben Hutchings | 8ceee66 | 2008-04-27 12:55:59 +0100 | [diff] [blame] | 127 | /*****************************************************************************/ |
| 128 | |
| 129 | /** |
| 130 | * enum reset_type - reset types |
| 131 | * |
| 132 | * %RESET_TYPE_INVSIBLE, %RESET_TYPE_ALL, %RESET_TYPE_WORLD and |
| 133 | * %RESET_TYPE_DISABLE specify the method/scope of the reset. The |
| 134 | * other valuesspecify reasons, which efx_schedule_reset() will choose |
| 135 | * a method for. |
| 136 | * |
Ben Hutchings | a7d529a | 2011-06-24 20:46:31 +0100 | [diff] [blame] | 137 | * Reset methods are numbered in order of increasing scope. |
| 138 | * |
Ben Hutchings | c2dbab3 | 2012-07-05 17:31:04 +0100 | [diff] [blame] | 139 | * @RESET_TYPE_INVISIBLE: Reset datapath and MAC (Falcon only) |
Alexandre Rames | 626950d | 2013-01-14 17:20:22 +0000 | [diff] [blame] | 140 | * @RESET_TYPE_RECOVER_OR_ALL: Try to recover. Apply RESET_TYPE_ALL |
| 141 | * if unsuccessful. |
Ben Hutchings | c2dbab3 | 2012-07-05 17:31:04 +0100 | [diff] [blame] | 142 | * @RESET_TYPE_ALL: Reset datapath, MAC and PHY |
| 143 | * @RESET_TYPE_WORLD: Reset as much as possible |
Alexandre Rames | 626950d | 2013-01-14 17:20:22 +0000 | [diff] [blame] | 144 | * @RESET_TYPE_RECOVER_OR_DISABLE: Try to recover. Apply RESET_TYPE_DISABLE if |
| 145 | * unsuccessful. |
Ben Hutchings | c2dbab3 | 2012-07-05 17:31:04 +0100 | [diff] [blame] | 146 | * @RESET_TYPE_DISABLE: Reset datapath, MAC and PHY; leave NIC disabled |
Ben Hutchings | 739bb23d | 2008-11-04 20:35:36 +0000 | [diff] [blame] | 147 | * @RESET_TYPE_TX_WATCHDOG: reset due to TX watchdog |
Ben Hutchings | 8ceee66 | 2008-04-27 12:55:59 +0100 | [diff] [blame] | 148 | * @RESET_TYPE_INT_ERROR: reset due to internal error |
| 149 | * @RESET_TYPE_RX_RECOVERY: reset to recover from RX datapath errors |
| 150 | * @RESET_TYPE_RX_DESC_FETCH: pcie error during rx descriptor fetch |
| 151 | * @RESET_TYPE_TX_DESC_FETCH: pcie error during tx descriptor fetch |
| 152 | * @RESET_TYPE_TX_SKIP: hardware completed empty tx descriptors |
Ben Hutchings | 8880f4e | 2009-11-29 15:15:41 +0000 | [diff] [blame] | 153 | * @RESET_TYPE_MC_FAILURE: MC reboot/assertion |
Ben Hutchings | 8ceee66 | 2008-04-27 12:55:59 +0100 | [diff] [blame] | 154 | */ |
| 155 | enum reset_type { |
Ben Hutchings | 8ceee66 | 2008-04-27 12:55:59 +0100 | [diff] [blame] | 156 | RESET_TYPE_INVISIBLE = 0, |
Alexandre Rames | 626950d | 2013-01-14 17:20:22 +0000 | [diff] [blame] | 157 | RESET_TYPE_RECOVER_OR_ALL = 1, |
| 158 | RESET_TYPE_ALL = 2, |
| 159 | RESET_TYPE_WORLD = 3, |
| 160 | RESET_TYPE_RECOVER_OR_DISABLE = 4, |
| 161 | RESET_TYPE_DISABLE = 5, |
Ben Hutchings | 8ceee66 | 2008-04-27 12:55:59 +0100 | [diff] [blame] | 162 | RESET_TYPE_MAX_METHOD, |
Ben Hutchings | 739bb23d | 2008-11-04 20:35:36 +0000 | [diff] [blame] | 163 | RESET_TYPE_TX_WATCHDOG, |
Ben Hutchings | 8ceee66 | 2008-04-27 12:55:59 +0100 | [diff] [blame] | 164 | RESET_TYPE_INT_ERROR, |
| 165 | RESET_TYPE_RX_RECOVERY, |
| 166 | RESET_TYPE_RX_DESC_FETCH, |
| 167 | RESET_TYPE_TX_DESC_FETCH, |
| 168 | RESET_TYPE_TX_SKIP, |
Ben Hutchings | 8880f4e | 2009-11-29 15:15:41 +0000 | [diff] [blame] | 169 | RESET_TYPE_MC_FAILURE, |
Ben Hutchings | 8ceee66 | 2008-04-27 12:55:59 +0100 | [diff] [blame] | 170 | RESET_TYPE_MAX, |
| 171 | }; |
| 172 | |
| 173 | #endif /* EFX_ENUM_H */ |