git: a1d803c16206 - main - cxgbe(4): make it safe to call setup_memwin repeatedly.
Navdeep Parhar
np at FreeBSD.org
Fri Mar 19 19:38:25 UTC 2021
The branch main has been updated by np:
URL: https://cgit.FreeBSD.org/src/commit/?id=a1d803c162067b6cd334fc8a44a89f26cc82d83b
commit a1d803c162067b6cd334fc8a44a89f26cc82d83b
Author: Navdeep Parhar <np at FreeBSD.org>
AuthorDate: 2021-03-19 19:30:57 +0000
Commit: Navdeep Parhar <np at FreeBSD.org>
CommitDate: 2021-03-19 19:37:44 +0000
cxgbe(4): make it safe to call setup_memwin repeatedly.
A repeat call will recreate the memory windows in the hardware and move
them to their last-known positions without repeating any of the software
initialization.
MFC after: 1 week
Sponsored by: Chelsio Communications
---
sys/dev/cxgbe/t4_main.c | 12 +++++++-----
1 file changed, 7 insertions(+), 5 deletions(-)
diff --git a/sys/dev/cxgbe/t4_main.c b/sys/dev/cxgbe/t4_main.c
index 201a333aa431..a61110e99e34 100644
--- a/sys/dev/cxgbe/t4_main.c
+++ b/sys/dev/cxgbe/t4_main.c
@@ -3031,16 +3031,18 @@ setup_memwin(struct adapter *sc)
}
for (i = 0, mw = &sc->memwin[0]; i < NUM_MEMWIN; i++, mw_init++, mw++) {
- rw_init(&mw->mw_lock, "memory window access");
- mw->mw_base = mw_init->base;
- mw->mw_aperture = mw_init->aperture;
- mw->mw_curpos = 0;
+ if (!rw_initialized(&mw->mw_lock)) {
+ rw_init(&mw->mw_lock, "memory window access");
+ mw->mw_base = mw_init->base;
+ mw->mw_aperture = mw_init->aperture;
+ mw->mw_curpos = 0;
+ }
t4_write_reg(sc,
PCIE_MEM_ACCESS_REG(A_PCIE_MEM_ACCESS_BASE_WIN, i),
(mw->mw_base + bar0) | V_BIR(0) |
V_WINDOW(ilog2(mw->mw_aperture) - 10));
rw_wlock(&mw->mw_lock);
- position_memwin(sc, i, 0);
+ position_memwin(sc, i, mw->mw_curpos);
rw_wunlock(&mw->mw_lock);
}
More information about the dev-commits-src-all
mailing list