aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/via-velocity.h
diff options
context:
space:
mode:
authorAl Viro <viro@ZenIV.linux.org.uk>2008-01-30 14:10:13 -0500
committerDavid S. Miller <davem@davemloft.net>2008-02-03 07:26:27 -0500
commit4a51c0d02c18ea2fea7611bcaf028e69201580d4 (patch)
tree8554c1a1627b24dcfbd349f0d69591b28c12923c /drivers/net/via-velocity.h
parentad84243eb4ec64215517fde0524d92ade47e6084 (diff)
big-endian support for via-velocity
* kill bitfields * annotate * add missing conversions * fix a couple of brainos in zerocopy stuff (fortunately, it's ifdef'ed out) Signed-off-by: Al Viro <viro@zeniv.linux.org.uk> Signed-off-by: Jeff Garzik <jeff@garzik.org> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/via-velocity.h')
-rw-r--r--drivers/net/via-velocity.h224
1 files changed, 96 insertions, 128 deletions
diff --git a/drivers/net/via-velocity.h b/drivers/net/via-velocity.h
index aa9179623d90..7387be4f428d 100644
--- a/drivers/net/via-velocity.h
+++ b/drivers/net/via-velocity.h
@@ -70,40 +70,27 @@
70 * Bits in the RSR0 register 70 * Bits in the RSR0 register
71 */ 71 */
72 72
73#define RSR_DETAG 0x0080 73#define RSR_DETAG cpu_to_le16(0x0080)
74#define RSR_SNTAG 0x0040 74#define RSR_SNTAG cpu_to_le16(0x0040)
75#define RSR_RXER 0x0020 75#define RSR_RXER cpu_to_le16(0x0020)
76#define RSR_RL 0x0010 76#define RSR_RL cpu_to_le16(0x0010)
77#define RSR_CE 0x0008 77#define RSR_CE cpu_to_le16(0x0008)
78#define RSR_FAE 0x0004 78#define RSR_FAE cpu_to_le16(0x0004)
79#define RSR_CRC 0x0002 79#define RSR_CRC cpu_to_le16(0x0002)
80#define RSR_VIDM 0x0001 80#define RSR_VIDM cpu_to_le16(0x0001)
81 81
82/* 82/*
83 * Bits in the RSR1 register 83 * Bits in the RSR1 register
84 */ 84 */
85 85
86#define RSR_RXOK 0x8000 // rx OK 86#define RSR_RXOK cpu_to_le16(0x8000) // rx OK
87#define RSR_PFT 0x4000 // Perfect filtering address match 87#define RSR_PFT cpu_to_le16(0x4000) // Perfect filtering address match
88#define RSR_MAR 0x2000 // MAC accept multicast address packet 88#define RSR_MAR cpu_to_le16(0x2000) // MAC accept multicast address packet
89#define RSR_BAR 0x1000 // MAC accept broadcast address packet 89#define RSR_BAR cpu_to_le16(0x1000) // MAC accept broadcast address packet
90#define RSR_PHY 0x0800 // MAC accept physical address packet 90#define RSR_PHY cpu_to_le16(0x0800) // MAC accept physical address packet
91#define RSR_VTAG 0x0400 // 802.1p/1q tagging packet indicator 91#define RSR_VTAG cpu_to_le16(0x0400) // 802.1p/1q tagging packet indicator
92#define RSR_STP 0x0200 // start of packet 92#define RSR_STP cpu_to_le16(0x0200) // start of packet
93#define RSR_EDP 0x0100 // end of packet 93#define RSR_EDP cpu_to_le16(0x0100) // end of packet
94
95/*
96 * Bits in the RSR1 register
97 */
98
99#define RSR1_RXOK 0x80 // rx OK
100#define RSR1_PFT 0x40 // Perfect filtering address match
101#define RSR1_MAR 0x20 // MAC accept multicast address packet
102#define RSR1_BAR 0x10 // MAC accept broadcast address packet
103#define RSR1_PHY 0x08 // MAC accept physical address packet
104#define RSR1_VTAG 0x04 // 802.1p/1q tagging packet indicator
105#define RSR1_STP 0x02 // start of packet
106#define RSR1_EDP 0x01 // end of packet
107 94
108/* 95/*
109 * Bits in the CSM register 96 * Bits in the CSM register
@@ -120,33 +107,21 @@
120 * Bits in the TSR0 register 107 * Bits in the TSR0 register
121 */ 108 */
122 109
123#define TSR0_ABT 0x0080 // Tx abort because of excessive collision 110#define TSR0_ABT cpu_to_le16(0x0080) // Tx abort because of excessive collision
124#define TSR0_OWT 0x0040 // Jumbo frame Tx abort 111#define TSR0_OWT cpu_to_le16(0x0040) // Jumbo frame Tx abort
125#define TSR0_OWC 0x0020 // Out of window collision 112#define TSR0_OWC cpu_to_le16(0x0020) // Out of window collision
126#define TSR0_COLS 0x0010 // experience collision in this transmit event 113#define TSR0_COLS cpu_to_le16(0x0010) // experience collision in this transmit event
127#define TSR0_NCR3 0x0008 // collision retry counter[3] 114#define TSR0_NCR3 cpu_to_le16(0x0008) // collision retry counter[3]
128#define TSR0_NCR2 0x0004 // collision retry counter[2] 115#define TSR0_NCR2 cpu_to_le16(0x0004) // collision retry counter[2]
129#define TSR0_NCR1 0x0002 // collision retry counter[1] 116#define TSR0_NCR1 cpu_to_le16(0x0002) // collision retry counter[1]
130#define TSR0_NCR0 0x0001 // collision retry counter[0] 117#define TSR0_NCR0 cpu_to_le16(0x0001) // collision retry counter[0]
131#define TSR0_TERR 0x8000 // 118#define TSR0_TERR cpu_to_le16(0x8000) //
132#define TSR0_FDX 0x4000 // current transaction is serviced by full duplex mode 119#define TSR0_FDX cpu_to_le16(0x4000) // current transaction is serviced by full duplex mode
133#define TSR0_GMII 0x2000 // current transaction is serviced by GMII mode 120#define TSR0_GMII cpu_to_le16(0x2000) // current transaction is serviced by GMII mode
134#define TSR0_LNKFL 0x1000 // packet serviced during link down 121#define TSR0_LNKFL cpu_to_le16(0x1000) // packet serviced during link down
135#define TSR0_SHDN 0x0400 // shutdown case 122#define TSR0_SHDN cpu_to_le16(0x0400) // shutdown case
136#define TSR0_CRS 0x0200 // carrier sense lost 123#define TSR0_CRS cpu_to_le16(0x0200) // carrier sense lost
137#define TSR0_CDH 0x0100 // AQE test fail (CD heartbeat) 124#define TSR0_CDH cpu_to_le16(0x0100) // AQE test fail (CD heartbeat)
138
139/*
140 * Bits in the TSR1 register
141 */
142
143#define TSR1_TERR 0x80 //
144#define TSR1_FDX 0x40 // current transaction is serviced by full duplex mode
145#define TSR1_GMII 0x20 // current transaction is serviced by GMII mode
146#define TSR1_LNKFL 0x10 // packet serviced during link down
147#define TSR1_SHDN 0x04 // shutdown case
148#define TSR1_CRS 0x02 // carrier sense lost
149#define TSR1_CDH 0x01 // AQE test fail (CD heartbeat)
150 125
151// 126//
152// Bits in the TCR0 register 127// Bits in the TCR0 register
@@ -197,25 +172,26 @@
197 */ 172 */
198 173
199struct rdesc0 { 174struct rdesc0 {
200 u16 RSR; /* Receive status */ 175 __le16 RSR; /* Receive status */
201 u16 len:14; /* Received packet length */ 176 __le16 len; /* bits 0--13; bit 15 - owner */
202 u16 reserved:1;
203 u16 owner:1; /* Who owns this buffer ? */
204}; 177};
205 178
206struct rdesc1 { 179struct rdesc1 {
207 u16 PQTAG; 180 __le16 PQTAG;
208 u8 CSM; 181 u8 CSM;
209 u8 IPKT; 182 u8 IPKT;
210}; 183};
211 184
185enum {
186 RX_INTEN = __constant_cpu_to_le16(0x8000)
187};
188
212struct rx_desc { 189struct rx_desc {
213 struct rdesc0 rdesc0; 190 struct rdesc0 rdesc0;
214 struct rdesc1 rdesc1; 191 struct rdesc1 rdesc1;
215 u32 pa_low; /* Low 32 bit PCI address */ 192 __le32 pa_low; /* Low 32 bit PCI address */
216 u16 pa_high; /* Next 16 bit PCI address (48 total) */ 193 __le16 pa_high; /* Next 16 bit PCI address (48 total) */
217 u16 len:15; /* Frame size */ 194 __le16 size; /* bits 0--14 - frame size, bit 15 - enable int. */
218 u16 inten:1; /* Enable interrupt */
219} __attribute__ ((__packed__)); 195} __attribute__ ((__packed__));
220 196
221/* 197/*
@@ -223,32 +199,24 @@ struct rx_desc {
223 */ 199 */
224 200
225struct tdesc0 { 201struct tdesc0 {
226 u16 TSR; /* Transmit status register */ 202 __le16 TSR; /* Transmit status register */
227 u16 pktsize:14; /* Size of frame */ 203 __le16 len; /* bits 0--13 - size of frame, bit 15 - owner */
228 u16 reserved:1;
229 u16 owner:1; /* Who owns the buffer */
230}; 204};
231 205
232struct pqinf { /* Priority queue info */
233 u16 VID:12;
234 u16 CFI:1;
235 u16 priority:3;
236} __attribute__ ((__packed__));
237
238struct tdesc1 { 206struct tdesc1 {
239 struct pqinf pqinf; 207 __le16 vlan;
240 u8 TCR; 208 u8 TCR;
241 u8 TCPLS:2; 209 u8 cmd; /* bits 0--1 - TCPLS, bits 4--7 - CMDZ */
242 u8 reserved:2;
243 u8 CMDZ:4;
244} __attribute__ ((__packed__)); 210} __attribute__ ((__packed__));
245 211
212enum {
213 TD_QUEUE = __constant_cpu_to_le16(0x8000)
214};
215
246struct td_buf { 216struct td_buf {
247 u32 pa_low; 217 __le32 pa_low;
248 u16 pa_high; 218 __le16 pa_high;
249 u16 bufsize:14; 219 __le16 size; /* bits 0--13 - size, bit 15 - queue */
250 u16 reserved:1;
251 u16 queue:1;
252} __attribute__ ((__packed__)); 220} __attribute__ ((__packed__));
253 221
254struct tx_desc { 222struct tx_desc {
@@ -276,7 +244,7 @@ struct velocity_td_info {
276 244
277enum velocity_owner { 245enum velocity_owner {
278 OWNED_BY_HOST = 0, 246 OWNED_BY_HOST = 0,
279 OWNED_BY_NIC = 1 247 OWNED_BY_NIC = __constant_cpu_to_le16(0x8000)
280}; 248};
281 249
282 250
@@ -1012,45 +980,45 @@ struct mac_regs {
1012 volatile u8 RCR; 980 volatile u8 RCR;
1013 volatile u8 TCR; 981 volatile u8 TCR;
1014 982
1015 volatile u32 CR0Set; /* 0x08 */ 983 volatile __le32 CR0Set; /* 0x08 */
1016 volatile u32 CR0Clr; /* 0x0C */ 984 volatile __le32 CR0Clr; /* 0x0C */
1017 985
1018 volatile u8 MARCAM[8]; /* 0x10 */ 986 volatile u8 MARCAM[8]; /* 0x10 */
1019 987
1020 volatile u32 DecBaseHi; /* 0x18 */ 988 volatile __le32 DecBaseHi; /* 0x18 */
1021 volatile u16 DbfBaseHi; /* 0x1C */ 989 volatile __le16 DbfBaseHi; /* 0x1C */
1022 volatile u16 reserved_1E; 990 volatile __le16 reserved_1E;
1023 991
1024 volatile u16 ISRCTL; /* 0x20 */ 992 volatile __le16 ISRCTL; /* 0x20 */
1025 volatile u8 TXESR; 993 volatile u8 TXESR;
1026 volatile u8 RXESR; 994 volatile u8 RXESR;
1027 995
1028 volatile u32 ISR; /* 0x24 */ 996 volatile __le32 ISR; /* 0x24 */
1029 volatile u32 IMR; 997 volatile __le32 IMR;
1030 998
1031 volatile u32 TDStatusPort; /* 0x2C */ 999 volatile __le32 TDStatusPort; /* 0x2C */
1032 1000
1033 volatile u16 TDCSRSet; /* 0x30 */ 1001 volatile __le16 TDCSRSet; /* 0x30 */
1034 volatile u8 RDCSRSet; 1002 volatile u8 RDCSRSet;
1035 volatile u8 reserved_33; 1003 volatile u8 reserved_33;
1036 volatile u16 TDCSRClr; 1004 volatile __le16 TDCSRClr;
1037 volatile u8 RDCSRClr; 1005 volatile u8 RDCSRClr;
1038 volatile u8 reserved_37; 1006 volatile u8 reserved_37;
1039 1007
1040 volatile u32 RDBaseLo; /* 0x38 */ 1008 volatile __le32 RDBaseLo; /* 0x38 */
1041 volatile u16 RDIdx; /* 0x3C */ 1009 volatile __le16 RDIdx; /* 0x3C */
1042 volatile u16 reserved_3E; 1010 volatile __le16 reserved_3E;
1043 1011
1044 volatile u32 TDBaseLo[4]; /* 0x40 */ 1012 volatile __le32 TDBaseLo[4]; /* 0x40 */
1045 1013
1046 volatile u16 RDCSize; /* 0x50 */ 1014 volatile __le16 RDCSize; /* 0x50 */
1047 volatile u16 TDCSize; /* 0x52 */ 1015 volatile __le16 TDCSize; /* 0x52 */
1048 volatile u16 TDIdx[4]; /* 0x54 */ 1016 volatile __le16 TDIdx[4]; /* 0x54 */
1049 volatile u16 tx_pause_timer; /* 0x5C */ 1017 volatile __le16 tx_pause_timer; /* 0x5C */
1050 volatile u16 RBRDU; /* 0x5E */ 1018 volatile __le16 RBRDU; /* 0x5E */
1051 1019
1052 volatile u32 FIFOTest0; /* 0x60 */ 1020 volatile __le32 FIFOTest0; /* 0x60 */
1053 volatile u32 FIFOTest1; /* 0x64 */ 1021 volatile __le32 FIFOTest1; /* 0x64 */
1054 1022
1055 volatile u8 CAMADDR; /* 0x68 */ 1023 volatile u8 CAMADDR; /* 0x68 */
1056 volatile u8 CAMCR; /* 0x69 */ 1024 volatile u8 CAMCR; /* 0x69 */
@@ -1063,18 +1031,18 @@ struct mac_regs {
1063 volatile u8 PHYSR1; 1031 volatile u8 PHYSR1;
1064 volatile u8 MIICR; 1032 volatile u8 MIICR;
1065 volatile u8 MIIADR; 1033 volatile u8 MIIADR;
1066 volatile u16 MIIDATA; 1034 volatile __le16 MIIDATA;
1067 1035
1068 volatile u16 SoftTimer0; /* 0x74 */ 1036 volatile __le16 SoftTimer0; /* 0x74 */
1069 volatile u16 SoftTimer1; 1037 volatile __le16 SoftTimer1;
1070 1038
1071 volatile u8 CFGA; /* 0x78 */ 1039 volatile u8 CFGA; /* 0x78 */
1072 volatile u8 CFGB; 1040 volatile u8 CFGB;
1073 volatile u8 CFGC; 1041 volatile u8 CFGC;
1074 volatile u8 CFGD; 1042 volatile u8 CFGD;
1075 1043
1076 volatile u16 DCFG; /* 0x7C */ 1044 volatile __le16 DCFG; /* 0x7C */
1077 volatile u16 MCFG; 1045 volatile __le16 MCFG;
1078 1046
1079 volatile u8 TBIST; /* 0x80 */ 1047 volatile u8 TBIST; /* 0x80 */
1080 volatile u8 RBIST; 1048 volatile u8 RBIST;
@@ -1086,9 +1054,9 @@ struct mac_regs {
1086 volatile u8 rev_id; 1054 volatile u8 rev_id;
1087 volatile u8 PORSTS; 1055 volatile u8 PORSTS;
1088 1056
1089 volatile u32 MIBData; /* 0x88 */ 1057 volatile __le32 MIBData; /* 0x88 */
1090 1058
1091 volatile u16 EEWrData; 1059 volatile __le16 EEWrData;
1092 1060
1093 volatile u8 reserved_8E; 1061 volatile u8 reserved_8E;
1094 volatile u8 BPMDWr; 1062 volatile u8 BPMDWr;
@@ -1098,7 +1066,7 @@ struct mac_regs {
1098 volatile u8 EECHKSUM; /* 0x92 */ 1066 volatile u8 EECHKSUM; /* 0x92 */
1099 volatile u8 EECSR; 1067 volatile u8 EECSR;
1100 1068
1101 volatile u16 EERdData; /* 0x94 */ 1069 volatile __le16 EERdData; /* 0x94 */
1102 volatile u8 EADDR; 1070 volatile u8 EADDR;
1103 volatile u8 EMBCMD; 1071 volatile u8 EMBCMD;
1104 1072
@@ -1112,22 +1080,22 @@ struct mac_regs {
1112 volatile u8 DEBUG; 1080 volatile u8 DEBUG;
1113 volatile u8 CHIPGCR; 1081 volatile u8 CHIPGCR;
1114 1082
1115 volatile u16 WOLCRSet; /* 0xA0 */ 1083 volatile __le16 WOLCRSet; /* 0xA0 */
1116 volatile u8 PWCFGSet; 1084 volatile u8 PWCFGSet;
1117 volatile u8 WOLCFGSet; 1085 volatile u8 WOLCFGSet;
1118 1086
1119 volatile u16 WOLCRClr; /* 0xA4 */ 1087 volatile __le16 WOLCRClr; /* 0xA4 */
1120 volatile u8 PWCFGCLR; 1088 volatile u8 PWCFGCLR;
1121 volatile u8 WOLCFGClr; 1089 volatile u8 WOLCFGClr;
1122 1090
1123 volatile u16 WOLSRSet; /* 0xA8 */ 1091 volatile __le16 WOLSRSet; /* 0xA8 */
1124 volatile u16 reserved_AA; 1092 volatile __le16 reserved_AA;
1125 1093
1126 volatile u16 WOLSRClr; /* 0xAC */ 1094 volatile __le16 WOLSRClr; /* 0xAC */
1127 volatile u16 reserved_AE; 1095 volatile __le16 reserved_AE;
1128 1096
1129 volatile u16 PatternCRC[8]; /* 0xB0 */ 1097 volatile __le16 PatternCRC[8]; /* 0xB0 */
1130 volatile u32 ByteMask[4][4]; /* 0xC0 */ 1098 volatile __le32 ByteMask[4][4]; /* 0xC0 */
1131} __attribute__ ((__packed__)); 1099} __attribute__ ((__packed__));
1132 1100
1133 1101
@@ -1238,12 +1206,12 @@ typedef u8 MCAM_ADDR[ETH_ALEN];
1238struct arp_packet { 1206struct arp_packet {
1239 u8 dest_mac[ETH_ALEN]; 1207 u8 dest_mac[ETH_ALEN];
1240 u8 src_mac[ETH_ALEN]; 1208 u8 src_mac[ETH_ALEN];
1241 u16 type; 1209 __be16 type;
1242 u16 ar_hrd; 1210 __be16 ar_hrd;
1243 u16 ar_pro; 1211 __be16 ar_pro;
1244 u8 ar_hln; 1212 u8 ar_hln;
1245 u8 ar_pln; 1213 u8 ar_pln;
1246 u16 ar_op; 1214 __be16 ar_op;
1247 u8 ar_sha[ETH_ALEN]; 1215 u8 ar_sha[ETH_ALEN];
1248 u8 ar_sip[4]; 1216 u8 ar_sip[4];
1249 u8 ar_tha[ETH_ALEN]; 1217 u8 ar_tha[ETH_ALEN];
@@ -1253,7 +1221,7 @@ struct arp_packet {
1253struct _magic_packet { 1221struct _magic_packet {
1254 u8 dest_mac[6]; 1222 u8 dest_mac[6];
1255 u8 src_mac[6]; 1223 u8 src_mac[6];
1256 u16 type; 1224 __be16 type;
1257 u8 MAC[16][6]; 1225 u8 MAC[16][6];
1258 u8 password[6]; 1226 u8 password[6];
1259} __attribute__ ((__packed__)); 1227} __attribute__ ((__packed__));