Commit Graph

59 Commits

Author SHA1 Message Date
thorpej 5082673b91 - Encapsulate the EEPROM reading code into ep_read_eeprom(), and use
the correct "read eeprom" opcode on the RoadRunner (which has a larger
  EEPROM, and thus needs a different opcode to make room for the larger
  offsets).
- Reset and enable the MII before probing for PHYs, and reset and enable
  the MII in epinit().
- Be more conservative when resetting the interface after a transmit error.

Based on PR #8331, from Ryoji KATO.

Closer on 3c574, probably will work fine with the 3CCFEM556BI (which
won't have an older rev TDK Semi PHY, and which was tested by the author
of the PR).
1999-10-11 17:48:20 +00:00
thorpej f98d358a1f Rework layer 2 protocol input routines. Instead of calling e.g. ether_input()
directly, call the function pointer (*if_input)(ifp, m).  The input routine
expects the packet header to be at the head of the packet, and will adjust
as necessary.  Privatize the layer 2 input and output routines, allowing
*_ifattach() to set them up as appropriate.
1999-05-18 23:52:51 +00:00
jonathan 055b827e11 Calling DELAY() during polling for command completion of the normal
per-packet discard of every received packet increases latency and
decrease throughput.  INstead, Spin on S_COMMAND_IN_PROGESS for enough
iterations as the expected time to completion.  Only do DELAY()/poll
loops (as suggested by Jason Thorpe) if spinning fails.
Take PCI as fastest case and compute worst-case estimate.

Shorten DELAY() in S_COMMAND_COMPLETE polling-loop up 10, loop-count
down.  to speed up epreset() completion (m/c filter change, ifup/ipdown, etc).
1999-04-20 04:40:24 +00:00
jonathan 07c7535688 * Make doubly sure that the ep shutdownhooks are run at splnet() or above.
* Clear the `enabled' bit in the softc so late hardware interrupts
  (e.g., just after the full reset) done as part of shutdown) are dropped.
* Eliminate loops that  poll forever on S_COMMAND_IN_PROGRESS to complete.
  Add inline function with bounded loopcount plus small delay, to avoid
  bugs in EISA hardware which never sets S_COMMAND_IN_PROGRESS.
  Use for both TX_RESET/RX_RESET/GLOBAL_RESET cmds, and polling for
  discard-Rx completion
1999-04-19 23:26:48 +00:00
jonathan 2bf9a70e67 Endian-ness bugfix for elink3 on big-endian hosts.
Big-endian CPUs should use bus_space_{read,write}_multi_stream methods
  to PIO packet data to NIC in 16-bit or 32-bit chunks.
  Make it so.
  Since we don't have stream methods on all ports yet (esp. i386), use
  the bus_space_{read,write}_multi methods if the compile-time
  stream-method feature-test   macro is not set.
Originally from tsubai@netbsd.org, via HAYAKAWA koichi's cardbus patches.
1999-04-13 20:23:52 +00:00
thorpej ad22c1dd58 Use ETHER_*_LEN constants from <net/if_ether.h> instead of defining them
ourselves.
1999-03-25 23:16:37 +00:00
explorer 3ebb419571 Update to slightly altered rnd_attach_source() api 1999-02-28 17:08:05 +00:00
thorpej 69a4436f8b Avoid initializing the interface in the SIOCSIFFLAGS if ! UP and ! RUNNING. 1999-02-17 03:40:59 +00:00
mycroft 90b7cbc727 Simplify argument to MGET(), to generate better code. 1998-12-12 16:36:24 +00:00
thorpej 1d0f24882d Now that the *_activate() functions don't do things which are attachment
specific, move them into the chipset drivers.
1998-11-18 18:34:52 +00:00
thorpej dd6750820c Expose the "enable" and "disable" functions so that the front-ends can
access them.
1998-11-17 20:25:00 +00:00
thorpej d2afdb5b59 Fix some whitespace lossage, canonicalize some media names. 1998-11-16 19:13:31 +00:00
fvdl 7b10c3e7e4 Add the 'ex' driver, a DMA driver for 3Com 90x and 90xB cards. Rename
constants from EP_ to ELINK_ since they're now used in the ex driver as well.
1998-11-04 00:29:28 +00:00
thorpej f3bfb08d45 When determining the default media on the Vortex/Boomerang, don't pick
the full-duplex variant.  XXX We should check the EEPROM for "default to
full-duplex".
1998-08-28 18:16:02 +00:00
thorpej bc21c243cd For non-MII Vortex/Boomerang, set full-duplex in the MAC CONTROL register
in epsetmedia() if full-duplex is selected (new feature on these cards!)

On MII Boomerangs, set the full-duplex bit in MAC CONTROL in the statchg
callback from the MII layer.  Should fix full-duplex on these cards.
1998-08-26 01:32:41 +00:00
thorpej 6bfd748b46 First-crack at RoadRunner (3c574-TX 10/100Mbps PCMCIA). Doens't yet use
any of the RoadRunner speed hacks.
1998-08-17 23:20:39 +00:00
thorpej cbcc3cfa46 Oops, back out something that I didn't intend to commit. 1998-08-16 01:16:57 +00:00
thorpej 479d8b25bf The 3c515 (Corkscrew) and 3c574 (RoadRunner) have their Window 1 registers
offset!  Define an inline function to compute the Window 1 register offset
and use it.
1998-08-15 16:20:51 +00:00
thorpej b170caf730 Completely rewrite media selection. Add support for the MII/PHY on
the 3Com 3c905-TX and 3c905-T4.  Fix handling of the MII on the
3c595-MII and 3c597-MII (can't talk to the PHYs on these cards; just
use "manual" for the external MII port).

Fixes kern/4782 (Chris Demetriou).
1998-08-12 18:51:52 +00:00
jonathan 011f2bda08 defopt NS, NSIP. 1998-07-05 06:49:00 +00:00
jonathan 3751946b97 defopt INET, NETATALK. 1998-07-05 00:51:04 +00:00
augustss 713692a2b5 For the Rx:Tx split message change "(undefined)" to "3:5". 1998-03-04 18:10:03 +00:00
thorpej 095c4c092d Adjust for config changes. 1998-01-12 09:23:08 +00:00
jonathan 8bb9a1ccb2 Protect #ifdef DEBUG printfs with a run-time teson a patchable variable
(epdebug), as per Jason Thorpe's comments.
1997-10-18 00:15:02 +00:00
explorer f9370ddc7a Add and/or update rnd_*() hooks 1997-10-15 05:55:13 +00:00
thorpej 10708da893 Pull down from marc-pcmcia branch:
Minor tweaks to deal with PCMCIA differences, and support for power
management.
1997-10-14 21:28:37 +00:00
jonathan 2f459bf1d8 Initialize local variable 'j' in eeprombusy() to pacify gcc -O (not -O2)
on i386.
1997-07-30 18:26:23 +00:00
thorpej 151926da32 Make sure we're in register window 0 before attempting EEPROM access,
pointed out by Matthias Drochner.
1997-05-14 00:22:00 +00:00
jonathan fac2cd30a0 Set TX-available threshhold in epinit() just before enabling interrupts,
so TX_AVAIL intrs are enabled for root-on-NFS kernels.
Tested (and required) on 3c595TX with root-on-NFS kernel booted from floppy.
1997-05-11 05:47:08 +00:00
mycroft 103c7d360d Oops; forgot to GC the last mbuf allocated when out of clusters. 1997-04-28 17:03:58 +00:00
jonathan dbf4f7b71f * Tidy PHY [sic] selection code in epsetmedia().
* epinit() had both explicit xcvr selection for 3c589 and a call
  to epsetmedia().  The first is redundant; delete it, and EP_COAX_DEFAULT.

* Update comments to reflect 3c589 and 3c509B fixes.  Fix typos.
1997-04-27 21:09:56 +00:00
veego a2e1f15ba7 - Replace the check for EP_BUS_PCMCIA in epsetmedia with a check for
EP_CHIPSET_3C509 and change it a bit so it works now with the 3c509
  and still works with the 3c589.
- KNF
1997-04-27 09:38:50 +00:00
mycroft 91a808523c Fix typo in previous. 1997-04-24 08:05:13 +00:00
mycroft 581399fc4c If we fail to allocate a cluster to hold a large packet, simply
drop it rather than using a chain of tiny mbufs.
1997-04-24 02:24:04 +00:00
cjs 9be8b65e23 Smaller, cleaner code for aligning struct ip on receipt. 1997-04-23 08:15:03 +00:00
cjs 5c8bf48817 Align struct ip on incoming packets for all types of cards, not just
32-bit ones.
1997-04-22 21:19:11 +00:00
jonathan f11d74c508 Remove IFF_LINK[01] "connector" support.
Add if_media support.   Still missing a software autosense FSM.
1997-04-07 23:49:47 +00:00
jonathan c1f72bba37 Add ifmedia hooks: include <ifmedia.h> and add sc_media to softc. 1997-03-30 22:47:05 +00:00
is 07b064e02e New ARP system, supports IPv4 over any hardware link.
Some of the stuff (e.g., rarpd, bootpd, dhcpd etc., libsa) still will
only support Ethernet. Tcpdump itself should be ok, but libpcap needs
lot of work.

For the detailed change history, look at the commit log entries for
the is-newarp branch.
1997-03-15 18:09:08 +00:00
jonathan c7cec27edf Move if_ep media-sense code from front ends to inside back end,
to prepare for if_media, and to support EISA 3c59x cards:

  * change epconfig() to take a short that encodes the chipset
    type (3c509, or Demon/Vortex/Boomerang).
  * add  distinct 3c509 and Demon/Vortex/Boomerang media-sense
    functions to back end.
  * Add EISA match/attach support for the 3c592 and 3c597
    (Demon) cards as well as the 3c509-comatibl EISA 3c509/3c579.

  * Assume that ISA and ISA PnP cards are 3c509-style, until
    proof to the contrary (e.g. large packet support).

Tested on 3c595, 3c590, and 3c509b. Not tested on 3c515 or Demon.
1997-02-18 10:51:06 +00:00
jonathan 4fdff0ed65 * Add ep_complete_cmd() function, to issue commands that perform a reset
(RX_RESET, TX_RESET, GLOBAL_RESET).
  Commands issued while a reset is in progress may be dropped. The driver
  must wait until resets are complete; ep_complete_cmd() does so.
* Change RX_RESET,  TX_RESET, GLOBAL_RESET to use ep_complete_cmd().

* Revert epconfig() to use inline RX_RESET, TX_RESET.
  That avoids accidentally setting IFF_UP, which  breaks both diskless boot,
  and "halt" commands issued before the interface is brought up.
1997-02-16 04:09:18 +00:00
jonathan 9821b30fe4 Use DELAY() after doing a TX_RESET or RX_RESET command.
Newer boards (e.g., Vortex) take  time to reset, and wedge on some machines.
Polling on S_COMMAND_IN_PROGRESS would be better, but that doesn't
work with xx_RESET commands on 3c509s.
1996-12-31 21:36:30 +00:00
jonathan 259ce9f178 * make sure 100mbit media-present bits don't collied with 3c509
CONFIG_CNTRL bits by making the "conn" argument to epconfig()
   a u_int, not a u_int16_t, and by defining 100mbit media
   bits in the upper 16 bits.

A redesigned interface that fixes this properly is in the pipeline.
1996-12-30 19:18:28 +00:00
jonathan b00ac4cf2c * add epshutdown(), and establish as shutdown hook: see multiboot
comments in pr port-i386/2358: "if_ep/3C590 no longer working"
* Only call Vortex media-config code on PCI-attached devices, until
  we know if it works on ISA and EISA large-packet devices also.
* Fix typo in printf of MAC address
1996-12-29 17:01:58 +00:00
jonathan 23c1d14c64 * Add 100Mbit xcvr flags to epconfig():
look for 100mbit Xcvrs, print their names, add to ep_connectors.

* Print 10baseT as 10baseT, since media name (utp) is no longer a unique
  transceiver type.

* Redo FIFO memory size printing, also show Tx/Rx split (xxx isa 3c509?).

* Print MAC address on a separate line,  with 100Mbit media and fifo-ram
  info it no longer fits on the same line as media types.

* Comment the fact that the "connection" media-selection code just doesn't
  grok 100Mbit media.

* add code to look for 3c59x/3c90x media-select and autoconfig bits, though
  we don't yet dynamically probe media when the autoconfig bit is set
  (see previous bullet).

* XXX the whole connector/media code should be redone, perhaps a' la
  the BSDI ifmedia design.
1996-12-29 13:32:46 +00:00
cjs b1e0c7d657 Print the memory size on startup.
Add newline to `Interface disabled' printf and clean up formatting.
Change packet read/write code to align all reads and writes into
memory to an appropriate boundary for the I/O size. This also fixes
a bug where the trailing unaligned bytes (1-3 of them) would be
put in an additional mbuf even if there was enough space for them
in the one we were currently filling.
This has been tested on a 3c905 in an Alpha (32-bit I/O, alignment
required), a 3c905 in an i386 (32-bit I/O, alignment not required)
and a 3c509 in an i386 (16-bit I/O, alignment not required). It
should be tested on a 3c509 in an Alpha with an ISA bus, if somone
can manage to get the two items together.
There are still some bugs in the driver relating to initialisation;
on my Alpha with a 3c905 you need to do an `ifconfig ep0 down;
ifconfig ep0 up' after the initial ifconfig to make it start working.
Apparently there are also some problems with a 3c579 in an i386,
although a 3c905 in an i386 works just fine.
1996-12-07 08:33:07 +00:00
jonathan f6a82ef733 * 3c509s drop the low-oder bits of EP_THRESH_DISABLE (2047) on a write,
and the result reads back as zero.  Mask probe code accordingly.
1996-11-22 04:48:26 +00:00
jonathan 16d760f318 Fix for hanging 3com ``large packet'' (100Mbit) Etherlink-III devices:
* Add a slot in the softc, ep_pktlenshift, to indicate that
    a board implements ``large packets'' (FDDI-sized frames) and
    therefore implicitly shifts the argument to packet-length commands
    by two bits to fit a 13-bit length in  an 11-bit command argument field.

 *  Change  the reset of station-mask filterto be independent of bus-type
    (e.g.,. for 3c515)

 * Replace  the "2044" constant used to disable TX threshold interrupts
   on 3c509-generation cards with a #define. Use 2047 instead,
   since that works on the large-packet cards (Vortex, Demon, Boomerang)
   and 2044 doesn't.

 *  Add code to  epconfing to probe for large-packet support,
    set the softc appropriately, and  shift packet sizes in commands
    by ep_pktlenshift to compensate  for the implicit shift.

 *  Tweak the epconfig() code to avoid hanging on startup.
    Set the Tx threshold to interrupt when there's space for
    a maximal-sized ether frame, then  do epinit() then epstop(),
    instead of just the Tx and Rx reset. Required on at least a 3c595.

Tested on  a 3c595, but not on 3c509-generation hardware.
1996-11-17 23:58:29 +00:00
thorpej 16c4c5af26 New bus.h implementation/interface:
- No more distinction between i/o-mapped and memory-mapped
	  devices.  It's all "bus space" now, and space tags
	  differentiate the space with finer grain than the
	  bus chipset tag.
	- Add memory barrier methods.
	- Implement space alloc/free methods.
	- Implement region read/write methods (like memcpy to/from
	  bus space).
This interface provides a better abstraction for dealing with
machine-independent chipset drivers.
1996-10-21 22:24:37 +00:00
christos 86373f8cf9 backout kprintf changes 1996-10-13 01:37:04 +00:00