Browse Source

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>
changes/18/50918/2
Patrick Georgi 2 months ago
parent
commit
9de060fd34
  1. 16
      payloads/libpayload/include/arm/arch/io.h
  2. 16
      payloads/libpayload/include/arm64/arch/io.h

16
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;

16
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;

Loading…
Cancel
Save