Date: Sun, 6 May 2012 20:37:02 +0000 (UTC) From: Marcel Moolenaar <marcel@FreeBSD.org> To: src-committers@freebsd.org, svn-src-projects@freebsd.org Subject: svn commit: r235105 - in projects/altix2/sys: kern sys Message-ID: <201205062037.q46Kb2au030792@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
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_ */
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201205062037.q46Kb2au030792>