summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatrick Georgi <pgeorgi@google.com>2021-02-19 16:34:26 +0100
committerPatrick Georgi <pgeorgi@google.com>2021-02-20 17:01:09 +0000
commit9de060fd34e53a797528e61b8d2f4e1afe99be00 (patch)
treeb8d04d231879fc7db0373d9e383941df950740d1
parente9b0830422206a9c11ff4e83420e385353c3ee8a (diff)
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 <pgeorgi@google.com> Reviewed-on: https://review.coreboot.org/c/coreboot/+/50918 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Angel Pons <th3fanbus@gmail.com>
-rw-r--r--payloads/libpayload/include/arm/arch/io.h16
-rw-r--r--payloads/libpayload/include/arm64/arch/io.h16
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;