Perform default mapping only for respective chips
The default memory mapping for the whole flash chip only makes sense
for chips that are directly connected to a bus serving memory cycles,
i.e. parallel, LPC and FWH chips. Use the new `.prepare_access` and
`.finish_access` hooks to map/unmap respective chips.
Going through the chip driver for this allows us to free the core
flashprog code from this peculiarity.
Change-Id: I54d1554b44b7e21fc18ef066103a9a26a2783b36
Signed-off-by: Nico Huber <nico.h@gmx.de>
Reviewed-on: https://review.sourcearcade.org/c/flashprog/+/72521
diff --git a/include/chipdrivers.h b/include/chipdrivers.h
index 8e2c520..8c4ecba 100644
--- a/include/chipdrivers.h
+++ b/include/chipdrivers.h
@@ -215,4 +215,8 @@
void decode_range_spi25_bit_cmp(size_t *start, size_t *len, const struct wp_bits *, size_t chip_len);
void decode_range_spi25_2x_block(size_t *start, size_t *len, const struct wp_bits *, size_t chip_len);
+/* flashprog.c */
+int prepare_memory_access(struct flashctx *, enum preparation_steps);
+void finish_memory_access(struct flashctx *);
+
#endif /* !__CHIPDRIVERS_H__ */