Index: sys/cam/scsi/scsi_all.h
===================================================================
RCS file: /home/ncvs/src/sys/cam/scsi/scsi_all.h,v
retrieving revision 1.19
diff -u -r1.19 scsi_all.h
--- sys/cam/scsi/scsi_all.h	4 Jun 2002 17:41:47 -0000	1.19
+++ sys/cam/scsi/scsi_all.h	19 Aug 2002 04:35:58 -0000
@@ -940,18 +940,18 @@
 void		scsi_mode_sense(struct ccb_scsiio *csio, u_int32_t retries,
 				void (*cbfcnp)(struct cam_periph *,
 					       union ccb *),
-				u_int8_t tag_action, int dbd,
-				u_int8_t page_code, u_int8_t page,
+				u_int8_t tag_action, int minimum_cmd_size,
+				int dbd, u_int8_t page_code, u_int8_t page,
 				u_int8_t *param_buf, u_int32_t param_len,
 				u_int8_t sense_len, u_int32_t timeout);
 
 void		scsi_mode_select(struct ccb_scsiio *csio, u_int32_t retries,
 				 void (*cbfcnp)(struct cam_periph *,
 						union ccb *),
-				 u_int8_t tag_action, int scsi_page_fmt,
-				 int save_pages, u_int8_t *param_buf,
-				 u_int32_t param_len, u_int8_t sense_len,
-				 u_int32_t timeout);
+				 u_int8_t tag_action, int minimum_cmd_size,
+				 int scsi_page_fmt, int save_pages,
+				 u_int8_t *param_buf, u_int32_t param_len,
+				 u_int8_t sense_len, u_int32_t timeout);
 
 void		scsi_log_sense(struct ccb_scsiio *csio, u_int32_t retries,
 			       void (*cbfcnp)(struct cam_periph *, union ccb *),
Index: sys/cam/scsi/scsi_all.c
===================================================================
RCS file: /home/ncvs/src/sys/cam/scsi/scsi_all.c,v
retrieving revision 1.35
diff -u -r1.35 scsi_all.c
--- sys/cam/scsi/scsi_all.c	5 Jun 2002 19:10:57 -0000	1.35
+++ sys/cam/scsi/scsi_all.c	19 Aug 2002 04:36:05 -0000
@@ -2409,8 +2409,9 @@
 void
 scsi_mode_sense(struct ccb_scsiio *csio, u_int32_t retries,
 		void (*cbfcnp)(struct cam_periph *, union ccb *),
-		u_int8_t tag_action, int dbd, u_int8_t page_code,
-		u_int8_t page, u_int8_t *param_buf, u_int32_t param_len,
+		u_int8_t tag_action, int minimum_cmd_size,
+		int dbd, u_int8_t page_code, u_int8_t page,
+		u_int8_t *param_buf, u_int32_t param_len,
 		u_int8_t sense_len, u_int32_t timeout)
 {
 	u_int8_t cdb_len;
@@ -2418,7 +2419,7 @@
 	/*
 	 * Use the smallest possible command to perform the operation.
 	 */
-	if (param_len < 256) {
+	if (minimum_cmd_size < 10 && param_len < 256) {
 		/*
 		 * We can fit in a 6 byte cdb.
 		 */
@@ -2462,16 +2463,17 @@
 void
 scsi_mode_select(struct ccb_scsiio *csio, u_int32_t retries,
 		 void (*cbfcnp)(struct cam_periph *, union ccb *),
-		 u_int8_t tag_action, int scsi_page_fmt, int save_pages,
-		 u_int8_t *param_buf, u_int32_t param_len, u_int8_t sense_len,
-		 u_int32_t timeout)
+		 u_int8_t tag_action, int minimum_cmd_size,
+		 int scsi_page_fmt, int save_pages,
+		 u_int8_t *param_buf, u_int32_t param_len,
+		 u_int8_t sense_len, u_int32_t timeout)
 {
 	u_int8_t cdb_len;
 
 	/*
 	 * Use the smallest possible command to perform the operation.
 	 */
-	if (param_len < 256) {
+	if (minimum_cmd_size < 10 && param_len < 256) {
 		/*
 		 * We can fit in a 6 byte cdb.
 		 */
Index: sys/cam/scsi/scsi_sa.c
===================================================================
RCS file: /home/ncvs/src/sys/cam/scsi/scsi_sa.c,v
retrieving revision 1.83
diff -u -r1.83 scsi_sa.c
--- sys/cam/scsi/scsi_sa.c	15 Aug 2002 20:54:03 -0000	1.83
+++ sys/cam/scsi/scsi_sa.c	19 Aug 2002 04:36:14 -0000
@@ -2521,7 +2521,7 @@
 	mode_blk = (struct scsi_mode_blk_desc *)&mode_hdr[1];
 
 	/* it is safe to retry this */
-	scsi_mode_sense(&ccb->csio, 5, sadone, MSG_SIMPLE_Q_TAG, FALSE,
+	scsi_mode_sense(&ccb->csio, 5, sadone, MSG_SIMPLE_Q_TAG, 6, FALSE,
 	    SMS_PAGE_CTRL_CURRENT, (params_to_get & SA_PARAM_COMPRESSION) ?
 	    cpage : SMS_VENDOR_SPECIFIC_PAGE, mode_buffer, mode_buffer_len,
 	    SSD_FULL_SIZE, SCSIOP_TIMEOUT);
@@ -2585,8 +2585,8 @@
 		 * for the block descriptor, etc.
 		 */
 
-		scsi_mode_sense(&ccb->csio, 2, sadone, MSG_SIMPLE_Q_TAG, FALSE,
-		    SMS_PAGE_CTRL_CURRENT, SMS_VENDOR_SPECIFIC_PAGE,
+		scsi_mode_sense(&ccb->csio, 2, sadone, MSG_SIMPLE_Q_TAG, 6,
+		    FALSE, SMS_PAGE_CTRL_CURRENT, SMS_VENDOR_SPECIFIC_PAGE,
 		    mode_buffer, mode_buffer_len, SSD_FULL_SIZE,
 		    SCSIOP_TIMEOUT);
 
@@ -2880,7 +2880,7 @@
 	}
 
 	/* It is safe to retry this operation */
-	scsi_mode_select(&ccb->csio, 5, sadone, MSG_SIMPLE_Q_TAG,
+	scsi_mode_select(&ccb->csio, 5, sadone, MSG_SIMPLE_Q_TAG, 6,
 	    (params_to_set & SA_PARAM_COMPRESSION)? TRUE : FALSE,
 	    FALSE, mode_buffer, mode_buffer_len, SSD_FULL_SIZE, SCSIOP_TIMEOUT);
 
Index: sys/cam/scsi/scsi_ch.c
===================================================================
RCS file: /home/ncvs/src/sys/cam/scsi/scsi_ch.c,v
retrieving revision 1.30
diff -u -r1.30 scsi_ch.c
--- sys/cam/scsi/scsi_ch.c	15 Aug 2002 20:54:02 -0000	1.30
+++ sys/cam/scsi/scsi_ch.c	19 Aug 2002 04:36:17 -0000
@@ -536,6 +536,7 @@
 				/* retries */ 1,
 				/* cbfcnp */ chdone,
 				/* tag_action */ MSG_SIMPLE_Q_TAG,
+				/* minimum_cmd_size */ 6,
 				/* dbd */ (softc->quirks & CH_Q_NO_DBD) ?
 					FALSE : TRUE,
 				/* page_code */ SMS_PAGE_CTRL_CURRENT,
@@ -1374,6 +1375,7 @@
 			/* retries */ 1,
 			/* cbfcnp */ chdone,
 			/* tag_action */ MSG_SIMPLE_Q_TAG,
+			/* minimum_cmd_size */ 6,
 			/* dbd */ dbd,
 			/* page_code */ SMS_PAGE_CTRL_CURRENT,
 			/* page */ CH_ELEMENT_ADDR_ASSIGN_PAGE,
@@ -1437,6 +1439,7 @@
 			/* retries */ 1,
 			/* cbfcnp */ chdone,
 			/* tag_action */ MSG_SIMPLE_Q_TAG,
+			/* minimum_cmd_size */ 6,
 			/* dbd */ dbd,
 			/* page_code */ SMS_PAGE_CTRL_CURRENT,
 			/* page */ CH_DEVICE_CAP_PAGE,
Index: sbin/camcontrol/camcontrol.c
===================================================================
RCS file: /home/ncvs/src/sbin/camcontrol/camcontrol.c,v
retrieving revision 1.44
diff -u -r1.44 camcontrol.c
--- sbin/camcontrol/camcontrol.c	18 Aug 2002 21:48:38 -0000	1.44
+++ sbin/camcontrol/camcontrol.c	19 Aug 2002 04:36:25 -0000
@@ -1584,6 +1584,7 @@
 			/* retries */ retry_count,
 			/* cbfcnp */ NULL,
 			/* tag_action */ MSG_SIMPLE_Q_TAG,
+			/* minimum_cmd_size */ 6,
 			/* dbd */ dbd,
 			/* page_code */ page_control << 6,
 			/* page */ mode_page,
@@ -1634,6 +1635,7 @@
 			 /* retries */ retry_count,
 			 /* cbfcnp */ NULL,
 			 /* tag_action */ MSG_SIMPLE_Q_TAG,
+			 /* minimum_cmd_size */ 6,
 			 /* scsi_page_fmt */ 1,
 			 /* save_pages */ save_pages,
 			 /* param_buf */ data,
Index: sys/cam/cam_xpt.c
===================================================================
RCS file: /home/ncvs/src/sys/cam/cam_xpt.c,v
retrieving revision 1.124
diff -u -r1.124 cam_xpt.c
--- cam_xpt.c	24 Apr 2002 00:00:55 -0000	1.124
+++ cam_xpt.c	19 Aug 2002 17:24:06 -0000
@@ -5628,6 +5628,7 @@
 					/*retries*/4,
 					probedone,
 					MSG_SIMPLE_Q_TAG,
+					/*minimum_cmd_size*/6,
 					/*dbd*/FALSE,
 					SMS_PAGE_CTRL_CURRENT,
 					SMS_CONTROL_MODE_PAGE,
