xref: /linux/drivers/scsi/pm8001/pm8001_hwi.h (revision a1c613ae4c322ddd58d5a8539dbfba2a0380a8c0)
1dbf9bfe6Sjack wang /*
2dbf9bfe6Sjack wang  * PMC-Sierra SPC 8001 SAS/SATA based host adapters driver
3dbf9bfe6Sjack wang  *
4dbf9bfe6Sjack wang  * Copyright (c) 2008-2009 USI Co., Ltd.
5dbf9bfe6Sjack wang  * All rights reserved.
6dbf9bfe6Sjack wang  *
7dbf9bfe6Sjack wang  * Redistribution and use in source and binary forms, with or without
8dbf9bfe6Sjack wang  * modification, are permitted provided that the following conditions
9dbf9bfe6Sjack wang  * are met:
10dbf9bfe6Sjack wang  * 1. Redistributions of source code must retain the above copyright
11dbf9bfe6Sjack wang  *    notice, this list of conditions, and the following disclaimer,
12dbf9bfe6Sjack wang  *    without modification.
13dbf9bfe6Sjack wang  * 2. Redistributions in binary form must reproduce at minimum a disclaimer
14dbf9bfe6Sjack wang  *    substantially similar to the "NO WARRANTY" disclaimer below
15dbf9bfe6Sjack wang  *    ("Disclaimer") and any redistribution must be conditioned upon
16dbf9bfe6Sjack wang  *    including a substantially similar Disclaimer requirement for further
17dbf9bfe6Sjack wang  *    binary redistribution.
18dbf9bfe6Sjack wang  * 3. Neither the names of the above-listed copyright holders nor the names
19dbf9bfe6Sjack wang  *    of any contributors may be used to endorse or promote products derived
20dbf9bfe6Sjack wang  *    from this software without specific prior written permission.
21dbf9bfe6Sjack wang  *
22dbf9bfe6Sjack wang  * Alternatively, this software may be distributed under the terms of the
23dbf9bfe6Sjack wang  * GNU General Public License ("GPL") version 2 as published by the Free
24dbf9bfe6Sjack wang  * Software Foundation.
25dbf9bfe6Sjack wang  *
26dbf9bfe6Sjack wang  * NO WARRANTY
27dbf9bfe6Sjack wang  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
28dbf9bfe6Sjack wang  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
29dbf9bfe6Sjack wang  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
30dbf9bfe6Sjack wang  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
31dbf9bfe6Sjack wang  * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
32dbf9bfe6Sjack wang  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
33dbf9bfe6Sjack wang  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
34dbf9bfe6Sjack wang  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
35dbf9bfe6Sjack wang  * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
36dbf9bfe6Sjack wang  * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
37dbf9bfe6Sjack wang  * POSSIBILITY OF SUCH DAMAGES.
38dbf9bfe6Sjack wang  *
39dbf9bfe6Sjack wang  */
40dbf9bfe6Sjack wang #ifndef _PMC8001_REG_H_
41dbf9bfe6Sjack wang #define _PMC8001_REG_H_
42dbf9bfe6Sjack wang 
43dbf9bfe6Sjack wang #include <linux/types.h>
44dbf9bfe6Sjack wang #include <scsi/libsas.h>
45dbf9bfe6Sjack wang 
46dbf9bfe6Sjack wang 
47dbf9bfe6Sjack wang /* for Request Opcode of IOMB */
48dbf9bfe6Sjack wang #define OPC_INB_ECHO				1	/* 0x000 */
49dbf9bfe6Sjack wang #define OPC_INB_PHYSTART			4	/* 0x004 */
50dbf9bfe6Sjack wang #define OPC_INB_PHYSTOP				5	/* 0x005 */
51dbf9bfe6Sjack wang #define OPC_INB_SSPINIIOSTART			6	/* 0x006 */
52dbf9bfe6Sjack wang #define OPC_INB_SSPINITMSTART			7	/* 0x007 */
53dbf9bfe6Sjack wang #define OPC_INB_SSPINIEXTIOSTART		8	/* 0x008 */
54dbf9bfe6Sjack wang #define OPC_INB_DEV_HANDLE_ACCEPT		9	/* 0x009 */
55dbf9bfe6Sjack wang #define OPC_INB_SSPTGTIOSTART			10	/* 0x00A */
56dbf9bfe6Sjack wang #define OPC_INB_SSPTGTRSPSTART			11	/* 0x00B */
57dbf9bfe6Sjack wang #define OPC_INB_SSPINIEDCIOSTART		12	/* 0x00C */
58dbf9bfe6Sjack wang #define OPC_INB_SSPINIEXTEDCIOSTART		13	/* 0x00D */
59dbf9bfe6Sjack wang #define OPC_INB_SSPTGTEDCIOSTART		14	/* 0x00E */
60dbf9bfe6Sjack wang #define OPC_INB_SSP_ABORT			15	/* 0x00F */
61dbf9bfe6Sjack wang #define OPC_INB_DEREG_DEV_HANDLE		16	/* 0x010 */
62dbf9bfe6Sjack wang #define OPC_INB_GET_DEV_HANDLE			17	/* 0x011 */
63dbf9bfe6Sjack wang #define OPC_INB_SMP_REQUEST			18	/* 0x012 */
64dbf9bfe6Sjack wang /* SMP_RESPONSE is removed */
65dbf9bfe6Sjack wang #define OPC_INB_SMP_RESPONSE			19	/* 0x013 */
66dbf9bfe6Sjack wang #define OPC_INB_SMP_ABORT			20	/* 0x014 */
67dbf9bfe6Sjack wang #define OPC_INB_REG_DEV				22	/* 0x016 */
68dbf9bfe6Sjack wang #define OPC_INB_SATA_HOST_OPSTART		23	/* 0x017 */
69dbf9bfe6Sjack wang #define OPC_INB_SATA_ABORT			24	/* 0x018 */
70dbf9bfe6Sjack wang #define OPC_INB_LOCAL_PHY_CONTROL		25	/* 0x019 */
71dbf9bfe6Sjack wang #define OPC_INB_GET_DEV_INFO			26	/* 0x01A */
72dbf9bfe6Sjack wang #define OPC_INB_FW_FLASH_UPDATE			32	/* 0x020 */
73dbf9bfe6Sjack wang #define OPC_INB_GPIO				34	/* 0x022 */
74dbf9bfe6Sjack wang #define OPC_INB_SAS_DIAG_MODE_START_END		35	/* 0x023 */
75dbf9bfe6Sjack wang #define OPC_INB_SAS_DIAG_EXECUTE		36	/* 0x024 */
76dbf9bfe6Sjack wang #define OPC_INB_SAS_HW_EVENT_ACK		37	/* 0x025 */
77dbf9bfe6Sjack wang #define OPC_INB_GET_TIME_STAMP			38	/* 0x026 */
78dbf9bfe6Sjack wang #define OPC_INB_PORT_CONTROL			39	/* 0x027 */
79dbf9bfe6Sjack wang #define OPC_INB_GET_NVMD_DATA			40	/* 0x028 */
80dbf9bfe6Sjack wang #define OPC_INB_SET_NVMD_DATA			41	/* 0x029 */
81dbf9bfe6Sjack wang #define OPC_INB_SET_DEVICE_STATE		42	/* 0x02A */
82dbf9bfe6Sjack wang #define OPC_INB_GET_DEVICE_STATE		43	/* 0x02B */
83dbf9bfe6Sjack wang #define OPC_INB_SET_DEV_INFO			44	/* 0x02C */
84dbf9bfe6Sjack wang #define OPC_INB_SAS_RE_INITIALIZE		45	/* 0x02D */
85dbf9bfe6Sjack wang 
86dbf9bfe6Sjack wang /* for Response Opcode of IOMB */
87dbf9bfe6Sjack wang #define OPC_OUB_ECHO				1	/* 0x001 */
88dbf9bfe6Sjack wang #define OPC_OUB_HW_EVENT			4	/* 0x004 */
89dbf9bfe6Sjack wang #define OPC_OUB_SSP_COMP			5	/* 0x005 */
90dbf9bfe6Sjack wang #define OPC_OUB_SMP_COMP			6	/* 0x006 */
91dbf9bfe6Sjack wang #define OPC_OUB_LOCAL_PHY_CNTRL			7	/* 0x007 */
92dbf9bfe6Sjack wang #define OPC_OUB_DEV_REGIST			10	/* 0x00A */
93dbf9bfe6Sjack wang #define OPC_OUB_DEREG_DEV			11	/* 0x00B */
94dbf9bfe6Sjack wang #define OPC_OUB_GET_DEV_HANDLE			12	/* 0x00C */
95dbf9bfe6Sjack wang #define OPC_OUB_SATA_COMP			13	/* 0x00D */
96dbf9bfe6Sjack wang #define OPC_OUB_SATA_EVENT			14	/* 0x00E */
97dbf9bfe6Sjack wang #define OPC_OUB_SSP_EVENT			15	/* 0x00F */
98dbf9bfe6Sjack wang #define OPC_OUB_DEV_HANDLE_ARRIV		16	/* 0x010 */
99dbf9bfe6Sjack wang /* SMP_RECEIVED Notification is removed */
100dbf9bfe6Sjack wang #define OPC_OUB_SMP_RECV_EVENT			17	/* 0x011 */
101dbf9bfe6Sjack wang #define OPC_OUB_SSP_RECV_EVENT			18	/* 0x012 */
102dbf9bfe6Sjack wang #define OPC_OUB_DEV_INFO			19	/* 0x013 */
103dbf9bfe6Sjack wang #define OPC_OUB_FW_FLASH_UPDATE			20	/* 0x014 */
104dbf9bfe6Sjack wang #define OPC_OUB_GPIO_RESPONSE			22	/* 0x016 */
105dbf9bfe6Sjack wang #define OPC_OUB_GPIO_EVENT			23	/* 0x017 */
106dbf9bfe6Sjack wang #define OPC_OUB_GENERAL_EVENT			24	/* 0x018 */
107dbf9bfe6Sjack wang #define OPC_OUB_SSP_ABORT_RSP			26	/* 0x01A */
108dbf9bfe6Sjack wang #define OPC_OUB_SATA_ABORT_RSP			27	/* 0x01B */
109dbf9bfe6Sjack wang #define OPC_OUB_SAS_DIAG_MODE_START_END		28	/* 0x01C */
110dbf9bfe6Sjack wang #define OPC_OUB_SAS_DIAG_EXECUTE		29	/* 0x01D */
111dbf9bfe6Sjack wang #define OPC_OUB_GET_TIME_STAMP			30	/* 0x01E */
112dbf9bfe6Sjack wang #define OPC_OUB_SAS_HW_EVENT_ACK		31	/* 0x01F */
113dbf9bfe6Sjack wang #define OPC_OUB_PORT_CONTROL			32	/* 0x020 */
114dbf9bfe6Sjack wang #define OPC_OUB_SKIP_ENTRY			33	/* 0x021 */
115dbf9bfe6Sjack wang #define OPC_OUB_SMP_ABORT_RSP			34	/* 0x022 */
116dbf9bfe6Sjack wang #define OPC_OUB_GET_NVMD_DATA			35	/* 0x023 */
117dbf9bfe6Sjack wang #define OPC_OUB_SET_NVMD_DATA			36	/* 0x024 */
118dbf9bfe6Sjack wang #define OPC_OUB_DEVICE_HANDLE_REMOVAL		37	/* 0x025 */
119dbf9bfe6Sjack wang #define OPC_OUB_SET_DEVICE_STATE		38	/* 0x026 */
120dbf9bfe6Sjack wang #define OPC_OUB_GET_DEVICE_STATE		39	/* 0x027 */
121dbf9bfe6Sjack wang #define OPC_OUB_SET_DEV_INFO			40	/* 0x028 */
122dbf9bfe6Sjack wang #define OPC_OUB_SAS_RE_INITIALIZE		41	/* 0x029 */
123dbf9bfe6Sjack wang 
124dbf9bfe6Sjack wang /* for phy start*/
125dbf9bfe6Sjack wang #define SPINHOLD_DISABLE		(0x00 << 14)
126dbf9bfe6Sjack wang #define SPINHOLD_ENABLE			(0x01 << 14)
127dbf9bfe6Sjack wang #define LINKMODE_SAS			(0x01 << 12)
128dbf9bfe6Sjack wang #define LINKMODE_DSATA			(0x02 << 12)
129dbf9bfe6Sjack wang #define LINKMODE_AUTO			(0x03 << 12)
130dbf9bfe6Sjack wang #define LINKRATE_15			(0x01 << 8)
131dbf9bfe6Sjack wang #define LINKRATE_30			(0x02 << 8)
132dbf9bfe6Sjack wang #define LINKRATE_60			(0x04 << 8)
133dbf9bfe6Sjack wang 
13454792dc2SSakthivel K /* for new SPC controllers MEMBASE III is shared between BIOS and DATA */
13554792dc2SSakthivel K #define GSM_SM_BASE			0x4F0000
136dbf9bfe6Sjack wang struct mpi_msg_hdr{
137dbf9bfe6Sjack wang 	__le32	header;	/* Bits [11:0]  - Message operation code */
138dbf9bfe6Sjack wang 	/* Bits [15:12] - Message Category */
139dbf9bfe6Sjack wang 	/* Bits [21:16] - Outboundqueue ID for the
140dbf9bfe6Sjack wang 	operation completion message */
141dbf9bfe6Sjack wang 	/* Bits [23:22] - Reserved */
142dbf9bfe6Sjack wang 	/* Bits [28:24] - Buffer Count, indicates how
143dbf9bfe6Sjack wang 	many buffer are allocated for the massage */
144dbf9bfe6Sjack wang 	/* Bits [30:29] - Reserved */
145dbf9bfe6Sjack wang 	/* Bits [31] - Message Valid bit */
146dbf9bfe6Sjack wang } __attribute__((packed, aligned(4)));
147dbf9bfe6Sjack wang 
148dbf9bfe6Sjack wang 
149dbf9bfe6Sjack wang /*
150dbf9bfe6Sjack wang  * brief the data structure of PHY Start Command
151dbf9bfe6Sjack wang  * use to describe enable the phy (64 bytes)
152dbf9bfe6Sjack wang  */
153dbf9bfe6Sjack wang struct phy_start_req {
154dbf9bfe6Sjack wang 	__le32	tag;
155dbf9bfe6Sjack wang 	__le32	ase_sh_lm_slr_phyid;
156dbf9bfe6Sjack wang 	struct sas_identify_frame sas_identify;
157dbf9bfe6Sjack wang 	u32	reserved[5];
158dbf9bfe6Sjack wang } __attribute__((packed, aligned(4)));
159dbf9bfe6Sjack wang 
160dbf9bfe6Sjack wang 
161dbf9bfe6Sjack wang /*
162dbf9bfe6Sjack wang  * brief the data structure of PHY Start Command
163dbf9bfe6Sjack wang  * use to disable the phy (64 bytes)
164dbf9bfe6Sjack wang  */
165dbf9bfe6Sjack wang struct phy_stop_req {
166dbf9bfe6Sjack wang 	__le32	tag;
167dbf9bfe6Sjack wang 	__le32	phy_id;
168dbf9bfe6Sjack wang 	u32	reserved[13];
169dbf9bfe6Sjack wang } __attribute__((packed, aligned(4)));
170dbf9bfe6Sjack wang 
171dbf9bfe6Sjack wang 
172dbf9bfe6Sjack wang /* set device bits fis - device to host */
173dbf9bfe6Sjack wang struct  set_dev_bits_fis {
174dbf9bfe6Sjack wang 	u8	fis_type;	/* 0xA1*/
175dbf9bfe6Sjack wang 	u8	n_i_pmport;
176dbf9bfe6Sjack wang 	/* b7 : n Bit. Notification bit. If set device needs attention. */
177dbf9bfe6Sjack wang 	/* b6 : i Bit. Interrupt Bit */
178dbf9bfe6Sjack wang 	/* b5-b4: reserved2 */
179dbf9bfe6Sjack wang 	/* b3-b0: PM Port */
180dbf9bfe6Sjack wang 	u8 	status;
181dbf9bfe6Sjack wang 	u8	error;
182dbf9bfe6Sjack wang 	u32	_r_a;
183dbf9bfe6Sjack wang } __attribute__ ((packed));
184dbf9bfe6Sjack wang /* PIO setup FIS - device to host */
185dbf9bfe6Sjack wang struct  pio_setup_fis {
186dbf9bfe6Sjack wang 	u8	fis_type;	/* 0x5f */
187dbf9bfe6Sjack wang 	u8	i_d_pmPort;
188dbf9bfe6Sjack wang 	/* b7 : reserved */
189dbf9bfe6Sjack wang 	/* b6 : i bit. Interrupt bit */
190dbf9bfe6Sjack wang 	/* b5 : d bit. data transfer direction. set to 1 for device to host
191dbf9bfe6Sjack wang 	xfer */
192dbf9bfe6Sjack wang 	/* b4 : reserved */
193dbf9bfe6Sjack wang 	/* b3-b0: PM Port */
194dbf9bfe6Sjack wang 	u8	status;
195dbf9bfe6Sjack wang 	u8	error;
196dbf9bfe6Sjack wang 	u8	lbal;
197dbf9bfe6Sjack wang 	u8	lbam;
198dbf9bfe6Sjack wang 	u8	lbah;
199dbf9bfe6Sjack wang 	u8	device;
200dbf9bfe6Sjack wang 	u8	lbal_exp;
201dbf9bfe6Sjack wang 	u8	lbam_exp;
202dbf9bfe6Sjack wang 	u8	lbah_exp;
203dbf9bfe6Sjack wang 	u8	_r_a;
204dbf9bfe6Sjack wang 	u8	sector_count;
205dbf9bfe6Sjack wang 	u8	sector_count_exp;
206dbf9bfe6Sjack wang 	u8	_r_b;
207dbf9bfe6Sjack wang 	u8	e_status;
208dbf9bfe6Sjack wang 	u8	_r_c[2];
209dbf9bfe6Sjack wang 	u8	transfer_count;
210dbf9bfe6Sjack wang } __attribute__ ((packed));
211dbf9bfe6Sjack wang 
212dbf9bfe6Sjack wang /*
213dbf9bfe6Sjack wang  * brief the data structure of SATA Completion Response
21425985edcSLucas De Marchi  * use to describe the sata task response (64 bytes)
215dbf9bfe6Sjack wang  */
216dbf9bfe6Sjack wang struct sata_completion_resp {
217dbf9bfe6Sjack wang 	__le32	tag;
218dbf9bfe6Sjack wang 	__le32	status;
219dbf9bfe6Sjack wang 	__le32	param;
220dbf9bfe6Sjack wang 	u32	sata_resp[12];
221dbf9bfe6Sjack wang } __attribute__((packed, aligned(4)));
222dbf9bfe6Sjack wang 
223dbf9bfe6Sjack wang 
224dbf9bfe6Sjack wang /*
225dbf9bfe6Sjack wang  * brief the data structure of SAS HW Event Notification
226dbf9bfe6Sjack wang  * use to alert the host about the hardware event(64 bytes)
227dbf9bfe6Sjack wang  */
228dbf9bfe6Sjack wang struct hw_event_resp {
229dbf9bfe6Sjack wang 	__le32	lr_evt_status_phyid_portid;
230dbf9bfe6Sjack wang 	__le32	evt_param;
231dbf9bfe6Sjack wang 	__le32	npip_portstate;
232dbf9bfe6Sjack wang 	struct sas_identify_frame	sas_identify;
233dbf9bfe6Sjack wang 	struct dev_to_host_fis	sata_fis;
234dbf9bfe6Sjack wang } __attribute__((packed, aligned(4)));
235dbf9bfe6Sjack wang 
236dbf9bfe6Sjack wang 
237dbf9bfe6Sjack wang /*
238dbf9bfe6Sjack wang  * brief the data structure of  REGISTER DEVICE Command
239dbf9bfe6Sjack wang  * use to describe MPI REGISTER DEVICE Command (64 bytes)
240dbf9bfe6Sjack wang  */
241dbf9bfe6Sjack wang 
242dbf9bfe6Sjack wang struct reg_dev_req {
243dbf9bfe6Sjack wang 	__le32	tag;
244dbf9bfe6Sjack wang 	__le32	phyid_portid;
245dbf9bfe6Sjack wang 	__le32	dtype_dlr_retry;
246dbf9bfe6Sjack wang 	__le32	firstburstsize_ITNexustimeout;
247afc5ca9dSjack wang 	u8	sas_addr[SAS_ADDR_SIZE];
248dbf9bfe6Sjack wang 	__le32	upper_device_id;
249dbf9bfe6Sjack wang 	u32	reserved[8];
250dbf9bfe6Sjack wang } __attribute__((packed, aligned(4)));
251dbf9bfe6Sjack wang 
252dbf9bfe6Sjack wang 
253dbf9bfe6Sjack wang /*
254dbf9bfe6Sjack wang  * brief the data structure of  DEREGISTER DEVICE Command
255dbf9bfe6Sjack wang  * use to request spc to remove all internal resources associated
256dbf9bfe6Sjack wang  * with the device id (64 bytes)
257dbf9bfe6Sjack wang  */
258dbf9bfe6Sjack wang 
259dbf9bfe6Sjack wang struct dereg_dev_req {
260dbf9bfe6Sjack wang 	__le32	tag;
261dbf9bfe6Sjack wang 	__le32	device_id;
262dbf9bfe6Sjack wang 	u32	reserved[13];
263dbf9bfe6Sjack wang } __attribute__((packed, aligned(4)));
264dbf9bfe6Sjack wang 
265dbf9bfe6Sjack wang 
266dbf9bfe6Sjack wang /*
267dbf9bfe6Sjack wang  * brief the data structure of DEVICE_REGISTRATION Response
268dbf9bfe6Sjack wang  * use to notify the completion of the device registration  (64 bytes)
269dbf9bfe6Sjack wang  */
270dbf9bfe6Sjack wang 
271dbf9bfe6Sjack wang struct dev_reg_resp {
272dbf9bfe6Sjack wang 	__le32	tag;
273dbf9bfe6Sjack wang 	__le32	status;
274dbf9bfe6Sjack wang 	__le32	device_id;
275dbf9bfe6Sjack wang 	u32	reserved[12];
276dbf9bfe6Sjack wang } __attribute__((packed, aligned(4)));
277dbf9bfe6Sjack wang 
278dbf9bfe6Sjack wang 
279dbf9bfe6Sjack wang /*
280dbf9bfe6Sjack wang  * brief the data structure of Local PHY Control Command
281dbf9bfe6Sjack wang  * use to issue PHY CONTROL to local phy (64 bytes)
282dbf9bfe6Sjack wang  */
283dbf9bfe6Sjack wang struct local_phy_ctl_req {
284dbf9bfe6Sjack wang 	__le32	tag;
285dbf9bfe6Sjack wang 	__le32	phyop_phyid;
286dbf9bfe6Sjack wang 	u32	reserved1[13];
287dbf9bfe6Sjack wang } __attribute__((packed, aligned(4)));
288dbf9bfe6Sjack wang 
289dbf9bfe6Sjack wang 
290dbf9bfe6Sjack wang /**
291dbf9bfe6Sjack wang  * brief the data structure of Local Phy Control Response
292dbf9bfe6Sjack wang  * use to describe MPI Local Phy Control Response (64 bytes)
293dbf9bfe6Sjack wang  */
294dbf9bfe6Sjack wang struct local_phy_ctl_resp {
295dbf9bfe6Sjack wang 	__le32	tag;
296dbf9bfe6Sjack wang 	__le32	phyop_phyid;
297dbf9bfe6Sjack wang 	__le32	status;
298dbf9bfe6Sjack wang 	u32	reserved[12];
299dbf9bfe6Sjack wang } __attribute__((packed, aligned(4)));
300dbf9bfe6Sjack wang 
301dbf9bfe6Sjack wang 
302dbf9bfe6Sjack wang #define OP_BITS 0x0000FF00
303f5860992SSakthivel K #define ID_BITS 0x000000FF
304dbf9bfe6Sjack wang 
305dbf9bfe6Sjack wang /*
306dbf9bfe6Sjack wang  * brief the data structure of PORT Control Command
307dbf9bfe6Sjack wang  * use to control port properties (64 bytes)
308dbf9bfe6Sjack wang  */
309dbf9bfe6Sjack wang 
310dbf9bfe6Sjack wang struct port_ctl_req {
311dbf9bfe6Sjack wang 	__le32	tag;
312dbf9bfe6Sjack wang 	__le32	portop_portid;
313dbf9bfe6Sjack wang 	__le32	param0;
314dbf9bfe6Sjack wang 	__le32	param1;
315dbf9bfe6Sjack wang 	u32	reserved1[11];
316dbf9bfe6Sjack wang } __attribute__((packed, aligned(4)));
317dbf9bfe6Sjack wang 
318dbf9bfe6Sjack wang 
319dbf9bfe6Sjack wang /*
320dbf9bfe6Sjack wang  * brief the data structure of HW Event Ack Command
321dbf9bfe6Sjack wang  * use to acknowledge receive HW event (64 bytes)
322dbf9bfe6Sjack wang  */
323dbf9bfe6Sjack wang 
324dbf9bfe6Sjack wang struct hw_event_ack_req {
325dbf9bfe6Sjack wang 	__le32	tag;
326dbf9bfe6Sjack wang 	__le32	sea_phyid_portid;
327dbf9bfe6Sjack wang 	__le32	param0;
328dbf9bfe6Sjack wang 	__le32	param1;
329dbf9bfe6Sjack wang 	u32	reserved1[11];
330dbf9bfe6Sjack wang } __attribute__((packed, aligned(4)));
331dbf9bfe6Sjack wang 
332dbf9bfe6Sjack wang 
333dbf9bfe6Sjack wang /*
334dbf9bfe6Sjack wang  * brief the data structure of SSP Completion Response
335dbf9bfe6Sjack wang  * use to indicate a SSP Completion  (n bytes)
336dbf9bfe6Sjack wang  */
337dbf9bfe6Sjack wang struct ssp_completion_resp {
338dbf9bfe6Sjack wang 	__le32	tag;
339dbf9bfe6Sjack wang 	__le32	status;
340dbf9bfe6Sjack wang 	__le32	param;
341dbf9bfe6Sjack wang 	__le32	ssptag_rescv_rescpad;
342dbf9bfe6Sjack wang 	struct ssp_response_iu  ssp_resp_iu;
343dbf9bfe6Sjack wang 	__le32	residual_count;
344dbf9bfe6Sjack wang } __attribute__((packed, aligned(4)));
345dbf9bfe6Sjack wang 
346dbf9bfe6Sjack wang 
347dbf9bfe6Sjack wang #define SSP_RESCV_BIT	0x00010000
348dbf9bfe6Sjack wang 
349dbf9bfe6Sjack wang /*
350dbf9bfe6Sjack wang  * brief the data structure of SATA EVNET esponse
351dbf9bfe6Sjack wang  * use to indicate a SATA Completion  (64 bytes)
352dbf9bfe6Sjack wang  */
353dbf9bfe6Sjack wang 
354dbf9bfe6Sjack wang struct sata_event_resp {
355dbf9bfe6Sjack wang 	__le32	tag;
356dbf9bfe6Sjack wang 	__le32	event;
357dbf9bfe6Sjack wang 	__le32	port_id;
358dbf9bfe6Sjack wang 	__le32	device_id;
359dbf9bfe6Sjack wang 	u32	reserved[11];
360dbf9bfe6Sjack wang } __attribute__((packed, aligned(4)));
361dbf9bfe6Sjack wang 
362dbf9bfe6Sjack wang /*
363dbf9bfe6Sjack wang  * brief the data structure of SSP EVNET esponse
364dbf9bfe6Sjack wang  * use to indicate a SSP Completion  (64 bytes)
365dbf9bfe6Sjack wang  */
366dbf9bfe6Sjack wang 
367dbf9bfe6Sjack wang struct ssp_event_resp {
368dbf9bfe6Sjack wang 	__le32	tag;
369dbf9bfe6Sjack wang 	__le32	event;
370dbf9bfe6Sjack wang 	__le32	port_id;
371dbf9bfe6Sjack wang 	__le32	device_id;
372dbf9bfe6Sjack wang 	u32	reserved[11];
373dbf9bfe6Sjack wang } __attribute__((packed, aligned(4)));
374dbf9bfe6Sjack wang 
375dbf9bfe6Sjack wang /**
376dbf9bfe6Sjack wang  * brief the data structure of General Event Notification Response
377dbf9bfe6Sjack wang  * use to describe MPI General Event Notification Response (64 bytes)
378dbf9bfe6Sjack wang  */
379dbf9bfe6Sjack wang struct general_event_resp {
380dbf9bfe6Sjack wang 	__le32	status;
381dbf9bfe6Sjack wang 	__le32	inb_IOMB_payload[14];
382dbf9bfe6Sjack wang } __attribute__((packed, aligned(4)));
383dbf9bfe6Sjack wang 
384dbf9bfe6Sjack wang 
385dbf9bfe6Sjack wang #define GENERAL_EVENT_PAYLOAD	14
386dbf9bfe6Sjack wang #define OPCODE_BITS	0x00000fff
387dbf9bfe6Sjack wang 
388dbf9bfe6Sjack wang /*
389dbf9bfe6Sjack wang  * brief the data structure of SMP Request Command
390dbf9bfe6Sjack wang  * use to describe MPI SMP REQUEST Command (64 bytes)
391dbf9bfe6Sjack wang  */
392dbf9bfe6Sjack wang struct smp_req {
393dbf9bfe6Sjack wang 	__le32	tag;
394dbf9bfe6Sjack wang 	__le32	device_id;
395dbf9bfe6Sjack wang 	__le32	len_ip_ir;
396dbf9bfe6Sjack wang 	/* Bits [0]  - Indirect response */
397dbf9bfe6Sjack wang 	/* Bits [1] - Indirect Payload */
398dbf9bfe6Sjack wang 	/* Bits [15:2] - Reserved */
399dbf9bfe6Sjack wang 	/* Bits [23:16] - direct payload Len */
400dbf9bfe6Sjack wang 	/* Bits [31:24] - Reserved */
401dbf9bfe6Sjack wang 	u8	smp_req16[16];
402dbf9bfe6Sjack wang 	union {
403dbf9bfe6Sjack wang 		u8	smp_req[32];
404dbf9bfe6Sjack wang 		struct {
405dbf9bfe6Sjack wang 			__le64 long_req_addr;/* sg dma address, LE */
406dbf9bfe6Sjack wang 			__le32 long_req_size;/* LE */
407dbf9bfe6Sjack wang 			u32	_r_a;
408dbf9bfe6Sjack wang 			__le64 long_resp_addr;/* sg dma address, LE */
409dbf9bfe6Sjack wang 			__le32 long_resp_size;/* LE */
410dbf9bfe6Sjack wang 			u32	_r_b;
411dbf9bfe6Sjack wang 			} long_smp_req;/* sequencer extension */
412dbf9bfe6Sjack wang 	};
413dbf9bfe6Sjack wang } __attribute__((packed, aligned(4)));
414dbf9bfe6Sjack wang /*
415dbf9bfe6Sjack wang  * brief the data structure of SMP Completion Response
416dbf9bfe6Sjack wang  * use to describe MPI SMP Completion Response (64 bytes)
417dbf9bfe6Sjack wang  */
418dbf9bfe6Sjack wang struct smp_completion_resp {
419dbf9bfe6Sjack wang 	__le32	tag;
420dbf9bfe6Sjack wang 	__le32	status;
421dbf9bfe6Sjack wang 	__le32	param;
422dbf9bfe6Sjack wang 	__le32	_r_a[12];
423dbf9bfe6Sjack wang } __attribute__((packed, aligned(4)));
424dbf9bfe6Sjack wang 
425dbf9bfe6Sjack wang /*
426dbf9bfe6Sjack wang  *brief the data structure of SSP SMP SATA Abort Command
427dbf9bfe6Sjack wang  * use to describe MPI SSP SMP & SATA Abort Command (64 bytes)
428dbf9bfe6Sjack wang  */
429dbf9bfe6Sjack wang struct task_abort_req {
430dbf9bfe6Sjack wang 	__le32	tag;
431dbf9bfe6Sjack wang 	__le32	device_id;
432dbf9bfe6Sjack wang 	__le32	tag_to_abort;
433dbf9bfe6Sjack wang 	__le32	abort_all;
434dbf9bfe6Sjack wang 	u32	reserved[11];
435dbf9bfe6Sjack wang } __attribute__((packed, aligned(4)));
436dbf9bfe6Sjack wang 
437dbf9bfe6Sjack wang /**
438dbf9bfe6Sjack wang  * brief the data structure of SSP SATA SMP Abort Response
439dbf9bfe6Sjack wang  * use to describe SSP SMP & SATA Abort Response ( 64 bytes)
440dbf9bfe6Sjack wang  */
441dbf9bfe6Sjack wang struct task_abort_resp {
442dbf9bfe6Sjack wang 	__le32	tag;
443dbf9bfe6Sjack wang 	__le32	status;
444dbf9bfe6Sjack wang 	__le32	scp;
445dbf9bfe6Sjack wang 	u32	reserved[12];
446dbf9bfe6Sjack wang } __attribute__((packed, aligned(4)));
447dbf9bfe6Sjack wang 
448dbf9bfe6Sjack wang 
449dbf9bfe6Sjack wang /**
450dbf9bfe6Sjack wang  * brief the data structure of SAS Diagnostic Start/End Command
451dbf9bfe6Sjack wang  * use to describe MPI SAS Diagnostic Start/End Command (64 bytes)
452dbf9bfe6Sjack wang  */
453dbf9bfe6Sjack wang struct sas_diag_start_end_req {
454dbf9bfe6Sjack wang 	__le32	tag;
455dbf9bfe6Sjack wang 	__le32	operation_phyid;
456dbf9bfe6Sjack wang 	u32	reserved[13];
457dbf9bfe6Sjack wang } __attribute__((packed, aligned(4)));
458dbf9bfe6Sjack wang 
459dbf9bfe6Sjack wang 
460dbf9bfe6Sjack wang /**
461dbf9bfe6Sjack wang  * brief the data structure of SAS Diagnostic Execute Command
462dbf9bfe6Sjack wang  * use to describe MPI SAS Diagnostic Execute Command (64 bytes)
463dbf9bfe6Sjack wang  */
464dbf9bfe6Sjack wang struct sas_diag_execute_req{
465dbf9bfe6Sjack wang 	__le32	tag;
466dbf9bfe6Sjack wang 	__le32	cmdtype_cmddesc_phyid;
467dbf9bfe6Sjack wang 	__le32	pat1_pat2;
468dbf9bfe6Sjack wang 	__le32	threshold;
469dbf9bfe6Sjack wang 	__le32	codepat_errmsk;
470dbf9bfe6Sjack wang 	__le32	pmon;
471dbf9bfe6Sjack wang 	__le32	pERF1CTL;
472dbf9bfe6Sjack wang 	u32	reserved[8];
473dbf9bfe6Sjack wang } __attribute__((packed, aligned(4)));
474dbf9bfe6Sjack wang 
475dbf9bfe6Sjack wang 
476dbf9bfe6Sjack wang #define SAS_DIAG_PARAM_BYTES 24
477dbf9bfe6Sjack wang 
478dbf9bfe6Sjack wang /*
479dbf9bfe6Sjack wang  * brief the data structure of Set Device State Command
480dbf9bfe6Sjack wang  * use to describe MPI Set Device State Command (64 bytes)
481dbf9bfe6Sjack wang  */
482dbf9bfe6Sjack wang struct set_dev_state_req {
483dbf9bfe6Sjack wang 	__le32	tag;
484dbf9bfe6Sjack wang 	__le32	device_id;
485dbf9bfe6Sjack wang 	__le32	nds;
486dbf9bfe6Sjack wang 	u32	reserved[12];
487dbf9bfe6Sjack wang } __attribute__((packed, aligned(4)));
488dbf9bfe6Sjack wang 
489d0b68041Sjack_wang /*
490d0b68041Sjack_wang  * brief the data structure of sas_re_initialization
491d0b68041Sjack_wang  */
492d0b68041Sjack_wang struct sas_re_initialization_req {
493d0b68041Sjack_wang 
494d0b68041Sjack_wang 	__le32	tag;
495d0b68041Sjack_wang 	__le32	SSAHOLT;/* bit29-set max port;
496d0b68041Sjack_wang 			** bit28-set open reject cmd retries.
497d0b68041Sjack_wang 			** bit27-set open reject data retries.
498d0b68041Sjack_wang 			** bit26-set open reject option, remap:1 or not:0.
499d0b68041Sjack_wang 			** bit25-set sata head of line time out.
500d0b68041Sjack_wang 			*/
501d0b68041Sjack_wang 	__le32 reserved_maxPorts;
502d0b68041Sjack_wang 	__le32 open_reject_cmdretries_data_retries;/* cmd retries: 31-bit16;
503d0b68041Sjack_wang 						    * data retries: bit15-bit0.
504d0b68041Sjack_wang 						    */
505d0b68041Sjack_wang 	__le32	sata_hol_tmo;
506d0b68041Sjack_wang 	u32	reserved1[10];
507d0b68041Sjack_wang } __attribute__((packed, aligned(4)));
508dbf9bfe6Sjack wang 
509dbf9bfe6Sjack wang /*
510dbf9bfe6Sjack wang  * brief the data structure of SATA Start Command
511dbf9bfe6Sjack wang  * use to describe MPI SATA IO Start Command (64 bytes)
512dbf9bfe6Sjack wang  */
513dbf9bfe6Sjack wang 
514dbf9bfe6Sjack wang struct sata_start_req {
515dbf9bfe6Sjack wang 	__le32	tag;
516dbf9bfe6Sjack wang 	__le32	device_id;
517dbf9bfe6Sjack wang 	__le32	data_len;
518*54543295SIgor Pylypiv 	__le32	retfis_ncqtag_atap_dir_m;
519dbf9bfe6Sjack wang 	struct host_to_dev_fis	sata_fis;
520dbf9bfe6Sjack wang 	u32	reserved1;
521dbf9bfe6Sjack wang 	u32	reserved2;
522dbf9bfe6Sjack wang 	u32	addr_low;
523dbf9bfe6Sjack wang 	u32	addr_high;
524dbf9bfe6Sjack wang 	__le32	len;
525dbf9bfe6Sjack wang 	__le32	esgl;
526dbf9bfe6Sjack wang } __attribute__((packed, aligned(4)));
527dbf9bfe6Sjack wang 
528dbf9bfe6Sjack wang /**
529dbf9bfe6Sjack wang  * brief the data structure of SSP INI TM Start Command
530dbf9bfe6Sjack wang  * use to describe MPI SSP INI TM Start Command (64 bytes)
531dbf9bfe6Sjack wang  */
532dbf9bfe6Sjack wang struct ssp_ini_tm_start_req {
533dbf9bfe6Sjack wang 	__le32	tag;
534dbf9bfe6Sjack wang 	__le32	device_id;
535dbf9bfe6Sjack wang 	__le32	relate_tag;
536dbf9bfe6Sjack wang 	__le32	tmf;
537dbf9bfe6Sjack wang 	u8	lun[8];
538dbf9bfe6Sjack wang 	__le32	ds_ads_m;
539dbf9bfe6Sjack wang 	u32	reserved[8];
540dbf9bfe6Sjack wang } __attribute__((packed, aligned(4)));
541dbf9bfe6Sjack wang 
542dbf9bfe6Sjack wang 
543dbf9bfe6Sjack wang struct ssp_info_unit {
544dbf9bfe6Sjack wang 	u8	lun[8];/* SCSI Logical Unit Number */
545dbf9bfe6Sjack wang 	u8	reserved1;/* reserved */
546dbf9bfe6Sjack wang 	u8	efb_prio_attr;
547dbf9bfe6Sjack wang 	/* B7   : enabledFirstBurst */
548dbf9bfe6Sjack wang 	/* B6-3 : taskPriority */
549dbf9bfe6Sjack wang 	/* B2-0 : taskAttribute */
550dbf9bfe6Sjack wang 	u8	reserved2;	/* reserved */
551dbf9bfe6Sjack wang 	u8	additional_cdb_len;
552dbf9bfe6Sjack wang 	/* B7-2 : additional_cdb_len */
553dbf9bfe6Sjack wang 	/* B1-0 : reserved */
554dbf9bfe6Sjack wang 	u8	cdb[16];/* The SCSI CDB up to 16 bytes length */
555dbf9bfe6Sjack wang } __attribute__((packed, aligned(4)));
556dbf9bfe6Sjack wang 
557dbf9bfe6Sjack wang 
558dbf9bfe6Sjack wang /**
559dbf9bfe6Sjack wang  * brief the data structure of SSP INI IO Start Command
560dbf9bfe6Sjack wang  * use to describe MPI SSP INI IO Start Command (64 bytes)
561dbf9bfe6Sjack wang  */
562dbf9bfe6Sjack wang struct ssp_ini_io_start_req {
563dbf9bfe6Sjack wang 	__le32	tag;
564dbf9bfe6Sjack wang 	__le32	device_id;
565dbf9bfe6Sjack wang 	__le32	data_len;
566dbf9bfe6Sjack wang 	__le32	dir_m_tlr;
567dbf9bfe6Sjack wang 	struct ssp_info_unit	ssp_iu;
568dbf9bfe6Sjack wang 	__le32	addr_low;
569dbf9bfe6Sjack wang 	__le32	addr_high;
570dbf9bfe6Sjack wang 	__le32	len;
571dbf9bfe6Sjack wang 	__le32	esgl;
572dbf9bfe6Sjack wang } __attribute__((packed, aligned(4)));
573dbf9bfe6Sjack wang 
574dbf9bfe6Sjack wang 
575dbf9bfe6Sjack wang /**
576dbf9bfe6Sjack wang  * brief the data structure of Firmware download
577dbf9bfe6Sjack wang  * use to describe MPI FW DOWNLOAD Command (64 bytes)
578dbf9bfe6Sjack wang  */
579dbf9bfe6Sjack wang struct fw_flash_Update_req {
580dbf9bfe6Sjack wang 	__le32	tag;
581dbf9bfe6Sjack wang 	__le32	cur_image_offset;
582dbf9bfe6Sjack wang 	__le32	cur_image_len;
583dbf9bfe6Sjack wang 	__le32	total_image_len;
584dbf9bfe6Sjack wang 	u32	reserved0[7];
585dbf9bfe6Sjack wang 	__le32	sgl_addr_lo;
586dbf9bfe6Sjack wang 	__le32	sgl_addr_hi;
587dbf9bfe6Sjack wang 	__le32	len;
588dbf9bfe6Sjack wang 	__le32	ext_reserved;
589dbf9bfe6Sjack wang } __attribute__((packed, aligned(4)));
590dbf9bfe6Sjack wang 
591dbf9bfe6Sjack wang 
592dbf9bfe6Sjack wang #define FWFLASH_IOMB_RESERVED_LEN 0x07
593dbf9bfe6Sjack wang /**
594dbf9bfe6Sjack wang  * brief the data structure of FW_FLASH_UPDATE Response
595dbf9bfe6Sjack wang  * use to describe MPI FW_FLASH_UPDATE Response (64 bytes)
596dbf9bfe6Sjack wang  *
597dbf9bfe6Sjack wang  */
598dbf9bfe6Sjack wang struct fw_flash_Update_resp {
599fd00f7c1SSantosh Nayak 	__le32	tag;
600dbf9bfe6Sjack wang 	__le32	status;
601dbf9bfe6Sjack wang 	u32	reserved[13];
602dbf9bfe6Sjack wang } __attribute__((packed, aligned(4)));
603dbf9bfe6Sjack wang 
604dbf9bfe6Sjack wang 
605dbf9bfe6Sjack wang /**
606dbf9bfe6Sjack wang  * brief the data structure of Get NVM Data Command
607dbf9bfe6Sjack wang  * use to get data from NVM in HBA(64 bytes)
608dbf9bfe6Sjack wang  */
609dbf9bfe6Sjack wang struct get_nvm_data_req {
610dbf9bfe6Sjack wang 	__le32	tag;
611dbf9bfe6Sjack wang 	__le32	len_ir_vpdd;
612dbf9bfe6Sjack wang 	__le32	vpd_offset;
613dbf9bfe6Sjack wang 	u32	reserved[8];
614dbf9bfe6Sjack wang 	__le32	resp_addr_lo;
615dbf9bfe6Sjack wang 	__le32	resp_addr_hi;
616dbf9bfe6Sjack wang 	__le32	resp_len;
617dbf9bfe6Sjack wang 	u32	reserved1;
618dbf9bfe6Sjack wang } __attribute__((packed, aligned(4)));
619dbf9bfe6Sjack wang 
620dbf9bfe6Sjack wang 
621dbf9bfe6Sjack wang struct set_nvm_data_req {
622dbf9bfe6Sjack wang 	__le32	tag;
623dbf9bfe6Sjack wang 	__le32	len_ir_vpdd;
624dbf9bfe6Sjack wang 	__le32	vpd_offset;
6258270ee2aSSantosh Nayak 	__le32	reserved[8];
626dbf9bfe6Sjack wang 	__le32	resp_addr_lo;
627dbf9bfe6Sjack wang 	__le32	resp_addr_hi;
628dbf9bfe6Sjack wang 	__le32	resp_len;
629dbf9bfe6Sjack wang 	u32	reserved1;
630dbf9bfe6Sjack wang } __attribute__((packed, aligned(4)));
631dbf9bfe6Sjack wang 
632dbf9bfe6Sjack wang 
633dbf9bfe6Sjack wang #define TWI_DEVICE	0x0
634dbf9bfe6Sjack wang #define C_SEEPROM	0x1
635dbf9bfe6Sjack wang #define VPD_FLASH	0x4
636dbf9bfe6Sjack wang #define AAP1_RDUMP	0x5
637dbf9bfe6Sjack wang #define IOP_RDUMP	0x6
638dbf9bfe6Sjack wang #define EXPAN_ROM	0x7
639dbf9bfe6Sjack wang 
640dbf9bfe6Sjack wang #define IPMode		0x80000000
641dbf9bfe6Sjack wang #define NVMD_TYPE	0x0000000F
642dbf9bfe6Sjack wang #define NVMD_STAT	0x0000FFFF
643dbf9bfe6Sjack wang #define NVMD_LEN	0xFF000000
644dbf9bfe6Sjack wang /**
645dbf9bfe6Sjack wang  * brief the data structure of Get NVMD Data Response
646dbf9bfe6Sjack wang  * use to describe MPI Get NVMD Data Response (64 bytes)
647dbf9bfe6Sjack wang  */
648dbf9bfe6Sjack wang struct get_nvm_data_resp {
649dbf9bfe6Sjack wang 	__le32		tag;
650dbf9bfe6Sjack wang 	__le32		ir_tda_bn_dps_das_nvm;
651dbf9bfe6Sjack wang 	__le32		dlen_status;
652dbf9bfe6Sjack wang 	__le32		nvm_data[12];
653dbf9bfe6Sjack wang } __attribute__((packed, aligned(4)));
654dbf9bfe6Sjack wang 
655dbf9bfe6Sjack wang 
656dbf9bfe6Sjack wang /**
657dbf9bfe6Sjack wang  * brief the data structure of SAS Diagnostic Start/End Response
658dbf9bfe6Sjack wang  * use to describe MPI SAS Diagnostic Start/End Response (64 bytes)
659dbf9bfe6Sjack wang  *
660dbf9bfe6Sjack wang  */
661dbf9bfe6Sjack wang struct sas_diag_start_end_resp {
662dbf9bfe6Sjack wang 	__le32		tag;
663dbf9bfe6Sjack wang 	__le32		status;
664dbf9bfe6Sjack wang 	u32		reserved[13];
665dbf9bfe6Sjack wang } __attribute__((packed, aligned(4)));
666dbf9bfe6Sjack wang 
667dbf9bfe6Sjack wang 
668dbf9bfe6Sjack wang /**
669dbf9bfe6Sjack wang  * brief the data structure of SAS Diagnostic Execute Response
670dbf9bfe6Sjack wang  * use to describe MPI SAS Diagnostic Execute Response (64 bytes)
671dbf9bfe6Sjack wang  *
672dbf9bfe6Sjack wang  */
673dbf9bfe6Sjack wang struct sas_diag_execute_resp {
674dbf9bfe6Sjack wang 	__le32		tag;
675dbf9bfe6Sjack wang 	__le32		cmdtype_cmddesc_phyid;
676dbf9bfe6Sjack wang 	__le32		Status;
677dbf9bfe6Sjack wang 	__le32		ReportData;
678dbf9bfe6Sjack wang 	u32		reserved[11];
679dbf9bfe6Sjack wang } __attribute__((packed, aligned(4)));
680dbf9bfe6Sjack wang 
681dbf9bfe6Sjack wang 
682dbf9bfe6Sjack wang /**
683dbf9bfe6Sjack wang  * brief the data structure of Set Device State Response
684dbf9bfe6Sjack wang  * use to describe MPI Set Device State Response (64 bytes)
685dbf9bfe6Sjack wang  *
686dbf9bfe6Sjack wang  */
687dbf9bfe6Sjack wang struct set_dev_state_resp {
688dbf9bfe6Sjack wang 	__le32		tag;
689dbf9bfe6Sjack wang 	__le32		status;
690dbf9bfe6Sjack wang 	__le32		device_id;
691dbf9bfe6Sjack wang 	__le32		pds_nds;
692dbf9bfe6Sjack wang 	u32		reserved[11];
693dbf9bfe6Sjack wang } __attribute__((packed, aligned(4)));
694dbf9bfe6Sjack wang 
695dbf9bfe6Sjack wang 
696dbf9bfe6Sjack wang #define NDS_BITS 0x0F
697dbf9bfe6Sjack wang #define PDS_BITS 0xF0
698dbf9bfe6Sjack wang 
699dbf9bfe6Sjack wang /*
700dbf9bfe6Sjack wang  * HW Events type
701dbf9bfe6Sjack wang  */
702dbf9bfe6Sjack wang 
703dbf9bfe6Sjack wang #define HW_EVENT_RESET_START			0x01
704dbf9bfe6Sjack wang #define HW_EVENT_CHIP_RESET_COMPLETE		0x02
705dbf9bfe6Sjack wang #define HW_EVENT_PHY_STOP_STATUS		0x03
706dbf9bfe6Sjack wang #define HW_EVENT_SAS_PHY_UP			0x04
707dbf9bfe6Sjack wang #define HW_EVENT_SATA_PHY_UP			0x05
708dbf9bfe6Sjack wang #define HW_EVENT_SATA_SPINUP_HOLD		0x06
709dbf9bfe6Sjack wang #define HW_EVENT_PHY_DOWN			0x07
710dbf9bfe6Sjack wang #define HW_EVENT_PORT_INVALID			0x08
711dbf9bfe6Sjack wang #define HW_EVENT_BROADCAST_CHANGE		0x09
712dbf9bfe6Sjack wang #define HW_EVENT_PHY_ERROR			0x0A
713dbf9bfe6Sjack wang #define HW_EVENT_BROADCAST_SES			0x0B
714dbf9bfe6Sjack wang #define HW_EVENT_INBOUND_CRC_ERROR		0x0C
715dbf9bfe6Sjack wang #define HW_EVENT_HARD_RESET_RECEIVED		0x0D
716dbf9bfe6Sjack wang #define HW_EVENT_MALFUNCTION			0x0E
717dbf9bfe6Sjack wang #define HW_EVENT_ID_FRAME_TIMEOUT		0x0F
718dbf9bfe6Sjack wang #define HW_EVENT_BROADCAST_EXP			0x10
719dbf9bfe6Sjack wang #define HW_EVENT_PHY_START_STATUS		0x11
720dbf9bfe6Sjack wang #define HW_EVENT_LINK_ERR_INVALID_DWORD		0x12
721dbf9bfe6Sjack wang #define HW_EVENT_LINK_ERR_DISPARITY_ERROR	0x13
722dbf9bfe6Sjack wang #define HW_EVENT_LINK_ERR_CODE_VIOLATION	0x14
723dbf9bfe6Sjack wang #define HW_EVENT_LINK_ERR_LOSS_OF_DWORD_SYNCH	0x15
724dbf9bfe6Sjack wang #define HW_EVENT_LINK_ERR_PHY_RESET_FAILED	0x16
725dbf9bfe6Sjack wang #define HW_EVENT_PORT_RECOVERY_TIMER_TMO	0x17
726dbf9bfe6Sjack wang #define HW_EVENT_PORT_RECOVER			0x18
727dbf9bfe6Sjack wang #define HW_EVENT_PORT_RESET_TIMER_TMO		0x19
728dbf9bfe6Sjack wang #define HW_EVENT_PORT_RESET_COMPLETE		0x20
729dbf9bfe6Sjack wang #define EVENT_BROADCAST_ASYNCH_EVENT		0x21
730dbf9bfe6Sjack wang 
731dbf9bfe6Sjack wang /* port state */
732dbf9bfe6Sjack wang #define PORT_NOT_ESTABLISHED			0x00
733dbf9bfe6Sjack wang #define PORT_VALID				0x01
734dbf9bfe6Sjack wang #define PORT_LOSTCOMM				0x02
735dbf9bfe6Sjack wang #define PORT_IN_RESET				0x04
736dbf9bfe6Sjack wang #define PORT_INVALID				0x08
737dbf9bfe6Sjack wang 
738dbf9bfe6Sjack wang /*
739dbf9bfe6Sjack wang  * SSP/SMP/SATA IO Completion Status values
740dbf9bfe6Sjack wang  */
741dbf9bfe6Sjack wang 
742dbf9bfe6Sjack wang #define IO_SUCCESS				0x00
743dbf9bfe6Sjack wang #define IO_ABORTED				0x01
744dbf9bfe6Sjack wang #define IO_OVERFLOW				0x02
745dbf9bfe6Sjack wang #define IO_UNDERFLOW				0x03
746dbf9bfe6Sjack wang #define IO_FAILED				0x04
747dbf9bfe6Sjack wang #define IO_ABORT_RESET				0x05
748dbf9bfe6Sjack wang #define IO_NOT_VALID				0x06
749dbf9bfe6Sjack wang #define IO_NO_DEVICE				0x07
750dbf9bfe6Sjack wang #define IO_ILLEGAL_PARAMETER			0x08
751dbf9bfe6Sjack wang #define IO_LINK_FAILURE				0x09
752dbf9bfe6Sjack wang #define IO_PROG_ERROR				0x0A
753dbf9bfe6Sjack wang #define IO_EDC_IN_ERROR				0x0B
754dbf9bfe6Sjack wang #define IO_EDC_OUT_ERROR			0x0C
755dbf9bfe6Sjack wang #define IO_ERROR_HW_TIMEOUT			0x0D
756dbf9bfe6Sjack wang #define IO_XFER_ERROR_BREAK			0x0E
757dbf9bfe6Sjack wang #define IO_XFER_ERROR_PHY_NOT_READY		0x0F
758dbf9bfe6Sjack wang #define IO_OPEN_CNX_ERROR_PROTOCOL_NOT_SUPPORTED	0x10
759dbf9bfe6Sjack wang #define IO_OPEN_CNX_ERROR_ZONE_VIOLATION		0x11
760dbf9bfe6Sjack wang #define IO_OPEN_CNX_ERROR_BREAK				0x12
761dbf9bfe6Sjack wang #define IO_OPEN_CNX_ERROR_IT_NEXUS_LOSS			0x13
762dbf9bfe6Sjack wang #define IO_OPEN_CNX_ERROR_BAD_DESTINATION		0x14
763dbf9bfe6Sjack wang #define IO_OPEN_CNX_ERROR_CONNECTION_RATE_NOT_SUPPORTED	0x15
764dbf9bfe6Sjack wang #define IO_OPEN_CNX_ERROR_STP_RESOURCES_BUSY		0x16
765dbf9bfe6Sjack wang #define IO_OPEN_CNX_ERROR_WRONG_DESTINATION		0x17
766dbf9bfe6Sjack wang #define IO_OPEN_CNX_ERROR_UNKNOWN_ERROR			0x18
767dbf9bfe6Sjack wang #define IO_XFER_ERROR_NAK_RECEIVED			0x19
768dbf9bfe6Sjack wang #define IO_XFER_ERROR_ACK_NAK_TIMEOUT			0x1A
769dbf9bfe6Sjack wang #define IO_XFER_ERROR_PEER_ABORTED			0x1B
770dbf9bfe6Sjack wang #define IO_XFER_ERROR_RX_FRAME				0x1C
771dbf9bfe6Sjack wang #define IO_XFER_ERROR_DMA				0x1D
772dbf9bfe6Sjack wang #define IO_XFER_ERROR_CREDIT_TIMEOUT			0x1E
773dbf9bfe6Sjack wang #define IO_XFER_ERROR_SATA_LINK_TIMEOUT			0x1F
774dbf9bfe6Sjack wang #define IO_XFER_ERROR_SATA				0x20
775dbf9bfe6Sjack wang #define IO_XFER_ERROR_ABORTED_DUE_TO_SRST		0x22
776dbf9bfe6Sjack wang #define IO_XFER_ERROR_REJECTED_NCQ_MODE			0x21
777dbf9bfe6Sjack wang #define IO_XFER_ERROR_ABORTED_NCQ_MODE			0x23
778dbf9bfe6Sjack wang #define IO_XFER_OPEN_RETRY_TIMEOUT			0x24
779dbf9bfe6Sjack wang #define IO_XFER_SMP_RESP_CONNECTION_ERROR		0x25
780dbf9bfe6Sjack wang #define IO_XFER_ERROR_UNEXPECTED_PHASE			0x26
781dbf9bfe6Sjack wang #define IO_XFER_ERROR_XFER_RDY_OVERRUN			0x27
782dbf9bfe6Sjack wang #define IO_XFER_ERROR_XFER_RDY_NOT_EXPECTED		0x28
783dbf9bfe6Sjack wang 
784dbf9bfe6Sjack wang #define IO_XFER_ERROR_CMD_ISSUE_ACK_NAK_TIMEOUT		0x30
785dbf9bfe6Sjack wang #define IO_XFER_ERROR_CMD_ISSUE_BREAK_BEFORE_ACK_NAK	0x31
786dbf9bfe6Sjack wang #define IO_XFER_ERROR_CMD_ISSUE_PHY_DOWN_BEFORE_ACK_NAK	0x32
787dbf9bfe6Sjack wang 
788dbf9bfe6Sjack wang #define IO_XFER_ERROR_OFFSET_MISMATCH			0x34
789dbf9bfe6Sjack wang #define IO_XFER_ERROR_XFER_ZERO_DATA_LEN		0x35
790dbf9bfe6Sjack wang #define IO_XFER_CMD_FRAME_ISSUED			0x36
791dbf9bfe6Sjack wang #define IO_ERROR_INTERNAL_SMP_RESOURCE			0x37
792dbf9bfe6Sjack wang #define IO_PORT_IN_RESET				0x38
793dbf9bfe6Sjack wang #define IO_DS_NON_OPERATIONAL				0x39
794dbf9bfe6Sjack wang #define IO_DS_IN_RECOVERY				0x3A
795dbf9bfe6Sjack wang #define IO_TM_TAG_NOT_FOUND				0x3B
796dbf9bfe6Sjack wang #define IO_XFER_PIO_SETUP_ERROR				0x3C
797dbf9bfe6Sjack wang #define IO_SSP_EXT_IU_ZERO_LEN_ERROR			0x3D
798dbf9bfe6Sjack wang #define IO_DS_IN_ERROR					0x3E
799dbf9bfe6Sjack wang #define IO_OPEN_CNX_ERROR_HW_RESOURCE_BUSY		0x3F
800dbf9bfe6Sjack wang #define IO_ABORT_IN_PROGRESS				0x40
801dbf9bfe6Sjack wang #define IO_ABORT_DELAYED				0x41
802dbf9bfe6Sjack wang #define IO_INVALID_LENGTH				0x42
8034f5deeb4SRuksar Devadi #define IO_FATAL_ERROR					0x51
804dbf9bfe6Sjack wang 
805dbf9bfe6Sjack wang /* WARNING: This error code must always be the last number.
806dbf9bfe6Sjack wang  * If you add error code, modify this code also
807dbf9bfe6Sjack wang  * It is used as an index
808dbf9bfe6Sjack wang  */
809dbf9bfe6Sjack wang #define IO_ERROR_UNKNOWN_GENERIC			0x43
810dbf9bfe6Sjack wang 
811dbf9bfe6Sjack wang /* MSGU CONFIGURATION  TABLE*/
812dbf9bfe6Sjack wang 
813dbf9bfe6Sjack wang #define SPC_MSGU_CFG_TABLE_UPDATE		0x01/* Inbound doorbell bit0 */
814dbf9bfe6Sjack wang #define SPC_MSGU_CFG_TABLE_RESET		0x02/* Inbound doorbell bit1 */
815dbf9bfe6Sjack wang #define SPC_MSGU_CFG_TABLE_FREEZE		0x04/* Inbound doorbell bit2 */
816dbf9bfe6Sjack wang #define SPC_MSGU_CFG_TABLE_UNFREEZE		0x08/* Inbound doorbell bit4 */
817dbf9bfe6Sjack wang #define MSGU_IBDB_SET				0x04
818dbf9bfe6Sjack wang #define MSGU_HOST_INT_STATUS			0x08
819dbf9bfe6Sjack wang #define MSGU_HOST_INT_MASK			0x0C
820dbf9bfe6Sjack wang #define MSGU_IOPIB_INT_STATUS			0x18
821dbf9bfe6Sjack wang #define MSGU_IOPIB_INT_MASK			0x1C
822dbf9bfe6Sjack wang #define MSGU_IBDB_CLEAR				0x20/* RevB - Host not use */
823dbf9bfe6Sjack wang #define MSGU_MSGU_CONTROL			0x24
824dbf9bfe6Sjack wang #define MSGU_ODR				0x3C/* RevB */
825dbf9bfe6Sjack wang #define MSGU_ODCR				0x40/* RevB */
826dbf9bfe6Sjack wang #define MSGU_SCRATCH_PAD_0			0x44
827dbf9bfe6Sjack wang #define MSGU_SCRATCH_PAD_1			0x48
828dbf9bfe6Sjack wang #define MSGU_SCRATCH_PAD_2			0x4C
829dbf9bfe6Sjack wang #define MSGU_SCRATCH_PAD_3			0x50
830dbf9bfe6Sjack wang #define MSGU_HOST_SCRATCH_PAD_0			0x54
831dbf9bfe6Sjack wang #define MSGU_HOST_SCRATCH_PAD_1			0x58
832dbf9bfe6Sjack wang #define MSGU_HOST_SCRATCH_PAD_2			0x5C
833dbf9bfe6Sjack wang #define MSGU_HOST_SCRATCH_PAD_3			0x60
834dbf9bfe6Sjack wang #define MSGU_HOST_SCRATCH_PAD_4			0x64
835dbf9bfe6Sjack wang #define MSGU_HOST_SCRATCH_PAD_5			0x68
836dbf9bfe6Sjack wang #define MSGU_HOST_SCRATCH_PAD_6			0x6C
837dbf9bfe6Sjack wang #define MSGU_HOST_SCRATCH_PAD_7			0x70
838dbf9bfe6Sjack wang #define MSGU_ODMR				0x74/* RevB */
839dbf9bfe6Sjack wang 
840dbf9bfe6Sjack wang /* bit definition for ODMR register */
841dbf9bfe6Sjack wang #define ODMR_MASK_ALL				0xFFFFFFFF/* mask all
842dbf9bfe6Sjack wang 					interrupt vector */
843dbf9bfe6Sjack wang #define ODMR_CLEAR_ALL				0/* clear all
844dbf9bfe6Sjack wang 					interrupt vector */
845dbf9bfe6Sjack wang /* bit definition for ODCR register */
846dbf9bfe6Sjack wang #define ODCR_CLEAR_ALL		0xFFFFFFFF   /* mask all
847dbf9bfe6Sjack wang 					interrupt vector*/
848dbf9bfe6Sjack wang /* MSIX Interupts */
849dbf9bfe6Sjack wang #define MSIX_TABLE_OFFSET		0x2000
850dbf9bfe6Sjack wang #define MSIX_TABLE_ELEMENT_SIZE		0x10
851dbf9bfe6Sjack wang #define MSIX_INTERRUPT_CONTROL_OFFSET	0xC
852dbf9bfe6Sjack wang #define MSIX_TABLE_BASE	  (MSIX_TABLE_OFFSET + MSIX_INTERRUPT_CONTROL_OFFSET)
853dbf9bfe6Sjack wang #define MSIX_INTERRUPT_DISABLE		0x1
854dbf9bfe6Sjack wang #define MSIX_INTERRUPT_ENABLE		0x0
855dbf9bfe6Sjack wang 
856dbf9bfe6Sjack wang 
857dbf9bfe6Sjack wang /* state definition for Scratch Pad1 register */
858dbf9bfe6Sjack wang #define SCRATCH_PAD1_POR		0x00  /* power on reset state */
859dbf9bfe6Sjack wang #define SCRATCH_PAD1_SFR		0x01  /* soft reset state */
860dbf9bfe6Sjack wang #define SCRATCH_PAD1_ERR		0x02  /* error state */
861dbf9bfe6Sjack wang #define SCRATCH_PAD1_RDY		0x03  /* ready state */
862dbf9bfe6Sjack wang #define SCRATCH_PAD1_RST		0x04  /* soft reset toggle flag */
863dbf9bfe6Sjack wang #define SCRATCH_PAD1_AAP1RDY_RST	0x08  /* AAP1 ready for soft reset */
864dbf9bfe6Sjack wang #define SCRATCH_PAD1_STATE_MASK		0xFFFFFFF0   /* ScratchPad1
865dbf9bfe6Sjack wang  Mask, bit1-0 State, bit2 Soft Reset, bit3 FW RDY for Soft Reset */
866dbf9bfe6Sjack wang #define SCRATCH_PAD1_RESERVED		0x000003F8   /* Scratch Pad1
867dbf9bfe6Sjack wang  Reserved bit 3 to 9 */
868dbf9bfe6Sjack wang 
869dbf9bfe6Sjack wang  /* state definition for Scratch Pad2 register */
870dbf9bfe6Sjack wang #define SCRATCH_PAD2_POR		0x00  /* power on state */
871dbf9bfe6Sjack wang #define SCRATCH_PAD2_SFR		0x01  /* soft reset state */
872dbf9bfe6Sjack wang #define SCRATCH_PAD2_ERR		0x02  /* error state */
873dbf9bfe6Sjack wang #define SCRATCH_PAD2_RDY		0x03  /* ready state */
874dbf9bfe6Sjack wang #define SCRATCH_PAD2_FWRDY_RST		0x04  /* FW ready for soft reset flag*/
875dbf9bfe6Sjack wang #define SCRATCH_PAD2_IOPRDY_RST		0x08  /* IOP ready for soft reset */
876dbf9bfe6Sjack wang #define SCRATCH_PAD2_STATE_MASK		0xFFFFFFF4 /* ScratchPad 2
877dbf9bfe6Sjack wang  Mask, bit1-0 State */
878dbf9bfe6Sjack wang #define SCRATCH_PAD2_RESERVED		0x000003FC   /* Scratch Pad1
879dbf9bfe6Sjack wang  Reserved bit 2 to 9 */
880dbf9bfe6Sjack wang 
881dbf9bfe6Sjack wang #define SCRATCH_PAD_ERROR_MASK		0xFFFFFC00   /* Error mask bits */
882dbf9bfe6Sjack wang #define SCRATCH_PAD_STATE_MASK		0x00000003   /* State Mask bits */
883dbf9bfe6Sjack wang 
884dbf9bfe6Sjack wang /* main configuration offset - byte offset */
885dbf9bfe6Sjack wang #define MAIN_SIGNATURE_OFFSET		0x00/* DWORD 0x00 */
886dbf9bfe6Sjack wang #define MAIN_INTERFACE_REVISION		0x04/* DWORD 0x01 */
887dbf9bfe6Sjack wang #define MAIN_FW_REVISION		0x08/* DWORD 0x02 */
888dbf9bfe6Sjack wang #define MAIN_MAX_OUTSTANDING_IO_OFFSET	0x0C/* DWORD 0x03 */
889dbf9bfe6Sjack wang #define MAIN_MAX_SGL_OFFSET		0x10/* DWORD 0x04 */
890dbf9bfe6Sjack wang #define MAIN_CNTRL_CAP_OFFSET		0x14/* DWORD 0x05 */
891dbf9bfe6Sjack wang #define MAIN_GST_OFFSET			0x18/* DWORD 0x06 */
892dbf9bfe6Sjack wang #define MAIN_IBQ_OFFSET			0x1C/* DWORD 0x07 */
893dbf9bfe6Sjack wang #define MAIN_OBQ_OFFSET			0x20/* DWORD 0x08 */
894dbf9bfe6Sjack wang #define MAIN_IQNPPD_HPPD_OFFSET		0x24/* DWORD 0x09 */
895dbf9bfe6Sjack wang #define MAIN_OB_HW_EVENT_PID03_OFFSET	0x28/* DWORD 0x0A */
896dbf9bfe6Sjack wang #define MAIN_OB_HW_EVENT_PID47_OFFSET	0x2C/* DWORD 0x0B */
897dbf9bfe6Sjack wang #define MAIN_OB_NCQ_EVENT_PID03_OFFSET	0x30/* DWORD 0x0C */
898dbf9bfe6Sjack wang #define MAIN_OB_NCQ_EVENT_PID47_OFFSET	0x34/* DWORD 0x0D */
899dbf9bfe6Sjack wang #define MAIN_TITNX_EVENT_PID03_OFFSET	0x38/* DWORD 0x0E */
900dbf9bfe6Sjack wang #define MAIN_TITNX_EVENT_PID47_OFFSET	0x3C/* DWORD 0x0F */
901dbf9bfe6Sjack wang #define MAIN_OB_SSP_EVENT_PID03_OFFSET	0x40/* DWORD 0x10 */
902dbf9bfe6Sjack wang #define MAIN_OB_SSP_EVENT_PID47_OFFSET	0x44/* DWORD 0x11 */
903dbf9bfe6Sjack wang #define MAIN_OB_SMP_EVENT_PID03_OFFSET	0x48/* DWORD 0x12 */
904dbf9bfe6Sjack wang #define MAIN_OB_SMP_EVENT_PID47_OFFSET	0x4C/* DWORD 0x13 */
905dbf9bfe6Sjack wang #define MAIN_EVENT_LOG_ADDR_HI		0x50/* DWORD 0x14 */
906dbf9bfe6Sjack wang #define MAIN_EVENT_LOG_ADDR_LO		0x54/* DWORD 0x15 */
907dbf9bfe6Sjack wang #define MAIN_EVENT_LOG_BUFF_SIZE	0x58/* DWORD 0x16 */
908dbf9bfe6Sjack wang #define MAIN_EVENT_LOG_OPTION		0x5C/* DWORD 0x17 */
909dbf9bfe6Sjack wang #define MAIN_IOP_EVENT_LOG_ADDR_HI	0x60/* DWORD 0x18 */
910dbf9bfe6Sjack wang #define MAIN_IOP_EVENT_LOG_ADDR_LO	0x64/* DWORD 0x19 */
911dbf9bfe6Sjack wang #define MAIN_IOP_EVENT_LOG_BUFF_SIZE	0x68/* DWORD 0x1A */
912dbf9bfe6Sjack wang #define MAIN_IOP_EVENT_LOG_OPTION	0x6C/* DWORD 0x1B */
913dbf9bfe6Sjack wang #define MAIN_FATAL_ERROR_INTERRUPT	0x70/* DWORD 0x1C */
914dbf9bfe6Sjack wang #define MAIN_FATAL_ERROR_RDUMP0_OFFSET	0x74/* DWORD 0x1D */
915dbf9bfe6Sjack wang #define MAIN_FATAL_ERROR_RDUMP0_LENGTH	0x78/* DWORD 0x1E */
916dbf9bfe6Sjack wang #define MAIN_FATAL_ERROR_RDUMP1_OFFSET	0x7C/* DWORD 0x1F */
917dbf9bfe6Sjack wang #define MAIN_FATAL_ERROR_RDUMP1_LENGTH	0x80/* DWORD 0x20 */
918dbf9bfe6Sjack wang #define MAIN_HDA_FLAGS_OFFSET		0x84/* DWORD 0x21 */
919dbf9bfe6Sjack wang #define MAIN_ANALOG_SETUP_OFFSET	0x88/* DWORD 0x22 */
920dbf9bfe6Sjack wang 
921dbf9bfe6Sjack wang /* Gereral Status Table offset - byte offset */
922dbf9bfe6Sjack wang #define GST_GSTLEN_MPIS_OFFSET		0x00
923dbf9bfe6Sjack wang #define GST_IQ_FREEZE_STATE0_OFFSET	0x04
924dbf9bfe6Sjack wang #define GST_IQ_FREEZE_STATE1_OFFSET	0x08
925dbf9bfe6Sjack wang #define GST_MSGUTCNT_OFFSET		0x0C
926dbf9bfe6Sjack wang #define GST_IOPTCNT_OFFSET		0x10
927dbf9bfe6Sjack wang #define GST_PHYSTATE_OFFSET		0x18
928dbf9bfe6Sjack wang #define GST_PHYSTATE0_OFFSET		0x18
929dbf9bfe6Sjack wang #define GST_PHYSTATE1_OFFSET		0x1C
930dbf9bfe6Sjack wang #define GST_PHYSTATE2_OFFSET		0x20
931dbf9bfe6Sjack wang #define GST_PHYSTATE3_OFFSET		0x24
932dbf9bfe6Sjack wang #define GST_PHYSTATE4_OFFSET		0x28
933dbf9bfe6Sjack wang #define GST_PHYSTATE5_OFFSET		0x2C
934dbf9bfe6Sjack wang #define GST_PHYSTATE6_OFFSET		0x30
935dbf9bfe6Sjack wang #define GST_PHYSTATE7_OFFSET		0x34
936dbf9bfe6Sjack wang #define GST_RERRINFO_OFFSET		0x44
937dbf9bfe6Sjack wang 
938dbf9bfe6Sjack wang /* General Status Table - MPI state */
939dbf9bfe6Sjack wang #define GST_MPI_STATE_UNINIT		0x00
940dbf9bfe6Sjack wang #define GST_MPI_STATE_INIT		0x01
941dbf9bfe6Sjack wang #define GST_MPI_STATE_TERMINATION	0x02
942dbf9bfe6Sjack wang #define GST_MPI_STATE_ERROR		0x03
943dbf9bfe6Sjack wang #define GST_MPI_STATE_MASK		0x07
944dbf9bfe6Sjack wang 
945dbf9bfe6Sjack wang #define MBIC_NMI_ENABLE_VPE0_IOP	0x000418
946dbf9bfe6Sjack wang #define MBIC_NMI_ENABLE_VPE0_AAP1	0x000418
947dbf9bfe6Sjack wang /* PCIE registers - BAR2(0x18), BAR1(win) 0x010000 */
948dbf9bfe6Sjack wang #define PCIE_EVENT_INTERRUPT_ENABLE	0x003040
949dbf9bfe6Sjack wang #define PCIE_EVENT_INTERRUPT		0x003044
950dbf9bfe6Sjack wang #define PCIE_ERROR_INTERRUPT_ENABLE	0x003048
951dbf9bfe6Sjack wang #define PCIE_ERROR_INTERRUPT		0x00304C
95225985edcSLucas De Marchi /* signature definition for host scratch pad0 register */
953dbf9bfe6Sjack wang #define SPC_SOFT_RESET_SIGNATURE	0x252acbcd
954dbf9bfe6Sjack wang /* Signature for Soft Reset */
955dbf9bfe6Sjack wang 
956dbf9bfe6Sjack wang /* SPC Reset register - BAR4(0x20), BAR2(win) (need dynamic mapping) */
957dbf9bfe6Sjack wang #define SPC_REG_RESET			0x000000/* reset register */
958dbf9bfe6Sjack wang 
959dbf9bfe6Sjack wang /* bit difination for SPC_RESET register */
960dbf9bfe6Sjack wang #define   SPC_REG_RESET_OSSP		0x00000001
961dbf9bfe6Sjack wang #define   SPC_REG_RESET_RAAE		0x00000002
962dbf9bfe6Sjack wang #define   SPC_REG_RESET_PCS_SPBC	0x00000004
963dbf9bfe6Sjack wang #define   SPC_REG_RESET_PCS_IOP_SS	0x00000008
964dbf9bfe6Sjack wang #define   SPC_REG_RESET_PCS_AAP1_SS	0x00000010
965dbf9bfe6Sjack wang #define   SPC_REG_RESET_PCS_AAP2_SS	0x00000020
966dbf9bfe6Sjack wang #define   SPC_REG_RESET_PCS_LM		0x00000040
967dbf9bfe6Sjack wang #define   SPC_REG_RESET_PCS		0x00000080
968dbf9bfe6Sjack wang #define   SPC_REG_RESET_GSM		0x00000100
969dbf9bfe6Sjack wang #define   SPC_REG_RESET_DDR2		0x00010000
970dbf9bfe6Sjack wang #define   SPC_REG_RESET_BDMA_CORE	0x00020000
971dbf9bfe6Sjack wang #define   SPC_REG_RESET_BDMA_SXCBI	0x00040000
972dbf9bfe6Sjack wang #define   SPC_REG_RESET_PCIE_AL_SXCBI	0x00080000
973dbf9bfe6Sjack wang #define   SPC_REG_RESET_PCIE_PWR	0x00100000
974dbf9bfe6Sjack wang #define   SPC_REG_RESET_PCIE_SFT	0x00200000
975dbf9bfe6Sjack wang #define   SPC_REG_RESET_PCS_SXCBI	0x00400000
976dbf9bfe6Sjack wang #define   SPC_REG_RESET_LMS_SXCBI	0x00800000
977dbf9bfe6Sjack wang #define   SPC_REG_RESET_PMIC_SXCBI	0x01000000
978dbf9bfe6Sjack wang #define   SPC_REG_RESET_PMIC_CORE	0x02000000
979dbf9bfe6Sjack wang #define   SPC_REG_RESET_PCIE_PC_SXCBI	0x04000000
980dbf9bfe6Sjack wang #define   SPC_REG_RESET_DEVICE		0x80000000
981dbf9bfe6Sjack wang 
982dbf9bfe6Sjack wang /* registers for BAR Shifting - BAR2(0x18), BAR1(win) */
983dbf9bfe6Sjack wang #define SPC_IBW_AXI_TRANSLATION_LOW	0x003258
984dbf9bfe6Sjack wang 
985dbf9bfe6Sjack wang #define MBIC_AAP1_ADDR_BASE		0x060000
986dbf9bfe6Sjack wang #define MBIC_IOP_ADDR_BASE		0x070000
987dbf9bfe6Sjack wang #define GSM_ADDR_BASE			0x0700000
988dbf9bfe6Sjack wang /* Dynamic map through Bar4 - 0x00700000 */
989dbf9bfe6Sjack wang #define GSM_CONFIG_RESET		0x00000000
990dbf9bfe6Sjack wang #define RAM_ECC_DB_ERR			0x00000018
991dbf9bfe6Sjack wang #define GSM_READ_ADDR_PARITY_INDIC	0x00000058
992dbf9bfe6Sjack wang #define GSM_WRITE_ADDR_PARITY_INDIC	0x00000060
993dbf9bfe6Sjack wang #define GSM_WRITE_DATA_PARITY_INDIC	0x00000068
994dbf9bfe6Sjack wang #define GSM_READ_ADDR_PARITY_CHECK	0x00000038
995dbf9bfe6Sjack wang #define GSM_WRITE_ADDR_PARITY_CHECK	0x00000040
996dbf9bfe6Sjack wang #define GSM_WRITE_DATA_PARITY_CHECK	0x00000048
997dbf9bfe6Sjack wang 
998dbf9bfe6Sjack wang #define RB6_ACCESS_REG			0x6A0000
999dbf9bfe6Sjack wang #define HDAC_EXEC_CMD			0x0002
1000dbf9bfe6Sjack wang #define HDA_C_PA			0xcb
1001dbf9bfe6Sjack wang #define HDA_SEQ_ID_BITS			0x00ff0000
1002dbf9bfe6Sjack wang #define HDA_GSM_OFFSET_BITS		0x00FFFFFF
1003dbf9bfe6Sjack wang #define MBIC_AAP1_ADDR_BASE		0x060000
1004dbf9bfe6Sjack wang #define MBIC_IOP_ADDR_BASE		0x070000
1005dbf9bfe6Sjack wang #define GSM_ADDR_BASE			0x0700000
1006dbf9bfe6Sjack wang #define SPC_TOP_LEVEL_ADDR_BASE		0x000000
1007dbf9bfe6Sjack wang #define GSM_CONFIG_RESET_VALUE          0x00003b00
1008dbf9bfe6Sjack wang #define GPIO_ADDR_BASE                  0x00090000
1009dbf9bfe6Sjack wang #define GPIO_GPIO_0_0UTPUT_CTL_OFFSET   0x0000010c
1010dbf9bfe6Sjack wang 
1011dbf9bfe6Sjack wang /* RB6 offset */
1012dbf9bfe6Sjack wang #define SPC_RB6_OFFSET			0x80C0
1013dbf9bfe6Sjack wang /* Magic number of  soft reset for RB6 */
1014dbf9bfe6Sjack wang #define RB6_MAGIC_NUMBER_RST		0x1234
1015dbf9bfe6Sjack wang 
1016dbf9bfe6Sjack wang /* Device Register status */
1017dbf9bfe6Sjack wang #define DEVREG_SUCCESS					0x00
1018dbf9bfe6Sjack wang #define DEVREG_FAILURE_OUT_OF_RESOURCE			0x01
1019dbf9bfe6Sjack wang #define DEVREG_FAILURE_DEVICE_ALREADY_REGISTERED	0x02
1020dbf9bfe6Sjack wang #define DEVREG_FAILURE_INVALID_PHY_ID			0x03
1021dbf9bfe6Sjack wang #define DEVREG_FAILURE_PHY_ID_ALREADY_REGISTERED	0x04
1022dbf9bfe6Sjack wang #define DEVREG_FAILURE_PORT_ID_OUT_OF_RANGE		0x05
1023dbf9bfe6Sjack wang #define DEVREG_FAILURE_PORT_NOT_VALID_STATE		0x06
1024dbf9bfe6Sjack wang #define DEVREG_FAILURE_DEVICE_TYPE_NOT_VALID		0x07
1025dbf9bfe6Sjack wang 
1026d078b511SAnand Kumar Santhanam #define GSM_BASE					0x4F0000
1027d078b511SAnand Kumar Santhanam #define SHIFT_REG_64K_MASK				0xffff0000
1028d078b511SAnand Kumar Santhanam #define SHIFT_REG_BIT_SHIFT				8
1029dbf9bfe6Sjack wang #endif
1030dbf9bfe6Sjack wang 
1031