Re: howto provide io memory to PCI card

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello Charles,

On Thu, Apr 29, 2010 at 3:55 PM, Charles Brown <charles.brown@xxxxxxxxxx> wrote:
>   Early on I was using the altpciechdma driver as reference, but the
> hardware engineer doesn't want me controlling the DMA on the card.  So,
> we're just using memcpy_toio/fromio.
>
I am the author of altpciechdma, which supports both:
1) memory on the board available through BAR0, which can be mapped on
the host. Memory copies are initiated by the host.
2) direct memory access from the board to memory on the host. Memory
copies are performed by the board, as instructed to the DMA controller
on the board, by the host, as initiated by the host.

As you can see, in both cases, the host initiates the memory copies.
Only in case of DMA the board *performs* it.

>   That design also has the card providing host->board IO memory using BAR0
> and board->host using BAR2, but the HW engineer only wants to provide
> host->board memory in BAR0, and me to provide the memory for board->host -
> by allocating appropriate memory and handing back a physical address. He has
> BAR2 set to 0.
>
So in your case, you want the board to both initiate and perform the
copy, thus self-initiated DMA.

>  /* write address back, so board can use it in address translation */
>  dest = (unsigned char *)ioremap( start, size );
>  memcpy_toio( &dest[4], &board->iomstart, sizeof(board->iomstart) );
>  memcpy_toio( &dest[4+sizeof(board->iomstart)], &board->iomlength,
> sizeof(board->iomlength) );
>  memcpy_toio( &dest[0], "RDY\0", 4 );
>  iounmap( dest );
>

Let us first find out what you expect to do:

Where do you expect the memory pointed to by "dest" is located?

Regards,
-- 
Leon
--
To unsubscribe from this list: send the line "unsubscribe linux-pci" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [DMA Engine]     [Linux Coverity]     [Linux USB]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Greybus]

  Powered by Linux