Commit Graph

55 Commits

Author SHA1 Message Date
pooka 3c0925818d Match 5703 ASIC A3.
Also, when printing the ASIC ID, print the revision in hex in all
cases to avoid extra confusion if only the "superclass" of the ASIC
is recognized.
2003-12-08 17:09:39 +00:00
fvdl 9d4e217e09 From FreeBSD:
* erratum: disable the nocrc RX bit, as it may cause problems on the 570{1-4}.
  adjust the length of the incoming packet accordingly to trim it.
* the 5704 has a smaller MBUF_POOL, so set a smaller value

Local change:
* Pass the autoneg force flag to mii_attach. Some PHYs need to be kicked
  out of their falsely autoneged 10baseT state with this.
2003-11-11 22:28:58 +00:00
simonb b6abb6ab1d Remove some assigned-to but otherwise unused variables. 2003-10-30 01:58:17 +00:00
fvdl d85a7f8656 Need the NOCRC bit, or my 5704B5 will start acting up. 2003-10-23 20:36:36 +00:00
fvdl 4df6c69646 * match more cards (from FreeBSD)
* don't set the NOCRC bit in the mode control register, it can cause
  problems on some chips (from the broadcom errata via FreeBSD)
* implement a fallback quirktable that is searched only using the
  major asic revision, so that the driver has a shot at supporting
  newer versions properly without modification
* rename asicrev -> chipid, like the FreeBSD driver
2003-10-23 17:41:59 +00:00
tron 90ef1d5718 From FreeBSD as suggested by Nicolas Joly in PR kern/22682:
Do not initalize the LED's to 0x00.  The default configuration
the chip comes up in should yeild proper operation of the LED's.
2003-09-05 08:53:23 +00:00
fvdl 7674ed5fa0 Support the BCM5704C rev 3. From Nicolas Joly, PR 22620 2003-08-27 23:13:50 +00:00
hannken 26d8cfe506 Finish last commit (Make this compile with options DEBUG).
NetBSD has no M_WRITABLE().
2003-08-26 10:17:02 +00:00
cjep a94f967897 Make this compile with options DEBUG (part of PR#22582 from Frank Kardel). 2003-08-23 20:37:18 +00:00
jonathan 215937cb45 Check in hooks to fix checksum offload on bge devices. Empirical
observation is that some 570x devices can get themselves into a state
where they miscompute off-loaded TCP or UDP checksums on packets so
small that Ethernet padding is required.  Further obsevation suggests
that the bge checksum-offload hardware is adding those padding bytes
into its TCP checksum computation. (Once a 5700 gets in this state,
even a warm boot won't fix it: it needs a hard powerdown.)

Work around the problem by padding such runts with zeros: even if the
checksum-offload adds in extra zeros, the resulting sum will be correct.

Also, dont trust the checksum-offload on received packets smaller than
the minimum ethernet frame, in case the Rx-side has a similar bug.

Finally, on packets where we do trust the outboard Rx-side TCP or UDP
checksum, the bge did not include the pseudo-header. Set the
M_CSUM_NO_PSEUDOHDR bit as well as M_CSUM_DATA, and rely on
udp_input() or tcp_input() adding in the sum via in_cksum_phdr().
2003-08-22 03:32:35 +00:00
jonathan 25eeb02c06 Fix a bug in compaction of `DMA runt' fragmented packet chains:
if we m_dup() a packet to compactify it, and later run out of DMA
descriptors, bge_encap() will return ENOBUFS, hoping the driver will
try again later.  But we have just m_freem()'d the original chain
which was m_dup()'d, leaving a pointer to the just-freed packet header
in the tx queue.

Fix by always walking the chain, shuffling data towards the head;
except if we find a runt in the very last mbuf, we must borrow data
from its predecessor.

(Patch is verbatim from a third-party tree, apologies for any style woes.)
2003-08-22 03:03:20 +00:00
hannken 7b247f3812 Add support for the BCM5705:
- Only BCM5705M asic rev A1 was tested.

Thanks to Bill Paul (wpaul@freebsd.org) for help and support.

Approved by: Frank van der Linden <fvdl@netbsd.org>
2003-07-17 11:44:26 +00:00
lukem 365cbd9428 add missing __KERNEL_RCSID() 2003-07-14 15:47:00 +00:00
ragge b027f1fffd Set the send queue to max(BGE_TX_RING_CNT - 1, IFQ_MAXLEN); sometimes
IFQ_MAXLEN may be choosen to a larger value than number of descriptors.
Why this setting from the beginning???
2003-06-30 13:20:21 +00:00
fvdl 7dd7f8baa2 Handle 64bit DMA addresses on PCI for platforms that can (currently only
enabled on amd64). Add a dmat64 field to various PCI attach structures,
and pass it down where needed. Implement a simple new function called
pci_dma64_available(pa) to test if 64bit DMA addresses may be used.
This returns 1 iff _PCI_HAVE_DMA64 is defined in <machine/pci_machdep.h>,
and there is more than 4G of memory.
2003-06-15 23:08:53 +00:00
fvdl 370167ec16 Add newer 5704 asic revs, and add them to the table, with the
BGE_QUIRK_ONLY_PHY_1 quirk in their entry.
2003-06-01 20:26:14 +00:00
wiz 1ffa7b76c4 DMA, not dma nor Dma. 2003-05-03 18:10:37 +00:00
tron ea710d8119 Don't print a kernel message like "bge0: gigabit link up" when a Gigabit
link is detected. No other ethernet driver does this and this driver
doesn't do it for other modes.
2003-03-24 12:06:05 +00:00
jonathan cd38c4da5c Commit workaround for hardware bug: 5701 chips running in PCI-X mode
require that the DMA receive buffers be aligned. The driver was
deliberately mis-aligning by 2 bytes, to force the layer-2/3
headers to 32-bit alignment.

Workaround: if chip is a 5701, and is in PCI-X mode, leave the DMA
buffers aligned.  If the host CPU requires alignment, copy the buffer
after reception to force aligment.

Tested  on an i386 in  PCI-X bus, with __NO_STRICT_ALIGNMENT forced off.

Patch and comments reworked  to minimize drift from
	FreeBSD if_bge.c rev 1.14.
2003-03-07 18:57:53 +00:00
jonathan 5214474746 Fix typo: PRODUCER_BUG quirk mask overlapped the PCIX register-bug quirk.
(Harmless, since we dont use the latter; but we will use it very soon.)
2003-03-07 18:40:18 +00:00
jonathan a9ae465f5e Commit the FreeBSD alternative of a private patch to check NIC internal
ram for using TBI, versus MII/GMII.

FreeBSD commit log and versions:
   Obtain the media type from the shared memory and only use the eeprom
   as a fallback.

   if_bge.c:	rev 1.30
   if_bgereg.h:	rev 1.13

Thanks to Paul Saab @mu.org.
2003-03-06 20:53:05 +00:00
jonathan cf38b6aae6 FreeBSD fix for problems reported (to FreeBSD) with 16-bit accesses
to 32-bit device registers. Add (untested) NetBSD fix for big-endian hosts.
From FreeBSD versions:
	if_bge.c:	1.26 and 1.27
	if_bgereg.h: 1.12

FreeBSD (MFC) comment:

MFC:  Avoid 16-bit accesses to device memory.  Use volatile where
appropriate in referencing device memory.  Parenthesize BGE_HOSTADDR
define properly.
2003-03-06 20:12:53 +00:00
tsutsui 60a7e59350 hz -> Hz 2003-02-22 04:57:48 +00:00
tron 1677386f89 Correct typo in an e-mail address. 2003-02-09 10:06:16 +00:00
thorpej 515d52e9e7 Change ext_size to a size_t, and update the signature of ext_free. 2003-01-31 05:00:24 +00:00
thorpej 2f060102ae Use aprint_*(). 2003-01-31 01:03:35 +00:00
itojun c8012d9047 correct the use of m_tag. correct indentation (:set sw=8 ts=8 please,
jonathan)
2003-01-17 08:27:35 +00:00
itojun 40606ab8f2 switch from kame-based m_aux mbuf auxiliary data, to openbsd m_tag
implementation.  it will simplify porting across *bsd (such as kame/altq),
and make us more synchronized.  from Joel Wilsson
2003-01-17 08:11:49 +00:00
jonathan 1b7f3ca44b Grr. Fix consistent typo, to match what i actually tested before committing. 2003-01-17 00:24:29 +00:00
jonathan ad77f4e6fb Enable the 5700 DMA bug and producer-pointer fixes, by setting the
quirk on all 5700 revision B devices. (These fixes have not been
tested against NetBSD recently; committing the fix and the enable separately
gives us flexibility about which fixes get pulled into the NetBSD-1.6 branch.)
2003-01-17 00:11:00 +00:00
jonathan 1484718092 Commit accumulated bge fixes:
* Add support for 5704C dual-channel chip with integral copper PHY (tested)
   and 5704S dual-channel SERDES/TBI gbic  (untested).  Add PHY DSP patch
   for 5704.
 * Update PHY DSP-code patch for bcm5401 to match latest Linux driver.

 * Add PHY DSP-code patch for 5703 (untested).

 * Update onchip buffer tunables to recommended values from Linux drivers.

 * Disable MWI access.  This chip family cannot hanlde PCI stalls
   in the middle of an MWI burst. The driver has heuristics to detect PCI
   line size, but under load, some PCI bridges may force stalls which
   the attach-time heruistics do not catch. Some PCI bridges never
   do this, so maybe it should be a  tunable option.

*  bcm5700 rev Bx chips have a race condition, where updating the
   Tx producer pointer goes un-noticed by the chip.  Workaround is to
   write the new producer-pointer value twice.

*  bcm5700 chips rev Bx wedge up if given  DMA descriptors of
   eight bytes or less. Once hit, only reovery is a watchdog timeout/reset.
   If the offending packet is retransmitted, the chip will wedge again...
   Check for teeny fragments in a Tx request, and either fold the
   teeny chunk residue into an adjacent mbuf, or m_dup the entire buffer.
   (NB: quirk not yet enabled; in-place folding tested only on FreeBSD.)

 * Add workaround for revision Bx bcm5700: chip bugs in decoding
   of PCI register writes may leave the hardware in (partial) powersave state,
   such that  writes to "indirect" registers do not work.
   Explicitly force chip into D0 state at attach time.

 * Accessing PHY registers with the bge chip in autopoll mode, when
   link-state is the process of changing, may cause the bge chip to
   assert PCI errors.   Workaround:   when doing miibus register access,
   save autopoll state, disable around access, and restore autopoll state.
   NB: issuing PHY resets may give a window where the problem still occurs.

 * Increase Tx interrupt-coalescing thresholds, to reduce Tx-done interrupts.
2003-01-17 00:02:56 +00:00
matt 5914ae08f9 Recognize BCM5702X and BCM5703X. Add a ONLY_PHY_1 quirk and use it.
Add support for getting the macaddr for 5703 (taken from FreeBSD).
2002-12-26 20:55:30 +00:00
kristerw e367c94b9c Do not try to print uninitialized variable. 2002-10-06 23:34:56 +00:00
thorpej b75a007d9f Add trailing ; to CFATTACH_DECL. 2002-10-02 16:51:16 +00:00
thorpej 387fc6dc87 Use CFATTACH_DECL(). 2002-09-30 20:37:04 +00:00
thorpej f818766afe Declare all cfattach structures const. 2002-09-27 20:31:45 +00:00
mjl 395027b4be Correct obviously switched args to memset() 2002-07-18 02:07:13 +00:00
thorpej 7ba40961d6 Add a BGE_QUIRK_CSUM_BROKEN quirk, and give it to BCM5700 B0, rather
than testing for the revision all over the driver.  If the chip has
broken checksums, then don't advertise the capability to the stack.
2002-07-13 22:48:40 +00:00
thorpej 0ff52204b9 Give BCM5700 Ax and Bx revs the BGE_QUIRK_LINK_STATE_BROKEN quirk,
and test for that, rather than checking revision where the quirk is
handled.
2002-07-13 22:31:18 +00:00
thorpej dcebb2bf0d Add a lookup table with ASIC revision, name, and any quirks. Print
ASIC revision at attach time.  Add BCM5703 revisions.
2002-07-13 22:21:20 +00:00
thorpej 7d85789f0a Move the BCM5401 DSP patch out of the bge driver and into
the brgphy driver; all users of the BCM5400 and BCM5401 need
the DSP patch and the sledgehammer-reset-at-media-set-time.

Also add a DSP patch for the BCM5411 gleaned from Apple's
GMAC driver for Darwin.

Tested with a 3Com 3c996-T (BCM5700 + BCM5401).
2002-07-13 01:23:27 +00:00
enami f216ec52a0 Match Altima AC1001. 2002-07-12 22:29:14 +00:00
thorpej 7ff40c446d Fix multicast filter programming. 2002-07-01 22:42:47 +00:00
thorpej 969b2f1817 Fix a comment. 2002-06-28 18:46:46 +00:00
thorpej 9066ce1621 When stopping the various functional blocks of the chip, clear the
bit and then read it back in a loop (with appropriate delays) waiting
for it to read back clear.

This fixes a problem where the bus would hang when bringing down
the interface or changing interface flags on a system with a
sufficiently fast CPU (e.g. 2GHz P4 Xeon).
2002-06-28 18:44:45 +00:00
fvdl 50ade28e9b Rearrange alignment code a bit. 2002-06-28 18:39:45 +00:00
thorpej 6abec8e2a2 Increase previously added delays from 2us to 10us. 2002-06-28 01:10:06 +00:00
thorpej 90bf67b885 * Only set the jumbo frame capability if we are able to allocate
jumbo frame buffers.
* Garbage-collect some stuff we don't need.
* Fix timeout detection in the firmware handshake.
2002-06-28 00:55:20 +00:00
thorpej 7778c16e7c Use a table to match BCM570x products. 2002-06-27 23:56:20 +00:00
thorpej b7af161065 Don't call m_aux_find() in the inner loop when creating the Tx
descriptor list.  Instead, call it once and remember the result,
and only call it looking for VLAN tags if VLANs are configured
on the interface.
2002-06-27 23:21:34 +00:00