1 /* SPDX-License-Identifier: GPL-2.0-or-later */ 2 #pragma once 3 4 /* 5 * scsi.h 6 * 7 * General scsi and linux scsi specific defines and structs. 8 * 9 * Copyright (C) IBM Corp. 2003 10 * 11 * This program is free software; you can redistribute it and/or modify it 12 * under the terms of the GNU General Public License as published by the 13 * Free Software Foundation version 2 of the License. 14 */ 15 16 #include <scsi/scsi.h> 17 18 struct scsi_ioctl_command { 19 unsigned inlen; /* excluding scsi command length */ 20 unsigned outlen; 21 unsigned char data[1]; 22 /* on input, scsi command starts here then opt. data */ 23 }; 24 25 /* 26 * Default 5 second timeout 27 */ 28 #define DEF_TIMEOUT 5000 29 30 #define SENSE_BUFF_LEN 32 31 32 /* 33 * The request buffer size passed to the SCSI INQUIRY commands, use 254, 34 * as this is a nice value for some devices, especially some of the usb 35 * mass storage devices. 36 */ 37 #define SCSI_INQ_BUFF_LEN 254 38 39 /* 40 * SCSI INQUIRY vendor and model (really product) lengths. 41 */ 42 #define VENDOR_LENGTH 8 43 #define MODEL_LENGTH 16 44 45 #define INQUIRY_CMD 0x12 46 #define INQUIRY_CMDLEN 6 47 48 /* 49 * INQUIRY VPD page 0x83 identifier descriptor related values. Reference the 50 * SCSI Primary Commands specification for details. 51 */ 52 53 /* 54 * id type values of id descriptors. These are assumed to fit in 4 bits. 55 */ 56 #define SCSI_ID_VENDOR_SPECIFIC 0 57 #define SCSI_ID_T10_VENDOR 1 58 #define SCSI_ID_EUI_64 2 59 #define SCSI_ID_NAA 3 60 #define SCSI_ID_RELPORT 4 61 #define SCSI_ID_TGTGROUP 5 62 #define SCSI_ID_LUNGROUP 6 63 #define SCSI_ID_MD5 7 64 #define SCSI_ID_NAME 8 65 66 /* 67 * Supported NAA values. These fit in 4 bits, so the "don't care" value 68 * cannot conflict with real values. 69 */ 70 #define SCSI_ID_NAA_DONT_CARE 0xff 71 #define SCSI_ID_NAA_IEEE_REG 0x05 72 #define SCSI_ID_NAA_IEEE_REG_EXTENDED 0x06 73 74 /* 75 * Supported Code Set values. 76 */ 77 #define SCSI_ID_BINARY 1 78 #define SCSI_ID_ASCII 2 79 80 struct scsi_id_search_values { 81 u_char id_type; 82 u_char naa_type; 83 u_char code_set; 84 }; 85 86 /* 87 * Following are the "true" SCSI status codes. Linux has traditionally 88 * used a 1 bit right and masked version of these. So now CHECK_CONDITION 89 * and friends (in <scsi/scsi.h>) are deprecated. 90 */ 91 #define SCSI_CHECK_CONDITION 0x02 92 #define SCSI_CONDITION_MET 0x04 93 #define SCSI_BUSY 0x08 94 #define SCSI_IMMEDIATE 0x10 95 #define SCSI_IMMEDIATE_CONDITION_MET 0x14 96 #define SCSI_RESERVATION_CONFLICT 0x18 97 #define SCSI_COMMAND_TERMINATED 0x22 98 #define SCSI_TASK_SET_FULL 0x28 99 #define SCSI_ACA_ACTIVE 0x30 100 #define SCSI_TASK_ABORTED 0x40 101