xref: /freebsd/sys/cam/scsi/scsi_iu.h (revision 2ff63af9b88c7413b7d71715b5532625752a248e)
1898b0535SWarner Losh /*-
22ac1f534SJustin T. Gibbs  * This file is in the public domain.
32ac1f534SJustin T. Gibbs  */
42ac1f534SJustin T. Gibbs #ifndef	_SCSI_SCSI_IU_H
52ac1f534SJustin T. Gibbs #define _SCSI_SCSI_IU_H 1
62ac1f534SJustin T. Gibbs 
72ac1f534SJustin T. Gibbs struct scsi_status_iu_header
82ac1f534SJustin T. Gibbs {
9*7c5d20a6SWarner Losh 	uint8_t reserved[2];
10*7c5d20a6SWarner Losh 	uint8_t flags;
112ac1f534SJustin T. Gibbs #define	SIU_SNSVALID 0x2
122ac1f534SJustin T. Gibbs #define	SIU_RSPVALID 0x1
13*7c5d20a6SWarner Losh 	uint8_t status;
14*7c5d20a6SWarner Losh 	uint8_t sense_length[4];
15*7c5d20a6SWarner Losh 	uint8_t pkt_failures_length[4];
16*7c5d20a6SWarner Losh 	uint8_t pkt_failures[1];
172ac1f534SJustin T. Gibbs };
182ac1f534SJustin T. Gibbs 
192ac1f534SJustin T. Gibbs #define SIU_PKTFAIL_OFFSET(siu) 12
202ac1f534SJustin T. Gibbs #define SIU_PKTFAIL_CODE(siu) (scsi_4btoul((siu)->pkt_failures) & 0xFF)
212ac1f534SJustin T. Gibbs #define		SIU_PFC_NONE			0
222ac1f534SJustin T. Gibbs #define		SIU_PFC_CIU_FIELDS_INVALID	2
232ac1f534SJustin T. Gibbs #define		SIU_PFC_TMF_NOT_SUPPORTED	4
242ac1f534SJustin T. Gibbs #define		SIU_PFC_TMF_FAILED		5
252ac1f534SJustin T. Gibbs #define		SIU_PFC_INVALID_TYPE_CODE	6
262ac1f534SJustin T. Gibbs #define		SIU_PFC_ILLEGAL_REQUEST		7
272ac1f534SJustin T. Gibbs #define SIU_SENSE_OFFSET(siu)				\
282ac1f534SJustin T. Gibbs     (12 + (((siu)->flags & SIU_RSPVALID)		\
292ac1f534SJustin T. Gibbs 	? scsi_4btoul((siu)->pkt_failures_length)	\
302ac1f534SJustin T. Gibbs 	: 0))
31b085809dSJustin T. Gibbs 
32b085809dSJustin T. Gibbs #define	SIU_TASKMGMT_NONE		0x00
33b085809dSJustin T. Gibbs #define	SIU_TASKMGMT_ABORT_TASK		0x01
34b085809dSJustin T. Gibbs #define	SIU_TASKMGMT_ABORT_TASK_SET	0x02
35b085809dSJustin T. Gibbs #define	SIU_TASKMGMT_CLEAR_TASK_SET	0x04
36b085809dSJustin T. Gibbs #define	SIU_TASKMGMT_LUN_RESET		0x08
37b085809dSJustin T. Gibbs #define	SIU_TASKMGMT_TARGET_RESET	0x20
38b085809dSJustin T. Gibbs #define	SIU_TASKMGMT_CLEAR_ACA		0x40
392ac1f534SJustin T. Gibbs #endif /*_SCSI_SCSI_IU_H*/
40