xref: /linux/drivers/scsi/isci/sas.h (revision 2ec53eb4d5b301e5c9c386da5685894d572772a5)
1e76d6180SDave Jiang /*
2e76d6180SDave Jiang  * This file is provided under a dual BSD/GPLv2 license.  When using or
3e76d6180SDave Jiang  * redistributing this file, you may do so under either license.
4e76d6180SDave Jiang  *
5e76d6180SDave Jiang  * GPL LICENSE SUMMARY
6e76d6180SDave Jiang  *
7e76d6180SDave Jiang  * Copyright(c) 2008 - 2011 Intel Corporation. All rights reserved.
8e76d6180SDave Jiang  *
9e76d6180SDave Jiang  * This program is free software; you can redistribute it and/or modify
10e76d6180SDave Jiang  * it under the terms of version 2 of the GNU General Public License as
11e76d6180SDave Jiang  * published by the Free Software Foundation.
12e76d6180SDave Jiang  *
13e76d6180SDave Jiang  * This program is distributed in the hope that it will be useful, but
14e76d6180SDave Jiang  * WITHOUT ANY WARRANTY; without even the implied warranty of
15e76d6180SDave Jiang  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16e76d6180SDave Jiang  * General Public License for more details.
17e76d6180SDave Jiang  *
18e76d6180SDave Jiang  * You should have received a copy of the GNU General Public License
19e76d6180SDave Jiang  * along with this program; if not, write to the Free Software
20e76d6180SDave Jiang  * Foundation, Inc., 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
21e76d6180SDave Jiang  * The full GNU General Public License is included in this distribution
22e76d6180SDave Jiang  * in the file called LICENSE.GPL.
23e76d6180SDave Jiang  *
24e76d6180SDave Jiang  * BSD LICENSE
25e76d6180SDave Jiang  *
26e76d6180SDave Jiang  * Copyright(c) 2008 - 2011 Intel Corporation. All rights reserved.
27e76d6180SDave Jiang  * All rights reserved.
28e76d6180SDave Jiang  *
29e76d6180SDave Jiang  * Redistribution and use in source and binary forms, with or without
30e76d6180SDave Jiang  * modification, are permitted provided that the following conditions
31e76d6180SDave Jiang  * are met:
32e76d6180SDave Jiang  *
33e76d6180SDave Jiang  *   * Redistributions of source code must retain the above copyright
34e76d6180SDave Jiang  *     notice, this list of conditions and the following disclaimer.
35e76d6180SDave Jiang  *   * Redistributions in binary form must reproduce the above copyright
36e76d6180SDave Jiang  *     notice, this list of conditions and the following disclaimer in
37e76d6180SDave Jiang  *     the documentation and/or other materials provided with the
38e76d6180SDave Jiang  *     distribution.
39e76d6180SDave Jiang  *   * Neither the name of Intel Corporation nor the names of its
40e76d6180SDave Jiang  *     contributors may be used to endorse or promote products derived
41e76d6180SDave Jiang  *     from this software without specific prior written permission.
42e76d6180SDave Jiang  *
43e76d6180SDave Jiang  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
44e76d6180SDave Jiang  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
45e76d6180SDave Jiang  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
46e76d6180SDave Jiang  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
47e76d6180SDave Jiang  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
48e76d6180SDave Jiang  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
49e76d6180SDave Jiang  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
50e76d6180SDave Jiang  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
51e76d6180SDave Jiang  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
52e76d6180SDave Jiang  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
53e76d6180SDave Jiang  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
54e76d6180SDave Jiang  */
55e76d6180SDave Jiang 
56e76d6180SDave Jiang #ifndef _SCI_SAS_H_
57e76d6180SDave Jiang #define _SCI_SAS_H_
58*2ec53eb4SDave Jiang 
59*2ec53eb4SDave Jiang #include <linux/kernel.h>
60*2ec53eb4SDave Jiang 
61e76d6180SDave Jiang /*
62e76d6180SDave Jiang  * SATA FIS Types These constants depict the various SATA FIS types devined in
63e76d6180SDave Jiang  * the serial ATA specification.
64e76d6180SDave Jiang  * XXX: This needs to go into <scsi/sas.h>
65e76d6180SDave Jiang  */
66e76d6180SDave Jiang #define FIS_REGH2D          0x27
67e76d6180SDave Jiang #define FIS_REGD2H          0x34
68e76d6180SDave Jiang #define FIS_SETDEVBITS      0xA1
69e76d6180SDave Jiang #define FIS_DMA_ACTIVATE    0x39
70e76d6180SDave Jiang #define FIS_DMA_SETUP       0x41
71e76d6180SDave Jiang #define FIS_BIST_ACTIVATE   0x58
72e76d6180SDave Jiang #define FIS_PIO_SETUP       0x5F
73e76d6180SDave Jiang #define FIS_DATA            0x46
74e76d6180SDave Jiang 
75af5ae893SDave Jiang /**************************************************************************/
76af5ae893SDave Jiang #define SSP_RESP_IU_MAX_SIZE	280
77af5ae893SDave Jiang 
780cfa890eSDave Jiang /*
790cfa890eSDave Jiang  * contents of the SSP COMMAND INFORMATION UNIT.
800cfa890eSDave Jiang  * For specific information on each of these individual fields please
810cfa890eSDave Jiang  * reference the SAS specification SSP transport layer section.
820cfa890eSDave Jiang  * XXX: This needs to go into <scsi/sas.h>
830cfa890eSDave Jiang  */
840cfa890eSDave Jiang struct ssp_cmd_iu {
850cfa890eSDave Jiang 	u8 LUN[8];
860cfa890eSDave Jiang 	u8 add_cdb_len:6;
870cfa890eSDave Jiang 	u8 _r_a:2;
880cfa890eSDave Jiang 	u8 _r_b;
890cfa890eSDave Jiang 	u8 en_fburst:1;
900cfa890eSDave Jiang 	u8 task_prio:4;
910cfa890eSDave Jiang 	u8 task_attr:3;
920cfa890eSDave Jiang 	u8 _r_c;
930cfa890eSDave Jiang 
940cfa890eSDave Jiang 	u8 cdb[16];
950cfa890eSDave Jiang }  __packed;
960cfa890eSDave Jiang 
970cfa890eSDave Jiang /*
980cfa890eSDave Jiang  * contents of the SSP TASK INFORMATION UNIT.
990cfa890eSDave Jiang  * For specific information on each of these individual fields please
1000cfa890eSDave Jiang  * reference the SAS specification SSP transport layer section.
1010cfa890eSDave Jiang  * XXX: This needs to go into <scsi/sas.h>
1020cfa890eSDave Jiang  */
1030cfa890eSDave Jiang struct ssp_task_iu {
1040cfa890eSDave Jiang 	u8 LUN[8];
1050cfa890eSDave Jiang 	u8 _r_a;
1060cfa890eSDave Jiang 	u8 task_func;
1070cfa890eSDave Jiang 	u8 _r_b[4];
1080cfa890eSDave Jiang 	u16 task_tag;
1090cfa890eSDave Jiang 	u8 _r_c[12];
1100cfa890eSDave Jiang }  __packed;
1110cfa890eSDave Jiang 
112*2ec53eb4SDave Jiang 
113*2ec53eb4SDave Jiang /*
114*2ec53eb4SDave Jiang  * struct smp_req_phy_id - This structure defines the contents of
115*2ec53eb4SDave Jiang  *    an SMP Request that is comprised of the struct smp_request_header and a
116*2ec53eb4SDave Jiang  *    phy identifier.
117*2ec53eb4SDave Jiang  *    Examples: SMP_REQUEST_DISCOVER, SMP_REQUEST_REPORT_PHY_SATA.
118*2ec53eb4SDave Jiang  *
119*2ec53eb4SDave Jiang  * For specific information on each of these individual fields please reference
120*2ec53eb4SDave Jiang  * the SAS specification.
121*2ec53eb4SDave Jiang  */
122*2ec53eb4SDave Jiang struct smp_req_phy_id {
123*2ec53eb4SDave Jiang 	u8 _r_a[4];		/* bytes 4-7 */
124*2ec53eb4SDave Jiang 
125*2ec53eb4SDave Jiang 	u8 ign_zone_grp:1;	/* byte 8 */
126*2ec53eb4SDave Jiang 	u8 _r_b:7;
127*2ec53eb4SDave Jiang 
128*2ec53eb4SDave Jiang 	u8 phy_id;		/* byte 9 */
129*2ec53eb4SDave Jiang 	u8 _r_c;		/* byte 10 */
130*2ec53eb4SDave Jiang 	u8 _r_d;		/* byte 11 */
131*2ec53eb4SDave Jiang }  __packed;
132*2ec53eb4SDave Jiang 
133*2ec53eb4SDave Jiang /*
134*2ec53eb4SDave Jiang  * struct smp_req_config_route_info - This structure defines the
135*2ec53eb4SDave Jiang  *    contents of an SMP Configure Route Information request.
136*2ec53eb4SDave Jiang  *
137*2ec53eb4SDave Jiang  * For specific information on each of these individual fields please reference
138*2ec53eb4SDave Jiang  * the SAS specification.
139*2ec53eb4SDave Jiang  */
140*2ec53eb4SDave Jiang struct smp_req_conf_rtinfo {
141*2ec53eb4SDave Jiang 	u16 exp_change_cnt;		/* bytes 4-5 */
142*2ec53eb4SDave Jiang 	u8 exp_rt_idx_hi;		/* byte 6 */
143*2ec53eb4SDave Jiang 	u8 exp_rt_idx;			/* byte 7 */
144*2ec53eb4SDave Jiang 
145*2ec53eb4SDave Jiang 	u8 _r_a;			/* byte 8 */
146*2ec53eb4SDave Jiang 	u8 phy_id;			/* byte 9 */
147*2ec53eb4SDave Jiang 	u16 _r_b;			/* bytes 10-11 */
148*2ec53eb4SDave Jiang 
149*2ec53eb4SDave Jiang 	u8 _r_c:7;			/* byte 12 */
150*2ec53eb4SDave Jiang 	u8 dis_rt_entry:1;
151*2ec53eb4SDave Jiang 	u8 _r_d[3];			/* bytes 13-15 */
152*2ec53eb4SDave Jiang 
153*2ec53eb4SDave Jiang 	u8 rt_sas_addr[8];		/* bytes 16-23 */
154*2ec53eb4SDave Jiang 	u8 _r_e[16];			/* bytes 24-39 */
155*2ec53eb4SDave Jiang }  __packed;
156*2ec53eb4SDave Jiang 
157*2ec53eb4SDave Jiang /*
158*2ec53eb4SDave Jiang  * struct smp_req_phycntl - This structure defines the contents of an
159*2ec53eb4SDave Jiang  *    SMP Phy Controller request.
160*2ec53eb4SDave Jiang  *
161*2ec53eb4SDave Jiang  * For specific information on each of these individual fields please reference
162*2ec53eb4SDave Jiang  * the SAS specification.
163*2ec53eb4SDave Jiang  */
164*2ec53eb4SDave Jiang struct smp_req_phycntl {
165*2ec53eb4SDave Jiang 	u16 exp_change_cnt;		/* byte 4-5 */
166*2ec53eb4SDave Jiang 
167*2ec53eb4SDave Jiang 	u8 _r_a[3];			/* bytes 6-8 */
168*2ec53eb4SDave Jiang 
169*2ec53eb4SDave Jiang 	u8 phy_id;			/* byte 9 */
170*2ec53eb4SDave Jiang 	u8 phy_op;			/* byte 10 */
171*2ec53eb4SDave Jiang 
172*2ec53eb4SDave Jiang 	u8 upd_pathway:1;		/* byte 11 */
173*2ec53eb4SDave Jiang 	u8 _r_b:7;
174*2ec53eb4SDave Jiang 
175*2ec53eb4SDave Jiang 	u8 _r_c[12];			/* byte 12-23 */
176*2ec53eb4SDave Jiang 
177*2ec53eb4SDave Jiang 	u8 att_dev_name[8];             /* byte 24-31 */
178*2ec53eb4SDave Jiang 
179*2ec53eb4SDave Jiang 	u8 _r_d:4;			/* byte 32 */
180*2ec53eb4SDave Jiang 	u8 min_linkrate:4;
181*2ec53eb4SDave Jiang 
182*2ec53eb4SDave Jiang 	u8 _r_e:4;			/* byte 33 */
183*2ec53eb4SDave Jiang 	u8 max_linkrate:4;
184*2ec53eb4SDave Jiang 
185*2ec53eb4SDave Jiang 	u8 _r_f[2];			/* byte 34-35 */
186*2ec53eb4SDave Jiang 
187*2ec53eb4SDave Jiang 	u8 pathway:4;			/* byte 36 */
188*2ec53eb4SDave Jiang 	u8 _r_g:4;
189*2ec53eb4SDave Jiang 
190*2ec53eb4SDave Jiang 	u8 _r_h[3];			/* bytes 37-39 */
191*2ec53eb4SDave Jiang }  __packed;
192*2ec53eb4SDave Jiang 
193*2ec53eb4SDave Jiang #define SMP_REQ_VENDOR_SPECIFIC_MAX_LEN 1016
194*2ec53eb4SDave Jiang 
195*2ec53eb4SDave Jiang /*
196*2ec53eb4SDave Jiang  * struct smp_req - This structure simply unionizes the existing request
197*2ec53eb4SDave Jiang  *    structures into a common request type.
198*2ec53eb4SDave Jiang  *
199*2ec53eb4SDave Jiang  * XXX: This data structure may need to go to scsi/sas.h
200*2ec53eb4SDave Jiang  */
201*2ec53eb4SDave Jiang struct smp_req {
202*2ec53eb4SDave Jiang 	u8 type;		/* byte 0 */
203*2ec53eb4SDave Jiang 	u8 func;		/* byte 1 */
204*2ec53eb4SDave Jiang 	u8 alloc_resp_len;	/* byte 2 */
205*2ec53eb4SDave Jiang 	u8 req_len;		/* byte 3 */
206*2ec53eb4SDave Jiang 
207*2ec53eb4SDave Jiang 	union { /* bytes 4-N */
208*2ec53eb4SDave Jiang 		u32 smp_req_gen;
209*2ec53eb4SDave Jiang 		struct smp_req_phy_id phy_id;
210*2ec53eb4SDave Jiang 		struct smp_req_phycntl phy_cntl;
211*2ec53eb4SDave Jiang 		struct smp_req_conf_rtinfo conf_rt_info;
212*2ec53eb4SDave Jiang 		u8 vendor[SMP_REQ_VENDOR_SPECIFIC_MAX_LEN];
213*2ec53eb4SDave Jiang 	};
214*2ec53eb4SDave Jiang }  __packed;
215*2ec53eb4SDave Jiang 
216e76d6180SDave Jiang #endif
217