Hi,
On 14/02/2008, Masa Murayama <[EMAIL PROTECTED]> wrote:
>
> ----- Original Message -----
> >Date: Thu, 14 Feb 2008 10:13:17 +0530
> >From: "Nabil Rahiman" <[EMAIL PROTECTED]>
> >To: "Mark Johnson" <[EMAIL PROTECTED]>
> >Cc: [email protected]
> >Subject: Re: [driver-discuss] porting device driver from Linux to
> > Solaris(for Atheros Ethernet driver)
> >
> >
> >Hi,
> > Thanks for the prompt reply.
> >
> >On 13/02/2008, Mark Johnson <[EMAIL PROTECTED]> wrote:
> >>
> >>
> >>
> >> 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.
> >
> >
> > I used Linux source for getting the information how it is
> >communicating with hardware(ATheros
> >Ethernet chip). Because there is no specification available for this
> device.
> > I think this is not against the license. If this is against
> licensing
> >issue how could I get the specification for this particular hardware.
> > I used the source code which is available in
> >http://homepage2.nifty.com/mrym3/taiyodo/eng/
> > There he used two different files one for specific to the device and
> other
> >one is a common architecture (how the driver is communicating with OS and
> >creating some data structure for its communication) for an Ethernet
> driver.
> >And I am rewriting the file which is specific to device. I hope this is
> not
> >the against the license agreement.
>
>
> If you want to distribute the driver, I recommend to start from *bsd
This time I am not planning to distribute. I am doing this project for
testing it on my personal
system which is not supporting Solaris
driver.
>
>
> >> 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.
> >
>
>
> There is no standard api or structure in Linux which is corresponding
> to dma attribute in Solaris. You need to think them by yourself,
> but it is easy. To do that, you need to notice following.
>
> buffer address bits in tx and rx descriptors
> this will define dma low and high address and align.
>
> buffer size bits in tx and rx descriptors.
> this will define dma counts
>
> the number of descriptors you can use for one packet
> this will define segment boundary ant s/g list length
Thanks for this information.
Nabil
-masa
>
>
> >
> > I think the information that you passed to the structure member
> >variable is not
> >be always same. It will different for the different device.
> > So I need to pass the values to this structure variable which suit
> for
> >the Atheros Device.
> >
> > If the values is specif to the device then there could be some similar
> data
> >structure
> >in linux also. But couldn't figure out which data structure that we want
> to
> >use in linux. So that use
> >the same here in Solaris.
> >
> >
> >
> >
> >
> > > 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
> >>
> >
>
> >----- inline -----
>
> >_______________________________________________
> >driver-discuss mailing list
> >[email protected]
> >http://mail.opensolaris.org/mailman/listinfo/driver-discuss
>
>
_______________________________________________
driver-discuss mailing list
[email protected]
http://mail.opensolaris.org/mailman/listinfo/driver-discuss