Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 14 Oct 2024 05:41:00 GMT
From:      Warner Losh <imp@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: 45645518ea19 - main - ciss: Add max physical target
Message-ID:  <202410140541.49E5f0vR089687@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by imp:

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

commit 45645518ea19ccb4761aee3a525aab2f323d37d4
Author:     Peter Eriksson <pen@lysator.liu.se>
AuthorDate: 2024-10-14 04:01:33 +0000
Commit:     Warner Losh <imp@FreeBSD.org>
CommitDate: 2024-10-14 05:24:15 +0000

    ciss: Add max physical target
    
    Add support for tracking the maximum physical target and using that to
    override the maximum logical target.
    
    PR: 246279
    Reviewed by: imp
    Tested by: Marek Zarychta
    Differential Revision: https://reviews.freebsd.org/D25155
---
 sys/dev/ciss/ciss.c    | 11 ++++++++++-
 sys/dev/ciss/cissvar.h |  1 +
 2 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/sys/dev/ciss/ciss.c b/sys/dev/ciss/ciss.c
index bb33ad17306f..a6071735c87b 100644
--- a/sys/dev/ciss/ciss.c
+++ b/sys/dev/ciss/ciss.c
@@ -1544,6 +1544,9 @@ ciss_init_physical(struct ciss_softc *sc)
 	    nphys, (nphys > 1 || nphys == 0) ? "s" : "");
     }
 
+    /* Per-controller highest target number seen */
+    sc->ciss_max_physical_target = 0;
+
     /*
      * Figure out the bus mapping.
      * Logical buses include both the local logical bus for local arrays and
@@ -1626,6 +1629,8 @@ ciss_init_physical(struct ciss_softc *sc)
     }
 
     ciss_filter_physical(sc, cll);
+    if (bootverbose || ciss_verbose)
+	ciss_printf(sc, "max physical target id: %d\n", sc->ciss_max_physical_target);
 
 out:
     if (cll != NULL)
@@ -1675,6 +1680,10 @@ ciss_filter_physical(struct ciss_softc *sc, struct ciss_lun_report *cll)
 	target = CISS_EXTRA_TARGET2(ea);
 	sc->ciss_physical[bus][target].cp_address = cll->lun[i];
 	sc->ciss_physical[bus][target].cp_online = 1;
+
+	if ((target > sc->ciss_max_physical_target) &&
+	    (cll->lun[i].physical.mode != CISS_HDR_ADDRESS_MODE_MASK_PERIPHERAL))
+		sc->ciss_max_physical_target = target;
     }
 
     return (0);
@@ -3062,7 +3071,7 @@ ciss_cam_action(struct cam_sim *sim, union ccb *ccb)
 	cpi->hba_inquiry = PI_TAG_ABLE;	/* XXX is this correct? */
 	cpi->target_sprt = 0;
 	cpi->hba_misc = 0;
-	cpi->max_target = sc->ciss_cfg->max_logical_supported;
+	cpi->max_target = MAX(sc->ciss_max_physical_target, sc->ciss_cfg->max_logical_supported);
 	cpi->max_lun = 0;		/* 'logical drive' channel only */
 	cpi->initiator_id = sc->ciss_cfg->max_logical_supported;
 	strlcpy(cpi->sim_vid, "FreeBSD", SIM_IDLEN);
diff --git a/sys/dev/ciss/cissvar.h b/sys/dev/ciss/cissvar.h
index eec11018d279..58275f83732c 100644
--- a/sys/dev/ciss/cissvar.h
+++ b/sys/dev/ciss/cissvar.h
@@ -236,6 +236,7 @@ struct ciss_softc
     int				ciss_max_bus_number;	/* maximum bus number */
     int				ciss_max_logical_bus;
     int				ciss_max_physical_bus;
+    int				ciss_max_physical_target;	/* highest physical target number */
 
     struct cam_devq		*ciss_cam_devq;
     struct cam_sim		**ciss_cam_sim;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202410140541.49E5f0vR089687>