~pmdj/ubuntu/trusty/qemu/2.9+applesmc+fadtv3

« back to all changes in this revision

Viewing changes to roms/ipxe/src/drivers/net/forcedeth.h

  • Committer: Phil Dennis-Jordan
  • Date: 2017-07-21 08:03:43 UTC
  • mfrom: (1.1.1)
  • Revision ID: phil@philjordan.eu-20170721080343-2yr2vdj7713czahv
New upstream release 2.9.0.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 *    forcedeth.h -- Driver for NVIDIA nForce media access controllers for iPXE
 
3
 *    Copyright (c) 2010 Andrei Faur <da3drus@gmail.com>
 
4
 *
 
5
 *    This program is free software; you can redistribute it and/or
 
6
 *    modify it under the terms of the GNU General Public License as
 
7
 *    published by the Free Software Foundation; either version 2 of the
 
8
 *    License, or any later version.
 
9
 *
 
10
 *    This program is distributed in the hope that it will be useful, but
 
11
 *    WITHOUT ANY WARRANTY; without even the implied warranty of
 
12
 *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 
13
 *    General Public License for more details.
 
14
 *
 
15
 *    You should have received a copy of the GNU General Public License
 
16
 *    along with this program; if not, write to the Free Software
 
17
 *    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
 
18
 *    02110-1301, USA.
 
19
 *
 
20
 * Portions of this code are taken from the Linux forcedeth driver that was
 
21
 * based on a cleanroom reimplementation which was based on reverse engineered
 
22
 * documentation written by Carl-Daniel Hailfinger and Andrew de Quincey:
 
23
 * Copyright (C) 2003,4,5 Manfred Spraul
 
24
 * Copyright (C) 2004 Andrew de Quincey (wol support)
 
25
 * Copyright (C) 2004 Carl-Daniel Hailfinger (invalid MAC handling, insane
 
26
 *              IRQ rate fixes, bigendian fixes, cleanups, verification)
 
27
 * Copyright (c) 2004,2005,2006,2007,2008,2009 NVIDIA Corporation
 
28
 *
 
29
 * This header is a direct copy of #define lines and structs found in the
 
30
 * above mentioned driver, modified where necessary to make them work for iPXE.
 
31
 *
 
32
 */
 
33
 
 
34
FILE_LICENCE ( GPL2_OR_LATER );
 
35
 
 
36
#ifndef _FORCEDETH_H_
 
37
#define _FORCEDETH_H_
 
38
 
 
39
#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
 
40
 
 
41
struct ring_desc {
 
42
        u32 buf;
 
43
        u32 flaglen;
 
44
};
 
45
 
 
46
struct ring_desc_ex {
 
47
        u32 bufhigh;
 
48
        u32 buflow;
 
49
        u32 txvlan;
 
50
        u32 flaglen;
 
51
};
 
52
 
 
53
#define DESC_VER_1      1
 
54
#define DESC_VER_2      2
 
55
#define DESC_VER_3      3
 
56
 
 
57
#define RX_RING_SIZE            16
 
58
#define TX_RING_SIZE            32
 
59
#define RXTX_RING_SIZE          ( ( RX_RING_SIZE ) + ( TX_RING_SIZE ) )
 
60
#define RX_RING_MIN             128
 
61
#define TX_RING_MIN             64
 
62
#define RING_MAX_DESC_VER_1     1024
 
63
#define RING_MAX_DESC_VER_2_3   16384
 
64
 
 
65
#define NV_RX_ALLOC_PAD (64)
 
66
 
 
67
#define NV_RX_HEADERS   (64)
 
68
 
 
69
#define RX_BUF_SZ               ( ( ETH_FRAME_LEN ) + ( NV_RX_HEADERS ) )
 
70
 
 
71
#define NV_PKTLIMIT_1   1500
 
72
#define NV_PKTLIMIT_2   9100
 
73
 
 
74
#define NV_LINK_POLL_FREQUENCY  128
 
75
 
 
76
/* PHY defines */
 
77
#define PHY_OUI_MARVELL         0x5043
 
78
#define PHY_OUI_CICADA          0x03f1
 
79
#define PHY_OUI_VITESSE         0x01c1
 
80
#define PHY_OUI_REALTEK         0x0732
 
81
#define PHY_OUI_REALTEK2        0x0020
 
82
#define PHYID1_OUI_MASK 0x03ff
 
83
#define PHYID1_OUI_SHFT 6
 
84
#define PHYID2_OUI_MASK 0xfc00
 
85
#define PHYID2_OUI_SHFT 10
 
86
#define PHYID2_MODEL_MASK               0x03f0
 
87
#define PHY_MODEL_REALTEK_8211          0x0110
 
88
#define PHY_REV_MASK                    0x0001
 
89
#define PHY_REV_REALTEK_8211B           0x0000
 
90
#define PHY_REV_REALTEK_8211C           0x0001
 
91
#define PHY_MODEL_REALTEK_8201          0x0200
 
92
#define PHY_MODEL_MARVELL_E3016         0x0220
 
93
#define PHY_MARVELL_E3016_INITMASK      0x0300
 
94
#define PHY_CICADA_INIT1        0x0f000
 
95
#define PHY_CICADA_INIT2        0x0e00
 
96
#define PHY_CICADA_INIT3        0x01000
 
97
#define PHY_CICADA_INIT4        0x0200
 
98
#define PHY_CICADA_INIT5        0x0004
 
99
#define PHY_CICADA_INIT6        0x02000
 
100
#define PHY_VITESSE_INIT_REG1   0x1f
 
101
#define PHY_VITESSE_INIT_REG2   0x10
 
102
#define PHY_VITESSE_INIT_REG3   0x11
 
103
#define PHY_VITESSE_INIT_REG4   0x12
 
104
#define PHY_VITESSE_INIT_MSK1   0xc
 
105
#define PHY_VITESSE_INIT_MSK2   0x0180
 
106
#define PHY_VITESSE_INIT1       0x52b5
 
107
#define PHY_VITESSE_INIT2       0xaf8a
 
108
#define PHY_VITESSE_INIT3       0x8
 
109
#define PHY_VITESSE_INIT4       0x8f8a
 
110
#define PHY_VITESSE_INIT5       0xaf86
 
111
#define PHY_VITESSE_INIT6       0x8f86
 
112
#define PHY_VITESSE_INIT7       0xaf82
 
113
#define PHY_VITESSE_INIT8       0x0100
 
114
#define PHY_VITESSE_INIT9       0x8f82
 
115
#define PHY_VITESSE_INIT10      0x0
 
116
#define PHY_REALTEK_INIT_REG1   0x1f
 
117
#define PHY_REALTEK_INIT_REG2   0x19
 
118
#define PHY_REALTEK_INIT_REG3   0x13
 
119
#define PHY_REALTEK_INIT_REG4   0x14
 
120
#define PHY_REALTEK_INIT_REG5   0x18
 
121
#define PHY_REALTEK_INIT_REG6   0x11
 
122
#define PHY_REALTEK_INIT_REG7   0x01
 
123
#define PHY_REALTEK_INIT1       0x0000
 
124
#define PHY_REALTEK_INIT2       0x8e00
 
125
#define PHY_REALTEK_INIT3       0x0001
 
126
#define PHY_REALTEK_INIT4       0xad17
 
127
#define PHY_REALTEK_INIT5       0xfb54
 
128
#define PHY_REALTEK_INIT6       0xf5c7
 
129
#define PHY_REALTEK_INIT7       0x1000
 
130
#define PHY_REALTEK_INIT8       0x0003
 
131
#define PHY_REALTEK_INIT9       0x0008
 
132
#define PHY_REALTEK_INIT10      0x0005
 
133
#define PHY_REALTEK_INIT11      0x0200
 
134
#define PHY_REALTEK_INIT_MSK1   0x0003
 
135
 
 
136
#define PHY_GIGABIT     0x0100
 
137
 
 
138
#define PHY_TIMEOUT     0x1
 
139
#define PHY_ERROR       0x2
 
140
 
 
141
#define PHY_100 0x1
 
142
#define PHY_1000        0x2
 
143
#define PHY_HALF        0x100
 
144
 
 
145
 
 
146
#define NV_PAUSEFRAME_RX_CAPABLE        0x0001
 
147
#define NV_PAUSEFRAME_TX_CAPABLE        0x0002
 
148
#define NV_PAUSEFRAME_RX_ENABLE         0x0004
 
149
#define NV_PAUSEFRAME_TX_ENABLE         0x0008
 
150
#define NV_PAUSEFRAME_RX_REQ            0x0010
 
151
#define NV_PAUSEFRAME_TX_REQ            0x0020
 
152
#define NV_PAUSEFRAME_AUTONEG           0x0040
 
153
 
 
154
/* MSI/MSI-X defines */
 
155
#define NV_MSI_X_MAX_VECTORS  8
 
156
#define NV_MSI_X_VECTORS_MASK 0x000f
 
157
#define NV_MSI_CAPABLE        0x0010
 
158
#define NV_MSI_X_CAPABLE      0x0020
 
159
#define NV_MSI_ENABLED        0x0040
 
160
#define NV_MSI_X_ENABLED      0x0080
 
161
 
 
162
#define NV_MSI_X_VECTOR_ALL   0x0
 
163
#define NV_MSI_X_VECTOR_RX    0x0
 
164
#define NV_MSI_X_VECTOR_TX    0x1
 
165
#define NV_MSI_X_VECTOR_OTHER 0x2
 
166
 
 
167
#define NV_MSI_PRIV_OFFSET 0x68
 
168
#define NV_MSI_PRIV_VALUE  0xffffffff
 
169
 
 
170
 
 
171
#define NV_MIIBUSY_DELAY        50
 
172
#define NV_MIIPHY_DELAY         10
 
173
#define NV_MIIPHY_DELAYMAX      10000
 
174
 
 
175
/* Hardware access */
 
176
#define DEV_NEED_TIMERIRQ          0x0000001  /* set the timer irq flag in the irq mask */
 
177
#define DEV_NEED_LINKTIMER         0x0000002  /* poll link settings. Relies on the timer irq */
 
178
#define DEV_HAS_LARGEDESC          0x0000004  /* device supports jumbo frames and needs packet format 2 */
 
179
#define DEV_HAS_HIGH_DMA           0x0000008  /* device supports 64bit dma */
 
180
#define DEV_HAS_CHECKSUM           0x0000010  /* device supports tx and rx checksum offloads */
 
181
#define DEV_HAS_VLAN               0x0000020  /* device supports vlan tagging and striping */
 
182
#define DEV_HAS_MSI                0x0000040  /* device supports MSI */
 
183
#define DEV_HAS_MSI_X              0x0000080  /* device supports MSI-X */
 
184
#define DEV_HAS_POWER_CNTRL        0x0000100  /* device supports power savings */
 
185
#define DEV_HAS_STATISTICS_V1      0x0000200  /* device supports hw statistics version 1 */
 
186
#define DEV_HAS_STATISTICS_V2      0x0000600  /* device supports hw statistics version 2 */
 
187
#define DEV_HAS_STATISTICS_V3      0x0000e00  /* device supports hw statistics version 3 */
 
188
#define DEV_HAS_TEST_EXTENDED      0x0001000  /* device supports extended diagnostic test */
 
189
#define DEV_HAS_MGMT_UNIT          0x0002000  /* device supports management unit */
 
190
#define DEV_HAS_CORRECT_MACADDR    0x0004000  /* device supports correct mac address order */
 
191
#define DEV_HAS_COLLISION_FIX      0x0008000  /* device supports tx collision fix */
 
192
#define DEV_HAS_PAUSEFRAME_TX_V1   0x0010000  /* device supports tx pause frames version 1 */
 
193
#define DEV_HAS_PAUSEFRAME_TX_V2   0x0020000  /* device supports tx pause frames version 2 */
 
194
#define DEV_HAS_PAUSEFRAME_TX_V3   0x0040000  /* device supports tx pause frames version 3 */
 
195
#define DEV_NEED_TX_LIMIT          0x0080000  /* device needs to limit tx */
 
196
#define DEV_NEED_TX_LIMIT2         0x0180000  /* device needs to limit tx, expect for some revs */
 
197
#define DEV_HAS_GEAR_MODE          0x0200000  /* device supports gear mode */
 
198
#define DEV_NEED_PHY_INIT_FIX      0x0400000  /* device needs specific phy workaround */
 
199
#define DEV_NEED_LOW_POWER_FIX     0x0800000  /* device needs special power up workaround */
 
200
#define DEV_NEED_MSI_FIX           0x1000000  /* device needs msi workaround */
 
201
 
 
202
#define FLAG_MASK_V1 0xffff0000
 
203
#define FLAG_MASK_V2 0xffffc000
 
204
#define LEN_MASK_V1 (0xffffffff ^ FLAG_MASK_V1)
 
205
#define LEN_MASK_V2 (0xffffffff ^ FLAG_MASK_V2)
 
206
 
 
207
#define NV_TX_LASTPACKET        (1<<16)
 
208
#define NV_TX_RETRYERROR        (1<<19)
 
209
#define NV_TX_RETRYCOUNT_MASK   (0xF<<20)
 
210
#define NV_TX_FORCED_INTERRUPT  (1<<24)
 
211
#define NV_TX_DEFERRED          (1<<26)
 
212
#define NV_TX_CARRIERLOST       (1<<27)
 
213
#define NV_TX_LATECOLLISION     (1<<28)
 
214
#define NV_TX_UNDERFLOW         (1<<29)
 
215
#define NV_TX_ERROR             (1<<30)
 
216
#define NV_TX_VALID             (1<<31)
 
217
 
 
218
#define NV_TX2_LASTPACKET       (1<<29)
 
219
#define NV_TX2_RETRYERROR       (1<<18)
 
220
#define NV_TX2_RETRYCOUNT_MASK  (0xF<<19)
 
221
#define NV_TX2_FORCED_INTERRUPT (1<<30)
 
222
#define NV_TX2_DEFERRED         (1<<25)
 
223
#define NV_TX2_CARRIERLOST      (1<<26)
 
224
#define NV_TX2_LATECOLLISION    (1<<27)
 
225
#define NV_TX2_UNDERFLOW        (1<<28)
 
226
/* error and valid are the same for both */
 
227
#define NV_TX2_ERROR            (1<<30)
 
228
#define NV_TX2_VALID            (1<<31)
 
229
#define NV_TX2_TSO              (1<<28)
 
230
#define NV_TX2_TSO_SHIFT        14
 
231
#define NV_TX2_TSO_MAX_SHIFT    14
 
232
#define NV_TX2_TSO_MAX_SIZE     (1<<NV_TX2_TSO_MAX_SHIFT)
 
233
#define NV_TX2_CHECKSUM_L3      (1<<27)
 
234
#define NV_TX2_CHECKSUM_L4      (1<<26)
 
235
 
 
236
#define NV_TX3_VLAN_TAG_PRESENT (1<<18)
 
237
 
 
238
#define NV_RX_DESCRIPTORVALID   (1<<16)
 
239
#define NV_RX_MISSEDFRAME       (1<<17)
 
240
#define NV_RX_SUBSTRACT1        (1<<18)
 
241
#define NV_RX_ERROR1            (1<<23)
 
242
#define NV_RX_ERROR2            (1<<24)
 
243
#define NV_RX_ERROR3            (1<<25)
 
244
#define NV_RX_ERROR4            (1<<26)
 
245
#define NV_RX_CRCERR            (1<<27)
 
246
#define NV_RX_OVERFLOW          (1<<28)
 
247
#define NV_RX_FRAMINGERR        (1<<29)
 
248
#define NV_RX_ERROR             (1<<30)
 
249
#define NV_RX_AVAIL             (1<<31)
 
250
#define NV_RX_ERROR_MASK        (NV_RX_ERROR1|NV_RX_ERROR2|NV_RX_ERROR3|NV_RX_ERROR4|NV_RX_CRCERR|NV_RX_OVERFLOW|NV_RX_FRAMINGERR)
 
251
 
 
252
#define NV_RX2_CHECKSUMMASK     (0x1C000000)
 
253
#define NV_RX2_CHECKSUM_IP      (0x10000000)
 
254
#define NV_RX2_CHECKSUM_IP_TCP  (0x14000000)
 
255
#define NV_RX2_CHECKSUM_IP_UDP  (0x18000000)
 
256
#define NV_RX2_DESCRIPTORVALID  (1<<29)
 
257
#define NV_RX2_SUBSTRACT1       (1<<25)
 
258
#define NV_RX2_ERROR1           (1<<18)
 
259
#define NV_RX2_ERROR2           (1<<19)
 
260
#define NV_RX2_ERROR3           (1<<20)
 
261
#define NV_RX2_ERROR4           (1<<21)
 
262
#define NV_RX2_CRCERR           (1<<22)
 
263
#define NV_RX2_OVERFLOW         (1<<23)
 
264
#define NV_RX2_FRAMINGERR       (1<<24)
 
265
/* error and avail are the same for both */
 
266
#define NV_RX2_ERROR            (1<<30)
 
267
#define NV_RX2_AVAIL            (1<<31)
 
268
#define NV_RX2_ERROR_MASK       (NV_RX2_ERROR1|NV_RX2_ERROR2|NV_RX2_ERROR3|NV_RX2_ERROR4|NV_RX2_CRCERR|NV_RX2_OVERFLOW|NV_RX2_FRAMINGERR)
 
269
 
 
270
#define NV_RX3_VLAN_TAG_PRESENT (1<<16)
 
271
#define NV_RX3_VLAN_TAG_MASK    (0x0000FFFF)
 
272
 
 
273
/* Miscellaneous hardware related defines */
 
274
#define NV_PCI_REGSZ_VER1       0x270
 
275
#define NV_PCI_REGSZ_VER2       0x2d4
 
276
#define NV_PCI_REGSZ_VER3       0x604
 
277
#define NV_PCI_REGSZ_MAX        0x604
 
278
 
 
279
/* various timeout delays: all in usec */
 
280
#define NV_TXRX_RESET_DELAY     4
 
281
#define NV_TXSTOP_DELAY1        10
 
282
#define NV_TXSTOP_DELAY1MAX     500000
 
283
#define NV_TXSTOP_DELAY2        100
 
284
#define NV_RXSTOP_DELAY1        10
 
285
#define NV_RXSTOP_DELAY1MAX     500000
 
286
#define NV_RXSTOP_DELAY2        100
 
287
#define NV_SETUP5_DELAY         5
 
288
#define NV_SETUP5_DELAYMAX      50000
 
289
#define NV_POWERUP_DELAY        5
 
290
#define NV_POWERUP_DELAYMAX     5000
 
291
#define NV_MIIBUSY_DELAY        50
 
292
#define NV_MIIPHY_DELAY 10
 
293
#define NV_MIIPHY_DELAYMAX      10000
 
294
#define NV_MAC_RESET_DELAY      64
 
295
 
 
296
#define NV_MSI_X_CAPABLE        0x0020
 
297
 
 
298
#define MII_READ        (-1)
 
299
 
 
300
struct forcedeth_private {
 
301
        struct pci_device *pci_dev;
 
302
        struct net_device *netdev;
 
303
 
 
304
        void *mmio_addr;
 
305
 
 
306
        u32 linkspeed;
 
307
        int duplex;
 
308
 
 
309
        int phyaddr;
 
310
        unsigned int phy_oui;
 
311
        unsigned int phy_rev;
 
312
        unsigned int phy_model;
 
313
 
 
314
        u16 gigabit;
 
315
        u32 mac_in_use;
 
316
        int mgmt_version;
 
317
        int mgmt_sema;
 
318
 
 
319
        /* rx specific fields */
 
320
        struct ring_desc *rx_ring;
 
321
        struct io_buffer *rx_iobuf[RX_RING_SIZE];
 
322
        int rx_curr;
 
323
 
 
324
        /* tx specific fields */
 
325
        struct ring_desc *tx_ring;
 
326
        struct io_buffer *tx_iobuf[TX_RING_SIZE];
 
327
        int tx_fill_ctr;
 
328
        int tx_curr;
 
329
        int tx_tail;
 
330
 
 
331
        /* flow control */
 
332
        u32 pause_flags;
 
333
 
 
334
        unsigned long driver_data;
 
335
};
 
336
 
 
337
enum {
 
338
        NvRegIrqStatus = 0x000,
 
339
#define NVREG_IRQSTAT_MIIEVENT  0x040
 
340
#define NVREG_IRQSTAT_MASK              0x83ff
 
341
        NvRegIrqMask = 0x004,
 
342
#define NVREG_IRQ_RX_ERROR              0x0001
 
343
#define NVREG_IRQ_RX                    0x0002
 
344
#define NVREG_IRQ_RX_NOBUF              0x0004
 
345
#define NVREG_IRQ_TX_ERR                0x0008
 
346
#define NVREG_IRQ_TX_OK                 0x0010
 
347
#define NVREG_IRQ_TIMER                 0x0020
 
348
#define NVREG_IRQ_LINK                  0x0040
 
349
#define NVREG_IRQ_RX_FORCED             0x0080
 
350
#define NVREG_IRQ_TX_FORCED             0x0100
 
351
#define NVREG_IRQ_RECOVER_ERROR         0x8200
 
352
#define NVREG_IRQMASK_THROUGHPUT        0x00df
 
353
#define NVREG_IRQMASK_CPU               0x0060
 
354
#define NVREG_IRQ_TX_ALL                (NVREG_IRQ_TX_ERR|NVREG_IRQ_TX_OK|NVREG_IRQ_TX_FORCED)
 
355
#define NVREG_IRQ_RX_ALL                (NVREG_IRQ_RX_ERROR|NVREG_IRQ_RX|NVREG_IRQ_RX_NOBUF|NVREG_IRQ_RX_FORCED)
 
356
#define NVREG_IRQ_OTHER                 (NVREG_IRQ_TIMER|NVREG_IRQ_LINK|NVREG_IRQ_RECOVER_ERROR)
 
357
 
 
358
        NvRegUnknownSetupReg6 = 0x008,
 
359
#define NVREG_UNKSETUP6_VAL             3
 
360
 
 
361
/*
 
362
 * NVREG_POLL_DEFAULT is the interval length of the timer source on the nic
 
363
 * NVREG_POLL_DEFAULT=97 would result in an interval length of 1 ms
 
364
 */
 
365
        NvRegPollingInterval = 0x00c,
 
366
#define NVREG_POLL_DEFAULT_THROUGHPUT   65535 /* backup tx cleanup if loop max reached */
 
367
#define NVREG_POLL_DEFAULT_CPU  13
 
368
        NvRegMSIMap0 = 0x020,
 
369
        NvRegMSIMap1 = 0x024,
 
370
        NvRegMSIIrqMask = 0x030,
 
371
#define NVREG_MSI_VECTOR_0_ENABLED 0x01
 
372
        NvRegMisc1 = 0x080,
 
373
#define NVREG_MISC1_PAUSE_TX    0x01
 
374
#define NVREG_MISC1_HD          0x02
 
375
#define NVREG_MISC1_FORCE       0x3b0f3c
 
376
 
 
377
        NvRegMacReset = 0x34,
 
378
#define NVREG_MAC_RESET_ASSERT  0x0F3
 
379
        NvRegTransmitterControl = 0x084,
 
380
#define NVREG_XMITCTL_START     0x01
 
381
#define NVREG_XMITCTL_MGMT_ST   0x40000000
 
382
#define NVREG_XMITCTL_SYNC_MASK         0x000f0000
 
383
#define NVREG_XMITCTL_SYNC_NOT_READY    0x0
 
384
#define NVREG_XMITCTL_SYNC_PHY_INIT     0x00040000
 
385
#define NVREG_XMITCTL_MGMT_SEMA_MASK    0x00000f00
 
386
#define NVREG_XMITCTL_MGMT_SEMA_FREE    0x0
 
387
#define NVREG_XMITCTL_HOST_SEMA_MASK    0x0000f000
 
388
#define NVREG_XMITCTL_HOST_SEMA_ACQ     0x0000f000
 
389
#define NVREG_XMITCTL_HOST_LOADED       0x00004000
 
390
#define NVREG_XMITCTL_TX_PATH_EN        0x01000000
 
391
#define NVREG_XMITCTL_DATA_START        0x00100000
 
392
#define NVREG_XMITCTL_DATA_READY        0x00010000
 
393
#define NVREG_XMITCTL_DATA_ERROR        0x00020000
 
394
        NvRegTransmitterStatus = 0x088,
 
395
#define NVREG_XMITSTAT_BUSY     0x01
 
396
 
 
397
        NvRegPacketFilterFlags = 0x8c,
 
398
#define NVREG_PFF_PAUSE_RX      0x08
 
399
#define NVREG_PFF_ALWAYS        0x7F0000
 
400
#define NVREG_PFF_PROMISC       0x80
 
401
#define NVREG_PFF_MYADDR        0x20
 
402
#define NVREG_PFF_LOOPBACK      0x10
 
403
 
 
404
        NvRegOffloadConfig = 0x90,
 
405
#define NVREG_OFFLOAD_HOMEPHY   0x601
 
406
#define NVREG_OFFLOAD_NORMAL    RX_NIC_BUFSIZE
 
407
        NvRegReceiverControl = 0x094,
 
408
#define NVREG_RCVCTL_START      0x01
 
409
#define NVREG_RCVCTL_RX_PATH_EN 0x01000000
 
410
        NvRegReceiverStatus = 0x98,
 
411
#define NVREG_RCVSTAT_BUSY      0x01
 
412
 
 
413
        NvRegSlotTime = 0x9c,
 
414
#define NVREG_SLOTTIME_LEGBF_ENABLED    0x80000000
 
415
#define NVREG_SLOTTIME_10_100_FULL      0x00007f00
 
416
#define NVREG_SLOTTIME_1000_FULL        0x0003ff00
 
417
#define NVREG_SLOTTIME_HALF             0x0000ff00
 
418
#define NVREG_SLOTTIME_DEFAULT          0x00007f00
 
419
#define NVREG_SLOTTIME_MASK             0x000000ff
 
420
 
 
421
        NvRegTxDeferral = 0xA0,
 
422
#define NVREG_TX_DEFERRAL_DEFAULT               0x15050f
 
423
#define NVREG_TX_DEFERRAL_RGMII_10_100          0x16070f
 
424
#define NVREG_TX_DEFERRAL_RGMII_1000            0x14050f
 
425
#define NVREG_TX_DEFERRAL_RGMII_STRETCH_10      0x16190f
 
426
#define NVREG_TX_DEFERRAL_RGMII_STRETCH_100     0x16300f
 
427
#define NVREG_TX_DEFERRAL_MII_STRETCH           0x152000
 
428
        NvRegRxDeferral = 0xA4,
 
429
#define NVREG_RX_DEFERRAL_DEFAULT       0x16
 
430
        NvRegMacAddrA = 0xA8,
 
431
        NvRegMacAddrB = 0xAC,
 
432
        NvRegMulticastAddrA = 0xB0,
 
433
#define NVREG_MCASTADDRA_FORCE  0x01
 
434
        NvRegMulticastAddrB = 0xB4,
 
435
        NvRegMulticastMaskA = 0xB8,
 
436
#define NVREG_MCASTMASKA_NONE           0xffffffff
 
437
        NvRegMulticastMaskB = 0xBC,
 
438
#define NVREG_MCASTMASKB_NONE           0xffff
 
439
 
 
440
        NvRegPhyInterface = 0xC0,
 
441
#define PHY_RGMII               0x10000000
 
442
        NvRegBackOffControl = 0xC4,
 
443
#define NVREG_BKOFFCTRL_DEFAULT                 0x70000000
 
444
#define NVREG_BKOFFCTRL_SEED_MASK               0x000003ff
 
445
#define NVREG_BKOFFCTRL_SELECT                  24
 
446
#define NVREG_BKOFFCTRL_GEAR                    12
 
447
 
 
448
        NvRegTxRingPhysAddr = 0x100,
 
449
        NvRegRxRingPhysAddr = 0x104,
 
450
        NvRegRingSizes = 0x108,
 
451
#define NVREG_RINGSZ_TXSHIFT 0
 
452
#define NVREG_RINGSZ_RXSHIFT 16
 
453
        NvRegTransmitPoll = 0x10c,
 
454
#define NVREG_TRANSMITPOLL_MAC_ADDR_REV 0x00008000
 
455
        NvRegLinkSpeed = 0x110,
 
456
#define NVREG_LINKSPEED_FORCE 0x10000
 
457
#define NVREG_LINKSPEED_10      1000
 
458
#define NVREG_LINKSPEED_100     100
 
459
#define NVREG_LINKSPEED_1000    50
 
460
#define NVREG_LINKSPEED_MASK    (0xFFF)
 
461
        NvRegUnknownSetupReg5 = 0x130,
 
462
#define NVREG_UNKSETUP5_BIT31   (1<<31)
 
463
        NvRegTxWatermark = 0x13c,
 
464
#define NVREG_TX_WM_DESC1_DEFAULT       0x0200010
 
465
#define NVREG_TX_WM_DESC2_3_DEFAULT     0x1e08000
 
466
#define NVREG_TX_WM_DESC2_3_1000        0xfe08000
 
467
        NvRegTxRxControl = 0x144,
 
468
#define NVREG_TXRXCTL_KICK      0x0001
 
469
#define NVREG_TXRXCTL_BIT1      0x0002
 
470
#define NVREG_TXRXCTL_BIT2      0x0004
 
471
#define NVREG_TXRXCTL_IDLE      0x0008
 
472
#define NVREG_TXRXCTL_RESET     0x0010
 
473
#define NVREG_TXRXCTL_RXCHECK   0x0400
 
474
#define NVREG_TXRXCTL_DESC_1    0
 
475
#define NVREG_TXRXCTL_DESC_2    0x002100
 
476
#define NVREG_TXRXCTL_DESC_3    0xc02200
 
477
#define NVREG_TXRXCTL_VLANSTRIP 0x00040
 
478
#define NVREG_TXRXCTL_VLANINS   0x00080
 
479
        NvRegTxRingPhysAddrHigh = 0x148,
 
480
        NvRegRxRingPhysAddrHigh = 0x14C,
 
481
        NvRegTxPauseFrame = 0x170,
 
482
#define NVREG_TX_PAUSEFRAME_DISABLE     0x0fff0080
 
483
#define NVREG_TX_PAUSEFRAME_ENABLE_V1   0x01800010
 
484
#define NVREG_TX_PAUSEFRAME_ENABLE_V2   0x056003f0
 
485
#define NVREG_TX_PAUSEFRAME_ENABLE_V3   0x09f00880
 
486
        NvRegTxPauseFrameLimit = 0x174,
 
487
#define NVREG_TX_PAUSEFRAMELIMIT_ENABLE 0x00010000
 
488
        NvRegMIIStatus = 0x180,
 
489
#define NVREG_MIISTAT_ERROR             0x0001
 
490
#define NVREG_MIISTAT_LINKCHANGE        0x0008
 
491
#define NVREG_MIISTAT_MASK_RW           0x0007
 
492
#define NVREG_MIISTAT_MASK_ALL          0x000f
 
493
        NvRegMIIMask = 0x184,
 
494
#define NVREG_MII_LINKCHANGE            0x0008
 
495
 
 
496
        NvRegAdapterControl = 0x188,
 
497
#define NVREG_ADAPTCTL_START    0x02
 
498
#define NVREG_ADAPTCTL_LINKUP   0x04
 
499
#define NVREG_ADAPTCTL_PHYVALID 0x40000
 
500
#define NVREG_ADAPTCTL_RUNNING  0x100000
 
501
#define NVREG_ADAPTCTL_PHYSHIFT 24
 
502
        NvRegMIISpeed = 0x18c,
 
503
#define NVREG_MIISPEED_BIT8     (1<<8)
 
504
#define NVREG_MIIDELAY  5
 
505
        NvRegMIIControl = 0x190,
 
506
#define NVREG_MIICTL_INUSE      0x08000
 
507
#define NVREG_MIICTL_WRITE      0x00400
 
508
#define NVREG_MIICTL_ADDRSHIFT  5
 
509
        NvRegMIIData = 0x194,
 
510
        NvRegTxUnicast = 0x1a0,
 
511
        NvRegTxMulticast = 0x1a4,
 
512
        NvRegTxBroadcast = 0x1a8,
 
513
        NvRegWakeUpFlags = 0x200,
 
514
#define NVREG_WAKEUPFLAGS_VAL           0x7770
 
515
#define NVREG_WAKEUPFLAGS_BUSYSHIFT     24
 
516
#define NVREG_WAKEUPFLAGS_ENABLESHIFT   16
 
517
#define NVREG_WAKEUPFLAGS_D3SHIFT       12
 
518
#define NVREG_WAKEUPFLAGS_D2SHIFT       8
 
519
#define NVREG_WAKEUPFLAGS_D1SHIFT       4
 
520
#define NVREG_WAKEUPFLAGS_D0SHIFT       0
 
521
#define NVREG_WAKEUPFLAGS_ACCEPT_MAGPAT         0x01
 
522
#define NVREG_WAKEUPFLAGS_ACCEPT_WAKEUPPAT      0x02
 
523
#define NVREG_WAKEUPFLAGS_ACCEPT_LINKCHANGE     0x04
 
524
#define NVREG_WAKEUPFLAGS_ENABLE        0x1111
 
525
 
 
526
        NvRegMgmtUnitGetVersion = 0x204,
 
527
#define NVREG_MGMTUNITGETVERSION        0x01
 
528
        NvRegMgmtUnitVersion = 0x208,
 
529
#define NVREG_MGMTUNITVERSION           0x08
 
530
        NvRegPowerCap = 0x268,
 
531
#define NVREG_POWERCAP_D3SUPP   (1<<30)
 
532
#define NVREG_POWERCAP_D2SUPP   (1<<26)
 
533
#define NVREG_POWERCAP_D1SUPP   (1<<25)
 
534
        NvRegPowerState = 0x26c,
 
535
#define NVREG_POWERSTATE_POWEREDUP      0x8000
 
536
#define NVREG_POWERSTATE_VALID          0x0100
 
537
#define NVREG_POWERSTATE_MASK           0x0003
 
538
#define NVREG_POWERSTATE_D0             0x0000
 
539
#define NVREG_POWERSTATE_D1             0x0001
 
540
#define NVREG_POWERSTATE_D2             0x0002
 
541
#define NVREG_POWERSTATE_D3             0x0003
 
542
        NvRegMgmtUnitControl = 0x278,
 
543
#define NVREG_MGMTUNITCONTROL_INUSE     0x20000
 
544
        NvRegTxCnt = 0x280,
 
545
        NvRegTxZeroReXmt = 0x284,
 
546
        NvRegTxOneReXmt = 0x288,
 
547
        NvRegTxManyReXmt = 0x28c,
 
548
        NvRegTxLateCol = 0x290,
 
549
        NvRegTxUnderflow = 0x294,
 
550
        NvRegTxLossCarrier = 0x298,
 
551
        NvRegTxExcessDef = 0x29c,
 
552
        NvRegTxRetryErr = 0x2a0,
 
553
        NvRegRxFrameErr = 0x2a4,
 
554
        NvRegRxExtraByte = 0x2a8,
 
555
        NvRegRxLateCol = 0x2ac,
 
556
        NvRegRxRunt = 0x2b0,
 
557
        NvRegRxFrameTooLong = 0x2b4,
 
558
        NvRegRxOverflow = 0x2b8,
 
559
        NvRegRxFCSErr = 0x2bc,
 
560
        NvRegRxFrameAlignErr = 0x2c0,
 
561
        NvRegRxLenErr = 0x2c4,
 
562
        NvRegRxUnicast = 0x2c8,
 
563
        NvRegRxMulticast = 0x2cc,
 
564
        NvRegRxBroadcast = 0x2d0,
 
565
        NvRegTxDef = 0x2d4,
 
566
        NvRegTxFrame = 0x2d8,
 
567
        NvRegRxCnt = 0x2dc,
 
568
        NvRegTxPause = 0x2e0,
 
569
        NvRegRxPause = 0x2e4,
 
570
        NvRegRxDropFrame = 0x2e8,
 
571
        NvRegVlanControl = 0x300,
 
572
#define NVREG_VLANCONTROL_ENABLE        0x2000
 
573
        NvRegMSIXMap0 = 0x3e0,
 
574
        NvRegMSIXMap1 = 0x3e4,
 
575
        NvRegMSIXIrqStatus = 0x3f0,
 
576
 
 
577
        NvRegPowerState2 = 0x600,
 
578
#define NVREG_POWERSTATE2_POWERUP_MASK          0x0F15
 
579
#define NVREG_POWERSTATE2_POWERUP_REV_A3        0x0001
 
580
#define NVREG_POWERSTATE2_PHY_RESET             0x0004
 
581
#define NVREG_POWERSTATE2_GATE_CLOCKS           0x0F00
 
582
};
 
583
 
 
584
enum {
 
585
        NV_OPTIMIZATION_MODE_THROUGHPUT,
 
586
        NV_OPTIMIZATION_MODE_CPU,
 
587
        NV_OPTIMIZATION_MODE_DYNAMIC
 
588
};
 
589
 
 
590
enum {
 
591
        NV_CROSSOVER_DETECTION_DISABLED,
 
592
        NV_CROSSOVER_DETECTION_ENABLED
 
593
};
 
594
 
 
595
 
 
596
#define NV_SETUP_RX_RING        0x01
 
597
#define NV_SETUP_TX_RING        0x02
 
598
 
 
599
#define NV_RESTART_TX           0x1
 
600
#define NV_RESTART_RX           0x2
 
601
 
 
602
#endif /* _FORCEDETH_H_ */