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>
This commit is contained in:
Patrick Georgi 2021-02-19 16:34:26 +01:00
parent e9b0830422
commit 9de060fd34
2 changed files with 16 additions and 16 deletions

View File

@ -80,52 +80,52 @@ static inline void writel(uint32_t _v, volatile void *_a)
dmb(); dmb();
} }
static inline uint8_t read8(const void *addr) static inline uint8_t read8(volatile const void *addr)
{ {
dmb(); dmb();
return *(volatile uint8_t *)addr; return *(volatile uint8_t *)addr;
} }
static inline uint16_t read16(const void *addr) static inline uint16_t read16(volatile const void *addr)
{ {
dmb(); dmb();
return *(volatile uint16_t *)addr; return *(volatile uint16_t *)addr;
} }
static inline uint32_t read32(const void *addr) static inline uint32_t read32(volatile const void *addr)
{ {
dmb(); dmb();
return *(volatile uint32_t *)addr; return *(volatile uint32_t *)addr;
} }
static inline uint64_t read64(const void *addr) static inline uint64_t read64(volatile const void *addr)
{ {
dmb(); dmb();
return *(volatile uint64_t *)addr; 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(); dmb();
*(volatile uint8_t *)addr = val; *(volatile uint8_t *)addr = val;
dmb(); dmb();
} }
static inline void write16(void *addr, uint16_t val) static inline void write16(volatile void *addr, uint16_t val)
{ {
dmb(); dmb();
*(volatile uint16_t *)addr = val; *(volatile uint16_t *)addr = val;
dmb(); dmb();
} }
static inline void write32(void *addr, uint32_t val) static inline void write32(volatile void *addr, uint32_t val)
{ {
dmb(); dmb();
*(volatile uint32_t *)addr = val; *(volatile uint32_t *)addr = val;
dmb(); dmb();
} }
static inline void write64(void *addr, uint64_t val) static inline void write64(volatile void *addr, uint64_t val)
{ {
dmb(); dmb();
*(volatile uint64_t *)addr = val; *(volatile uint64_t *)addr = val;

View File

@ -81,52 +81,52 @@ static inline void writel(uint32_t _v, volatile void *_a)
dmb(); dmb();
} }
static inline uint8_t read8(const void *addr) static inline uint8_t read8(volatile const void *addr)
{ {
dmb(); dmb();
return *(volatile uint8_t *)addr; return *(volatile uint8_t *)addr;
} }
static inline uint16_t read16(const void *addr) static inline uint16_t read16(volatile const void *addr)
{ {
dmb(); dmb();
return *(volatile uint16_t *)addr; return *(volatile uint16_t *)addr;
} }
static inline uint32_t read32(const void *addr) static inline uint32_t read32(volatile const void *addr)
{ {
dmb(); dmb();
return *(volatile uint32_t *)addr; return *(volatile uint32_t *)addr;
} }
static inline uint64_t read64(const void *addr) static inline uint64_t read64(volatile const void *addr)
{ {
dmb(); dmb();
return *(volatile uint64_t *)addr; 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(); dmb();
*(volatile uint8_t *)addr = val; *(volatile uint8_t *)addr = val;
dmb(); dmb();
} }
static inline void write16(void *addr, uint16_t val) static inline void write16(volatile void *addr, uint16_t val)
{ {
dmb(); dmb();
*(volatile uint16_t *)addr = val; *(volatile uint16_t *)addr = val;
dmb(); dmb();
} }
static inline void write32(void *addr, uint32_t val) static inline void write32(volatile void *addr, uint32_t val)
{ {
dmb(); dmb();
*(volatile uint32_t *)addr = val; *(volatile uint32_t *)addr = val;
dmb(); dmb();
} }
static inline void write64(void *addr, uint64_t val) static inline void write64(volatile void *addr, uint64_t val)
{ {
dmb(); dmb();
*(volatile uint64_t *)addr = val; *(volatile uint64_t *)addr = val;