Commit Graph

413 Commits

Author SHA1 Message Date
Ruslan Ermilov
4a0d6638b3 - Store pointer to the link-level address right in "struct ifnet"
rather than in ifindex_table[]; all (except one) accesses are
  through ifp anyway.  IF_LLADDR() works faster, and all (except
  one) ifaddr_byindex() users were converted to use ifp->if_addr.

- Stop storing a (pointer to) Ethernet address in "struct arpcom",
  and drop the IFP2ENADDR() macro; all users have been converted
  to use IF_LLADDR() instead.
2005-11-11 16:04:59 +00:00
Warner Losh
bd645acfdd Add Billionton LNA-100B variation that Alan reported in arch. [1]
Also add Global Village lan modem, even though I'm unsure if it works.

Reported by: Alan newsletter at acsoftware dot org
2005-10-29 03:49:44 +00:00
Warner Losh
db099e0981 Add missing softc 2005-10-22 07:43:20 +00:00
Warner Losh
9910f6b1d6 Turns out that we're asking for the MAC address at a bad time in the
attach routine.  Go ahead and ask for it in the probe routine and be
just as wrong as all the other cards that ask for it there...

# this gets the RTL8019 on a SBC at work fully functional.  6.0 still treats
# the 8019 as a generic NE-2000, so these changes aren't relevant there.
2005-10-22 07:26:05 +00:00
Warner Losh
201aec8321 In the ISA case, we call ed_probe_WD80x3 before we call
ed_probe_rtl80x9.  In the pci case we call ed_probe_rtl80x9 first.  In
the PCI case we were using the correct nic_offset by accident because
softc is initialized to zero.  In the isa case we were using the wrong
value by accident, since ed_probe_WD80x3 sets the offset value to
0x10.  This lead to the identification routines failing.  Fix this
problem by always initalizing the nic_offset and asic_offset before
making ed_{asic,nic}_{in,out}* calls.
2005-10-22 05:14:18 +00:00
Warner Losh
ebf417cf92 Check against 8019 rather than 8029 for reading in the MAC addr since
the former is the ISA part, not the latter.

MFC After 6.0 is unfrozen (this bug doesn't exist in 6.0 because I didn't
	MFC the rtl80x9 changes for ISA due to an error on my part)
2005-10-17 02:32:23 +00:00
Warner Losh
92a6736a5b If we can't probe the RTL80x9 for some reason, fall back to probing it
as a Novell NE-2000.  This is necessary for unpatched qemu working
correctly.  qemu claims to be a RTL8029, but doesn't implement the
RTL8029 specific registers at this time.  I've created patches for
that, but there's no reason we can't use qemu's emulation w/o these
patches.  This should make life easier for those folks that boot
FreeBSD via qemu.
2005-10-13 22:12:34 +00:00
Warner Losh
fab4f06582 o Fix probing of rtl80x9 parts. We shouldn't be calling
ed_probe_generic8390 where we're calling it.  It will be done as part
  of ed_probe_Novel_generic after things are setup in a way that
  ed_probe_generic8390 will grok.
o Fix operator precedence botch that causes a panic when setting the media
  type for 10baseT connections.
o Save the type of device so that it prints with the rest of the probe.

# this should make it work with qemu again, but only if it has my patches
# to actually implement the RTL8029 specific registers.
2005-10-13 22:06:02 +00:00
Warner Losh
3703310002 Buffalo LPC4/CLX ID 2005-10-11 01:04:16 +00:00
Warner Losh
d0948af5ae New OEM generic card. "10/100 Fast Ethernet PC Card". It has a
generic sounding CIS "PCMCIA", "FAST ETHERENT CARD" and a bogus MANFID
code (0xffff and 0x1090).  However, since I'm not aware of 'generic'
cards that aren't NE-2000oids, go with that and hope for the best.
2005-10-11 01:02:16 +00:00
Warner Losh
6ec4c010b5 Remove debug that crept in.. 2005-10-05 05:24:35 +00:00
Warner Losh
95a2adef58 MFp4:
o Add support for Tamarack TC5299J + MII found on SMC 8041TX V.2
	  and corega PCCCCTXD
	o Add support for ISA/PCI RTL80[12]9 chips
	o Improve support for the ax88790 based
	o minor code movement

Submitted by: (#2) David Madole
2005-10-05 05:21:07 +00:00
Warner Losh
e51bf22777 Emit a warning when a card matches multiple entries in our table. A
number of cards have been discovered to be matching on the strings of
the cis rather than manufacturer/product id for cards we already had a
prod id for.  This is a result of getting the list from the NetBSD
driver which also includes the OID for the cards where such a
distinction mattered (since it was tested against the MAC address we
got from the card).  Since we do not try to match OIDs, we do not need
the extra entries and they just waste space.

I'm guessing that some of the dlink entires (DE-660, DE-660+) and many
of the corega cards may fall into this boat and can safely be removed.
2005-09-26 18:27:13 +00:00
Warner Losh
33521176c6 Go ahead and detach our children in our detach routine. I'm undecided
if we should delete them also or not, but have decided not to do so
for the moment.
2005-09-26 18:22:24 +00:00
Warner Losh
c4a4b66d17 I have confirmed with my Epson EEN10B that it needs to look at the
attribute memory at 0xff0 to find its MAC address.  This is another
instance of the IBM ethercard II from all apperances (short of popping
the lid).  Update the entry to document which cards we support
actually need this functionality.
2005-09-24 17:36:43 +00:00
Warner Losh
c1a8a7110a The DLink DE650 has the same ID as Linksys EthernetCard, so we don't
need a sperate entry for it.
2005-09-24 17:32:20 +00:00
Warner Losh
829681b6aa Remove obsolete include 2005-09-23 21:59:11 +00:00
Warner Losh
bb041987d9 Remove duplicate if_free().
Submitted by:	ru@
2005-09-19 14:44:11 +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
Warner Losh
62e428c42e MFp4:
o eliminate the ED_NO_MIIBUS option.  Now, you need miibus to use ed with
  pccard.  If you have an old ISA or PCI card w/o a miibus, then you'll still
  be able to use the ed driver w/o miibus in the kernel.  If you have pccard
  you'll need mii now.  Most pccards these days have miibus, and many
  cards have ISSUES if you don't attach miibus.  issues I don't want to
  constantly rediagnose.
  - Add new media_ioctl, mediachg and tick function pointers.  The core
    driver will call these if they aren't NULL, or return an error if they
    are.
  - migrate remaining mii code into if_ed_pccard.
o include some notes from my datasheet fishing.  this may allow us to
  get media status from some pccards.
o Fix one bug that's common to many drivers.  call if_free(ifp) after
  we tear down the interrupt.  ed_intr() depends on ifp being there and
  freeing it while interrupts can still happen is, ummm, bad.
2005-09-18 20:51:34 +00:00
Ruslan Ermilov
ad61f89618 Fix "struct ifnet" leaks when attach() fails in the middle. 2005-09-16 11:25:19 +00:00
Warner Losh
4062f4e78e When stopping the card, and returning to page 0, it is best if you do
that with the NIC set of registers rather than the ASIC registers.  I
believe this was a harmless oversight, since we set ED_P0_CR to the
same value 5ms later, but just to be safe...
2005-09-15 04:05:09 +00:00
Ruslan Ermilov
9abf4b7a1d Make device_detach methods really work. 2005-09-14 19:03:14 +00:00
Warner Losh
d21d33847c MFp4: Omnibus ed changes
o Attach AX88x90's MII bus to system, and require its presence.
o Reorg the mii code a little, and move more of it into pccard attachment.
o Eliminate ed_pccard_{read,write}_attrmem in favor of a more appropriate
  function in the pccard layer.
o Update comments to reflect knowledge gained.
o Update how re recognize a NE-2000 ROM.  I found a couple of different
  datasheets that define the structure of the PROM data, so the code's
  old heuristics have been removed, and comments updated to reflect the
  structure.
o Eliminate work around for EC2T.  It is no longer needed, and was wrong
  headed since the EC2T has a Winbound 82C926C in it, not a AX88x90.
o Add copyright to if_ed_pccard.c, since I believe I've re-written more than
  3/4 of it.

# With these changes, all of my 20-odd ed based cards work, except for the
# NetGear FA-410, and I'm pretty sure that's a MII/PHY problem.
2005-09-13 19:47:44 +00:00
Warner Losh
5098c3916e MFp4: Minor formatting nits in pccard table. 2005-09-13 19:09:57 +00:00
Warner Losh
c3ee3aa526 Use smaller names. The "NE2000 PCI Ethernet" is largerly redundant
with edX at pciY.  This removes 8*22 bytes from the strings. Not a
huge win, but a cheap one.
2005-09-13 19:07:00 +00:00
Warner Losh
1376a07bcf MFp4:
Reduce the size of ed a little by removing some CIS based entries (others
likely can be removed too):
o The D-Link DFE-670TXD doesn't need its own entry based on strings.
o The Xircom CompactCard appears to be a TDK design, so list it there by ID
  and remove the strings.

Increase the size of ed a little:
o Add support for the Addtron AE-660CT and Addtron AE-660.  This is a very
  generic NE-2000 clone (so generic that its CIS tags say NE-2000 generic
  card!).
2005-09-10 00:17:55 +00:00
Warner Losh
fd410513a9 The ed driver lock is already held in the mii frobbing routines. Remove
locking from these routines.
2005-09-08 17:17:13 +00:00
Warner Losh
c16a45fc5b Add note about what ED_DEFAULT_MAC_OFFSET applies to 2005-09-08 17:16:23 +00:00
Warner Losh
63f90381e9 Consistancy is the hobgoblin of small minds:
o DLINK -> DL100XX
2005-09-07 03:34:24 +00:00
Warner Losh
f2e03f728c Minor reorg of pccard attach code to fix ax88x90 case broken after fixing
dl100xx case.
o We no longer acquire and release resources during attach many times.  We now
  do it once at the beginning.
o Move setting the resource offsets to just after acquiring the ports in
  attach.
o Move ax88x90 code to the end of the file, just after the dl100xx specific
  code.
o Rename ed_pccard_Linksys to ed_pccard_dl100xx to reflect the underlying
  chipset.
o Pass the ed_product structure into ed_pccard_{dl100xx,ax88x90} and have
  those routines test the flags to see if this card should be probed in that
  way.
o transition from ed_probe_Novell to ed_probe_Novell_generic since we already
  have the resources setup.
o Move use of ed_probe_Novell_generic into ed_pccard_dl100xx to be more
  consistant with ax88x90 case.
o simplify the code where we probe for the chipsets
2005-09-07 03:30:58 +00:00
Warner Losh
3ba88ec464 o Expose ed_probe_Novel_generic, it is useful for pccard case.
o Fix a now stale comment.  There are likely many others like them, but this
  one definitely hasn't been true since DELAY was introduced into the tree.
2005-09-07 03:20:33 +00:00
Warner Losh
56013d44db Fix DL100xx based cards. Don't drop resources. It was approrpiate in
the probe code that this used to be part of, but as part of the
attach, we shouldn't be dropping the resources here.

Also, allocate the proper rid in the ax88x90 setup.
2005-09-07 00:00:16 +00:00
Warner Losh
6942fac077 move away from K&R function definitions 2005-09-06 23:15:21 +00:00
Warner Losh
79e277f155 Work around a bug I've seen on Linksys EC2T cards. For some reason,
as yet unknown, those cards report their MAC address a byte at a time.
However, other AX88x90 cards report the MAC address a word at a time.
Add a heuristic which looks at the high order bytes of the first 6
words.  If they are all '0', assume the card is behaving like the
Linksys EC2T card.  Since the default prefix for these cards appears
to be 00:e0:98, this appears to be a safe heuristic.  While some cards
have been observed with different prefixes, they all work with this
heuristic.

I'm unsure if this is a bug in the EC2T card, or if it is a bug in the
initialization of the card.  No other OS has this heuristic (although
w/o it, the MAC address that is used works).
2005-09-06 22:55:32 +00:00
Warner Losh
e10a8107c6 Go ahead and | in ED_CR_PAGE_0, even though this doesn't change things
at all.  It makes the code clearer.

fix a comment comments about why we need to write i/o address to certain
registers.
2005-09-06 22:46:41 +00:00
Warner Losh
15a38fff14 It turns out that many of the ambicom cards have their CIS resources
listed in different orders.  Since it is easy to identify the Modem
resources vs the Ethernet resources by looking at the size, use that
rather than hard coded rids.  For such parts, go ahead and guess which
rid we should use based on the size.  This guess appears reliable for
the two example cards that I have with different CIS info.
2005-09-06 22:44:26 +00:00
Warner Losh
9baacb5117 MFp4: kill bogus comment 2005-09-02 03:15:51 +00:00
Warner Losh
16e16d771c At some point in the past, we read the PROM by words. Now we read
PROM by bytes.  Adjust the extraction of the MAC address from this data
to reflect this change.

This gets the AX88x90 based PC Cards MAC address working again (my
UMAX Ethernet and Linksys EC2T cards now work).

MFC After: 3 days
2005-09-01 20:08:24 +00:00
Warner Losh
d121857765 Add back dropped if_media.h include 2005-08-30 05:24:53 +00:00
Warner Losh
f1c4694df3 Finish conversion to bus space and make ed MP safe.
o Lock ed
o Fix extra newline in probe messages
o Eliminate gone.
o Make detach less-racy.
o Eliminate spl*
o Switch from timeout/untimeout to callout interface.
o Read/write card memory using bus_space calls.
o generalize readmem so that we don't need ifs in the code.
o Fix memory stuff to be consistant.
o Remove OLDCARD compat stuff.
o Mark interrupt as MPSAFE.

# sic, hpp not tested at all
# ISA and PCI attachments lightly tested
2005-08-28 23:56:25 +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
Robert Watson
13b203d0d7 Modify device drivers supporting multicast addresses to lock if_addr_mtx
over iteration of their multicast address lists when synchronizing the
hardware address filter with the network stack-maintained list.

Problem reported by:	Ed Maste (emaste at phaedrus dot sandvine dot ca>
MFC after:		1 week
2005-08-03 00:18:35 +00:00
Warner Losh
33d6891bc8 Add support for the DLink DMF650TX Ethernet+56k modem PC Card. This
gets the ethernet part of the card working, while putting appropriate
hooks in place for the modem code.  Other ed based lan/modem combo
cards should be easy to add.  Please send me info on any you'd like to
see support added.

Note: The 650 isn't a strictly conforming multi-function card, so
special support is needed. :-(
2005-07-15 01:54:59 +00:00
Warner Losh
ba8f34770d Add a boatload of new device ids, gleaned from the pcmcia-cs-3.2.8
distribution.  Add the appropriate devices to the man pages.

Obtained from: pcmcia-cs
Approved by: re (scottl)
2005-07-10 02:00:35 +00:00
Warner Losh
ab581af779 Eliminate unused argument in PCMCIA_CARD macro.
Provide a backwards compatible way to have the extra macro by defining
PCCARD_API_LEVEL 5 before including pccarddevs for driver writers that
want/need to have the same driver on 5 and 6 with pccard attachments.

Approved by: re (dwhite)
2005-06-24 14:36:54 +00:00
Brooks Davis
c3f967ce8d Fix four casts of the softc to a struct ifnet.
Hopefully this fixes ed(4) under qemu.  I'm shocked that real hardware
is apparently working with these bugs.

Approved by:	re (ifnet blanket)
Pointy hat:	brooks
2005-06-15 20:23:40 +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
591223e66b Use tabs instead of spaces to indent, per style(9)
Noticed by: njl
2005-06-09 18:46:36 +00:00
Warner Losh
7999556019 My abstracting out the MAC reading code to fix pccard broke pci. Add
back the reading of the MAC address in the 'standard' way.

Reported by: Jeremie Le Hen ( jeremie at le-hen dot org )
2005-06-08 23:15:33 +00:00