git: e48f7ff6a12c - stable/14 - ahc/ahd: Fix target mode operation

From: Alexander Motin <mav_at_FreeBSD.org>
Date: Wed, 17 Apr 2024 13:39:43 UTC
The branch stable/14 has been updated by mav:

URL: https://cgit.FreeBSD.org/src/commit/?id=e48f7ff6a12c591b9b1d83abfcd46934b73c90fb

commit e48f7ff6a12c591b9b1d83abfcd46934b73c90fb
Author:     Alexander Motin <mav@FreeBSD.org>
AuthorDate: 2024-04-10 20:44:00 +0000
Commit:     Alexander Motin <mav@FreeBSD.org>
CommitDate: 2024-04-17 13:39:37 +0000

    ahc/ahd: Fix target mode operation
    
    After 5e63cdb457f9 the drivers didn't clear CAM_DIS_DISCONNECT in
    ah*_handle_target_cmd() when needed, only set it.
    
    Reported/tested by:     HP van Braam <hp@tmm.cx>
    MFC after:      1 week
    
    (cherry picked from commit f1e4c095777db088645008848b3bfb87146c13ec)
---
 sys/dev/aic7xxx/aic79xx.c | 3 +++
 sys/dev/aic7xxx/aic7xxx.c | 3 +++
 2 files changed, 6 insertions(+)

diff --git a/sys/dev/aic7xxx/aic79xx.c b/sys/dev/aic7xxx/aic79xx.c
index 116418dda25f..58b795a9d4ce 100644
--- a/sys/dev/aic7xxx/aic79xx.c
+++ b/sys/dev/aic7xxx/aic79xx.c
@@ -10317,7 +10317,10 @@ ahd_handle_target_cmd(struct ahd_softc *ahd, struct target_cmd *cmd)
 		ahd->pending_device = lstate;
 		ahd_freeze_ccb((union ccb *)atio);
 		atio->ccb_h.flags |= CAM_DIS_DISCONNECT;
+	} else {
+		atio->ccb_h.flags &= ~CAM_DIS_DISCONNECT;
 	}
+
 	xpt_done((union ccb*)atio);
 	return (0);
 }
diff --git a/sys/dev/aic7xxx/aic7xxx.c b/sys/dev/aic7xxx/aic7xxx.c
index 4b62f76b9cf8..9934fbcc41bb 100644
--- a/sys/dev/aic7xxx/aic7xxx.c
+++ b/sys/dev/aic7xxx/aic7xxx.c
@@ -7843,7 +7843,10 @@ ahc_handle_target_cmd(struct ahc_softc *ahc, struct target_cmd *cmd)
 		ahc->pending_device = lstate;
 		aic_freeze_ccb((union ccb *)atio);
 		atio->ccb_h.flags |= CAM_DIS_DISCONNECT;
+	} else {
+		atio->ccb_h.flags &= ~CAM_DIS_DISCONNECT;
 	}
+
 	xpt_done((union ccb*)atio);
 	return (0);
 }