From: Santosh Shukla <santosh.shu...@caviumnetworks.com> Replace the raw I/O device memory read/write access with eal abstraction for I/O device memory read/write access to fix portability issues across different architectures.
Signed-off-by: Santosh Shukla <santosh.shu...@caviumnetworks.com> Signed-off-by: Jerin Jacob <jerin.ja...@caviumnetworks.com> CC: Harish Patil <harish.pa...@cavium.com> CC: Rasesh Mody <rasesh.m...@cavium.com> --- drivers/net/qede/base/bcm_osal.h | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/drivers/net/qede/base/bcm_osal.h b/drivers/net/qede/base/bcm_osal.h index 0b446f2..925660e 100644 --- a/drivers/net/qede/base/bcm_osal.h +++ b/drivers/net/qede/base/bcm_osal.h @@ -18,6 +18,7 @@ #include <rte_cycles.h> #include <rte_debug.h> #include <rte_ether.h> +#include <rte_io.h> /* Forward declaration */ struct ecore_dev; @@ -113,18 +114,23 @@ void *osal_dma_alloc_coherent_aligned(struct ecore_dev *, dma_addr_t *, /* HW reads/writes */ -#define DIRECT_REG_RD(_dev, _reg_addr) \ - (*((volatile u32 *) (_reg_addr))) +#define DIRECT_REG_RD(_dev, _reg_addr) ({ \ + uint32_t __val; \ + __val = rte_readl((_reg_addr)); \ + __val; \ +}) #define REG_RD(_p_hwfn, _reg_offset) \ DIRECT_REG_RD(_p_hwfn, \ ((u8 *)(uintptr_t)(_p_hwfn->regview) + (_reg_offset))) -#define DIRECT_REG_WR16(_reg_addr, _val) \ - (*((volatile u16 *)(_reg_addr)) = _val) +#define DIRECT_REG_WR16(_reg_addr, _val) ({ \ + rte_writew((_val), (_reg_addr)); \ +}) -#define DIRECT_REG_WR(_dev, _reg_addr, _val) \ - (*((volatile u32 *)(_reg_addr)) = _val) +#define DIRECT_REG_WR(_dev, _reg_addr, _val) ({ \ + rte_writel((_val), (_reg_addr)); \ +}) #define REG_WR(_p_hwfn, _reg_offset, _val) \ DIRECT_REG_WR(NULL, \ -- 2.5.5