提交 588b34be 编写于 作者: D Daniel Axtens 提交者: Michael Ellerman

cxl: Convert MMIO read/write macros to inline functions

We're about to make these more complex, so make them functions
first.
Signed-off-by: NDaniel Axtens <dja@axtens.net>
Signed-off-by: NMichael Ellerman <mpe@ellerman.id.au>
上级 e642d11b
...@@ -537,10 +537,15 @@ static inline void __iomem *_cxl_p1_addr(struct cxl *cxl, cxl_p1_reg_t reg) ...@@ -537,10 +537,15 @@ static inline void __iomem *_cxl_p1_addr(struct cxl *cxl, cxl_p1_reg_t reg)
return cxl->p1_mmio + cxl_reg_off(reg); return cxl->p1_mmio + cxl_reg_off(reg);
} }
#define cxl_p1_write(cxl, reg, val) \ static inline void cxl_p1_write(struct cxl *cxl, cxl_p1_reg_t reg, u64 val)
out_be64(_cxl_p1_addr(cxl, reg), val) {
#define cxl_p1_read(cxl, reg) \ out_be64(_cxl_p1_addr(cxl, reg), val);
in_be64(_cxl_p1_addr(cxl, reg)) }
static inline u64 cxl_p1_read(struct cxl *cxl, cxl_p1_reg_t reg)
{
return in_be64(_cxl_p1_addr(cxl, reg));
}
static inline void __iomem *_cxl_p1n_addr(struct cxl_afu *afu, cxl_p1n_reg_t reg) static inline void __iomem *_cxl_p1n_addr(struct cxl_afu *afu, cxl_p1n_reg_t reg)
{ {
...@@ -548,26 +553,40 @@ static inline void __iomem *_cxl_p1n_addr(struct cxl_afu *afu, cxl_p1n_reg_t reg ...@@ -548,26 +553,40 @@ static inline void __iomem *_cxl_p1n_addr(struct cxl_afu *afu, cxl_p1n_reg_t reg
return afu->p1n_mmio + cxl_reg_off(reg); return afu->p1n_mmio + cxl_reg_off(reg);
} }
#define cxl_p1n_write(afu, reg, val) \ static inline void cxl_p1n_write(struct cxl_afu *afu, cxl_p1n_reg_t reg, u64 val)
out_be64(_cxl_p1n_addr(afu, reg), val) {
#define cxl_p1n_read(afu, reg) \ out_be64(_cxl_p1n_addr(afu, reg), val);
in_be64(_cxl_p1n_addr(afu, reg)) }
static inline u64 cxl_p1n_read(struct cxl_afu *afu, cxl_p1n_reg_t reg)
{
return in_be64(_cxl_p1n_addr(afu, reg));
}
static inline void __iomem *_cxl_p2n_addr(struct cxl_afu *afu, cxl_p2n_reg_t reg) static inline void __iomem *_cxl_p2n_addr(struct cxl_afu *afu, cxl_p2n_reg_t reg)
{ {
return afu->p2n_mmio + cxl_reg_off(reg); return afu->p2n_mmio + cxl_reg_off(reg);
} }
#define cxl_p2n_write(afu, reg, val) \ static inline void cxl_p2n_write(struct cxl_afu *afu, cxl_p2n_reg_t reg, u64 val)
out_be64(_cxl_p2n_addr(afu, reg), val) {
#define cxl_p2n_read(afu, reg) \ out_be64(_cxl_p2n_addr(afu, reg), val);
in_be64(_cxl_p2n_addr(afu, reg)) }
static inline u64 cxl_p2n_read(struct cxl_afu *afu, cxl_p2n_reg_t reg)
{
return in_be64(_cxl_p2n_addr(afu, reg));
}
#define cxl_afu_cr_read64(afu, cr, off) \ static inline u64 cxl_afu_cr_read64(struct cxl_afu *afu, int cr, u64 off)
in_le64((afu)->afu_desc_mmio + (afu)->crs_offset + ((cr) * (afu)->crs_len) + (off)) {
#define cxl_afu_cr_read32(afu, cr, off) \ return in_le64((afu)->afu_desc_mmio + (afu)->crs_offset + ((cr) * (afu)->crs_len) + (off));
in_le32((afu)->afu_desc_mmio + (afu)->crs_offset + ((cr) * (afu)->crs_len) + (off)) }
static inline u32 cxl_afu_cr_read32(struct cxl_afu *afu, int cr, u64 off)
{
return in_le32((afu)->afu_desc_mmio + (afu)->crs_offset + ((cr) * (afu)->crs_len) + (off));
}
u16 cxl_afu_cr_read16(struct cxl_afu *afu, int cr, u64 off); u16 cxl_afu_cr_read16(struct cxl_afu *afu, int cr, u64 off);
u8 cxl_afu_cr_read8(struct cxl_afu *afu, int cr, u64 off); u8 cxl_afu_cr_read8(struct cxl_afu *afu, int cr, u64 off);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册