sys_io: Expand the API to 64bits read/write functions
And implement the support for intel64 which is basically the
architecture that will require it for now.
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
diff --git a/include/arch/x86/intel64/arch.h b/include/arch/x86/intel64/arch.h
index 0bc72b7..ed726a2 100644
--- a/include/arch/x86/intel64/arch.h
+++ b/include/arch/x86/intel64/arch.h
@@ -18,6 +18,28 @@
#endif
#ifndef _ASMLANGUAGE
+
+static ALWAYS_INLINE void sys_write64(uint64_t data, mm_reg_t addr)
+{
+ __asm__ volatile("movq %0, %1"
+ :
+ : "r"(data), "m" (*(volatile uint64_t *)
+ (uintptr_t) addr)
+ : "memory");
+}
+
+static ALWAYS_INLINE uint32_t sys_read64(mm_reg_t addr)
+{
+ uint64_t ret;
+
+ __asm__ volatile("movq %1, %0"
+ : "=r"(ret)
+ : "m" (*(volatile uint64_t *)(uintptr_t) addr)
+ : "memory");
+
+ return ret;
+}
+
static ALWAYS_INLINE unsigned int arch_irq_lock(void)
{
unsigned long key;
diff --git a/include/sys/sys_io.h b/include/sys/sys_io.h
index 24de867..95b7d4a 100644
--- a/include/sys/sys_io.h
+++ b/include/sys/sys_io.h
@@ -211,6 +211,28 @@
* @return the 32 bits read
*/
+/**
+ * @fn static inline void sys_write64(uint64_t data, mm_reg_t addr);
+ * @brief Write 64 bits to a memory mapped register
+ *
+ * This function writes 64 bits to the given memory mapped register.
+ *
+ * @param data the 64 bits to write
+ * @param addr the memory mapped register address where to write the 64 bits
+ */
+
+/**
+ * @fn static inline uint64_t sys_read64(mm_reg_t addr);
+ * @brief Read 64 bits from a memory mapped register
+ *
+ * This function reads 64 bits from the given memory mapped register.
+ *
+ * @param addr the memory mapped register address from where to read
+ * the 64 bits
+ *
+ * @return the 64 bits read
+ */
+
/* Memory bits manipulation functions */
/**