From owner-svn-src-projects@FreeBSD.ORG Sun May 6 20:37:02 2012 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D1B6D106564A; Sun, 6 May 2012 20:37:02 +0000 (UTC) (envelope-from marcel@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id BC1968FC15; Sun, 6 May 2012 20:37:02 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q46Kb2nX030795; Sun, 6 May 2012 20:37:02 GMT (envelope-from marcel@svn.freebsd.org) Received: (from marcel@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q46Kb2au030792; Sun, 6 May 2012 20:37:02 GMT (envelope-from marcel@svn.freebsd.org) Message-Id: <201205062037.q46Kb2au030792@svn.freebsd.org> From: Marcel Moolenaar Date: Sun, 6 May 2012 20:37:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r235105 - in projects/altix2/sys: kern sys X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 06 May 2012 20:37:03 -0000 Author: marcel Date: Sun May 6 20:37:02 2012 New Revision: 235105 URL: http://svn.freebsd.org/changeset/base/235105 Log: Implement busdma_tag_derive(). Modified: projects/altix2/sys/kern/subr_busdma.c projects/altix2/sys/sys/busdma.h Modified: projects/altix2/sys/kern/subr_busdma.c ============================================================================== --- projects/altix2/sys/kern/subr_busdma.c Sun May 6 20:26:28 2012 (r235104) +++ projects/altix2/sys/kern/subr_busdma.c Sun May 6 20:37:02 2012 (r235105) @@ -37,6 +37,8 @@ __FBSDID("$FreeBSD$"); struct busdma_tag { struct busdma_tag *dt_chain; + struct busdma_tag *dt_child; + struct busdma_tag *dt_parent; device_t dt_device; bus_addr_t dt_minaddr; bus_addr_t dt_maxaddr; @@ -93,7 +95,7 @@ _busdma_tag_get_base(device_t dev) static int _busdma_tag_make(device_t dev, busdma_tag_t base, bus_addr_t maxaddr, - bus_addr_t align, bus_addr_t bndry, bus_addr_t maxsz, u_int nsegs, + bus_addr_t align, bus_addr_t bndry, bus_size_t maxsz, u_int nsegs, bus_size_t maxsegsz, u_int flags, busdma_tag_t *tag_p) { busdma_tag_t tag; @@ -122,7 +124,7 @@ _busdma_tag_make(device_t dev, busdma_ta int busdma_tag_create(device_t dev, bus_addr_t maxaddr, bus_addr_t align, - bus_addr_t bndry, bus_addr_t maxsz, u_int nsegs, bus_size_t maxsegsz, + bus_addr_t bndry, bus_size_t maxsz, u_int nsegs, bus_size_t maxsegsz, u_int flags, busdma_tag_t *tag_p) { busdma_tag_t base, first, tag; @@ -142,3 +144,26 @@ busdma_tag_create(device_t dev, bus_addr *tag_p = tag; return (0); } + +int +busdma_tag_derive(busdma_tag_t base, bus_addr_t maxaddr, bus_addr_t align, + bus_addr_t bndry, bus_size_t maxsz, u_int nsegs, bus_size_t maxsegsz, + u_int flags, busdma_tag_t *tag_p) +{ + busdma_tag_t tag; + int error; + + error = _busdma_tag_make(base->dt_device, base, maxaddr, align, bndry, + maxsz, nsegs, maxsegsz, flags, &tag); + if (error != 0) + return (error); + + /* + * This is a derived tag. Link it with the base tag. + */ + tag->dt_parent = base; + tag->dt_chain = base->dt_child; + base->dt_child = tag; + *tag_p = tag; + return (0); +} Modified: projects/altix2/sys/sys/busdma.h ============================================================================== --- projects/altix2/sys/sys/busdma.h Sun May 6 20:26:28 2012 (r235104) +++ projects/altix2/sys/sys/busdma.h Sun May 6 20:37:02 2012 (r235105) @@ -49,7 +49,25 @@ typedef struct busdma_tag *busdma_tag_t; * tag_p address in which to return the newly created tag. */ int busdma_tag_create(device_t dev, bus_addr_t maxaddr, bus_addr_t align, - bus_addr_t bndry, bus_addr_t maxsz, u_int nsegs, bus_size_t maxsegsz, + bus_addr_t bndry, bus_size_t maxsz, u_int nsegs, bus_size_t maxsegsz, + u_int flags, busdma_tag_t *tag_p); + +/* + * busdma_tag_derive + * returns: errno value + * arguments: + * tag The root tag that is to be derived from. + * maxaddr largest address that can be handled by the device. + * align alignment requirements of the DMA segments. + * bndry address boundary constraints for DMA. + * maxsz maximum total DMA size allowed. + * nsegs maximum number of DMA segments allowed. + * maxsegsz maximum size of a single DMA segment. + * flags flags that control the behaviour of the operation. + * tag_p address in which to return the newly created tag. + */ +int busdma_tag_derive(busdma_tag_t tag, bus_addr_t maxaddr, bus_addr_t align, + bus_addr_t bndry, bus_size_t maxsz, u_int nsegs, bus_size_t maxsegsz, u_int flags, busdma_tag_t *tag_p); #endif /* _SYS_BUSDMA_H_ */