Add the sense codes that a zoned block device reports when a request violates the zone model (ZBC-3 and ZAC-3):
ILLEGAL REQUEST, UNALIGNED WRITE COMMAND (21h/04h): a write that does not start at the write pointer of a sequential write required zone ILLEGAL REQUEST, WRITE BOUNDARY VIOLATION (21h/05h): a write that crosses the end of the writable part of a zone DATA PROTECT, INSUFFICIENT ZONE RESOURCES (55h/0Eh): a request that would open or activate more zones than the device allows The IDE device is going to report them for zoned devices. Signed-off-by: Niklas Cassel <[email protected]> --- include/scsi/utils.h | 6 ++++++ scsi/utils.c | 15 +++++++++++++++ 2 files changed, 21 insertions(+) diff --git a/include/scsi/utils.h b/include/scsi/utils.h index d5c8efa16e..d16c264b22 100644 --- a/include/scsi/utils.h +++ b/include/scsi/utils.h @@ -69,6 +69,10 @@ extern const struct SCSISense sense_code_TARGET_FAILURE; extern const struct SCSISense sense_code_INVALID_OPCODE; /* Illegal request, LBA out of range */ extern const struct SCSISense sense_code_LBA_OUT_OF_RANGE; +/* Illegal request, Unaligned write command */ +extern const struct SCSISense sense_code_UNALIGNED_WRITE; +/* Illegal request, Write boundary violation */ +extern const struct SCSISense sense_code_WRITE_BOUNDARY_VIOLATION; /* Illegal request, Invalid field in CDB */ extern const struct SCSISense sense_code_INVALID_FIELD; /* Illegal request, Invalid field in parameter list */ @@ -119,6 +123,8 @@ extern const struct SCSISense sense_code_DEVICE_INTERNAL_RESET; extern const struct SCSISense sense_code_WRITE_PROTECTED; /* Data Protection, Space Allocation Failed Write Protect */ extern const struct SCSISense sense_code_SPACE_ALLOC_FAILED; +/* Data Protection, Insufficient zone resources */ +extern const struct SCSISense sense_code_INSUFFICIENT_ZONE_RESOURCES; #define SENSE_CODE(x) sense_code_ ## x diff --git a/scsi/utils.c b/scsi/utils.c index 1ee68e6822..9eb41aefdf 100644 --- a/scsi/utils.c +++ b/scsi/utils.c @@ -190,6 +190,16 @@ const struct SCSISense sense_code_LBA_OUT_OF_RANGE = { .key = ILLEGAL_REQUEST, .asc = 0x21, .ascq = 0x00 }; +/* Illegal request, Unaligned write command */ +const struct SCSISense sense_code_UNALIGNED_WRITE = { + .key = ILLEGAL_REQUEST, .asc = 0x21, .ascq = 0x04 +}; + +/* Illegal request, Write boundary violation */ +const struct SCSISense sense_code_WRITE_BOUNDARY_VIOLATION = { + .key = ILLEGAL_REQUEST, .asc = 0x21, .ascq = 0x05 +}; + /* Illegal request, Invalid field in CDB */ const struct SCSISense sense_code_INVALID_FIELD = { .key = ILLEGAL_REQUEST, .asc = 0x24, .ascq = 0x00 @@ -330,6 +340,11 @@ const struct SCSISense sense_code_SPACE_ALLOC_FAILED = { .key = DATA_PROTECT, .asc = 0x27, .ascq = 0x07 }; +/* Data Protection, Insufficient zone resources */ +const struct SCSISense sense_code_INSUFFICIENT_ZONE_RESOURCES = { + .key = DATA_PROTECT, .asc = 0x55, .ascq = 0x0e +}; + /* * scsi_convert_sense * -- 2.56.0
