162306a36Sopenharmony_ci/* typhoon.h:	chip info for the 3Com 3CR990 family of controllers */
262306a36Sopenharmony_ci/*
362306a36Sopenharmony_ci	Written 2002-2003 by David Dillow <dave@thedillows.org>
462306a36Sopenharmony_ci
562306a36Sopenharmony_ci	This software may be used and distributed according to the terms of
662306a36Sopenharmony_ci	the GNU General Public License (GPL), incorporated herein by reference.
762306a36Sopenharmony_ci	Drivers based on or derived from this code fall under the GPL and must
862306a36Sopenharmony_ci	retain the authorship, copyright and license notice.  This file is not
962306a36Sopenharmony_ci	a complete program and may only be used when the entire operating
1062306a36Sopenharmony_ci	system is licensed under the GPL.
1162306a36Sopenharmony_ci
1262306a36Sopenharmony_ci	This software is available on a public web site. It may enable
1362306a36Sopenharmony_ci	cryptographic capabilities of the 3Com hardware, and may be
1462306a36Sopenharmony_ci	exported from the United States under License Exception "TSU"
1562306a36Sopenharmony_ci	pursuant to 15 C.F.R. Section 740.13(e).
1662306a36Sopenharmony_ci
1762306a36Sopenharmony_ci	This work was funded by the National Library of Medicine under
1862306a36Sopenharmony_ci	the Department of Energy project number 0274DD06D1 and NLM project
1962306a36Sopenharmony_ci	number Y1-LM-2015-01.
2062306a36Sopenharmony_ci*/
2162306a36Sopenharmony_ci
2262306a36Sopenharmony_ci/* All Typhoon ring positions are specificed in bytes, and point to the
2362306a36Sopenharmony_ci * first "clean" entry in the ring -- ie the next entry we use for whatever
2462306a36Sopenharmony_ci * purpose.
2562306a36Sopenharmony_ci */
2662306a36Sopenharmony_ci
2762306a36Sopenharmony_ci/* The Typhoon basic ring
2862306a36Sopenharmony_ci * ringBase:  where this ring lives (our virtual address)
2962306a36Sopenharmony_ci * lastWrite: the next entry we'll use
3062306a36Sopenharmony_ci */
3162306a36Sopenharmony_cistruct basic_ring {
3262306a36Sopenharmony_ci	u8 *ringBase;
3362306a36Sopenharmony_ci	u32 lastWrite;
3462306a36Sopenharmony_ci};
3562306a36Sopenharmony_ci
3662306a36Sopenharmony_ci/* The Typhoon transmit ring -- same as a basic ring, plus:
3762306a36Sopenharmony_ci * lastRead:      where we're at in regard to cleaning up the ring
3862306a36Sopenharmony_ci * writeRegister: register to use for writing (different for Hi & Lo rings)
3962306a36Sopenharmony_ci */
4062306a36Sopenharmony_cistruct transmit_ring {
4162306a36Sopenharmony_ci	u8 *ringBase;
4262306a36Sopenharmony_ci	u32 lastWrite;
4362306a36Sopenharmony_ci	u32 lastRead;
4462306a36Sopenharmony_ci	int writeRegister;
4562306a36Sopenharmony_ci};
4662306a36Sopenharmony_ci
4762306a36Sopenharmony_ci/* The host<->Typhoon ring index structure
4862306a36Sopenharmony_ci * This indicates the current positions in the rings
4962306a36Sopenharmony_ci *
5062306a36Sopenharmony_ci * All values must be in little endian format for the 3XP
5162306a36Sopenharmony_ci *
5262306a36Sopenharmony_ci * rxHiCleared:   entry we've cleared to in the Hi receive ring
5362306a36Sopenharmony_ci * rxLoCleared:   entry we've cleared to in the Lo receive ring
5462306a36Sopenharmony_ci * rxBuffReady:   next entry we'll put a free buffer in
5562306a36Sopenharmony_ci * respCleared:   entry we've cleared to in the response ring
5662306a36Sopenharmony_ci *
5762306a36Sopenharmony_ci * txLoCleared:   entry the NIC has cleared to in the Lo transmit ring
5862306a36Sopenharmony_ci * txHiCleared:   entry the NIC has cleared to in the Hi transmit ring
5962306a36Sopenharmony_ci * rxLoReady:     entry the NIC has filled to in the Lo receive ring
6062306a36Sopenharmony_ci * rxBuffCleared: entry the NIC has cleared in the free buffer ring
6162306a36Sopenharmony_ci * cmdCleared:    entry the NIC has cleared in the command ring
6262306a36Sopenharmony_ci * respReady:     entry the NIC has filled to in the response ring
6362306a36Sopenharmony_ci * rxHiReady:     entry the NIC has filled to in the Hi receive ring
6462306a36Sopenharmony_ci */
6562306a36Sopenharmony_cistruct typhoon_indexes {
6662306a36Sopenharmony_ci	/* The first four are written by the host, and read by the NIC */
6762306a36Sopenharmony_ci	volatile __le32 rxHiCleared;
6862306a36Sopenharmony_ci	volatile __le32 rxLoCleared;
6962306a36Sopenharmony_ci	volatile __le32 rxBuffReady;
7062306a36Sopenharmony_ci	volatile __le32 respCleared;
7162306a36Sopenharmony_ci
7262306a36Sopenharmony_ci	/* The remaining are written by the NIC, and read by the host */
7362306a36Sopenharmony_ci	volatile __le32 txLoCleared;
7462306a36Sopenharmony_ci	volatile __le32 txHiCleared;
7562306a36Sopenharmony_ci	volatile __le32 rxLoReady;
7662306a36Sopenharmony_ci	volatile __le32 rxBuffCleared;
7762306a36Sopenharmony_ci	volatile __le32 cmdCleared;
7862306a36Sopenharmony_ci	volatile __le32 respReady;
7962306a36Sopenharmony_ci	volatile __le32 rxHiReady;
8062306a36Sopenharmony_ci} __packed;
8162306a36Sopenharmony_ci
8262306a36Sopenharmony_ci/* The host<->Typhoon interface
8362306a36Sopenharmony_ci * Our means of communicating where things are
8462306a36Sopenharmony_ci *
8562306a36Sopenharmony_ci * All values must be in little endian format for the 3XP
8662306a36Sopenharmony_ci *
8762306a36Sopenharmony_ci * ringIndex:   64 bit bus address of the index structure
8862306a36Sopenharmony_ci * txLoAddr:    64 bit bus address of the Lo transmit ring
8962306a36Sopenharmony_ci * txLoSize:    size (in bytes) of the Lo transmit ring
9062306a36Sopenharmony_ci * txHi*:       as above for the Hi priority transmit ring
9162306a36Sopenharmony_ci * rxLo*:       as above for the Lo priority receive ring
9262306a36Sopenharmony_ci * rxBuff*:     as above for the free buffer ring
9362306a36Sopenharmony_ci * cmd*:        as above for the command ring
9462306a36Sopenharmony_ci * resp*:       as above for the response ring
9562306a36Sopenharmony_ci * zeroAddr:    64 bit bus address of a zero word (for DMA)
9662306a36Sopenharmony_ci * rxHi*:       as above for the Hi Priority receive ring
9762306a36Sopenharmony_ci *
9862306a36Sopenharmony_ci * While there is room for 64 bit addresses, current versions of the 3XP
9962306a36Sopenharmony_ci * only do 32 bit addresses, so the *Hi for each of the above will always
10062306a36Sopenharmony_ci * be zero.
10162306a36Sopenharmony_ci */
10262306a36Sopenharmony_cistruct typhoon_interface {
10362306a36Sopenharmony_ci	__le32 ringIndex;
10462306a36Sopenharmony_ci	__le32 ringIndexHi;
10562306a36Sopenharmony_ci	__le32 txLoAddr;
10662306a36Sopenharmony_ci	__le32 txLoAddrHi;
10762306a36Sopenharmony_ci	__le32 txLoSize;
10862306a36Sopenharmony_ci	__le32 txHiAddr;
10962306a36Sopenharmony_ci	__le32 txHiAddrHi;
11062306a36Sopenharmony_ci	__le32 txHiSize;
11162306a36Sopenharmony_ci	__le32 rxLoAddr;
11262306a36Sopenharmony_ci	__le32 rxLoAddrHi;
11362306a36Sopenharmony_ci	__le32 rxLoSize;
11462306a36Sopenharmony_ci	__le32 rxBuffAddr;
11562306a36Sopenharmony_ci	__le32 rxBuffAddrHi;
11662306a36Sopenharmony_ci	__le32 rxBuffSize;
11762306a36Sopenharmony_ci	__le32 cmdAddr;
11862306a36Sopenharmony_ci	__le32 cmdAddrHi;
11962306a36Sopenharmony_ci	__le32 cmdSize;
12062306a36Sopenharmony_ci	__le32 respAddr;
12162306a36Sopenharmony_ci	__le32 respAddrHi;
12262306a36Sopenharmony_ci	__le32 respSize;
12362306a36Sopenharmony_ci	__le32 zeroAddr;
12462306a36Sopenharmony_ci	__le32 zeroAddrHi;
12562306a36Sopenharmony_ci	__le32 rxHiAddr;
12662306a36Sopenharmony_ci	__le32 rxHiAddrHi;
12762306a36Sopenharmony_ci	__le32 rxHiSize;
12862306a36Sopenharmony_ci} __packed;
12962306a36Sopenharmony_ci
13062306a36Sopenharmony_ci/* The Typhoon transmit/fragment descriptor
13162306a36Sopenharmony_ci *
13262306a36Sopenharmony_ci * A packet is described by a packet descriptor, followed by option descriptors,
13362306a36Sopenharmony_ci * if any, then one or more fragment descriptors.
13462306a36Sopenharmony_ci *
13562306a36Sopenharmony_ci * Packet descriptor:
13662306a36Sopenharmony_ci * flags:	Descriptor type
13762306a36Sopenharmony_ci * len:i	zero, or length of this packet
13862306a36Sopenharmony_ci * addr*:	8 bytes of opaque data to the firmware -- for skb pointer
13962306a36Sopenharmony_ci * processFlags: Determine offload tasks to perform on this packet.
14062306a36Sopenharmony_ci *
14162306a36Sopenharmony_ci * Fragment descriptor:
14262306a36Sopenharmony_ci * flags:	Descriptor type
14362306a36Sopenharmony_ci * len:i	length of this fragment
14462306a36Sopenharmony_ci * addr:	low bytes of DMA address for this part of the packet
14562306a36Sopenharmony_ci * addrHi:	hi bytes of DMA address for this part of the packet
14662306a36Sopenharmony_ci * processFlags: must be zero
14762306a36Sopenharmony_ci *
14862306a36Sopenharmony_ci * TYPHOON_DESC_VALID is not mentioned in their docs, but their Linux
14962306a36Sopenharmony_ci * driver uses it.
15062306a36Sopenharmony_ci */
15162306a36Sopenharmony_cistruct tx_desc {
15262306a36Sopenharmony_ci	u8  flags;
15362306a36Sopenharmony_ci#define TYPHOON_TYPE_MASK	0x07
15462306a36Sopenharmony_ci#define 	TYPHOON_FRAG_DESC	0x00
15562306a36Sopenharmony_ci#define 	TYPHOON_TX_DESC		0x01
15662306a36Sopenharmony_ci#define 	TYPHOON_CMD_DESC	0x02
15762306a36Sopenharmony_ci#define 	TYPHOON_OPT_DESC	0x03
15862306a36Sopenharmony_ci#define 	TYPHOON_RX_DESC		0x04
15962306a36Sopenharmony_ci#define 	TYPHOON_RESP_DESC	0x05
16062306a36Sopenharmony_ci#define TYPHOON_OPT_TYPE_MASK	0xf0
16162306a36Sopenharmony_ci#define 	TYPHOON_OPT_IPSEC	0x00
16262306a36Sopenharmony_ci#define 	TYPHOON_OPT_TCP_SEG	0x10
16362306a36Sopenharmony_ci#define TYPHOON_CMD_RESPOND	0x40
16462306a36Sopenharmony_ci#define TYPHOON_RESP_ERROR	0x40
16562306a36Sopenharmony_ci#define TYPHOON_RX_ERROR	0x40
16662306a36Sopenharmony_ci#define TYPHOON_DESC_VALID	0x80
16762306a36Sopenharmony_ci	u8  numDesc;
16862306a36Sopenharmony_ci	__le16 len;
16962306a36Sopenharmony_ci	union {
17062306a36Sopenharmony_ci		struct {
17162306a36Sopenharmony_ci			__le32 addr;
17262306a36Sopenharmony_ci			__le32 addrHi;
17362306a36Sopenharmony_ci		} frag;
17462306a36Sopenharmony_ci		u64 tx_addr;	/* opaque for hardware, for TX_DESC */
17562306a36Sopenharmony_ci	};
17662306a36Sopenharmony_ci	__le32 processFlags;
17762306a36Sopenharmony_ci#define TYPHOON_TX_PF_NO_CRC		cpu_to_le32(0x00000001)
17862306a36Sopenharmony_ci#define TYPHOON_TX_PF_IP_CHKSUM		cpu_to_le32(0x00000002)
17962306a36Sopenharmony_ci#define TYPHOON_TX_PF_TCP_CHKSUM	cpu_to_le32(0x00000004)
18062306a36Sopenharmony_ci#define TYPHOON_TX_PF_TCP_SEGMENT	cpu_to_le32(0x00000008)
18162306a36Sopenharmony_ci#define TYPHOON_TX_PF_INSERT_VLAN	cpu_to_le32(0x00000010)
18262306a36Sopenharmony_ci#define TYPHOON_TX_PF_IPSEC		cpu_to_le32(0x00000020)
18362306a36Sopenharmony_ci#define TYPHOON_TX_PF_VLAN_PRIORITY	cpu_to_le32(0x00000040)
18462306a36Sopenharmony_ci#define TYPHOON_TX_PF_UDP_CHKSUM	cpu_to_le32(0x00000080)
18562306a36Sopenharmony_ci#define TYPHOON_TX_PF_PAD_FRAME		cpu_to_le32(0x00000100)
18662306a36Sopenharmony_ci#define TYPHOON_TX_PF_RESERVED		cpu_to_le32(0x00000e00)
18762306a36Sopenharmony_ci#define TYPHOON_TX_PF_VLAN_MASK		cpu_to_le32(0x0ffff000)
18862306a36Sopenharmony_ci#define TYPHOON_TX_PF_INTERNAL		cpu_to_le32(0xf0000000)
18962306a36Sopenharmony_ci#define TYPHOON_TX_PF_VLAN_TAG_SHIFT	12
19062306a36Sopenharmony_ci} __packed;
19162306a36Sopenharmony_ci
19262306a36Sopenharmony_ci/* The TCP Segmentation offload option descriptor
19362306a36Sopenharmony_ci *
19462306a36Sopenharmony_ci * flags:	descriptor type
19562306a36Sopenharmony_ci * numDesc:	must be 1
19662306a36Sopenharmony_ci * mss_flags:	bits 0-11 (little endian) are MSS, 12 is first TSO descriptor
19762306a36Sopenharmony_ci *			13 is list TSO descriptor, set both if only one TSO
19862306a36Sopenharmony_ci * respAddrLo:	low bytes of address of the bytesTx field of this descriptor
19962306a36Sopenharmony_ci * bytesTx:	total number of bytes in this TSO request
20062306a36Sopenharmony_ci * status:	0 on completion
20162306a36Sopenharmony_ci */
20262306a36Sopenharmony_cistruct tcpopt_desc {
20362306a36Sopenharmony_ci	u8  flags;
20462306a36Sopenharmony_ci	u8  numDesc;
20562306a36Sopenharmony_ci	__le16 mss_flags;
20662306a36Sopenharmony_ci#define TYPHOON_TSO_FIRST		cpu_to_le16(0x1000)
20762306a36Sopenharmony_ci#define TYPHOON_TSO_LAST		cpu_to_le16(0x2000)
20862306a36Sopenharmony_ci	__le32 respAddrLo;
20962306a36Sopenharmony_ci	__le32 bytesTx;
21062306a36Sopenharmony_ci	__le32 status;
21162306a36Sopenharmony_ci} __packed;
21262306a36Sopenharmony_ci
21362306a36Sopenharmony_ci/* The IPSEC Offload descriptor
21462306a36Sopenharmony_ci *
21562306a36Sopenharmony_ci * flags:	descriptor type
21662306a36Sopenharmony_ci * numDesc:	must be 1
21762306a36Sopenharmony_ci * ipsecFlags:	bit 0: 0 -- generate IV, 1 -- use supplied IV
21862306a36Sopenharmony_ci * sa1, sa2:	Security Association IDs for this packet
21962306a36Sopenharmony_ci * reserved:	set to 0
22062306a36Sopenharmony_ci */
22162306a36Sopenharmony_cistruct ipsec_desc {
22262306a36Sopenharmony_ci	u8  flags;
22362306a36Sopenharmony_ci	u8  numDesc;
22462306a36Sopenharmony_ci	__le16 ipsecFlags;
22562306a36Sopenharmony_ci#define TYPHOON_IPSEC_GEN_IV	cpu_to_le16(0x0000)
22662306a36Sopenharmony_ci#define TYPHOON_IPSEC_USE_IV	cpu_to_le16(0x0001)
22762306a36Sopenharmony_ci	__le32 sa1;
22862306a36Sopenharmony_ci	__le32 sa2;
22962306a36Sopenharmony_ci	__le32 reserved;
23062306a36Sopenharmony_ci} __packed;
23162306a36Sopenharmony_ci
23262306a36Sopenharmony_ci/* The Typhoon receive descriptor (Updated by NIC)
23362306a36Sopenharmony_ci *
23462306a36Sopenharmony_ci * flags:         Descriptor type, error indication
23562306a36Sopenharmony_ci * numDesc:       Always zero
23662306a36Sopenharmony_ci * frameLen:      the size of the packet received
23762306a36Sopenharmony_ci * addr:          low 32 bytes of the virtual addr passed in for this buffer
23862306a36Sopenharmony_ci * addrHi:        high 32 bytes of the virtual addr passed in for this buffer
23962306a36Sopenharmony_ci * rxStatus:      Error if set in flags, otherwise result of offload processing
24062306a36Sopenharmony_ci * filterResults: results of filtering on packet, not used
24162306a36Sopenharmony_ci * ipsecResults:  Results of IPSEC processing
24262306a36Sopenharmony_ci * vlanTag:       the 801.2q TCI from the packet
24362306a36Sopenharmony_ci */
24462306a36Sopenharmony_cistruct rx_desc {
24562306a36Sopenharmony_ci	u8  flags;
24662306a36Sopenharmony_ci	u8  numDesc;
24762306a36Sopenharmony_ci	__le16 frameLen;
24862306a36Sopenharmony_ci	u32 addr;	/* opaque, comes from virtAddr */
24962306a36Sopenharmony_ci	u32 addrHi;	/* opaque, comes from virtAddrHi */
25062306a36Sopenharmony_ci	__le32 rxStatus;
25162306a36Sopenharmony_ci#define TYPHOON_RX_ERR_INTERNAL		cpu_to_le32(0x00000000)
25262306a36Sopenharmony_ci#define TYPHOON_RX_ERR_FIFO_UNDERRUN	cpu_to_le32(0x00000001)
25362306a36Sopenharmony_ci#define TYPHOON_RX_ERR_BAD_SSD		cpu_to_le32(0x00000002)
25462306a36Sopenharmony_ci#define TYPHOON_RX_ERR_RUNT		cpu_to_le32(0x00000003)
25562306a36Sopenharmony_ci#define TYPHOON_RX_ERR_CRC		cpu_to_le32(0x00000004)
25662306a36Sopenharmony_ci#define TYPHOON_RX_ERR_OVERSIZE		cpu_to_le32(0x00000005)
25762306a36Sopenharmony_ci#define TYPHOON_RX_ERR_ALIGN		cpu_to_le32(0x00000006)
25862306a36Sopenharmony_ci#define TYPHOON_RX_ERR_DRIBBLE		cpu_to_le32(0x00000007)
25962306a36Sopenharmony_ci#define TYPHOON_RX_PROTO_MASK		cpu_to_le32(0x00000003)
26062306a36Sopenharmony_ci#define TYPHOON_RX_PROTO_UNKNOWN	cpu_to_le32(0x00000000)
26162306a36Sopenharmony_ci#define TYPHOON_RX_PROTO_IP		cpu_to_le32(0x00000001)
26262306a36Sopenharmony_ci#define TYPHOON_RX_PROTO_IPX		cpu_to_le32(0x00000002)
26362306a36Sopenharmony_ci#define TYPHOON_RX_VLAN			cpu_to_le32(0x00000004)
26462306a36Sopenharmony_ci#define TYPHOON_RX_IP_FRAG		cpu_to_le32(0x00000008)
26562306a36Sopenharmony_ci#define TYPHOON_RX_IPSEC		cpu_to_le32(0x00000010)
26662306a36Sopenharmony_ci#define TYPHOON_RX_IP_CHK_FAIL		cpu_to_le32(0x00000020)
26762306a36Sopenharmony_ci#define TYPHOON_RX_TCP_CHK_FAIL		cpu_to_le32(0x00000040)
26862306a36Sopenharmony_ci#define TYPHOON_RX_UDP_CHK_FAIL		cpu_to_le32(0x00000080)
26962306a36Sopenharmony_ci#define TYPHOON_RX_IP_CHK_GOOD		cpu_to_le32(0x00000100)
27062306a36Sopenharmony_ci#define TYPHOON_RX_TCP_CHK_GOOD		cpu_to_le32(0x00000200)
27162306a36Sopenharmony_ci#define TYPHOON_RX_UDP_CHK_GOOD		cpu_to_le32(0x00000400)
27262306a36Sopenharmony_ci	__le16 filterResults;
27362306a36Sopenharmony_ci#define TYPHOON_RX_FILTER_MASK		cpu_to_le16(0x7fff)
27462306a36Sopenharmony_ci#define TYPHOON_RX_FILTERED		cpu_to_le16(0x8000)
27562306a36Sopenharmony_ci	__le16 ipsecResults;
27662306a36Sopenharmony_ci#define TYPHOON_RX_OUTER_AH_GOOD	cpu_to_le16(0x0001)
27762306a36Sopenharmony_ci#define TYPHOON_RX_OUTER_ESP_GOOD	cpu_to_le16(0x0002)
27862306a36Sopenharmony_ci#define TYPHOON_RX_INNER_AH_GOOD	cpu_to_le16(0x0004)
27962306a36Sopenharmony_ci#define TYPHOON_RX_INNER_ESP_GOOD	cpu_to_le16(0x0008)
28062306a36Sopenharmony_ci#define TYPHOON_RX_OUTER_AH_FAIL	cpu_to_le16(0x0010)
28162306a36Sopenharmony_ci#define TYPHOON_RX_OUTER_ESP_FAIL	cpu_to_le16(0x0020)
28262306a36Sopenharmony_ci#define TYPHOON_RX_INNER_AH_FAIL	cpu_to_le16(0x0040)
28362306a36Sopenharmony_ci#define TYPHOON_RX_INNER_ESP_FAIL	cpu_to_le16(0x0080)
28462306a36Sopenharmony_ci#define TYPHOON_RX_UNKNOWN_SA		cpu_to_le16(0x0100)
28562306a36Sopenharmony_ci#define TYPHOON_RX_ESP_FORMAT_ERR	cpu_to_le16(0x0200)
28662306a36Sopenharmony_ci	__be32 vlanTag;
28762306a36Sopenharmony_ci} __packed;
28862306a36Sopenharmony_ci
28962306a36Sopenharmony_ci/* The Typhoon free buffer descriptor, used to give a buffer to the NIC
29062306a36Sopenharmony_ci *
29162306a36Sopenharmony_ci * physAddr:    low 32 bits of the bus address of the buffer
29262306a36Sopenharmony_ci * physAddrHi:  high 32 bits of the bus address of the buffer, always zero
29362306a36Sopenharmony_ci * virtAddr:    low 32 bits of the skb address
29462306a36Sopenharmony_ci * virtAddrHi:  high 32 bits of the skb address, always zero
29562306a36Sopenharmony_ci *
29662306a36Sopenharmony_ci * the virt* address is basically two 32 bit cookies, just passed back
29762306a36Sopenharmony_ci * from the NIC
29862306a36Sopenharmony_ci */
29962306a36Sopenharmony_cistruct rx_free {
30062306a36Sopenharmony_ci	__le32 physAddr;
30162306a36Sopenharmony_ci	__le32 physAddrHi;
30262306a36Sopenharmony_ci	u32 virtAddr;
30362306a36Sopenharmony_ci	u32 virtAddrHi;
30462306a36Sopenharmony_ci} __packed;
30562306a36Sopenharmony_ci
30662306a36Sopenharmony_ci/* The Typhoon command descriptor, used for commands and responses
30762306a36Sopenharmony_ci *
30862306a36Sopenharmony_ci * flags:   descriptor type
30962306a36Sopenharmony_ci * numDesc: number of descriptors following in this command/response,
31062306a36Sopenharmony_ci *				ie, zero for a one descriptor command
31162306a36Sopenharmony_ci * cmd:     the command
31262306a36Sopenharmony_ci * seqNo:   sequence number (unused)
31362306a36Sopenharmony_ci * parm1:   use varies by command
31462306a36Sopenharmony_ci * parm2:   use varies by command
31562306a36Sopenharmony_ci * parm3:   use varies by command
31662306a36Sopenharmony_ci */
31762306a36Sopenharmony_cistruct cmd_desc {
31862306a36Sopenharmony_ci	u8  flags;
31962306a36Sopenharmony_ci	u8  numDesc;
32062306a36Sopenharmony_ci	__le16 cmd;
32162306a36Sopenharmony_ci#define TYPHOON_CMD_TX_ENABLE		cpu_to_le16(0x0001)
32262306a36Sopenharmony_ci#define TYPHOON_CMD_TX_DISABLE		cpu_to_le16(0x0002)
32362306a36Sopenharmony_ci#define TYPHOON_CMD_RX_ENABLE		cpu_to_le16(0x0003)
32462306a36Sopenharmony_ci#define TYPHOON_CMD_RX_DISABLE		cpu_to_le16(0x0004)
32562306a36Sopenharmony_ci#define TYPHOON_CMD_SET_RX_FILTER	cpu_to_le16(0x0005)
32662306a36Sopenharmony_ci#define TYPHOON_CMD_READ_STATS		cpu_to_le16(0x0007)
32762306a36Sopenharmony_ci#define TYPHOON_CMD_XCVR_SELECT		cpu_to_le16(0x0013)
32862306a36Sopenharmony_ci#define TYPHOON_CMD_SET_MAX_PKT_SIZE	cpu_to_le16(0x001a)
32962306a36Sopenharmony_ci#define TYPHOON_CMD_READ_MEDIA_STATUS	cpu_to_le16(0x001b)
33062306a36Sopenharmony_ci#define TYPHOON_CMD_GOTO_SLEEP		cpu_to_le16(0x0023)
33162306a36Sopenharmony_ci#define TYPHOON_CMD_SET_MULTICAST_HASH	cpu_to_le16(0x0025)
33262306a36Sopenharmony_ci#define TYPHOON_CMD_SET_MAC_ADDRESS	cpu_to_le16(0x0026)
33362306a36Sopenharmony_ci#define TYPHOON_CMD_READ_MAC_ADDRESS	cpu_to_le16(0x0027)
33462306a36Sopenharmony_ci#define TYPHOON_CMD_VLAN_TYPE_WRITE	cpu_to_le16(0x002b)
33562306a36Sopenharmony_ci#define TYPHOON_CMD_CREATE_SA		cpu_to_le16(0x0034)
33662306a36Sopenharmony_ci#define TYPHOON_CMD_DELETE_SA		cpu_to_le16(0x0035)
33762306a36Sopenharmony_ci#define TYPHOON_CMD_READ_VERSIONS	cpu_to_le16(0x0043)
33862306a36Sopenharmony_ci#define TYPHOON_CMD_IRQ_COALESCE_CTRL	cpu_to_le16(0x0045)
33962306a36Sopenharmony_ci#define TYPHOON_CMD_ENABLE_WAKE_EVENTS	cpu_to_le16(0x0049)
34062306a36Sopenharmony_ci#define TYPHOON_CMD_SET_OFFLOAD_TASKS	cpu_to_le16(0x004f)
34162306a36Sopenharmony_ci#define TYPHOON_CMD_HELLO_RESP		cpu_to_le16(0x0057)
34262306a36Sopenharmony_ci#define TYPHOON_CMD_HALT		cpu_to_le16(0x005d)
34362306a36Sopenharmony_ci#define TYPHOON_CMD_READ_IPSEC_INFO	cpu_to_le16(0x005e)
34462306a36Sopenharmony_ci#define TYPHOON_CMD_GET_IPSEC_ENABLE	cpu_to_le16(0x0067)
34562306a36Sopenharmony_ci#define TYPHOON_CMD_GET_CMD_LVL		cpu_to_le16(0x0069)
34662306a36Sopenharmony_ci	u16 seqNo;
34762306a36Sopenharmony_ci	__le16 parm1;
34862306a36Sopenharmony_ci	__le32 parm2;
34962306a36Sopenharmony_ci	__le32 parm3;
35062306a36Sopenharmony_ci} __packed;
35162306a36Sopenharmony_ci
35262306a36Sopenharmony_ci/* The Typhoon response descriptor, see command descriptor for details
35362306a36Sopenharmony_ci */
35462306a36Sopenharmony_cistruct resp_desc {
35562306a36Sopenharmony_ci	u8  flags;
35662306a36Sopenharmony_ci	u8  numDesc;
35762306a36Sopenharmony_ci	__le16 cmd;
35862306a36Sopenharmony_ci	__le16 seqNo;
35962306a36Sopenharmony_ci	__le16 parm1;
36062306a36Sopenharmony_ci	__le32 parm2;
36162306a36Sopenharmony_ci	__le32 parm3;
36262306a36Sopenharmony_ci} __packed;
36362306a36Sopenharmony_ci
36462306a36Sopenharmony_ci#define INIT_COMMAND_NO_RESPONSE(x, command)				\
36562306a36Sopenharmony_ci	do { struct cmd_desc *_ptr = (x);				\
36662306a36Sopenharmony_ci		memset(_ptr, 0, sizeof(struct cmd_desc));		\
36762306a36Sopenharmony_ci		_ptr->flags = TYPHOON_CMD_DESC | TYPHOON_DESC_VALID;	\
36862306a36Sopenharmony_ci		_ptr->cmd = command;					\
36962306a36Sopenharmony_ci	} while (0)
37062306a36Sopenharmony_ci
37162306a36Sopenharmony_ci/* We set seqNo to 1 if we're expecting a response from this command */
37262306a36Sopenharmony_ci#define INIT_COMMAND_WITH_RESPONSE(x, command)				\
37362306a36Sopenharmony_ci	do { struct cmd_desc *_ptr = (x);				\
37462306a36Sopenharmony_ci		memset(_ptr, 0, sizeof(struct cmd_desc));		\
37562306a36Sopenharmony_ci		_ptr->flags = TYPHOON_CMD_RESPOND | TYPHOON_CMD_DESC;	\
37662306a36Sopenharmony_ci		_ptr->flags |= TYPHOON_DESC_VALID; 			\
37762306a36Sopenharmony_ci		_ptr->cmd = command;					\
37862306a36Sopenharmony_ci		_ptr->seqNo = 1;					\
37962306a36Sopenharmony_ci	} while (0)
38062306a36Sopenharmony_ci
38162306a36Sopenharmony_ci/* TYPHOON_CMD_SET_RX_FILTER filter bits (cmd.parm1)
38262306a36Sopenharmony_ci */
38362306a36Sopenharmony_ci#define TYPHOON_RX_FILTER_DIRECTED	cpu_to_le16(0x0001)
38462306a36Sopenharmony_ci#define TYPHOON_RX_FILTER_ALL_MCAST	cpu_to_le16(0x0002)
38562306a36Sopenharmony_ci#define TYPHOON_RX_FILTER_BROADCAST	cpu_to_le16(0x0004)
38662306a36Sopenharmony_ci#define TYPHOON_RX_FILTER_PROMISCOUS	cpu_to_le16(0x0008)
38762306a36Sopenharmony_ci#define TYPHOON_RX_FILTER_MCAST_HASH	cpu_to_le16(0x0010)
38862306a36Sopenharmony_ci
38962306a36Sopenharmony_ci/* TYPHOON_CMD_READ_STATS response format
39062306a36Sopenharmony_ci */
39162306a36Sopenharmony_cistruct stats_resp {
39262306a36Sopenharmony_ci	u8  flags;
39362306a36Sopenharmony_ci	u8  numDesc;
39462306a36Sopenharmony_ci	__le16 cmd;
39562306a36Sopenharmony_ci	__le16 seqNo;
39662306a36Sopenharmony_ci	__le16 unused;
39762306a36Sopenharmony_ci	__le32 txPackets;
39862306a36Sopenharmony_ci	__le64 txBytes;
39962306a36Sopenharmony_ci	__le32 txDeferred;
40062306a36Sopenharmony_ci	__le32 txLateCollisions;
40162306a36Sopenharmony_ci	__le32 txCollisions;
40262306a36Sopenharmony_ci	__le32 txCarrierLost;
40362306a36Sopenharmony_ci	__le32 txMultipleCollisions;
40462306a36Sopenharmony_ci	__le32 txExcessiveCollisions;
40562306a36Sopenharmony_ci	__le32 txFifoUnderruns;
40662306a36Sopenharmony_ci	__le32 txMulticastTxOverflows;
40762306a36Sopenharmony_ci	__le32 txFiltered;
40862306a36Sopenharmony_ci	__le32 rxPacketsGood;
40962306a36Sopenharmony_ci	__le64 rxBytesGood;
41062306a36Sopenharmony_ci	__le32 rxFifoOverruns;
41162306a36Sopenharmony_ci	__le32 BadSSD;
41262306a36Sopenharmony_ci	__le32 rxCrcErrors;
41362306a36Sopenharmony_ci	__le32 rxOversized;
41462306a36Sopenharmony_ci	__le32 rxBroadcast;
41562306a36Sopenharmony_ci	__le32 rxMulticast;
41662306a36Sopenharmony_ci	__le32 rxOverflow;
41762306a36Sopenharmony_ci	__le32 rxFiltered;
41862306a36Sopenharmony_ci	__le32 linkStatus;
41962306a36Sopenharmony_ci#define TYPHOON_LINK_STAT_MASK		cpu_to_le32(0x00000001)
42062306a36Sopenharmony_ci#define TYPHOON_LINK_GOOD		cpu_to_le32(0x00000001)
42162306a36Sopenharmony_ci#define TYPHOON_LINK_BAD		cpu_to_le32(0x00000000)
42262306a36Sopenharmony_ci#define TYPHOON_LINK_SPEED_MASK		cpu_to_le32(0x00000002)
42362306a36Sopenharmony_ci#define TYPHOON_LINK_100MBPS		cpu_to_le32(0x00000002)
42462306a36Sopenharmony_ci#define TYPHOON_LINK_10MBPS		cpu_to_le32(0x00000000)
42562306a36Sopenharmony_ci#define TYPHOON_LINK_DUPLEX_MASK	cpu_to_le32(0x00000004)
42662306a36Sopenharmony_ci#define TYPHOON_LINK_FULL_DUPLEX	cpu_to_le32(0x00000004)
42762306a36Sopenharmony_ci#define TYPHOON_LINK_HALF_DUPLEX	cpu_to_le32(0x00000000)
42862306a36Sopenharmony_ci	__le32 unused2;
42962306a36Sopenharmony_ci	__le32 unused3;
43062306a36Sopenharmony_ci} __packed;
43162306a36Sopenharmony_ci
43262306a36Sopenharmony_ci/* TYPHOON_CMD_XCVR_SELECT xcvr values (resp.parm1)
43362306a36Sopenharmony_ci */
43462306a36Sopenharmony_ci#define TYPHOON_XCVR_10HALF	cpu_to_le16(0x0000)
43562306a36Sopenharmony_ci#define TYPHOON_XCVR_10FULL	cpu_to_le16(0x0001)
43662306a36Sopenharmony_ci#define TYPHOON_XCVR_100HALF	cpu_to_le16(0x0002)
43762306a36Sopenharmony_ci#define TYPHOON_XCVR_100FULL	cpu_to_le16(0x0003)
43862306a36Sopenharmony_ci#define TYPHOON_XCVR_AUTONEG	cpu_to_le16(0x0004)
43962306a36Sopenharmony_ci
44062306a36Sopenharmony_ci/* TYPHOON_CMD_READ_MEDIA_STATUS (resp.parm1)
44162306a36Sopenharmony_ci */
44262306a36Sopenharmony_ci#define TYPHOON_MEDIA_STAT_CRC_STRIP_DISABLE	cpu_to_le16(0x0004)
44362306a36Sopenharmony_ci#define TYPHOON_MEDIA_STAT_COLLISION_DETECT	cpu_to_le16(0x0010)
44462306a36Sopenharmony_ci#define TYPHOON_MEDIA_STAT_CARRIER_SENSE	cpu_to_le16(0x0020)
44562306a36Sopenharmony_ci#define TYPHOON_MEDIA_STAT_POLARITY_REV		cpu_to_le16(0x0400)
44662306a36Sopenharmony_ci#define TYPHOON_MEDIA_STAT_NO_LINK		cpu_to_le16(0x0800)
44762306a36Sopenharmony_ci
44862306a36Sopenharmony_ci/* TYPHOON_CMD_SET_MULTICAST_HASH enable values (cmd.parm1)
44962306a36Sopenharmony_ci */
45062306a36Sopenharmony_ci#define TYPHOON_MCAST_HASH_DISABLE	cpu_to_le16(0x0000)
45162306a36Sopenharmony_ci#define TYPHOON_MCAST_HASH_ENABLE	cpu_to_le16(0x0001)
45262306a36Sopenharmony_ci#define TYPHOON_MCAST_HASH_SET		cpu_to_le16(0x0002)
45362306a36Sopenharmony_ci
45462306a36Sopenharmony_ci/* TYPHOON_CMD_CREATE_SA descriptor and settings
45562306a36Sopenharmony_ci */
45662306a36Sopenharmony_cistruct sa_descriptor {
45762306a36Sopenharmony_ci	u8  flags;
45862306a36Sopenharmony_ci	u8  numDesc;
45962306a36Sopenharmony_ci	u16 cmd;
46062306a36Sopenharmony_ci	u16 seqNo;
46162306a36Sopenharmony_ci	u16 mode;
46262306a36Sopenharmony_ci#define TYPHOON_SA_MODE_NULL		cpu_to_le16(0x0000)
46362306a36Sopenharmony_ci#define TYPHOON_SA_MODE_AH		cpu_to_le16(0x0001)
46462306a36Sopenharmony_ci#define TYPHOON_SA_MODE_ESP		cpu_to_le16(0x0002)
46562306a36Sopenharmony_ci	u8  hashFlags;
46662306a36Sopenharmony_ci#define TYPHOON_SA_HASH_ENABLE		0x01
46762306a36Sopenharmony_ci#define TYPHOON_SA_HASH_SHA1		0x02
46862306a36Sopenharmony_ci#define TYPHOON_SA_HASH_MD5		0x04
46962306a36Sopenharmony_ci	u8  direction;
47062306a36Sopenharmony_ci#define TYPHOON_SA_DIR_RX		0x00
47162306a36Sopenharmony_ci#define TYPHOON_SA_DIR_TX		0x01
47262306a36Sopenharmony_ci	u8  encryptionFlags;
47362306a36Sopenharmony_ci#define TYPHOON_SA_ENCRYPT_ENABLE	0x01
47462306a36Sopenharmony_ci#define TYPHOON_SA_ENCRYPT_DES		0x02
47562306a36Sopenharmony_ci#define TYPHOON_SA_ENCRYPT_3DES		0x00
47662306a36Sopenharmony_ci#define TYPHOON_SA_ENCRYPT_3DES_2KEY	0x00
47762306a36Sopenharmony_ci#define TYPHOON_SA_ENCRYPT_3DES_3KEY	0x04
47862306a36Sopenharmony_ci#define TYPHOON_SA_ENCRYPT_CBC		0x08
47962306a36Sopenharmony_ci#define TYPHOON_SA_ENCRYPT_ECB		0x00
48062306a36Sopenharmony_ci	u8  specifyIndex;
48162306a36Sopenharmony_ci#define TYPHOON_SA_SPECIFY_INDEX	0x01
48262306a36Sopenharmony_ci#define TYPHOON_SA_GENERATE_INDEX	0x00
48362306a36Sopenharmony_ci	u32 SPI;
48462306a36Sopenharmony_ci	u32 destAddr;
48562306a36Sopenharmony_ci	u32 destMask;
48662306a36Sopenharmony_ci	u8  integKey[20];
48762306a36Sopenharmony_ci	u8  confKey[24];
48862306a36Sopenharmony_ci	u32 index;
48962306a36Sopenharmony_ci	u32 unused;
49062306a36Sopenharmony_ci	u32 unused2;
49162306a36Sopenharmony_ci} __packed;
49262306a36Sopenharmony_ci
49362306a36Sopenharmony_ci/* TYPHOON_CMD_SET_OFFLOAD_TASKS bits (cmd.parm2 (Tx) & cmd.parm3 (Rx))
49462306a36Sopenharmony_ci * This is all for IPv4.
49562306a36Sopenharmony_ci */
49662306a36Sopenharmony_ci#define TYPHOON_OFFLOAD_TCP_CHKSUM	cpu_to_le32(0x00000002)
49762306a36Sopenharmony_ci#define TYPHOON_OFFLOAD_UDP_CHKSUM	cpu_to_le32(0x00000004)
49862306a36Sopenharmony_ci#define TYPHOON_OFFLOAD_IP_CHKSUM	cpu_to_le32(0x00000008)
49962306a36Sopenharmony_ci#define TYPHOON_OFFLOAD_IPSEC		cpu_to_le32(0x00000010)
50062306a36Sopenharmony_ci#define TYPHOON_OFFLOAD_BCAST_THROTTLE	cpu_to_le32(0x00000020)
50162306a36Sopenharmony_ci#define TYPHOON_OFFLOAD_DHCP_PREVENT	cpu_to_le32(0x00000040)
50262306a36Sopenharmony_ci#define TYPHOON_OFFLOAD_VLAN		cpu_to_le32(0x00000080)
50362306a36Sopenharmony_ci#define TYPHOON_OFFLOAD_FILTERING	cpu_to_le32(0x00000100)
50462306a36Sopenharmony_ci#define TYPHOON_OFFLOAD_TCP_SEGMENT	cpu_to_le32(0x00000200)
50562306a36Sopenharmony_ci
50662306a36Sopenharmony_ci/* TYPHOON_CMD_ENABLE_WAKE_EVENTS bits (cmd.parm1)
50762306a36Sopenharmony_ci */
50862306a36Sopenharmony_ci#define TYPHOON_WAKE_MAGIC_PKT		cpu_to_le16(0x01)
50962306a36Sopenharmony_ci#define TYPHOON_WAKE_LINK_EVENT		cpu_to_le16(0x02)
51062306a36Sopenharmony_ci#define TYPHOON_WAKE_ICMP_ECHO		cpu_to_le16(0x04)
51162306a36Sopenharmony_ci#define TYPHOON_WAKE_ARP		cpu_to_le16(0x08)
51262306a36Sopenharmony_ci
51362306a36Sopenharmony_ci/* These are used to load the firmware image on the NIC
51462306a36Sopenharmony_ci */
51562306a36Sopenharmony_cistruct typhoon_file_header {
51662306a36Sopenharmony_ci	u8  tag[8];
51762306a36Sopenharmony_ci	__le32 version;
51862306a36Sopenharmony_ci	__le32 numSections;
51962306a36Sopenharmony_ci	__le32 startAddr;
52062306a36Sopenharmony_ci	__le32 hmacDigest[5];
52162306a36Sopenharmony_ci} __packed;
52262306a36Sopenharmony_ci
52362306a36Sopenharmony_cistruct typhoon_section_header {
52462306a36Sopenharmony_ci	__le32 len;
52562306a36Sopenharmony_ci	u16 checksum;
52662306a36Sopenharmony_ci	u16 reserved;
52762306a36Sopenharmony_ci	__le32 startAddr;
52862306a36Sopenharmony_ci} __packed;
52962306a36Sopenharmony_ci
53062306a36Sopenharmony_ci/* The Typhoon Register offsets
53162306a36Sopenharmony_ci */
53262306a36Sopenharmony_ci#define TYPHOON_REG_SOFT_RESET			0x00
53362306a36Sopenharmony_ci#define TYPHOON_REG_INTR_STATUS			0x04
53462306a36Sopenharmony_ci#define TYPHOON_REG_INTR_ENABLE			0x08
53562306a36Sopenharmony_ci#define TYPHOON_REG_INTR_MASK			0x0c
53662306a36Sopenharmony_ci#define TYPHOON_REG_SELF_INTERRUPT		0x10
53762306a36Sopenharmony_ci#define TYPHOON_REG_HOST2ARM7			0x14
53862306a36Sopenharmony_ci#define TYPHOON_REG_HOST2ARM6			0x18
53962306a36Sopenharmony_ci#define TYPHOON_REG_HOST2ARM5			0x1c
54062306a36Sopenharmony_ci#define TYPHOON_REG_HOST2ARM4			0x20
54162306a36Sopenharmony_ci#define TYPHOON_REG_HOST2ARM3			0x24
54262306a36Sopenharmony_ci#define TYPHOON_REG_HOST2ARM2			0x28
54362306a36Sopenharmony_ci#define TYPHOON_REG_HOST2ARM1			0x2c
54462306a36Sopenharmony_ci#define TYPHOON_REG_HOST2ARM0			0x30
54562306a36Sopenharmony_ci#define TYPHOON_REG_ARM2HOST3			0x34
54662306a36Sopenharmony_ci#define TYPHOON_REG_ARM2HOST2			0x38
54762306a36Sopenharmony_ci#define TYPHOON_REG_ARM2HOST1			0x3c
54862306a36Sopenharmony_ci#define TYPHOON_REG_ARM2HOST0			0x40
54962306a36Sopenharmony_ci
55062306a36Sopenharmony_ci#define TYPHOON_REG_BOOT_DATA_LO		TYPHOON_REG_HOST2ARM5
55162306a36Sopenharmony_ci#define TYPHOON_REG_BOOT_DATA_HI		TYPHOON_REG_HOST2ARM4
55262306a36Sopenharmony_ci#define TYPHOON_REG_BOOT_DEST_ADDR		TYPHOON_REG_HOST2ARM3
55362306a36Sopenharmony_ci#define TYPHOON_REG_BOOT_CHECKSUM		TYPHOON_REG_HOST2ARM2
55462306a36Sopenharmony_ci#define TYPHOON_REG_BOOT_LENGTH			TYPHOON_REG_HOST2ARM1
55562306a36Sopenharmony_ci
55662306a36Sopenharmony_ci#define TYPHOON_REG_DOWNLOAD_BOOT_ADDR		TYPHOON_REG_HOST2ARM1
55762306a36Sopenharmony_ci#define TYPHOON_REG_DOWNLOAD_HMAC_0		TYPHOON_REG_HOST2ARM2
55862306a36Sopenharmony_ci#define TYPHOON_REG_DOWNLOAD_HMAC_1		TYPHOON_REG_HOST2ARM3
55962306a36Sopenharmony_ci#define TYPHOON_REG_DOWNLOAD_HMAC_2		TYPHOON_REG_HOST2ARM4
56062306a36Sopenharmony_ci#define TYPHOON_REG_DOWNLOAD_HMAC_3		TYPHOON_REG_HOST2ARM5
56162306a36Sopenharmony_ci#define TYPHOON_REG_DOWNLOAD_HMAC_4		TYPHOON_REG_HOST2ARM6
56262306a36Sopenharmony_ci
56362306a36Sopenharmony_ci#define TYPHOON_REG_BOOT_RECORD_ADDR_HI		TYPHOON_REG_HOST2ARM2
56462306a36Sopenharmony_ci#define TYPHOON_REG_BOOT_RECORD_ADDR_LO		TYPHOON_REG_HOST2ARM1
56562306a36Sopenharmony_ci
56662306a36Sopenharmony_ci#define TYPHOON_REG_TX_LO_READY			TYPHOON_REG_HOST2ARM3
56762306a36Sopenharmony_ci#define TYPHOON_REG_CMD_READY			TYPHOON_REG_HOST2ARM2
56862306a36Sopenharmony_ci#define TYPHOON_REG_TX_HI_READY			TYPHOON_REG_HOST2ARM1
56962306a36Sopenharmony_ci
57062306a36Sopenharmony_ci#define TYPHOON_REG_COMMAND			TYPHOON_REG_HOST2ARM0
57162306a36Sopenharmony_ci#define TYPHOON_REG_HEARTBEAT			TYPHOON_REG_ARM2HOST3
57262306a36Sopenharmony_ci#define TYPHOON_REG_STATUS			TYPHOON_REG_ARM2HOST0
57362306a36Sopenharmony_ci
57462306a36Sopenharmony_ci/* 3XP Reset values (TYPHOON_REG_SOFT_RESET)
57562306a36Sopenharmony_ci */
57662306a36Sopenharmony_ci#define TYPHOON_RESET_ALL	0x7f
57762306a36Sopenharmony_ci#define TYPHOON_RESET_NONE	0x00
57862306a36Sopenharmony_ci
57962306a36Sopenharmony_ci/* 3XP irq bits (TYPHOON_REG_INTR{STATUS,ENABLE,MASK})
58062306a36Sopenharmony_ci *
58162306a36Sopenharmony_ci * Some of these came from OpenBSD, as the 3Com docs have it wrong
58262306a36Sopenharmony_ci * (INTR_SELF) or don't list it at all (INTR_*_ABORT)
58362306a36Sopenharmony_ci *
58462306a36Sopenharmony_ci * Enabling irqs on the Heartbeat reg (ArmToHost3) gets you an irq
58562306a36Sopenharmony_ci * about every 8ms, so don't do it.
58662306a36Sopenharmony_ci */
58762306a36Sopenharmony_ci#define TYPHOON_INTR_HOST_INT		0x00000001
58862306a36Sopenharmony_ci#define TYPHOON_INTR_ARM2HOST0		0x00000002
58962306a36Sopenharmony_ci#define TYPHOON_INTR_ARM2HOST1		0x00000004
59062306a36Sopenharmony_ci#define TYPHOON_INTR_ARM2HOST2		0x00000008
59162306a36Sopenharmony_ci#define TYPHOON_INTR_ARM2HOST3		0x00000010
59262306a36Sopenharmony_ci#define TYPHOON_INTR_DMA0		0x00000020
59362306a36Sopenharmony_ci#define TYPHOON_INTR_DMA1		0x00000040
59462306a36Sopenharmony_ci#define TYPHOON_INTR_DMA2		0x00000080
59562306a36Sopenharmony_ci#define TYPHOON_INTR_DMA3		0x00000100
59662306a36Sopenharmony_ci#define TYPHOON_INTR_MASTER_ABORT	0x00000200
59762306a36Sopenharmony_ci#define TYPHOON_INTR_TARGET_ABORT	0x00000400
59862306a36Sopenharmony_ci#define TYPHOON_INTR_SELF		0x00000800
59962306a36Sopenharmony_ci#define TYPHOON_INTR_RESERVED		0xfffff000
60062306a36Sopenharmony_ci
60162306a36Sopenharmony_ci#define TYPHOON_INTR_BOOTCMD		TYPHOON_INTR_ARM2HOST0
60262306a36Sopenharmony_ci
60362306a36Sopenharmony_ci#define TYPHOON_INTR_ENABLE_ALL		0xffffffef
60462306a36Sopenharmony_ci#define TYPHOON_INTR_ALL		0xffffffff
60562306a36Sopenharmony_ci#define TYPHOON_INTR_NONE		0x00000000
60662306a36Sopenharmony_ci
60762306a36Sopenharmony_ci/* The commands for the 3XP chip (TYPHOON_REG_COMMAND)
60862306a36Sopenharmony_ci */
60962306a36Sopenharmony_ci#define TYPHOON_BOOTCMD_BOOT			0x00
61062306a36Sopenharmony_ci#define TYPHOON_BOOTCMD_WAKEUP			0xfa
61162306a36Sopenharmony_ci#define TYPHOON_BOOTCMD_DNLD_COMPLETE		0xfb
61262306a36Sopenharmony_ci#define TYPHOON_BOOTCMD_SEG_AVAILABLE		0xfc
61362306a36Sopenharmony_ci#define TYPHOON_BOOTCMD_RUNTIME_IMAGE		0xfd
61462306a36Sopenharmony_ci#define TYPHOON_BOOTCMD_REG_BOOT_RECORD		0xff
61562306a36Sopenharmony_ci
61662306a36Sopenharmony_ci/* 3XP Status values (TYPHOON_REG_STATUS)
61762306a36Sopenharmony_ci */
61862306a36Sopenharmony_ci#define TYPHOON_STATUS_WAITING_FOR_BOOT		0x07
61962306a36Sopenharmony_ci#define TYPHOON_STATUS_SECOND_INIT		0x08
62062306a36Sopenharmony_ci#define TYPHOON_STATUS_RUNNING			0x09
62162306a36Sopenharmony_ci#define TYPHOON_STATUS_WAITING_FOR_HOST		0x0d
62262306a36Sopenharmony_ci#define TYPHOON_STATUS_WAITING_FOR_SEGMENT	0x10
62362306a36Sopenharmony_ci#define TYPHOON_STATUS_SLEEPING			0x11
62462306a36Sopenharmony_ci#define TYPHOON_STATUS_HALTED			0x14
625