Commit Graph

131 Commits

Author SHA1 Message Date
John Baldwin
acf7d97237 Fix the PCI attach routine to properly setup the IRQ and port resource
rid's and to deallocate resources if a failure occurs during attach.  This
patch also fixes the driver to return failure if bus_alloc_resource() for
the IRQ fails rather than panic'ing on the next line by passing a NULL
resource to bus_setup_intr().  The other attachments already do all this.

Submitted by:	Jun Su <csujun@263.net>
2004-01-22 16:07:03 +00:00
David E. O'Brien
a55a017f42 Don't use caddr_t in mchash(). Also use C99 spellings over BSD ones.
Requested by:	bde,imp
2003-12-08 07:54:15 +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
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
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
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
David E. O'Brien
aad970f1fe Use __FBSDID().
Also some minor style cleanups.
2003-08-24 17:55:58 +00:00
Warner Losh
d2c5276d96 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:39:05 +00:00
Poul-Henning Kamp
2da1191964 Don't inline ridiculously very large functions.
Compared to the contents of these functions, an extra function call
is nano-peanuts.
2003-07-22 09:22:00 +00:00
Scott Long
f6b1c44d1f Mega busdma API commit.
Add two new arguments to bus_dma_tag_create(): lockfunc and lockfuncarg.
Lockfunc allows a driver to provide a function for managing its locking
semantics while using busdma.  At the moment, this is used for the
asynchronous busdma_swi and callback mechanism.  Two lockfunc implementations
are provided: busdma_lock_mutex() performs standard mutex operations on the
mutex that is specified from lockfuncarg.  dftl_lock() is a panic
implementation and is defaulted to when NULL, NULL are passed to
bus_dma_tag_create().  The only time that NULL, NULL should ever be used is
when the driver ensures that bus_dmamap_load() will not be deferred.
Drivers that do not provide their own locking can pass
busdma_lock_mutex,&Giant args in order to preserve the former behaviour.

sparc64 and powerpc do not provide real busdma_swi functions, so this is
largely a noop on those platforms.  The busdma_swi on is64 is not properly
locked yet, so warnings will be emitted on this platform when busdma
callback deferrals happen.

If anyone gets panics or warnings from dflt_lock() being called, please
let me know right away.

Reviewed by:	tmm, gibbs
2003-07-01 15:52:06 +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
Warner Losh
a163d034fa Back out M_* changes, per decision of the TRB.
Approved by: trb
2003-02-19 05:47:46 +00:00
Alfred Perlstein
44956c9863 Remove M_TRYWAIT/M_WAITOK/M_WAIT. Callers should use 0.
Merge M_NOWAIT/M_DONTWAIT into a single flag M_NOWAIT.
2003-01-21 08:56:16 +00:00
Sam Leffler
673d91916d network interface driver changes:
o don't strip the Ethernet header from inbound packets; pass packets
  up the stack intact (required significant changes to some drivers)
o reference common definitions in net/ethernet.h (e.g. ETHER_ALIGN)
o track ether_ifattach/ether_ifdetach API changes
o track bpf changes (use BPF_TAP and BPF_MTAP)
o track vlan changes (ifnet capabilities, revised processing scheme, etc.)
o use if_input to pass packets "up"
o call ether_ioctl for default handling of ioctls

Reviewed by:	many
Approved by:	re
2002-11-14 23:54:55 +00:00
Poul-Henning Kamp
8c5d013757 Fix mis-indentation.
Spotted by:	FlexeLint
2002-10-02 09:09:25 +00:00
Alfred Perlstein
e51a25f850 Remove __P. 2002-03-20 02:08:01 +00:00
Matthew Dillon
ecde8f7c29 Get rid of the twisted MFREE() macro entirely.
Reviewed by:	dg, bmilekic
MFC after:	3 days
2002-02-05 02:00:56 +00:00
Yoshihiro Takahashi
f44a4f377e - Don't overwrite inb, inw and outw.
- Move the lance_probe function to if_lnc.c.
- Support C-NET(98)S again.

Submitted by:		chi@bd.mbn.or.jp (Chiharu Shibata) and nyan
No response from:	Paul Richards
2001-07-04 13:00:21 +00:00
Ian Dowse
f7cbf2b00e Use a module name of 'if_lnc' in both the PCI and ISA sections of
the driver. Doing this breaks the ability to unload the unneeded
parts of the driver (e.g unload the PCI section when using an ISA
card), but currently ifconfig(8) expects an interface `XXX' to have
a driver name of `if_XXX'.

PR:		kern/25582
Submitted by:	Alexander N. Kabaev <kabaev@mail.ru>, imp (apparently
		Warner suggested a similar fix some time ago).
Reviewed by:	paul (who would prefer to see ifconfig changed instead)
2001-03-18 17:44:23 +00:00
Ian Dowse
783e9b1a7a There were a few changes missed when this file was converted to
newbus in revision 1.19. As a result, lnc was, I believe, broken
for all PCI cards. The softc fields `lnc_btag' and `lnc_bhandle'
were not initialised, `rap', `rdp' and `bdp' were initialised to
the wrong values, and the size of the DMA ring memory was calculated
incorrectly.

Paul Richards has further cleanups in the pipeline, but this at
least is enough to make the driver usable with VMware.

Approved by:	paul
2001-03-02 00:40:06 +00:00
Poul-Henning Kamp
6817526d14 Convert if_multiaddrs from LIST to TAILQ so that it can be traversed
backwards in the three drivers which want to do that.

Reviewed by:    mikeh
2001-02-06 10:12:15 +00:00
Poul-Henning Kamp
78d82c8c59 Use LIST_FOREACH() to traverse ifp->if_multiaddrs list, instead of
<sys/queue.h> implementation details.

Created with:   /usr/sbin/sed
Reviewed with:  /sbin/md5
2001-02-03 16:29:10 +00:00
Peter Wemm
2eedcf55e9 Remove unused #include "lnc.h" 2001-01-29 11:19:30 +00:00
Garrett Wollman
c9fce3556d Make it clear that the macro `inb' is being overridden. 2001-01-09 04:23:56 +00:00
Paul Richards
8fcbbfe4a3 The pci and isa drivers were meant to share the same devclass but
the devclass definitions were all wrong so they had their own private
ones with the same name.

Fix it so they all use the same global devclass.
2000-12-29 11:59:41 +00:00
Paul Richards
7716c31841 Set a lower probe return value for PCI cards so that the pcn driver wins. 2000-12-29 11:41:18 +00:00
Paul Richards
b31d9f17b1 Fix a legacy issue. The offset for reading the MAC address is 0 using
bus space, not iosize which is what it was when using inb().
2000-12-29 04:41:52 +00:00
Paul Richards
d4dc2d4d0f Switch off some debugging code. 2000-12-16 03:29:27 +00:00
Paul Richards
3a173aeeb3 Fixup some problems with the merged code of the previous commit. 2000-12-16 01:41:14 +00:00
Paul Richards
232b06012c Newbusify.
Temporarily disable PC98 until I bring it up to date.
2000-12-16 01:33:28 +00:00
Hajimu UMEMOTO
39715b6a8a fix problem with vmware DAD. reported by many, tested @ IETF49 with
help from Florent Parent <Florent.Parent@viagenie.qc.ca>.

Obtained from:	KAME
2000-12-11 18:53:40 +00:00
David Malone
7cc0979fd6 Convert more malloc+bzero to malloc+M_ZERO.
Submitted by:	josh@zipperup.org
Submitted by:	Robert Drehmel <robd@gmx.net>
2000-12-08 21:51:06 +00:00
Archie Cobbs
21b8ebd926 Make all Ethernet drivers attach using ether_ifattach() and detach using
ether_ifdetach().

The former consolidates the operations of if_attach(), ng_ether_attach(),
and bpfattach(). The latter consolidates the corresponding detach operations.

Reviewed by:	julian, freebsd-net
2000-07-13 22:54:34 +00:00
Jun-ichiro itojun Hagino
2f0dab8f41 be sure to wipe out m_pkthdr when you set M_PKTHDR, you may see junk pointer
in m_pkthdr portion.
actually, we should not change pkthdr mbuf <-> non-pkthdr mbuf.
2000-07-04 18:43:32 +00:00
Gary Jennejohn
06157db316 MF4: add support for the Am79C973. 2000-06-18 08:12:54 +00:00
Peter Wemm
ad4805bb07 Unused includes: #include "pci.h" and #include "lnc.h" 2000-06-10 11:13:39 +00:00
Brian Somers
fa33ce4b09 Dynamically allocate softc structures
Reviewed by: Mark Knight <mkn@uk.FreeBSD.org>
2000-06-09 17:03:29 +00:00
Peter Wemm
6a4c2576dc Mass update of isa drivers using compatability shims to use
COMPAT_ISA_DRIVER() so that we can get rid of the evil isa_compat.h table.
2000-05-28 13:40:48 +00:00
Yoshihiro Takahashi
67d17d7279 Fixed to support PC-98. 2000-05-19 16:31:45 +00:00
Paul Richards
4d2d5ed69d Replace all references to lnc_softc with a typedef. 2000-05-16 02:30:53 +00:00
Paul Richards
33f38fdc5b Update copyright. 2000-05-16 02:18:49 +00:00
Paul Richards
9b55e84fec Re-organise lnc driver in preparation for newbusifying it. 2000-05-16 02:08:04 +00:00
Paul Richards
7e84fbbdfd Unchain lnc include files. 2000-05-14 19:14:41 +00:00
Paul Richards
2e054666c6 Fix includes to build from /sys/dev/lnc 2000-05-14 18:21:39 +00:00
Paul Richards
e30ce7f9de Sync with the BPF and BRIDGE changes. 2000-05-14 17:37:34 +00:00
Peter Wemm
365c5db0a7 Add $FreeBSD$ 2000-05-01 20:32:07 +00:00
Poul-Henning Kamp
3389ae9350 Remove ~25 unneeded #include <sys/conf.h>
Remove ~60 unneeded #include <sys/malloc.h>
2000-04-19 14:58:28 +00:00
Warner Losh
d0d3b8345b Ahhrggg. Put the test for the compat shims AFTER the file that includes
them.

Pointed out by: bde
2000-03-27 20:24:02 +00:00
Warner Losh
76fbc068b8 Per conversations in -current, add #error to these drivers when you don't
have the right compatibility shims enabled.  ISA drivers to follow later.
2000-03-27 18:32:45 +00:00
Paul Richards
c4bf272b86 Update the copyright. Remove the advertising clause. 2000-03-20 00:53:46 +00:00