isp: Endianness of firmware data

Ján Sučan sucanjan at fit.cvut.cz
Thu Jun 1 13:58:41 PDT 2017


Hello to all,

I would like to ask for a help with an issue for which I am not sure
about a clean solution.

With isp driver firmware I wanted to do the same as I did with mxge: to
move firmware data from arrays in C header files to uuencode .uu files
in a sys/contrib/isp.
The issue is that the firmware is stored in arrays of uint16_t. The isp
driver has macros for handling the firmware data on both little-endian
and big-endian machines. But it seems, that it uses some of those
uint16_t values not caring about endianness (see the
sys/dev/disk/isp/isp.c line 841 where the value is used directly for
controlling number of repetitions of a while cycle).

Currently, the correct order is ensured at compile-time. If the firmware
is moved to files it will be saved with fixed endianness. So it wil be
OK on little-endian and bad on big-endian or the other way around.
I think of modifying firmware data right after firmware_get() so driver
will find expected endianness.

Do you think it's a good solution or should I take another direction? I
would be grateful for any suggestion.

Thanks
jan



More information about the Kernel mailing list