Home | History | Annotate | Line # | Download | only in dev
if_cnmacvar.h revision 1.2
      1  1.2  simonb /*	$NetBSD: if_cnmacvar.h,v 1.2 2020/05/31 06:27:06 simonb Exp $	*/
      2  1.1  hikaru 
      3  1.1  hikaru #undef DEBUG
      4  1.1  hikaru #undef TENBASET_DBG
      5  1.1  hikaru #undef REGISTER_DUMP
      6  1.1  hikaru #ifdef DEBUG
      7  1.1  hikaru #define dprintf printf
      8  1.1  hikaru #else
      9  1.1  hikaru #define dprintf(...)
     10  1.1  hikaru #endif
     11  1.1  hikaru 
     12  1.1  hikaru #define IS_MAC_MULTICASTBIT(addr) \
     13  1.1  hikaru         ((addr)[0] & 0x01)
     14  1.1  hikaru 
     15  1.1  hikaru #define SEND_QUEUE_SIZE		(32)
     16  1.1  hikaru #define GATHER_QUEUE_SIZE	(1024)
     17  1.1  hikaru #define FREE_QUEUE_SIZE		GATHER_QUEUE_SIZE
     18  1.1  hikaru #define RECV_QUEUE_SIZE		(GATHER_QUEUE_SIZE * 2)
     19  1.1  hikaru 
     20  1.2  simonb #ifdef CNMAC_FIXUP_ODD_NIBBLE_DYNAMIC
     21  1.1  hikaru #define PROC_NIBBLE_SOFT_THRESHOLD 2000
     22  1.1  hikaru #endif
     23  1.1  hikaru 
     24  1.1  hikaru /* XXX MUST BE REPLACED WITH BUS_DMA!!! */
     25  1.1  hikaru paddr_t kvtophys(vaddr_t);
     26  1.1  hikaru /* XXX MUST BE REPLACED WITH BUS_DMA!!! */
     27  1.1  hikaru 
     28  1.1  hikaru struct _send_queue_entry;
     29  1.2  simonb struct octasx_softc;
     30  1.2  simonb struct octsmi_softc;
     31  1.2  simonb struct octgmx_port_softc;
     32  1.2  simonb struct octipd_softc;
     33  1.2  simonb struct octpip_softc;
     34  1.2  simonb struct octpko_softc;
     35  1.2  simonb struct octpow_softc;
     36  1.1  hikaru 
     37  1.2  simonb extern struct octpow_softc	octpow_softc;
     38  1.1  hikaru 
     39  1.2  simonb struct cnmac_softc {
     40  1.1  hikaru 	device_t		sc_dev;
     41  1.1  hikaru 	bus_space_tag_t		sc_regt;
     42  1.1  hikaru 	bus_dma_tag_t		sc_dmat;
     43  1.1  hikaru 
     44  1.1  hikaru #if 1
     45  1.1  hikaru 	/* XXX backward compatibility; debugging purpose only */
     46  1.1  hikaru 	bus_space_handle_t      sc_gmx_regh;
     47  1.1  hikaru 	bus_space_handle_t      sc_gmx_port_regh;
     48  1.1  hikaru 	bus_space_handle_t      sc_asx_regh;
     49  1.1  hikaru 	bus_space_handle_t      sc_pow_regh;
     50  1.1  hikaru 	bus_space_handle_t      sc_fpa_regh;
     51  1.1  hikaru 	bus_space_handle_t      sc_smi_regh;
     52  1.1  hikaru 	bus_space_handle_t      sc_pip_regh;
     53  1.1  hikaru #endif
     54  1.1  hikaru 
     55  1.1  hikaru 	void			*sc_pow_recv_ih;
     56  1.2  simonb 	struct octpip_softc	*sc_pip;
     57  1.2  simonb 	struct octipd_softc	*sc_ipd;
     58  1.2  simonb 	struct octpko_softc	*sc_pko;
     59  1.2  simonb 	struct octasx_softc	*sc_asx;
     60  1.2  simonb 	struct octsmi_softc	*sc_smi;
     61  1.2  simonb 	struct octgmx_softc	*sc_gmx;
     62  1.2  simonb 	struct octgmx_port_softc
     63  1.1  hikaru 				*sc_gmx_port;
     64  1.2  simonb 	struct octpow_softc	*sc_pow;
     65  1.1  hikaru 
     66  1.1  hikaru 	struct ethercom		sc_ethercom;
     67  1.1  hikaru 	struct mii_data		sc_mii;
     68  1.1  hikaru 
     69  1.1  hikaru 	void			*sc_sdhook;
     70  1.1  hikaru 
     71  1.1  hikaru 	struct callout		sc_tick_misc_ch;
     72  1.1  hikaru 	struct callout		sc_tick_free_ch;
     73  1.1  hikaru 
     74  1.2  simonb #ifdef CNMAC_INTR_FEEDBACK
     75  1.1  hikaru 	struct callout		sc_resume_ch;
     76  1.1  hikaru #endif
     77  1.1  hikaru 
     78  1.1  hikaru 	int64_t			sc_soft_req_cnt;
     79  1.1  hikaru 	int64_t			sc_soft_req_thresh;
     80  1.1  hikaru 	int64_t			sc_hard_done_cnt;
     81  1.1  hikaru 	int			sc_flush;
     82  1.1  hikaru 	int			sc_prefetch;
     83  1.1  hikaru 	SIMPLEQ_HEAD(, _send_queue_entry)
     84  1.1  hikaru 				sc_sendq;
     85  1.1  hikaru 	uint64_t		sc_ext_callback_cnt;
     86  1.1  hikaru 
     87  1.1  hikaru 	uint32_t		sc_port;
     88  1.1  hikaru 	uint32_t		sc_port_type;
     89  1.1  hikaru 	uint32_t		sc_init_flag;
     90  1.1  hikaru 
     91  1.1  hikaru 	/*
     92  1.1  hikaru 	 * Redirection - received (input) packets are redirected (directly sent)
     93  1.1  hikaru 	 * to another port.  Only meant to test hardware + driver performance.
     94  1.1  hikaru 	 *
     95  1.1  hikaru 	 *  0	- disabled
     96  1.1  hikaru 	 * >0	- redirected to ports that correspond to bits
     97  1.1  hikaru 	 *		0b001 (0x1)	- Port 0
     98  1.1  hikaru 	 *		0b010 (0x2)	- Port 1
     99  1.1  hikaru 	 *		0b100 (0x4)	- Port 2
    100  1.1  hikaru 	 */
    101  1.1  hikaru 	int			sc_redir;
    102  1.1  hikaru 
    103  1.2  simonb 	struct octfau_desc	sc_fau_done;
    104  1.2  simonb 	struct octpko_cmdptr_desc
    105  1.1  hikaru 				sc_cmdptr;
    106  1.1  hikaru 
    107  1.1  hikaru 	size_t			sc_ip_offset;
    108  1.1  hikaru 
    109  1.1  hikaru 	struct timeval		sc_rate_recv_check_link_last;
    110  1.1  hikaru 	struct timeval		sc_rate_recv_check_link_cap;
    111  1.1  hikaru 	struct timeval		sc_rate_recv_check_jumbo_last;
    112  1.1  hikaru 	struct timeval		sc_rate_recv_check_jumbo_cap;
    113  1.1  hikaru 	struct timeval		sc_rate_recv_check_code_last;
    114  1.1  hikaru 	struct timeval		sc_rate_recv_check_code_cap;
    115  1.1  hikaru 	struct timeval		sc_rate_recv_fixup_odd_nibble_short_last;
    116  1.1  hikaru 	struct timeval		sc_rate_recv_fixup_odd_nibble_short_cap;
    117  1.1  hikaru 	struct timeval		sc_rate_recv_fixup_odd_nibble_preamble_last;
    118  1.1  hikaru 	struct timeval		sc_rate_recv_fixup_odd_nibble_preamble_cap;
    119  1.1  hikaru 	struct timeval		sc_rate_recv_fixup_odd_nibble_crc_last;
    120  1.1  hikaru 	struct timeval		sc_rate_recv_fixup_odd_nibble_crc_cap;
    121  1.2  simonb #ifdef CNMAC_DEBUG
    122  1.1  hikaru 	struct timeval		sc_rate_recv_fixup_odd_nibble_addr_last;
    123  1.1  hikaru 	struct timeval		sc_rate_recv_fixup_odd_nibble_addr_cap;
    124  1.1  hikaru #endif
    125  1.1  hikaru 	int			sc_quirks;
    126  1.2  simonb #ifdef CNMAC_DEBUG
    127  1.1  hikaru 	struct evcnt		sc_ev_rx;
    128  1.1  hikaru 	struct evcnt		sc_ev_rxint;
    129  1.1  hikaru 	struct evcnt		sc_ev_rxrs;
    130  1.1  hikaru 	struct evcnt		sc_ev_rxbufpkalloc;
    131  1.1  hikaru 	struct evcnt		sc_ev_rxbufpkput;
    132  1.1  hikaru 	struct evcnt		sc_ev_rxbufwqalloc;
    133  1.1  hikaru 	struct evcnt		sc_ev_rxbufwqput;
    134  1.1  hikaru 	struct evcnt		sc_ev_rxerrcode;
    135  1.1  hikaru 	struct evcnt		sc_ev_rxerrfix;
    136  1.1  hikaru 	struct evcnt		sc_ev_rxerrjmb;
    137  1.1  hikaru 	struct evcnt		sc_ev_rxerrlink;
    138  1.1  hikaru 	struct evcnt		sc_ev_rxerroff;
    139  1.1  hikaru 	struct evcnt		sc_ev_rxonperrshort;
    140  1.1  hikaru 	struct evcnt		sc_ev_rxonperrpreamble;
    141  1.1  hikaru 	struct evcnt		sc_ev_rxonperrcrc;
    142  1.1  hikaru 	struct evcnt		sc_ev_rxonperraddress;
    143  1.1  hikaru 	struct evcnt		sc_ev_rxonponp;
    144  1.1  hikaru 	struct evcnt		sc_ev_rxonpok;
    145  1.1  hikaru 	struct evcnt		sc_ev_tx;
    146  1.1  hikaru 	struct evcnt		sc_ev_txadd;
    147  1.1  hikaru 	struct evcnt		sc_ev_txbufcballoc;
    148  1.1  hikaru 	struct evcnt		sc_ev_txbufcbget;
    149  1.1  hikaru 	struct evcnt		sc_ev_txbufgballoc;
    150  1.1  hikaru 	struct evcnt		sc_ev_txbufgbget;
    151  1.1  hikaru 	struct evcnt		sc_ev_txbufgbput;
    152  1.1  hikaru 	struct evcnt		sc_ev_txdel;
    153  1.1  hikaru 	struct evcnt		sc_ev_txerr;
    154  1.1  hikaru 	struct evcnt		sc_ev_txerrcmd;
    155  1.1  hikaru 	struct evcnt		sc_ev_txerrgbuf;
    156  1.1  hikaru 	struct evcnt		sc_ev_txerrlink;
    157  1.1  hikaru 	struct evcnt		sc_ev_txerrmkcmd;
    158  1.1  hikaru #endif
    159  1.1  hikaru };
    160