lkml.org 
[lkml]   [2008]   [Aug]   [5]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 3/4] Fix remaining big endian issue of hfcmulti
On Tue, Aug 05, 2008 at 02:29:48PM +1000, Benjamin Herrenschmidt wrote:
> On Sat, 2008-08-02 at 16:35 +0200, Karsten Keil wrote:
> > The driver was not so bad at big endian at all, only the optimised fifo
> > read/write functions need a fix, with this fix the driver works on
> > a pegasus PPC machine.
>
> This is however very broken... IE, you should instead use iomap
> and thus get ioreadXX_rep() and writeXX_rep() (XX = 16 or 32) that
> will do the right thing for you. IE, they will do the right amount
> of memory barriers and will avoid the unnecessary double-swapping
> you are doing there.
>

Thanks for this hint, I didn't know that the repetive versions are
for byte streams and not for eg. transfer of multiple u32.
So it makes things lot easier the code should look like:

int l = len >> 2;

if (l) {
ioread32_rep(hc->pci_membase + A_FIFO_DATA0, data, l);
data += l << 2;
}
if (len & 2) {
ioread16_rep(hc->pci_membase + A_FIFO_DATA0, data, 1);
data += 2;
}
if (len & 1)
writeb(*data, hc->pci_membase + A_FIFO_DATA0);

--
Karsten Keil
SuSE Labs
ISDN and VOIP development
SUSE LINUX Products GmbH, Maxfeldstr.5 90409 Nuernberg, GF: Markus Rex, HRB 16746 (AG Nuernberg)


\
 
 \ /
  Last update: 2008-08-05 13:33    [W:1.650 / U:0.068 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site