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.
- 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.
- 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.
- 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.
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.
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.
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?).
- 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.
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
- MP-safe drivers provide a mutex to ifmedia that is used to serialize
access to media-related structures / hardware regsiters. Converted
drivers use the new ifmedia_init_with_lock() function for this. The
new name is provided to ease the transition.
- Un-converted drivers continue to call ifmedia_init(), which will supply
a compatibility lock to be used instead. Several media-related entry
points must be aware of this compatibility lock, and are able to acquire
it recursively a limited number of times, if needed. This is a SPIN
mutex with priority IPL_NET.
- This same lock is used to serialize access to PHY registers and other
MII-related data structures.
The PHY drivers are modified to acquire and release the lock, as needed,
and assert the lock is held as a diagnostic aid.
The "usbnet" framework has had an overhaul of its internal locking
protocols to fit in with the media / mii changes, and the drivers adapted.
USB wifi drivers have been changed to provide their own adaptive mutex
to the ifmedia later via a new ieee80211_media_init_with_lock() function.
This is required because the USB drivers need an adaptive mutex.
Besised "usbnet", a few other drivers are converted: vmx, wm, ixgbe / ixv.
mcx also now calls ifmedia_init_with_lock() because it needs to also use
an adaptive mutex. The mcx driver still needs to be fully converted to
NET_MPSAFE.
Reported by Rocky Hotas.
- On ASUS M2N-MX SE Plus (NVIDIA MCP61 with Attansic L2 rev. 1), changing
debug port 0x29's value makes the next PHY read fail with error. Read any
register to ignore this problem if the PHY is Attansic L2 revision 1.
I don't know if this problem is from L2 rev. 1 itself or from the
combination because I have only one machine which has L2 rev. "1".
At least, ASUS eee pc 900 (Attansic L2 rev. "2") has no this problem.
- Add comment. AR8021 document has no description about the power saving
control register(debug port 0x29).
- Add comment. AR8031 document says the lower 14 bits are reserved and the
default value is 0x36d0. Shouldn't we clear those bits?
- I have no document neither L1(F1) nor L2(F2), so I don't know whether the
debug port access is correct or not.
Tested with the following machines:
- ASUS P5B SE, L1 rev. 5, age(4)
- ASUS K50IJ, L1 rev. 9, ale(4)
- ASUS eee pc 900, L2 rev. 2, lii(4)
- ASUS M2N-MX SE Plus, L2 rev. 1, nfe(4)
- Intel DP55WB, 82578(AR8021 rev. 2), wm(4)
- Dell inspiron 14z, AR0835 rev. 9, alc(4)
I don't know if the reset is required or not. I tested some media
transitions without the reset and it worked. It might be OK to remove
but Linux does it only in et1011c_config_aneg(). So move the reset to
etphy_service(,,MII_MEDIACHG)'s autonego case. This change is also
required for future locking changes.