git: 4bb54e8ec3d0 - stable/13 - ahc/ahd: Fix target mode operation

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

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

commit 4bb54e8ec3d002b0bb822b6ca8b5ac44d9ee649d
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:40:06 +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 795cf145c575..533271a4b51a 100644
--- a/sys/dev/aic7xxx/aic79xx.c
+++ b/sys/dev/aic7xxx/aic79xx.c
@@ -10326,7 +10326,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 68f189f5dd48..91bc68121067 100644
--- a/sys/dev/aic7xxx/aic7xxx.c
+++ b/sys/dev/aic7xxx/aic7xxx.c
@@ -7849,7 +7849,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);
 }