Page MenuHomeFreeBSD

D61120.1795828425.diff
No OneTemporary

Authored By
Unknown
Size
1 KB
Referenced Files
None
Subscribers
None

D61120.1795828425.diff

diff --git a/sys/dev/ufshci/ufshci_ctrlr.c b/sys/dev/ufshci/ufshci_ctrlr.c
--- a/sys/dev/ufshci/ufshci_ctrlr.c
+++ b/sys/dev/ufshci/ufshci_ctrlr.c
@@ -27,6 +27,8 @@
ufshci_req_queue_fail(ctrlr, &ctrlr->task_mgmt_req_queue);
ufshci_req_queue_fail(ctrlr, &ctrlr->transfer_req_queue);
+
+ ufshci_sim_controller_failed(ctrlr);
}
/* Some controllers require a reinit after switching to the max gear. */
diff --git a/sys/dev/ufshci/ufshci_private.h b/sys/dev/ufshci/ufshci_private.h
--- a/sys/dev/ufshci/ufshci_private.h
+++ b/sys/dev/ufshci/ufshci_private.h
@@ -448,6 +448,7 @@
uint64_t ufshci_sim_translate_ufs_to_scsi_lun(uint8_t ufs_lun);
int ufshci_sim_attach(struct ufshci_controller *ctrlr);
void ufshci_sim_detach(struct ufshci_controller *ctrlr);
+void ufshci_sim_controller_failed(struct ufshci_controller *ctrlr);
void ufshci_sim_release_wlun_periph(struct ufshci_controller *ctrlr);
struct cam_periph *ufshci_sim_find_periph(struct ufshci_controller *ctrlr,
uint8_t wlun);
diff --git a/sys/dev/ufshci/ufshci_sim.c b/sys/dev/ufshci/ufshci_sim.c
--- a/sys/dev/ufshci/ufshci_sim.c
+++ b/sys/dev/ufshci/ufshci_sim.c
@@ -423,6 +423,25 @@
}
}
+void
+ufshci_sim_controller_failed(struct ufshci_controller *ctrlr)
+{
+ /* Attach may fail before the path is set up. */
+ if (ctrlr->ufshci_path == NULL)
+ return;
+
+ /*
+ * Hand the loss to CAM. The event goes to every periph on the
+ * devices under the path, where cam_periph_async() invalidates
+ * each one, so da(4) detaches and the disk node goes away rather
+ * than pointing at a controller that answers nothing. The path
+ * stored at attach covers the whole bus, so one post reaches
+ * every logical unit. xpt_async clones the path, so the stored
+ * one survives the call.
+ */
+ xpt_async(AC_LOST_DEVICE, ctrlr->ufshci_path, NULL);
+}
+
void
ufshci_sim_detach(struct ufshci_controller *ctrlr)
{

File Metadata

Mime Type
text/plain
Expires
Sat, Nov 28, 1:13 AM (22 h, 45 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
42054629
Default Alt Text
D61120.1795828425.diff (1 KB)

Event Timeline