Ben Hutchings | 8ceee66 | 2008-04-27 12:55:59 +0100 | [diff] [blame] | 1 | /**************************************************************************** |
| 2 | * Driver for Solarflare Solarstorm network controllers and boards |
Ben Hutchings | 177dfcd | 2008-12-12 21:50:08 -0800 | [diff] [blame] | 3 | * Copyright 2007-2008 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 | 177dfcd | 2008-12-12 21:50:08 -0800 | [diff] [blame] | 16 | * @LOOPBACK_GMAC: loopback within GMAC at unspecified level |
| 17 | * @LOOPBACK_XGMII: loopback within XMAC at XGMII level |
| 18 | * @LOOPBACK_XGXS: loopback within XMAC at XGXS level |
| 19 | * @LOOPBACK_XAUI: loopback within XMAC at XAUI level |
| 20 | * @LOOPBACK_GPHY: loopback within 1G PHY at unspecified level |
| 21 | * @LOOPBACK_PHYXS: loopback within 10G PHY at PHYXS level |
| 22 | * @LOOPBACK_PCS: loopback within 10G PHY at PCS level |
| 23 | * @LOOPBACK_PMAPMD: loopback within 10G PHY at PMAPMD level |
Ben Hutchings | 3273c2e | 2008-05-07 13:36:19 +0100 | [diff] [blame] | 24 | * @LOOPBACK_NETWORK: reflecting loopback (even further than furthest!) |
| 25 | */ |
| 26 | /* Please keep in order and up-to-date w.r.t the following two #defines */ |
| 27 | enum efx_loopback_mode { |
| 28 | LOOPBACK_NONE = 0, |
Ben Hutchings | 177dfcd | 2008-12-12 21:50:08 -0800 | [diff] [blame] | 29 | LOOPBACK_GMAC = 1, |
Ben Hutchings | 3273c2e | 2008-05-07 13:36:19 +0100 | [diff] [blame] | 30 | LOOPBACK_XGMII = 2, |
| 31 | LOOPBACK_XGXS = 3, |
| 32 | LOOPBACK_XAUI = 4, |
Ben Hutchings | 177dfcd | 2008-12-12 21:50:08 -0800 | [diff] [blame] | 33 | LOOPBACK_GPHY = 5, |
Ben Hutchings | 3273c2e | 2008-05-07 13:36:19 +0100 | [diff] [blame] | 34 | LOOPBACK_PHYXS = 6, |
| 35 | LOOPBACK_PCS = 7, |
| 36 | LOOPBACK_PMAPMD = 8, |
| 37 | LOOPBACK_NETWORK = 9, |
| 38 | LOOPBACK_MAX |
| 39 | }; |
| 40 | |
| 41 | #define LOOPBACK_TEST_MAX LOOPBACK_PMAPMD |
| 42 | |
| 43 | extern const char *efx_loopback_mode_names[]; |
| 44 | #define LOOPBACK_MODE_NAME(mode) \ |
| 45 | STRING_TABLE_LOOKUP(mode, efx_loopback_mode) |
| 46 | #define LOOPBACK_MODE(efx) \ |
| 47 | LOOPBACK_MODE_NAME(efx->loopback_mode) |
| 48 | |
| 49 | /* These loopbacks occur within the controller */ |
Ben Hutchings | 177dfcd | 2008-12-12 21:50:08 -0800 | [diff] [blame] | 50 | #define LOOPBACKS_INTERNAL ((1 << LOOPBACK_GMAC) | \ |
| 51 | (1 << LOOPBACK_XGMII)| \ |
| 52 | (1 << LOOPBACK_XGXS) | \ |
| 53 | (1 << LOOPBACK_XAUI)) |
Ben Hutchings | 3273c2e | 2008-05-07 13:36:19 +0100 | [diff] [blame] | 54 | |
| 55 | #define LOOPBACK_MASK(_efx) \ |
| 56 | (1 << (_efx)->loopback_mode) |
| 57 | |
Ben Hutchings | dc8cfa5 | 2008-09-01 12:46:50 +0100 | [diff] [blame] | 58 | #define LOOPBACK_INTERNAL(_efx) \ |
Ben Hutchings | 177dfcd | 2008-12-12 21:50:08 -0800 | [diff] [blame] | 59 | (!!(LOOPBACKS_INTERNAL & LOOPBACK_MASK(_efx))) |
Ben Hutchings | 3273c2e | 2008-05-07 13:36:19 +0100 | [diff] [blame] | 60 | |
Ben Hutchings | e6fa2eb | 2008-12-12 22:00:17 -0800 | [diff] [blame] | 61 | #define LOOPBACK_CHANGED(_from, _to, _mask) \ |
| 62 | (!!((LOOPBACK_MASK(_from) ^ LOOPBACK_MASK(_to)) & (_mask))) |
| 63 | |
Ben Hutchings | dc8cfa5 | 2008-09-01 12:46:50 +0100 | [diff] [blame] | 64 | #define LOOPBACK_OUT_OF(_from, _to, _mask) \ |
| 65 | ((LOOPBACK_MASK(_from) & (_mask)) && !(LOOPBACK_MASK(_to) & (_mask))) |
Ben Hutchings | 3273c2e | 2008-05-07 13:36:19 +0100 | [diff] [blame] | 66 | |
Ben Hutchings | 8ceee66 | 2008-04-27 12:55:59 +0100 | [diff] [blame] | 67 | /*****************************************************************************/ |
| 68 | |
| 69 | /** |
| 70 | * enum reset_type - reset types |
| 71 | * |
| 72 | * %RESET_TYPE_INVSIBLE, %RESET_TYPE_ALL, %RESET_TYPE_WORLD and |
| 73 | * %RESET_TYPE_DISABLE specify the method/scope of the reset. The |
| 74 | * other valuesspecify reasons, which efx_schedule_reset() will choose |
| 75 | * a method for. |
| 76 | * |
| 77 | * @RESET_TYPE_INVISIBLE: don't reset the PHYs or interrupts |
| 78 | * @RESET_TYPE_ALL: reset everything but PCI core blocks |
| 79 | * @RESET_TYPE_WORLD: reset everything, save & restore PCI config |
| 80 | * @RESET_TYPE_DISABLE: disable NIC |
Ben Hutchings | 739bb23d | 2008-11-04 20:35:36 +0000 | [diff] [blame] | 81 | * @RESET_TYPE_TX_WATCHDOG: reset due to TX watchdog |
Ben Hutchings | 8ceee66 | 2008-04-27 12:55:59 +0100 | [diff] [blame] | 82 | * @RESET_TYPE_INT_ERROR: reset due to internal error |
| 83 | * @RESET_TYPE_RX_RECOVERY: reset to recover from RX datapath errors |
| 84 | * @RESET_TYPE_RX_DESC_FETCH: pcie error during rx descriptor fetch |
| 85 | * @RESET_TYPE_TX_DESC_FETCH: pcie error during tx descriptor fetch |
| 86 | * @RESET_TYPE_TX_SKIP: hardware completed empty tx descriptors |
| 87 | */ |
| 88 | enum reset_type { |
| 89 | RESET_TYPE_NONE = -1, |
| 90 | RESET_TYPE_INVISIBLE = 0, |
| 91 | RESET_TYPE_ALL = 1, |
| 92 | RESET_TYPE_WORLD = 2, |
| 93 | RESET_TYPE_DISABLE = 3, |
| 94 | RESET_TYPE_MAX_METHOD, |
Ben Hutchings | 739bb23d | 2008-11-04 20:35:36 +0000 | [diff] [blame] | 95 | RESET_TYPE_TX_WATCHDOG, |
Ben Hutchings | 8ceee66 | 2008-04-27 12:55:59 +0100 | [diff] [blame] | 96 | RESET_TYPE_INT_ERROR, |
| 97 | RESET_TYPE_RX_RECOVERY, |
| 98 | RESET_TYPE_RX_DESC_FETCH, |
| 99 | RESET_TYPE_TX_DESC_FETCH, |
| 100 | RESET_TYPE_TX_SKIP, |
| 101 | RESET_TYPE_MAX, |
| 102 | }; |
| 103 | |
| 104 | #endif /* EFX_ENUM_H */ |