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