[coreboot] Notes on CBFS

ron minnich rminnich at gmail.com
Sun Apr 12 17:59:02 CEST 2009


On Sun, Apr 12, 2009 at 2:35 AM, Rudolf Marek <r.marek at assembler.cz> wrote:
>> on all platforms, but I think little-endian makes much more sense (eg,
>> rename the ntohl() calls to le32_to_cpu() ).
>
> Hi,
>
> Why not to use instead:
>
> #define ntohl(x) ((((x)&0xff)<<24) | (((x)&0xff00)<<8) | \
>                  (((x)&0xff0000) >> 8) | (((x)&0xff000000) >> 24))
>
> #define ntohl(x) __asm__("bswap %0" : "=r" (x) : "0" (x));
>

I'm surprised that this issue has turned out to be an issue :-) It's
definitely not the first thing I expected.

I'm fine with le32, although it may produce confusion in the future.
People's fingers seem to want to type [nh]to[nh]. I don't see how
ntoh* can cause so much bad code in seabios, but i want seabios to be
happy, so a patch is fine too. Kevin, are you certain it's that big
problem?

Also, w.r.t. getting rid of the offset in the file header: one nice
thing about that design is the file header and the file data need not
be contiguous in the flash. It is a much more flexible setup. Again,
given the small number of entries in a CBFS (certainly < 64), is the
savings of < 512 bytes or so worth this change?

thanks

ron




More information about the coreboot mailing list