summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authormarius <marius@FreeBSD.org>2011-10-08 12:33:10 +0000
committermarius <marius@FreeBSD.org>2011-10-08 12:33:10 +0000
commit07ac74d257832436e5d62b6a367e914e7b885db8 (patch)
treed092c392cb4048b55d5299cf6e1cdf2d236f5376 /sys
parentd905bcbba92d530f4fc057a29b74755a8ae49382 (diff)
downloadFreeBSD-src-07ac74d257832436e5d62b6a367e914e7b885db8.zip
FreeBSD-src-07ac74d257832436e5d62b6a367e914e7b885db8.tar.gz
- 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.
Diffstat (limited to 'sys')
-rw-r--r--sys/conf/files9
-rw-r--r--sys/dev/fxp/inphy.c (renamed from sys/dev/mii/inphy.c)2
-rw-r--r--sys/dev/fxp/inphyreg.h (renamed from sys/dev/mii/inphyreg.h)13
-rw-r--r--sys/dev/usb/net/ruephy.c (renamed from sys/dev/mii/ruephy.c)3
-rw-r--r--sys/dev/usb/net/ruephyreg.h (renamed from sys/dev/mii/ruephyreg.h)12
-rw-r--r--sys/dev/xl/xlphy.c (renamed from sys/dev/mii/exphy.c)42
-rw-r--r--sys/modules/fxp/Makefile2
-rw-r--r--sys/modules/mii/Makefile4
-rw-r--r--sys/modules/usb/rue/Makefile5
-rw-r--r--sys/modules/xl/Makefile3
10 files changed, 47 insertions, 48 deletions
diff --git a/sys/conf/files b/sys/conf/files
index 67c01bc..90e7b76 100644
--- a/sys/conf/files
+++ b/sys/conf/files
@@ -1092,6 +1092,7 @@ dev/firewire/sbp_targ.c optional sbp_targ
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 | bmtphy
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 | rdcphy
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
diff --git a/sys/dev/mii/inphy.c b/sys/dev/fxp/inphy.c
index e6a601c..587f3fd 100644
--- a/sys/dev/mii/inphy.c
+++ b/sys/dev/fxp/inphy.c
@@ -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"
diff --git a/sys/dev/mii/inphyreg.h b/sys/dev/fxp/inphyreg.h
index 4b7d1f1..42c683d 100644
--- a/sys/dev/mii/inphyreg.h
+++ b/sys/dev/fxp/inphyreg.h
@@ -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
diff --git a/sys/dev/mii/ruephy.c b/sys/dev/usb/net/ruephy.c
index a0d5441..64150a5 100644
--- a/sys/dev/mii/ruephy.c
+++ b/sys/dev/usb/net/ruephy.c
@@ -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"
diff --git a/sys/dev/mii/ruephyreg.h b/sys/dev/usb/net/ruephyreg.h
index 5f3911b..01d3cc1 100644
--- a/sys/dev/mii/ruephyreg.h
+++ b/sys/dev/usb/net/ruephyreg.h
@@ -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_ */
diff --git a/sys/dev/mii/exphy.c b/sys/dev/xl/xlphy.c
index 04add67..e5ac9fc 100644
--- a/sys/dev/mii/exphy.c
+++ b/sys/dev/xl/xlphy.c
@@ -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, struct mii_data *mii, int cmd)
}
static void
-exphy_reset(struct mii_softc *sc)
+xlphy_reset(struct mii_softc *sc)
{
mii_phy_reset(sc);
diff --git a/sys/modules/fxp/Makefile b/sys/modules/fxp/Makefile
index b80c3ec..283b638 100644
--- a/sys/modules/fxp/Makefile
+++ b/sys/modules/fxp/Makefile
@@ -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>
diff --git a/sys/modules/mii/Makefile b/sys/modules/mii/Makefile
index 2dd9811..b0cfc12 100644
--- a/sys/modules/mii/Makefile
+++ b/sys/modules/mii/Makefile
@@ -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
diff --git a/sys/modules/usb/rue/Makefile b/sys/modules/usb/rue/Makefile
index 258df6f..e7e236e 100644
--- a/sys/modules/usb/rue/Makefile
+++ b/sys/modules/usb/rue/Makefile
@@ -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>
diff --git a/sys/modules/xl/Makefile b/sys/modules/xl/Makefile
index 3898ad4..417f3fc 100644
--- a/sys/modules/xl/Makefile
+++ b/sys/modules/xl/Makefile
@@ -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>
OpenPOWER on IntegriCloud