/*
* 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.
*/
#include <sys/rndsource.h>
/*
* We include MII glue here -- some DP8390 compatible chips have
* MII interfaces on them (scary, isn't it...).
*/
#include <sys/callout.h>
#include <dev/mii/miivar.h>
#define INTERFACE_NAME_LEN 32
/*
* dp8390_softc: per line info and status
*/
struct dp8390_softc {
device_t sc_dev;
void *sc_ih;
int sc_flags; /* interface flags, from config */
struct ethercom sc_ec; /* ethernet common */
struct mii_data sc_mii; /* MII glue */
#define sc_media sc_mii.mii_media /* compatibility definition */
callout_t sc_tick_ch; /* MII tick callout */
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 */
u_int8_t cr_proto; /* values always set in CR */
u_int8_t rcr_proto; /* values always set in RCR */
u_int8_t dcr_reg; /* override DCR iff LS is set */
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 */
u_int8_t sc_enaddr[ETHER_ADDR_LEN]; /* storage for MAC address */
int sc_enabled; /* boolean; power enabled on interface */
/*
* Compile-time config flags
*/
/*
* This sets the default for enabling/disabling the transceiver.
*/
#define DP8390_DISABLE_TRANSCEIVER 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
/*
* The chip is ASIX AX88190 and needs work around.
*/
#define DP8390_DO_AX88190_WORKAROUND 0x0020
#define DP8390_ATTACHED 0x0040 /* attach has succeeded */
/*
* ASIX AX88796 doesn't have remote DMA complete bit in ISR, so don't
* check ISR.RDC
*/
#define DP8390_NO_REMOTE_DMA_COMPLETE 0x0080