Commit Graph

33 Commits

Author SHA1 Message Date
perry fbae48b901 Change "inline" back to "__inline" in .h files -- C99 is still too
new, and some apps compile things in C89 mode. C89 keywords stay.

As per core@.
2006-02-16 20:17:12 +00:00
perry 93124077ae Remove leading __ from __(const|inline|signed|volatile) -- it is obsolete. 2005-12-24 20:27:29 +00:00
jonathan cc474061e1 Add support for bcm5714 and (possibly incorrect) support for the
bcm5715 PCI-Express dual-port NICs. Taken from the Broadcom-supplied
Linux driver, bcm-8.3.13a.

Add nascent support for the bcm5780, but (since I have no bcm5780 to
test), don't yet add an entry which allows us to match or attach to a
5780.

Change 5752 support: Follow the lead of the Broadcom-supplied Linux
driver (bcm) and the Linux tg3 driver, and treat the 5752 like a 5750.
2005-12-12 00:40:44 +00:00
jonathan cf16a10aad Add PCI device-ids to sys/dev/pci/pcidevs for newer Broadcom gigabit
ethernet devices: bcm5714, bcm5752 (previously the 5789, but fvdl
committed that whilst I was musing).

Add definitions to sys/dev/pci/if_bgereg.h for the Broadcom 57xx-family
ASIC revisions on these newer chips.

Add entries to the PCI-device-version and bge-internal-asic-revision
tables in sys/dev/pci/if_bge.c to use these new devices. Pending
further information, follow the lead of FreeBSD's if_bge.c driver and,
pending further info, treat these new chips as we do the 5750.
2005-12-07 04:43:05 +00:00
tsutsui f7e281c38a Remove unnecessary byteswap code so that bge(4) should work
at least on macppc.
2005-11-25 15:30:34 +00:00
jonathan 43255e3f4e Add TSO support to bge(4) for PCI-Express bge devices, which are
shipped from the factory with TSO-capable firmware.  The TSO support
here may also work on 5705 chips, but that is (so far) untested.

TSO support written after careful reading of the Linux tg3 driver,
and (after attempting to deconstruct the cut-and-paste mess therein)
very close reading of the Broadcom-supplied Linux driver, particularly
the building of Tx-DMA buffer descriptors (bds). The TSO code herein was
then rewritten from scratch, circa 4am local time, October 27 2005.
(In other words: this is 4am software; caveat emptor.)

Other magic register settings in this patch are required; without
them, attepmting to use TSO locks up the chip. The required register
settings were extracted from the cited Linux drivers.

Note that TSO-capable firmware for the 5703/5704 is distributed in
non-GPL form with the aforementioned Linux drivers. Once the 5705 case
is debugged, (particularly the pseudo-header checksum precalculation
flagged with an XXX) downloading that TSO-capable firmware to the
5703/5704 should, in principle, enable TSO support on all but the
original bcm5700 (I forget if the 5701 can support TSO, or not).

Note also that the ``hard case '' of IP/TCP headers spanning more than
one mbuf is not handled; I haven't been able to trigger it.  In any
case, since TSO applies only to packets generated by the local TCP,
and our TCP always leaves space for TCP headers and a normal IP
header, TSO on an IP/TCP header spanning multiple headers can only
arise due to insertion of IP options. I beleive that we are clearly
better off outlawing that case, and requiring ip_insertoptions()
to  pull-up TCP headers on any packets with M_CSUM_TSOv4 set.

As far as I know, bge hardwar does not support TSO for IPv6.
2005-11-24 03:27:59 +00:00
jonathan de85711ee1 Correct a performance bug from Bill Paul's original FreeBSD bge(4) driver:
Each call to the FreeBSD bge_start() routine the transmit producer
pointer index from the chip mailbox register BGE_MBX_TX_HOST_PROD0_LO.
The local copy of that value is then updated by bge_encap() as
bge_encap() encapsulates packets in the Tx ring. If bge_encap()
succeds in encpuslating one or more packets, bge_start() tells the
chip to start sending the newly-encinitiates writes the new value back
to the chip mailbox register.

However, comparison of the Linux drivers (Broadcom-supplied and
open-source tg3.c) and to the OpenSolaris driver confirms that
register BGE_MBX_TX_HOST_PROD0_LO is write-only to software.
Thus, we can just keep a copy in the softc, and eliminate the
(expensive) PCI register write on each call to bge_start().

``Make it so''.
2005-11-15 06:05:44 +00:00
thorpej 3876130b24 Remove unused and incorrect macro BGE_HOSTADDR(). 2005-08-28 19:24:57 +00:00
gavan 84c672e259 Add quirk for BGE_CHIPID_BCM5751_A1. From Kurt Schreiner <ks at ub.uni-mainz
dot de> via PR kern/31028.
2005-08-22 18:18:25 +00:00
perry f31bd063e9 nuke trailing whitespace 2005-02-27 00:26:58 +00:00
jmcneill 0c537484ca Add powerhook to bge(4) 2005-01-26 21:52:47 +00:00
cube cce3c2a9eb Add support for the BCM575x variants. They're close to the 5705 one, with
some special cases for the PCI-Express versions.  As there is no
documentation available, all of this is inspired from Linux or taken from
FreeBSD (itself inspired from Linux).  There are a lot of magic numbers.

Tested on two BCM5751 devices as found in newer Dell computers.
2004-10-28 07:36:05 +00:00
thorpej b7d5c113dd Add PAUSE-related event counters. Slightly modified from patch supplied by
HITOSHI Osada.
2004-05-15 22:19:27 +00:00
thorpej 34b8c2c481 Patches from HITOSHI Osada:
* Set buffer management high water marks for MTU > 1514.
* Set BGE_MAX_RX_FRAME_LOWAT (from Linux driver).
2004-05-15 21:58:40 +00:00
thorpej 4c019a313e Add 802.3x flow control support. From HITOSHI Osada. 2004-04-10 19:23:49 +00:00
jonathan 73e79089ee Possibloe fix for some bge chip revisions taking a long time to reset
(e.g., polling for a half-second or more at splnet(), blocking most
interrupts, durin an ifconfig down/ifconfig up).

Appears to help for a 5704C rev A3, which is the only chip I've
ever seen that had even a mild version of the reported problem.
2004-03-20 01:58:51 +00:00
jonathan ca71058195 Add hooks to dynamically change the bge Rx interrupt thresholds. I
found empiricaly that (at least on bcm5700s) the Rx coalesce and bd
counts cannot be updated on-the-fly; attempting to do so (even at
splhigh()) causes weird behaviour.

Instead, add a softc flag to record that the desired softc values for
Rx-interrupt thresholds have changed; check that boolean in the interrupt
routine. If set, apply the new values there and clear the flag.
2004-01-22 02:29:46 +00:00
jonathan 487ab6705e Add some extra register definitions from FreeBSD and Linux:
BGE_MISC_TIMER register definition, and more bit definitions for
HCC-mode. (I would credit individuals, but the attributions are buried
deep in my own tree.)
2004-01-22 02:13:48 +00:00
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
wiz d88f7b1d62 boundary, not boundry. Inspired by Tom Cosgrove. 2003-11-02 10:31:06 +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
fvdl 7674ed5fa0 Support the BCM5704C rev 3. From Nicolas Joly, PR 22620 2003-08-27 23:13:50 +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
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
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 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
fvdl 3c2bd2b431 Add local_ctl_reg field to softc. 2003-01-17 11:17:08 +00:00
jonathan 21cd3a1948 Add register definitions for 5704 internal ASIC revision.
Add cpp definitions for the DMA control register fields needed for
5703/5704 configuration on PCI-X.
Add softc copy of internal"local control" register clobbered by reset.
2003-01-17 00:21:37 +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
fvdl 4f75cebd06 Add a few revision definitions. 2002-06-24 01:21:39 +00:00
fvdl b04a6fd69c Driver for Broadcom 570x / Altima AC 1000 gigabit ethernet cards.
Written by Bill Paul for FreeBSD. This port started out with the
port done to OpenBSD by nate@openbsd.org, but ended up looking much
more like the port of the ti driver done by drochner@netbsd.org
(they are similar in structure).
2002-06-22 14:42:07 +00:00