Update WRITE ATOMIC(16) support to sbc4r8 draft.

This is only a cosmetic change.  We still don't support atomic boundary
field in the CDB, but at least now we do it formally.
This commit is contained in:
mav 2015-09-24 08:04:47 +00:00
parent 09cbc1126e
commit 9e5012814b
3 changed files with 28 additions and 7 deletions

View File

@ -8940,7 +8940,7 @@ ctl_read_write(struct ctl_scsiio *ctsio)
break;
}
case WRITE_ATOMIC_16: {
struct scsi_rw_16 *cdb;
struct scsi_write_atomic_16 *cdb;
if (lun->be_lun->atomicblock == 0) {
ctl_set_invalid_opcode(ctsio);
@ -8948,13 +8948,13 @@ ctl_read_write(struct ctl_scsiio *ctsio)
return (CTL_RETVAL_COMPLETE);
}
cdb = (struct scsi_rw_16 *)ctsio->cdb;
cdb = (struct scsi_write_atomic_16 *)ctsio->cdb;
if (cdb->byte2 & SRW12_FUA)
flags |= CTL_LLF_FUA;
if (cdb->byte2 & SRW12_DPO)
flags |= CTL_LLF_DPO;
lba = scsi_8btou64(cdb->addr);
num_blocks = scsi_4btoul(cdb->length);
num_blocks = scsi_2btoul(cdb->length);
if (num_blocks > lun->be_lun->atomicblock) {
ctl_set_invalid_field(ctsio, /*sks_valid*/ 1,
/*command*/ 1, /*field*/ 12, /*bit_valid*/ 0,
@ -10148,6 +10148,8 @@ ctl_inquiry_evpd_block_limits(struct ctl_scsiio *ctsio, int alloc_len)
bl_ptr->max_atomic_transfer_length);
scsi_ulto4b(0, bl_ptr->atomic_alignment);
scsi_ulto4b(0, bl_ptr->atomic_transfer_length_granularity);
scsi_ulto4b(0, bl_ptr->max_atomic_transfer_length_with_atomic_boundary);
scsi_ulto4b(0, bl_ptr->max_atomic_boundary_size);
}
scsi_u64to8b(UINT64_MAX, bl_ptr->max_write_same_length);
@ -10647,8 +10649,7 @@ ctl_get_lba_len(union ctl_io *io, uint64_t *lba, uint64_t *len)
break;
}
case READ_16:
case WRITE_16:
case WRITE_ATOMIC_16: {
case WRITE_16: {
struct scsi_rw_16 *cdb;
cdb = (struct scsi_rw_16 *)io->scsiio.cdb;
@ -10657,6 +10658,15 @@ ctl_get_lba_len(union ctl_io *io, uint64_t *lba, uint64_t *len)
*len = scsi_4btoul(cdb->length);
break;
}
case WRITE_ATOMIC_16: {
struct scsi_write_atomic_16 *cdb;
cdb = (struct scsi_write_atomic_16 *)io->scsiio.cdb;
*lba = scsi_8btou64(cdb->addr);
*len = scsi_2btoul(cdb->length);
break;
}
case WRITE_VERIFY_16: {
struct scsi_write_verify_16 *cdb;

View File

@ -1068,7 +1068,6 @@ ctlfe_adjust_cdb(struct ccb_accept_tio *atio, uint32_t offset)
}
case READ_16:
case WRITE_16:
case WRITE_ATOMIC_16:
{
struct scsi_rw_16 *cdb = (struct scsi_rw_16 *)cmdbyt;
lba = scsi_8btou64(cdb->addr);

View File

@ -1283,6 +1283,17 @@ struct scsi_rw_16
u_int8_t control;
};
struct scsi_write_atomic_16
{
uint8_t opcode;
uint8_t byte2;
uint8_t addr[8];
uint8_t boundary[2];
uint8_t length[2];
uint8_t group;
uint8_t control;
};
struct scsi_write_same_10
{
uint8_t opcode;
@ -2757,7 +2768,8 @@ struct scsi_vpd_block_limits
u_int8_t max_atomic_transfer_length[4];
u_int8_t atomic_alignment[4];
u_int8_t atomic_transfer_length_granularity[4];
u_int8_t reserved2[8];
u_int8_t max_atomic_transfer_length_with_atomic_boundary[4];
u_int8_t max_atomic_boundary_size[4];
};
struct scsi_read_capacity