aboutsummaryrefslogtreecommitdiff
path: root/sys/cam
diff options
context:
space:
mode:
authorEmmanuel Vadot <manu@FreeBSD.org>2020-07-22 18:30:17 +0000
committerEmmanuel Vadot <manu@FreeBSD.org>2020-07-22 18:30:17 +0000
commitc7a499485320d4e10251cafdb1a296728f2d6a12 (patch)
tree79d72e8b8b4cff714248ff5d78e7759e84b16d06 /sys/cam
parentd5bfd287c29356012607adf6316eb9f7a7a15e16 (diff)
downloadsrc-c7a499485320d4e10251cafdb1a296728f2d6a12.tar.gz
src-c7a499485320d4e10251cafdb1a296728f2d6a12.zip
mmccam: Add a generic mmccam_start_discovery function
This is a generic function start a scan request for the given cam_sim. Other driver can now just use this function to request a new rescan. Submitted by: kibab
Notes
Notes: svn path=/head/; revision=363425
Diffstat (limited to 'sys/cam')
-rw-r--r--sys/cam/mmc/mmc_all.h2
-rw-r--r--sys/cam/mmc/mmc_xpt.c23
2 files changed, 25 insertions, 0 deletions
diff --git a/sys/cam/mmc/mmc_all.h b/sys/cam/mmc/mmc_all.h
index eb7869a05372..dd7cd25453a8 100644
--- a/sys/cam/mmc/mmc_all.h
+++ b/sys/cam/mmc/mmc_all.h
@@ -64,6 +64,7 @@
#ifndef CAM_MMC_ALL_H
#define CAM_MMC_ALL_H
+#include <cam/cam_sim.h>
#include <cam/mmc/mmc.h>
#include <dev/mmc/mmcreg.h>
@@ -72,5 +73,6 @@ 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);
+void mmccam_start_discovery(struct cam_sim *sim);
#endif
diff --git a/sys/cam/mmc/mmc_xpt.c b/sys/cam/mmc/mmc_xpt.c
index 56b3c2ff5644..6e39cffd13ff 100644
--- a/sys/cam/mmc/mmc_xpt.c
+++ b/sys/cam/mmc/mmc_xpt.c
@@ -404,6 +404,29 @@ mmc_announce_periph(struct cam_periph *periph)
printf("XPT info: CLK %04X, ...\n", cts.proto_specific.mmc.ios.clock);
}
+void
+mmccam_start_discovery(struct cam_sim *sim) {
+ union ccb *ccb;
+ uint32_t pathid;
+
+ pathid = cam_sim_path(sim);
+ ccb = xpt_alloc_ccb_nowait();
+ if (ccb == NULL) {
+ return;
+ }
+
+ /*
+ * We create a rescan request for BUS:0:0, since the card
+ * will be at lun 0.
+ */
+ if (xpt_create_path(&ccb->ccb_h.path, NULL, pathid,
+ /* target */ 0, /* lun */ 0) != CAM_REQ_CMP) {
+ xpt_free_ccb(ccb);
+ return;
+ }
+ xpt_rescan(ccb);
+}
+
/* This func is called per attached device :-( */
void
mmc_print_ident(struct mmc_params *ident_data)