This commit adds driver support for PCI fast ethernet NICs based on

the Davicom DM9100 and DM9102 chipsets, including the Jaton Corporation
XPressNet. Datasheet is available from www.davicom8.com.

The DM910x chips are still more tulip clones. The API is reproduced
pretty faithfully, unfortunately the performance is pretty bad. The
transmitter seems to have a lot of problems DMAing multi-fragment
packets. The only way to make it work reliably is to coalesce transmitted
packets into a single contiguous buffer. The Linux driver (written by
Davicom) actually does something similar to this. I can't recomment this
NIC as anything more than a "connectivity solution."

This driver uses newbus and miibus and is supported on both i386
and alpha platforms.
This commit is contained in:
Bill Paul 1999-09-06 06:14:30 +00:00
parent cb0ec4da2e
commit e5a9fd5435
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=50986
21 changed files with 2507 additions and 3 deletions

View File

@ -89,6 +89,7 @@ static struct _devname {
{ DEVICE_TYPE_NETWORK, "cc3i", "SDL HSSI sync serial PCI card" },
{ DEVICE_TYPE_NETWORK, "en", "Efficient Networks ATM PCI card" },
{ DEVICE_TYPE_NETWORK, "de", "DEC DE435 PCI NIC or other DC21040-AA based card" },
{ DEVICE_TYPE_NETWORK, "dm", "Davicom DM9100/DM9102 PCI fast ethernet card" },
{ DEVICE_TYPE_NETWORK, "fxp", "Intel EtherExpress Pro/100B PCI Fast Ethernet card" },
{ DEVICE_TYPE_NETWORK, "ed", "Novell NE1000/2000; 3C503; NE2000-compatible PCMCIA" },
{ DEVICE_TYPE_NETWORK, "ep", "3Com 3C509 ethernet card/3C589 PCMCIA" },

View File

@ -90,6 +90,7 @@ al0 dyn dyn n/a dyn ADMtek AL981 PCI based cards
ax0 dyn dyn n/a dyn ASIX AX88140A PCI based cards
de0 n/a n/a n/a n/a DEC DC21x40 PCI based cards
(including 21140 100bT cards)
dm0 n/a n/a n/a n/a Davicom DM9100/DM9102 PCI based cards
ed0 280 10 dyn d8000 WD & SMC 80xx; Novell NE1000 &
NE2000; 3Com 3C503; HP PC Lan+
eg0 310 5 dyn dyn 3Com 3C505
@ -514,6 +515,10 @@ DEC EtherWORKS II NICs (DE200, DE201, DE202, and DE422)
DEC DC21040, DC21041, or DC21140 based NICs (SMC Etherpower 8432T, DE245, etc)
DEC FDDI (DEFPA/DEFEA) NICs
Davicom DM9100 and DM9102 PCI fast ethernet NICs, including the
following:
Jaton Corporation XPressNet
Efficient ENI-155p ATM PCI
FORE PCA-200E ATM PCI

View File

@ -98,6 +98,10 @@ syslog(3) to log all messages to /var/log/security.
Driver support has been added for PCI fast ethernet adapters based on
the Silicon Integrated Systems SiS 900 and SiS 7016 ethernet controllers.
Driver support has been added for PCI fast ethernet adapters based on
the Davicom DM9100 and DM9102 ethernet controllers, including the Jaton
Corporation XpressNet.
1.2. SECURITY FIXES
-------------------
@ -334,6 +338,10 @@ DEC EtherWORKS II NICs (DE200, DE201, DE202, and DE422)
DEC DC21040, DC21041, or DC21140 based NICs (SMC Etherpower 8432T, DE245, etc)
DEC FDDI (DEFPA/DEFEA) NICs
Davicom DM9100 and DM9102 PCI fast ethernet NICs, including the
following:
Jaton Corporation XpressNet
Fujitsu MB86960A/MB86965A
HP PC Lan+ cards (model numbers: 27247B and 27252A).

150
share/man/man4/dm.4 Normal file
View File

@ -0,0 +1,150 @@
.\" Copyright (c) 1997, 1998, 1999
.\" Bill Paul <wpaul@ctr.columbia.edu>. All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in the
.\" documentation and/or other materials provided with the distribution.
.\" 3. All advertising materials mentioning features or use of this software
.\" must display the following acknowledgement:
.\" This product includes software developed by Bill Paul.
.\" 4. Neither the name of the author nor the names of any co-contributors
.\" may be used to endorse or promote products derived from this software
.\" without specific prior written permission.
.\"
.\" THIS SOFTWARE IS PROVIDED BY Bill Paul AND CONTRIBUTORS ``AS IS'' AND
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED. IN NO EVENT SHALL Bill Paul OR THE VOICES IN HIS HEAD
.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
.\" THE POSSIBILITY OF SUCH DAMAGE.
.\"
.\" $FreeBSD$
.\"
.Dd September 4, 1999
.Dt DM 4 i386
.Os FreeBSD
.Sh NAME
.Nm dm
.Nd
Davicom DM9100/DM9102 fast ethernet device driver
.Sh SYNOPSIS
.Cd "controller miibus0"
.Cd "device dm0"
.Sh DESCRIPTION
The
.Nm
driver provides support for PCI ethernet adapters and embedded
controllers based on the Davicom DM9100 and DM9102 PCI
fast ethernet controller chips including the Jaton Corporation
XPressNet.
.Pp
The DM9100 and DM9102 are designed to be DEC 21x4x workalikes. The
register layout, DMA descriptor scheme and receive filter programming
are identical to the DEC part. The DM9102
is a 100Mbps ethernet MAC and MII-compliant transceiver
in a single package. The DM9100 is similar to the DM9102 except
that it has no internal PHY, requiring instead an external transceiver
to be attached to its MII interface.
.Pp
The
.Nm
driver supports the following media types:
.Pp
.Bl -tag -width xxxxxxxxxxxxxxxxxxxx
.It autoselect
Enable autoselection of the media type and options.
The user can manually override
the autoselected mode by adding media options to the
.Pa /etc/rc.conf
fine.
.It 10baseT/UTP
Set 10Mbps operation. The
.Ar mediaopt
option can also be used to select either
.Ar full-duplex
or
.Ar half-duplex modes.
.It 100baseTX
Set 100Mbps (fast ethernet) operation. The
.Ar mediaopt
option can also be used to select either
.Ar full-duplex
or
.Ar half-duplex
modes.
.El
.Pp
The
.Nm
driver supports the following media options:
.Pp
.Bl -tag -width xxxxxxxxxxxxxxxxxxxx
.It full-duplex
Force full duplex operation
.It half-duplex
Force half duplex operation.
.El
.Pp
For more information on configuring this device, see
.Xr ifconfig 8 .
.Sh DIAGNOSTICS
.Bl -diag
.It "dm%d: couldn't map ports/memory"
A fatal initialization error has occurred.
.It "dm%d: couldn't map interrupt"
A fatal initialization error has occurred.
.It "dm%d: watchdog timeout"
The device has stopped responding to the network, or there is a problem with
the network connection (cable).
.It "dm%d: no memory for rx list"
The driver failed to allocate an mbuf for the receiver ring.
.It "dm%d: no memory for tx list"
The driver failed to allocate an mbuf for the transmitter ring when
allocating a pad buffer or collapsing an mbuf chain into a cludmr.
.It "dm%d: chip is in D3 power state -- setting to D0"
This message applies only to adapters which support power
management. Some operating sydmms place the controller in low power
mode when shutting down, and some PCI BIOSes fail to bring the chip
out of this state before configuring it. The controller loses all of
its PCI configuration in the D3 state, so if the BIOS does not set
it back to full power mode in time, it won't be able to configure it
correctly. The driver tries to detect this condition and bring
the adapter back to the D0 (full power) state, but this may not be
enough to return the driver to a fully operational condition. If
you see this message at boot time and the driver fails to attach
the device as a network interface, you will have to perform second
warm boot to have the device properly configured.
.Pp
Note that this condition only occurs when warm booting from another
operating sydmm. If you power down your sydmm prior to booting
.Fx ,
the card should be configured correctly.
.El
.Sh SEE ALSO
.Xr arp 4 ,
.Xr netintro 4 ,
.Xr ifconfig 8
.Rs
.%T Davicom DM9102 datasheet
.%O http://www.davicom8.com
.Re
.Sh HISTORY
The
.Nm
device driver first appeared in
.Fx 3.0 .
.Sh AUTHORS
The
.Nm
driver was written by
.An Bill Paul Aq wpaul@ee.columbia.edu .

View File

@ -2,8 +2,8 @@
MAN4= adv.4 adw.4 aha.4 ahb.4 ahc.4 aic.4 al.4 alpm.4 apm.4 ar.4 asc.4 \
atkbd.4 atkbdc.4 ax.4 bktr.4 bt.4 cs.4 cx.4 cy.4 de.4 \
dgb.4 dpt.4 ed.4 el.4 en.4 ep.4 ex.4 fdc.4 fe.4 fxp.4 gsc.4 ie.4 \
io.4 joy.4 keyboard.4 labpc.4 le.4 lnc.4 matcd.4 mcd.4 \
dgb.4 dm.4 dpt.4 ed.4 el.4 en.4 ep.4 ex.4 fdc.4 fe.4 fxp.4 gsc.4 \
ie.4 io.4 joy.4 keyboard.4 labpc.4 le.4 lnc.4 matcd.4 mcd.4 \
mem.4 meteor.4 mouse.4 mse.4 mtio.4 mx.4 ncr.4 npx.4 \
ohci.4 pcf.4 pcm.4 pcvt.4 perfmon.4 pn.4 pnp.4 ppc.4 psm.4 \
rdp.4 rl.4 sb.4 scd.4 screen.4 sf.4 si.4 sio.4 sis.4 sk.4 \
@ -32,6 +32,7 @@ MLINKS+= cx.4 ../cx.4
MLINKS+= cy.4 ../cy.4
MLINKS+= de.4 ../de.4
MLINKS+= dgb.4 ../dgb.4
MLINKS+= dm.4 ../dm.4
MLINKS+= dpt.4 ../dpt.4
MLINKS+= ed.4 ../ed.4
MLINKS+= el.4 ../el.4

View File

@ -0,0 +1,150 @@
.\" Copyright (c) 1997, 1998, 1999
.\" Bill Paul <wpaul@ctr.columbia.edu>. All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in the
.\" documentation and/or other materials provided with the distribution.
.\" 3. All advertising materials mentioning features or use of this software
.\" must display the following acknowledgement:
.\" This product includes software developed by Bill Paul.
.\" 4. Neither the name of the author nor the names of any co-contributors
.\" may be used to endorse or promote products derived from this software
.\" without specific prior written permission.
.\"
.\" THIS SOFTWARE IS PROVIDED BY Bill Paul AND CONTRIBUTORS ``AS IS'' AND
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED. IN NO EVENT SHALL Bill Paul OR THE VOICES IN HIS HEAD
.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
.\" THE POSSIBILITY OF SUCH DAMAGE.
.\"
.\" $FreeBSD$
.\"
.Dd September 4, 1999
.Dt DM 4 i386
.Os FreeBSD
.Sh NAME
.Nm dm
.Nd
Davicom DM9100/DM9102 fast ethernet device driver
.Sh SYNOPSIS
.Cd "controller miibus0"
.Cd "device dm0"
.Sh DESCRIPTION
The
.Nm
driver provides support for PCI ethernet adapters and embedded
controllers based on the Davicom DM9100 and DM9102 PCI
fast ethernet controller chips including the Jaton Corporation
XPressNet.
.Pp
The DM9100 and DM9102 are designed to be DEC 21x4x workalikes. The
register layout, DMA descriptor scheme and receive filter programming
are identical to the DEC part. The DM9102
is a 100Mbps ethernet MAC and MII-compliant transceiver
in a single package. The DM9100 is similar to the DM9102 except
that it has no internal PHY, requiring instead an external transceiver
to be attached to its MII interface.
.Pp
The
.Nm
driver supports the following media types:
.Pp
.Bl -tag -width xxxxxxxxxxxxxxxxxxxx
.It autoselect
Enable autoselection of the media type and options.
The user can manually override
the autoselected mode by adding media options to the
.Pa /etc/rc.conf
fine.
.It 10baseT/UTP
Set 10Mbps operation. The
.Ar mediaopt
option can also be used to select either
.Ar full-duplex
or
.Ar half-duplex modes.
.It 100baseTX
Set 100Mbps (fast ethernet) operation. The
.Ar mediaopt
option can also be used to select either
.Ar full-duplex
or
.Ar half-duplex
modes.
.El
.Pp
The
.Nm
driver supports the following media options:
.Pp
.Bl -tag -width xxxxxxxxxxxxxxxxxxxx
.It full-duplex
Force full duplex operation
.It half-duplex
Force half duplex operation.
.El
.Pp
For more information on configuring this device, see
.Xr ifconfig 8 .
.Sh DIAGNOSTICS
.Bl -diag
.It "dm%d: couldn't map ports/memory"
A fatal initialization error has occurred.
.It "dm%d: couldn't map interrupt"
A fatal initialization error has occurred.
.It "dm%d: watchdog timeout"
The device has stopped responding to the network, or there is a problem with
the network connection (cable).
.It "dm%d: no memory for rx list"
The driver failed to allocate an mbuf for the receiver ring.
.It "dm%d: no memory for tx list"
The driver failed to allocate an mbuf for the transmitter ring when
allocating a pad buffer or collapsing an mbuf chain into a cludmr.
.It "dm%d: chip is in D3 power state -- setting to D0"
This message applies only to adapters which support power
management. Some operating sydmms place the controller in low power
mode when shutting down, and some PCI BIOSes fail to bring the chip
out of this state before configuring it. The controller loses all of
its PCI configuration in the D3 state, so if the BIOS does not set
it back to full power mode in time, it won't be able to configure it
correctly. The driver tries to detect this condition and bring
the adapter back to the D0 (full power) state, but this may not be
enough to return the driver to a fully operational condition. If
you see this message at boot time and the driver fails to attach
the device as a network interface, you will have to perform second
warm boot to have the device properly configured.
.Pp
Note that this condition only occurs when warm booting from another
operating sydmm. If you power down your sydmm prior to booting
.Fx ,
the card should be configured correctly.
.El
.Sh SEE ALSO
.Xr arp 4 ,
.Xr netintro 4 ,
.Xr ifconfig 8
.Rs
.%T Davicom DM9102 datasheet
.%O http://www.davicom8.com
.Re
.Sh HISTORY
The
.Nm
device driver first appeared in
.Fx 3.0 .
.Sh AUTHORS
The
.Nm
driver was written by
.An Bill Paul Aq wpaul@ee.columbia.edu .

View File

@ -115,6 +115,7 @@ controller miibus0
device al0
device ax0
device de0
device dm0
device fxp0
device le0
device mx0

View File

@ -115,6 +115,7 @@ controller miibus0
device al0
device ax0
device de0
device dm0
device fxp0
device le0
device mx0

View File

@ -162,6 +162,7 @@ controller miibus0
device al0 # ADMtek AL981 (``Comet'')
device ax0 # ASIX AX88140A
device de0 # DEC/Intel DC21x4x (``Tulip'')
device dm0 # Davicom DM9100/DM9102
device fxp0 # Intel EtherExpress PRO/100B (82557, 82558)
device mx0 # Macronix 98713/98715/98725 (``PMAC'')
device pn0 # Lite-On 82c168/82c169 (``PNIC'')

View File

@ -1542,6 +1542,10 @@ controller miibus0
# The `de' device provides support for the Digital Equipment DC21040
# self-contained Ethernet adapter.
#
# The `dm' device provides support for PCI fast ethernet adapters
# based on the the Davicom DM9100 and DM9102 controller chips, including
# the Jaton Corporation XPressNet.
#
# The `fxp' device provides support for the Intel EtherExpress Pro/100B
# PCI Fast Ethernet adapters.
#
@ -1721,6 +1725,7 @@ options SCSI_ISP_FCDUPLEX=0x4 # isp2 is a Fibre Channel card
device al0
device ax0
device de0
device dm0
device fxp0
device mx0
device pn0

View File

@ -626,6 +626,7 @@ pci/ida_pci.c optional ida pci
pci/if_al.c optional al
pci/if_ax.c optional ax
pci/if_de.c optional de
pci/if_dm.c optional dm
pci/if_ed_p.c optional ed pci
pci/if_en_pci.c optional en pci
pci/if_fxp.c optional fxp

View File

@ -162,6 +162,7 @@ controller miibus0
device al0 # ADMtek AL981 (``Comet'')
device ax0 # ASIX AX88140A
device de0 # DEC/Intel DC21x4x (``Tulip'')
device dm0 # Davicom DM9100/DM9102
device fxp0 # Intel EtherExpress PRO/100B (82557, 82558)
device mx0 # Macronix 98713/98715/98725 (``PMAC'')
device pn0 # Lite-On 82c168/82c169 (``PNIC'')

View File

@ -1542,6 +1542,10 @@ controller miibus0
# The `de' device provides support for the Digital Equipment DC21040
# self-contained Ethernet adapter.
#
# The `dm' device provides support for PCI fast ethernet adapters
# based on the the Davicom DM9100 and DM9102 controller chips, including
# the Jaton Corporation XPressNet.
#
# The `fxp' device provides support for the Intel EtherExpress Pro/100B
# PCI Fast Ethernet adapters.
#
@ -1721,6 +1725,7 @@ options SCSI_ISP_FCDUPLEX=0x4 # isp2 is a Fibre Channel card
device al0
device ax0
device de0
device dm0
device fxp0
device mx0
device pn0

View File

@ -1542,6 +1542,10 @@ controller miibus0
# The `de' device provides support for the Digital Equipment DC21040
# self-contained Ethernet adapter.
#
# The `dm' device provides support for PCI fast ethernet adapters
# based on the the Davicom DM9100 and DM9102 controller chips, including
# the Jaton Corporation XPressNet.
#
# The `fxp' device provides support for the Intel EtherExpress Pro/100B
# PCI Fast Ethernet adapters.
#
@ -1721,6 +1725,7 @@ options SCSI_ISP_FCDUPLEX=0x4 # isp2 is a Fibre Channel card
device al0
device ax0
device de0
device dm0
device fxp0
device mx0
device pn0

View File

@ -404,6 +404,7 @@ static DEV_INFO device_info[] = {
{"al", "ADMtek AL981 ethernet adapter", FLG_FIXED, CLS_NETWORK},
{"ax", "ASIX AX88140A ethernet adapter", FLG_FIXED, CLS_NETWORK},
{"de", "DEC DC21040 Ethernet adapter", FLG_FIXED, CLS_NETWORK},
{"dm", "Davicom DM910x Ethernet adapter", FLG_FIXED, CLS_NETWORK},
{"fpa", "DEC DEFPA PCI FDDI adapter", FLG_FIXED, CLS_NETWORK},
{"rl", "RealTek 8129/8139 ethernet adapter", FLG_FIXED, CLS_NETWORK},
{"mx", "Macronix PMAC ethernet adapter", FLG_FIXED, CLS_NETWORK},

View File

@ -2,7 +2,7 @@
# XXX present but broken: atapi ip_mroute_mod joy pcic
SUBDIR= ax ccd cd9660 coda fdesc fxp if_disc if_ppp if_sl if_tun ipfw \
SUBDIR= ax ccd cd9660 coda dm fdesc fxp if_disc if_ppp if_sl if_tun ipfw \
kernfs mfs mii msdos mx nfs ntfs nullfs pn portal procfs sf \
sis sk ste ti tl umapfs union vn vr wb xl

33
sys/modules/dm/Makefile Normal file
View File

@ -0,0 +1,33 @@
# $FreeBSD$
S = ${.CURDIR}/../..
.PATH: $S/pci
KMOD = dm
SRCS = if_dm.c dm.h bpf.h opt_bdg.h device_if.h bus_if.h pci_if.h
SRCS += miibus_if.h
CLEANFILES += dm.h bpf.h opt_bdg.h device_if.h bus_if.h pci_if.h
CLEANFILES += miibus_if.h
CFLAGS += ${DEBUG_FLAGS}
dm.h:
echo "#define NDM 1" > dm.h
bpf.h:
echo "#define NBPF 1" > bpf.h
opt_bdg.h:
touch opt_bdg.h
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
pci_if.h: $S/kern/makedevops.pl $S/pci/pci_if.m
perl $S/kern/makedevops.pl -h $S/pci/pci_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
.include <bsd.kmod.mk>

1714
sys/pci/if_dm.c Normal file

File diff suppressed because it is too large Load Diff

419
sys/pci/if_dmreg.h Normal file
View File

@ -0,0 +1,419 @@
/*
* Copyright (c) 1997, 1998, 1999
* Bill Paul <wpaul@ctr.columbia.edu>. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by Bill Paul.
* 4. Neither the name of the author nor the names of any co-contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY Bill Paul AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL Bill Paul OR THE VOICES IN HIS HEAD
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
* THE POSSIBILITY OF SUCH DAMAGE.
*
* $FreeBSD$
*/
/*
* Davicom register definitions.
*/
#define DM_BUSCTL 0x00 /* bus control */
#define DM_TXSTART 0x08 /* tx start demand */
#define DM_RXSTART 0x10 /* rx start demand */
#define DM_RXADDR 0x18 /* rx descriptor list start addr */
#define DM_TXADDR 0x20 /* tx descriptor list start addr */
#define DM_ISR 0x28 /* interrupt status register */
#define DM_NETCFG 0x30 /* network config register */
#define DM_IMR 0x38 /* interrupt mask */
#define DM_FRAMESDISCARDED 0x40 /* # of discarded frames */
#define DM_SIO 0x48 /* MII and ROM/EEPROM access */
#define DM_RESERVED 0x50
#define DM_GENTIMER 0x58 /* general timer */
#define DM_GENPORT 0x60 /* general purpose port */
/*
* Bus control bits.
*/
#define DM_BUSCTL_RESET 0x00000001
#define DM_BUSCTL_ARBITRATION 0x00000002
#define WB_BUSCTL_SKIPLEN 0x0000007C
#define DM_BUSCTL_BIGENDIAN 0x00000080
#define DM_BUSCTL_BURSTLEN 0x00003F00
#define DM_BUSCTL_CACHEALIGN 0x0000C000
#define DM_BUSCTL_BUF_BIGENDIAN 0x00100000
#define DM_BUSCTL_READMULTI 0x00200000
#define DM_SKIPLEN_1LONG 0x00000004
#define DM_SKIPLEN_2LONG 0x00000008
#define DM_SKIPLEN_3LONG 0x00000010
#define DM_SKIPLEN_4LONG 0x00000020
#define DM_SKIPLEN_5LONG 0x00000040
#define DM_CACHEALIGN_NONE 0x00000000
#define DM_CACHEALIGN_8LONG 0x00004000
#define DM_CACHEALIGN_16LONG 0x00008000
#define DM_CACHEALIGN_32LONG 0x0000C000
#define DM_BURSTLEN_UNLIMIT 0x00000000
#define DM_BURSTLEN_1LONG 0x00000100
#define DM_BURSTLEN_2LONG 0x00000200
#define DM_BURSTLEN_4LONG 0x00000400
#define DM_BURSTLEN_8LONG 0x00000800
#define DM_BURSTLEN_16LONG 0x00001000
#define DM_BURSTLEN_32LONG 0x00002000
/*
* Interrupt status bits.
*/
#define DM_ISR_TX_OK 0x00000001
#define DM_ISR_TX_IDLE 0x00000002
#define DM_ISR_TX_NOBUF 0x00000004
#define DM_ISR_TX_JABBERTIMEO 0x00000008
#define DM_ISR_TX_UNDERRUN 0x00000020
#define DM_ISR_RX_OK 0x00000040
#define DM_ISR_RX_NOBUF 0x00000080
#define DM_ISR_RX_IDLE 0x00000100
#define DM_ISR_RX_WATDOGTIMEO 0x00000200
#define DM_ISR_TX_EARLY 0x00000400
#define DM_ISR_TIMER_EXPIRED 0x00000800
#define DM_ISR_BUS_ERR 0x00002000
#define DM_ISR_ABNORMAL 0x00008000
#define DM_ISR_NORMAL 0x00010000
#define DM_ISR_RX_STATE 0x000E0000
#define DM_ISR_TX_STATE 0x00700000
#define DM_ISR_BUSERRTYPE 0x03800000
#define DM_RXSTATE_STOPPED 0x00000000 /* 000 - Stopped */
#define DM_RXSTATE_FETCH 0x00020000 /* 001 - Fetching descriptor */
#define DM_RXSTATE_ENDCHECK 0x00040000 /* 010 - check for rx end */
#define DM_RXSTATE_WAIT 0x00060000 /* 011 - waiting for packet */
#define DM_RXSTATE_SUSPEND 0x00080000 /* 100 - suspend rx */
#define DM_RXSTATE_CLOSE 0x000A0000 /* 101 - close tx desc */
#define DM_RXSTATE_FLUSH 0x000C0000 /* 110 - flush from FIFO */
#define DM_RXSTATE_DEQUEUE 0x000E0000 /* 111 - dequeue from FIFO */
#define DM_TXSTATE_RESET 0x00000000 /* 000 - reset */
#define DM_TXSTATE_FETCH 0x00100000 /* 001 - fetching descriptor */
#define DM_TXSTATE_WAITEND 0x00200000 /* 010 - wait for tx end */
#define DM_TXSTATE_READING 0x00300000 /* 011 - read and enqueue */
#define DM_TXSTATE_RSVD 0x00400000 /* 100 - reserved */
#define DM_TXSTATE_SETUP 0x00500000 /* 101 - setup packet */
#define DM_TXSTATE_SUSPEND 0x00600000 /* 110 - suspend tx */
#define DM_TXSTATE_CLOSE 0x00700000 /* 111 - close tx desc */
/*
* Network config bits.
*/
#define DM_NETCFG_LINKSTAT_PCS 0x00000001
#define DM_NETCFG_RX_ON 0x00000002
#define DM_NETCFG_RX_BADFRAMES 0x00000008
#define DM_NETCFG_RX_PROMISC 0x00000040
#define DM_NETCFG_RX_ALLMULTI 0x00000080
#define DM_NETCFG_RX_BROAD 0x00000100
#define DM_NETCFG_FULLDUPLEX 0x00000200
#define DM_NETCFG_LOOPBACK 0x00000C00
#define DM_NETCFG_FORCECOLL 0x00001000
#define DM_NETCFG_TX_ON 0x00002000
#define DM_NETCFG_TX_THRESH 0x0000C000
#define DM_NETCFG_PORTSEL 0x00040000 /* 0 == SRL, 1 == MII/SYM */
#define DM_NETCFG_HEARTBEAT 0x00080000 /* 0 == ON, 1 == OFF */
#define DM_NETCFG_STORENFWD 0x00200000
#define DM_NETCFG_SPEEDSEL 0x00400000 /* 1 == 10, 0 == 100 */
#define DM_NETCFG_PCS 0x00800000
#define DM_NETCFG_SCRAMBLER 0x01000000
#define DM_NETCFG_RX_ALL 0x40000000
#define DM_OPMODE_NORM 0x00000000
#define DM_OPMODE_INTLOOP 0x00000400
#define DM_OPMODE_EXTLOOP 0x00000800
#define DM_TXTHRESH_72BYTES 0x00000000
#define DM_TXTHRESH_96BYTES 0x00004000
#define DM_TXTHRESH_128BYTES 0x00008000
#define DM_TXTHRESH_160BYTES 0x0000C000
/*
* Interrupt mask bits.
*/
#define DM_IMR_TX_OK 0x00000001
#define DM_IMR_TX_IDLE 0x00000002
#define DM_IMR_TX_NOBUF 0x00000004
#define DM_IMR_TX_JABBERTIMEO 0x00000008
#define DM_IMR_TX_UNDERRUN 0x00000020
#define DM_IMR_RX_OK 0x00000040
#define DM_IMR_RX_NOBUF 0x00000080
#define DM_IMR_RX_IDLE 0x00000100
#define DM_IMR_RX_WATDOGTIMEO 0x00000200
#define DM_IMR_TX_EARLY 0x00000400
#define DM_IMR_TIMER_EXPIRED 0x00000800
#define DM_IMR_BUS_ERR 0x00002000
#define DM_IMR_RX_EARLY 0x00004000
#define DM_IMR_ABNORMAL 0x00008000
#define DM_IMR_NORMAL 0x00010000
#define DM_INTRS \
(DM_IMR_RX_OK|DM_IMR_TX_OK|DM_IMR_RX_NOBUF|DM_IMR_RX_WATDOGTIMEO|\
DM_IMR_TX_NOBUF|DM_IMR_TX_UNDERRUN|DM_IMR_BUS_ERR| \
DM_IMR_ABNORMAL|DM_IMR_NORMAL|/*DM_IMR_TX_EARLY*/ \
DM_IMR_TX_IDLE|DM_IMR_RX_IDLE)
/*
* Serial I/O (EEPROM/ROM) bits.
*/
#define DM_SIO_EE_CS 0x00000001 /* EEPROM chip select */
#define DM_SIO_EE_CLK 0x00000002 /* EEPROM clock */
#define DM_SIO_EE_DATAIN 0x00000004 /* EEPROM data output */
#define DM_SIO_EE_DATAOUT 0x00000008 /* EEPROM data input */
#define DM_SIO_EESEL 0x00000800
#define DM_SIO_ROMSEL 0x00001000
#define DM_SIO_ROMCTL_WRITE 0x00002000
#define DM_SIO_ROMCTL_READ 0x00004000
#define DM_SIO_MII_CLK 0x00010000 /* MDIO clock */
#define DM_SIO_MII_DATAOUT 0x00020000 /* MDIO data out */
#define DM_SIO_MII_DIR 0x00040000 /* MDIO dir */
#define DM_SIO_MII_DATAIN 0x00080000 /* MDIO data in */
#define DM_EECMD_WRITE 0x140
#define DM_EECMD_READ 0x180
#define DM_EECMD_ERASE 0x1c0
#define DM_EE_NODEADDR_OFFSET 0x70
#define DM_EE_NODEADDR 10
/*
* General purpose timer register
*/
#define DM_TIMER_VALUE 0x0000FFFF
#define DM_TIMER_CONTINUOUS 0x00010000
/*
* Size of a setup frame.
*/
#define DM_SFRAME_LEN 192
/*
* Davicom TX/RX list structure.
*/
struct dm_desc {
u_int32_t dm_status;
u_int32_t dm_ctl;
u_int32_t dm_ptr1;
u_int32_t dm_ptr2;
struct mbuf *dm_mbuf;
struct dm_desc *dm_nextdesc;
};
#define dm_data dm_ptr1
#define dm_next dm_ptr2
#define DM_RXSTAT_FIFOOFLOW 0x00000001
#define DM_RXSTAT_CRCERR 0x00000002
#define DM_RXSTAT_DRIBBLE 0x00000004
#define DM_RXSTAT_WATCHDOG 0x00000010
#define DM_RXSTAT_FRAMETYPE 0x00000020 /* 0 == IEEE 802.3 */
#define DM_RXSTAT_COLLSEEN 0x00000040
#define DM_RXSTAT_GIANT 0x00000080
#define DM_RXSTAT_LASTFRAG 0x00000100
#define DM_RXSTAT_FIRSTFRAG 0x00000200
#define DM_RXSTAT_MULTICAST 0x00000400
#define DM_RXSTAT_RUNT 0x00000800
#define DM_RXSTAT_RXTYPE 0x00003000
#define DM_RXSTAT_RXERR 0x00008000
#define DM_RXSTAT_RXLEN 0x3FFF0000
#define DM_RXSTAT_OWN 0x80000000
#define DM_RXBYTES(x) ((x & DM_RXSTAT_RXLEN) >> 16)
#define DM_RXSTAT (DM_RXSTAT_FIRSTFRAG|DM_RXSTAT_LASTFRAG|DM_RXSTAT_OWN)
#define DM_RXCTL_BUFLEN1 0x00000FFF
#define DM_RXCTL_BUFLEN2 0x00FFF000
#define DM_RXCTL_RLINK 0x01000000
#define DM_RXCTL_RLAST 0x02000000
#define DM_TXSTAT_DEFER 0x00000001
#define DM_TXSTAT_UNDERRUN 0x00000002
#define DM_TXSTAT_LINKFAIL 0x00000003
#define DM_TXSTAT_COLLCNT 0x00000078
#define DM_TXSTAT_SQE 0x00000080
#define DM_TXSTAT_EXCESSCOLL 0x00000100
#define DM_TXSTAT_LATECOLL 0x00000200
#define DM_TXSTAT_NOCARRIER 0x00000400
#define DM_TXSTAT_CARRLOST 0x00000800
#define DM_TXSTAT_JABTIMEO 0x00004000
#define DM_TXSTAT_ERRSUM 0x00008000
#define DM_TXSTAT_OWN 0x80000000
#define DM_TXCTL_BUFLEN1 0x000007FF
#define DM_TXCTL_BUFLEN2 0x003FF800
#define DM_TXCTL_FILTTYPE0 0x00400000
#define DM_TXCTL_PAD 0x00800000
#define DM_TXCTL_TLINK 0x01000000
#define DM_TXCTL_TLAST 0x02000000
#define DM_TXCTL_NOCRC 0x04000000
#define DM_TXCTL_SETUP 0x08000000
#define DM_TXCTL_FILTTYPE1 0x10000000
#define DM_TXCTL_FIRSTFRAG 0x20000000
#define DM_TXCTL_LASTFRAG 0x40000000
#define DM_TXCTL_FINT 0x80000000
#define DM_FILTER_PERFECT 0x00000000
#define DM_FILTER_HASHPERF 0x00400000
#define DM_FILTER_INVERSE 0x10000000
#define DM_FILTER_HASHONLY 0x10400000
#define DM_MAXFRAGS 16
#define DM_RX_LIST_CNT 64
#define DM_TX_LIST_CNT 128
#define DM_MIN_FRAMELEN 60
#define DM_RXLEN 1536
#define DM_INC(x, y) (x) = (x + 1) % y
struct dm_list_data {
struct dm_desc dm_rx_list[DM_RX_LIST_CNT];
struct dm_desc dm_tx_list[DM_TX_LIST_CNT];
struct dm_desc dm_sframe;
};
struct dm_chain_data {
u_int32_t dm_sbuf[DM_SFRAME_LEN/sizeof(u_int32_t)];
u_int8_t dm_pad[DM_MIN_FRAMELEN];
int dm_tx_prod;
int dm_tx_cons;
int dm_tx_cnt;
int dm_rx_prod;
};
struct dm_type {
u_int16_t dm_vid;
u_int16_t dm_did;
char *dm_name;
};
struct dm_mii_frame {
u_int8_t mii_stdelim;
u_int8_t mii_opcode;
u_int8_t mii_phyaddr;
u_int8_t mii_regaddr;
u_int8_t mii_turnaround;
u_int16_t mii_data;
};
/*
* MII constants
*/
#define DM_MII_STARTDELIM 0x01
#define DM_MII_READOP 0x02
#define DM_MII_WRITEOP 0x01
#define DM_MII_TURNAROUND 0x02
struct dm_softc {
struct arpcom arpcom; /* interface info */
bus_space_handle_t dm_bhandle; /* bus space handle */
bus_space_tag_t dm_btag; /* bus space tag */
void *dm_intrhand;
struct resource *dm_irq;
struct resource *dm_res;
device_t dm_miibus;
u_int8_t dm_unit; /* interface number */
int dm_cachesize;
struct dm_list_data *dm_ldata;
struct dm_chain_data dm_cdata;
struct callout_handle dm_stat_ch;
};
/*
* register space access macros
*/
#define CSR_WRITE_4(sc, reg, val) \
bus_space_write_4(sc->dm_btag, sc->dm_bhandle, reg, val)
#define CSR_WRITE_2(sc, reg, val) \
bus_space_write_2(sc->dm_btag, sc->dm_bbhandle, reg, val)
#define CSR_WRITE_1(sc, reg, val) \
bus_space_write_1(sc->dm_btag, sc->dm_bhandle, reg, val)
#define CSR_READ_4(sc, reg) \
bus_space_read_4(sc->dm_btag, sc->dm_bhandle, reg)
#define CSR_READ_2(sc, reg) \
bus_space_read_2(sc->dm_btag, sc->dm_bhandle, reg)
#define CSR_READ_1(sc, reg) \
bus_space_read_1(sc->dm_btag, sc->dm_bhandle, reg)
#define DM_TIMEOUT 1000
#define ETHER_ALIGN 2
/*
* General constants that are fun to know.
*
* Davicom PCI vendor ID
*/
#define DM_VENDORID 0x1282
/*
* Davicom DM9102 device ID.
*/
#define DM_DEVICEID_DM9102 0x9102
#define DM_DEVICEID_DM9100 0x9100
/*
* PCI low memory base and low I/O base register, and
* other PCI registers.
*/
#define DM_PCI_VENDOR_ID 0x00
#define DM_PCI_DEVICE_ID 0x02
#define DM_PCI_COMMAND 0x04
#define DM_PCI_STATUS 0x06
#define DM_PCI_REVID 0x08
#define DM_PCI_CLASSCODE 0x09
#define DM_PCI_CACHELEN 0x0C
#define DM_PCI_LATENCY_TIMER 0x0D
#define DM_PCI_HEADER_TYPE 0x0E
#define DM_PCI_LOIO 0x10
#define DM_PCI_LOMEM 0x14
#define DM_PCI_BIOSROM 0x30
#define DM_PCI_INTLINE 0x3C
#define DM_PCI_INTPIN 0x3D
#define DM_PCI_MINGNT 0x3E
#define DM_PCI_MINLAT 0x0F
#define DM_PCI_RESETOPT 0x48
#define DM_PCI_EEPROM_DATA 0x4C
/* power management registers */
#define DM_PCI_CAPID 0x50 /* 8 bits */
#define DM_PCI_NEXTPTR 0x51 /* 8 bits */
#define DM_PCI_PWRMGMTCAP 0x52 /* 16 bits */
#define DM_PCI_PWRMGMTCTRL 0x54 /* 16 bits */
#define DM_PSTATE_MASK 0x0003
#define DM_PSTATE_D0 0x0000
#define DM_PSTATE_D1 0x0001
#define DM_PSTATE_D2 0x0002
#define DM_PSTATE_D3 0x0003
#define DM_PME_EN 0x0010
#define DM_PME_STATUS 0x8000
#ifdef __alpha__
#undef vtophys
#define vtophys(va) alpha_XXX_dmamap((vm_offset_t)va)
#endif

View File

@ -89,6 +89,7 @@ static struct _devname {
{ DEVICE_TYPE_NETWORK, "cc3i", "SDL HSSI sync serial PCI card" },
{ DEVICE_TYPE_NETWORK, "en", "Efficient Networks ATM PCI card" },
{ DEVICE_TYPE_NETWORK, "de", "DEC DE435 PCI NIC or other DC21040-AA based card" },
{ DEVICE_TYPE_NETWORK, "dm", "Davicom DM9100/DM9102 PCI fast ethernet card" },
{ DEVICE_TYPE_NETWORK, "fxp", "Intel EtherExpress Pro/100B PCI Fast Ethernet card" },
{ DEVICE_TYPE_NETWORK, "ed", "Novell NE1000/2000; 3C503; NE2000-compatible PCMCIA" },
{ DEVICE_TYPE_NETWORK, "ep", "3Com 3C509 ethernet card/3C589 PCMCIA" },

View File

@ -89,6 +89,7 @@ static struct _devname {
{ DEVICE_TYPE_NETWORK, "cc3i", "SDL HSSI sync serial PCI card" },
{ DEVICE_TYPE_NETWORK, "en", "Efficient Networks ATM PCI card" },
{ DEVICE_TYPE_NETWORK, "de", "DEC DE435 PCI NIC or other DC21040-AA based card" },
{ DEVICE_TYPE_NETWORK, "dm", "Davicom DM9100/DM9102 PCI fast ethernet card" },
{ DEVICE_TYPE_NETWORK, "fxp", "Intel EtherExpress Pro/100B PCI Fast Ethernet card" },
{ DEVICE_TYPE_NETWORK, "ed", "Novell NE1000/2000; 3C503; NE2000-compatible PCMCIA" },
{ DEVICE_TYPE_NETWORK, "ep", "3Com 3C509 ethernet card/3C589 PCMCIA" },