/* SPDX-License-Identifier: GPL-2.0 */ /* * This header file contains public constants and structures used by * the SCSI initiator code. */ #ifndef _SCSI_SCSI_H #define _SCSI_SCSI_H #include <linux/types.h> #include <asm/param.h> #include <scsi/scsi_common.h> #include <scsi/scsi_proto.h> #include <scsi/scsi_status.h> struct scsi_cmnd; enum scsi_timeouts { … }; /* * DIX-capable adapters effectively support infinite chaining for the * protection information scatterlist */ #define SCSI_MAX_PROT_SG_SEGMENTS … /* * Special value for scanning to specify scanning or rescanning of all * possible channels, (target) ids, or luns on a given shost. */ #define SCAN_WILD_CARD … /* * standard mode-select header prepended to all mode-select commands */ struct ccs_modesel_head { … }; /* * The Well Known LUNS (SAM-3) in our int representation of a LUN */ #define SCSI_W_LUN_BASE … #define SCSI_W_LUN_REPORT_LUNS … #define SCSI_W_LUN_ACCESS_CONTROL … #define SCSI_W_LUN_TARGET_LOG_PAGE … static inline int scsi_is_wlun(u64 lun) { … } /** * scsi_status_is_check_condition - check the status return. * * @status: the status passed up from the driver (including host and * driver components) * * Returns: %true if the status code is SAM_STAT_CHECK_CONDITION. */ static inline int scsi_status_is_check_condition(int status) { … } /* * Extended message codes. */ #define EXTENDED_MODIFY_DATA_POINTER … #define EXTENDED_SDTR … #define EXTENDED_EXTENDED_IDENTIFY … #define EXTENDED_WDTR … #define EXTENDED_PPR … #define EXTENDED_MODIFY_BIDI_DATA_PTR … /* * Internal return values. */ enum scsi_disposition { … }; /* * Midlevel queue return values. */ #define SCSI_MLQUEUE_HOST_BUSY … #define SCSI_MLQUEUE_DEVICE_BUSY … #define SCSI_MLQUEUE_EH_RETRY … #define SCSI_MLQUEUE_TARGET_BUSY … /* * Use these to separate status msg and our bytes * * These are set by: * * status byte = set from target device * msg_byte (unused) * host_byte = set by low-level driver to indicate status. */ #define status_byte(result) … #define host_byte(result) … #define sense_class(sense) … #define sense_error(sense) … #define sense_valid(sense) … /* * default timeouts */ #define FORMAT_UNIT_TIMEOUT … #define START_STOP_TIMEOUT … #define MOVE_MEDIUM_TIMEOUT … #define READ_ELEMENT_STATUS_TIMEOUT … #define READ_DEFECT_DATA_TIMEOUT … #define IDENTIFY_BASE … #define IDENTIFY(can_disconnect, lun) … /* * struct scsi_device::scsi_level values. For SCSI devices other than those * prior to SCSI-2 (i.e. over 12 years old) this value is (resp[2] + 1) * where "resp" is a byte array of the response to an INQUIRY. The scsi_level * variable is visible to the user via sysfs. */ #define SCSI_UNKNOWN … #define SCSI_1 … #define SCSI_1_CCS … #define SCSI_2 … #define SCSI_3 … #define SCSI_SPC_2 … #define SCSI_SPC_3 … #define SCSI_SPC_4 … #define SCSI_SPC_5 … #define SCSI_SPC_6 … /* * INQ PERIPHERAL QUALIFIERS */ #define SCSI_INQ_PQ_CON … #define SCSI_INQ_PQ_NOT_CON … #define SCSI_INQ_PQ_NOT_CAP … /* * Here are some scsi specific ioctl commands which are sometimes useful. * * Note that include/linux/cdrom.h also defines IOCTL 0x5300 - 0x5395 */ /* Used to obtain PUN and LUN info. Conflicts with CDROMAUDIOBUFSIZ */ #define SCSI_IOCTL_GET_IDLUN … /* 0x5383 and 0x5384 were used for SCSI_IOCTL_TAGGED_{ENABLE,DISABLE} */ /* Used to obtain the host number of a device. */ #define SCSI_IOCTL_PROBE_HOST … /* Used to obtain the bus number for a device */ #define SCSI_IOCTL_GET_BUS_NUMBER … /* Used to obtain the PCI location of a device */ #define SCSI_IOCTL_GET_PCI … /** * scsi_status_is_good - check the status return. * * @status: the status passed up from the driver (including host and * driver components) * * Returns: %true for known good conditions that may be treated as * command completed normally */ static inline bool scsi_status_is_good(int status) { … } #endif /* _SCSI_SCSI_H */