Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 24 Jul 2017 01:39:58 +0000 (UTC)
From:      Sepherosa Ziehau <sephe@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org
Subject:   svn commit: r321404 - stable/11/sys/dev/hyperv/storvsc
Message-ID:  <201707240139.v6O1dwEJ017760@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: sephe
Date: Mon Jul 24 01:39:58 2017
New Revision: 321404
URL: https://svnweb.freebsd.org/changeset/base/321404

Log:
  MFC 321286
  
      hyperv/storvsc: Force SPC3 for CDROM attached.
  
      This unbreaks the CDROM attaching on GEN2 VMs.  On GEN1 VMs, CDROM is
      attached to emulated ATA controller.
  
      PR:             220790
      Submitted by:   Hongjiang Zhang <honzhan microsoft com>
      Sponsored by:   Microsoft
      Differential Revision:  https://reviews.freebsd.org/D11634

Modified:
  stable/11/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c
==============================================================================
--- stable/11/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c	Mon Jul 24 00:53:43 2017	(r321403)
+++ stable/11/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c	Mon Jul 24 01:39:58 2017	(r321404)
@@ -2211,6 +2211,23 @@ storvsc_io_done(struct hv_storvsc_request *reqp)
 				    resp_buf[3], resp_buf[4]);
 			}
 			/*
+			 * XXX: Hyper-V (since win2012r2) responses inquiry with
+			 * unknown version (0) for GEN-2 DVD device.
+			 * Manually set the version number to SPC3 in order to
+			 * ask CAM to continue probing with "PROBE_REPORT_LUNS".
+			 * see probedone() in scsi_xpt.c
+			 */
+			if (SID_TYPE(inq_data) == T_CDROM &&
+			    inq_data->version == 0 &&
+			    (vmstor_proto_version >= VMSTOR_PROTOCOL_VERSION_WIN8)) {
+				inq_data->version = SCSI_REV_SPC3;
+				if (bootverbose) {
+					xpt_print(ccb->ccb_h.path,
+					    "set version from 0 to %d\n",
+					    inq_data->version);
+				}
+			}
+			/*
 			 * XXX: Manually fix the wrong response returned from WS2012
 			 */
 			if (!is_scsi_valid(inq_data) &&
@@ -2219,7 +2236,7 @@ storvsc_io_done(struct hv_storvsc_request *reqp)
 			    vmstor_proto_version == VMSTOR_PROTOCOL_VERSION_WIN7)) {
 				if (data_len >= 4 &&
 				    (resp_buf[2] == 0 || resp_buf[3] == 0)) {
-					resp_buf[2] = 5; // verion=5 means SPC-3
+					resp_buf[2] = SCSI_REV_SPC3;
 					resp_buf[3] = 2; // resp fmt must be 2
 					if (bootverbose)
 						xpt_print(ccb->ccb_h.path,



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201707240139.v6O1dwEJ017760>