diff --git a/usr/src/uts/common/io/mlxcx/mlxcx.c b/usr/src/uts/common/io/mlxcx/mlxcx.c index 4d2ae82673aa..a93a65a0848c 100644 --- a/usr/src/uts/common/io/mlxcx/mlxcx.c +++ b/usr/src/uts/common/io/mlxcx/mlxcx.c @@ -606,9 +606,9 @@ mlxcx_load_props(mlxcx_t *mlxp) p->mldp_rx_per_cq = MLXCX_RX_PER_CQ_DEFAULT; } - p->mldp_rx_p50_loan_min_size = ddi_getprop(DDI_DEV_T_ANY, - mlxp->mlx_dip, DDI_PROP_CANSLEEP | DDI_PROP_DONTPASS, - "rx_p50_loan_min_size", MLXCX_P50_LOAN_MIN_SIZE_DFLT); + p->mldp_rx_p50_loan_min_size = ddi_getprop(DDI_DEV_T_ANY, + mlxp->mlx_dip, DDI_PROP_CANSLEEP | DDI_PROP_DONTPASS, + "rx_p50_loan_min_size", MLXCX_P50_LOAN_MIN_SIZE_DFLT); } void @@ -653,61 +653,6 @@ mlxcx_panic(mlxcx_t *mlxp, const char *fmt, ...) va_end(ap); } -uint16_t -mlxcx_get16(mlxcx_t *mlxp, uintptr_t off) -{ - uintptr_t addr = off + (uintptr_t)mlxp->mlx_regs_base; - return (ddi_get16(mlxp->mlx_regs_handle, (void *)addr)); -} - -uint32_t -mlxcx_get32(mlxcx_t *mlxp, uintptr_t off) -{ - uintptr_t addr = off + (uintptr_t)mlxp->mlx_regs_base; - return (ddi_get32(mlxp->mlx_regs_handle, (void *)addr)); -} - -uint64_t -mlxcx_get64(mlxcx_t *mlxp, uintptr_t off) -{ - uintptr_t addr = off + (uintptr_t)mlxp->mlx_regs_base; - return (ddi_get64(mlxp->mlx_regs_handle, (void *)addr)); -} - -void -mlxcx_put32(mlxcx_t *mlxp, uintptr_t off, uint32_t val) -{ - uintptr_t addr = off + (uintptr_t)mlxp->mlx_regs_base; - ddi_put32(mlxp->mlx_regs_handle, (void *)addr, val); -} - -void -mlxcx_put64(mlxcx_t *mlxp, uintptr_t off, uint64_t val) -{ - uintptr_t addr = off + (uintptr_t)mlxp->mlx_regs_base; - ddi_put64(mlxp->mlx_regs_handle, (void *)addr, val); -} - -void -mlxcx_uar_put32(mlxcx_t *mlxp, mlxcx_uar_t *mlu, uintptr_t off, uint32_t val) -{ - /* - * The UAR is always inside the first BAR, which we mapped as - * mlx_regs - */ - uintptr_t addr = off + (uintptr_t)mlu->mlu_base + - (uintptr_t)mlxp->mlx_regs_base; - ddi_put32(mlxp->mlx_regs_handle, (void *)addr, val); -} - -void -mlxcx_uar_put64(mlxcx_t *mlxp, mlxcx_uar_t *mlu, uintptr_t off, uint64_t val) -{ - uintptr_t addr = off + (uintptr_t)mlu->mlu_base + - (uintptr_t)mlxp->mlx_regs_base; - ddi_put64(mlxp->mlx_regs_handle, (void *)addr, val); -} - static void mlxcx_fm_fini(mlxcx_t *mlxp) { diff --git a/usr/src/uts/common/io/mlxcx/mlxcx.h b/usr/src/uts/common/io/mlxcx/mlxcx.h index 8efe2e9f15e9..24844e106e64 100644 --- a/usr/src/uts/common/io/mlxcx/mlxcx.h +++ b/usr/src/uts/common/io/mlxcx/mlxcx.h @@ -1202,17 +1202,62 @@ struct mlxcx { }; /* - * Register access + * Register access. Use static inlines. */ -extern uint16_t mlxcx_get16(mlxcx_t *, uintptr_t); -extern uint32_t mlxcx_get32(mlxcx_t *, uintptr_t); -extern uint64_t mlxcx_get64(mlxcx_t *, uintptr_t); +static inline uint16_t +mlxcx_get16(mlxcx_t *mlxp, uintptr_t off) +{ + uintptr_t addr = off + (uintptr_t)mlxp->mlx_regs_base; + return (ddi_get16(mlxp->mlx_regs_handle, (void *)addr)); +} + +static inline uint32_t +mlxcx_get32(mlxcx_t *mlxp, uintptr_t off) +{ + uintptr_t addr = off + (uintptr_t)mlxp->mlx_regs_base; + return (ddi_get32(mlxp->mlx_regs_handle, (void *)addr)); +} + +static inline uint64_t +mlxcx_get64(mlxcx_t *mlxp, uintptr_t off) +{ + uintptr_t addr = off + (uintptr_t)mlxp->mlx_regs_base; + return (ddi_get64(mlxp->mlx_regs_handle, (void *)addr)); +} + +static inline void +mlxcx_put32(mlxcx_t *mlxp, uintptr_t off, uint32_t val) +{ + uintptr_t addr = off + (uintptr_t)mlxp->mlx_regs_base; + ddi_put32(mlxp->mlx_regs_handle, (void *)addr, val); +} -extern void mlxcx_put32(mlxcx_t *, uintptr_t, uint32_t); -extern void mlxcx_put64(mlxcx_t *, uintptr_t, uint64_t); +static inline void +mlxcx_put64(mlxcx_t *mlxp, uintptr_t off, uint64_t val) +{ + uintptr_t addr = off + (uintptr_t)mlxp->mlx_regs_base; + ddi_put64(mlxp->mlx_regs_handle, (void *)addr, val); +} + +static inline void +mlxcx_uar_put32(mlxcx_t *mlxp, mlxcx_uar_t *mlu, uintptr_t off, uint32_t val) +{ + /* + * The UAR is always inside the first BAR, which we mapped as + * mlx_regs + */ + uintptr_t addr = off + (uintptr_t)mlu->mlu_base + + (uintptr_t)mlxp->mlx_regs_base; + ddi_put32(mlxp->mlx_regs_handle, (void *)addr, val); +} -extern void mlxcx_uar_put32(mlxcx_t *, mlxcx_uar_t *, uintptr_t, uint32_t); -extern void mlxcx_uar_put64(mlxcx_t *, mlxcx_uar_t *, uintptr_t, uint64_t); +static inline void +mlxcx_uar_put64(mlxcx_t *mlxp, mlxcx_uar_t *mlu, uintptr_t off, uint64_t val) +{ + uintptr_t addr = off + (uintptr_t)mlu->mlu_base + + (uintptr_t)mlxp->mlx_regs_base; + ddi_put64(mlxp->mlx_regs_handle, (void *)addr, val); +} /* * Logging functions.