Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 24 Oct 2013 10:33:31 +0000 (UTC)
From:      Alexander Motin <mav@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: r257049 - in stable/10/sys/cam: . ata scsi
Message-ID:  <201310241033.r9OAXVgU022614@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: mav
Date: Thu Oct 24 10:33:31 2013
New Revision: 257049
URL: http://svnweb.freebsd.org/changeset/base/257049

Log:
  MFC r256552:
  Unify periph invalidation and destruction reporting.
  Print message containing device model and serial number on invalidation.
  
  Approved by:	re (hrs)

Modified:
  stable/10/sys/cam/ata/ata_all.c
  stable/10/sys/cam/ata/ata_all.h
  stable/10/sys/cam/ata/ata_da.c
  stable/10/sys/cam/ata/ata_pmp.c
  stable/10/sys/cam/cam_periph.c
  stable/10/sys/cam/cam_periph.h
  stable/10/sys/cam/cam_xpt.c
  stable/10/sys/cam/cam_xpt_periph.h
  stable/10/sys/cam/scsi/scsi_all.c
  stable/10/sys/cam/scsi/scsi_all.h
  stable/10/sys/cam/scsi/scsi_cd.c
  stable/10/sys/cam/scsi/scsi_ch.c
  stable/10/sys/cam/scsi/scsi_da.c
  stable/10/sys/cam/scsi/scsi_enc.c
  stable/10/sys/cam/scsi/scsi_pass.c
  stable/10/sys/cam/scsi/scsi_pt.c
  stable/10/sys/cam/scsi/scsi_sa.c
  stable/10/sys/cam/scsi/scsi_sg.c
Directory Properties:
  stable/10/sys/   (props changed)

Modified: stable/10/sys/cam/ata/ata_all.c
==============================================================================
--- stable/10/sys/cam/ata/ata_all.c	Thu Oct 24 10:31:53 2013	(r257048)
+++ stable/10/sys/cam/ata/ata_all.c	Thu Oct 24 10:33:31 2013	(r257049)
@@ -297,6 +297,18 @@ ata_print_ident(struct ata_params *ident
 }
 
 void
+ata_print_ident_short(struct ata_params *ident_data)
+{
+	char product[48], revision[16];
+
+	cam_strvis(product, ident_data->model, sizeof(ident_data->model),
+		   sizeof(product));
+	cam_strvis(revision, ident_data->revision, sizeof(ident_data->revision),
+		   sizeof(revision));
+	printf("<%s %s>", product, revision);
+}
+
+void
 semb_print_ident(struct sep_identify_data *ident_data)
 {
 	char vendor[9], product[17], revision[5], fw[5], in[7], ins[5];
@@ -311,6 +323,18 @@ semb_print_ident(struct sep_identify_dat
 	    vendor, product, revision, fw, in, ins);
 }
 
+void
+semb_print_ident_short(struct sep_identify_data *ident_data)
+{
+	char vendor[9], product[17], revision[5], fw[5];
+
+	cam_strvis(vendor, ident_data->vendor_id, 8, sizeof(vendor));
+	cam_strvis(product, ident_data->product_id, 16, sizeof(product));
+	cam_strvis(revision, ident_data->product_rev, 4, sizeof(revision));
+	cam_strvis(fw, ident_data->firmware_rev, 4, sizeof(fw));
+	printf("<%s %s %s %s>", vendor, product, revision, fw);
+}
+
 uint32_t
 ata_logical_sector_size(struct ata_params *ident_data)
 {

Modified: stable/10/sys/cam/ata/ata_all.h
==============================================================================
--- stable/10/sys/cam/ata/ata_all.h	Thu Oct 24 10:31:53 2013	(r257048)
+++ stable/10/sys/cam/ata/ata_all.h	Thu Oct 24 10:33:31 2013	(r257049)
@@ -109,6 +109,7 @@ int	ata_status_sbuf(struct ccb_ataio *at
 int	ata_res_sbuf(struct ccb_ataio *ataio, struct sbuf *sb);
 
 void	ata_print_ident(struct ata_params *ident_data);
+void	ata_print_ident_short(struct ata_params *ident_data);
 
 uint32_t	ata_logical_sector_size(struct ata_params *ident_data);
 uint64_t	ata_physical_sector_size(struct ata_params *ident_data);
@@ -143,6 +144,7 @@ int	ata_identify_match(caddr_t identbuff
 int	ata_static_identify_match(caddr_t identbuffer, caddr_t table_entry);
 
 void	semb_print_ident(struct sep_identify_data *ident_data);
+void	semb_print_ident_short(struct sep_identify_data *ident_data);
 
 void semb_receive_diagnostic_results(struct ccb_ataio *ataio,
 	u_int32_t retries, void (*cbfcnp)(struct cam_periph *, union ccb*),

Modified: stable/10/sys/cam/ata/ata_da.c
==============================================================================
--- stable/10/sys/cam/ata/ata_da.c	Thu Oct 24 10:31:53 2013	(r257048)
+++ stable/10/sys/cam/ata/ata_da.c	Thu Oct 24 10:33:31 2013	(r257049)
@@ -907,7 +907,6 @@ adaoninvalidate(struct cam_periph *perip
 	bioq_flush(&softc->trim_queue, NULL, ENXIO);
 
 	disk_gone(softc->disk);
-	xpt_print(periph->path, "lost device\n");
 }
 
 static void
@@ -917,7 +916,6 @@ adacleanup(struct cam_periph *periph)
 
 	softc = (struct ada_softc *)periph->softc;
 
-	xpt_print(periph->path, "removing device entry\n");
 	cam_periph_unlock(periph);
 
 	/*

Modified: stable/10/sys/cam/ata/ata_pmp.c
==============================================================================
--- stable/10/sys/cam/ata/ata_pmp.c	Thu Oct 24 10:31:53 2013	(r257048)
+++ stable/10/sys/cam/ata/ata_pmp.c	Thu Oct 24 10:33:31 2013	(r257049)
@@ -241,7 +241,6 @@ pmponinvalidate(struct cam_periph *perip
 		}
 	}
 	pmprelease(periph, -1);
-	xpt_print(periph->path, "lost device\n");
 }
 
 static void
@@ -251,7 +250,6 @@ pmpcleanup(struct cam_periph *periph)
 
 	softc = (struct pmp_softc *)periph->softc;
 
-	xpt_print(periph->path, "removing device entry\n");
 	cam_periph_unlock(periph);
 
 	/*

Modified: stable/10/sys/cam/cam_periph.c
==============================================================================
--- stable/10/sys/cam/cam_periph.c	Thu Oct 24 10:31:53 2013	(r257048)
+++ stable/10/sys/cam/cam_periph.c	Thu Oct 24 10:33:31 2013	(r257049)
@@ -586,6 +586,8 @@ cam_periph_invalidate(struct cam_periph 
 		return;
 
 	CAM_DEBUG(periph->path, CAM_DEBUG_INFO, ("Periph invalidated\n"));
+	if (periph->flags & CAM_PERIPH_ANNOUNCED)
+		xpt_denounce_periph(periph);
 	periph->flags |= CAM_PERIPH_INVALID;
 	periph->flags &= ~CAM_PERIPH_NEW_DEV_FOUND;
 	if (periph->periph_oninval != NULL)
@@ -648,7 +650,10 @@ camperiphfree(struct cam_periph *periph)
 	xpt_remove_periph(periph);
 
 	xpt_unlock_buses();
-	CAM_DEBUG(periph->path, CAM_DEBUG_INFO, ("Periph destroyed\n"));
+	if (periph->flags & CAM_PERIPH_ANNOUNCED) {
+		xpt_print(periph->path, "Periph destroyed\n");
+	} else
+		CAM_DEBUG(periph->path, CAM_DEBUG_INFO, ("Periph destroyed\n"));
 
 	if (periph->flags & CAM_PERIPH_NEW_DEV_FOUND) {
 		union ccb ccb;

Modified: stable/10/sys/cam/cam_periph.h
==============================================================================
--- stable/10/sys/cam/cam_periph.h	Thu Oct 24 10:31:53 2013	(r257048)
+++ stable/10/sys/cam/cam_periph.h	Thu Oct 24 10:33:31 2013	(r257049)
@@ -121,6 +121,7 @@ struct cam_periph {
 #define CAM_PERIPH_NEW_DEV_FOUND	0x10
 #define CAM_PERIPH_RECOVERY_INPROG	0x20
 #define CAM_PERIPH_FREE			0x80
+#define CAM_PERIPH_ANNOUNCED		0x100
 	u_int32_t		 immediate_priority;
 	u_int32_t		 refcount;
 	SLIST_HEAD(, ccb_hdr)	 ccb_list;	/* For "immediate" requests */

Modified: stable/10/sys/cam/cam_xpt.c
==============================================================================
--- stable/10/sys/cam/cam_xpt.c	Thu Oct 24 10:31:53 2013	(r257048)
+++ stable/10/sys/cam/cam_xpt.c	Thu Oct 24 10:33:31 2013	(r257049)
@@ -1023,6 +1023,7 @@ xpt_announce_periph(struct cam_periph *p
 	struct	cam_path *path = periph->path;
 
 	mtx_assert(periph->sim->mtx, MA_OWNED);
+	periph->flags |= CAM_PERIPH_ANNOUNCED;
 
 	printf("%s%d at %s%d bus %d scbus%d target %d lun %d\n",
 	       periph->periph_name, periph->unit_number,
@@ -1071,6 +1072,37 @@ xpt_announce_quirks(struct cam_periph *p
 	}
 }
 
+void
+xpt_denounce_periph(struct cam_periph *periph)
+{
+	struct	cam_path *path = periph->path;
+
+	mtx_assert(periph->sim->mtx, MA_OWNED);
+	printf("%s%d at %s%d bus %d scbus%d target %d lun %d\n",
+	       periph->periph_name, periph->unit_number,
+	       path->bus->sim->sim_name,
+	       path->bus->sim->unit_number,
+	       path->bus->sim->bus_id,
+	       path->bus->path_id,
+	       path->target->target_id,
+	       path->device->lun_id);
+	printf("%s%d: ", periph->periph_name, periph->unit_number);
+	if (path->device->protocol == PROTO_SCSI)
+		scsi_print_inquiry_short(&path->device->inq_data);
+	else if (path->device->protocol == PROTO_ATA ||
+	    path->device->protocol == PROTO_SATAPM)
+		ata_print_ident_short(&path->device->ident_data);
+	else if (path->device->protocol == PROTO_SEMB)
+		semb_print_ident_short(
+		    (struct sep_identify_data *)&path->device->ident_data);
+	else
+		printf("Unknown protocol device");
+	if (path->device->serial_num_len > 0)
+		printf(" s/n %.60s", path->device->serial_num);
+	printf(" detached\n");
+}
+
+
 int
 xpt_getattr(char *buf, size_t len, const char *attr, struct cam_path *path)
 {

Modified: stable/10/sys/cam/cam_xpt_periph.h
==============================================================================
--- stable/10/sys/cam/cam_xpt_periph.h	Thu Oct 24 10:31:53 2013	(r257048)
+++ stable/10/sys/cam/cam_xpt_periph.h	Thu Oct 24 10:33:31 2013	(r257049)
@@ -47,6 +47,7 @@ void		xpt_announce_periph(struct cam_per
 				    char *announce_string);
 void		xpt_announce_quirks(struct cam_periph *periph,
 				    int quirks, char *bit_string);
+void		xpt_denounce_periph(struct cam_periph *periph);
 #endif
 
 #endif /* _CAM_CAM_XPT_PERIPH_H */

Modified: stable/10/sys/cam/scsi/scsi_all.c
==============================================================================
--- stable/10/sys/cam/scsi/scsi_all.c	Thu Oct 24 10:31:53 2013	(r257048)
+++ stable/10/sys/cam/scsi/scsi_all.c	Thu Oct 24 10:33:31 2013	(r257049)
@@ -5249,6 +5249,21 @@ scsi_print_inquiry(struct scsi_inquiry_d
 	       dtype, rstr, qtype);
 }
 
+void
+scsi_print_inquiry_short(struct scsi_inquiry_data *inq_data)
+{
+	char vendor[16], product[48], revision[16];
+
+	cam_strvis(vendor, inq_data->vendor, sizeof(inq_data->vendor),
+		   sizeof(vendor));
+	cam_strvis(product, inq_data->product, sizeof(inq_data->product),
+		   sizeof(product));
+	cam_strvis(revision, inq_data->revision, sizeof(inq_data->revision),
+		   sizeof(revision));
+
+	printf("<%s %s %s>", vendor, product, revision);
+}
+
 /*
  * Table of syncrates that don't follow the "divisible by 4"
  * rule. This table will be expanded in future SCSI specs.

Modified: stable/10/sys/cam/scsi/scsi_all.h
==============================================================================
--- stable/10/sys/cam/scsi/scsi_all.h	Thu Oct 24 10:31:53 2013	(r257048)
+++ stable/10/sys/cam/scsi/scsi_all.h	Thu Oct 24 10:33:31 2013	(r257049)
@@ -2313,6 +2313,7 @@ char *		scsi_cdb_string(u_int8_t *cdb_pt
 				size_t len);
 
 void		scsi_print_inquiry(struct scsi_inquiry_data *inq_data);
+void		scsi_print_inquiry_short(struct scsi_inquiry_data *inq_data);
 
 u_int		scsi_calc_syncsrate(u_int period_factor);
 u_int		scsi_calc_syncparam(u_int period);

Modified: stable/10/sys/cam/scsi/scsi_cd.c
==============================================================================
--- stable/10/sys/cam/scsi/scsi_cd.c	Thu Oct 24 10:31:53 2013	(r257048)
+++ stable/10/sys/cam/scsi/scsi_cd.c	Thu Oct 24 10:33:31 2013	(r257049)
@@ -428,7 +428,6 @@ cdoninvalidate(struct cam_periph *periph
 		camq_remove(&softc->changer->devq, softc->pinfo.index);
 
 	disk_gone(softc->disk);
-	xpt_print(periph->path, "lost device, %d refs\n", periph->refcount);
 }
 
 static void
@@ -438,8 +437,6 @@ cdcleanup(struct cam_periph *periph)
 
 	softc = (struct cd_softc *)periph->softc;
 
-	xpt_print(periph->path, "removing device entry\n");
-
 	/*
 	 * In the queued, non-active case, the device in question
 	 * has already been removed from the changer run queue.  Since this

Modified: stable/10/sys/cam/scsi/scsi_ch.c
==============================================================================
--- stable/10/sys/cam/scsi/scsi_ch.c	Thu Oct 24 10:31:53 2013	(r257048)
+++ stable/10/sys/cam/scsi/scsi_ch.c	Thu Oct 24 10:33:31 2013	(r257049)
@@ -306,9 +306,6 @@ choninvalidate(struct cam_periph *periph
 	 * when it has cleaned up its state.
 	 */
 	destroy_dev_sched_cb(softc->dev, chdevgonecb, periph);
-
-	xpt_print(periph->path, "lost device\n");
-
 }
 
 static void
@@ -318,8 +315,6 @@ chcleanup(struct cam_periph *periph)
 
 	softc = (struct ch_softc *)periph->softc;
 
-	xpt_print(periph->path, "removing device entry\n");
-
 	devstat_remove_entry(softc->device_stats);
 
 	free(softc, M_DEVBUF);

Modified: stable/10/sys/cam/scsi/scsi_da.c
==============================================================================
--- stable/10/sys/cam/scsi/scsi_da.c	Thu Oct 24 10:31:53 2013	(r257048)
+++ stable/10/sys/cam/scsi/scsi_da.c	Thu Oct 24 10:33:31 2013	(r257049)
@@ -1561,9 +1561,6 @@ daoninvalidate(struct cam_periph *periph
 	 * done cleaning up its resources.
 	 */
 	disk_gone(softc->disk);
-
-	xpt_print(periph->path, "lost device - %d outstanding, %d refs\n",
-		  softc->outstanding_cmds, periph->refcount);
 }
 
 static void
@@ -1573,7 +1570,6 @@ dacleanup(struct cam_periph *periph)
 
 	softc = (struct da_softc *)periph->softc;
 
-	xpt_print(periph->path, "removing device entry\n");
 	cam_periph_unlock(periph);
 
 	/*

Modified: stable/10/sys/cam/scsi/scsi_enc.c
==============================================================================
--- stable/10/sys/cam/scsi/scsi_enc.c	Thu Oct 24 10:31:53 2013	(r257048)
+++ stable/10/sys/cam/scsi/scsi_enc.c	Thu Oct 24 10:33:31 2013	(r257049)
@@ -178,8 +178,6 @@ enc_oninvalidate(struct cam_periph *peri
 	callout_drain(&enc->status_updater);
 
 	destroy_dev_sched_cb(enc->enc_dev, enc_devgonecb, periph);
-
-	xpt_print(periph->path, "lost device\n");
 }
 
 static void
@@ -189,9 +187,6 @@ enc_dtor(struct cam_periph *periph)
 
 	enc = periph->softc;
 
-	xpt_print(periph->path, "removing device entry\n");
-
-
 	/* If the sub-driver has a cleanup routine, call it */
 	if (enc->enc_vec.softc_cleanup != NULL)
 		enc->enc_vec.softc_cleanup(enc);

Modified: stable/10/sys/cam/scsi/scsi_pass.c
==============================================================================
--- stable/10/sys/cam/scsi/scsi_pass.c	Thu Oct 24 10:31:53 2013	(r257048)
+++ stable/10/sys/cam/scsi/scsi_pass.c	Thu Oct 24 10:33:31 2013	(r257049)
@@ -207,11 +207,6 @@ passoninvalidate(struct cam_periph *peri
 	 * XXX Handle any transactions queued to the card
 	 *     with XPT_ABORT_CCB.
 	 */
-
-	if (bootverbose) {
-		xpt_print(periph->path, "lost device\n");
-	}
-
 }
 
 static void
@@ -221,8 +216,6 @@ passcleanup(struct cam_periph *periph)
 
 	softc = (struct pass_softc *)periph->softc;
 
-	if (bootverbose)
-		xpt_print(periph->path, "removing device entry\n");
 	devstat_remove_entry(softc->device_stats);
 
 	cam_periph_unlock(periph);

Modified: stable/10/sys/cam/scsi/scsi_pt.c
==============================================================================
--- stable/10/sys/cam/scsi/scsi_pt.c	Thu Oct 24 10:31:53 2013	(r257048)
+++ stable/10/sys/cam/scsi/scsi_pt.c	Thu Oct 24 10:33:31 2013	(r257049)
@@ -333,8 +333,6 @@ ptoninvalidate(struct cam_periph *periph
 	 *     with XPT_ABORT_CCB.
 	 */
 	bioq_flush(&softc->bio_queue, NULL, ENXIO);
-
-	xpt_print(periph->path, "lost device\n");
 }
 
 static void
@@ -344,7 +342,6 @@ ptdtor(struct cam_periph *periph)
 
 	softc = (struct pt_softc *)periph->softc;
 
-	xpt_print(periph->path, "removing device entry\n");
 	devstat_remove_entry(softc->device_stats);
 	cam_periph_unlock(periph);
 	destroy_dev(softc->dev);

Modified: stable/10/sys/cam/scsi/scsi_sa.c
==============================================================================
--- stable/10/sys/cam/scsi/scsi_sa.c	Thu Oct 24 10:31:53 2013	(r257048)
+++ stable/10/sys/cam/scsi/scsi_sa.c	Thu Oct 24 10:33:31 2013	(r257049)
@@ -1401,9 +1401,6 @@ saoninvalidate(struct cam_periph *periph
 	 */
 	bioq_flush(&softc->bio_queue, NULL, ENXIO);
 	softc->queue_count = 0;
-
-	xpt_print(periph->path, "lost device\n");
-
 }
 
 static void
@@ -1414,7 +1411,6 @@ sacleanup(struct cam_periph *periph)
 
 	softc = (struct sa_softc *)periph->softc;
 
-	xpt_print(periph->path, "removing device entry\n");
 	devstat_remove_entry(softc->device_stats);
 	cam_periph_unlock(periph);
 	destroy_dev(softc->devs.ctl_dev);

Modified: stable/10/sys/cam/scsi/scsi_sg.c
==============================================================================
--- stable/10/sys/cam/scsi/scsi_sg.c	Thu Oct 24 10:31:53 2013	(r257048)
+++ stable/10/sys/cam/scsi/scsi_sg.c	Thu Oct 24 10:33:31 2013	(r257049)
@@ -238,9 +238,6 @@ sgoninvalidate(struct cam_periph *periph
 	 *     with XPT_ABORT_CCB.
 	 */
 
-	if (bootverbose) {
-		xpt_print(periph->path, "lost device\n");
-	}
 }
 
 static void
@@ -249,8 +246,6 @@ sgcleanup(struct cam_periph *periph)
 	struct sg_softc *softc;
 
 	softc = (struct sg_softc *)periph->softc;
-	if (bootverbose)
-		xpt_print(periph->path, "removing device entry\n");
 
 	devstat_remove_entry(softc->device_stats);
 



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