memory_bus: Turn flashbase into a par_master member `rom_base`
Get rid of the global `flashbase`. Treat overrides for the `rom_base`
similar to `max_rom_decode`: Gather the information in `internal_data`
and then pass it to register_par_master().
Change-Id: Ib9ed7234a849fe3550200fd602226d0036da15f0
Signed-off-by: Nico Huber <nico.h@gmx.de>
Reviewed-on: https://review.sourcearcade.org/c/flashprog/+/436
diff --git a/memory_bus.c b/memory_bus.c
index b9cd68c..3ca71d1 100644
--- a/memory_bus.c
+++ b/memory_bus.c
@@ -46,6 +46,8 @@
int prepare_memory_access(struct flashctx *flash, enum preparation_steps prep)
{
+ const struct par_master *const par = flash->mst.par;
+
if (prep == PREPARE_POST_PROBE)
return 0;
@@ -54,7 +56,7 @@
flash->virtual_registers = (chipaddr)ERROR_PTR;
const chipsize_t size = flash->chip->total_size * 1024;
- const uintptr_t base = flashbase ? flashbase : (0xffffffff - size + 1);
+ const uintptr_t base = par->rom_base ? par->rom_base : (0xffffffff - size + 1);
void *const addr = programmer_map_flash_region(flash, flash->chip->name, base, size);
if (addr == ERROR_PTR) {
msg_perr("Could not map flash chip %s at 0x%0*" PRIxPTR ".\n",