Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 21 Jul 1999 10:03:14 -0600
From:      "Justin T. Gibbs" <gibbs@caspian.plutotech.com>
To:        Wilko Bulte <wilko@yedi.iaf.nl>
Cc:        gibbs@plutotech.com (Justin T. Gibbs), hackers@FreeBSD.ORG
Subject:   Re: any docs on how to use bus_dma_tag_create e.a. ? 
Message-ID:  <199907211603.KAA03304@caspian.plutotech.com>
In-Reply-To: Your message of "Tue, 20 Jul 1999 22:37:47 %2B0200." <199907202037.WAA00801@yedi.iaf.nl> 

next in thread | previous in thread | raw e-mail | index | archive | help
>> bus_dma related stuff is only required if the device has a DMA engine
>> you wish to use.  To access the shared memory on the card (e.g. map
>
>Eh, sorry, I was confused. It has *both* shared memory and a DMA engine.
>
>> it into the kernel's virtual address space), you will need to use
>> the resource manager and bus space.
>
>Do you by chance have an example (maybe in -current somewhere) of the
>shared memory stuff? I found some DMA stuff in ahc_pci.c:
>
> /* Allocate a dmatag for our SCB DMA maps */
>        /* XXX Should be a child of the PCI bus dma tag */
>        error = bus_dma_tag_create(/*parent*/NULL,

A parent tag would indicate the restrictions of any parent bridge between
the device you are talking to and CPU memory.  We haven't modified the
new bus code yet to pass through this information, so just leave it NULL
for now.
				    /*alignment*/1,

Any alignment constraints on the target memory region of a DMA specified in
bytes.  If the allocation must be 32bit aligned, you would specify 4.

>                                   /*boundary*/0,

Any boundary constraints on the target memory region of a DMA, for instance
if the DMA cannot cross a 64k boundary, you would set this to 64K.

>                                   /*lowaddr*/BUS_SPACE_MAXADDR_32BIT,
>                                   /*highaddr*/BUS_SPACE_MAXADDR,

low and high address of the region that the DMA engine cannot access.

>                                   /*filter*/NULL, /*filterarg*/NULL,

If the device's DMA constraints cannot be specified with a single region,
you must specify a region that encompasses all such regions and specify
a filter function to provide a finer level of control.

>                                   /*maxsize*/MAXBSIZE,

Maximum DMA transfer size.

>				   /*nsegments*/AHC_NSEG,

Maximum number of discontinuities in the mapped region.

>                                   /*maxsegsz*/AHC_MAXTRANSFER_SIZE,

Maximum size of a segment.  maxsize <= nsegments * maxsegsz.

>                                   /*flags*/BUS_DMA_ALLOCNOW

Allocate all necessary resources to handle a single mapping for this tag
at the time the tag is created.
 
>Most (?) drivers seem to use the older framework (can I distinguish
>those by COMPAT_PCI_DRIVER() ?).

You should use the new API if possible.

--
Justin



To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message




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