From owner-svn-src-head@freebsd.org Thu Sep 24 08:04:49 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id F2080A0719F; Thu, 24 Sep 2015 08:04:48 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E244A18C8; Thu, 24 Sep 2015 08:04:48 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8O84mpf012407; Thu, 24 Sep 2015 08:04:48 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8O84m4h012404; Thu, 24 Sep 2015 08:04:48 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201509240804.t8O84m4h012404@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Thu, 24 Sep 2015 08:04:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288166 - in head/sys/cam: ctl scsi X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 24 Sep 2015 08:04:49 -0000 Author: mav Date: Thu Sep 24 08:04:47 2015 New Revision: 288166 URL: https://svnweb.freebsd.org/changeset/base/288166 Log: 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. Modified: head/sys/cam/ctl/ctl.c head/sys/cam/ctl/scsi_ctl.c head/sys/cam/scsi/scsi_all.h Modified: head/sys/cam/ctl/ctl.c ============================================================================== --- head/sys/cam/ctl/ctl.c Thu Sep 24 07:16:34 2015 (r288165) +++ head/sys/cam/ctl/ctl.c Thu Sep 24 08:04:47 2015 (r288166) @@ -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 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 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 *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; Modified: head/sys/cam/ctl/scsi_ctl.c ============================================================================== --- head/sys/cam/ctl/scsi_ctl.c Thu Sep 24 07:16:34 2015 (r288165) +++ head/sys/cam/ctl/scsi_ctl.c Thu Sep 24 08:04:47 2015 (r288166) @@ -1068,7 +1068,6 @@ ctlfe_adjust_cdb(struct ccb_accept_tio * } 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); Modified: head/sys/cam/scsi/scsi_all.h ============================================================================== --- head/sys/cam/scsi/scsi_all.h Thu Sep 24 07:16:34 2015 (r288165) +++ head/sys/cam/scsi/scsi_all.h Thu Sep 24 08:04:47 2015 (r288166) @@ -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