From 9de060fd34e53a797528e61b8d2f4e1afe99be00 Mon Sep 17 00:00:00 2001 From: Patrick Georgi Date: Fri, 19 Feb 2021 16:34:26 +0100 Subject: [PATCH] libpayload: Use volatile pointers in {read,write}{8,16,32,64} This is already the case on x86 but not on the ARM platforms, and {read,write}[bwl] are using volatile pointers, too, so follow suit. Change-Id: I6819df62016990e12410eaa9c3c97b8b90944b51 Signed-off-by: Patrick Georgi Reviewed-on: https://review.coreboot.org/c/coreboot/+/50918 Tested-by: build bot (Jenkins) Reviewed-by: Angel Pons --- payloads/libpayload/include/arm/arch/io.h | 16 ++++++++-------- payloads/libpayload/include/arm64/arch/io.h | 16 ++++++++-------- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/payloads/libpayload/include/arm/arch/io.h b/payloads/libpayload/include/arm/arch/io.h index ce48baf72e..c36494ded3 100644 --- a/payloads/libpayload/include/arm/arch/io.h +++ b/payloads/libpayload/include/arm/arch/io.h @@ -80,52 +80,52 @@ static inline void writel(uint32_t _v, volatile void *_a) dmb(); } -static inline uint8_t read8(const void *addr) +static inline uint8_t read8(volatile const void *addr) { dmb(); return *(volatile uint8_t *)addr; } -static inline uint16_t read16(const void *addr) +static inline uint16_t read16(volatile const void *addr) { dmb(); return *(volatile uint16_t *)addr; } -static inline uint32_t read32(const void *addr) +static inline uint32_t read32(volatile const void *addr) { dmb(); return *(volatile uint32_t *)addr; } -static inline uint64_t read64(const void *addr) +static inline uint64_t read64(volatile const void *addr) { dmb(); return *(volatile uint64_t *)addr; } -static inline void write8(void *addr, uint8_t val) +static inline void write8(volatile void *addr, uint8_t val) { dmb(); *(volatile uint8_t *)addr = val; dmb(); } -static inline void write16(void *addr, uint16_t val) +static inline void write16(volatile void *addr, uint16_t val) { dmb(); *(volatile uint16_t *)addr = val; dmb(); } -static inline void write32(void *addr, uint32_t val) +static inline void write32(volatile void *addr, uint32_t val) { dmb(); *(volatile uint32_t *)addr = val; dmb(); } -static inline void write64(void *addr, uint64_t val) +static inline void write64(volatile void *addr, uint64_t val) { dmb(); *(volatile uint64_t *)addr = val; diff --git a/payloads/libpayload/include/arm64/arch/io.h b/payloads/libpayload/include/arm64/arch/io.h index 092198842f..9d67716f89 100644 --- a/payloads/libpayload/include/arm64/arch/io.h +++ b/payloads/libpayload/include/arm64/arch/io.h @@ -81,52 +81,52 @@ static inline void writel(uint32_t _v, volatile void *_a) dmb(); } -static inline uint8_t read8(const void *addr) +static inline uint8_t read8(volatile const void *addr) { dmb(); return *(volatile uint8_t *)addr; } -static inline uint16_t read16(const void *addr) +static inline uint16_t read16(volatile const void *addr) { dmb(); return *(volatile uint16_t *)addr; } -static inline uint32_t read32(const void *addr) +static inline uint32_t read32(volatile const void *addr) { dmb(); return *(volatile uint32_t *)addr; } -static inline uint64_t read64(const void *addr) +static inline uint64_t read64(volatile const void *addr) { dmb(); return *(volatile uint64_t *)addr; } -static inline void write8(void *addr, uint8_t val) +static inline void write8(volatile void *addr, uint8_t val) { dmb(); *(volatile uint8_t *)addr = val; dmb(); } -static inline void write16(void *addr, uint16_t val) +static inline void write16(volatile void *addr, uint16_t val) { dmb(); *(volatile uint16_t *)addr = val; dmb(); } -static inline void write32(void *addr, uint32_t val) +static inline void write32(volatile void *addr, uint32_t val) { dmb(); *(volatile uint32_t *)addr = val; dmb(); } -static inline void write64(void *addr, uint64_t val) +static inline void write64(volatile void *addr, uint64_t val) { dmb(); *(volatile uint64_t *)addr = val;