162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */
262306a36Sopenharmony_ci
362306a36Sopenharmony_ci#ifndef _SCSI_SCSI_STATUS_H
462306a36Sopenharmony_ci#define _SCSI_SCSI_STATUS_H
562306a36Sopenharmony_ci
662306a36Sopenharmony_ci#include <linux/types.h>
762306a36Sopenharmony_ci#include <scsi/scsi_proto.h>
862306a36Sopenharmony_ci
962306a36Sopenharmony_ci/* Message codes. */
1062306a36Sopenharmony_cienum scsi_msg_byte {
1162306a36Sopenharmony_ci	COMMAND_COMPLETE	= 0x00,
1262306a36Sopenharmony_ci	EXTENDED_MESSAGE	= 0x01,
1362306a36Sopenharmony_ci	SAVE_POINTERS		= 0x02,
1462306a36Sopenharmony_ci	RESTORE_POINTERS	= 0x03,
1562306a36Sopenharmony_ci	DISCONNECT		= 0x04,
1662306a36Sopenharmony_ci	INITIATOR_ERROR		= 0x05,
1762306a36Sopenharmony_ci	ABORT_TASK_SET		= 0x06,
1862306a36Sopenharmony_ci	MESSAGE_REJECT		= 0x07,
1962306a36Sopenharmony_ci	NOP			= 0x08,
2062306a36Sopenharmony_ci	MSG_PARITY_ERROR	= 0x09,
2162306a36Sopenharmony_ci	LINKED_CMD_COMPLETE	= 0x0a,
2262306a36Sopenharmony_ci	LINKED_FLG_CMD_COMPLETE	= 0x0b,
2362306a36Sopenharmony_ci	TARGET_RESET		= 0x0c,
2462306a36Sopenharmony_ci	ABORT_TASK		= 0x0d,
2562306a36Sopenharmony_ci	CLEAR_TASK_SET		= 0x0e,
2662306a36Sopenharmony_ci	INITIATE_RECOVERY	= 0x0f,            /* SCSI-II only */
2762306a36Sopenharmony_ci	RELEASE_RECOVERY	= 0x10,            /* SCSI-II only */
2862306a36Sopenharmony_ci	TERMINATE_IO_PROC	= 0x11,            /* SCSI-II only */
2962306a36Sopenharmony_ci	CLEAR_ACA		= 0x16,
3062306a36Sopenharmony_ci	LOGICAL_UNIT_RESET	= 0x17,
3162306a36Sopenharmony_ci	SIMPLE_QUEUE_TAG	= 0x20,
3262306a36Sopenharmony_ci	HEAD_OF_QUEUE_TAG	= 0x21,
3362306a36Sopenharmony_ci	ORDERED_QUEUE_TAG	= 0x22,
3462306a36Sopenharmony_ci	IGNORE_WIDE_RESIDUE	= 0x23,
3562306a36Sopenharmony_ci	ACA			= 0x24,
3662306a36Sopenharmony_ci	QAS_REQUEST		= 0x55,
3762306a36Sopenharmony_ci
3862306a36Sopenharmony_ci	/* Old SCSI2 names, don't use in new code */
3962306a36Sopenharmony_ci	BUS_DEVICE_RESET	= TARGET_RESET,
4062306a36Sopenharmony_ci	ABORT			= ABORT_TASK_SET,
4162306a36Sopenharmony_ci};
4262306a36Sopenharmony_ci
4362306a36Sopenharmony_ci/* Host byte codes. */
4462306a36Sopenharmony_cienum scsi_host_status {
4562306a36Sopenharmony_ci	DID_OK		= 0x00,	/* NO error                                */
4662306a36Sopenharmony_ci	DID_NO_CONNECT	= 0x01,	/* Couldn't connect before timeout period  */
4762306a36Sopenharmony_ci	DID_BUS_BUSY	= 0x02,	/* BUS stayed busy through time out period */
4862306a36Sopenharmony_ci	DID_TIME_OUT	= 0x03,	/* TIMED OUT for other reason              */
4962306a36Sopenharmony_ci	DID_BAD_TARGET	= 0x04,	/* BAD target.                             */
5062306a36Sopenharmony_ci	DID_ABORT	= 0x05,	/* Told to abort for some other reason     */
5162306a36Sopenharmony_ci	DID_PARITY	= 0x06,	/* Parity error                            */
5262306a36Sopenharmony_ci	DID_ERROR	= 0x07,	/* Internal error                          */
5362306a36Sopenharmony_ci	DID_RESET	= 0x08,	/* Reset by somebody.                      */
5462306a36Sopenharmony_ci	DID_BAD_INTR	= 0x09,	/* Got an interrupt we weren't expecting.  */
5562306a36Sopenharmony_ci	DID_PASSTHROUGH	= 0x0a,	/* Force command past mid-layer            */
5662306a36Sopenharmony_ci	DID_SOFT_ERROR	= 0x0b,	/* The low level driver just wish a retry  */
5762306a36Sopenharmony_ci	DID_IMM_RETRY	= 0x0c,	/* Retry without decrementing retry count  */
5862306a36Sopenharmony_ci	DID_REQUEUE	= 0x0d,	/* Requeue command (no immediate retry) also
5962306a36Sopenharmony_ci				 * without decrementing the retry count	   */
6062306a36Sopenharmony_ci	DID_TRANSPORT_DISRUPTED = 0x0e, /* Transport error disrupted execution
6162306a36Sopenharmony_ci					 * and the driver blocked the port to
6262306a36Sopenharmony_ci					 * recover the link. Transport class will
6362306a36Sopenharmony_ci					 * retry or fail IO */
6462306a36Sopenharmony_ci	DID_TRANSPORT_FAILFAST = 0x0f, /* Transport class fastfailed the io */
6562306a36Sopenharmony_ci	/*
6662306a36Sopenharmony_ci	 * We used to have DID_TARGET_FAILURE, DID_NEXUS_FAILURE,
6762306a36Sopenharmony_ci	 * DID_ALLOC_FAILURE and DID_MEDIUM_ERROR at 0x10 - 0x13. For compat
6862306a36Sopenharmony_ci	 * with userspace apps that parse the host byte for SG IO, we leave
6962306a36Sopenharmony_ci	 * that block of codes unused and start at 0x14 below.
7062306a36Sopenharmony_ci	 */
7162306a36Sopenharmony_ci	DID_TRANSPORT_MARGINAL = 0x14, /* Transport marginal errors */
7262306a36Sopenharmony_ci};
7362306a36Sopenharmony_ci
7462306a36Sopenharmony_ci#endif /* _SCSI_SCSI_STATUS_H */
75