2003-11-10 11:51:51 +03:00
|
|
|
/* $NetBSD: if_tlvar.h,v 1.10 2003/11/10 08:51:52 wiz Exp $ */
|
1998-08-11 04:09:26 +04:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Copyright (c) 1997 Manuel Bouyer. All rights reserved.
|
|
|
|
*
|
|
|
|
* Redistribution and use in source and binary forms, with or without
|
|
|
|
* modification, are permitted provided that the following conditions
|
|
|
|
* are met:
|
|
|
|
* 1. Redistributions of source code must retain the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer.
|
|
|
|
* 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer in the
|
|
|
|
* documentation and/or other materials provided with the distribution.
|
|
|
|
* 3. All advertising materials mentioning features or use of this software
|
|
|
|
* must display the following acknowledgement:
|
|
|
|
* This product includes software developed by Manuel Bouyer.
|
|
|
|
* 4. The name of the author may not be used to endorse or promote products
|
|
|
|
* derived from this software without specific prior written permission.
|
|
|
|
*
|
|
|
|
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
|
|
|
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
|
|
|
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
|
|
|
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
|
|
|
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
|
|
|
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
|
|
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
|
|
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
|
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
|
|
|
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Texas Instruments ThunderLAN ethernet controller
|
|
|
|
* ThunderLAN Programmer's Guide (TI Literature Number SPWU013A)
|
|
|
|
* available from www.ti.com
|
|
|
|
*/
|
|
|
|
|
2003-09-30 04:35:30 +04:00
|
|
|
#include <dev/i2c/i2cvar.h>
|
|
|
|
|
1998-08-11 04:09:26 +04:00
|
|
|
struct tl_product_desc {
|
|
|
|
u_int32_t tp_product;
|
|
|
|
int tp_tlphymedia;
|
|
|
|
const char *tp_desc;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct tl_softc {
|
|
|
|
struct device sc_dev; /* base device */
|
|
|
|
bus_space_tag_t tl_bustag;
|
|
|
|
bus_space_handle_t tl_bushandle; /* CSR region handle */
|
2001-08-03 20:53:08 +04:00
|
|
|
bus_dma_tag_t tl_dmatag;
|
1998-08-11 04:09:26 +04:00
|
|
|
const struct tl_product_desc *tl_product;
|
|
|
|
void* tl_ih;
|
|
|
|
struct ethercom tl_ec;
|
2000-03-23 10:01:25 +03:00
|
|
|
struct callout tl_tick_ch; /* tick callout */
|
|
|
|
struct callout tl_restart_ch; /* restart callout */
|
2003-11-10 11:51:51 +03:00
|
|
|
u_int8_t tl_enaddr[ETHER_ADDR_LEN]; /* hardware address */
|
2003-09-30 04:35:30 +04:00
|
|
|
struct i2c_controller sc_i2c; /* i2c controller info, for eeprom */
|
1998-08-11 04:09:26 +04:00
|
|
|
mii_data_t tl_mii; /* mii bus */
|
2001-08-06 23:20:26 +04:00
|
|
|
bus_dma_segment_t ctrl_segs; /* bus-dma memory for control blocks */
|
|
|
|
int ctrl_nsegs;
|
2001-09-20 14:04:10 +04:00
|
|
|
char *ctrl; /* vaddr for ctrl_segs */
|
1998-08-11 04:09:26 +04:00
|
|
|
struct Rx_list *Rx_list; /* Receive and transmit lists */
|
2001-08-03 20:53:08 +04:00
|
|
|
struct tl_Rx_list *hw_Rx_list; /* and assocoated hw descriptor */
|
|
|
|
bus_dmamap_t Rx_dmamap; /* and associated DMA maps */
|
1998-08-11 04:09:26 +04:00
|
|
|
struct Tx_list *Tx_list;
|
2001-08-03 20:53:08 +04:00
|
|
|
struct tl_Tx_list *hw_Tx_list;
|
|
|
|
bus_dmamap_t Tx_dmamap;
|
1998-08-11 04:09:26 +04:00
|
|
|
struct Rx_list *active_Rx, *last_Rx;
|
|
|
|
struct Tx_list *active_Tx, *last_Tx;
|
|
|
|
struct Tx_list *Free_Tx;
|
2001-08-06 23:20:26 +04:00
|
|
|
bus_dmamap_t null_dmamap; /* for small packets padding */
|
1998-08-11 04:09:26 +04:00
|
|
|
#ifdef TL_PRIV_STATS
|
|
|
|
int ierr_overr;
|
|
|
|
int ierr_code;
|
|
|
|
int ierr_crc;
|
|
|
|
int ierr_nomem;
|
|
|
|
int oerr_underr;
|
2003-11-02 13:50:40 +03:00
|
|
|
int oerr_deferred;
|
1998-08-11 04:09:26 +04:00
|
|
|
int oerr_coll;
|
|
|
|
int oerr_multicoll;
|
|
|
|
int oerr_latecoll;
|
|
|
|
int oerr_exesscoll;
|
|
|
|
int oerr_carrloss;
|
|
|
|
int oerr_mcopy;
|
|
|
|
#endif
|
|
|
|
};
|
|
|
|
#define tl_if tl_ec.ec_if
|
|
|
|
#define tl_bpf tl_if.if_bpf
|
|
|
|
|
|
|
|
typedef struct tl_softc tl_softc_t;
|
|
|
|
typedef u_long ioctl_cmd_t;
|
|
|
|
|
|
|
|
#define TL_HR_READ(sc, reg) \
|
|
|
|
bus_space_read_4(sc->tl_bustag, sc->tl_bushandle, (reg))
|
|
|
|
#define TL_HR_READ_BYTE(sc, reg) \
|
|
|
|
bus_space_read_1(sc->tl_bustag, sc->tl_bushandle, (reg))
|
|
|
|
#define TL_HR_WRITE(sc, reg, data) \
|
|
|
|
bus_space_write_4(sc->tl_bustag, sc->tl_bushandle, (reg), (data))
|
|
|
|
#define TL_HR_WRITE_BYTE(sc, reg, data) \
|
|
|
|
bus_space_write_1(sc->tl_bustag, sc->tl_bushandle, (reg), (data))
|
|
|
|
#define ETHER_MIN_TX (ETHERMIN + sizeof(struct ether_header))
|