1*0Sstevel@tonic-gate /* 2*0Sstevel@tonic-gate * CDDL HEADER START 3*0Sstevel@tonic-gate * 4*0Sstevel@tonic-gate * The contents of this file are subject to the terms of the 5*0Sstevel@tonic-gate * Common Development and Distribution License, Version 1.0 only 6*0Sstevel@tonic-gate * (the "License"). You may not use this file except in compliance 7*0Sstevel@tonic-gate * with the License. 8*0Sstevel@tonic-gate * 9*0Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 10*0Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 11*0Sstevel@tonic-gate * See the License for the specific language governing permissions 12*0Sstevel@tonic-gate * and limitations under the License. 13*0Sstevel@tonic-gate * 14*0Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 15*0Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 16*0Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 17*0Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 18*0Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 19*0Sstevel@tonic-gate * 20*0Sstevel@tonic-gate * CDDL HEADER END 21*0Sstevel@tonic-gate */ 22*0Sstevel@tonic-gate /* 23*0Sstevel@tonic-gate * Copyright (c) 1996,2000 by Sun Microsystems, Inc. 24*0Sstevel@tonic-gate * All rights reserved. 25*0Sstevel@tonic-gate */ 26*0Sstevel@tonic-gate 27*0Sstevel@tonic-gate #ifndef _SYS_SCSI_GENERIC_MESSAGE_H 28*0Sstevel@tonic-gate #define _SYS_SCSI_GENERIC_MESSAGE_H 29*0Sstevel@tonic-gate 30*0Sstevel@tonic-gate #pragma ident "%Z%%M% %I% %E% SMI" 31*0Sstevel@tonic-gate 32*0Sstevel@tonic-gate #ifdef __cplusplus 33*0Sstevel@tonic-gate extern "C" { 34*0Sstevel@tonic-gate #endif 35*0Sstevel@tonic-gate 36*0Sstevel@tonic-gate /* 37*0Sstevel@tonic-gate * Defined Messages For Parallel SCSI. 38*0Sstevel@tonic-gate */ 39*0Sstevel@tonic-gate 40*0Sstevel@tonic-gate /* 41*0Sstevel@tonic-gate * The SCSI specification defines message codes 0x00, 0x02-0x1F, 42*0Sstevel@tonic-gate * as fixed single byte messages, 0x01 as indicating extended (multi-byte) 43*0Sstevel@tonic-gate * messages, 0x20-0x2F as fixed two byte messages, and 0x80-0xFF 44*0Sstevel@tonic-gate * as IDENTIFY messages. 45*0Sstevel@tonic-gate */ 46*0Sstevel@tonic-gate 47*0Sstevel@tonic-gate #define MSG_COMMAND_COMPLETE 0x00 48*0Sstevel@tonic-gate #define MSG_SAVE_DATA_PTR 0x02 49*0Sstevel@tonic-gate #define MSG_RESTORE_PTRS 0x03 50*0Sstevel@tonic-gate #define MSG_DISCONNECT 0x04 51*0Sstevel@tonic-gate #define MSG_INITIATOR_ERROR 0x05 52*0Sstevel@tonic-gate #define MSG_ABORT 0x06 53*0Sstevel@tonic-gate #define MSG_REJECT 0x07 54*0Sstevel@tonic-gate #define MSG_NOP 0x08 55*0Sstevel@tonic-gate #define MSG_MSG_PARITY 0x09 56*0Sstevel@tonic-gate #define MSG_LINK_CMPLT 0x0A 57*0Sstevel@tonic-gate #define MSG_LINK_CMPLT_FLAG 0x0B 58*0Sstevel@tonic-gate #define MSG_DEVICE_RESET 0x0C 59*0Sstevel@tonic-gate #define MSG_ABORT_TAG 0x0D 60*0Sstevel@tonic-gate #define MSG_CLEAR_QUEUE 0x0E 61*0Sstevel@tonic-gate #define MSG_INITIATE_RECOVERY 0x0F 62*0Sstevel@tonic-gate #define MSG_RELEASE_RECOVERY 0x10 63*0Sstevel@tonic-gate #define MSG_TERMINATE_PROCESS 0x11 64*0Sstevel@tonic-gate #define MSG_CONTINUE_TASK 0x12 65*0Sstevel@tonic-gate #define MSG_TARGET_TRAN_DIS 0x13 66*0Sstevel@tonic-gate #define MSG_CLEAR_ACA 0x16 67*0Sstevel@tonic-gate 68*0Sstevel@tonic-gate 69*0Sstevel@tonic-gate /* 70*0Sstevel@tonic-gate * Message code 0x01 indicates an extended 71*0Sstevel@tonic-gate * (two or more) byte message. The EXTENDED 72*0Sstevel@tonic-gate * message byte is followed immediately by 73*0Sstevel@tonic-gate * a message length byte and then an extended 74*0Sstevel@tonic-gate * message code byte. 75*0Sstevel@tonic-gate * 76*0Sstevel@tonic-gate * Note: The EXTENDED IDENTIFY message is pre-SCSI-2. 77*0Sstevel@tonic-gate */ 78*0Sstevel@tonic-gate 79*0Sstevel@tonic-gate #define MSG_EXTENDED 0x01 80*0Sstevel@tonic-gate 81*0Sstevel@tonic-gate #define MSG_MODIFY_DATA_PTR 0x00 82*0Sstevel@tonic-gate #define MSG_SYNCHRONOUS 0x01 83*0Sstevel@tonic-gate #define MSG_IDENTIFY_EXTENDED 0x02 84*0Sstevel@tonic-gate #define MSG_WIDE_DATA_XFER 0x03 85*0Sstevel@tonic-gate #define MSG_PARALLEL_PROTOCOL 0x04 86*0Sstevel@tonic-gate 87*0Sstevel@tonic-gate /* 88*0Sstevel@tonic-gate * parallel protocol message optional flags 89*0Sstevel@tonic-gate */ 90*0Sstevel@tonic-gate #define OPT_IU 0x01 91*0Sstevel@tonic-gate #define OPT_DT 0x02 92*0Sstevel@tonic-gate #define OPT_QAS_REQ 0x04 93*0Sstevel@tonic-gate 94*0Sstevel@tonic-gate /* 95*0Sstevel@tonic-gate * Message codes 0x20-0x2F are fixed two byte messages. 96*0Sstevel@tonic-gate */ 97*0Sstevel@tonic-gate 98*0Sstevel@tonic-gate 99*0Sstevel@tonic-gate #define MSG_SIMPLE_QTAG 0x20 100*0Sstevel@tonic-gate #define MSG_HEAD_QTAG 0x21 101*0Sstevel@tonic-gate #define MSG_ORDERED_QTAG 0x22 102*0Sstevel@tonic-gate #define MSG_IGNORE_WIDE_RESID 0x23 103*0Sstevel@tonic-gate #define MSG_ACA 0x24 104*0Sstevel@tonic-gate #define MSG_LUN_RESET 0x25 105*0Sstevel@tonic-gate 106*0Sstevel@tonic-gate /* 107*0Sstevel@tonic-gate * Codes 0x80-0xFF are identify messages, indicated 108*0Sstevel@tonic-gate * by the setting of the most significant bit in the 109*0Sstevel@tonic-gate * message (0x80). 110*0Sstevel@tonic-gate */ 111*0Sstevel@tonic-gate 112*0Sstevel@tonic-gate #define MSG_IDENTIFY 0x80 113*0Sstevel@tonic-gate 114*0Sstevel@tonic-gate /* 115*0Sstevel@tonic-gate * Initiators will set bit 6 in an Identify message 116*0Sstevel@tonic-gate * to indicate whether or not they can accommodate 117*0Sstevel@tonic-gate * disconnect/reconnect 118*0Sstevel@tonic-gate */ 119*0Sstevel@tonic-gate 120*0Sstevel@tonic-gate #define INI_CAN_DISCON 0x40 121*0Sstevel@tonic-gate 122*0Sstevel@tonic-gate /* 123*0Sstevel@tonic-gate * ..so we can have a compound definition 124*0Sstevel@tonic-gate * for Initiators that can accommodate 125*0Sstevel@tonic-gate * disconnect/reconnect 126*0Sstevel@tonic-gate */ 127*0Sstevel@tonic-gate 128*0Sstevel@tonic-gate #define MSG_DR_IDENTIFY (MSG_IDENTIFY|INI_CAN_DISCON) 129*0Sstevel@tonic-gate 130*0Sstevel@tonic-gate /* 131*0Sstevel@tonic-gate * Note: Following is ONLY applicable to pre-SCSI-3. 132*0Sstevel@tonic-gate * 133*0Sstevel@tonic-gate * Bit 5 of the identify message specifies that, if zero, 134*0Sstevel@tonic-gate * that the IDENTIFY message is directed to a logical unit, 135*0Sstevel@tonic-gate * and if one, that the IDENTIFY message is directed to a 136*0Sstevel@tonic-gate * target routine that does not involve a logical unit. 137*0Sstevel@tonic-gate */ 138*0Sstevel@tonic-gate 139*0Sstevel@tonic-gate #define MSG_LUNTAR 0x20 140*0Sstevel@tonic-gate 141*0Sstevel@tonic-gate /* 142*0Sstevel@tonic-gate * Note: Following is ONLY applicable to pre-SCSI-3. 143*0Sstevel@tonic-gate * 144*0Sstevel@tonic-gate * Bits 2-0 identify either the logical unit or the target 145*0Sstevel@tonic-gate * routine number based upon whether MSG_LUNTAR is clear 146*0Sstevel@tonic-gate * or set. 147*0Sstevel@tonic-gate */ 148*0Sstevel@tonic-gate 149*0Sstevel@tonic-gate #define MSG_LUNRTN 0x07 150*0Sstevel@tonic-gate 151*0Sstevel@tonic-gate /* 152*0Sstevel@tonic-gate * Note: Following is ONLY applicable to pre-SCSI-3. 153*0Sstevel@tonic-gate * 154*0Sstevel@tonic-gate * Bits 4-3 are reserved and must be zero. 155*0Sstevel@tonic-gate */ 156*0Sstevel@tonic-gate 157*0Sstevel@tonic-gate #define BAD_IDENTIFY 0x18 158*0Sstevel@tonic-gate 159*0Sstevel@tonic-gate /* 160*0Sstevel@tonic-gate * These macros may be useful to quickly determine the 161*0Sstevel@tonic-gate * length of a message based upon the message code. 162*0Sstevel@tonic-gate */ 163*0Sstevel@tonic-gate 164*0Sstevel@tonic-gate /* 165*0Sstevel@tonic-gate * Note: IS_IDENTIFY_MSG is ONLY applicable to pre-SCSI-3. 166*0Sstevel@tonic-gate * For SCSI-3, use IS_IDENTIFY_MSG_SCSI3. 167*0Sstevel@tonic-gate */ 168*0Sstevel@tonic-gate #define IS_IDENTIFY_MSG(msg) \ 169*0Sstevel@tonic-gate (((msg) & MSG_IDENTIFY) && !((msg) & BAD_IDENTIFY)) 170*0Sstevel@tonic-gate #define IS_IDENTIFY_MSG_SCSI3(msg) ((msg) & MSG_IDENTIFY) 171*0Sstevel@tonic-gate #define IS_EXTENDED_MSG(msg) ((msg) == MSG_EXTENDED) 172*0Sstevel@tonic-gate #define IS_2BYTE_MSG(msg) (((msg) & 0xF0) == 0x20) 173*0Sstevel@tonic-gate #define IS_1BYTE_MSG(msg) (!(IS_EXTENDED_MSG((msg))) && \ 174*0Sstevel@tonic-gate ((((msg) & 0xF0) == 0) || IS_IDENTIFY_MSG((msg)))) 175*0Sstevel@tonic-gate 176*0Sstevel@tonic-gate #ifdef __cplusplus 177*0Sstevel@tonic-gate } 178*0Sstevel@tonic-gate #endif 179*0Sstevel@tonic-gate 180*0Sstevel@tonic-gate #endif /* _SYS_SCSI_GENERIC_MESSAGE_H */ 181