Commit Graph

41 Commits

Author SHA1 Message Date
Paolo Pisati
ef544f6312 o break newbus api: add a new argument of type driver_filter_t to
bus_setup_intr()

o add an int return code to all fast handlers

o retire INTR_FAST/IH_FAST

For more info: http://docs.freebsd.org/cgi/getmsg.cgi?fetch=465712+0+current/freebsd-current

Reviewed by: many
Approved by: re@
2007-02-23 12:19:07 +00:00
Gleb Smirnoff
6b9f5c941c - Consistently use if_printf() only in interface methods: if_start(),
if_watchdog, etc., or in functions used only in these methods.
  In all other functions in the driver use device_printf().
- Use __func__ instead of typing function name.

Submitted by:	Alex Lyashkov <umka sevcity.net>
2006-09-15 15:16:12 +00:00
John Baldwin
f73c6b9d92 - Use PCIR_BAR macro rather than hardcoding 0x10.
- Use pci_enable_busmaster() rather than doing it by hand.
- Remove duplicate if_free().
2005-09-29 14:56:30 +00:00
Warner Losh
ad4f426ef6 Make sure that we call if_free(ifp) after bus_teardown_intr. Since we
could get an interrupt after we free the ifp, and the interrupt
handler depended on the ifp being still alive, this could, in theory,
cause a crash.  Eliminate this possibility by moving the if_free to
after the bus_teardown_intr() call.
2005-09-19 03:10:21 +00:00
Ruslan Ermilov
ad61f89618 Fix "struct ifnet" leaks when attach() fails in the middle. 2005-09-16 11:25:19 +00:00
Robert Watson
13f4c340ae Propagate rename of IFF_OACTIVE and IFF_RUNNING to IFF_DRV_OACTIVE and
IFF_DRV_RUNNING, as well as the move from ifnet.if_flags to
ifnet.if_drv_flags.  Device drivers are now responsible for
synchronizing access to these flags, as they are in if_drv_flags.  This
helps prevent races between the network stack and device driver in
maintaining the interface flags field.

Many __FreeBSD__ and __FreeBSD_version checks maintained and continued;
some less so.

Reviewed by:	pjd, bz
MFC after:	7 days
2005-08-09 10:20:02 +00:00
Brooks Davis
fc74a9f93a Stop embedding struct ifnet at the top of driver softcs. Instead the
struct ifnet or the layer 2 common structure it was embedded in have
been replaced with a struct ifnet pointer to be filled by a call to the
new function, if_alloc(). The layer 2 common structure is also allocated
via if_alloc() based on the interface type. It is hung off the new
struct ifnet member, if_l2com.

This change removes the size of these structures from the kernel ABI and
will allow us to better manage them as interfaces come and go.

Other changes of note:
 - Struct arpcom is no longer referenced in normal interface code.
   Instead the Ethernet address is accessed via the IFP2ENADDR() macro.
   To enforce this ac_enaddr has been renamed to _ac_enaddr.
 - The second argument to ether_ifattach is now always the mac address
   from driver private storage rather than sometimes being ac_enaddr.

Reviewed by:	sobomax, sam
2005-06-10 16:49:24 +00:00
Warner Losh
538565c4a5 Use BUS_PROBE_DEFAULT for pci probe return value 2005-03-05 18:30:12 +00:00
Warner Losh
098ca2bda9 Start each of the license/copyright comments with /*-, minor shuffle of lines 2005-01-06 01:43:34 +00:00
Poul-Henning Kamp
fe12f24bb0 Add missing <sys/module.h> includes 2004-05-30 20:08:47 +00:00
Nate Lawson
5f96beb9e0 Convert callers to the new bus_alloc_resource_any(9) API.
Submitted by:	Mark Santcroos <marks@ripe.net>
Reviewed by:	imp, dfr, bde
2004-03-17 17:50:55 +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
David E. O'Brien
aad970f1fe Use __FBSDID().
Also some minor style cleanups.
2003-08-24 17:55:58 +00:00
Warner Losh
4fbd232c86 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 05:54:52 +00:00
Hartmut Brandt
865613a3d4 Implement the ATMIOCOPENVCC and ATMIOCCLOSEVCC ioctls(). This was the
last driver that did not know about those.
2003-08-05 13:39:36 +00:00
Hartmut Brandt
3786d0183e Make the en(4) driver more like the other ATM drivers. This is the
preparation for supporting the OPENVCC and CLOSEVCC ioctls which
are needed for ng_atm. This required some re-organisation of the code
(mostly converting array indexes to pointers). This also gives us
an array of open vccs that will help in using the generic GETVCCS handler.
2003-08-05 12:02:25 +00:00
Hartmut Brandt
1ba46a03b7 Make the midway driver use the new ATM phy driver. This allows one to
toggle several media options (sonet/sdh, for example) with ifconfig and
to see the carrier state in ifconfig's output. It gives also read/write
access (given the right privilegs) to the S/Uni registers to user space
programs.
2003-06-13 12:08:09 +00:00
David E. O'Brien
f4636c5959 Use __FBSDID(). 2003-06-11 06:34:30 +00:00
Hartmut Brandt
2102bdf21a Define a link layer MIB for ATM. Most fields of this MIB are needed by
ILMI daemons. Factor out common softc fields for all ATM interfaces that
need to be externally visible into an ifatm structure and make the midway
driver using this structure and fill the MIB.
2003-05-05 16:35:52 +00:00
Hartmut Brandt
d2c96fc51f Add module data and version to the atm_subr and reference this info from the
(currently) only consumer (en).

Add a sysctl node hw.atm where the atm drivers will hook on their hardware
sysctl sub-trees.

Make atm_ifattach call if_attach and remove the corresponding call to if_attach
from en. Create atm_ifdetach and use that in en.

While the last change actually changes the interface this is not a problem in
practice because the only other consumer of this API is an older LANAI driver
on the net, that is not ready for current anyway.

Reviewed by:	-atm
2003-04-29 08:07:44 +00:00
Hartmut Brandt
33cfde03bc Convert the midway driver to use busdma. Except for this conversion the
following changes have been done:

- stylify. The original code was too hard to read.
- get rid of a number of compilation options (Adaptec-only, Eni-only, no-DMA).
- more debugging features.
- locking. This is not correct yet in the absence of interface layer locking,
  but is correct enough to not to cause lock order reversals.
- remove RAW mode. There are no users of this in the tree and I doubt that
  there are any.
- remove NetBSD compatibility code. There was no way to keep NetBSD non-busdma
  and FreeBSD busdma code together.
- if_en now buildable as a module.

This has been actively tested on sparc64 and i386 with ENI server and
client cards and an Adaptec card (thanks to kjc).

Reviewed by:	mdodd, arr
2003-04-25 16:14:03 +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
Alfred Perlstein
e51a25f850 Remove __P. 2002-03-20 02:08:01 +00:00
Kenjiro Cho
44b5247d95 newbusify the en atm driver. 2000-11-07 09:31:28 +00:00
Bruce Evans
f18c4450ac Added used include of <machine/bus.h> -- don't depend on evil namespace
pollution in <sys/mutex.h>.  This was half fixed in rev.1.3 of
midwayreg.h.  The pollution exposed the bug that this driver was using
toy versions of the bus space macros under FreeBSD.  Disabling the
toy versions made this driver compile but dependent on the pollution.
There was still a toy version of bus_space_read_1() in unreachable code.
2000-11-04 15:03:34 +00:00
Poul-Henning Kamp
41f7aa55ba Make LINT compile again. 2000-10-22 16:09:12 +00:00
Poul-Henning Kamp
db7e3af111 Remove unneeded #include <machine/clock.h> 2000-10-15 14:19:01 +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
Mike Smith
3ed7a59b07 Clean up after removing sys/eventhandler.h from sys/systm.h at the last
minute.  This should cover all of the missed cases (and should let LINT
build again).
1999-08-21 22:10:49 +00:00
Mike Smith
fcb893a801 Implement a new generic mechanism for attaching handler functions to
events, in order to pave the way for removing a number of the ad-hoc
implementations currently in use.

Retire the at_shutdown family of functions and replace them with
new event handler lists.

Rework kern_shutdown.c to take greater advantage of the use of event
handlers.

Reviewed by:	green
1999-08-21 06:24:40 +00:00
Peter Wemm
9929d2a045 Eliminate a bunch of #include "pci.h" and #if NPCI > 0 around entire
files.  config will leave the whole file out if configured to do so.
1999-07-03 20:17:08 +00:00
Peter Wemm
35ce6c413e Missing revision markers. 1999-05-09 17:12:25 +00:00
Peter Wemm
579f45fa60 Simplify the COMPAT_PCI_DRIVER/DATA_SET hack. We can add:
#define COMPAT_PCI_DRIVER(name,data) DATA_SET(pcidevice_set,data)
.. to 2.2.x and 3.x if people think it's worth it.  Driver writers can do
this if it's not defined.  (The reason for this is that I'm trying to
progressively eliminate use of linker_sets where it hurts modularity and
runtime load capability, and these DATA_SET's keep getting in the way.)
1999-05-09 17:07:30 +00:00
Peter Wemm
96b3554e5c Use COMPAT_PCI_DRIVER() for registration if it exists. This shouldn't
hurt the driver portability to 3.x too much for where drivers are shared.
1999-04-24 20:17:05 +00:00
Kenjiro Cho
1e7bb3a362 cleanup: remove part of the code for 2.1.
add two functions to get the MAC address of the card.

Obtained from: ALTQ
1999-01-09 12:56:17 +00:00
Matthew Dillon
2cbe36f725 probe function changed from returning char * to const char *. 1998-12-14 06:37:37 +00:00
Archie Cobbs
2127f26023 Examine all occurrences of sprintf(), strcat(), and str[n]cpy()
for possible buffer overflow problems. Replaced most sprintf()'s
with snprintf(); for others cases, added terminating NUL bytes where
appropriate, replaced constants like "16" with sizeof(), etc.

These changes include several bug fixes, but most changes are for
maintainability's sake. Any instance where it wasn't "immediately
obvious" that a buffer overflow could not occur was made safer.

Reviewed by:	Bruce Evans <bde@zeta.org.au>
Reviewed by:	Matthew Dillon <dillon@apollo.backplane.com>
Reviewed by:	Mike Spengler <mks@networkcs.com>
1998-12-04 22:54:57 +00:00
Bruce Evans
55b211e3af Removed unused #includes. 1997-10-28 15:59:26 +00:00
Bruce Evans
4d1d4912ae Added used #include - don't depend on <sys/mbuf.h> including
<sys/malloc.h> (unless we only use the bogusly shared M*WAIT flags).
1997-09-02 01:19:47 +00:00
Kenjiro Cho
413fe3928f import Chuck Cranor's ATM driver 1997-05-09 07:48:14 +00:00