amd_spi100: Fix memory-mapped reads for partially mapped chips

If the memory-mapping doesn't cover exactly the full flash chip,
we have to translate the `start` offset by subtracting the offset
of the mapping inside the chip's space (`mapped_start`). This
calculation should also work if more than the chip's size is
mapped. Then this offset would be negative.

We also use the newly added `mapped_start` for the preceding
calculations in the SPI engine fallback case. It keeps its exact
semantics, though.

Change-Id: I4881b2420cb80c079052235ad54cedbb6fa3c945
Signed-off-by: Nico Huber <nico.h@gmx.de>
Reviewed-on: https://review.coreboot.org/c/flashrom-stable/+/73671
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Marty E. Plummer <hanetzer@startmail.com>
Reviewed-by: Arthur Heymans <arthur@aheymans.xyz>
1 file changed