git: 23a5782dc0c0 - stable/14 - mpi3mr: Use template for main busdma tag.

From: Alexander Motin <mav_at_FreeBSD.org>
Date: Fri, 19 Jan 2024 17:17:42 UTC
The branch stable/14 has been updated by mav:

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

commit 23a5782dc0c0064c2e5693193caeb0dbf67cd718
Author:     Alexander Motin <mav@FreeBSD.org>
AuthorDate: 2023-11-29 01:50:39 +0000
Commit:     Alexander Motin <mav@FreeBSD.org>
CommitDate: 2024-01-19 17:16:50 +0000

    mpi3mr: Use template for main busdma tag.
    
    Use the simpler template code for the parent busdma tag for all I/O to
    this card.
    
    Reviewed by:            mav, jhb, imp
    Differential Revision:  https://reviews.freebsd.org/D42607
    
    (cherry picked from commit 489eee0d41dce317678adb0dae8d509a5f1d6d93)
---
 sys/dev/mpi3mr/mpi3mr_pci.c | 16 ++++------------
 1 file changed, 4 insertions(+), 12 deletions(-)

diff --git a/sys/dev/mpi3mr/mpi3mr_pci.c b/sys/dev/mpi3mr/mpi3mr_pci.c
index d07463366943..c1c0211aab4e 100644
--- a/sys/dev/mpi3mr/mpi3mr_pci.c
+++ b/sys/dev/mpi3mr/mpi3mr_pci.c
@@ -256,6 +256,7 @@ mpi3mr_release_resources(struct mpi3mr_softc *sc)
 
 static int mpi3mr_setup_resources(struct mpi3mr_softc *sc)
 {
+	bus_dma_template_t t;
 	int i;
 	device_t dev = sc->mpi3mr_dev;
 	
@@ -288,20 +289,11 @@ static int mpi3mr_setup_resources(struct mpi3mr_softc *sc)
 	 * dma_mask on the device.
 	 */
 	/* Allocate the parent DMA tag */
-	if (bus_dma_tag_create(bus_get_dma_tag(dev),  	/* parent */
-				1, 0,			/* algnmnt, boundary */
-				BUS_SPACE_MAXADDR,	/* lowaddr */
-				BUS_SPACE_MAXADDR,	/* highaddr */
-				NULL, NULL,		/* filter, filterarg */
-				BUS_SPACE_MAXSIZE_32BIT,/* maxsize */
-				BUS_SPACE_UNRESTRICTED,	/* nsegments */
-				BUS_SPACE_MAXSIZE_32BIT,/* maxsegsize */
-                                0,			/* flags */
-                                NULL, NULL,		/* lockfunc, lockarg */
-                                &sc->mpi3mr_parent_dmat)) {
+	bus_dma_template_init(&t, bus_get_dma_tag(dev));
+	if (bus_dma_template_tag(&t, &sc->mpi3mr_parent_dmat)) {
 		mpi3mr_dprint(sc, MPI3MR_ERROR, "Cannot allocate parent DMA tag\n");
 		return (ENOMEM);
-        }
+	}
 
 	sc->max_msix_vectors = pci_msix_count(dev);