Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 19 Jan 2024 17:17:44 GMT
From:      Alexander Motin <mav@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: 344cdef0ccd7 - stable/14 - mpi3mr: Assume dma_hiaddr is BUS_SPACE_MAXADDR
Message-ID:  <202401191717.40JHHib5097449@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch stable/14 has been updated by mav:

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

commit 344cdef0ccd7ee3fb2ba67591298959f803bd292
Author:     Warner Losh <imp@FreeBSD.org>
AuthorDate: 2023-11-29 01:50:52 +0000
Commit:     Alexander Motin <mav@FreeBSD.org>
CommitDate: 2024-01-19 17:16:50 +0000

    mpi3mr: Assume dma_hiaddr is BUS_SPACE_MAXADDR
    
    No sense having a variable for this. So use BUS_SPACE_MAXADDR and remove
    dma_hiaddr from softc.
    
    Suggested by:           jhb
    Sponsored by:           Netflix
    Differential Revision:  https://reviews.freebsd.org/D42808
    
    (cherry picked from commit 1ec7c672bc2854a1efb1d50f189d4881163c16c6)
---
 sys/dev/mpi3mr/mpi3mr.c     | 47 ++++++++++++++++++++++-----------------------
 sys/dev/mpi3mr/mpi3mr.h     |  1 -
 sys/dev/mpi3mr/mpi3mr_app.c |  2 +-
 3 files changed, 24 insertions(+), 26 deletions(-)

diff --git a/sys/dev/mpi3mr/mpi3mr.c b/sys/dev/mpi3mr/mpi3mr.c
index c1f35dbca94c..73a40b374c1a 100644
--- a/sys/dev/mpi3mr/mpi3mr.c
+++ b/sys/dev/mpi3mr/mpi3mr.c
@@ -605,7 +605,7 @@ static int mpi3mr_create_op_reply_queue(struct mpi3mr_softc *sc, U16 qid)
 		if (bus_dma_tag_create(sc->mpi3mr_parent_dmat,    /* parent */
 					4, 0,			/* algnmnt, boundary */
 					sc->dma_loaddr,		/* lowaddr */
-					sc->dma_hiaddr,		/* highaddr */
+					BUS_SPACE_MAXADDR,	/* highaddr */
 					NULL, NULL,		/* filter, filterarg */
 					op_reply_q->qsz,		/* maxsize */
 					1,			/* nsegments */
@@ -751,7 +751,7 @@ static int mpi3mr_create_op_req_queue(struct mpi3mr_softc *sc, U16 req_qid, U8 r
 		if (bus_dma_tag_create(sc->mpi3mr_parent_dmat,    /* parent */
 					4, 0,			/* algnmnt, boundary */
 					sc->dma_loaddr,		/* lowaddr */
-					sc->dma_hiaddr,		/* highaddr */
+					BUS_SPACE_MAXADDR,	/* highaddr */
 					NULL, NULL,		/* filter, filterarg */
 					op_req_q->qsz,		/* maxsize */
 					1,			/* nsegments */
@@ -1441,10 +1441,10 @@ static int mpi3mr_issue_iocfacts(struct mpi3mr_softc *sc,
 
 
 	/*
-	 * We can't use sc->dma_loaddr / hiaddr here.  We set those only after
-	 * we get the iocfacts.  So allocate in the lower 4GB.  The amount of
-	 * data is tiny and we don't do this that often, so any bouncing we
-	 * might have to do isn't a cause for concern.
+	 * We can't use sc->dma_loaddr here.  We set those only after we get the
+	 * iocfacts.  So allocate in the lower 4GB.  The amount of data is tiny
+	 * and we don't do this that often, so any bouncing we might have to do
+	 * isn't a cause for concern.
 	 */
         if (bus_dma_tag_create(sc->mpi3mr_parent_dmat,    /* parent */
 				4, 0,			/* algnmnt, boundary */
@@ -1689,8 +1689,8 @@ static int mpi3mr_process_factsdata(struct mpi3mr_softc *sc,
 
 	/*
 	 * Set the DMA mask for the card.  dma_mask is the number of bits that
-	 * can have bits set in them.  Translate this into bus_dma loaddr/hiaddr
-	 * args.  Add sanity for more bits than address space or other overflow
+	 * can have bits set in them.  Translate this into bus_dma loaddr args.
+	 * Add sanity for more bits than address space or other overflow
 	 * situations.
 	 */
 	if (sc->facts.dma_mask == 0 ||
@@ -1698,10 +1698,9 @@ static int mpi3mr_process_factsdata(struct mpi3mr_softc *sc,
 		sc->dma_loaddr = BUS_SPACE_MAXADDR;
 	else
 		sc->dma_loaddr = ~((1ull << sc->facts.dma_mask) - 1);
-	sc->dma_hiaddr = BUS_SPACE_MAXADDR;
 	mpi3mr_dprint(sc, MPI3MR_INFO,
-	    "dma_mask bits: %d loaddr 0x%jx hiaddr 0x%jx\n",
-	    sc->facts.dma_mask, sc->dma_loaddr, sc->dma_hiaddr);
+	    "dma_mask bits: %d loaddr 0x%jx\n",
+	    sc->facts.dma_mask, sc->dma_loaddr);
 
 	return retval;
 }
@@ -1739,7 +1738,7 @@ static int mpi3mr_reply_dma_alloc(struct mpi3mr_softc *sc)
 	if (bus_dma_tag_create(sc->mpi3mr_parent_dmat,  /* parent */
 				16, 0,			/* algnmnt, boundary */
 				sc->dma_loaddr,		/* lowaddr */
-				sc->dma_hiaddr,		/* highaddr */
+				BUS_SPACE_MAXADDR,	/* highaddr */
 				NULL, NULL,		/* filter, filterarg */
                                 sz,			/* maxsize */
                                 1,			/* nsegments */
@@ -1775,7 +1774,7 @@ static int mpi3mr_reply_dma_alloc(struct mpi3mr_softc *sc)
         if (bus_dma_tag_create(sc->mpi3mr_parent_dmat,    /* parent */
 				8, 0,			/* algnmnt, boundary */
 				sc->dma_loaddr,		/* lowaddr */
-				sc->dma_hiaddr,		/* highaddr */
+				BUS_SPACE_MAXADDR,	/* highaddr */
 				NULL, NULL,		/* filter, filterarg */
                                 sz,			/* maxsize */
                                 1,			/* nsegments */
@@ -1809,7 +1808,7 @@ static int mpi3mr_reply_dma_alloc(struct mpi3mr_softc *sc)
         if (bus_dma_tag_create(sc->mpi3mr_parent_dmat,    /* parent */
 				4, 0,			/* algnmnt, boundary */
 				sc->dma_loaddr,		/* lowaddr */
-				sc->dma_hiaddr,		/* highaddr */
+				BUS_SPACE_MAXADDR,	/* highaddr */
 				NULL, NULL,		/* filter, filterarg */
                                 sz,			/* maxsize */
                                 1,			/* nsegments */
@@ -1843,7 +1842,7 @@ static int mpi3mr_reply_dma_alloc(struct mpi3mr_softc *sc)
         if (bus_dma_tag_create(sc->mpi3mr_parent_dmat,    /* parent */
 				8, 0,			/* algnmnt, boundary */
 				sc->dma_loaddr,		/* lowaddr */
-				sc->dma_hiaddr,		/* highaddr */
+				BUS_SPACE_MAXADDR,	/* highaddr */
 				NULL, NULL,		/* filter, filterarg */
                                 sz,			/* maxsize */
                                 1,			/* nsegments */
@@ -1980,7 +1979,7 @@ mpi3mr_print_fw_pkg_ver(struct mpi3mr_softc *sc)
 	if (bus_dma_tag_create(sc->mpi3mr_parent_dmat,  /* parent */
 				4, 0,			/* algnmnt, boundary */
 				sc->dma_loaddr,		/* lowaddr */
-				sc->dma_hiaddr,		/* highaddr */
+				BUS_SPACE_MAXADDR,	/* highaddr */
 				NULL, NULL,		/* filter, filterarg */
 				fw_pkg_ver_len,		/* maxsize */
 				1,			/* nsegments */
@@ -2102,7 +2101,7 @@ static int mpi3mr_issue_iocinit(struct mpi3mr_softc *sc)
 	if (bus_dma_tag_create(sc->mpi3mr_parent_dmat,  /* parent */
 				4, 0,			/* algnmnt, boundary */
 				sc->dma_loaddr,		/* lowaddr */
-				sc->dma_hiaddr,		/* highaddr */
+				BUS_SPACE_MAXADDR,	/* highaddr */
 				NULL, NULL,		/* filter, filterarg */
                                 drvr_info_len,		/* maxsize */
                                 1,			/* nsegments */
@@ -2515,7 +2514,7 @@ static int mpi3mr_alloc_chain_bufs(struct mpi3mr_softc *sc)
         if (bus_dma_tag_create(sc->mpi3mr_parent_dmat,  /* parent */
 				4096, 0,		/* algnmnt, boundary */
 				sc->dma_loaddr,		/* lowaddr */
-				sc->dma_hiaddr,		/* highaddr */
+				BUS_SPACE_MAXADDR,	/* highaddr */
 				NULL, NULL,		/* filter, filterarg */
                                 sz,			/* maxsize */
                                 1,			/* nsegments */
@@ -2590,8 +2589,8 @@ static int mpi3mr_pel_alloc(struct mpi3mr_softc *sc)
 		sc->pel_seq_number_sz = sizeof(Mpi3PELSeq_t);
 		if (bus_dma_tag_create(sc->mpi3mr_parent_dmat,   /* parent */
 				 4, 0,                           /* alignment, boundary */
-				 sc->dma_loaddr,	        /* lowaddr */
-				 sc->dma_hiaddr,	              /* highaddr */
+				 sc->dma_loaddr,	         /* lowaddr */
+				 BUS_SPACE_MAXADDR,		 /* highaddr */
 				 NULL, NULL,                     /* filter, filterarg */
 				 sc->pel_seq_number_sz,		 /* maxsize */
 				 1,                              /* nsegments */
@@ -4946,7 +4945,7 @@ mpi3mr_alloc_requests(struct mpi3mr_softc *sc)
 	ret = bus_dma_tag_create( sc->mpi3mr_parent_dmat,    /* parent */
 				1, 0,			/* algnmnt, boundary */
 				sc->dma_loaddr,		/* lowaddr */
-				sc->dma_hiaddr,		/* highaddr */
+				BUS_SPACE_MAXADDR,	/* highaddr */
 				NULL, NULL,		/* filter, filterarg */
 				BUS_SPACE_MAXSIZE,	/* maxsize */
                                 nsegs,			/* nsegments */
@@ -5120,7 +5119,7 @@ void mpi3mr_alloc_ioctl_dma_memory(struct mpi3mr_softc *sc)
 		if (bus_dma_tag_create(sc->mpi3mr_parent_dmat,    /* parent */
 					4, 0,			/* algnmnt, boundary */
 					sc->dma_loaddr,		/* lowaddr */
-					sc->dma_hiaddr,		/* highaddr */
+					BUS_SPACE_MAXADDR,	/* highaddr */
 					NULL, NULL,		/* filter, filterarg */
 					mem_desc->size,		/* maxsize */
 					1,			/* nsegments */
@@ -5150,7 +5149,7 @@ void mpi3mr_alloc_ioctl_dma_memory(struct mpi3mr_softc *sc)
 	if (bus_dma_tag_create(sc->mpi3mr_parent_dmat,    /* parent */
 				4, 0,			/* algnmnt, boundary */
 				sc->dma_loaddr,		/* lowaddr */
-				sc->dma_hiaddr,		/* highaddr */
+				BUS_SPACE_MAXADDR,	/* highaddr */
 				NULL, NULL,		/* filter, filterarg */
 				mem_desc->size,		/* maxsize */
 				1,			/* nsegments */
@@ -5179,7 +5178,7 @@ void mpi3mr_alloc_ioctl_dma_memory(struct mpi3mr_softc *sc)
 	if (bus_dma_tag_create(sc->mpi3mr_parent_dmat,    /* parent */
 				4, 0,			/* algnmnt, boundary */
 				sc->dma_loaddr,		/* lowaddr */
-				sc->dma_hiaddr,		/* highaddr */
+				BUS_SPACE_MAXADDR,	/* highaddr */
 				NULL, NULL,		/* filter, filterarg */
 				mem_desc->size,		/* maxsize */
 				1,			/* nsegments */
diff --git a/sys/dev/mpi3mr/mpi3mr.h b/sys/dev/mpi3mr/mpi3mr.h
index 3a9612449c63..ca1f42a4a7e5 100644
--- a/sys/dev/mpi3mr/mpi3mr.h
+++ b/sys/dev/mpi3mr/mpi3mr.h
@@ -545,7 +545,6 @@ struct mpi3mr_softc {
 	char driver_name[MPI3MR_NAME_LENGTH];
 	int bars;
 	bus_addr_t dma_loaddr;
-	bus_addr_t dma_hiaddr;
 	u_int mpi3mr_debug;
 	struct mpi3mr_reset reset;
 	int max_msix_vectors;
diff --git a/sys/dev/mpi3mr/mpi3mr_app.c b/sys/dev/mpi3mr/mpi3mr_app.c
index dd3e4ac2ca08..384d0d6fe178 100644
--- a/sys/dev/mpi3mr/mpi3mr_app.c
+++ b/sys/dev/mpi3mr/mpi3mr_app.c
@@ -337,7 +337,7 @@ mpi3mr_app_build_nvme_prp(struct mpi3mr_softc *sc,
 	if (bus_dma_tag_create(sc->mpi3mr_parent_dmat,		/* parent */
 				4, 0,				/* algnmnt, boundary */
 				sc->dma_loaddr,			/* lowaddr */
-				sc->dma_hiaddr,			/* highaddr */
+				BUS_SPACE_MAXADDR,		/* highaddr */
 				NULL, NULL,			/* filter, filterarg */
 				dev_pgsz,			/* maxsize */
                                 1,				/* nsegments */



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