libpayload: arm(64): add read8/16/32 and write8/16/32
This applys the same change made by https://chromium-review.googlesource.com/261692 to libpayload. BUG=none BRANCH=tot TEST=built for veyron_jerry, rush_ryu, samus Change-Id: I26dd66d79cd1559a7852b3c9d252420f2fed5fa0 Signed-off-by: Patrick Georgi <pgeorgi@chromium.org> Original-Commit-Id: d0d6f70aa805e18966e80618fbf9e9605274b030 Original-Change-Id: Ib0c199238f8fa58643d51782b17550dbd0d9ebd7 Original-Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org> Original-Reviewed-on: https://chromium-review.googlesource.com/282541 Original-Reviewed-by: Aaron Durbin <adurbin@chromium.org> Reviewed-on: http://review.coreboot.org/10773 Tested-by: build bot (Jenkins) Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
This commit is contained in:
parent
c2b48e55f1
commit
394933640b
|
@ -34,6 +34,14 @@
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <arch/cache.h>
|
#include <arch/cache.h>
|
||||||
|
|
||||||
|
/*
|
||||||
|
* readb/w/l writeb/w/l are deprecated. use read8/16/32 and write8/16/32
|
||||||
|
* instead for future development.
|
||||||
|
*
|
||||||
|
* TODO: make the existing code use read8/16/32 and write8/16/32 then remove
|
||||||
|
* readb/w/l and writeb/w/l.
|
||||||
|
*/
|
||||||
|
|
||||||
static inline uint8_t readb(volatile const void *_a)
|
static inline uint8_t readb(volatile const void *_a)
|
||||||
{
|
{
|
||||||
dmb();
|
dmb();
|
||||||
|
@ -73,4 +81,43 @@ static inline void writel(uint32_t _v, volatile void *_a)
|
||||||
dmb();
|
dmb();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static inline uint8_t read8(const void *addr)
|
||||||
|
{
|
||||||
|
dmb();
|
||||||
|
return *(volatile uint8_t *)addr;
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline uint16_t read16(const void *addr)
|
||||||
|
{
|
||||||
|
dmb();
|
||||||
|
return *(volatile uint16_t *)addr;
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline uint32_t read32(const void *addr)
|
||||||
|
{
|
||||||
|
dmb();
|
||||||
|
return *(volatile uint32_t *)addr;
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline void write8(void *addr, uint8_t val)
|
||||||
|
{
|
||||||
|
dmb();
|
||||||
|
*(volatile uint8_t *)addr = val;
|
||||||
|
dmb();
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline void write16(void *addr, uint16_t val)
|
||||||
|
{
|
||||||
|
dmb();
|
||||||
|
*(volatile uint16_t *)addr = val;
|
||||||
|
dmb();
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline void write32(void *addr, uint32_t val)
|
||||||
|
{
|
||||||
|
dmb();
|
||||||
|
*(volatile uint32_t *)addr = val;
|
||||||
|
dmb();
|
||||||
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -35,6 +35,14 @@
|
||||||
#include <arch/cache.h>
|
#include <arch/cache.h>
|
||||||
#include <arch/lib_helpers.h>
|
#include <arch/lib_helpers.h>
|
||||||
|
|
||||||
|
/*
|
||||||
|
* readb/w/l writeb/w/l are deprecated. use read8/16/32 and write8/16/32
|
||||||
|
* instead for future development.
|
||||||
|
*
|
||||||
|
* TODO: make the existing code use read8/16/32 and write8/16/32 then remove
|
||||||
|
* readb/w/l and writeb/w/l.
|
||||||
|
*/
|
||||||
|
|
||||||
static inline uint8_t readb(volatile const void *_a)
|
static inline uint8_t readb(volatile const void *_a)
|
||||||
{
|
{
|
||||||
dmb();
|
dmb();
|
||||||
|
@ -74,4 +82,43 @@ static inline void writel(uint32_t _v, volatile void *_a)
|
||||||
dmb();
|
dmb();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static inline uint8_t read8(const void *addr)
|
||||||
|
{
|
||||||
|
dmb();
|
||||||
|
return *(volatile uint8_t *)addr;
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline uint16_t read16(const void *addr)
|
||||||
|
{
|
||||||
|
dmb();
|
||||||
|
return *(volatile uint16_t *)addr;
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline uint32_t read32(const void *addr)
|
||||||
|
{
|
||||||
|
dmb();
|
||||||
|
return *(volatile uint32_t *)addr;
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline void write8(void *addr, uint8_t val)
|
||||||
|
{
|
||||||
|
dmb();
|
||||||
|
*(volatile uint8_t *)addr = val;
|
||||||
|
dmb();
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline void write16(void *addr, uint16_t val)
|
||||||
|
{
|
||||||
|
dmb();
|
||||||
|
*(volatile uint16_t *)addr = val;
|
||||||
|
dmb();
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline void write32(void *addr, uint32_t val)
|
||||||
|
{
|
||||||
|
dmb();
|
||||||
|
*(volatile uint32_t *)addr = val;
|
||||||
|
dmb();
|
||||||
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue