summaryrefslogtreecommitdiff
path: root/payloads/libpayload/include/arm64
diff options
context:
space:
mode:
authorDaisuke Nojiri <dnojiri@chromium.org>2015-06-25 16:19:49 -0700
committerPatrick Georgi <pgeorgi@google.com>2015-07-06 09:39:48 +0200
commit394933640bc0515617117ed0cb8de7702bc9c1bf (patch)
tree12ca61aa19aa0ef2e7f611166c28472489cfe835 /payloads/libpayload/include/arm64
parentc2b48e55f1d4bd02a07515164ddcca472bf47351 (diff)
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>
Diffstat (limited to 'payloads/libpayload/include/arm64')
-rw-r--r--payloads/libpayload/include/arm64/arch/io.h47
1 files changed, 47 insertions, 0 deletions
diff --git a/payloads/libpayload/include/arm64/arch/io.h b/payloads/libpayload/include/arm64/arch/io.h
index f8be1aec95..c177598d86 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