1221420Sdes/*-
2224642Sbrooks * This file is in the public domain.
392559Sdes * $FreeBSD$
457429Smarkm */
557429Smarkm#ifndef	_SCSI_SCSI_IU_H
657429Smarkm#define _SCSI_SCSI_IU_H 1
757429Smarkm
857429Smarkmstruct scsi_status_iu_header
960576Skris{
1065674Skris	u_int8_t reserved[2];
1165674Skris	u_int8_t flags;
1265674Skris#define	SIU_SNSVALID 0x2
1365674Skris#define	SIU_RSPVALID 0x1
1465674Skris	u_int8_t status;
1557429Smarkm	u_int8_t sense_length[4];
1657429Smarkm	u_int8_t pkt_failures_length[4];
1757429Smarkm	u_int8_t pkt_failures[1];
1857429Smarkm};
1957429Smarkm
2057429Smarkm#define SIU_PKTFAIL_OFFSET(siu) 12
2157429Smarkm#define SIU_PKTFAIL_CODE(siu) (scsi_4btoul((siu)->pkt_failures) & 0xFF)
2257429Smarkm#define		SIU_PFC_NONE			0
2357429Smarkm#define		SIU_PFC_CIU_FIELDS_INVALID	2
2457429Smarkm#define		SIU_PFC_TMF_NOT_SUPPORTED	4
2557429Smarkm#define		SIU_PFC_TMF_FAILED		5
2665674Skris#define		SIU_PFC_INVALID_TYPE_CODE	6
2776262Sgreen#define		SIU_PFC_ILLEGAL_REQUEST		7
28204917Sdes#define SIU_SENSE_OFFSET(siu)				\
29137019Sdes    (12 + (((siu)->flags & SIU_RSPVALID)		\
30162856Sdes	? scsi_4btoul((siu)->pkt_failures_length)	\
3157429Smarkm	: 0))
3276262Sgreen
3376262Sgreen#define	SIU_TASKMGMT_NONE		0x00
3476262Sgreen#define	SIU_TASKMGMT_ABORT_TASK		0x01
3576262Sgreen#define	SIU_TASKMGMT_ABORT_TASK_SET	0x02
3676262Sgreen#define	SIU_TASKMGMT_CLEAR_TASK_SET	0x04
3776262Sgreen#define	SIU_TASKMGMT_LUN_RESET		0x08
3876262Sgreen#define	SIU_TASKMGMT_TARGET_RESET	0x20
39137019Sdes#define	SIU_TASKMGMT_CLEAR_ACA		0x40
40181111Sdes#endif /*_SCSI_SCSI_IU_H*/
4176262Sgreen