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_ 582ec53eb4SDave Jiang 592ec53eb4SDave Jiang #include <linux/kernel.h> 602ec53eb4SDave 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 1122ec53eb4SDave Jiang 1132ec53eb4SDave Jiang /* 1142ec53eb4SDave Jiang * struct smp_req_phy_id - This structure defines the contents of 1152ec53eb4SDave Jiang * an SMP Request that is comprised of the struct smp_request_header and a 1162ec53eb4SDave Jiang * phy identifier. 1172ec53eb4SDave Jiang * Examples: SMP_REQUEST_DISCOVER, SMP_REQUEST_REPORT_PHY_SATA. 1182ec53eb4SDave Jiang * 1192ec53eb4SDave Jiang * For specific information on each of these individual fields please reference 1202ec53eb4SDave Jiang * the SAS specification. 1212ec53eb4SDave Jiang */ 1222ec53eb4SDave Jiang struct smp_req_phy_id { 1232ec53eb4SDave Jiang u8 _r_a[4]; /* bytes 4-7 */ 1242ec53eb4SDave Jiang 1252ec53eb4SDave Jiang u8 ign_zone_grp:1; /* byte 8 */ 1262ec53eb4SDave Jiang u8 _r_b:7; 1272ec53eb4SDave Jiang 1282ec53eb4SDave Jiang u8 phy_id; /* byte 9 */ 1292ec53eb4SDave Jiang u8 _r_c; /* byte 10 */ 1302ec53eb4SDave Jiang u8 _r_d; /* byte 11 */ 1312ec53eb4SDave Jiang } __packed; 1322ec53eb4SDave Jiang 1332ec53eb4SDave Jiang /* 1342ec53eb4SDave Jiang * struct smp_req_config_route_info - This structure defines the 1352ec53eb4SDave Jiang * contents of an SMP Configure Route Information request. 1362ec53eb4SDave Jiang * 1372ec53eb4SDave Jiang * For specific information on each of these individual fields please reference 1382ec53eb4SDave Jiang * the SAS specification. 1392ec53eb4SDave Jiang */ 1402ec53eb4SDave Jiang struct smp_req_conf_rtinfo { 1412ec53eb4SDave Jiang u16 exp_change_cnt; /* bytes 4-5 */ 1422ec53eb4SDave Jiang u8 exp_rt_idx_hi; /* byte 6 */ 1432ec53eb4SDave Jiang u8 exp_rt_idx; /* byte 7 */ 1442ec53eb4SDave Jiang 1452ec53eb4SDave Jiang u8 _r_a; /* byte 8 */ 1462ec53eb4SDave Jiang u8 phy_id; /* byte 9 */ 1472ec53eb4SDave Jiang u16 _r_b; /* bytes 10-11 */ 1482ec53eb4SDave Jiang 1492ec53eb4SDave Jiang u8 _r_c:7; /* byte 12 */ 1502ec53eb4SDave Jiang u8 dis_rt_entry:1; 1512ec53eb4SDave Jiang u8 _r_d[3]; /* bytes 13-15 */ 1522ec53eb4SDave Jiang 1532ec53eb4SDave Jiang u8 rt_sas_addr[8]; /* bytes 16-23 */ 1542ec53eb4SDave Jiang u8 _r_e[16]; /* bytes 24-39 */ 1552ec53eb4SDave Jiang } __packed; 1562ec53eb4SDave Jiang 1572ec53eb4SDave Jiang /* 1582ec53eb4SDave Jiang * struct smp_req_phycntl - This structure defines the contents of an 1592ec53eb4SDave Jiang * SMP Phy Controller request. 1602ec53eb4SDave Jiang * 1612ec53eb4SDave Jiang * For specific information on each of these individual fields please reference 1622ec53eb4SDave Jiang * the SAS specification. 1632ec53eb4SDave Jiang */ 1642ec53eb4SDave Jiang struct smp_req_phycntl { 1652ec53eb4SDave Jiang u16 exp_change_cnt; /* byte 4-5 */ 1662ec53eb4SDave Jiang 1672ec53eb4SDave Jiang u8 _r_a[3]; /* bytes 6-8 */ 1682ec53eb4SDave Jiang 1692ec53eb4SDave Jiang u8 phy_id; /* byte 9 */ 1702ec53eb4SDave Jiang u8 phy_op; /* byte 10 */ 1712ec53eb4SDave Jiang 1722ec53eb4SDave Jiang u8 upd_pathway:1; /* byte 11 */ 1732ec53eb4SDave Jiang u8 _r_b:7; 1742ec53eb4SDave Jiang 1752ec53eb4SDave Jiang u8 _r_c[12]; /* byte 12-23 */ 1762ec53eb4SDave Jiang 1772ec53eb4SDave Jiang u8 att_dev_name[8]; /* byte 24-31 */ 1782ec53eb4SDave Jiang 1792ec53eb4SDave Jiang u8 _r_d:4; /* byte 32 */ 1802ec53eb4SDave Jiang u8 min_linkrate:4; 1812ec53eb4SDave Jiang 1822ec53eb4SDave Jiang u8 _r_e:4; /* byte 33 */ 1832ec53eb4SDave Jiang u8 max_linkrate:4; 1842ec53eb4SDave Jiang 1852ec53eb4SDave Jiang u8 _r_f[2]; /* byte 34-35 */ 1862ec53eb4SDave Jiang 1872ec53eb4SDave Jiang u8 pathway:4; /* byte 36 */ 1882ec53eb4SDave Jiang u8 _r_g:4; 1892ec53eb4SDave Jiang 1902ec53eb4SDave Jiang u8 _r_h[3]; /* bytes 37-39 */ 1912ec53eb4SDave Jiang } __packed; 1922ec53eb4SDave Jiang 1932ec53eb4SDave Jiang /* 1942ec53eb4SDave Jiang * struct smp_req - This structure simply unionizes the existing request 1952ec53eb4SDave Jiang * structures into a common request type. 1962ec53eb4SDave Jiang * 1972ec53eb4SDave Jiang * XXX: This data structure may need to go to scsi/sas.h 1982ec53eb4SDave Jiang */ 1992ec53eb4SDave Jiang struct smp_req { 2002ec53eb4SDave Jiang u8 type; /* byte 0 */ 2012ec53eb4SDave Jiang u8 func; /* byte 1 */ 2022ec53eb4SDave Jiang u8 alloc_resp_len; /* byte 2 */ 2032ec53eb4SDave Jiang u8 req_len; /* byte 3 */ 204*5febf6d6SGustavo A. R. Silva u8 req_data[]; 2052ec53eb4SDave Jiang } __packed; 2062ec53eb4SDave Jiang 2078694e792SDave Jiang /* 2088694e792SDave Jiang * struct sci_sas_address - This structure depicts how a SAS address is 2098694e792SDave Jiang * represented by SCI. 2108694e792SDave Jiang * XXX convert this to u8 [SAS_ADDR_SIZE] like the rest of libsas 2118694e792SDave Jiang * 2128694e792SDave Jiang */ 2138694e792SDave Jiang struct sci_sas_address { 2148694e792SDave Jiang u32 high; 2158694e792SDave Jiang u32 low; 2168694e792SDave Jiang }; 217e76d6180SDave Jiang #endif 218