5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
7 *
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
12 *
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 *
19 * CDDL HEADER END
20 */
21 /*
22 * Copyright 2010 Sun Microsystems, Inc. All rights reserved.
23 * Use is subject to license terms.
24 */
25
26 /*
27 * SunOS MT STREAMS ERI(PCI) 10/100 Mb Ethernet Device Driver
28 */
29
30 #include <sys/types.h>
31 #include <sys/debug.h>
32 #include <sys/stropts.h>
33 #include <sys/stream.h>
34 #include <sys/strsubr.h>
35 #include <sys/kmem.h>
36 #include <sys/crc32.h>
37 #include <sys/ddi.h>
38 #include <sys/sunddi.h>
39 #include <sys/strsun.h>
40 #include <sys/stat.h>
41 #include <sys/cpu.h>
42 #include <sys/kstat.h>
43 #include <inet/common.h>
44 #include <sys/pattr.h>
329 #define ERI_DONT_STRIP_CRC
330 /*
331 * Translate a kernel virtual address to i/o address.
332 */
333 #define ERI_IOPBIOADDR(erip, a) \
334 ((erip)->iopbiobase + ((uintptr_t)a - (erip)->iopbkbase))
335
336 /*
337 * ERI Configuration Register Value
338 * Used to configure parameters that define DMA burst
339 * and internal arbitration behavior.
340 * for equal TX and RX bursts, set the following in global
341 * configuration register.
342 * static int global_config = 0x42;
343 */
344
345 /*
346 * ERI ERX Interrupt Blanking Time
347 * Each count is about 16 us (2048 clocks) for 66 MHz PCI.
348 */
349 static int intr_blank_time = 6; /* for about 96 us */
350 static int intr_blank_packets = 8; /* */
351
352 /*
353 * ERX PAUSE Threshold Register value
354 * The following value is for an OFF Threshold of about 15.5 Kbytes
355 * and an ON Threshold of 4K bytes.
356 */
357 static int rx_pause_threshold = 0xf8 | (0x40 << 12);
358 static int eri_reinit_fatal = 0;
359 #ifdef DEBUG
360 static int noteri = 0;
361 #endif
362
363 #ifdef ERI_TX_HUNG
364 static int eri_reinit_txhung = 0;
365 #endif
366
367 #ifdef ERI_HDX_BUG_WORKAROUND
368 /*
369 * By default enable padding in hdx mode to 97 bytes.
370 * To disabled, in /etc/system:
|
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
7 *
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
12 *
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 *
19 * CDDL HEADER END
20 */
21 /*
22 * Copyright 2010 Sun Microsystems, Inc. All rights reserved.
23 * Use is subject to license terms.
24 */
25 /*
26 * Copyright 2013 Nexenta Systems, Inc. All rights reserved.
27 */
28
29 /*
30 * SunOS MT STREAMS ERI(PCI) 10/100 Mb Ethernet Device Driver
31 */
32
33 #include <sys/types.h>
34 #include <sys/debug.h>
35 #include <sys/stropts.h>
36 #include <sys/stream.h>
37 #include <sys/strsubr.h>
38 #include <sys/kmem.h>
39 #include <sys/crc32.h>
40 #include <sys/ddi.h>
41 #include <sys/sunddi.h>
42 #include <sys/strsun.h>
43 #include <sys/stat.h>
44 #include <sys/cpu.h>
45 #include <sys/kstat.h>
46 #include <inet/common.h>
47 #include <sys/pattr.h>
332 #define ERI_DONT_STRIP_CRC
333 /*
334 * Translate a kernel virtual address to i/o address.
335 */
336 #define ERI_IOPBIOADDR(erip, a) \
337 ((erip)->iopbiobase + ((uintptr_t)a - (erip)->iopbkbase))
338
339 /*
340 * ERI Configuration Register Value
341 * Used to configure parameters that define DMA burst
342 * and internal arbitration behavior.
343 * for equal TX and RX bursts, set the following in global
344 * configuration register.
345 * static int global_config = 0x42;
346 */
347
348 /*
349 * ERI ERX Interrupt Blanking Time
350 * Each count is about 16 us (2048 clocks) for 66 MHz PCI.
351 */
352 volatile int intr_blank_time = 6; /* for about 96 us */
353 volatile int intr_blank_packets = 8; /* */
354
355 /*
356 * ERX PAUSE Threshold Register value
357 * The following value is for an OFF Threshold of about 15.5 Kbytes
358 * and an ON Threshold of 4K bytes.
359 */
360 static int rx_pause_threshold = 0xf8 | (0x40 << 12);
361 static int eri_reinit_fatal = 0;
362 #ifdef DEBUG
363 static int noteri = 0;
364 #endif
365
366 #ifdef ERI_TX_HUNG
367 static int eri_reinit_txhung = 0;
368 #endif
369
370 #ifdef ERI_HDX_BUG_WORKAROUND
371 /*
372 * By default enable padding in hdx mode to 97 bytes.
373 * To disabled, in /etc/system:
|