Define xpt_path_inq.
This provides a nice wrarpper around the XPT_PATH_INQ ccb creation and calling. Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D13387
This commit is contained in:
parent
2b31251a64
commit
762a7f4f5f
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=326645
@ -1726,10 +1726,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);
|
||||
|
||||
|
@ -1006,10 +1006,7 @@ device_fail: if ((path->device->flags & CAM_DEV_UNCONFIGURED) == 0)
|
||||
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. */
|
||||
@ -1412,10 +1409,7 @@ ata_scan_bus(struct cam_periph *periph, union ccb *request_ccb)
|
||||
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);
|
||||
@ -1570,10 +1564,7 @@ ata_scan_lun(struct cam_periph *periph, struct cam_path *path,
|
||||
|
||||
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;
|
||||
@ -1682,9 +1673,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)
|
||||
@ -1979,9 +1968,7 @@ ata_set_transfer_settings(struct ccb_trans_settings *cts, struct cam_path *path,
|
||||
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
|
||||
@ -2110,9 +2097,7 @@ _ata_announce_periph(struct cam_periph *periph, struct ccb_trans_settings *cts,
|
||||
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->transport == XPORT_ATA) {
|
||||
|
@ -743,9 +743,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:
|
||||
|
@ -2620,9 +2620,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);
|
||||
@ -4087,9 +4085,7 @@ xpt_bus_register(struct cam_sim *sim, device_t parent, u_int32_t bus)
|
||||
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;
|
||||
|
@ -36,8 +36,10 @@
|
||||
|
||||
#ifdef _KERNEL
|
||||
#include <sys/cdefs.h>
|
||||
#include <cam/cam_ccb.h>
|
||||
#endif
|
||||
|
||||
|
||||
/* Forward Declarations */
|
||||
union ccb;
|
||||
struct cam_periph;
|
||||
@ -147,6 +149,20 @@ const char * xpt_action_name(uint32_t action);
|
||||
void xpt_pollwait(union ccb *start_ccb, uint32_t timeout);
|
||||
uint32_t xpt_poll_setup(union ccb *start_ccb);
|
||||
|
||||
/*
|
||||
* 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 */
|
||||
|
||||
#endif /* _CAM_CAM_XPT_H */
|
||||
|
@ -685,10 +685,7 @@ sdda_hook_into_geom(struct cam_periph *periph)
|
||||
|
||||
softc = (struct sdda_softc*) periph->softc;
|
||||
|
||||
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);
|
||||
|
||||
bzero(&cgd, sizeof(cgd));
|
||||
xpt_setup_ccb(&cgd.ccb_h, periph->path, CAM_PRIORITY_NONE);
|
||||
|
@ -239,9 +239,7 @@ mmc_scan_lun(struct cam_periph *periph, struct cam_path *path,
|
||||
|
||||
CAM_DEBUG(path, CAM_DEBUG_TRACE, ("mmc_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, periph->path);
|
||||
|
||||
if (cpi.ccb_h.status != CAM_REQ_CMP) {
|
||||
if (request_ccb != NULL) {
|
||||
@ -392,9 +390,7 @@ mmc_announce_periph(struct cam_periph *periph)
|
||||
xpt_action((union ccb*)&cts);
|
||||
if ((cts.ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_CMP)
|
||||
return;
|
||||
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);
|
||||
printf("XPT info: CLK %04X, ...\n", cts.proto_specific.mmc.ios.clock);
|
||||
}
|
||||
|
||||
@ -570,8 +566,7 @@ mmcprobe_start(struct cam_periph *periph, union ccb *start_ccb)
|
||||
case PROBE_RESET:
|
||||
/* FALLTHROUGH */
|
||||
case PROBE_IDENTIFY:
|
||||
init_standard_ccb(start_ccb, XPT_PATH_INQ);
|
||||
xpt_action(start_ccb);
|
||||
xpt_path_inq(&start_ccb->cpi, periph->path);
|
||||
|
||||
CAM_DEBUG(start_ccb->ccb_h.path, CAM_DEBUG_PROBE, ("Start with PROBE_RESET\n"));
|
||||
init_standard_ccb(start_ccb, XPT_SET_TRAN_SETTINGS);
|
||||
|
@ -706,10 +706,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);
|
||||
|
||||
|
@ -365,9 +365,7 @@ nvme_scan_lun(struct cam_periph *periph, struct cam_path *path,
|
||||
|
||||
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) {
|
||||
@ -458,9 +456,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;
|
||||
@ -633,9 +629,7 @@ nvme_announce_periph(struct cam_periph *periph)
|
||||
nvmex = &cts.xport_specific.nvme;
|
||||
|
||||
/* 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);
|
||||
printf("%s%d: nvme version %d.%d x%d (max x%d) lanes PCIe Gen%d (max Gen%d) link",
|
||||
periph->periph_name, periph->unit_number,
|
||||
NVME_MAJOR(nvmex->spec),
|
||||
|
@ -595,10 +595,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;
|
||||
|
||||
|
@ -404,10 +404,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
|
||||
|
@ -2462,10 +2462,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;
|
||||
|
||||
|
@ -588,10 +588,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 */
|
||||
|
@ -277,10 +277,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);
|
||||
|
||||
|
@ -2427,10 +2427,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
|
||||
|
@ -324,10 +324,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 */
|
||||
|
@ -393,9 +393,7 @@ targenable(struct targ_softc *softc, struct cam_path *path, int grp6_len,
|
||||
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);
|
||||
|
@ -709,9 +709,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,
|
||||
|
@ -2364,10 +2364,7 @@ storvsc_ada_probe_veto(void *arg __unused, struct cam_path *path,
|
||||
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) {
|
||||
|
Loading…
Reference in New Issue
Block a user