Author: marius
Date: Sat Oct  8 12:33:10 2011
New Revision: 226154
URL: http://svn.freebsd.org/changeset/base/226154

Log:
  - Follow the lead of dcphy(4) and pnphy(4) and move the reminder of the PHY
    drivers that only ever attach to a particular MAC driver, i.e. inphy(4),
    ruephy(4) and xlphy(4), to the directory where the respective MAC driver
    lives and only compile it into the kernel when the latter is also there,
    also removing it from miibus.ko and moving it into the module of the
    respective MAC driver.
  - While at it, rename exphy.c, which comes from NetBSD where the MAC driver
    it corresponds to also is named ex(4) instead of xl(4) but that in FreeBSD
    actually identifies itself as xlphy(4), and its function names accordingly
    for consistency.
  - Additionally while at it, fix some minor style issues like whitespace
    in the register headers and add multi-inclusion protection to inphyreg.h.

Added:
  head/sys/dev/fxp/inphy.c
     - copied, changed from r226118, head/sys/dev/mii/inphy.c
  head/sys/dev/fxp/inphyreg.h
     - copied, changed from r226118, head/sys/dev/mii/inphyreg.h
  head/sys/dev/usb/net/ruephy.c
     - copied, changed from r226118, head/sys/dev/mii/ruephy.c
  head/sys/dev/usb/net/ruephyreg.h
     - copied, changed from r226118, head/sys/dev/mii/ruephyreg.h
  head/sys/dev/xl/xlphy.c
     - copied, changed from r226118, head/sys/dev/mii/exphy.c
Deleted:
  head/sys/dev/mii/exphy.c
  head/sys/dev/mii/inphy.c
  head/sys/dev/mii/inphyreg.h
  head/sys/dev/mii/ruephy.c
  head/sys/dev/mii/ruephyreg.h
Modified:
  head/sys/conf/files
  head/sys/modules/fxp/Makefile
  head/sys/modules/mii/Makefile
  head/sys/modules/usb/rue/Makefile
  head/sys/modules/xl/Makefile

Modified: head/sys/conf/files
==============================================================================
--- head/sys/conf/files Sat Oct  8 12:28:06 2011        (r226153)
+++ head/sys/conf/files Sat Oct  8 12:33:10 2011        (r226154)
@@ -1092,6 +1092,7 @@ dev/firewire/sbp_targ.c           optional sbp_ta
 dev/flash/at45d.c              optional at45d
 dev/flash/mx25l.c              optional mx25l
 dev/fxp/if_fxp.c               optional fxp
+dev/fxp/inphy.c                        optional fxp
 dev/gem/if_gem.c               optional gem
 dev/gem/if_gem_pci.c           optional gem pci
 dev/gem/if_gem_sbus.c          optional gem sbus
@@ -1418,12 +1419,8 @@ dev/mii/bmtphy.c         optional miibus | bmtp
 dev/mii/brgphy.c               optional miibus | brgphy
 dev/mii/ciphy.c                        optional miibus | ciphy
 dev/mii/e1000phy.c             optional miibus | e1000phy
-# XXX only xl cards?
-dev/mii/exphy.c                        optional miibus | exphy
 dev/mii/gentbi.c               optional miibus | gentbi
 dev/mii/icsphy.c               optional miibus | icsphy
-# XXX only fxp cards?
-dev/mii/inphy.c                        optional miibus | inphy
 dev/mii/ip1000phy.c            optional miibus | ip1000phy
 dev/mii/jmphy.c                        optional miibus | jmphy
 dev/mii/lxtphy.c               optional miibus | lxtphy
@@ -1440,8 +1437,6 @@ dev/mii/rdcphy.c          optional miibus | rdcp
 dev/mii/rgephy.c               optional miibus | rgephy
 dev/mii/rlphy.c                        optional miibus | rlphy
 dev/mii/rlswitch.c             optional rlswitch
-# XXX rue only?
-dev/mii/ruephy.c               optional miibus | ruephy
 dev/mii/smcphy.c               optional miibus | smcphy
 dev/mii/tdkphy.c               optional miibus | tdkphy
 dev/mii/tlphy.c                        optional miibus | tlphy
@@ -1924,6 +1919,7 @@ dev/usb/net/if_mos.c              optional mos
 dev/usb/net/if_rue.c           optional rue
 dev/usb/net/if_udav.c          optional udav
 dev/usb/net/if_usie.c          optional usie
+dev/usb/net/ruephy.c           optional rue
 dev/usb/net/usb_ethernet.c     optional aue | axe | cdce | cue | kue | mos | \
                                         rue | udav
 dev/usb/net/uhso.c             optional uhso
@@ -2062,6 +2058,7 @@ wpi.fw                    optional wpifw                  
                \
 dev/xe/if_xe.c                 optional xe
 dev/xe/if_xe_pccard.c          optional xe pccard
 dev/xl/if_xl.c                 optional xl pci
+dev/xl/xlphy.c                 optional xl pci
 fs/coda/coda_fbsd.c            optional vcoda
 fs/coda/coda_psdev.c           optional vcoda
 fs/coda/coda_subr.c            optional vcoda

Copied and modified: head/sys/dev/fxp/inphy.c (from r226118, 
head/sys/dev/mii/inphy.c)
==============================================================================
--- head/sys/dev/mii/inphy.c    Fri Oct  7 21:23:42 2011        (r226118, copy 
source)
+++ head/sys/dev/fxp/inphy.c    Sat Oct  8 12:33:10 2011        (r226154)
@@ -49,7 +49,7 @@ __FBSDID("$FreeBSD$");
 #include <dev/mii/miivar.h>
 #include "miidevs.h"
 
-#include <dev/mii/inphyreg.h>
+#include <dev/fxp/inphyreg.h>
 
 #include "miibus_if.h"
 

Copied and modified: head/sys/dev/fxp/inphyreg.h (from r226118, 
head/sys/dev/mii/inphyreg.h)
==============================================================================
--- head/sys/dev/mii/inphyreg.h Fri Oct  7 21:23:42 2011        (r226118, copy 
source)
+++ head/sys/dev/fxp/inphyreg.h Sat Oct  8 12:33:10 2011        (r226154)
@@ -29,7 +29,12 @@
  *     $FreeBSD$
  */
 
-#define MII_INPHY_SCR           0x10    /* status and control register */
-#define SCR_FLOWCTL            0x8000
-#define SCR_S100               0x0002  /* autonegotiated speed */
-#define SCR_FDX                        0x0001  /* autonegotiated duplex */
+#ifndef _INPHYREG_H
+#define        _INPHYREG_H
+
+#define        MII_INPHY_SCR           0x10    /* status and control register 
*/
+#define        SCR_FLOWCTL             0x8000
+#define        SCR_S100                0x0002  /* autonegotiated speed */
+#define        SCR_FDX                 0x0001  /* autonegotiated duplex */
+
+#endif

Copied and modified: head/sys/dev/usb/net/ruephy.c (from r226118, 
head/sys/dev/mii/ruephy.c)
==============================================================================
--- head/sys/dev/mii/ruephy.c   Fri Oct  7 21:23:42 2011        (r226118, copy 
source)
+++ head/sys/dev/usb/net/ruephy.c       Sat Oct  8 12:33:10 2011        
(r226154)
@@ -48,8 +48,7 @@ __FBSDID("$FreeBSD$");
 #include <dev/mii/miivar.h>
 #include "miidevs.h"
 
-#include <machine/bus.h>
-#include <dev/mii/ruephyreg.h>
+#include <dev/usb/net/ruephyreg.h>
 
 #include "miibus_if.h"
 

Copied and modified: head/sys/dev/usb/net/ruephyreg.h (from r226118, 
head/sys/dev/mii/ruephyreg.h)
==============================================================================
--- head/sys/dev/mii/ruephyreg.h        Fri Oct  7 21:23:42 2011        
(r226118, copy source)
+++ head/sys/dev/usb/net/ruephyreg.h    Sat Oct  8 12:33:10 2011        
(r226154)
@@ -27,12 +27,12 @@
  */
 
 #ifndef _RUEPHYREG_H_
-#define _RUEPHYREG_H_
+#define        _RUEPHYREG_H_
 
-#define RUEPHY_MII_MSR         0x0137  /* B, R/W */
-#define RUEPHY_MSR_RXFCE       0x40
-#define RUEPHY_MSR_DUPLEX      0x10
-#define RUEPHY_MSR_SPEED100    0x08
-#define RUEPHY_MSR_LINK                0x04
+#define        RUEPHY_MII_MSR          0x0137  /* B, R/W */
+#define        RUEPHY_MSR_RXFCE        0x40
+#define        RUEPHY_MSR_DUPLEX       0x10
+#define        RUEPHY_MSR_SPEED100     0x08
+#define        RUEPHY_MSR_LINK         0x04
 
 #endif /* _RUEPHYREG_H_ */

Copied and modified: head/sys/dev/xl/xlphy.c (from r226118, 
head/sys/dev/mii/exphy.c)
==============================================================================
--- head/sys/dev/mii/exphy.c    Fri Oct  7 21:23:42 2011        (r226118, copy 
source)
+++ head/sys/dev/xl/xlphy.c     Sat Oct  8 12:33:10 2011        (r226154)
@@ -77,30 +77,30 @@ __FBSDID("$FreeBSD$");
 
 #include "miibus_if.h"
 
-static int exphy_probe(device_t);
-static int exphy_attach(device_t);
+static int xlphy_probe(device_t);
+static int xlphy_attach(device_t);
 
-static device_method_t exphy_methods[] = {
+static device_method_t xlphy_methods[] = {
        /* device interface */
-       DEVMETHOD(device_probe,         exphy_probe),
-       DEVMETHOD(device_attach,        exphy_attach),
+       DEVMETHOD(device_probe,         xlphy_probe),
+       DEVMETHOD(device_attach,        xlphy_attach),
        DEVMETHOD(device_detach,        mii_phy_detach),
        DEVMETHOD(device_shutdown,      bus_generic_shutdown),
        { 0, 0 }
 };
 
-static devclass_t exphy_devclass;
+static devclass_t xlphy_devclass;
 
-static driver_t exphy_driver = {
+static driver_t xlphy_driver = {
        "xlphy",
-       exphy_methods,
+       xlphy_methods,
        sizeof(struct mii_softc)
 };
 
-DRIVER_MODULE(xlphy, miibus, exphy_driver, exphy_devclass, 0, 0);
+DRIVER_MODULE(xlphy, miibus, xlphy_driver, xlphy_devclass, 0, 0);
 
-static int     exphy_service(struct mii_softc *, struct mii_data *, int);
-static void    exphy_reset(struct mii_softc *);
+static int     xlphy_service(struct mii_softc *, struct mii_data *, int);
+static void    xlphy_reset(struct mii_softc *);
 
 /*
  * Some 3Com internal PHYs report zero for OUI and model, others use
@@ -109,42 +109,42 @@ static void       exphy_reset(struct mii_softc
  * handled fine by ukphy(4); they can be isolated and don't require
  * special treatment after reset.
  */
-static const struct mii_phydesc exphys[] = {
+static const struct mii_phydesc xlphys[] = {
        { 0, 0, "3Com internal media interface" },
        MII_PHY_DESC(xxBROADCOM, 3C905C),
        MII_PHY_END
 };
 
-static const struct mii_phy_funcs exphy_funcs = {
-       exphy_service,
+static const struct mii_phy_funcs xlphy_funcs = {
+       xlphy_service,
        ukphy_status,
-       exphy_reset
+       xlphy_reset
 };
 
 static int
-exphy_probe(device_t dev)
+xlphy_probe(device_t dev)
 {
 
        if (strcmp(device_get_name(device_get_parent(device_get_parent(dev))),
            "xl") == 0)
-               return (mii_phy_dev_probe(dev, exphys, BUS_PROBE_DEFAULT));
+               return (mii_phy_dev_probe(dev, xlphys, BUS_PROBE_DEFAULT));
        return (ENXIO);
 }
 
 static int
-exphy_attach(device_t dev)
+xlphy_attach(device_t dev)
 {
 
        /*
         * The 3Com PHY can never be isolated.
         */
        mii_phy_dev_attach(dev, MIIF_NOISOLATE | MIIF_NOMANPAUSE,
-           &exphy_funcs, 1);
+           &xlphy_funcs, 1);
        return (0);
 }
 
 static int
-exphy_service(struct mii_softc *sc, struct mii_data *mii, int cmd)
+xlphy_service(struct mii_softc *sc, struct mii_data *mii, int cmd)
 {
 
        switch (cmd) {
@@ -184,7 +184,7 @@ exphy_service(struct mii_softc *sc, stru
 }
 
 static void
-exphy_reset(struct mii_softc *sc)
+xlphy_reset(struct mii_softc *sc)
 {
 
        mii_phy_reset(sc);

Modified: head/sys/modules/fxp/Makefile
==============================================================================
--- head/sys/modules/fxp/Makefile       Sat Oct  8 12:28:06 2011        
(r226153)
+++ head/sys/modules/fxp/Makefile       Sat Oct  8 12:33:10 2011        
(r226154)
@@ -3,6 +3,6 @@
 .PATH: ${.CURDIR}/../../dev/fxp
 
 KMOD=  if_fxp
-SRCS=  if_fxp.c device_if.h bus_if.h pci_if.h miibus_if.h
+SRCS=  device_if.h bus_if.h if_fxp.c inphy.c miibus_if.h miidevs.h pci_if.h
 
 .include <bsd.kmod.mk>

Modified: head/sys/modules/mii/Makefile
==============================================================================
--- head/sys/modules/mii/Makefile       Sat Oct  8 12:28:06 2011        
(r226153)
+++ head/sys/modules/mii/Makefile       Sat Oct  8 12:33:10 2011        
(r226154)
@@ -5,10 +5,10 @@
 KMOD=  miibus
 SRCS=  acphy.c amphy.c atphy.c axphy.c bmtphy.c brgphy.c bus_if.h
 SRCS+= ciphy.c device_if.h
-SRCS+= e1000phy.c exphy.c gentbi.c icsphy.c inphy.c ip1000phy.c jmphy.c
+SRCS+= e1000phy.c gentbi.c icsphy.c ip1000phy.c jmphy.c
 SRCS+= lxtphy.c miibus_if.c miibus_if.h mii.c miidevs.h mii_physubr.c
 SRCS+= mlphy.c nsgphy.c nsphy.c nsphyter.c pci_if.h pnaphy.c qsphy.c
-SRCS+= rdcphy.c rgephy.c rlphy.c ruephy.c tdkphy.c tlphy.c truephy.c
+SRCS+= rdcphy.c rgephy.c rlphy.c tdkphy.c tlphy.c truephy.c
 SRCS+= ukphy.c ukphy_subr.c
 SRCS+= xmphy.c
 

Modified: head/sys/modules/usb/rue/Makefile
==============================================================================
--- head/sys/modules/usb/rue/Makefile   Sat Oct  8 12:28:06 2011        
(r226153)
+++ head/sys/modules/usb/rue/Makefile   Sat Oct  8 12:33:10 2011        
(r226154)
@@ -30,8 +30,7 @@ S=     ${.CURDIR}/../../..
 .PATH: $S/dev/usb/net
 
 KMOD=  if_rue
-SRCS=  opt_bus.h opt_usb.h device_if.h bus_if.h usb_if.h usbdevs.h \
-       miibus_if.h opt_inet.h \
-       if_rue.c
+SRCS=  bus_if.h device_if.h miibus_if.h miidevs.h if_rue.c opt_bus.h
+SRCS+= opt_inet.h opt_usb.h ruephy.c usb_if.h usbdevs.h
 
 .include <bsd.kmod.mk>

Modified: head/sys/modules/xl/Makefile
==============================================================================
--- head/sys/modules/xl/Makefile        Sat Oct  8 12:28:06 2011        
(r226153)
+++ head/sys/modules/xl/Makefile        Sat Oct  8 12:33:10 2011        
(r226154)
@@ -3,7 +3,6 @@
 .PATH: ${.CURDIR}/../../dev/xl
 
 KMOD=  if_xl
-SRCS=  if_xl.c device_if.h bus_if.h pci_if.h
-SRCS+= miibus_if.h
+SRCS=  bus_if.h device_if.h if_xl.c miibus_if.h miidevs.h pci_if.h xlphy.c
 
 .include <bsd.kmod.mk>
_______________________________________________
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to