Nico Huber has uploaded this change for review. ( https://review.coreboot.org/21784
Change subject: hwaccess: Constify `addr` argument of MMIO read functions ......................................................................
hwaccess: Constify `addr` argument of MMIO read functions
Original-Change-Id: I1419241a8332b74103b3921df2c615bdf91346a7 Original-Reviewed-on: https://review.coreboot.org/18881 Original-Tested-by: build bot (Jenkins) Original-Reviewed-by: Philippe Mathieu-Daudé philippe.mathieu.daude@gmail.com Original-Reviewed-by: Youness Alaoui snifikino@gmail.com Original-Reviewed-by: David Hendricks david.hendricks@gmail.com
Change-Id: I9158e8a7b994fe84e71a39483db651843adcf892 Signed-off-by: Nico Huber nico.huber@secunet.com --- M hwaccess.c M programmer.h 2 files changed, 17 insertions(+), 17 deletions(-)
git pull ssh://review.coreboot.org:29418/flashrom refs/changes/84/21784/1
diff --git a/hwaccess.c b/hwaccess.c index 3406334..2bf6f42 100644 --- a/hwaccess.c +++ b/hwaccess.c @@ -159,22 +159,22 @@ 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; @@ -195,17 +195,17 @@ 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 3853413..1a6216a 100644 --- a/programmer.h +++ b/programmer.h @@ -351,16 +351,16 @@ 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