Merge with 970703 snapshot of Matt Thomas's de driver.

This commit is contained in:
thorpej 1997-08-25 18:56:46 +00:00
parent 6b71fbbcbe
commit a2a13689fd
2 changed files with 559 additions and 352 deletions

File diff suppressed because it is too large Load Diff

View File

@ -1,5 +1,3 @@
/* $NetBSD: if_devar.h,v 1.14 1997/07/19 09:49:45 cgd Exp $ */
/*-
* Copyright (c) 1994-1997 Matt Thomas (matt@3am-software.com)
* All rights reserved.
@ -23,7 +21,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* Id: if_devar.h,v 1.23 1997/06/03 18:51:16 thomas Exp
* Id: if_devar.h,v 1.28 1997/07/03 16:55:07 thomas Exp
*/
#if !defined(_DEVAR_H)
@ -439,8 +437,10 @@ typedef struct {
u_int32_t dot3StatsDeferredTransmissions;
u_int32_t dot3StatsLateCollisions;
u_int32_t dot3StatsExcessiveCollisions;
u_int32_t dot3StatsInternalMacTransmitErrors;
u_int32_t dot3StatsCarrierSenseErrors;
u_int32_t dot3StatsInternalMacTransmitErrors;
u_int32_t dot3StatsInternalTransmitUnderflows; /* not in rfc1650! */
u_int32_t dot3StatsInternalTransmitBabbles; /* not in rfc1650! */
/*
* Receive Statistics
*/
@ -476,9 +476,8 @@ struct _tulip_softc_t {
struct device tulip_dev; /* base device */
void *tulip_ih; /* intrrupt vectoring */
void *tulip_ats; /* shutdown hook */
bus_space_tag_t tulip_bustag; /* tag of CSR region being used */
bus_space_handle_t tulip_bushandle; /* handle for CSR region being used */
bus_space_tag_t tulip_bustag;
bus_space_handle_t tulip_bushandle; /* CSR region handle */
pci_chipset_tag_t tulip_pc;
struct ethercom tulip_ec;
u_int8_t tulip_enaddr[ETHER_ADDR_LEN];
@ -503,9 +502,9 @@ struct _tulip_softc_t {
#define TULIP_INRESET 0x00000200
#define TULIP_NEEDRESET 0x00000400
#define TULIP_SQETEST 0x00000800
#define TULIP_TXINTPENDING 0x00001000
#define TULIP_xxxxxx0 0x00002000
#define TULIP_xxxxxx1 0x00004000
#define TULIP_xxxxxx0 0x00001000
#define TULIP_xxxxxx1 0x00002000
#define TULIP_WANTTXSTART 0x00004000
#define TULIP_NEWTXTHRESH 0x00008000
#define TULIP_NOAUTOSENSE 0x00010000
#define TULIP_PRINTLINKUP 0x00020000
@ -514,7 +513,7 @@ struct _tulip_softc_t {
#define TULIP_NOMESSAGES 0x00100000
#define TULIP_SYSTEMERROR 0x00200000
#define TULIP_TIMEOUTPENDING 0x00400000
#define TULIP_FASTTIMEOUTPENDING 0x00800000
#define TULIP_xxxxxx2 0x00800000
#define TULIP_TRYNWAY 0x01000000
#define TULIP_DIDNWAY 0x02000000
#define TULIP_RXIGNORE 0x04000000
@ -522,7 +521,8 @@ struct _tulip_softc_t {
#define TULIP_DEVICEPROBE 0x10000000
#define TULIP_PROMISC 0x20000000
#define TULIP_HASHONLY 0x40000000
/* only 1 bit left! */
#define TULIP_xxxxxx3 0x80000000
/* only 4 bits left! */
u_int32_t tulip_features; /* static bits indicating features of chip */
#define TULIP_HAVE_GPR 0x00000001 /* have gp register (140[A]) */
#define TULIP_HAVE_RXBADOVRFLW 0x00000002 /* RX corrupts on overflow */
@ -601,9 +601,36 @@ struct _tulip_softc_t {
u_int32_t dbg_txprobes_failed[TULIP_MEDIA_MAX];
u_int32_t dbg_events[TULIP_MEDIAPOLL_MAX];
u_int32_t dbg_rxpktsperintr[TULIP_RXDESCS];
u_int32_t dbg_txpipe;
u_int32_t dbg_txpipestats[TULIP_TXDESCS];
} tulip_dbg;
#endif
#if defined(TULIP_PERFSTATS)
#define TULIP_PERF_CURRENT 0
#define TULIP_PERF_PREVIOUS 1
#define TULIP_PERF_TOTAL 2
#define TULIP_PERF_MAX 3
struct tulip_perfstats {
u_quad_t perf_intr_cycles;
u_quad_t perf_ifstart_cycles;
u_quad_t perf_ifstart_one_cycles;
u_quad_t perf_ifioctl_cycles;
u_quad_t perf_ifwatchdog_cycles;
u_quad_t perf_timeout_cycles;
u_quad_t perf_txput_cycles;
u_quad_t perf_txintr_cycles;
u_quad_t perf_rxintr_cycles;
u_quad_t perf_rxget_cycles;
unsigned perf_intr;
unsigned perf_ifstart;
unsigned perf_ifstart_one;
unsigned perf_ifioctl;
unsigned perf_ifwatchdog;
unsigned perf_timeout;
unsigned perf_txput;
unsigned perf_txintr;
unsigned perf_rxintr;
unsigned perf_rxget;
} tulip_perfstats[TULIP_PERF_MAX];
#define tulip_curperfstats tulip_perfstats[TULIP_PERF_CURRENT]
#endif
struct ifqueue tulip_txq;
struct ifqueue tulip_rxq;
@ -620,10 +647,10 @@ struct _tulip_softc_t {
u_int32_t tulip_setupdata[192/sizeof(u_int32_t)];
char tulip_boardid[16]; /* buffer for board ID */
u_int8_t tulip_rombuf[128];
#ifndef __NetBSD__
u_int8_t tulip_pci_busno; /* needed for multiport boards */
#if defined(__NetBSD__)
struct device *tulip_pci_busno; /* needed for multiport boards */
#else
struct device *tulip_pci_busno; /* in NetBSD each pci bus is a dev */
u_int8_t tulip_pci_busno; /* needed for multiport boards */
#endif
u_int8_t tulip_pci_devno; /* needed for multiport boards */
u_int8_t tulip_connidx;
@ -835,6 +862,7 @@ typedef u_long ioctl_cmd_t;
extern struct cfdriver decd;
#define TULIP_UNIT_TO_SOFTC(unit) ((tulip_softc_t *) decd.cd_devs[unit])
#define TULIP_IFP_TO_SOFTC(ifp) (TULIP_UNIT_TO_SOFTC((ifp)->if_unit))
#define TULIP_ETHER_IFATTACH(sc) ether_attach(&(sc)->tulip_if)
#if _BSDI_VERSION >= 199510
#if 0
#define TULIP_BURSTSIZE(unit) log2_burst_size
@ -952,6 +980,47 @@ extern struct cfdriver de_cd;
#define TULIP_BPF_ATTACH(sc) bpfattach(&(sc)->tulip_bpf, &(sc)->tulip_if, DLT_EN10MB, sizeof(struct ether_header))
#endif
#if defined(TULIP_PERFSTATS)
#define TULIP_PERFMERGE(sc, member) \
do { (sc)->tulip_perfstats[TULIP_PERF_TOTAL].member \
+= (sc)->tulip_perfstats[TULIP_PERF_CURRENT].member; \
(sc)->tulip_perfstats[TULIP_PERF_PREVIOUS].member \
= (sc)->tulip_perfstats[TULIP_PERF_CURRENT].member; \
(sc)->tulip_perfstats[TULIP_PERF_CURRENT].member = 0; } while (0)
#define TULIP_PERFSTART(name) const tulip_cycle_t perfstart_ ## name = TULIP_PERFREAD();
#define TULIP_PERFEND(name) do { \
(sc)->tulip_curperfstats.perf_ ## name ## _cycles += TULIP_PERFDIFF(perfstart_ ## name, TULIP_PERFREAD()); \
(sc)->tulip_curperfstats.perf_ ## name ++; \
} while (0)
#if defined(__i386__)
typedef u_quad_t tulip_cycle_t;
static __inline__ tulip_cycle_t
TULIP_PERFREAD(
void)
{
tulip_cycle_t x;
__asm__ volatile (".byte 0x0f, 0x31" : "=A" (x));
return x;
}
#define TULIP_PERFDIFF(s, f) ((f) - (s))
#elif defined(__alpha__)
typedef unsigned long tulip_cycle_t;
static __inline__ tulip_cycle_t
TULIP_PERFREAD(
void)
{
tulip_cycle_t x;
__asm__ volatile ("rpcc %0" : "=r" (x));
return x;
}
#define TULIP_PERFDIFF(s, f) ((unsigned int) ((f) - (s)))
#endif
#else
#define TULIP_PERFSTART(name)
#define TULIP_PERFEND(name) do { } while (0)
#define TULIP_PERFMERGE(s,n) do { } while (0)
#endif /* TULIP_PERFSTATS */
/*
* However, this change to FreeBSD I am much less enamored with.
*/