[Skiboot] [PATCH 07/12] io: endian conversions for io accessors

Nicholas Piggin npiggin at gmail.com
Wed Oct 2 14:26:31 AEST 2019

Oliver O'Halloran's on October 1, 2019 2:58 pm:
> On Sun, 2019-09-29 at 17:46 +1000, Nicholas Piggin wrote:
>> This requires a small change to flash drivers which assumed 4-byte LPC
>> reads would not change endian. _raw accessors could be added if this
>> becomes a signifcant pattern, but for now this hack works.
> Hmm, lpc_read() and lpc_write() are more or less directly wired to the
> OPAL_LPC_READ/OPAL_LPC_WRITE calls so we should probably have a bit
> more of a think about what's happening here.

I'm not sure what you mean.
> I suspect the in_beXX() functions are used here mainly because we don't
> have any "native" endian in/out accessor functions so Ben just went
> with the BE versions since they don't swap.

Right. It's a performance optimisation that's reading a window of bytes
using a function designed to read 4-byte big-endian values. I think
this is okay though, if you think about it the hack is actually not the
endian swap. The endian swap is just acknowledging the hack which is
that it's using lpc_read of 4 bytes to read a byte stream.


More information about the Skiboot mailing list