Nabil Rahiman wrote:
> Hi,
> 
>     I am trying to port the lnux device driver into Solaris platform. 


Are you aware there are usually licensing issues with
porting a driver from Linux to Solaris? i.e. Linux
drivers usually have a GPLv2 license and therefore
can't be included with Solaris/OpenSolaris.



>     In Solaris for allocatting dma resource,  we have to set the 
> following set of dma attributes.
> 
> typedef struct ddi_dma_attr {
> 
>         uint_t          dma_attr_version;       /* version number */
>         uint64_t        dma_attr_addr_lo;       /* low DMA address range */
>         uint64_t        dma_attr_addr_hi;       /* high DMA address range */
> 
>         uint64_t        dma_attr_count_max;     /* DMA counter register */
>         uint64_t        dma_attr_align;         /* DMA address alignment */
>         uint_t          dma_attr_burstsizes;    /* DMA burstsizes */
> 
>         uint32_t        dma_attr_minxfer;       /* min effective DMA size */
>         uint64_t        dma_attr_maxxfer;       /* max DMA xfer size */
>         uint64_t        dma_attr_seg;           /* segment boundary */
> 
>         int             dma_attr_sgllen;        /* s/g length */
>         uint32_t        dma_attr_granular;      /* granularity of device */
>         uint_t          dma_attr_flags;         /* Bus specific DMA flags */
> 
> } ddi_dma_attr_t;
> 
> 
> And most of these attribute values are specific to the device.
> 
> But I couldn't find out the corresponding structure/functionality in Linux.
> 
> Please guide me.

I'm not sure what you are asking. Could you re-word it?  I made a
pass at what all the fields are used for.


 >         uint_t          dma_attr_version;       /* version number */

should be set to DMA_ATTR_V0


 >         uint64_t        dma_attr_addr_lo;       /* low DMA address range */

the lowest physical address the device can dma to.
Set to 0x0.


 >         uint64_t        dma_attr_addr_hi;       /* high DMA address range */

The highest dma address the device can DMA to (i.e. when
you need to use a copy/bounce buffer). Usually set to
0xFFFF.FFFF or 0xFFFF.FFFF.FFFF.FFFF


 >         uint64_t        dma_attr_count_max;     /* DMA counter register */

The maximum size of a single physically contiguous region (cookie)
you want return from ddi_dma_*_bind().




 >         uint64_t        dma_attr_align;         /* DMA address alignment */

The buffer alignment.  Only use in ddi_dma_mem_alloc().


 >         uint_t          dma_attr_burstsizes;    /* DMA burstsizes */

Not used. Set to 0x1.


 >         uint32_t        dma_attr_minxfer;       /* min effective DMA size */

Minimum xfer size.  Not used on x86.  Usually set to 1.


 >         uint64_t        dma_attr_maxxfer;       /* max DMA xfer size */

maximum size dma a device can do.  usually this ==
(dma_attr_count_max * dma_attr_sgllen), but not always.
Once you exceed this, the ddi_dma_*_bind() will break
the bind into multiple windows (assuming you support
partial maps).  It may also break it into multiple
windows if your devices needs to use a bounce buffer
and you exceeded the maximum size of the bounce
buffer.


 >         uint64_t        dma_attr_seg;           /* segment boundary */

Address boundary that a device cannot DMA over. Usually
used on old devices and/or bus technologies. usually
st to 0xFFFF.FFFF



 >         int             dma_attr_sgllen;        /* s/g length */

The maximum number of physically contiguous regions (cookies)
that the device supports.


 >         uint32_t        dma_attr_granular;      /* granularity of device */

uses when breaking a buffer into multiple windows. The
windows will be broken into whole multiples of granularity.
commonly used in storage drivers which do DMAs in 512 byte
chunks.  usually set to 1 or 512.



 >         uint_t          dma_attr_flags;         /* Bus specific DMA flags */


Set to 0x0.




MRJ
_______________________________________________
driver-discuss mailing list
[email protected]
http://mail.opensolaris.org/mailman/listinfo/driver-discuss

Reply via email to