]> git.kernelconcepts.de Git - karo-tx-uboot.git/blob - drivers/net/npe/include/IxEthDBPortDefs.h
doc: SPI: Add qspi test details on AM43xx
[karo-tx-uboot.git] / drivers / net / npe / include / IxEthDBPortDefs.h
1 /**
2  * @file IxEthDBPortDefs.h
3  *
4  * @brief Public definition of the ports and port capabilities
5  * 
6  * @par
7  * IXP400 SW Release version 2.0
8  * 
9  * -- Copyright Notice --
10  * 
11  * @par
12  * Copyright 2001-2005, Intel Corporation.
13  * All rights reserved.
14  * 
15  * @par
16  * SPDX-License-Identifier:     BSD-3-Clause
17  * @par
18  * -- End of Copyright Notice --
19  */
20
21 /**
22  * @defgroup IxEthDBPortDefs IXP400 Ethernet Database Port Definitions (IxEthDBPortDefs)
23  *
24  * @brief IXP400 Public definition of the ports and port capabilities
25  *
26  * @{
27  */
28
29 #ifndef IxEthDBPortDefs_H
30 #define IxEthDBPortDefs_H
31
32 /** 
33  * @brief Port types - currently only Ethernet NPEs are recognized as specific types 
34  * All other (user-defined) ports must be specified as IX_ETH_GENERIC
35  */
36 typedef enum
37 {
38     IX_ETH_GENERIC = 0, /**< generic ethernet port */
39     IX_ETH_NPE          /**< specific Ethernet NPE */
40 } IxEthDBPortType;
41
42 /** 
43  * @brief Port capabilities - used by ixEthAccDatabaseMaintenance to decide whether it
44  * should manually age entries or not depending on the port capabilities.
45  *
46  * Ethernet NPEs have aging capabilities, meaning that they will age the entries
47  * automatically (by themselves).*/
48 typedef enum
49 {
50     IX_ETH_NO_CAPABILITIES = 0,   /**< no aging capabilities */
51     IX_ETH_ENTRY_AGING     = 0x1  /**< aging capabilities present */
52 } IxEthDBPortCapability;
53
54 /** 
55  * @brief Port Definition - a structure contains the Port type and capabilities 
56  */
57 typedef struct
58 {
59     IxEthDBPortType type;
60     IxEthDBPortCapability capabilities;
61 } IxEthDBPortDefinition;
62
63 /** 
64  * @brief Port definitions structure, indexed on the port ID
65  * @warning Ports 0 and 1 are used by the Ethernet access component therefore
66  * it is essential to be left untouched. Port 2 here (WAN) is given as 
67  * an example port. The NPE firmware also assumes the NPE B to be
68  * the port 0 and NPE C to be the port 1.
69  *
70  * @note that only 32 ports (0..31) are supported by EthDB
71  */
72 static const IxEthDBPortDefinition ixEthDBPortDefinitions[] = 
73 {
74     /*    id       type              capabilities */
75     {   /* 0 */    IX_ETH_NPE,       IX_ETH_NO_CAPABILITIES },    /* Ethernet NPE B */
76     {   /* 1 */    IX_ETH_NPE,       IX_ETH_NO_CAPABILITIES },    /* Ethernet NPE C */
77     {   /* 2 */    IX_ETH_NPE,       IX_ETH_NO_CAPABILITIES },    /* Ethernet NPE A */
78     {   /* 3 */    IX_ETH_GENERIC,   IX_ETH_NO_CAPABILITIES },    /* WAN port */
79 };
80
81 /** 
82  * @def IX_ETH_DB_NUMBER_OF_PORTS
83  * @brief number of supported ports 
84  */
85 #define IX_ETH_DB_NUMBER_OF_PORTS ARRAY_SIZE(ixEthDBPortDefinitions)
86
87 /**
88  * @def IX_ETH_DB_UNKNOWN_PORT
89  * @brief definition of an unknown port
90  */
91 #define IX_ETH_DB_UNKNOWN_PORT (0xff)
92
93 /** 
94  * @def IX_ETH_DB_ALL_PORTS
95  * @brief Special port ID indicating all the ports
96  * @note This port ID can be used only by a subset of the EthDB API; each
97  * function specifically mentions whether this is a valid parameter as the port ID
98  */
99 #define IX_ETH_DB_ALL_PORTS (IX_ETH_DB_NUMBER_OF_PORTS + 1)
100
101 /**
102  * @def IX_ETH_DB_PORTS_ASSERTION
103  * @brief catch invalid port definitions (<2) with a 
104  * compile-time assertion resulting in a duplicate case error. 
105  */
106 #define IX_ETH_DB_PORTS_ASSERTION { switch(0) { case 0 : ; case 1 : ; case IX_ETH_DB_NUMBER_OF_PORTS : ; }}
107
108 /** 
109  * @def IX_ETH_DB_CHECK_PORT(portID)
110  * @brief safety checks to verify whether the port is invalid or uninitialized
111  */
112 #define IX_ETH_DB_CHECK_PORT(portID) \
113 { \
114   if ((portID) >= IX_ETH_DB_NUMBER_OF_PORTS) \
115   { \
116       return IX_ETH_DB_INVALID_PORT; \
117   } \
118   \
119   if (!ixEthDBPortInfo[(portID)].enabled) \
120   { \
121       return IX_ETH_DB_PORT_UNINITIALIZED; \
122   } \
123 }
124
125 /**
126  * @def IX_ETH_DB_CHECK_PORT_ALL(portID)
127  * @brief safety checks to verify whether the port is invalid or uninitialized; 
128  * tolerates the use of IX_ETH_DB_ALL_PORTS
129  */
130 #define IX_ETH_DB_CHECK_PORT_ALL(portID) \
131 { \
132   if ((portID) != IX_ETH_DB_ALL_PORTS) \
133     IX_ETH_DB_CHECK_PORT(portID) \
134 }
135
136 #endif /* IxEthDBPortDefs_H */
137 /**
138  *@}
139  */