Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 4 Jul 2022 14:25:13 GMT
From:      =?utf-8?Q?Kornel=20Dul=C4=99ba?= <kd@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: 665482590757 - main - e6000sw: Fix direct register write logic
Message-ID:  <202207041425.264EPDIF064138@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by kd:

URL: https://cgit.FreeBSD.org/src/commit/?id=66548259075788d2084e9da1c5df7b88f44c4b4d

commit 66548259075788d2084e9da1c5df7b88f44c4b4d
Author:     Kornel Dulęba <kd@FreeBSD.org>
AuthorDate: 2022-07-04 06:53:41 +0000
Commit:     Kornel Dulęba <kd@FreeBSD.org>
CommitDate: 2022-07-04 14:22:22 +0000

    e6000sw: Fix direct register write logic
    
    When accessing a register directly from etherswitchcfg one must specify
    a register group(e.g. registers of portN) and the register offset within
    the group. The latter is passed as the 5 least significant bits.
    Extract the former by dividing the register address by 32, not by 5.
    
    Approved by:    mw(mentor)
    Obtained from:  Semihalf
    Sponsored by:   Stormshield
    MFC after:      2 weeks
    Differential Revision:  https://reviews.freebsd.org/D35672
---
 sys/dev/etherswitch/e6000sw/e6000sw.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys/dev/etherswitch/e6000sw/e6000sw.c b/sys/dev/etherswitch/e6000sw/e6000sw.c
index 3c0ede5cddcd..7374fe2d74e5 100644
--- a/sys/dev/etherswitch/e6000sw/e6000sw.c
+++ b/sys/dev/etherswitch/e6000sw/e6000sw.c
@@ -1061,7 +1061,7 @@ e6000sw_writereg_wrapper(device_t dev, int addr_reg, int val)
 		device_printf(dev, "Wrong register address.\n");
 		return (EINVAL);
 	}
-	e6000sw_writereg(device_get_softc(dev), addr_reg / 5,
+	e6000sw_writereg(device_get_softc(dev), addr_reg / 32,
 	    addr_reg % 32, val);
 
 	return (0);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202207041425.264EPDIF064138>