xref: /dflybsd-src/sys/dev/netif/txp/if_txpreg.h (revision 86d7f5d305c6adaa56ff4582ece9859d73106103)
186d7f5d3SJohn Marino /*	$OpenBSD: if_txpreg.h,v 1.30 2001/06/23 04:18:02 jason Exp $ */
286d7f5d3SJohn Marino /*	$FreeBSD: src/sys/dev/txp/if_txpreg.h,v 1.2.2.1 2001/07/30 17:31:39 wpaul Exp $ */
386d7f5d3SJohn Marino /*	$DragonFly: src/sys/dev/netif/txp/if_txpreg.h,v 1.6 2006/08/01 18:10:40 swildner Exp $ */
486d7f5d3SJohn Marino 
586d7f5d3SJohn Marino /*
686d7f5d3SJohn Marino  * Copyright (c) 2001 Aaron Campbell <aaron@monkey.org>.
786d7f5d3SJohn Marino  * All rights reserved.
886d7f5d3SJohn Marino  *
986d7f5d3SJohn Marino  * Redistribution and use in source and binary forms, with or without
1086d7f5d3SJohn Marino  * modification, are permitted provided that the following conditions
1186d7f5d3SJohn Marino  * are met:
1286d7f5d3SJohn Marino  * 1. Redistributions of source code must retain the above copyright
1386d7f5d3SJohn Marino  *    notice, this list of conditions and the following disclaimer.
1486d7f5d3SJohn Marino  * 2. Redistributions in binary form must reproduce the above copyright
1586d7f5d3SJohn Marino  *    notice, this list of conditions and the following disclaimer in the
1686d7f5d3SJohn Marino  *    documentation and/or other materials provided with the distribution.
1786d7f5d3SJohn Marino  * 3. All advertising materials mentioning features or use of this software
1886d7f5d3SJohn Marino  *    must display the following acknowledgement:
1986d7f5d3SJohn Marino  *      This product includes software developed by Aaron Campbell.
2086d7f5d3SJohn Marino  * 4. The name of the author may not be used to endorse or promote products
2186d7f5d3SJohn Marino  *    derived from this software without specific prior written permission.
2286d7f5d3SJohn Marino  *
2386d7f5d3SJohn Marino  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
2486d7f5d3SJohn Marino  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
2586d7f5d3SJohn Marino  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
2686d7f5d3SJohn Marino  * IN NO EVENT SHALL THE AUTHOR OR HIS RELATIVES BE LIABLE FOR ANY DIRECT,
2786d7f5d3SJohn Marino  * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
2886d7f5d3SJohn Marino  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
2986d7f5d3SJohn Marino  * SERVICES; LOSS OF MIND, USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
3086d7f5d3SJohn Marino  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
3186d7f5d3SJohn Marino  * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
3286d7f5d3SJohn Marino  * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
3386d7f5d3SJohn Marino  * THE POSSIBILITY OF SUCH DAMAGE.
3486d7f5d3SJohn Marino  */
3586d7f5d3SJohn Marino 
3686d7f5d3SJohn Marino #define	TXP_PCI_LOMEM			0x14	/* pci conf, memory map BAR */
3786d7f5d3SJohn Marino #define	TXP_PCI_LOIO			0x10	/* pci conf, IO map BAR */
3886d7f5d3SJohn Marino #define TXP_PCI_INTLINE			0x3C
3986d7f5d3SJohn Marino 
4086d7f5d3SJohn Marino /*
4186d7f5d3SJohn Marino  * Typhoon registers.
4286d7f5d3SJohn Marino  */
4386d7f5d3SJohn Marino #define	TXP_SRR				0x00	/* soft reset register */
4486d7f5d3SJohn Marino #define	TXP_ISR				0x04	/* interrupt status register */
4586d7f5d3SJohn Marino #define	TXP_IER				0x08	/* interrupt enable register */
4686d7f5d3SJohn Marino #define	TXP_IMR				0x0c	/* interrupt mask register */
4786d7f5d3SJohn Marino #define	TXP_SIR				0x10	/* self interrupt register */
4886d7f5d3SJohn Marino #define	TXP_H2A_7			0x14	/* host->arm comm 7 */
4986d7f5d3SJohn Marino #define	TXP_H2A_6			0x18	/* host->arm comm 6 */
5086d7f5d3SJohn Marino #define	TXP_H2A_5			0x1c	/* host->arm comm 5 */
5186d7f5d3SJohn Marino #define	TXP_H2A_4			0x20	/* host->arm comm 4 */
5286d7f5d3SJohn Marino #define	TXP_H2A_3			0x24	/* host->arm comm 3 */
5386d7f5d3SJohn Marino #define	TXP_H2A_2			0x28	/* host->arm comm 2 */
5486d7f5d3SJohn Marino #define	TXP_H2A_1			0x2c	/* host->arm comm 1 */
5586d7f5d3SJohn Marino #define	TXP_H2A_0			0x30	/* host->arm comm 0 */
5686d7f5d3SJohn Marino #define	TXP_A2H_3			0x34	/* arm->host comm 3 */
5786d7f5d3SJohn Marino #define	TXP_A2H_2			0x38	/* arm->host comm 2 */
5886d7f5d3SJohn Marino #define	TXP_A2H_1			0x3c	/* arm->host comm 1 */
5986d7f5d3SJohn Marino #define	TXP_A2H_0			0x40	/* arm->host comm 0 */
6086d7f5d3SJohn Marino 
6186d7f5d3SJohn Marino /*
6286d7f5d3SJohn Marino  * interrupt bits (IMR, ISR, IER)
6386d7f5d3SJohn Marino  */
6486d7f5d3SJohn Marino #define	TXP_INT_RESERVED	0xffff0000
6586d7f5d3SJohn Marino #define	TXP_INT_A2H_7		0x00008000	/* arm->host comm 7 */
6686d7f5d3SJohn Marino #define	TXP_INT_A2H_6		0x00004000	/* arm->host comm 6 */
6786d7f5d3SJohn Marino #define	TXP_INT_A2H_5		0x00002000	/* arm->host comm 5 */
6886d7f5d3SJohn Marino #define	TXP_INT_A2H_4		0x00001000	/* arm->host comm 4 */
6986d7f5d3SJohn Marino #define	TXP_INT_SELF		0x00000800	/* self interrupt */
7086d7f5d3SJohn Marino #define	TXP_INT_PCI_TABORT	0x00000400	/* pci target abort */
7186d7f5d3SJohn Marino #define	TXP_INT_PCI_MABORT	0x00000200	/* pci master abort */
7286d7f5d3SJohn Marino #define	TXP_INT_DMA3		0x00000100	/* dma3 done */
7386d7f5d3SJohn Marino #define	TXP_INT_DMA2		0x00000080	/* dma2 done */
7486d7f5d3SJohn Marino #define	TXP_INT_DMA1		0x00000040	/* dma1 done */
7586d7f5d3SJohn Marino #define	TXP_INT_DMA0		0x00000020	/* dma0 done */
7686d7f5d3SJohn Marino #define	TXP_INT_A2H_3		0x00000010	/* arm->host comm 3 */
7786d7f5d3SJohn Marino #define	TXP_INT_A2H_2		0x00000008	/* arm->host comm 2 */
7886d7f5d3SJohn Marino #define	TXP_INT_A2H_1		0x00000004	/* arm->host comm 1 */
7986d7f5d3SJohn Marino #define	TXP_INT_A2H_0		0x00000002	/* arm->host comm 0 */
8086d7f5d3SJohn Marino #define	TXP_INT_LATCH		0x00000001	/* interrupt latch */
8186d7f5d3SJohn Marino 
8286d7f5d3SJohn Marino /*
8386d7f5d3SJohn Marino  * soft reset register (SRR)
8486d7f5d3SJohn Marino  */
8586d7f5d3SJohn Marino #define	TXP_SRR_ALL		0x0000007f	/* full reset */
8686d7f5d3SJohn Marino 
8786d7f5d3SJohn Marino /*
8886d7f5d3SJohn Marino  * Typhoon boot commands.
8986d7f5d3SJohn Marino  */
9086d7f5d3SJohn Marino #define	TXP_BOOTCMD_NULL			0x00
9186d7f5d3SJohn Marino #define	TXP_BOOTCMD_DOWNLOAD_COMPLETE		0xfb
9286d7f5d3SJohn Marino #define	TXP_BOOTCMD_SEGMENT_AVAILABLE		0xfc
9386d7f5d3SJohn Marino #define	TXP_BOOTCMD_RUNTIME_IMAGE		0xfd
9486d7f5d3SJohn Marino #define	TXP_BOOTCMD_REGISTER_BOOT_RECORD	0xff
9586d7f5d3SJohn Marino 
9686d7f5d3SJohn Marino /*
9786d7f5d3SJohn Marino  * Typhoon runtime commands.
9886d7f5d3SJohn Marino  */
9986d7f5d3SJohn Marino #define	TXP_CMD_GLOBAL_RESET			0x00
10086d7f5d3SJohn Marino #define	TXP_CMD_TX_ENABLE			0x01
10186d7f5d3SJohn Marino #define	TXP_CMD_TX_DISABLE			0x02
10286d7f5d3SJohn Marino #define	TXP_CMD_RX_ENABLE			0x03
10386d7f5d3SJohn Marino #define	TXP_CMD_RX_DISABLE			0x04
10486d7f5d3SJohn Marino #define	TXP_CMD_RX_FILTER_WRITE			0x05
10586d7f5d3SJohn Marino #define	TXP_CMD_RX_FILTER_READ			0x06
10686d7f5d3SJohn Marino #define	TXP_CMD_READ_STATISTICS			0x07
10786d7f5d3SJohn Marino #define	TXP_CMD_CYCLE_STATISTICS		0x08
10886d7f5d3SJohn Marino #define	TXP_CMD_CLEAR_STATISTICS		0x09
10986d7f5d3SJohn Marino #define	TXP_CMD_MEMORY_READ			0x0a
11086d7f5d3SJohn Marino #define	TXP_CMD_MEMORY_WRITE_SINGLE		0x0b
11186d7f5d3SJohn Marino #define	TXP_CMD_VARIABLE_SECTION_READ		0x0c
11286d7f5d3SJohn Marino #define	TXP_CMD_VARIABLE_SECTION_WRITE		0x0d
11386d7f5d3SJohn Marino #define	TXP_CMD_STATIC_SECTION_READ		0x0e
11486d7f5d3SJohn Marino #define	TXP_CMD_STATIC_SECTION_WRITE		0x0f
11586d7f5d3SJohn Marino #define	TXP_CMD_IMAGE_SECTION_PROGRAM		0x10
11686d7f5d3SJohn Marino #define	TXP_CMD_NVRAM_PAGE_READ			0x11
11786d7f5d3SJohn Marino #define	TXP_CMD_NVRAM_PAGE_WRITE		0x12
11886d7f5d3SJohn Marino #define	TXP_CMD_XCVR_SELECT			0x13
11986d7f5d3SJohn Marino #define	TXP_CMD_TEST_MUX			0x14
12086d7f5d3SJohn Marino #define	TXP_CMD_PHYLOOPBACK_ENABLE		0x15
12186d7f5d3SJohn Marino #define	TXP_CMD_PHYLOOPBACK_DISABLE		0x16
12286d7f5d3SJohn Marino #define	TXP_CMD_MAC_CONTROL_READ		0x17
12386d7f5d3SJohn Marino #define	TXP_CMD_MAC_CONTROL_WRITE		0x18
12486d7f5d3SJohn Marino #define	TXP_CMD_MAX_PKT_SIZE_READ		0x19
12586d7f5d3SJohn Marino #define	TXP_CMD_MAX_PKT_SIZE_WRITE		0x1a
12686d7f5d3SJohn Marino #define	TXP_CMD_MEDIA_STATUS_READ		0x1b
12786d7f5d3SJohn Marino #define	TXP_CMD_MEDIA_STATUS_WRITE		0x1c
12886d7f5d3SJohn Marino #define	TXP_CMD_NETWORK_DIAGS_READ		0x1d
12986d7f5d3SJohn Marino #define	TXP_CMD_NETWORK_DIAGS_WRITE		0x1e
13086d7f5d3SJohn Marino #define	TXP_CMD_PHY_MGMT_READ			0x1f
13186d7f5d3SJohn Marino #define	TXP_CMD_PHY_MGMT_WRITE			0x20
13286d7f5d3SJohn Marino #define	TXP_CMD_VARIABLE_PARAMETER_READ		0x21
13386d7f5d3SJohn Marino #define	TXP_CMD_VARIABLE_PARAMETER_WRITE	0x22
13486d7f5d3SJohn Marino #define	TXP_CMD_GOTO_SLEEP			0x23
13586d7f5d3SJohn Marino #define	TXP_CMD_FIREWALL_CONTROL		0x24
13686d7f5d3SJohn Marino #define	TXP_CMD_MCAST_HASH_MASK_WRITE		0x25
13786d7f5d3SJohn Marino #define	TXP_CMD_STATION_ADDRESS_WRITE		0x26
13886d7f5d3SJohn Marino #define	TXP_CMD_STATION_ADDRESS_READ		0x27
13986d7f5d3SJohn Marino #define	TXP_CMD_STATION_MASK_WRITE		0x28
14086d7f5d3SJohn Marino #define	TXP_CMD_STATION_MASK_READ		0x29
14186d7f5d3SJohn Marino #define	TXP_CMD_VLAN_ETHER_TYPE_READ		0x2a
14286d7f5d3SJohn Marino #define	TXP_CMD_VLAN_ETHER_TYPE_WRITE		0x2b
14386d7f5d3SJohn Marino #define	TXP_CMD_VLAN_MASK_READ			0x2c
14486d7f5d3SJohn Marino #define	TXP_CMD_VLAN_MASK_WRITE			0x2d
14586d7f5d3SJohn Marino #define	TXP_CMD_BCAST_THROTTLE_WRITE		0x2e
14686d7f5d3SJohn Marino #define	TXP_CMD_BCAST_THROTTLE_READ		0x2f
14786d7f5d3SJohn Marino #define	TXP_CMD_DHCP_PREVENT_WRITE		0x30
14886d7f5d3SJohn Marino #define	TXP_CMD_DHCP_PREVENT_READ		0x31
14986d7f5d3SJohn Marino #define	TXP_CMD_RECV_BUFFER_CONTROL		0x32
15086d7f5d3SJohn Marino #define	TXP_CMD_SOFTWARE_RESET			0x33
15186d7f5d3SJohn Marino #define	TXP_CMD_CREATE_SA			0x34
15286d7f5d3SJohn Marino #define	TXP_CMD_DELETE_SA			0x35
15386d7f5d3SJohn Marino #define	TXP_CMD_ENABLE_RX_IP_OPTION		0x36
15486d7f5d3SJohn Marino #define	TXP_CMD_RANDOM_NUMBER_CONTROL		0x37
15586d7f5d3SJohn Marino #define	TXP_CMD_RANDOM_NUMBER_READ		0x38
15686d7f5d3SJohn Marino #define	TXP_CMD_MATRIX_TABLE_MODE_WRITE		0x39
15786d7f5d3SJohn Marino #define	TXP_CMD_MATRIX_DETAIL_READ		0x3a
15886d7f5d3SJohn Marino #define	TXP_CMD_FILTER_ARRAY_READ		0x3b
15986d7f5d3SJohn Marino #define	TXP_CMD_FILTER_DETAIL_READ		0x3c
16086d7f5d3SJohn Marino #define	TXP_CMD_FILTER_TABLE_MODE_WRITE		0x3d
16186d7f5d3SJohn Marino #define	TXP_CMD_FILTER_TCL_WRITE		0x3e
16286d7f5d3SJohn Marino #define	TXP_CMD_FILTER_TBL_READ			0x3f
16386d7f5d3SJohn Marino #define	TXP_CMD_FILTER_DEFINE			0x45
16486d7f5d3SJohn Marino #define	TXP_CMD_ADD_WAKEUP_PKT			0x46
16586d7f5d3SJohn Marino #define	TXP_CMD_ADD_SLEEP_PKT			0x47
16686d7f5d3SJohn Marino #define	TXP_CMD_ENABLE_SLEEP_EVENTS		0x48
16786d7f5d3SJohn Marino #define	TXP_CMD_ENABLE_WAKEUP_EVENTS		0x49
16886d7f5d3SJohn Marino #define	TXP_CMD_GET_IP_ADDRESS			0x4a
16986d7f5d3SJohn Marino #define	TXP_CMD_READ_PCI_REG			0x4c
17086d7f5d3SJohn Marino #define	TXP_CMD_WRITE_PCI_REG			0x4d
17186d7f5d3SJohn Marino #define	TXP_CMD_OFFLOAD_READ			0x4e
17286d7f5d3SJohn Marino #define	TXP_CMD_OFFLOAD_WRITE			0x4f
17386d7f5d3SJohn Marino #define	TXP_CMD_HELLO_RESPONSE			0x57
17486d7f5d3SJohn Marino #define	TXP_CMD_ENABLE_RX_FILTER		0x58
17586d7f5d3SJohn Marino #define	TXP_CMD_RX_FILTER_CAPABILITY		0x59
17686d7f5d3SJohn Marino #define	TXP_CMD_HALT				0x5d
17786d7f5d3SJohn Marino #define	TXP_CMD_READ_IPSEC_INFO			0x54
17886d7f5d3SJohn Marino #define	TXP_CMD_GET_IPSEC_ENABLE		0x67
17986d7f5d3SJohn Marino #define	TXP_CMD_INVALID				0xffff
18086d7f5d3SJohn Marino 
18186d7f5d3SJohn Marino #define	TXP_FRAGMENT		0x0000
18286d7f5d3SJohn Marino #define	TXP_TXFRAME		0x0001
18386d7f5d3SJohn Marino #define	TXP_COMMAND		0x0002
18486d7f5d3SJohn Marino #define	TXP_OPTION		0x0003
18586d7f5d3SJohn Marino #define	TXP_RECEIVE		0x0004
18686d7f5d3SJohn Marino #define	TXP_RESPONSE		0x0005
18786d7f5d3SJohn Marino 
18886d7f5d3SJohn Marino #define	TXP_TYPE_IPSEC		0x0000
18986d7f5d3SJohn Marino #define	TXP_TYPE_TCPSEGMENT	0x0001
19086d7f5d3SJohn Marino 
19186d7f5d3SJohn Marino #define	TXP_PFLAG_NOCRC		0x0000
19286d7f5d3SJohn Marino #define	TXP_PFLAG_IPCKSUM	0x0001
19386d7f5d3SJohn Marino #define	TXP_PFLAG_TCPCKSUM	0x0002
19486d7f5d3SJohn Marino #define	TXP_PFLAG_TCPSEGMENT	0x0004
19586d7f5d3SJohn Marino #define	TXP_PFLAG_INSERTVLAN	0x0008
19686d7f5d3SJohn Marino #define	TXP_PFLAG_IPSEC		0x0010
19786d7f5d3SJohn Marino #define	TXP_PFLAG_PRIORITY	0x0020
19886d7f5d3SJohn Marino #define	TXP_PFLAG_UDPCKSUM	0x0040
19986d7f5d3SJohn Marino #define	TXP_PFLAG_PADFRAME	0x0080
20086d7f5d3SJohn Marino 
20186d7f5d3SJohn Marino #define	TXP_MISC_FIRSTDESC	0x0000
20286d7f5d3SJohn Marino #define	TXP_MISC_LASTDESC	0x0001
20386d7f5d3SJohn Marino 
20486d7f5d3SJohn Marino #define	TXP_ERR_INTERNAL	0x0000
20586d7f5d3SJohn Marino #define	TXP_ERR_FIFOUNDERRUN	0x0001
20686d7f5d3SJohn Marino #define	TXP_ERR_BADSSD		0x0002
20786d7f5d3SJohn Marino #define	TXP_ERR_RUNT		0x0003
20886d7f5d3SJohn Marino #define	TXP_ERR_CRC		0x0004
20986d7f5d3SJohn Marino #define	TXP_ERR_OVERSIZE	0x0005
21086d7f5d3SJohn Marino #define	TXP_ERR_ALIGNMENT	0x0006
21186d7f5d3SJohn Marino #define	TXP_ERR_DRIBBLEBIT	0x0007
21286d7f5d3SJohn Marino 
21386d7f5d3SJohn Marino #define	TXP_PROTO_UNKNOWN	0x0000
21486d7f5d3SJohn Marino #define	TXP_PROTO_IP		0x0001
21586d7f5d3SJohn Marino #define	TXP_PROTO_IPX		0x0002
21686d7f5d3SJohn Marino #define	TXP_PROTO_RESERVED	0x0003
21786d7f5d3SJohn Marino 
21886d7f5d3SJohn Marino #define	TXP_STAT_PROTO		0x0001
21986d7f5d3SJohn Marino #define	TXP_STAT_VLAN		0x0002
22086d7f5d3SJohn Marino #define	TXP_STAT_IPFRAGMENT	0x0004
22186d7f5d3SJohn Marino #define	TXP_STAT_IPSEC		0x0008
22286d7f5d3SJohn Marino #define	TXP_STAT_IPCKSUMBAD	0x0010
22386d7f5d3SJohn Marino #define	TXP_STAT_TCPCKSUMBAD	0x0020
22486d7f5d3SJohn Marino #define	TXP_STAT_UDPCKSUMBAD	0x0040
22586d7f5d3SJohn Marino #define	TXP_STAT_IPCKSUMGOOD	0x0080
22686d7f5d3SJohn Marino #define	TXP_STAT_TCPCKSUMGOOD	0x0100
22786d7f5d3SJohn Marino #define	TXP_STAT_UDPCKSUMGOOD	0x0200
22886d7f5d3SJohn Marino 
22986d7f5d3SJohn Marino struct txp_tx_desc {
23086d7f5d3SJohn Marino 	volatile u_int8_t	tx_flags;	/* type/descriptor flags */
23186d7f5d3SJohn Marino 	volatile u_int8_t	tx_numdesc;	/* number of descriptors */
23286d7f5d3SJohn Marino 	volatile u_int16_t	tx_totlen;	/* total packet length */
23386d7f5d3SJohn Marino 	volatile u_int32_t	tx_addrlo;	/* virt addr low word */
23486d7f5d3SJohn Marino 	volatile u_int32_t	tx_addrhi;	/* virt addr high word */
23586d7f5d3SJohn Marino 	volatile u_int32_t	tx_pflags;	/* processing flags */
23686d7f5d3SJohn Marino };
23786d7f5d3SJohn Marino #define	TX_FLAGS_TYPE_M		0x07		/* type mask */
23886d7f5d3SJohn Marino #define	TX_FLAGS_TYPE_FRAG	0x00		/* type: fragment */
23986d7f5d3SJohn Marino #define	TX_FLAGS_TYPE_DATA	0x01		/* type: data frame */
24086d7f5d3SJohn Marino #define	TX_FLAGS_TYPE_CMD	0x02		/* type: command frame */
24186d7f5d3SJohn Marino #define	TX_FLAGS_TYPE_OPT	0x03		/* type: options */
24286d7f5d3SJohn Marino #define	TX_FLAGS_TYPE_RX	0x04		/* type: command */
24386d7f5d3SJohn Marino #define	TX_FLAGS_TYPE_RESP	0x05		/* type: response */
24486d7f5d3SJohn Marino #define	TX_FLAGS_RESP		0x40		/* response requested */
24586d7f5d3SJohn Marino #define	TX_FLAGS_VALID		0x80		/* valid descriptor */
24686d7f5d3SJohn Marino 
24786d7f5d3SJohn Marino #define	TX_PFLAGS_DNAC		0x00000001	/* do not add crc */
24886d7f5d3SJohn Marino #define	TX_PFLAGS_IPCKSUM	0x00000002	/* ip checksum */
24986d7f5d3SJohn Marino #define	TX_PFLAGS_TCPCKSUM	0x00000004	/* tcp checksum */
25086d7f5d3SJohn Marino #define	TX_PFLAGS_TCPSEG	0x00000008	/* tcp segmentation */
25186d7f5d3SJohn Marino #define	TX_PFLAGS_VLAN		0x00000010	/* insert vlan */
25286d7f5d3SJohn Marino #define	TX_PFLAGS_IPSEC		0x00000020	/* perform ipsec */
25386d7f5d3SJohn Marino #define	TX_PFLAGS_PRIO		0x00000040	/* priority field valid */
25486d7f5d3SJohn Marino #define	TX_PFLAGS_UDPCKSUM	0x00000080	/* udp checksum */
25586d7f5d3SJohn Marino #define	TX_PFLAGS_PADFRAME	0x00000100	/* pad frame */
25686d7f5d3SJohn Marino #define	TX_PFLAGS_VLANTAG_M	0x0ffff000	/* vlan tag mask */
25786d7f5d3SJohn Marino #define	TX_PFLAGS_VLANPRI_M	0x00700000	/* vlan priority mask */
25886d7f5d3SJohn Marino #define	TX_PFLAGS_VLANTAG_S	12		/* amount to shift tag */
25986d7f5d3SJohn Marino 
26086d7f5d3SJohn Marino struct txp_rx_desc {
26186d7f5d3SJohn Marino 	volatile u_int8_t	rx_flags;	/* type/descriptor flags */
26286d7f5d3SJohn Marino 	volatile u_int8_t	rx_numdesc;	/* number of descriptors */
26386d7f5d3SJohn Marino 	volatile u_int16_t	rx_len;		/* frame length */
26486d7f5d3SJohn Marino #ifdef notdef
26586d7f5d3SJohn Marino 	volatile u_int32_t	rx_vaddrlo;	/* virtual address, lo word */
26686d7f5d3SJohn Marino 	volatile u_int32_t	rx_vaddrhi;	/* virtual address, hi word */
26786d7f5d3SJohn Marino #endif
26886d7f5d3SJohn Marino 	union {
26986d7f5d3SJohn Marino 		struct txp_swdesc	*rx_sd;
27086d7f5d3SJohn Marino 		u_int64_t		rx_dummy;
27186d7f5d3SJohn Marino 	} txp_rx_u;
27286d7f5d3SJohn Marino 	volatile u_int32_t	rx_stat;	/* status */
27386d7f5d3SJohn Marino 	volatile u_int16_t	rx_filter;	/* filter status */
27486d7f5d3SJohn Marino 	volatile u_int16_t	rx_hash;	/* hash status */
27586d7f5d3SJohn Marino 	volatile u_int32_t	rx_vlan;	/* vlan tag/priority */
27686d7f5d3SJohn Marino };
27786d7f5d3SJohn Marino 
27886d7f5d3SJohn Marino #define rx_sd	txp_rx_u.rx_sd
27986d7f5d3SJohn Marino 
28086d7f5d3SJohn Marino /* txp_rx_desc.rx_flags */
28186d7f5d3SJohn Marino #define	RX_FLAGS_TYPE_M		0x07		/* type mask */
28286d7f5d3SJohn Marino #define	RX_FLAGS_TYPE_FRAG	0x00		/* type: fragment */
28386d7f5d3SJohn Marino #define	RX_FLAGS_TYPE_DATA	0x01		/* type: data frame */
28486d7f5d3SJohn Marino #define	RX_FLAGS_TYPE_CMD	0x02		/* type: command frame */
28586d7f5d3SJohn Marino #define	RX_FLAGS_TYPE_OPT	0x03		/* type: options */
28686d7f5d3SJohn Marino #define	RX_FLAGS_TYPE_RX	0x04		/* type: command */
28786d7f5d3SJohn Marino #define	RX_FLAGS_TYPE_RESP	0x05		/* type: response */
28886d7f5d3SJohn Marino #define	RX_FLAGS_RCV_TYPE_M	0x18		/* rcvtype mask */
28986d7f5d3SJohn Marino #define	RX_FLAGS_RCV_TYPE_RX	0x00		/* rcvtype: receive */
29086d7f5d3SJohn Marino #define	RX_FLAGS_RCV_TYPE_RSP	0x08		/* rcvtype: response */
29186d7f5d3SJohn Marino #define	RX_FLAGS_ERROR		0x40		/* error in packet */
29286d7f5d3SJohn Marino 
29386d7f5d3SJohn Marino /* txp_rx_desc.rx_stat (if rx_flags & RX_FLAGS_ERROR bit set) */
29486d7f5d3SJohn Marino #define	RX_ERROR_ADAPTER	0x00000000	/* adapter internal error */
29586d7f5d3SJohn Marino #define	RX_ERROR_FIFO		0x00000001	/* fifo underrun */
29686d7f5d3SJohn Marino #define	RX_ERROR_BADSSD		0x00000002	/* bad ssd */
29786d7f5d3SJohn Marino #define	RX_ERROR_RUNT		0x00000003	/* runt packet */
29886d7f5d3SJohn Marino #define	RX_ERROR_CRC		0x00000004	/* bad crc */
29986d7f5d3SJohn Marino #define	RX_ERROR_OVERSIZE	0x00000005	/* oversized packet */
30086d7f5d3SJohn Marino #define	RX_ERROR_ALIGN		0x00000006	/* alignment error */
30186d7f5d3SJohn Marino #define	RX_ERROR_DRIBBLE	0x00000007	/* dribble bit */
30286d7f5d3SJohn Marino 
30386d7f5d3SJohn Marino /* txp_rx_desc.rx_stat (if rx_flags & RX_FLAGS_ERROR not bit set) */
30486d7f5d3SJohn Marino #define	RX_STAT_PROTO_M		0x00000003	/* protocol mask */
30586d7f5d3SJohn Marino #define	RX_STAT_PROTO_UK	0x00000000	/* unknown protocol */
30686d7f5d3SJohn Marino #define	RX_STAT_PROTO_IPX	0x00000001	/* IPX */
30786d7f5d3SJohn Marino #define	RX_STAT_PROTO_IP	0x00000002	/* IP */
30886d7f5d3SJohn Marino #define	RX_STAT_PROTO_RSV	0x00000003	/* reserved */
30986d7f5d3SJohn Marino #define	RX_STAT_VLAN		0x00000004	/* vlan tag (in rxd) */
31086d7f5d3SJohn Marino #define	RX_STAT_IPFRAG		0x00000008	/* fragment, ipsec not done */
31186d7f5d3SJohn Marino #define	RX_STAT_IPSEC		0x00000010	/* ipsec decoded packet */
31286d7f5d3SJohn Marino #define	RX_STAT_IPCKSUMBAD	0x00000020	/* ip checksum failed */
31386d7f5d3SJohn Marino #define	RX_STAT_UDPCKSUMBAD	0x00000040	/* udp checksum failed */
31486d7f5d3SJohn Marino #define	RX_STAT_TCPCKSUMBAD	0x00000080	/* tcp checksum failed */
31586d7f5d3SJohn Marino #define	RX_STAT_IPCKSUMGOOD	0x00000100	/* ip checksum succeeded */
31686d7f5d3SJohn Marino #define	RX_STAT_UDPCKSUMGOOD	0x00000200	/* udp checksum succeeded */
31786d7f5d3SJohn Marino #define	RX_STAT_TCPCKSUMGOOD	0x00000400	/* tcp checksum succeeded */
31886d7f5d3SJohn Marino 
31986d7f5d3SJohn Marino 
32086d7f5d3SJohn Marino struct txp_rxbuf_desc {
32186d7f5d3SJohn Marino 	volatile u_int32_t	rb_paddrlo;
32286d7f5d3SJohn Marino 	volatile u_int32_t	rb_paddrhi;
32386d7f5d3SJohn Marino #ifdef notdef
32486d7f5d3SJohn Marino 	volatile u_int32_t	rb_vaddrlo;
32586d7f5d3SJohn Marino 	volatile u_int32_t	rb_vaddrhi;
32686d7f5d3SJohn Marino #endif
32786d7f5d3SJohn Marino 	union {
32886d7f5d3SJohn Marino 		struct txp_swdesc	*rb_sd;
32986d7f5d3SJohn Marino 		u_int64_t		rb_dummy;
33086d7f5d3SJohn Marino 	} txp_rb_u;
33186d7f5d3SJohn Marino };
33286d7f5d3SJohn Marino 
33386d7f5d3SJohn Marino #define rb_sd	txp_rb_u.rb_sd
33486d7f5d3SJohn Marino 
33586d7f5d3SJohn Marino /* Extension descriptor */
33686d7f5d3SJohn Marino struct txp_ext_desc {
33786d7f5d3SJohn Marino 	volatile u_int32_t	ext_1;
33886d7f5d3SJohn Marino 	volatile u_int32_t	ext_2;
33986d7f5d3SJohn Marino 	volatile u_int32_t	ext_3;
34086d7f5d3SJohn Marino 	volatile u_int32_t	ext_4;
34186d7f5d3SJohn Marino };
34286d7f5d3SJohn Marino 
34386d7f5d3SJohn Marino struct txp_cmd_desc {
34486d7f5d3SJohn Marino 	volatile u_int8_t	cmd_flags;
34586d7f5d3SJohn Marino 	volatile u_int8_t	cmd_numdesc;
34686d7f5d3SJohn Marino 	volatile u_int16_t	cmd_id;
34786d7f5d3SJohn Marino 	volatile u_int16_t	cmd_seq;
34886d7f5d3SJohn Marino 	volatile u_int16_t	cmd_par1;
34986d7f5d3SJohn Marino 	volatile u_int32_t	cmd_par2;
35086d7f5d3SJohn Marino 	volatile u_int32_t	cmd_par3;
35186d7f5d3SJohn Marino };
35286d7f5d3SJohn Marino #define	CMD_FLAGS_TYPE_M	0x07		/* type mask */
35386d7f5d3SJohn Marino #define	CMD_FLAGS_TYPE_FRAG	0x00		/* type: fragment */
35486d7f5d3SJohn Marino #define	CMD_FLAGS_TYPE_DATA	0x01		/* type: data frame */
35586d7f5d3SJohn Marino #define	CMD_FLAGS_TYPE_CMD	0x02		/* type: command frame */
35686d7f5d3SJohn Marino #define	CMD_FLAGS_TYPE_OPT	0x03		/* type: options */
35786d7f5d3SJohn Marino #define	CMD_FLAGS_TYPE_RX	0x04		/* type: command */
35886d7f5d3SJohn Marino #define	CMD_FLAGS_TYPE_RESP	0x05		/* type: response */
35986d7f5d3SJohn Marino #define	CMD_FLAGS_RESP		0x40		/* response requested */
36086d7f5d3SJohn Marino #define	CMD_FLAGS_VALID		0x80		/* valid descriptor */
36186d7f5d3SJohn Marino 
36286d7f5d3SJohn Marino struct txp_rsp_desc {
36386d7f5d3SJohn Marino 	volatile u_int8_t	rsp_flags;
36486d7f5d3SJohn Marino 	volatile u_int8_t	rsp_numdesc;
36586d7f5d3SJohn Marino 	volatile u_int16_t	rsp_id;
36686d7f5d3SJohn Marino 	volatile u_int16_t	rsp_seq;
36786d7f5d3SJohn Marino 	volatile u_int16_t	rsp_par1;
36886d7f5d3SJohn Marino 	volatile u_int32_t	rsp_par2;
36986d7f5d3SJohn Marino 	volatile u_int32_t	rsp_par3;
37086d7f5d3SJohn Marino };
37186d7f5d3SJohn Marino #define	RSP_FLAGS_TYPE_M	0x07		/* type mask */
37286d7f5d3SJohn Marino #define	RSP_FLAGS_TYPE_FRAG	0x00		/* type: fragment */
37386d7f5d3SJohn Marino #define	RSP_FLAGS_TYPE_DATA	0x01		/* type: data frame */
37486d7f5d3SJohn Marino #define	RSP_FLAGS_TYPE_CMD	0x02		/* type: command frame */
37586d7f5d3SJohn Marino #define	RSP_FLAGS_TYPE_OPT	0x03		/* type: options */
37686d7f5d3SJohn Marino #define	RSP_FLAGS_TYPE_RX	0x04		/* type: command */
37786d7f5d3SJohn Marino #define	RSP_FLAGS_TYPE_RESP	0x05		/* type: response */
37886d7f5d3SJohn Marino #define	RSP_FLAGS_ERROR		0x40		/* response error */
37986d7f5d3SJohn Marino 
38086d7f5d3SJohn Marino struct txp_frag_desc {
38186d7f5d3SJohn Marino 	volatile u_int8_t	frag_flags;	/* type/descriptor flags */
38286d7f5d3SJohn Marino 	volatile u_int8_t	frag_rsvd1;
38386d7f5d3SJohn Marino 	volatile u_int16_t	frag_len;	/* bytes in this fragment */
38486d7f5d3SJohn Marino 	volatile u_int32_t	frag_addrlo;	/* phys addr low word */
38586d7f5d3SJohn Marino 	volatile u_int32_t	frag_addrhi;	/* phys addr high word */
38686d7f5d3SJohn Marino 	volatile u_int32_t	frag_rsvd2;
38786d7f5d3SJohn Marino };
38886d7f5d3SJohn Marino #define	FRAG_FLAGS_TYPE_M	0x07		/* type mask */
38986d7f5d3SJohn Marino #define	FRAG_FLAGS_TYPE_FRAG	0x00		/* type: fragment */
39086d7f5d3SJohn Marino #define	FRAG_FLAGS_TYPE_DATA	0x01		/* type: data frame */
39186d7f5d3SJohn Marino #define	FRAG_FLAGS_TYPE_CMD	0x02		/* type: command frame */
39286d7f5d3SJohn Marino #define	FRAG_FLAGS_TYPE_OPT	0x03		/* type: options */
39386d7f5d3SJohn Marino #define	FRAG_FLAGS_TYPE_RX	0x04		/* type: command */
39486d7f5d3SJohn Marino #define	FRAG_FLAGS_TYPE_RESP	0x05		/* type: response */
39586d7f5d3SJohn Marino 
39686d7f5d3SJohn Marino struct txp_opt_desc {
39786d7f5d3SJohn Marino 	u_int8_t		opt_desctype:3,
39886d7f5d3SJohn Marino 				opt_rsvd:1,
39986d7f5d3SJohn Marino 				opt_type:4;
40086d7f5d3SJohn Marino 
40186d7f5d3SJohn Marino 	u_int8_t		opt_num;
40286d7f5d3SJohn Marino 	u_int16_t		opt_dep1;
40386d7f5d3SJohn Marino 	u_int32_t		opt_dep2;
40486d7f5d3SJohn Marino 	u_int32_t		opt_dep3;
40586d7f5d3SJohn Marino 	u_int32_t		opt_dep4;
40686d7f5d3SJohn Marino };
40786d7f5d3SJohn Marino 
40886d7f5d3SJohn Marino struct txp_ipsec_desc {
40986d7f5d3SJohn Marino 	u_int8_t		ipsec_desctpe:3,
41086d7f5d3SJohn Marino 				ipsec_rsvd:1,
41186d7f5d3SJohn Marino 				ipsec_type:4;
41286d7f5d3SJohn Marino 
41386d7f5d3SJohn Marino 	u_int8_t		ipsec_num;
41486d7f5d3SJohn Marino 	u_int16_t		ipsec_flags;
41586d7f5d3SJohn Marino 	u_int16_t		ipsec_ah1;
41686d7f5d3SJohn Marino 	u_int16_t		ipsec_esp1;
41786d7f5d3SJohn Marino 	u_int16_t		ipsec_ah2;
41886d7f5d3SJohn Marino 	u_int16_t		ipsec_esp2;
41986d7f5d3SJohn Marino 	u_int32_t		ipsec_rsvd1;
42086d7f5d3SJohn Marino };
42186d7f5d3SJohn Marino 
42286d7f5d3SJohn Marino struct txp_tcpseg_desc {
42386d7f5d3SJohn Marino 	u_int8_t		tcpseg_desctype:3,
42486d7f5d3SJohn Marino 				tcpseg_rsvd:1,
42586d7f5d3SJohn Marino 				tcpseg_type:4;
42686d7f5d3SJohn Marino 
42786d7f5d3SJohn Marino 	u_int8_t		tcpseg_num;
42886d7f5d3SJohn Marino 
42986d7f5d3SJohn Marino 	u_int16_t		tcpseg_mss:12,
43086d7f5d3SJohn Marino 				tcpseg_misc:4;
43186d7f5d3SJohn Marino 
43286d7f5d3SJohn Marino 	u_int32_t		tcpseg_respaddr;
43386d7f5d3SJohn Marino 	u_int32_t		tcpseg_txbytes;
43486d7f5d3SJohn Marino 	u_int32_t		tcpseg_lss;
43586d7f5d3SJohn Marino };
43686d7f5d3SJohn Marino 
43786d7f5d3SJohn Marino /*
43886d7f5d3SJohn Marino  * Transceiver types
43986d7f5d3SJohn Marino  */
44086d7f5d3SJohn Marino #define	TXP_XCVR_10_HDX		0
44186d7f5d3SJohn Marino #define	TXP_XCVR_10_FDX		1
44286d7f5d3SJohn Marino #define	TXP_XCVR_100_HDX	2
44386d7f5d3SJohn Marino #define	TXP_XCVR_100_FDX	3
44486d7f5d3SJohn Marino #define	TXP_XCVR_AUTO		4
44586d7f5d3SJohn Marino 
44686d7f5d3SJohn Marino #define TXP_MEDIA_CRC		0x0004	/* crc strip disable */
44786d7f5d3SJohn Marino #define	TXP_MEDIA_CD		0x0010	/* collision detection */
44886d7f5d3SJohn Marino #define	TXP_MEDIA_CS		0x0020	/* carrier sense */
44986d7f5d3SJohn Marino #define	TXP_MEDIA_POL		0x0400	/* polarity reversed */
45086d7f5d3SJohn Marino #define	TXP_MEDIA_NOLINK	0x0800	/* 0 = link, 1 = no link */
45186d7f5d3SJohn Marino 
45286d7f5d3SJohn Marino /*
45386d7f5d3SJohn Marino  * receive filter bits (par1 to TXP_CMD_RX_FILTER_{READ|WRITE}
45486d7f5d3SJohn Marino  */
45586d7f5d3SJohn Marino #define	TXP_RXFILT_DIRECT	0x0001	/* directed packets */
45686d7f5d3SJohn Marino #define	TXP_RXFILT_ALLMULTI	0x0002	/* all multicast packets */
45786d7f5d3SJohn Marino #define	TXP_RXFILT_BROADCAST	0x0004	/* broadcast packets */
45886d7f5d3SJohn Marino #define	TXP_RXFILT_PROMISC	0x0008	/* promiscuous mode */
45986d7f5d3SJohn Marino #define	TXP_RXFILT_HASHMULTI	0x0010	/* use multicast filter */
46086d7f5d3SJohn Marino 
46186d7f5d3SJohn Marino /*
46286d7f5d3SJohn Marino  * boot record (pointers to rings)
46386d7f5d3SJohn Marino  */
46486d7f5d3SJohn Marino struct txp_boot_record {
46586d7f5d3SJohn Marino 	volatile u_int32_t	br_hostvar_lo;		/* host ring pointer */
46686d7f5d3SJohn Marino 	volatile u_int32_t	br_hostvar_hi;
46786d7f5d3SJohn Marino 	volatile u_int32_t	br_txlopri_lo;		/* tx low pri ring */
46886d7f5d3SJohn Marino 	volatile u_int32_t	br_txlopri_hi;
46986d7f5d3SJohn Marino 	volatile u_int32_t	br_txlopri_siz;
47086d7f5d3SJohn Marino 	volatile u_int32_t	br_txhipri_lo;		/* tx high pri ring */
47186d7f5d3SJohn Marino 	volatile u_int32_t	br_txhipri_hi;
47286d7f5d3SJohn Marino 	volatile u_int32_t	br_txhipri_siz;
47386d7f5d3SJohn Marino 	volatile u_int32_t	br_rxlopri_lo;		/* rx low pri ring */
47486d7f5d3SJohn Marino 	volatile u_int32_t	br_rxlopri_hi;
47586d7f5d3SJohn Marino 	volatile u_int32_t	br_rxlopri_siz;
47686d7f5d3SJohn Marino 	volatile u_int32_t	br_rxbuf_lo;		/* rx buffer ring */
47786d7f5d3SJohn Marino 	volatile u_int32_t	br_rxbuf_hi;
47886d7f5d3SJohn Marino 	volatile u_int32_t	br_rxbuf_siz;
47986d7f5d3SJohn Marino 	volatile u_int32_t	br_cmd_lo;		/* command ring */
48086d7f5d3SJohn Marino 	volatile u_int32_t	br_cmd_hi;
48186d7f5d3SJohn Marino 	volatile u_int32_t	br_cmd_siz;
48286d7f5d3SJohn Marino 	volatile u_int32_t	br_resp_lo;		/* response ring */
48386d7f5d3SJohn Marino 	volatile u_int32_t	br_resp_hi;
48486d7f5d3SJohn Marino 	volatile u_int32_t	br_resp_siz;
48586d7f5d3SJohn Marino 	volatile u_int32_t	br_zero_lo;		/* zero word */
48686d7f5d3SJohn Marino 	volatile u_int32_t	br_zero_hi;
48786d7f5d3SJohn Marino 	volatile u_int32_t	br_rxhipri_lo;		/* rx high pri ring */
48886d7f5d3SJohn Marino 	volatile u_int32_t	br_rxhipri_hi;
48986d7f5d3SJohn Marino 	volatile u_int32_t	br_rxhipri_siz;
49086d7f5d3SJohn Marino };
49186d7f5d3SJohn Marino 
49286d7f5d3SJohn Marino /*
49386d7f5d3SJohn Marino  * hostvar structure (shared with typhoon)
49486d7f5d3SJohn Marino  */
49586d7f5d3SJohn Marino struct txp_hostvar {
49686d7f5d3SJohn Marino 	volatile u_int32_t	hv_rx_hi_read_idx;	/* host->arm */
49786d7f5d3SJohn Marino 	volatile u_int32_t	hv_rx_lo_read_idx;	/* host->arm */
49886d7f5d3SJohn Marino 	volatile u_int32_t	hv_rx_buf_write_idx;	/* host->arm */
49986d7f5d3SJohn Marino 	volatile u_int32_t	hv_resp_read_idx;	/* host->arm */
50086d7f5d3SJohn Marino 	volatile u_int32_t	hv_tx_lo_desc_read_idx;	/* arm->host */
50186d7f5d3SJohn Marino 	volatile u_int32_t	hv_tx_hi_desc_read_idx;	/* arm->host */
50286d7f5d3SJohn Marino 	volatile u_int32_t	hv_rx_lo_write_idx;	/* arm->host */
50386d7f5d3SJohn Marino 	volatile u_int32_t	hv_rx_buf_read_idx;	/* arm->host */
50486d7f5d3SJohn Marino 	volatile u_int32_t	hv_cmd_read_idx;	/* arm->host */
50586d7f5d3SJohn Marino 	volatile u_int32_t	hv_resp_write_idx;	/* arm->host */
50686d7f5d3SJohn Marino 	volatile u_int32_t	hv_rx_hi_write_idx;	/* arm->host */
50786d7f5d3SJohn Marino };
50886d7f5d3SJohn Marino 
50986d7f5d3SJohn Marino /*
51086d7f5d3SJohn Marino  * TYPHOON status register state (in TXP_A2H_0)
51186d7f5d3SJohn Marino  */
51286d7f5d3SJohn Marino #define	STAT_ROM_CODE			0x00000001
51386d7f5d3SJohn Marino #define	STAT_ROM_EEPROM_LOAD		0x00000002
51486d7f5d3SJohn Marino #define	STAT_WAITING_FOR_BOOT		0x00000007
51586d7f5d3SJohn Marino #define	STAT_RUNNING			0x00000009
51686d7f5d3SJohn Marino #define	STAT_WAITING_FOR_HOST_REQUEST	0x0000000d
51786d7f5d3SJohn Marino #define	STAT_WAITING_FOR_SEGMENT	0x00000010
51886d7f5d3SJohn Marino #define	STAT_SLEEPING			0x00000011
51986d7f5d3SJohn Marino #define	STAT_HALTED			0x00000014
52086d7f5d3SJohn Marino 
52186d7f5d3SJohn Marino #define	TX_ENTRIES			256
52286d7f5d3SJohn Marino #define	RX_ENTRIES			128
52386d7f5d3SJohn Marino #define	RXBUF_ENTRIES			256
52486d7f5d3SJohn Marino #define	CMD_ENTRIES			32
52586d7f5d3SJohn Marino #define	RSP_ENTRIES			32
52686d7f5d3SJohn Marino 
52786d7f5d3SJohn Marino #define	OFFLOAD_TCPCKSUM		0x00000002	/* tcp checksum */
52886d7f5d3SJohn Marino #define	OFFLOAD_UDPCKSUM		0x00000004	/* udp checksum */
52986d7f5d3SJohn Marino #define	OFFLOAD_IPCKSUM			0x00000008	/* ip checksum */
53086d7f5d3SJohn Marino #define	OFFLOAD_IPSEC			0x00000010	/* ipsec enable */
53186d7f5d3SJohn Marino #define	OFFLOAD_BCAST			0x00000020	/* broadcast throttle */
53286d7f5d3SJohn Marino #define	OFFLOAD_DHCP			0x00000040	/* dhcp prevention */
53386d7f5d3SJohn Marino #define	OFFLOAD_VLAN			0x00000080	/* vlan enable */
53486d7f5d3SJohn Marino #define	OFFLOAD_FILTER			0x00000100	/* filter enable */
53586d7f5d3SJohn Marino #define	OFFLOAD_TCPSEG			0x00000200	/* tcp segmentation */
53686d7f5d3SJohn Marino #define	OFFLOAD_MASK			0xfffffffe	/* mask off low bit */
53786d7f5d3SJohn Marino 
53886d7f5d3SJohn Marino /*
53986d7f5d3SJohn Marino  * Macros for converting array indices to offsets within the descriptor
54086d7f5d3SJohn Marino  * arrays.  The chip operates on offsets, but it's much easier for us
54186d7f5d3SJohn Marino  * to operate on indices.  Assumes descriptor entries are 16 bytes.
54286d7f5d3SJohn Marino  */
54386d7f5d3SJohn Marino #define	TXP_IDX2OFFSET(idx)	((idx) << 4)
54486d7f5d3SJohn Marino #define	TXP_OFFSET2IDX(off)	((off) >> 4)
54586d7f5d3SJohn Marino 
54686d7f5d3SJohn Marino struct txp_cmd_ring {
54786d7f5d3SJohn Marino 	struct txp_cmd_desc	*base;
54886d7f5d3SJohn Marino 	u_int32_t		lastwrite;
54986d7f5d3SJohn Marino 	u_int32_t		size;
55086d7f5d3SJohn Marino };
55186d7f5d3SJohn Marino 
55286d7f5d3SJohn Marino struct txp_rsp_ring {
55386d7f5d3SJohn Marino 	struct txp_rsp_desc	*base;
55486d7f5d3SJohn Marino 	u_int32_t		lastwrite;
55586d7f5d3SJohn Marino 	u_int32_t		size;
55686d7f5d3SJohn Marino };
55786d7f5d3SJohn Marino 
55886d7f5d3SJohn Marino struct txp_tx_ring {
55986d7f5d3SJohn Marino 	struct txp_tx_desc	*r_desc;	/* base address of descs */
56086d7f5d3SJohn Marino 	u_int32_t		r_reg;		/* register to activate */
56186d7f5d3SJohn Marino 	u_int32_t		r_prod;		/* producer */
56286d7f5d3SJohn Marino 	u_int32_t		r_cons;		/* consumer */
56386d7f5d3SJohn Marino 	u_int32_t		r_cnt;		/* # descs in use */
56486d7f5d3SJohn Marino 	volatile u_int32_t	*r_off;		/* hostvar index pointer */
56586d7f5d3SJohn Marino };
56686d7f5d3SJohn Marino 
56786d7f5d3SJohn Marino struct txp_swdesc {
56886d7f5d3SJohn Marino 	struct mbuf *		sd_mbuf;
56986d7f5d3SJohn Marino 	bus_dmamap_t		sd_map;
57086d7f5d3SJohn Marino };
57186d7f5d3SJohn Marino 
57286d7f5d3SJohn Marino struct txp_rx_ring {
57386d7f5d3SJohn Marino 	struct txp_rx_desc	*r_desc;	/* base address of descs */
57486d7f5d3SJohn Marino 	volatile u_int32_t	*r_roff;	/* hv read offset ptr */
57586d7f5d3SJohn Marino 	volatile u_int32_t	*r_woff;	/* hv write offset ptr */
57686d7f5d3SJohn Marino };
57786d7f5d3SJohn Marino 
57886d7f5d3SJohn Marino struct txp_ldata {
57986d7f5d3SJohn Marino 	struct txp_boot_record	txp_boot;
58086d7f5d3SJohn Marino 	struct txp_hostvar	txp_hostvar;
58186d7f5d3SJohn Marino 	struct txp_tx_desc	txp_txhiring[TX_ENTRIES];
58286d7f5d3SJohn Marino 	struct txp_tx_desc	txp_txloring[TX_ENTRIES];
58386d7f5d3SJohn Marino 	struct txp_rxbuf_desc	txp_rxbufs[RXBUF_ENTRIES];
58486d7f5d3SJohn Marino 	struct txp_rx_desc	txp_rxhiring[RX_ENTRIES];
58586d7f5d3SJohn Marino 	struct txp_rx_desc	txp_rxloring[RX_ENTRIES];
58686d7f5d3SJohn Marino 	struct txp_cmd_desc	txp_cmdring[CMD_ENTRIES];
58786d7f5d3SJohn Marino 	struct txp_rsp_desc	txp_rspring[RSP_ENTRIES];
58886d7f5d3SJohn Marino 	u_int32_t		txp_zero;
58986d7f5d3SJohn Marino };
59086d7f5d3SJohn Marino 
59186d7f5d3SJohn Marino struct txp_softc {
59286d7f5d3SJohn Marino 	struct arpcom		sc_arpcom;	/* ethernet common */
59386d7f5d3SJohn Marino 	struct txp_hostvar	*sc_hostvar;
59486d7f5d3SJohn Marino 	struct txp_boot_record	*sc_boot;
59586d7f5d3SJohn Marino 	bus_space_handle_t	sc_bh;		/* bus handle (regs) */
59686d7f5d3SJohn Marino 	bus_space_tag_t		sc_bt;		/* bus tag (regs) */
59786d7f5d3SJohn Marino 	struct resource		*sc_res;
59886d7f5d3SJohn Marino 	struct resource		*sc_irq;
59986d7f5d3SJohn Marino 	void			*sc_intrhand;
60086d7f5d3SJohn Marino 	struct txp_ldata	*sc_ldata;
60186d7f5d3SJohn Marino 	void			*sc_fwbuf;
60286d7f5d3SJohn Marino 	int			sc_rxbufprod;
60386d7f5d3SJohn Marino 	struct txp_cmd_ring	sc_cmdring;
60486d7f5d3SJohn Marino 	struct txp_rsp_ring	sc_rspring;
60586d7f5d3SJohn Marino 	struct txp_swdesc	sc_txd[TX_ENTRIES];
60686d7f5d3SJohn Marino 	struct callout		txp_stat_timer;
60786d7f5d3SJohn Marino 	struct ifmedia		sc_ifmedia;
60886d7f5d3SJohn Marino 	struct txp_tx_ring	sc_txhir, sc_txlor;
60986d7f5d3SJohn Marino 	struct txp_rxbuf_desc	*sc_rxbufs;
61086d7f5d3SJohn Marino 	struct txp_rx_ring	sc_rxhir, sc_rxlor;
61186d7f5d3SJohn Marino 	u_int16_t		sc_xcvr;
61286d7f5d3SJohn Marino 	u_int16_t		sc_seq;
61386d7f5d3SJohn Marino 	u_int32_t		sc_rx_capability, sc_tx_capability;
61486d7f5d3SJohn Marino };
61586d7f5d3SJohn Marino 
61686d7f5d3SJohn Marino struct txp_fw_file_header {
61786d7f5d3SJohn Marino 	u_int8_t	magicid[8];	/* TYPHOON\0 */
61886d7f5d3SJohn Marino 	u_int32_t	version;
61986d7f5d3SJohn Marino 	u_int32_t	nsections;
62086d7f5d3SJohn Marino 	u_int32_t	addr;
62186d7f5d3SJohn Marino };
62286d7f5d3SJohn Marino 
62386d7f5d3SJohn Marino struct txp_fw_section_header {
62486d7f5d3SJohn Marino 	u_int32_t	nbytes;
62586d7f5d3SJohn Marino 	u_int16_t	cksum;
62686d7f5d3SJohn Marino 	u_int16_t	reserved;
62786d7f5d3SJohn Marino 	u_int32_t	addr;
62886d7f5d3SJohn Marino };
62986d7f5d3SJohn Marino 
63086d7f5d3SJohn Marino #define	TXP_MAX_SEGLEN	0xffff
63186d7f5d3SJohn Marino #define	TXP_MAX_PKTLEN	0x0800
63286d7f5d3SJohn Marino 
63386d7f5d3SJohn Marino #define	WRITE_REG(sc,reg,val) \
63486d7f5d3SJohn Marino     bus_space_write_4((sc)->sc_bt, (sc)->sc_bh, reg, val)
63586d7f5d3SJohn Marino #define	READ_REG(sc,reg) \
63686d7f5d3SJohn Marino     bus_space_read_4((sc)->sc_bt, (sc)->sc_bh, reg)
63786d7f5d3SJohn Marino 
63886d7f5d3SJohn Marino struct txp_type {
63986d7f5d3SJohn Marino 	u_int16_t		txp_vid;
64086d7f5d3SJohn Marino 	u_int16_t		txp_did;
64186d7f5d3SJohn Marino 	char			*txp_name;
64286d7f5d3SJohn Marino };
643