Commit Graph

161 Commits

Author SHA1 Message Date
Maxime Henrion
ec6a729924 Some integrated Davicom cards in sparc64 boxes have an all zeros
MAC address in the EEPROM, and we need to get it from OpenFirmware.
This isn't very pretty but time is lacking to do this in a better
way this near 5.2-RELEASE.  This is a RELENG_5_2 candidate.

Original version by:	Marius Strobl <marius@alchemy.franken.de>
Tested by:		Pete Bentley <pete@sorted.org>
Reviewed by:		jake
2004-01-08 19:08:27 +00:00
Don Lewis
4ff4a9bee9 The transmit frame status is stored in the last transmit descriptor for the
frame, not the first.  It is probably also not safe to free the mbuf chain
as soon as the OWN bit is cleared on the first descriptor since the chip
may not be done copying the frame into the transmit FIFO.  Revert the part of
of busdma conversion (if_dc.c rev 1.115) which changed dc_txeof() to look for
the status in the first descriptor and free the mbuf chain when processing
the first descriptor for the frame, and revert the matching changes elsewhere
in the driver.  This part of the busdma change caused the driver to report
spurious collisions and output errors, even when running in full-duplex mode.
Reverting the mbuf chain handling slightly complicates dc_dma_map_txbuf(),
since it is responsible for setting the OWN bits on the descriptors, but does
not normally have direct access to the mbuf chain.

Tested by:
  Dejan Lesjak <dejan.lesjak at ijs.si>  alpha/<Intel 21143 10/100BaseTX>
  "Xin LI" <delphij at frontfree.net>    i386/<Macronix 98713 10/100BaseTX>
  Wiktor Niesiobedzki <bsd at w.evip.pl> i386/<3Com OfficeConnect 10/100B>

Reviewed by:	mux
2004-01-08 06:22:15 +00:00
MIHIRA Sanpei Yoshiro
773c505f3c Add support for ELECOM/Laneed CardBus FastEtherner Card(LD-CBL/TXA)
Submitted by:	Masahiro Yamagishi <night@pluto.dti.ne.jp>
Approved by:	re (scottl)
2003-12-06 02:29:31 +00:00
Warner Losh
347934fa63 Sometimes cardbus attachments don't attach, so while we track down
this problem put these lines back in.  While they should be
unnecessary, they appear to be sometimes necessary.

Reviewed in concept: dfr
Approved by: re (scottl@)
2003-11-28 05:28:29 +00:00
Sam Leffler
5120abbfb4 Drop the driver lock around calls to if_input to avoid a LOR when
the packets are immediately returned for sending (e.g.  when bridging
or packet forwarding).  There are more efficient ways to do this
but for now use the least intrusive approach.

Reviewed by:	imp, rwatson
2003-11-14 19:00:32 +00:00
David E. O'Brien
4dc52c32bf Remove duplicate FBSDID's, move others to their right place. 2003-11-14 17:16:58 +00:00
Warner Losh
3373489b49 reconst poison
re-de u_intXX_t
2003-11-14 05:45:39 +00:00
David E. O'Brien
aa8255025a Try to create some sort of consistency in how the routings to find the
multicast hash are written.  There are still two distinct algorithms used,
and there actually isn't any reason each driver should have its own copy
of this function as they could all share one copy of it (if it grew an
additional argument).
2003-11-13 20:55:53 +00:00
Doug Rabson
0be389f3ca Remove explicit cardbus attachments from drivers where this is identical
to the pci attachment. Cardbus is a derived class of pci so all pci
drivers are automatically available for matching against cardbus devices.

Reviewed by: imp
2003-11-03 09:22:18 +00:00
Ruslan Ermilov
05992bb56b Correct the spelling of m_devget() in the sysctl variable description. 2003-11-02 21:43:29 +00:00
Brooks Davis
9bf40ede4a Replace the if_name and if_unit members of struct ifnet with new members
if_xname, if_dname, and if_dunit. if_xname is the name of the interface
and if_dname/unit are the driver name and instance.

This change paves the way for interface renaming and enhanced pseudo
device creation and configuration symantics.

Approved By:	re (in principle)
Reviewed By:	njl, imp
Tested On:	i386, amd64, sparc64
Obtained From:	NetBSD (if_xname)
2003-10-31 18:32:15 +00:00
Warner Losh
9d51aaa4e8 Const poison crc routines (why these aren't centralized, I'm not sure). 2003-10-23 16:57:38 +00:00
Mike Silbersack
a10c0e4574 Fix a problem where m_defrag would allocate a new mbuf to replace the
chain passed into dc_encap, which dc_start was unaware of.  This caused
the old (now invalid) mbuf to be passed to BPF_MTAP.

Spotted by:	Kenjiro Cho <kjc@csl.sony.co.jp>
2003-10-19 23:05:19 +00:00
Martin Blapp
87f4fa1512 Ignore CSR13, CSR14, CSR15 'Media Specific Data' registers
for 21143 based cards which use SIA mode.

This fixes 10mbit mode for ZNYX ZX346Q cards and other
21143 based cards.

PR:		32118
Submitted by:	Rene de Vries <rene@tunix.nl>
		Geert Jan de Groot <GeertJan.deGroot@tunix.nl>

Obtained from:	BSDI

MFC after:	2 weeks
2003-10-05 19:57:10 +00:00
Martin Blapp
129eaf7996 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.

Tested on AN985, AN983B. According to the datasheets, it should
also work for the AL981 (I don't have such a chip on a card at home)

PR:             52988
Submitted by:   Andrew Gordon <arg-bsd@arg.me.uk>
MFC after:      2 weeks
2003-09-16 05:01:27 +00:00
John Baldwin
e27951b29c Use PCIR_BAR(x) instead of PCIR_MAPS.
Glanced over by:	imp, gibbs
Tested by:		i386 LINT
2003-09-02 17:30:40 +00:00
Martin Blapp
4a80e74bf3 All davicom cards seem to need DC_TX_ALIGN. 2003-08-27 08:13:34 +00:00
Martin Blapp
7dfdc26c46 Make TX on davicom 9102A working again. This chip needs
its mbufs aligned on TX.

PR:		53656, 42714
MFC after:	3 days
2003-08-24 23:47:44 +00:00
David E. O'Brien
aad970f1fe Use __FBSDID().
Also some minor style cleanups.
2003-08-24 17:55:58 +00:00
Warner Losh
19b7ffd1b8 Prefer new location of pci include files (which have only been in the
tree for two or more years now), except in a few places where there's
code to be compatible with older versions of FreeBSD.
2003-08-22 07:20:27 +00:00
Warner Losh
38d8c9940b Prefer new location of pci include files (which have only been in the
tree for two or more years now), except in a few places where there's
code to be compatible with older versions of FreeBSD.
2003-08-22 06:42:59 +00:00
Sam Leffler
c06eb4e293 Change instances of callout_init that specify MPSAFE behaviour to
use CALLOUT_MPSAFE instead of "1" for the second parameter.  This
does not change the behaviour; it just makes the intent more clear.
2003-08-19 17:51:11 +00:00
Maxime Henrion
aafb3ebbe3 Use the BUS_DMA_ZERO flag. 2003-07-27 14:00:02 +00:00
Warner Losh
4c16d09eda Add support for FA-511; Submitted by: Kenneth P. Stox; Pr 42858 2003-07-19 06:01:15 +00:00
Bill Paul
e7b9ab3aaa Add support for a bunch of Microsoft networking products:
- MN-110 10/100 USB ethernet (ADMtek Pegasus II, if_aue)
- MN-120 10/100 cardbus (ADMtek Centaur-C, if_dc)
- MN-130 10/100 PCI (ADMtek Centaur-P, if_dc)

Also update dc(4) man page to mention support for MN-120 and MN-130.
2003-07-10 18:43:17 +00:00
Maxime Henrion
af4358c71e Make the dc(4) driver endian-clean, so to that it works on sparc64.
There are such cards in Netra X1 boxes, which should thus be fully
supported now.

Tested by:	jake
2003-07-09 15:03:10 +00:00
Maxime Henrion
56e5e7ae57 Convert the dc(4) driver to the busdma API. This is a necessary step
to have this driver working on sparc64.  It still needs to be made
endian-clean before it can work there.

Special thanks to dragonk@evilcode.net for sending me a dc(4) card so
that I was able to do this work.

Many cheers to all the people that tested this change, thanks to them,
this change shouldn't break anything :-).

Tested by:	marcel (i386 and ia64), ru (i386), wilko (alpha),
		mbr (i386), wpaul (i386) and
		Will Saxon <WillS@housing.ufl.edu> (i386)
2003-07-06 21:45:31 +00:00
Maxime Henrion
3d6ae7e047 Fix a bug that could cause dc(4) to m_freem() an already freed
mbuf or something that isn't an mbuf.

MFC after:	3 days
2003-07-06 14:39:45 +00:00
Maxime Henrion
b3811c9583 Various style(9) and readability fixes. 2003-07-06 14:36:33 +00:00
Warner Losh
b84e866a18 Due to extreme bogusness in the pci bus layer, these drivers were
forced to do slightly bogus power state manipulation.  However, this
is one of those features that is preventing further progress, so mark
them as BURN_BIRDGES like I did for the drivers in sys/dev/...

This, like the other change, are a no-op unless you have BURN_BRIDGES
in your kernel.
2003-07-03 21:39:53 +00:00
Martin Blapp
e351d778f2 Add ADMtek ADM9511 and ADM9513 device ID's.
PR:		PR51823
Submitted by:	Kaho Toshikazu <kaho@elam.kais.kyoto-u.ac.jp>
Reviewed by:	phk
MFC after:	2 days
2003-06-08 10:11:55 +00:00
Maxime Henrion
1edc4c46b8 Change a :
bzero(ptr, sizeof(DC_RXLEN * 5));
which should obviously be:
	bzero(ptr, DC_RXLEN * 5);

Looks like this bug may have reduced the effectiveness of the
workaround for the hardware bug in the PNIC chips.

MFC after:	1 week
2003-06-01 22:09:12 +00:00
Maxime Henrion
0934f18afb - Style(9) fixes, most notably :
o Remove register keyword
	o ANSIfy prototypes
	o Remove "return;" at the end of void functions
	o Remove trailing spaces
	o Don't align local variables with tabs and reorder them
	o Don't use /* FOO */ at the end of a #ifdef FOO block if
	  it's a small block
- Other non-functional changes :
	o 6 -> ETHER_ADDR_LEN
	o Don't initialize if_output; ether_ifattach() does it for us
2003-06-01 19:26:34 +00:00
Poul-Henning Kamp
19ca58475e Remove unnecessary breaks.
Remove unused variables.
Add XXX comment where a break may be missing. [lxtphy.c]

Found by:       FlexeLint
2003-05-31 19:48:33 +00:00
Martin Blapp
f956e0b3f0 Only use a SIA/SYM media info block if no MII block is detected.
The submitter of PR 32118 told me that this patch also fixes autoselecting
for znyx 4 port cards (10baseT, 100baseTX did work already).

PR:		32118
Reviewed by:	imp
Approved by:	rwatson (re)
2003-05-15 16:53:29 +00:00
Martin Blapp
7eac366be1 Add support for 3Com OfficeConnect 10/100B.
PR:		49059, 50747
Submitted by:	Dax Eckenberg <daxbert@dweebsoft.com>
Reviewed by:	imp, jhb
Approved by:	jhb
MFC after:	2 weeks
2003-05-12 19:50:21 +00:00
Martin Blapp
acc1bccccd Use only a 64bit hash filter table for ADM-Centaur cards like the
Accton EN2242 and the ADMtek AN985 cards.

PR:		32699
Submitted by:	Jean-Luc Richier <Jean-Luc.Richier@imag.fr>
Reviewed by:	phk
MFC after:	2 weeks
2003-05-01 09:31:01 +00:00
Warner Losh
214073e5e4 Use newly minted device_is_attached rather than device_is_alive to see
if attach succeeded.  device_is_alive just tells us that probe
succeeded.  Since we were using it to do things like detach net
interfaces, this caused problems when there were errors in the attach
routine.

Symptoms of problem reported by: martin blapp
2003-04-21 18:34:04 +00:00
MIHIRA Sanpei Yoshiro
97f9172896 Add support for Planex FNW-3602-T(CardBus 100M/10M).
Submitted by:	kazz <kazz@v001.vaio.ne.jp>
Obtained from:	[bsd-nomads:16637]
2003-04-18 15:42:25 +00:00
Nate Lawson
693f4477b1 Revise attach/detach resource cleanup
- Unconditionally call *_stop() if device is in the tree. This is to
  prevent callouts from happening after the device is gone. Checks for
  bus_child_present() should be added in the future to keep from touching
  potentially non-existent hardware in *_detach().  Found by iedowse@.
- Always check for and free miibus children, even if the device is not in
  the tree since some failure cases could have gotten here.
- Call ether_ifdetach() in the irq setup failure case
- ti(4), xl(4): move ifmedia_init() calls to the beginning of attach so
  that ifmedia_removeall() can be unconditionally called on detach. There
  is no way to detect whether ifmedia has been initialized without using
  a separate variable (as tl(4) does).
- Add comments to indicate assumptions of code path
2003-04-17 20:32:06 +00:00
Ian Dowse
2ea36df806 Revert part of revision 1.97 by calling dc_stop() unconditionally
in dc_detach() instead of only calling it if the hardware is preset.
This is a workaround for page faults in softclock() after a `dc'
device was detached, caused by not disabling a timer before freeing
its memory. The bus_child_present() checks should probably be
re-added later, but only to avoid the hardware accesses and not the
other resource cleanups in dc_stop().

Approved by:	njl
2003-04-17 08:36:52 +00:00
Matthew N. Dodd
533294b956 - Don't call pci_enable_io() in drivers (unless needed for resume).
- Don't test memory/port status and emit an error message; the PCI
  bus code will do this now.
2003-04-16 03:16:57 +00:00
Matthew N. Dodd
f246e4a17f - Express hard dependencies on bus (pci, isa, pccard) and
network layer (ether).
- Don't abuse module names to facilitate ifconfig module loading;
  such abuse isn't really needed.  (And if we do need type information
  associated with a module then we should make it explicit and not
  use hacks.)
2003-04-15 06:37:30 +00:00
David E. O'Brien
8368cf8f75 Use __FBSDID rather than rcsid[]. 2003-04-03 21:36:33 +00:00
John Baldwin
59f47d29b7 Add missing ()'s so that these drivers all compile again.
Noticed by:	jake
Tested on:	i386 (compile)
2003-03-31 20:22:00 +00:00
Nate Lawson
54f1f1d1e6 Clean up locking and resource management for pci/if_*
- Remove locking of the softc in the attach method, instead depending on
  bus_setup_intr being at the end of attach (delaying interrupt enable until
  after ether_ifattach is called)
- Call *_detach directly in the error case of attach, depending on checking
  in detach to only free resources that were allocated.  This puts all
  resource freeing in one place, avoiding thinkos that lead to memory leaks.
- Add bus_child_present check to calls to *_stop in the detach method to
  be sure hw is present before touching its registers.
- Remove bzero softc calls since device_t should do this for us.
- dc: move interrupt allocation back where it was before.  It was unnecessary
  to move it.  This reverts part of 1.88
- rl: move irq allocation before ether_ifattach.  Problems might have been
  caused by allocating the irq after enabling interrupts on the card.
- rl: call rl_stop before ether_ifdetach
- sf: call sf_stop before ether_ifdetach
- sis: add missed free of sis_tag
- sis: check errors from tag creation
- sis: move dmamem_alloc and dmamap_load to happen at same time as tag creation
- sk: remove duplicate initialization of sk_dev
- ste: add missed bus_generic_detach
- ti: call ti_stop before ether_ifdetach
- ti: add missed error setting in ti_rdata alloc failure
- vr: add missed error setting in I/O, memory mapping cases
- xl: add missed error setting in I/O, memory mapping cases
- xl: remove multi-level goto on attach failure
- xl: move dmamem_alloc and dmamap_load to happen at same time as tag creation
- Calls to free(9) are unconditional because it is valid to call free with a
  null pointer.

Reviewed by:	imp, mdodd
2003-03-31 17:29:43 +00:00
Mike Silbersack
cda97c506e Update if_dc to use m_defrag, removing the semi-duplicate dc_coal
function.

Also, use m_defrag where appropriate to defrag long mbuf chains
in the same fashion as was done in if_sis.c.  Before this change,
if_dc would blow up and take down the interface if fed a really long
mbuf chain.

MFC after:	2 weeks
2003-03-29 21:27:07 +00:00
Matthew N. Dodd
868d8b6286 - Use if_broadcastaddr from struct ifnet rather than relying on
extern 'etherbroadcastaddr'.
- Make 'etherbroadcastaddr' static.

Reviewed by:	 imp
2003-03-21 17:53:16 +00:00
Warner Losh
a163d034fa Back out M_* changes, per decision of the TRB.
Approved by: trb
2003-02-19 05:47:46 +00:00
Warner Losh
6d0dd93192 Minor correction to comment: PNIC and XIRCOM have eeprom, its just
non-standard.
2003-02-12 07:16:15 +00:00