Factor out fallback_map/unmap, most external programmers don't need and special handling here
Corresponding to flashrom svn r531.
Signed-off-by: Uwe Hermann <uwe@hermann-uwe.de>
Acked-by: Uwe Hermann <uwe@hermann-uwe.de>
diff --git a/flash.h b/flash.h
index 44569fc..42cda8d 100644
--- a/flash.h
+++ b/flash.h
@@ -629,6 +629,8 @@
uint8_t mmio_readb(void *addr);
uint16_t mmio_readw(void *addr);
uint32_t mmio_readl(void *addr);
+void *fallback_map(const char *descr, unsigned long phys_addr, size_t len);
+void fallback_unmap(void *virt_addr, size_t len);
void fallback_chip_writew(uint16_t val, chipaddr addr);
void fallback_chip_writel(uint32_t val, chipaddr addr);
uint16_t fallback_chip_readw(const chipaddr addr);
diff --git a/flashrom.c b/flashrom.c
index 5b4cf8e..673c288 100644
--- a/flashrom.c
+++ b/flashrom.c
@@ -64,8 +64,8 @@
{
.init = nic3com_init,
.shutdown = nic3com_shutdown,
- .map_flash_region = nic3com_map,
- .unmap_flash_region = nic3com_unmap,
+ .map_flash_region = fallback_map,
+ .unmap_flash_region = fallback_unmap,
.chip_readb = nic3com_chip_readb,
.chip_readw = fallback_chip_readw,
.chip_readl = fallback_chip_readl,
@@ -77,8 +77,8 @@
{
.init = satasii_init,
.shutdown = satasii_shutdown,
- .map_flash_region = satasii_map,
- .unmap_flash_region = satasii_unmap,
+ .map_flash_region = fallback_map,
+ .unmap_flash_region = fallback_unmap,
.chip_readb = satasii_chip_readb,
.chip_readw = fallback_chip_readw,
.chip_readl = fallback_chip_readl,
diff --git a/internal.c b/internal.c
index d2a9ae2..c2d8f6b 100644
--- a/internal.c
+++ b/internal.c
@@ -195,6 +195,17 @@
return *(volatile uint32_t *) addr;
}
+/* Fallback map() for programmers which don't need special handling */
+void *fallback_map(const char *descr, unsigned long phys_addr, size_t len)
+{
+ return 0;
+}
+
+/* Fallback unmap() for programmers which don't need special handling */
+void fallback_unmap(void *virt_addr, size_t len)
+{
+}
+
/* Little-endian fallback for drivers not supporting 16 bit accesses */
void fallback_chip_writew(uint16_t val, chipaddr addr)
{
diff --git a/nic3com.c b/nic3com.c
index 4e3e475..023ec35 100644
--- a/nic3com.c
+++ b/nic3com.c
@@ -102,15 +102,6 @@
return 0;
}
-void *nic3com_map(const char *descr, unsigned long phys_addr, size_t len)
-{
- return 0;
-}
-
-void nic3com_unmap(void *virt_addr, size_t len)
-{
-}
-
void nic3com_chip_writeb(uint8_t val, chipaddr addr)
{
OUTL((uint32_t)addr, io_base_addr + BIOS_ROM_ADDR);
diff --git a/satasii.c b/satasii.c
index 78b90e3..a137c7f 100644
--- a/satasii.c
+++ b/satasii.c
@@ -80,15 +80,6 @@
return 0;
}
-void *satasii_map(const char *descr, unsigned long phys_addr, size_t len)
-{
- return 0;
-}
-
-void satasii_unmap(void *virt_addr, size_t len)
-{
-}
-
void satasii_chip_writeb(uint8_t val, chipaddr addr)
{
uint32_t ctrl_reg, data_reg;