Commit Graph

95 Commits

Author SHA1 Message Date
joerg 34110c5c6d - device/softc split 2008-07-09 16:14:57 +00:00
joerg 7a5458e4c2 Constify device table. 2008-07-09 16:06:02 +00:00
martin ce099b4099 Remove clause 3 and 4 from TNF licenses 2008-04-28 20:22:51 +00:00
cegger 9d57c80079 use aprint_*_dev and device_xname 2008-04-10 19:13:36 +00:00
dyoung 8ce2158b0c pci_activate() expects for its void * argument to be a device_t,
so change the type of the argument to device_t.  Update each use
of pci_activate().

Use device_t and accessors.  Use aprint_*_dev().
2008-03-21 07:47:43 +00:00
dyoung d347ff7717 Prepare for PMF self-suspension: in the if_stop() methods, clear
IFF_UP and IFF_RUNNING before running the 'disable' step, instead
of after.  Soon I will handle the 'disable' step by calling into
PMF, which may call if_stop(, 0).  Ordinarily, that is harmless.
This change lets the if_stop() routines exit early when they find
on entry that IFF_RUNNING is not set.
2008-03-11 23:58:06 +00:00
dyoung b480b62270 Make many ethernet drivers share the common code for MII media
handling, ether_mediastatus() and ether_mediachange().  Check for
a non-ENXIO error return from mii_mediachg().  (ENXIO indicates
that a PHY is suspended.)

This patch shrinks the source code size by 979 lines.  There was
a 5100-byte savings on the NetBSD/i386 kernel configuration, ALL.

I have made a few miscellaneous changes, too:

gem(4): use LIST_EMPTY(), LIST_FOREACH().
mtd(4): handle media ioctls, for a change!
axe(4): do not track link status in sc->axe_link any longer
nfe(4), aue(4), axe(4), udav(4), url(4): do not reset all PHYs
        on a change of media

Except for the change to mtd(4), no functional changes are intended.

XXX This patch affects more architectures than I can feasibly
XXX compile and run.  I have compiled macppc, sparc64, i386.  I
XXX have run the patches on i386 boxen with bnx(4) and sip(4).
XXX Compiling and running on evbmips (MERAKI, ADM5120) is in
XXX progress.
2008-01-19 22:10:14 +00:00
ad a2a3828545 machine/{bus,cpu,intr}.h -> sys/{bus,cpu,intr}.h 2007-10-19 11:59:34 +00:00
ad 88ab7da936 Merge some of the less invasive changes from the vmlocking branch:
- kthread, callout, devsw API changes
- select()/poll() improvements
- miscellaneous MT safety improvements
2007-07-09 20:51:58 +00:00
jmcneill b52635a353 Add VT6105M (Rhine III) to the list of supported devices, as found in the
Soekris net5501.
2007-06-15 21:08:21 +00:00
christos 53524e44ef Kill caddr_t; there will be some MI fallout, but it will be fixed shortly. 2007-03-04 05:59:00 +00:00
christos 168cd830d2 __unused removal on arguments; approved by core. 2006-11-16 01:32:37 +00:00
tsutsui 527c7a697a Use uintNN_t. 2006-11-05 13:05:18 +00:00
tsutsui 690e60f366 Pull several fixes which improve TX error handling
from FreeBSD's if_vr.c rev 1.52:
- check more error status in TX descriptor and restart TX module
  appropriately in vr_txeof()
- check more error interrupt status in vr_intr()

I can't confirm whether these changes actually fix TX stalls because
I can't reproduce the problem I had about seven years ago (I guess
it might be caused by excessive collisions on a dumb hub), but at least
they don't seem to have bad side effects on normal operations on my macppc.
2006-11-03 08:41:05 +00:00
tsutsui c2d79bf895 Don't touch the VR_STICKHW register on VT3043.
The commit log in FreeBSD's if_vr.c rev 1.43 says
"This is really only for the VT6102, but it doesn't hurt the older chips,"
but at least it hurts my VT86C100A (which returns a product ID of VT3043)
on macppc and causes kernel MCHK trap while the same board on i386
and VT6102 on macppc have no problem with it.
2006-11-02 17:32:11 +00:00
tsutsui 7f2c078b18 Pull some RX fixes from FreeBSD's if_vr.c rev 1.59:
- in vr_rxeoc() (i.e. on RX error interrupts), disable RX before
  calling vr_rxeof() and check it actually stopped
- no recovery is needed for VR_ISR_DROPPED, so just account ierrors
- also account ierrors in vr_rxeoc()
2006-11-02 11:02:58 +00:00
tsutsui 06503d5611 - make DMA descriptor members volatile
- set VR_RXSTAT_OWN after all other descriptor data is set

With these changes, vr_init() seems to initialize
the vr chip stuck on RX properly.
2006-11-02 10:44:30 +00:00
scw d269f28650 Force a reload of the EEPROM if the MAC address is all zeroes.
Fixes PR kern/34812.
2006-10-20 10:31:06 +00:00
christos 4d595fd7b1 - sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386
2006-10-12 01:30:41 +00:00
christos 63bbcb495a re-factor the pci powestate api. reviewed by gimpy 2006-06-17 23:34:26 +00:00
christos 95e1ffb156 merge ktrace-lwp. 2005-12-11 12:16:03 +00:00
thorpej 505f0442e5 Eliminate use of M_HASFCS. 2005-01-30 17:33:48 +00:00
scw 1464f79e43 In vr_start(), don't forget to free the new mbuf if the second
bus_dmamap_load_mbuf() fails.
2005-01-27 11:58:01 +00:00
jmmv 51b5451e34 Capture incomplete packets coming from the card, as this driver doesn't
support this feature.  This avoids multiple crashes that I've had in the
past.  Also ensure that packets are not empty when DIAGNOSTIC is set.

However, this is just another sanity check of the received packets, but
does not address the real problem.  The issue seems to be the following:
if the card receives data while doing a reset (vr_init), it later finds
a bunch of empty packets in the receive ring.

This explains the crashes I've hit: running a program which needs
promiscuous mode (dhclient) while the card was already running in
that mode (tcpdump).  In this situation, it's easy that the second
reset receives stuff from the network.

Unfortunately, I don't know why the card is producing these packets...

While here, fix a typo in a comment.
2005-01-25 17:02:09 +00:00
jmmv c4c2514524 Fix two typos. 2005-01-13 14:51:28 +00:00
thorpej e9818f5b5e When adding/deleting multicast addresses, only whack the address
filter if the interface is marked RUNNING.

Fixes kern/27678.
2004-10-30 18:08:34 +00:00
thorpej d17a849385 Use ANSI function decls and make use of static. 2004-08-21 22:48:18 +00:00
jdolecek 6d8183e508 add rnd hooks 2004-02-15 09:40:32 +00:00
jmcneill 1708376e44 Don't set VR_EECSR_LOAD before reading the MAC address on the VT6102 either. 2003-11-14 22:33:29 +00:00
scw c86e508708 On Rhine III, don't set VR_EECSR_LOAD before reading the MAC address.
This reloads the entire EEPROM, not just the MAC address, which can
cause problems for the host PCI bus under certain circumstances. The
chip already loads the EEPROM at powerup/reset anyway.

XXX: This probably applies to the other Rhine variants too, but I don't
have a data sheet to confirm this behaviour.
2003-11-13 22:29:09 +00:00
tsutsui f7772c7c77 - No need to set VR_TXCTL_TLINK in vr_start() because all TX buffers have
only single segment.
- No need to set VR_CMD_TX_ON in vr_start().
- Initialize BCR0 and BCR1 registers.
- Change RX DMA threshold 128bytes.

Mostly from FreeBSD via OpenBSD.
2003-10-17 17:42:35 +00:00
tsutsui 631fad8686 Misc cosmetics. 2003-10-17 16:39:09 +00:00
tsutsui 0a3ddecb47 Use common PCI macro/functions for PWRMGMT. 2003-10-17 16:00:43 +00:00
dogcow 171b7c3fa5 add VT6105 support to vr(4) 2003-08-23 00:14:28 +00:00
christos 1af07f5803 Add MIIF_FORCEANEG from Martin Husemann 2003-04-10 01:58:21 +00:00
bouyer 847cb1fa0d Zero out the buffer when padding packet to ETHER_MIN_LEN-ETHER_CRC_LEN 2003-01-15 22:01:57 +00:00
lha 615a1ff234 From freebsd if_vr.c:1.43,1.56 and if_vrreg.h:1.11,1.14
- Windows put the chip in suspended mode, make sure we unsuspend
  it. 1.43, by Takefumi SAYO <stake@po.shiojiri.ne.jp>

- Detect the revision of the Rhine chip we're using, and force reset
  when the chip supports it. 1.65, by silby@freebsd.org
2003-01-03 19:01:09 +00:00
fair 2104199dc3 Change the "dontcare bits" argument to ifmedia_init() to IFM_IMASK
so that it is possible select PHY instances other than the first
one (instance zero), if there is more than one PHY attached.
2002-10-21 23:38:10 +00:00
thorpej b75a007d9f Add trailing ; to CFATTACH_DECL. 2002-10-02 16:51:16 +00:00
thorpej 387fc6dc87 Use CFATTACH_DECL(). 2002-09-30 20:37:04 +00:00
thorpej f818766afe Declare all cfattach structures const. 2002-09-27 20:31:45 +00:00
christos 08ea4bc534 my card prints transmit aborted and then hangs. Let's try to reset it. 2002-07-28 15:41:00 +00:00
lukem 9048aaae21 add RCSID 2001-11-13 07:48:40 +00:00
mrg 4f3eac8332 mtod() with uintptr_t, not bus_addr_t. 2001-08-14 11:57:26 +00:00
thorpej bd35a1b7ed Make sure to initialize the all Rx descriptors properly in *_init()
even if mbufs for them are already allocated.
2001-07-23 17:26:50 +00:00
thorpej 44e529fecc Use BUS_DMA_READ and BUS_DMA_WRITE in some obvious places. 2001-07-19 16:36:14 +00:00
thorpej 80f54c0005 bcopy -> memcpy, strcpy 2001-07-07 16:40:23 +00:00
thorpej 9988acd41e Don't need INET or NS includes here. 2001-06-12 22:28:15 +00:00
wiz 0a600be867 receive, not recieve 2001-06-12 15:17:10 +00:00
tsutsui 013511e442 Use ether_crc32_be() for multicast hash calculation. 2001-01-29 12:04:10 +00:00