Re: PCI question....

Jeff Garzik (jgarzik@mandrakesoft.mandrakesoft.com)
Thu, 23 Dec 1999 05:26:36 -0600 (CST)


On Thu, 23 Dec 1999, Rogier Wolff wrote:

>
> Hi,
>
> Question for PCI gurus: Is:
>
> void mybcopy( char *from, char *to, int amount)
> {
> while ( amount-- )
> *to++ = *from++;
> }
>
> guaranteed to perform byte transactions on a PCI device? (The device
> at hand doesn't support non-byte tranactions)
>
> "to" is probably on the PCI device, while "from" is usually in main
> memory, but might be cached closer to the CPU....

I don't claim to be a PCI guru, but...

* If you read a byte immediately after writing a byte, I think
you should be ok.

* Your entire routine above could possibly be replaced with memcpy_toio
or memcpy_fromio.

* If memcpy_toio doesn't work for you because of some constraints, make
sure you are still using readl() and writel(), NOT direct memory
references. See Documentation/IO-mapping.txt.

Regards,

Jeff

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/