memory_bus: Pass master instead of flash to .chip_read/write
There is / should be no need to know flash-chip details in a programmer
driver. They should only pass data around and leave the chip details to
each chip driver.
This will allow us to probe for chips before knowing the details and as
a bonus gets rid of many `flash.h` dependencies.
Change-Id: Iae78fbbd95567134da890613114999cb14c3a011
Signed-off-by: Nico Huber <nico.h@gmx.de>
Reviewed-on: https://review.sourcearcade.org/c/flashprog/+/437
diff --git a/satamv.c b/satamv.c
index 7fec115..e304c19 100644
--- a/satamv.c
+++ b/satamv.c
@@ -17,7 +17,6 @@
/* Datasheets are not public (yet?) */
#include <stdlib.h>
-#include "flash.h"
#include "programmer.h"
#include "hwaccess_x86_io.h"
#include "hwaccess_physmap.h"
@@ -39,10 +38,8 @@
#define PCI_BAR2_CONTROL 0x00c08
#define GPIO_PORT_CONTROL 0x104f0
-static void satamv_chip_writeb(const struct flashctx *flash, uint8_t val,
- chipaddr addr);
-static uint8_t satamv_chip_readb(const struct flashctx *flash,
- const chipaddr addr);
+static void satamv_chip_writeb(const struct par_master *, uint8_t val, chipaddr);
+static uint8_t satamv_chip_readb(const struct par_master *, chipaddr);
static const struct par_master par_master_satamv = {
.chip_readb = satamv_chip_readb,
.chip_readw = fallback_chip_readw,
@@ -173,15 +170,13 @@
}
/* FIXME: Prefer direct access to BAR2 if BAR2 is active. */
-static void satamv_chip_writeb(const struct flashctx *flash, uint8_t val,
- chipaddr addr)
+static void satamv_chip_writeb(const struct par_master *par, uint8_t val, chipaddr addr)
{
satamv_indirect_chip_writeb(val, addr);
}
/* FIXME: Prefer direct access to BAR2 if BAR2 is active. */
-static uint8_t satamv_chip_readb(const struct flashctx *flash,
- const chipaddr addr)
+static uint8_t satamv_chip_readb(const struct par_master *par, const chipaddr addr)
{
return satamv_indirect_chip_readb(addr);
}