aboutsummaryrefslogtreecommitdiff
path: root/sys/cam
diff options
context:
space:
mode:
authorWarner Losh <imp@FreeBSD.org>2020-01-27 22:19:55 +0000
committerWarner Losh <imp@FreeBSD.org>2020-01-27 22:19:55 +0000
commit8c7cd14adf8360b3372381430dabf3c73b55854a (patch)
treec8186aee93f5844c1dcdf25e9736a2b4778ac902 /sys/cam
parentf886c4ba71aeb85dc88bec62709884526320338f (diff)
downloadsrc-8c7cd14adf8360b3372381430dabf3c73b55854a.tar.gz
src-8c7cd14adf8360b3372381430dabf3c73b55854a.zip
Create a convenince wrapper to fill in a CAM_PATH_INQ request for MMC sims. Pass
in the parameters needed for the different sims, but it's almost all identical.
Notes
Notes: svn path=/head/; revision=357181
Diffstat (limited to 'sys/cam')
-rw-r--r--sys/cam/mmc/mmc_all.h4
-rw-r--r--sys/cam/mmc/mmc_xpt.c29
2 files changed, 33 insertions, 0 deletions
diff --git a/sys/cam/mmc/mmc_all.h b/sys/cam/mmc/mmc_all.h
index cbc32c0d9882..eb7869a05372 100644
--- a/sys/cam/mmc/mmc_all.h
+++ b/sys/cam/mmc/mmc_all.h
@@ -68,5 +68,9 @@
#include <dev/mmc/mmcreg.h>
void mmc_print_ident(struct mmc_params *ident_data);
+struct ccb_pathinq;
+struct cam_sim;
+void mmc_path_inq(struct ccb_pathinq *cpi, const char *hba,
+ const struct cam_sim *sim, size_t maxio);
#endif
diff --git a/sys/cam/mmc/mmc_xpt.c b/sys/cam/mmc/mmc_xpt.c
index 80c8f5768727..f70dbec5ee49 100644
--- a/sys/cam/mmc/mmc_xpt.c
+++ b/sys/cam/mmc/mmc_xpt.c
@@ -1104,3 +1104,32 @@ mmcprobe_done(struct cam_periph *periph, union ccb *done_ccb)
cam_periph_release_locked(periph);
}
}
+
+void
+mmc_path_inq(struct ccb_pathinq *cpi, const char *hba,
+ const struct cam_sim *sim, size_t maxio)
+{
+
+ cpi->version_num = 1;
+ cpi->hba_inquiry = 0;
+ cpi->target_sprt = 0;
+ cpi->hba_misc = PIM_NOBUSRESET | PIM_SEQSCAN;
+ cpi->hba_eng_cnt = 0;
+ cpi->max_target = 0;
+ cpi->max_lun = 0;
+ cpi->initiator_id = 1;
+ cpi->maxio = maxio;
+ strncpy(cpi->sim_vid, "FreeBSD", SIM_IDLEN);
+ strncpy(cpi->hba_vid, hba, HBA_IDLEN);
+ strncpy(cpi->dev_name, cam_sim_name(sim), DEV_IDLEN);
+ cpi->unit_number = cam_sim_unit(sim);
+ cpi->bus_id = cam_sim_bus(sim);
+ cpi->protocol = PROTO_MMCSD;
+ cpi->protocol_version = SCSI_REV_0;
+ cpi->transport = XPORT_MMCSD;
+ cpi->transport_version = 1;
+
+ cpi->base_transfer_speed = 100; /* XXX WTF? */
+
+ cpi->ccb_h.status = CAM_REQ_CMP;
+}