Commit Graph

20 Commits

Author SHA1 Message Date
Warner Losh
9f15b72029 Spell destroy in a more traditional way 2005-07-19 22:26:44 +00:00
Warner Losh
083dc134a1 Nits 2005-07-13 14:54:40 +00:00
Warner Losh
880266e041 Minor cleanup of ep driver and pccard attachment:
o Grab the MAC address out of the CIS if the card has the special
  3Com 0x88 tuple.  Most 3Com cards don't have this tuple, but we
  prefer it to the eeprom since it only appears to be present when
  the eeprom doesn't have the info.  So far, I've only observed this
  on my 3C362 and 3C362B cards, but the NetBSD driver implies that
  the 3C362C also has this tuple, and that some 3C574 cards do too (none
  of mine do).  ep_pccard_mac was written after looking at the NetBSD
  code.
o Store the enet addr in the softc for this device, so we can use the
  overridden MAC to set the station address.
o Create a routine to set the station address and use it where we need it.
o setup the cmd shitfs and such before we call ep_alloc(), and remove
  setting up the cmd shift value there.  It initializes to 0, and those
  attachments that need to frob it do so before calling ep_alloc.
o Remove some obsolete comments
o No longer a need to export ep_get_macaddr, so make it static
o ep_alloc already grabs the EEPROM id, so we don't need to grab it again
  in ep_pccard_attach.
o eliminate unit, it isn't needed, fix some printfs to be device_printf
  instead.

# All my pccards except the 3C1 work now.  Didn't test ISA or cbus cards
# that I have: 3C509B-TP or 3C569B-J-TPO

Tested on: 3C589B, 3C589C, 3C589D, 3C589D-TP, 3C562, 3C562B/3C563B,
	3C562D/3C563D, 3CCFE574BT, 3CXEM556, 3CCSH572BT, 3C574-TX,
	3CCE589EC, 3CXE589EC, 3CCFEM556, 3C1
Approved by: re (scottl)
2005-07-01 04:23:32 +00:00
Warner Losh
c4af929fb7 o When calling ep_get_macaddr(), provide it a local buffer. Add a comment
that says why we do this (or rather, explains that it is some voodoo magic
  that's poorly understood).  The local buffer fixes the crash on attach.
o Rename get_e() to ep_get_e() to avoid namespace pollution.

Submitted by: mux
Approved by: re (scottl)
2005-06-26 04:19: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
a20e4848bd u_intXX_t -> uintXX_t while I'm here. 2005-01-20 19:39:33 +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
Warner Losh
1e56655e43 Minor style nits suggested by sam and mdodd:
o give an argument to EP_BUSY_WAIT
o use foo_locked rather than foo_body
o Add locking assertions for extra safety.
2003-10-25 21:28:40 +00:00
Warner Losh
c365ed47e4 Whole grab-bag of changes:
o Make the driver MPSAFE
o Some changes due to diff reduction effort with vx.
o Removed some obsolete junk.

Reviewed by: sam, modd
2003-10-25 04:09:49 +00:00
Warner Losh
0f08d52a60 Finish the removal of the bst/bsh confusion. 2003-10-19 17:38:04 +00:00
Warner Losh
38e7cb26d4 Don't confuse tags and handles. 2003-10-19 00:03:10 +00:00
Warner Losh
3dc59524c7 Transition to using bus_space macros rather than the inb/outb/etc.
Use EP_{READ,WRITE}{,_MULTI}_{1,2,4} instead.  I've had several people
submit patches like this over the years of varying qualities, markm
being the last.  The names were chosen in consulation with mdodd on
irc.

I've tested this with only PCMCIA cards: 3CCE589EC and 3CCSH572BT.
I've not tried with my more extensive ISA, EISA and cbus collection.

Reviewed by: mdodd
2003-10-18 15:22:43 +00:00
Mark Murray
5146af6d82 Style(9) cleanup. There was no consistent style in this driver, and
The next round of commits will be to fix up locking in it. This lot
is to at least give a consistent base to work off.

OK'ed by:	imp, mdodd
2003-07-17 19:37:56 +00:00
Matthew N. Dodd
672fc9ebf6 - Free interrupt handler in ep_free().
- Move ep_pccard_detach() to if_ep.c and rename to ep_detach()
- Specify detach methods for all bus frontends.
2003-03-29 22:27:41 +00:00
Matthew N. Dodd
bb25efadc4 - Return error status instead of value in get_e().
- Modify ep_get_macaddr() to return an error status.
- Reverse the return value logic of eeprom_rdy().
2003-03-29 21:44:46 +00:00
Archie Cobbs
2e2de7f23f Move code to handle BPF and bridging for incoming Ethernet packets out
of the individual drivers and into the common routine ether_input().
Also, remove the (incomplete) hack for matching ethernet headers
in the ip_fw code.

The good news: net result of 1016 lines removed, and this should make
bridging now work with *all* Ethernet drivers.

The bad news: it's nearly impossible to test every driver, especially
for bridging, and I was unable to get much testing help on the mailing
lists.

Reviewed by:	freebsd-net
2000-05-14 02:18:43 +00:00
Matthew N. Dodd
f0b421372f Fix driver to restore function on 3c574 adapters. The panic on
ifconfig and bogus ethernet address (4b:57:4b:57:4b:57) has been
hacked around.  I'll revisit this when I have a clue whats going on.

Reviewed by:	obrien
2000-01-15 05:21:43 +00:00
Matthew N. Dodd
79a9057038 HEADS UP! All 3c5x9 users!
- Rip out all the static softc stuff and do softc allocation the right way.
- Rewrite most of the ISA code so that it provides a DEVICE_IDENTIFY
  method to enumerate all non-PnP ISA devices.

  This has the following consequences:

	- No 'ep' devices may be hardwired.
	  - All hardwired devices will probably be detected twice.
	    By hardwired I mean:

		device          ep0     at isa? port 0x300 irq 10

	- 'ep' devices are ordered by bus, slot, and then MAC address.

- Make 3c509B cards work in PnP mode.  Yes, they really work.
- Convert over to using ifmedia for media selection.  No more of this
  lame 'linkX' stuff.
- Consolidate a lot of duplicated code.
- Make a stab at not breaking MII based PCCARD devices.
  I doubt that the PCCARD stuff works any more than it did before my
  changes but theres hope.  My PCCARD hardware should arrive in a
  week or so.
- Retreive the media settings from the card EEPROM rather than guessing.
  I've got a 3c509-TPO that thinks its got an AUI port and if others
  can report similar problems I'll write a bit of clever code that will
  fix this but right now it works correctly on all but 1 card.
- Clean up a few things and make some cosmetic changes.
- Add myself as the MAINTAINER since nobody else wants to.  I'm
  in the best position to do this as I've got an example of most
  of the cards:

	EISA	3c579	bnc/aui
	MCA	3c529	tp/aui
	ISA	3c509	tpo
	ISA-PnP	3c509B	combo

   If someone wants to send me a any cards I don't have I'd appriciate
   it.  Also welcome are 3c59x boards since I'll be folding if_vx and
   if_ep at some point.
1999-10-27 06:25:16 +00:00
Warner Losh
758b76dc94 Add newbus attachment for pccard driver. Heavily tested by me, and
I'm committing this from a laptop running this driver.  Have only one
devclass for all ep devices (at least for pccard and eisa) so unit
numbering is sane.  Might not work with both isa and non-isa devices
on the same system until ep is updated (Matt has some patches in the
pipeline which should resolve this, he wanted me to commit this so he
can resolve any conflicts against cvs rather than my patches).

Reviewed by: Matt Dodd <mdodd@freebsd.org>
1999-10-25 02:52:16 +00:00
Matthew N. Dodd
39b547ce4d - Split out the ISA and PCCARD specific code.
- Split out the prototypes, externs and struct decls from if_epreg.h into
  if_epvar.h.

- Add support for MCA based Etherlink III (3c529) devices.

None of this code is used right now; the old if_ep driver is still
in place and used.

I will eventually get around to converting if_ep_isa.c to newbus once I've
had a talk with Peter and DFR about the DEVICE_IDENTIFY() method.

I have tested this code on my PS/2.  It works.  I would like EISA and ISA
testers since my example hardware hasn't arrived yet.

Add:

dev/ep/if_ep.c          optional ep
dev/ep/if_ep_isa.c      optional ep isa
dev/ep/if_ep_eisa.c     optional ep eisa
dev/ep/if_ep_mca.c      optional ep mca
dev/ep/if_ep_pccard.c   optional ep card

to sys/conf/files

Remove:

i386/eisa/3c5x9.c             optional        ep
i386/isa/if_ep.c              optional        ep

from sys/i386/conf/files.i386

PCCARD testers wanted!

I will switch off and cvs rm the old driver in favor of this copy once
I've had positive feedback or have the hardware to verify that it works.
1999-09-26 06:42:36 +00:00