Nico Huber has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/38647 )
Change subject: drivers/intel/gma/edid: Use byte swap function ......................................................................
Patch Set 1:
(1 comment)
https://review.coreboot.org/c/coreboot/+/38647/1/src/drivers/intel/gma/edid.... File src/drivers/intel/gma/edid.c:
https://review.coreboot.org/c/coreboot/+/38647/1/src/drivers/intel/gma/edid.... PS1, Line 94: edid[4 * i] = reg32 & 0xff; : edid[4 * i + 1] = (reg32 >> 8) & 0xff; : edid[4 * i + 2] = (reg32 >> 16) & 0xff; : edid[4 * i + 3] = (reg32 >> 24) & 0xff; This looks like little-endian encoding, and we are in drivers/intel/. I don't think there is anything to swap. It's also hard to argue about endianness here, as this is just copying data from hardware to a stream (just leaving the bytes in the order they were found should work).
I think the best way to express this would be to use a host-specific read and write:
((uint32_t *)edid)[i] = read32(GMBUS3_ADDR);
or
write32(edid + 4 * i, read32(GMBUS3_ADDR));
The former doesn't look too nice, the latter would (unnecessarily) treat the RAM where `edid` resides like MMIO...
Or maybe just use memcpy()? ;)