History log of /openbsd-current/sys/dev/mii/dcphy.c
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
# 1.26 06-Apr-2022 naddy

constify struct cfattach


Revision tags: OPENBSD_5_5_BASE OPENBSD_5_6_BASE OPENBSD_5_7_BASE OPENBSD_5_8_BASE OPENBSD_5_9_BASE OPENBSD_6_0_BASE OPENBSD_6_1_BASE OPENBSD_6_2_BASE OPENBSD_6_3_BASE OPENBSD_6_4_BASE OPENBSD_6_5_BASE OPENBSD_6_6_BASE OPENBSD_6_7_BASE OPENBSD_6_8_BASE OPENBSD_6_9_BASE OPENBSD_7_0_BASE OPENBSD_7_1_BASE
# 1.25 28-Dec-2013 deraadt

mii drivers no longer need activate functions. Repair of the PHY
configuration setting is done at resume time because all networks
drivers which were previously up, do an IFF_UP operation which
hits PHY_RESET.
This was in snapshots for about 2 weeks.


Revision tags: OPENBSD_5_4_BASE
# 1.24 28-May-2013 mikeb

Fix a common issue across different PHY drivers to reset the
autonegotiation timer when PHY gets the link so that if we
restart the timer the mii_ticks value would be sane.

Lifted originally from FreeBSD, tested by a few on re(4) and
bge(4), ok kettenis


Revision tags: OPENBSD_4_5_BASE OPENBSD_4_6_BASE OPENBSD_4_7_BASE OPENBSD_4_8_BASE OPENBSD_4_9_BASE OPENBSD_5_0_BASE OPENBSD_5_1_BASE OPENBSD_5_2_BASE OPENBSD_5_3_BASE
# 1.23 11-Sep-2008 brad

Fix a typo.


# 1.22 08-Sep-2008 brad

IEEE 802.3 Annex 28B.3 explicitly specifies the following relative
priorities of the technologies supported by 802.3 Selector Field
value.

1000BASE-T full duplex
1000BASE-T
100BASE-T2 full duplex
100BASE-TX full duplex
100BASE-T2
100BASE-T4
100BASE-TX
10BASE-T full duplex
10BAST-T

However PHY drivers did not honor the order such that 100BASE-T4 had
higher priority than 100BASE-TX full duplex. Fix a long standing bug
such that PHY drivers choose the highest common denominator ability.

This bug is exposed by a Cisco 3550 switch which inadvertently
announces 100BASE-T4 capability even though it is not capable of
100BASE-T4 operation, it is a 100BASE-TX switch.

From FreeBSD

Tested with dc(4), fxp(4), rl(4), sis(4).


Revision tags: OPENBSD_4_4_BASE
# 1.21 22-Jul-2008 martynas

more negotation -> negotiation; ok sthen@


# 1.20 11-Jul-2008 brad

Check the correct BMSR bit in the capabilities field when checking
for 100baseT4. The dcphy(4) driver could inadvertently display
100baseT4 for the media type for PHY not actually capable of
100baseT4.

From FreeBSD

ok dlg@


# 1.19 10-Jun-2008 brad

Some header cleanup. Remove some unused headers and shuffle some around
for consistency between drivers.

"looks good" reyk@


Revision tags: OPENBSD_4_1_BASE OPENBSD_4_2_BASE OPENBSD_4_3_BASE
# 1.18 27-Dec-2006 kettenis

Always explicitly set IFM_HDX for half-duplex.

From brad@


Revision tags: OPENBSD_4_0_BASE
# 1.17 05-Aug-2006 brad

add sys/timeout.h and remove redundant sys/socket.h header.


Revision tags: OPENBSD_3_8_BASE OPENBSD_3_9_BASE
# 1.16 04-Aug-2005 brad

allow dcphy_status() to be called even when the parent interface
is in the down state. on some dc's with dcphy this will now allow
the card to show carrier state and some link speed though not
necessarily full-duplex for some reason. something to look into
still.


# 1.15 27-May-2005 brad

some cleanup


# 1.14 26-Mar-2005 krw

Cleanup. Use defines, standard names, consistant comparison operators, etc.
for auto negotiation ticks code. No functional change.

ok brad@


Revision tags: OPENBSD_3_7_BASE
# 1.13 28-Jan-2005 brad

Get flags passed down to PHY drivers correctly. This was done on
an adhoc basis in a couple of PHY drivers, this fixes it more generally.

From NetBSD

Fixes panics with aue(4) NICs.


# 1.12 25-Dec-2004 brad

- remove unneccessary break
- reorder operations and a few return (0)'s to break's with MII_TICK switch case


# 1.11 16-Nov-2004 brad

if_dc.c rev 1.56

Do not call mii_pollstat() from within device tick routines; the status
information is updated by mii_tick().

dcphy.c rev 1.13

Work around an Intel 21143 chip bug.

Rev 1.56 of if_dc.c removed calls to mii_pollstat() from the dc_tick()
routine. dc_tick() is called regularly to detect link up and link down
status, especially when autonegotiating.

The expectation was that mii_tick() (which is still called from dc_tick())
would update status information automatically in all cases where it would
be sensible to do so.

Unfortunately, with authentic 21143 chips this is not the case, and
the driver never successfully autonegotiates. This is because (despite
what it says in the 21143 manual) the chip always claims that link is not
present while the autonegotiation enable bit is set. Autonegotation takes
place and succeeds, but the driver tests the link bits before it switches
off the autonegotiation enable bit, and success is not recognised.

The simplest solution is to call dcphy_status() more often for MII_TICK
calls by dropping out of the switch statement instead of exiting when
we are autonegotiating and link appears to not be present. When
autonegotiation succeeds, dcphy_status() will note the speed and fdx/hdx
state and turn off the autonegotiation enable bit. The next call to
dcphy_status() will notice that link is present, and the dc driver code
will be notified.

Macronix chips also use this code, but implement link detection as
described in the manual, and hence don't need this patch. However, tests
on a Macronix 98715AEC-C show that it does not adversely affect them.

From FreeBSD

ok deraadt@


# 1.10 27-Sep-2004 brad

ANSI protos and some minor cleanup

ok henning@


# 1.9 26-Sep-2004 brad

Restructure the PHY entry points to use a structure of
entry points instead of descrete function pointers, and
extend this to include a "reset" entry point. Make sure
any PHY-specific reset routine is always used.

From NetBSD

ok mcbride@


Revision tags: OPENBSD_3_3_BASE OPENBSD_3_4_BASE OPENBSD_3_5_BASE OPENBSD_3_6_BASE SMP_SYNC_A SMP_SYNC_B UBC_SYNC_A UBC_SYNC_B
# 1.8 20-Oct-2002 henning

add support for intel 21145
This chip is some strange abnormal 21143 variant. It really only works with
10 MBit/s halfduplex only and autonegotiation is totally broken in hardware.
Should also have a HomePNA phy, but we don't support that.
for now requires and explicit "media 10BaseT".
if anybody has such a chip please mail me.

nick@ is the only one who has the hardware and did an incredible amount of
testing. Thanks for all the help, Nick!

some hints and ok jason@


Revision tags: OPENBSD_3_2_BASE
# 1.7 04-May-2002 fgsch

some space and tab cleanup.


Revision tags: OPENBSD_3_1_BASE
# 1.6 14-Mar-2002 millert

First round of __P removal in sys


Revision tags: OPENBSD_2_9_BASE OPENBSD_3_0_BASE UBC_BASE
# 1.5 02-Apr-2001 aaron

branches: 1.5.6;
Oops, this should have been committed along with the SROM media block parsing
changes to the dc driver.


Revision tags: OPENBSD_2_8_BASE
# 1.4 07-Sep-2000 aaron

During the last FreeBSD dc(4) sync, I very stupidly forgot to check for changes
in dcphy(4) as well, breaking some cards (i.e., the Macronix PMAC 98715). This
commit brings dcphy up-to-date. Thanks to cgruber@troba.com and ericj@ for
providing me with Macronix cards for testing.


# 1.3 26-Aug-2000 nate

sync mii code with netbsd
adds detach functionality for phys
some code cleanup

Nobody really had time to test all of this out, but theo said commit anyway


Revision tags: OPENBSD_2_7_BASE
# 1.2 18-Apr-2000 jason

split dc driver into bus dependent and bus independent (pci) parts
(cardbus to come later).


Revision tags: SMP_BASE
# 1.1 09-Jan-2000 jason

branches: 1.1.2;
emulated phy for if_dc; from FreeBSD


Revision tags: OPENBSD_5_5_BASE OPENBSD_5_6_BASE OPENBSD_5_7_BASE OPENBSD_5_8_BASE OPENBSD_5_9_BASE OPENBSD_6_0_BASE OPENBSD_6_1_BASE OPENBSD_6_2_BASE
# 1.25 28-Dec-2013 deraadt

mii drivers no longer need activate functions. Repair of the PHY
configuration setting is done at resume time because all networks
drivers which were previously up, do an IFF_UP operation which
hits PHY_RESET.
This was in snapshots for about 2 weeks.


Revision tags: OPENBSD_5_4_BASE
# 1.24 28-May-2013 mikeb

Fix a common issue across different PHY drivers to reset the
autonegotiation timer when PHY gets the link so that if we
restart the timer the mii_ticks value would be sane.

Lifted originally from FreeBSD, tested by a few on re(4) and
bge(4), ok kettenis


Revision tags: OPENBSD_4_5_BASE OPENBSD_4_6_BASE OPENBSD_4_7_BASE OPENBSD_4_8_BASE OPENBSD_4_9_BASE OPENBSD_5_0_BASE OPENBSD_5_1_BASE OPENBSD_5_2_BASE OPENBSD_5_3_BASE
# 1.23 11-Sep-2008 brad

Fix a typo.


# 1.22 08-Sep-2008 brad

IEEE 802.3 Annex 28B.3 explicitly specifies the following relative
priorities of the technologies supported by 802.3 Selector Field
value.

1000BASE-T full duplex
1000BASE-T
100BASE-T2 full duplex
100BASE-TX full duplex
100BASE-T2
100BASE-T4
100BASE-TX
10BASE-T full duplex
10BAST-T

However PHY drivers did not honor the order such that 100BASE-T4 had
higher priority than 100BASE-TX full duplex. Fix a long standing bug
such that PHY drivers choose the highest common denominator ability.

This bug is exposed by a Cisco 3550 switch which inadvertently
announces 100BASE-T4 capability even though it is not capable of
100BASE-T4 operation, it is a 100BASE-TX switch.

From FreeBSD

Tested with dc(4), fxp(4), rl(4), sis(4).


Revision tags: OPENBSD_4_4_BASE
# 1.21 22-Jul-2008 martynas

more negotation -> negotiation; ok sthen@


# 1.20 11-Jul-2008 brad

Check the correct BMSR bit in the capabilities field when checking
for 100baseT4. The dcphy(4) driver could inadvertently display
100baseT4 for the media type for PHY not actually capable of
100baseT4.

From FreeBSD

ok dlg@


# 1.19 10-Jun-2008 brad

Some header cleanup. Remove some unused headers and shuffle some around
for consistency between drivers.

"looks good" reyk@


Revision tags: OPENBSD_4_1_BASE OPENBSD_4_2_BASE OPENBSD_4_3_BASE
# 1.18 27-Dec-2006 kettenis

Always explicitly set IFM_HDX for half-duplex.

From brad@


Revision tags: OPENBSD_4_0_BASE
# 1.17 05-Aug-2006 brad

add sys/timeout.h and remove redundant sys/socket.h header.


Revision tags: OPENBSD_3_8_BASE OPENBSD_3_9_BASE
# 1.16 04-Aug-2005 brad

allow dcphy_status() to be called even when the parent interface
is in the down state. on some dc's with dcphy this will now allow
the card to show carrier state and some link speed though not
necessarily full-duplex for some reason. something to look into
still.


# 1.15 27-May-2005 brad

some cleanup


# 1.14 26-Mar-2005 krw

Cleanup. Use defines, standard names, consistant comparison operators, etc.
for auto negotiation ticks code. No functional change.

ok brad@


Revision tags: OPENBSD_3_7_BASE
# 1.13 28-Jan-2005 brad

Get flags passed down to PHY drivers correctly. This was done on
an adhoc basis in a couple of PHY drivers, this fixes it more generally.

From NetBSD

Fixes panics with aue(4) NICs.


# 1.12 25-Dec-2004 brad

- remove unneccessary break
- reorder operations and a few return (0)'s to break's with MII_TICK switch case


# 1.11 16-Nov-2004 brad

if_dc.c rev 1.56

Do not call mii_pollstat() from within device tick routines; the status
information is updated by mii_tick().

dcphy.c rev 1.13

Work around an Intel 21143 chip bug.

Rev 1.56 of if_dc.c removed calls to mii_pollstat() from the dc_tick()
routine. dc_tick() is called regularly to detect link up and link down
status, especially when autonegotiating.

The expectation was that mii_tick() (which is still called from dc_tick())
would update status information automatically in all cases where it would
be sensible to do so.

Unfortunately, with authentic 21143 chips this is not the case, and
the driver never successfully autonegotiates. This is because (despite
what it says in the 21143 manual) the chip always claims that link is not
present while the autonegotiation enable bit is set. Autonegotation takes
place and succeeds, but the driver tests the link bits before it switches
off the autonegotiation enable bit, and success is not recognised.

The simplest solution is to call dcphy_status() more often for MII_TICK
calls by dropping out of the switch statement instead of exiting when
we are autonegotiating and link appears to not be present. When
autonegotiation succeeds, dcphy_status() will note the speed and fdx/hdx
state and turn off the autonegotiation enable bit. The next call to
dcphy_status() will notice that link is present, and the dc driver code
will be notified.

Macronix chips also use this code, but implement link detection as
described in the manual, and hence don't need this patch. However, tests
on a Macronix 98715AEC-C show that it does not adversely affect them.

From FreeBSD

ok deraadt@


# 1.10 27-Sep-2004 brad

ANSI protos and some minor cleanup

ok henning@


# 1.9 26-Sep-2004 brad

Restructure the PHY entry points to use a structure of
entry points instead of descrete function pointers, and
extend this to include a "reset" entry point. Make sure
any PHY-specific reset routine is always used.

From NetBSD

ok mcbride@


Revision tags: OPENBSD_3_3_BASE OPENBSD_3_4_BASE OPENBSD_3_5_BASE OPENBSD_3_6_BASE SMP_SYNC_A SMP_SYNC_B UBC_SYNC_A UBC_SYNC_B
# 1.8 20-Oct-2002 henning

add support for intel 21145
This chip is some strange abnormal 21143 variant. It really only works with
10 MBit/s halfduplex only and autonegotiation is totally broken in hardware.
Should also have a HomePNA phy, but we don't support that.
for now requires and explicit "media 10BaseT".
if anybody has such a chip please mail me.

nick@ is the only one who has the hardware and did an incredible amount of
testing. Thanks for all the help, Nick!

some hints and ok jason@


Revision tags: OPENBSD_3_2_BASE
# 1.7 04-May-2002 fgsch

some space and tab cleanup.


Revision tags: OPENBSD_3_1_BASE
# 1.6 14-Mar-2002 millert

First round of __P removal in sys


Revision tags: OPENBSD_2_9_BASE OPENBSD_3_0_BASE UBC_BASE
# 1.5 02-Apr-2001 aaron

branches: 1.5.6;
Oops, this should have been committed along with the SROM media block parsing
changes to the dc driver.


Revision tags: OPENBSD_2_8_BASE
# 1.4 07-Sep-2000 aaron

During the last FreeBSD dc(4) sync, I very stupidly forgot to check for changes
in dcphy(4) as well, breaking some cards (i.e., the Macronix PMAC 98715). This
commit brings dcphy up-to-date. Thanks to cgruber@troba.com and ericj@ for
providing me with Macronix cards for testing.


# 1.3 26-Aug-2000 nate

sync mii code with netbsd
adds detach functionality for phys
some code cleanup

Nobody really had time to test all of this out, but theo said commit anyway


Revision tags: OPENBSD_2_7_BASE
# 1.2 18-Apr-2000 jason

split dc driver into bus dependent and bus independent (pci) parts
(cardbus to come later).


Revision tags: SMP_BASE
# 1.1 09-Jan-2000 jason

branches: 1.1.2;
emulated phy for if_dc; from FreeBSD