Thomas Heijligen has uploaded this change for review.
atavia: Use a atavia_offset locally to determin offset
Use atavia_offset directly in atavia_chip_write / read instead of
going the round over a pseudo mapping and flashctx->virtual_memory.
Change-Id: Ie0ec85c276f03942d6b9435a746ec329b2b95926
Signed-off-by: Thomas Heijligen <thomas.heijligen@secunet.com>
---
M atavia.c
1 file changed, 21 insertions(+), 11 deletions(-)
git pull ssh://review.coreboot.org:29418/flashrom refs/changes/25/73825/1
diff --git a/atavia.c b/atavia.c
index f35771a..d0f2a32 100644
--- a/atavia.c
+++ b/atavia.c
@@ -54,7 +54,10 @@
{0},
};
-static void *atavia_offset = NULL;
+/* The atavia_offset is some kind of magic to get the driver working.
+ * You can find the correct value in the documentation or by try and error.
+ */
+static uint32_t atavia_offset = 0;
static struct pci_dev *dev = NULL;
static void atavia_prettyprint_access(uint8_t access)
@@ -101,15 +104,10 @@
return ready;
}
-static void *atavia_map(const char *descr, uintptr_t phys_addr, size_t len)
-{
- return (atavia_offset != 0) ? atavia_offset : (void *)phys_addr;
-}
-
static void atavia_chip_writeb(const struct flashctx *flash, uint8_t val, const chipaddr addr)
{
msg_pspew("%s: 0x%02x to 0x%*" PRIxPTR ".\n", __func__, val, PRIxPTR_WIDTH, addr);
- pci_write_long(dev, BROM_ADDR, (addr & ~3));
+ pci_write_long(dev, BROM_ADDR, atavia_offset + (addr & ~3));
pci_write_long(dev, BROM_DATA, val << BYTE_OFFSET(addr));
pci_write_byte(dev, BROM_ACCESS, BROM_TRIGGER | BROM_WRITE | ENABLE_BYTE(addr));
@@ -120,7 +118,7 @@
static uint8_t atavia_chip_readb(const struct flashctx *flash, const chipaddr addr)
{
- pci_write_long(dev, BROM_ADDR, (addr & ~3));
+ pci_write_long(dev, BROM_ADDR, atavia_offset + (addr & ~3));
pci_write_byte(dev, BROM_ACCESS, BROM_TRIGGER | ENABLE_BYTE(addr));
if (!atavia_ready(dev)) {
@@ -133,7 +131,6 @@
}
static const struct par_master lpc_master_atavia = {
- .map_flash_region = atavia_map,
.chip_readb = atavia_chip_readb,
.chip_writeb = atavia_chip_writeb,
};
@@ -148,13 +145,13 @@
return ERROR_FLASHROM_FATAL;
}
char *endptr;
- atavia_offset = (void *)strtoul(arg, &endptr, 0);
+ atavia_offset = (uint32_t)strtoul(arg, &endptr, 0);
if (*endptr) {
msg_perr("Error: Invalid offset specified: \"%s\".\n", arg);
free(arg);
return ERROR_FLASHROM_FATAL;
}
- msg_pinfo("Mapping addresses to base %p.\n", atavia_offset);
+ msg_pinfo("Using %#"PRIx32" as base.\n", atavia_offset);
}
free(arg);
To view, visit change 73825. To unsubscribe, or for help writing mail filters, visit settings.