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