Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 23 Jun 2005 04:19:58 GMT
From:      Scott Long <scottl@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 78841 for review
Message-ID:  <200506230419.j5N4JwGA099870@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=78841

Change 78841 by scottl@scottl-junior on 2005/06/23 04:18:58

	Partial IFC

Affected files ...

.. //depot/projects/scottl-camlock/src/sys/cam/cam_periph.c#3 integrate
.. //depot/projects/scottl-camlock/src/sys/cam/cam_xpt.c#14 integrate
.. //depot/projects/scottl-camlock/src/sys/cam/scsi/scsi_all.c#3 integrate
.. //depot/projects/scottl-camlock/src/sys/cam/scsi/scsi_cd.c#3 integrate
.. //depot/projects/scottl-camlock/src/sys/cam/scsi/scsi_ch.c#4 integrate
.. //depot/projects/scottl-camlock/src/sys/cam/scsi/scsi_da.c#5 integrate
.. //depot/projects/scottl-camlock/src/sys/cam/scsi/scsi_low.c#4 integrate
.. //depot/projects/scottl-camlock/src/sys/cam/scsi/scsi_sa.c#4 integrate
.. //depot/projects/scottl-camlock/src/sys/cam/scsi/scsi_target.c#4 integrate

Differences ...

==== //depot/projects/scottl-camlock/src/sys/cam/cam_periph.c#3 (text+ko) ====

@@ -28,7 +28,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/cam/cam_periph.c,v 1.58 2005/01/05 22:34:34 imp Exp $");
+__FBSDID("$FreeBSD: src/sys/cam/cam_periph.c,v 1.59 2005/02/20 23:45:49 scottl Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -445,6 +445,10 @@
 		if (strcmp((*p_drv)->driver_name, periph->periph_name) == 0)
 			break;
 	}
+	if (*p_drv == NULL) {
+		printf("camperiphfree: attempt to free non-existant periph\n");
+		return;
+	}
 	
 	if (periph->periph_dtor != NULL)
 		periph->periph_dtor(periph);

==== //depot/projects/scottl-camlock/src/sys/cam/cam_xpt.c#14 (text+ko) ====

@@ -28,7 +28,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/cam/cam_xpt.c,v 1.149 2005/02/09 11:44:15 scottl Exp $");
+__FBSDID("$FreeBSD: src/sys/cam/cam_xpt.c,v 1.153 2005/05/11 17:39:33 kan Exp $");
 
 #include <sys/param.h>
 #include <sys/bus.h>
@@ -2379,7 +2379,7 @@
 					break;
 			}
 
-			if (pdrv == NULL) {
+			if (*pdrv == NULL) {
 				cdm->status = CAM_DEV_MATCH_ERROR;
 				return(0);
 			}
@@ -4871,6 +4871,7 @@
 		device->qfrozen_cnt = 0;
 		device->flags = CAM_DEV_UNCONFIGURED;
 		device->tag_delay_count = 0;
+		device->tag_saved_openings = 0;
 		device->refcount = 1;
 		callout_handle_init(&device->c_handle);
 
@@ -4958,6 +4959,9 @@
 	if (result == CAM_REQ_CMP && (diff < 0)) {
 		dev->flags |= CAM_DEV_RESIZE_QUEUE_NEEDED;
 	}
+	if ((dev->flags & CAM_DEV_TAG_AFTER_COUNT) != 0
+	 || (dev->inq_flags & SID_CmdQue) != 0)
+		dev->tag_saved_openings = newopenings;
 	/* Adjust the global limit */
 	xpt_max_ccbs += diff;
 	splx(s);
@@ -5189,7 +5193,6 @@
 			struct cam_path *path;
 			cam_status status;
 
-			path = request_ccb->ccb_h.path;
 			status = xpt_create_path(&path, xpt_periph,
 						 path_id, target_id, lun_id);
 			if (status != CAM_REQ_CMP) {
@@ -5205,8 +5208,8 @@
 					free(scan_info, M_TEMP);
 					request_ccb->ccb_h.status = CAM_REQ_CMP;
 					xpt_done(request_ccb);
-					break;
 				}
+				break;
 			}
 			xpt_setup_ccb(&request_ccb->ccb_h, path,
 				      request_ccb->ccb_h.pinfo.priority);
@@ -5224,7 +5227,6 @@
 	}
 }
 
-void
 xpt_find_quirk(struct cam_ed *device)
 {
 	caddr_t	match;
@@ -5854,7 +5856,11 @@
 	device->flags &= ~CAM_DEV_TAG_AFTER_COUNT;
 	xpt_freeze_devq(path, /*count*/1);
 	device->inq_flags |= SID_CmdQue;
-	newopenings = min(device->quirk->maxtags, sim->max_tagged_dev_openings);
+	if (device->tag_saved_openings != 0)
+		newopenings = device->tag_saved_openings;
+	else
+		newopenings = min(device->quirk->maxtags,
+				  sim->max_tagged_dev_openings);
 	xpt_dev_ccbq_resize(path, newopenings);
 	xpt_setup_ccb(&crs.ccb_h, path, /*priority*/1);
 	crs.ccb_h.func_code = XPT_REL_SIMQ;
@@ -6032,6 +6038,7 @@
 			if (done_ccb->ccb_h.status == CAM_REQ_CMP) {
 				done_ccb->ccb_h.func_code = XPT_SCAN_BUS;
 				done_ccb->ccb_h.cbfcnp = xpt_finishconfig;
+				done_ccb->crcn.flags = 0;
 				xpt_action(done_ccb);
 				return;
 			}

==== //depot/projects/scottl-camlock/src/sys/cam/scsi/scsi_all.c#3 (text+ko) ====

@@ -28,7 +28,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/cam/scsi/scsi_all.c,v 1.46 2005/01/05 22:34:34 imp Exp $");
+__FBSDID("$FreeBSD: src/sys/cam/scsi/scsi_all.c,v 1.48 2005/04/14 03:52:50 mjacob Exp $");
 
 #include <sys/param.h>
 
@@ -1971,7 +1971,7 @@
 			 * errors on finicky architectures.  We don't
 			 * ensure that the sense data is pointer aligned.
 			 */
-			bcopy(&csio->sense_data, sense, 
+			bcopy(&csio->sense_data, &sense, 
 			      sizeof(struct scsi_sense_data *));
 		}
 	} else {
@@ -2312,6 +2312,15 @@
 	int i;
 	int num_syncrates;
 
+	/*
+	 * It's a bug if period is zero, but if it is anyway, don't
+	 * die with a divide fault- instead return something which
+	 * 'approximates' async
+	 */
+	if (period_factor == 0) {
+		return (3300);
+	}
+
 	num_syncrates = sizeof(scsi_syncrates) / sizeof(scsi_syncrates[0]);
 	/* See if the period is in the "exception" table */
 	for (i = 0; i < num_syncrates; i++) {

==== //depot/projects/scottl-camlock/src/sys/cam/scsi/scsi_cd.c#3 (text+ko) ====

@@ -46,7 +46,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/cam/scsi/scsi_cd.c,v 1.92 2005/01/30 08:12:36 sobomax Exp $");
+__FBSDID("$FreeBSD: src/sys/cam/scsi/scsi_cd.c,v 1.93 2005/03/26 06:05:06 ken Exp $");
 
 #include "opt_cd.h"
 
@@ -1929,10 +1929,16 @@
 	/*
 	 * If we don't have media loaded, check for it.  If still don't
 	 * have media loaded, we can only do a load or eject.
+	 *
+	 * We only care whether media is loaded if this is a cd-specific ioctl
+	 * (thus the IOCGROUP check below).  Note that this will break if
+	 * anyone adds any ioctls into the switch statement below that don't
+	 * have their ioctl group set to 'c'.
 	 */
 	if (((softc->flags & CD_FLAG_VALID_MEDIA) == 0)
 	 && ((cmd != CDIOCCLOSE)
-	  && (cmd != CDIOCEJECT))) {
+	  && (cmd != CDIOCEJECT))
+	 && (IOCGROUP(cmd) == 'c')) {
 		error = cdcheckmedia(periph);
 		if (error != 0) {
 			cam_periph_unlock(periph);

==== //depot/projects/scottl-camlock/src/sys/cam/scsi/scsi_ch.c#4 (text+ko) ====

@@ -68,7 +68,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/cam/scsi/scsi_ch.c,v 1.41 2005/01/05 22:34:34 imp Exp $");
+__FBSDID("$FreeBSD: src/sys/cam/scsi/scsi_ch.c,v 1.42 2005/03/26 04:21:11 ken Exp $");
 
 #include <sys/param.h>
 #include <sys/queue.h>
@@ -1157,6 +1157,8 @@
 	 * Fill in the user status array.
 	 */
 	st_hdr = (struct read_element_status_header *)data;
+	pg_hdr = (struct read_element_status_page_header *)((uintptr_t)st_hdr +
+		  sizeof(struct read_element_status_header));
 	avail = scsi_2btoul(st_hdr->count);
 
 	if (avail != cesr->cesr_element_count) {

==== //depot/projects/scottl-camlock/src/sys/cam/scsi/scsi_da.c#5 (text+ko) ====

@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/cam/scsi/scsi_da.c,v 1.173 2005/01/05 22:34:34 imp Exp $");
+__FBSDID("$FreeBSD: src/sys/cam/scsi/scsi_da.c,v 1.180 2005/06/09 17:35:04 pjd Exp $");
 
 #include <sys/param.h>
 
@@ -203,6 +203,7 @@
 	{
 		/*
 		 * Doesn't like the synchronize cache command.
+		 * Reported by: Blaz Zupan <blaz@gold.amis.net>
 		 */
 		{T_DIRECT, SIP_MEDIA_FIXED, quantum, "MAVERICK 540S", "*"},
 		/*quirks*/ DA_Q_NO_SYNC_CACHE
@@ -216,6 +217,14 @@
 	},
 	{
 		/*
+		 * Doesn't like the synchronize cache command.
+		 * Reported by: walter@pelissero.de
+		 */
+		{T_DIRECT, SIP_MEDIA_FIXED, quantum, "LPS540S", "*"},
+		/*quirks*/ DA_Q_NO_SYNC_CACHE
+	},
+	{
+		/*
 		 * Doesn't work correctly with 6 byte reads/writes.
 		 * Returns illegal request, and points to byte 9 of the
 		 * 6-byte CDB.
@@ -231,6 +240,14 @@
 	},
 	{
 		/*
+		 * Doesn't like the synchronize cache command.
+		 * Reported by: walter@pelissero.de
+		 */
+		{T_DIRECT, SIP_MEDIA_FIXED, "CONNER", "CP3500*", "*"},
+                /*quirks*/ DA_Q_NO_SYNC_CACHE
+	},
+	{
+		/*
 		 * The CISS RAID controllers do not support SYNC_CACHE
 		 */
 		{T_DIRECT, SIP_MEDIA_FIXED, "COMPAQ", "RAID*", "*"},
@@ -314,7 +331,30 @@
 		 * Frontier Labs NEX IA+ Digital Audio Player, rev 1.10/0.01
 		 * PR: kern/70158
 		 */
-		{T_DIRECT, SIP_MEDIA_REMOVABLE, "FL" , "NexIA+*", "*"},
+		{T_DIRECT, SIP_MEDIA_REMOVABLE, "FL" , "Nex*", "*"},
+		/*quirks*/ DA_Q_NO_SYNC_CACHE
+	},
+	{
+		/*
+		 * ZICPlay USB MP3 Player with FM
+		 * PR: kern/75057
+		 */
+		{T_DIRECT, SIP_MEDIA_REMOVABLE, "ACTIONS*" , "USB DISK*", "*"},
+		/*quirks*/ DA_Q_NO_SYNC_CACHE
+	},
+	{
+		/*
+		 * TEAC USB floppy mechanisms
+		 */
+		{T_DIRECT, SIP_MEDIA_REMOVABLE, "TEAC" , "FD-05*", "*"},
+		/*quirks*/ DA_Q_NO_SYNC_CACHE
+	},
+	{
+		/*
+		 * Kingston DataTraveler II+ USB Pen-Drive.
+		 * Reported by: Pawel Jakub Dawidek <pjd@FreeBSD.org>
+		 */
+		{T_DIRECT, SIP_MEDIA_REMOVABLE, "Kingston" , "DataTraveler II+", "*"},
 		/*quirks*/ DA_Q_NO_SYNC_CACHE
 	},
 };

==== //depot/projects/scottl-camlock/src/sys/cam/scsi/scsi_low.c#4 (text+ko) ====

@@ -2,7 +2,7 @@
 /*	$NetBSD$	*/
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/cam/scsi/scsi_low.c,v 1.22 2005/01/05 22:34:34 imp Exp $");
+__FBSDID("$FreeBSD: src/sys/cam/scsi/scsi_low.c,v 1.23 2005/03/19 06:32:57 scottl Exp $");
 
 #define	SCSI_LOW_STATICS
 #define	SCSI_LOW_DEBUG
@@ -1421,7 +1421,6 @@
 			CAM_LUN_WILDCARD) != CAM_REQ_CMP) {
 		xpt_bus_deregister(cam_sim_path(slp->sl_si.sim));
 		cam_sim_free(slp->sl_si.sim, /*free_simq*/TRUE);
-		free(slp->sl_si.sim, M_DEVBUF);
 		return ENODEV;
 	}
 

==== //depot/projects/scottl-camlock/src/sys/cam/scsi/scsi_sa.c#4 (text+ko) ====

@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/cam/scsi/scsi_sa.c,v 1.102 2005/01/05 22:34:35 imp Exp $");
+__FBSDID("$FreeBSD: src/sys/cam/scsi/scsi_sa.c,v 1.104 2005/04/14 04:51:18 mjacob Exp $");
 
 #include <sys/param.h>
 #include <sys/queue.h>
@@ -810,10 +810,29 @@
 			}
 			break;
 
+		case MTIOCTOP:
+		{
+			struct mtop *mt = (struct mtop *) arg;
+
+			/*
+			 * Check to make sure it's an OP we can perform
+			 * with no media inserted.
+			 */
+			switch (mt->mt_op) {
+			case MTSETBSIZ:
+			case MTSETDNSTY:
+			case MTCOMP:
+				mt = NULL;
+				/* FALLTHROUGH */
+			default:
+				break;
+			}
+			if (mt != NULL) {
+				break;
+			}
+			/* FALLTHROUGH */
+		}
 		case MTIOCSETEOTMODEL:
-		case MTSETBSIZ:
-		case MTSETDNSTY:
-		case MTCOMP:
 			/*
 			 * We need to acquire the peripheral here rather
 			 * than at open time because we are sharing writable
@@ -1822,8 +1841,8 @@
 			 * will now attempt to rewind/load it.
 			 */
 			softc->flags &= ~SA_FLAG_TAPE_MOUNTED;
-			if (CAM_DEBUGGED(ccb->ccb_h.path, CAM_DEBUG_INFO)) {
-				xpt_print_path(ccb->ccb_h.path);
+			if (CAM_DEBUGGED(periph->path, CAM_DEBUG_INFO)) {
+				xpt_print_path(periph->path);
 				printf("error %d on TUR in samount\n", error);
 			}
 		}
@@ -1887,7 +1906,7 @@
 		rblim = (struct  scsi_read_block_limits_data *)
 		    malloc(8192, M_TEMP, M_WAITOK);
 		if (rblim == NULL) {
-			xpt_print_path(ccb->ccb_h.path);
+			xpt_print_path(periph->path);
 			printf("no memory for test read\n");
 			xpt_release_ccb(ccb);
 			error = ENOMEM;
@@ -1909,7 +1928,7 @@
 			    softc->device_stats);
 			QFRLS(ccb);
 			if (error) {
-				xpt_print_path(ccb->ccb_h.path);
+				xpt_print_path(periph->path);
 				printf("unable to rewind after test read\n");
 				xpt_release_ccb(ccb);
 				goto exit;
@@ -2074,7 +2093,7 @@
 		if ((softc->max_blk < softc->media_blksize) ||
 		    (softc->min_blk > softc->media_blksize &&
 		    softc->media_blksize)) {
-			xpt_print_path(ccb->ccb_h.path);
+			xpt_print_path(periph->path);
 			printf("BLOCK LIMITS (%d..%d) could not match current "
 			    "block settings (%d)- adjusting\n", softc->min_blk,
 			    softc->max_blk, softc->media_blksize);
@@ -2109,7 +2128,7 @@
 			error = sasetparams(periph, SA_PARAM_BLOCKSIZE,
 			    softc->media_blksize, 0, 0, SF_NO_PRINT);
 			if (error) {
-				xpt_print_path(ccb->ccb_h.path);
+				xpt_print_path(periph->path);
 				printf("unable to set fixed blocksize to %d\n",
 				     softc->media_blksize);
 				goto exit;
@@ -2136,7 +2155,7 @@
 						softc->last_media_blksize = 512;
 					goto tryagain;
 				}
-				xpt_print_path(ccb->ccb_h.path);
+				xpt_print_path(periph->path);
 				printf("unable to set variable blocksize\n");
 				goto exit;
 			}
@@ -2194,7 +2213,7 @@
 			if (error == 0) {
 				softc->buffer_mode = SMH_SA_BUF_MODE_SIBUF;
 			} else {
-				xpt_print_path(ccb->ccb_h.path);
+				xpt_print_path(periph->path);
 				printf("unable to set buffered mode\n");
 			}
 			error = 0;	/* not an error */

==== //depot/projects/scottl-camlock/src/sys/cam/scsi/scsi_target.c#4 (text+ko) ====

@@ -28,7 +28,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/cam/scsi/scsi_target.c,v 1.65 2005/02/12 04:51:19 scottl Exp $");
+__FBSDID("$FreeBSD: src/sys/cam/scsi/scsi_target.c,v 1.66 2005/03/31 12:19:41 phk Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -1035,6 +1035,7 @@
 		return;
 	*dev = make_dev(&targ_cdevsw, unit2minor(u), UID_ROOT, GID_WHEEL,
 			0600, "targ%d", u);
+	dev_ref(*dev);
 	(*dev)->si_flags |= SI_CHEAPCLONE;
 }
 



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