mirror of
https://github.com/opnsense/src.git
synced 2026-06-12 02:00:31 -04:00
rtwn: add support for register IO debugging
Add support to read/write the MAC/PHY registers. Hide it behind RTWN_DEBUG. This doesn't cover the RF registers as they require a different IO path, but I haven't yet debugged the RF paths. Locally tested: * RTL8192CU, STA * RTL8188EU, STA * RTL8812AU / RTL8821AU, STA Differential Revision: https://reviews.freebsd.org/D48084 Reviewed by: bz
This commit is contained in:
parent
203027b2d5
commit
7ddf19492c
2 changed files with 35 additions and 0 deletions
|
|
@ -321,12 +321,46 @@ rtwn_radiotap_attach(struct rtwn_softc *sc)
|
|||
&rxtap->wr_ihdr, sizeof(*rxtap), RTWN_RX_RADIOTAP_PRESENT);
|
||||
}
|
||||
|
||||
#ifdef RTWN_DEBUG
|
||||
static int
|
||||
rtwn_sysctl_reg_readwrite(SYSCTL_HANDLER_ARGS)
|
||||
{
|
||||
struct rtwn_softc *sc = arg1;
|
||||
int error;
|
||||
uint32_t val;
|
||||
|
||||
if (sc->sc_reg_addr > 0xffff)
|
||||
return (EINVAL);
|
||||
|
||||
RTWN_LOCK(sc);
|
||||
val = rtwn_read_4(sc, sc->sc_reg_addr);
|
||||
RTWN_UNLOCK(sc);
|
||||
error = sysctl_handle_int(oidp, &val, 0, req);
|
||||
if (error || !req->newptr)
|
||||
return (error);
|
||||
RTWN_LOCK(sc);
|
||||
rtwn_write_4(sc, sc->sc_reg_addr, val);
|
||||
RTWN_UNLOCK(sc);
|
||||
return (0);
|
||||
}
|
||||
#endif /* RTWN_DEBUG */
|
||||
|
||||
void
|
||||
rtwn_sysctlattach(struct rtwn_softc *sc)
|
||||
{
|
||||
struct sysctl_ctx_list *ctx = device_get_sysctl_ctx(sc->sc_dev);
|
||||
struct sysctl_oid *tree = device_get_sysctl_tree(sc->sc_dev);
|
||||
|
||||
sc->sc_reg_addr = 0;
|
||||
#ifdef RTWN_DEBUG
|
||||
SYSCTL_ADD_UINT(ctx, SYSCTL_CHILDREN(tree), OID_AUTO,
|
||||
"reg_addr", CTLFLAG_RW, &sc->sc_reg_addr,
|
||||
sc->sc_reg_addr, "debug register address");
|
||||
SYSCTL_ADD_PROC(ctx, SYSCTL_CHILDREN(tree), OID_AUTO,
|
||||
"reg_val", CTLTYPE_INT | CTLFLAG_RW, sc, 0,
|
||||
rtwn_sysctl_reg_readwrite, "I", "debug register read/write");
|
||||
#endif /* RTWN_DEBUG */
|
||||
|
||||
sc->sc_ht40 = 0;
|
||||
SYSCTL_ADD_INT(ctx, SYSCTL_CHILDREN(tree), OID_AUTO,
|
||||
"ht40", CTLFLAG_RDTUN, &sc->sc_ht40,
|
||||
|
|
|
|||
|
|
@ -178,6 +178,7 @@ struct rtwn_softc {
|
|||
int sc_hwcrypto;
|
||||
int sc_ratectl_sysctl;
|
||||
int sc_ratectl;
|
||||
uint32_t sc_reg_addr;
|
||||
|
||||
uint8_t sc_detached;
|
||||
uint8_t sc_flags;
|
||||
|
|
|
|||
Loading…
Reference in a new issue