History log of /openbsd-current/sys/dev/pci/if_dc_pci.c
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
# 1.79 24-May-2024 jsg

remove unneeded includes; ok miod@


Revision tags: OPENBSD_7_1_BASE OPENBSD_7_2_BASE OPENBSD_7_3_BASE OPENBSD_7_4_BASE OPENBSD_7_5_BASE
# 1.78 11-Mar-2022 mpi

Constify struct cfattach.


# 1.77 22-Feb-2022 guenther

Delete unnecessary #includes of <sys/domain.h> and/or <sys/protosw.h>

net/if_pppx.c pointed out by jsg@
ok gnezdo@ deraadt@ jsg@ mpi@ millert@


Revision tags: OPENBSD_6_2_BASE OPENBSD_6_3_BASE OPENBSD_6_4_BASE OPENBSD_6_5_BASE OPENBSD_6_6_BASE OPENBSD_6_7_BASE OPENBSD_6_8_BASE OPENBSD_6_9_BASE OPENBSD_7_0_BASE
# 1.76 11-Apr-2017 dhill

Partially revert previous mallocarray conversions that contain
constants.

The consensus is that if both operands are constant, we don't need
mallocarray. Reminded by tedu@

ok deraadt@


# 1.75 09-Apr-2017 dhill

Convert some malloc(9) to mallocarray(9)

ok deraadt@


Revision tags: OPENBSD_5_9_BASE OPENBSD_6_0_BASE OPENBSD_6_1_BASE
# 1.74 24-Nov-2015 mpi

You only need <net/if_dl.h> if you're using LLADDR() or a sockaddr_dl.


# 1.73 24-Nov-2015 mpi

The only network driver needing <net/if_types.h> is upl(4) for IFT_OTHER.


Revision tags: OPENBSD_5_8_BASE
# 1.72 14-Mar-2015 jsg

Remove some includes include-what-you-use claims don't
have any direct symbols used. Tested for indirect use by compiling
amd64/i386/sparc64 kernels.

ok tedu@ deraadt@


Revision tags: OPENBSD_5_7_BASE
# 1.71 22-Dec-2014 tedu

unifdef INET


Revision tags: OPENBSD_5_6_BASE
# 1.70 22-Jul-2014 mpi

Fewer <netinet/in_systm.h>


Revision tags: OPENBSD_5_5_BASE
# 1.69 07-Aug-2013 bluhm

Most network drivers include netinet/in_var.h, but apparently they
don't have to. Just remove these include lines.
Compiled on amd64 i386 sparc64; OK henning@ mikeb@


Revision tags: OPENBSD_5_3_BASE OPENBSD_5_4_BASE
# 1.68 18-Oct-2012 deraadt

Convert a number of old private copies of code which predates
pci_set_powerstate() to using it instead. Many of these chunks of code had
bugs in them, especially missing delay() calls. Some of them were doing
things our PCI subsystem is now responsible for handling. If you have
any of the affected devices, please keep an eye out for regressions.
ok kettenis


Revision tags: OPENBSD_4_9_BASE OPENBSD_5_0_BASE OPENBSD_5_1_BASE OPENBSD_5_2_BASE
# 1.67 27-Aug-2010 deraadt

Move the dc_pci_activate function to dc.c, and mangle it up with some of
the gunk in dc_powerhook. Then make dc_powerhook just call it
ok kettenis


Revision tags: OPENBSD_4_8_BASE
# 1.66 05-Aug-2010 deraadt

ca_activate function for suspend/resume; tested by mlarkin on a
Davicom DM9102. (bit of noise on suspend or resume, but that can be
dealt with later)


Revision tags: OPENBSD_4_7_BASE
# 1.65 15-Oct-2009 deraadt

Add detach support to a few more drivers, and in others do the neccessary
operations in the detach function in the right order. Also ensure that the
interrupt handlers not trust registers that go away.
read over very carefully by dms, tested by me


Revision tags: OPENBSD_4_6_BASE
# 1.64 26-Jun-2009 deraadt

Using information gleamed from the FreeBSD driver, change the MAC address
reading to use the eeprom instead of CIS, and then the Xircom Cardbus cards
can work in the expresscard adaptor, as pci devices.
ok jsg


# 1.63 02-Jun-2009 jsg

make dc at pci detachable; untested.


# 1.62 02-Jun-2009 jsg

Add more CardBus ids to PCI attachments to cope with
things like the crazy ExpressCard->CardBus adapters which
make CardBus devices show as PCI devices.


Revision tags: OPENBSD_4_5_BASE
# 1.61 11-Sep-2008 brad

ANSI function declarations.


# 1.60 11-Sep-2008 brad

Remove the redundant local variable 'revision' from the PCI attach function.
The softc field dc_revision contains the PCI revision. No functional change.


Revision tags: OPENBSD_4_3_BASE OPENBSD_4_4_BASE
# 1.59 26-Nov-2007 brad

print the comma before the MAC address string in dc_attach() instead of the
PCI front end attach function. This corrects the dmesg output for CardBus
adapters and ensures proper dmesg output if an error occurs in dc_attach().

ok dlg@


Revision tags: OPENBSD_4_2_BASE
# 1.58 01-Aug-2007 miod

Stop making de win over dc on alpha, and include both dc and de on all
installation media now - it fits.

THIS MEANS YOU NEED TO RENAME /etc/hostname.de0 TO /etc/hostname.dc0
BEFORE BOOTING A NEW KERNEL.

ok deraadt@


# 1.57 10-Apr-2007 miod

``it's'' -> ``its'' when the grammar gods require this change.


Revision tags: OPENBSD_4_1_BASE
# 1.56 13-Feb-2007 jsg

Add missing break in attach code.
ok tom@ claudio@ henning@


Revision tags: OPENBSD_4_0_BASE
# 1.55 20-Jul-2006 brad

update for the new ADMtek PCI ids.


# 1.54 18-Jul-2006 brad

attach to the ADMtek 983B chipset as well.


# 1.53 17-Jun-2006 brad

add sys/timeout.h


Revision tags: OPENBSD_3_9_BASE
# 1.52 06-Nov-2005 brad

- remove spl from attach
- de-allocate resources on failure to attach


Revision tags: OPENBSD_3_8_BASE
# 1.51 09-Aug-2005 mickey

do not set PCI_COMMAND_MASTER_ENABLE explicitly as it's already set in pcisubmatch(); kettenis@ testing; brad@ ok


# 1.50 26-Mar-2005 mickey

simplify man! no need to outline pci_mapreg_map() anymore just use it


Revision tags: OPENBSD_3_7_BASE
# 1.49 16-Jan-2005 brad

- recognize Microsoft PCI and CardBus adapters
- recognize Hawking CardBus adapter
- simplify 3Com switch case and fold in with ADMtek case
- use 64-bit multicast hash for all instances of ADMtek 983 chipset

Hawking CardBus adapter reported by Alec Berryman <alec at thened dot net>
Microsoft adapters from FreeBSD dc(4) driver


# 1.48 16-Jan-2005 brad

get EEPROM width on all cards except for the original PNIC
or XIRCOM cards.

Based on the FreeBSD dc(4) driver.


# 1.47 14-Jan-2005 brad

rev 1.63

Avoid an unnecessary copy of a packet if it is already in a single mbuf.
Introduce an additional device flag for those NICs which require the
transmit buffers to be aligned to 32-bit boundaries.

From FreeBSD


# 1.46 08-Jan-2005 brad

rev 1.125

Don't read the MAC address from a copy of the EEPROM in the softc
that has been recorded earlier and overwrite it again later by
reading it directly from the EEPROM again.

Read the MAC address from the PAR0/PAR1 registers instead, which
are autoloaded on reboot.

From FreeBSD

Thanks to David Snyder <dasnyderx at yahoo dot com> for testing on
a AN983 based card which used to come up with a MAC address of
ff:ff:ff:ff:ff:ff.


# 1.45 28-Sep-2004 brad

Use ETHER_MIN_LEN/ETHER_MAX_DIX_LEN


Revision tags: OPENBSD_3_6_BASE
# 1.44 04-Aug-2004 mickey

kill hppa quirk that is not needed


# 1.43 28-Jun-2004 mickey

do not force into io space on hppa as it's much slower


Revision tags: OPENBSD_3_5_BASE SMP_SYNC_A SMP_SYNC_B
# 1.42 21-Oct-2003 deraadt

a 3com tulip, wow; christoph.scheurer@ch.tum.de


# 1.41 07-Oct-2003 fgsch

use PCI_PMCSR instead of some magic value.
ok krw@ henning@


# 1.40 29-Sep-2003 mickey

fix the dc_cacheline to 16 on hppa


Revision tags: OPENBSD_3_4_BASE
# 1.39 16-Aug-2003 henning

AN983 needs 64BIT_HASH too, fixes multicast
From: jared r r spiegel <jrrs@gateway.nodeless.net>


# 1.38 26-Jun-2003 mickey

it's better w/ a comma between irq and address


Revision tags: UBC_SYNC_A
# 1.37 17-May-2003 jason

fix up the media handling for the intel based MACs. Also hack around a
bug in the Momenco firmware on the Leopard-V, which now has one port
working.


# 1.36 29-Apr-2003 jason

- remove last vestige of "old autoconf": dc_unit is dead, long live dv_xname
- remove a bunch of #if 0 stuff (most of which referred to dc_unit, grr)
- delay a bzero until necessary


# 1.35 19-Apr-2003 henning

Davicom DM9009 support

tested by Lucas Reddinger <lucas at wlwdesigns.com>


Revision tags: OPENBSD_3_3_BASE UBC_SYNC_B
# 1.34 20-Oct-2002 henning

add support for intel 21145
This chip is some strange abnormal 21143 variant. It really only works with
10 MBit/s halfduplex only and autonegotiation is totally broken in hardware.
Should also have a HomePNA phy, but we don't support that.
for now requires and explicit "media 10BaseT".
if anybody has such a chip please mail me.

nick@ is the only one who has the hardware and did an incredible amount of
testing. Thanks for all the help, Nick!

some hints and ok jason@


Revision tags: OPENBSD_3_2_BASE
# 1.33 09-Jun-2002 art

unbreak sparc64 kernel builds after the arpcom change.


# 1.32 18-Apr-2002 jason

add support for Conexant LANfinity RS7112; based on patch from Maurice Nonnekes <maurice@amaze.nl> based on FreeBSD (only minor surgery necessary)


# 1.31 16-Apr-2002 jason

move prototypes of dc_eeprom_width, dc_read_srom, and dc_parse_21143_srom to dcreg.h and out of the bus specific drivers


Revision tags: OPENBSD_3_1_BASE
# 1.30 01-Apr-2002 nate

Don't have dc and de return the same match value in any case.
Comment the reasoning for the various return values in dc_pci_match.
dc is preferred over de on all archs except for alpha where de is used.
The main reason dc is not preferred on alpha is that it doesn't fit
on the floppy, so RAMDISK and GENERIC would have different drivers for
the same device which is rather confusing.


# 1.29 22-Mar-2002 jason

On sparc64, try local-mac-address before falling back to myetheraddr()


# 1.28 14-Mar-2002 millert

First round of __P removal in sys


# 1.27 06-Mar-2002 nate

remove unused #include


# 1.26 04-Mar-2002 nate

21140 support for dc isn't reliable enough for it to win over dc.
dc doesn't fit on the alpha ramdisk, so let de win in all cases.


# 1.25 17-Feb-2002 nate

make dc win on alpha too


# 1.24 17-Feb-2002 nate

Make dc match with higher priorit over de for 21142/3 chips
Also match on 21140


# 1.23 11-Jan-2002 nordin

Check result from malloc(9) when using M_NOWAIT. fgsch@ ok


Revision tags: UBC_BASE
# 1.22 13-Dec-2001 nate

branches: 1.22.2;
Fix old alpha bug recently triggered by conversion to busdma.


# 1.21 06-Dec-2001 jason

enough bus_dmamap_sync() and htole()/letoh() to get TX working on sparc64.
ALso, get the MAC address from myetheraddr() instead of trying to use the eeprom on sparc64.


# 1.20 06-Dec-2001 jason

Checkpoint bus_dma work in progress:
- descriptor lists are now bus_dma allocated and manipulated
(for those keeping score: 6 vtophys dead, 4 to go)


# 1.19 06-Nov-2001 miod

Replace inclusion of <vm/foo.h> with the correct <uvm/bar.h> when necessary.
(Look ma, I might have broken the tree)


Revision tags: OPENBSD_3_0_BASE
# 1.18 06-Oct-2001 aaron

We must read the SROM ahead of time for all ADMtek-based PCI cards; based on
patch from ckuethe@pyxis.cns.ualberta.ca in PR/2102. At some point after 3.0
I must de-cruftify the dc(4) matching code to avoid such errors. :(


# 1.17 25-Aug-2001 art

Change pci_intr_map to take pci_attach_args as an argument.
All callers actually took all arguments to pci_intr_map from pci_attach_args
structs, so this simplifies code.
This also allows more complicated interrupt assignment schemes like the one
on sparc64.

This makes sparc64 pci interrupts work.

Inspired by the same change in NetBSD.


# 1.16 22-Aug-2001 aaron

Support more dc(4) CardBus devices, including the AN985-based Linksys PCMPC200
10/100 CardBus Ethernet adapter (thanks to beck@ for the donation).


# 1.15 14-Aug-2001 aaron

Call dc_read_srom with the correct width; patch from gluk@. Fixes problems
with multiple 21143 interfaces.


# 1.14 12-Aug-2001 mickey

remove redundant vm includes


Revision tags: OPENBSD_2_9_BASE
# 1.13 06-Apr-2001 aaron

branches: 1.13.4;
- For CardBus 21143 cards, parse the SROM. Makes my SMC EZ CardBus 10/100 work.
- General cleanup in the dc CardBus attachment.
- Split detach up into bus-dependent and bus-independent parts.
- Some function and variable renaming for consistency.


# 1.12 09-Feb-2001 aaron

Add support for parsing the media blocks from the SROM on the 21143 adapters.
These changes should make the driver work with the built-in Ethernet on the
Alpha Miata machines. From FreeBSD.

To make sure I didn't break anything (and as a general test), I tested the
modified driver with the following dc(4) variants: Macronix PMAC 98715,
Lite-On PNIC, Lite-On PNIC-II, ADMtek AL981, and ADMtek AN983.


# 1.11 16-Nov-2000 aaron

Add support for Accton EN2242 MiniPCI adapters as found in HP OmniBook XE3
laptops; from FreeBSD. No special changes needed here, just the addition of
the EN2242's product ID since it is an ADMtek Centaur chip.


Revision tags: OPENBSD_2_8_BASE
# 1.10 30-Oct-2000 aaron

Match the Macronix 98727/98732 chips.


# 1.9 27-Oct-2000 aaron

From FreeBSD:

Yet another bug fix/optimization for the Davicom DM9100/9102: increase the
PCI latency timer value to 0x80. Davicom's Linux driver does this, and it
drastically reduces the number of TX underruns in my tests. (Note: this is
done only for the Davicom chips. I'm not sure it's a good idea to do it
for all of them.)


# 1.8 27-Oct-2000 aaron

From FreeBSD:

Set the DC_TX_INTR_ALWAYS and DC_TX_STORENFWD flags for the Davicom chips.
Do not set DC_TX_ONE. The DC_TX_USE_INTR flag causes dc_encap() to set the
'interrupt on TX completion' bit only once every 64 packets. This is an
attempt to reduce the number of interrupts generated by the chip. You're
supposed to get a 'no more TX buffers left' interrupt once you hit the last
packet whether you ask for one or not, however it seems the Davicom chip
doesn't generate this interrupt, or at least it doesn't generate it under
the same circumstances. The result is that if you transmit n packets, where
n is less than 64, and then wait 5 seconds, you'll get a watchdog timeout
whether you want one or not. The DC_TX_INTR_ALWAYS causes dc_encap() to
request an interrupt for every frame.


# 1.7 16-Oct-2000 aaron

Use mii_attach() directly instead of mii_phy_probe().


# 1.6 13-Sep-2000 aaron

Sync with FreeBSD. Finally make the OpenBSD-specific changes necessary to make
non-MII 21143-based cards work. The sync just fixes the LED handling on these
kinds of adapters.


# 1.5 02-Aug-2000 aaron

Sync with FreeBSD. Summary of changes:

- Add support for Accton EN1217 Ethernet adapters.
- Fix problems with LEDs on some cards when clearing the jabber disable bit.
- Handle new Macronix chips whose multicast hash tables are only 128 bits.
- Fix timing issues during autonegotiation with Macronix and PNIC II.


# 1.4 12-Jun-2000 aaron

Fix ADMtek identity crisis (whoops, missed this file); thanks mickey@


Revision tags: OPENBSD_2_7_BASE
# 1.3 26-Apr-2000 mickey

we've done an oops


# 1.2 26-Apr-2000 mickey

dc_csid ain't needed no more; jason@ ok


# 1.1 18-Apr-2000 jason

split dc driver into bus dependent and bus independent (pci) parts
(cardbus to come later).


# 1.78 11-Mar-2022 mpi

Constify struct cfattach.


# 1.77 22-Feb-2022 guenther

Delete unnecessary #includes of <sys/domain.h> and/or <sys/protosw.h>

net/if_pppx.c pointed out by jsg@
ok gnezdo@ deraadt@ jsg@ mpi@ millert@


Revision tags: OPENBSD_6_2_BASE OPENBSD_6_3_BASE OPENBSD_6_4_BASE OPENBSD_6_5_BASE OPENBSD_6_6_BASE OPENBSD_6_7_BASE OPENBSD_6_8_BASE OPENBSD_6_9_BASE OPENBSD_7_0_BASE
# 1.76 11-Apr-2017 dhill

Partially revert previous mallocarray conversions that contain
constants.

The consensus is that if both operands are constant, we don't need
mallocarray. Reminded by tedu@

ok deraadt@


# 1.75 09-Apr-2017 dhill

Convert some malloc(9) to mallocarray(9)

ok deraadt@


Revision tags: OPENBSD_5_9_BASE OPENBSD_6_0_BASE OPENBSD_6_1_BASE
# 1.74 24-Nov-2015 mpi

You only need <net/if_dl.h> if you're using LLADDR() or a sockaddr_dl.


# 1.73 24-Nov-2015 mpi

The only network driver needing <net/if_types.h> is upl(4) for IFT_OTHER.


Revision tags: OPENBSD_5_8_BASE
# 1.72 14-Mar-2015 jsg

Remove some includes include-what-you-use claims don't
have any direct symbols used. Tested for indirect use by compiling
amd64/i386/sparc64 kernels.

ok tedu@ deraadt@


Revision tags: OPENBSD_5_7_BASE
# 1.71 22-Dec-2014 tedu

unifdef INET


Revision tags: OPENBSD_5_6_BASE
# 1.70 22-Jul-2014 mpi

Fewer <netinet/in_systm.h>


Revision tags: OPENBSD_5_5_BASE
# 1.69 07-Aug-2013 bluhm

Most network drivers include netinet/in_var.h, but apparently they
don't have to. Just remove these include lines.
Compiled on amd64 i386 sparc64; OK henning@ mikeb@


Revision tags: OPENBSD_5_3_BASE OPENBSD_5_4_BASE
# 1.68 18-Oct-2012 deraadt

Convert a number of old private copies of code which predates
pci_set_powerstate() to using it instead. Many of these chunks of code had
bugs in them, especially missing delay() calls. Some of them were doing
things our PCI subsystem is now responsible for handling. If you have
any of the affected devices, please keep an eye out for regressions.
ok kettenis


Revision tags: OPENBSD_4_9_BASE OPENBSD_5_0_BASE OPENBSD_5_1_BASE OPENBSD_5_2_BASE
# 1.67 27-Aug-2010 deraadt

Move the dc_pci_activate function to dc.c, and mangle it up with some of
the gunk in dc_powerhook. Then make dc_powerhook just call it
ok kettenis


Revision tags: OPENBSD_4_8_BASE
# 1.66 05-Aug-2010 deraadt

ca_activate function for suspend/resume; tested by mlarkin on a
Davicom DM9102. (bit of noise on suspend or resume, but that can be
dealt with later)


Revision tags: OPENBSD_4_7_BASE
# 1.65 15-Oct-2009 deraadt

Add detach support to a few more drivers, and in others do the neccessary
operations in the detach function in the right order. Also ensure that the
interrupt handlers not trust registers that go away.
read over very carefully by dms, tested by me


Revision tags: OPENBSD_4_6_BASE
# 1.64 26-Jun-2009 deraadt

Using information gleamed from the FreeBSD driver, change the MAC address
reading to use the eeprom instead of CIS, and then the Xircom Cardbus cards
can work in the expresscard adaptor, as pci devices.
ok jsg


# 1.63 02-Jun-2009 jsg

make dc at pci detachable; untested.


# 1.62 02-Jun-2009 jsg

Add more CardBus ids to PCI attachments to cope with
things like the crazy ExpressCard->CardBus adapters which
make CardBus devices show as PCI devices.


Revision tags: OPENBSD_4_5_BASE
# 1.61 11-Sep-2008 brad

ANSI function declarations.


# 1.60 11-Sep-2008 brad

Remove the redundant local variable 'revision' from the PCI attach function.
The softc field dc_revision contains the PCI revision. No functional change.


Revision tags: OPENBSD_4_3_BASE OPENBSD_4_4_BASE
# 1.59 26-Nov-2007 brad

print the comma before the MAC address string in dc_attach() instead of the
PCI front end attach function. This corrects the dmesg output for CardBus
adapters and ensures proper dmesg output if an error occurs in dc_attach().

ok dlg@


Revision tags: OPENBSD_4_2_BASE
# 1.58 01-Aug-2007 miod

Stop making de win over dc on alpha, and include both dc and de on all
installation media now - it fits.

THIS MEANS YOU NEED TO RENAME /etc/hostname.de0 TO /etc/hostname.dc0
BEFORE BOOTING A NEW KERNEL.

ok deraadt@


# 1.57 10-Apr-2007 miod

``it's'' -> ``its'' when the grammar gods require this change.


Revision tags: OPENBSD_4_1_BASE
# 1.56 13-Feb-2007 jsg

Add missing break in attach code.
ok tom@ claudio@ henning@


Revision tags: OPENBSD_4_0_BASE
# 1.55 20-Jul-2006 brad

update for the new ADMtek PCI ids.


# 1.54 18-Jul-2006 brad

attach to the ADMtek 983B chipset as well.


# 1.53 17-Jun-2006 brad

add sys/timeout.h


Revision tags: OPENBSD_3_9_BASE
# 1.52 06-Nov-2005 brad

- remove spl from attach
- de-allocate resources on failure to attach


Revision tags: OPENBSD_3_8_BASE
# 1.51 09-Aug-2005 mickey

do not set PCI_COMMAND_MASTER_ENABLE explicitly as it's already set in pcisubmatch(); kettenis@ testing; brad@ ok


# 1.50 26-Mar-2005 mickey

simplify man! no need to outline pci_mapreg_map() anymore just use it


Revision tags: OPENBSD_3_7_BASE
# 1.49 16-Jan-2005 brad

- recognize Microsoft PCI and CardBus adapters
- recognize Hawking CardBus adapter
- simplify 3Com switch case and fold in with ADMtek case
- use 64-bit multicast hash for all instances of ADMtek 983 chipset

Hawking CardBus adapter reported by Alec Berryman <alec at thened dot net>
Microsoft adapters from FreeBSD dc(4) driver


# 1.48 16-Jan-2005 brad

get EEPROM width on all cards except for the original PNIC
or XIRCOM cards.

Based on the FreeBSD dc(4) driver.


# 1.47 14-Jan-2005 brad

rev 1.63

Avoid an unnecessary copy of a packet if it is already in a single mbuf.
Introduce an additional device flag for those NICs which require the
transmit buffers to be aligned to 32-bit boundaries.

From FreeBSD


# 1.46 08-Jan-2005 brad

rev 1.125

Don't read the MAC address from a copy of the EEPROM in the softc
that has been recorded earlier and overwrite it again later by
reading it directly from the EEPROM again.

Read the MAC address from the PAR0/PAR1 registers instead, which
are autoloaded on reboot.

From FreeBSD

Thanks to David Snyder <dasnyderx at yahoo dot com> for testing on
a AN983 based card which used to come up with a MAC address of
ff:ff:ff:ff:ff:ff.


# 1.45 28-Sep-2004 brad

Use ETHER_MIN_LEN/ETHER_MAX_DIX_LEN


Revision tags: OPENBSD_3_6_BASE
# 1.44 04-Aug-2004 mickey

kill hppa quirk that is not needed


# 1.43 28-Jun-2004 mickey

do not force into io space on hppa as it's much slower


Revision tags: OPENBSD_3_5_BASE SMP_SYNC_A SMP_SYNC_B
# 1.42 21-Oct-2003 deraadt

a 3com tulip, wow; christoph.scheurer@ch.tum.de


# 1.41 07-Oct-2003 fgsch

use PCI_PMCSR instead of some magic value.
ok krw@ henning@


# 1.40 29-Sep-2003 mickey

fix the dc_cacheline to 16 on hppa


Revision tags: OPENBSD_3_4_BASE
# 1.39 16-Aug-2003 henning

AN983 needs 64BIT_HASH too, fixes multicast
From: jared r r spiegel <jrrs@gateway.nodeless.net>


# 1.38 26-Jun-2003 mickey

it's better w/ a comma between irq and address


Revision tags: UBC_SYNC_A
# 1.37 17-May-2003 jason

fix up the media handling for the intel based MACs. Also hack around a
bug in the Momenco firmware on the Leopard-V, which now has one port
working.


# 1.36 29-Apr-2003 jason

- remove last vestige of "old autoconf": dc_unit is dead, long live dv_xname
- remove a bunch of #if 0 stuff (most of which referred to dc_unit, grr)
- delay a bzero until necessary


# 1.35 19-Apr-2003 henning

Davicom DM9009 support

tested by Lucas Reddinger <lucas at wlwdesigns.com>


Revision tags: OPENBSD_3_3_BASE UBC_SYNC_B
# 1.34 20-Oct-2002 henning

add support for intel 21145
This chip is some strange abnormal 21143 variant. It really only works with
10 MBit/s halfduplex only and autonegotiation is totally broken in hardware.
Should also have a HomePNA phy, but we don't support that.
for now requires and explicit "media 10BaseT".
if anybody has such a chip please mail me.

nick@ is the only one who has the hardware and did an incredible amount of
testing. Thanks for all the help, Nick!

some hints and ok jason@


Revision tags: OPENBSD_3_2_BASE
# 1.33 09-Jun-2002 art

unbreak sparc64 kernel builds after the arpcom change.


# 1.32 18-Apr-2002 jason

add support for Conexant LANfinity RS7112; based on patch from Maurice Nonnekes <maurice@amaze.nl> based on FreeBSD (only minor surgery necessary)


# 1.31 16-Apr-2002 jason

move prototypes of dc_eeprom_width, dc_read_srom, and dc_parse_21143_srom to dcreg.h and out of the bus specific drivers


Revision tags: OPENBSD_3_1_BASE
# 1.30 01-Apr-2002 nate

Don't have dc and de return the same match value in any case.
Comment the reasoning for the various return values in dc_pci_match.
dc is preferred over de on all archs except for alpha where de is used.
The main reason dc is not preferred on alpha is that it doesn't fit
on the floppy, so RAMDISK and GENERIC would have different drivers for
the same device which is rather confusing.


# 1.29 22-Mar-2002 jason

On sparc64, try local-mac-address before falling back to myetheraddr()


# 1.28 14-Mar-2002 millert

First round of __P removal in sys


# 1.27 06-Mar-2002 nate

remove unused #include


# 1.26 04-Mar-2002 nate

21140 support for dc isn't reliable enough for it to win over dc.
dc doesn't fit on the alpha ramdisk, so let de win in all cases.


# 1.25 17-Feb-2002 nate

make dc win on alpha too


# 1.24 17-Feb-2002 nate

Make dc match with higher priorit over de for 21142/3 chips
Also match on 21140


# 1.23 11-Jan-2002 nordin

Check result from malloc(9) when using M_NOWAIT. fgsch@ ok


Revision tags: UBC_BASE
# 1.22 13-Dec-2001 nate

branches: 1.22.2;
Fix old alpha bug recently triggered by conversion to busdma.


# 1.21 06-Dec-2001 jason

enough bus_dmamap_sync() and htole()/letoh() to get TX working on sparc64.
ALso, get the MAC address from myetheraddr() instead of trying to use the eeprom on sparc64.


# 1.20 06-Dec-2001 jason

Checkpoint bus_dma work in progress:
- descriptor lists are now bus_dma allocated and manipulated
(for those keeping score: 6 vtophys dead, 4 to go)


# 1.19 06-Nov-2001 miod

Replace inclusion of <vm/foo.h> with the correct <uvm/bar.h> when necessary.
(Look ma, I might have broken the tree)


Revision tags: OPENBSD_3_0_BASE
# 1.18 06-Oct-2001 aaron

We must read the SROM ahead of time for all ADMtek-based PCI cards; based on
patch from ckuethe@pyxis.cns.ualberta.ca in PR/2102. At some point after 3.0
I must de-cruftify the dc(4) matching code to avoid such errors. :(


# 1.17 25-Aug-2001 art

Change pci_intr_map to take pci_attach_args as an argument.
All callers actually took all arguments to pci_intr_map from pci_attach_args
structs, so this simplifies code.
This also allows more complicated interrupt assignment schemes like the one
on sparc64.

This makes sparc64 pci interrupts work.

Inspired by the same change in NetBSD.


# 1.16 22-Aug-2001 aaron

Support more dc(4) CardBus devices, including the AN985-based Linksys PCMPC200
10/100 CardBus Ethernet adapter (thanks to beck@ for the donation).


# 1.15 14-Aug-2001 aaron

Call dc_read_srom with the correct width; patch from gluk@. Fixes problems
with multiple 21143 interfaces.


# 1.14 12-Aug-2001 mickey

remove redundant vm includes


Revision tags: OPENBSD_2_9_BASE
# 1.13 06-Apr-2001 aaron

branches: 1.13.4;
- For CardBus 21143 cards, parse the SROM. Makes my SMC EZ CardBus 10/100 work.
- General cleanup in the dc CardBus attachment.
- Split detach up into bus-dependent and bus-independent parts.
- Some function and variable renaming for consistency.


# 1.12 09-Feb-2001 aaron

Add support for parsing the media blocks from the SROM on the 21143 adapters.
These changes should make the driver work with the built-in Ethernet on the
Alpha Miata machines. From FreeBSD.

To make sure I didn't break anything (and as a general test), I tested the
modified driver with the following dc(4) variants: Macronix PMAC 98715,
Lite-On PNIC, Lite-On PNIC-II, ADMtek AL981, and ADMtek AN983.


# 1.11 16-Nov-2000 aaron

Add support for Accton EN2242 MiniPCI adapters as found in HP OmniBook XE3
laptops; from FreeBSD. No special changes needed here, just the addition of
the EN2242's product ID since it is an ADMtek Centaur chip.


Revision tags: OPENBSD_2_8_BASE
# 1.10 30-Oct-2000 aaron

Match the Macronix 98727/98732 chips.


# 1.9 27-Oct-2000 aaron

From FreeBSD:

Yet another bug fix/optimization for the Davicom DM9100/9102: increase the
PCI latency timer value to 0x80. Davicom's Linux driver does this, and it
drastically reduces the number of TX underruns in my tests. (Note: this is
done only for the Davicom chips. I'm not sure it's a good idea to do it
for all of them.)


# 1.8 27-Oct-2000 aaron

From FreeBSD:

Set the DC_TX_INTR_ALWAYS and DC_TX_STORENFWD flags for the Davicom chips.
Do not set DC_TX_ONE. The DC_TX_USE_INTR flag causes dc_encap() to set the
'interrupt on TX completion' bit only once every 64 packets. This is an
attempt to reduce the number of interrupts generated by the chip. You're
supposed to get a 'no more TX buffers left' interrupt once you hit the last
packet whether you ask for one or not, however it seems the Davicom chip
doesn't generate this interrupt, or at least it doesn't generate it under
the same circumstances. The result is that if you transmit n packets, where
n is less than 64, and then wait 5 seconds, you'll get a watchdog timeout
whether you want one or not. The DC_TX_INTR_ALWAYS causes dc_encap() to
request an interrupt for every frame.


# 1.7 16-Oct-2000 aaron

Use mii_attach() directly instead of mii_phy_probe().


# 1.6 13-Sep-2000 aaron

Sync with FreeBSD. Finally make the OpenBSD-specific changes necessary to make
non-MII 21143-based cards work. The sync just fixes the LED handling on these
kinds of adapters.


# 1.5 02-Aug-2000 aaron

Sync with FreeBSD. Summary of changes:

- Add support for Accton EN1217 Ethernet adapters.
- Fix problems with LEDs on some cards when clearing the jabber disable bit.
- Handle new Macronix chips whose multicast hash tables are only 128 bits.
- Fix timing issues during autonegotiation with Macronix and PNIC II.


# 1.4 12-Jun-2000 aaron

Fix ADMtek identity crisis (whoops, missed this file); thanks mickey@


Revision tags: OPENBSD_2_7_BASE
# 1.3 26-Apr-2000 mickey

we've done an oops


# 1.2 26-Apr-2000 mickey

dc_csid ain't needed no more; jason@ ok


# 1.1 18-Apr-2000 jason

split dc driver into bus dependent and bus independent (pci) parts
(cardbus to come later).


# 1.77 22-Feb-2022 guenther

Delete unnecessary #includes of <sys/domain.h> and/or <sys/protosw.h>

net/if_pppx.c pointed out by jsg@
ok gnezdo@ deraadt@ jsg@ mpi@ millert@


Revision tags: OPENBSD_6_2_BASE OPENBSD_6_3_BASE OPENBSD_6_4_BASE OPENBSD_6_5_BASE OPENBSD_6_6_BASE OPENBSD_6_7_BASE OPENBSD_6_8_BASE OPENBSD_6_9_BASE OPENBSD_7_0_BASE
# 1.76 11-Apr-2017 dhill

Partially revert previous mallocarray conversions that contain
constants.

The consensus is that if both operands are constant, we don't need
mallocarray. Reminded by tedu@

ok deraadt@


# 1.75 09-Apr-2017 dhill

Convert some malloc(9) to mallocarray(9)

ok deraadt@


Revision tags: OPENBSD_5_9_BASE OPENBSD_6_0_BASE OPENBSD_6_1_BASE
# 1.74 24-Nov-2015 mpi

You only need <net/if_dl.h> if you're using LLADDR() or a sockaddr_dl.


# 1.73 24-Nov-2015 mpi

The only network driver needing <net/if_types.h> is upl(4) for IFT_OTHER.


Revision tags: OPENBSD_5_8_BASE
# 1.72 14-Mar-2015 jsg

Remove some includes include-what-you-use claims don't
have any direct symbols used. Tested for indirect use by compiling
amd64/i386/sparc64 kernels.

ok tedu@ deraadt@


Revision tags: OPENBSD_5_7_BASE
# 1.71 22-Dec-2014 tedu

unifdef INET


Revision tags: OPENBSD_5_6_BASE
# 1.70 22-Jul-2014 mpi

Fewer <netinet/in_systm.h>


Revision tags: OPENBSD_5_5_BASE
# 1.69 07-Aug-2013 bluhm

Most network drivers include netinet/in_var.h, but apparently they
don't have to. Just remove these include lines.
Compiled on amd64 i386 sparc64; OK henning@ mikeb@


Revision tags: OPENBSD_5_3_BASE OPENBSD_5_4_BASE
# 1.68 18-Oct-2012 deraadt

Convert a number of old private copies of code which predates
pci_set_powerstate() to using it instead. Many of these chunks of code had
bugs in them, especially missing delay() calls. Some of them were doing
things our PCI subsystem is now responsible for handling. If you have
any of the affected devices, please keep an eye out for regressions.
ok kettenis


Revision tags: OPENBSD_4_9_BASE OPENBSD_5_0_BASE OPENBSD_5_1_BASE OPENBSD_5_2_BASE
# 1.67 27-Aug-2010 deraadt

Move the dc_pci_activate function to dc.c, and mangle it up with some of
the gunk in dc_powerhook. Then make dc_powerhook just call it
ok kettenis


Revision tags: OPENBSD_4_8_BASE
# 1.66 05-Aug-2010 deraadt

ca_activate function for suspend/resume; tested by mlarkin on a
Davicom DM9102. (bit of noise on suspend or resume, but that can be
dealt with later)


Revision tags: OPENBSD_4_7_BASE
# 1.65 15-Oct-2009 deraadt

Add detach support to a few more drivers, and in others do the neccessary
operations in the detach function in the right order. Also ensure that the
interrupt handlers not trust registers that go away.
read over very carefully by dms, tested by me


Revision tags: OPENBSD_4_6_BASE
# 1.64 26-Jun-2009 deraadt

Using information gleamed from the FreeBSD driver, change the MAC address
reading to use the eeprom instead of CIS, and then the Xircom Cardbus cards
can work in the expresscard adaptor, as pci devices.
ok jsg


# 1.63 02-Jun-2009 jsg

make dc at pci detachable; untested.


# 1.62 02-Jun-2009 jsg

Add more CardBus ids to PCI attachments to cope with
things like the crazy ExpressCard->CardBus adapters which
make CardBus devices show as PCI devices.


Revision tags: OPENBSD_4_5_BASE
# 1.61 11-Sep-2008 brad

ANSI function declarations.


# 1.60 11-Sep-2008 brad

Remove the redundant local variable 'revision' from the PCI attach function.
The softc field dc_revision contains the PCI revision. No functional change.


Revision tags: OPENBSD_4_3_BASE OPENBSD_4_4_BASE
# 1.59 26-Nov-2007 brad

print the comma before the MAC address string in dc_attach() instead of the
PCI front end attach function. This corrects the dmesg output for CardBus
adapters and ensures proper dmesg output if an error occurs in dc_attach().

ok dlg@


Revision tags: OPENBSD_4_2_BASE
# 1.58 01-Aug-2007 miod

Stop making de win over dc on alpha, and include both dc and de on all
installation media now - it fits.

THIS MEANS YOU NEED TO RENAME /etc/hostname.de0 TO /etc/hostname.dc0
BEFORE BOOTING A NEW KERNEL.

ok deraadt@


# 1.57 10-Apr-2007 miod

``it's'' -> ``its'' when the grammar gods require this change.


Revision tags: OPENBSD_4_1_BASE
# 1.56 13-Feb-2007 jsg

Add missing break in attach code.
ok tom@ claudio@ henning@


Revision tags: OPENBSD_4_0_BASE
# 1.55 20-Jul-2006 brad

update for the new ADMtek PCI ids.


# 1.54 18-Jul-2006 brad

attach to the ADMtek 983B chipset as well.


# 1.53 17-Jun-2006 brad

add sys/timeout.h


Revision tags: OPENBSD_3_9_BASE
# 1.52 06-Nov-2005 brad

- remove spl from attach
- de-allocate resources on failure to attach


Revision tags: OPENBSD_3_8_BASE
# 1.51 09-Aug-2005 mickey

do not set PCI_COMMAND_MASTER_ENABLE explicitly as it's already set in pcisubmatch(); kettenis@ testing; brad@ ok


# 1.50 26-Mar-2005 mickey

simplify man! no need to outline pci_mapreg_map() anymore just use it


Revision tags: OPENBSD_3_7_BASE
# 1.49 16-Jan-2005 brad

- recognize Microsoft PCI and CardBus adapters
- recognize Hawking CardBus adapter
- simplify 3Com switch case and fold in with ADMtek case
- use 64-bit multicast hash for all instances of ADMtek 983 chipset

Hawking CardBus adapter reported by Alec Berryman <alec at thened dot net>
Microsoft adapters from FreeBSD dc(4) driver


# 1.48 16-Jan-2005 brad

get EEPROM width on all cards except for the original PNIC
or XIRCOM cards.

Based on the FreeBSD dc(4) driver.


# 1.47 14-Jan-2005 brad

rev 1.63

Avoid an unnecessary copy of a packet if it is already in a single mbuf.
Introduce an additional device flag for those NICs which require the
transmit buffers to be aligned to 32-bit boundaries.

From FreeBSD


# 1.46 08-Jan-2005 brad

rev 1.125

Don't read the MAC address from a copy of the EEPROM in the softc
that has been recorded earlier and overwrite it again later by
reading it directly from the EEPROM again.

Read the MAC address from the PAR0/PAR1 registers instead, which
are autoloaded on reboot.

From FreeBSD

Thanks to David Snyder <dasnyderx at yahoo dot com> for testing on
a AN983 based card which used to come up with a MAC address of
ff:ff:ff:ff:ff:ff.


# 1.45 28-Sep-2004 brad

Use ETHER_MIN_LEN/ETHER_MAX_DIX_LEN


Revision tags: OPENBSD_3_6_BASE
# 1.44 04-Aug-2004 mickey

kill hppa quirk that is not needed


# 1.43 28-Jun-2004 mickey

do not force into io space on hppa as it's much slower


Revision tags: OPENBSD_3_5_BASE SMP_SYNC_A SMP_SYNC_B
# 1.42 21-Oct-2003 deraadt

a 3com tulip, wow; christoph.scheurer@ch.tum.de


# 1.41 07-Oct-2003 fgsch

use PCI_PMCSR instead of some magic value.
ok krw@ henning@


# 1.40 29-Sep-2003 mickey

fix the dc_cacheline to 16 on hppa


Revision tags: OPENBSD_3_4_BASE
# 1.39 16-Aug-2003 henning

AN983 needs 64BIT_HASH too, fixes multicast
From: jared r r spiegel <jrrs@gateway.nodeless.net>


# 1.38 26-Jun-2003 mickey

it's better w/ a comma between irq and address


Revision tags: UBC_SYNC_A
# 1.37 17-May-2003 jason

fix up the media handling for the intel based MACs. Also hack around a
bug in the Momenco firmware on the Leopard-V, which now has one port
working.


# 1.36 29-Apr-2003 jason

- remove last vestige of "old autoconf": dc_unit is dead, long live dv_xname
- remove a bunch of #if 0 stuff (most of which referred to dc_unit, grr)
- delay a bzero until necessary


# 1.35 19-Apr-2003 henning

Davicom DM9009 support

tested by Lucas Reddinger <lucas at wlwdesigns.com>


Revision tags: OPENBSD_3_3_BASE UBC_SYNC_B
# 1.34 20-Oct-2002 henning

add support for intel 21145
This chip is some strange abnormal 21143 variant. It really only works with
10 MBit/s halfduplex only and autonegotiation is totally broken in hardware.
Should also have a HomePNA phy, but we don't support that.
for now requires and explicit "media 10BaseT".
if anybody has such a chip please mail me.

nick@ is the only one who has the hardware and did an incredible amount of
testing. Thanks for all the help, Nick!

some hints and ok jason@


Revision tags: OPENBSD_3_2_BASE
# 1.33 09-Jun-2002 art

unbreak sparc64 kernel builds after the arpcom change.


# 1.32 18-Apr-2002 jason

add support for Conexant LANfinity RS7112; based on patch from Maurice Nonnekes <maurice@amaze.nl> based on FreeBSD (only minor surgery necessary)


# 1.31 16-Apr-2002 jason

move prototypes of dc_eeprom_width, dc_read_srom, and dc_parse_21143_srom to dcreg.h and out of the bus specific drivers


Revision tags: OPENBSD_3_1_BASE
# 1.30 01-Apr-2002 nate

Don't have dc and de return the same match value in any case.
Comment the reasoning for the various return values in dc_pci_match.
dc is preferred over de on all archs except for alpha where de is used.
The main reason dc is not preferred on alpha is that it doesn't fit
on the floppy, so RAMDISK and GENERIC would have different drivers for
the same device which is rather confusing.


# 1.29 22-Mar-2002 jason

On sparc64, try local-mac-address before falling back to myetheraddr()


# 1.28 14-Mar-2002 millert

First round of __P removal in sys


# 1.27 06-Mar-2002 nate

remove unused #include


# 1.26 04-Mar-2002 nate

21140 support for dc isn't reliable enough for it to win over dc.
dc doesn't fit on the alpha ramdisk, so let de win in all cases.


# 1.25 17-Feb-2002 nate

make dc win on alpha too


# 1.24 17-Feb-2002 nate

Make dc match with higher priorit over de for 21142/3 chips
Also match on 21140


# 1.23 11-Jan-2002 nordin

Check result from malloc(9) when using M_NOWAIT. fgsch@ ok


Revision tags: UBC_BASE
# 1.22 13-Dec-2001 nate

branches: 1.22.2;
Fix old alpha bug recently triggered by conversion to busdma.


# 1.21 06-Dec-2001 jason

enough bus_dmamap_sync() and htole()/letoh() to get TX working on sparc64.
ALso, get the MAC address from myetheraddr() instead of trying to use the eeprom on sparc64.


# 1.20 06-Dec-2001 jason

Checkpoint bus_dma work in progress:
- descriptor lists are now bus_dma allocated and manipulated
(for those keeping score: 6 vtophys dead, 4 to go)


# 1.19 06-Nov-2001 miod

Replace inclusion of <vm/foo.h> with the correct <uvm/bar.h> when necessary.
(Look ma, I might have broken the tree)


Revision tags: OPENBSD_3_0_BASE
# 1.18 06-Oct-2001 aaron

We must read the SROM ahead of time for all ADMtek-based PCI cards; based on
patch from ckuethe@pyxis.cns.ualberta.ca in PR/2102. At some point after 3.0
I must de-cruftify the dc(4) matching code to avoid such errors. :(


# 1.17 25-Aug-2001 art

Change pci_intr_map to take pci_attach_args as an argument.
All callers actually took all arguments to pci_intr_map from pci_attach_args
structs, so this simplifies code.
This also allows more complicated interrupt assignment schemes like the one
on sparc64.

This makes sparc64 pci interrupts work.

Inspired by the same change in NetBSD.


# 1.16 22-Aug-2001 aaron

Support more dc(4) CardBus devices, including the AN985-based Linksys PCMPC200
10/100 CardBus Ethernet adapter (thanks to beck@ for the donation).


# 1.15 14-Aug-2001 aaron

Call dc_read_srom with the correct width; patch from gluk@. Fixes problems
with multiple 21143 interfaces.


# 1.14 12-Aug-2001 mickey

remove redundant vm includes


Revision tags: OPENBSD_2_9_BASE
# 1.13 06-Apr-2001 aaron

branches: 1.13.4;
- For CardBus 21143 cards, parse the SROM. Makes my SMC EZ CardBus 10/100 work.
- General cleanup in the dc CardBus attachment.
- Split detach up into bus-dependent and bus-independent parts.
- Some function and variable renaming for consistency.


# 1.12 09-Feb-2001 aaron

Add support for parsing the media blocks from the SROM on the 21143 adapters.
These changes should make the driver work with the built-in Ethernet on the
Alpha Miata machines. From FreeBSD.

To make sure I didn't break anything (and as a general test), I tested the
modified driver with the following dc(4) variants: Macronix PMAC 98715,
Lite-On PNIC, Lite-On PNIC-II, ADMtek AL981, and ADMtek AN983.


# 1.11 16-Nov-2000 aaron

Add support for Accton EN2242 MiniPCI adapters as found in HP OmniBook XE3
laptops; from FreeBSD. No special changes needed here, just the addition of
the EN2242's product ID since it is an ADMtek Centaur chip.


Revision tags: OPENBSD_2_8_BASE
# 1.10 30-Oct-2000 aaron

Match the Macronix 98727/98732 chips.


# 1.9 27-Oct-2000 aaron

From FreeBSD:

Yet another bug fix/optimization for the Davicom DM9100/9102: increase the
PCI latency timer value to 0x80. Davicom's Linux driver does this, and it
drastically reduces the number of TX underruns in my tests. (Note: this is
done only for the Davicom chips. I'm not sure it's a good idea to do it
for all of them.)


# 1.8 27-Oct-2000 aaron

From FreeBSD:

Set the DC_TX_INTR_ALWAYS and DC_TX_STORENFWD flags for the Davicom chips.
Do not set DC_TX_ONE. The DC_TX_USE_INTR flag causes dc_encap() to set the
'interrupt on TX completion' bit only once every 64 packets. This is an
attempt to reduce the number of interrupts generated by the chip. You're
supposed to get a 'no more TX buffers left' interrupt once you hit the last
packet whether you ask for one or not, however it seems the Davicom chip
doesn't generate this interrupt, or at least it doesn't generate it under
the same circumstances. The result is that if you transmit n packets, where
n is less than 64, and then wait 5 seconds, you'll get a watchdog timeout
whether you want one or not. The DC_TX_INTR_ALWAYS causes dc_encap() to
request an interrupt for every frame.


# 1.7 16-Oct-2000 aaron

Use mii_attach() directly instead of mii_phy_probe().


# 1.6 13-Sep-2000 aaron

Sync with FreeBSD. Finally make the OpenBSD-specific changes necessary to make
non-MII 21143-based cards work. The sync just fixes the LED handling on these
kinds of adapters.


# 1.5 02-Aug-2000 aaron

Sync with FreeBSD. Summary of changes:

- Add support for Accton EN1217 Ethernet adapters.
- Fix problems with LEDs on some cards when clearing the jabber disable bit.
- Handle new Macronix chips whose multicast hash tables are only 128 bits.
- Fix timing issues during autonegotiation with Macronix and PNIC II.


# 1.4 12-Jun-2000 aaron

Fix ADMtek identity crisis (whoops, missed this file); thanks mickey@


Revision tags: OPENBSD_2_7_BASE
# 1.3 26-Apr-2000 mickey

we've done an oops


# 1.2 26-Apr-2000 mickey

dc_csid ain't needed no more; jason@ ok


# 1.1 18-Apr-2000 jason

split dc driver into bus dependent and bus independent (pci) parts
(cardbus to come later).


Revision tags: OPENBSD_6_2_BASE
# 1.76 11-Apr-2017 dhill

Partially revert previous mallocarray conversions that contain
constants.

The consensus is that if both operands are constant, we don't need
mallocarray. Reminded by tedu@

ok deraadt@


# 1.75 09-Apr-2017 dhill

Convert some malloc(9) to mallocarray(9)

ok deraadt@


Revision tags: OPENBSD_5_9_BASE OPENBSD_6_0_BASE OPENBSD_6_1_BASE
# 1.74 24-Nov-2015 mpi

You only need <net/if_dl.h> if you're using LLADDR() or a sockaddr_dl.


# 1.73 24-Nov-2015 mpi

The only network driver needing <net/if_types.h> is upl(4) for IFT_OTHER.


Revision tags: OPENBSD_5_8_BASE
# 1.72 14-Mar-2015 jsg

Remove some includes include-what-you-use claims don't
have any direct symbols used. Tested for indirect use by compiling
amd64/i386/sparc64 kernels.

ok tedu@ deraadt@


Revision tags: OPENBSD_5_7_BASE
# 1.71 22-Dec-2014 tedu

unifdef INET


Revision tags: OPENBSD_5_6_BASE
# 1.70 22-Jul-2014 mpi

Fewer <netinet/in_systm.h>


Revision tags: OPENBSD_5_5_BASE
# 1.69 07-Aug-2013 bluhm

Most network drivers include netinet/in_var.h, but apparently they
don't have to. Just remove these include lines.
Compiled on amd64 i386 sparc64; OK henning@ mikeb@


Revision tags: OPENBSD_5_3_BASE OPENBSD_5_4_BASE
# 1.68 18-Oct-2012 deraadt

Convert a number of old private copies of code which predates
pci_set_powerstate() to using it instead. Many of these chunks of code had
bugs in them, especially missing delay() calls. Some of them were doing
things our PCI subsystem is now responsible for handling. If you have
any of the affected devices, please keep an eye out for regressions.
ok kettenis


Revision tags: OPENBSD_4_9_BASE OPENBSD_5_0_BASE OPENBSD_5_1_BASE OPENBSD_5_2_BASE
# 1.67 27-Aug-2010 deraadt

Move the dc_pci_activate function to dc.c, and mangle it up with some of
the gunk in dc_powerhook. Then make dc_powerhook just call it
ok kettenis


Revision tags: OPENBSD_4_8_BASE
# 1.66 05-Aug-2010 deraadt

ca_activate function for suspend/resume; tested by mlarkin on a
Davicom DM9102. (bit of noise on suspend or resume, but that can be
dealt with later)


Revision tags: OPENBSD_4_7_BASE
# 1.65 15-Oct-2009 deraadt

Add detach support to a few more drivers, and in others do the neccessary
operations in the detach function in the right order. Also ensure that the
interrupt handlers not trust registers that go away.
read over very carefully by dms, tested by me


Revision tags: OPENBSD_4_6_BASE
# 1.64 26-Jun-2009 deraadt

Using information gleamed from the FreeBSD driver, change the MAC address
reading to use the eeprom instead of CIS, and then the Xircom Cardbus cards
can work in the expresscard adaptor, as pci devices.
ok jsg


# 1.63 02-Jun-2009 jsg

make dc at pci detachable; untested.


# 1.62 02-Jun-2009 jsg

Add more CardBus ids to PCI attachments to cope with
things like the crazy ExpressCard->CardBus adapters which
make CardBus devices show as PCI devices.


Revision tags: OPENBSD_4_5_BASE
# 1.61 11-Sep-2008 brad

ANSI function declarations.


# 1.60 11-Sep-2008 brad

Remove the redundant local variable 'revision' from the PCI attach function.
The softc field dc_revision contains the PCI revision. No functional change.


Revision tags: OPENBSD_4_3_BASE OPENBSD_4_4_BASE
# 1.59 26-Nov-2007 brad

print the comma before the MAC address string in dc_attach() instead of the
PCI front end attach function. This corrects the dmesg output for CardBus
adapters and ensures proper dmesg output if an error occurs in dc_attach().

ok dlg@


Revision tags: OPENBSD_4_2_BASE
# 1.58 01-Aug-2007 miod

Stop making de win over dc on alpha, and include both dc and de on all
installation media now - it fits.

THIS MEANS YOU NEED TO RENAME /etc/hostname.de0 TO /etc/hostname.dc0
BEFORE BOOTING A NEW KERNEL.

ok deraadt@


# 1.57 10-Apr-2007 miod

``it's'' -> ``its'' when the grammar gods require this change.


Revision tags: OPENBSD_4_1_BASE
# 1.56 13-Feb-2007 jsg

Add missing break in attach code.
ok tom@ claudio@ henning@


Revision tags: OPENBSD_4_0_BASE
# 1.55 20-Jul-2006 brad

update for the new ADMtek PCI ids.


# 1.54 18-Jul-2006 brad

attach to the ADMtek 983B chipset as well.


# 1.53 17-Jun-2006 brad

add sys/timeout.h


Revision tags: OPENBSD_3_9_BASE
# 1.52 06-Nov-2005 brad

- remove spl from attach
- de-allocate resources on failure to attach


Revision tags: OPENBSD_3_8_BASE
# 1.51 09-Aug-2005 mickey

do not set PCI_COMMAND_MASTER_ENABLE explicitly as it's already set in pcisubmatch(); kettenis@ testing; brad@ ok


# 1.50 26-Mar-2005 mickey

simplify man! no need to outline pci_mapreg_map() anymore just use it


Revision tags: OPENBSD_3_7_BASE
# 1.49 16-Jan-2005 brad

- recognize Microsoft PCI and CardBus adapters
- recognize Hawking CardBus adapter
- simplify 3Com switch case and fold in with ADMtek case
- use 64-bit multicast hash for all instances of ADMtek 983 chipset

Hawking CardBus adapter reported by Alec Berryman <alec at thened dot net>
Microsoft adapters from FreeBSD dc(4) driver


# 1.48 16-Jan-2005 brad

get EEPROM width on all cards except for the original PNIC
or XIRCOM cards.

Based on the FreeBSD dc(4) driver.


# 1.47 14-Jan-2005 brad

rev 1.63

Avoid an unnecessary copy of a packet if it is already in a single mbuf.
Introduce an additional device flag for those NICs which require the
transmit buffers to be aligned to 32-bit boundaries.

From FreeBSD


# 1.46 08-Jan-2005 brad

rev 1.125

Don't read the MAC address from a copy of the EEPROM in the softc
that has been recorded earlier and overwrite it again later by
reading it directly from the EEPROM again.

Read the MAC address from the PAR0/PAR1 registers instead, which
are autoloaded on reboot.

From FreeBSD

Thanks to David Snyder <dasnyderx at yahoo dot com> for testing on
a AN983 based card which used to come up with a MAC address of
ff:ff:ff:ff:ff:ff.


# 1.45 28-Sep-2004 brad

Use ETHER_MIN_LEN/ETHER_MAX_DIX_LEN


Revision tags: OPENBSD_3_6_BASE
# 1.44 04-Aug-2004 mickey

kill hppa quirk that is not needed


# 1.43 28-Jun-2004 mickey

do not force into io space on hppa as it's much slower


Revision tags: OPENBSD_3_5_BASE SMP_SYNC_A SMP_SYNC_B
# 1.42 21-Oct-2003 deraadt

a 3com tulip, wow; christoph.scheurer@ch.tum.de


# 1.41 07-Oct-2003 fgsch

use PCI_PMCSR instead of some magic value.
ok krw@ henning@


# 1.40 29-Sep-2003 mickey

fix the dc_cacheline to 16 on hppa


Revision tags: OPENBSD_3_4_BASE
# 1.39 16-Aug-2003 henning

AN983 needs 64BIT_HASH too, fixes multicast
From: jared r r spiegel <jrrs@gateway.nodeless.net>


# 1.38 26-Jun-2003 mickey

it's better w/ a comma between irq and address


Revision tags: UBC_SYNC_A
# 1.37 17-May-2003 jason

fix up the media handling for the intel based MACs. Also hack around a
bug in the Momenco firmware on the Leopard-V, which now has one port
working.


# 1.36 29-Apr-2003 jason

- remove last vestige of "old autoconf": dc_unit is dead, long live dv_xname
- remove a bunch of #if 0 stuff (most of which referred to dc_unit, grr)
- delay a bzero until necessary


# 1.35 19-Apr-2003 henning

Davicom DM9009 support

tested by Lucas Reddinger <lucas at wlwdesigns.com>


Revision tags: OPENBSD_3_3_BASE UBC_SYNC_B
# 1.34 20-Oct-2002 henning

add support for intel 21145
This chip is some strange abnormal 21143 variant. It really only works with
10 MBit/s halfduplex only and autonegotiation is totally broken in hardware.
Should also have a HomePNA phy, but we don't support that.
for now requires and explicit "media 10BaseT".
if anybody has such a chip please mail me.

nick@ is the only one who has the hardware and did an incredible amount of
testing. Thanks for all the help, Nick!

some hints and ok jason@


Revision tags: OPENBSD_3_2_BASE
# 1.33 09-Jun-2002 art

unbreak sparc64 kernel builds after the arpcom change.


# 1.32 18-Apr-2002 jason

add support for Conexant LANfinity RS7112; based on patch from Maurice Nonnekes <maurice@amaze.nl> based on FreeBSD (only minor surgery necessary)


# 1.31 16-Apr-2002 jason

move prototypes of dc_eeprom_width, dc_read_srom, and dc_parse_21143_srom to dcreg.h and out of the bus specific drivers


Revision tags: OPENBSD_3_1_BASE
# 1.30 01-Apr-2002 nate

Don't have dc and de return the same match value in any case.
Comment the reasoning for the various return values in dc_pci_match.
dc is preferred over de on all archs except for alpha where de is used.
The main reason dc is not preferred on alpha is that it doesn't fit
on the floppy, so RAMDISK and GENERIC would have different drivers for
the same device which is rather confusing.


# 1.29 22-Mar-2002 jason

On sparc64, try local-mac-address before falling back to myetheraddr()


# 1.28 14-Mar-2002 millert

First round of __P removal in sys


# 1.27 06-Mar-2002 nate

remove unused #include


# 1.26 04-Mar-2002 nate

21140 support for dc isn't reliable enough for it to win over dc.
dc doesn't fit on the alpha ramdisk, so let de win in all cases.


# 1.25 17-Feb-2002 nate

make dc win on alpha too


# 1.24 17-Feb-2002 nate

Make dc match with higher priorit over de for 21142/3 chips
Also match on 21140


# 1.23 11-Jan-2002 nordin

Check result from malloc(9) when using M_NOWAIT. fgsch@ ok


Revision tags: UBC_BASE
# 1.22 13-Dec-2001 nate

branches: 1.22.2;
Fix old alpha bug recently triggered by conversion to busdma.


# 1.21 06-Dec-2001 jason

enough bus_dmamap_sync() and htole()/letoh() to get TX working on sparc64.
ALso, get the MAC address from myetheraddr() instead of trying to use the eeprom on sparc64.


# 1.20 06-Dec-2001 jason

Checkpoint bus_dma work in progress:
- descriptor lists are now bus_dma allocated and manipulated
(for those keeping score: 6 vtophys dead, 4 to go)


# 1.19 06-Nov-2001 miod

Replace inclusion of <vm/foo.h> with the correct <uvm/bar.h> when necessary.
(Look ma, I might have broken the tree)


Revision tags: OPENBSD_3_0_BASE
# 1.18 06-Oct-2001 aaron

We must read the SROM ahead of time for all ADMtek-based PCI cards; based on
patch from ckuethe@pyxis.cns.ualberta.ca in PR/2102. At some point after 3.0
I must de-cruftify the dc(4) matching code to avoid such errors. :(


# 1.17 25-Aug-2001 art

Change pci_intr_map to take pci_attach_args as an argument.
All callers actually took all arguments to pci_intr_map from pci_attach_args
structs, so this simplifies code.
This also allows more complicated interrupt assignment schemes like the one
on sparc64.

This makes sparc64 pci interrupts work.

Inspired by the same change in NetBSD.


# 1.16 22-Aug-2001 aaron

Support more dc(4) CardBus devices, including the AN985-based Linksys PCMPC200
10/100 CardBus Ethernet adapter (thanks to beck@ for the donation).


# 1.15 14-Aug-2001 aaron

Call dc_read_srom with the correct width; patch from gluk@. Fixes problems
with multiple 21143 interfaces.


# 1.14 12-Aug-2001 mickey

remove redundant vm includes


Revision tags: OPENBSD_2_9_BASE
# 1.13 06-Apr-2001 aaron

branches: 1.13.4;
- For CardBus 21143 cards, parse the SROM. Makes my SMC EZ CardBus 10/100 work.
- General cleanup in the dc CardBus attachment.
- Split detach up into bus-dependent and bus-independent parts.
- Some function and variable renaming for consistency.


# 1.12 09-Feb-2001 aaron

Add support for parsing the media blocks from the SROM on the 21143 adapters.
These changes should make the driver work with the built-in Ethernet on the
Alpha Miata machines. From FreeBSD.

To make sure I didn't break anything (and as a general test), I tested the
modified driver with the following dc(4) variants: Macronix PMAC 98715,
Lite-On PNIC, Lite-On PNIC-II, ADMtek AL981, and ADMtek AN983.


# 1.11 16-Nov-2000 aaron

Add support for Accton EN2242 MiniPCI adapters as found in HP OmniBook XE3
laptops; from FreeBSD. No special changes needed here, just the addition of
the EN2242's product ID since it is an ADMtek Centaur chip.


Revision tags: OPENBSD_2_8_BASE
# 1.10 30-Oct-2000 aaron

Match the Macronix 98727/98732 chips.


# 1.9 27-Oct-2000 aaron

From FreeBSD:

Yet another bug fix/optimization for the Davicom DM9100/9102: increase the
PCI latency timer value to 0x80. Davicom's Linux driver does this, and it
drastically reduces the number of TX underruns in my tests. (Note: this is
done only for the Davicom chips. I'm not sure it's a good idea to do it
for all of them.)


# 1.8 27-Oct-2000 aaron

From FreeBSD:

Set the DC_TX_INTR_ALWAYS and DC_TX_STORENFWD flags for the Davicom chips.
Do not set DC_TX_ONE. The DC_TX_USE_INTR flag causes dc_encap() to set the
'interrupt on TX completion' bit only once every 64 packets. This is an
attempt to reduce the number of interrupts generated by the chip. You're
supposed to get a 'no more TX buffers left' interrupt once you hit the last
packet whether you ask for one or not, however it seems the Davicom chip
doesn't generate this interrupt, or at least it doesn't generate it under
the same circumstances. The result is that if you transmit n packets, where
n is less than 64, and then wait 5 seconds, you'll get a watchdog timeout
whether you want one or not. The DC_TX_INTR_ALWAYS causes dc_encap() to
request an interrupt for every frame.


# 1.7 16-Oct-2000 aaron

Use mii_attach() directly instead of mii_phy_probe().


# 1.6 13-Sep-2000 aaron

Sync with FreeBSD. Finally make the OpenBSD-specific changes necessary to make
non-MII 21143-based cards work. The sync just fixes the LED handling on these
kinds of adapters.


# 1.5 02-Aug-2000 aaron

Sync with FreeBSD. Summary of changes:

- Add support for Accton EN1217 Ethernet adapters.
- Fix problems with LEDs on some cards when clearing the jabber disable bit.
- Handle new Macronix chips whose multicast hash tables are only 128 bits.
- Fix timing issues during autonegotiation with Macronix and PNIC II.


# 1.4 12-Jun-2000 aaron

Fix ADMtek identity crisis (whoops, missed this file); thanks mickey@


Revision tags: OPENBSD_2_7_BASE
# 1.3 26-Apr-2000 mickey

we've done an oops


# 1.2 26-Apr-2000 mickey

dc_csid ain't needed no more; jason@ ok


# 1.1 18-Apr-2000 jason

split dc driver into bus dependent and bus independent (pci) parts
(cardbus to come later).