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