2000-09-28 14:56:57 +04:00
|
|
|
/* $NetBSD: dp8390var.h,v 1.20 2000/09/28 10:56:57 tsutsui Exp $ */
|
1997-04-29 08:32:07 +04:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Device driver for National Semiconductor DS8390/WD83C690 based ethernet
|
|
|
|
* adapters.
|
|
|
|
*
|
|
|
|
* Copyright (c) 1994, 1995 Charles M. Hannum. All rights reserved.
|
|
|
|
*
|
|
|
|
* Copyright (C) 1993, David Greenman. This software may be used, modified,
|
|
|
|
* copied, distributed, and sold, in both source and binary form provided that
|
|
|
|
* the above copyright and these terms are retained. Under no circumstances is
|
|
|
|
* the author responsible for the proper functioning of this software, nor does
|
|
|
|
* the author assume any responsibility for damages incurred with its use.
|
|
|
|
*/
|
|
|
|
|
1999-02-07 04:54:50 +03:00
|
|
|
#include "rnd.h"
|
|
|
|
#if NRND > 0
|
|
|
|
#include <sys/rnd.h>
|
|
|
|
#endif
|
|
|
|
|
1997-04-29 08:32:07 +04:00
|
|
|
#define INTERFACE_NAME_LEN 32
|
|
|
|
|
|
|
|
/*
|
|
|
|
* dp8390_softc: per line info and status
|
|
|
|
*/
|
|
|
|
struct dp8390_softc {
|
|
|
|
struct device sc_dev;
|
|
|
|
void *sc_ih;
|
1997-11-02 03:23:54 +03:00
|
|
|
int sc_flags; /* interface flags, from config */
|
1997-04-29 08:32:07 +04:00
|
|
|
|
1997-11-02 03:23:54 +03:00
|
|
|
struct ethercom sc_ec; /* ethernet common */
|
|
|
|
struct ifmedia sc_media; /* supported media information */
|
1997-04-29 08:32:07 +04:00
|
|
|
|
|
|
|
bus_space_tag_t sc_regt; /* NIC register space tag */
|
|
|
|
bus_space_handle_t sc_regh; /* NIC register space handle */
|
|
|
|
bus_space_tag_t sc_buft; /* Buffer space tag */
|
|
|
|
bus_space_handle_t sc_bufh; /* Buffer space handle */
|
|
|
|
|
|
|
|
bus_size_t sc_reg_map[16]; /* register map (offsets) */
|
|
|
|
|
1997-11-05 10:15:42 +03:00
|
|
|
int is790; /* NIC is a 790 */
|
1997-04-29 08:32:07 +04:00
|
|
|
|
|
|
|
u_int8_t cr_proto; /* values always set in CR */
|
2000-02-09 18:40:23 +03:00
|
|
|
u_int8_t rcr_proto; /* values always set in RCR */
|
1997-04-30 22:09:14 +04:00
|
|
|
u_int8_t dcr_reg; /* override DCR iff LS is set */
|
1997-04-29 08:32:07 +04:00
|
|
|
|
|
|
|
int mem_start; /* offset of NIC memory */
|
|
|
|
int mem_end; /* offset of NIC memory end */
|
|
|
|
int mem_size; /* total shared memory size */
|
|
|
|
int mem_ring; /* offset of start of RX ring-buffer */
|
|
|
|
|
|
|
|
u_short txb_cnt; /* Number of transmit buffers */
|
|
|
|
u_short txb_inuse; /* number of transmit buffers active */
|
|
|
|
|
|
|
|
u_short txb_new; /* pointer to where new buffer will be added */
|
|
|
|
u_short txb_next_tx; /* pointer to next buffer ready to xmit */
|
|
|
|
u_short txb_len[8]; /* buffered xmit buffer lengths */
|
|
|
|
u_short tx_page_start; /* first page of TX buffer area */
|
|
|
|
u_short rec_page_start; /* first page of RX ring-buffer */
|
|
|
|
u_short rec_page_stop; /* last page of RX ring-buffer */
|
|
|
|
u_short next_packet; /* pointer to next unread RX packet */
|
|
|
|
|
2000-09-28 14:56:57 +04:00
|
|
|
u_int8_t sc_enaddr[ETHER_ADDR_LEN]; /* storage for MAC address */
|
1997-04-29 08:32:07 +04:00
|
|
|
|
1997-10-15 20:54:39 +04:00
|
|
|
int sc_enabled; /* boolean; power enabled on interface */
|
|
|
|
|
1999-02-07 04:54:50 +03:00
|
|
|
#if NRND > 0
|
|
|
|
rndsource_element_t rnd_source; /* random source */
|
|
|
|
#endif
|
|
|
|
|
1997-04-29 08:32:07 +04:00
|
|
|
int (*test_mem) __P((struct dp8390_softc *));
|
|
|
|
void (*init_card) __P((struct dp8390_softc *));
|
|
|
|
void (*read_hdr) __P((struct dp8390_softc *,
|
|
|
|
int, struct dp8390_ring *));
|
|
|
|
void (*recv_int) __P((struct dp8390_softc *));
|
|
|
|
int (*ring_copy) __P((struct dp8390_softc *,
|
|
|
|
int, caddr_t, u_short));
|
|
|
|
int (*write_mbuf) __P((struct dp8390_softc *, struct mbuf *, int));
|
1997-10-15 20:54:39 +04:00
|
|
|
|
|
|
|
int (*sc_enable) __P((struct dp8390_softc *));
|
|
|
|
void (*sc_disable) __P((struct dp8390_softc *));
|
1997-11-02 03:23:54 +03:00
|
|
|
|
|
|
|
int (*sc_mediachange) __P((struct dp8390_softc *));
|
|
|
|
void (*sc_mediastatus) __P((struct dp8390_softc *,
|
|
|
|
struct ifmediareq *));
|
1997-04-29 08:32:07 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Vendor types
|
|
|
|
*/
|
|
|
|
#define DP8390_VENDOR_UNKNOWN 0xff /* Unknown network card */
|
|
|
|
#define DP8390_VENDOR_WD_SMC 0x00 /* Western Digital/SMC */
|
|
|
|
#define DP8390_VENDOR_3COM 0x01 /* 3Com */
|
|
|
|
#define DP8390_VENDOR_NOVELL 0x02 /* Novell */
|
|
|
|
#define DP8390_VENDOR_APPLE 0x10 /* Apple Ethernet card */
|
|
|
|
#define DP8390_VENDOR_INTERLAN 0x11 /* Interlan A310 card (GatorCard) */
|
|
|
|
#define DP8390_VENDOR_DAYNA 0x12 /* DaynaPORT E/30s (and others?) */
|
|
|
|
#define DP8390_VENDOR_ASANTE 0x13 /* Asante MacCon II/E */
|
|
|
|
#define DP8390_VENDOR_FARALLON 0x14 /* Farallon EtherMac II-TP */
|
|
|
|
#define DP8390_VENDOR_FOCUS 0x15 /* FOCUS Enhancements EtherLAN */
|
|
|
|
#define DP8390_VENDOR_KINETICS 0x16 /* Kinetics EtherPort SE/30 */
|
1998-08-12 11:19:09 +04:00
|
|
|
#define DP8390_VENDOR_CABLETRON 0x17 /* Cabletron Ethernet */
|
1997-04-29 08:32:07 +04:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Compile-time config flags
|
|
|
|
*/
|
|
|
|
/*
|
|
|
|
* This sets the default for enabling/disablng the tranceiver.
|
|
|
|
*/
|
|
|
|
#define DP8390_DISABLE_TRANCEIVER 0x0001
|
|
|
|
|
|
|
|
/*
|
|
|
|
* This forces the board to be used in 8/16-bit mode even if it autoconfigs
|
|
|
|
* differently.
|
|
|
|
*/
|
|
|
|
#define DP8390_FORCE_8BIT_MODE 0x0002
|
|
|
|
#define DP8390_FORCE_16BIT_MODE 0x0004
|
|
|
|
|
|
|
|
/*
|
|
|
|
* This disables the use of multiple transmit buffers.
|
|
|
|
*/
|
|
|
|
#define DP8390_NO_MULTI_BUFFERING 0x0008
|
|
|
|
|
|
|
|
/*
|
|
|
|
* This forces all operations with the NIC memory to use Programmed I/O (i.e.
|
|
|
|
* not via shared memory).
|
|
|
|
*/
|
|
|
|
#define DP8390_FORCE_PIO 0x0010
|
|
|
|
|
2000-02-09 18:40:23 +03:00
|
|
|
/*
|
|
|
|
* The chip is ASIX AX88190 and needs work around.
|
|
|
|
*/
|
|
|
|
#define DP8390_DO_AX88190_WORKAROUND 0x0020
|
|
|
|
|
2000-05-29 21:37:12 +04:00
|
|
|
#define DP8390_ATTACHED 0x0040 /* attach has succeeded */
|
|
|
|
|
1997-04-29 08:32:07 +04:00
|
|
|
/*
|
|
|
|
* NIC register access macros
|
|
|
|
*/
|
1997-10-15 20:54:39 +04:00
|
|
|
#define NIC_GET(t, h, reg) bus_space_read_1(t, h, \
|
|
|
|
((sc)->sc_reg_map[reg]))
|
|
|
|
#define NIC_PUT(t, h, reg, val) bus_space_write_1(t, h, \
|
|
|
|
((sc)->sc_reg_map[reg]), (val))
|
2000-03-22 21:02:59 +03:00
|
|
|
#define NIC_BARRIER(t, h) bus_space_barrier(t, h, 0, 0x10, \
|
|
|
|
BUS_SPACE_BARRIER_READ | BUS_SPACE_BARRIER_WRITE)
|
1997-04-29 08:32:07 +04:00
|
|
|
|
1997-11-02 03:23:54 +03:00
|
|
|
int dp8390_config __P((struct dp8390_softc *, int *, int, int));
|
1997-10-15 20:54:39 +04:00
|
|
|
int dp8390_intr __P((void *));
|
1997-04-29 08:32:07 +04:00
|
|
|
int dp8390_ioctl __P((struct ifnet *, u_long, caddr_t));
|
|
|
|
void dp8390_start __P((struct ifnet *));
|
|
|
|
void dp8390_watchdog __P((struct ifnet *));
|
|
|
|
void dp8390_reset __P((struct dp8390_softc *));
|
|
|
|
void dp8390_init __P((struct dp8390_softc *));
|
|
|
|
void dp8390_stop __P((struct dp8390_softc *));
|
|
|
|
|
|
|
|
void dp8390_rint __P((struct dp8390_softc *));
|
|
|
|
|
|
|
|
void dp8390_getmcaf __P((struct ethercom *, u_int8_t *));
|
|
|
|
struct mbuf *dp8390_get __P((struct dp8390_softc *, int, u_short));
|
|
|
|
void dp8390_read __P((struct dp8390_softc *, int, u_short));
|
1998-11-17 23:25:00 +03:00
|
|
|
|
|
|
|
int dp8390_enable __P((struct dp8390_softc *));
|
|
|
|
void dp8390_disable __P((struct dp8390_softc *));
|
1998-11-18 21:34:52 +03:00
|
|
|
|
|
|
|
int dp8390_activate __P((struct device *, enum devact));
|
2000-02-02 13:00:06 +03:00
|
|
|
|
2000-02-02 14:41:56 +03:00
|
|
|
int dp8390_detach __P((struct dp8390_softc *, int));
|
2000-03-22 23:58:25 +03:00
|
|
|
|
|
|
|
#ifdef IPKDB_DP8390
|
|
|
|
int dp8390_ipkdb_attach __P((struct ipkdb_if *));
|
|
|
|
#endif
|