1*4c06356bSdh142964 /* 2*4c06356bSdh142964 * CDDL HEADER START 3*4c06356bSdh142964 * 4*4c06356bSdh142964 * The contents of this file are subject to the terms of the 5*4c06356bSdh142964 * Common Development and Distribution License (the "License"). 6*4c06356bSdh142964 * You may not use this file except in compliance with the License. 7*4c06356bSdh142964 * 8*4c06356bSdh142964 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 9*4c06356bSdh142964 * or http://www.opensolaris.org/os/licensing. 10*4c06356bSdh142964 * See the License for the specific language governing permissions 11*4c06356bSdh142964 * and limitations under the License. 12*4c06356bSdh142964 * 13*4c06356bSdh142964 * When distributing Covered Code, include this CDDL HEADER in each 14*4c06356bSdh142964 * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 15*4c06356bSdh142964 * If applicable, add the following below this CDDL HEADER, with the 16*4c06356bSdh142964 * fields enclosed by brackets "[]" replaced with your own identifying 17*4c06356bSdh142964 * information: Portions Copyright [yyyy] [name of copyright owner] 18*4c06356bSdh142964 * 19*4c06356bSdh142964 * CDDL HEADER END 20*4c06356bSdh142964 * 21*4c06356bSdh142964 * 22*4c06356bSdh142964 * Copyright 2009 Sun Microsystems, Inc. All rights reserved. 23*4c06356bSdh142964 * Use is subject to license terms. 24*4c06356bSdh142964 */ 25*4c06356bSdh142964 /* 26*4c06356bSdh142964 * SAS Common Structures and Definitions 27*4c06356bSdh142964 * sas2r14, simplified/reduced 28*4c06356bSdh142964 */ 29*4c06356bSdh142964 #ifndef _SAS_H 30*4c06356bSdh142964 #define _SAS_H 31*4c06356bSdh142964 #ifdef __cplusplus 32*4c06356bSdh142964 extern "C" { 33*4c06356bSdh142964 #endif 34*4c06356bSdh142964 35*4c06356bSdh142964 #include <sys/sysmacros.h> 36*4c06356bSdh142964 /* 37*4c06356bSdh142964 * SAS Address Frames 38*4c06356bSdh142964 * Trailing 4 byte CRC not included. 39*4c06356bSdh142964 */ 40*4c06356bSdh142964 typedef struct { 41*4c06356bSdh142964 DECL_BITFIELD3( 42*4c06356bSdh142964 address_frame_type :4, 43*4c06356bSdh142964 device_type :3, 44*4c06356bSdh142964 reserved0 :1); 45*4c06356bSdh142964 DECL_BITFIELD2( 46*4c06356bSdh142964 reason :4, 47*4c06356bSdh142964 reserved1 :4); 48*4c06356bSdh142964 DECL_BITFIELD5( 49*4c06356bSdh142964 restricted0 :1, 50*4c06356bSdh142964 smp_ini_port :1, 51*4c06356bSdh142964 stp_ini_port :1, 52*4c06356bSdh142964 ssp_ini_port :1, 53*4c06356bSdh142964 reserved2 :4); 54*4c06356bSdh142964 DECL_BITFIELD5( 55*4c06356bSdh142964 restricted1 :1, 56*4c06356bSdh142964 smp_tgt_port :1, 57*4c06356bSdh142964 stp_tgt_port :1, 58*4c06356bSdh142964 ssp_tgt_port :1, 59*4c06356bSdh142964 reserved3 :4); 60*4c06356bSdh142964 uint8_t device_name[8]; 61*4c06356bSdh142964 uint8_t sas_address[8]; 62*4c06356bSdh142964 uint8_t phy_identifier; 63*4c06356bSdh142964 DECL_BITFIELD4( 64*4c06356bSdh142964 break_reply_capable :1, 65*4c06356bSdh142964 requested_inside_zpsds :1, 66*4c06356bSdh142964 inside_zpsds_persistent :1, 67*4c06356bSdh142964 reserved4 :5); 68*4c06356bSdh142964 uint8_t reserved5[6]; 69*4c06356bSdh142964 } sas_identify_af_t; 70*4c06356bSdh142964 71*4c06356bSdh142964 typedef struct { 72*4c06356bSdh142964 DECL_BITFIELD3( 73*4c06356bSdh142964 address_frame_type :4, 74*4c06356bSdh142964 protocol :3, 75*4c06356bSdh142964 ini_port :1); 76*4c06356bSdh142964 DECL_BITFIELD2( 77*4c06356bSdh142964 connection_rate :4, 78*4c06356bSdh142964 features :4); 79*4c06356bSdh142964 uint16_t itag; /* initiator connection tag */ 80*4c06356bSdh142964 uint8_t sas_dst[8]; /* destination sas address */ 81*4c06356bSdh142964 uint8_t sas_src[8]; /* source sas address */ 82*4c06356bSdh142964 uint8_t src_zone_group; /* source zone group */ 83*4c06356bSdh142964 uint8_t path_block_count; /* pathway blocked count */ 84*4c06356bSdh142964 uint16_t arb_wait_time; /* arbitration wait time */ 85*4c06356bSdh142964 uint8_t compat[4]; /* 'more' compatible features */ 86*4c06356bSdh142964 } sas_open_af_t; 87*4c06356bSdh142964 88*4c06356bSdh142964 #define SAS_AF_IDENTIFY 0 89*4c06356bSdh142964 #define SAS_AF_OPEN 1 90*4c06356bSdh142964 91*4c06356bSdh142964 #define SAS_IF_DTYPE_ENDPOINT 1 92*4c06356bSdh142964 #define SAS_IF_DTYPE_EDGE 2 93*4c06356bSdh142964 #define SAS_IF_DTYPE_FANOUT 3 /* obsolete */ 94*4c06356bSdh142964 95*4c06356bSdh142964 #define SAS_OF_PROTO_SMP 0 96*4c06356bSdh142964 #define SAS_OF_PROTO_SSP 1 97*4c06356bSdh142964 #define SAS_OF_PROTO_STP 2 98*4c06356bSdh142964 99*4c06356bSdh142964 #define SAS_SSP_SUPPORT 0x8 100*4c06356bSdh142964 #define SAS_STP_SUPPORT 0x4 101*4c06356bSdh142964 #define SAS_SMP_SUPPORT 0x2 102*4c06356bSdh142964 103*4c06356bSdh142964 104*4c06356bSdh142964 #define SAS_CONNRATE_1_5_GBPS 0x8 105*4c06356bSdh142964 #define SAS_CONNRATE_3_0_GBPS 0x9 106*4c06356bSdh142964 #define SAS_CONNRATE_6_0_GBPS 0xA 107*4c06356bSdh142964 108*4c06356bSdh142964 #define SAS_SATA_SUPPORT 0x1 109*4c06356bSdh142964 #define SAS_ATTACHED_NAME_OFFSET 52 /* SAS-2 only */ 110*4c06356bSdh142964 111*4c06356bSdh142964 /* 112*4c06356bSdh142964 * SSP Definitions 113*4c06356bSdh142964 */ 114*4c06356bSdh142964 typedef struct { 115*4c06356bSdh142964 uint8_t lun[8]; 116*4c06356bSdh142964 uint8_t reserved0; 117*4c06356bSdh142964 DECL_BITFIELD3( 118*4c06356bSdh142964 task_attribute :2, 119*4c06356bSdh142964 command_priority :4, 120*4c06356bSdh142964 enable_first_burst :1); 121*4c06356bSdh142964 uint8_t reserved1; 122*4c06356bSdh142964 DECL_BITFIELD2( 123*4c06356bSdh142964 reserved2 :2, 124*4c06356bSdh142964 addi_cdb_len :6); 125*4c06356bSdh142964 uint8_t cdb[16]; 126*4c06356bSdh142964 /* additional cdb bytes go here, followed by 4 byte CRC */ 127*4c06356bSdh142964 } sas_ssp_cmd_iu_t; 128*4c06356bSdh142964 129*4c06356bSdh142964 #define SAS_CMD_TASK_ATTR_SIMPLE 0x00 130*4c06356bSdh142964 #define SAS_CMD_TASK_ATTR_HEAD 0x01 131*4c06356bSdh142964 #define SAS_CMD_TASK_ATTR_ORDERED 0x02 132*4c06356bSdh142964 #define SAS_CMD_TASK_ATTR_ACA 0x04 133*4c06356bSdh142964 134*4c06356bSdh142964 typedef struct { 135*4c06356bSdh142964 uint8_t reserved0[8]; 136*4c06356bSdh142964 uint16_t status_qualifier; 137*4c06356bSdh142964 DECL_BITFIELD2( 138*4c06356bSdh142964 datapres :2, 139*4c06356bSdh142964 reserved1 :6); 140*4c06356bSdh142964 uint8_t status; 141*4c06356bSdh142964 uint8_t reserved2[4]; 142*4c06356bSdh142964 uint32_t sense_data_length; 143*4c06356bSdh142964 uint32_t response_data_length; 144*4c06356bSdh142964 uint8_t rspd[]; 145*4c06356bSdh142964 /* response data followed by sense data goes here */ 146*4c06356bSdh142964 } sas_ssp_rsp_iu_t; 147*4c06356bSdh142964 148*4c06356bSdh142964 /* length of bytes up to response data */ 149*4c06356bSdh142964 #define SAS_RSP_HDR_SIZE 24 150*4c06356bSdh142964 151*4c06356bSdh142964 #define SAS_RSP_DATAPRES_NO_DATA 0x00 152*4c06356bSdh142964 #define SAS_RSP_DATAPRES_RESPONSE_DATA 0x01 153*4c06356bSdh142964 #define SAS_RSP_DATAPRES_SENSE_DATA 0x02 154*4c06356bSdh142964 155*4c06356bSdh142964 /* 156*4c06356bSdh142964 * When the RSP IU is type RESPONSE_DATA, 157*4c06356bSdh142964 * the first 4 bytes of response data should 158*4c06356bSdh142964 * be a Big Endian representation of one of 159*4c06356bSdh142964 * these codes. 160*4c06356bSdh142964 */ 161*4c06356bSdh142964 #define SAS_RSP_TMF_COMPLETE 0x00 162*4c06356bSdh142964 #define SAS_RSP_INVALID_FRAME 0x02 163*4c06356bSdh142964 #define SAS_RSP_TMF_NOT_SUPPORTED 0x04 164*4c06356bSdh142964 #define SAS_RSP_TMF_FAILED 0x05 165*4c06356bSdh142964 #define SAS_RSP_TMF_SUCCEEDED 0x08 166*4c06356bSdh142964 #define SAS_RSP_TMF_INCORRECT_LUN 0x09 167*4c06356bSdh142964 #define SAS_RSP_OVERLAPPED_OIPTTA 0x0A 168*4c06356bSdh142964 169*4c06356bSdh142964 /* 170*4c06356bSdh142964 * Task Management Functions- should be in a SAM definition file 171*4c06356bSdh142964 */ 172*4c06356bSdh142964 #define SAS_ABORT_TASK 0x01 173*4c06356bSdh142964 #define SAS_ABORT_TASK_SET 0x02 174*4c06356bSdh142964 #define SAS_CLEAR_TASK_SET 0x04 175*4c06356bSdh142964 #define SAS_LOGICAL_UNIT_RESET 0x08 176*4c06356bSdh142964 #define SAS_I_T_NEXUS_RESET 0x10 177*4c06356bSdh142964 #define SAS_CLEAR_ACA 0x40 178*4c06356bSdh142964 #define SAS_QUERY_TASK 0x80 179*4c06356bSdh142964 #define SAS_QUERY_TASK_SET 0x81 180*4c06356bSdh142964 #define SAS_QUERY_UNIT_ATTENTION 0x82 181*4c06356bSdh142964 182*4c06356bSdh142964 /* 183*4c06356bSdh142964 * PHY size changed from SAS1.1 to SAS2. 184*4c06356bSdh142964 */ 185*4c06356bSdh142964 #define SAS_PHYNUM_MAX 127 186*4c06356bSdh142964 #define SAS_PHYNUM_MASK 0x7f 187*4c06356bSdh142964 188*4c06356bSdh142964 #define SAS2_PHYNUM_MAX 254 189*4c06356bSdh142964 #define SAS2_PHYNUM_MASK 0xff 190*4c06356bSdh142964 191*4c06356bSdh142964 192*4c06356bSdh142964 /* 193*4c06356bSdh142964 * Maximum SMP payload size, including CRC 194*4c06356bSdh142964 */ 195*4c06356bSdh142964 #define SAS_SMP_MAX_PAYLOAD 1032 196*4c06356bSdh142964 #ifdef __cplusplus 197*4c06356bSdh142964 } 198*4c06356bSdh142964 #endif 199*4c06356bSdh142964 #endif /* _SAS_H */ 200