History log of /freebsd-10.1-release/sys/dev/ed/if_ed_pccard.c
Revision Date Author Comments
(<<< Hide modified files)
(Show modified files >>>)
# 272461 02-Oct-2014 gjb

Copy stable/10@r272459 to releng/10.1 as part of
the 10.1-RELEASE process.

Approved by: re (implicit)
Sponsored by: The FreeBSD Foundation

# 264942 25-Apr-2014 marius

MFC: r260050, r261528

- Switch to using the common MII bitbang'ing code instead of duplicating it.
- Based on lessons learnt with dc(4) (see r185750), add bus space barriers to
the MII bitbang read and write functions as well as to instances of page
switching.
- Add missing locking to ed_ifmedia_{upd,sts}().
- Canonicalize some messages.
- Based on actual functionality, ED_TC5299J_MII_DIROUT should be rather named
ED_TC5299J_MII_DIRIN.
- Remove unused headers.
- Use DEVMETHOD_END.
- Use NULL instead of 0 for pointers.


# 256281 10-Oct-2013 gjb

Copy head (r256279) to stable/10 as part of the 10.0-RELEASE cycle.

Approved by: re (implicit)
Sponsored by: The FreeBSD Foundation


# 221407 03-May-2011 marius

- Remove attempts to implement setting of BMCR_LOOP/MIIF_NOLOOP
(reporting IFM_LOOP based on BMCR_LOOP is left in place though as
it might provide useful for debugging). For most mii(4) drivers it
was unclear whether the PHYs driven by them actually support
loopback or not. Moreover, typically loopback mode also needs to
be activated on the MAC, which none of the Ethernet drivers using
mii(4) implements. Given that loopback media has no real use (and
obviously hardly had a chance to actually work) besides for driver
development (which just loopback mode should be sufficient for
though, i.e one doesn't necessary need support for loopback media)
support for it is just dropped as both NetBSD and OpenBSD already
did quite some time ago.
- Let mii_phy_add_media() also announce the support of IFM_NONE.
- Restructure the PHY entry points to use a structure of entry points
instead of discrete function pointers, and extend this to include
a "reset" entry point. Make sure any PHY-specific reset routine is
always used, and provide one for lxtphy(4) which disables MII
interrupts (as is done for a few other PHYs we have drivers for).
This includes changing NIC drivers which previously just called the
generic mii_phy_reset() to now actually call the PHY-specific reset
routine, which might be crucial in some cases. While at it, the
redundant checks in these NIC drivers for mii->mii_instance not being
zero before calling the reset routines were removed because as soon
as one PHY driver attaches mii->mii_instance is incremented and we
hardly can end up in their media change callbacks etc if no PHY driver
has attached as mii_attach() would have failed in that case and not
attach a miibus(4) instance.
Consequently, NIC drivers now no longer should call mii_phy_reset()
directly, so it was removed from EXPORT_SYMS.
- Add a mii_phy_dev_attach() as a companion helper to mii_phy_dev_probe().
The purpose of that function is to perform the common steps to attach
a PHY driver instance and to hook it up to the miibus(4) instance and to
optionally also handle the probing, addition and initialization of the
supported media. So all a PHY driver without any special requirements
has to do in its bus attach method is to call mii_phy_dev_attach()
along with PHY-specific MIIF_* flags, a pointer to its PHY functions
and the add_media set to one. All PHY drivers were updated to take
advantage of mii_phy_dev_attach() as appropriate. Along with these
changes the capability mask was added to the mii_softc structure so
PHY drivers taking advantage of mii_phy_dev_attach() but still
handling media on their own do not need to fiddle with the MII attach
arguments anyway.
- Keep track of the PHY offset in the mii_softc structure. This is done
for compatibility with NetBSD/OpenBSD.
- Keep track of the PHY's OUI, model and revision in the mii_softc
structure. Several PHY drivers require this information also after
attaching and previously had to wrap their own softc around mii_softc.
NetBSD/OpenBSD also keep track of the model and revision on their
mii_softc structure. All PHY drivers were updated to take advantage
as appropriate.
- Convert the mebers of the MII data structure to unsigned where
appropriate. This is partly inspired by NetBSD/OpenBSD.
- According to IEEE 802.3-2002 the bits actually have to be reversed
when mapping an OUI to the MII ID registers. All PHY drivers and
miidevs where changed as necessary. Actually this now again allows to
largely share miidevs with NetBSD, which fixed this problem already
9 years ago. Consequently miidevs was synced as far as possible.
- Add MIIF_NOMANPAUSE and mii_phy_flowstatus() calls to drivers that
weren't explicitly converted to support flow control before. It's
unclear whether flow control actually works with these but typically
it should and their net behavior should be more correct with these
changes in place than without if the MAC driver sets MIIF_DOPAUSE.

Obtained from: NetBSD (partially)
Reviewed by: yongari (earlier version), silence on arch@ and net@


# 213894 15-Oct-2010 marius

Converted the remainder of the NIC drivers to use the mii_attach()
introduced in r213878 instead of mii_phy_probe(). Unlike r213893 these
are only straight forward conversions though.

Reviewed by: yongari


# 199380 17-Nov-2009 jhb

Use a private callout timer to drive the transmit watchdog instead of using
if_watchdog and if_timer. The driver already contained an optional stats
timer that individual attachments could use to provide a 'tick' event. The
stats timer only ran if the tick function pointer was non-NULL and the
attachment's tick routine had to call callout_reset(), etc. Now the driver
always schedules a stat timer and manages the callout_reset() internally.
This timer is used to drive the watchdog and will also call the attachment's
'tick' handler if one is provided.

Tested by: WATANABE Kazuhiro


# 191469 24-Apr-2009 imp

Add Surecom EP-427X.


# 191394 22-Apr-2009 imp

A couple of older Melco cards that missed the transition to newcard


# 191391 22-Apr-2009 imp

Add Billionton LNT10TB


# 191386 22-Apr-2009 imp

Add a few more models of AMBICOM cards from data from linux driver and
pccard.conf.


# 191384 22-Apr-2009 imp

These were a placeholder and don't belong here. Remove them.


# 191371 22-Apr-2009 imp

Kill stray bootverbose debug tool.

Submitted by: juli@


# 191370 22-Apr-2009 imp

Turns out the code improvements I did for the TC5299J support were
anti-improvements and broke support for this part. Revert the part of
the improvement at fault.


# 191299 19-Apr-2009 imp

Cleanup resource allocation code a bit. Store the rids on the
resources rather than on the softc. When we allocate resources for PC
Card, if we only get 16 ports, try again to get the others.


# 191238 18-Apr-2009 imp

Make sure that the data in the ROM with a valid signature isn't all
0's. At least one PC Card ASIC does this...


# 191237 18-Apr-2009 imp

Add GVP NIC 2000P and New Media Livewire. Also New Media LanSurfer
doesn't have a function type of network, so add a quirk for that...


# 191234 18-Apr-2009 imp

Establish the interrupt handler AFTER we successfully attach. We need
to do this in case we have a shared interrupt that fires during the
attach process....


# 191233 18-Apr-2009 imp

Remove debug write accidentally left in.


# 190902 10-Apr-2009 imp

Don't specify a hint, since it isn't needed.


# 190901 10-Apr-2009 imp

Fix comment

Submitted by: danfe@


# 190900 10-Apr-2009 imp

Improvements for TC5299J MII support.


# 190899 10-Apr-2009 imp

The D-Link DE-650 isn't tagged as a network card, so allow it to
attach anyway.
Add a comment about a 'common' mfg/prod pair that's used in a very
large array of different cards.


# 190898 10-Apr-2009 imp

Fix some comments.


# 190897 10-Apr-2009 imp

No need to check for chip type here.


# 190807 07-Apr-2009 imp

Fix a comment to match the code.


# 190805 07-Apr-2009 imp

Remove DL10019 workaround, since the code it calls isn't quite ready.


# 190804 07-Apr-2009 imp

Move tick to end of file for better code references.


# 190803 07-Apr-2009 imp

The DL100xx cards have 24k of packet memory, not 16k. Use it for them
and update comments about original patches doing this and it not
working. It works for both the DL10019 and DL10022 based cards that I
have. It really helps the DL10019 cards, since they were using 8k
instead of the normal 16k that regular NE-2000 cards help.

# Note to self: need to provide a common routine to setup memory
# parameters.


# 190802 07-Apr-2009 imp

Apply generic media stuff to pccard case too, when we aren't using miibus
for this.


# 190801 07-Apr-2009 imp

Minor fixes to comments about media autoselect.


# 190664 03-Apr-2009 imp

Remove more debug...


# 190651 02-Apr-2009 imp

Kill debug that crept in.


# 190650 02-Apr-2009 imp

Minor tweaks in the names to match the chips more closely.


# 190645 02-Apr-2009 imp

Minor DLINK DL100xx support tweaks:

The DIROUT bit difference between the 19 and 22 is annoying. We can
set both bits on both parts without ill effect. Use this trick to
simplify the code.

The DELAYS in the MII bus bit-bang code for the DL100xx parts aren't
needed. Eliminate them.


# 190644 02-Apr-2009 imp

The AX88190 has 64k of external SRAM, of which 62k can be used for
packet data. However, the AX88190A moves this on-chip and reduces it
to the more traditional 16k from 16k-32k. The AX88790 follows the
'190A. Probe memory above 32k to see which flavor of the '190 we have
and use the extra memory if we have it.

Eliminate the kludgy read eeprom for the ID code. It really is just a
memory read at location 0x400, so just use that instead. Makes the
code easier to understand as well as eliminates some magic numbers.


# 190643 02-Apr-2009 imp

Force an autonegotiation at attach time for all the attached PHYs for
ed cards. There's a number of minor nits in a lot of the PHYs on the
PC Cards that use the Axis AX88190 or DLink DL10019 and DL10022 chips.
Forcing the autonegotiation doesn't seem to cause problems on the
cards that have sane PHYs, but makes several cards I have work without
further workarounds.

I'm not 100% sure that kicking the PHY and resetting them is the right
thing to do on the media change callback. Other NICs seem to need
this and do similar things.


# 190598 31-Mar-2009 imp

Add additional data on the MIIBUS WTF that I committed earlier.


# 190597 31-Mar-2009 imp

It turns out that the initialization is required since it sets up the
readout of the MAC address.
The 10ms delay was really needed. Ooops.


# 190596 31-Mar-2009 imp

o Minor tweaks to the AX88x90 probe routine, mostly related to comments.
o Don't run through the register initialization in the read mac routine
for the AX88x90. It duplicates other stuff that we do.
o Eliminate the 10ms delay after we reset the AX88x90. We already wait for
the appropriate bits to indicate reset is done.


# 190586 31-Mar-2009 imp

Go back to filtering all PHY addresses above 16 since at least two
cards still have issues with them. Maybe this is a silicon rev? In
any case, doing the filtering only for the AX88790 for the moment.


# 190583 31-Mar-2009 imp

Hmmmm... This can't be right... But it looks like the DL100xx chips
don't have one of the clock cycles (the turn cycle) that the AX88x90
chips have. Make this conditional. But this seems totally crazy and
can't possibly be right. Commit the fix for the moment until I can
explore this mystery more deeply.

On the plus side, the DL10022-based cards I have (D-Link DEF-670TXD
and SMC8040TX) work after this fix.


# 190559 30-Mar-2009 imp

This is a major reworking of the AX88x90 support.

o Introduce new chip_type AX88790. There's a few places we need to know the
exact chip for workaronds.
o Explain the AX88190 workaround for the ISR bits being stuck, and don't
apply them to the AX88790. The datasheet says the bits are fixed, and
experience confirms.
o Fix mii bit-bang read code to read and discard the 'floating' bit.
o Remove empty ed_pccard_ax88x90_mii_reset routine
o Report error from mii_phy_probe
o Don't use ed_probe_Novel_generic for ax88x90 chips. It puts them into
an odd state sometimes. Instead, use a more stream-lined version that
avoids the trouble spots. This was copied and tweaked from the original.
o Move chip reset into its own routine.
o Minor code optimiation on getting MAC address
o Add code for coping with AX88790 cards that are in power down state and
need to be kicked before the PHY registers for the internal phy read right.
o Remove ugly cap of PHYs at 17.
o For AX88790, we need to set a special bit for accessig phy 16 (the internal
phy) and clear it for all others according to a chip erratum.
o streamline the bit-bang code for AX88x90: the delays aren't needed according
to the datasheet timing diagrams and also the Linux driver
o Fix minor bit definition for direction bit.
o Generally: Some comments reformatted
o Only try the toshiba probe on cards labelled as toshiba

# From another Akihabara card (this one from a few years ago from a
# friend in Japan). Fix the Corega FEther II PCC-TXD. This one is
# still on sale new, as of a few weeks ago. should fix all other AX88x90
# based cards, but I have some testing left to finish on my collection...


# 190483 28-Mar-2009 imp

It turns out that the Toshiba LANCT00A PC Card is really like the
Toshiba PCETC ISA card, and even has the same board type code in the
card ID (0x14). So, for this card, call ed_probe_WD80x3_generic after
setting things up apropriately. This makes the card attach and kinda
work (I'm seeing panics in sbdrop). Since history has shown that the
WD80x3 probe routine is dangerous, only do it for this card. Also,
disable the memory range check to make sure it is an valid ISA memory.
I think that it is bogus, but I'm not 100% sure, for these cards.

I removed probing for the WD80x3 in 2005 when I added support for the
AX88x90 and DL100xx cards since none of my cards had ever matched it
and PAO3 removed it and none of the cards in their database died.

It is possible there are other quirks about this card too, since no
other open source OS supports it, or even claims to support it. But
it was a fun half hour hack...


# 190475 27-Mar-2009 imp

Add bromax axnet based cards to the mix. This was harvested from the linux
driver. Not sure who sold it/rebadged it.

Add stub entries for Mitsubishi B8895 and Toshiba LANCT00A to the
driver with a comment that they don't work /* NG */.[*] These are
DP83902A based cards, which should work, but don't seem to. Likely
they are from the days before the ne2000 roamed the earth and use a
non-standard hookup (see if_ed_isa or if_ed_cbus for some examples).
Unless I happen to stumble into the right one, these may never work,
but I'm tired of omitting them from commits.

[*] The Japanese adopted OK from English, but also use NG for its
opposite.


# 190430 25-Mar-2009 imp

Add RIOS PCCARD 3.


# 189726 12-Mar-2009 imp

o writereg needs to return a vlue.
o Add TJ PTJ-LAN_T card. Some more work may be needed to make this
actually function correctly.


# 181351 06-Aug-2008 imp

When the miibus for the AX88x90 or TC5299J cards fails to attach, we
would call ed_release_resources() when we should have called
ed_detach() to properly undo the effects of prior calls to
ed_attach(). This would leave a stray ed interface ifnet alive in the
system, which was, well, bad, since we called if_free() on the
underlying memory... Fix the ed_detach routine to cope being called
in this context now.

This should never come up because the miibus is always there. Except
for now when it seems to be failing for reasons unknown... That's a
different bug that hits at least ed, xl, dc and fxp...


# 180315 06-Jul-2008 imp

Add two corega cards from NetBSD: FETEHR II PCC TXD and LAPCCTXD.


# 171352 11-Jul-2007 imp

Add Micro Research PCMCIA LAN Adapter MR10TPC support. Patch slightly
reworked by me.

Submitted by: Osamu Hasegawa-san
PR: 93393
Approved by: re (hrs)


# 168214 01-Apr-2007 netchild

Tell a statistic checker that not checking the return value of the probing
of the mii phy is intended for this chip.

Found by: Coverity Prevent (tm)
CID: 43


# 166901 23-Feb-2007 piso

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@


# 158369 08-May-2006 imp

Add (back) the D-Link DE-650. Not sure why it was deleted.


# 151840 29-Oct-2005 imp

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


# 151225 10-Oct-2005 imp

Buffalo LPC4/CLX ID


# 151224 10-Oct-2005 imp

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.


# 150959 05-Oct-2005 imp

Remove debug that crept in..


# 150957 05-Oct-2005 imp

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


# 150581 26-Sep-2005 imp

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.


# 150520 24-Sep-2005 imp

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.


# 150518 24-Sep-2005 imp

The DLink DE650 has the same ID as Linksys EthernetCard, so we don't
need a sperate entry for it.


# 150493 23-Sep-2005 imp

Remove obsolete include


# 150300 18-Sep-2005 imp

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.


# 150145 15-Sep-2005 imp

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...


# 150108 13-Sep-2005 imp

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.


# 150104 13-Sep-2005 imp

MFp4: Minor formatting nits in pccard table.


# 149922 09-Sep-2005 imp

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!).


# 149890 08-Sep-2005 imp

Add note about what ED_DEFAULT_MAC_OFFSET applies to


# 149842 07-Sep-2005 imp

Consistancy is the hobgoblin of small minds:
o DLINK -> DL100XX


# 149841 07-Sep-2005 imp

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


# 149837 06-Sep-2005 imp

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.


# 149835 06-Sep-2005 imp

move away from K&R function definitions


# 149834 06-Sep-2005 imp

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).


# 149833 06-Sep-2005 imp

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.


# 149832 06-Sep-2005 imp

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.


# 149696 01-Sep-2005 imp

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


# 149558 28-Aug-2005 imp

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


# 148022 14-Jul-2005 imp

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. :-(


# 147872 10-Jul-2005 imp

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)


# 147580 24-Jun-2005 imp

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)


# 147256 10-Jun-2005 brooks

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


# 142260 22-Feb-2005 imp

Belkin F5D5020 is an OEM'd card from RACORE based on the AX88190
chipset. Add support for this card. Office Max has them on sale and
I was surprised that we didn't have it in our supported list when I
plugged it in...


# 142023 17-Feb-2005 imp

Fix the support for the ax88[17]90 to print the right type, rather
than the generic ne-2000 string. This should have no effect on the
actual support of the parts, just reporting what the part was.

Also, rename a few functins and symbols to reflect a more generic
part support that grew out of the early specific support.


# 141930 14-Feb-2005 imp

o It turns out that most of the ne-2000 cards that I have got real unhappy
with the latest changes. They actually have valid ROM data at location
0 of memory, just like a real NE-2000 ISA card. Use this data, if
the ROM passes a few basic tests, as an additional source for the MAC
address. Prefer the CIS over this source, but have it take precidence
over falling back to reading the attribtue memory.
o Minor cleanup of a few devices that we match on based on CIS string.


# 141881 14-Feb-2005 imp

Rework DL10019/DL10022 support. This tries to reset things in a more
proper way, or at least the same way that NetBSD and Linux do things
(I've been unable to obtain datasheets for these parts to know for
sure). This has some marginal improvement in the DL10022 and DL10019
cards that I have. Also, report which type, exactly.

# There's one or two ed cards that I have which still don't work, but I think
# that's due to MII losage on the card that's not presently compensated
# for in the MII drivers.


# 141880 14-Feb-2005 imp

MFp4: Merge in AX88790 support from my p4 tree. I've had this in my
tree since 2003/02/20, and I recently cleaned it up. I'd even closed
the PR that I obtained this from Fri Jul 18 23:25:08 MDT 2003 since
I looked at my p4 tree.

PR: 46889
Submitted by: HASEGAWA Tomoki


# 141744 12-Feb-2005 imp

Improve the mining of MAC address from the card:
o Add a fallback location for the MAC address. Most of the early ne2000
PC Cards were built from the same parts, so most of them have the same
address in the CIS to grab the MAC from. Use this address as our
fallback if we don't find anything better.
o Add printf, in bootverbose, noting the MAC addresses that we find along
the way.

# Better sanity checking of the MAC address is needed. Will have to
# investigate using/creating a centralized function to do this as a number
# of other PC Card drivers each have their own ad-hoc tests.


# 141715 12-Feb-2005 imp

Add comment about MAC mining


# 141708 11-Feb-2005 imp

Really old PCMCIA cards stored the MAC address in the attribute memory
at some offset. Unlike newer cards, the MAC address wasn't part of
the CIS as a specific FUNCE. These older cards were having their MAC
address show up as 0:2:4:6:8:a because that's what's in the ROM
locations that would be there in a real ne2000.

This patch allows one to specify the offset for the MAC address for
these cards. Specify one for the IBM Ethernet II card, as it is one
that has this problem. One shouldn't specify this unless the MAC
address really isn't in the CIS at all.

Side note: The novell probe likely shouldn't read the MAC address, and
that should be moved to the bus specific attach routine(s), maybe as a
convenience function in if_ed_novell.c.

My IBM Ethernet II (aka Info Mover) now has a believable MAC address.


# 141681 11-Feb-2005 imp

Eliminate the ED_VENDOR_{PCCARD,LINKSYS} types. These cards really
are NOVELL NE2000 with just a tiny quirk that's non vendor specific.
Instead, use the chip_type of DL100XX instead. This is more inline
with how the AX88190 support was added, and seems a little cleaner.


# 141558 09-Feb-2005 imp

o Remove duplicate LINKSYS ETHERFAST entry.
o The COMBO_ECARD comes in many flavors, it seems, so probe both the DL10019
and the AX88x90 on it. Since this seems to work with no ill effects, maybe
the probing should happen more generally rather than being table driven.
Need to think more about this.
o Remove PCM100 because it is duplicative (the ETHERFAST is the pcm100 and
apparently has the same IDs). It was here for NetBSD because they match
up an expected MAC address OID, but since we don't bother with that, we
don't need to be so finely discriminating.
o Minor style nit.


# 141494 08-Feb-2005 imp

Make it possible to unload ed. Move the ed_pccard_detach routine to
if_ed and rename it to ed_detach(). Tell other busses to use this
routine for detach.

Since I don't actually have any non-pccard ed hardware I can test
with, I've only tested with my pccards.

More improvements in this area likely are possible.

Prodded by: rwatson


# 140887 27-Jan-2005 imp

Add back support for D-LINK DMR-650TX, and all the other OEMd versions
of this card (evidentally MultiMobile also sold this card as
MT5634ZLXI/E).

Reported by: Bastian Brinkman


# 140863 26-Jan-2005 rwatson

Remove unused static declaration of ed_pccard_dl100xx(), which probably
accidentally snuck into a prior commit to if_ed, and prevented building
with -Werror.

Pointed out by: csjp


# 140845 26-Jan-2005 imp

Kill stray debugging line not fully removed


# 140844 26-Jan-2005 imp

Rework how we deal with the DL10019 and DL10022 cards (as well as the
AX88190 ones, but that one only minorly):
o don't set flags in the match routine. They appear to be cleared
when probe/attach is called. Before this change, they were
always treated as a simple ne2000, which would fail to get the
right NIC address.
o Lookup device again in the probe routine and probe based on the
cards that you see.
o Detect and report the DL10022 seprately from the DL10019 cards.

While I'm here:
o remove a bad printf
o change another bad printf to device_printf.
o minor style(9) formatting tweaks.

# note: a lot of OEM entries are in the ed_pccard_products such that we can
# likely remove, or collapse, many of them.

This makes all of my DL100xx cards at least probe the ethernet address
correctly, which it wasn't doing before. I can't seem to locate my
AX88xxx based cards, so those haven't been tested, but they were
busted before the change so they can't be any worse now...


# 140837 25-Jan-2005 imp

Turns out that Digital's DEPCM-BA and I-O Data PCLATE are both OEM
versions of the Racore PC Card Ethernet card. Rearrange to reflect
this reality. This ejects IODATA from 0x1bf, which belongs to Racore.

Thanks to Wilko for providing me with a dumpcis for the DEPCM card.

Also, added Nextcom Nexthawk card from NetBSD


# 140830 25-Jan-2005 imp

Use DIGITAL2 for DEPCM card


# 140789 25-Jan-2005 imp

Remove obsolete comment from head this time. The RELENG_5 commit was
accidental, but harmless and correct so I'll not be reverting it unless
there's some hidden damage I can't see right now...


# 140786 25-Jan-2005 imp

Add MagicRAM PC Card Ethernet as ne2000 clone


# 140522 20-Jan-2005 imp

Only attach to network functions.


# 139749 05-Jan-2005 imp

Start each of the license/copyright comments with /*-, minor shuffle of lines


# 136719 20-Oct-2004 imp

Rumor has it that ACCTON EN2216 is also an ne2000 compatible. Make it so.


# 132511 21-Jul-2004 imp

It is a little better to return ENXIO from probe/match routine than EIO.


# 129764 27-May-2004 imp

Fix disordering of pccarddevs.h noticed by bde. Also remove a few
redundant includes and fix some of the include disordering.

Submitted by: bde


# 129740 25-May-2004 imp

Move to generating pccarddevs.h on the fly, both for the kernel and
the modules.

Also generate usbdevs.h automatically now, but a non-kernel file is
stopping that at the moment.


# 129046 08-May-2004 imp

It turns out that the module dependency on pccard is in error. Since
there's not dependencies on pccard symboles, such a dependency is not
necessary. This means that drivers that have multiple attachments can
not drag bogus devices into the kernel at load time.

We can't (yet) do this with pci and isa. Drivers written for them
actually do seem to have symbols that depend on these busses'
implementation code.

ndis not touched until other things can be tested.


# 124017 31-Dec-2003 kato

Added TDK LAK-CD031 (simple NE2000 device).

Reviewed by: imp


# 121816 31-Oct-2003 brooks

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)


# 120292 20-Sep-2003 imp

EXPsys PCMCIA Ethernet Combo

Submitted by: Ludwig Pummer


# 118636 07-Aug-2003 imp

Add MELCO LPC3_CTX. This is the same as Buffalo card of the same name
with different vendor id.

Submitted by: Shizuka Kudo-san


# 118102 27-Jul-2003 imp

The LP_ETH_10_100_CF entry needs to be tagged as a DL100019.

Submitted by: Scott Renfro


# 118065 26-Jul-2003 imp

Add Socket Communications Low Power 10/100 CF Ethernet card.

Obtained from: NetBSD (information, not code)


# 117761 19-Jul-2003 imp

Add support for BUFFALO LPC3-CLX 10/100Base-T PC-Card

PR: 47786
Submitted by: IHA, genta -san


# 113506 15-Apr-2003 mdodd

- 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.)


# 113326 10-Apr-2003 imp

SMC 8041 is the same thing as LINKSYS COMBO_ECARD, so no extra entry
is required. NetBSD has one because it checks for the mac address
match as well wanting to give its own string in the description.
Since we do neither, we don't need a separate entry.

# I suspect that a few of the COREGA cards might fall into that category
# as well, but since I don't have access to any of them it is hard to know
# for sure.


# 113324 10-Apr-2003 imp

Add Billionton CFLT10N and SMC8041 (although I'm not 100% sure the latter is
needed). Remove duplicate kingston kne2 entry.

Info obtained from NetBSD


# 113320 10-Apr-2003 imp

reorganize the supported card table. We don't need the enet_vendor or
enet_mcast fields, so remove them. Sort. Eliminate now duplicate
entries.

This reorg saves about 500 bytes in the binary. I've tested this only
with a couple of cards, so please let me know if I've broken anything.


# 113317 10-Apr-2003 imp

Don't set the description if NULL.


# 113080 04-Apr-2003 sanpei

Add NE2000DVF_AX88190 flag to Corega FEther PCC-TXD
(see also /etc/defaults/pccard.conf rev.1.172)


# 109455 18-Jan-2003 shiba

Add BUFFALO LPC-CF-CLT(10Base-T Compact Flash Ether Card).


# 106937 14-Nov-2002 sam

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


# 104857 11-Oct-2002 imp

add some devices from NetBSD


# 100531 22-Jul-2002 imp

integrate from p4 repo:
o Honor NE2000DVF_{AX88190,DL10019} flags by setting the ED_FLAGS_xxxx
flag.
o Mark linksys combo_ecard as ax88190
o Set the type_str to AX88190 for the ax88190 cards.

This fixes ax88190 based cards, for the most part, but doesn't seem to fix
the mii based dl10019 cards (aka linksys cards).


# 93626 02-Apr-2002 imp

More newcard devices:
Netgear FA-410TXC
Netgear FA-411
Lantech Fastnet TX
Linksys pcm100
Hide the total wildcard device for SVEC too :-(

Obtained from: NetBSD/OpenBSD


# 89952 29-Jan-2002 imp

Add EDIMAX ethernet card for NEWCARD from NetBSD


# 86643 20-Nov-2001 imp

Comment out some bogus entries. somehow they match everything, which
is bad. I need to correct pccarddev, but I'm not sure how just at the
moment. So I'm firewalling the damage.


# 86396 15-Nov-2001 imp

MF NetBSD's if_ne_pcmcia.c rev 1.82's list of devices


# 86394 15-Nov-2001 imp

Migrate to PCMCIA_CARD() macros


# 86273 11-Nov-2001 imp

s/PCCARD_/PCMCIA_/g in NEWCARD device tables to enable easier NetBSD sharing


# 84151 29-Sep-2001 iedowse

Add an option ED_NO_MIIBUS, which causes the `ed' driver to be
built without support for miibus PHYs. Most ed cards don't need
miibus support, so it's useful to be able to avoid the bloat of
all the mii devices for small fixed-purpose kernels.


# 80163 22-Jul-2001 iedowse

Remove an old hack that remembered if the card type was Linksys by
storing a flag in the global variable 'linksys' during the probe
routine and reading it during the attach routine. We now have the
ED_VENDOR_LINKSYS vendor code stored in sc->vendor, so check that
instead.


# 80159 22-Jul-2001 iedowse

Attach the miibus for Linksys/Dlink cards from the attach routine,
not from the probe routine. This was an oversight when I originally
ported the miibus support to -current, though it was mostly harmless.

We now set the vendor code to the new value ED_VENDOR_LINKSYS in
ed_pccard_Linksys() at probe time. Then ed_pccard_attach() checks
the vendor code, and sets up the miibus if appropriate.

Reviewed by: imp


# 73374 03-Mar-2001 imp

Add support for Dlink DL10022 to the ed driver. This is a mii part
bolted to a ne-2000 chip. This is necessary for the NetGear FA-410TX
and other cards.

This also requires you add mii to your kernel if you have an ed driver
configured.

This code will result in a couple of timeout messages for ed on the
impacted cards. Additional work will be needed, but this does work
right now, and many people need these cards.

Submitted by: Ian Dowse <iedowse@maths.tcd.ie>


# 71324 21-Jan-2001 imp

Add a bunch of entries from NetBSD's if_ne_pcmcia.c v1.67. We still
need to verify that all the entries in pccard.conf are present in this
table.


# 70834 09-Jan-2001 wollman

select() DKI is now in <sys/selinfo.h>.


# 70355 26-Dec-2000 imp

Minor newbus/style(9) cleanups.
o Move the ax88190 code to its own function.
o Move all device_method_t, driver_t and DRIVER_MODULE definitions to the
end of files.
o Wrap a few lines > 80 characters.
o Use the same devclass for all ed drivers. This allows machines with
multiple types of cards to have their cards numbered correctly. Before,
you could wind up with two ed0's.
o Protect if_edvar.h from multiple includes because I was there.


# 70154 18-Dec-2000 toshi

Linksys Fast Ethernet PCCARD cards supported by the ed driver now
require the addition of flag 0x80000 to their config line in
pccard.conf(5). This flag is not optional. These Linksys cards will
not be recognized without it.

Reviewed by: imp, iwasaki


# 70117 17-Dec-2000 imp

Call ed_probe_Novel in the AX88190 case as well.
Remove stary blank line.

Submitted by: Seigo Tanimura <tanimura@r.dl.itc.u-tokyo.ac.jp>


# 69964 13-Dec-2000 imp

Fix problem with ax88190 based cards trying to probe further after
matching the ax88190.


# 69150 25-Nov-2000 peter

Argh, I have fixed this cut/paste error twice before. I must have
committed the wrong patch. :-( sn_pccard_products[] should have
been static anyway.


# 69137 25-Nov-2000 peter

Update the ed driver to probe and attach under a NEWCARD kernel (I was
using a cardbus based system with pccbb providing the pcic interface).
Something isn't quite right.. when the driver allocates and activates
its resources, the IO space that was requested reads as all zeros (versus
the original 0xff's as it normally is when there is no device responding).

Also, deactivate the resources before releasing them. OLDCARD doesn't
seem to care but NEWCARD/CARDBUS get rather unhappy if you release
a resource that hasn't been deactivated yet.

Make pcic_p.c only compile with oldcard kernels.


# 67172 15-Oct-2000 msmith

Network modules are all "if_foo" not "foo". Avoid the confusing spew that
ensues when ifconfig tries to load if_ed.ko when it's already in the kernel.


# 67164 15-Oct-2000 phk

Remove unneeded #include <machine/clock.h>


# 66332 25-Sep-2000 tanimura

Allocate memory resource to access the attribute memory of a card.

Reviewed by: imp


# 65771 12-Sep-2000 ps

Move the detection of Linksys PCMCIA cards from attach to probe.
This should solve the problems people were seeing with this driver.

Reported by: phk & others.


# 64777 17-Aug-2000 nyan

- Fixed the conversion to bus_space interface.
- Added PC-98 Cbus devices support.
The original patch is submitted by chi@bd.mbn.or.jp (Chiharu Shibata)
- Removed old ed driver.


# 64630 14-Aug-2000 tanimura

Newbusify ed driver.

Partly submitted by: alex


# 63775 23-Jul-2000 tanimura

MFPAO: Add support for AX88190, equipped in MELCO LPC3-TX.


# 63090 13-Jul-2000 archie

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


# 62236 29-Jun-2000 ps

Only try to detect Linksys PCMCIA cards when we are in a pccard
environment. This fixes the breakage to ISA ethernet cards.

Reviewed by: peter


# 59720 28-Apr-2000 imp

sanpai-san (sanpai@sanpai.org) suggested that we put the novel probe
first. This will fix a few cards that hang on the WD probe. He tells
me that PAO went one step farther and removed the WD proble completely
and none of the cards in the 2.x database broke in PAO3. Since I'm
more conservative in this code, I'm just swapping the order, which he
said also fixed his problem.

Reviewed by: mdodd, iwasaki
Submitted by: sanpai@sanpai.org


# 59313 17-Apr-2000 imp

Remove unloaded printf. We do this now in the newbus layer.


# 56361 21-Jan-2000 hosokawa

Propagate MAC address in CIS tupple to dev/ed/ driver.
Many ed-based Ethernet PC-cards can't get correct MAC address without
this patch.

Submitted by: Takanori Watanabe <takawata@shidahara1.planet.sci.kobe-u.ac.jp>
Reviewed by: Warner Losh <imp@village.org>


# 54384 10-Dec-1999 imp

Fix pccard ed driver, I think.
o Expose ed_stop and call it early to shutdown the hardware.
o When releasing the interrupt, pass the cookie for the irq, not
a pointer to the cookie (this is the base problem).
o Release other resources used, just like the ep driver


# 53978 01-Dec-1999 imp

Fix the hang on card eject problem and maybe the hang on suspend
problem.

o Create new timeout routine so we don't detach the card inside a ISR
but instead drop back to spl0 via a timeout of 0.
o Actually delete the child of the pccard device rather than just faking
it badly.
o Fix sio, ed and ep to have pccard detach routines that are int rather
than void.
o Fix ep and ed pccard detach routines to use if_detach rather than just
if_down. if_detach destroys the device, while if_down just marks it
down. In this incarnation of the pccard things, we map the disable
the slot action to detach the driver, which removes the driver from the
device tree. When that is done, a panic would soon follow as the
ifconfig tried to down the device.

Didn't fix:
o Should cache the pccard dev child's pointer in struct slot
o remove now unused parts of struct slot
o Any driver using softc after detach has been called. sio's softc used
to be statically allocated, so you could check sc->gone, but that is
now gone.
o Didn't remove gone from softc of drivers that use the old pccard method.

Didn't test:
o ed driver changes
o sio driver changes on pccards
o suspend (no laptop or apm support on my desktop)


# 53448 20-Nov-1999 imp

Kill unneeded #includes. They were left over from the short period of
time when a strcmp against the device name was required. Sio patches
sent to peter for review.


# 53378 18-Nov-1999 nyan

Set port_used and mem_used to the resource size instead of 1.

Submitted by: chi@bd.mbn.or.jp (Chiharu Shibata)


# 52585 28-Oct-1999 imp

Last change to pccard_nbk now obviates the need to check the name of
the device in question.
Also fix warnings on if_ep_pccard.c


# 52478 25-Oct-1999 imp

Have only one attach routine, rather than two.
Remove debug printfs.

This should allow the ed driver to work when memory mapping works again.


# 52473 25-Oct-1999 imp

Add pccard attachment. This won't work with memory mapped ed devices
yet, but that should be resolved shortly. Non memory mapped ed
devices should work, but I cannot test this since my only ed card is
memory mapped.

Submitted by: Matt Dodd <mdodd@freebsd.org>


# 52245 14-Oct-1999 mdodd

Break out the bus front end code into separate files.

Note that these haven't been turned on nor has the old code
been removed from if_ed.c. The next commit will address that.