18c2ecf20Sopenharmony_ci/*
28c2ecf20Sopenharmony_ci * This file is in the public domain.
38c2ecf20Sopenharmony_ci */
48c2ecf20Sopenharmony_ci#ifndef	_SCSI_SCSI_IU_H
58c2ecf20Sopenharmony_ci#define _SCSI_SCSI_IU_H 1
68c2ecf20Sopenharmony_ci
78c2ecf20Sopenharmony_cistruct scsi_status_iu_header
88c2ecf20Sopenharmony_ci{
98c2ecf20Sopenharmony_ci	u_int8_t reserved[2];
108c2ecf20Sopenharmony_ci	u_int8_t flags;
118c2ecf20Sopenharmony_ci#define	SIU_SNSVALID 0x2
128c2ecf20Sopenharmony_ci#define	SIU_RSPVALID 0x1
138c2ecf20Sopenharmony_ci	u_int8_t status;
148c2ecf20Sopenharmony_ci	u_int8_t sense_length[4];
158c2ecf20Sopenharmony_ci	u_int8_t pkt_failures_length[4];
168c2ecf20Sopenharmony_ci	u_int8_t pkt_failures[1];
178c2ecf20Sopenharmony_ci};
188c2ecf20Sopenharmony_ci
198c2ecf20Sopenharmony_ci#define SIU_PKTFAIL_OFFSET(siu) 12
208c2ecf20Sopenharmony_ci#define SIU_PKTFAIL_CODE(siu) (scsi_4btoul((siu)->pkt_failures) & 0xFF)
218c2ecf20Sopenharmony_ci#define		SIU_PFC_NONE			0
228c2ecf20Sopenharmony_ci#define		SIU_PFC_CIU_FIELDS_INVALID	2
238c2ecf20Sopenharmony_ci#define		SIU_PFC_TMF_NOT_SUPPORTED	4
248c2ecf20Sopenharmony_ci#define		SIU_PFC_TMF_FAILED		5
258c2ecf20Sopenharmony_ci#define		SIU_PFC_INVALID_TYPE_CODE	6
268c2ecf20Sopenharmony_ci#define		SIU_PFC_ILLEGAL_REQUEST		7
278c2ecf20Sopenharmony_ci#define SIU_SENSE_OFFSET(siu)				\
288c2ecf20Sopenharmony_ci    (12 + (((siu)->flags & SIU_RSPVALID)		\
298c2ecf20Sopenharmony_ci	? scsi_4btoul((siu)->pkt_failures_length)	\
308c2ecf20Sopenharmony_ci	: 0))
318c2ecf20Sopenharmony_ci
328c2ecf20Sopenharmony_ci#define	SIU_TASKMGMT_NONE		0x00
338c2ecf20Sopenharmony_ci#define	SIU_TASKMGMT_ABORT_TASK		0x01
348c2ecf20Sopenharmony_ci#define	SIU_TASKMGMT_ABORT_TASK_SET	0x02
358c2ecf20Sopenharmony_ci#define	SIU_TASKMGMT_CLEAR_TASK_SET	0x04
368c2ecf20Sopenharmony_ci#define	SIU_TASKMGMT_LUN_RESET		0x08
378c2ecf20Sopenharmony_ci#define	SIU_TASKMGMT_TARGET_RESET	0x20
388c2ecf20Sopenharmony_ci#define	SIU_TASKMGMT_CLEAR_ACA		0x40
398c2ecf20Sopenharmony_ci#endif /*_SCSI_SCSI_IU_H*/
40