git: 489eee0d41dc - main - mpi3mr: Use template for main busdma tag.

From: Warner Losh <imp_at_FreeBSD.org>
Date: Wed, 29 Nov 2023 01:55:43 UTC
The branch main has been updated by imp:

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

commit 489eee0d41dce317678adb0dae8d509a5f1d6d93
Author:     Alexander Motin <mav@FreeBSD.org>
AuthorDate: 2023-11-29 01:50:39 +0000
Commit:     Warner Losh <imp@FreeBSD.org>
CommitDate: 2023-11-29 01:52:23 +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
---
 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);