git: 2233463df7de - stable/15 - cxgbe: Stop using bus_space_tag/handle directly
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Fri, 24 Apr 2026 15:28:57 UTC
The branch stable/15 has been updated by jhb:
URL: https://cgit.FreeBSD.org/src/commit/?id=2233463df7de6f95e45c018e26cf99fbdb1102bf
commit 2233463df7de6f95e45c018e26cf99fbdb1102bf
Author: John Baldwin <jhb@FreeBSD.org>
AuthorDate: 2025-12-09 15:46:55 +0000
Commit: John Baldwin <jhb@FreeBSD.org>
CommitDate: 2026-04-24 15:26:37 +0000
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)
---
sys/dev/cxgbe/adapter.h | 18 ++++++++----------
sys/dev/cxgbe/t4_iov.c | 6 +-----
sys/dev/cxgbe/t4_main.c | 6 ++----
3 files changed, 11 insertions(+), 19 deletions(-)
diff --git a/sys/dev/cxgbe/adapter.h b/sys/dev/cxgbe/adapter.h
index 55f09fefb7e3..6ff1f07ddf50 100644
--- a/sys/dev/cxgbe/adapter.h
+++ b/sys/dev/cxgbe/adapter.h
@@ -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
}
diff --git a/sys/dev/cxgbe/t4_iov.c b/sys/dev/cxgbe/t4_iov.c
index 452ebaaf0172..9ccf63fd6516 100644
--- a/sys/dev/cxgbe/t4_iov.c
+++ b/sys/dev/cxgbe/t4_iov.c
@@ -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);
diff --git a/sys/dev/cxgbe/t4_main.c b/sys/dev/cxgbe/t4_main.c
index 22d2f504c257..88a1cb9d3eb9 100644
--- a/sys/dev/cxgbe/t4_main.c
+++ b/sys/dev/cxgbe/t4_main.c
@@ -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);