Patrick Georgi (pgeorgi@google.com) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/10773
-gerrit
commit 06dd3b0255be0ffdfc575bd925b905b7416d4550 Author: Daisuke Nojiri dnojiri@chromium.org Date: Thu Jun 25 16:19:49 2015 -0700
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 --- payloads/libpayload/include/arm/arch/io.h | 47 +++++++++++++++++++++++++++++ payloads/libpayload/include/arm64/arch/io.h | 47 +++++++++++++++++++++++++++++ 2 files changed, 94 insertions(+)
diff --git a/payloads/libpayload/include/arm/arch/io.h b/payloads/libpayload/include/arm/arch/io.h index df3a0d5..2743852 100644 --- a/payloads/libpayload/include/arm/arch/io.h +++ b/payloads/libpayload/include/arm/arch/io.h @@ -34,6 +34,14 @@ #include <stdint.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) { dmb(); @@ -73,4 +81,43 @@ static inline void writel(uint32_t _v, volatile void *_a) 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 diff --git a/payloads/libpayload/include/arm64/arch/io.h b/payloads/libpayload/include/arm64/arch/io.h index f8be1ae..c177598 100644 --- a/payloads/libpayload/include/arm64/arch/io.h +++ b/payloads/libpayload/include/arm64/arch/io.h @@ -35,6 +35,14 @@ #include <arch/cache.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) { dmb(); @@ -74,4 +82,43 @@ static inline void writel(uint32_t _v, volatile void *_a) 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