Commit Graph

22 Commits

Author SHA1 Message Date
Marius Strobl
51a753f9d8 Add a missing mtx_destroy() in hme_pci_detach().
Reviewed by:	yongari
Approved by:	re (scottl)
2005-07-10 10:36:45 +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
Marius Strobl
e12405280b - Fix braino introduced in rev. 1.17, unlike the X1032A (HME-ISP1040-combo)
and the X1034A (quad HME; QFE) cards the X1033A (single HME) don't have a
  PCI-PCI-bridge so we can't rely on the PCI slot number being useable as
  index for the network address to read from the VPD on the latter. Use
  the end tag to determine whether it is a QFE VPD with 4 NAs and only use
  the slot number as index in this case.
- Remove a useless check.

Prodded by:		joerg
Additional testing by:	joerg
MFC after:		1 day
2005-03-02 00:49:37 +00:00
Marius Strobl
6ff81db1a7 Add a note that all four HME chips on a SUNW,qfe card share the same PROM,
making it a bit more clear why we can read four NAs from the VPD.

MFC after:	1 day
2005-02-20 01:52:43 +00:00
Marius Strobl
be063afc20 Some changes related to reading the MAC-address from the VPD on systems
without Open Firmware:
- The PCI data structure of some HME PROMs contains a non-zero interface
  revision in the class code. Thus remove the checks for matching class
  code and PCI data structure length and revsion. These were pretty much
  useless anyway as we only really need the pointer to the VPD which is
  located before the structure length and revision fields.
- On Sun QFE (Quad FastEthernet) cards read the Nth MAC-address for the
  Nth HME controller instead of always the first one for all four HMEs. [1]
- Improve the comment describing the used VPD format to better reflect
  reality.
- Minor clean-up.

Prodded by:	joerg [1]
2004-12-12 00:32:51 +00:00
Pyun YongHyeon
38fa13a6a2 Make hme(4) mpsafe
- Let hme_start()/hme_init() acquire lock and then call
   hme_start_locked()/hme_init_locked() respectivly.
 - Teardown interrupt handler before hme_detach().
 - Remove IFF_NEEDSGIANT flag and mark interrupt handler INTR_MPSAFE.
 - Set callout handler to CALLOUT_MPSAFE.
 - Add locks in hme MII interface.

Reviewed by:	jake
Tested by:	Julian C. Dunn  <jdunn at opentrend dot net>
MFC after:	2 weeks
2004-11-22 06:46:30 +00:00
Marius Strobl
f348e5ac4b Make hme(4), i.e. the PCI-variant, MI by reading the MAC address on sytems
without Open Firmware directly instead of using OF_getetheraddr(). This is
a bit painful though, as the MAC address is contained in the NA field of
the VPD of the EBus bridge, which is is another function of the same chip.
To make it worse, the VPD of the EBus bridge can't be accessed via the PCI
capability pointer but has to be digged out from the Boot PROM and has a
non-standard format.
The PCI VPD struct and macros used here should be part of the FreeBSD PCI
code nevertheless.

Approved by:	tmm
Based on:	NetBSD
Tested with:	Sun X1032A (hme(4)-isp(4)-combo card) on alpha and i386
2004-08-14 22:38:20 +00:00
Marius Strobl
f7abebde9e - Use bus_space_subregion() rather than arithmetic on bus_space_handle_t. [1]
- Properly use the error variable and return it on failure in the attach-
  routines.

Reviewed by:	tmm
Inspired by:	NetBSD [1]
2004-08-12 20:37:02 +00:00
Poul-Henning Kamp
186f2b9e04 Add missing <sys/module.h> includes currently relying on nested include
in <sys/kernel.h>
2004-06-03 06:10:02 +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
Marcel Moolenaar
11a91bffe5 Preparatory commit to allow prototypes in ofw_machdep.h to contain
both newbus types and OFW types. This involves either including
<machine/bus.h> or <dev/ofw/openfirm.h>.

Reviewed by: jake, jmg, tmm
2003-09-02 20:24:42 +00:00
David E. O'Brien
aad970f1fe Use __FBSDID().
Also some minor style cleanups.
2003-08-24 17:55:58 +00:00
Marcel Moolenaar
70cba801e9 s#<foo/bar.h>#<dev/foo/bar.h>#g 2003-08-23 05:51:03 +00:00
Warner Losh
77e6a3b2dd 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:00:27 +00:00
Thomas Moestl
5905e65b56 Some gem and hme hardware bogusly has the intpin register hardwired to
0; detect this case and correct it. While being there, clean up nearby
comments.
2003-07-01 14:11:04 +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
Thomas Moestl
a0de7a9e73 Add detach, shutdown, suspend and resume methods.
Tested by:	jake
2003-01-09 00:45:10 +00:00
Thomas Moestl
7ee69ef245 Assorted fixes:
- remove some useless code from the status change handler that was intended
  to enable the the MII drivers for external phys; this is already done
  during interface initialization, and the deleted code made some
  assumptions about phy addresses that do not seem to hold true on newer
  cards. This should get at least one of the two hmes of newer Netra t1
  machines working.
- correct the interrupt resource allocation
- bump the number of RX descriptors, lower values cause promblems on some
  machines
2002-03-23 19:37:11 +00:00
Thomas Moestl
49921f1e25 Use the pci_enable_* functions instead of manually fiddling with the
command register.

Pointed out by:	msmith
2002-03-11 02:37:19 +00:00
Thomas Moestl
52381bfae4 Add a driver for the Sun HME PCI/SBus ethernet adaptor, which is onboard
in most machines of the Sun Ultra series. This is a port of the NetBSD
driver which I enhanced to make use of the gather functionality and the
configurable RX buffer offset to avoid copying all received/sent packet
(instead, packets will be directly DMAd from mbuf chains and into mbuf
clusters now).
2002-02-27 17:35:48 +00:00