+
+/*
+ * Convert little endian byte stream into local formated
+ * unsigned integer
+ */
+static inline uint32_t tpm_i2c_le_bytes_to_uint(TPMStateI2C *i2cst)
+{
+ uint32_t data = 0;
+ int i;
+
+ assert(i2cst->offset <= 5); /* Including 0th register value */
+
+ if (tpm_i2c_is_little_endian()) {
+ for (i = 1; i < i2cst->offset; i++) {
+ data |= (((uint32_t)i2cst->data[i]) << (8 * (i - 1)));
+ }
+ } else {
+ for (i = 1; i < i2cst->offset; i++) {
+ data <<= 8;
+ data |= i2cst->data[i];
+ }
+ }
+
+ return data;
+}
Why is this endianess test needed ? Something looks wrong.
Could you please explain the endianess used by the various devices and
the endianness of the MMIO ops ?
If you want to test on a BE host, simply install a debian PPC64 VM/LPAR
on a POWER9/10 box. I suppose you have access to one in IBM.