summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--payloads/libpayload/include/arm/arch/io.h13
-rw-r--r--payloads/libpayload/include/arm64/arch/io.h13
2 files changed, 26 insertions, 0 deletions
diff --git a/payloads/libpayload/include/arm/arch/io.h b/payloads/libpayload/include/arm/arch/io.h
index 6d549dedd1..ce48baf72e 100644
--- a/payloads/libpayload/include/arm/arch/io.h
+++ b/payloads/libpayload/include/arm/arch/io.h
@@ -98,6 +98,12 @@ static inline uint32_t read32(const void *addr)
return *(volatile uint32_t *)addr;
}
+static inline uint64_t read64(const void *addr)
+{
+ dmb();
+ return *(volatile uint64_t *)addr;
+}
+
static inline void write8(void *addr, uint8_t val)
{
dmb();
@@ -119,4 +125,11 @@ static inline void write32(void *addr, uint32_t val)
dmb();
}
+static inline void write64(void *addr, uint64_t val)
+{
+ dmb();
+ *(volatile uint64_t *)addr = val;
+ dmb();
+}
+
#endif
diff --git a/payloads/libpayload/include/arm64/arch/io.h b/payloads/libpayload/include/arm64/arch/io.h
index 00c75c4395..092198842f 100644
--- a/payloads/libpayload/include/arm64/arch/io.h
+++ b/payloads/libpayload/include/arm64/arch/io.h
@@ -99,6 +99,12 @@ static inline uint32_t read32(const void *addr)
return *(volatile uint32_t *)addr;
}
+static inline uint64_t read64(const void *addr)
+{
+ dmb();
+ return *(volatile uint64_t *)addr;
+}
+
static inline void write8(void *addr, uint8_t val)
{
dmb();
@@ -120,4 +126,11 @@ static inline void write32(void *addr, uint32_t val)
dmb();
}
+static inline void write64(void *addr, uint64_t val)
+{
+ dmb();
+ *(volatile uint64_t *)addr = val;
+ dmb();
+}
+
#endif