On 7/9/2021 00:32, Chris Johns wrote:
On 9/7/21 3:28 pm, Sebastian Huber wrote:
On 09/07/2021 03:14, Kinsey Moore wrote:
PHY read timeouts return 0xffffffff and bypass the current bad/no PHY
checks. This adds a check specifically for that read timeout to avoid
probing PHYs that don't exist.
---
   freebsd/sys/dev/mii/mii.c | 1 +
   1 file changed, 1 insertion(+)

diff --git a/freebsd/sys/dev/mii/mii.c b/freebsd/sys/dev/mii/mii.c
index d0428f24..8f087cab 100644
--- a/freebsd/sys/dev/mii/mii.c
+++ b/freebsd/sys/dev/mii/mii.c
@@ -474,6 +474,7 @@ mii_attach(device_t dev, device_t *miibus, if_t ifp,
            */
           bmsr = MIIBUS_READREG(dev, ma.mii_phyno, MII_BMSR);
           if (bmsr == 0 || bmsr == 0xffff ||
+            bmsr == 0xffffffff ||
Could you please fix the driver so that it returns 0 or 0xffff in case of
timeouts? This is the general MII module of FreeBSD. If you think there is a bug
in this code, then please report it to FreeBSD first.
We should resolve the issue in the probe and not the attach call. Attach errors
are real errors, probe errors or failures are niche to the specifics of the
hardware.

It looks like other drivers ensure that only the bottom two bytes of the return value are used though I can't seem to find a spec on the interface, so that's a possible bug in the cgem driver whose fix would achieve the same effect as this patch. Unfortunately, nothing is initialized or allocated until just before the PHYs are scanned in cgem_attach and getting something into the probe isn't going to be pretty, though it should at least be possible.


Kinsey

_______________________________________________
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel

Reply via email to