summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNico Huber <nico.huber@secunet.com>2017-03-17 17:19:15 +0100
committerNico Huber <nico.h@gmx.de>2017-04-25 18:51:46 +0200
commitb4d8a2a64b72d65e447161179279c108709c0ac3 (patch)
tree6b1d6c7c1756dd716614f43f26f358448b7ba25f
parentf84df9a78d35eb458ab19c6dac8a0d5f00013886 (diff)
downloadflashrom-b4d8a2a64b72d65e447161179279c108709c0ac3.tar.gz
flashrom-b4d8a2a64b72d65e447161179279c108709c0ac3.tar.bz2
flashrom-b4d8a2a64b72d65e447161179279c108709c0ac3.zip
hwaccess: Constify `addr` argument of MMIO read functions
Change-Id: I1419241a8332b74103b3921df2c615bdf91346a7 Signed-off-by: Nico Huber <nico.huber@secunet.com> Reviewed-on: https://review.coreboot.org/18881 Tested-by: build bot (Jenkins) Reviewed-by: Philippe Mathieu-Daudé <philippe.mathieu.daude@gmail.com> Reviewed-by: Youness Alaoui <snifikino@gmail.com> Reviewed-by: David Hendricks <david.hendricks@gmail.com>
-rw-r--r--hwaccess.c20
-rw-r--r--programmer.h14
2 files changed, 17 insertions, 17 deletions
diff --git a/hwaccess.c b/hwaccess.c
index 1901ee6a7..aede7e3ad 100644
--- a/hwaccess.c
+++ b/hwaccess.c
@@ -147,22 +147,22 @@ void mmio_writel(uint32_t val, void *addr)
sync_primitive();
}
-uint8_t mmio_readb(void *addr)
+uint8_t mmio_readb(const void *addr)
{
- return *(volatile uint8_t *) addr;
+ return *(volatile const uint8_t *) addr;
}
-uint16_t mmio_readw(void *addr)
+uint16_t mmio_readw(const void *addr)
{
- return *(volatile uint16_t *) addr;
+ return *(volatile const uint16_t *) addr;
}
-uint32_t mmio_readl(void *addr)
+uint32_t mmio_readl(const void *addr)
{
- return *(volatile uint32_t *) addr;
+ return *(volatile const uint32_t *) addr;
}
-void mmio_readn(void *addr, uint8_t *buf, size_t len)
+void mmio_readn(const void *addr, uint8_t *buf, size_t len)
{
memcpy(buf, addr, len);
return;
@@ -183,17 +183,17 @@ void mmio_le_writel(uint32_t val, void *addr)
mmio_writel(cpu_to_le32(val), addr);
}
-uint8_t mmio_le_readb(void *addr)
+uint8_t mmio_le_readb(const void *addr)
{
return le_to_cpu8(mmio_readb(addr));
}
-uint16_t mmio_le_readw(void *addr)
+uint16_t mmio_le_readw(const void *addr)
{
return le_to_cpu16(mmio_readw(addr));
}
-uint32_t mmio_le_readl(void *addr)
+uint32_t mmio_le_readl(const void *addr)
{
return le_to_cpu32(mmio_readl(addr));
}
diff --git a/programmer.h b/programmer.h
index 38534131e..1a6216aad 100644
--- a/programmer.h
+++ b/programmer.h
@@ -351,16 +351,16 @@ int internal_init(void);
void mmio_writeb(uint8_t val, void *addr);
void mmio_writew(uint16_t val, void *addr);
void mmio_writel(uint32_t val, void *addr);
-uint8_t mmio_readb(void *addr);
-uint16_t mmio_readw(void *addr);
-uint32_t mmio_readl(void *addr);
-void mmio_readn(void *addr, uint8_t *buf, size_t len);
+uint8_t mmio_readb(const void *addr);
+uint16_t mmio_readw(const void *addr);
+uint32_t mmio_readl(const void *addr);
+void mmio_readn(const void *addr, uint8_t *buf, size_t len);
void mmio_le_writeb(uint8_t val, void *addr);
void mmio_le_writew(uint16_t val, void *addr);
void mmio_le_writel(uint32_t val, void *addr);
-uint8_t mmio_le_readb(void *addr);
-uint16_t mmio_le_readw(void *addr);
-uint32_t mmio_le_readl(void *addr);
+uint8_t mmio_le_readb(const void *addr);
+uint16_t mmio_le_readw(const void *addr);
+uint32_t mmio_le_readl(const void *addr);
#define pci_mmio_writeb mmio_le_writeb
#define pci_mmio_writew mmio_le_writew
#define pci_mmio_writel mmio_le_writel