Re: [PATCH rtems-libbsd 1/3] dev/mii: Handle PHY read timeouts

2021-07-09 Thread Kinsey Moore

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 0x 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 == 0x ||
+    bmsr == 0x ||

Could you please fix the driver so that it returns 0 or 0x 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

Re: [PATCH rtems-libbsd 1/3] dev/mii: Handle PHY read timeouts

2021-07-08 Thread Chris Johns
On 9/7/21 3:28 pm, Sebastian Huber wrote:
> On 09/07/2021 03:14, Kinsey Moore wrote:
>> PHY read timeouts return 0x 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 == 0x ||
>> +    bmsr == 0x ||
> 
> Could you please fix the driver so that it returns 0 or 0x 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.

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

Re: [PATCH rtems-libbsd 1/3] dev/mii: Handle PHY read timeouts

2021-07-08 Thread Sebastian Huber

On 09/07/2021 03:14, Kinsey Moore wrote:

PHY read timeouts return 0x 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 == 0x ||
+   bmsr == 0x ||


Could you please fix the driver so that it returns 0 or 0x 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.


--
embedded brains GmbH
Herr Sebastian HUBER
Dornierstr. 4
82178 Puchheim
Germany
email: sebastian.hu...@embedded-brains.de
phone: +49-89-18 94 741 - 16
fax:   +49-89-18 94 741 - 08

Registergericht: Amtsgericht München
Registernummer: HRB 157899
Vertretungsberechtigte Geschäftsführer: Peter Rasmussen, Thomas Dörfler
Unsere Datenschutzerklärung finden Sie hier:
https://embedded-brains.de/datenschutzerklaerung/
___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel

[PATCH rtems-libbsd 1/3] dev/mii: Handle PHY read timeouts

2021-07-08 Thread Kinsey Moore
PHY read timeouts return 0x 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 == 0x ||
+   bmsr == 0x ||
(bmsr & (BMSR_EXTSTAT | BMSR_MEDIAMASK)) == 0) {
/* Assume no PHY at this address. */
continue;
-- 
2.20.1

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