xref: /freebsd/sys/dev/qlxgbe/ql_hw.h (revision 95ee2897e98f5d444f26ed2334cc7c439f9c16c6)
1718cf2ccSPedro F. Giffuni /*-
2*4d846d26SWarner Losh  * SPDX-License-Identifier: BSD-2-Clause
3718cf2ccSPedro F. Giffuni  *
435291c22SDavid C Somayajulu  * Copyright (c) 2013-2016 Qlogic Corporation
5f10a77bbSDavid C Somayajulu  * All rights reserved.
6f10a77bbSDavid C Somayajulu  *
7f10a77bbSDavid C Somayajulu  *  Redistribution and use in source and binary forms, with or without
8f10a77bbSDavid C Somayajulu  *  modification, are permitted provided that the following conditions
9f10a77bbSDavid C Somayajulu  *  are met:
10f10a77bbSDavid C Somayajulu  *
11f10a77bbSDavid C Somayajulu  *  1. Redistributions of source code must retain the above copyright
12f10a77bbSDavid C Somayajulu  *     notice, this list of conditions and the following disclaimer.
13f10a77bbSDavid C Somayajulu  *  2. Redistributions in binary form must reproduce the above copyright
14f10a77bbSDavid C Somayajulu  *     notice, this list of conditions and the following disclaimer in the
15f10a77bbSDavid C Somayajulu  *     documentation and/or other materials provided with the distribution.
16f10a77bbSDavid C Somayajulu  *
17f10a77bbSDavid C Somayajulu  *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
18f10a77bbSDavid C Somayajulu  *  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19f10a77bbSDavid C Somayajulu  *  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20f10a77bbSDavid C Somayajulu  *  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
21f10a77bbSDavid C Somayajulu  *  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
22f10a77bbSDavid C Somayajulu  *  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
23f10a77bbSDavid C Somayajulu  *  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
24f10a77bbSDavid C Somayajulu  *  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
25f10a77bbSDavid C Somayajulu  *  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
26f10a77bbSDavid C Somayajulu  *  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
27f10a77bbSDavid C Somayajulu  *  POSSIBILITY OF SUCH DAMAGE.
28f10a77bbSDavid C Somayajulu  */
29f10a77bbSDavid C Somayajulu /*
30f10a77bbSDavid C Somayajulu  * File: ql_hw.h
31f10a77bbSDavid C Somayajulu  * Author : David C Somayajulu, Qlogic Corporation, Aliso Viejo, CA 92656.
32f10a77bbSDavid C Somayajulu  */
33f10a77bbSDavid C Somayajulu #ifndef _QL_HW_H_
34f10a77bbSDavid C Somayajulu #define _QL_HW_H_
35f10a77bbSDavid C Somayajulu 
36f10a77bbSDavid C Somayajulu /*
37f10a77bbSDavid C Somayajulu  * PCIe Registers; Direct Mapped; Offsets from BAR0
38f10a77bbSDavid C Somayajulu  */
39f10a77bbSDavid C Somayajulu 
40f10a77bbSDavid C Somayajulu /*
41f10a77bbSDavid C Somayajulu  * Register offsets for QLE8030
42f10a77bbSDavid C Somayajulu  */
43f10a77bbSDavid C Somayajulu 
44f10a77bbSDavid C Somayajulu /*
45f10a77bbSDavid C Somayajulu  * Firmware Mailbox Registers
46f10a77bbSDavid C Somayajulu  *	0 thru 511; offsets 0x800 thru 0xFFC; 32bits each
47f10a77bbSDavid C Somayajulu  */
48f10a77bbSDavid C Somayajulu #define Q8_FW_MBOX0			0x00000800
49f10a77bbSDavid C Somayajulu #define Q8_FW_MBOX511			0x00000FFC
50f10a77bbSDavid C Somayajulu 
51f10a77bbSDavid C Somayajulu /*
52f10a77bbSDavid C Somayajulu  * Host Mailbox Registers
53f10a77bbSDavid C Somayajulu  *	0 thru 511; offsets 0x000 thru 0x7FC; 32bits each
54f10a77bbSDavid C Somayajulu  */
55f10a77bbSDavid C Somayajulu #define Q8_HOST_MBOX0			0x00000000
56f10a77bbSDavid C Somayajulu #define Q8_HOST_MBOX511			0x000007FC
57f10a77bbSDavid C Somayajulu 
58f10a77bbSDavid C Somayajulu #define Q8_MBOX_INT_ENABLE		0x00001000
59f10a77bbSDavid C Somayajulu #define Q8_MBOX_INT_MASK_MSIX		0x00001200
60f10a77bbSDavid C Somayajulu #define Q8_MBOX_INT_LEGACY		0x00003010
61f10a77bbSDavid C Somayajulu 
62f10a77bbSDavid C Somayajulu #define Q8_HOST_MBOX_CNTRL		0x00003038
63f10a77bbSDavid C Somayajulu #define Q8_FW_MBOX_CNTRL		0x0000303C
64f10a77bbSDavid C Somayajulu 
65f10a77bbSDavid C Somayajulu #define Q8_PEG_HALT_STATUS1		0x000034A8
66f10a77bbSDavid C Somayajulu #define Q8_PEG_HALT_STATUS2		0x000034AC
67f10a77bbSDavid C Somayajulu #define Q8_FIRMWARE_HEARTBEAT		0x000034B0
68f10a77bbSDavid C Somayajulu 
69f10a77bbSDavid C Somayajulu #define Q8_FLASH_LOCK_ID		0x00003500
70f10a77bbSDavid C Somayajulu #define Q8_DRIVER_LOCK_ID		0x00003504
71f10a77bbSDavid C Somayajulu #define Q8_FW_CAPABILITIES		0x00003528
72f10a77bbSDavid C Somayajulu 
73f10a77bbSDavid C Somayajulu #define Q8_FW_VER_MAJOR			0x00003550
74f10a77bbSDavid C Somayajulu #define Q8_FW_VER_MINOR			0x00003554
75f10a77bbSDavid C Somayajulu #define Q8_FW_VER_SUB			0x00003558
76f10a77bbSDavid C Somayajulu 
77f10a77bbSDavid C Somayajulu #define Q8_BOOTLD_ADDR			0x0000355C
78f10a77bbSDavid C Somayajulu #define Q8_BOOTLD_SIZE			0x00003560
79f10a77bbSDavid C Somayajulu 
80f10a77bbSDavid C Somayajulu #define Q8_FW_IMAGE_ADDR		0x00003564
81f10a77bbSDavid C Somayajulu #define Q8_FW_BUILD_NUMBER		0x00003568
82f10a77bbSDavid C Somayajulu #define Q8_FW_IMAGE_VALID		0x000035FC
83f10a77bbSDavid C Somayajulu 
84f10a77bbSDavid C Somayajulu #define Q8_CMDPEG_STATE			0x00003650
85f10a77bbSDavid C Somayajulu 
86f10a77bbSDavid C Somayajulu #define Q8_LINK_STATE			0x00003698
87f10a77bbSDavid C Somayajulu #define Q8_LINK_STATE_2			0x0000369C
88f10a77bbSDavid C Somayajulu 
89f10a77bbSDavid C Somayajulu #define Q8_LINK_SPEED_0			0x000036E0
90f10a77bbSDavid C Somayajulu #define Q8_LINK_SPEED_1			0x000036E4
91f10a77bbSDavid C Somayajulu #define Q8_LINK_SPEED_2			0x000036E8
92f10a77bbSDavid C Somayajulu #define Q8_LINK_SPEED_3			0x000036EC
93f10a77bbSDavid C Somayajulu 
94f10a77bbSDavid C Somayajulu #define Q8_MAX_LINK_SPEED_0		0x000036F0
95f10a77bbSDavid C Somayajulu #define Q8_MAX_LINK_SPEED_1		0x000036F4
96f10a77bbSDavid C Somayajulu #define Q8_MAX_LINK_SPEED_2		0x000036F8
97f10a77bbSDavid C Somayajulu #define Q8_MAX_LINK_SPEED_3		0x000036FC
98f10a77bbSDavid C Somayajulu 
99f10a77bbSDavid C Somayajulu #define Q8_ASIC_TEMPERATURE		0x000037B4
100f10a77bbSDavid C Somayajulu 
101f10a77bbSDavid C Somayajulu /*
102f10a77bbSDavid C Somayajulu  * CRB Window Registers
103f10a77bbSDavid C Somayajulu  *	0 thru 15; offsets 0x3800 thru 0x383C; 32bits each
104f10a77bbSDavid C Somayajulu  */
105f10a77bbSDavid C Somayajulu #define Q8_CRB_WINDOW_PF0		0x00003800
106f10a77bbSDavid C Somayajulu #define Q8_CRB_WINDOW_PF15		0x0000383C
107f10a77bbSDavid C Somayajulu 
108f10a77bbSDavid C Somayajulu #define Q8_FLASH_LOCK			0x00003850
109f10a77bbSDavid C Somayajulu #define Q8_FLASH_UNLOCK			0x00003854
110f10a77bbSDavid C Somayajulu 
111f10a77bbSDavid C Somayajulu #define Q8_DRIVER_LOCK			0x00003868
112f10a77bbSDavid C Somayajulu #define Q8_DRIVER_UNLOCK		0x0000386C
113f10a77bbSDavid C Somayajulu 
114f10a77bbSDavid C Somayajulu #define Q8_LEGACY_INT_PTR		0x000038C0
115f10a77bbSDavid C Somayajulu #define Q8_LEGACY_INT_TRIG		0x000038C4
116f10a77bbSDavid C Somayajulu #define Q8_LEGACY_INT_MASK		0x000038C8
117f10a77bbSDavid C Somayajulu 
118f10a77bbSDavid C Somayajulu #define Q8_WILD_CARD			0x000038F0
119f10a77bbSDavid C Somayajulu #define Q8_INFORMANT			0x000038FC
120f10a77bbSDavid C Somayajulu 
121f10a77bbSDavid C Somayajulu /*
122f10a77bbSDavid C Somayajulu  * Ethernet Interface Specific Registers
123f10a77bbSDavid C Somayajulu  */
124f10a77bbSDavid C Somayajulu #define Q8_DRIVER_OP_MODE		0x00003570
125f10a77bbSDavid C Somayajulu #define Q8_API_VERSION			0x0000356C
126f10a77bbSDavid C Somayajulu #define Q8_NPAR_STATE			0x0000359C
127f10a77bbSDavid C Somayajulu 
128f10a77bbSDavid C Somayajulu /*
129f10a77bbSDavid C Somayajulu  * End of PCIe Registers; Direct Mapped; Offsets from BAR0
130f10a77bbSDavid C Somayajulu  */
131f10a77bbSDavid C Somayajulu 
132f10a77bbSDavid C Somayajulu /*
133f10a77bbSDavid C Somayajulu  * Indirect Registers
134f10a77bbSDavid C Somayajulu  */
135f10a77bbSDavid C Somayajulu #define Q8_LED_DUAL_0			0x28084C80
136f10a77bbSDavid C Somayajulu #define Q8_LED_SINGLE_0			0x28084C90
137f10a77bbSDavid C Somayajulu 
138f10a77bbSDavid C Somayajulu #define Q8_LED_DUAL_1			0x28084CA0
139f10a77bbSDavid C Somayajulu #define Q8_LED_SINGLE_1			0x28084CB0
140f10a77bbSDavid C Somayajulu 
141f10a77bbSDavid C Somayajulu #define Q8_LED_DUAL_2			0x28084CC0
142f10a77bbSDavid C Somayajulu #define Q8_LED_SINGLE_2			0x28084CD0
143f10a77bbSDavid C Somayajulu 
144f10a77bbSDavid C Somayajulu #define Q8_LED_DUAL_3			0x28084CE0
145f10a77bbSDavid C Somayajulu #define Q8_LED_SINGLE_3			0x28084CF0
146f10a77bbSDavid C Somayajulu 
147f10a77bbSDavid C Somayajulu #define Q8_GPIO_1			0x28084D00
148f10a77bbSDavid C Somayajulu #define Q8_GPIO_2			0x28084D10
149f10a77bbSDavid C Somayajulu #define Q8_GPIO_3			0x28084D20
150f10a77bbSDavid C Somayajulu #define Q8_GPIO_4			0x28084D40
151f10a77bbSDavid C Somayajulu #define Q8_GPIO_5			0x28084D50
152f10a77bbSDavid C Somayajulu #define Q8_GPIO_6			0x28084D60
153f10a77bbSDavid C Somayajulu #define Q8_GPIO_7			0x42100060
154f10a77bbSDavid C Somayajulu #define Q8_GPIO_8			0x42100064
155f10a77bbSDavid C Somayajulu 
156f10a77bbSDavid C Somayajulu #define Q8_FLASH_SPI_STATUS		0x2808E010
157f10a77bbSDavid C Somayajulu #define Q8_FLASH_SPI_CONTROL		0x2808E014
158f10a77bbSDavid C Somayajulu 
159f10a77bbSDavid C Somayajulu #define Q8_FLASH_STATUS			0x42100004
160f10a77bbSDavid C Somayajulu #define Q8_FLASH_CONTROL		0x42110004
161f10a77bbSDavid C Somayajulu #define Q8_FLASH_ADDRESS		0x42110008
162f10a77bbSDavid C Somayajulu #define Q8_FLASH_WR_DATA		0x4211000C
163f10a77bbSDavid C Somayajulu #define Q8_FLASH_RD_DATA		0x42110018
164f10a77bbSDavid C Somayajulu 
165f10a77bbSDavid C Somayajulu #define Q8_FLASH_DIRECT_WINDOW		0x42110030
166f10a77bbSDavid C Somayajulu #define Q8_FLASH_DIRECT_DATA		0x42150000
167f10a77bbSDavid C Somayajulu 
168f10a77bbSDavid C Somayajulu #define Q8_MS_CNTRL			0x41000090
169f10a77bbSDavid C Somayajulu 
170f10a77bbSDavid C Somayajulu #define Q8_MS_ADDR_LO			0x41000094
171f10a77bbSDavid C Somayajulu #define Q8_MS_ADDR_HI			0x41000098
172f10a77bbSDavid C Somayajulu 
173f10a77bbSDavid C Somayajulu #define Q8_MS_WR_DATA_0_31		0x410000A0
174f10a77bbSDavid C Somayajulu #define Q8_MS_WR_DATA_32_63		0x410000A4
175f10a77bbSDavid C Somayajulu #define Q8_MS_WR_DATA_64_95		0x410000B0
176f10a77bbSDavid C Somayajulu #define Q8_MS_WR_DATA_96_127		0x410000B4
177f10a77bbSDavid C Somayajulu 
178f10a77bbSDavid C Somayajulu #define Q8_MS_RD_DATA_0_31		0x410000A8
179f10a77bbSDavid C Somayajulu #define Q8_MS_RD_DATA_32_63		0x410000AC
180f10a77bbSDavid C Somayajulu #define Q8_MS_RD_DATA_64_95		0x410000B8
181f10a77bbSDavid C Somayajulu #define Q8_MS_RD_DATA_96_127		0x410000BC
182f10a77bbSDavid C Somayajulu 
183f10a77bbSDavid C Somayajulu #define Q8_CRB_PEG_0			0x3400003c
184f10a77bbSDavid C Somayajulu #define Q8_CRB_PEG_1			0x3410003c
185f10a77bbSDavid C Somayajulu #define Q8_CRB_PEG_2			0x3420003c
186f10a77bbSDavid C Somayajulu #define Q8_CRB_PEG_3			0x3430003c
187f10a77bbSDavid C Somayajulu #define Q8_CRB_PEG_4			0x34B0003c
188f10a77bbSDavid C Somayajulu 
189f10a77bbSDavid C Somayajulu /*
190f10a77bbSDavid C Somayajulu  * Macros for reading and writing registers
191f10a77bbSDavid C Somayajulu  */
192f10a77bbSDavid C Somayajulu 
193f10a77bbSDavid C Somayajulu #if defined(__i386__) || defined(__amd64__)
194f10a77bbSDavid C Somayajulu #define Q8_MB()    __asm volatile("mfence" ::: "memory")
195f10a77bbSDavid C Somayajulu #define Q8_WMB()   __asm volatile("sfence" ::: "memory")
196f10a77bbSDavid C Somayajulu #define Q8_RMB()   __asm volatile("lfence" ::: "memory")
197f10a77bbSDavid C Somayajulu #else
198f10a77bbSDavid C Somayajulu #define Q8_MB()
199f10a77bbSDavid C Somayajulu #define Q8_WMB()
200f10a77bbSDavid C Somayajulu #define Q8_RMB()
201f10a77bbSDavid C Somayajulu #endif
202f10a77bbSDavid C Somayajulu 
203f10a77bbSDavid C Somayajulu #define READ_REG32(ha, reg) bus_read_4((ha->pci_reg), reg)
204f10a77bbSDavid C Somayajulu 
205f10a77bbSDavid C Somayajulu #define WRITE_REG32(ha, reg, val) \
206f10a77bbSDavid C Somayajulu 	{\
207f10a77bbSDavid C Somayajulu 		bus_write_4((ha->pci_reg), reg, val);\
208f10a77bbSDavid C Somayajulu 		bus_read_4((ha->pci_reg), reg);\
209f10a77bbSDavid C Somayajulu 	}
210f10a77bbSDavid C Somayajulu 
211f10a77bbSDavid C Somayajulu #define Q8_NUM_MBOX	512
212f10a77bbSDavid C Somayajulu 
213da834d52SDavid C Somayajulu #define Q8_MAX_NUM_MULTICAST_ADDRS	1022
214f10a77bbSDavid C Somayajulu #define Q8_MAC_ADDR_LEN			6
215f10a77bbSDavid C Somayajulu 
216f10a77bbSDavid C Somayajulu /*
217f10a77bbSDavid C Somayajulu  * Firmware Interface
218f10a77bbSDavid C Somayajulu  */
219f10a77bbSDavid C Somayajulu 
220f10a77bbSDavid C Somayajulu /*
221f10a77bbSDavid C Somayajulu  * Command Response Interface - Commands
222f10a77bbSDavid C Somayajulu  */
223f10a77bbSDavid C Somayajulu 
224f10a77bbSDavid C Somayajulu #define Q8_MBX_CONFIG_IP_ADDRESS		0x0001
225f10a77bbSDavid C Somayajulu #define Q8_MBX_CONFIG_INTR			0x0002
226f10a77bbSDavid C Somayajulu #define Q8_MBX_MAP_INTR_SRC			0x0003
227f10a77bbSDavid C Somayajulu #define Q8_MBX_MAP_SDS_TO_RDS			0x0006
228f10a77bbSDavid C Somayajulu #define Q8_MBX_CREATE_RX_CNTXT			0x0007
229f10a77bbSDavid C Somayajulu #define Q8_MBX_DESTROY_RX_CNTXT			0x0008
230f10a77bbSDavid C Somayajulu #define Q8_MBX_CREATE_TX_CNTXT			0x0009
231f10a77bbSDavid C Somayajulu #define Q8_MBX_DESTROY_TX_CNTXT			0x000A
232f10a77bbSDavid C Somayajulu #define Q8_MBX_ADD_RX_RINGS			0x000B
233f10a77bbSDavid C Somayajulu #define Q8_MBX_CONFIG_LRO_FLOW			0x000C
234f10a77bbSDavid C Somayajulu #define Q8_MBX_CONFIG_MAC_LEARNING		0x000D
235f10a77bbSDavid C Somayajulu #define Q8_MBX_GET_STATS			0x000F
236f10a77bbSDavid C Somayajulu #define Q8_MBX_GENERATE_INTR			0x0011
237f10a77bbSDavid C Somayajulu #define Q8_MBX_SET_MAX_MTU			0x0012
238f10a77bbSDavid C Somayajulu #define Q8_MBX_MAC_ADDR_CNTRL			0x001F
239f10a77bbSDavid C Somayajulu #define Q8_MBX_GET_PCI_CONFIG			0x0020
240f10a77bbSDavid C Somayajulu #define Q8_MBX_GET_NIC_PARTITION		0x0021
241f10a77bbSDavid C Somayajulu #define Q8_MBX_SET_NIC_PARTITION		0x0022
242f10a77bbSDavid C Somayajulu #define Q8_MBX_QUERY_WOL_CAP			0x002C
243f10a77bbSDavid C Somayajulu #define Q8_MBX_SET_WOL_CONFIG			0x002D
244f10a77bbSDavid C Somayajulu #define Q8_MBX_GET_MINIDUMP_TMPLT_SIZE		0x002F
245f10a77bbSDavid C Somayajulu #define Q8_MBX_GET_MINIDUMP_TMPLT		0x0030
246f10a77bbSDavid C Somayajulu #define Q8_MBX_GET_FW_DCBX_CAPS			0x0034
247f10a77bbSDavid C Somayajulu #define Q8_MBX_QUERY_DCBX_SETTINGS		0x0035
248f10a77bbSDavid C Somayajulu #define Q8_MBX_CONFIG_RSS			0x0041
249f10a77bbSDavid C Somayajulu #define Q8_MBX_CONFIG_RSS_TABLE			0x0042
250f10a77bbSDavid C Somayajulu #define Q8_MBX_CONFIG_INTR_COALESCE		0x0043
251f10a77bbSDavid C Somayajulu #define Q8_MBX_CONFIG_LED			0x0044
252f10a77bbSDavid C Somayajulu #define Q8_MBX_CONFIG_MAC_ADDR			0x0045
253f10a77bbSDavid C Somayajulu #define Q8_MBX_CONFIG_STATISTICS		0x0046
254f10a77bbSDavid C Somayajulu #define Q8_MBX_CONFIG_LOOPBACK			0x0047
255f10a77bbSDavid C Somayajulu #define Q8_MBX_LINK_EVENT_REQ			0x0048
256f10a77bbSDavid C Somayajulu #define Q8_MBX_CONFIG_MAC_RX_MODE		0x0049
257f10a77bbSDavid C Somayajulu #define Q8_MBX_CONFIG_FW_LRO			0x004A
25800caeec7SDavid C Somayajulu #define Q8_MBX_HW_CONFIG			0x004C
259f10a77bbSDavid C Somayajulu #define Q8_MBX_INIT_NIC_FUNC			0x0060
260f10a77bbSDavid C Somayajulu #define Q8_MBX_STOP_NIC_FUNC			0x0061
26135291c22SDavid C Somayajulu #define Q8_MBX_IDC_REQ				0x0062
26235291c22SDavid C Somayajulu #define Q8_MBX_IDC_ACK				0x0063
263f10a77bbSDavid C Somayajulu #define Q8_MBX_SET_PORT_CONFIG			0x0066
264f10a77bbSDavid C Somayajulu #define Q8_MBX_GET_PORT_CONFIG			0x0067
265f10a77bbSDavid C Somayajulu #define Q8_MBX_GET_LINK_STATUS			0x0068
266f10a77bbSDavid C Somayajulu 
267f10a77bbSDavid C Somayajulu /*
268f10a77bbSDavid C Somayajulu  * Mailbox Command Response
269f10a77bbSDavid C Somayajulu  */
270f10a77bbSDavid C Somayajulu #define Q8_MBX_RSP_SUCCESS			0x0001
271f10a77bbSDavid C Somayajulu #define Q8_MBX_RSP_RESPONSE_FAILURE		0x0002
272f10a77bbSDavid C Somayajulu #define Q8_MBX_RSP_NO_CARD_CRB			0x0003
273f10a77bbSDavid C Somayajulu #define Q8_MBX_RSP_NO_CARD_MEM			0x0004
274f10a77bbSDavid C Somayajulu #define Q8_MBX_RSP_NO_CARD_RSRC			0x0005
275f10a77bbSDavid C Somayajulu #define Q8_MBX_RSP_INVALID_ARGS			0x0006
276f10a77bbSDavid C Somayajulu #define Q8_MBX_RSP_INVALID_ACTION		0x0007
277f10a77bbSDavid C Somayajulu #define Q8_MBX_RSP_INVALID_STATE		0x0008
278f10a77bbSDavid C Somayajulu #define Q8_MBX_RSP_NOT_SUPPORTED		0x0009
279f10a77bbSDavid C Somayajulu #define Q8_MBX_RSP_NOT_PERMITTED		0x000A
280f10a77bbSDavid C Somayajulu #define Q8_MBX_RSP_NOT_READY			0x000B
281f10a77bbSDavid C Somayajulu #define Q8_MBX_RSP_DOES_NOT_EXIST		0x000C
282f10a77bbSDavid C Somayajulu #define Q8_MBX_RSP_ALREADY_EXISTS		0x000D
283f10a77bbSDavid C Somayajulu #define Q8_MBX_RSP_BAD_SIGNATURE		0x000E
284f10a77bbSDavid C Somayajulu #define Q8_MBX_RSP_CMD_NOT_IMPLEMENTED		0x000F
285f10a77bbSDavid C Somayajulu #define Q8_MBX_RSP_CMD_INVALID			0x0010
286f10a77bbSDavid C Somayajulu #define Q8_MBX_RSP_TIMEOUT			0x0011
287f10a77bbSDavid C Somayajulu #define Q8_MBX_RSP_CMD_FAILED			0x0012
288f10a77bbSDavid C Somayajulu #define Q8_MBX_RSP_FATAL_TEMP			0x0013
289f10a77bbSDavid C Somayajulu #define Q8_MBX_RSP_MAX_EXCEEDED			0x0014
290f10a77bbSDavid C Somayajulu #define Q8_MBX_RSP_UNSPECIFIED			0x0015
291f10a77bbSDavid C Somayajulu #define Q8_MBX_RSP_INTR_CREATE_FAILED		0x0017
292f10a77bbSDavid C Somayajulu #define Q8_MBX_RSP_INTR_DELETE_FAILED		0x0018
293f10a77bbSDavid C Somayajulu #define Q8_MBX_RSP_INTR_INVALID_OP		0x0019
294f10a77bbSDavid C Somayajulu #define Q8_MBX_RSP_IDC_INTRMD_RSP		0x001A
295f10a77bbSDavid C Somayajulu 
296f10a77bbSDavid C Somayajulu #define Q8_MBX_CMD_VERSION	(0x2 << 13)
297f10a77bbSDavid C Somayajulu #define Q8_MBX_RSP_STATUS(x) (((!(x >> 9)) || ((x >> 9) == 1)) ? 0: (x >> 9))
298f10a77bbSDavid C Somayajulu /*
299f10a77bbSDavid C Somayajulu  * Configure IP Address
300f10a77bbSDavid C Somayajulu  */
301f10a77bbSDavid C Somayajulu typedef struct _q80_config_ip_addr {
302f10a77bbSDavid C Somayajulu 	uint16_t	opcode;
303f10a77bbSDavid C Somayajulu 	uint16_t 	count_version;
304f10a77bbSDavid C Somayajulu 
305f10a77bbSDavid C Somayajulu 	uint8_t		cmd;
306f10a77bbSDavid C Somayajulu #define		Q8_MBX_CONFIG_IP_ADD_IP	0x1
307f10a77bbSDavid C Somayajulu #define		Q8_MBX_CONFIG_IP_DEL_IP	0x2
308f10a77bbSDavid C Somayajulu 
309f10a77bbSDavid C Somayajulu 	uint8_t		ip_type;
310f10a77bbSDavid C Somayajulu #define		Q8_MBX_CONFIG_IP_V4	0x0
311f10a77bbSDavid C Somayajulu #define		Q8_MBX_CONFIG_IP_V6	0x1
312f10a77bbSDavid C Somayajulu 
313f10a77bbSDavid C Somayajulu 	uint16_t	rsrvd;
314f10a77bbSDavid C Somayajulu 	union {
315f10a77bbSDavid C Somayajulu 		struct {
316f10a77bbSDavid C Somayajulu 			uint32_t addr;
317f10a77bbSDavid C Somayajulu 			uint32_t rsrvd[3];
318f10a77bbSDavid C Somayajulu 		} ipv4;
319f10a77bbSDavid C Somayajulu 		uint8_t	ipv6_addr[16];
320f10a77bbSDavid C Somayajulu 	} u;
321f10a77bbSDavid C Somayajulu } __packed q80_config_ip_addr_t;
322f10a77bbSDavid C Somayajulu 
323f10a77bbSDavid C Somayajulu typedef struct _q80_config_ip_addr_rsp {
324f10a77bbSDavid C Somayajulu         uint16_t	opcode;
325f10a77bbSDavid C Somayajulu         uint16_t	regcnt_status;
326f10a77bbSDavid C Somayajulu } __packed q80_config_ip_addr_rsp_t;
327f10a77bbSDavid C Somayajulu 
328f10a77bbSDavid C Somayajulu /*
329f10a77bbSDavid C Somayajulu  * Configure Interrupt Command
330f10a77bbSDavid C Somayajulu  */
331f10a77bbSDavid C Somayajulu typedef struct _q80_intr {
332f10a77bbSDavid C Somayajulu 	uint8_t		cmd_type;
333f10a77bbSDavid C Somayajulu #define		Q8_MBX_CONFIG_INTR_CREATE	0x1
334f10a77bbSDavid C Somayajulu #define		Q8_MBX_CONFIG_INTR_DELETE	0x2
335f10a77bbSDavid C Somayajulu #define		Q8_MBX_CONFIG_INTR_TYPE_LINE	(0x1 << 4)
336f10a77bbSDavid C Somayajulu #define		Q8_MBX_CONFIG_INTR_TYPE_MSI_X	(0x3 << 4)
337f10a77bbSDavid C Somayajulu 
338f10a77bbSDavid C Somayajulu 	uint8_t		rsrvd;
339f10a77bbSDavid C Somayajulu 	uint16_t	msix_index;
340f10a77bbSDavid C Somayajulu } __packed q80_intr_t;
341f10a77bbSDavid C Somayajulu 
342f10a77bbSDavid C Somayajulu #define Q8_MAX_INTR_VECTORS	16
343f10a77bbSDavid C Somayajulu typedef struct _q80_config_intr {
344f10a77bbSDavid C Somayajulu 	uint16_t	opcode;
345f10a77bbSDavid C Somayajulu 	uint16_t 	count_version;
346f10a77bbSDavid C Somayajulu 	uint8_t		nentries;
347f10a77bbSDavid C Somayajulu 	uint8_t		rsrvd[3];
348f10a77bbSDavid C Somayajulu 	q80_intr_t	intr[Q8_MAX_INTR_VECTORS];
349f10a77bbSDavid C Somayajulu } __packed q80_config_intr_t;
350f10a77bbSDavid C Somayajulu 
351f10a77bbSDavid C Somayajulu typedef struct _q80_intr_rsp {
352f10a77bbSDavid C Somayajulu 	uint8_t		status;
353f10a77bbSDavid C Somayajulu 	uint8_t		cmd;
354f10a77bbSDavid C Somayajulu 	uint16_t	intr_id;
355f10a77bbSDavid C Somayajulu 	uint32_t	intr_src;
356f10a77bbSDavid C Somayajulu } q80_intr_rsp_t;
357f10a77bbSDavid C Somayajulu 
358f10a77bbSDavid C Somayajulu typedef struct _q80_config_intr_rsp {
359f10a77bbSDavid C Somayajulu         uint16_t	opcode;
360f10a77bbSDavid C Somayajulu         uint16_t	regcnt_status;
361f10a77bbSDavid C Somayajulu 	uint8_t		nentries;
362f10a77bbSDavid C Somayajulu 	uint8_t		rsrvd[3];
363f10a77bbSDavid C Somayajulu 	q80_intr_rsp_t	intr[Q8_MAX_INTR_VECTORS];
364f10a77bbSDavid C Somayajulu } __packed q80_config_intr_rsp_t;
365f10a77bbSDavid C Somayajulu 
366f10a77bbSDavid C Somayajulu /*
367f10a77bbSDavid C Somayajulu  * Configure LRO Flow Command
368f10a77bbSDavid C Somayajulu  */
369f10a77bbSDavid C Somayajulu typedef struct _q80_config_lro_flow {
370f10a77bbSDavid C Somayajulu 	uint16_t	opcode;
371f10a77bbSDavid C Somayajulu 	uint16_t 	count_version;
372f10a77bbSDavid C Somayajulu 
373f10a77bbSDavid C Somayajulu 	uint8_t		cmd;
374f10a77bbSDavid C Somayajulu #define Q8_MBX_CONFIG_LRO_FLOW_ADD	0x01
375f10a77bbSDavid C Somayajulu #define Q8_MBX_CONFIG_LRO_FLOW_DELETE	0x02
376f10a77bbSDavid C Somayajulu 
377f10a77bbSDavid C Somayajulu 	uint8_t		type_ts;
378f10a77bbSDavid C Somayajulu #define Q8_MBX_CONFIG_LRO_FLOW_IPV4		0x00
379f10a77bbSDavid C Somayajulu #define Q8_MBX_CONFIG_LRO_FLOW_IPV6		0x01
380f10a77bbSDavid C Somayajulu #define Q8_MBX_CONFIG_LRO_FLOW_TS_ABSENT	0x00
381f10a77bbSDavid C Somayajulu #define Q8_MBX_CONFIG_LRO_FLOW_TS_PRESENT	0x02
382f10a77bbSDavid C Somayajulu 
383f10a77bbSDavid C Somayajulu 	uint16_t	rsrvd;
384f10a77bbSDavid C Somayajulu 	union {
385f10a77bbSDavid C Somayajulu 		struct {
386f10a77bbSDavid C Somayajulu 			uint32_t addr;
387f10a77bbSDavid C Somayajulu 			uint32_t rsrvd[3];
388f10a77bbSDavid C Somayajulu 		} ipv4;
389f10a77bbSDavid C Somayajulu 		uint8_t	ipv6_addr[16];
390f10a77bbSDavid C Somayajulu 	} dst;
391f10a77bbSDavid C Somayajulu 	union {
392f10a77bbSDavid C Somayajulu 		struct {
393f10a77bbSDavid C Somayajulu 			uint32_t addr;
394f10a77bbSDavid C Somayajulu 			uint32_t rsrvd[3];
395f10a77bbSDavid C Somayajulu 		} ipv4;
396f10a77bbSDavid C Somayajulu 		uint8_t	ipv6_addr[16];
397f10a77bbSDavid C Somayajulu 	} src;
398f10a77bbSDavid C Somayajulu 	uint16_t	dst_port;
399f10a77bbSDavid C Somayajulu 	uint16_t	src_port;
400f10a77bbSDavid C Somayajulu } __packed q80_config_lro_flow_t;
401f10a77bbSDavid C Somayajulu 
402f10a77bbSDavid C Somayajulu typedef struct _q80_config_lro_flow_rsp {
403f10a77bbSDavid C Somayajulu         uint16_t	opcode;
404f10a77bbSDavid C Somayajulu         uint16_t	regcnt_status;
405f10a77bbSDavid C Somayajulu } __packed q80_config_lro_flow_rsp_t;
406f10a77bbSDavid C Somayajulu 
407f10a77bbSDavid C Somayajulu typedef struct _q80_set_max_mtu {
408f10a77bbSDavid C Somayajulu 	uint16_t	opcode;
409f10a77bbSDavid C Somayajulu 	uint16_t 	count_version;
410f10a77bbSDavid C Somayajulu 	uint32_t	cntxt_id;
411f10a77bbSDavid C Somayajulu 	uint32_t	mtu;
412f10a77bbSDavid C Somayajulu } __packed q80_set_max_mtu_t;
413f10a77bbSDavid C Somayajulu 
414f10a77bbSDavid C Somayajulu typedef struct _q80_set_max_mtu_rsp {
415f10a77bbSDavid C Somayajulu         uint16_t	opcode;
416f10a77bbSDavid C Somayajulu         uint16_t	regcnt_status;
417f10a77bbSDavid C Somayajulu } __packed q80_set_max_mtu_rsp_t;
418f10a77bbSDavid C Somayajulu 
419f10a77bbSDavid C Somayajulu /*
420f10a77bbSDavid C Somayajulu  * Configure RSS
421f10a77bbSDavid C Somayajulu  */
422f10a77bbSDavid C Somayajulu typedef struct _q80_config_rss {
423f10a77bbSDavid C Somayajulu 	uint16_t	opcode;
424f10a77bbSDavid C Somayajulu 	uint16_t 	count_version;
425f10a77bbSDavid C Somayajulu 
426f10a77bbSDavid C Somayajulu 	uint16_t	cntxt_id;
427f10a77bbSDavid C Somayajulu 	uint16_t	rsrvd;
428f10a77bbSDavid C Somayajulu 
429f10a77bbSDavid C Somayajulu 	uint8_t		hash_type;
43035291c22SDavid C Somayajulu #define Q8_MBX_RSS_HASH_TYPE_IPV4_IP		(0x1 << 4)
43135291c22SDavid C Somayajulu #define Q8_MBX_RSS_HASH_TYPE_IPV4_TCP		(0x2 << 4)
432f10a77bbSDavid C Somayajulu #define Q8_MBX_RSS_HASH_TYPE_IPV4_TCP_IP	(0x3 << 4)
43335291c22SDavid C Somayajulu #define Q8_MBX_RSS_HASH_TYPE_IPV6_IP		(0x1 << 6)
43435291c22SDavid C Somayajulu #define Q8_MBX_RSS_HASH_TYPE_IPV6_TCP		(0x2 << 6)
435f10a77bbSDavid C Somayajulu #define Q8_MBX_RSS_HASH_TYPE_IPV6_TCP_IP	(0x3 << 6)
436f10a77bbSDavid C Somayajulu 
437f10a77bbSDavid C Somayajulu 	uint8_t		flags;
438f10a77bbSDavid C Somayajulu #define Q8_MBX_RSS_FLAGS_ENABLE_RSS		(0x1)
439f10a77bbSDavid C Somayajulu #define Q8_MBX_RSS_FLAGS_USE_IND_TABLE		(0x2)
440f10a77bbSDavid C Somayajulu #define Q8_MBX_RSS_FLAGS_TYPE_CRSS		(0x4)
441f10a77bbSDavid C Somayajulu 
442f10a77bbSDavid C Somayajulu 	uint16_t	indtbl_mask;
443f10a77bbSDavid C Somayajulu #define Q8_MBX_RSS_INDTBL_MASK			0x7F
444f10a77bbSDavid C Somayajulu #define Q8_MBX_RSS_FLAGS_MULTI_RSS_VALID	0x8000
445f10a77bbSDavid C Somayajulu 
446f10a77bbSDavid C Somayajulu 	uint32_t	multi_rss;
447f10a77bbSDavid C Somayajulu #define Q8_MBX_RSS_MULTI_RSS_ENGINE_ASSIGN	BIT_30
448f10a77bbSDavid C Somayajulu #define Q8_MBX_RSS_USE_MULTI_RSS_ENGINES	BIT_31
449f10a77bbSDavid C Somayajulu 
450f10a77bbSDavid C Somayajulu 	uint64_t	rss_key[5];
451f10a77bbSDavid C Somayajulu } __packed q80_config_rss_t;
452f10a77bbSDavid C Somayajulu 
453f10a77bbSDavid C Somayajulu typedef struct _q80_config_rss_rsp {
454f10a77bbSDavid C Somayajulu         uint16_t	opcode;
455f10a77bbSDavid C Somayajulu         uint16_t	regcnt_status;
456f10a77bbSDavid C Somayajulu } __packed q80_config_rss_rsp_t;
457f10a77bbSDavid C Somayajulu 
458f10a77bbSDavid C Somayajulu /*
459f10a77bbSDavid C Somayajulu  * Configure RSS Indirection Table
460f10a77bbSDavid C Somayajulu  */
461f10a77bbSDavid C Somayajulu #define Q8_RSS_IND_TBL_SIZE	40
462f10a77bbSDavid C Somayajulu #define Q8_RSS_IND_TBL_MIN_IDX	0
463f10a77bbSDavid C Somayajulu #define Q8_RSS_IND_TBL_MAX_IDX	127
464f10a77bbSDavid C Somayajulu 
465f10a77bbSDavid C Somayajulu typedef struct _q80_config_rss_ind_table {
466f10a77bbSDavid C Somayajulu 	uint16_t	opcode;
467f10a77bbSDavid C Somayajulu 	uint16_t 	count_version;
468f10a77bbSDavid C Somayajulu 	uint8_t		start_idx;
469f10a77bbSDavid C Somayajulu 	uint8_t		end_idx;
470f10a77bbSDavid C Somayajulu 	uint16_t 	cntxt_id;
47135291c22SDavid C Somayajulu 	uint8_t		ind_table[Q8_RSS_IND_TBL_SIZE];
472f10a77bbSDavid C Somayajulu } __packed q80_config_rss_ind_table_t;
473f10a77bbSDavid C Somayajulu 
474f10a77bbSDavid C Somayajulu typedef struct _q80_config_rss_ind_table_rsp {
475f10a77bbSDavid C Somayajulu         uint16_t	opcode;
476f10a77bbSDavid C Somayajulu         uint16_t	regcnt_status;
477f10a77bbSDavid C Somayajulu } __packed q80_config_rss_ind_table_rsp_t;
478f10a77bbSDavid C Somayajulu 
479f10a77bbSDavid C Somayajulu /*
480f10a77bbSDavid C Somayajulu  * Configure Interrupt Coalescing and Generation
481f10a77bbSDavid C Somayajulu  */
482f10a77bbSDavid C Somayajulu typedef struct _q80_config_intr_coalesc {
483f10a77bbSDavid C Somayajulu 	uint16_t	opcode;
484f10a77bbSDavid C Somayajulu 	uint16_t 	count_version;
485f10a77bbSDavid C Somayajulu         uint16_t	flags;
486f10a77bbSDavid C Somayajulu #define Q8_MBX_INTRC_FLAGS_RCV		1
487f10a77bbSDavid C Somayajulu #define Q8_MBX_INTRC_FLAGS_XMT		2
488f10a77bbSDavid C Somayajulu #define Q8_MBX_INTRC_FLAGS_PERIODIC	(1 << 3)
489f10a77bbSDavid C Somayajulu 
490f10a77bbSDavid C Somayajulu         uint16_t	cntxt_id;
491f10a77bbSDavid C Somayajulu         uint16_t	max_pkts;
492f10a77bbSDavid C Somayajulu         uint16_t	max_mswait;
493f10a77bbSDavid C Somayajulu         uint8_t		timer_type;
494f10a77bbSDavid C Somayajulu #define Q8_MBX_INTRC_TIMER_NONE			0
495f10a77bbSDavid C Somayajulu #define Q8_MBX_INTRC_TIMER_SINGLE		1
496f10a77bbSDavid C Somayajulu #define Q8_MBX_INTRC_TIMER_PERIODIC		2
497f10a77bbSDavid C Somayajulu 
498f10a77bbSDavid C Somayajulu         uint16_t	sds_ring_mask;
499f10a77bbSDavid C Somayajulu 
500f10a77bbSDavid C Somayajulu         uint8_t		rsrvd;
501f10a77bbSDavid C Somayajulu         uint32_t	ms_timeout;
502f10a77bbSDavid C Somayajulu } __packed q80_config_intr_coalesc_t;
503f10a77bbSDavid C Somayajulu 
504f10a77bbSDavid C Somayajulu typedef struct _q80_config_intr_coalesc_rsp {
505f10a77bbSDavid C Somayajulu         uint16_t	opcode;
506f10a77bbSDavid C Somayajulu         uint16_t	regcnt_status;
507f10a77bbSDavid C Somayajulu } __packed q80_config_intr_coalesc_rsp_t;
508f10a77bbSDavid C Somayajulu 
509f10a77bbSDavid C Somayajulu /*
510f10a77bbSDavid C Somayajulu  * Configure MAC Address
511f10a77bbSDavid C Somayajulu  */
512da834d52SDavid C Somayajulu #define Q8_ETHER_ADDR_LEN		6
513f10a77bbSDavid C Somayajulu typedef struct _q80_mac_addr {
514da834d52SDavid C Somayajulu 	uint8_t		addr[Q8_ETHER_ADDR_LEN];
515f10a77bbSDavid C Somayajulu 	uint16_t	vlan_tci;
516f10a77bbSDavid C Somayajulu } __packed q80_mac_addr_t;
517f10a77bbSDavid C Somayajulu 
518f10a77bbSDavid C Somayajulu #define Q8_MAX_MAC_ADDRS	64
519f10a77bbSDavid C Somayajulu 
520f10a77bbSDavid C Somayajulu typedef struct _q80_config_mac_addr {
521f10a77bbSDavid C Somayajulu 	uint16_t	opcode;
522f10a77bbSDavid C Somayajulu 	uint16_t 	count_version;
523f10a77bbSDavid C Somayajulu 	uint8_t		cmd;
524f10a77bbSDavid C Somayajulu #define Q8_MBX_CMAC_CMD_ADD_MAC_ADDR	1
525f10a77bbSDavid C Somayajulu #define Q8_MBX_CMAC_CMD_DEL_MAC_ADDR	2
526f10a77bbSDavid C Somayajulu 
527f10a77bbSDavid C Somayajulu #define Q8_MBX_CMAC_CMD_CAM_BOTH	(0x0 << 6)
528f10a77bbSDavid C Somayajulu #define Q8_MBX_CMAC_CMD_CAM_INGRESS	(0x1 << 6)
529f10a77bbSDavid C Somayajulu #define Q8_MBX_CMAC_CMD_CAM_EGRESS	(0x2 << 6)
530f10a77bbSDavid C Somayajulu 
531f10a77bbSDavid C Somayajulu 	uint8_t		nmac_entries;
532f10a77bbSDavid C Somayajulu 	uint16_t	cntxt_id;
533f10a77bbSDavid C Somayajulu 	q80_mac_addr_t	mac_addr[Q8_MAX_MAC_ADDRS];
534f10a77bbSDavid C Somayajulu } __packed q80_config_mac_addr_t;
535f10a77bbSDavid C Somayajulu 
536f10a77bbSDavid C Somayajulu typedef struct _q80_config_mac_addr_rsp {
537f10a77bbSDavid C Somayajulu         uint16_t	opcode;
538f10a77bbSDavid C Somayajulu         uint16_t	regcnt_status;
539f10a77bbSDavid C Somayajulu 	uint8_t		cmd;
540f10a77bbSDavid C Somayajulu 	uint8_t		nmac_entries;
541f10a77bbSDavid C Somayajulu 	uint16_t	cntxt_id;
542f10a77bbSDavid C Somayajulu 	uint32_t	status[Q8_MAX_MAC_ADDRS];
543f10a77bbSDavid C Somayajulu } __packed q80_config_mac_addr_rsp_t;
544f10a77bbSDavid C Somayajulu 
545f10a77bbSDavid C Somayajulu /*
546f10a77bbSDavid C Somayajulu  * Configure MAC Receive Mode
547f10a77bbSDavid C Somayajulu  */
548f10a77bbSDavid C Somayajulu typedef struct _q80_config_mac_rcv_mode {
549f10a77bbSDavid C Somayajulu 	uint16_t	opcode;
550f10a77bbSDavid C Somayajulu 	uint16_t 	count_version;
551f10a77bbSDavid C Somayajulu 
552f10a77bbSDavid C Somayajulu 	uint8_t		mode;
553f10a77bbSDavid C Somayajulu #define Q8_MBX_MAC_RCV_PROMISC_ENABLE	0x1
554f10a77bbSDavid C Somayajulu #define Q8_MBX_MAC_ALL_MULTI_ENABLE	0x2
555f10a77bbSDavid C Somayajulu 
556f10a77bbSDavid C Somayajulu 	uint8_t		rsrvd;
557f10a77bbSDavid C Somayajulu 	uint16_t	cntxt_id;
558f10a77bbSDavid C Somayajulu } __packed q80_config_mac_rcv_mode_t;
559f10a77bbSDavid C Somayajulu 
560f10a77bbSDavid C Somayajulu typedef struct _q80_config_mac_rcv_mode_rsp {
561f10a77bbSDavid C Somayajulu         uint16_t	opcode;
562f10a77bbSDavid C Somayajulu         uint16_t	regcnt_status;
563f10a77bbSDavid C Somayajulu } __packed q80_config_mac_rcv_mode_rsp_t;
564f10a77bbSDavid C Somayajulu 
565f10a77bbSDavid C Somayajulu /*
566f10a77bbSDavid C Somayajulu  * Configure Firmware Controlled LRO
567f10a77bbSDavid C Somayajulu  */
568f10a77bbSDavid C Somayajulu typedef struct _q80_config_fw_lro {
569f10a77bbSDavid C Somayajulu 	uint16_t	opcode;
570f10a77bbSDavid C Somayajulu 	uint16_t 	count_version;
571f10a77bbSDavid C Somayajulu 
572f10a77bbSDavid C Somayajulu 	uint8_t		flags;
573f10a77bbSDavid C Somayajulu #define Q8_MBX_FW_LRO_IPV4                     0x1
574f10a77bbSDavid C Somayajulu #define Q8_MBX_FW_LRO_IPV6                     0x2
575f10a77bbSDavid C Somayajulu #define Q8_MBX_FW_LRO_IPV4_WO_DST_IP_CHK       0x4
576f10a77bbSDavid C Somayajulu #define Q8_MBX_FW_LRO_IPV6_WO_DST_IP_CHK       0x8
577c12c5bfbSDavid C Somayajulu #define Q8_MBX_FW_LRO_LOW_THRESHOLD            0x10
578f10a77bbSDavid C Somayajulu 
579f10a77bbSDavid C Somayajulu 	uint8_t		rsrvd;
580f10a77bbSDavid C Somayajulu 	uint16_t	cntxt_id;
581c12c5bfbSDavid C Somayajulu 
582c12c5bfbSDavid C Somayajulu 	uint16_t	low_threshold;
583c12c5bfbSDavid C Somayajulu 	uint16_t	rsrvd0;
584f10a77bbSDavid C Somayajulu } __packed q80_config_fw_lro_t;
585f10a77bbSDavid C Somayajulu 
586f10a77bbSDavid C Somayajulu typedef struct _q80_config_fw_lro_rsp {
587f10a77bbSDavid C Somayajulu         uint16_t	opcode;
588f10a77bbSDavid C Somayajulu         uint16_t	regcnt_status;
589f10a77bbSDavid C Somayajulu } __packed q80_config_fw_lro_rsp_t;
590f10a77bbSDavid C Somayajulu 
591f10a77bbSDavid C Somayajulu /*
592f10a77bbSDavid C Somayajulu  * Minidump mailbox commands
593f10a77bbSDavid C Somayajulu  */
594f10a77bbSDavid C Somayajulu typedef struct _q80_config_md_templ_size {
595f10a77bbSDavid C Somayajulu 	uint16_t	opcode;
596f10a77bbSDavid C Somayajulu 	uint16_t	count_version;
597f10a77bbSDavid C Somayajulu } __packed q80_config_md_templ_size_t;
598f10a77bbSDavid C Somayajulu 
599f10a77bbSDavid C Somayajulu typedef struct _q80_config_md_templ_size_rsp {
600f10a77bbSDavid C Somayajulu 	uint16_t	opcode;
601f10a77bbSDavid C Somayajulu 	uint16_t	regcnt_status;
602f10a77bbSDavid C Somayajulu 	uint32_t	rsrvd;
603f10a77bbSDavid C Somayajulu 	uint32_t	templ_size;
604f10a77bbSDavid C Somayajulu 	uint32_t	templ_version;
605f10a77bbSDavid C Somayajulu } __packed q80_config_md_templ_size_rsp_t;
606f10a77bbSDavid C Somayajulu 
607f10a77bbSDavid C Somayajulu typedef struct _q80_config_md_templ_cmd {
608f10a77bbSDavid C Somayajulu 	uint16_t	opcode;
609f10a77bbSDavid C Somayajulu 	uint16_t	count_version;
610f10a77bbSDavid C Somayajulu 	uint64_t	buf_addr; /* physical address of buffer */
611f10a77bbSDavid C Somayajulu 	uint32_t	buff_size;
612f10a77bbSDavid C Somayajulu 	uint32_t	offset;
613f10a77bbSDavid C Somayajulu } __packed q80_config_md_templ_cmd_t;
614f10a77bbSDavid C Somayajulu 
615f10a77bbSDavid C Somayajulu typedef struct _q80_config_md_templ_cmd_rsp {
616f10a77bbSDavid C Somayajulu 	uint16_t	opcode;
617f10a77bbSDavid C Somayajulu 	uint16_t	regcnt_status;
618f10a77bbSDavid C Somayajulu 	uint32_t	rsrvd;
619f10a77bbSDavid C Somayajulu 	uint32_t	templ_size;
620f10a77bbSDavid C Somayajulu 	uint32_t	buff_size;
621f10a77bbSDavid C Somayajulu 	uint32_t	offset;
622f10a77bbSDavid C Somayajulu } __packed q80_config_md_templ_cmd_rsp_t;
623f10a77bbSDavid C Somayajulu 
624f10a77bbSDavid C Somayajulu /*
62500caeec7SDavid C Somayajulu  * Hardware Configuration Commands
62600caeec7SDavid C Somayajulu  */
62700caeec7SDavid C Somayajulu 
62800caeec7SDavid C Somayajulu typedef struct _q80_hw_config {
62900caeec7SDavid C Somayajulu        uint16_t        opcode;
63000caeec7SDavid C Somayajulu        uint16_t        count_version;
63100caeec7SDavid C Somayajulu #define Q8_HW_CONFIG_SET_MDIO_REG_COUNT                0x06
63200caeec7SDavid C Somayajulu #define Q8_HW_CONFIG_GET_MDIO_REG_COUNT                0x05
63300caeec7SDavid C Somayajulu #define Q8_HW_CONFIG_SET_CAM_SEARCH_MODE_COUNT 0x03
63400caeec7SDavid C Somayajulu #define Q8_HW_CONFIG_GET_CAM_SEARCH_MODE_COUNT 0x02
63500caeec7SDavid C Somayajulu #define Q8_HW_CONFIG_SET_TEMP_THRESHOLD_COUNT  0x03
63600caeec7SDavid C Somayajulu #define Q8_HW_CONFIG_GET_TEMP_THRESHOLD_COUNT  0x02
63700caeec7SDavid C Somayajulu #define Q8_HW_CONFIG_GET_ECC_COUNTS_COUNT      0x02
63800caeec7SDavid C Somayajulu 
63900caeec7SDavid C Somayajulu        uint32_t        cmd;
64000caeec7SDavid C Somayajulu #define Q8_HW_CONFIG_SET_MDIO_REG              0x01
64100caeec7SDavid C Somayajulu #define Q8_HW_CONFIG_GET_MDIO_REG              0x02
64200caeec7SDavid C Somayajulu #define Q8_HW_CONFIG_SET_CAM_SEARCH_MODE       0x03
64300caeec7SDavid C Somayajulu #define Q8_HW_CONFIG_GET_CAM_SEARCH_MODE       0x04
64400caeec7SDavid C Somayajulu #define Q8_HW_CONFIG_SET_TEMP_THRESHOLD                0x07
64500caeec7SDavid C Somayajulu #define Q8_HW_CONFIG_GET_TEMP_THRESHOLD                0x08
64600caeec7SDavid C Somayajulu #define Q8_HW_CONFIG_GET_ECC_COUNTS            0x0A
64700caeec7SDavid C Somayajulu 
64800caeec7SDavid C Somayajulu        union {
64900caeec7SDavid C Somayajulu                struct {
65000caeec7SDavid C Somayajulu                        uint32_t phys_port_number;
65100caeec7SDavid C Somayajulu                        uint32_t phy_dev_addr;
65200caeec7SDavid C Somayajulu                        uint32_t reg_addr;
65300caeec7SDavid C Somayajulu                        uint32_t data;
65400caeec7SDavid C Somayajulu                } set_mdio;
65500caeec7SDavid C Somayajulu 
65600caeec7SDavid C Somayajulu                struct {
65700caeec7SDavid C Somayajulu                        uint32_t phys_port_number;
65800caeec7SDavid C Somayajulu                        uint32_t phy_dev_addr;
65900caeec7SDavid C Somayajulu                        uint32_t reg_addr;
66000caeec7SDavid C Somayajulu                } get_mdio;
66100caeec7SDavid C Somayajulu 
66200caeec7SDavid C Somayajulu                struct {
66300caeec7SDavid C Somayajulu                        uint32_t mode;
66400caeec7SDavid C Somayajulu #define Q8_HW_CONFIG_CAM_SEARCH_MODE_INTERNAL  0x1
66500caeec7SDavid C Somayajulu #define Q8_HW_CONFIG_CAM_SEARCH_MODE_AUTO      0x2
66600caeec7SDavid C Somayajulu 
66700caeec7SDavid C Somayajulu                } set_cam_search_mode;
66800caeec7SDavid C Somayajulu 
66900caeec7SDavid C Somayajulu                struct {
67000caeec7SDavid C Somayajulu                        uint32_t value;
67100caeec7SDavid C Somayajulu                } set_temp_threshold;
67200caeec7SDavid C Somayajulu        } u;
67300caeec7SDavid C Somayajulu } __packed q80_hw_config_t;
67400caeec7SDavid C Somayajulu 
67500caeec7SDavid C Somayajulu typedef struct _q80_hw_config_rsp {
67600caeec7SDavid C Somayajulu         uint16_t       opcode;
67700caeec7SDavid C Somayajulu         uint16_t       regcnt_status;
67800caeec7SDavid C Somayajulu 
67900caeec7SDavid C Somayajulu        union {
68000caeec7SDavid C Somayajulu                struct {
68100caeec7SDavid C Somayajulu                        uint32_t value;
68200caeec7SDavid C Somayajulu                } get_mdio;
68300caeec7SDavid C Somayajulu 
68400caeec7SDavid C Somayajulu                struct {
68500caeec7SDavid C Somayajulu                        uint32_t mode;
68600caeec7SDavid C Somayajulu                } get_cam_search_mode;
68700caeec7SDavid C Somayajulu 
68800caeec7SDavid C Somayajulu                struct {
68900caeec7SDavid C Somayajulu                        uint32_t temp_warn;
69000caeec7SDavid C Somayajulu                        uint32_t curr_temp;
69100caeec7SDavid C Somayajulu                        uint32_t osc_ring_rate;
69200caeec7SDavid C Somayajulu                        uint32_t core_voltage;
69300caeec7SDavid C Somayajulu                } get_temp_threshold;
69400caeec7SDavid C Somayajulu 
69500caeec7SDavid C Somayajulu                struct {
69600caeec7SDavid C Somayajulu                        uint32_t ddr_ecc_error_count;
69700caeec7SDavid C Somayajulu                        uint32_t ocm_ecc_error_count;
69800caeec7SDavid C Somayajulu                        uint32_t l2_dcache_ecc_error_count;
69900caeec7SDavid C Somayajulu                        uint32_t l2_icache_ecc_error_count;
70000caeec7SDavid C Somayajulu                        uint32_t eport_ecc_error_count;
70100caeec7SDavid C Somayajulu                } get_ecc_counts;
70200caeec7SDavid C Somayajulu        } u;
70300caeec7SDavid C Somayajulu } __packed q80_hw_config_rsp_t;
70400caeec7SDavid C Somayajulu 
70500caeec7SDavid C Somayajulu /*
706f10a77bbSDavid C Somayajulu  * Link Event Request Command
707f10a77bbSDavid C Somayajulu  */
708f10a77bbSDavid C Somayajulu typedef struct _q80_link_event {
709f10a77bbSDavid C Somayajulu 	uint16_t	opcode;
710f10a77bbSDavid C Somayajulu 	uint16_t 	count_version;
711f10a77bbSDavid C Somayajulu 	uint8_t		cmd;
712f10a77bbSDavid C Somayajulu #define Q8_LINK_EVENT_CMD_STOP_PERIODIC	0
713f10a77bbSDavid C Somayajulu #define Q8_LINK_EVENT_CMD_ENABLE_ASYNC	1
714f10a77bbSDavid C Somayajulu 
715f10a77bbSDavid C Somayajulu 	uint8_t		flags;
716f10a77bbSDavid C Somayajulu #define Q8_LINK_EVENT_FLAGS_SEND_RSP	1
717f10a77bbSDavid C Somayajulu 
718f10a77bbSDavid C Somayajulu 	uint16_t	cntxt_id;
719f10a77bbSDavid C Somayajulu } __packed q80_link_event_t;
720f10a77bbSDavid C Somayajulu 
721f10a77bbSDavid C Somayajulu typedef struct _q80_link_event_rsp {
722f10a77bbSDavid C Somayajulu         uint16_t	opcode;
723f10a77bbSDavid C Somayajulu         uint16_t	regcnt_status;
724f10a77bbSDavid C Somayajulu } __packed q80_link_event_rsp_t;
725f10a77bbSDavid C Somayajulu 
726f10a77bbSDavid C Somayajulu /*
727f10a77bbSDavid C Somayajulu  * Get Statistics Command
728f10a77bbSDavid C Somayajulu  */
729f10a77bbSDavid C Somayajulu typedef struct _q80_rcv_stats {
730f10a77bbSDavid C Somayajulu 	uint64_t	total_bytes;
731f10a77bbSDavid C Somayajulu 	uint64_t	total_pkts;
732f10a77bbSDavid C Somayajulu 	uint64_t	lro_pkt_count;
733f10a77bbSDavid C Somayajulu 	uint64_t	sw_pkt_count;
734f10a77bbSDavid C Somayajulu 	uint64_t	ip_chksum_err;
735f10a77bbSDavid C Somayajulu 	uint64_t	pkts_wo_acntxts;
736f10a77bbSDavid C Somayajulu 	uint64_t	pkts_dropped_no_sds_card;
737f10a77bbSDavid C Somayajulu 	uint64_t	pkts_dropped_no_sds_host;
738f10a77bbSDavid C Somayajulu 	uint64_t	oversized_pkts;
739f10a77bbSDavid C Somayajulu 	uint64_t	pkts_dropped_no_rds;
740f10a77bbSDavid C Somayajulu 	uint64_t	unxpctd_mcast_pkts;
741f10a77bbSDavid C Somayajulu 	uint64_t	re1_fbq_error;
742f10a77bbSDavid C Somayajulu 	uint64_t	invalid_mac_addr;
743f10a77bbSDavid C Somayajulu 	uint64_t	rds_prime_trys;
744f10a77bbSDavid C Somayajulu 	uint64_t	rds_prime_success;
745f10a77bbSDavid C Somayajulu 	uint64_t	lro_flows_added;
746f10a77bbSDavid C Somayajulu 	uint64_t	lro_flows_deleted;
747f10a77bbSDavid C Somayajulu 	uint64_t	lro_flows_active;
748f10a77bbSDavid C Somayajulu 	uint64_t	pkts_droped_unknown;
749d2b62c58SDavid C Somayajulu 	uint64_t	pkts_cnt_oversized;
750f10a77bbSDavid C Somayajulu } __packed q80_rcv_stats_t;
751f10a77bbSDavid C Somayajulu 
752f10a77bbSDavid C Somayajulu typedef struct _q80_xmt_stats {
753f10a77bbSDavid C Somayajulu 	uint64_t	total_bytes;
754f10a77bbSDavid C Somayajulu 	uint64_t	total_pkts;
755f10a77bbSDavid C Somayajulu 	uint64_t	errors;
756f10a77bbSDavid C Somayajulu 	uint64_t	pkts_dropped;
757f10a77bbSDavid C Somayajulu 	uint64_t	switch_pkts;
758f10a77bbSDavid C Somayajulu 	uint64_t	num_buffers;
759f10a77bbSDavid C Somayajulu } __packed q80_xmt_stats_t;
760f10a77bbSDavid C Somayajulu 
761f10a77bbSDavid C Somayajulu typedef struct _q80_mac_stats {
762f10a77bbSDavid C Somayajulu 	uint64_t	xmt_frames;
763f10a77bbSDavid C Somayajulu 	uint64_t	xmt_bytes;
764f10a77bbSDavid C Somayajulu 	uint64_t	xmt_mcast_pkts;
765f10a77bbSDavid C Somayajulu 	uint64_t	xmt_bcast_pkts;
766f10a77bbSDavid C Somayajulu 	uint64_t	xmt_pause_frames;
767f10a77bbSDavid C Somayajulu 	uint64_t	xmt_cntrl_pkts;
768f10a77bbSDavid C Somayajulu 	uint64_t	xmt_pkt_lt_64bytes;
769f10a77bbSDavid C Somayajulu 	uint64_t	xmt_pkt_lt_127bytes;
770f10a77bbSDavid C Somayajulu 	uint64_t	xmt_pkt_lt_255bytes;
771f10a77bbSDavid C Somayajulu 	uint64_t	xmt_pkt_lt_511bytes;
772f10a77bbSDavid C Somayajulu 	uint64_t	xmt_pkt_lt_1023bytes;
773f10a77bbSDavid C Somayajulu 	uint64_t	xmt_pkt_lt_1518bytes;
774f10a77bbSDavid C Somayajulu 	uint64_t	xmt_pkt_gt_1518bytes;
775f10a77bbSDavid C Somayajulu 	uint64_t	rsrvd0[3];
776f10a77bbSDavid C Somayajulu 	uint64_t	rcv_frames;
777f10a77bbSDavid C Somayajulu 	uint64_t	rcv_bytes;
778f10a77bbSDavid C Somayajulu 	uint64_t	rcv_mcast_pkts;
779f10a77bbSDavid C Somayajulu 	uint64_t	rcv_bcast_pkts;
780f10a77bbSDavid C Somayajulu 	uint64_t	rcv_pause_frames;
781f10a77bbSDavid C Somayajulu 	uint64_t	rcv_cntrl_pkts;
782f10a77bbSDavid C Somayajulu 	uint64_t	rcv_pkt_lt_64bytes;
783f10a77bbSDavid C Somayajulu 	uint64_t	rcv_pkt_lt_127bytes;
784f10a77bbSDavid C Somayajulu 	uint64_t	rcv_pkt_lt_255bytes;
785f10a77bbSDavid C Somayajulu 	uint64_t	rcv_pkt_lt_511bytes;
786f10a77bbSDavid C Somayajulu 	uint64_t	rcv_pkt_lt_1023bytes;
787f10a77bbSDavid C Somayajulu 	uint64_t	rcv_pkt_lt_1518bytes;
788f10a77bbSDavid C Somayajulu 	uint64_t	rcv_pkt_gt_1518bytes;
789f10a77bbSDavid C Somayajulu 	uint64_t	rsrvd1[3];
790f10a77bbSDavid C Somayajulu 	uint64_t	rcv_len_error;
791f10a77bbSDavid C Somayajulu 	uint64_t	rcv_len_small;
792f10a77bbSDavid C Somayajulu 	uint64_t	rcv_len_large;
793f10a77bbSDavid C Somayajulu 	uint64_t	rcv_jabber;
794f10a77bbSDavid C Somayajulu 	uint64_t	rcv_dropped;
795f10a77bbSDavid C Somayajulu 	uint64_t	fcs_error;
796f10a77bbSDavid C Somayajulu 	uint64_t	align_error;
79735291c22SDavid C Somayajulu 	uint64_t	eswitched_frames;
79835291c22SDavid C Somayajulu 	uint64_t	eswitched_bytes;
79935291c22SDavid C Somayajulu 	uint64_t	eswitched_mcast_frames;
80035291c22SDavid C Somayajulu 	uint64_t	eswitched_bcast_frames;
80135291c22SDavid C Somayajulu 	uint64_t	eswitched_ucast_frames;
80235291c22SDavid C Somayajulu 	uint64_t	eswitched_err_free_frames;
80335291c22SDavid C Somayajulu 	uint64_t	eswitched_err_free_bytes;
804f10a77bbSDavid C Somayajulu } __packed q80_mac_stats_t;
805f10a77bbSDavid C Somayajulu 
806f10a77bbSDavid C Somayajulu typedef struct _q80_get_stats {
807f10a77bbSDavid C Somayajulu 	uint16_t	opcode;
808f10a77bbSDavid C Somayajulu 	uint16_t 	count_version;
809f10a77bbSDavid C Somayajulu 
810f10a77bbSDavid C Somayajulu 	uint32_t 	cmd;
811f10a77bbSDavid C Somayajulu #define Q8_GET_STATS_CMD_CLEAR		0x01
812f10a77bbSDavid C Somayajulu #define Q8_GET_STATS_CMD_RCV		0x00
813f10a77bbSDavid C Somayajulu #define Q8_GET_STATS_CMD_XMT		0x02
814f10a77bbSDavid C Somayajulu #define Q8_GET_STATS_CMD_TYPE_CNTXT	0x00
815f10a77bbSDavid C Somayajulu #define Q8_GET_STATS_CMD_TYPE_MAC	0x04
816f10a77bbSDavid C Somayajulu #define Q8_GET_STATS_CMD_TYPE_FUNC	0x08
817f10a77bbSDavid C Somayajulu #define Q8_GET_STATS_CMD_TYPE_VPORT	0x0C
81835291c22SDavid C Somayajulu #define Q8_GET_STATS_CMD_TYPE_ALL      (0x7 << 2)
819f10a77bbSDavid C Somayajulu 
820f10a77bbSDavid C Somayajulu } __packed q80_get_stats_t;
821f10a77bbSDavid C Somayajulu 
822f10a77bbSDavid C Somayajulu typedef struct _q80_get_stats_rsp {
823f10a77bbSDavid C Somayajulu         uint16_t	opcode;
824f10a77bbSDavid C Somayajulu         uint16_t	regcnt_status;
825f10a77bbSDavid C Somayajulu 	uint32_t 	cmd;
826f10a77bbSDavid C Somayajulu 	union {
827f10a77bbSDavid C Somayajulu 		q80_rcv_stats_t rcv;
828f10a77bbSDavid C Somayajulu 		q80_xmt_stats_t xmt;
829f10a77bbSDavid C Somayajulu 		q80_mac_stats_t mac;
830f10a77bbSDavid C Somayajulu 	} u;
831f10a77bbSDavid C Somayajulu } __packed q80_get_stats_rsp_t;
832f10a77bbSDavid C Somayajulu 
83335291c22SDavid C Somayajulu typedef struct _q80_get_mac_rcv_xmt_stats_rsp {
83435291c22SDavid C Somayajulu 	uint16_t	opcode;
83535291c22SDavid C Somayajulu 	uint16_t	regcnt_status;
83635291c22SDavid C Somayajulu 	uint32_t	cmd;
83735291c22SDavid C Somayajulu 	q80_mac_stats_t mac;
83835291c22SDavid C Somayajulu 	q80_rcv_stats_t rcv;
83935291c22SDavid C Somayajulu 	q80_xmt_stats_t xmt;
84035291c22SDavid C Somayajulu } __packed q80_get_mac_rcv_xmt_stats_rsp_t;
84135291c22SDavid C Somayajulu 
842f10a77bbSDavid C Somayajulu /*
843f10a77bbSDavid C Somayajulu  * Init NIC Function
844f10a77bbSDavid C Somayajulu  * Used to Register DCBX Configuration Change AEN
845f10a77bbSDavid C Somayajulu  */
846f10a77bbSDavid C Somayajulu typedef struct _q80_init_nic_func {
847f10a77bbSDavid C Somayajulu         uint16_t        opcode;
848f10a77bbSDavid C Somayajulu         uint16_t        count_version;
849f10a77bbSDavid C Somayajulu 
850f10a77bbSDavid C Somayajulu         uint32_t        options;
85135291c22SDavid C Somayajulu #define Q8_INIT_NIC_REG_IDC_AEN		0x01
852f10a77bbSDavid C Somayajulu #define Q8_INIT_NIC_REG_DCBX_CHNG_AEN	0x02
853f10a77bbSDavid C Somayajulu #define Q8_INIT_NIC_REG_SFP_CHNG_AEN	0x04
854f10a77bbSDavid C Somayajulu 
855f10a77bbSDavid C Somayajulu } __packed q80_init_nic_func_t;
856f10a77bbSDavid C Somayajulu 
857f10a77bbSDavid C Somayajulu typedef struct _q80_init_nic_func_rsp {
858f10a77bbSDavid C Somayajulu         uint16_t        opcode;
859f10a77bbSDavid C Somayajulu         uint16_t        regcnt_status;
860f10a77bbSDavid C Somayajulu } __packed q80_init_nic_func_rsp_t;
861f10a77bbSDavid C Somayajulu 
862f10a77bbSDavid C Somayajulu /*
863f10a77bbSDavid C Somayajulu  * Stop NIC Function
864f10a77bbSDavid C Somayajulu  * Used to DeRegister DCBX Configuration Change AEN
865f10a77bbSDavid C Somayajulu  */
866f10a77bbSDavid C Somayajulu typedef struct _q80_stop_nic_func {
867f10a77bbSDavid C Somayajulu         uint16_t        opcode;
868f10a77bbSDavid C Somayajulu         uint16_t        count_version;
869f10a77bbSDavid C Somayajulu 
870f10a77bbSDavid C Somayajulu         uint32_t        options;
871f10a77bbSDavid C Somayajulu #define Q8_STOP_NIC_DEREG_DCBX_CHNG_AEN 0x02
872f10a77bbSDavid C Somayajulu #define Q8_STOP_NIC_DEREG_SFP_CHNG_AEN	0x04
873f10a77bbSDavid C Somayajulu 
874f10a77bbSDavid C Somayajulu } __packed q80_stop_nic_func_t;
875f10a77bbSDavid C Somayajulu 
876f10a77bbSDavid C Somayajulu typedef struct _q80_stop_nic_func_rsp {
877f10a77bbSDavid C Somayajulu         uint16_t        opcode;
878f10a77bbSDavid C Somayajulu         uint16_t        regcnt_status;
879f10a77bbSDavid C Somayajulu } __packed q80_stop_nic_func_rsp_t;
880f10a77bbSDavid C Somayajulu 
881f10a77bbSDavid C Somayajulu /*
882f10a77bbSDavid C Somayajulu  * Query Firmware DCBX Capabilities
883f10a77bbSDavid C Somayajulu  */
884f10a77bbSDavid C Somayajulu typedef struct _q80_query_fw_dcbx_caps {
885f10a77bbSDavid C Somayajulu         uint16_t        opcode;
886f10a77bbSDavid C Somayajulu         uint16_t        count_version;
887f10a77bbSDavid C Somayajulu } __packed q80_query_fw_dcbx_caps_t;
888f10a77bbSDavid C Somayajulu 
889f10a77bbSDavid C Somayajulu typedef struct _q80_query_fw_dcbx_caps_rsp {
890f10a77bbSDavid C Somayajulu         uint16_t        opcode;
891f10a77bbSDavid C Somayajulu         uint16_t        regcnt_status;
892f10a77bbSDavid C Somayajulu 
893f10a77bbSDavid C Somayajulu         uint32_t        dcbx_caps;
894f10a77bbSDavid C Somayajulu #define Q8_QUERY_FW_DCBX_CAPS_TSA               0x00000001
895f10a77bbSDavid C Somayajulu #define Q8_QUERY_FW_DCBX_CAPS_ETS               0x00000002
896f10a77bbSDavid C Somayajulu #define Q8_QUERY_FW_DCBX_CAPS_DCBX_CEE_1_01     0x00000004
897f10a77bbSDavid C Somayajulu #define Q8_QUERY_FW_DCBX_CAPS_DCBX_IEEE_1_0     0x00000008
898f10a77bbSDavid C Somayajulu #define Q8_QUERY_FW_DCBX_MAX_TC_MASK            0x00F00000
899f10a77bbSDavid C Somayajulu #define Q8_QUERY_FW_DCBX_MAX_ETS_TC_MASK        0x0F000000
900f10a77bbSDavid C Somayajulu #define Q8_QUERY_FW_DCBX_MAX_PFC_TC_MASK        0xF0000000
901f10a77bbSDavid C Somayajulu 
902f10a77bbSDavid C Somayajulu } __packed q80_query_fw_dcbx_caps_rsp_t;
903f10a77bbSDavid C Somayajulu 
904f10a77bbSDavid C Somayajulu /*
90535291c22SDavid C Somayajulu  * IDC Ack Cmd
90635291c22SDavid C Somayajulu  */
90735291c22SDavid C Somayajulu 
90835291c22SDavid C Somayajulu typedef struct _q80_idc_ack {
90935291c22SDavid C Somayajulu 	uint16_t	opcode;
91035291c22SDavid C Somayajulu 	uint16_t	count_version;
91135291c22SDavid C Somayajulu 
91235291c22SDavid C Somayajulu 	uint32_t	aen_mb1;
91335291c22SDavid C Somayajulu 	uint32_t	aen_mb2;
91435291c22SDavid C Somayajulu 	uint32_t	aen_mb3;
91535291c22SDavid C Somayajulu 	uint32_t	aen_mb4;
91635291c22SDavid C Somayajulu 
91735291c22SDavid C Somayajulu } __packed q80_idc_ack_t;
91835291c22SDavid C Somayajulu 
91935291c22SDavid C Somayajulu typedef struct _q80_idc_ack_rsp {
92035291c22SDavid C Somayajulu 	uint16_t	opcode;
92135291c22SDavid C Somayajulu 	uint16_t	regcnt_status;
92235291c22SDavid C Somayajulu } __packed q80_idc_ack_rsp_t;
92335291c22SDavid C Somayajulu 
92435291c22SDavid C Somayajulu /*
925f10a77bbSDavid C Somayajulu  * Set Port Configuration command
926f10a77bbSDavid C Somayajulu  * Used to set Ethernet Standard Pause values
927f10a77bbSDavid C Somayajulu  */
928f10a77bbSDavid C Somayajulu 
929f10a77bbSDavid C Somayajulu typedef struct _q80_set_port_cfg {
930f10a77bbSDavid C Somayajulu 	uint16_t	opcode;
931f10a77bbSDavid C Somayajulu 	uint16_t	count_version;
932f10a77bbSDavid C Somayajulu 
933f10a77bbSDavid C Somayajulu 	uint32_t	cfg_bits;
934f10a77bbSDavid C Somayajulu 
935f10a77bbSDavid C Somayajulu #define Q8_PORT_CFG_BITS_LOOPBACK_MODE_MASK	(0x7 << 1)
936f10a77bbSDavid C Somayajulu #define Q8_PORT_CFG_BITS_LOOPBACK_MODE_NONE	(0x0 << 1)
937f10a77bbSDavid C Somayajulu #define Q8_PORT_CFG_BITS_LOOPBACK_MODE_HSS	(0x2 << 1)
938f10a77bbSDavid C Somayajulu #define Q8_PORT_CFG_BITS_LOOPBACK_MODE_PHY	(0x3 << 1)
939f10a77bbSDavid C Somayajulu #define Q8_PORT_CFG_BITS_LOOPBACK_MODE_EXT	(0x4 << 1)
940f10a77bbSDavid C Somayajulu 
941f10a77bbSDavid C Somayajulu #define Q8_VALID_LOOPBACK_MODE(mode) \
942f10a77bbSDavid C Somayajulu              (((mode) == Q8_PORT_CFG_BITS_LOOPBACK_MODE_NONE) || \
943f10a77bbSDavid C Somayajulu 		(((mode) >= Q8_PORT_CFG_BITS_LOOPBACK_MODE_HSS) && \
944f10a77bbSDavid C Somayajulu 		 ((mode) <= Q8_PORT_CFG_BITS_LOOPBACK_MODE_EXT)))
945f10a77bbSDavid C Somayajulu 
946f10a77bbSDavid C Somayajulu #define Q8_PORT_CFG_BITS_DCBX_ENABLE		BIT_4
947f10a77bbSDavid C Somayajulu 
948f10a77bbSDavid C Somayajulu #define Q8_PORT_CFG_BITS_PAUSE_CFG_MASK		(0x3 << 5)
949f10a77bbSDavid C Somayajulu #define Q8_PORT_CFG_BITS_PAUSE_DISABLED		(0x0 << 5)
950f10a77bbSDavid C Somayajulu #define Q8_PORT_CFG_BITS_PAUSE_STD		(0x1 << 5)
951f10a77bbSDavid C Somayajulu #define Q8_PORT_CFG_BITS_PAUSE_PPM		(0x2 << 5)
952f10a77bbSDavid C Somayajulu 
953f10a77bbSDavid C Somayajulu #define Q8_PORT_CFG_BITS_LNKCAP_10MB		BIT_8
954f10a77bbSDavid C Somayajulu #define Q8_PORT_CFG_BITS_LNKCAP_100MB		BIT_9
955f10a77bbSDavid C Somayajulu #define Q8_PORT_CFG_BITS_LNKCAP_1GB		BIT_10
956f10a77bbSDavid C Somayajulu #define Q8_PORT_CFG_BITS_LNKCAP_10GB		BIT_11
957f10a77bbSDavid C Somayajulu 
958f10a77bbSDavid C Somayajulu #define Q8_PORT_CFG_BITS_AUTONEG		BIT_15
959f10a77bbSDavid C Somayajulu #define Q8_PORT_CFG_BITS_XMT_DISABLE		BIT_17
960f10a77bbSDavid C Somayajulu #define Q8_PORT_CFG_BITS_FEC_RQSTD		BIT_18
961f10a77bbSDavid C Somayajulu #define Q8_PORT_CFG_BITS_EEE_RQSTD		BIT_19
962f10a77bbSDavid C Somayajulu 
963f10a77bbSDavid C Somayajulu #define Q8_PORT_CFG_BITS_STDPAUSE_DIR_MASK	(0x3 << 20)
964f10a77bbSDavid C Somayajulu #define Q8_PORT_CFG_BITS_STDPAUSE_XMT_RCV	(0x0 << 20)
965f10a77bbSDavid C Somayajulu #define Q8_PORT_CFG_BITS_STDPAUSE_XMT		(0x1 << 20)
966f10a77bbSDavid C Somayajulu #define Q8_PORT_CFG_BITS_STDPAUSE_RCV		(0x2 << 20)
967f10a77bbSDavid C Somayajulu 
968f10a77bbSDavid C Somayajulu } __packed q80_set_port_cfg_t;
969f10a77bbSDavid C Somayajulu 
970f10a77bbSDavid C Somayajulu typedef struct _q80_set_port_cfg_rsp {
971f10a77bbSDavid C Somayajulu 	uint16_t	opcode;
972f10a77bbSDavid C Somayajulu 	uint16_t	regcnt_status;
973f10a77bbSDavid C Somayajulu } __packed q80_set_port_cfg_rsp_t;
974f10a77bbSDavid C Somayajulu 
975f10a77bbSDavid C Somayajulu /*
976f10a77bbSDavid C Somayajulu  * Get Port Configuration Command
977f10a77bbSDavid C Somayajulu  */
978f10a77bbSDavid C Somayajulu 
979f10a77bbSDavid C Somayajulu typedef struct _q80_get_port_cfg {
980f10a77bbSDavid C Somayajulu 	uint16_t	opcode;
981f10a77bbSDavid C Somayajulu 	uint16_t	count_version;
982f10a77bbSDavid C Somayajulu } __packed q80_get_port_cfg_t;
983f10a77bbSDavid C Somayajulu 
984f10a77bbSDavid C Somayajulu typedef struct _q80_get_port_cfg_rsp {
985f10a77bbSDavid C Somayajulu 	uint16_t	opcode;
986f10a77bbSDavid C Somayajulu 	uint16_t	regcnt_status;
987f10a77bbSDavid C Somayajulu 
988f10a77bbSDavid C Somayajulu 	uint32_t	cfg_bits; /* same as in q80_set_port_cfg_t */
989f10a77bbSDavid C Somayajulu 
990f10a77bbSDavid C Somayajulu 	uint8_t		phys_port_type;
991f10a77bbSDavid C Somayajulu 	uint8_t		rsvd[3];
992f10a77bbSDavid C Somayajulu } __packed q80_get_port_cfg_rsp_t;
993f10a77bbSDavid C Somayajulu 
994f10a77bbSDavid C Somayajulu /*
995f10a77bbSDavid C Somayajulu  * Get Link Status Command
996f10a77bbSDavid C Somayajulu  * Used to get current PAUSE values for the port
997f10a77bbSDavid C Somayajulu  */
998f10a77bbSDavid C Somayajulu 
999f10a77bbSDavid C Somayajulu typedef struct _q80_get_link_status {
1000f10a77bbSDavid C Somayajulu         uint16_t        opcode;
1001f10a77bbSDavid C Somayajulu         uint16_t        count_version;
1002f10a77bbSDavid C Somayajulu } __packed q80_get_link_status_t;
1003f10a77bbSDavid C Somayajulu 
1004f10a77bbSDavid C Somayajulu typedef struct _q80_get_link_status_rsp {
1005f10a77bbSDavid C Somayajulu         uint16_t        opcode;
1006f10a77bbSDavid C Somayajulu         uint16_t        regcnt_status;
1007f10a77bbSDavid C Somayajulu 
1008f10a77bbSDavid C Somayajulu 	uint32_t	cfg_bits;
1009f10a77bbSDavid C Somayajulu #define Q8_GET_LINK_STAT_CFG_BITS_LINK_UP		BIT_0
1010f10a77bbSDavid C Somayajulu 
1011f10a77bbSDavid C Somayajulu #define Q8_GET_LINK_STAT_CFG_BITS_LINK_SPEED_MASK	(0x7 << 3)
1012f10a77bbSDavid C Somayajulu #define Q8_GET_LINK_STAT_CFG_BITS_LINK_SPEED_UNKNOWN	(0x0 << 3)
1013f10a77bbSDavid C Somayajulu #define Q8_GET_LINK_STAT_CFG_BITS_LINK_SPEED_10MB	(0x1 << 3)
1014f10a77bbSDavid C Somayajulu #define Q8_GET_LINK_STAT_CFG_BITS_LINK_SPEED_100MB	(0x2 << 3)
1015f10a77bbSDavid C Somayajulu #define Q8_GET_LINK_STAT_CFG_BITS_LINK_SPEED_1GB	(0x3 << 3)
1016f10a77bbSDavid C Somayajulu #define Q8_GET_LINK_STAT_CFG_BITS_LINK_SPEED_10GB	(0x4 << 3)
1017f10a77bbSDavid C Somayajulu 
1018f10a77bbSDavid C Somayajulu #define Q8_GET_LINK_STAT_CFG_BITS_PAUSE_CFG_MASK	(0x3 << 6)
1019f10a77bbSDavid C Somayajulu #define Q8_GET_LINK_STAT_CFG_BITS_PAUSE_CFG_DISABLE	(0x0 << 6)
1020f10a77bbSDavid C Somayajulu #define Q8_GET_LINK_STAT_CFG_BITS_PAUSE_CFG_STD		(0x1 << 6)
1021f10a77bbSDavid C Somayajulu #define Q8_GET_LINK_STAT_CFG_BITS_PAUSE_CFG_PPM		(0x2 << 6)
1022f10a77bbSDavid C Somayajulu 
1023f10a77bbSDavid C Somayajulu #define Q8_GET_LINK_STAT_CFG_BITS_LOOPBACK_MASK		(0x7 << 8)
1024f10a77bbSDavid C Somayajulu #define Q8_GET_LINK_STAT_CFG_BITS_LOOPBACK_NONE		(0x0 << 6)
1025f10a77bbSDavid C Somayajulu #define Q8_GET_LINK_STAT_CFG_BITS_LOOPBACK_HSS		(0x2 << 6)
1026f10a77bbSDavid C Somayajulu #define Q8_GET_LINK_STAT_CFG_BITS_LOOPBACK_PHY		(0x3 << 6)
1027f10a77bbSDavid C Somayajulu 
1028f10a77bbSDavid C Somayajulu #define Q8_GET_LINK_STAT_CFG_BITS_FEC_ENABLED		BIT_12
1029f10a77bbSDavid C Somayajulu #define Q8_GET_LINK_STAT_CFG_BITS_EEE_ENABLED		BIT_13
1030f10a77bbSDavid C Somayajulu 
1031f10a77bbSDavid C Somayajulu #define Q8_GET_LINK_STAT_CFG_BITS_STDPAUSE_DIR_MASK	(0x3 << 20)
1032f10a77bbSDavid C Somayajulu #define Q8_GET_LINK_STAT_CFG_BITS_STDPAUSE_NONE		(0x0 << 20)
1033f10a77bbSDavid C Somayajulu #define Q8_GET_LINK_STAT_CFG_BITS_STDPAUSE_XMT		(0x1 << 20)
1034f10a77bbSDavid C Somayajulu #define Q8_GET_LINK_STAT_CFG_BITS_STDPAUSE_RCV		(0x2 << 20)
1035f10a77bbSDavid C Somayajulu #define Q8_GET_LINK_STAT_CFG_BITS_STDPAUSE_XMT_RCV	(0x3 << 20)
1036f10a77bbSDavid C Somayajulu 
1037f10a77bbSDavid C Somayajulu 	uint32_t	link_state;
1038f10a77bbSDavid C Somayajulu #define Q8_GET_LINK_STAT_LOSS_OF_SIGNAL			BIT_0
1039f10a77bbSDavid C Somayajulu #define Q8_GET_LINK_STAT_PORT_RST_DONE			BIT_3
1040f10a77bbSDavid C Somayajulu #define Q8_GET_LINK_STAT_PHY_LINK_DOWN			BIT_4
1041f10a77bbSDavid C Somayajulu #define Q8_GET_LINK_STAT_PCS_LINK_DOWN			BIT_5
1042f10a77bbSDavid C Somayajulu #define Q8_GET_LINK_STAT_MAC_LOCAL_FAULT		BIT_6
1043f10a77bbSDavid C Somayajulu #define Q8_GET_LINK_STAT_MAC_REMOTE_FAULT		BIT_7
1044f10a77bbSDavid C Somayajulu #define Q8_GET_LINK_STAT_XMT_DISABLED			BIT_9
1045f10a77bbSDavid C Somayajulu #define Q8_GET_LINK_STAT_SFP_XMT_FAULT			BIT_10
1046f10a77bbSDavid C Somayajulu 
1047f10a77bbSDavid C Somayajulu 	uint32_t	sfp_info;
1048f10a77bbSDavid C Somayajulu #define Q8_GET_LINK_STAT_SFP_TRNCVR_MASK		0x3
1049f10a77bbSDavid C Somayajulu #define Q8_GET_LINK_STAT_SFP_TRNCVR_NOT_EXPECTED	0x0
1050f10a77bbSDavid C Somayajulu #define Q8_GET_LINK_STAT_SFP_TRNCVR_NONE		0x1
1051f10a77bbSDavid C Somayajulu #define Q8_GET_LINK_STAT_SFP_TRNCVR_INVALID		0x2
1052f10a77bbSDavid C Somayajulu #define Q8_GET_LINK_STAT_SFP_TRNCVR_VALID		0x3
1053f10a77bbSDavid C Somayajulu 
1054f10a77bbSDavid C Somayajulu #define Q8_GET_LINK_STAT_SFP_ADDTL_INFO_MASK		(0x3 << 2)
1055f10a77bbSDavid C Somayajulu #define Q8_GET_LINK_STAT_SFP_ADDTL_INFO_UNREC_TRSVR	(0x0 << 2)
1056f10a77bbSDavid C Somayajulu #define Q8_GET_LINK_STAT_SFP_ADDTL_INFO_NOT_QLOGIC	(0x1 << 2)
1057f10a77bbSDavid C Somayajulu #define Q8_GET_LINK_STAT_SFP_ADDTL_INFO_SPEED_FAILED	(0x2 << 2)
1058f10a77bbSDavid C Somayajulu #define Q8_GET_LINK_STAT_SFP_ADDTL_INFO_ACCESS_ERROR	(0x3 << 2)
1059f10a77bbSDavid C Somayajulu 
1060f10a77bbSDavid C Somayajulu #define Q8_GET_LINK_STAT_SFP_MOD_TYPE_MASK		(0x1F << 4)
1061f10a77bbSDavid C Somayajulu #define Q8_GET_LINK_STAT_SFP_MOD_NONE			(0x00 << 4)
1062f10a77bbSDavid C Somayajulu #define Q8_GET_LINK_STAT_SFP_MOD_10GBLRM		(0x01 << 4)
1063f10a77bbSDavid C Somayajulu #define Q8_GET_LINK_STAT_SFP_MOD_10GBLR			(0x02 << 4)
1064f10a77bbSDavid C Somayajulu #define Q8_GET_LINK_STAT_SFP_MOD_10GBSR			(0x03 << 4)
1065f10a77bbSDavid C Somayajulu #define Q8_GET_LINK_STAT_SFP_MOD_10GBC_P		(0x04 << 4)
1066f10a77bbSDavid C Somayajulu #define Q8_GET_LINK_STAT_SFP_MOD_10GBC_AL		(0x05 << 4)
1067f10a77bbSDavid C Somayajulu #define Q8_GET_LINK_STAT_SFP_MOD_10GBC_PL		(0x06 << 4)
1068f10a77bbSDavid C Somayajulu #define Q8_GET_LINK_STAT_SFP_MOD_1GBSX			(0x07 << 4)
1069f10a77bbSDavid C Somayajulu #define Q8_GET_LINK_STAT_SFP_MOD_1GBLX			(0x08 << 4)
1070f10a77bbSDavid C Somayajulu #define Q8_GET_LINK_STAT_SFP_MOD_1GBCX			(0x09 << 4)
1071f10a77bbSDavid C Somayajulu #define Q8_GET_LINK_STAT_SFP_MOD_1GBT			(0x0A << 4)
1072f10a77bbSDavid C Somayajulu #define Q8_GET_LINK_STAT_SFP_MOD_1GBC_PL		(0x0B << 4)
1073f10a77bbSDavid C Somayajulu #define Q8_GET_LINK_STAT_SFP_MOD_UNKNOWN		(0x0F << 4)
1074f10a77bbSDavid C Somayajulu 
1075f10a77bbSDavid C Somayajulu #define Q8_GET_LINK_STAT_SFP_MULTI_RATE_MOD		BIT_9
1076f10a77bbSDavid C Somayajulu #define Q8_GET_LINK_STAT_SFP_XMT_FAULT			BIT_10
1077f10a77bbSDavid C Somayajulu #define Q8_GET_LINK_STAT_SFP_COPPER_CBL_LENGTH_MASK	(0xFF << 16)
1078f10a77bbSDavid C Somayajulu 
1079f10a77bbSDavid C Somayajulu } __packed q80_get_link_status_rsp_t;
1080f10a77bbSDavid C Somayajulu 
1081f10a77bbSDavid C Somayajulu /*
1082f10a77bbSDavid C Somayajulu  * Transmit Related Definitions
1083f10a77bbSDavid C Somayajulu  */
1084f10a77bbSDavid C Somayajulu /* Max# of TX Rings per Tx Create Cntxt Mbx Cmd*/
1085f10a77bbSDavid C Somayajulu #define MAX_TCNTXT_RINGS           8
1086f10a77bbSDavid C Somayajulu 
1087f10a77bbSDavid C Somayajulu /*
1088f10a77bbSDavid C Somayajulu  * Transmit Context - Q8_CMD_CREATE_TX_CNTXT Command Configuration Data
1089f10a77bbSDavid C Somayajulu  */
1090f10a77bbSDavid C Somayajulu 
1091f10a77bbSDavid C Somayajulu typedef struct _q80_rq_tx_ring {
1092f10a77bbSDavid C Somayajulu 	uint64_t	paddr;
1093f10a77bbSDavid C Somayajulu 	uint64_t	tx_consumer;
1094f10a77bbSDavid C Somayajulu 	uint16_t	nentries;
1095f10a77bbSDavid C Somayajulu 	uint16_t	intr_id;
1096f10a77bbSDavid C Somayajulu 	uint8_t 	intr_src_bit;
1097f10a77bbSDavid C Somayajulu 	uint8_t 	rsrvd[3];
1098f10a77bbSDavid C Somayajulu } __packed q80_rq_tx_ring_t;
1099f10a77bbSDavid C Somayajulu 
1100f10a77bbSDavid C Somayajulu typedef struct _q80_rq_tx_cntxt {
1101f10a77bbSDavid C Somayajulu 	uint16_t		opcode;
1102f10a77bbSDavid C Somayajulu 	uint16_t 		count_version;
1103f10a77bbSDavid C Somayajulu 
1104f10a77bbSDavid C Somayajulu 	uint32_t		cap0;
1105f10a77bbSDavid C Somayajulu #define Q8_TX_CNTXT_CAP0_BASEFW		(1 << 0)
1106f10a77bbSDavid C Somayajulu #define Q8_TX_CNTXT_CAP0_LSO		(1 << 6)
1107f10a77bbSDavid C Somayajulu #define Q8_TX_CNTXT_CAP0_TC		(1 << 25)
1108f10a77bbSDavid C Somayajulu 
1109f10a77bbSDavid C Somayajulu 	uint32_t		cap1;
1110f10a77bbSDavid C Somayajulu 	uint32_t		cap2;
1111f10a77bbSDavid C Somayajulu 	uint32_t		cap3;
1112f10a77bbSDavid C Somayajulu 	uint8_t			ntx_rings;
1113f10a77bbSDavid C Somayajulu 	uint8_t			traffic_class; /* bits 8-10; others reserved */
1114f10a77bbSDavid C Somayajulu 	uint16_t		tx_vpid;
1115f10a77bbSDavid C Somayajulu 	q80_rq_tx_ring_t	tx_ring[MAX_TCNTXT_RINGS];
1116f10a77bbSDavid C Somayajulu } __packed q80_rq_tx_cntxt_t;
1117f10a77bbSDavid C Somayajulu 
1118f10a77bbSDavid C Somayajulu typedef struct _q80_rsp_tx_ring {
1119f10a77bbSDavid C Somayajulu 	uint32_t		prod_index;
1120f10a77bbSDavid C Somayajulu 	uint16_t		cntxt_id;
1121f10a77bbSDavid C Somayajulu 	uint8_t			state;
1122f10a77bbSDavid C Somayajulu 	uint8_t			rsrvd;
1123f10a77bbSDavid C Somayajulu } q80_rsp_tx_ring_t;
1124f10a77bbSDavid C Somayajulu 
1125f10a77bbSDavid C Somayajulu typedef struct _q80_rsp_tx_cntxt {
1126f10a77bbSDavid C Somayajulu         uint16_t                opcode;
1127f10a77bbSDavid C Somayajulu         uint16_t                regcnt_status;
1128f10a77bbSDavid C Somayajulu 	uint8_t			ntx_rings;
1129f10a77bbSDavid C Somayajulu         uint8_t                 phy_port;
1130f10a77bbSDavid C Somayajulu         uint8_t                 virt_port;
1131f10a77bbSDavid C Somayajulu 	uint8_t                 rsrvd;
1132f10a77bbSDavid C Somayajulu 	q80_rsp_tx_ring_t	tx_ring[MAX_TCNTXT_RINGS];
1133f10a77bbSDavid C Somayajulu } __packed q80_rsp_tx_cntxt_t;
1134f10a77bbSDavid C Somayajulu 
1135f10a77bbSDavid C Somayajulu typedef struct _q80_tx_cntxt_destroy {
1136f10a77bbSDavid C Somayajulu         uint16_t        opcode;
1137f10a77bbSDavid C Somayajulu 	uint16_t 	count_version;
1138f10a77bbSDavid C Somayajulu         uint32_t        cntxt_id;
1139f10a77bbSDavid C Somayajulu } __packed q80_tx_cntxt_destroy_t;
1140f10a77bbSDavid C Somayajulu 
1141f10a77bbSDavid C Somayajulu typedef struct _q80_tx_cntxt_destroy_rsp {
1142f10a77bbSDavid C Somayajulu 	uint16_t	opcode;
1143f10a77bbSDavid C Somayajulu 	uint16_t	regcnt_status;
1144f10a77bbSDavid C Somayajulu } __packed q80_tx_cntxt_destroy_rsp_t;
1145f10a77bbSDavid C Somayajulu 
1146f10a77bbSDavid C Somayajulu /*
1147f10a77bbSDavid C Somayajulu  * Transmit Command Descriptor
1148f10a77bbSDavid C Somayajulu  * These commands are issued on the Transmit Ring associated with a Transmit
1149f10a77bbSDavid C Somayajulu  * context
1150f10a77bbSDavid C Somayajulu  */
1151f10a77bbSDavid C Somayajulu typedef struct _q80_tx_cmd {
1152f10a77bbSDavid C Somayajulu 	uint8_t		tcp_hdr_off;	/* TCP Header Offset */
1153f10a77bbSDavid C Somayajulu 	uint8_t		ip_hdr_off;	/* IP Header Offset */
1154f10a77bbSDavid C Somayajulu 	uint16_t	flags_opcode;	/* Bits 0-6: flags; 7-12: opcode */
1155f10a77bbSDavid C Somayajulu 
1156f10a77bbSDavid C Somayajulu 	/* flags field */
1157f10a77bbSDavid C Somayajulu #define Q8_TX_CMD_FLAGS_MULTICAST	0x01
1158f10a77bbSDavid C Somayajulu #define Q8_TX_CMD_FLAGS_LSO_TSO		0x02
1159f10a77bbSDavid C Somayajulu #define Q8_TX_CMD_FLAGS_VLAN_TAGGED	0x10
1160f10a77bbSDavid C Somayajulu #define Q8_TX_CMD_FLAGS_HW_VLAN_ID	0x40
1161f10a77bbSDavid C Somayajulu 
1162f10a77bbSDavid C Somayajulu 	/* opcode field */
1163f10a77bbSDavid C Somayajulu #define Q8_TX_CMD_OP_XMT_UDP_CHKSUM_IPV6	(0xC << 7)
1164f10a77bbSDavid C Somayajulu #define Q8_TX_CMD_OP_XMT_TCP_CHKSUM_IPV6	(0xB << 7)
1165f10a77bbSDavid C Somayajulu #define Q8_TX_CMD_OP_XMT_TCP_LSO_IPV6		(0x6 << 7)
1166f10a77bbSDavid C Somayajulu #define Q8_TX_CMD_OP_XMT_TCP_LSO		(0x5 << 7)
1167f10a77bbSDavid C Somayajulu #define Q8_TX_CMD_OP_XMT_UDP_CHKSUM		(0x3 << 7)
1168f10a77bbSDavid C Somayajulu #define Q8_TX_CMD_OP_XMT_TCP_CHKSUM		(0x2 << 7)
1169f10a77bbSDavid C Somayajulu #define Q8_TX_CMD_OP_XMT_ETHER			(0x1 << 7)
1170f10a77bbSDavid C Somayajulu 
1171f10a77bbSDavid C Somayajulu 	uint8_t		n_bufs;		/* # of data segs in data buffer */
1172f10a77bbSDavid C Somayajulu 	uint8_t		data_len_lo;	/* data length lower 8 bits */
1173f10a77bbSDavid C Somayajulu 	uint16_t	data_len_hi;	/* data length upper 16 bits */
1174f10a77bbSDavid C Somayajulu 
1175f10a77bbSDavid C Somayajulu 	uint64_t	buf2_addr;	/* buffer 2 address */
1176f10a77bbSDavid C Somayajulu 
1177f10a77bbSDavid C Somayajulu 	uint16_t	rsrvd0;
1178f10a77bbSDavid C Somayajulu 	uint16_t	mss;		/* MSS for this packet */
1179f10a77bbSDavid C Somayajulu 	uint8_t		cntxtid;	/* Bits 7-4: ContextId; 3-0: reserved */
1180f10a77bbSDavid C Somayajulu 
1181f10a77bbSDavid C Somayajulu #define Q8_TX_CMD_PORT_CNXTID(c_id) ((c_id & 0xF) << 4)
1182f10a77bbSDavid C Somayajulu 
1183f10a77bbSDavid C Somayajulu 	uint8_t		total_hdr_len;	/* MAC+IP+TCP Header Length for LSO */
1184f10a77bbSDavid C Somayajulu 	uint16_t	rsrvd1;
1185f10a77bbSDavid C Somayajulu 
1186f10a77bbSDavid C Somayajulu 	uint64_t	buf3_addr;	/* buffer 3 address */
1187f10a77bbSDavid C Somayajulu 	uint64_t	buf1_addr;	/* buffer 1 address */
1188f10a77bbSDavid C Somayajulu 
1189f10a77bbSDavid C Somayajulu 	uint16_t	buf1_len;	/* length of buffer 1 */
1190f10a77bbSDavid C Somayajulu 	uint16_t	buf2_len;	/* length of buffer 2 */
1191f10a77bbSDavid C Somayajulu 	uint16_t	buf3_len;	/* length of buffer 3 */
1192f10a77bbSDavid C Somayajulu 	uint16_t	buf4_len;	/* length of buffer 4 */
1193f10a77bbSDavid C Somayajulu 
1194f10a77bbSDavid C Somayajulu 	uint64_t	buf4_addr;	/* buffer 4 address */
1195f10a77bbSDavid C Somayajulu 
1196f10a77bbSDavid C Somayajulu 	uint32_t	rsrvd2;
1197f10a77bbSDavid C Somayajulu 	uint16_t	rsrvd3;
1198f10a77bbSDavid C Somayajulu 	uint16_t	vlan_tci;	/* VLAN TCI when hw tagging is enabled*/
1199f10a77bbSDavid C Somayajulu 
1200f10a77bbSDavid C Somayajulu } __packed q80_tx_cmd_t; /* 64 bytes */
1201f10a77bbSDavid C Somayajulu 
1202f10a77bbSDavid C Somayajulu #define Q8_TX_CMD_MAX_SEGMENTS		4
1203f10a77bbSDavid C Somayajulu #define Q8_TX_CMD_TSO_ALIGN		2
1204f10a77bbSDavid C Somayajulu #define Q8_TX_MAX_NON_TSO_SEGS		62
1205f10a77bbSDavid C Somayajulu 
1206f10a77bbSDavid C Somayajulu /*
1207f10a77bbSDavid C Somayajulu  * Receive Related Definitions
1208f10a77bbSDavid C Somayajulu  */
1209f10a77bbSDavid C Somayajulu #define MAX_RDS_RING_SETS	8 /* Max# of Receive Descriptor Rings */
121035291c22SDavid C Somayajulu 
121135291c22SDavid C Somayajulu #ifdef QL_ENABLE_ISCSI_TLV
121235291c22SDavid C Somayajulu #define MAX_SDS_RINGS           32 /* Max# of Status Descriptor Rings */
121335291c22SDavid C Somayajulu #define NUM_TX_RINGS		(MAX_SDS_RINGS * 2)
121435291c22SDavid C Somayajulu #else
12157fb51846SDavid C Somayajulu #define MAX_SDS_RINGS           32 /* Max# of Status Descriptor Rings */
121635291c22SDavid C Somayajulu #define NUM_TX_RINGS		MAX_SDS_RINGS
121735291c22SDavid C Somayajulu #endif /* #ifdef QL_ENABLE_ISCSI_TLV */
121835291c22SDavid C Somayajulu #define MAX_RDS_RINGS           MAX_SDS_RINGS /* Max# of Rcv Descriptor Rings */
121935291c22SDavid C Somayajulu 
1220f10a77bbSDavid C Somayajulu typedef struct _q80_rq_sds_ring {
1221f10a77bbSDavid C Somayajulu 	uint64_t paddr; /* physical addr of status ring in system memory */
1222f10a77bbSDavid C Somayajulu 	uint64_t hdr_split1;
1223f10a77bbSDavid C Somayajulu 	uint64_t hdr_split2;
1224f10a77bbSDavid C Somayajulu 	uint16_t size; /* number of entries in status ring */
1225f10a77bbSDavid C Somayajulu 	uint16_t hdr_split1_size;
1226f10a77bbSDavid C Somayajulu 	uint16_t hdr_split2_size;
1227f10a77bbSDavid C Somayajulu 	uint16_t hdr_split_count;
1228f10a77bbSDavid C Somayajulu 	uint16_t intr_id;
1229f10a77bbSDavid C Somayajulu 	uint8_t  intr_src_bit;
1230f10a77bbSDavid C Somayajulu 	uint8_t  rsrvd[5];
1231f10a77bbSDavid C Somayajulu } __packed q80_rq_sds_ring_t; /* 10 32bit words */
1232f10a77bbSDavid C Somayajulu 
1233f10a77bbSDavid C Somayajulu typedef struct _q80_rq_rds_ring {
1234f10a77bbSDavid C Somayajulu 	uint64_t paddr_std;	/* physical addr of rcv ring in system memory */
1235f10a77bbSDavid C Somayajulu 	uint64_t paddr_jumbo;	/* physical addr of rcv ring in system memory */
1236f10a77bbSDavid C Somayajulu 	uint16_t std_bsize;
1237f10a77bbSDavid C Somayajulu 	uint16_t std_nentries;
1238f10a77bbSDavid C Somayajulu 	uint16_t jumbo_bsize;
1239f10a77bbSDavid C Somayajulu 	uint16_t jumbo_nentries;
1240f10a77bbSDavid C Somayajulu } __packed q80_rq_rds_ring_t; /* 6 32bit words */
1241f10a77bbSDavid C Somayajulu 
1242f10a77bbSDavid C Somayajulu #define MAX_RCNTXT_SDS_RINGS	8
1243f10a77bbSDavid C Somayajulu 
1244f10a77bbSDavid C Somayajulu typedef struct _q80_rq_rcv_cntxt {
1245f10a77bbSDavid C Somayajulu 	uint16_t		opcode;
1246f10a77bbSDavid C Somayajulu 	uint16_t 		count_version;
1247f10a77bbSDavid C Somayajulu 	uint32_t		cap0;
1248f10a77bbSDavid C Somayajulu #define Q8_RCV_CNTXT_CAP0_BASEFW	(1 << 0)
1249f10a77bbSDavid C Somayajulu #define Q8_RCV_CNTXT_CAP0_MULTI_RDS	(1 << 1)
1250f10a77bbSDavid C Somayajulu #define Q8_RCV_CNTXT_CAP0_LRO		(1 << 5)
1251f10a77bbSDavid C Somayajulu #define Q8_RCV_CNTXT_CAP0_HW_LRO	(1 << 10)
1252f10a77bbSDavid C Somayajulu #define Q8_RCV_CNTXT_CAP0_VLAN_ALIGN	(1 << 14)
1253f10a77bbSDavid C Somayajulu #define Q8_RCV_CNTXT_CAP0_RSS		(1 << 15)
1254f10a77bbSDavid C Somayajulu #define Q8_RCV_CNTXT_CAP0_MSFT_RSS	(1 << 16)
1255f10a77bbSDavid C Somayajulu #define Q8_RCV_CNTXT_CAP0_SGL_JUMBO	(1 << 18)
1256f10a77bbSDavid C Somayajulu #define Q8_RCV_CNTXT_CAP0_SGL_LRO	(1 << 19)
125735291c22SDavid C Somayajulu #define Q8_RCV_CNTXT_CAP0_SINGLE_JUMBO	(1 << 26)
1258f10a77bbSDavid C Somayajulu 
1259f10a77bbSDavid C Somayajulu 	uint32_t		cap1;
1260f10a77bbSDavid C Somayajulu 	uint32_t		cap2;
1261f10a77bbSDavid C Somayajulu 	uint32_t		cap3;
1262f10a77bbSDavid C Somayajulu 	uint8_t 		nrds_sets_rings;
1263f10a77bbSDavid C Somayajulu 	uint8_t 		nsds_rings;
1264f10a77bbSDavid C Somayajulu 	uint16_t		rds_producer_mode;
1265f10a77bbSDavid C Somayajulu #define Q8_RCV_CNTXT_RDS_PROD_MODE_UNIQUE	0
1266f10a77bbSDavid C Somayajulu #define Q8_RCV_CNTXT_RDS_PROD_MODE_SHARED	1
1267f10a77bbSDavid C Somayajulu 
1268f10a77bbSDavid C Somayajulu 	uint16_t		rcv_vpid;
1269f10a77bbSDavid C Somayajulu 	uint16_t		rsrvd0;
1270f10a77bbSDavid C Somayajulu 	uint32_t		rsrvd1;
1271f10a77bbSDavid C Somayajulu 	q80_rq_sds_ring_t	sds[MAX_RCNTXT_SDS_RINGS];
1272f10a77bbSDavid C Somayajulu 	q80_rq_rds_ring_t	rds[MAX_RDS_RING_SETS];
1273f10a77bbSDavid C Somayajulu } __packed q80_rq_rcv_cntxt_t;
1274f10a77bbSDavid C Somayajulu 
1275f10a77bbSDavid C Somayajulu typedef struct _q80_rsp_rds_ring {
1276f10a77bbSDavid C Somayajulu 	uint32_t prod_std;
1277f10a77bbSDavid C Somayajulu 	uint32_t prod_jumbo;
1278f10a77bbSDavid C Somayajulu } __packed q80_rsp_rds_ring_t; /* 8 bytes */
1279f10a77bbSDavid C Somayajulu 
1280f10a77bbSDavid C Somayajulu typedef struct _q80_rsp_rcv_cntxt {
1281f10a77bbSDavid C Somayajulu 	uint16_t		opcode;
1282f10a77bbSDavid C Somayajulu 	uint16_t		regcnt_status;
1283f10a77bbSDavid C Somayajulu 	uint8_t 		nrds_sets_rings;
1284f10a77bbSDavid C Somayajulu 	uint8_t 		nsds_rings;
1285f10a77bbSDavid C Somayajulu 	uint16_t		cntxt_id;
1286f10a77bbSDavid C Somayajulu 	uint8_t			state;
1287f10a77bbSDavid C Somayajulu 	uint8_t			num_funcs;
1288f10a77bbSDavid C Somayajulu 	uint8_t			phy_port;
1289f10a77bbSDavid C Somayajulu 	uint8_t			virt_port;
1290f10a77bbSDavid C Somayajulu 	uint32_t		sds_cons[MAX_RCNTXT_SDS_RINGS];
1291f10a77bbSDavid C Somayajulu 	q80_rsp_rds_ring_t	rds[MAX_RDS_RING_SETS];
1292f10a77bbSDavid C Somayajulu } __packed q80_rsp_rcv_cntxt_t;
1293f10a77bbSDavid C Somayajulu 
1294f10a77bbSDavid C Somayajulu typedef struct _q80_rcv_cntxt_destroy {
1295f10a77bbSDavid C Somayajulu 	uint16_t	opcode;
1296f10a77bbSDavid C Somayajulu 	uint16_t 	count_version;
1297f10a77bbSDavid C Somayajulu 	uint32_t	cntxt_id;
1298f10a77bbSDavid C Somayajulu } __packed q80_rcv_cntxt_destroy_t;
1299f10a77bbSDavid C Somayajulu 
1300f10a77bbSDavid C Somayajulu typedef struct _q80_rcv_cntxt_destroy_rsp {
1301f10a77bbSDavid C Somayajulu 	uint16_t	opcode;
1302f10a77bbSDavid C Somayajulu 	uint16_t	regcnt_status;
1303f10a77bbSDavid C Somayajulu } __packed q80_rcv_cntxt_destroy_rsp_t;
1304f10a77bbSDavid C Somayajulu 
1305f10a77bbSDavid C Somayajulu /*
1306f10a77bbSDavid C Somayajulu  * Add Receive Rings
1307f10a77bbSDavid C Somayajulu  */
1308f10a77bbSDavid C Somayajulu typedef struct _q80_rq_add_rcv_rings {
1309f10a77bbSDavid C Somayajulu 	uint16_t		opcode;
1310f10a77bbSDavid C Somayajulu 	uint16_t		count_version;
1311f10a77bbSDavid C Somayajulu 	uint8_t			nrds_sets_rings;
1312f10a77bbSDavid C Somayajulu 	uint8_t			nsds_rings;
1313f10a77bbSDavid C Somayajulu 	uint16_t		cntxt_id;
1314f10a77bbSDavid C Somayajulu 	q80_rq_sds_ring_t	sds[MAX_RCNTXT_SDS_RINGS];
1315f10a77bbSDavid C Somayajulu 	q80_rq_rds_ring_t	rds[MAX_RDS_RING_SETS];
1316f10a77bbSDavid C Somayajulu } __packed q80_rq_add_rcv_rings_t;
1317f10a77bbSDavid C Somayajulu 
1318f10a77bbSDavid C Somayajulu typedef struct _q80_rsp_add_rcv_rings {
1319f10a77bbSDavid C Somayajulu 	uint16_t		opcode;
1320f10a77bbSDavid C Somayajulu 	uint16_t		regcnt_status;
1321f10a77bbSDavid C Somayajulu 	uint8_t			nrds_sets_rings;
1322f10a77bbSDavid C Somayajulu 	uint8_t			nsds_rings;
1323f10a77bbSDavid C Somayajulu 	uint16_t		cntxt_id;
1324f10a77bbSDavid C Somayajulu 	uint32_t		sds_cons[MAX_RCNTXT_SDS_RINGS];
1325f10a77bbSDavid C Somayajulu 	q80_rsp_rds_ring_t	rds[MAX_RDS_RING_SETS];
1326f10a77bbSDavid C Somayajulu } __packed q80_rsp_add_rcv_rings_t;
1327f10a77bbSDavid C Somayajulu 
1328f10a77bbSDavid C Somayajulu /*
1329f10a77bbSDavid C Somayajulu  * Map Status Ring to Receive Descriptor Set
1330f10a77bbSDavid C Somayajulu  */
1331f10a77bbSDavid C Somayajulu 
1332f10a77bbSDavid C Somayajulu #define MAX_SDS_TO_RDS_MAP      16
1333f10a77bbSDavid C Somayajulu 
1334f10a77bbSDavid C Somayajulu typedef struct _q80_sds_rds_map_e {
1335f10a77bbSDavid C Somayajulu         uint8_t sds_ring;
1336f10a77bbSDavid C Somayajulu         uint8_t rsrvd0;
1337f10a77bbSDavid C Somayajulu         uint8_t rds_ring;
1338f10a77bbSDavid C Somayajulu         uint8_t rsrvd1;
1339f10a77bbSDavid C Somayajulu } __packed q80_sds_rds_map_e_t;
1340f10a77bbSDavid C Somayajulu 
1341f10a77bbSDavid C Somayajulu typedef struct _q80_rq_map_sds_to_rds {
1342f10a77bbSDavid C Somayajulu         uint16_t                opcode;
1343f10a77bbSDavid C Somayajulu         uint16_t                count_version;
1344f10a77bbSDavid C Somayajulu         uint16_t                cntxt_id;
1345f10a77bbSDavid C Somayajulu         uint16_t                num_rings;
1346f10a77bbSDavid C Somayajulu         q80_sds_rds_map_e_t     sds_rds[MAX_SDS_TO_RDS_MAP];
1347f10a77bbSDavid C Somayajulu } __packed q80_rq_map_sds_to_rds_t;
1348f10a77bbSDavid C Somayajulu 
1349f10a77bbSDavid C Somayajulu typedef struct _q80_rsp_map_sds_to_rds {
1350f10a77bbSDavid C Somayajulu         uint16_t                opcode;
1351f10a77bbSDavid C Somayajulu         uint16_t                regcnt_status;
1352f10a77bbSDavid C Somayajulu         uint16_t                cntxt_id;
1353f10a77bbSDavid C Somayajulu         uint16_t                num_rings;
1354f10a77bbSDavid C Somayajulu         q80_sds_rds_map_e_t     sds_rds[MAX_SDS_TO_RDS_MAP];
1355f10a77bbSDavid C Somayajulu } __packed q80_rsp_map_sds_to_rds_t;
1356f10a77bbSDavid C Somayajulu 
1357f10a77bbSDavid C Somayajulu /*
1358f10a77bbSDavid C Somayajulu  * Receive Descriptor corresponding to each entry in the receive ring
1359f10a77bbSDavid C Somayajulu  */
1360f10a77bbSDavid C Somayajulu typedef struct _q80_rcv_desc {
1361f10a77bbSDavid C Somayajulu 	uint16_t handle;
1362f10a77bbSDavid C Somayajulu 	uint16_t rsrvd;
1363f10a77bbSDavid C Somayajulu 	uint32_t buf_size; /* buffer size in bytes */
1364f10a77bbSDavid C Somayajulu 	uint64_t buf_addr; /* physical address of buffer */
1365f10a77bbSDavid C Somayajulu } __packed q80_recv_desc_t;
1366f10a77bbSDavid C Somayajulu 
1367f10a77bbSDavid C Somayajulu /*
1368f10a77bbSDavid C Somayajulu  * Status Descriptor corresponding to each entry in the Status ring
1369f10a77bbSDavid C Somayajulu  */
1370f10a77bbSDavid C Somayajulu typedef struct _q80_stat_desc {
1371f10a77bbSDavid C Somayajulu 	uint64_t data[2];
1372f10a77bbSDavid C Somayajulu } __packed q80_stat_desc_t;
1373f10a77bbSDavid C Somayajulu 
1374f10a77bbSDavid C Somayajulu /*
1375f10a77bbSDavid C Somayajulu  * definitions for data[0] field of Status Descriptor
1376f10a77bbSDavid C Somayajulu  */
1377f10a77bbSDavid C Somayajulu #define Q8_STAT_DESC_RSS_HASH(data)		(data & 0xFFFFFFFF)
1378f10a77bbSDavid C Somayajulu #define Q8_STAT_DESC_TOTAL_LENGTH(data)		((data >> 32) & 0x3FFF)
1379f10a77bbSDavid C Somayajulu #define Q8_STAT_DESC_TOTAL_LENGTH_SGL_RCV(data)	((data >> 32) & 0xFFFF)
1380f10a77bbSDavid C Somayajulu #define Q8_STAT_DESC_HANDLE(data)		((data >> 48) & 0xFFFF)
1381f10a77bbSDavid C Somayajulu /*
1382f10a77bbSDavid C Somayajulu  * definitions for data[1] field of Status Descriptor
1383f10a77bbSDavid C Somayajulu  */
1384f10a77bbSDavid C Somayajulu 
1385f10a77bbSDavid C Somayajulu #define Q8_STAT_DESC_OPCODE(data)		((data >> 42) & 0xF)
1386f10a77bbSDavid C Somayajulu #define		Q8_STAT_DESC_OPCODE_RCV_PKT		0x01
1387f10a77bbSDavid C Somayajulu #define		Q8_STAT_DESC_OPCODE_LRO_PKT		0x02
1388f10a77bbSDavid C Somayajulu #define		Q8_STAT_DESC_OPCODE_SGL_LRO		0x04
1389f10a77bbSDavid C Somayajulu #define		Q8_STAT_DESC_OPCODE_SGL_RCV		0x05
1390f10a77bbSDavid C Somayajulu #define		Q8_STAT_DESC_OPCODE_CONT		0x06
1391f10a77bbSDavid C Somayajulu 
1392f10a77bbSDavid C Somayajulu /*
1393f10a77bbSDavid C Somayajulu  * definitions for data[1] field of Status Descriptor for standard frames
1394f10a77bbSDavid C Somayajulu  * status descriptor opcode equals 0x04
1395f10a77bbSDavid C Somayajulu  */
1396f10a77bbSDavid C Somayajulu #define Q8_STAT_DESC_STATUS(data)		((data >> 39) & 0x0007)
1397f10a77bbSDavid C Somayajulu #define		Q8_STAT_DESC_STATUS_CHKSUM_NOT_DONE	0x00
1398f10a77bbSDavid C Somayajulu #define		Q8_STAT_DESC_STATUS_NO_CHKSUM		0x01
1399f10a77bbSDavid C Somayajulu #define		Q8_STAT_DESC_STATUS_CHKSUM_OK		0x02
1400f10a77bbSDavid C Somayajulu #define		Q8_STAT_DESC_STATUS_CHKSUM_ERR		0x03
1401f10a77bbSDavid C Somayajulu 
1402f10a77bbSDavid C Somayajulu #define Q8_STAT_DESC_VLAN(data)			((data >> 47) & 1)
1403f10a77bbSDavid C Somayajulu #define Q8_STAT_DESC_VLAN_ID(data)		((data >> 48) & 0xFFFF)
1404f10a77bbSDavid C Somayajulu 
1405f10a77bbSDavid C Somayajulu #define Q8_STAT_DESC_PROTOCOL(data)		((data >> 44) & 0x000F)
1406f10a77bbSDavid C Somayajulu #define Q8_STAT_DESC_L2_OFFSET(data)		((data >> 48) & 0x001F)
1407f10a77bbSDavid C Somayajulu #define Q8_STAT_DESC_COUNT(data)		((data >> 37) & 0x0007)
1408f10a77bbSDavid C Somayajulu 
1409f10a77bbSDavid C Somayajulu /*
1410f10a77bbSDavid C Somayajulu  * definitions for data[0-1] fields of Status Descriptor for LRO
1411f10a77bbSDavid C Somayajulu  * status descriptor opcode equals 0x04
1412f10a77bbSDavid C Somayajulu  */
1413f10a77bbSDavid C Somayajulu 
1414f10a77bbSDavid C Somayajulu /* definitions for data[1] field */
1415f10a77bbSDavid C Somayajulu #define Q8_LRO_STAT_DESC_SEQ_NUM(data)		(uint32_t)(data)
1416f10a77bbSDavid C Somayajulu 
1417f10a77bbSDavid C Somayajulu /*
1418f10a77bbSDavid C Somayajulu  * definitions specific to opcode 0x04 data[1]
1419f10a77bbSDavid C Somayajulu  */
1420f10a77bbSDavid C Somayajulu #define	Q8_STAT_DESC_COUNT_SGL_LRO(data)	((data >> 13) & 0x0007)
1421f10a77bbSDavid C Somayajulu #define Q8_SGL_LRO_STAT_L2_OFFSET(data)         ((data >> 16) & 0xFF)
1422f10a77bbSDavid C Somayajulu #define Q8_SGL_LRO_STAT_L4_OFFSET(data)         ((data >> 24) & 0xFF)
1423f10a77bbSDavid C Somayajulu #define Q8_SGL_LRO_STAT_TS(data)                ((data >> 40) & 0x1)
1424f10a77bbSDavid C Somayajulu #define Q8_SGL_LRO_STAT_PUSH_BIT(data)          ((data >> 41) & 0x1)
1425f10a77bbSDavid C Somayajulu 
1426f10a77bbSDavid C Somayajulu /*
1427f10a77bbSDavid C Somayajulu  * definitions specific to opcode 0x05 data[1]
1428f10a77bbSDavid C Somayajulu  */
1429f10a77bbSDavid C Somayajulu #define	Q8_STAT_DESC_COUNT_SGL_RCV(data)	((data >> 37) & 0x0003)
1430f10a77bbSDavid C Somayajulu 
1431f10a77bbSDavid C Somayajulu /*
1432f10a77bbSDavid C Somayajulu  * definitions for opcode 0x06
1433f10a77bbSDavid C Somayajulu  */
1434f10a77bbSDavid C Somayajulu /* definitions for data[0] field */
1435f10a77bbSDavid C Somayajulu #define Q8_SGL_STAT_DESC_HANDLE1(data)          (data & 0xFFFF)
1436f10a77bbSDavid C Somayajulu #define Q8_SGL_STAT_DESC_HANDLE2(data)          ((data >> 16) & 0xFFFF)
1437f10a77bbSDavid C Somayajulu #define Q8_SGL_STAT_DESC_HANDLE3(data)          ((data >> 32) & 0xFFFF)
1438f10a77bbSDavid C Somayajulu #define Q8_SGL_STAT_DESC_HANDLE4(data)          ((data >> 48) & 0xFFFF)
1439f10a77bbSDavid C Somayajulu 
1440f10a77bbSDavid C Somayajulu /* definitions for data[1] field */
1441f10a77bbSDavid C Somayajulu #define Q8_SGL_STAT_DESC_HANDLE5(data)          (data & 0xFFFF)
1442f10a77bbSDavid C Somayajulu #define Q8_SGL_STAT_DESC_HANDLE6(data)          ((data >> 16) & 0xFFFF)
1443f10a77bbSDavid C Somayajulu #define Q8_SGL_STAT_DESC_NUM_HANDLES(data)      ((data >> 32) & 0x7)
1444f10a77bbSDavid C Somayajulu #define Q8_SGL_STAT_DESC_HANDLE7(data)          ((data >> 48) & 0xFFFF)
1445f10a77bbSDavid C Somayajulu 
1446f10a77bbSDavid C Somayajulu /** Driver Related Definitions Begin **/
1447f10a77bbSDavid C Somayajulu 
1448f10a77bbSDavid C Somayajulu #define TX_SMALL_PKT_SIZE	128 /* size in bytes of small packets */
1449f10a77bbSDavid C Somayajulu 
1450f10a77bbSDavid C Somayajulu /* The number of descriptors should be a power of 2 */
1451f10a77bbSDavid C Somayajulu #define NUM_TX_DESCRIPTORS		1024
1452f10a77bbSDavid C Somayajulu #define NUM_STATUS_DESCRIPTORS		1024
1453f10a77bbSDavid C Somayajulu 
1454f10a77bbSDavid C Somayajulu #define NUM_RX_DESCRIPTORS	2048
1455f10a77bbSDavid C Somayajulu 
1456f10a77bbSDavid C Somayajulu /*
1457f10a77bbSDavid C Somayajulu  * structure describing various dma buffers
1458f10a77bbSDavid C Somayajulu  */
1459f10a77bbSDavid C Somayajulu 
1460f10a77bbSDavid C Somayajulu typedef struct qla_dmabuf {
1461f10a77bbSDavid C Somayajulu         volatile struct {
1462f10a77bbSDavid C Somayajulu                 uint32_t        tx_ring		:1,
1463f10a77bbSDavid C Somayajulu                                 rds_ring	:1,
1464f10a77bbSDavid C Somayajulu                                 sds_ring	:1,
1465f10a77bbSDavid C Somayajulu 				minidump	:1;
1466f10a77bbSDavid C Somayajulu         } flags;
1467f10a77bbSDavid C Somayajulu 
1468f10a77bbSDavid C Somayajulu         qla_dma_t               tx_ring;
1469f10a77bbSDavid C Somayajulu         qla_dma_t               rds_ring[MAX_RDS_RINGS];
1470f10a77bbSDavid C Somayajulu         qla_dma_t               sds_ring[MAX_SDS_RINGS];
1471f10a77bbSDavid C Somayajulu 	qla_dma_t		minidump;
1472f10a77bbSDavid C Somayajulu } qla_dmabuf_t;
1473f10a77bbSDavid C Somayajulu 
1474f10a77bbSDavid C Somayajulu typedef struct _qla_sds {
1475f10a77bbSDavid C Somayajulu         q80_stat_desc_t *sds_ring_base; /* start of sds ring */
1476f10a77bbSDavid C Somayajulu         uint32_t        sdsr_next; /* next entry in SDS ring to process */
1477f10a77bbSDavid C Somayajulu         struct lro_ctrl lro;
1478f10a77bbSDavid C Somayajulu         void            *rxb_free;
1479f10a77bbSDavid C Somayajulu         uint32_t        rx_free;
1480f10a77bbSDavid C Somayajulu         volatile uint32_t rcv_active;
1481f10a77bbSDavid C Somayajulu 	uint32_t	sds_consumer;
1482f10a77bbSDavid C Somayajulu 	uint64_t	intr_count;
148300caeec7SDavid C Somayajulu 	uint64_t	spurious_intr_count;
1484f10a77bbSDavid C Somayajulu } qla_sds_t;
1485f10a77bbSDavid C Somayajulu 
1486f10a77bbSDavid C Somayajulu #define Q8_MAX_LRO_CONT_DESC    7
1487f10a77bbSDavid C Somayajulu #define Q8_MAX_HANDLES_LRO      (1 + (Q8_MAX_LRO_CONT_DESC * 7))
1488f10a77bbSDavid C Somayajulu #define Q8_MAX_HANDLES_NON_LRO  8
1489f10a77bbSDavid C Somayajulu 
1490f10a77bbSDavid C Somayajulu typedef struct _qla_sgl_rcv {
1491f10a77bbSDavid C Somayajulu         uint16_t        pkt_length;
1492f10a77bbSDavid C Somayajulu         uint16_t        num_handles;
1493f10a77bbSDavid C Somayajulu         uint16_t        chksum_status;
1494f10a77bbSDavid C Somayajulu         uint32_t        rss_hash;
1495f10a77bbSDavid C Somayajulu         uint16_t        rss_hash_flags;
1496f10a77bbSDavid C Somayajulu         uint16_t        vlan_tag;
1497f10a77bbSDavid C Somayajulu         uint16_t        handle[Q8_MAX_HANDLES_NON_LRO];
1498f10a77bbSDavid C Somayajulu } qla_sgl_rcv_t;
1499f10a77bbSDavid C Somayajulu 
1500f10a77bbSDavid C Somayajulu typedef struct _qla_sgl_lro {
1501f10a77bbSDavid C Somayajulu         uint16_t        flags;
1502f10a77bbSDavid C Somayajulu #define Q8_LRO_COMP_TS          0x1
1503f10a77bbSDavid C Somayajulu #define Q8_LRO_COMP_PUSH_BIT    0x2
1504f10a77bbSDavid C Somayajulu         uint16_t        l2_offset;
1505f10a77bbSDavid C Somayajulu         uint16_t        l4_offset;
1506f10a77bbSDavid C Somayajulu 
1507f10a77bbSDavid C Somayajulu         uint16_t        payload_length;
1508f10a77bbSDavid C Somayajulu         uint16_t        num_handles;
1509f10a77bbSDavid C Somayajulu         uint32_t        rss_hash;
1510f10a77bbSDavid C Somayajulu         uint16_t        rss_hash_flags;
1511f10a77bbSDavid C Somayajulu         uint16_t        vlan_tag;
1512f10a77bbSDavid C Somayajulu         uint16_t        handle[Q8_MAX_HANDLES_LRO];
1513f10a77bbSDavid C Somayajulu } qla_sgl_lro_t;
1514f10a77bbSDavid C Somayajulu 
1515f10a77bbSDavid C Somayajulu typedef union {
1516f10a77bbSDavid C Somayajulu         qla_sgl_rcv_t   rcv;
1517f10a77bbSDavid C Somayajulu         qla_sgl_lro_t   lro;
1518f10a77bbSDavid C Somayajulu } qla_sgl_comp_t;
1519f10a77bbSDavid C Somayajulu 
1520f10a77bbSDavid C Somayajulu #define QL_FRAME_HDR_SIZE (ETHER_HDR_LEN + ETHER_VLAN_ENCAP_LEN +\
1521f10a77bbSDavid C Somayajulu 		sizeof (struct ip6_hdr) + sizeof (struct tcphdr) + 16)
1522f10a77bbSDavid C Somayajulu 
1523f10a77bbSDavid C Somayajulu typedef struct _qla_hw_tx_cntxt {
1524f10a77bbSDavid C Somayajulu 	q80_tx_cmd_t    *tx_ring_base;
1525f10a77bbSDavid C Somayajulu 	bus_addr_t	tx_ring_paddr;
1526f10a77bbSDavid C Somayajulu 
1527f10a77bbSDavid C Somayajulu 	volatile uint32_t *tx_cons; /* tx consumer shadow reg */
1528f10a77bbSDavid C Somayajulu 	bus_addr_t      tx_cons_paddr;
1529f10a77bbSDavid C Somayajulu 
1530f10a77bbSDavid C Somayajulu 	volatile uint32_t txr_free; /* # of free entries in tx ring */
1531f10a77bbSDavid C Somayajulu 	volatile uint32_t txr_next; /* # next available tx ring entry */
1532f10a77bbSDavid C Somayajulu 	volatile uint32_t txr_comp; /* index of last tx entry completed */
1533f10a77bbSDavid C Somayajulu 
1534f10a77bbSDavid C Somayajulu 	uint32_t        tx_prod_reg;
1535f10a77bbSDavid C Somayajulu 	uint16_t	tx_cntxt_id;
1536f10a77bbSDavid C Somayajulu 
1537f10a77bbSDavid C Somayajulu } qla_hw_tx_cntxt_t;
1538f10a77bbSDavid C Somayajulu 
1539f10a77bbSDavid C Somayajulu typedef struct _qla_mcast {
1540f10a77bbSDavid C Somayajulu 	uint16_t	rsrvd;
1541da834d52SDavid C Somayajulu 	uint8_t		addr[ETHER_ADDR_LEN];
1542f10a77bbSDavid C Somayajulu } __packed qla_mcast_t;
1543f10a77bbSDavid C Somayajulu 
1544f10a77bbSDavid C Somayajulu typedef struct _qla_rdesc {
1545f10a77bbSDavid C Somayajulu         volatile uint32_t prod_std;
1546f10a77bbSDavid C Somayajulu         volatile uint32_t prod_jumbo;
1547f10a77bbSDavid C Somayajulu         volatile uint32_t rx_next; /* next standard rcv ring to arm fw */
1548f10a77bbSDavid C Somayajulu         volatile int32_t  rx_in; /* next standard rcv ring to add mbufs */
15497fb51846SDavid C Somayajulu 	uint64_t count;
15507fb51846SDavid C Somayajulu 	uint64_t lro_pkt_count;
15517fb51846SDavid C Somayajulu 	uint64_t lro_bytes;
1552f10a77bbSDavid C Somayajulu } qla_rdesc_t;
1553f10a77bbSDavid C Somayajulu 
1554f10a77bbSDavid C Somayajulu typedef struct _qla_flash_desc_table {
1555f10a77bbSDavid C Somayajulu 	uint32_t	flash_valid;
1556f10a77bbSDavid C Somayajulu 	uint16_t	flash_ver;
1557f10a77bbSDavid C Somayajulu 	uint16_t	flash_len;
1558f10a77bbSDavid C Somayajulu 	uint16_t	flash_cksum;
1559f10a77bbSDavid C Somayajulu 	uint16_t	flash_unused;
1560f10a77bbSDavid C Somayajulu 	uint8_t		flash_model[16];
1561f10a77bbSDavid C Somayajulu 	uint16_t	flash_manuf;
1562f10a77bbSDavid C Somayajulu 	uint16_t	flash_id;
1563f10a77bbSDavid C Somayajulu 	uint8_t		flash_flag;
1564f10a77bbSDavid C Somayajulu 	uint8_t		erase_cmd;
1565f10a77bbSDavid C Somayajulu 	uint8_t		alt_erase_cmd;
1566f10a77bbSDavid C Somayajulu 	uint8_t		write_enable_cmd;
1567f10a77bbSDavid C Somayajulu 	uint8_t		write_enable_bits;
1568f10a77bbSDavid C Somayajulu 	uint8_t		write_statusreg_cmd;
1569f10a77bbSDavid C Somayajulu 	uint8_t		unprotected_sec_cmd;
1570f10a77bbSDavid C Somayajulu 	uint8_t		read_manuf_cmd;
1571f10a77bbSDavid C Somayajulu 	uint32_t	block_size;
1572f10a77bbSDavid C Somayajulu 	uint32_t	alt_block_size;
1573f10a77bbSDavid C Somayajulu 	uint32_t	flash_size;
1574f10a77bbSDavid C Somayajulu 	uint32_t	write_enable_data;
1575f10a77bbSDavid C Somayajulu 	uint8_t		readid_addr_len;
1576f10a77bbSDavid C Somayajulu 	uint8_t		write_disable_bits;
1577f10a77bbSDavid C Somayajulu 	uint8_t		read_dev_id_len;
1578f10a77bbSDavid C Somayajulu 	uint8_t		chip_erase_cmd;
1579f10a77bbSDavid C Somayajulu 	uint16_t	read_timeo;
1580f10a77bbSDavid C Somayajulu 	uint8_t		protected_sec_cmd;
1581f10a77bbSDavid C Somayajulu 	uint8_t		resvd[65];
1582f10a77bbSDavid C Somayajulu } __packed qla_flash_desc_table_t;
1583f10a77bbSDavid C Somayajulu 
1584f10a77bbSDavid C Somayajulu /*
1585f10a77bbSDavid C Somayajulu  * struct for storing hardware specific information for a given interface
1586f10a77bbSDavid C Somayajulu  */
1587f10a77bbSDavid C Somayajulu typedef struct _qla_hw {
1588f10a77bbSDavid C Somayajulu 	struct {
1589f10a77bbSDavid C Somayajulu 		uint32_t
1590f10a77bbSDavid C Somayajulu 			unicast_mac	:1,
1591f10a77bbSDavid C Somayajulu 			bcast_mac	:1,
1592f10a77bbSDavid C Somayajulu 			init_tx_cnxt	:1,
1593f10a77bbSDavid C Somayajulu 			init_rx_cnxt	:1,
1594f10a77bbSDavid C Somayajulu 			init_intr_cnxt	:1,
1595f10a77bbSDavid C Somayajulu 			fdt_valid	:1;
1596f10a77bbSDavid C Somayajulu 	} flags;
1597f10a77bbSDavid C Somayajulu 
1598b65c0c07SDavid C Somayajulu 	volatile uint16_t	link_speed;
1599b65c0c07SDavid C Somayajulu 	volatile uint16_t	cable_length;
1600b65c0c07SDavid C Somayajulu 	volatile uint32_t	cable_oui;
1601b65c0c07SDavid C Somayajulu 	volatile uint8_t	link_up;
1602b65c0c07SDavid C Somayajulu 	volatile uint8_t	module_type;
1603b65c0c07SDavid C Somayajulu 	volatile uint8_t	link_faults;
1604b65c0c07SDavid C Somayajulu 	volatile uint8_t	loopback_mode;
1605b65c0c07SDavid C Somayajulu 	volatile uint8_t	fduplex;
1606b65c0c07SDavid C Somayajulu 	volatile uint8_t	autoneg;
1607f10a77bbSDavid C Somayajulu 
1608b65c0c07SDavid C Somayajulu 	volatile uint8_t	mac_rcv_mode;
1609f10a77bbSDavid C Somayajulu 
1610b65c0c07SDavid C Somayajulu 	volatile uint32_t	max_mtu;
1611f10a77bbSDavid C Somayajulu 
1612f10a77bbSDavid C Somayajulu 	uint8_t		mac_addr[ETHER_ADDR_LEN];
1613f10a77bbSDavid C Somayajulu 
1614f10a77bbSDavid C Somayajulu 	uint32_t	num_sds_rings;
1615f10a77bbSDavid C Somayajulu 	uint32_t	num_rds_rings;
1616f10a77bbSDavid C Somayajulu 	uint32_t	num_tx_rings;
1617f10a77bbSDavid C Somayajulu 
1618f10a77bbSDavid C Somayajulu         qla_dmabuf_t	dma_buf;
1619f10a77bbSDavid C Somayajulu 
1620f10a77bbSDavid C Somayajulu 	/* Transmit Side */
1621f10a77bbSDavid C Somayajulu 
1622f10a77bbSDavid C Somayajulu 	qla_hw_tx_cntxt_t tx_cntxt[NUM_TX_RINGS];
1623f10a77bbSDavid C Somayajulu 
1624f10a77bbSDavid C Somayajulu 	/* Receive Side */
1625f10a77bbSDavid C Somayajulu 
1626f10a77bbSDavid C Somayajulu 	uint16_t	rcv_cntxt_id;
1627f10a77bbSDavid C Somayajulu 
1628f10a77bbSDavid C Somayajulu 	uint32_t	mbx_intr_mask_offset;
1629f10a77bbSDavid C Somayajulu 
1630f10a77bbSDavid C Somayajulu 	uint16_t	intr_id[MAX_SDS_RINGS];
1631f10a77bbSDavid C Somayajulu 	uint32_t	intr_src[MAX_SDS_RINGS];
1632f10a77bbSDavid C Somayajulu 
1633f10a77bbSDavid C Somayajulu 	qla_sds_t	sds[MAX_SDS_RINGS];
1634f10a77bbSDavid C Somayajulu 	uint32_t	mbox[Q8_NUM_MBOX];
1635f10a77bbSDavid C Somayajulu 	qla_rdesc_t	rds[MAX_RDS_RINGS];
1636f10a77bbSDavid C Somayajulu 
1637f10a77bbSDavid C Somayajulu 	uint32_t	rds_pidx_thres;
1638f10a77bbSDavid C Somayajulu 	uint32_t	sds_cidx_thres;
1639f10a77bbSDavid C Somayajulu 
164035291c22SDavid C Somayajulu 	uint32_t	rcv_intr_coalesce;
164135291c22SDavid C Somayajulu 	uint32_t	xmt_intr_coalesce;
164235291c22SDavid C Somayajulu 
164335291c22SDavid C Somayajulu 	/* Immediate Completion */
164435291c22SDavid C Somayajulu 	volatile uint32_t imd_compl;
164535291c22SDavid C Somayajulu 	volatile uint32_t aen_mb0;
164635291c22SDavid C Somayajulu 	volatile uint32_t aen_mb1;
164735291c22SDavid C Somayajulu 	volatile uint32_t aen_mb2;
164835291c22SDavid C Somayajulu 	volatile uint32_t aen_mb3;
164935291c22SDavid C Somayajulu 	volatile uint32_t aen_mb4;
165035291c22SDavid C Somayajulu 
1651f10a77bbSDavid C Somayajulu 	/* multicast address list */
1652f10a77bbSDavid C Somayajulu 	uint32_t	nmcast;
1653f10a77bbSDavid C Somayajulu 	qla_mcast_t	mcast[Q8_MAX_NUM_MULTICAST_ADDRS];
1654da834d52SDavid C Somayajulu 	uint8_t		mac_addr_arr[(Q8_MAX_MAC_ADDRS * ETHER_ADDR_LEN)];
1655f10a77bbSDavid C Somayajulu 
1656f10a77bbSDavid C Somayajulu 	/* reset sequence */
1657f10a77bbSDavid C Somayajulu #define Q8_MAX_RESET_SEQ_IDX	16
1658f10a77bbSDavid C Somayajulu 	uint32_t	rst_seq[Q8_MAX_RESET_SEQ_IDX];
1659f10a77bbSDavid C Somayajulu 	uint32_t	rst_seq_idx;
1660f10a77bbSDavid C Somayajulu 
1661f10a77bbSDavid C Somayajulu 	/* heart beat register value */
1662f10a77bbSDavid C Somayajulu 	uint32_t	hbeat_value;
1663f10a77bbSDavid C Somayajulu 	uint32_t	health_count;
166412e46badSDavid C Somayajulu 	uint32_t	hbeat_failure;
1665f10a77bbSDavid C Somayajulu 
1666f10a77bbSDavid C Somayajulu 	uint32_t	max_tx_segs;
1667c12c5bfbSDavid C Somayajulu 	uint32_t	min_lro_pkt_size;
1668f10a77bbSDavid C Somayajulu 
1669a7c62c11SDavid C Somayajulu 	uint32_t        enable_hw_lro;
1670a7c62c11SDavid C Somayajulu 	uint32_t        enable_soft_lro;
167135291c22SDavid C Somayajulu 	uint32_t        enable_9kb;
167235291c22SDavid C Somayajulu 
167335291c22SDavid C Somayajulu 	uint32_t	user_pri_nic;
167435291c22SDavid C Somayajulu 	uint32_t	user_pri_iscsi;
167535291c22SDavid C Somayajulu 
1676f10a77bbSDavid C Somayajulu 	/* Flash Descriptor Table */
1677f10a77bbSDavid C Somayajulu 	qla_flash_desc_table_t fdt;
1678f10a77bbSDavid C Somayajulu 
16797fb51846SDavid C Somayajulu 	/* stats */
16807fb51846SDavid C Somayajulu 	q80_mac_stats_t mac;
16817fb51846SDavid C Somayajulu 	q80_rcv_stats_t rcv;
16827fb51846SDavid C Somayajulu 	q80_xmt_stats_t xmt[NUM_TX_RINGS];
16837fb51846SDavid C Somayajulu 
1684f10a77bbSDavid C Somayajulu 	/* Minidump Related */
1685f10a77bbSDavid C Somayajulu 	uint32_t	mdump_init;
16866a62bec0SDavid C Somayajulu 	uint32_t	mdump_done;
1687f10a77bbSDavid C Somayajulu 	uint32_t	mdump_active;
16886a62bec0SDavid C Somayajulu 	uint32_t	mdump_capture_mask;
1689f10a77bbSDavid C Somayajulu 	uint32_t	mdump_start_seq_index;
16906a62bec0SDavid C Somayajulu 	void		*mdump_buffer;
16916a62bec0SDavid C Somayajulu 	uint32_t	mdump_buffer_size;
16926a62bec0SDavid C Somayajulu 	void		*mdump_template;
16936a62bec0SDavid C Somayajulu 	uint32_t	mdump_template_size;
1694b65c0c07SDavid C Somayajulu 	uint64_t	mdump_usec_ts;
1695ab142b3fSDavid C Somayajulu 
1696b65c0c07SDavid C Somayajulu #define Q8_MBX_COMP_MSECS	(19)
1697b65c0c07SDavid C Somayajulu 	uint64_t	mbx_comp_msecs[Q8_MBX_COMP_MSECS];
1698ab142b3fSDavid C Somayajulu 	/* driver state related */
1699ab142b3fSDavid C Somayajulu 	void		*drvr_state;
1700b65c0c07SDavid C Somayajulu 
1701b65c0c07SDavid C Somayajulu 	/* slow path trace */
1702b65c0c07SDavid C Somayajulu 	uint32_t	sp_log_stop_events;
1703b65c0c07SDavid C Somayajulu #define Q8_SP_LOG_STOP_HBEAT_FAILURE		0x001
1704b65c0c07SDavid C Somayajulu #define Q8_SP_LOG_STOP_TEMP_FAILURE		0x002
1705b65c0c07SDavid C Somayajulu #define Q8_SP_LOG_STOP_HW_INIT_FAILURE		0x004
1706b65c0c07SDavid C Somayajulu #define Q8_SP_LOG_STOP_IF_START_FAILURE		0x008
1707b65c0c07SDavid C Somayajulu #define Q8_SP_LOG_STOP_ERR_RECOVERY_FAILURE	0x010
1708b65c0c07SDavid C Somayajulu 
1709b65c0c07SDavid C Somayajulu 	uint32_t	sp_log_stop;
1710b65c0c07SDavid C Somayajulu 	uint32_t	sp_log_index;
1711b65c0c07SDavid C Somayajulu 	uint32_t	sp_log_num_entries;
1712b65c0c07SDavid C Somayajulu 	void		*sp_log;
1713f10a77bbSDavid C Somayajulu } qla_hw_t;
1714f10a77bbSDavid C Somayajulu 
1715f10a77bbSDavid C Somayajulu #define QL_UPDATE_RDS_PRODUCER_INDEX(ha, prod_reg, val) \
1716c7d4c9d9SDavid C Somayajulu 		bus_write_4((ha->pci_reg), prod_reg, val);
1717f10a77bbSDavid C Somayajulu 
1718f10a77bbSDavid C Somayajulu #define QL_UPDATE_TX_PRODUCER_INDEX(ha, val, i) \
1719f10a77bbSDavid C Somayajulu 		WRITE_REG32(ha, ha->hw.tx_cntxt[i].tx_prod_reg, val)
1720f10a77bbSDavid C Somayajulu 
1721f10a77bbSDavid C Somayajulu #define QL_UPDATE_SDS_CONSUMER_INDEX(ha, i, val) \
1722c7d4c9d9SDavid C Somayajulu 	bus_write_4((ha->pci_reg), (ha->hw.sds[i].sds_consumer), val);
1723f10a77bbSDavid C Somayajulu 
1724c7d4c9d9SDavid C Somayajulu #define QL_ENABLE_INTERRUPTS(ha, i) \
1725c7d4c9d9SDavid C Somayajulu 		bus_write_4((ha->pci_reg), (ha->hw.intr_src[i]), 0);
1726f10a77bbSDavid C Somayajulu 
1727f10a77bbSDavid C Somayajulu #define QL_BUFFER_ALIGN                16
1728f10a77bbSDavid C Somayajulu 
1729f10a77bbSDavid C Somayajulu /*
1730f10a77bbSDavid C Somayajulu  * Flash Configuration
1731f10a77bbSDavid C Somayajulu  */
1732f10a77bbSDavid C Somayajulu #define Q8_BOARD_CONFIG_OFFSET		0x370000
1733f10a77bbSDavid C Somayajulu #define Q8_BOARD_CONFIG_LENGTH		0x2000
1734f10a77bbSDavid C Somayajulu 
1735f10a77bbSDavid C Somayajulu #define Q8_BOARD_CONFIG_MAC0_LO		0x400
1736f10a77bbSDavid C Somayajulu 
1737f10a77bbSDavid C Somayajulu #define Q8_FDT_LOCK_MAGIC_ID		0x00FD00FD
1738f10a77bbSDavid C Somayajulu #define Q8_FDT_FLASH_ADDR_VAL		0xFD009F
1739f10a77bbSDavid C Somayajulu #define Q8_FDT_FLASH_CTRL_VAL		0x3F
1740f10a77bbSDavid C Somayajulu #define Q8_FDT_MASK_VAL			0xFF
1741f10a77bbSDavid C Somayajulu 
1742f10a77bbSDavid C Somayajulu #define Q8_WR_ENABLE_FL_ADDR		0xFD0100
1743f10a77bbSDavid C Somayajulu #define Q8_WR_ENABLE_FL_CTRL		0x5
1744f10a77bbSDavid C Somayajulu 
1745f10a77bbSDavid C Somayajulu #define Q8_ERASE_LOCK_MAGIC_ID		0x00EF00EF
1746f10a77bbSDavid C Somayajulu #define Q8_ERASE_FL_ADDR_MASK		0xFD0300
1747f10a77bbSDavid C Somayajulu #define Q8_ERASE_FL_CTRL_MASK		0x3D
1748f10a77bbSDavid C Somayajulu 
1749f10a77bbSDavid C Somayajulu #define Q8_WR_FL_LOCK_MAGIC_ID		0xABCDABCD
1750f10a77bbSDavid C Somayajulu #define Q8_WR_FL_ADDR_MASK		0x800000
1751f10a77bbSDavid C Somayajulu #define Q8_WR_FL_CTRL_MASK		0x3D
1752f10a77bbSDavid C Somayajulu 
1753f10a77bbSDavid C Somayajulu #define QL_FDT_OFFSET			0x3F0000
1754f10a77bbSDavid C Somayajulu #define Q8_FLASH_SECTOR_SIZE		0x10000
1755f10a77bbSDavid C Somayajulu 
1756f10a77bbSDavid C Somayajulu /*
1757f10a77bbSDavid C Somayajulu  * Off Chip Memory Access
1758f10a77bbSDavid C Somayajulu  */
1759f10a77bbSDavid C Somayajulu 
1760f10a77bbSDavid C Somayajulu typedef struct _q80_offchip_mem_val {
1761f10a77bbSDavid C Somayajulu         uint32_t data_lo;
1762f10a77bbSDavid C Somayajulu         uint32_t data_hi;
1763f10a77bbSDavid C Somayajulu         uint32_t data_ulo;
1764f10a77bbSDavid C Somayajulu         uint32_t data_uhi;
1765f10a77bbSDavid C Somayajulu } q80_offchip_mem_val_t;
1766f10a77bbSDavid C Somayajulu 
1767f10a77bbSDavid C Somayajulu #endif /* #ifndef _QL_HW_H_ */
1768