diff options
author | marius <marius@FreeBSD.org> | 2007-01-20 00:55:03 +0000 |
---|---|---|
committer | marius <marius@FreeBSD.org> | 2007-01-20 00:55:03 +0000 |
commit | 536c29257b4ebc40eba977edc25de18a8a284275 (patch) | |
tree | 0d8314e56b0cd494a93db7fb64e528dcd1530ecf /sys/dev/mii | |
parent | 8b9041b642394dd10b8ed7a1b34e258fe8ac78f3 (diff) | |
download | FreeBSD-src-536c29257b4ebc40eba977edc25de18a8a284275.zip FreeBSD-src-536c29257b4ebc40eba977edc25de18a8a284275.tar.gz |
- In miibus_attach() remove IFM_IMASK from the dontcare_mask of the
ifmedia_init() invocation. IFM_IMASK makes only sense here when all of
the maxium of 32 PHYs on each one MII bus support disjoint sets of media,
which generally isn't the case (though it would be nice if we had a way
to let NIC drivers indicate that for the few card models where the PHY
configuration is known/fixed and IFM_IMASK actually makes sense).
- Add and use a miibus_print_child() for the bus_print_child method which
additionally prints the PHY number (which actually is the PHY address)
so one can figure out the media instance <-> PHY number mapping from the
PHY driver attach output. This is intented to be usefull in situations
where the addresses of the PHYs on the bus are known (f.e. of internal/
integrated PHYs) so one can feed the appropriate media instance number
to ifconfig(8) (with the upcoming change for ifconfig(8)).
This is more or less inspired by the NetBSD mii_print().
Diffstat (limited to 'sys/dev/mii')
-rw-r--r-- | sys/dev/mii/mii.c | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/sys/dev/mii/mii.c b/sys/dev/mii/mii.c index 2511068..d88ddc9 100644 --- a/sys/dev/mii/mii.c +++ b/sys/dev/mii/mii.c @@ -64,6 +64,7 @@ MODULE_VERSION(miibus, 1); #include "miibus_if.h" +static int miibus_print_child(device_t dev, device_t child); static int miibus_child_location_str(device_t bus, device_t child, char *buf, size_t buflen); static int miibus_child_pnpinfo_str(device_t bus, device_t child, char *buf, @@ -82,7 +83,7 @@ static device_method_t miibus_methods[] = { DEVMETHOD(device_shutdown, bus_generic_shutdown), /* bus interface */ - DEVMETHOD(bus_print_child, bus_generic_print_child), + DEVMETHOD(bus_print_child, miibus_print_child), DEVMETHOD(bus_driver_added, bus_generic_driver_added), DEVMETHOD(bus_child_pnpinfo_str, miibus_child_pnpinfo_str), DEVMETHOD(bus_child_location_str, miibus_child_location_str), @@ -179,7 +180,7 @@ miibus_attach(device_t dev) v = device_get_ivars(dev); ifmedia_upd = v[0]; ifmedia_sts = v[1]; - ifmedia_init(&mii->mii_media, IFM_IMASK, ifmedia_upd, ifmedia_sts); + ifmedia_init(&mii->mii_media, 0, ifmedia_upd, ifmedia_sts); bus_generic_attach(dev); return(0); @@ -199,6 +200,20 @@ miibus_detach(device_t dev) } static int +miibus_print_child(device_t dev, device_t child) +{ + struct mii_attach_args *ma; + int retval; + + ma = device_get_ivars(child); + retval = bus_print_child_header(dev, child); + retval += printf(" PHY %d", ma->mii_phyno); + retval += bus_print_child_footer(dev, child); + + return (retval); +} + +static int miibus_child_pnpinfo_str(device_t bus, device_t child, char *buf, size_t buflen) { |