Date: Wed, 9 Jan 2013 05:02:55 +0000 (UTC) From: Marcel Moolenaar <marcel@FreeBSD.org> To: src-committers@freebsd.org, svn-src-projects@freebsd.org Subject: svn commit: r245214 - in projects/altix2/sys: kern sys Message-ID: <201301090502.r0952tCY043599@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: marcel Date: Wed Jan 9 05:02:55 2013 New Revision: 245214 URL: http://svnweb.freebsd.org/changeset/base/245214 Log: Add the BUSDMA_ALLOC_CONSISTENT flag. Pass it along in the mtag and save it in the memory descriptor. The flag tells the backend that the allocation needs a coherent and unbuffered (synchronous) DMA mapping because it's used for a CPU and device handshake protocol, such as mailboxes and/or buffer rings. On the SGI Altix, this means that we cannot use a direct-mapped 32-bit DMA address, nor a 64-bit DAC address when the PCI bus is not in PCI-X mode. 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 Wed Jan 9 04:04:30 2013 (r245213) +++ projects/altix2/sys/kern/subr_busdma.c Wed Jan 9 05:02:55 2013 (r245214) @@ -813,7 +813,7 @@ busdma_mem_alloc(struct busdma_tag *tag, if (md == NULL) return (ENOMEM); - mtag.dmt_flags = flags & BUSDMA_MD_PLATFORM_FLAGS; + mtag.dmt_flags = flags; mtag.dmt_minaddr = tag->dt_minaddr; mtag.dmt_maxaddr = tag->dt_maxaddr; mtag.dmt_maxsz = tag->dt_maxsegsz; @@ -826,7 +826,7 @@ busdma_mem_alloc(struct busdma_tag *tag, goto fail; } - md->md_flags |= mtag.dmt_flags & BUSDMA_MD_PLATFORM_FLAGS; + md->md_flags = mtag.dmt_flags; mflags = (flags & BUSDMA_ALLOC_ZERO) ? M_ZERO : 0; idx = 0; Modified: projects/altix2/sys/sys/busdma.h ============================================================================== --- projects/altix2/sys/sys/busdma.h Wed Jan 9 04:04:30 2013 (r245213) +++ projects/altix2/sys/sys/busdma.h Wed Jan 9 05:02:55 2013 (r245214) @@ -148,9 +148,12 @@ busdma_md_get_pointer(busdma_md_t md, u_ */ int busdma_mem_alloc(busdma_tag_t tag, u_int flags, busdma_md_t *md_p); -/* Allocate pre-zeroed memory. */ +/* Allocate pre-zeroed DMA memory. */ #define BUSDMA_ALLOC_ZERO 0x10000 +/* Allocate memory with consistent mapping. */ +#define BUSDMA_ALLOC_CONSISTENT 0x20000 + /* * busdma_mem_free * returns: errno value
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201301090502.r0952tCY043599>