avr32: Fix build failures in board code
[sfrench/cifs-2.6.git] / drivers / net / sfc / enum.h
1 /****************************************************************************
2  * Driver for Solarflare Solarstorm network controllers and boards
3  * Copyright 2007 Solarflare Communications Inc.
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
13 /**
14  * enum efx_loopback_mode - loopback modes
15  * @LOOPBACK_NONE: no loopback
16  * @LOOPBACK_XGMII: loopback within MAC at XGMII level
17  * @LOOPBACK_XGXS: loopback within MAC at XGXS level
18  * @LOOPBACK_XAUI: loopback within MAC at XAUI level
19  * @LOOPBACK_PHYXS: loopback within PHY at PHYXS level
20  * @LOOPBACK_PCS: loopback within PHY at PCS level
21  * @LOOPBACK_PMAPMD: loopback within PHY at PMAPMD level
22  * @LOOPBACK_NETWORK: reflecting loopback (even further than furthest!)
23  */
24 /* Please keep in order and up-to-date w.r.t the following two #defines */
25 enum efx_loopback_mode {
26         LOOPBACK_NONE = 0,
27         LOOPBACK_MAC = 1,
28         LOOPBACK_XGMII = 2,
29         LOOPBACK_XGXS = 3,
30         LOOPBACK_XAUI = 4,
31         LOOPBACK_PHY = 5,
32         LOOPBACK_PHYXS = 6,
33         LOOPBACK_PCS = 7,
34         LOOPBACK_PMAPMD = 8,
35         LOOPBACK_NETWORK = 9,
36         LOOPBACK_MAX
37 };
38
39 #define LOOPBACK_TEST_MAX LOOPBACK_PMAPMD
40
41 extern const char *efx_loopback_mode_names[];
42 #define LOOPBACK_MODE_NAME(mode)                        \
43         STRING_TABLE_LOOKUP(mode, efx_loopback_mode)
44 #define LOOPBACK_MODE(efx)                              \
45         LOOPBACK_MODE_NAME(efx->loopback_mode)
46
47 /* These loopbacks occur within the controller */
48 #define LOOPBACKS_10G_INTERNAL ((1 << LOOPBACK_XGMII)| \
49                                 (1 << LOOPBACK_XGXS) | \
50                                 (1 << LOOPBACK_XAUI))
51
52 #define LOOPBACK_MASK(_efx)                     \
53         (1 << (_efx)->loopback_mode)
54
55 #define LOOPBACK_INTERNAL(_efx)                                         \
56         ((LOOPBACKS_10G_INTERNAL & LOOPBACK_MASK(_efx)) ? 1 : 0)
57
58 #define LOOPBACK_OUT_OF(_from, _to, _mask)              \
59         (((LOOPBACK_MASK(_from) & (_mask)) &&           \
60           ((LOOPBACK_MASK(_to) & (_mask)) == 0)) ? 1 : 0)
61
62 /*****************************************************************************/
63
64 /**
65  * enum reset_type - reset types
66  *
67  * %RESET_TYPE_INVSIBLE, %RESET_TYPE_ALL, %RESET_TYPE_WORLD and
68  * %RESET_TYPE_DISABLE specify the method/scope of the reset.  The
69  * other valuesspecify reasons, which efx_schedule_reset() will choose
70  * a method for.
71  *
72  * @RESET_TYPE_INVISIBLE: don't reset the PHYs or interrupts
73  * @RESET_TYPE_ALL: reset everything but PCI core blocks
74  * @RESET_TYPE_WORLD: reset everything, save & restore PCI config
75  * @RESET_TYPE_DISABLE: disable NIC
76  * @RESET_TYPE_MONITOR: reset due to hardware monitor
77  * @RESET_TYPE_INT_ERROR: reset due to internal error
78  * @RESET_TYPE_RX_RECOVERY: reset to recover from RX datapath errors
79  * @RESET_TYPE_RX_DESC_FETCH: pcie error during rx descriptor fetch
80  * @RESET_TYPE_TX_DESC_FETCH: pcie error during tx descriptor fetch
81  * @RESET_TYPE_TX_SKIP: hardware completed empty tx descriptors
82  */
83 enum reset_type {
84         RESET_TYPE_NONE = -1,
85         RESET_TYPE_INVISIBLE = 0,
86         RESET_TYPE_ALL = 1,
87         RESET_TYPE_WORLD = 2,
88         RESET_TYPE_DISABLE = 3,
89         RESET_TYPE_MAX_METHOD,
90         RESET_TYPE_MONITOR,
91         RESET_TYPE_INT_ERROR,
92         RESET_TYPE_RX_RECOVERY,
93         RESET_TYPE_RX_DESC_FETCH,
94         RESET_TYPE_TX_DESC_FETCH,
95         RESET_TYPE_TX_SKIP,
96         RESET_TYPE_MAX,
97 };
98
99 #endif /* EFX_ENUM_H */