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/include/programmer.h b/include/programmer.h
index 04c4b42..9249f5c 100644
--- a/include/programmer.h
+++ b/include/programmer.h
@@ -226,7 +226,7 @@
int chipset_flash_enable(struct flashprog_programmer *);
/* processor_enable.c */
-int processor_flash_enable(void);
+int processor_flash_enable(struct flashprog_programmer *);
#endif
#if CONFIG_INTERNAL == 1
@@ -243,6 +243,7 @@
/* internal.c */
struct internal_data {
+ uintptr_t rom_base;
size_t max_rom_decode;
};
struct superio {
@@ -270,7 +271,6 @@
/* flashprog.c */
// FIXME: These need to be local, not global
extern bool programmer_may_write;
-extern unsigned long flashbase;
char *extract_programmer_param(const char *param_name);
struct master_common {
@@ -445,6 +445,8 @@
/* XXX: Keep common struct first, it is overlayed with other master types. */
struct master_common common;
+ uintptr_t rom_base;
+
void (*chip_writeb) (const struct flashctx *flash, uint8_t val, chipaddr addr);
void (*chip_writew) (const struct flashctx *flash, uint16_t val, chipaddr addr);
void (*chip_writel) (const struct flashctx *flash, uint32_t val, chipaddr addr);
@@ -460,7 +462,7 @@
int (*shutdown)(void *data);
void *data;
};
-int register_par_master(const struct par_master *mst, const enum chipbustype buses, size_t max_rom_decode, void *data);
+int register_par_master(const struct par_master *mst, const enum chipbustype buses, uintptr_t rom_base, size_t max_rom_decode, void *data);
/* programmer.c */
void *fallback_map(const char *descr, uintptr_t phys_addr, size_t len);