[U-Boot] About the volatile data type in include/net.h

Simon Glass sjg at chromium.org
Wed Nov 23 23:42:11 CET 2011


Hi Mike,

On Wed, Nov 23, 2011 at 2:27 PM, Mike Frysinger <vapier at gentoo.org> wrote:
> On Wednesday 23 November 2011 14:21:20 Simon Glass wrote:
>> On Mon, Nov 21, 2011 at 7:06 PM, Macpaul Lin wrote:
>> > I have found there are some variables declared as volatile in
>> > include/net.h. Some of them are used as in send and receive functions.
>> > Since some of them seems won't be update by hardware, like sending
>> > functions. Should we check and clean them up?
>>
>> I think so, since any access should go through read()l/writel() anyway.
>
> i don't think so ... there's no reason to use readl/writel on packet buffers
> sitting in external memory

I suppose DMA takes care of these, fair enough. Do no boards maually
read/write packet buffers any more?

But (re your other email) I can't see that volatile would avoid the
cache problems. Some boards will have network problems with the dcache
turned on. But these would not be fixed by volatile, only by
flush/invalidate. I think USB has an example of how to do that, but it
doesn't seem to be everywhere in U-Boot yet.

Regards,
Simon

>
> readl/writel would make sense if you were reading hardware buffers that are
> mapped into the cpu's address space, but that's not what these packet buffers
> are in the eth_device's api.
> -mike
>


More information about the U-Boot mailing list