Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 8 Aug 2019 22:16:20 +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-11@freebsd.org
Subject:   svn commit: r350804 - in stable/11/sys: cam cam/ata cam/nvme cam/scsi dev/hyperv/storvsc
Message-ID:  <201908082216.x78MGKAk048013@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: mav
Date: Thu Aug  8 22:16:19 2019
New Revision: 350804
URL: https://svnweb.freebsd.org/changeset/base/350804

Log:
  MFC r326645 (by imp): Define xpt_path_inq.
  
  This provides a nice wrarpper around the XPT_PATH_INQ ccb creation and
  calling.

Modified:
  stable/11/sys/cam/ata/ata_da.c
  stable/11/sys/cam/ata/ata_xpt.c
  stable/11/sys/cam/cam_periph.c
  stable/11/sys/cam/cam_xpt.c
  stable/11/sys/cam/cam_xpt.h
  stable/11/sys/cam/nvme/nvme_da.c
  stable/11/sys/cam/nvme/nvme_xpt.c
  stable/11/sys/cam/scsi/scsi_cd.c
  stable/11/sys/cam/scsi/scsi_ch.c
  stable/11/sys/cam/scsi/scsi_da.c
  stable/11/sys/cam/scsi/scsi_pass.c
  stable/11/sys/cam/scsi/scsi_pt.c
  stable/11/sys/cam/scsi/scsi_sa.c
  stable/11/sys/cam/scsi/scsi_sg.c
  stable/11/sys/cam/scsi/scsi_target.c
  stable/11/sys/cam/scsi/scsi_xpt.c
  stable/11/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/cam/ata/ata_da.c
==============================================================================
--- stable/11/sys/cam/ata/ata_da.c	Thu Aug  8 22:11:01 2019	(r350803)
+++ stable/11/sys/cam/ata/ata_da.c	Thu Aug  8 22:16:19 2019	(r350804)
@@ -1751,10 +1751,7 @@ adaregister(struct cam_periph *periph, void *arg)
 	else
 		softc->quirks = ADA_Q_NONE;
 
-	bzero(&cpi, sizeof(cpi));
-	xpt_setup_ccb(&cpi.ccb_h, periph->path, CAM_PRIORITY_NONE);
-	cpi.ccb_h.func_code = XPT_PATH_INQ;
-	xpt_action((union ccb *)&cpi);
+	xpt_path_inq(&cpi, periph->path);
 
 	TASK_INIT(&softc->sysctl_task, 0, adasysctlinit, periph);
 

Modified: stable/11/sys/cam/ata/ata_xpt.c
==============================================================================
--- stable/11/sys/cam/ata/ata_xpt.c	Thu Aug  8 22:11:01 2019	(r350803)
+++ stable/11/sys/cam/ata/ata_xpt.c	Thu Aug  8 22:16:19 2019	(r350804)
@@ -994,10 +994,7 @@ noerror:
 		if (path->device->mintags != 0 &&
 		    path->bus->sim->max_tagged_dev_openings != 0) {
 			/* Check if the SIM does not want queued commands. */
-			bzero(&cpi, sizeof(cpi));
-			xpt_setup_ccb(&cpi.ccb_h, path, CAM_PRIORITY_NONE);
-			cpi.ccb_h.func_code = XPT_PATH_INQ;
-			xpt_action((union ccb *)&cpi);
+			xpt_path_inq(&cpi, path);
 			if (cpi.ccb_h.status == CAM_REQ_CMP &&
 			    (cpi.hba_inquiry & PI_TAG_ABLE)) {
 				/* Report SIM which tags are allowed. */
@@ -1400,10 +1397,7 @@ ata_scan_bus(struct cam_periph *periph, union ccb *req
 			xpt_done(request_ccb);
 			return;
 		}
-		xpt_setup_ccb(&work_ccb->ccb_h, request_ccb->ccb_h.path,
-			      request_ccb->ccb_h.pinfo.priority);
-		work_ccb->ccb_h.func_code = XPT_PATH_INQ;
-		xpt_action(work_ccb);
+		xpt_path_inq(&work_ccb->cpi, request_ccb->ccb_h.path);
 		if (work_ccb->ccb_h.status != CAM_REQ_CMP) {
 			request_ccb->ccb_h.status = work_ccb->ccb_h.status;
 			xpt_free_ccb(work_ccb);
@@ -1558,10 +1552,7 @@ ata_scan_lun(struct cam_periph *periph, struct cam_pat
 
 	CAM_DEBUG(path, CAM_DEBUG_TRACE, ("xpt_scan_lun\n"));
 
-	xpt_setup_ccb(&cpi.ccb_h, path, CAM_PRIORITY_NONE);
-	cpi.ccb_h.func_code = XPT_PATH_INQ;
-	xpt_action((union ccb *)&cpi);
-
+	xpt_path_inq(&cpi, path);
 	if (cpi.ccb_h.status != CAM_REQ_CMP) {
 		if (request_ccb != NULL) {
 			request_ccb->ccb_h.status = cpi.ccb_h.status;
@@ -1670,9 +1661,7 @@ ata_device_transport(struct cam_path *path)
 	struct ata_params *ident_buf = NULL;
 
 	/* Get transport information from the SIM */
-	xpt_setup_ccb(&cpi.ccb_h, path, CAM_PRIORITY_NONE);
-	cpi.ccb_h.func_code = XPT_PATH_INQ;
-	xpt_action((union ccb *)&cpi);
+	xpt_path_inq(&cpi, path);
 
 	path->device->transport = cpi.transport;
 	if ((path->device->flags & CAM_DEV_INQUIRY_DATA_VALID) != 0)
@@ -1967,9 +1956,7 @@ ata_set_transfer_settings(struct ccb_trans_settings *c
 		scsi = &cts->proto_specific.scsi;
 	else
 		scsi = NULL;
-	xpt_setup_ccb(&cpi.ccb_h, path, CAM_PRIORITY_NONE);
-	cpi.ccb_h.func_code = XPT_PATH_INQ;
-	xpt_action((union ccb *)&cpi);
+	xpt_path_inq(&cpi, path);
 
 	/* Sanity checking */
 	if ((cpi.hba_inquiry & PI_TAG_ABLE) == 0
@@ -2101,9 +2088,7 @@ ata_announce_periph(struct cam_periph *periph)
 	if ((cts.ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_CMP)
 		return;
 	/* Ask the SIM for its base transfer speed */
-	xpt_setup_ccb(&cpi.ccb_h, path, CAM_PRIORITY_NORMAL);
-	cpi.ccb_h.func_code = XPT_PATH_INQ;
-	xpt_action((union ccb *)&cpi);
+	xpt_path_inq(&cpi, path);
 	/* Report connection speed */
 	speed = cpi.base_transfer_speed;
 	if (cts.ccb_h.status == CAM_REQ_CMP && cts.transport == XPORT_ATA) {

Modified: stable/11/sys/cam/cam_periph.c
==============================================================================
--- stable/11/sys/cam/cam_periph.c	Thu Aug  8 22:11:01 2019	(r350803)
+++ stable/11/sys/cam/cam_periph.c	Thu Aug  8 22:16:19 2019	(r350804)
@@ -738,9 +738,7 @@ camperiphfree(struct cam_periph *periph)
 			arg = &ccb;
 			break;
 		case AC_PATH_REGISTERED:
-			ccb.ccb_h.func_code = XPT_PATH_INQ;
-			xpt_setup_ccb(&ccb.ccb_h, periph->path, CAM_PRIORITY_NORMAL);
-			xpt_action(&ccb);
+			xpt_path_inq(&ccb.cpi, periph->path);
 			arg = &ccb;
 			break;
 		default:

Modified: stable/11/sys/cam/cam_xpt.c
==============================================================================
--- stable/11/sys/cam/cam_xpt.c	Thu Aug  8 22:11:01 2019	(r350803)
+++ stable/11/sys/cam/cam_xpt.c	Thu Aug  8 22:16:19 2019	(r350804)
@@ -2491,9 +2491,7 @@ xptsetasyncbusfunc(struct cam_eb *bus, void *arg)
 			 CAM_TARGET_WILDCARD,
 			 CAM_LUN_WILDCARD);
 	xpt_path_lock(&path);
-	xpt_setup_ccb(&cpi.ccb_h, &path, CAM_PRIORITY_NORMAL);
-	cpi.ccb_h.func_code = XPT_PATH_INQ;
-	xpt_action((union ccb *)&cpi);
+	xpt_path_inq(&cpi, &path);
 	csa->callback(csa->callback_arg,
 			    AC_PATH_REGISTERED,
 			    &path, &cpi);
@@ -3937,9 +3935,7 @@ xpt_bus_register(struct cam_sim *sim, device_t parent,
 		return (CAM_RESRC_UNAVAIL);
 	}
 
-	xpt_setup_ccb(&cpi.ccb_h, path, CAM_PRIORITY_NORMAL);
-	cpi.ccb_h.func_code = XPT_PATH_INQ;
-	xpt_action((union ccb *)&cpi);
+	xpt_path_inq(&cpi, path);
 
 	if (cpi.ccb_h.status == CAM_REQ_CMP) {
 		struct xpt_xport **xpt;

Modified: stable/11/sys/cam/cam_xpt.h
==============================================================================
--- stable/11/sys/cam/cam_xpt.h	Thu Aug  8 22:11:01 2019	(r350803)
+++ stable/11/sys/cam/cam_xpt.h	Thu Aug  8 22:16:19 2019	(r350804)
@@ -32,6 +32,12 @@
 #ifndef _CAM_CAM_XPT_H
 #define _CAM_CAM_XPT_H 1
 
+#ifdef _KERNEL
+#include <sys/cdefs.h>
+#include <cam/cam_ccb.h>
+#endif
+
+
 /* Forward Declarations */
 union ccb;
 struct cam_periph;
@@ -134,6 +140,20 @@ void			xpt_copy_path(struct cam_path *new_path,
 				      struct cam_path *path);
 
 void			xpt_release_path(struct cam_path *path);
+
+/*
+ * Perform a path inquiry at the request priority. The bzero may be
+ * unnecessary.
+ */
+static inline void
+xpt_path_inq(struct ccb_pathinq *cpi, struct cam_path *path)
+{
+
+	bzero(cpi, sizeof(*cpi));
+	xpt_setup_ccb(&cpi->ccb_h, path, CAM_PRIORITY_NORMAL);
+	cpi->ccb_h.func_code = XPT_PATH_INQ;
+	xpt_action((union ccb *)cpi);
+}
 
 #endif /* _KERNEL */
 

Modified: stable/11/sys/cam/nvme/nvme_da.c
==============================================================================
--- stable/11/sys/cam/nvme/nvme_da.c	Thu Aug  8 22:11:01 2019	(r350803)
+++ stable/11/sys/cam/nvme/nvme_da.c	Thu Aug  8 22:16:19 2019	(r350804)
@@ -716,10 +716,7 @@ ndaregister(struct cam_periph *periph, void *arg)
 
 	softc->quirks = NDA_Q_NONE;
 
-	bzero(&cpi, sizeof(cpi));
-	xpt_setup_ccb(&cpi.ccb_h, periph->path, CAM_PRIORITY_NONE);
-	cpi.ccb_h.func_code = XPT_PATH_INQ;
-	xpt_action((union ccb *)&cpi);
+	xpt_path_inq(&cpi, periph->path);
 
 	TASK_INIT(&softc->sysctl_task, 0, ndasysctlinit, periph);
 

Modified: stable/11/sys/cam/nvme/nvme_xpt.c
==============================================================================
--- stable/11/sys/cam/nvme/nvme_xpt.c	Thu Aug  8 22:11:01 2019	(r350803)
+++ stable/11/sys/cam/nvme/nvme_xpt.c	Thu Aug  8 22:16:19 2019	(r350804)
@@ -364,9 +364,7 @@ nvme_scan_lun(struct cam_periph *periph, struct cam_pa
 
 	CAM_DEBUG(path, CAM_DEBUG_TRACE, ("nvme_scan_lun\n"));
 
-	xpt_setup_ccb(&cpi.ccb_h, path, CAM_PRIORITY_NONE);
-	cpi.ccb_h.func_code = XPT_PATH_INQ;
-	xpt_action((union ccb *)&cpi);
+	xpt_path_inq(&cpi, path);
 
 	if (cpi.ccb_h.status != CAM_REQ_CMP) {
 		if (request_ccb != NULL) {
@@ -457,9 +455,7 @@ nvme_device_transport(struct cam_path *path)
 	/* XXX get data from nvme namespace and other info ??? */
 
 	/* Get transport information from the SIM */
-	xpt_setup_ccb(&cpi.ccb_h, path, CAM_PRIORITY_NONE);
-	cpi.ccb_h.func_code = XPT_PATH_INQ;
-	xpt_action((union ccb *)&cpi);
+	xpt_path_inq(&cpi, path);
 
 	path->device->transport = cpi.transport;
 	path->device->transport_version = cpi.transport_version;
@@ -628,9 +624,7 @@ nvme_announce_periph(struct cam_periph *periph)
 	if ((cts.ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_CMP)
 		return;
 	/* Ask the SIM for its base transfer speed */
-	xpt_setup_ccb(&cpi.ccb_h, path, CAM_PRIORITY_NORMAL);
-	cpi.ccb_h.func_code = XPT_PATH_INQ;
-	xpt_action((union ccb *)&cpi);
+	xpt_path_inq(&cpi, periph->path);
 	/* XXX NVME STUFF HERE */
 	printf("\n");
 }

Modified: stable/11/sys/cam/scsi/scsi_cd.c
==============================================================================
--- stable/11/sys/cam/scsi/scsi_cd.c	Thu Aug  8 22:11:01 2019	(r350803)
+++ stable/11/sys/cam/scsi/scsi_cd.c	Thu Aug  8 22:16:19 2019	(r350804)
@@ -587,10 +587,7 @@ cdregister(struct cam_periph *periph, void *arg)
 		softc->quirks = CD_Q_NONE;
 
 	/* Check if the SIM does not want 6 byte commands */
-	bzero(&cpi, sizeof(cpi));
-	xpt_setup_ccb(&cpi.ccb_h, periph->path, CAM_PRIORITY_NORMAL);
-	cpi.ccb_h.func_code = XPT_PATH_INQ;
-	xpt_action((union ccb *)&cpi);
+	xpt_path_inq(&cpi, periph->path);
 	if (cpi.ccb_h.status == CAM_REQ_CMP && (cpi.hba_misc & PIM_NO_6_BYTE))
 		softc->quirks |= CD_Q_10_BYTE_ONLY;
 

Modified: stable/11/sys/cam/scsi/scsi_ch.c
==============================================================================
--- stable/11/sys/cam/scsi/scsi_ch.c	Thu Aug  8 22:11:01 2019	(r350803)
+++ stable/11/sys/cam/scsi/scsi_ch.c	Thu Aug  8 22:16:19 2019	(r350804)
@@ -402,10 +402,7 @@ chregister(struct cam_periph *periph, void *arg)
 	if (cgd->inq_data.version <= SCSI_REV_2)
 		softc->quirks |= CH_Q_NO_DVCID;
 
-	bzero(&cpi, sizeof(cpi));
-	xpt_setup_ccb(&cpi.ccb_h, periph->path, CAM_PRIORITY_NORMAL);
-	cpi.ccb_h.func_code = XPT_PATH_INQ;
-	xpt_action((union ccb *)&cpi);
+	xpt_path_inq(&cpi, periph->path);
 
 	/*
 	 * Changers don't have a blocksize, and obviously don't support

Modified: stable/11/sys/cam/scsi/scsi_da.c
==============================================================================
--- stable/11/sys/cam/scsi/scsi_da.c	Thu Aug  8 22:11:01 2019	(r350803)
+++ stable/11/sys/cam/scsi/scsi_da.c	Thu Aug  8 22:16:19 2019	(r350804)
@@ -2517,10 +2517,7 @@ daregister(struct cam_periph *periph, void *arg)
 		softc->quirks = DA_Q_NONE;
 
 	/* Check if the SIM does not want 6 byte commands */
-	bzero(&cpi, sizeof(cpi));
-	xpt_setup_ccb(&cpi.ccb_h, periph->path, CAM_PRIORITY_NORMAL);
-	cpi.ccb_h.func_code = XPT_PATH_INQ;
-	xpt_action((union ccb *)&cpi);
+	xpt_path_inq(&cpi, periph->path);
 	if (cpi.ccb_h.status == CAM_REQ_CMP && (cpi.hba_misc & PIM_NO_6_BYTE))
 		softc->quirks |= DA_Q_NO_6_BYTE;
 

Modified: stable/11/sys/cam/scsi/scsi_pass.c
==============================================================================
--- stable/11/sys/cam/scsi/scsi_pass.c	Thu Aug  8 22:11:01 2019	(r350803)
+++ stable/11/sys/cam/scsi/scsi_pass.c	Thu Aug  8 22:16:19 2019	(r350804)
@@ -589,10 +589,7 @@ passregister(struct cam_periph *periph, void *arg)
 	softc->io_zone_size = MAXPHYS;
 	knlist_init_mtx(&softc->read_select.si_note, cam_periph_mtx(periph));
 
-	bzero(&cpi, sizeof(cpi));
-	xpt_setup_ccb(&cpi.ccb_h, periph->path, CAM_PRIORITY_NORMAL);
-	cpi.ccb_h.func_code = XPT_PATH_INQ;
-	xpt_action((union ccb *)&cpi);
+	xpt_path_inq(&cpi, periph->path);
 
 	if (cpi.maxio == 0)
 		softc->maxio = DFLTPHYS;	/* traditional default */

Modified: stable/11/sys/cam/scsi/scsi_pt.c
==============================================================================
--- stable/11/sys/cam/scsi/scsi_pt.c	Thu Aug  8 22:11:01 2019	(r350803)
+++ stable/11/sys/cam/scsi/scsi_pt.c	Thu Aug  8 22:16:19 2019	(r350804)
@@ -275,10 +275,7 @@ ptctor(struct cam_periph *periph, void *arg)
 
 	periph->softc = softc;
 
-	bzero(&cpi, sizeof(cpi));
-	xpt_setup_ccb(&cpi.ccb_h, periph->path, CAM_PRIORITY_NORMAL);
-	cpi.ccb_h.func_code = XPT_PATH_INQ;
-	xpt_action((union ccb *)&cpi);
+	xpt_path_inq(&cpi, periph->path);
 
 	cam_periph_unlock(periph);
 

Modified: stable/11/sys/cam/scsi/scsi_sa.c
==============================================================================
--- stable/11/sys/cam/scsi/scsi_sa.c	Thu Aug  8 22:11:01 2019	(r350803)
+++ stable/11/sys/cam/scsi/scsi_sa.c	Thu Aug  8 22:16:19 2019	(r350804)
@@ -2425,10 +2425,7 @@ saregister(struct cam_periph *periph, void *arg)
 			softc->flags |= SA_FLAG_PROTECT_SUPP;
 	}
 
-	bzero(&cpi, sizeof(cpi));
-	xpt_setup_ccb(&cpi.ccb_h, periph->path, CAM_PRIORITY_NORMAL);
-	cpi.ccb_h.func_code = XPT_PATH_INQ;
-	xpt_action((union ccb *)&cpi);
+	xpt_path_inq(&cpi, periph->path);
 
 	/*
 	 * The SA driver supports a blocksize, but we don't know the

Modified: stable/11/sys/cam/scsi/scsi_sg.c
==============================================================================
--- stable/11/sys/cam/scsi/scsi_sg.c	Thu Aug  8 22:11:01 2019	(r350803)
+++ stable/11/sys/cam/scsi/scsi_sg.c	Thu Aug  8 22:16:19 2019	(r350804)
@@ -322,10 +322,7 @@ sgregister(struct cam_periph *periph, void *arg)
 	TAILQ_INIT(&softc->rdwr_done);
 	periph->softc = softc;
 
-	bzero(&cpi, sizeof(cpi));
-	xpt_setup_ccb(&cpi.ccb_h, periph->path, CAM_PRIORITY_NORMAL);
-	cpi.ccb_h.func_code = XPT_PATH_INQ;
-	xpt_action((union ccb *)&cpi);
+	xpt_path_inq(&cpi, periph->path);
 
 	if (cpi.maxio == 0)
 		softc->maxio = DFLTPHYS;	/* traditional default */

Modified: stable/11/sys/cam/scsi/scsi_target.c
==============================================================================
--- stable/11/sys/cam/scsi/scsi_target.c	Thu Aug  8 22:11:01 2019	(r350803)
+++ stable/11/sys/cam/scsi/scsi_target.c	Thu Aug  8 22:16:19 2019	(r350804)
@@ -391,9 +391,7 @@ targenable(struct targ_softc *softc, struct cam_path *
 		return (CAM_LUN_ALRDY_ENA);
 
 	/* Make sure SIM supports target mode */
-	xpt_setup_ccb(&cpi.ccb_h, path, CAM_PRIORITY_NORMAL);
-	cpi.ccb_h.func_code = XPT_PATH_INQ;
-	xpt_action((union ccb *)&cpi);
+	xpt_path_inq(&cpi, path);
 	status = cpi.ccb_h.status & CAM_STATUS_MASK;
 	if (status != CAM_REQ_CMP) {
 		printf("pathinq failed, status %#x\n", status);

Modified: stable/11/sys/cam/scsi/scsi_xpt.c
==============================================================================
--- stable/11/sys/cam/scsi/scsi_xpt.c	Thu Aug  8 22:11:01 2019	(r350803)
+++ stable/11/sys/cam/scsi/scsi_xpt.c	Thu Aug  8 22:16:19 2019	(r350804)
@@ -697,9 +697,7 @@ probeschedule(struct cam_periph *periph)
 	softc = (probe_softc *)periph->softc;
 	ccb = (union ccb *)TAILQ_FIRST(&softc->request_ccbs);
 
-	xpt_setup_ccb(&cpi.ccb_h, periph->path, CAM_PRIORITY_NONE);
-	cpi.ccb_h.func_code = XPT_PATH_INQ;
-	xpt_action((union ccb *)&cpi);
+	xpt_path_inq(&cpi, periph->path);
 
 	/*
 	 * If a device has gone away and another device, or the same one,

Modified: stable/11/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c
==============================================================================
--- stable/11/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c	Thu Aug  8 22:11:01 2019	(r350803)
+++ stable/11/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c	Thu Aug  8 22:16:19 2019	(r350804)
@@ -2350,10 +2350,7 @@ storvsc_ada_probe_veto(void *arg __unused, struct cam_
 	if (path->device->protocol == PROTO_ATA) {
 		struct ccb_pathinq cpi;
 
-		bzero(&cpi, sizeof(cpi));
-		xpt_setup_ccb(&cpi.ccb_h, path, CAM_PRIORITY_NONE);
-		cpi.ccb_h.func_code = XPT_PATH_INQ;
-		xpt_action((union ccb *)&cpi);
+		xpt_path_inq(&cpi, path);
 		if (cpi.ccb_h.status == CAM_REQ_CMP &&
 		    cpi.hba_vendor == PCI_VENDOR_INTEL &&
 		    cpi.hba_device == PCI_PRODUCT_PIIX4) {



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