From owner-svn-src-all@freebsd.org Thu Dec 22 12:18:42 2016 Return-Path: Delivered-To: svn-src-all@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 3C77CC8B8B4; Thu, 22 Dec 2016 12:18:42 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 1735F1D57; Thu, 22 Dec 2016 12:18:42 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBMCIfr3024341; Thu, 22 Dec 2016 12:18:41 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBMCIft4024338; Thu, 22 Dec 2016 12:18:41 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201612221218.uBMCIft4024338@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Thu, 22 Dec 2016 12:18:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310390 - 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-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Dec 2016 12:18:42 -0000 Author: mav Date: Thu Dec 22 12:18:40 2016 New Revision: 310390 URL: https://svnweb.freebsd.org/changeset/base/310390 Log: Add support for REPD bit in RSTMF command. We have no real timeout values to report there, but its better then error. MFC after: 2 weeks Modified: head/sys/cam/ctl/ctl.c head/sys/cam/ctl/ctl_cmd_table.c head/sys/cam/scsi/scsi_all.h Modified: head/sys/cam/ctl/ctl.c ============================================================================== --- head/sys/cam/ctl/ctl.c Thu Dec 22 11:10:11 2016 (r310389) +++ head/sys/cam/ctl/ctl.c Thu Dec 22 12:18:40 2016 (r310390) @@ -7462,7 +7462,7 @@ int ctl_report_supported_tmf(struct ctl_scsiio *ctsio) { struct scsi_report_supported_tmf *cdb; - struct scsi_report_supported_tmf_data *data; + struct scsi_report_supported_tmf_ext_data *data; int retval; int alloc_len, total_len; @@ -7472,7 +7472,10 @@ ctl_report_supported_tmf(struct ctl_scsi retval = CTL_RETVAL_COMPLETE; - total_len = sizeof(struct scsi_report_supported_tmf_data); + if (cdb->options & RST_REPD) + total_len = sizeof(struct scsi_report_supported_tmf_ext_data); + else + total_len = sizeof(struct scsi_report_supported_tmf_data); alloc_len = scsi_4btoul(cdb->length); ctsio->kern_data_ptr = malloc(total_len, M_CTL, M_WAITOK | M_ZERO); @@ -7491,10 +7494,11 @@ ctl_report_supported_tmf(struct ctl_scsi ctsio->kern_data_resid = 0; ctsio->kern_rel_offset = 0; - data = (struct scsi_report_supported_tmf_data *)ctsio->kern_data_ptr; + data = (struct scsi_report_supported_tmf_ext_data *)ctsio->kern_data_ptr; data->byte1 |= RST_ATS | RST_ATSS | RST_CTSS | RST_LURS | RST_QTS | RST_TRS; data->byte2 |= RST_QAES | RST_QTSS | RST_ITNRS; + data->length = total_len - 4; ctl_set_success(ctsio); ctsio->io_hdr.flags |= CTL_FLAG_ALLOCATED; Modified: head/sys/cam/ctl/ctl_cmd_table.c ============================================================================== --- head/sys/cam/ctl/ctl_cmd_table.c Thu Dec 22 11:10:11 2016 (r310389) +++ head/sys/cam/ctl/ctl_cmd_table.c Thu Dec 22 12:18:40 2016 (r310390) @@ -824,7 +824,7 @@ const struct ctl_cmd_entry ctl_cmd_table CTL_FLAG_DATA_IN | CTL_CMD_FLAG_ALLOW_ON_PR_RESV, CTL_LUN_PAT_NONE, - 12, {0x0d, 0, 0, 0, 0, 0xff, 0xff, 0xff, 0xff, 0, 0x07}}, + 12, {0x0d, 0x80, 0, 0, 0, 0xff, 0xff, 0xff, 0xff, 0, 0x07}}, /* 0E */ {NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE, CTL_LUN_PAT_NONE}, Modified: head/sys/cam/scsi/scsi_all.h ============================================================================== --- head/sys/cam/scsi/scsi_all.h Thu Dec 22 11:10:11 2016 (r310389) +++ head/sys/cam/scsi/scsi_all.h Thu Dec 22 12:18:40 2016 (r310390) @@ -1482,6 +1482,10 @@ struct scsi_report_supported_opcodes_des uint8_t flags; #define RSO_SERVACTV 0x01 #define RSO_CTDP 0x02 +#define RSO_CDLP_MASK 0x0c +#define RSO_CDLP_NO 0x00 +#define RSO_CDLP_A 0x04 +#define RSO_CDLP_B 0x08 uint8_t cdb_length[2]; struct scsi_report_supported_opcodes_timeout timeout[0]; }; @@ -1497,6 +1501,10 @@ struct scsi_report_supported_opcodes_one uint8_t reserved; uint8_t support; #define RSO_ONE_CTDP 0x80 +#define RSO_ONE_CDLP_MASK 0x18 +#define RSO_ONE_CDLP_NO 0x00 +#define RSO_ONE_CDLP_A 0x08 +#define RSO_ONE_CDLP_B 0x10 #define RSO_ONE_SUP_MASK 0x07 #define RSO_ONE_SUP_UNAVAIL 0x00 #define RSO_ONE_SUP_NOT_SUP 0x01 @@ -1510,7 +1518,9 @@ struct scsi_report_supported_tmf { uint8_t opcode; uint8_t service_action; - uint8_t reserved[4]; + uint8_t options; +#define RST_REPD 0x80 + uint8_t reserved[3]; uint8_t length[4]; uint8_t reserved1; uint8_t control; @@ -1531,7 +1541,34 @@ struct scsi_report_supported_tmf_data #define RST_ITNRS 0x01 #define RST_QTSS 0x02 #define RST_QAES 0x04 - uint8_t reserved[2]; + uint8_t reserved; + uint8_t length; +}; + +struct scsi_report_supported_tmf_ext_data +{ + uint8_t byte1; + uint8_t byte2; + uint8_t reserved; + uint8_t length; + uint8_t byte5; +#define RST_TMFTMOV 0x01 + uint8_t reserved2; + uint8_t byte7; +#define RST_WAKETS 0x01 +#define RST_TRTS 0x02 +#define RST_QTTS 0x04 +#define RST_LURTS 0x08 +#define RST_CTSTS 0x10 +#define RST_CACATS 0x20 +#define RST_ATSTS 0x40 +#define RST_ATTS 0x80 + uint8_t byte8; +#define RST_ITNRTS 0x01 +#define RST_QTSTS 0x02 +#define RST_QAETS 0x04 + uint8_t long_timeout[4]; + uint8_t short_timeout[4]; }; struct scsi_report_timestamp