mb/prodrive/hermes: Fix eeprom reading

The logic for bytes to copy to the function input pointer was wrong.
What it did was to loop over all 2 bytes that need to be read and only
copy the first byte.

Change-Id: Ic08cf01d800babd4a9176dfb2337411b789040f3
Signed-off-by: Arthur Heymans <arthur@aheymans.xyz>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/52207
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Angel Pons <th3fanbus@gmail.com>
Reviewed-by: Christian Walter <christian.walter@9elements.com>
This commit is contained in:
Arthur Heymans 2021-04-09 11:18:52 +02:00 committed by Patrick Georgi
parent fce0954f45
commit af13a6ed28
1 changed files with 3 additions and 4 deletions

View File

@ -121,10 +121,9 @@ bool read_write_config(void *blob, size_t read_offset, size_t write_offset, size
/* Write to UPD */
uint8_t *writePointer = (uint8_t *)blob + write_offset + i;
if (size > 1 && (size % 2 == 0))
memcpy(writePointer, tmp, 2);
else
*writePointer = tmp[0];
writePointer[0] = tmp[0];
if (size - i > 1)
writePointer[1] = tmp[1];
}
/* Restore I2C_EN bit */