i82557reg.h revision 1.19.16.2       1  1.19.16.2     yamt /*	$NetBSD: i82557reg.h,v 1.19.16.2 2009/05/04 08:12:42 yamt Exp $	*/
      2        1.1  thorpej 
      3        1.1  thorpej /*-
      4        1.8  thorpej  * Copyright (c) 1998, 1999, 2001 The NetBSD Foundation, Inc.
      5        1.1  thorpej  * All rights reserved.
      6        1.1  thorpej  *
      7        1.1  thorpej  * This code is derived from software contributed to The NetBSD Foundation
      8        1.1  thorpej  * by Jason R. Thorpe of the Numerical Aerospace Simulation Facility,
      9        1.1  thorpej  * NASA Ames Research Center.
     10        1.1  thorpej  *
     11        1.1  thorpej  * Redistribution and use in source and binary forms, with or without
     12        1.1  thorpej  * modification, are permitted provided that the following conditions
     13        1.1  thorpej  * are met:
     14        1.1  thorpej  * 1. Redistributions of source code must retain the above copyright
     15        1.1  thorpej  *    notice, this list of conditions and the following disclaimer.
     16        1.1  thorpej  * 2. Redistributions in binary form must reproduce the above copyright
     17        1.1  thorpej  *    notice, this list of conditions and the following disclaimer in the
     18        1.1  thorpej  *    documentation and/or other materials provided with the distribution.
     19        1.1  thorpej  *
     20        1.1  thorpej  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
     21        1.1  thorpej  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
     22        1.1  thorpej  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
     23        1.1  thorpej  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
     24        1.1  thorpej  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
     25        1.1  thorpej  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
     26        1.1  thorpej  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
     27        1.1  thorpej  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
     28        1.1  thorpej  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
     29        1.1  thorpej  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
     30        1.1  thorpej  * POSSIBILITY OF SUCH DAMAGE.
     31        1.1  thorpej  */
     32        1.1  thorpej 
     33        1.1  thorpej /*
     34        1.1  thorpej  * Copyright (c) 1995, David Greenman
     35        1.8  thorpej  * Copyright (c) 2001 Jonathan Lemon <jlemon (at) freebsd.org>
     36        1.1  thorpej  * All rights reserved.
     37        1.1  thorpej  *
     38        1.1  thorpej  * Redistribution and use in source and binary forms, with or without
     39        1.1  thorpej  * modification, are permitted provided that the following conditions
     40        1.1  thorpej  * are met:
     41        1.1  thorpej  * 1. Redistributions of source code must retain the above copyright
     42        1.1  thorpej  *    notice unmodified, this list of conditions, and the following
     43        1.1  thorpej  *    disclaimer.
     44        1.1  thorpej  * 2. Redistributions in binary form must reproduce the above copyright
     45        1.1  thorpej  *    notice, this list of conditions and the following disclaimer in the
     46        1.1  thorpej  *    documentation and/or other materials provided with the distribution.
     47        1.1  thorpej  *
     48        1.1  thorpej  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
     49        1.1  thorpej  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
     50        1.1  thorpej  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
     51        1.1  thorpej  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
     52        1.1  thorpej  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
     53        1.1  thorpej  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
     54        1.1  thorpej  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
     55        1.1  thorpej  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
     56        1.1  thorpej  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
     57        1.1  thorpej  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
     58        1.1  thorpej  * SUCH DAMAGE.
     59        1.1  thorpej  *
     60        1.8  thorpej  *	Id: if_fxpreg.h,v 1.24 2001/05/15 18:52:40 jlemon Exp
     61        1.1  thorpej  */
     62        1.1  thorpej 
     63        1.1  thorpej #define FXP_PCI_MMBA	0x10
     64        1.1  thorpej #define FXP_PCI_IOBA	0x14
     65        1.1  thorpej 
     66        1.1  thorpej /*
     67        1.1  thorpej  * Control/status registers.
     68        1.1  thorpej  */
     69        1.5  thorpej #define	FXP_CSR_SCB_RUSCUS	0x00	/* scb_rus/scb_cus (1 byte) */
     70        1.5  thorpej #define	FXP_CSR_SCB_STATACK	0x01	/* scb_statack (1 byte) */
     71        1.5  thorpej #define	FXP_CSR_SCB_COMMAND	0x02	/* scb_command (1 byte) */
     72        1.5  thorpej #define	FXP_CSR_SCB_INTRCNTL	0x03	/* scb_intrcntl (1 byte) */
     73        1.5  thorpej #define	FXP_CSR_SCB_GENERAL	0x04	/* scb_general (4 bytes) */
     74        1.5  thorpej #define	FXP_CSR_PORT		0x08	/* port (4 bytes) */
     75        1.5  thorpej #define	FXP_CSR_FLASHCONTROL	0x0c	/* flash control (2 bytes) */
     76        1.5  thorpej #define	FXP_CSR_EEPROMCONTROL	0x0e	/* eeprom control (2 bytes) */
     77        1.5  thorpej #define	FXP_CSR_MDICONTROL	0x10	/* mdi control (4 bytes) */
     78        1.5  thorpej #define	FXP_CSR_FLOWCONTROL	0x19	/* flow control (2 bytes) */
     79        1.1  thorpej 
     80        1.1  thorpej /*
     81        1.1  thorpej  * FOR REFERENCE ONLY, the old definition of FXP_CSR_SCB_RUSCUS:
     82        1.1  thorpej  *
     83  1.19.16.2     yamt  *	volatile uint8_t	:2,
     84        1.1  thorpej  *				scb_rus:4,
     85        1.1  thorpej  *				scb_cus:2;
     86        1.1  thorpej  */
     87        1.1  thorpej 
     88        1.1  thorpej #define FXP_PORT_SOFTWARE_RESET		0
     89        1.1  thorpej #define FXP_PORT_SELFTEST		1
     90        1.1  thorpej #define FXP_PORT_SELECTIVE_RESET	2
     91        1.1  thorpej #define FXP_PORT_DUMP			3
     92        1.1  thorpej 
     93        1.1  thorpej #define FXP_SCB_RUS_IDLE		0
     94        1.1  thorpej #define FXP_SCB_RUS_SUSPENDED		1
     95        1.1  thorpej #define FXP_SCB_RUS_NORESOURCES		2
     96        1.1  thorpej #define FXP_SCB_RUS_READY		4
     97        1.1  thorpej #define FXP_SCB_RUS_SUSP_NORBDS		9
     98        1.1  thorpej #define FXP_SCB_RUS_NORES_NORBDS	10
     99        1.1  thorpej #define FXP_SCB_RUS_READY_NORBDS	12
    100        1.1  thorpej 
    101        1.1  thorpej #define FXP_SCB_CUS_IDLE		0
    102        1.1  thorpej #define FXP_SCB_CUS_SUSPENDED		1
    103        1.1  thorpej #define FXP_SCB_CUS_ACTIVE		2
    104        1.5  thorpej 
    105        1.5  thorpej #define	FXP_SCB_INTR_DISABLE		0x01	/* disable all interrupts */
    106        1.5  thorpej #define	FXP_SCB_INTR_SWI		0x02	/* generate SWI */
    107        1.5  thorpej #define	FXP_SCB_INTMASK_FCP		0x04
    108        1.5  thorpej #define	FXP_SCB_INTMASK_ER		0x08
    109        1.5  thorpej #define	FXP_SCB_INTMASK_RNR		0x10
    110        1.5  thorpej #define	FXP_SCB_INTMASK_CNA		0x20
    111        1.5  thorpej #define	FXP_SCB_INTMASK_FR		0x40
    112        1.5  thorpej #define	FXP_SCB_INTMASK_CXTNO		0x80
    113        1.1  thorpej 
    114        1.6  thorpej #define	FXP_SCB_STATACK_FCP		0x01	/* flow control pause */
    115        1.6  thorpej #define	FXP_SCB_STATACK_ER		0x02	/* early receive */
    116        1.1  thorpej #define FXP_SCB_STATACK_SWI		0x04
    117        1.1  thorpej #define FXP_SCB_STATACK_MDI		0x08
    118        1.1  thorpej #define FXP_SCB_STATACK_RNR		0x10
    119        1.1  thorpej #define FXP_SCB_STATACK_CNA		0x20
    120        1.1  thorpej #define FXP_SCB_STATACK_FR		0x40
    121        1.1  thorpej #define FXP_SCB_STATACK_CXTNO		0x80
    122        1.1  thorpej 
    123        1.1  thorpej #define FXP_SCB_COMMAND_CU_NOP		0x00
    124        1.1  thorpej #define FXP_SCB_COMMAND_CU_START	0x10
    125        1.1  thorpej #define FXP_SCB_COMMAND_CU_RESUME	0x20
    126        1.1  thorpej #define FXP_SCB_COMMAND_CU_DUMP_ADR	0x40
    127        1.1  thorpej #define FXP_SCB_COMMAND_CU_DUMP		0x50
    128        1.1  thorpej #define FXP_SCB_COMMAND_CU_BASE		0x60
    129        1.1  thorpej #define FXP_SCB_COMMAND_CU_DUMPRESET	0x70
    130        1.1  thorpej 
    131        1.1  thorpej #define FXP_SCB_COMMAND_RU_NOP		0
    132        1.1  thorpej #define FXP_SCB_COMMAND_RU_START	1
    133        1.1  thorpej #define FXP_SCB_COMMAND_RU_RESUME	2
    134        1.1  thorpej #define FXP_SCB_COMMAND_RU_ABORT	4
    135        1.1  thorpej #define FXP_SCB_COMMAND_RU_LOADHDS	5
    136        1.1  thorpej #define FXP_SCB_COMMAND_RU_BASE		6
    137        1.1  thorpej #define FXP_SCB_COMMAND_RU_RBDRESUME	7
    138        1.1  thorpej 
    139       1.19  tsutsui #define FXP_SCB_INTRCNTL_REQUEST_SWI	0x02
    140        1.1  thorpej /*
    141        1.2  thorpej  * Command block definitions
    142        1.1  thorpej  */
    143        1.1  thorpej 
    144        1.1  thorpej /*
    145        1.2  thorpej  * NOP command.
    146        1.1  thorpej  */
    147        1.1  thorpej struct fxp_cb_nop {
    148  1.19.16.2     yamt 	volatile uint16_t cb_status;
    149  1.19.16.2     yamt 	volatile uint16_t cb_command;
    150  1.19.16.2     yamt 	volatile uint32_t link_addr;
    151        1.1  thorpej };
    152        1.2  thorpej 
    153        1.2  thorpej /*
    154        1.2  thorpej  * Individual Address command.
    155        1.2  thorpej  */
    156        1.1  thorpej struct fxp_cb_ias {
    157  1.19.16.2     yamt 	volatile uint16_t cb_status;
    158  1.19.16.2     yamt 	volatile uint16_t cb_command;
    159  1.19.16.2     yamt 	volatile uint32_t link_addr;
    160  1.19.16.2     yamt 	uint8_t macaddr[6];
    161        1.1  thorpej };
    162        1.2  thorpej 
    163        1.3  thorpej #if BYTE_ORDER == LITTLE_ENDIAN
    164        1.3  thorpej #define	__FXP_BITFIELD2(a, b)			a, b
    165        1.3  thorpej #define	__FXP_BITFIELD3(a, b, c)		a, b, c
    166        1.3  thorpej #define	__FXP_BITFIELD4(a, b, c, d)		a, b, c, d
    167        1.8  thorpej #define	__FXP_BITFIELD5(a, b, c, d, e)		a, b, c, d, e
    168        1.3  thorpej #define	__FXP_BITFIELD6(a, b, c, d, e, f)	a, b, c, d, e, f
    169        1.8  thorpej #define	__FXP_BITFIELD7(a, b, c, d, e, f, g)	a, b, c, d, e, f, g
    170        1.8  thorpej #define	__FXP_BITFIELD8(a, b, c, d, e, f, g, h)	a, b, c, d, e, f, g, h
    171        1.3  thorpej #else
    172        1.3  thorpej #define	__FXP_BITFIELD2(a, b)			b, a
    173        1.3  thorpej #define	__FXP_BITFIELD3(a, b, c)		c, b, a
    174        1.3  thorpej #define	__FXP_BITFIELD4(a, b, c, d)		d, c, b, a
    175        1.9  hannken #define	__FXP_BITFIELD5(a, b, c, d, e)		e, d, c, b, a
    176        1.3  thorpej #define	__FXP_BITFIELD6(a, b, c, d, e, f)	f, e, d, c, b, a
    177        1.9  hannken #define	__FXP_BITFIELD7(a, b, c, d, e, f, g)	g, f, e, d, c, b, a
    178        1.8  thorpej #define	__FXP_BITFIELD8(a, b, c, d, e, f, g, h)	h, g, f, e, d, c, b, a
    179        1.3  thorpej #endif
    180        1.3  thorpej 
    181        1.2  thorpej /*
    182        1.2  thorpej  * Configure command.
    183        1.2  thorpej  */
    184        1.1  thorpej struct fxp_cb_config {
    185  1.19.16.2     yamt 	volatile uint16_t	cb_status;
    186  1.19.16.2     yamt 	volatile uint16_t	cb_command;
    187  1.19.16.2     yamt 	volatile uint32_t	link_addr;
    188       1.10  thorpej 
    189       1.10  thorpej 	/* Bytes 0 - 21 -- common to all i8255x */
    190  1.19.16.2     yamt /*0*/	volatile uint8_t	__FXP_BITFIELD2(byte_count:6, :2);
    191  1.19.16.2     yamt /*1*/	volatile uint8_t	__FXP_BITFIELD3(rx_fifo_limit:4,
    192        1.3  thorpej 				    tx_fifo_limit:3,
    193        1.3  thorpej 				    :1);
    194  1.19.16.2     yamt /*2*/	volatile uint8_t	adaptive_ifs;
    195  1.19.16.2     yamt /*3*/	volatile uint8_t	__FXP_BITFIELD5(mwi_enable:1,	/* 8,9 */
    196        1.8  thorpej 				    type_enable:1,		/* 8,9 */
    197        1.8  thorpej 				    read_align_en:1,		/* 8,9 */
    198        1.8  thorpej 				    end_wr_on_cl:1,		/* 8,9 */
    199        1.8  thorpej 				    :4);
    200  1.19.16.2     yamt /*4*/	volatile uint8_t	__FXP_BITFIELD2(rx_dma_bytecount:7,
    201        1.8  thorpej 				    :1);
    202  1.19.16.2     yamt /*5*/	volatile uint8_t	__FXP_BITFIELD2(tx_dma_bytecount:7,
    203        1.8  thorpej 				    dma_mbce:1);
    204  1.19.16.2     yamt /*6*/	volatile uint8_t	__FXP_BITFIELD8(late_scb:1,	/* 7 */
    205        1.8  thorpej 				    direct_dma_dis:1,		/* 8,9 */
    206        1.8  thorpej 				    tno_int_or_tco_en:1,	/* 7,9 */
    207        1.8  thorpej 				    ci_int:1,
    208        1.8  thorpej 				    ext_txcb_dis:1,		/* 8,9 */
    209        1.8  thorpej 				    ext_stats_dis:1,		/* 8,9 */
    210        1.8  thorpej 				    keep_overrun_rx:1,
    211        1.3  thorpej 				    save_bf:1);
    212  1.19.16.2     yamt /*7*/	volatile uint8_t	__FXP_BITFIELD6(disc_short_rx:1,
    213        1.8  thorpej 				    underrun_retry:2,
    214       1.10  thorpej 				    :2,
    215       1.12     yamt 				    ext_rfa:1,			/* 0 */
    216        1.8  thorpej 				    two_frames:1,		/* 8,9 */
    217        1.8  thorpej 				    dyn_tbd:1);			/* 8,9 */
    218  1.19.16.2     yamt /*8*/	volatile uint8_t	__FXP_BITFIELD3(mediatype:1,	/* 7 */
    219        1.8  thorpej 				    :6,
    220        1.8  thorpej 				    csma_dis:1);		/* 8,9 */
    221  1.19.16.2     yamt /*9*/	volatile uint8_t	__FXP_BITFIELD6(tcp_udp_cksum:1,/* 9 */
    222        1.8  thorpej 				    :3,
    223        1.8  thorpej 				    vlan_tco:1,			/* 8,9 */
    224        1.8  thorpej 				    link_wake_en:1,		/* 8,9 */
    225        1.8  thorpej 				    arp_wake_en:1,		/* 8 */
    226        1.8  thorpej 				    mc_wake_en:1);		/* 8 */
    227  1.19.16.2     yamt /*10*/	volatile uint8_t	__FXP_BITFIELD4(:3,
    228        1.3  thorpej 				    nsai:1,
    229        1.3  thorpej 				    preamble_length:2,
    230        1.3  thorpej 				    loopback:2);
    231  1.19.16.2     yamt /*11*/	volatile uint8_t	__FXP_BITFIELD2(linear_priority:3,/* 7 */
    232        1.8  thorpej 				    :5);
    233  1.19.16.2     yamt /*12*/	volatile uint8_t	__FXP_BITFIELD3(linear_pri_mode:1,/* 7 */
    234        1.8  thorpej 				    :3,
    235        1.3  thorpej 				    interfrm_spacing:4);
    236  1.19.16.2     yamt /*13*/	volatile uint8_t	:8;
    237  1.19.16.2     yamt /*14*/	volatile uint8_t	:8;
    238  1.19.16.2     yamt /*15*/	volatile uint8_t	__FXP_BITFIELD8(promiscuous:1,
    239        1.8  thorpej 				    bcast_disable:1,
    240        1.8  thorpej 				    wait_after_win:1,		/* 8,9 */
    241        1.8  thorpej 				    :1,
    242        1.8  thorpej 				    ignore_ul:1,		/* 8,9 */
    243        1.8  thorpej 				    crc16_en:1,			/* 9 */
    244        1.8  thorpej 				    :1,
    245        1.3  thorpej 				    crscdt:1);
    246  1.19.16.2     yamt /*16*/	volatile uint8_t	fc_delay_lsb:8;			/* 8,9 */
    247  1.19.16.2     yamt /*17*/	volatile uint8_t	fc_delay_msb:8;			/* 8,9 */
    248  1.19.16.2     yamt /*18*/	volatile uint8_t	__FXP_BITFIELD6(stripping:1,
    249        1.3  thorpej 				    padding:1,
    250        1.8  thorpej 				    rcv_crc_xfer:1,
    251        1.8  thorpej 				    long_rx_en:1,		/* 8,9 */
    252        1.8  thorpej 				    pri_fc_thresh:3,		/* 8,9 */
    253        1.8  thorpej 				    :1);
    254  1.19.16.2     yamt /*19*/	volatile uint8_t	__FXP_BITFIELD8(ia_wake_en:1,	/* 8 */
    255        1.8  thorpej 				    magic_pkt_dis:1,		/* 8,9,!9ER */
    256        1.8  thorpej 				    tx_fc_dis:1,		/* 8,9 */
    257        1.8  thorpej 				    rx_fc_restop:1,		/* 8,9 */
    258        1.8  thorpej 				    rx_fc_restart:1,		/* 8,9 */
    259        1.8  thorpej 				    fc_filter:1,		/* 8,9 */
    260        1.8  thorpej 				    force_fdx:1,
    261        1.3  thorpej 				    fdx_pin_en:1);
    262  1.19.16.2     yamt /*20*/	volatile uint8_t	__FXP_BITFIELD4(:5,
    263        1.8  thorpej 				    pri_fc_loc:1		/* 8,9 */,
    264        1.8  thorpej 				    multi_ia:1,
    265        1.8  thorpej 				    :1);
    266  1.19.16.2     yamt /*21*/	volatile uint8_t	__FXP_BITFIELD3(:3, mc_all:1, :4);
    267       1.10  thorpej 
    268       1.10  thorpej 	/* Bytes 22 - 31 -- i82550 only */
    269  1.19.16.2     yamt /*22*/	volatile uint8_t	__FXP_BITFIELD3(ext_rx_mode:1,
    270       1.10  thorpej 				    vlan_drop_en:1,
    271       1.10  thorpej 				    :6);
    272  1.19.16.2     yamt 	volatile uint8_t	reserved[9];
    273        1.1  thorpej };
    274        1.1  thorpej 
    275       1.10  thorpej #define	FXP_CONFIG_LEN		22	/* i8255x */
    276       1.10  thorpej #define	FXP_EXT_CONFIG_LEN	32	/* i82550 */
    277       1.10  thorpej 
    278        1.1  thorpej /*
    279        1.2  thorpej  * Multicast setup command.
    280        1.1  thorpej  */
    281        1.1  thorpej #define MAXMCADDR 80
    282        1.1  thorpej struct fxp_cb_mcs {
    283  1.19.16.2     yamt 	volatile uint16_t cb_status;
    284  1.19.16.2     yamt 	volatile uint16_t cb_command;
    285  1.19.16.2     yamt 	volatile uint32_t link_addr;
    286  1.19.16.2     yamt 	volatile uint16_t mc_cnt;
    287  1.19.16.2     yamt 	uint8_t mc_addr[MAXMCADDR][6];
    288        1.1  thorpej };
    289        1.1  thorpej 
    290       1.11  thorpej #define	MAXUCODESIZE		192
    291       1.11  thorpej struct fxp_cb_ucode {
    292  1.19.16.2     yamt 	volatile uint16_t cb_status;
    293  1.19.16.2     yamt 	volatile uint16_t cb_command;
    294  1.19.16.2     yamt 	volatile uint32_t link_addr;
    295  1.19.16.2     yamt 	uint32_t ucode[MAXUCODESIZE];
    296       1.11  thorpej };
    297       1.11  thorpej 
    298       1.12     yamt struct fxp_ipcb {
    299       1.12     yamt 	/*
    300       1.12     yamt 	 * The following fields are valid only when
    301       1.12     yamt 	 * using the IPCB command block for TX checksum offload
    302       1.12     yamt 	 * (and TCP large send, VLANs, and (I think) IPsec). To use
    303       1.12     yamt 	 * them, you must enable extended TxCBs (available only
    304       1.12     yamt 	 * on the 82559 and later) and use the IPCBXMIT command.
    305       1.12     yamt 	 * Note that Intel defines the IPCB to be 32 bytes long,
    306       1.12     yamt 	 * the last 8 bytes of which comprise the first entry
    307       1.12     yamt 	 * in the TBD array. This means we only have to define
    308       1.12     yamt 	 * 8 extra bytes here.
    309       1.12     yamt          */
    310  1.19.16.2     yamt 	volatile uint16_t ipcb_schedule_low;
    311  1.19.16.2     yamt 	volatile uint8_t ipcb_ip_schedule;
    312  1.19.16.2     yamt 	volatile uint8_t ipcb_ip_activation_high;
    313  1.19.16.2     yamt 	volatile uint16_t ipcb_vlan_id;
    314  1.19.16.2     yamt 	volatile uint8_t ipcb_ip_header_offset;
    315  1.19.16.2     yamt 	volatile uint8_t ipcb_tcp_header_offset;
    316       1.12     yamt };
    317       1.12     yamt 
    318       1.12     yamt /*
    319       1.12     yamt  * IPCB field definitions
    320       1.12     yamt  */
    321       1.12     yamt /* for ipcb_ip_schedule */
    322       1.12     yamt #define FXP_IPCB_IP_CHECKSUM_ENABLE	0x10
    323       1.12     yamt #define FXP_IPCB_TCPUDP_CHECKSUM_ENABLE	0x20
    324       1.12     yamt #define FXP_IPCB_TCP_PACKET		0x40
    325       1.12     yamt #define FXP_IPCB_LARGESEND_ENABLE	0x80
    326       1.12     yamt /* for ipcb_ip_activation_high */
    327       1.12     yamt #define FXP_IPCB_HARDWAREPARSING_ENABLE	0x01
    328       1.12     yamt #define FXP_IPCB_INSERTVLAN_ENABLE	0x02
    329       1.12     yamt 
    330        1.1  thorpej /*
    331  1.19.16.2     yamt  * hardware ip4csum-tx on fxp(4) doesn't set IP checksums properly
    332  1.19.16.2     yamt  * if the TX IP packet length is 21 or 22 bytes and it requires autopadding.
    333  1.19.16.2     yamt  * To avoid this bug, we have to pad such very short packets manually.
    334  1.19.16.2     yamt  */
    335  1.19.16.2     yamt #define FXP_IP4CSUMTX_MINLEN	22
    336  1.19.16.2     yamt #define FXP_IP4CSUMTX_PADLEN	(ETHER_HDR_LEN + FXP_IP4CSUMTX_MINLEN)
    337  1.19.16.2     yamt 
    338  1.19.16.2     yamt /*
    339        1.2  thorpej  * Transmit command.
    340        1.1  thorpej  */
    341        1.1  thorpej struct fxp_cb_tx {
    342  1.19.16.2     yamt 	volatile uint16_t cb_status;
    343  1.19.16.2     yamt 	volatile uint16_t cb_command;
    344  1.19.16.2     yamt 	volatile uint32_t link_addr;
    345  1.19.16.2     yamt 	volatile uint32_t tbd_array_addr;
    346  1.19.16.2     yamt 	volatile uint16_t byte_count;
    347  1.19.16.2     yamt 	volatile uint8_t tx_threshold;
    348  1.19.16.2     yamt 	volatile uint8_t tbd_number;
    349        1.4  thorpej 	/*
    350        1.4  thorpej 	 * If using the extended TxCB feature, there is a
    351        1.8  thorpej 	 * two TBDs right here.  We handle this in the
    352        1.4  thorpej 	 * fxp_control_data in i82557var.h.
    353        1.4  thorpej 	 */
    354        1.1  thorpej };
    355        1.1  thorpej 
    356        1.1  thorpej /*
    357        1.2  thorpej  * Transmit buffer descriptors.
    358        1.1  thorpej  */
    359        1.2  thorpej struct fxp_tbd {
    360  1.19.16.2     yamt 	volatile uint32_t tb_addr;
    361  1.19.16.2     yamt 	volatile uint32_t tb_size;
    362        1.2  thorpej };
    363        1.1  thorpej 
    364        1.1  thorpej /*
    365        1.1  thorpej  * Control Block (CB) definitions
    366        1.1  thorpej  */
    367        1.1  thorpej 
    368        1.1  thorpej /* status */
    369        1.1  thorpej #define FXP_CB_STATUS_OK	0x2000
    370        1.1  thorpej #define FXP_CB_STATUS_C		0x8000
    371        1.2  thorpej 
    372        1.1  thorpej /* commands */
    373  1.19.16.2     yamt #define FXP_CB_COMMAND_CMD	0x0007
    374        1.1  thorpej #define FXP_CB_COMMAND_NOP	0x0
    375        1.1  thorpej #define FXP_CB_COMMAND_IAS	0x1
    376        1.1  thorpej #define FXP_CB_COMMAND_CONFIG	0x2
    377        1.1  thorpej #define FXP_CB_COMMAND_MCAS	0x3
    378        1.1  thorpej #define FXP_CB_COMMAND_XMIT	0x4
    379       1.11  thorpej #define FXP_CB_COMMAND_UCODE	0x5
    380        1.1  thorpej #define FXP_CB_COMMAND_DUMP	0x6
    381        1.1  thorpej #define FXP_CB_COMMAND_DIAG	0x7
    382       1.12     yamt #define FXP_CB_COMMAND_IPCBXMIT	0x9
    383        1.2  thorpej 
    384        1.1  thorpej /* command flags */
    385        1.1  thorpej #define FXP_CB_COMMAND_SF	0x0008	/* simple/flexible mode */
    386        1.1  thorpej #define FXP_CB_COMMAND_I	0x2000	/* generate interrupt on completion */
    387        1.1  thorpej #define FXP_CB_COMMAND_S	0x4000	/* suspend on completion */
    388        1.1  thorpej #define FXP_CB_COMMAND_EL	0x8000	/* end of list */
    389        1.1  thorpej 
    390        1.1  thorpej /*
    391        1.2  thorpej  * Receive Frame Area.
    392        1.2  thorpej  *
    393        1.1  thorpej  * NOTE!  The RFA will NOT be aligned on a 4-byte boundary in the DMA
    394        1.1  thorpej  * area!  To prevent EGCS from optimizing the copy of link_addr and
    395        1.1  thorpej  * rbd_addr (which would cause an unaligned access fault on RISC systems),
    396        1.1  thorpej  * we must make them an array of bytes!
    397        1.1  thorpej  */
    398        1.1  thorpej struct fxp_rfa {
    399       1.10  thorpej 	/* Fields common to all i8255x chips. */
    400  1.19.16.2     yamt 	volatile uint16_t rfa_status;
    401  1.19.16.2     yamt 	volatile uint16_t rfa_control;
    402  1.19.16.2     yamt 	volatile uint8_t link_addr[4];
    403  1.19.16.2     yamt 	volatile uint8_t rbd_addr[4];
    404  1.19.16.2     yamt 	volatile uint16_t actual_size;
    405  1.19.16.2     yamt 	volatile uint16_t size;
    406       1.10  thorpej 
    407       1.12     yamt 	/* Fields available only on the i82550/i82551 in extended RFD mode. */
    408  1.19.16.2     yamt 	volatile uint16_t vlan_id;
    409  1.19.16.2     yamt 	volatile uint8_t rx_parse_stat;
    410  1.19.16.2     yamt 	volatile uint8_t reserved;
    411  1.19.16.2     yamt 	volatile uint16_t security_stat;
    412  1.19.16.2     yamt 	volatile uint8_t cksum_stat;
    413  1.19.16.2     yamt 	volatile uint8_t zerocopy_stat;
    414  1.19.16.2     yamt 	volatile uint8_t unused[8];
    415        1.1  thorpej };
    416       1.10  thorpej 
    417       1.10  thorpej #define	RFA_SIZE		16
    418       1.10  thorpej #define	RFA_EXT_SIZE		32
    419        1.2  thorpej 
    420        1.1  thorpej #define FXP_RFA_STATUS_RCOL	0x0001	/* receive collision */
    421        1.1  thorpej #define FXP_RFA_STATUS_IAMATCH	0x0002	/* 0 = matches station address */
    422       1.12     yamt #define FXP_RFA_STATUS_NOAMATCH	0x0004	/* 1 = doesn't match anything */
    423       1.12     yamt #define FXP_RFA_STATUS_PARSE	0x0008	/* pkt parse ok (82550/1 only) */
    424        1.1  thorpej #define FXP_RFA_STATUS_S4	0x0010	/* receive error from PHY */
    425        1.1  thorpej #define FXP_RFA_STATUS_TL	0x0020	/* type/length */
    426        1.1  thorpej #define FXP_RFA_STATUS_FTS	0x0080	/* frame too short */
    427        1.1  thorpej #define FXP_RFA_STATUS_OVERRUN	0x0100	/* DMA overrun */
    428        1.1  thorpej #define FXP_RFA_STATUS_RNR	0x0200	/* no resources */
    429        1.1  thorpej #define FXP_RFA_STATUS_ALIGN	0x0400	/* alignment error */
    430        1.1  thorpej #define FXP_RFA_STATUS_CRC	0x0800	/* CRC error */
    431       1.14     yamt #define FXP_RFA_STATUS_VLAN	0x1000	/* VLAN */
    432        1.1  thorpej #define FXP_RFA_STATUS_OK	0x2000	/* packet received okay */
    433        1.1  thorpej #define FXP_RFA_STATUS_C	0x8000	/* packet reception complete */
    434        1.2  thorpej 
    435        1.2  thorpej #define FXP_RFA_CONTROL_SF	0x0008	/* simple/flexible memory mode */
    436        1.2  thorpej #define FXP_RFA_CONTROL_H	0x0010	/* header RFD */
    437        1.1  thorpej #define FXP_RFA_CONTROL_S	0x4000	/* suspend after reception */
    438        1.1  thorpej #define FXP_RFA_CONTROL_EL	0x8000	/* end of list */
    439       1.12     yamt 
    440       1.12     yamt /* Bits in the 'cksum_stat' byte */
    441       1.12     yamt #define FXP_RFDX_CS_TCPUDP_CSUM_BIT_VALID	0x10
    442       1.12     yamt #define FXP_RFDX_CS_TCPUDP_CSUM_VALID		0x20
    443       1.12     yamt #define FXP_RFDX_CS_IP_CSUM_BIT_VALID		0x01
    444       1.12     yamt #define FXP_RFDX_CS_IP_CSUM_VALID		0x02
    445       1.12     yamt 
    446       1.12     yamt /* Bits in the 'rx_parse_stat' byte */
    447       1.12     yamt #define FXP_RFDX_P_PARSE_BIT			0x08
    448       1.12     yamt #define FXP_RFDX_P_CSUM_PROTOCOL_MASK		0x03
    449       1.12     yamt #define FXP_RFDX_P_TCP_PACKET			0x00
    450       1.12     yamt #define FXP_RFDX_P_UDP_PACKET			0x01
    451       1.12     yamt #define FXP_RFDX_P_IP_PACKET			0x03
    452        1.1  thorpej 
    453        1.1  thorpej /*
    454        1.1  thorpej  * Statistics dump area definitions
    455        1.1  thorpej  */
    456        1.1  thorpej struct fxp_stats {
    457  1.19.16.2     yamt 	volatile uint32_t tx_good;
    458  1.19.16.2     yamt 	volatile uint32_t tx_maxcols;
    459  1.19.16.2     yamt 	volatile uint32_t tx_latecols;
    460  1.19.16.2     yamt 	volatile uint32_t tx_underruns;
    461  1.19.16.2     yamt 	volatile uint32_t tx_lostcrs;
    462  1.19.16.2     yamt 	volatile uint32_t tx_deferred;
    463  1.19.16.2     yamt 	volatile uint32_t tx_single_collisions;
    464  1.19.16.2     yamt 	volatile uint32_t tx_multiple_collisions;
    465  1.19.16.2     yamt 	volatile uint32_t tx_total_collisions;
    466  1.19.16.2     yamt 	volatile uint32_t rx_good;
    467  1.19.16.2     yamt 	volatile uint32_t rx_crc_errors;
    468  1.19.16.2     yamt 	volatile uint32_t rx_alignment_errors;
    469  1.19.16.2     yamt 	volatile uint32_t rx_rnr_errors;
    470  1.19.16.2     yamt 	volatile uint32_t rx_overrun_errors;
    471  1.19.16.2     yamt 	volatile uint32_t rx_cdt_errors;
    472  1.19.16.2     yamt 	volatile uint32_t rx_shortframes;
    473  1.19.16.2     yamt 	volatile uint32_t tx_pauseframes;
    474       1.15  thorpej #define	completion_status	tx_pauseframes
    475  1.19.16.2     yamt 	volatile uint32_t rx_pauseframes;
    476  1.19.16.2     yamt 	volatile uint32_t rx_unsupportedframes;
    477  1.19.16.2     yamt 	volatile uint32_t tx_tco_frames;
    478  1.19.16.2     yamt 	volatile uint32_t rx_tco_frames;
    479  1.19.16.2     yamt 	volatile uint32_t ext_completion_status;
    480        1.1  thorpej };
    481        1.1  thorpej #define FXP_STATS_DUMP_COMPLETE	0xa005
    482        1.1  thorpej #define FXP_STATS_DR_COMPLETE	0xa007
    483       1.16    perry 
    484        1.1  thorpej /*
    485        1.1  thorpej  * Serial EEPROM control register bits
    486        1.1  thorpej  */
    487        1.2  thorpej #define FXP_EEPROM_EESK		0x01		/* shift clock */
    488        1.2  thorpej #define FXP_EEPROM_EECS		0x02		/* chip select */
    489        1.2  thorpej #define FXP_EEPROM_EEDI		0x04		/* data in */
    490        1.2  thorpej #define FXP_EEPROM_EEDO		0x08		/* data out */
    491        1.1  thorpej 
    492        1.1  thorpej /*
    493        1.1  thorpej  * Serial EEPROM opcodes, including start bit
    494        1.1  thorpej  */
    495        1.1  thorpej #define FXP_EEPROM_OPC_ERASE	0x4
    496        1.1  thorpej #define FXP_EEPROM_OPC_WRITE	0x5
    497        1.1  thorpej #define FXP_EEPROM_OPC_READ	0x6
    498        1.1  thorpej 
    499        1.1  thorpej /*
    500        1.1  thorpej  * Management Data Interface opcodes
    501        1.1  thorpej  */
    502        1.1  thorpej #define FXP_MDI_WRITE		0x1
    503        1.1  thorpej #define FXP_MDI_READ		0x2
    504        1.1  thorpej 
    505        1.1  thorpej /*
    506        1.2  thorpej  * PHY device types (from EEPROM)
    507        1.1  thorpej  */
    508        1.6  thorpej #define	FXP_PHY_DEVICE_MASK	0x3f00
    509        1.6  thorpej #define	FXP_PHY_DEVICE_SHIFT	8
    510        1.6  thorpej #define	FXP_PHY_DEVADDR_MASK	0x00ff
    511        1.6  thorpej #define	FXP_PHY_SERIAL_ONLY	0x8000
    512        1.1  thorpej #define FXP_PHY_NONE		0
    513        1.1  thorpej #define FXP_PHY_82553A		1
    514        1.1  thorpej #define FXP_PHY_82553C		2
    515        1.1  thorpej #define FXP_PHY_82503		3
    516        1.1  thorpej #define FXP_PHY_DP83840		4
    517        1.1  thorpej #define FXP_PHY_80C240		5
    518        1.1  thorpej #define FXP_PHY_80C24		6
    519        1.1  thorpej #define FXP_PHY_82555		7
    520        1.1  thorpej #define FXP_PHY_DP83840A	10
    521        1.6  thorpej #define	FXP_PHY_DP82555B	11
    522        1.7  thorpej 
    523        1.7  thorpej /*
    524        1.7  thorpej  * PCI revisions.
    525        1.7  thorpej  */
    526        1.7  thorpej #define	FXP_REV_82558_A4	4
    527        1.7  thorpej #define	FXP_REV_82558_B0	5
    528        1.7  thorpej #define	FXP_REV_82559_A0	8
    529        1.7  thorpej #define	FXP_REV_82559S_A	9
    530        1.7  thorpej #define	FXP_REV_82550		12
    531        1.7  thorpej #define	FXP_REV_82550_C		13
    532  1.19.16.2     yamt #define	FXP_REV_82551		15
    533