xref: /freebsd/sys/dev/bge/if_bgereg.h (revision 21c9e4077af2422dc842c9caa7d1045d65cfb4c9)
1098ca2bdSWarner Losh /*-
295d67482SBill Paul  * Copyright (c) 2001 Wind River Systems
395d67482SBill Paul  * Copyright (c) 1997, 1998, 1999, 2001
495d67482SBill Paul  *	Bill Paul <wpaul@windriver.com>.  All rights reserved.
595d67482SBill Paul  *
695d67482SBill Paul  * Redistribution and use in source and binary forms, with or without
795d67482SBill Paul  * modification, are permitted provided that the following conditions
895d67482SBill Paul  * are met:
995d67482SBill Paul  * 1. Redistributions of source code must retain the above copyright
1095d67482SBill Paul  *    notice, this list of conditions and the following disclaimer.
1195d67482SBill Paul  * 2. Redistributions in binary form must reproduce the above copyright
1295d67482SBill Paul  *    notice, this list of conditions and the following disclaimer in the
1395d67482SBill Paul  *    documentation and/or other materials provided with the distribution.
1495d67482SBill Paul  * 3. All advertising materials mentioning features or use of this software
1595d67482SBill Paul  *    must display the following acknowledgement:
1695d67482SBill Paul  *	This product includes software developed by Bill Paul.
1795d67482SBill Paul  * 4. Neither the name of the author nor the names of any co-contributors
1895d67482SBill Paul  *    may be used to endorse or promote products derived from this software
1995d67482SBill Paul  *    without specific prior written permission.
2095d67482SBill Paul  *
2195d67482SBill Paul  * THIS SOFTWARE IS PROVIDED BY Bill Paul AND CONTRIBUTORS ``AS IS'' AND
2295d67482SBill Paul  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
2395d67482SBill Paul  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
2495d67482SBill Paul  * ARE DISCLAIMED.  IN NO EVENT SHALL Bill Paul OR THE VOICES IN HIS HEAD
2595d67482SBill Paul  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
2695d67482SBill Paul  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
2795d67482SBill Paul  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
2895d67482SBill Paul  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
2995d67482SBill Paul  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
3095d67482SBill Paul  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
3195d67482SBill Paul  * THE POSSIBILITY OF SUCH DAMAGE.
3295d67482SBill Paul  *
3395d67482SBill Paul  * $FreeBSD$
3495d67482SBill Paul  */
3595d67482SBill Paul 
3695d67482SBill Paul /*
3795d67482SBill Paul  * BCM570x memory map. The internal memory layout varies somewhat
3895d67482SBill Paul  * depending on whether or not we have external SSRAM attached.
3995d67482SBill Paul  * The BCM5700 can have up to 16MB of external memory. The BCM5701
4095d67482SBill Paul  * is apparently not designed to use external SSRAM. The mappings
4195d67482SBill Paul  * up to the first 4 send rings are the same for both internal and
4295d67482SBill Paul  * external memory configurations. Note that mini RX ring space is
4395d67482SBill Paul  * only available with external SSRAM configurations, which means
4495d67482SBill Paul  * the mini RX ring is not supported on the BCM5701.
4595d67482SBill Paul  *
4695d67482SBill Paul  * The NIC's memory can be accessed by the host in one of 3 ways:
4795d67482SBill Paul  *
4895d67482SBill Paul  * 1) Indirect register access. The MEMWIN_BASEADDR and MEMWIN_DATA
4995d67482SBill Paul  *    registers in PCI config space can be used to read any 32-bit
5095d67482SBill Paul  *    address within the NIC's memory.
5195d67482SBill Paul  *
5295d67482SBill Paul  * 2) Memory window access. The MEMWIN_BASEADDR register in PCI config
5395d67482SBill Paul  *    space can be used in conjunction with the memory window in the
5495d67482SBill Paul  *    device register space at offset 0x8000 to read any 32K chunk
5595d67482SBill Paul  *    of NIC memory.
5695d67482SBill Paul  *
5795d67482SBill Paul  * 3) Flat mode. If the 'flat mode' bit in the PCI state register is
5895d67482SBill Paul  *    set, the device I/O mapping consumes 32MB of host address space,
5995d67482SBill Paul  *    allowing all of the registers and internal NIC memory to be
6095d67482SBill Paul  *    accessed directly. NIC memory addresses are offset by 0x01000000.
6195d67482SBill Paul  *    Flat mode consumes so much host address space that it is not
6295d67482SBill Paul  *    recommended.
6395d67482SBill Paul  */
6495d67482SBill Paul #define BGE_PAGE_ZERO			0x00000000
6595d67482SBill Paul #define BGE_PAGE_ZERO_END		0x000000FF
6695d67482SBill Paul #define BGE_SEND_RING_RCB		0x00000100
6795d67482SBill Paul #define BGE_SEND_RING_RCB_END		0x000001FF
6895d67482SBill Paul #define BGE_RX_RETURN_RING_RCB		0x00000200
6995d67482SBill Paul #define BGE_RX_RETURN_RING_RCB_END	0x000002FF
7095d67482SBill Paul #define BGE_STATS_BLOCK			0x00000300
7195d67482SBill Paul #define BGE_STATS_BLOCK_END		0x00000AFF
7295d67482SBill Paul #define BGE_STATUS_BLOCK		0x00000B00
7395d67482SBill Paul #define BGE_STATUS_BLOCK_END		0x00000B4F
7495d67482SBill Paul #define BGE_SOFTWARE_GENCOMM		0x00000B50
7541abcc1bSPaul Saab #define BGE_SOFTWARE_GENCOMM_SIG	0x00000B54
7641abcc1bSPaul Saab #define BGE_SOFTWARE_GENCOMM_NICCFG	0x00000B58
7795d67482SBill Paul #define BGE_SOFTWARE_GENCOMM_END	0x00000FFF
7895d67482SBill Paul #define BGE_UNMAPPED			0x00001000
7995d67482SBill Paul #define BGE_UNMAPPED_END		0x00001FFF
8095d67482SBill Paul #define BGE_DMA_DESCRIPTORS		0x00002000
8195d67482SBill Paul #define BGE_DMA_DESCRIPTORS_END		0x00003FFF
8295d67482SBill Paul #define BGE_SEND_RING_1_TO_4		0x00004000
8395d67482SBill Paul #define BGE_SEND_RING_1_TO_4_END	0x00005FFF
8495d67482SBill Paul 
8595d67482SBill Paul /* Mappings for internal memory configuration */
8695d67482SBill Paul #define BGE_STD_RX_RINGS		0x00006000
8795d67482SBill Paul #define BGE_STD_RX_RINGS_END		0x00006FFF
8895d67482SBill Paul #define BGE_JUMBO_RX_RINGS		0x00007000
8995d67482SBill Paul #define BGE_JUMBO_RX_RINGS_END		0x00007FFF
9095d67482SBill Paul #define BGE_BUFFPOOL_1			0x00008000
9195d67482SBill Paul #define BGE_BUFFPOOL_1_END		0x0000FFFF
9295d67482SBill Paul #define BGE_BUFFPOOL_2			0x00010000 /* or expansion ROM */
9395d67482SBill Paul #define BGE_BUFFPOOL_2_END		0x00017FFF
9495d67482SBill Paul #define BGE_BUFFPOOL_3			0x00018000 /* or expansion ROM */
9595d67482SBill Paul #define BGE_BUFFPOOL_3_END		0x0001FFFF
9695d67482SBill Paul 
9795d67482SBill Paul /* Mappings for external SSRAM configurations */
9895d67482SBill Paul #define BGE_SEND_RING_5_TO_6		0x00006000
9995d67482SBill Paul #define BGE_SEND_RING_5_TO_6_END	0x00006FFF
10095d67482SBill Paul #define BGE_SEND_RING_7_TO_8		0x00007000
10195d67482SBill Paul #define BGE_SEND_RING_7_TO_8_END	0x00007FFF
10295d67482SBill Paul #define BGE_SEND_RING_9_TO_16		0x00008000
10395d67482SBill Paul #define BGE_SEND_RING_9_TO_16_END	0x0000BFFF
10495d67482SBill Paul #define BGE_EXT_STD_RX_RINGS		0x0000C000
10595d67482SBill Paul #define BGE_EXT_STD_RX_RINGS_END	0x0000CFFF
10695d67482SBill Paul #define BGE_EXT_JUMBO_RX_RINGS		0x0000D000
10795d67482SBill Paul #define BGE_EXT_JUMBO_RX_RINGS_END	0x0000DFFF
10895d67482SBill Paul #define BGE_MINI_RX_RINGS		0x0000E000
10995d67482SBill Paul #define BGE_MINI_RX_RINGS_END		0x0000FFFF
11095d67482SBill Paul #define BGE_AVAIL_REGION1		0x00010000 /* or expansion ROM */
11195d67482SBill Paul #define BGE_AVAIL_REGION1_END		0x00017FFF
11295d67482SBill Paul #define BGE_AVAIL_REGION2		0x00018000 /* or expansion ROM */
11395d67482SBill Paul #define BGE_AVAIL_REGION2_END		0x0001FFFF
11495d67482SBill Paul #define BGE_EXT_SSRAM			0x00020000
11595d67482SBill Paul #define BGE_EXT_SSRAM_END		0x000FFFFF
11695d67482SBill Paul 
11795d67482SBill Paul 
11895d67482SBill Paul /*
11995d67482SBill Paul  * BCM570x register offsets. These are memory mapped registers
12095d67482SBill Paul  * which can be accessed with the CSR_READ_4()/CSR_WRITE_4() macros.
12195d67482SBill Paul  * Each register must be accessed using 32 bit operations.
12295d67482SBill Paul  *
12395d67482SBill Paul  * All registers are accessed through a 32K shared memory block.
12495d67482SBill Paul  * The first group of registers are actually copies of the PCI
12595d67482SBill Paul  * configuration space registers.
12695d67482SBill Paul  */
12795d67482SBill Paul 
12895d67482SBill Paul /*
12995d67482SBill Paul  * PCI registers defined in the PCI 2.2 spec.
13095d67482SBill Paul  */
13195d67482SBill Paul #define BGE_PCI_VID			0x00
13295d67482SBill Paul #define BGE_PCI_DID			0x02
13395d67482SBill Paul #define BGE_PCI_CMD			0x04
13495d67482SBill Paul #define BGE_PCI_STS			0x06
13595d67482SBill Paul #define BGE_PCI_REV			0x08
13695d67482SBill Paul #define BGE_PCI_CLASS			0x09
13795d67482SBill Paul #define BGE_PCI_CACHESZ			0x0C
13895d67482SBill Paul #define BGE_PCI_LATTIMER		0x0D
13995d67482SBill Paul #define BGE_PCI_HDRTYPE			0x0E
14095d67482SBill Paul #define BGE_PCI_BIST			0x0F
14195d67482SBill Paul #define BGE_PCI_BAR0			0x10
14295d67482SBill Paul #define BGE_PCI_BAR1			0x14
14395d67482SBill Paul #define BGE_PCI_SUBSYS			0x2C
14495d67482SBill Paul #define BGE_PCI_SUBVID			0x2E
14595d67482SBill Paul #define BGE_PCI_ROMBASE			0x30
14695d67482SBill Paul #define BGE_PCI_CAPPTR			0x34
14795d67482SBill Paul #define BGE_PCI_INTLINE			0x3C
14895d67482SBill Paul #define BGE_PCI_INTPIN			0x3D
14995d67482SBill Paul #define BGE_PCI_MINGNT			0x3E
15095d67482SBill Paul #define BGE_PCI_MAXLAT			0x3F
15195d67482SBill Paul #define BGE_PCI_PCIXCAP			0x40
15295d67482SBill Paul #define BGE_PCI_NEXTPTR_PM		0x41
15395d67482SBill Paul #define BGE_PCI_PCIX_CMD		0x42
15495d67482SBill Paul #define BGE_PCI_PCIX_STS		0x44
15595d67482SBill Paul #define BGE_PCI_PWRMGMT_CAPID		0x48
15695d67482SBill Paul #define BGE_PCI_NEXTPTR_VPD		0x49
15795d67482SBill Paul #define BGE_PCI_PWRMGMT_CAPS		0x4A
15895d67482SBill Paul #define BGE_PCI_PWRMGMT_CMD		0x4C
15995d67482SBill Paul #define BGE_PCI_PWRMGMT_STS		0x4D
16095d67482SBill Paul #define BGE_PCI_PWRMGMT_DATA		0x4F
16195d67482SBill Paul #define BGE_PCI_VPD_CAPID		0x50
16295d67482SBill Paul #define BGE_PCI_NEXTPTR_MSI		0x51
16395d67482SBill Paul #define BGE_PCI_VPD_ADDR		0x52
16495d67482SBill Paul #define BGE_PCI_VPD_DATA		0x54
16595d67482SBill Paul #define BGE_PCI_MSI_CAPID		0x58
16695d67482SBill Paul #define BGE_PCI_NEXTPTR_NONE		0x59
16795d67482SBill Paul #define BGE_PCI_MSI_CTL			0x5A
16895d67482SBill Paul #define BGE_PCI_MSI_ADDR_HI		0x5C
16995d67482SBill Paul #define BGE_PCI_MSI_ADDR_LO		0x60
17095d67482SBill Paul #define BGE_PCI_MSI_DATA		0x64
17195d67482SBill Paul 
172e53d81eeSPaul Saab /* PCI MSI. ??? */
173e53d81eeSPaul Saab #define BGE_PCIE_CAPID_REG		0xD0
174e53d81eeSPaul Saab #define BGE_PCIE_CAPID			0x10
175e53d81eeSPaul Saab 
17695d67482SBill Paul /*
17795d67482SBill Paul  * PCI registers specific to the BCM570x family.
17895d67482SBill Paul  */
17995d67482SBill Paul #define BGE_PCI_MISC_CTL		0x68
18095d67482SBill Paul #define BGE_PCI_DMA_RW_CTL		0x6C
18195d67482SBill Paul #define BGE_PCI_PCISTATE		0x70
18295d67482SBill Paul #define BGE_PCI_CLKCTL			0x74
18395d67482SBill Paul #define BGE_PCI_REG_BASEADDR		0x78
18495d67482SBill Paul #define BGE_PCI_MEMWIN_BASEADDR		0x7C
18595d67482SBill Paul #define BGE_PCI_REG_DATA		0x80
18695d67482SBill Paul #define BGE_PCI_MEMWIN_DATA		0x84
18795d67482SBill Paul #define BGE_PCI_MODECTL			0x88
18895d67482SBill Paul #define BGE_PCI_MISC_CFG		0x8C
18995d67482SBill Paul #define BGE_PCI_MISC_LOCALCTL		0x90
19095d67482SBill Paul #define BGE_PCI_UNDI_RX_STD_PRODIDX_HI	0x98
19195d67482SBill Paul #define BGE_PCI_UNDI_RX_STD_PRODIDX_LO	0x9C
19295d67482SBill Paul #define BGE_PCI_UNDI_RX_RTN_CONSIDX_HI	0xA0
19395d67482SBill Paul #define BGE_PCI_UNDI_RX_RTN_CONSIDX_LO	0xA4
19495d67482SBill Paul #define BGE_PCI_UNDI_TX_BD_PRODIDX_HI	0xA8
19595d67482SBill Paul #define BGE_PCI_UNDI_TX_BD_PRODIDX_LO	0xAC
19695d67482SBill Paul #define BGE_PCI_ISR_MBX_HI		0xB0
19795d67482SBill Paul #define BGE_PCI_ISR_MBX_LO		0xB4
19895d67482SBill Paul 
19995d67482SBill Paul /* PCI Misc. Host control register */
20095d67482SBill Paul #define BGE_PCIMISCCTL_CLEAR_INTA	0x00000001
20195d67482SBill Paul #define BGE_PCIMISCCTL_MASK_PCI_INTR	0x00000002
20295d67482SBill Paul #define BGE_PCIMISCCTL_ENDIAN_BYTESWAP	0x00000004
20395d67482SBill Paul #define BGE_PCIMISCCTL_ENDIAN_WORDSWAP	0x00000008
20495d67482SBill Paul #define BGE_PCIMISCCTL_PCISTATE_RW	0x00000010
20595d67482SBill Paul #define BGE_PCIMISCCTL_CLOCKCTL_RW	0x00000020
20695d67482SBill Paul #define BGE_PCIMISCCTL_REG_WORDSWAP	0x00000040
20795d67482SBill Paul #define BGE_PCIMISCCTL_INDIRECT_ACCESS	0x00000080
20895d67482SBill Paul #define BGE_PCIMISCCTL_ASICREV		0xFFFF0000
20995d67482SBill Paul 
210e907febfSPyun YongHyeon #define BGE_HIF_SWAP_OPTIONS	(BGE_PCIMISCCTL_ENDIAN_WORDSWAP)
211e907febfSPyun YongHyeon #if BYTE_ORDER == LITTLE_ENDIAN
212e907febfSPyun YongHyeon #define BGE_DMA_SWAP_OPTIONS \
213e907febfSPyun YongHyeon 	BGE_MODECTL_WORDSWAP_NONFRAME| \
214e907febfSPyun YongHyeon 	BGE_MODECTL_BYTESWAP_DATA|BGE_MODECTL_WORDSWAP_DATA
215e907febfSPyun YongHyeon #else
216e907febfSPyun YongHyeon #define BGE_DMA_SWAP_OPTIONS \
217e907febfSPyun YongHyeon 	BGE_MODECTL_WORDSWAP_NONFRAME|BGE_MODECTL_BYTESWAP_NONFRAME| \
218e907febfSPyun YongHyeon 	BGE_MODECTL_BYTESWAP_DATA|BGE_MODECTL_WORDSWAP_DATA
219e907febfSPyun YongHyeon #endif
22095d67482SBill Paul 
221e907febfSPyun YongHyeon #define BGE_INIT \
222e907febfSPyun YongHyeon 	(BGE_HIF_SWAP_OPTIONS|BGE_PCIMISCCTL_CLEAR_INTA| \
223e907febfSPyun YongHyeon 	 BGE_PCIMISCCTL_MASK_PCI_INTR|BGE_PCIMISCCTL_INDIRECT_ACCESS)
22495d67482SBill Paul 
225e0ced696SPaul Saab #define BGE_CHIPID_TIGON_I		0x40000000
226e0ced696SPaul Saab #define BGE_CHIPID_TIGON_II		0x60000000
2274c0da0ffSGleb Smirnoff #define BGE_CHIPID_BCM5700_A0		0x70000000
2284c0da0ffSGleb Smirnoff #define BGE_CHIPID_BCM5700_A1		0x70010000
229e0ced696SPaul Saab #define BGE_CHIPID_BCM5700_B0		0x71000000
2304c0da0ffSGleb Smirnoff #define BGE_CHIPID_BCM5700_B1		0x71010000
2314c0da0ffSGleb Smirnoff #define BGE_CHIPID_BCM5700_B2		0x71020000
2324c0da0ffSGleb Smirnoff #define BGE_CHIPID_BCM5700_B3		0x71030000
233e0ced696SPaul Saab #define BGE_CHIPID_BCM5700_ALTIMA	0x71040000
234e0ced696SPaul Saab #define BGE_CHIPID_BCM5700_C0		0x72000000
235e0ced696SPaul Saab #define BGE_CHIPID_BCM5701_A0		0x00000000	/* grrrr */
236e0ced696SPaul Saab #define BGE_CHIPID_BCM5701_B0		0x01000000
237e0ced696SPaul Saab #define BGE_CHIPID_BCM5701_B2		0x01020000
238e0ced696SPaul Saab #define BGE_CHIPID_BCM5701_B5		0x01050000
239e0ced696SPaul Saab #define BGE_CHIPID_BCM5703_A0		0x10000000
240e0ced696SPaul Saab #define BGE_CHIPID_BCM5703_A1		0x10010000
241e0ced696SPaul Saab #define BGE_CHIPID_BCM5703_A2		0x10020000
2424c0da0ffSGleb Smirnoff #define BGE_CHIPID_BCM5703_A3		0x10030000
2439e86676bSGleb Smirnoff #define BGE_CHIPID_BCM5703_B0		0x11000000
244e0ced696SPaul Saab #define BGE_CHIPID_BCM5704_A0		0x20000000
245e0ced696SPaul Saab #define BGE_CHIPID_BCM5704_A1		0x20010000
246e0ced696SPaul Saab #define BGE_CHIPID_BCM5704_A2		0x20020000
2474c0da0ffSGleb Smirnoff #define BGE_CHIPID_BCM5704_A3		0x20030000
2484c0da0ffSGleb Smirnoff #define BGE_CHIPID_BCM5704_B0		0x21000000
2490434d1b8SBill Paul #define BGE_CHIPID_BCM5705_A0		0x30000000
2500434d1b8SBill Paul #define BGE_CHIPID_BCM5705_A1		0x30010000
2510434d1b8SBill Paul #define BGE_CHIPID_BCM5705_A2		0x30020000
2520434d1b8SBill Paul #define BGE_CHIPID_BCM5705_A3		0x30030000
253e53d81eeSPaul Saab #define BGE_CHIPID_BCM5750_A0		0x40000000
254e53d81eeSPaul Saab #define BGE_CHIPID_BCM5750_A1		0x40010000
2554c0da0ffSGleb Smirnoff #define BGE_CHIPID_BCM5750_A3		0x40030000
2564c0da0ffSGleb Smirnoff #define BGE_CHIPID_BCM5750_B0		0x40100000
2574c0da0ffSGleb Smirnoff #define BGE_CHIPID_BCM5750_B1		0x41010000
2584c0da0ffSGleb Smirnoff #define BGE_CHIPID_BCM5750_C0		0x42000000
2594c0da0ffSGleb Smirnoff #define BGE_CHIPID_BCM5750_C1		0x42010000
26042787b76SGleb Smirnoff #define BGE_CHIPID_BCM5750_C2		0x42020000
261419c028bSPaul Saab #define BGE_CHIPID_BCM5714_A0		0x50000000
2624c0da0ffSGleb Smirnoff #define BGE_CHIPID_BCM5752_A0		0x60000000
2634c0da0ffSGleb Smirnoff #define BGE_CHIPID_BCM5752_A1		0x60010000
2644c0da0ffSGleb Smirnoff #define BGE_CHIPID_BCM5752_A2		0x60020000
2654c0da0ffSGleb Smirnoff #define BGE_CHIPID_BCM5714_B0		0x80000000
2664c0da0ffSGleb Smirnoff #define BGE_CHIPID_BCM5714_B3		0x80030000
2674c0da0ffSGleb Smirnoff #define BGE_CHIPID_BCM5715_A0		0x90000000
2684c0da0ffSGleb Smirnoff #define BGE_CHIPID_BCM5715_A1		0x90010000
26995d67482SBill Paul 
270a1d52896SBill Paul /* shorthand one */
2715cba12d3SPaul Saab #define BGE_ASICREV(x)			((x) >> 28)
2725cba12d3SPaul Saab #define BGE_ASICREV_BCM5701		0x00
2735cba12d3SPaul Saab #define BGE_ASICREV_BCM5703		0x01
2745cba12d3SPaul Saab #define BGE_ASICREV_BCM5704		0x02
2750434d1b8SBill Paul #define BGE_ASICREV_BCM5705		0x03
276e53d81eeSPaul Saab #define BGE_ASICREV_BCM5750		0x04
2774c0da0ffSGleb Smirnoff #define BGE_ASICREV_BCM5714_A0		0x05
278560c1670SGleb Smirnoff #define BGE_ASICREV_BCM5752		0x06
2794c0da0ffSGleb Smirnoff #define BGE_ASICREV_BCM5700		0x07
2804c0da0ffSGleb Smirnoff #define BGE_ASICREV_BCM5780		0x08
2814c0da0ffSGleb Smirnoff #define BGE_ASICREV_BCM5714		0x09
2829e86676bSGleb Smirnoff #define BGE_ASICREV_BCM5755		0x0a
2839e86676bSGleb Smirnoff #define BGE_ASICREV_BCM5787		0x0b
284a1d52896SBill Paul 
285e0ced696SPaul Saab /* chip revisions */
286e0ced696SPaul Saab #define BGE_CHIPREV(x)			((x) >> 24)
287e0ced696SPaul Saab #define BGE_CHIPREV_5700_AX		0x70
288e0ced696SPaul Saab #define BGE_CHIPREV_5700_BX		0x71
289e0ced696SPaul Saab #define BGE_CHIPREV_5700_CX		0x72
290e0ced696SPaul Saab #define BGE_CHIPREV_5701_AX		0x00
291e0ced696SPaul Saab 
29295d67482SBill Paul /* PCI DMA Read/Write Control register */
29395d67482SBill Paul #define BGE_PCIDMARWCTL_MINDMA		0x000000FF
29495d67482SBill Paul #define BGE_PCIDMARWCTL_RDADRR_BNDRY	0x00000700
29595d67482SBill Paul #define BGE_PCIDMARWCTL_WRADDR_BNDRY	0x00003800
29695d67482SBill Paul #define BGE_PCIDMARWCTL_ONEDMA_ATONCE	0x00004000
29795d67482SBill Paul #define BGE_PCIDMARWCTL_RD_WAT		0x00070000
2985cba12d3SPaul Saab # define BGE_PCIDMARWCTL_RD_WAT_SHIFT	16
29995d67482SBill Paul #define BGE_PCIDMARWCTL_WR_WAT		0x00380000
3005cba12d3SPaul Saab # define BGE_PCIDMARWCTL_WR_WAT_SHIFT	19
30195d67482SBill Paul #define BGE_PCIDMARWCTL_USE_MRM		0x00400000
30295d67482SBill Paul #define BGE_PCIDMARWCTL_ASRT_ALL_BE	0x00800000
30395d67482SBill Paul #define BGE_PCIDMARWCTL_DFLT_PCI_RD_CMD	0x0F000000
3045cba12d3SPaul Saab # define  BGE_PCIDMA_RWCTL_PCI_RD_CMD_SHIFT	24
30595d67482SBill Paul #define BGE_PCIDMARWCTL_DFLT_PCI_WR_CMD	0xF0000000
3065cba12d3SPaul Saab # define  BGE_PCIDMA_RWCTL_PCI_WR_CMD_SHIFT	28
30795d67482SBill Paul 
30895d67482SBill Paul #define BGE_PCI_READ_BNDRY_DISABLE	0x00000000
30995d67482SBill Paul #define BGE_PCI_READ_BNDRY_16BYTES	0x00000100
31095d67482SBill Paul #define BGE_PCI_READ_BNDRY_32BYTES	0x00000200
31195d67482SBill Paul #define BGE_PCI_READ_BNDRY_64BYTES	0x00000300
31295d67482SBill Paul #define BGE_PCI_READ_BNDRY_128BYTES	0x00000400
31395d67482SBill Paul #define BGE_PCI_READ_BNDRY_256BYTES	0x00000500
31495d67482SBill Paul #define BGE_PCI_READ_BNDRY_512BYTES	0x00000600
31595d67482SBill Paul #define BGE_PCI_READ_BNDRY_1024BYTES	0x00000700
31695d67482SBill Paul 
31795d67482SBill Paul #define BGE_PCI_WRITE_BNDRY_DISABLE	0x00000000
31895d67482SBill Paul #define BGE_PCI_WRITE_BNDRY_16BYTES	0x00000800
31995d67482SBill Paul #define BGE_PCI_WRITE_BNDRY_32BYTES	0x00001000
32095d67482SBill Paul #define BGE_PCI_WRITE_BNDRY_64BYTES	0x00001800
32195d67482SBill Paul #define BGE_PCI_WRITE_BNDRY_128BYTES	0x00002000
32295d67482SBill Paul #define BGE_PCI_WRITE_BNDRY_256BYTES	0x00002800
32395d67482SBill Paul #define BGE_PCI_WRITE_BNDRY_512BYTES	0x00003000
32495d67482SBill Paul #define BGE_PCI_WRITE_BNDRY_1024BYTES	0x00003800
32595d67482SBill Paul 
32695d67482SBill Paul /*
32795d67482SBill Paul  * PCI state register -- note, this register is read only
32895d67482SBill Paul  * unless the PCISTATE_WR bit of the PCI Misc. Host Control
32995d67482SBill Paul  * register is set.
33095d67482SBill Paul  */
33195d67482SBill Paul #define BGE_PCISTATE_FORCE_RESET	0x00000001
33295d67482SBill Paul #define BGE_PCISTATE_INTR_STATE		0x00000002
33395d67482SBill Paul #define BGE_PCISTATE_PCI_BUSMODE	0x00000004 /* 1 = PCI, 0 = PCI-X */
33495d67482SBill Paul #define BGE_PCISTATE_PCI_BUSSPEED	0x00000008 /* 1 = 33/66, 0 = 66/133 */
33595d67482SBill Paul #define BGE_PCISTATE_32BIT_BUS		0x00000010 /* 1 = 32bit, 0 = 64bit */
33695d67482SBill Paul #define BGE_PCISTATE_WANT_EXPROM	0x00000020
33795d67482SBill Paul #define BGE_PCISTATE_EXPROM_RETRY	0x00000040
33895d67482SBill Paul #define BGE_PCISTATE_FLATVIEW_MODE	0x00000100
33995d67482SBill Paul #define BGE_PCISTATE_PCI_TGT_RETRY_MAX	0x00000E00
34095d67482SBill Paul 
34195d67482SBill Paul /*
34295d67482SBill Paul  * PCI Clock Control register -- note, this register is read only
34395d67482SBill Paul  * unless the CLOCKCTL_RW bit of the PCI Misc. Host Control
34495d67482SBill Paul  * register is set.
34595d67482SBill Paul  */
34695d67482SBill Paul #define BGE_PCICLOCKCTL_DETECTED_SPEED	0x0000000F
34795d67482SBill Paul #define BGE_PCICLOCKCTL_M66EN		0x00000080
34895d67482SBill Paul #define BGE_PCICLOCKCTL_LOWPWR_CLKMODE	0x00000200
34995d67482SBill Paul #define BGE_PCICLOCKCTL_RXCPU_CLK_DIS	0x00000400
35095d67482SBill Paul #define BGE_PCICLOCKCTL_TXCPU_CLK_DIS	0x00000800
35195d67482SBill Paul #define BGE_PCICLOCKCTL_ALTCLK		0x00001000
35295d67482SBill Paul #define BGE_PCICLOCKCTL_ALTCLK_SRC	0x00002000
35395d67482SBill Paul #define BGE_PCICLOCKCTL_PCIPLL_DISABLE	0x00004000
35495d67482SBill Paul #define BGE_PCICLOCKCTL_SYSPLL_DISABLE	0x00008000
35595d67482SBill Paul #define BGE_PCICLOCKCTL_BIST_ENABLE	0x00010000
35695d67482SBill Paul 
35795d67482SBill Paul 
35895d67482SBill Paul #ifndef PCIM_CMD_MWIEN
35995d67482SBill Paul #define PCIM_CMD_MWIEN			0x0010
36095d67482SBill Paul #endif
36195d67482SBill Paul 
36295d67482SBill Paul /*
36395d67482SBill Paul  * High priority mailbox registers
36495d67482SBill Paul  * Each mailbox is 64-bits wide, though we only use the
36595d67482SBill Paul  * lower 32 bits. To write a 64-bit value, write the upper 32 bits
36695d67482SBill Paul  * first. The NIC will load the mailbox after the lower 32 bit word
36795d67482SBill Paul  * has been updated.
36895d67482SBill Paul  */
36995d67482SBill Paul #define BGE_MBX_IRQ0_HI			0x0200
37095d67482SBill Paul #define BGE_MBX_IRQ0_LO			0x0204
37195d67482SBill Paul #define BGE_MBX_IRQ1_HI			0x0208
37295d67482SBill Paul #define BGE_MBX_IRQ1_LO			0x020C
37395d67482SBill Paul #define BGE_MBX_IRQ2_HI			0x0210
37495d67482SBill Paul #define BGE_MBX_IRQ2_LO			0x0214
37595d67482SBill Paul #define BGE_MBX_IRQ3_HI			0x0218
37695d67482SBill Paul #define BGE_MBX_IRQ3_LO			0x021C
37795d67482SBill Paul #define BGE_MBX_GEN0_HI			0x0220
37895d67482SBill Paul #define BGE_MBX_GEN0_LO			0x0224
37995d67482SBill Paul #define BGE_MBX_GEN1_HI			0x0228
38095d67482SBill Paul #define BGE_MBX_GEN1_LO			0x022C
38195d67482SBill Paul #define BGE_MBX_GEN2_HI			0x0230
38295d67482SBill Paul #define BGE_MBX_GEN2_LO			0x0234
38395d67482SBill Paul #define BGE_MBX_GEN3_HI			0x0228
38495d67482SBill Paul #define BGE_MBX_GEN3_LO			0x022C
38595d67482SBill Paul #define BGE_MBX_GEN4_HI			0x0240
38695d67482SBill Paul #define BGE_MBX_GEN4_LO			0x0244
38795d67482SBill Paul #define BGE_MBX_GEN5_HI			0x0248
38895d67482SBill Paul #define BGE_MBX_GEN5_LO			0x024C
38995d67482SBill Paul #define BGE_MBX_GEN6_HI			0x0250
39095d67482SBill Paul #define BGE_MBX_GEN6_LO			0x0254
39195d67482SBill Paul #define BGE_MBX_GEN7_HI			0x0258
39295d67482SBill Paul #define BGE_MBX_GEN7_LO			0x025C
39395d67482SBill Paul #define BGE_MBX_RELOAD_STATS_HI		0x0260
39495d67482SBill Paul #define BGE_MBX_RELOAD_STATS_LO		0x0264
39595d67482SBill Paul #define BGE_MBX_RX_STD_PROD_HI		0x0268
39695d67482SBill Paul #define BGE_MBX_RX_STD_PROD_LO		0x026C
39795d67482SBill Paul #define BGE_MBX_RX_JUMBO_PROD_HI	0x0270
39895d67482SBill Paul #define BGE_MBX_RX_JUMBO_PROD_LO	0x0274
39995d67482SBill Paul #define BGE_MBX_RX_MINI_PROD_HI		0x0278
40095d67482SBill Paul #define BGE_MBX_RX_MINI_PROD_LO		0x027C
40195d67482SBill Paul #define BGE_MBX_RX_CONS0_HI		0x0280
40295d67482SBill Paul #define BGE_MBX_RX_CONS0_LO		0x0284
40395d67482SBill Paul #define BGE_MBX_RX_CONS1_HI		0x0288
40495d67482SBill Paul #define BGE_MBX_RX_CONS1_LO		0x028C
40595d67482SBill Paul #define BGE_MBX_RX_CONS2_HI		0x0290
40695d67482SBill Paul #define BGE_MBX_RX_CONS2_LO		0x0294
40795d67482SBill Paul #define BGE_MBX_RX_CONS3_HI		0x0298
40895d67482SBill Paul #define BGE_MBX_RX_CONS3_LO		0x029C
40995d67482SBill Paul #define BGE_MBX_RX_CONS4_HI		0x02A0
41095d67482SBill Paul #define BGE_MBX_RX_CONS4_LO		0x02A4
41195d67482SBill Paul #define BGE_MBX_RX_CONS5_HI		0x02A8
41295d67482SBill Paul #define BGE_MBX_RX_CONS5_LO		0x02AC
41395d67482SBill Paul #define BGE_MBX_RX_CONS6_HI		0x02B0
41495d67482SBill Paul #define BGE_MBX_RX_CONS6_LO		0x02B4
41595d67482SBill Paul #define BGE_MBX_RX_CONS7_HI		0x02B8
41695d67482SBill Paul #define BGE_MBX_RX_CONS7_LO		0x02BC
41795d67482SBill Paul #define BGE_MBX_RX_CONS8_HI		0x02C0
41895d67482SBill Paul #define BGE_MBX_RX_CONS8_LO		0x02C4
41995d67482SBill Paul #define BGE_MBX_RX_CONS9_HI		0x02C8
42095d67482SBill Paul #define BGE_MBX_RX_CONS9_LO		0x02CC
42195d67482SBill Paul #define BGE_MBX_RX_CONS10_HI		0x02D0
42295d67482SBill Paul #define BGE_MBX_RX_CONS10_LO		0x02D4
42395d67482SBill Paul #define BGE_MBX_RX_CONS11_HI		0x02D8
42495d67482SBill Paul #define BGE_MBX_RX_CONS11_LO		0x02DC
42595d67482SBill Paul #define BGE_MBX_RX_CONS12_HI		0x02E0
42695d67482SBill Paul #define BGE_MBX_RX_CONS12_LO		0x02E4
42795d67482SBill Paul #define BGE_MBX_RX_CONS13_HI		0x02E8
42895d67482SBill Paul #define BGE_MBX_RX_CONS13_LO		0x02EC
42995d67482SBill Paul #define BGE_MBX_RX_CONS14_HI		0x02F0
43095d67482SBill Paul #define BGE_MBX_RX_CONS14_LO		0x02F4
43195d67482SBill Paul #define BGE_MBX_RX_CONS15_HI		0x02F8
43295d67482SBill Paul #define BGE_MBX_RX_CONS15_LO		0x02FC
43395d67482SBill Paul #define BGE_MBX_TX_HOST_PROD0_HI	0x0300
43495d67482SBill Paul #define BGE_MBX_TX_HOST_PROD0_LO	0x0304
43595d67482SBill Paul #define BGE_MBX_TX_HOST_PROD1_HI	0x0308
43695d67482SBill Paul #define BGE_MBX_TX_HOST_PROD1_LO	0x030C
43795d67482SBill Paul #define BGE_MBX_TX_HOST_PROD2_HI	0x0310
43895d67482SBill Paul #define BGE_MBX_TX_HOST_PROD2_LO	0x0314
43995d67482SBill Paul #define BGE_MBX_TX_HOST_PROD3_HI	0x0318
44095d67482SBill Paul #define BGE_MBX_TX_HOST_PROD3_LO	0x031C
44195d67482SBill Paul #define BGE_MBX_TX_HOST_PROD4_HI	0x0320
44295d67482SBill Paul #define BGE_MBX_TX_HOST_PROD4_LO	0x0324
44395d67482SBill Paul #define BGE_MBX_TX_HOST_PROD5_HI	0x0328
44495d67482SBill Paul #define BGE_MBX_TX_HOST_PROD5_LO	0x032C
44595d67482SBill Paul #define BGE_MBX_TX_HOST_PROD6_HI	0x0330
44695d67482SBill Paul #define BGE_MBX_TX_HOST_PROD6_LO	0x0334
44795d67482SBill Paul #define BGE_MBX_TX_HOST_PROD7_HI	0x0338
44895d67482SBill Paul #define BGE_MBX_TX_HOST_PROD7_LO	0x033C
44995d67482SBill Paul #define BGE_MBX_TX_HOST_PROD8_HI	0x0340
45095d67482SBill Paul #define BGE_MBX_TX_HOST_PROD8_LO	0x0344
45195d67482SBill Paul #define BGE_MBX_TX_HOST_PROD9_HI	0x0348
45295d67482SBill Paul #define BGE_MBX_TX_HOST_PROD9_LO	0x034C
45395d67482SBill Paul #define BGE_MBX_TX_HOST_PROD10_HI	0x0350
45495d67482SBill Paul #define BGE_MBX_TX_HOST_PROD10_LO	0x0354
45595d67482SBill Paul #define BGE_MBX_TX_HOST_PROD11_HI	0x0358
45695d67482SBill Paul #define BGE_MBX_TX_HOST_PROD11_LO	0x035C
45795d67482SBill Paul #define BGE_MBX_TX_HOST_PROD12_HI	0x0360
45895d67482SBill Paul #define BGE_MBX_TX_HOST_PROD12_LO	0x0364
45995d67482SBill Paul #define BGE_MBX_TX_HOST_PROD13_HI	0x0368
46095d67482SBill Paul #define BGE_MBX_TX_HOST_PROD13_LO	0x036C
46195d67482SBill Paul #define BGE_MBX_TX_HOST_PROD14_HI	0x0370
46295d67482SBill Paul #define BGE_MBX_TX_HOST_PROD14_LO	0x0374
46395d67482SBill Paul #define BGE_MBX_TX_HOST_PROD15_HI	0x0378
46495d67482SBill Paul #define BGE_MBX_TX_HOST_PROD15_LO	0x037C
46595d67482SBill Paul #define BGE_MBX_TX_NIC_PROD0_HI		0x0380
46695d67482SBill Paul #define BGE_MBX_TX_NIC_PROD0_LO		0x0384
46795d67482SBill Paul #define BGE_MBX_TX_NIC_PROD1_HI		0x0388
46895d67482SBill Paul #define BGE_MBX_TX_NIC_PROD1_LO		0x038C
46995d67482SBill Paul #define BGE_MBX_TX_NIC_PROD2_HI		0x0390
47095d67482SBill Paul #define BGE_MBX_TX_NIC_PROD2_LO		0x0394
47195d67482SBill Paul #define BGE_MBX_TX_NIC_PROD3_HI		0x0398
47295d67482SBill Paul #define BGE_MBX_TX_NIC_PROD3_LO		0x039C
47395d67482SBill Paul #define BGE_MBX_TX_NIC_PROD4_HI		0x03A0
47495d67482SBill Paul #define BGE_MBX_TX_NIC_PROD4_LO		0x03A4
47595d67482SBill Paul #define BGE_MBX_TX_NIC_PROD5_HI		0x03A8
47695d67482SBill Paul #define BGE_MBX_TX_NIC_PROD5_LO		0x03AC
47795d67482SBill Paul #define BGE_MBX_TX_NIC_PROD6_HI		0x03B0
47895d67482SBill Paul #define BGE_MBX_TX_NIC_PROD6_LO		0x03B4
47995d67482SBill Paul #define BGE_MBX_TX_NIC_PROD7_HI		0x03B8
48095d67482SBill Paul #define BGE_MBX_TX_NIC_PROD7_LO		0x03BC
48195d67482SBill Paul #define BGE_MBX_TX_NIC_PROD8_HI		0x03C0
48295d67482SBill Paul #define BGE_MBX_TX_NIC_PROD8_LO		0x03C4
48395d67482SBill Paul #define BGE_MBX_TX_NIC_PROD9_HI		0x03C8
48495d67482SBill Paul #define BGE_MBX_TX_NIC_PROD9_LO		0x03CC
48595d67482SBill Paul #define BGE_MBX_TX_NIC_PROD10_HI	0x03D0
48695d67482SBill Paul #define BGE_MBX_TX_NIC_PROD10_LO	0x03D4
48795d67482SBill Paul #define BGE_MBX_TX_NIC_PROD11_HI	0x03D8
48895d67482SBill Paul #define BGE_MBX_TX_NIC_PROD11_LO	0x03DC
48995d67482SBill Paul #define BGE_MBX_TX_NIC_PROD12_HI	0x03E0
49095d67482SBill Paul #define BGE_MBX_TX_NIC_PROD12_LO	0x03E4
49195d67482SBill Paul #define BGE_MBX_TX_NIC_PROD13_HI	0x03E8
49295d67482SBill Paul #define BGE_MBX_TX_NIC_PROD13_LO	0x03EC
49395d67482SBill Paul #define BGE_MBX_TX_NIC_PROD14_HI	0x03F0
49495d67482SBill Paul #define BGE_MBX_TX_NIC_PROD14_LO	0x03F4
49595d67482SBill Paul #define BGE_MBX_TX_NIC_PROD15_HI	0x03F8
49695d67482SBill Paul #define BGE_MBX_TX_NIC_PROD15_LO	0x03FC
49795d67482SBill Paul 
49895d67482SBill Paul #define BGE_TX_RINGS_MAX		4
49995d67482SBill Paul #define BGE_TX_RINGS_EXTSSRAM_MAX	16
50095d67482SBill Paul #define BGE_RX_RINGS_MAX		16
50195d67482SBill Paul 
50295d67482SBill Paul /* Ethernet MAC control registers */
50395d67482SBill Paul #define BGE_MAC_MODE			0x0400
50495d67482SBill Paul #define BGE_MAC_STS			0x0404
50595d67482SBill Paul #define BGE_MAC_EVT_ENB			0x0408
50695d67482SBill Paul #define BGE_MAC_LED_CTL			0x040C
50795d67482SBill Paul #define BGE_MAC_ADDR1_LO		0x0410
50895d67482SBill Paul #define BGE_MAC_ADDR1_HI		0x0414
50995d67482SBill Paul #define BGE_MAC_ADDR2_LO		0x0418
51095d67482SBill Paul #define BGE_MAC_ADDR2_HI		0x041C
51195d67482SBill Paul #define BGE_MAC_ADDR3_LO		0x0420
51295d67482SBill Paul #define BGE_MAC_ADDR3_HI		0x0424
51395d67482SBill Paul #define BGE_MAC_ADDR4_LO		0x0428
51495d67482SBill Paul #define BGE_MAC_ADDR4_HI		0x042C
51595d67482SBill Paul #define BGE_WOL_PATPTR			0x0430
51695d67482SBill Paul #define BGE_WOL_PATCFG			0x0434
51795d67482SBill Paul #define BGE_TX_RANDOM_BACKOFF		0x0438
51895d67482SBill Paul #define BGE_RX_MTU			0x043C
51995d67482SBill Paul #define BGE_GBIT_PCS_TEST		0x0440
52095d67482SBill Paul #define BGE_TX_TBI_AUTONEG		0x0444
52195d67482SBill Paul #define BGE_RX_TBI_AUTONEG		0x0448
52295d67482SBill Paul #define BGE_MI_COMM			0x044C
52395d67482SBill Paul #define BGE_MI_STS			0x0450
52495d67482SBill Paul #define BGE_MI_MODE			0x0454
52595d67482SBill Paul #define BGE_AUTOPOLL_STS		0x0458
52695d67482SBill Paul #define BGE_TX_MODE			0x045C
52795d67482SBill Paul #define BGE_TX_STS			0x0460
52895d67482SBill Paul #define BGE_TX_LENGTHS			0x0464
52995d67482SBill Paul #define BGE_RX_MODE			0x0468
53095d67482SBill Paul #define BGE_RX_STS			0x046C
53195d67482SBill Paul #define BGE_MAR0			0x0470
53295d67482SBill Paul #define BGE_MAR1			0x0474
53395d67482SBill Paul #define BGE_MAR2			0x0478
53495d67482SBill Paul #define BGE_MAR3			0x047C
53595d67482SBill Paul #define BGE_RX_BD_RULES_CTL0		0x0480
53695d67482SBill Paul #define BGE_RX_BD_RULES_MASKVAL0	0x0484
53795d67482SBill Paul #define BGE_RX_BD_RULES_CTL1		0x0488
53895d67482SBill Paul #define BGE_RX_BD_RULES_MASKVAL1	0x048C
53995d67482SBill Paul #define BGE_RX_BD_RULES_CTL2		0x0490
54095d67482SBill Paul #define BGE_RX_BD_RULES_MASKVAL2	0x0494
54195d67482SBill Paul #define BGE_RX_BD_RULES_CTL3		0x0498
54295d67482SBill Paul #define BGE_RX_BD_RULES_MASKVAL3	0x049C
54395d67482SBill Paul #define BGE_RX_BD_RULES_CTL4		0x04A0
54495d67482SBill Paul #define BGE_RX_BD_RULES_MASKVAL4	0x04A4
54595d67482SBill Paul #define BGE_RX_BD_RULES_CTL5		0x04A8
54695d67482SBill Paul #define BGE_RX_BD_RULES_MASKVAL5	0x04AC
54795d67482SBill Paul #define BGE_RX_BD_RULES_CTL6		0x04B0
54895d67482SBill Paul #define BGE_RX_BD_RULES_MASKVAL6	0x04B4
54995d67482SBill Paul #define BGE_RX_BD_RULES_CTL7		0x04B8
55095d67482SBill Paul #define BGE_RX_BD_RULES_MASKVAL7	0x04BC
55195d67482SBill Paul #define BGE_RX_BD_RULES_CTL8		0x04C0
55295d67482SBill Paul #define BGE_RX_BD_RULES_MASKVAL8	0x04C4
55395d67482SBill Paul #define BGE_RX_BD_RULES_CTL9		0x04C8
55495d67482SBill Paul #define BGE_RX_BD_RULES_MASKVAL9	0x04CC
55595d67482SBill Paul #define BGE_RX_BD_RULES_CTL10		0x04D0
55695d67482SBill Paul #define BGE_RX_BD_RULES_MASKVAL10	0x04D4
55795d67482SBill Paul #define BGE_RX_BD_RULES_CTL11		0x04D8
55895d67482SBill Paul #define BGE_RX_BD_RULES_MASKVAL11	0x04DC
55995d67482SBill Paul #define BGE_RX_BD_RULES_CTL12		0x04E0
56095d67482SBill Paul #define BGE_RX_BD_RULES_MASKVAL12	0x04E4
56195d67482SBill Paul #define BGE_RX_BD_RULES_CTL13		0x04E8
56295d67482SBill Paul #define BGE_RX_BD_RULES_MASKVAL13	0x04EC
56395d67482SBill Paul #define BGE_RX_BD_RULES_CTL14		0x04F0
56495d67482SBill Paul #define BGE_RX_BD_RULES_MASKVAL14	0x04F4
56595d67482SBill Paul #define BGE_RX_BD_RULES_CTL15		0x04F8
56695d67482SBill Paul #define BGE_RX_BD_RULES_MASKVAL15	0x04FC
56795d67482SBill Paul #define BGE_RX_RULES_CFG		0x0500
568da3003f0SBill Paul #define BGE_SERDES_CFG			0x0590
569da3003f0SBill Paul #define BGE_SERDES_STS			0x0594
570da3003f0SBill Paul #define BGE_SGDIG_CFG			0x05B0
571da3003f0SBill Paul #define BGE_SGDIG_STS			0x05B4
57295d67482SBill Paul #define BGE_RX_STATS			0x0800
57395d67482SBill Paul #define BGE_TX_STATS			0x0880
57495d67482SBill Paul 
57595d67482SBill Paul /* Ethernet MAC Mode register */
57695d67482SBill Paul #define BGE_MACMODE_RESET		0x00000001
57795d67482SBill Paul #define BGE_MACMODE_HALF_DUPLEX		0x00000002
57895d67482SBill Paul #define BGE_MACMODE_PORTMODE		0x0000000C
57995d67482SBill Paul #define BGE_MACMODE_LOOPBACK		0x00000010
58095d67482SBill Paul #define BGE_MACMODE_RX_TAGGEDPKT	0x00000080
58195d67482SBill Paul #define BGE_MACMODE_TX_BURST_ENB	0x00000100
58295d67482SBill Paul #define BGE_MACMODE_MAX_DEFER		0x00000200
58395d67482SBill Paul #define BGE_MACMODE_LINK_POLARITY	0x00000400
58495d67482SBill Paul #define BGE_MACMODE_RX_STATS_ENB	0x00000800
58595d67482SBill Paul #define BGE_MACMODE_RX_STATS_CLEAR	0x00001000
58695d67482SBill Paul #define BGE_MACMODE_RX_STATS_FLUSH	0x00002000
58795d67482SBill Paul #define BGE_MACMODE_TX_STATS_ENB	0x00004000
58895d67482SBill Paul #define BGE_MACMODE_TX_STATS_CLEAR	0x00008000
58995d67482SBill Paul #define BGE_MACMODE_TX_STATS_FLUSH	0x00010000
59095d67482SBill Paul #define BGE_MACMODE_TBI_SEND_CFGS	0x00020000
59195d67482SBill Paul #define BGE_MACMODE_MAGIC_PKT_ENB	0x00040000
59295d67482SBill Paul #define BGE_MACMODE_ACPI_PWRON_ENB	0x00080000
59395d67482SBill Paul #define BGE_MACMODE_MIP_ENB		0x00100000
59495d67482SBill Paul #define BGE_MACMODE_TXDMA_ENB		0x00200000
59595d67482SBill Paul #define BGE_MACMODE_RXDMA_ENB		0x00400000
59695d67482SBill Paul #define BGE_MACMODE_FRMHDR_DMA_ENB	0x00800000
59795d67482SBill Paul 
59895d67482SBill Paul #define BGE_PORTMODE_NONE		0x00000000
59995d67482SBill Paul #define BGE_PORTMODE_MII		0x00000004
60095d67482SBill Paul #define BGE_PORTMODE_GMII		0x00000008
60195d67482SBill Paul #define BGE_PORTMODE_TBI		0x0000000C
60295d67482SBill Paul 
60395d67482SBill Paul /* MAC Status register */
60495d67482SBill Paul #define BGE_MACSTAT_TBI_PCS_SYNCHED	0x00000001
60595d67482SBill Paul #define BGE_MACSTAT_TBI_SIGNAL_DETECT	0x00000002
60695d67482SBill Paul #define BGE_MACSTAT_RX_CFG		0x00000004
60795d67482SBill Paul #define BGE_MACSTAT_CFG_CHANGED		0x00000008
60895d67482SBill Paul #define BGE_MACSTAT_SYNC_CHANGED	0x00000010
60995d67482SBill Paul #define BGE_MACSTAT_PORT_DECODE_ERROR	0x00000400
61095d67482SBill Paul #define BGE_MACSTAT_LINK_CHANGED	0x00001000
61195d67482SBill Paul #define BGE_MACSTAT_MI_COMPLETE		0x00400000
61295d67482SBill Paul #define BGE_MACSTAT_MI_INTERRUPT	0x00800000
61395d67482SBill Paul #define BGE_MACSTAT_AUTOPOLL_ERROR	0x01000000
61495d67482SBill Paul #define BGE_MACSTAT_ODI_ERROR		0x02000000
61595d67482SBill Paul #define BGE_MACSTAT_RXSTAT_OFLOW	0x04000000
61695d67482SBill Paul #define BGE_MACSTAT_TXSTAT_OFLOW	0x08000000
61795d67482SBill Paul 
61895d67482SBill Paul /* MAC Event Enable Register */
61995d67482SBill Paul #define BGE_EVTENB_PORT_DECODE_ERROR	0x00000400
62095d67482SBill Paul #define BGE_EVTENB_LINK_CHANGED		0x00001000
62195d67482SBill Paul #define BGE_EVTENB_MI_COMPLETE		0x00400000
62295d67482SBill Paul #define BGE_EVTENB_MI_INTERRUPT		0x00800000
62395d67482SBill Paul #define BGE_EVTENB_AUTOPOLL_ERROR	0x01000000
62495d67482SBill Paul #define BGE_EVTENB_ODI_ERROR		0x02000000
62595d67482SBill Paul #define BGE_EVTENB_RXSTAT_OFLOW		0x04000000
62695d67482SBill Paul #define BGE_EVTENB_TXSTAT_OFLOW		0x08000000
62795d67482SBill Paul 
62895d67482SBill Paul /* LED Control Register */
62995d67482SBill Paul #define BGE_LEDCTL_LINKLED_OVERRIDE	0x00000001
63095d67482SBill Paul #define BGE_LEDCTL_1000MBPS_LED		0x00000002
63195d67482SBill Paul #define BGE_LEDCTL_100MBPS_LED		0x00000004
63295d67482SBill Paul #define BGE_LEDCTL_10MBPS_LED		0x00000008
63395d67482SBill Paul #define BGE_LEDCTL_TRAFLED_OVERRIDE	0x00000010
63495d67482SBill Paul #define BGE_LEDCTL_TRAFLED_BLINK	0x00000020
63595d67482SBill Paul #define BGE_LEDCTL_TREFLED_BLINK_2	0x00000040
63695d67482SBill Paul #define BGE_LEDCTL_1000MBPS_STS		0x00000080
63795d67482SBill Paul #define BGE_LEDCTL_100MBPS_STS		0x00000100
63895d67482SBill Paul #define BGE_LEDCTL_10MBPS_STS		0x00000200
63995d67482SBill Paul #define BGE_LEDCTL_TRADLED_STS		0x00000400
64095d67482SBill Paul #define BGE_LEDCTL_BLINKPERIOD		0x7FF80000
64195d67482SBill Paul #define BGE_LEDCTL_BLINKPERIOD_OVERRIDE	0x80000000
64295d67482SBill Paul 
64395d67482SBill Paul /* TX backoff seed register */
64495d67482SBill Paul #define BGE_TX_BACKOFF_SEED_MASK	0x3F
64595d67482SBill Paul 
64695d67482SBill Paul /* Autopoll status register */
64795d67482SBill Paul #define BGE_AUTOPOLLSTS_ERROR		0x00000001
64895d67482SBill Paul 
64995d67482SBill Paul /* Transmit MAC mode register */
65095d67482SBill Paul #define BGE_TXMODE_RESET		0x00000001
65195d67482SBill Paul #define BGE_TXMODE_ENABLE		0x00000002
65295d67482SBill Paul #define BGE_TXMODE_FLOWCTL_ENABLE	0x00000010
65395d67482SBill Paul #define BGE_TXMODE_BIGBACKOFF_ENABLE	0x00000020
65495d67482SBill Paul #define BGE_TXMODE_LONGPAUSE_ENABLE	0x00000040
65595d67482SBill Paul 
65695d67482SBill Paul /* Transmit MAC status register */
65795d67482SBill Paul #define BGE_TXSTAT_RX_XOFFED		0x00000001
65895d67482SBill Paul #define BGE_TXSTAT_SENT_XOFF		0x00000002
65995d67482SBill Paul #define BGE_TXSTAT_SENT_XON		0x00000004
66095d67482SBill Paul #define BGE_TXSTAT_LINK_UP		0x00000008
66195d67482SBill Paul #define BGE_TXSTAT_ODI_UFLOW		0x00000010
66295d67482SBill Paul #define BGE_TXSTAT_ODI_OFLOW		0x00000020
66395d67482SBill Paul 
66495d67482SBill Paul /* Transmit MAC lengths register */
66595d67482SBill Paul #define BGE_TXLEN_SLOTTIME		0x000000FF
66695d67482SBill Paul #define BGE_TXLEN_IPG			0x00000F00
66795d67482SBill Paul #define BGE_TXLEN_CRS			0x00003000
66895d67482SBill Paul 
66995d67482SBill Paul /* Receive MAC mode register */
67095d67482SBill Paul #define BGE_RXMODE_RESET		0x00000001
67195d67482SBill Paul #define BGE_RXMODE_ENABLE		0x00000002
67295d67482SBill Paul #define BGE_RXMODE_FLOWCTL_ENABLE	0x00000004
67395d67482SBill Paul #define BGE_RXMODE_RX_GIANTS		0x00000020
67495d67482SBill Paul #define BGE_RXMODE_RX_RUNTS		0x00000040
67595d67482SBill Paul #define BGE_RXMODE_8022_LENCHECK	0x00000080
67695d67482SBill Paul #define BGE_RXMODE_RX_PROMISC		0x00000100
67795d67482SBill Paul #define BGE_RXMODE_RX_NO_CRC_CHECK	0x00000200
67895d67482SBill Paul #define BGE_RXMODE_RX_KEEP_VLAN_DIAG	0x00000400
67995d67482SBill Paul 
68095d67482SBill Paul /* Receive MAC status register */
68195d67482SBill Paul #define BGE_RXSTAT_REMOTE_XOFFED	0x00000001
68295d67482SBill Paul #define BGE_RXSTAT_RCVD_XOFF		0x00000002
68395d67482SBill Paul #define BGE_RXSTAT_RCVD_XON		0x00000004
68495d67482SBill Paul 
68595d67482SBill Paul /* Receive Rules Control register */
68695d67482SBill Paul #define BGE_RXRULECTL_OFFSET		0x000000FF
68795d67482SBill Paul #define BGE_RXRULECTL_CLASS		0x00001F00
68895d67482SBill Paul #define BGE_RXRULECTL_HDRTYPE		0x0000E000
68995d67482SBill Paul #define BGE_RXRULECTL_COMPARE_OP	0x00030000
69095d67482SBill Paul #define BGE_RXRULECTL_MAP		0x01000000
69195d67482SBill Paul #define BGE_RXRULECTL_DISCARD		0x02000000
69295d67482SBill Paul #define BGE_RXRULECTL_MASK		0x04000000
69395d67482SBill Paul #define BGE_RXRULECTL_ACTIVATE_PROC3	0x08000000
69495d67482SBill Paul #define BGE_RXRULECTL_ACTIVATE_PROC2	0x10000000
69595d67482SBill Paul #define BGE_RXRULECTL_ACTIVATE_PROC1	0x20000000
69695d67482SBill Paul #define BGE_RXRULECTL_ANDWITHNEXT	0x40000000
69795d67482SBill Paul 
69895d67482SBill Paul /* Receive Rules Mask register */
69995d67482SBill Paul #define BGE_RXRULEMASK_VALUE		0x0000FFFF
70095d67482SBill Paul #define BGE_RXRULEMASK_MASKVAL		0xFFFF0000
70195d67482SBill Paul 
702da3003f0SBill Paul /* SERDES configuration register */
703da3003f0SBill Paul #define BGE_SERDESCFG_RXR		0x00000007 /* phase interpolator */
704da3003f0SBill Paul #define BGE_SERDESCFG_RXG		0x00000018 /* rx gain setting */
705da3003f0SBill Paul #define BGE_SERDESCFG_RXEDGESEL		0x00000040 /* rising/falling egde */
706da3003f0SBill Paul #define BGE_SERDESCFG_TX_BIAS		0x00000380 /* TXDAC bias setting */
707da3003f0SBill Paul #define BGE_SERDESCFG_IBMAX		0x00000400 /* bias current +25% */
708da3003f0SBill Paul #define BGE_SERDESCFG_IBMIN		0x00000800 /* bias current -25% */
709da3003f0SBill Paul #define BGE_SERDESCFG_TXMODE		0x00001000
710da3003f0SBill Paul #define BGE_SERDESCFG_TXEDGESEL		0x00002000 /* rising/falling edge */
711da3003f0SBill Paul #define BGE_SERDESCFG_MODE		0x00004000 /* TXCP/TXCN disabled */
712da3003f0SBill Paul #define BGE_SERDESCFG_PLLTEST		0x00008000 /* PLL test mode */
713da3003f0SBill Paul #define BGE_SERDESCFG_CDET		0x00010000 /* comma detect enable */
714da3003f0SBill Paul #define BGE_SERDESCFG_TBILOOP		0x00020000 /* local loopback */
715da3003f0SBill Paul #define BGE_SERDESCFG_REMLOOP		0x00040000 /* remote loopback */
716da3003f0SBill Paul #define BGE_SERDESCFG_INVPHASE		0x00080000 /* Reverse 125Mhz clock */
717da3003f0SBill Paul #define BGE_SERDESCFG_12REGCTL		0x00300000 /* 1.2v regulator ctl */
718da3003f0SBill Paul #define BGE_SERDESCFG_REGCTL		0x00C00000 /* regulator ctl (2.5v) */
719da3003f0SBill Paul 
720da3003f0SBill Paul /* SERDES status register */
721da3003f0SBill Paul #define BGE_SERDESSTS_RXSTAT		0x0000000F /* receive status bits */
722da3003f0SBill Paul #define BGE_SERDESSTS_CDET		0x00000010 /* comma code detected */
723da3003f0SBill Paul 
724da3003f0SBill Paul /* SGDIG config (not documented) */
725da3003f0SBill Paul #define BGE_SGDIGCFG_PAUSE_CAP		0x00000800
726da3003f0SBill Paul #define BGE_SGDIGCFG_ASYM_PAUSE		0x00001000
727da3003f0SBill Paul #define BGE_SGDIGCFG_SEND		0x40000000
728da3003f0SBill Paul #define BGE_SGDIGCFG_AUTO		0x80000000
729da3003f0SBill Paul 
730da3003f0SBill Paul /* SGDIG status (not documented) */
731da3003f0SBill Paul #define BGE_SGDIGSTS_PAUSE_CAP		0x00080000
732da3003f0SBill Paul #define BGE_SGDIGSTS_ASYM_PAUSE		0x00100000
733da3003f0SBill Paul #define BGE_SGDIGSTS_DONE		0x00000002
734da3003f0SBill Paul 
735da3003f0SBill Paul 
73695d67482SBill Paul /* MI communication register */
73795d67482SBill Paul #define BGE_MICOMM_DATA			0x0000FFFF
73895d67482SBill Paul #define BGE_MICOMM_REG			0x001F0000
73995d67482SBill Paul #define BGE_MICOMM_PHY			0x03E00000
74095d67482SBill Paul #define BGE_MICOMM_CMD			0x0C000000
74195d67482SBill Paul #define BGE_MICOMM_READFAIL		0x10000000
74295d67482SBill Paul #define BGE_MICOMM_BUSY			0x20000000
74395d67482SBill Paul 
74495d67482SBill Paul #define BGE_MIREG(x)	((x & 0x1F) << 16)
74595d67482SBill Paul #define BGE_MIPHY(x)	((x & 0x1F) << 21)
74695d67482SBill Paul #define BGE_MICMD_WRITE			0x04000000
74795d67482SBill Paul #define BGE_MICMD_READ			0x08000000
74895d67482SBill Paul 
74995d67482SBill Paul /* MI status register */
75095d67482SBill Paul #define BGE_MISTS_LINK			0x00000001
75195d67482SBill Paul #define BGE_MISTS_10MBPS		0x00000002
75295d67482SBill Paul 
75395d67482SBill Paul #define BGE_MIMODE_SHORTPREAMBLE	0x00000002
75495d67482SBill Paul #define BGE_MIMODE_AUTOPOLL		0x00000010
75595d67482SBill Paul #define BGE_MIMODE_CLKCNT		0x001F0000
75695d67482SBill Paul 
75795d67482SBill Paul 
75895d67482SBill Paul /*
75995d67482SBill Paul  * Send data initiator control registers.
76095d67482SBill Paul  */
76195d67482SBill Paul #define BGE_SDI_MODE			0x0C00
76295d67482SBill Paul #define BGE_SDI_STATUS			0x0C04
76395d67482SBill Paul #define BGE_SDI_STATS_CTL		0x0C08
76495d67482SBill Paul #define BGE_SDI_STATS_ENABLE_MASK	0x0C0C
76595d67482SBill Paul #define BGE_SDI_STATS_INCREMENT_MASK	0x0C10
76695d67482SBill Paul #define BGE_LOCSTATS_COS0		0x0C80
76795d67482SBill Paul #define BGE_LOCSTATS_COS1		0x0C84
76895d67482SBill Paul #define BGE_LOCSTATS_COS2		0x0C88
76995d67482SBill Paul #define BGE_LOCSTATS_COS3		0x0C8C
77095d67482SBill Paul #define BGE_LOCSTATS_COS4		0x0C90
77195d67482SBill Paul #define BGE_LOCSTATS_COS5		0x0C84
77295d67482SBill Paul #define BGE_LOCSTATS_COS6		0x0C98
77395d67482SBill Paul #define BGE_LOCSTATS_COS7		0x0C9C
77495d67482SBill Paul #define BGE_LOCSTATS_COS8		0x0CA0
77595d67482SBill Paul #define BGE_LOCSTATS_COS9		0x0CA4
77695d67482SBill Paul #define BGE_LOCSTATS_COS10		0x0CA8
77795d67482SBill Paul #define BGE_LOCSTATS_COS11		0x0CAC
77895d67482SBill Paul #define BGE_LOCSTATS_COS12		0x0CB0
77995d67482SBill Paul #define BGE_LOCSTATS_COS13		0x0CB4
78095d67482SBill Paul #define BGE_LOCSTATS_COS14		0x0CB8
78195d67482SBill Paul #define BGE_LOCSTATS_COS15		0x0CBC
78295d67482SBill Paul #define BGE_LOCSTATS_DMA_RQ_FULL	0x0CC0
78395d67482SBill Paul #define BGE_LOCSTATS_DMA_HIPRIO_RQ_FULL	0x0CC4
78495d67482SBill Paul #define BGE_LOCSTATS_SDC_QUEUE_FULL	0x0CC8
78595d67482SBill Paul #define BGE_LOCSTATS_NIC_SENDPROD_SET	0x0CCC
78695d67482SBill Paul #define BGE_LOCSTATS_STATS_UPDATED	0x0CD0
78795d67482SBill Paul #define BGE_LOCSTATS_IRQS		0x0CD4
78895d67482SBill Paul #define BGE_LOCSTATS_AVOIDED_IRQS	0x0CD8
78995d67482SBill Paul #define BGE_LOCSTATS_TX_THRESH_HIT	0x0CDC
79095d67482SBill Paul 
79195d67482SBill Paul /* Send Data Initiator mode register */
79295d67482SBill Paul #define BGE_SDIMODE_RESET		0x00000001
79395d67482SBill Paul #define BGE_SDIMODE_ENABLE		0x00000002
79495d67482SBill Paul #define BGE_SDIMODE_STATS_OFLOW_ATTN	0x00000004
79595d67482SBill Paul 
79695d67482SBill Paul /* Send Data Initiator stats register */
79795d67482SBill Paul #define BGE_SDISTAT_STATS_OFLOW_ATTN	0x00000004
79895d67482SBill Paul 
79995d67482SBill Paul /* Send Data Initiator stats control register */
80095d67482SBill Paul #define BGE_SDISTATSCTL_ENABLE		0x00000001
80195d67482SBill Paul #define BGE_SDISTATSCTL_FASTER		0x00000002
80295d67482SBill Paul #define BGE_SDISTATSCTL_CLEAR		0x00000004
80395d67482SBill Paul #define BGE_SDISTATSCTL_FORCEFLUSH	0x00000008
80495d67482SBill Paul #define BGE_SDISTATSCTL_FORCEZERO	0x00000010
80595d67482SBill Paul 
80695d67482SBill Paul /*
80795d67482SBill Paul  * Send Data Completion Control registers
80895d67482SBill Paul  */
80995d67482SBill Paul #define BGE_SDC_MODE			0x1000
81095d67482SBill Paul #define BGE_SDC_STATUS			0x1004
81195d67482SBill Paul 
81295d67482SBill Paul /* Send Data completion mode register */
81395d67482SBill Paul #define BGE_SDCMODE_RESET		0x00000001
81495d67482SBill Paul #define BGE_SDCMODE_ENABLE		0x00000002
81595d67482SBill Paul #define BGE_SDCMODE_ATTN		0x00000004
81695d67482SBill Paul 
81795d67482SBill Paul /* Send Data completion status register */
81895d67482SBill Paul #define BGE_SDCSTAT_ATTN		0x00000004
81995d67482SBill Paul 
82095d67482SBill Paul /*
82195d67482SBill Paul  * Send BD Ring Selector Control registers
82295d67482SBill Paul  */
82395d67482SBill Paul #define BGE_SRS_MODE			0x1400
82495d67482SBill Paul #define BGE_SRS_STATUS			0x1404
82595d67482SBill Paul #define BGE_SRS_HWDIAG			0x1408
82695d67482SBill Paul #define BGE_SRS_LOC_NIC_CONS0		0x1440
82795d67482SBill Paul #define BGE_SRS_LOC_NIC_CONS1		0x1444
82895d67482SBill Paul #define BGE_SRS_LOC_NIC_CONS2		0x1448
82995d67482SBill Paul #define BGE_SRS_LOC_NIC_CONS3		0x144C
83095d67482SBill Paul #define BGE_SRS_LOC_NIC_CONS4		0x1450
83195d67482SBill Paul #define BGE_SRS_LOC_NIC_CONS5		0x1454
83295d67482SBill Paul #define BGE_SRS_LOC_NIC_CONS6		0x1458
83395d67482SBill Paul #define BGE_SRS_LOC_NIC_CONS7		0x145C
83495d67482SBill Paul #define BGE_SRS_LOC_NIC_CONS8		0x1460
83595d67482SBill Paul #define BGE_SRS_LOC_NIC_CONS9		0x1464
83695d67482SBill Paul #define BGE_SRS_LOC_NIC_CONS10		0x1468
83795d67482SBill Paul #define BGE_SRS_LOC_NIC_CONS11		0x146C
83895d67482SBill Paul #define BGE_SRS_LOC_NIC_CONS12		0x1470
83995d67482SBill Paul #define BGE_SRS_LOC_NIC_CONS13		0x1474
84095d67482SBill Paul #define BGE_SRS_LOC_NIC_CONS14		0x1478
84195d67482SBill Paul #define BGE_SRS_LOC_NIC_CONS15		0x147C
84295d67482SBill Paul 
84395d67482SBill Paul /* Send BD Ring Selector Mode register */
84495d67482SBill Paul #define BGE_SRSMODE_RESET		0x00000001
84595d67482SBill Paul #define BGE_SRSMODE_ENABLE		0x00000002
84695d67482SBill Paul #define BGE_SRSMODE_ATTN		0x00000004
84795d67482SBill Paul 
84895d67482SBill Paul /* Send BD Ring Selector Status register */
84995d67482SBill Paul #define BGE_SRSSTAT_ERROR		0x00000004
85095d67482SBill Paul 
85195d67482SBill Paul /* Send BD Ring Selector HW Diagnostics register */
85295d67482SBill Paul #define BGE_SRSHWDIAG_STATE		0x0000000F
85395d67482SBill Paul #define BGE_SRSHWDIAG_CURRINGNUM	0x000000F0
85495d67482SBill Paul #define BGE_SRSHWDIAG_STAGEDRINGNUM	0x00000F00
85595d67482SBill Paul #define BGE_SRSHWDIAG_RINGNUM_IN_MBX	0x0000F000
85695d67482SBill Paul 
85795d67482SBill Paul /*
85895d67482SBill Paul  * Send BD Initiator Selector Control registers
85995d67482SBill Paul  */
86095d67482SBill Paul #define BGE_SBDI_MODE			0x1800
86195d67482SBill Paul #define BGE_SBDI_STATUS			0x1804
86295d67482SBill Paul #define BGE_SBDI_LOC_NIC_PROD0		0x1808
86395d67482SBill Paul #define BGE_SBDI_LOC_NIC_PROD1		0x180C
86495d67482SBill Paul #define BGE_SBDI_LOC_NIC_PROD2		0x1810
86595d67482SBill Paul #define BGE_SBDI_LOC_NIC_PROD3		0x1814
86695d67482SBill Paul #define BGE_SBDI_LOC_NIC_PROD4		0x1818
86795d67482SBill Paul #define BGE_SBDI_LOC_NIC_PROD5		0x181C
86895d67482SBill Paul #define BGE_SBDI_LOC_NIC_PROD6		0x1820
86995d67482SBill Paul #define BGE_SBDI_LOC_NIC_PROD7		0x1824
87095d67482SBill Paul #define BGE_SBDI_LOC_NIC_PROD8		0x1828
87195d67482SBill Paul #define BGE_SBDI_LOC_NIC_PROD9		0x182C
87295d67482SBill Paul #define BGE_SBDI_LOC_NIC_PROD10		0x1830
87395d67482SBill Paul #define BGE_SBDI_LOC_NIC_PROD11		0x1834
87495d67482SBill Paul #define BGE_SBDI_LOC_NIC_PROD12		0x1838
87595d67482SBill Paul #define BGE_SBDI_LOC_NIC_PROD13		0x183C
87695d67482SBill Paul #define BGE_SBDI_LOC_NIC_PROD14		0x1840
87795d67482SBill Paul #define BGE_SBDI_LOC_NIC_PROD15		0x1844
87895d67482SBill Paul 
87995d67482SBill Paul /* Send BD Initiator Mode register */
88095d67482SBill Paul #define BGE_SBDIMODE_RESET		0x00000001
88195d67482SBill Paul #define BGE_SBDIMODE_ENABLE		0x00000002
88295d67482SBill Paul #define BGE_SBDIMODE_ATTN		0x00000004
88395d67482SBill Paul 
88495d67482SBill Paul /* Send BD Initiator Status register */
88595d67482SBill Paul #define BGE_SBDISTAT_ERROR		0x00000004
88695d67482SBill Paul 
88795d67482SBill Paul /*
88895d67482SBill Paul  * Send BD Completion Control registers
88995d67482SBill Paul  */
89095d67482SBill Paul #define BGE_SBDC_MODE			0x1C00
89195d67482SBill Paul #define BGE_SBDC_STATUS			0x1C04
89295d67482SBill Paul 
89395d67482SBill Paul /* Send BD Completion Control Mode register */
89495d67482SBill Paul #define BGE_SBDCMODE_RESET		0x00000001
89595d67482SBill Paul #define BGE_SBDCMODE_ENABLE		0x00000002
89695d67482SBill Paul #define BGE_SBDCMODE_ATTN		0x00000004
89795d67482SBill Paul 
89895d67482SBill Paul /* Send BD Completion Control Status register */
89995d67482SBill Paul #define BGE_SBDCSTAT_ATTN		0x00000004
90095d67482SBill Paul 
90195d67482SBill Paul /*
90295d67482SBill Paul  * Receive List Placement Control registers
90395d67482SBill Paul  */
90495d67482SBill Paul #define BGE_RXLP_MODE			0x2000
90595d67482SBill Paul #define BGE_RXLP_STATUS			0x2004
90695d67482SBill Paul #define BGE_RXLP_SEL_LIST_LOCK		0x2008
90795d67482SBill Paul #define BGE_RXLP_SEL_NON_EMPTY_BITS	0x200C
90895d67482SBill Paul #define BGE_RXLP_CFG			0x2010
90995d67482SBill Paul #define BGE_RXLP_STATS_CTL		0x2014
91095d67482SBill Paul #define BGE_RXLP_STATS_ENABLE_MASK	0x2018
91195d67482SBill Paul #define BGE_RXLP_STATS_INCREMENT_MASK	0x201C
91295d67482SBill Paul #define BGE_RXLP_HEAD0			0x2100
91395d67482SBill Paul #define BGE_RXLP_TAIL0			0x2104
91495d67482SBill Paul #define BGE_RXLP_COUNT0			0x2108
91595d67482SBill Paul #define BGE_RXLP_HEAD1			0x2110
91695d67482SBill Paul #define BGE_RXLP_TAIL1			0x2114
91795d67482SBill Paul #define BGE_RXLP_COUNT1			0x2118
91895d67482SBill Paul #define BGE_RXLP_HEAD2			0x2120
91995d67482SBill Paul #define BGE_RXLP_TAIL2			0x2124
92095d67482SBill Paul #define BGE_RXLP_COUNT2			0x2128
92195d67482SBill Paul #define BGE_RXLP_HEAD3			0x2130
92295d67482SBill Paul #define BGE_RXLP_TAIL3			0x2134
92395d67482SBill Paul #define BGE_RXLP_COUNT3			0x2138
92495d67482SBill Paul #define BGE_RXLP_HEAD4			0x2140
92595d67482SBill Paul #define BGE_RXLP_TAIL4			0x2144
92695d67482SBill Paul #define BGE_RXLP_COUNT4			0x2148
92795d67482SBill Paul #define BGE_RXLP_HEAD5			0x2150
92895d67482SBill Paul #define BGE_RXLP_TAIL5			0x2154
92995d67482SBill Paul #define BGE_RXLP_COUNT5			0x2158
93095d67482SBill Paul #define BGE_RXLP_HEAD6			0x2160
93195d67482SBill Paul #define BGE_RXLP_TAIL6			0x2164
93295d67482SBill Paul #define BGE_RXLP_COUNT6			0x2168
93395d67482SBill Paul #define BGE_RXLP_HEAD7			0x2170
93495d67482SBill Paul #define BGE_RXLP_TAIL7			0x2174
93595d67482SBill Paul #define BGE_RXLP_COUNT7			0x2178
93695d67482SBill Paul #define BGE_RXLP_HEAD8			0x2180
93795d67482SBill Paul #define BGE_RXLP_TAIL8			0x2184
93895d67482SBill Paul #define BGE_RXLP_COUNT8			0x2188
93995d67482SBill Paul #define BGE_RXLP_HEAD9			0x2190
94095d67482SBill Paul #define BGE_RXLP_TAIL9			0x2194
94195d67482SBill Paul #define BGE_RXLP_COUNT9			0x2198
94295d67482SBill Paul #define BGE_RXLP_HEAD10			0x21A0
94395d67482SBill Paul #define BGE_RXLP_TAIL10			0x21A4
94495d67482SBill Paul #define BGE_RXLP_COUNT10		0x21A8
94595d67482SBill Paul #define BGE_RXLP_HEAD11			0x21B0
94695d67482SBill Paul #define BGE_RXLP_TAIL11			0x21B4
94795d67482SBill Paul #define BGE_RXLP_COUNT11		0x21B8
94895d67482SBill Paul #define BGE_RXLP_HEAD12			0x21C0
94995d67482SBill Paul #define BGE_RXLP_TAIL12			0x21C4
95095d67482SBill Paul #define BGE_RXLP_COUNT12		0x21C8
95195d67482SBill Paul #define BGE_RXLP_HEAD13			0x21D0
95295d67482SBill Paul #define BGE_RXLP_TAIL13			0x21D4
95395d67482SBill Paul #define BGE_RXLP_COUNT13		0x21D8
95495d67482SBill Paul #define BGE_RXLP_HEAD14			0x21E0
95595d67482SBill Paul #define BGE_RXLP_TAIL14			0x21E4
95695d67482SBill Paul #define BGE_RXLP_COUNT14		0x21E8
95795d67482SBill Paul #define BGE_RXLP_HEAD15			0x21F0
95895d67482SBill Paul #define BGE_RXLP_TAIL15			0x21F4
95995d67482SBill Paul #define BGE_RXLP_COUNT15		0x21F8
96095d67482SBill Paul #define BGE_RXLP_LOCSTAT_COS0		0x2200
96195d67482SBill Paul #define BGE_RXLP_LOCSTAT_COS1		0x2204
96295d67482SBill Paul #define BGE_RXLP_LOCSTAT_COS2		0x2208
96395d67482SBill Paul #define BGE_RXLP_LOCSTAT_COS3		0x220C
96495d67482SBill Paul #define BGE_RXLP_LOCSTAT_COS4		0x2210
96595d67482SBill Paul #define BGE_RXLP_LOCSTAT_COS5		0x2214
96695d67482SBill Paul #define BGE_RXLP_LOCSTAT_COS6		0x2218
96795d67482SBill Paul #define BGE_RXLP_LOCSTAT_COS7		0x221C
96895d67482SBill Paul #define BGE_RXLP_LOCSTAT_COS8		0x2220
96995d67482SBill Paul #define BGE_RXLP_LOCSTAT_COS9		0x2224
97095d67482SBill Paul #define BGE_RXLP_LOCSTAT_COS10		0x2228
97195d67482SBill Paul #define BGE_RXLP_LOCSTAT_COS11		0x222C
97295d67482SBill Paul #define BGE_RXLP_LOCSTAT_COS12		0x2230
97395d67482SBill Paul #define BGE_RXLP_LOCSTAT_COS13		0x2234
97495d67482SBill Paul #define BGE_RXLP_LOCSTAT_COS14		0x2238
97595d67482SBill Paul #define BGE_RXLP_LOCSTAT_COS15		0x223C
97695d67482SBill Paul #define BGE_RXLP_LOCSTAT_FILTDROP	0x2240
97795d67482SBill Paul #define BGE_RXLP_LOCSTAT_DMA_WRQ_FULL	0x2244
97895d67482SBill Paul #define BGE_RXLP_LOCSTAT_DMA_HPWRQ_FULL	0x2248
97995d67482SBill Paul #define BGE_RXLP_LOCSTAT_OUT_OF_BDS	0x224C
98095d67482SBill Paul #define BGE_RXLP_LOCSTAT_IFIN_DROPS	0x2250
98195d67482SBill Paul #define BGE_RXLP_LOCSTAT_IFIN_ERRORS	0x2254
98295d67482SBill Paul #define BGE_RXLP_LOCSTAT_RXTHRESH_HIT	0x2258
98395d67482SBill Paul 
98495d67482SBill Paul 
98595d67482SBill Paul /* Receive List Placement mode register */
98695d67482SBill Paul #define BGE_RXLPMODE_RESET		0x00000001
98795d67482SBill Paul #define BGE_RXLPMODE_ENABLE		0x00000002
98895d67482SBill Paul #define BGE_RXLPMODE_CLASS0_ATTN	0x00000004
98995d67482SBill Paul #define BGE_RXLPMODE_MAPOUTRANGE_ATTN	0x00000008
99095d67482SBill Paul #define BGE_RXLPMODE_STATSOFLOW_ATTN	0x00000010
99195d67482SBill Paul 
99295d67482SBill Paul /* Receive List Placement Status register */
99395d67482SBill Paul #define BGE_RXLPSTAT_CLASS0_ATTN	0x00000004
99495d67482SBill Paul #define BGE_RXLPSTAT_MAPOUTRANGE_ATTN	0x00000008
99595d67482SBill Paul #define BGE_RXLPSTAT_STATSOFLOW_ATTN	0x00000010
99695d67482SBill Paul 
99795d67482SBill Paul /*
99895d67482SBill Paul  * Receive Data and Receive BD Initiator Control Registers
99995d67482SBill Paul  */
100095d67482SBill Paul #define BGE_RDBDI_MODE			0x2400
100195d67482SBill Paul #define BGE_RDBDI_STATUS		0x2404
100295d67482SBill Paul #define BGE_RX_JUMBO_RCB_HADDR_HI	0x2440
100395d67482SBill Paul #define BGE_RX_JUMBO_RCB_HADDR_LO	0x2444
100495d67482SBill Paul #define BGE_RX_JUMBO_RCB_MAXLEN_FLAGS	0x2448
100595d67482SBill Paul #define BGE_RX_JUMBO_RCB_NICADDR	0x244C
100695d67482SBill Paul #define BGE_RX_STD_RCB_HADDR_HI		0x2450
100795d67482SBill Paul #define BGE_RX_STD_RCB_HADDR_LO		0x2454
100895d67482SBill Paul #define BGE_RX_STD_RCB_MAXLEN_FLAGS	0x2458
100995d67482SBill Paul #define BGE_RX_STD_RCB_NICADDR		0x245C
101095d67482SBill Paul #define BGE_RX_MINI_RCB_HADDR_HI	0x2460
101195d67482SBill Paul #define BGE_RX_MINI_RCB_HADDR_LO	0x2464
101295d67482SBill Paul #define BGE_RX_MINI_RCB_MAXLEN_FLAGS	0x2468
101395d67482SBill Paul #define BGE_RX_MINI_RCB_NICADDR		0x246C
101495d67482SBill Paul #define BGE_RDBDI_JUMBO_RX_CONS		0x2470
101595d67482SBill Paul #define BGE_RDBDI_STD_RX_CONS		0x2474
101695d67482SBill Paul #define BGE_RDBDI_MINI_RX_CONS		0x2478
101795d67482SBill Paul #define BGE_RDBDI_RETURN_PROD0		0x2480
101895d67482SBill Paul #define BGE_RDBDI_RETURN_PROD1		0x2484
101995d67482SBill Paul #define BGE_RDBDI_RETURN_PROD2		0x2488
102095d67482SBill Paul #define BGE_RDBDI_RETURN_PROD3		0x248C
102195d67482SBill Paul #define BGE_RDBDI_RETURN_PROD4		0x2490
102295d67482SBill Paul #define BGE_RDBDI_RETURN_PROD5		0x2494
102395d67482SBill Paul #define BGE_RDBDI_RETURN_PROD6		0x2498
102495d67482SBill Paul #define BGE_RDBDI_RETURN_PROD7		0x249C
102595d67482SBill Paul #define BGE_RDBDI_RETURN_PROD8		0x24A0
102695d67482SBill Paul #define BGE_RDBDI_RETURN_PROD9		0x24A4
102795d67482SBill Paul #define BGE_RDBDI_RETURN_PROD10		0x24A8
102895d67482SBill Paul #define BGE_RDBDI_RETURN_PROD11		0x24AC
102995d67482SBill Paul #define BGE_RDBDI_RETURN_PROD12		0x24B0
103095d67482SBill Paul #define BGE_RDBDI_RETURN_PROD13		0x24B4
103195d67482SBill Paul #define BGE_RDBDI_RETURN_PROD14		0x24B8
103295d67482SBill Paul #define BGE_RDBDI_RETURN_PROD15		0x24BC
103395d67482SBill Paul #define BGE_RDBDI_HWDIAG		0x24C0
103495d67482SBill Paul 
103595d67482SBill Paul 
103695d67482SBill Paul /* Receive Data and Receive BD Initiator Mode register */
103795d67482SBill Paul #define BGE_RDBDIMODE_RESET		0x00000001
103895d67482SBill Paul #define BGE_RDBDIMODE_ENABLE		0x00000002
103995d67482SBill Paul #define BGE_RDBDIMODE_JUMBO_ATTN	0x00000004
104095d67482SBill Paul #define BGE_RDBDIMODE_GIANT_ATTN	0x00000008
104195d67482SBill Paul #define BGE_RDBDIMODE_BADRINGSZ_ATTN	0x00000010
104295d67482SBill Paul 
104395d67482SBill Paul /* Receive Data and Receive BD Initiator Status register */
104495d67482SBill Paul #define BGE_RDBDISTAT_JUMBO_ATTN	0x00000004
104595d67482SBill Paul #define BGE_RDBDISTAT_GIANT_ATTN	0x00000008
104695d67482SBill Paul #define BGE_RDBDISTAT_BADRINGSZ_ATTN	0x00000010
104795d67482SBill Paul 
104895d67482SBill Paul 
104995d67482SBill Paul /*
105095d67482SBill Paul  * Receive Data Completion Control registers
105195d67482SBill Paul  */
105295d67482SBill Paul #define BGE_RDC_MODE			0x2800
105395d67482SBill Paul 
105495d67482SBill Paul /* Receive Data Completion Mode register */
105595d67482SBill Paul #define BGE_RDCMODE_RESET		0x00000001
105695d67482SBill Paul #define BGE_RDCMODE_ENABLE		0x00000002
105795d67482SBill Paul #define BGE_RDCMODE_ATTN		0x00000004
105895d67482SBill Paul 
105995d67482SBill Paul /*
106095d67482SBill Paul  * Receive BD Initiator Control registers
106195d67482SBill Paul  */
106295d67482SBill Paul #define BGE_RBDI_MODE			0x2C00
106395d67482SBill Paul #define BGE_RBDI_STATUS			0x2C04
106495d67482SBill Paul #define BGE_RBDI_NIC_JUMBO_BD_PROD	0x2C08
106595d67482SBill Paul #define BGE_RBDI_NIC_STD_BD_PROD	0x2C0C
106695d67482SBill Paul #define BGE_RBDI_NIC_MINI_BD_PROD	0x2C10
106795d67482SBill Paul #define BGE_RBDI_MINI_REPL_THRESH	0x2C14
106895d67482SBill Paul #define BGE_RBDI_STD_REPL_THRESH	0x2C18
106995d67482SBill Paul #define BGE_RBDI_JUMBO_REPL_THRESH	0x2C1C
107095d67482SBill Paul 
107195d67482SBill Paul /* Receive BD Initiator Mode register */
107295d67482SBill Paul #define BGE_RBDIMODE_RESET		0x00000001
107395d67482SBill Paul #define BGE_RBDIMODE_ENABLE		0x00000002
107495d67482SBill Paul #define BGE_RBDIMODE_ATTN		0x00000004
107595d67482SBill Paul 
107695d67482SBill Paul /* Receive BD Initiator Status register */
107795d67482SBill Paul #define BGE_RBDISTAT_ATTN		0x00000004
107895d67482SBill Paul 
107995d67482SBill Paul /*
108095d67482SBill Paul  * Receive BD Completion Control registers
108195d67482SBill Paul  */
108295d67482SBill Paul #define BGE_RBDC_MODE			0x3000
108395d67482SBill Paul #define BGE_RBDC_STATUS			0x3004
108495d67482SBill Paul #define BGE_RBDC_JUMBO_BD_PROD		0x3008
108595d67482SBill Paul #define BGE_RBDC_STD_BD_PROD		0x300C
108695d67482SBill Paul #define BGE_RBDC_MINI_BD_PROD		0x3010
108795d67482SBill Paul 
108895d67482SBill Paul /* Receive BD completion mode register */
108995d67482SBill Paul #define BGE_RBDCMODE_RESET		0x00000001
109095d67482SBill Paul #define BGE_RBDCMODE_ENABLE		0x00000002
109195d67482SBill Paul #define BGE_RBDCMODE_ATTN		0x00000004
109295d67482SBill Paul 
109395d67482SBill Paul /* Receive BD completion status register */
109495d67482SBill Paul #define BGE_RBDCSTAT_ERROR		0x00000004
109595d67482SBill Paul 
109695d67482SBill Paul /*
109795d67482SBill Paul  * Receive List Selector Control registers
109895d67482SBill Paul  */
109995d67482SBill Paul #define BGE_RXLS_MODE			0x3400
110095d67482SBill Paul #define BGE_RXLS_STATUS			0x3404
110195d67482SBill Paul 
110295d67482SBill Paul /* Receive List Selector Mode register */
110395d67482SBill Paul #define BGE_RXLSMODE_RESET		0x00000001
110495d67482SBill Paul #define BGE_RXLSMODE_ENABLE		0x00000002
110595d67482SBill Paul #define BGE_RXLSMODE_ATTN		0x00000004
110695d67482SBill Paul 
110795d67482SBill Paul /* Receive List Selector Status register */
110895d67482SBill Paul #define BGE_RXLSSTAT_ERROR		0x00000004
110995d67482SBill Paul 
111095d67482SBill Paul /*
111195d67482SBill Paul  * Mbuf Cluster Free registers (has nothing to do with BSD mbufs)
111295d67482SBill Paul  */
111395d67482SBill Paul #define BGE_MBCF_MODE			0x3800
111495d67482SBill Paul #define BGE_MBCF_STATUS			0x3804
111595d67482SBill Paul 
111695d67482SBill Paul /* Mbuf Cluster Free mode register */
111795d67482SBill Paul #define BGE_MBCFMODE_RESET		0x00000001
111895d67482SBill Paul #define BGE_MBCFMODE_ENABLE		0x00000002
111995d67482SBill Paul #define BGE_MBCFMODE_ATTN		0x00000004
112095d67482SBill Paul 
112195d67482SBill Paul /* Mbuf Cluster Free status register */
112295d67482SBill Paul #define BGE_MBCFSTAT_ERROR		0x00000004
112395d67482SBill Paul 
112495d67482SBill Paul /*
112595d67482SBill Paul  * Host Coalescing Control registers
112695d67482SBill Paul  */
112795d67482SBill Paul #define BGE_HCC_MODE			0x3C00
112895d67482SBill Paul #define BGE_HCC_STATUS			0x3C04
112995d67482SBill Paul #define BGE_HCC_RX_COAL_TICKS		0x3C08
113095d67482SBill Paul #define BGE_HCC_TX_COAL_TICKS		0x3C0C
113195d67482SBill Paul #define BGE_HCC_RX_MAX_COAL_BDS		0x3C10
113295d67482SBill Paul #define BGE_HCC_TX_MAX_COAL_BDS		0x3C14
113395d67482SBill Paul #define BGE_HCC_RX_COAL_TICKS_INT	0x3C18 /* ticks during interrupt */
113495d67482SBill Paul #define BGE_HCC_TX_COAL_TICKS_INT	0x3C1C /* ticks during interrupt */
113595d67482SBill Paul #define BGE_HCC_RX_MAX_COAL_BDS_INT	0x3C20 /* BDs during interrupt */
1136f53579cfSPaul Saab #define BGE_HCC_TX_MAX_COAL_BDS_INT	0x3C24 /* BDs during interrupt */
113795d67482SBill Paul #define BGE_HCC_STATS_TICKS		0x3C28
113895d67482SBill Paul #define BGE_HCC_STATS_ADDR_HI		0x3C30
113995d67482SBill Paul #define BGE_HCC_STATS_ADDR_LO		0x3C34
114095d67482SBill Paul #define BGE_HCC_STATUSBLK_ADDR_HI	0x3C38
114195d67482SBill Paul #define BGE_HCC_STATUSBLK_ADDR_LO	0x3C3C
114295d67482SBill Paul #define BGE_HCC_STATS_BASEADDR		0x3C40 /* address in NIC memory */
114395d67482SBill Paul #define BGE_HCC_STATUSBLK_BASEADDR	0x3C44 /* address in NIC memory */
114495d67482SBill Paul #define BGE_FLOW_ATTN			0x3C48
114595d67482SBill Paul #define BGE_HCC_JUMBO_BD_CONS		0x3C50
114695d67482SBill Paul #define BGE_HCC_STD_BD_CONS		0x3C54
114795d67482SBill Paul #define BGE_HCC_MINI_BD_CONS		0x3C58
114895d67482SBill Paul #define BGE_HCC_RX_RETURN_PROD0		0x3C80
114995d67482SBill Paul #define BGE_HCC_RX_RETURN_PROD1		0x3C84
115095d67482SBill Paul #define BGE_HCC_RX_RETURN_PROD2		0x3C88
115195d67482SBill Paul #define BGE_HCC_RX_RETURN_PROD3		0x3C8C
115295d67482SBill Paul #define BGE_HCC_RX_RETURN_PROD4		0x3C90
115395d67482SBill Paul #define BGE_HCC_RX_RETURN_PROD5		0x3C94
115495d67482SBill Paul #define BGE_HCC_RX_RETURN_PROD6		0x3C98
115595d67482SBill Paul #define BGE_HCC_RX_RETURN_PROD7		0x3C9C
115695d67482SBill Paul #define BGE_HCC_RX_RETURN_PROD8		0x3CA0
115795d67482SBill Paul #define BGE_HCC_RX_RETURN_PROD9		0x3CA4
115895d67482SBill Paul #define BGE_HCC_RX_RETURN_PROD10	0x3CA8
115995d67482SBill Paul #define BGE_HCC_RX_RETURN_PROD11	0x3CAC
116095d67482SBill Paul #define BGE_HCC_RX_RETURN_PROD12	0x3CB0
116195d67482SBill Paul #define BGE_HCC_RX_RETURN_PROD13	0x3CB4
116295d67482SBill Paul #define BGE_HCC_RX_RETURN_PROD14	0x3CB8
116395d67482SBill Paul #define BGE_HCC_RX_RETURN_PROD15	0x3CBC
116495d67482SBill Paul #define BGE_HCC_TX_BD_CONS0		0x3CC0
116595d67482SBill Paul #define BGE_HCC_TX_BD_CONS1		0x3CC4
116695d67482SBill Paul #define BGE_HCC_TX_BD_CONS2		0x3CC8
116795d67482SBill Paul #define BGE_HCC_TX_BD_CONS3		0x3CCC
116895d67482SBill Paul #define BGE_HCC_TX_BD_CONS4		0x3CD0
116995d67482SBill Paul #define BGE_HCC_TX_BD_CONS5		0x3CD4
117095d67482SBill Paul #define BGE_HCC_TX_BD_CONS6		0x3CD8
117195d67482SBill Paul #define BGE_HCC_TX_BD_CONS7		0x3CDC
117295d67482SBill Paul #define BGE_HCC_TX_BD_CONS8		0x3CE0
117395d67482SBill Paul #define BGE_HCC_TX_BD_CONS9		0x3CE4
117495d67482SBill Paul #define BGE_HCC_TX_BD_CONS10		0x3CE8
117595d67482SBill Paul #define BGE_HCC_TX_BD_CONS11		0x3CEC
117695d67482SBill Paul #define BGE_HCC_TX_BD_CONS12		0x3CF0
117795d67482SBill Paul #define BGE_HCC_TX_BD_CONS13		0x3CF4
117895d67482SBill Paul #define BGE_HCC_TX_BD_CONS14		0x3CF8
117995d67482SBill Paul #define BGE_HCC_TX_BD_CONS15		0x3CFC
118095d67482SBill Paul 
118195d67482SBill Paul 
118295d67482SBill Paul /* Host coalescing mode register */
118395d67482SBill Paul #define BGE_HCCMODE_RESET		0x00000001
118495d67482SBill Paul #define BGE_HCCMODE_ENABLE		0x00000002
118595d67482SBill Paul #define BGE_HCCMODE_ATTN		0x00000004
118695d67482SBill Paul #define BGE_HCCMODE_COAL_NOW		0x00000008
11874a531e8dSPawel Jakub Dawidek #define BGE_HCCMODE_MSI_BITS		0x00000070
118895d67482SBill Paul #define BGE_HCCMODE_STATBLK_SIZE	0x00000180
118995d67482SBill Paul 
119095d67482SBill Paul #define BGE_STATBLKSZ_FULL		0x00000000
119195d67482SBill Paul #define BGE_STATBLKSZ_64BYTE		0x00000080
119295d67482SBill Paul #define BGE_STATBLKSZ_32BYTE		0x00000100
119395d67482SBill Paul 
119495d67482SBill Paul /* Host coalescing status register */
119595d67482SBill Paul #define BGE_HCCSTAT_ERROR		0x00000004
119695d67482SBill Paul 
119795d67482SBill Paul /* Flow attention register */
119895d67482SBill Paul #define BGE_FLOWATTN_MB_LOWAT		0x00000040
119995d67482SBill Paul #define BGE_FLOWATTN_MEMARB		0x00000080
120095d67482SBill Paul #define BGE_FLOWATTN_HOSTCOAL		0x00008000
120195d67482SBill Paul #define BGE_FLOWATTN_DMADONE_DISCARD	0x00010000
120295d67482SBill Paul #define BGE_FLOWATTN_RCB_INVAL		0x00020000
120395d67482SBill Paul #define BGE_FLOWATTN_RXDATA_CORRUPT	0x00040000
120495d67482SBill Paul #define BGE_FLOWATTN_RDBDI		0x00080000
120595d67482SBill Paul #define BGE_FLOWATTN_RXLS		0x00100000
120695d67482SBill Paul #define BGE_FLOWATTN_RXLP		0x00200000
120795d67482SBill Paul #define BGE_FLOWATTN_RBDC		0x00400000
120895d67482SBill Paul #define BGE_FLOWATTN_RBDI		0x00800000
120995d67482SBill Paul #define BGE_FLOWATTN_SDC		0x08000000
121095d67482SBill Paul #define BGE_FLOWATTN_SDI		0x10000000
121195d67482SBill Paul #define BGE_FLOWATTN_SRS		0x20000000
121295d67482SBill Paul #define BGE_FLOWATTN_SBDC		0x40000000
121395d67482SBill Paul #define BGE_FLOWATTN_SBDI		0x80000000
121495d67482SBill Paul 
121595d67482SBill Paul /*
121695d67482SBill Paul  * Memory arbiter registers
121795d67482SBill Paul  */
121895d67482SBill Paul #define BGE_MARB_MODE			0x4000
121995d67482SBill Paul #define BGE_MARB_STATUS			0x4004
122095d67482SBill Paul #define BGE_MARB_TRAPADDR_HI		0x4008
122195d67482SBill Paul #define BGE_MARB_TRAPADDR_LO		0x400C
122295d67482SBill Paul 
122395d67482SBill Paul /* Memory arbiter mode register */
122495d67482SBill Paul #define BGE_MARBMODE_RESET		0x00000001
122595d67482SBill Paul #define BGE_MARBMODE_ENABLE		0x00000002
122695d67482SBill Paul #define BGE_MARBMODE_TX_ADDR_TRAP	0x00000004
122795d67482SBill Paul #define BGE_MARBMODE_RX_ADDR_TRAP	0x00000008
122895d67482SBill Paul #define BGE_MARBMODE_DMAW1_TRAP		0x00000010
122995d67482SBill Paul #define BGE_MARBMODE_DMAR1_TRAP		0x00000020
123095d67482SBill Paul #define BGE_MARBMODE_RXRISC_TRAP	0x00000040
123195d67482SBill Paul #define BGE_MARBMODE_TXRISC_TRAP	0x00000080
123295d67482SBill Paul #define BGE_MARBMODE_PCI_TRAP		0x00000100
123395d67482SBill Paul #define BGE_MARBMODE_DMAR2_TRAP		0x00000200
123495d67482SBill Paul #define BGE_MARBMODE_RXQ_TRAP		0x00000400
123595d67482SBill Paul #define BGE_MARBMODE_RXDI1_TRAP		0x00000800
123695d67482SBill Paul #define BGE_MARBMODE_RXDI2_TRAP		0x00001000
123795d67482SBill Paul #define BGE_MARBMODE_DC_GRPMEM_TRAP	0x00002000
123895d67482SBill Paul #define BGE_MARBMODE_HCOAL_TRAP		0x00004000
123995d67482SBill Paul #define BGE_MARBMODE_MBUF_TRAP		0x00008000
124095d67482SBill Paul #define BGE_MARBMODE_TXDI_TRAP		0x00010000
124195d67482SBill Paul #define BGE_MARBMODE_SDC_DMAC_TRAP	0x00020000
124295d67482SBill Paul #define BGE_MARBMODE_TXBD_TRAP		0x00040000
124395d67482SBill Paul #define BGE_MARBMODE_BUFFMAN_TRAP	0x00080000
124495d67482SBill Paul #define BGE_MARBMODE_DMAW2_TRAP		0x00100000
124595d67482SBill Paul #define BGE_MARBMODE_XTSSRAM_ROFLO_TRAP	0x00200000
124695d67482SBill Paul #define BGE_MARBMODE_XTSSRAM_RUFLO_TRAP 0x00400000
124795d67482SBill Paul #define BGE_MARBMODE_XTSSRAM_WOFLO_TRAP	0x00800000
124895d67482SBill Paul #define BGE_MARBMODE_XTSSRAM_WUFLO_TRAP	0x01000000
124995d67482SBill Paul #define BGE_MARBMODE_XTSSRAM_PERR_TRAP	0x02000000
125095d67482SBill Paul 
125195d67482SBill Paul /* Memory arbiter status register */
125295d67482SBill Paul #define BGE_MARBSTAT_TX_ADDR_TRAP	0x00000004
125395d67482SBill Paul #define BGE_MARBSTAT_RX_ADDR_TRAP	0x00000008
125495d67482SBill Paul #define BGE_MARBSTAT_DMAW1_TRAP		0x00000010
125595d67482SBill Paul #define BGE_MARBSTAT_DMAR1_TRAP		0x00000020
125695d67482SBill Paul #define BGE_MARBSTAT_RXRISC_TRAP	0x00000040
125795d67482SBill Paul #define BGE_MARBSTAT_TXRISC_TRAP	0x00000080
125895d67482SBill Paul #define BGE_MARBSTAT_PCI_TRAP		0x00000100
125995d67482SBill Paul #define BGE_MARBSTAT_DMAR2_TRAP		0x00000200
126095d67482SBill Paul #define BGE_MARBSTAT_RXQ_TRAP		0x00000400
126195d67482SBill Paul #define BGE_MARBSTAT_RXDI1_TRAP		0x00000800
126295d67482SBill Paul #define BGE_MARBSTAT_RXDI2_TRAP		0x00001000
126395d67482SBill Paul #define BGE_MARBSTAT_DC_GRPMEM_TRAP	0x00002000
126495d67482SBill Paul #define BGE_MARBSTAT_HCOAL_TRAP		0x00004000
126595d67482SBill Paul #define BGE_MARBSTAT_MBUF_TRAP		0x00008000
126695d67482SBill Paul #define BGE_MARBSTAT_TXDI_TRAP		0x00010000
126795d67482SBill Paul #define BGE_MARBSTAT_SDC_DMAC_TRAP	0x00020000
126895d67482SBill Paul #define BGE_MARBSTAT_TXBD_TRAP		0x00040000
126995d67482SBill Paul #define BGE_MARBSTAT_BUFFMAN_TRAP	0x00080000
127095d67482SBill Paul #define BGE_MARBSTAT_DMAW2_TRAP		0x00100000
127195d67482SBill Paul #define BGE_MARBSTAT_XTSSRAM_ROFLO_TRAP	0x00200000
127295d67482SBill Paul #define BGE_MARBSTAT_XTSSRAM_RUFLO_TRAP 0x00400000
127395d67482SBill Paul #define BGE_MARBSTAT_XTSSRAM_WOFLO_TRAP	0x00800000
127495d67482SBill Paul #define BGE_MARBSTAT_XTSSRAM_WUFLO_TRAP	0x01000000
127595d67482SBill Paul #define BGE_MARBSTAT_XTSSRAM_PERR_TRAP	0x02000000
127695d67482SBill Paul 
127795d67482SBill Paul /*
127895d67482SBill Paul  * Buffer manager control registers
127995d67482SBill Paul  */
128095d67482SBill Paul #define BGE_BMAN_MODE			0x4400
128195d67482SBill Paul #define BGE_BMAN_STATUS			0x4404
128295d67482SBill Paul #define BGE_BMAN_MBUFPOOL_BASEADDR	0x4408
128395d67482SBill Paul #define BGE_BMAN_MBUFPOOL_LEN		0x440C
128495d67482SBill Paul #define BGE_BMAN_MBUFPOOL_READDMA_LOWAT	0x4410
128595d67482SBill Paul #define BGE_BMAN_MBUFPOOL_MACRX_LOWAT	0x4414
128695d67482SBill Paul #define BGE_BMAN_MBUFPOOL_HIWAT		0x4418
128795d67482SBill Paul #define BGE_BMAN_RXCPU_MBALLOC_REQ	0x441C
128895d67482SBill Paul #define BGE_BMAN_RXCPU_MBALLOC_RESP	0x4420
128995d67482SBill Paul #define BGE_BMAN_TXCPU_MBALLOC_REQ	0x4424
129095d67482SBill Paul #define BGE_BMAN_TXCPU_MBALLOC_RESP	0x4428
129195d67482SBill Paul #define BGE_BMAN_DMA_DESCPOOL_BASEADDR	0x442C
129295d67482SBill Paul #define BGE_BMAN_DMA_DESCPOOL_LEN	0x4430
129395d67482SBill Paul #define BGE_BMAN_DMA_DESCPOOL_LOWAT	0x4434
129495d67482SBill Paul #define BGE_BMAN_DMA_DESCPOOL_HIWAT	0x4438
129595d67482SBill Paul #define BGE_BMAN_RXCPU_DMAALLOC_REQ	0x443C
129695d67482SBill Paul #define BGE_BMAN_RXCPU_DMAALLOC_RESP	0x4440
129795d67482SBill Paul #define BGE_BMAN_TXCPU_DMAALLOC_REQ	0x4444
129895d67482SBill Paul #define BGE_BMAN_TXCPU_DMALLLOC_RESP	0x4448
129995d67482SBill Paul #define BGE_BMAN_HWDIAG_1		0x444C
130095d67482SBill Paul #define BGE_BMAN_HWDIAG_2		0x4450
130195d67482SBill Paul #define BGE_BMAN_HWDIAG_3		0x4454
130295d67482SBill Paul 
130395d67482SBill Paul /* Buffer manager mode register */
130495d67482SBill Paul #define BGE_BMANMODE_RESET		0x00000001
130595d67482SBill Paul #define BGE_BMANMODE_ENABLE		0x00000002
130695d67482SBill Paul #define BGE_BMANMODE_ATTN		0x00000004
130795d67482SBill Paul #define BGE_BMANMODE_TESTMODE		0x00000008
130895d67482SBill Paul #define BGE_BMANMODE_LOMBUF_ATTN	0x00000010
130995d67482SBill Paul 
131095d67482SBill Paul /* Buffer manager status register */
131195d67482SBill Paul #define BGE_BMANSTAT_ERRO		0x00000004
131295d67482SBill Paul #define BGE_BMANSTAT_LOWMBUF_ERROR	0x00000010
131395d67482SBill Paul 
131495d67482SBill Paul 
131595d67482SBill Paul /*
131695d67482SBill Paul  * Read DMA Control registers
131795d67482SBill Paul  */
131895d67482SBill Paul #define BGE_RDMA_MODE			0x4800
131995d67482SBill Paul #define BGE_RDMA_STATUS			0x4804
132095d67482SBill Paul 
132195d67482SBill Paul /* Read DMA mode register */
132295d67482SBill Paul #define BGE_RDMAMODE_RESET		0x00000001
132395d67482SBill Paul #define BGE_RDMAMODE_ENABLE		0x00000002
132495d67482SBill Paul #define BGE_RDMAMODE_PCI_TGT_ABRT_ATTN	0x00000004
132595d67482SBill Paul #define BGE_RDMAMODE_PCI_MSTR_ABRT_ATTN	0x00000008
132695d67482SBill Paul #define BGE_RDMAMODE_PCI_PERR_ATTN	0x00000010
132795d67482SBill Paul #define BGE_RDMAMODE_PCI_ADDROFLOW_ATTN	0x00000020
132895d67482SBill Paul #define BGE_RDMAMODE_PCI_FIFOOFLOW_ATTN	0x00000040
132995d67482SBill Paul #define BGE_RDMAMODE_PCI_FIFOUFLOW_ATTN	0x00000080
133095d67482SBill Paul #define BGE_RDMAMODE_PCI_FIFOOREAD_ATTN	0x00000100
133195d67482SBill Paul #define BGE_RDMAMODE_LOCWRITE_TOOBIG	0x00000200
133295d67482SBill Paul #define BGE_RDMAMODE_ALL_ATTNS		0x000003FC
133395d67482SBill Paul 
133495d67482SBill Paul /* Read DMA status register */
133595d67482SBill Paul #define BGE_RDMASTAT_PCI_TGT_ABRT_ATTN	0x00000004
133695d67482SBill Paul #define BGE_RDMASTAT_PCI_MSTR_ABRT_ATTN	0x00000008
133795d67482SBill Paul #define BGE_RDMASTAT_PCI_PERR_ATTN	0x00000010
133895d67482SBill Paul #define BGE_RDMASTAT_PCI_ADDROFLOW_ATTN	0x00000020
133995d67482SBill Paul #define BGE_RDMASTAT_PCI_FIFOOFLOW_ATTN	0x00000040
134095d67482SBill Paul #define BGE_RDMASTAT_PCI_FIFOUFLOW_ATTN	0x00000080
134195d67482SBill Paul #define BGE_RDMASTAT_PCI_FIFOOREAD_ATTN	0x00000100
134295d67482SBill Paul #define BGE_RDMASTAT_LOCWRITE_TOOBIG	0x00000200
134395d67482SBill Paul 
134495d67482SBill Paul /*
134595d67482SBill Paul  * Write DMA control registers
134695d67482SBill Paul  */
134795d67482SBill Paul #define BGE_WDMA_MODE			0x4C00
134895d67482SBill Paul #define BGE_WDMA_STATUS			0x4C04
134995d67482SBill Paul 
135095d67482SBill Paul /* Write DMA mode register */
135195d67482SBill Paul #define BGE_WDMAMODE_RESET		0x00000001
135295d67482SBill Paul #define BGE_WDMAMODE_ENABLE		0x00000002
135395d67482SBill Paul #define BGE_WDMAMODE_PCI_TGT_ABRT_ATTN	0x00000004
135495d67482SBill Paul #define BGE_WDMAMODE_PCI_MSTR_ABRT_ATTN	0x00000008
135595d67482SBill Paul #define BGE_WDMAMODE_PCI_PERR_ATTN	0x00000010
135695d67482SBill Paul #define BGE_WDMAMODE_PCI_ADDROFLOW_ATTN	0x00000020
135795d67482SBill Paul #define BGE_WDMAMODE_PCI_FIFOOFLOW_ATTN	0x00000040
135895d67482SBill Paul #define BGE_WDMAMODE_PCI_FIFOUFLOW_ATTN	0x00000080
135995d67482SBill Paul #define BGE_WDMAMODE_PCI_FIFOOREAD_ATTN	0x00000100
136095d67482SBill Paul #define BGE_WDMAMODE_LOCREAD_TOOBIG	0x00000200
136195d67482SBill Paul #define BGE_WDMAMODE_ALL_ATTNS		0x000003FC
136295d67482SBill Paul 
136395d67482SBill Paul /* Write DMA status register */
136495d67482SBill Paul #define BGE_WDMASTAT_PCI_TGT_ABRT_ATTN	0x00000004
136595d67482SBill Paul #define BGE_WDMASTAT_PCI_MSTR_ABRT_ATTN	0x00000008
136695d67482SBill Paul #define BGE_WDMASTAT_PCI_PERR_ATTN	0x00000010
136795d67482SBill Paul #define BGE_WDMASTAT_PCI_ADDROFLOW_ATTN	0x00000020
136895d67482SBill Paul #define BGE_WDMASTAT_PCI_FIFOOFLOW_ATTN	0x00000040
136995d67482SBill Paul #define BGE_WDMASTAT_PCI_FIFOUFLOW_ATTN	0x00000080
137095d67482SBill Paul #define BGE_WDMASTAT_PCI_FIFOOREAD_ATTN	0x00000100
137195d67482SBill Paul #define BGE_WDMASTAT_LOCREAD_TOOBIG	0x00000200
137295d67482SBill Paul 
137395d67482SBill Paul 
137495d67482SBill Paul /*
137595d67482SBill Paul  * RX CPU registers
137695d67482SBill Paul  */
137795d67482SBill Paul #define BGE_RXCPU_MODE			0x5000
137895d67482SBill Paul #define BGE_RXCPU_STATUS		0x5004
137995d67482SBill Paul #define BGE_RXCPU_PC			0x501C
138095d67482SBill Paul 
138195d67482SBill Paul /* RX CPU mode register */
138295d67482SBill Paul #define BGE_RXCPUMODE_RESET		0x00000001
138395d67482SBill Paul #define BGE_RXCPUMODE_SINGLESTEP	0x00000002
138495d67482SBill Paul #define BGE_RXCPUMODE_P0_DATAHLT_ENB	0x00000004
138595d67482SBill Paul #define BGE_RXCPUMODE_P0_INSTRHLT_ENB	0x00000008
138695d67482SBill Paul #define BGE_RXCPUMODE_WR_POSTBUF_ENB	0x00000010
138795d67482SBill Paul #define BGE_RXCPUMODE_DATACACHE_ENB	0x00000020
138895d67482SBill Paul #define BGE_RXCPUMODE_ROMFAIL		0x00000040
138995d67482SBill Paul #define BGE_RXCPUMODE_WATCHDOG_ENB	0x00000080
139095d67482SBill Paul #define BGE_RXCPUMODE_INSTRCACHE_PRF	0x00000100
139195d67482SBill Paul #define BGE_RXCPUMODE_INSTRCACHE_FLUSH	0x00000200
139295d67482SBill Paul #define BGE_RXCPUMODE_HALTCPU		0x00000400
139395d67482SBill Paul #define BGE_RXCPUMODE_INVDATAHLT_ENB	0x00000800
139495d67482SBill Paul #define BGE_RXCPUMODE_MADDRTRAPHLT_ENB	0x00001000
139595d67482SBill Paul #define BGE_RXCPUMODE_RADDRTRAPHLT_ENB	0x00002000
139695d67482SBill Paul 
139795d67482SBill Paul /* RX CPU status register */
139895d67482SBill Paul #define BGE_RXCPUSTAT_HW_BREAKPOINT	0x00000001
139995d67482SBill Paul #define BGE_RXCPUSTAT_HLTINSTR_EXECUTED	0x00000002
140095d67482SBill Paul #define BGE_RXCPUSTAT_INVALID_INSTR	0x00000004
140195d67482SBill Paul #define BGE_RXCPUSTAT_P0_DATAREF	0x00000008
140295d67482SBill Paul #define BGE_RXCPUSTAT_P0_INSTRREF	0x00000010
140395d67482SBill Paul #define BGE_RXCPUSTAT_INVALID_DATAACC	0x00000020
140495d67482SBill Paul #define BGE_RXCPUSTAT_INVALID_INSTRFTCH	0x00000040
140595d67482SBill Paul #define BGE_RXCPUSTAT_BAD_MEMALIGN	0x00000080
140695d67482SBill Paul #define BGE_RXCPUSTAT_MADDR_TRAP	0x00000100
140795d67482SBill Paul #define BGE_RXCPUSTAT_REGADDR_TRAP	0x00000200
140895d67482SBill Paul #define BGE_RXCPUSTAT_DATAACC_STALL	0x00001000
140995d67482SBill Paul #define BGE_RXCPUSTAT_INSTRFETCH_STALL	0x00002000
141095d67482SBill Paul #define BGE_RXCPUSTAT_MA_WR_FIFOOFLOW	0x08000000
141195d67482SBill Paul #define BGE_RXCPUSTAT_MA_RD_FIFOOFLOW	0x10000000
141295d67482SBill Paul #define BGE_RXCPUSTAT_MA_DATAMASK_OFLOW	0x20000000
141395d67482SBill Paul #define BGE_RXCPUSTAT_MA_REQ_FIFOOFLOW	0x40000000
141495d67482SBill Paul #define BGE_RXCPUSTAT_BLOCKING_READ	0x80000000
141595d67482SBill Paul 
141695d67482SBill Paul 
141795d67482SBill Paul /*
141895d67482SBill Paul  * TX CPU registers
141995d67482SBill Paul  */
142095d67482SBill Paul #define BGE_TXCPU_MODE			0x5400
142195d67482SBill Paul #define BGE_TXCPU_STATUS		0x5404
142295d67482SBill Paul #define BGE_TXCPU_PC			0x541C
142395d67482SBill Paul 
142495d67482SBill Paul /* TX CPU mode register */
142595d67482SBill Paul #define BGE_TXCPUMODE_RESET		0x00000001
142695d67482SBill Paul #define BGE_TXCPUMODE_SINGLESTEP	0x00000002
142795d67482SBill Paul #define BGE_TXCPUMODE_P0_DATAHLT_ENB	0x00000004
142895d67482SBill Paul #define BGE_TXCPUMODE_P0_INSTRHLT_ENB	0x00000008
142995d67482SBill Paul #define BGE_TXCPUMODE_WR_POSTBUF_ENB	0x00000010
143095d67482SBill Paul #define BGE_TXCPUMODE_DATACACHE_ENB	0x00000020
143195d67482SBill Paul #define BGE_TXCPUMODE_ROMFAIL		0x00000040
143295d67482SBill Paul #define BGE_TXCPUMODE_WATCHDOG_ENB	0x00000080
143395d67482SBill Paul #define BGE_TXCPUMODE_INSTRCACHE_PRF	0x00000100
143495d67482SBill Paul #define BGE_TXCPUMODE_INSTRCACHE_FLUSH	0x00000200
143595d67482SBill Paul #define BGE_TXCPUMODE_HALTCPU		0x00000400
143695d67482SBill Paul #define BGE_TXCPUMODE_INVDATAHLT_ENB	0x00000800
143795d67482SBill Paul #define BGE_TXCPUMODE_MADDRTRAPHLT_ENB	0x00001000
143895d67482SBill Paul 
143995d67482SBill Paul /* TX CPU status register */
144095d67482SBill Paul #define BGE_TXCPUSTAT_HW_BREAKPOINT	0x00000001
144195d67482SBill Paul #define BGE_TXCPUSTAT_HLTINSTR_EXECUTED	0x00000002
144295d67482SBill Paul #define BGE_TXCPUSTAT_INVALID_INSTR	0x00000004
144395d67482SBill Paul #define BGE_TXCPUSTAT_P0_DATAREF	0x00000008
144495d67482SBill Paul #define BGE_TXCPUSTAT_P0_INSTRREF	0x00000010
144595d67482SBill Paul #define BGE_TXCPUSTAT_INVALID_DATAACC	0x00000020
144695d67482SBill Paul #define BGE_TXCPUSTAT_INVALID_INSTRFTCH	0x00000040
144795d67482SBill Paul #define BGE_TXCPUSTAT_BAD_MEMALIGN	0x00000080
144895d67482SBill Paul #define BGE_TXCPUSTAT_MADDR_TRAP	0x00000100
144995d67482SBill Paul #define BGE_TXCPUSTAT_REGADDR_TRAP	0x00000200
145095d67482SBill Paul #define BGE_TXCPUSTAT_DATAACC_STALL	0x00001000
145195d67482SBill Paul #define BGE_TXCPUSTAT_INSTRFETCH_STALL	0x00002000
145295d67482SBill Paul #define BGE_TXCPUSTAT_MA_WR_FIFOOFLOW	0x08000000
145395d67482SBill Paul #define BGE_TXCPUSTAT_MA_RD_FIFOOFLOW	0x10000000
145495d67482SBill Paul #define BGE_TXCPUSTAT_MA_DATAMASK_OFLOW	0x20000000
145595d67482SBill Paul #define BGE_TXCPUSTAT_MA_REQ_FIFOOFLOW	0x40000000
145695d67482SBill Paul #define BGE_TXCPUSTAT_BLOCKING_READ	0x80000000
145795d67482SBill Paul 
145895d67482SBill Paul 
145995d67482SBill Paul /*
146095d67482SBill Paul  * Low priority mailbox registers
146195d67482SBill Paul  */
146295d67482SBill Paul #define BGE_LPMBX_IRQ0_HI		0x5800
146395d67482SBill Paul #define BGE_LPMBX_IRQ0_LO		0x5804
146495d67482SBill Paul #define BGE_LPMBX_IRQ1_HI		0x5808
146595d67482SBill Paul #define BGE_LPMBX_IRQ1_LO		0x580C
146695d67482SBill Paul #define BGE_LPMBX_IRQ2_HI		0x5810
146795d67482SBill Paul #define BGE_LPMBX_IRQ2_LO		0x5814
146895d67482SBill Paul #define BGE_LPMBX_IRQ3_HI		0x5818
146995d67482SBill Paul #define BGE_LPMBX_IRQ3_LO		0x581C
147095d67482SBill Paul #define BGE_LPMBX_GEN0_HI		0x5820
147195d67482SBill Paul #define BGE_LPMBX_GEN0_LO		0x5824
147295d67482SBill Paul #define BGE_LPMBX_GEN1_HI		0x5828
147395d67482SBill Paul #define BGE_LPMBX_GEN1_LO		0x582C
147495d67482SBill Paul #define BGE_LPMBX_GEN2_HI		0x5830
147595d67482SBill Paul #define BGE_LPMBX_GEN2_LO		0x5834
147695d67482SBill Paul #define BGE_LPMBX_GEN3_HI		0x5828
147795d67482SBill Paul #define BGE_LPMBX_GEN3_LO		0x582C
147895d67482SBill Paul #define BGE_LPMBX_GEN4_HI		0x5840
147995d67482SBill Paul #define BGE_LPMBX_GEN4_LO		0x5844
148095d67482SBill Paul #define BGE_LPMBX_GEN5_HI		0x5848
148195d67482SBill Paul #define BGE_LPMBX_GEN5_LO		0x584C
148295d67482SBill Paul #define BGE_LPMBX_GEN6_HI		0x5850
148395d67482SBill Paul #define BGE_LPMBX_GEN6_LO		0x5854
148495d67482SBill Paul #define BGE_LPMBX_GEN7_HI		0x5858
148595d67482SBill Paul #define BGE_LPMBX_GEN7_LO		0x585C
148695d67482SBill Paul #define BGE_LPMBX_RELOAD_STATS_HI	0x5860
148795d67482SBill Paul #define BGE_LPMBX_RELOAD_STATS_LO	0x5864
148895d67482SBill Paul #define BGE_LPMBX_RX_STD_PROD_HI	0x5868
148995d67482SBill Paul #define BGE_LPMBX_RX_STD_PROD_LO	0x586C
149095d67482SBill Paul #define BGE_LPMBX_RX_JUMBO_PROD_HI	0x5870
149195d67482SBill Paul #define BGE_LPMBX_RX_JUMBO_PROD_LO	0x5874
149295d67482SBill Paul #define BGE_LPMBX_RX_MINI_PROD_HI	0x5878
149395d67482SBill Paul #define BGE_LPMBX_RX_MINI_PROD_LO	0x587C
149495d67482SBill Paul #define BGE_LPMBX_RX_CONS0_HI		0x5880
149595d67482SBill Paul #define BGE_LPMBX_RX_CONS0_LO		0x5884
149695d67482SBill Paul #define BGE_LPMBX_RX_CONS1_HI		0x5888
149795d67482SBill Paul #define BGE_LPMBX_RX_CONS1_LO		0x588C
149895d67482SBill Paul #define BGE_LPMBX_RX_CONS2_HI		0x5890
149995d67482SBill Paul #define BGE_LPMBX_RX_CONS2_LO		0x5894
150095d67482SBill Paul #define BGE_LPMBX_RX_CONS3_HI		0x5898
150195d67482SBill Paul #define BGE_LPMBX_RX_CONS3_LO		0x589C
150295d67482SBill Paul #define BGE_LPMBX_RX_CONS4_HI		0x58A0
150395d67482SBill Paul #define BGE_LPMBX_RX_CONS4_LO		0x58A4
150495d67482SBill Paul #define BGE_LPMBX_RX_CONS5_HI		0x58A8
150595d67482SBill Paul #define BGE_LPMBX_RX_CONS5_LO		0x58AC
150695d67482SBill Paul #define BGE_LPMBX_RX_CONS6_HI		0x58B0
150795d67482SBill Paul #define BGE_LPMBX_RX_CONS6_LO		0x58B4
150895d67482SBill Paul #define BGE_LPMBX_RX_CONS7_HI		0x58B8
150995d67482SBill Paul #define BGE_LPMBX_RX_CONS7_LO		0x58BC
151095d67482SBill Paul #define BGE_LPMBX_RX_CONS8_HI		0x58C0
151195d67482SBill Paul #define BGE_LPMBX_RX_CONS8_LO		0x58C4
151295d67482SBill Paul #define BGE_LPMBX_RX_CONS9_HI		0x58C8
151395d67482SBill Paul #define BGE_LPMBX_RX_CONS9_LO		0x58CC
151495d67482SBill Paul #define BGE_LPMBX_RX_CONS10_HI		0x58D0
151595d67482SBill Paul #define BGE_LPMBX_RX_CONS10_LO		0x58D4
151695d67482SBill Paul #define BGE_LPMBX_RX_CONS11_HI		0x58D8
151795d67482SBill Paul #define BGE_LPMBX_RX_CONS11_LO		0x58DC
151895d67482SBill Paul #define BGE_LPMBX_RX_CONS12_HI		0x58E0
151995d67482SBill Paul #define BGE_LPMBX_RX_CONS12_LO		0x58E4
152095d67482SBill Paul #define BGE_LPMBX_RX_CONS13_HI		0x58E8
152195d67482SBill Paul #define BGE_LPMBX_RX_CONS13_LO		0x58EC
152295d67482SBill Paul #define BGE_LPMBX_RX_CONS14_HI		0x58F0
152395d67482SBill Paul #define BGE_LPMBX_RX_CONS14_LO		0x58F4
152495d67482SBill Paul #define BGE_LPMBX_RX_CONS15_HI		0x58F8
152595d67482SBill Paul #define BGE_LPMBX_RX_CONS15_LO		0x58FC
152695d67482SBill Paul #define BGE_LPMBX_TX_HOST_PROD0_HI	0x5900
152795d67482SBill Paul #define BGE_LPMBX_TX_HOST_PROD0_LO	0x5904
152895d67482SBill Paul #define BGE_LPMBX_TX_HOST_PROD1_HI	0x5908
152995d67482SBill Paul #define BGE_LPMBX_TX_HOST_PROD1_LO	0x590C
153095d67482SBill Paul #define BGE_LPMBX_TX_HOST_PROD2_HI	0x5910
153195d67482SBill Paul #define BGE_LPMBX_TX_HOST_PROD2_LO	0x5914
153295d67482SBill Paul #define BGE_LPMBX_TX_HOST_PROD3_HI	0x5918
153395d67482SBill Paul #define BGE_LPMBX_TX_HOST_PROD3_LO	0x591C
153495d67482SBill Paul #define BGE_LPMBX_TX_HOST_PROD4_HI	0x5920
153595d67482SBill Paul #define BGE_LPMBX_TX_HOST_PROD4_LO	0x5924
153695d67482SBill Paul #define BGE_LPMBX_TX_HOST_PROD5_HI	0x5928
153795d67482SBill Paul #define BGE_LPMBX_TX_HOST_PROD5_LO	0x592C
153895d67482SBill Paul #define BGE_LPMBX_TX_HOST_PROD6_HI	0x5930
153995d67482SBill Paul #define BGE_LPMBX_TX_HOST_PROD6_LO	0x5934
154095d67482SBill Paul #define BGE_LPMBX_TX_HOST_PROD7_HI	0x5938
154195d67482SBill Paul #define BGE_LPMBX_TX_HOST_PROD7_LO	0x593C
154295d67482SBill Paul #define BGE_LPMBX_TX_HOST_PROD8_HI	0x5940
154395d67482SBill Paul #define BGE_LPMBX_TX_HOST_PROD8_LO	0x5944
154495d67482SBill Paul #define BGE_LPMBX_TX_HOST_PROD9_HI	0x5948
154595d67482SBill Paul #define BGE_LPMBX_TX_HOST_PROD9_LO	0x594C
154695d67482SBill Paul #define BGE_LPMBX_TX_HOST_PROD10_HI	0x5950
154795d67482SBill Paul #define BGE_LPMBX_TX_HOST_PROD10_LO	0x5954
154895d67482SBill Paul #define BGE_LPMBX_TX_HOST_PROD11_HI	0x5958
154995d67482SBill Paul #define BGE_LPMBX_TX_HOST_PROD11_LO	0x595C
155095d67482SBill Paul #define BGE_LPMBX_TX_HOST_PROD12_HI	0x5960
155195d67482SBill Paul #define BGE_LPMBX_TX_HOST_PROD12_LO	0x5964
155295d67482SBill Paul #define BGE_LPMBX_TX_HOST_PROD13_HI	0x5968
155395d67482SBill Paul #define BGE_LPMBX_TX_HOST_PROD13_LO	0x596C
155495d67482SBill Paul #define BGE_LPMBX_TX_HOST_PROD14_HI	0x5970
155595d67482SBill Paul #define BGE_LPMBX_TX_HOST_PROD14_LO	0x5974
155695d67482SBill Paul #define BGE_LPMBX_TX_HOST_PROD15_HI	0x5978
155795d67482SBill Paul #define BGE_LPMBX_TX_HOST_PROD15_LO	0x597C
155895d67482SBill Paul #define BGE_LPMBX_TX_NIC_PROD0_HI	0x5980
155995d67482SBill Paul #define BGE_LPMBX_TX_NIC_PROD0_LO	0x5984
156095d67482SBill Paul #define BGE_LPMBX_TX_NIC_PROD1_HI	0x5988
156195d67482SBill Paul #define BGE_LPMBX_TX_NIC_PROD1_LO	0x598C
156295d67482SBill Paul #define BGE_LPMBX_TX_NIC_PROD2_HI	0x5990
156395d67482SBill Paul #define BGE_LPMBX_TX_NIC_PROD2_LO	0x5994
156495d67482SBill Paul #define BGE_LPMBX_TX_NIC_PROD3_HI	0x5998
156595d67482SBill Paul #define BGE_LPMBX_TX_NIC_PROD3_LO	0x599C
156695d67482SBill Paul #define BGE_LPMBX_TX_NIC_PROD4_HI	0x59A0
156795d67482SBill Paul #define BGE_LPMBX_TX_NIC_PROD4_LO	0x59A4
156895d67482SBill Paul #define BGE_LPMBX_TX_NIC_PROD5_HI	0x59A8
156995d67482SBill Paul #define BGE_LPMBX_TX_NIC_PROD5_LO	0x59AC
157095d67482SBill Paul #define BGE_LPMBX_TX_NIC_PROD6_HI	0x59B0
157195d67482SBill Paul #define BGE_LPMBX_TX_NIC_PROD6_LO	0x59B4
157295d67482SBill Paul #define BGE_LPMBX_TX_NIC_PROD7_HI	0x59B8
157395d67482SBill Paul #define BGE_LPMBX_TX_NIC_PROD7_LO	0x59BC
157495d67482SBill Paul #define BGE_LPMBX_TX_NIC_PROD8_HI	0x59C0
157595d67482SBill Paul #define BGE_LPMBX_TX_NIC_PROD8_LO	0x59C4
157695d67482SBill Paul #define BGE_LPMBX_TX_NIC_PROD9_HI	0x59C8
157795d67482SBill Paul #define BGE_LPMBX_TX_NIC_PROD9_LO	0x59CC
157895d67482SBill Paul #define BGE_LPMBX_TX_NIC_PROD10_HI	0x59D0
157995d67482SBill Paul #define BGE_LPMBX_TX_NIC_PROD10_LO	0x59D4
158095d67482SBill Paul #define BGE_LPMBX_TX_NIC_PROD11_HI	0x59D8
158195d67482SBill Paul #define BGE_LPMBX_TX_NIC_PROD11_LO	0x59DC
158295d67482SBill Paul #define BGE_LPMBX_TX_NIC_PROD12_HI	0x59E0
158395d67482SBill Paul #define BGE_LPMBX_TX_NIC_PROD12_LO	0x59E4
158495d67482SBill Paul #define BGE_LPMBX_TX_NIC_PROD13_HI	0x59E8
158595d67482SBill Paul #define BGE_LPMBX_TX_NIC_PROD13_LO	0x59EC
158695d67482SBill Paul #define BGE_LPMBX_TX_NIC_PROD14_HI	0x59F0
158795d67482SBill Paul #define BGE_LPMBX_TX_NIC_PROD14_LO	0x59F4
158895d67482SBill Paul #define BGE_LPMBX_TX_NIC_PROD15_HI	0x59F8
158995d67482SBill Paul #define BGE_LPMBX_TX_NIC_PROD15_LO	0x59FC
159095d67482SBill Paul 
159195d67482SBill Paul /*
159295d67482SBill Paul  * Flow throw Queue reset register
159395d67482SBill Paul  */
159495d67482SBill Paul #define BGE_FTQ_RESET			0x5C00
159595d67482SBill Paul 
159695d67482SBill Paul #define BGE_FTQRESET_DMAREAD		0x00000002
159795d67482SBill Paul #define BGE_FTQRESET_DMAHIPRIO_RD	0x00000004
159895d67482SBill Paul #define BGE_FTQRESET_DMADONE		0x00000010
159995d67482SBill Paul #define BGE_FTQRESET_SBDC		0x00000020
160095d67482SBill Paul #define BGE_FTQRESET_SDI		0x00000040
160195d67482SBill Paul #define BGE_FTQRESET_WDMA		0x00000080
160295d67482SBill Paul #define BGE_FTQRESET_DMAHIPRIO_WR	0x00000100
160395d67482SBill Paul #define BGE_FTQRESET_TYPE1_SOFTWARE	0x00000200
160495d67482SBill Paul #define BGE_FTQRESET_SDC		0x00000400
160595d67482SBill Paul #define BGE_FTQRESET_HCC		0x00000800
160695d67482SBill Paul #define BGE_FTQRESET_TXFIFO		0x00001000
160795d67482SBill Paul #define BGE_FTQRESET_MBC		0x00002000
160895d67482SBill Paul #define BGE_FTQRESET_RBDC		0x00004000
160995d67482SBill Paul #define BGE_FTQRESET_RXLP		0x00008000
161095d67482SBill Paul #define BGE_FTQRESET_RDBDI		0x00010000
161195d67482SBill Paul #define BGE_FTQRESET_RDC		0x00020000
161295d67482SBill Paul #define BGE_FTQRESET_TYPE2_SOFTWARE	0x00040000
161395d67482SBill Paul 
161495d67482SBill Paul /*
161595d67482SBill Paul  * Message Signaled Interrupt registers
161695d67482SBill Paul  */
161795d67482SBill Paul #define BGE_MSI_MODE			0x6000
161895d67482SBill Paul #define BGE_MSI_STATUS			0x6004
161995d67482SBill Paul #define BGE_MSI_FIFOACCESS		0x6008
162095d67482SBill Paul 
162195d67482SBill Paul /* MSI mode register */
162295d67482SBill Paul #define BGE_MSIMODE_RESET		0x00000001
162395d67482SBill Paul #define BGE_MSIMODE_ENABLE		0x00000002
162495d67482SBill Paul #define BGE_MSIMODE_PCI_TGT_ABRT_ATTN	0x00000004
162595d67482SBill Paul #define BGE_MSIMODE_PCI_MSTR_ABRT_ATTN	0x00000008
162695d67482SBill Paul #define BGE_MSIMODE_PCI_PERR_ATTN	0x00000010
162795d67482SBill Paul #define BGE_MSIMODE_MSI_FIFOUFLOW_ATTN	0x00000020
162895d67482SBill Paul #define BGE_MSIMODE_MSI_FIFOOFLOW_ATTN	0x00000040
162995d67482SBill Paul 
163095d67482SBill Paul /* MSI status register */
163195d67482SBill Paul #define BGE_MSISTAT_PCI_TGT_ABRT_ATTN	0x00000004
163295d67482SBill Paul #define BGE_MSISTAT_PCI_MSTR_ABRT_ATTN	0x00000008
163395d67482SBill Paul #define BGE_MSISTAT_PCI_PERR_ATTN	0x00000010
163495d67482SBill Paul #define BGE_MSISTAT_MSI_FIFOUFLOW_ATTN	0x00000020
163595d67482SBill Paul #define BGE_MSISTAT_MSI_FIFOOFLOW_ATTN	0x00000040
163695d67482SBill Paul 
163795d67482SBill Paul 
163895d67482SBill Paul /*
163995d67482SBill Paul  * DMA Completion registers
164095d67482SBill Paul  */
164195d67482SBill Paul #define BGE_DMAC_MODE			0x6400
164295d67482SBill Paul 
164395d67482SBill Paul /* DMA Completion mode register */
164495d67482SBill Paul #define BGE_DMACMODE_RESET		0x00000001
164595d67482SBill Paul #define BGE_DMACMODE_ENABLE		0x00000002
164695d67482SBill Paul 
164795d67482SBill Paul 
164895d67482SBill Paul /*
164995d67482SBill Paul  * General control registers.
165095d67482SBill Paul  */
165195d67482SBill Paul #define BGE_MODE_CTL			0x6800
165295d67482SBill Paul #define BGE_MISC_CFG			0x6804
165395d67482SBill Paul #define BGE_MISC_LOCAL_CTL		0x6808
165495d67482SBill Paul #define BGE_EE_ADDR			0x6838
165595d67482SBill Paul #define BGE_EE_DATA			0x683C
165695d67482SBill Paul #define BGE_EE_CTL			0x6840
165795d67482SBill Paul #define BGE_MDI_CTL			0x6844
165895d67482SBill Paul #define BGE_EE_DELAY			0x6848
165995d67482SBill Paul 
166095d67482SBill Paul /* Mode control register */
166195d67482SBill Paul #define BGE_MODECTL_INT_SNDCOAL_ONLY	0x00000001
166295d67482SBill Paul #define BGE_MODECTL_BYTESWAP_NONFRAME	0x00000002
166395d67482SBill Paul #define BGE_MODECTL_WORDSWAP_NONFRAME	0x00000004
166495d67482SBill Paul #define BGE_MODECTL_BYTESWAP_DATA	0x00000010
166595d67482SBill Paul #define BGE_MODECTL_WORDSWAP_DATA	0x00000020
166695d67482SBill Paul #define BGE_MODECTL_NO_FRAME_CRACKING	0x00000200
166795d67482SBill Paul #define BGE_MODECTL_NO_RX_CRC		0x00000400
166895d67482SBill Paul #define BGE_MODECTL_RX_BADFRAMES	0x00000800
166995d67482SBill Paul #define BGE_MODECTL_NO_TX_INTR		0x00002000
167095d67482SBill Paul #define BGE_MODECTL_NO_RX_INTR		0x00004000
167195d67482SBill Paul #define BGE_MODECTL_FORCE_PCI32		0x00008000
167295d67482SBill Paul #define BGE_MODECTL_STACKUP		0x00010000
167395d67482SBill Paul #define BGE_MODECTL_HOST_SEND_BDS	0x00020000
167495d67482SBill Paul #define BGE_MODECTL_TX_NO_PHDR_CSUM	0x00100000
167595d67482SBill Paul #define BGE_MODECTL_RX_NO_PHDR_CSUM	0x00800000
167695d67482SBill Paul #define BGE_MODECTL_TX_ATTN_INTR	0x01000000
167795d67482SBill Paul #define BGE_MODECTL_RX_ATTN_INTR	0x02000000
167895d67482SBill Paul #define BGE_MODECTL_MAC_ATTN_INTR	0x04000000
167995d67482SBill Paul #define BGE_MODECTL_DMA_ATTN_INTR	0x08000000
168095d67482SBill Paul #define BGE_MODECTL_FLOWCTL_ATTN_INTR	0x10000000
168195d67482SBill Paul #define BGE_MODECTL_4X_SENDRING_SZ	0x20000000
168295d67482SBill Paul #define BGE_MODECTL_FW_PROCESS_MCASTS	0x40000000
168395d67482SBill Paul 
168495d67482SBill Paul /* Misc. config register */
168595d67482SBill Paul #define BGE_MISCCFG_RESET_CORE_CLOCKS	0x00000001
168695d67482SBill Paul #define BGE_MISCCFG_TIMER_PRESCALER	0x000000FE
168795d67482SBill Paul 
168895d67482SBill Paul #define BGE_32BITTIME_66MHZ		(0x41 << 1)
168995d67482SBill Paul 
169095d67482SBill Paul /* Misc. Local Control */
169195d67482SBill Paul #define BGE_MLC_INTR_STATE		0x00000001
169295d67482SBill Paul #define BGE_MLC_INTR_CLR		0x00000002
169395d67482SBill Paul #define BGE_MLC_INTR_SET		0x00000004
169495d67482SBill Paul #define BGE_MLC_INTR_ONATTN		0x00000008
169595d67482SBill Paul #define BGE_MLC_MISCIO_IN0		0x00000100
169695d67482SBill Paul #define BGE_MLC_MISCIO_IN1		0x00000200
169795d67482SBill Paul #define BGE_MLC_MISCIO_IN2		0x00000400
169895d67482SBill Paul #define BGE_MLC_MISCIO_OUTEN0		0x00000800
169995d67482SBill Paul #define BGE_MLC_MISCIO_OUTEN1		0x00001000
170095d67482SBill Paul #define BGE_MLC_MISCIO_OUTEN2		0x00002000
170195d67482SBill Paul #define BGE_MLC_MISCIO_OUT0		0x00004000
170295d67482SBill Paul #define BGE_MLC_MISCIO_OUT1		0x00008000
170395d67482SBill Paul #define BGE_MLC_MISCIO_OUT2		0x00010000
170495d67482SBill Paul #define BGE_MLC_EXTRAM_ENB		0x00020000
170595d67482SBill Paul #define BGE_MLC_SRAM_SIZE		0x001C0000
170695d67482SBill Paul #define BGE_MLC_BANK_SEL		0x00200000 /* 0 = 2 banks, 1 == 1 */
170795d67482SBill Paul #define BGE_MLC_SSRAM_TYPE		0x00400000 /* 1 = ZBT, 0 = standard */
170895d67482SBill Paul #define BGE_MLC_SSRAM_CYC_DESEL		0x00800000
170995d67482SBill Paul #define BGE_MLC_AUTO_EEPROM		0x01000000
171095d67482SBill Paul 
171195d67482SBill Paul #define BGE_SSRAMSIZE_256KB		0x00000000
171295d67482SBill Paul #define BGE_SSRAMSIZE_512KB		0x00040000
171395d67482SBill Paul #define BGE_SSRAMSIZE_1MB		0x00080000
171495d67482SBill Paul #define BGE_SSRAMSIZE_2MB		0x000C0000
171595d67482SBill Paul #define BGE_SSRAMSIZE_4MB		0x00100000
171695d67482SBill Paul #define BGE_SSRAMSIZE_8MB		0x00140000
171795d67482SBill Paul #define BGE_SSRAMSIZE_16M		0x00180000
171895d67482SBill Paul 
171995d67482SBill Paul /* EEPROM address register */
172095d67482SBill Paul #define BGE_EEADDR_ADDRESS		0x0000FFFC
172195d67482SBill Paul #define BGE_EEADDR_HALFCLK		0x01FF0000
172295d67482SBill Paul #define BGE_EEADDR_START		0x02000000
172395d67482SBill Paul #define BGE_EEADDR_DEVID		0x1C000000
172495d67482SBill Paul #define BGE_EEADDR_RESET		0x20000000
172595d67482SBill Paul #define BGE_EEADDR_DONE			0x40000000
172695d67482SBill Paul #define BGE_EEADDR_RW			0x80000000 /* 1 = rd, 0 = wr */
172795d67482SBill Paul 
172895d67482SBill Paul #define BGE_EEDEVID(x)			((x & 7) << 26)
172995d67482SBill Paul #define BGE_EEHALFCLK(x)		((x & 0x1FF) << 16)
173095d67482SBill Paul #define BGE_HALFCLK_384SCL		0x60
173195d67482SBill Paul #define BGE_EE_READCMD \
173295d67482SBill Paul 	(BGE_EEHALFCLK(BGE_HALFCLK_384SCL)|BGE_EEDEVID(0)|	\
173395d67482SBill Paul 	BGE_EEADDR_START|BGE_EEADDR_RW|BGE_EEADDR_DONE)
173495d67482SBill Paul #define BGE_EE_WRCMD \
173595d67482SBill Paul 	(BGE_EEHALFCLK(BGE_HALFCLK_384SCL)|BGE_EEDEVID(0)|	\
173695d67482SBill Paul 	BGE_EEADDR_START|BGE_EEADDR_DONE)
173795d67482SBill Paul 
173895d67482SBill Paul /* EEPROM Control register */
173995d67482SBill Paul #define BGE_EECTL_CLKOUT_TRISTATE	0x00000001
174095d67482SBill Paul #define BGE_EECTL_CLKOUT		0x00000002
174195d67482SBill Paul #define BGE_EECTL_CLKIN			0x00000004
174295d67482SBill Paul #define BGE_EECTL_DATAOUT_TRISTATE	0x00000008
174395d67482SBill Paul #define BGE_EECTL_DATAOUT		0x00000010
174495d67482SBill Paul #define BGE_EECTL_DATAIN		0x00000020
174595d67482SBill Paul 
174695d67482SBill Paul /* MDI (MII/GMII) access register */
174795d67482SBill Paul #define BGE_MDI_DATA			0x00000001
174895d67482SBill Paul #define BGE_MDI_DIR			0x00000002
174995d67482SBill Paul #define BGE_MDI_SEL			0x00000004
175095d67482SBill Paul #define BGE_MDI_CLK			0x00000008
175195d67482SBill Paul 
175295d67482SBill Paul #define BGE_MEMWIN_START		0x00008000
175395d67482SBill Paul #define BGE_MEMWIN_END			0x0000FFFF
175495d67482SBill Paul 
175595d67482SBill Paul 
175695d67482SBill Paul #define BGE_MEMWIN_READ(sc, x, val)					\
175795d67482SBill Paul 	do {								\
175895d67482SBill Paul 		pci_write_config(sc->bge_dev, BGE_PCI_MEMWIN_BASEADDR,	\
175995d67482SBill Paul 		    (0xFFFF0000 & x), 4);				\
176095d67482SBill Paul 		val = CSR_READ_4(sc, BGE_MEMWIN_START + (x & 0xFFFF));	\
176195d67482SBill Paul 	} while(0)
176295d67482SBill Paul 
176395d67482SBill Paul #define BGE_MEMWIN_WRITE(sc, x, val)					\
176495d67482SBill Paul 	do {								\
176595d67482SBill Paul 		pci_write_config(sc->bge_dev, BGE_PCI_MEMWIN_BASEADDR,	\
176695d67482SBill Paul 		    (0xFFFF0000 & x), 4);				\
176795d67482SBill Paul 		CSR_WRITE_4(sc, BGE_MEMWIN_START + (x & 0xFFFF), val);	\
176895d67482SBill Paul 	} while(0)
176995d67482SBill Paul 
177095d67482SBill Paul /*
177121c9e407SDavid Christensen  * This magic number is written to the firmware mailbox at 0xb50
177221c9e407SDavid Christensen  * before a software reset is issued.  After the internal firmware
177321c9e407SDavid Christensen  * has completed its initialization it will write the opposite of
177421c9e407SDavid Christensen  * this value, ~BGE_MAGIC_NUMBER, to the same location, allowing the
177521c9e407SDavid Christensen  * driver to synchronize with the firmware.
177695d67482SBill Paul  */
177795d67482SBill Paul #define BGE_MAGIC_NUMBER                0x4B657654
177895d67482SBill Paul 
177995d67482SBill Paul typedef struct {
1780a6c21371SGleb Smirnoff 	uint32_t		bge_addr_hi;
1781a6c21371SGleb Smirnoff 	uint32_t		bge_addr_lo;
178295d67482SBill Paul } bge_hostaddr;
1783f41ac2beSBill Paul 
1784487a8c7eSPaul Saab #define BGE_HOSTADDR(x, y)						\
1785487a8c7eSPaul Saab 	do {								\
1786a6c21371SGleb Smirnoff 		(x).bge_addr_lo = ((uint64_t) (y) & 0xffffffff);	\
1787a6c21371SGleb Smirnoff 		(x).bge_addr_hi = ((uint64_t) (y) >> 32);		\
1788487a8c7eSPaul Saab 	} while(0)
178995d67482SBill Paul 
1790f41ac2beSBill Paul #define BGE_ADDR_LO(y)	\
1791a6c21371SGleb Smirnoff 	((uint64_t) (y) & 0xFFFFFFFF)
1792f41ac2beSBill Paul #define BGE_ADDR_HI(y)	\
1793a6c21371SGleb Smirnoff 	((uint64_t) (y) >> 32)
1794f41ac2beSBill Paul 
179595d67482SBill Paul /* Ring control block structure */
179695d67482SBill Paul struct bge_rcb {
179795d67482SBill Paul 	bge_hostaddr		bge_hostaddr;
1798a6c21371SGleb Smirnoff 	uint32_t		bge_maxlen_flags;
1799a6c21371SGleb Smirnoff 	uint32_t		bge_nicaddr;
180095d67482SBill Paul };
1801e907febfSPyun YongHyeon 
1802e907febfSPyun YongHyeon #define	RCB_WRITE_4(sc, rcb, offset, val) \
1803e907febfSPyun YongHyeon 	bus_space_write_4(sc->bge_btag, sc->bge_bhandle, \
1804e907febfSPyun YongHyeon 			  rcb + offsetof(struct bge_rcb, offset), val)
180567111612SJohn Polstra #define BGE_RCB_MAXLEN_FLAGS(maxlen, flags)	((maxlen) << 16 | (flags))
180695d67482SBill Paul 
180795d67482SBill Paul #define BGE_RCB_FLAG_USE_EXT_RX_BD	0x0001
180895d67482SBill Paul #define BGE_RCB_FLAG_RING_DISABLED	0x0002
180995d67482SBill Paul 
181095d67482SBill Paul struct bge_tx_bd {
181195d67482SBill Paul 	bge_hostaddr		bge_addr;
1812e907febfSPyun YongHyeon #if BYTE_ORDER == LITTLE_ENDIAN
1813a6c21371SGleb Smirnoff 	uint16_t		bge_flags;
1814a6c21371SGleb Smirnoff 	uint16_t		bge_len;
1815a6c21371SGleb Smirnoff 	uint16_t		bge_vlan_tag;
1816a6c21371SGleb Smirnoff 	uint16_t		bge_rsvd;
1817e907febfSPyun YongHyeon #else
1818a6c21371SGleb Smirnoff 	uint16_t		bge_len;
1819a6c21371SGleb Smirnoff 	uint16_t		bge_flags;
1820a6c21371SGleb Smirnoff 	uint16_t		bge_rsvd;
1821a6c21371SGleb Smirnoff 	uint16_t		bge_vlan_tag;
1822e907febfSPyun YongHyeon #endif
182395d67482SBill Paul };
182495d67482SBill Paul 
182595d67482SBill Paul #define BGE_TXBDFLAG_TCP_UDP_CSUM	0x0001
182695d67482SBill Paul #define BGE_TXBDFLAG_IP_CSUM		0x0002
182795d67482SBill Paul #define BGE_TXBDFLAG_END		0x0004
182895d67482SBill Paul #define BGE_TXBDFLAG_IP_FRAG		0x0008
182995d67482SBill Paul #define BGE_TXBDFLAG_IP_FRAG_END	0x0010
183095d67482SBill Paul #define BGE_TXBDFLAG_VLAN_TAG		0x0040
183195d67482SBill Paul #define BGE_TXBDFLAG_COAL_NOW		0x0080
183295d67482SBill Paul #define BGE_TXBDFLAG_CPU_PRE_DMA	0x0100
183395d67482SBill Paul #define BGE_TXBDFLAG_CPU_POST_DMA	0x0200
183495d67482SBill Paul #define BGE_TXBDFLAG_INSERT_SRC_ADDR	0x1000
183595d67482SBill Paul #define BGE_TXBDFLAG_CHOOSE_SRC_ADDR	0x6000
183695d67482SBill Paul #define BGE_TXBDFLAG_NO_CRC		0x8000
183795d67482SBill Paul 
183895d67482SBill Paul #define BGE_NIC_TXRING_ADDR(ringno, size)	\
183995d67482SBill Paul 	BGE_SEND_RING_1_TO_4 +			\
184095d67482SBill Paul 	((ringno * sizeof(struct bge_tx_bd) * size) / 4)
184195d67482SBill Paul 
184295d67482SBill Paul struct bge_rx_bd {
184395d67482SBill Paul 	bge_hostaddr		bge_addr;
1844e907febfSPyun YongHyeon #if BYTE_ORDER == LITTLE_ENDIAN
1845a6c21371SGleb Smirnoff 	uint16_t		bge_len;
1846a6c21371SGleb Smirnoff 	uint16_t		bge_idx;
1847a6c21371SGleb Smirnoff 	uint16_t		bge_flags;
1848a6c21371SGleb Smirnoff 	uint16_t		bge_type;
1849a6c21371SGleb Smirnoff 	uint16_t		bge_tcp_udp_csum;
1850a6c21371SGleb Smirnoff 	uint16_t		bge_ip_csum;
1851a6c21371SGleb Smirnoff 	uint16_t		bge_vlan_tag;
1852a6c21371SGleb Smirnoff 	uint16_t		bge_error_flag;
1853e907febfSPyun YongHyeon #else
1854a6c21371SGleb Smirnoff 	uint16_t		bge_idx;
1855a6c21371SGleb Smirnoff 	uint16_t		bge_len;
1856a6c21371SGleb Smirnoff 	uint16_t		bge_type;
1857a6c21371SGleb Smirnoff 	uint16_t		bge_flags;
1858a6c21371SGleb Smirnoff 	uint16_t		bge_ip_csum;
1859a6c21371SGleb Smirnoff 	uint16_t		bge_tcp_udp_csum;
1860a6c21371SGleb Smirnoff 	uint16_t		bge_error_flag;
1861a6c21371SGleb Smirnoff 	uint16_t		bge_vlan_tag;
1862e907febfSPyun YongHyeon #endif
1863a6c21371SGleb Smirnoff 	uint32_t		bge_rsvd;
1864a6c21371SGleb Smirnoff 	uint32_t		bge_opaque;
186595d67482SBill Paul };
186695d67482SBill Paul 
18671be6acb7SGleb Smirnoff struct bge_extrx_bd {
18681be6acb7SGleb Smirnoff 	bge_hostaddr		bge_addr1;
18691be6acb7SGleb Smirnoff 	bge_hostaddr		bge_addr2;
18701be6acb7SGleb Smirnoff 	bge_hostaddr		bge_addr3;
1871e907febfSPyun YongHyeon #if BYTE_ORDER == LITTLE_ENDIAN
1872a6c21371SGleb Smirnoff 	uint16_t		bge_len2;
1873a6c21371SGleb Smirnoff 	uint16_t		bge_len1;
1874a6c21371SGleb Smirnoff 	uint16_t		bge_rsvd1;
1875a6c21371SGleb Smirnoff 	uint16_t		bge_len3;
1876e907febfSPyun YongHyeon #else
1877a6c21371SGleb Smirnoff 	uint16_t		bge_len1;
1878a6c21371SGleb Smirnoff 	uint16_t		bge_len2;
1879a6c21371SGleb Smirnoff 	uint16_t		bge_len3;
1880a6c21371SGleb Smirnoff 	uint16_t		bge_rsvd1;
1881e907febfSPyun YongHyeon #endif
18821be6acb7SGleb Smirnoff 	bge_hostaddr		bge_addr0;
1883e907febfSPyun YongHyeon #if BYTE_ORDER == LITTLE_ENDIAN
1884a6c21371SGleb Smirnoff 	uint16_t		bge_len0;
1885a6c21371SGleb Smirnoff 	uint16_t		bge_idx;
1886a6c21371SGleb Smirnoff 	uint16_t		bge_flags;
1887a6c21371SGleb Smirnoff 	uint16_t		bge_type;
1888a6c21371SGleb Smirnoff 	uint16_t		bge_tcp_udp_csum;
1889a6c21371SGleb Smirnoff 	uint16_t		bge_ip_csum;
1890a6c21371SGleb Smirnoff 	uint16_t		bge_vlan_tag;
1891a6c21371SGleb Smirnoff 	uint16_t		bge_error_flag;
1892e907febfSPyun YongHyeon #else
1893a6c21371SGleb Smirnoff 	uint16_t		bge_idx;
1894a6c21371SGleb Smirnoff 	uint16_t		bge_len0;
1895a6c21371SGleb Smirnoff 	uint16_t		bge_type;
1896a6c21371SGleb Smirnoff 	uint16_t		bge_flags;
1897a6c21371SGleb Smirnoff 	uint16_t		bge_ip_csum;
1898a6c21371SGleb Smirnoff 	uint16_t		bge_tcp_udp_csum;
1899a6c21371SGleb Smirnoff 	uint16_t		bge_error_flag;
1900a6c21371SGleb Smirnoff 	uint16_t		bge_vlan_tag;
1901e907febfSPyun YongHyeon #endif
1902a6c21371SGleb Smirnoff 	uint32_t		bge_rsvd0;
1903a6c21371SGleb Smirnoff 	uint32_t		bge_opaque;
19041be6acb7SGleb Smirnoff };
19051be6acb7SGleb Smirnoff 
190695d67482SBill Paul #define BGE_RXBDFLAG_END		0x0004
190795d67482SBill Paul #define BGE_RXBDFLAG_JUMBO_RING		0x0020
190895d67482SBill Paul #define BGE_RXBDFLAG_VLAN_TAG		0x0040
190995d67482SBill Paul #define BGE_RXBDFLAG_ERROR		0x0400
191095d67482SBill Paul #define BGE_RXBDFLAG_MINI_RING		0x0800
191195d67482SBill Paul #define BGE_RXBDFLAG_IP_CSUM		0x1000
191295d67482SBill Paul #define BGE_RXBDFLAG_TCP_UDP_CSUM	0x2000
191395d67482SBill Paul #define BGE_RXBDFLAG_TCP_UDP_IS_TCP	0x4000
191495d67482SBill Paul 
191595d67482SBill Paul #define BGE_RXERRFLAG_BAD_CRC		0x0001
191695d67482SBill Paul #define BGE_RXERRFLAG_COLL_DETECT	0x0002
191795d67482SBill Paul #define BGE_RXERRFLAG_LINK_LOST		0x0004
191895d67482SBill Paul #define BGE_RXERRFLAG_PHY_DECODE_ERR	0x0008
191995d67482SBill Paul #define BGE_RXERRFLAG_MAC_ABORT		0x0010
192095d67482SBill Paul #define BGE_RXERRFLAG_RUNT		0x0020
192195d67482SBill Paul #define BGE_RXERRFLAG_TRUNC_NO_RSRCS	0x0040
192295d67482SBill Paul #define BGE_RXERRFLAG_GIANT		0x0080
192395d67482SBill Paul 
192495d67482SBill Paul struct bge_sts_idx {
1925e907febfSPyun YongHyeon #if BYTE_ORDER == LITTLE_ENDIAN
1926a6c21371SGleb Smirnoff 	uint16_t		bge_rx_prod_idx;
1927a6c21371SGleb Smirnoff 	uint16_t		bge_tx_cons_idx;
1928e907febfSPyun YongHyeon #else
1929a6c21371SGleb Smirnoff 	uint16_t		bge_tx_cons_idx;
1930a6c21371SGleb Smirnoff 	uint16_t		bge_rx_prod_idx;
1931e907febfSPyun YongHyeon #endif
193295d67482SBill Paul };
193395d67482SBill Paul 
193495d67482SBill Paul struct bge_status_block {
1935a6c21371SGleb Smirnoff 	uint32_t		bge_status;
1936a6c21371SGleb Smirnoff 	uint32_t		bge_rsvd0;
1937e907febfSPyun YongHyeon #if BYTE_ORDER == LITTLE_ENDIAN
1938a6c21371SGleb Smirnoff 	uint16_t		bge_rx_jumbo_cons_idx;
1939a6c21371SGleb Smirnoff 	uint16_t		bge_rx_std_cons_idx;
1940a6c21371SGleb Smirnoff 	uint16_t		bge_rx_mini_cons_idx;
1941a6c21371SGleb Smirnoff 	uint16_t		bge_rsvd1;
1942e907febfSPyun YongHyeon #else
1943a6c21371SGleb Smirnoff 	uint16_t		bge_rx_std_cons_idx;
1944a6c21371SGleb Smirnoff 	uint16_t		bge_rx_jumbo_cons_idx;
1945a6c21371SGleb Smirnoff 	uint16_t		bge_rsvd1;
1946a6c21371SGleb Smirnoff 	uint16_t		bge_rx_mini_cons_idx;
1947e907febfSPyun YongHyeon #endif
194895d67482SBill Paul 	struct bge_sts_idx	bge_idx[16];
194995d67482SBill Paul };
195095d67482SBill Paul 
195195d67482SBill Paul #define BGE_TX_CONSIDX(x, i) x->bge_idx[i].bge_tx_considx
195295d67482SBill Paul #define BGE_RX_PRODIDX(x, i) x->bge_idx[i].bge_rx_prodidx
195395d67482SBill Paul 
195495d67482SBill Paul #define BGE_STATFLAG_UPDATED		0x00000001
195595d67482SBill Paul #define BGE_STATFLAG_LINKSTATE_CHANGED	0x00000002
195695d67482SBill Paul #define BGE_STATFLAG_ERROR		0x00000004
195795d67482SBill Paul 
195895d67482SBill Paul 
195995d67482SBill Paul /*
196095d67482SBill Paul  * Broadcom Vendor ID
196195d67482SBill Paul  * (Note: the BCM570x still defaults to the Alteon PCI vendor ID
196295d67482SBill Paul  * even though they're now manufactured by Broadcom)
196395d67482SBill Paul  */
196495d67482SBill Paul #define BCOM_VENDORID			0x14E4
196595d67482SBill Paul #define BCOM_DEVICEID_BCM5700		0x1644
196695d67482SBill Paul #define BCOM_DEVICEID_BCM5701		0x1645
19674c0da0ffSGleb Smirnoff #define BCOM_DEVICEID_BCM5702		0x1646
19684c0da0ffSGleb Smirnoff #define BCOM_DEVICEID_BCM5702X		0x16A6
19694c0da0ffSGleb Smirnoff #define BCOM_DEVICEID_BCM5702_ALT	0x16C6
19704c0da0ffSGleb Smirnoff #define BCOM_DEVICEID_BCM5703		0x1647
19714c0da0ffSGleb Smirnoff #define BCOM_DEVICEID_BCM5703X		0x16A7
19724c0da0ffSGleb Smirnoff #define BCOM_DEVICEID_BCM5703_ALT	0x16C7
19736ac6d2c8SPaul Saab #define BCOM_DEVICEID_BCM5704C		0x1648
19746ac6d2c8SPaul Saab #define BCOM_DEVICEID_BCM5704S		0x16A8
19754c0da0ffSGleb Smirnoff #define BCOM_DEVICEID_BCM5704S_ALT	0x1649
19760434d1b8SBill Paul #define BCOM_DEVICEID_BCM5705		0x1653
1977c001ccf2SPaul Saab #define BCOM_DEVICEID_BCM5705K		0x1654
19784c0da0ffSGleb Smirnoff #define BCOM_DEVICEID_BCM5705F		0x166E
19790434d1b8SBill Paul #define BCOM_DEVICEID_BCM5705M		0x165D
19800434d1b8SBill Paul #define BCOM_DEVICEID_BCM5705M_ALT	0x165E
1981419c028bSPaul Saab #define BCOM_DEVICEID_BCM5714C		0x1668
19824c0da0ffSGleb Smirnoff #define BCOM_DEVICEID_BCM5714S		0x1669
19834c0da0ffSGleb Smirnoff #define BCOM_DEVICEID_BCM5715		0x1678
19844c0da0ffSGleb Smirnoff #define BCOM_DEVICEID_BCM5715S		0x1679
19854c0da0ffSGleb Smirnoff #define BCOM_DEVICEID_BCM5720		0x1658
19864c0da0ffSGleb Smirnoff #define BCOM_DEVICEID_BCM5721		0x1659
1987e53d81eeSPaul Saab #define BCOM_DEVICEID_BCM5750		0x1676
1988e53d81eeSPaul Saab #define BCOM_DEVICEID_BCM5750M		0x167C
1989e53d81eeSPaul Saab #define BCOM_DEVICEID_BCM5751		0x1677
19904c0da0ffSGleb Smirnoff #define BCOM_DEVICEID_BCM5751F		0x167E
1991d2014b30STai-hwa Liang #define BCOM_DEVICEID_BCM5751M		0x167D
1992560c1670SGleb Smirnoff #define BCOM_DEVICEID_BCM5752		0x1600
19934c0da0ffSGleb Smirnoff #define BCOM_DEVICEID_BCM5752M		0x1601
19944c0da0ffSGleb Smirnoff #define BCOM_DEVICEID_BCM5753		0x16F7
19954c0da0ffSGleb Smirnoff #define BCOM_DEVICEID_BCM5753F		0x16FE
19964c0da0ffSGleb Smirnoff #define BCOM_DEVICEID_BCM5753M		0x16FD
19979e86676bSGleb Smirnoff #define BCOM_DEVICEID_BCM5754		0x167A
19989e86676bSGleb Smirnoff #define BCOM_DEVICEID_BCM5754M		0x1672
19999e86676bSGleb Smirnoff #define BCOM_DEVICEID_BCM5755		0x167B
20009e86676bSGleb Smirnoff #define BCOM_DEVICEID_BCM5755M		0x1673
20014c0da0ffSGleb Smirnoff #define BCOM_DEVICEID_BCM5780		0x166A
20024c0da0ffSGleb Smirnoff #define BCOM_DEVICEID_BCM5780S		0x166B
20034c0da0ffSGleb Smirnoff #define BCOM_DEVICEID_BCM5781		0x16DD
20040434d1b8SBill Paul #define BCOM_DEVICEID_BCM5782		0x1696
20059e86676bSGleb Smirnoff #define BCOM_DEVICEID_BCM5786		0x169A
20069e86676bSGleb Smirnoff #define BCOM_DEVICEID_BCM5787		0x169B
20079e86676bSGleb Smirnoff #define BCOM_DEVICEID_BCM5787M		0x1693
20089f71a4c2SBill Paul #define BCOM_DEVICEID_BCM5788		0x169C
2009c3615d48SMike Silbersack #define BCOM_DEVICEID_BCM5789		0x169D
20105d99c641SBill Paul #define BCOM_DEVICEID_BCM5901		0x170D
20115d99c641SBill Paul #define BCOM_DEVICEID_BCM5901A2		0x170E
20124c0da0ffSGleb Smirnoff #define BCOM_DEVICEID_BCM5903M		0x16FF
201395d67482SBill Paul 
201495d67482SBill Paul /*
201595d67482SBill Paul  * Alteon AceNIC PCI vendor/device ID.
201695d67482SBill Paul  */
20174c0da0ffSGleb Smirnoff #define ALTEON_VENDORID			0x12AE
20184c0da0ffSGleb Smirnoff #define ALTEON_DEVICEID_ACENIC		0x0001
20194c0da0ffSGleb Smirnoff #define ALTEON_DEVICEID_ACENIC_COPPER	0x0002
20204c0da0ffSGleb Smirnoff #define ALTEON_DEVICEID_BCM5700		0x0003
20214c0da0ffSGleb Smirnoff #define ALTEON_DEVICEID_BCM5701		0x0004
202295d67482SBill Paul 
202395d67482SBill Paul /*
202495d67482SBill Paul  * 3Com 3c985 PCI vendor/device ID.
202595d67482SBill Paul  */
202695d67482SBill Paul #define TC_VENDORID			0x10B7
202795d67482SBill Paul #define TC_DEVICEID_3C985		0x0001
202895d67482SBill Paul #define TC_DEVICEID_3C996		0x0003
202995d67482SBill Paul 
203095d67482SBill Paul /*
203195d67482SBill Paul  * SysKonnect PCI vendor ID
203295d67482SBill Paul  */
203395d67482SBill Paul #define SK_VENDORID			0x1148
203495d67482SBill Paul #define SK_DEVICEID_ALTIMA		0x4400
203595d67482SBill Paul #define SK_SUBSYSID_9D21		0x4421
203695d67482SBill Paul #define SK_SUBSYSID_9D41		0x4441
203795d67482SBill Paul 
203895d67482SBill Paul /*
2039586d7c2eSJohn Polstra  * Altima PCI vendor/device ID.
2040586d7c2eSJohn Polstra  */
2041586d7c2eSJohn Polstra #define ALTIMA_VENDORID			0x173b
2042586d7c2eSJohn Polstra #define ALTIMA_DEVICE_AC1000		0x03e8
20432aae6624SBill Paul #define ALTIMA_DEVICE_AC1002		0x03e9
2044470bd96aSJohn Polstra #define ALTIMA_DEVICE_AC9100		0x03ea
2045586d7c2eSJohn Polstra 
2046586d7c2eSJohn Polstra /*
20476d2a9bd6SDoug Ambrisko  * Dell PCI vendor ID
20486d2a9bd6SDoug Ambrisko  */
20496d2a9bd6SDoug Ambrisko 
20506d2a9bd6SDoug Ambrisko #define DELL_VENDORID			0x1028
20516d2a9bd6SDoug Ambrisko 
20526d2a9bd6SDoug Ambrisko /*
20534c0da0ffSGleb Smirnoff  * Apple PCI vendor ID.
20544c0da0ffSGleb Smirnoff  */
20554c0da0ffSGleb Smirnoff #define APPLE_VENDORID			0x106b
20564c0da0ffSGleb Smirnoff #define APPLE_DEVICE_BCM5701		0x1645
20574c0da0ffSGleb Smirnoff 
20584c0da0ffSGleb Smirnoff /*
205995d67482SBill Paul  * Offset of MAC address inside EEPROM.
206095d67482SBill Paul  */
206195d67482SBill Paul #define BGE_EE_MAC_OFFSET		0x7C
206295d67482SBill Paul #define BGE_EE_HWCFG_OFFSET		0xC8
206395d67482SBill Paul 
2064a1d52896SBill Paul #define BGE_HWCFG_VOLTAGE		0x00000003
2065a1d52896SBill Paul #define BGE_HWCFG_PHYLED_MODE		0x0000000C
2066a1d52896SBill Paul #define BGE_HWCFG_MEDIA			0x00000030
2067a1d52896SBill Paul 
2068a1d52896SBill Paul #define BGE_VOLTAGE_1POINT3		0x00000000
2069a1d52896SBill Paul #define BGE_VOLTAGE_1POINT8		0x00000001
2070a1d52896SBill Paul 
2071a1d52896SBill Paul #define BGE_PHYLEDMODE_UNSPEC		0x00000000
2072a1d52896SBill Paul #define BGE_PHYLEDMODE_TRIPLELED	0x00000004
2073a1d52896SBill Paul #define BGE_PHYLEDMODE_SINGLELED	0x00000008
2074a1d52896SBill Paul 
2075a1d52896SBill Paul #define BGE_MEDIA_UNSPEC		0x00000000
2076a1d52896SBill Paul #define BGE_MEDIA_COPPER		0x00000010
2077a1d52896SBill Paul #define BGE_MEDIA_FIBER			0x00000020
2078a1d52896SBill Paul 
207995d67482SBill Paul #define BGE_PCI_READ_CMD		0x06000000
208095d67482SBill Paul #define BGE_PCI_WRITE_CMD		0x70000000
208195d67482SBill Paul 
208295d67482SBill Paul #define BGE_TICKS_PER_SEC		1000000
208395d67482SBill Paul 
208495d67482SBill Paul /*
208595d67482SBill Paul  * Ring size constants.
208695d67482SBill Paul  */
208795d67482SBill Paul #define BGE_EVENT_RING_CNT	256
208895d67482SBill Paul #define BGE_CMD_RING_CNT	64
208995d67482SBill Paul #define BGE_STD_RX_RING_CNT	512
209095d67482SBill Paul #define BGE_JUMBO_RX_RING_CNT	256
209195d67482SBill Paul #define BGE_MINI_RX_RING_CNT	1024
209295d67482SBill Paul #define BGE_RETURN_RING_CNT	1024
209395d67482SBill Paul 
20940434d1b8SBill Paul /* 5705 has smaller return ring size */
20950434d1b8SBill Paul 
20960434d1b8SBill Paul #define BGE_RETURN_RING_CNT_5705	512
20970434d1b8SBill Paul 
209895d67482SBill Paul /*
209995d67482SBill Paul  * Possible TX ring sizes.
210095d67482SBill Paul  */
210195d67482SBill Paul #define BGE_TX_RING_CNT_128	128
210295d67482SBill Paul #define BGE_TX_RING_BASE_128	0x3800
210395d67482SBill Paul 
210495d67482SBill Paul #define BGE_TX_RING_CNT_256	256
210595d67482SBill Paul #define BGE_TX_RING_BASE_256	0x3000
210695d67482SBill Paul 
210795d67482SBill Paul #define BGE_TX_RING_CNT_512	512
210895d67482SBill Paul #define BGE_TX_RING_BASE_512	0x2000
210995d67482SBill Paul 
211095d67482SBill Paul #define BGE_TX_RING_CNT		BGE_TX_RING_CNT_512
211195d67482SBill Paul #define BGE_TX_RING_BASE	BGE_TX_RING_BASE_512
211295d67482SBill Paul 
211395d67482SBill Paul /*
211495d67482SBill Paul  * Tigon III statistics counters.
211595d67482SBill Paul  */
21160434d1b8SBill Paul /* Statistics maintained MAC Receive block. */
21170434d1b8SBill Paul struct bge_rx_mac_stats {
211895d67482SBill Paul 	bge_hostaddr		ifHCInOctets;
211995d67482SBill Paul 	bge_hostaddr		Reserved1;
212095d67482SBill Paul 	bge_hostaddr		etherStatsFragments;
212195d67482SBill Paul 	bge_hostaddr		ifHCInUcastPkts;
212295d67482SBill Paul 	bge_hostaddr		ifHCInMulticastPkts;
212395d67482SBill Paul 	bge_hostaddr		ifHCInBroadcastPkts;
212495d67482SBill Paul 	bge_hostaddr		dot3StatsFCSErrors;
212595d67482SBill Paul 	bge_hostaddr		dot3StatsAlignmentErrors;
212695d67482SBill Paul 	bge_hostaddr		xonPauseFramesReceived;
212795d67482SBill Paul 	bge_hostaddr		xoffPauseFramesReceived;
212895d67482SBill Paul 	bge_hostaddr		macControlFramesReceived;
212995d67482SBill Paul 	bge_hostaddr		xoffStateEntered;
213095d67482SBill Paul 	bge_hostaddr		dot3StatsFramesTooLong;
213195d67482SBill Paul 	bge_hostaddr		etherStatsJabbers;
213295d67482SBill Paul 	bge_hostaddr		etherStatsUndersizePkts;
213395d67482SBill Paul 	bge_hostaddr		inRangeLengthError;
213495d67482SBill Paul 	bge_hostaddr		outRangeLengthError;
213595d67482SBill Paul 	bge_hostaddr		etherStatsPkts64Octets;
213695d67482SBill Paul 	bge_hostaddr		etherStatsPkts65Octetsto127Octets;
213795d67482SBill Paul 	bge_hostaddr		etherStatsPkts128Octetsto255Octets;
213895d67482SBill Paul 	bge_hostaddr		etherStatsPkts256Octetsto511Octets;
213995d67482SBill Paul 	bge_hostaddr		etherStatsPkts512Octetsto1023Octets;
214095d67482SBill Paul 	bge_hostaddr		etherStatsPkts1024Octetsto1522Octets;
214195d67482SBill Paul 	bge_hostaddr		etherStatsPkts1523Octetsto2047Octets;
214295d67482SBill Paul 	bge_hostaddr		etherStatsPkts2048Octetsto4095Octets;
214395d67482SBill Paul 	bge_hostaddr		etherStatsPkts4096Octetsto8191Octets;
214495d67482SBill Paul 	bge_hostaddr		etherStatsPkts8192Octetsto9022Octets;
21450434d1b8SBill Paul };
214695d67482SBill Paul 
214795d67482SBill Paul 
21480434d1b8SBill Paul /* Statistics maintained MAC Transmit block. */
21490434d1b8SBill Paul struct bge_tx_mac_stats {
215095d67482SBill Paul 	bge_hostaddr		ifHCOutOctets;
215195d67482SBill Paul 	bge_hostaddr		Reserved2;
215295d67482SBill Paul 	bge_hostaddr		etherStatsCollisions;
215395d67482SBill Paul 	bge_hostaddr		outXonSent;
215495d67482SBill Paul 	bge_hostaddr		outXoffSent;
215595d67482SBill Paul 	bge_hostaddr		flowControlDone;
215695d67482SBill Paul 	bge_hostaddr		dot3StatsInternalMacTransmitErrors;
215795d67482SBill Paul 	bge_hostaddr		dot3StatsSingleCollisionFrames;
215895d67482SBill Paul 	bge_hostaddr		dot3StatsMultipleCollisionFrames;
215995d67482SBill Paul 	bge_hostaddr		dot3StatsDeferredTransmissions;
216095d67482SBill Paul 	bge_hostaddr		Reserved3;
216195d67482SBill Paul 	bge_hostaddr		dot3StatsExcessiveCollisions;
216295d67482SBill Paul 	bge_hostaddr		dot3StatsLateCollisions;
216395d67482SBill Paul 	bge_hostaddr		dot3Collided2Times;
216495d67482SBill Paul 	bge_hostaddr		dot3Collided3Times;
216595d67482SBill Paul 	bge_hostaddr		dot3Collided4Times;
216695d67482SBill Paul 	bge_hostaddr		dot3Collided5Times;
216795d67482SBill Paul 	bge_hostaddr		dot3Collided6Times;
216895d67482SBill Paul 	bge_hostaddr		dot3Collided7Times;
216995d67482SBill Paul 	bge_hostaddr		dot3Collided8Times;
217095d67482SBill Paul 	bge_hostaddr		dot3Collided9Times;
217195d67482SBill Paul 	bge_hostaddr		dot3Collided10Times;
217295d67482SBill Paul 	bge_hostaddr		dot3Collided11Times;
217395d67482SBill Paul 	bge_hostaddr		dot3Collided12Times;
217495d67482SBill Paul 	bge_hostaddr		dot3Collided13Times;
217595d67482SBill Paul 	bge_hostaddr		dot3Collided14Times;
217695d67482SBill Paul 	bge_hostaddr		dot3Collided15Times;
217795d67482SBill Paul 	bge_hostaddr		ifHCOutUcastPkts;
217895d67482SBill Paul 	bge_hostaddr		ifHCOutMulticastPkts;
217995d67482SBill Paul 	bge_hostaddr		ifHCOutBroadcastPkts;
218095d67482SBill Paul 	bge_hostaddr		dot3StatsCarrierSenseErrors;
218195d67482SBill Paul 	bge_hostaddr		ifOutDiscards;
218295d67482SBill Paul 	bge_hostaddr		ifOutErrors;
21830434d1b8SBill Paul };
21840434d1b8SBill Paul 
21850434d1b8SBill Paul /* Stats counters access through registers */
21860434d1b8SBill Paul struct bge_mac_stats_regs {
2187a6c21371SGleb Smirnoff 	uint32_t		ifHCOutOctets;
2188a6c21371SGleb Smirnoff 	uint32_t		Reserved0;
2189a6c21371SGleb Smirnoff 	uint32_t		etherStatsCollisions;
2190a6c21371SGleb Smirnoff 	uint32_t		outXonSent;
2191a6c21371SGleb Smirnoff 	uint32_t		outXoffSent;
2192a6c21371SGleb Smirnoff 	uint32_t		Reserved1;
2193a6c21371SGleb Smirnoff 	uint32_t		dot3StatsInternalMacTransmitErrors;
2194a6c21371SGleb Smirnoff 	uint32_t		dot3StatsSingleCollisionFrames;
2195a6c21371SGleb Smirnoff 	uint32_t		dot3StatsMultipleCollisionFrames;
2196a6c21371SGleb Smirnoff 	uint32_t		dot3StatsDeferredTransmissions;
2197a6c21371SGleb Smirnoff 	uint32_t		Reserved2;
2198a6c21371SGleb Smirnoff 	uint32_t		dot3StatsExcessiveCollisions;
2199a6c21371SGleb Smirnoff 	uint32_t		dot3StatsLateCollisions;
2200a6c21371SGleb Smirnoff 	uint32_t		Reserved3[14];
2201a6c21371SGleb Smirnoff 	uint32_t		ifHCOutUcastPkts;
2202a6c21371SGleb Smirnoff 	uint32_t		ifHCOutMulticastPkts;
2203a6c21371SGleb Smirnoff 	uint32_t		ifHCOutBroadcastPkts;
2204a6c21371SGleb Smirnoff 	uint32_t		Reserved4[2];
2205a6c21371SGleb Smirnoff 	uint32_t		ifHCInOctets;
2206a6c21371SGleb Smirnoff 	uint32_t		Reserved5;
2207a6c21371SGleb Smirnoff 	uint32_t		etherStatsFragments;
2208a6c21371SGleb Smirnoff 	uint32_t		ifHCInUcastPkts;
2209a6c21371SGleb Smirnoff 	uint32_t		ifHCInMulticastPkts;
2210a6c21371SGleb Smirnoff 	uint32_t		ifHCInBroadcastPkts;
2211a6c21371SGleb Smirnoff 	uint32_t		dot3StatsFCSErrors;
2212a6c21371SGleb Smirnoff 	uint32_t		dot3StatsAlignmentErrors;
2213a6c21371SGleb Smirnoff 	uint32_t		xonPauseFramesReceived;
2214a6c21371SGleb Smirnoff 	uint32_t		xoffPauseFramesReceived;
2215a6c21371SGleb Smirnoff 	uint32_t		macControlFramesReceived;
2216a6c21371SGleb Smirnoff 	uint32_t		xoffStateEntered;
2217a6c21371SGleb Smirnoff 	uint32_t		dot3StatsFramesTooLong;
2218a6c21371SGleb Smirnoff 	uint32_t		etherStatsJabbers;
2219a6c21371SGleb Smirnoff 	uint32_t		etherStatsUndersizePkts;
22200434d1b8SBill Paul };
22210434d1b8SBill Paul 
22220434d1b8SBill Paul struct bge_stats {
2223a6c21371SGleb Smirnoff 	uint8_t		Reserved0[256];
22240434d1b8SBill Paul 
22250434d1b8SBill Paul 	/* Statistics maintained by Receive MAC. */
22260434d1b8SBill Paul 	struct bge_rx_mac_stats rxstats;
22270434d1b8SBill Paul 
22280434d1b8SBill Paul 	bge_hostaddr		Unused1[37];
22290434d1b8SBill Paul 
22300434d1b8SBill Paul 	/* Statistics maintained by Transmit MAC. */
22310434d1b8SBill Paul 	struct bge_tx_mac_stats txstats;
223295d67482SBill Paul 
223395d67482SBill Paul 	bge_hostaddr		Unused2[31];
223495d67482SBill Paul 
223595d67482SBill Paul 	/* Statistics maintained by Receive List Placement. */
223695d67482SBill Paul 	bge_hostaddr		COSIfHCInPkts[16];
223795d67482SBill Paul 	bge_hostaddr		COSFramesDroppedDueToFilters;
223895d67482SBill Paul 	bge_hostaddr		nicDmaWriteQueueFull;
223995d67482SBill Paul 	bge_hostaddr		nicDmaWriteHighPriQueueFull;
224095d67482SBill Paul 	bge_hostaddr		nicNoMoreRxBDs;
224195d67482SBill Paul 	bge_hostaddr		ifInDiscards;
224295d67482SBill Paul 	bge_hostaddr		ifInErrors;
224395d67482SBill Paul 	bge_hostaddr		nicRecvThresholdHit;
224495d67482SBill Paul 
224595d67482SBill Paul 	bge_hostaddr		Unused3[9];
224695d67482SBill Paul 
224795d67482SBill Paul 	/* Statistics maintained by Send Data Initiator. */
224895d67482SBill Paul 	bge_hostaddr		COSIfHCOutPkts[16];
224995d67482SBill Paul 	bge_hostaddr		nicDmaReadQueueFull;
225095d67482SBill Paul 	bge_hostaddr		nicDmaReadHighPriQueueFull;
225195d67482SBill Paul 	bge_hostaddr		nicSendDataCompQueueFull;
225295d67482SBill Paul 
225395d67482SBill Paul 	/* Statistics maintained by Host Coalescing. */
225495d67482SBill Paul 	bge_hostaddr		nicRingSetSendProdIndex;
225595d67482SBill Paul 	bge_hostaddr		nicRingStatusUpdate;
225695d67482SBill Paul 	bge_hostaddr		nicInterrupts;
225795d67482SBill Paul 	bge_hostaddr		nicAvoidedInterrupts;
225895d67482SBill Paul 	bge_hostaddr		nicSendThresholdHit;
225995d67482SBill Paul 
2260a6c21371SGleb Smirnoff 	uint8_t		Reserved4[320];
226195d67482SBill Paul };
226295d67482SBill Paul 
226395d67482SBill Paul /*
226495d67482SBill Paul  * Tigon general information block. This resides in host memory
226595d67482SBill Paul  * and contains the status counters, ring control blocks and
226695d67482SBill Paul  * producer pointers.
226795d67482SBill Paul  */
226895d67482SBill Paul 
226995d67482SBill Paul struct bge_gib {
227095d67482SBill Paul 	struct bge_stats	bge_stats;
227195d67482SBill Paul 	struct bge_rcb		bge_tx_rcb[16];
227295d67482SBill Paul 	struct bge_rcb		bge_std_rx_rcb;
227395d67482SBill Paul 	struct bge_rcb		bge_jumbo_rx_rcb;
227495d67482SBill Paul 	struct bge_rcb		bge_mini_rx_rcb;
227595d67482SBill Paul 	struct bge_rcb		bge_return_rcb;
227695d67482SBill Paul };
227795d67482SBill Paul 
227895d67482SBill Paul #define BGE_FRAMELEN		1518
227995d67482SBill Paul #define BGE_MAX_FRAMELEN	1536
228095d67482SBill Paul #define BGE_JUMBO_FRAMELEN	9018
228195d67482SBill Paul #define BGE_JUMBO_MTU		(BGE_JUMBO_FRAMELEN-ETHER_HDR_LEN-ETHER_CRC_LEN)
228295d67482SBill Paul #define BGE_MIN_FRAMELEN		60
228395d67482SBill Paul 
228495d67482SBill Paul /*
228595d67482SBill Paul  * Other utility macros.
228695d67482SBill Paul  */
228795d67482SBill Paul #define BGE_INC(x, y)	(x) = (x + 1) % y
228895d67482SBill Paul 
228995d67482SBill Paul /*
229095d67482SBill Paul  * Vital product data and structures.
229195d67482SBill Paul  */
229295d67482SBill Paul #define BGE_VPD_FLAG		0x8000
229395d67482SBill Paul 
229495d67482SBill Paul /* VPD structures */
229595d67482SBill Paul struct vpd_res {
2296a6c21371SGleb Smirnoff 	uint8_t		vr_id;
2297a6c21371SGleb Smirnoff 	uint8_t		vr_len;
2298a6c21371SGleb Smirnoff 	uint8_t		vr_pad;
229995d67482SBill Paul };
230095d67482SBill Paul 
230195d67482SBill Paul struct vpd_key {
230295d67482SBill Paul 	char			vk_key[2];
2303a6c21371SGleb Smirnoff 	uint8_t		vk_len;
230495d67482SBill Paul };
230595d67482SBill Paul 
230695d67482SBill Paul #define VPD_RES_ID	0x82	/* ID string */
230795d67482SBill Paul #define VPD_RES_READ	0x90	/* start of read only area */
230895d67482SBill Paul #define VPD_RES_WRITE	0x81	/* start of read/write area */
230995d67482SBill Paul #define VPD_RES_END	0x78	/* end tag */
231095d67482SBill Paul 
231195d67482SBill Paul 
231295d67482SBill Paul /*
231395d67482SBill Paul  * Register access macros. The Tigon always uses memory mapped register
231495d67482SBill Paul  * accesses and all registers must be accessed with 32 bit operations.
231595d67482SBill Paul  */
231695d67482SBill Paul 
231795d67482SBill Paul #define CSR_WRITE_4(sc, reg, val)	\
231895d67482SBill Paul 	bus_space_write_4(sc->bge_btag, sc->bge_bhandle, reg, val)
231995d67482SBill Paul 
232095d67482SBill Paul #define CSR_READ_4(sc, reg)		\
232195d67482SBill Paul 	bus_space_read_4(sc->bge_btag, sc->bge_bhandle, reg)
232295d67482SBill Paul 
232395d67482SBill Paul #define BGE_SETBIT(sc, reg, x)	\
232429f19445SAlfred Perlstein 	CSR_WRITE_4(sc, reg, (CSR_READ_4(sc, reg) | (x)))
232595d67482SBill Paul #define BGE_CLRBIT(sc, reg, x)	\
232629f19445SAlfred Perlstein 	CSR_WRITE_4(sc, reg, (CSR_READ_4(sc, reg) & ~(x)))
232795d67482SBill Paul 
232895d67482SBill Paul #define PCI_SETBIT(dev, reg, x, s)	\
232929f19445SAlfred Perlstein 	pci_write_config(dev, reg, (pci_read_config(dev, reg, s) | (x)), s)
233095d67482SBill Paul #define PCI_CLRBIT(dev, reg, x, s)	\
233129f19445SAlfred Perlstein 	pci_write_config(dev, reg, (pci_read_config(dev, reg, s) & ~(x)), s)
233295d67482SBill Paul 
233395d67482SBill Paul /*
233495d67482SBill Paul  * Memory management stuff. Note: the SSLOTS, MSLOTS and JSLOTS
233595d67482SBill Paul  * values are tuneable. They control the actual amount of buffers
233695d67482SBill Paul  * allocated for the standard, mini and jumbo receive rings.
233795d67482SBill Paul  */
233895d67482SBill Paul 
233995d67482SBill Paul #define BGE_SSLOTS	256
234095d67482SBill Paul #define BGE_MSLOTS	256
234195d67482SBill Paul #define BGE_JSLOTS	384
234295d67482SBill Paul 
234395d67482SBill Paul #define BGE_JRAWLEN (BGE_JUMBO_FRAMELEN + ETHER_ALIGN)
2344a6c21371SGleb Smirnoff #define BGE_JLEN (BGE_JRAWLEN + (sizeof(uint64_t) - \
2345a6c21371SGleb Smirnoff 	(BGE_JRAWLEN % sizeof(uint64_t))))
234695d67482SBill Paul #define BGE_JPAGESZ PAGE_SIZE
234795d67482SBill Paul #define BGE_RESID (BGE_JPAGESZ - (BGE_JLEN * BGE_JSLOTS) % BGE_JPAGESZ)
234895d67482SBill Paul #define BGE_JMEM ((BGE_JLEN * BGE_JSLOTS) + BGE_RESID)
234995d67482SBill Paul 
23504e7ba1abSGleb Smirnoff #define BGE_NSEG_JUMBO	4
23511be6acb7SGleb Smirnoff #define BGE_NSEG_NEW 32
23521be6acb7SGleb Smirnoff 
235395d67482SBill Paul /*
235495d67482SBill Paul  * Ring structures. Most of these reside in host memory and we tell
235595d67482SBill Paul  * the NIC where they are via the ring control blocks. The exceptions
235695d67482SBill Paul  * are the tx and command rings, which live in NIC memory and which
235795d67482SBill Paul  * we access via the shared memory window.
235895d67482SBill Paul  */
2359f41ac2beSBill Paul 
236095d67482SBill Paul struct bge_ring_data {
2361f41ac2beSBill Paul 	struct bge_rx_bd	*bge_rx_std_ring;
2362f41ac2beSBill Paul 	bus_addr_t		bge_rx_std_ring_paddr;
23631be6acb7SGleb Smirnoff 	struct bge_extrx_bd	*bge_rx_jumbo_ring;
2364f41ac2beSBill Paul 	bus_addr_t		bge_rx_jumbo_ring_paddr;
2365f41ac2beSBill Paul 	struct bge_rx_bd	*bge_rx_return_ring;
2366f41ac2beSBill Paul 	bus_addr_t		bge_rx_return_ring_paddr;
2367f41ac2beSBill Paul 	struct bge_tx_bd	*bge_tx_ring;
2368f41ac2beSBill Paul 	bus_addr_t		bge_tx_ring_paddr;
2369f41ac2beSBill Paul 	struct bge_status_block	*bge_status_block;
2370f41ac2beSBill Paul 	bus_addr_t		bge_status_block_paddr;
2371f41ac2beSBill Paul 	struct bge_stats	*bge_stats;
2372f41ac2beSBill Paul 	bus_addr_t		bge_stats_paddr;
237395d67482SBill Paul 	struct bge_gib		bge_info;
237495d67482SBill Paul };
237595d67482SBill Paul 
2376f41ac2beSBill Paul #define BGE_STD_RX_RING_SZ	\
2377f41ac2beSBill Paul 	(sizeof(struct bge_rx_bd) * BGE_STD_RX_RING_CNT)
2378f41ac2beSBill Paul #define BGE_JUMBO_RX_RING_SZ	\
23791be6acb7SGleb Smirnoff 	(sizeof(struct bge_extrx_bd) * BGE_JUMBO_RX_RING_CNT)
2380f41ac2beSBill Paul #define BGE_TX_RING_SZ		\
2381f41ac2beSBill Paul 	(sizeof(struct bge_tx_bd) * BGE_TX_RING_CNT)
2382f41ac2beSBill Paul #define BGE_RX_RTN_RING_SZ(x)	\
2383f41ac2beSBill Paul 	(sizeof(struct bge_rx_bd) * x->bge_return_ring_cnt)
2384f41ac2beSBill Paul 
2385f41ac2beSBill Paul #define BGE_STATUS_BLK_SZ	sizeof (struct bge_status_block)
2386f41ac2beSBill Paul 
2387f41ac2beSBill Paul #define BGE_STATS_SZ		sizeof (struct bge_stats)
2388f41ac2beSBill Paul 
238995d67482SBill Paul /*
239095d67482SBill Paul  * Mbuf pointers. We need these to keep track of the virtual addresses
239195d67482SBill Paul  * of our mbuf chains since we can only convert from physical to virtual,
239295d67482SBill Paul  * not the other way around.
239395d67482SBill Paul  */
239495d67482SBill Paul struct bge_chain_data {
2395f41ac2beSBill Paul 	bus_dma_tag_t		bge_parent_tag;
2396f41ac2beSBill Paul 	bus_dma_tag_t		bge_rx_std_ring_tag;
2397f41ac2beSBill Paul 	bus_dma_tag_t		bge_rx_jumbo_ring_tag;
2398f41ac2beSBill Paul 	bus_dma_tag_t		bge_rx_return_ring_tag;
2399f41ac2beSBill Paul 	bus_dma_tag_t		bge_tx_ring_tag;
2400f41ac2beSBill Paul 	bus_dma_tag_t		bge_status_tag;
2401f41ac2beSBill Paul 	bus_dma_tag_t		bge_stats_tag;
2402f41ac2beSBill Paul 	bus_dma_tag_t		bge_mtag;	/* mbuf mapping tag */
2403f41ac2beSBill Paul 	bus_dma_tag_t		bge_mtag_jumbo;	/* mbuf mapping tag */
2404f41ac2beSBill Paul 	bus_dmamap_t		bge_tx_dmamap[BGE_TX_RING_CNT];
2405f41ac2beSBill Paul 	bus_dmamap_t		bge_rx_std_dmamap[BGE_STD_RX_RING_CNT];
2406f41ac2beSBill Paul 	bus_dmamap_t		bge_rx_jumbo_dmamap[BGE_JUMBO_RX_RING_CNT];
2407f41ac2beSBill Paul 	bus_dmamap_t		bge_rx_std_ring_map;
2408f41ac2beSBill Paul 	bus_dmamap_t		bge_rx_jumbo_ring_map;
2409f41ac2beSBill Paul 	bus_dmamap_t		bge_tx_ring_map;
2410f41ac2beSBill Paul 	bus_dmamap_t		bge_rx_return_ring_map;
2411f41ac2beSBill Paul 	bus_dmamap_t		bge_status_map;
2412f41ac2beSBill Paul 	bus_dmamap_t		bge_stats_map;
241395d67482SBill Paul 	struct mbuf		*bge_tx_chain[BGE_TX_RING_CNT];
241495d67482SBill Paul 	struct mbuf		*bge_rx_std_chain[BGE_STD_RX_RING_CNT];
241595d67482SBill Paul 	struct mbuf		*bge_rx_jumbo_chain[BGE_JUMBO_RX_RING_CNT];
2416f41ac2beSBill Paul };
2417f41ac2beSBill Paul 
2418f41ac2beSBill Paul struct bge_dmamap_arg {
2419f41ac2beSBill Paul 	struct bge_softc	*sc;
2420f41ac2beSBill Paul 	bus_addr_t		bge_busaddr;
2421a6c21371SGleb Smirnoff 	uint16_t		bge_flags;
2422f41ac2beSBill Paul 	int			bge_idx;
2423f41ac2beSBill Paul 	int			bge_maxsegs;
2424f41ac2beSBill Paul 	struct bge_tx_bd	*bge_ring;
242595d67482SBill Paul };
242695d67482SBill Paul 
242795d67482SBill Paul #define BGE_HWREV_TIGON		0x01
242895d67482SBill Paul #define BGE_HWREV_TIGON_II	0x02
24290434d1b8SBill Paul #define BGE_TIMEOUT		100000
243095d67482SBill Paul #define BGE_TXCONS_UNSET		0xFFFF	/* impossible value */
243195d67482SBill Paul 
243295d67482SBill Paul struct bge_bcom_hack {
243395d67482SBill Paul 	int			reg;
243495d67482SBill Paul 	int			val;
243595d67482SBill Paul };
243695d67482SBill Paul 
243795d67482SBill Paul struct bge_softc {
2438fc74a9f9SBrooks Davis 	struct ifnet		*bge_ifp;	/* interface info */
243995d67482SBill Paul 	device_t		bge_dev;
24400f9bd73bSSam Leffler 	struct mtx		bge_mtx;
244195d67482SBill Paul 	device_t		bge_miibus;
244295d67482SBill Paul 	bus_space_handle_t	bge_bhandle;
244395d67482SBill Paul 	bus_space_tag_t		bge_btag;
244495d67482SBill Paul 	void			*bge_intrhand;
244595d67482SBill Paul 	struct resource		*bge_irq;
244695d67482SBill Paul 	struct resource		*bge_res;
244795d67482SBill Paul 	struct ifmedia		bge_ifmedia;	/* TBI media info */
2448652ae483SGleb Smirnoff 	uint32_t		bge_flags;
2449652ae483SGleb Smirnoff #define BGE_FLAG_EXTRAM		0x00000001	/* Has external SSRAM. */
2450652ae483SGleb Smirnoff #define BGE_FLAG_TBI		0x00000002
2451652ae483SGleb Smirnoff #define BGE_FLAG_RX_ALIGNBUG	0x00000004
2452652ae483SGleb Smirnoff #define BGE_FLAG_NO3LED		0x00000008
2453652ae483SGleb Smirnoff #define BGE_FLAG_PCIX		0x00000010
2454652ae483SGleb Smirnoff #define BGE_FLAG_PCIE		0x00000020
2455a6c21371SGleb Smirnoff 	uint32_t		bge_chipid;
2456a6c21371SGleb Smirnoff 	uint8_t		bge_asicrev;
2457a6c21371SGleb Smirnoff 	uint8_t		bge_chiprev;
2458f41ac2beSBill Paul 	struct bge_ring_data	bge_ldata;	/* rings */
245995d67482SBill Paul 	struct bge_chain_data	bge_cdata;	/* mbufs */
2460a6c21371SGleb Smirnoff 	uint16_t		bge_tx_saved_considx;
2461a6c21371SGleb Smirnoff 	uint16_t		bge_rx_saved_considx;
2462a6c21371SGleb Smirnoff 	uint16_t		bge_ev_saved_considx;
2463a6c21371SGleb Smirnoff 	uint16_t		bge_return_ring_cnt;
2464a6c21371SGleb Smirnoff 	uint16_t		bge_std;	/* current std ring head */
2465a6c21371SGleb Smirnoff 	uint16_t		bge_jumbo;	/* current jumo ring head */
2466a6c21371SGleb Smirnoff 	uint32_t		bge_stat_ticks;
2467a6c21371SGleb Smirnoff 	uint32_t		bge_rx_coal_ticks;
2468a6c21371SGleb Smirnoff 	uint32_t		bge_tx_coal_ticks;
2469a6c21371SGleb Smirnoff 	uint32_t		bge_tx_prodidx;
2470a6c21371SGleb Smirnoff 	uint32_t		bge_rx_max_coal_bds;
2471a6c21371SGleb Smirnoff 	uint32_t		bge_tx_max_coal_bds;
2472a6c21371SGleb Smirnoff 	uint32_t		bge_tx_buf_ratio;
247395d67482SBill Paul 	int			bge_if_flags;
247495d67482SBill Paul 	int			bge_txcnt;
24757b97099dSOleg Bulyzhin 	int			bge_link;	/* link state */
24767b97099dSOleg Bulyzhin 	int			bge_link_evt;	/* pending link event */
24770f9bd73bSSam Leffler 	struct callout		bge_stat_ch;
247895d67482SBill Paul 	char			*bge_vpd_prodname;
247995d67482SBill Paul 	char			*bge_vpd_readonly;
24806fb34dd2SOleg Bulyzhin 	u_long			bge_rx_discards;
24816fb34dd2SOleg Bulyzhin 	u_long			bge_tx_discards;
24826fb34dd2SOleg Bulyzhin 	u_long			bge_tx_collisions;
248375719184SGleb Smirnoff #ifdef DEVICE_POLLING
248475719184SGleb Smirnoff 	int			rxcycles;
248575719184SGleb Smirnoff #endif /* DEVICE_POLLING */
248695d67482SBill Paul };
24870f9bd73bSSam Leffler 
24880f9bd73bSSam Leffler #define	BGE_LOCK_INIT(_sc, _name) \
24890f9bd73bSSam Leffler 	mtx_init(&(_sc)->bge_mtx, _name, MTX_NETWORK_LOCK, MTX_DEF)
24900f9bd73bSSam Leffler #define	BGE_LOCK(_sc)		mtx_lock(&(_sc)->bge_mtx)
24910f9bd73bSSam Leffler #define	BGE_LOCK_ASSERT(_sc)	mtx_assert(&(_sc)->bge_mtx, MA_OWNED)
24920f9bd73bSSam Leffler #define	BGE_UNLOCK(_sc)		mtx_unlock(&(_sc)->bge_mtx)
24930f9bd73bSSam Leffler #define	BGE_LOCK_DESTROY(_sc)	mtx_destroy(&(_sc)->bge_mtx)
2494