Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 10 Apr 2017 03:09:12 +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-10@freebsd.org
Subject:   svn commit: r316671 - stable/10/sys/dev/hyperv/storvsc
Message-ID:  <201704100309.v3A39Cxs086698@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: sephe
Date: Mon Apr 10 03:09:12 2017
New Revision: 316671
URL: https://svnweb.freebsd.org/changeset/base/316671

Log:
  MFC 316519
  
      hyperv/storvsc: Fixup SRB status.
  
      This unbreaks GEN2 Hyper-V cd support.
  
      Submitted by:   Hongjiang Zhang <honzhan microsoft com>
      Reviewed by:    dexuan@
      Sponsored by:   Microsoft
      Differential Revision:  https://reviews.freebsd.org/D10212

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

Modified: stable/10/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c
==============================================================================
--- stable/10/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c	Mon Apr 10 02:46:39 2017	(r316670)
+++ stable/10/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c	Mon Apr 10 03:09:12 2017	(r316671)
@@ -2148,19 +2148,20 @@ storvsc_io_done(struct hv_storvsc_reques
 
 	ccb->ccb_h.status &= ~CAM_SIM_QUEUED;
 	ccb->ccb_h.status &= ~CAM_STATUS_MASK;
+	int srb_status = SRB_STATUS(vm_srb->srb_status);
 	if (vm_srb->scsi_status == SCSI_STATUS_OK) {
 		const struct scsi_generic *cmd;
 
 		cmd = (const struct scsi_generic *)
 		    ((ccb->ccb_h.flags & CAM_CDB_POINTER) ?
 		     csio->cdb_io.cdb_ptr : csio->cdb_io.cdb_bytes);
-		if (vm_srb->srb_status != SRB_STATUS_SUCCESS) {
+		if (srb_status != SRB_STATUS_SUCCESS) {
 			/*
 			 * If there are errors, for example, invalid LUN,
 			 * host will inform VM through SRB status.
 			 */
 			if (bootverbose) {
-				if (vm_srb->srb_status == SRB_STATUS_INVALID_LUN) {
+				if (srb_status == SRB_STATUS_INVALID_LUN) {
 					xpt_print(ccb->ccb_h.path,
 					    "invalid LUN %d for op: %s\n",
 					    vm_srb->lun,
@@ -2168,7 +2169,7 @@ storvsc_io_done(struct hv_storvsc_reques
 				} else {
 					xpt_print(ccb->ccb_h.path,
 					    "Unknown SRB flag: %d for op: %s\n",
-					    vm_srb->srb_status,
+					    srb_status,
 					    scsi_op_desc(cmd->opcode, NULL));
 				}
 			}
@@ -2191,7 +2192,7 @@ storvsc_io_done(struct hv_storvsc_reques
 		}
 
 		if (cmd->opcode == INQUIRY &&
-		    vm_srb->srb_status == SRB_STATUS_SUCCESS) {
+		    srb_status == SRB_STATUS_SUCCESS) {
 			int resp_xfer_len, resp_buf_len, data_len;
 			uint8_t *resp_buf = (uint8_t *)csio->data_ptr;
 			struct scsi_inquiry_data *inq_data =

Modified: stable/10/sys/dev/hyperv/storvsc/hv_vstorage.h
==============================================================================
--- stable/10/sys/dev/hyperv/storvsc/hv_vstorage.h	Mon Apr 10 02:46:39 2017	(r316670)
+++ stable/10/sys/dev/hyperv/storvsc/hv_vstorage.h	Mon Apr 10 03:09:12 2017	(r316671)
@@ -242,17 +242,16 @@ struct vstor_packet {
 #define SRB_STATUS_PENDING		0x00
 #define SRB_STATUS_SUCCESS		0x01
 #define SRB_STATUS_ABORTED		0x02
-#define SRB_STATUS_ABORT_FAILED	0x03
 #define SRB_STATUS_ERROR 		0x04
-#define SRB_STATUS_BUSY			0x05
-
+#define SRB_STATUS_INVALID_LUN          0x20
 /**
  * SRB Status Masks (can be combined with above status codes)
  */
 #define SRB_STATUS_QUEUE_FROZEN         0x40
 #define SRB_STATUS_AUTOSENSE_VALID      0x80
-#define SRB_STATUS_INVALID_LUN          0X20
 
+#define SRB_STATUS(status)	\
+	((status) & ~(SRB_STATUS_AUTOSENSE_VALID | SRB_STATUS_QUEUE_FROZEN))
 /*
  * SRB Flag Bits
  */



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