cxgbe: Stop using bus_space_tag/handle directly

Reviewed by:	np, imp
Sponsored by:	Chelsio Communications
Differential Revision:	https://reviews.freebsd.org/D53030

(cherry picked from commit bc2b10a5931442bb39653cd8d5712b2d7195cf46)
This commit is contained in:
John Baldwin 2025-12-09 10:46:55 -05:00
parent 41abe983db
commit 2233463df7
3 changed files with 11 additions and 19 deletions

View file

@ -941,8 +941,6 @@ struct adapter {
struct resource *regs_res;
int msix_rid;
struct resource *msix_res;
bus_space_handle_t bh;
bus_space_tag_t bt;
bus_size_t mmio_len;
int udbs_rid;
struct resource *udbs_res;
@ -1252,7 +1250,7 @@ t4_read_reg(struct adapter *sc, uint32_t reg)
{
if (hw_off_limits(sc))
MPASS(curthread == sc->reset_thread);
return bus_space_read_4(sc->bt, sc->bh, reg);
return bus_read_4(sc->regs_res, reg);
}
static inline void
@ -1260,7 +1258,7 @@ t4_write_reg(struct adapter *sc, uint32_t reg, uint32_t val)
{
if (hw_off_limits(sc))
MPASS(curthread == sc->reset_thread);
bus_space_write_4(sc->bt, sc->bh, reg, val);
bus_write_4(sc->regs_res, reg, val);
}
static inline uint64_t
@ -1269,10 +1267,10 @@ t4_read_reg64(struct adapter *sc, uint32_t reg)
if (hw_off_limits(sc))
MPASS(curthread == sc->reset_thread);
#ifdef __LP64__
return bus_space_read_8(sc->bt, sc->bh, reg);
return bus_read_8(sc->regs_res, reg);
#else
return (uint64_t)bus_space_read_4(sc->bt, sc->bh, reg) +
((uint64_t)bus_space_read_4(sc->bt, sc->bh, reg + 4) << 32);
return (uint64_t)bus_read_4(sc->regs_res, reg) +
((uint64_t)bus_read_4(sc->regs_res, reg + 4) << 32);
#endif
}
@ -1283,10 +1281,10 @@ t4_write_reg64(struct adapter *sc, uint32_t reg, uint64_t val)
if (hw_off_limits(sc))
MPASS(curthread == sc->reset_thread);
#ifdef __LP64__
bus_space_write_8(sc->bt, sc->bh, reg, val);
bus_write_8(sc->regs_res, reg, val);
#else
bus_space_write_4(sc->bt, sc->bh, reg, val);
bus_space_write_4(sc->bt, sc->bh, reg + 4, val>> 32);
bus_write_4(sc->regs_res, reg, val);
bus_write_4(sc->regs_res, reg + 4, val>> 32);
#endif
}

View file

@ -54,8 +54,6 @@ struct t4iov_softc {
int pf;
int regs_rid;
struct resource *regs_res;
bus_space_handle_t bh;
bus_space_tag_t bt;
};
struct {
@ -147,7 +145,7 @@ static inline uint32_t
t4iov_read_reg(struct t4iov_softc *sc, uint32_t reg)
{
return bus_space_read_4(sc->bt, sc->bh, reg);
return bus_read_4(sc->regs_res, reg);
}
static int t4iov_attach_child(device_t dev);
@ -249,8 +247,6 @@ t4iov_attach(device_t dev)
device_printf(dev, "cannot map registers.\n");
return (ENXIO);
}
sc->bt = rman_get_bustag(sc->regs_res);
sc->bh = rman_get_bushandle(sc->regs_res);
pl_rev = t4iov_read_reg(sc, A_PL_REV);
whoami = t4iov_read_reg(sc, A_PL_WHOAMI);

View file

@ -2660,8 +2660,8 @@ reset_adapter_with_pl_rst(struct adapter *sc)
{
/* This is a t4_write_reg without the hw_off_limits check. */
MPASS(sc->error_flags & HW_OFF_LIMITS);
bus_space_write_4(sc->bt, sc->bh, A_PL_RST,
F_PIORSTMODE | F_PIORST | F_AUTOPCIEPAUSE);
bus_write_4(sc->regs_res, A_PL_RST,
F_PIORSTMODE | F_PIORST | F_AUTOPCIEPAUSE);
pause("pl_rst", 1 * hz); /* Wait 1s for reset */
return (0);
}
@ -3971,8 +3971,6 @@ t4_map_bars_0_and_4(struct adapter *sc)
device_printf(sc->dev, "cannot map registers.\n");
return (ENXIO);
}
sc->bt = rman_get_bustag(sc->regs_res);
sc->bh = rman_get_bushandle(sc->regs_res);
sc->mmio_len = rman_get_size(sc->regs_res);
setbit(&sc->doorbells, DOORBELL_KDB);