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>
This commit is contained in:
Tomasz Bursztyka 2020-10-20 15:15:39 +02:00 committed by Anas Nashif
commit e137e9b468
2 changed files with 44 additions and 0 deletions

View file

@ -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;

View file

@ -211,6 +211,28 @@ typedef uintptr_t mem_addr_t;
* @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 */
/**