Commit Graph

963 Commits

Author SHA1 Message Date
andvar 8167a3efd2 s/Transmi /Transmit / in comments. 2024-02-26 20:20:01 +00:00
andvar 100a3398b8 fix spelling mistakes, mainly in comments and log messages. 2024-02-09 22:08:30 +00:00
andvar a5175f1e98 s/sharable/shareable in comments and documentation. 2024-02-08 20:11:55 +00:00
andvar cb7270a436 s/should't/shouldn't/ and s/mistmatch/mismatch/ in comments. 2024-02-08 19:44:08 +00:00
msaitoh 2931f95ff0 miidevs: Regen. 2023-10-17 14:08:13 +00:00
msaitoh bc7af51573 miidevs: Add MaxLinear GPY115. 2023-10-17 14:07:51 +00:00
msaitoh 09cff4217c Regen. 2023-09-29 09:08:30 +00:00
msaitoh 239bfb0ff0 miidevs: Update I22[56]
- Add model 0x0001 and 0x0005 for I226 and 0x000c for I225.
   Need more info to write better descriptions.
 - Modify GPY211's description a little.
2023-09-29 09:08:16 +00:00
msaitoh 3b2adf3873 Regen. 2023-09-29 03:39:00 +00:00
msaitoh 161418d9c2 Add MaxLinear GPY21[125] 2.5G PHY. 2023-09-29 03:38:36 +00:00
andvar 11688feb47 fix various typos in comments and messages. 2023-06-03 20:41:44 +00:00
msaitoh e1c80d2dbf Fix a bug when a media is changed to IFM_AUTO.
Fix a bug that ifconfig ifN media auto doesn't change the setting when
the previous media setting used autonego. When the mii_phy_setmedia()
function is called to change the media to IFM_AUTO, the BMCR_AUTOEN bit was
used to check if the previous setting was IFM_AUTO. It's not correct.
IFM_1000_T also uses autonego. So if a previous setting is IFM_1000_T and
the next setting is IFM_AUTO, mii_phy_auto() is not called if neither
MIIF_FORCEANEG nor MIIF_DOPAUSE are set. As a result, after changing
IFM_AUTO, neither 10Mbps nor 100Mbps are not advertised.

Note that almost all drivers uses MIIF_DOPAUSE flags.

TODO: cleanup ciphy.c and rgephy.c. Those have #ifdef foo.
2023-05-22 02:12:13 +00:00
andvar ee31f12086 s/Regiser/Register/ and s/regester/register/ in comments. 2023-05-06 21:53:26 +00:00
msaitoh 9589449d9e Retry autonegotiation every mii_anegticks seconds instead of mii_anegticks+1. 2023-02-22 08:09:09 +00:00
jmcneill 1214ec155b fix blank printf at attach 2022-10-31 22:45:13 +00:00
riastradh eb906dd0c2 mii(9): Make mii_phy_down clear the flag if it prevented the callout.
This fixes a bug in the previous change to make mii_down wait for the
mii auto timeout to complete.
2022-08-23 01:05:50 +00:00
riastradh e83eef3e0a mii(4): Make mii_down wait for concurrent mii_phy_auto to finish.
This is important for callers in if_stop routines to guarantee that
all concurrent access to the mii registers has ended.

Drivers must not call this from softint context.  Drivers with custom
watchdog timers (not if_watchdog) that do if_stop from callout must
defer to thread context instead, e.g. via workqueue(9) -- as they
should be doing anyway for heavyweight operations like if_stop.
2022-08-20 11:12:46 +00:00
riastradh 366512517f mii(4): Wait for MIIF_DOINGAUTO to clear with MIIF_AUTOTSLEEP too.
Otherwise mii_phy_detach may return while mii_phy_auto_timeout_locked
is still in progress in another thread.

Reuse the storage for mii_nway_ch, which is unused if MIIF_AUTOTSLEEP
is set, for a new condvar in a union.  This doesn't change the kernel
ABI because sizeof(struct kcondvar) <= sizeof(struct callout) and
both have the same alignment, for an array of void *.
2022-08-14 20:34:26 +00:00
riastradh 3a885b13c6 mii(4): Sprinkle assertions in mii phy auto timeout. 2022-08-14 20:33:57 +00:00
riastradh 03dbe12f0c urlphy(4): Fix missing mii locking in urlphy_attach. 2022-01-08 17:35:05 +00:00
msaitoh fd0f817df7 QEMU e1000's PHY code doesn't reflect the PSSR_LINK bit. Do workaround.
IEEE 802.3 clause 22's PHY device has a link status bit in the BMCR
  register, but it's required to read twice to get the correct value.
  Almost all PHY devices have the vendor specific register which has
  the link status bit that it's not required to read twice. makphy(4)
  use the bit in the PSSR register to reduce the access cost.

   QEMU's e1000 provides the PHY specific status register at 0x11 but the
  link indication bit (PSSR_LINK.) is always 1 because
  e1000x_update_regs_on_link_{down,up}() modify MII_SR_LINK_STATUS
  (BMSR_LINK in NetBSD) but don't modify PSSR_LINK. It causes
  "virsh domif-setlink xxx yyy down" doesn't work.
  To avoid this problem, read the BMSR and check the BMSR_LINK bit. Add
  MAKPHY_QUIRK_PSSR_LINK bit for this quirk. Set it if MII_EXTSR doesn't
  exist because it's one of the case of QEMU.

  Found and tested by ozaki-r.
2022-01-06 07:39:10 +00:00
jmcneill 17d21f0174 Add driver for Motorcomm YT8511 GbE PHY 2022-01-03 17:18:12 +00:00
riastradh b24dc162a1 mii(9): Fix callout race between mii_phy_down and mii_phy_detach. 2021-12-28 12:00:48 +00:00
msaitoh 09ce039b20 Reduce the access of the ESSR register.
- makphyattach() have a code to detect the Fiber/Copper auto selection
   feature. Save the info to sc_flags to reduce the access
   to the ESSR register. One of the reason is that the register is not
   implemented on QEMU. Another reason is that it's not required to
   access the register if the device is in the copper only mode.
2021-12-28 06:36:29 +00:00
msaitoh 2612a28064 QEMU e1000's PHY code doesn't implement register 16. Do workaround.
- Marvell 88E1[01]11 (and many other Marvell PHYs) have the Fiber/Copper
   auto selection feature. Our makphy(4) implement it but QEMU doesn't.
   If it fails, a garbage data is used in the attach function and unexpected
   media may be used. Fix this behavior by checking the return value of
   PHY_READ(MAKPHY_ESSR). If the access failed, the media is regarded
   as copper only. It's just a cosmetic change. It's not affected to the
   packet processing.
2021-12-28 06:35:37 +00:00
msaitoh 3401d1f8f2 QEMU e1000's PHY code doesn't implement page 0 register 15. Do workaround.
- The BMSR register bit 8 (BMSR_EXTSTAT) denote the existence of page 0
   register 15. qemu's e1000 sets BMSR_EXTSTAT but the access to register 15
   fails. It doesn't conforms to the IEEE standard. Our makphy automatically
   check the existence of 1000BASE-T or 1000BASE-SX by accessing the register
   15. If the access failed, neither 1000BASE-T nor 1000BASE-SX is set to
   the ability(mii_extcapabilities). Set EXTSR_1000TFDX and EXTSR_1000THDX
   if the access failed in the attach function. It's just a cosmetic change.
   It's not affected to the packet processing.
2021-12-28 06:34:40 +00:00
msaitoh 3da58d14f1 Cosmetic change for the output of mii_get_descr(). 2021-12-15 08:28:22 +00:00
msaitoh e778ac4194 Don't power down the PHY when the interface goes down.
- All of other PHY drivers don't power down the PHY. Do the same way.
 - At least, keeping the link is required for Intel AMT and WoL.
2021-11-05 01:53:30 +00:00
andvar 8135609163 Add missing RCSID and __KERNEL_RCSID(). 2021-08-25 21:50:29 +00:00
andvar ca7653601e fix various typos in comments and log messages. 2021-08-20 20:25:26 +00:00
thorpej c7fb772b85 Merge thorpej-cfargs2. 2021-08-07 16:18:40 +00:00
pgoyette b6ad7b596e Regen for new sys/dev/devlist2h.awk 2021-06-29 21:04:02 +00:00
pgoyette 74007e33ee Rework the xxxVERBOSE option to share the common module-hook-based
verbose mechanism with MIIVERBOSE.  This reduces some duplicated code
and allows us to once again permit auto-unload of MIIVERBOSE.

Change details:
* Update dev/devlist2h.awk to accomodate miidevs, including generation
  of MII_STR_oui_model definitions and use of oui and model rather than
  vendor and product.  This also changes the compressed data in the
  xxxdevs_data.h files to uint32_t (since mii oui's are up to 6 hex
  digits long)
* Update a couple of phy drivers to use new calls to get verbose data
* Regen all of the xxxdevs{,_data}.h files (separate commit, coming
  very soon)
* Update mii/mii_verbose.[ch] and mii/mii_physubr.c to use the various
  DEV_VERBOSE_xxx macros
* Update the pci, usb, and hdaudio code as needed, to #include the
  xxxdevs.h files (in order to get the proper printf format strings)
* Since dev/dev_verbose.c now uses non-literal printf format strings,
  (to deal with the vendor/product vs oui/model issue), we need to
  make sure it gets compiled with -Wno-error=format-nonliteral, even
  in userland's libpci and librumpdev!
* Bump kernel version for the change in module interfaces

Welcome to 9.99.86!

XXX It might be useful in the future to extend the MII_STR_oui_model
XXX definitions to PCI as well (and perhaps USB and HDAUDIO).  This
XXX would allow for a single centralized location for the products'
XXX descriptions, rather than being dispersed among individual
XXX drivers' xxx_match tables.
2021-06-29 21:03:36 +00:00
pgoyette 8c69265ead Ooopppsss - typo! 2021-06-05 22:45:03 +00:00
pgoyette 202be4ee97 As with usbverbose and pciverbose, these modules are not safe to be
auto-unloaded.  Disable for now.

All of these need to be updated with an appropriate refcount mechanism
to ensure that the code and/or tables aren't unloaded while they are
being used.
2021-06-05 22:21:15 +00:00
thorpej 2685996b0e Merge thorpej-cfargs branch:
Simplify and make extensible the config_search() / config_found() /
config_attach() interfaces: rather than having different variants for
which arguments you want pass along, just have a single call that
takes a variadic list of tag-value arguments.

Adjust all call sites:
- Simplify wherever possible; don't pass along arguments that aren't
  actually needed.
- Don't be explicit about what interface attribute is attaching if
  the device only has one.  (More simplification.)
- Add a config_probe() function to be used in indirect configuiration
  situations, making is visibly easier to see when indirect config is
  in play, and allowing for future change in semantics.  (As of now,
  this is just a wrapper around config_match(), but that is an
  implementation detail.)

Remove unnecessary or redundant interface attributes where they're not
needed.

There are currently 5 "cfargs" defined:
- CFARG_SUBMATCH (submatch function for direct config)
- CFARG_SEARCH (search function for indirect config)
- CFARG_IATTR (interface attribte)
- CFARG_LOCATORS (locators array)
- CFARG_DEVHANDLE (devhandle_t - wraps OFW, ACPI, etc. handles)

...and a sentinel value CFARG_EOL.

Add some extra sanity checking to ensure that interface attributes
aren't ambiguous.

Use CFARG_DEVHANDLE in MI FDT, OFW, and ACPI code, and macppc and shark
ports to associate those device handles with device_t instance.  This
will trickle trough to more places over time (need back-end for pre-OFW
Sun OBP; any others?).
2021-04-24 23:36:23 +00:00
msaitoh c8b8553e08 Fix a bug that "ifconfig xx0 media none" set LINK_STATE_UNKNOWN instead of
LINK_STATE_DOWN.

XXX We should check for other PHY drivers, too.
2020-11-04 09:15:10 +00:00
msaitoh 6b533c04da Add Intel I347-AT4. 2020-10-20 08:53:34 +00:00
msaitoh c30bad5e0d Add a workaround for jumbo frame on PCH2 and newer. Tested by chs@.
- Add wm_lv_jumbo_workaround_ich8lan() and use it. From FreeBSD.

  XXX For KUMCTRLSTA_OFFSET_HD_CTRL register modification, it's doubtful.
  FreeBSD and Linux do the same thing that they set the same value on both
  jumbo frame's enable case and the disable case. It seems the default value
  is 0x0b0c and it's not changed on the enable case, so it might be a bug
  on the enable case or the modification is not required.

- Rename I219_UNKNOWN1 to I82579_UNKNOWN1.
2020-09-16 15:04:01 +00:00
kardel f33b2e8145 Move mii_phy_statusmsg(sc) back to its original position. Fixes
deafness bug on macppc reported and tested by martin@
Thanks !
2020-08-27 10:10:23 +00:00
kardel 634cbaafea Keep the change check invariant intact. The previous code could miss
status updates by picking up a new status different from the tested
status. This left addresses in the DETACHED state although the
link status is already UP again.

addresses PR/kern 55538
2020-08-24 12:46:04 +00:00
msaitoh 1d6d3e383e Remove extra PHY_RESET(sc) in the MII_TICK path because it's not requierd
to just restart autonego.
2020-08-24 04:49:05 +00:00
msaitoh 600be1acda Don't do full initialization for autonego when just restarting autonego
because it's not required.

 This change reduce extra initialization which include PHY_RESET() which
caused long delay(max 500ms).
2020-08-24 04:23:41 +00:00
uwe 4e04df6ed9 mii_knowndevs[] is de facto const, define it as such.
This time for real.  On my first try I did it in the generated
miidevs_data.h file.
2020-08-04 04:22:02 +00:00
uwe 6d258dd428 mii_knowndevs[] is de facto const, define it as such. 2020-08-03 14:00:41 +00:00
msaitoh e178001a00 Rename PSSR_* to MAKPHY_PSSR_* and IGPHY_PSSR_* to avoid conflict.
No functional change.
2020-08-03 07:25:59 +00:00
msaitoh bce8b71104 s/MII_IGPHY_/IGPHY_/. No functional change. 2020-08-03 07:16:51 +00:00
msaitoh d245628f58 - Remove the waitfor argument from mii_phy_auto().
- Whitespace fix.
2020-07-07 08:44:12 +00:00
msaitoh 53f3973f63 - Call tlphy_auto correctly.
- It's not required to do busy-wait by mii_phy_auto(sc, 1). Now there is
 no any PHY driver which calls mii_phy_auto(sc, 1).
2020-07-07 08:35:16 +00:00
msaitoh 1f74e5c827 "no media present" is intended case on tlphy(4), so don't use
aprint_error_dev().
2020-07-07 06:59:22 +00:00