lkml.org 
[lkml]   [1999]   [Aug]   [16]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: New resources - pls, explain :-(
On Sat, Aug 14, 1999, Linus Torvalds <torvalds@transmeta.com> wrote:

>Why?
>
>You can do byte-swapping by hand.
>
>I think it is really _stupid_ to do a writel_be(), and quite frankly, the
>moew people whine about it the less likely I'm going to accept it. So far
>all the arguments have just been _stupid_. They haven't had any reasoning.

Hi Linus !

I think it's not so stupid, but should definitely not be called
writel_be(). I _do_ agree however that the arguments so far were not very
precise, I'll try do be clear:

Basically, as Paul Mackerras noticed, there are cases when you move bunch
of byte datas 32 bits at a time (or 16 bits at a time) between the HW
device and system memory where you just need no swapping, whatever endian
is current on your platform. And of course, in those cases, you also want
maximum performances. So you want to avoid swapping twice, which would be
your only choice if writel is little endian.

This is quite common when accessing HW fifos (I'm doing this on a sound
card driver).

I see 3 cases:

- writel/readl are native endian, which I think is just plain wrong
- writel/readl are little endian and you do not provide no-swap
versions. In this case, doing the above requires either double-swapping
on be-machines, or re-implementing the writel/readl logic withtout the
swap in the driver, which makes the driver dependant on the
implementation of writel/readl.
- writel/readl are little endian, and you provide writel_ns/readl_ns. On
little endian platforms, those are #defined to be writel/readl. On big
endian platforms they avoid swapping.


--
Perso. e-mail: <mailto:bh40@calva.net>
Work e-mail: <mailto:benh@mipsys.com>
BenH. Web : <http://calvaweb.calvacom.fr/bh40/>




-
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/

\
 
 \ /
  Last update: 2005-03-22 13:53    [W:0.145 / U:0.300 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site