Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 2 Sep 2012 15:00:35 +0000 (UTC)
From:      Matt Jacob <mjacob@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org
Subject:   svn commit: r240014 - stable/9/sys/dev/isp
Message-ID:  <201209021500.q82F0Z0W021535@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: mjacob
Date: Sun Sep  2 15:00:35 2012
New Revision: 240014
URL: http://svn.freebsd.org/changeset/base/240014

Log:
  MFC of 228914
  
  Fix target mode compilation issues that arose after a change
  in the sense data structures.

Modified:
  stable/9/sys/dev/isp/isp_freebsd.c
  stable/9/sys/dev/isp/isp_freebsd.h
Directory Properties:
  stable/9/sys/   (props changed)
  stable/9/sys/dev/   (props changed)
  stable/9/sys/dev/isp/   (props changed)

Modified: stable/9/sys/dev/isp/isp_freebsd.c
==============================================================================
--- stable/9/sys/dev/isp/isp_freebsd.c	Sun Sep  2 14:56:04 2012	(r240013)
+++ stable/9/sys/dev/isp/isp_freebsd.c	Sun Sep  2 15:00:35 2012	(r240014)
@@ -3248,10 +3248,10 @@ isptargstart(struct cam_periph *periph, 
 		xpt_print(atio->ccb_h.path, "[0x%x] Non-Zero Lun %d: cdb0=0x%x\n", atio->tag_id, return_lun, cdb[0]);
 		if (cdb[0] != INQUIRY && cdb[0] != REPORT_LUNS && cdb[0] != REQUEST_SENSE) {
 			status = SCSI_STATUS_CHECK_COND;
-			atio->sense_data.error_code = SSD_ERRCODE_VALID|SSD_CURRENT_ERROR|SSD_KEY_ILLEGAL_REQUEST;
-			atio->sense_data.add_sense_code = 0x25;
-			atio->sense_data.add_sense_code_qual = 0x0;
-			atio->sense_len = sizeof (atio->sense_data);
+			SDFIXED(atio->sense_data)->error_code = SSD_ERRCODE_VALID|SSD_CURRENT_ERROR|SSD_KEY_ILLEGAL_REQUEST;
+			SDFIXED(atio->sense_data)->add_sense_code = 0x25;
+			SDFIXED(atio->sense_data)->add_sense_code_qual = 0x0;
+			atio->sense_len = SSD_MIN_SIZE;
 		}
 		return_lun = CAM_LUN_WILDCARD;
 	}
@@ -3275,10 +3275,10 @@ isptargstart(struct cam_periph *periph, 
 	case READ_16:
 		if (isptarg_rwparm(cdb, disk_data, disk_size, atio->ccb_h.ccb_data_offset, &data_ptr, &data_len, &last)) {
 			status = SCSI_STATUS_CHECK_COND;
-			atio->sense_data.error_code = SSD_ERRCODE_VALID|SSD_CURRENT_ERROR|SSD_KEY_UNIT_ATTENTION;
-			atio->sense_data.add_sense_code = 0x5;
-			atio->sense_data.add_sense_code_qual = 0x24;
-			atio->sense_len = sizeof (atio->sense_data);
+			SDFIXED(atio->sense_data)->error_code = SSD_ERRCODE_VALID|SSD_CURRENT_ERROR|SSD_KEY_UNIT_ATTENTION;
+			SDFIXED(atio->sense_data)->add_sense_code = 0x5;
+			SDFIXED(atio->sense_data)->add_sense_code_qual = 0x24;
+			atio->sense_len = SSD_MIN_SIZE;
 		} else {
 #ifdef	ISP_FORCE_TIMEOUT
 			{
@@ -3314,10 +3314,10 @@ isptargstart(struct cam_periph *periph, 
 	case WRITE_16:
 		if (isptarg_rwparm(cdb, disk_data, disk_size, atio->ccb_h.ccb_data_offset, &data_ptr, &data_len, &last)) {
 			status = SCSI_STATUS_CHECK_COND;
-			atio->sense_data.error_code = SSD_ERRCODE_VALID|SSD_CURRENT_ERROR|SSD_KEY_UNIT_ATTENTION;
-			atio->sense_data.add_sense_code = 0x5;
-			atio->sense_data.add_sense_code_qual = 0x24;
-			atio->sense_len = sizeof (atio->sense_data);
+			SDFIXED(atio->sense_data)->error_code = SSD_ERRCODE_VALID|SSD_CURRENT_ERROR|SSD_KEY_UNIT_ATTENTION;
+			SDFIXED(atio->sense_data)->add_sense_code = 0x5;
+			SDFIXED(atio->sense_data)->add_sense_code_qual = 0x24;
+			atio->sense_len = SSD_MIN_SIZE;
 		} else {
 #ifdef	ISP_FORCE_TIMEOUT
 			{
@@ -3351,10 +3351,10 @@ isptargstart(struct cam_periph *periph, 
 		flags |= CAM_DIR_IN;
 		if (cdb[1] || cdb[2] || cdb[3]) {
 			status = SCSI_STATUS_CHECK_COND;
-			atio->sense_data.error_code = SSD_ERRCODE_VALID|SSD_CURRENT_ERROR|SSD_KEY_UNIT_ATTENTION;
-			atio->sense_data.add_sense_code = 0x5;
-			atio->sense_data.add_sense_code_qual = 0x20;
-			atio->sense_len = sizeof (atio->sense_data);
+			SDFIXED(atio->sense_data)->error_code = SSD_ERRCODE_VALID|SSD_CURRENT_ERROR|SSD_KEY_UNIT_ATTENTION;
+			SDFIXED(atio->sense_data)->add_sense_code = 0x5;
+			SDFIXED(atio->sense_data)->add_sense_code_qual = 0x20;
+			atio->sense_len = SSD_MIN_SIZE;
 			break;
 		}
 		data_len = sizeof (iqd);
@@ -3375,10 +3375,10 @@ isptargstart(struct cam_periph *periph, 
 		if (ca) {
 			ca = 0;
 			status = SCSI_STATUS_CHECK_COND;
-			atio->sense_data.error_code = SSD_ERRCODE_VALID|SSD_CURRENT_ERROR|SSD_KEY_UNIT_ATTENTION;
-			atio->sense_data.add_sense_code = 0x28;
-			atio->sense_data.add_sense_code_qual = 0x0;
-			atio->sense_len = sizeof (atio->sense_data);
+			SDFIXED(atio->sense_data)->error_code = SSD_ERRCODE_VALID|SSD_CURRENT_ERROR|SSD_KEY_UNIT_ATTENTION;
+			SDFIXED(atio->sense_data)->add_sense_code = 0x28;
+			SDFIXED(atio->sense_data)->add_sense_code_qual = 0x0;
+			atio->sense_len = SSD_MIN_SIZE;
 		}
 		break;
 	case SYNCHRONIZE_CACHE:
@@ -3393,10 +3393,10 @@ isptargstart(struct cam_periph *periph, 
 		flags |= CAM_DIR_IN;
 		if (cdb[2] || cdb[3] || cdb[4] || cdb[5]) {
 			status = SCSI_STATUS_CHECK_COND;
-			atio->sense_data.error_code = SSD_ERRCODE_VALID|SSD_CURRENT_ERROR|SSD_KEY_UNIT_ATTENTION;
-			atio->sense_data.add_sense_code = 0x5;
-			atio->sense_data.add_sense_code_qual = 0x24;
-			atio->sense_len = sizeof (atio->sense_data);
+			SDFIXED(atio->sense_data)->error_code = SSD_ERRCODE_VALID|SSD_CURRENT_ERROR|SSD_KEY_UNIT_ATTENTION;
+			SDFIXED(atio->sense_data)->add_sense_code = 0x5;
+			SDFIXED(atio->sense_data)->add_sense_code_qual = 0x24;
+			atio->sense_len = SSD_MIN_SIZE;
 			break;
 		}
 		if (cdb[8] & 0x1) { /* PMI */
@@ -3447,10 +3447,10 @@ isptargstart(struct cam_periph *periph, 
 	default:
 		flags |= CAM_DIR_NONE;
 		status = SCSI_STATUS_CHECK_COND;
-		atio->sense_data.error_code = SSD_ERRCODE_VALID|SSD_CURRENT_ERROR|SSD_KEY_UNIT_ATTENTION;
-		atio->sense_data.add_sense_code = 0x5;
-		atio->sense_data.add_sense_code_qual = 0x20;
-		atio->sense_len = sizeof (atio->sense_data);
+		SDFIXED(atio->sense_data)->error_code = SSD_ERRCODE_VALID|SSD_CURRENT_ERROR|SSD_KEY_UNIT_ATTENTION;
+		SDFIXED(atio->sense_data)->add_sense_code = 0x5;
+		SDFIXED(atio->sense_data)->add_sense_code_qual = 0x20;
+		atio->sense_len = SSD_MIN_SIZE;
 		break;
 	}
 

Modified: stable/9/sys/dev/isp/isp_freebsd.h
==============================================================================
--- stable/9/sys/dev/isp/isp_freebsd.h	Sun Sep  2 14:56:04 2012	(r240013)
+++ stable/9/sys/dev/isp/isp_freebsd.h	Sun Sep  2 15:00:35 2012	(r240014)
@@ -76,6 +76,13 @@
 #define	ISP_IFLAGS	INTR_TYPE_CAM | INTR_ENTROPY | INTR_MPSAFE
 
 #ifdef	ISP_TARGET_MODE
+/* Not quite right, but there was no bump for this change */
+#if __FreeBSD_version < 225469
+#define	SDFIXED(x)	(&x)
+#else
+#define	SDFIXED(x)	((struct scsi_sense_data_fixed *)(&x))
+#endif
+
 #define	ISP_TARGET_FUNCTIONS	1
 #define	ATPDPSIZE	4096
 



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