Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 6 May 2012 20:40:19 +0000 (UTC)
From:      Marcel Moolenaar <marcel@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-projects@freebsd.org
Subject:   svn commit: r235106 - projects/altix2/sys/dev/mpt
Message-ID:  <201205062040.q46KeJbQ030926@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: marcel
Date: Sun May  6 20:40:18 2012
New Revision: 235106
URL: http://svn.freebsd.org/changeset/base/235106

Log:
  Add the mpt_dma_tag_derive macro and use it when deriving from the
  parent tag. This will use busdma_tag_derive for busdma/mi and is
  identical to mpt_dma_tag_create for bus_dma.

Modified:
  projects/altix2/sys/dev/mpt/mpt.c
  projects/altix2/sys/dev/mpt/mpt.h
  projects/altix2/sys/dev/mpt/mpt_pci.c
  projects/altix2/sys/dev/mpt/mpt_user.c

Modified: projects/altix2/sys/dev/mpt/mpt.c
==============================================================================
--- projects/altix2/sys/dev/mpt/mpt.c	Sun May  6 20:37:02 2012	(r235105)
+++ projects/altix2/sys/dev/mpt/mpt.c	Sun May  6 20:40:18 2012	(r235106)
@@ -2534,7 +2534,7 @@ mpt_dma_buf_alloc(struct mpt_softc *mpt)
 	int i, error;
 
 	/* Create a child tag for data buffers */
-	if (mpt_dma_tag_create(mpt, mpt->parent_dmat, 1,
+	if (mpt_dma_tag_derive(mpt, mpt->parent_dmat, 1,
 	    0, BUS_SPACE_MAXADDR, BUS_SPACE_MAXADDR,
 	    NULL, NULL, (mpt->max_cam_seg_cnt - 1) * PAGE_SIZE,
 	    mpt->max_cam_seg_cnt, BUS_SPACE_MAXSIZE_32BIT, 0,
@@ -2544,7 +2544,7 @@ mpt_dma_buf_alloc(struct mpt_softc *mpt)
 	}
 
 	/* Create a child tag for request buffers */
-	if (mpt_dma_tag_create(mpt, mpt->parent_dmat, PAGE_SIZE, 0,
+	if (mpt_dma_tag_derive(mpt, mpt->parent_dmat, PAGE_SIZE, 0,
 	    BUS_SPACE_MAXADDR_32BIT, BUS_SPACE_MAXADDR,
 	    NULL, NULL, MPT_REQ_MEM_SIZE(mpt), 1, BUS_SPACE_MAXSIZE_32BIT, 0,
 	    &mpt->request_dmat) != 0) {
@@ -2758,7 +2758,7 @@ mpt_configure_ioc(struct mpt_softc *mpt,
 		 * the firmware after any hard-reset.
 		 */
 		mpt->fw_image_size = mpt->ioc_facts.FWImageSize;
-		error = mpt_dma_tag_create(mpt, mpt->parent_dmat, 1, 0,
+		error = mpt_dma_tag_derive(mpt, mpt->parent_dmat, 1, 0,
 		    BUS_SPACE_MAXADDR_32BIT, BUS_SPACE_MAXADDR, NULL, NULL,
 		    mpt->fw_image_size, 1, mpt->fw_image_size, 0,
 		    &mpt->fw_dmat);

Modified: projects/altix2/sys/dev/mpt/mpt.h
==============================================================================
--- projects/altix2/sys/dev/mpt/mpt.h	Sun May  6 20:37:02 2012	(r235105)
+++ projects/altix2/sys/dev/mpt/mpt.h	Sun May  6 20:40:18 2012	(r235106)
@@ -241,19 +241,19 @@ int mpt_modevent(module_t, int, void *);
 #ifdef MPT_USE_BUSDMA
 #include <sys/busdma.h>
 
-#define	mpt_dma_tag_create(mpt, parent_tag, alignment, boundary,        \
-                           lowaddr, highaddr, filter, filterarg,        \
-                           maxsize, nsegments, maxsegsz, flags,         \
-                           dma_tagp)                                    \
+#define	mpt_dma_tag_create(mpt, parent_tag, alignment, boundary,	\
+		lowaddr, highaddr, filter, filterarg, maxsize,		\
+		nsegments, maxsegsz, flags, dma_tagp)			\
 	busdma_tag_create((mpt)->dev, lowaddr, alignment, boundary,	\
-	    maxsize, nsegments, maxsegsz, flags, (busdma_tag_t *)dma_tagp)
+	    maxsize, nsegments, maxsegsz, flags,			\
+	    (busdma_tag_t *)dma_tagp)
 
-#define	mpt_dma_tag_derive(mpt, parent_tag, alignment, boundary,        \
-                           lowaddr, highaddr, filter, filterarg,        \
-                           maxsize, nsegments, maxsegsz, flags,         \
-                           dma_tagp)                                    \
-	busdma_tag_derive(parent_tag, lowaddr, alignment, boundary,	\
-	    maxsize, nsegments, maxsegsz, flags, (busdma_tag_t *)dma_tagp)
+#define	mpt_dma_tag_derive(mpt, parent_tag, alignment, boundary,	\
+		lowaddr, highaddr, filter, filterarg, maxsize,		\
+		nsegments, maxsegsz, flags, dma_tagp)			\
+	busdma_tag_derive((busdma_tag_t)parent_tag, lowaddr, alignment,	\
+	    boundary, maxsize, nsegments, maxsegsz, flags,		\
+	    (busdma_tag_t *)dma_tagp)
 #else
 #if __FreeBSD_version < 600000
 #define	bus_get_dma_tag(x)	NULL
@@ -278,6 +278,7 @@ int mpt_modevent(module_t, int, void *);
 			   maxsize, nsegments, maxsegsz, flags,		\
 			   dma_tagp)
 #endif
+#define	mpt_dma_tag_derive	mpt_dma_tag_create
 #endif /* MPT_USE_BUSDMA */
 
 struct mpt_map_info {

Modified: projects/altix2/sys/dev/mpt/mpt_pci.c
==============================================================================
--- projects/altix2/sys/dev/mpt/mpt_pci.c	Sun May  6 20:37:02 2012	(r235105)
+++ projects/altix2/sys/dev/mpt/mpt_pci.c	Sun May  6 20:40:18 2012	(r235106)
@@ -775,7 +775,7 @@ mpt_dma_mem_alloc(struct mpt_softc *mpt)
 	}
 
 	/* Create a child tag for reply buffers */
-	if (mpt_dma_tag_create(mpt, mpt->parent_dmat, PAGE_SIZE, 0,
+	if (mpt_dma_tag_derive(mpt, mpt->parent_dmat, PAGE_SIZE, 0,
 	    BUS_SPACE_MAXADDR_32BIT, BUS_SPACE_MAXADDR,
 	    NULL, NULL, 2 * PAGE_SIZE, 1, BUS_SPACE_MAXSIZE_32BIT, 0,
 	    &mpt->reply_dmat) != 0) {

Modified: projects/altix2/sys/dev/mpt/mpt_user.c
==============================================================================
--- projects/altix2/sys/dev/mpt/mpt_user.c	Sun May  6 20:37:02 2012	(r235105)
+++ projects/altix2/sys/dev/mpt/mpt_user.c	Sun May  6 20:40:18 2012	(r235106)
@@ -200,7 +200,7 @@ mpt_alloc_buffer(struct mpt_softc *mpt, 
 	/* Limit requests to 16M. */
 	if (len > 16 * 1024 * 1024)
 		return (ENOSPC);
-	error = mpt_dma_tag_create(mpt, mpt->parent_dmat, 1, 0,
+	error = mpt_dma_tag_derive(mpt, mpt->parent_dmat, 1, 0,
 	    BUS_SPACE_MAXADDR_32BIT, BUS_SPACE_MAXADDR, NULL, NULL,
 	    len, 1, len, 0, &page_mem->tag);
 	if (error)



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