summaryrefslogtreecommitdiffstats
path: root/sys/modules/mii
diff options
context:
space:
mode:
authorwpaul <wpaul@FreeBSD.org>1999-08-21 17:40:53 +0000
committerwpaul <wpaul@FreeBSD.org>1999-08-21 17:40:53 +0000
commitcdea47dc6eedf22eb73e5b4675affbc31669814e (patch)
tree52556fc37b962523cea5a60841a8698aa96054e7 /sys/modules/mii
parent2cf7e92c711cd5cfa74fa596ee64157497f96bf3 (diff)
downloadFreeBSD-src-cdea47dc6eedf22eb73e5b4675affbc31669814e.zip
FreeBSD-src-cdea47dc6eedf22eb73e5b4675affbc31669814e.tar.gz
This commit adds support for the NetBSD MII abstraction layer and
MII-compliant PHY drivers. Many 10/100 ethernet NICs available today either use an MII transceiver or have built-in transceivers that can be programmed using an MII interface. It makes sense then to separate this support out into common code instead of duplicating it in all of the NIC drivers. The mii code also handles all of the media detection, selection and reporting via the ifmedia interface. This is basically the same code from NetBSD's /sys/dev/mii, except it's been adapted to FreeBSD's bus architecture. The advantage to this is that it automatically allows everything to be turned into a loadable module. There are some common functions for use in drivers once an miibus has been attached (mii_mediachg(), mii_pollstat(), mii_tick()) as well as individual PHY drivers. There is also a generic driver for all PHYs that aren't handled by a specific driver. It's possible to do this because all 10/100 PHYs implement the same general register set in addition to their vendor-specific register sets, so for the most part you can use one driver for pretty much any PHY. There are a couple of oddball exceptions though, hence the need to have specific drivers. There are two layers: the generic "miibus" layer and the PHY driver layer. The drivers are child devices of "miibus" and the "miibus" is a child of a given NIC driver. The "miibus" code and the PHY drivers can actually be compiled and kldoaded as completely separate modules or compiled together into one module. For the moment I'm using the latter approach since the code is relatively small. Currently there are only three PHY drivers here: the generic driver, the built-in 3Com XL driver and the NS DP83840 driver. I'll be adding others later as I convert various NIC drivers to use this code. I realize that I'm cvs adding this stuff instead of importing it onto a separate vendor branch, but in my opinion the import approach doesn't really offer any significant advantage: I'm going to be maintaining this stuff and writing my own PHY drivers one way or the other.
Diffstat (limited to 'sys/modules/mii')
-rw-r--r--sys/modules/mii/Makefile23
1 files changed, 23 insertions, 0 deletions
diff --git a/sys/modules/mii/Makefile b/sys/modules/mii/Makefile
new file mode 100644
index 0000000..f4528e2
--- /dev/null
+++ b/sys/modules/mii/Makefile
@@ -0,0 +1,23 @@
+# $Id: Makefile,v 1.1 1999/07/23 05:48:01 wpaul Exp $
+
+S = ${.CURDIR}/../..
+.PATH: $S/dev/mii
+KMOD = mii
+SRCS = mii.c mii_physubr.c ukphy.c ukphy_subr.c bus_if.h
+SRCS += miibus_if.h device_if.h miibus_if.c exphy.c nsphy.c
+CLEANFILES += device_if.h bus_if.h miibus_if.h miibus_if.c
+CFLAGS += ${DEBUG_FLAGS}
+
+device_if.h: $S/kern/makedevops.pl $S/kern/device_if.m
+ perl $S/kern/makedevops.pl -h $S/kern/device_if.m
+
+bus_if.h: $S/kern/makedevops.pl $S/kern/bus_if.m
+ perl $S/kern/makedevops.pl -h $S/kern/bus_if.m
+
+miibus_if.h: $S/kern/makedevops.pl $S/dev/mii/miibus_if.m
+ perl $S/kern/makedevops.pl -h $S/dev/mii/miibus_if.m
+
+miibus_if.c: $S/kern/makedevops.pl $S/dev/mii/miibus_if.m
+ perl $S/kern/makedevops.pl -c $S/dev/mii/miibus_if.m
+
+.include <bsd.kmod.mk>
OpenPOWER on IntegriCloud