Commit Graph

208 Commits

Author SHA1 Message Date
Jung-uk Kim
86543395c1 Add a flag for Ethernet@WireSpeed capability and correct chip revisions.
The idea was taken from OpenBSD and cross-referenced with Linux driver.
2008-01-18 22:09:50 +00:00
Jung-uk Kim
e4be3198af Fix mbuf pool watermark configuration (mismerged from OpenBSD in 1.132).
Submitted by:	sephe
MFC after:	3 days
2008-01-18 20:33:21 +00:00
Remko Lodder
effef9789a Add support for the BMC5722.
Reported by:		Chris Shenton <chris at shenton dot org> on current@
Approved by:		imp (mentor)
2007-12-25 19:51:18 +00:00
Jung-uk Kim
d949071d71 Do not report MAC, TX, and RX stats via sysctl(8) with BCM5705+.
The register layout is little different from memory-mapped stats
in the previous generation chips.  In fact, it is bad because
registers in this range are cleared after reading them.

Reviewed by:	scottl
MFC after:	3 days
2007-11-16 16:39:27 +00:00
Marius Strobl
55aaf894e8 Make the PCI code aware of PCI domains (aka PCI segments) so we can
support machines having multiple independently numbered PCI domains
and don't support reenumeration without ambiguity amongst the
devices as seen by the OS and represented by PCI location strings.
This includes introducing a function pci_find_dbsf(9) which works
like pci_find_bsf(9) but additionally takes a domain number argument
and limiting pci_find_bsf(9) to only search devices in domain 0 (the
only domain in single-domain systems). Bge(4) and ofw_pcibus(4) are
changed to use pci_find_dbsf(9) instead of pci_find_bsf(9) in order
to no longer report false positives when searching for siblings and
dupe devices in the same domain respectively.
Along with this change the sole host-PCI bridge driver converted to
actually make use of PCI domain support is uninorth(4), the others
continue to use domain 0 only for now and need to be converted as
appropriate later on.
Note that this means that the format of the location strings as used
by pciconf(8) has been changed and that consumers of <sys/pciio.h>
potentially need to be recompiled.

Suggested by:	jhb
Reviewed by:	grehan, jhb, marcel
Approved by:	re (kensmith), jhb (PCI maintainer hat)
2007-09-30 11:05:18 +00:00
David Malone
041b706b2f Despite several examples in the kernel, the third argument of
sysctl_handle_int is not sizeof the int type you want to export.
The type must always be an int or an unsigned int.

Remove the instances where a sizeof(variable) is passed to stop
people accidently cut and pasting these examples.

In a few places this was sysctl_handle_int was being used on 64 bit
types, which would truncate the value to be exported.  In these
cases use sysctl_handle_quad to export them and change the format
to Q so that sysctl(1) can still print them.
2007-06-04 18:25:08 +00:00
Yaroslav Tykhiy
cb2eacc7dd Add on/off controls for VLAN_MTU and VLAN_HWTAGGING to bge(4). 2007-06-01 02:02:39 +00:00
Jung-uk Kim
e629eb82ba Remove an empty line. 2007-05-22 20:24:07 +00:00
Jung-uk Kim
0f89fde22c Remove BCM5704S specific tunable (hw.bge.fake_autoneg) and
auto-detect the condition.
2007-05-22 19:35:34 +00:00
Jung-uk Kim
186f842beb Rearrange DMA read/write control register settings based on document snippet
provided by davidch via glebius.

PR:		kern/96806
2007-05-22 19:22:58 +00:00
Jung-uk Kim
410c2bebd2 Remove stale alpha support code. 2007-05-22 19:11:39 +00:00
Jung-uk Kim
d5d2385773 Fix time out check in EEPROM read and move delays to give some settle time.
Submitted by:	mjacob
2007-05-22 18:51:05 +00:00
Jung-uk Kim
ca0ba1d16f Add delays in MI communication register R/W loops. 2007-05-22 18:16:23 +00:00
Jung-uk Kim
fe09b799f1 Reflect MFC of pci_find_extcap().
MFC after:	3 days
2007-05-01 19:18:12 +00:00
Marius Strobl
08013fd336 - Add support/quirks for the on-board BGEs found in Sun Blade 1500
Blade 2500, Fire V210 and probably some other sparc64 machines.
  These chips are typically not fitted with an EEPROM which means
  that we have to obtain the MAC address via OFW and that some chip
  tests will just always fail.
  These changes are based on the respective code found in OpenBSD
  with some additional info obtained from OpenSolaris and some style
  suggestions by jkim@. They also have the desired side-effect of
  respecting the 'local-mac-address?' system configuration variable
  for the affected BGEs.
- In bge_attach() factor out calling bge_release_resources() before
  going to the fail label into the fail label as well as replace a
  magic 6 with ETHER_ADDR_LEN.

Reviewed by:	yongari (before style changes), jkim
2007-04-30 21:55:27 +00:00
Jung-uk Kim
0a55a034ba Enable MSI support on RELENG_6.
MFC after:	3 days
2007-04-02 19:09:06 +00:00
Scott Long
06e83c7e86 Fix some OID names and minor style as per feedback from various people.
Also, apparently quad support is broken in the sysctl infrastructure, so don't
pretend that it works.

Submitted by: ru, bde
2007-03-13 00:41:55 +00:00
Scott Long
763757b2a4 Add MAC, RX, and TX stats reporting via sysctl. 2007-03-12 09:25:57 +00:00
Jung-uk Kim
0c4a1ef8dc Add more chipset revision IDs.
Obtained from:	OpenBSD
2007-03-09 01:30:23 +00:00
Jung-uk Kim
39153c5a23 Use correct bits to stop firmware when ASF mode is enabled. 2007-03-08 00:49:26 +00:00
Jung-uk Kim
0c8aa4eacd Fix more style(9) bugs.
- Remove some excessive parentheses around shift operators.
- Use macro instead of magic number where it is applicable.
- Change lower-case hexdecimals to upper cases to match wpaul's style.
- Revert some unnecessary line wraps and changes from the previous commit.

Pointed out by:	bde
2007-03-08 00:29:18 +00:00
Jung-uk Kim
6098821ce7 Fix style(9) and consistency. 2007-03-06 20:14:48 +00:00
Jung-uk Kim
4e35d186f1 Pollute bge(4) with #if's and #ifdef's to make MFC easier.
MFC after:	3 days
2007-03-06 19:15:16 +00:00
Paolo Pisati
ef544f6312 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@
2007-02-23 12:19:07 +00:00
Jung-uk Kim
464223f762 Use bge_writereg_ind() to do global reset as we did before 1.159 for certain
chipsets.  It was causing 'firmware handshake timed out' errors for some
chips.

Discussed with:	scottl
2007-02-14 19:44:15 +00:00
Jung-uk Kim
8117907083 Fix two typos in comments. 2007-02-14 19:01:33 +00:00
Jung-uk Kim
1ec4c3a889 Add BCM5701 A0/B0 CRC bug workaround. Magic values taken from Linux driver. 2007-02-12 23:58:52 +00:00
Jung-uk Kim
797b2220ae Fix style(9).
Pointed out by:	many
2007-02-12 23:33:05 +00:00
Jung-uk Kim
08bf8bb7c1 Add PHY DSP code for BCM5755M.
Obtained from:	OpenBSD
2007-02-12 22:51:25 +00:00
Jung-uk Kim
5ee49a3a58 - Fix BCM5754 support found in Dell PowerEdge SC440.
- Move some PHY bug detections from brgphy.c to if_bge.c.
- Do not penalize working PHYs.
- Re-arrange bge_flags roughly by their categories.
- Fix minor style(9) nits.

PR:		kern/107257
Obtained from:	OpenBSD
Tested by:	Mike Hibler <mike at flux dot utah dot edu>
2007-01-15 21:43:43 +00:00
John Polstra
0fb18ca82e Correct the comment describing the BGE_PCISTATE_PCI_BUSSPEED bit.
It had the sense of the bit reversed.
2007-01-11 01:43:24 +00:00
Bruce Evans
b64728e55e After rev.1.169, the "interrupt" coalescing parameters are not used in
bge_intr().  Some of them are used in bge_poll().  Simplify by only
initializing these for polling mode and not toggling them when switching
modes.  This also fixes missing synchronization with the coalescing
engine in the toggling.
2006-12-26 18:33:55 +00:00
John Polstra
bf6ef57a40 Re-enable MSI support for those chips on which it is believed to work
properly.
2006-12-22 02:59:58 +00:00
John Polstra
65b8185c34 Correct the BGE_CHIPID_BCM5750_B0 constant.
MFC after:	1 week
2006-12-22 01:10:36 +00:00
Bruce Evans
5b01e77c64 In bge_txeof(), cancel the watchdog timeout if all descriptors have
been handled instead of when at least one descriptor was just handled.
For bge, it is normal to get a txeof when only a small fraction of the
queued tx descriptors have been handled, so the bug broke the watchdog
in a usual case.
2006-12-20 12:03:21 +00:00
Bruce Evans
b848e03260 Avoid a race and a pessimization in bge_intr():
- moved the synchronizing bus read to after the bus write for the first
  interrupt ack so that it actually synchronizes everything necessary.

  We were acking not only the status update that triggered the interrupt
  together with any status updates that occurred before we got around
  to the bus write for the ack, but also any status updates that occur
  after we do the bus write but before the write reaches the device.
  The corresponding race for the second interrupt ack resulted in
  sometimes returning from the interrupt handler with acked but
  unserviced interrupt events.  Such events then remain unserviced
  until further events cause another interrupt or the watchdog times
  out.

  The race was often lost on my 5705, apparently since my 5705 has broken
  event coalescing which causes a status update for almost every packet,
  so another status update is quite likely to occur while the interrupt
  handler is running.  Watchdog timeouts weren't very noticeable,
  apparently because bge_txeof() has one of the usual bugs resetting the
  watchdog.

- don't disable device interrupts while bge_intr() is running.  Doing this
  just had the side effects of:
  - entering a device mode in which different coalescing parameters apply.
    Different coalescing parameters can be used to either inhibit or
    enhance the chance of getting another status update while in the
    interrupt handler.  This feature is useless with the current
    organization of the interrupt handler but might be useful with a
    taskqueue handler.
  - giving a race for ack+reenable/return.  This cannot be handled
    by simply rearranging the order of bus accesses like the race for
    ack+keepenable/entry.  It is necessary to sync the ack and then
    check for new events.
  - taking longer, especially with the extra code to avoid the race on
    ack+reenable/return.

Reviewed by:	ru, gleb, scottl
2006-12-20 11:14:45 +00:00
Jung-uk Kim
45ee6ab350 Partially back out rev. 1.148 and use new ETHER_BPF_MTAP() macro for VLAN.
Remaining changes are cosmetic.
2006-12-20 01:12:07 +00:00
Oleg Bulyzhin
5dda808582 - Add missing callout_drain() call.
- Synchronize bge_tick() with callout_reset/callout_stop() calls.
- Avoid using bge_tick() inside bge_link_upd(), use mii_pollstat() instead.

MFC after:	2 month
2006-12-19 08:57:46 +00:00
Jung-uk Kim
7c929cf95b - Remove stale VPD support and its comment and get device name from VPD API.
- Do not repeatedly read vendor/device IDs while probing.
- Remove redundant bzero(3) for softc.  device_get_softc(9) does it for free[1].

Reviewed by:	glebius
Suggested by:	glebius[1]
2006-12-18 16:40:04 +00:00
John Polstra
20aa3e4827 Disable bge MSI support for now. A couple of people warned me that there
are problems with it on several revisions of this chip.  I'll
re-enable it after I've sorted out which chip revisions work and which
don't.
2006-12-15 00:27:06 +00:00
John Polstra
724bd93939 Add MSI support to the bge driver. I tested this on a Dell SC1435
running an i386 kernel, and it worked fine.
2006-12-14 23:10:12 +00:00
Scott Long
9ba784dbaf Fix recent style problems and expand a comment.
Submitted by: Bruce Evans
2006-12-13 21:13:09 +00:00
Scott Long
5345bad07f Use the BGE_IS_* macros consistently. Also add a couple of missing
cases to the debug_info function.
2006-12-13 21:03:55 +00:00
Scott Long
088766f15c Remove a redundant write of the firmware reset magic number. It looks to
have been added erroneously, and it causes problems on some chips.  A larger
change is needed to do this write at a more appropriate place, but that
change requires reworking the ASF logic.  That will be worked on in the
future.

Submitted by: Bruce Evans
2006-12-13 20:51:51 +00:00
Jung-uk Kim
8634dfff05 Use one counter instead of four to make up TX collision stats as BCM5705+.
It reduces chance of errors from multiple counter wraps at the same time.
2006-12-13 17:28:51 +00:00
Scott Long
6f8718a3bf Fix support for certain 575x/578x chips. This consists of the following:
- Use the appropriate register writing method when reseting the chip
- Program the descriptor DMA engine correctly.
- More reliably detect certain chips and their features.

Also add some low-level debugging tools to help future work on this driver.

Submitted by: David Christenson (proof of concept changes)
Sponsored by: www.UIA.net
2006-12-12 05:11:12 +00:00
Jung-uk Kim
6b037352d0 - Correct collision counter for BCM5705+. This register is read/clear.
- Correct RX packet drop counter for BCM5705+.  This register is read/clear
and it wraps very quickly under heavy packet drops because only the lower
ten bits are valid according to the documentation.  However, it seems few
more bits are actually valid and the rest bits are always zeros[1].
Therefore, we don't mask them off here.  To get accurate packet drop count,
we need to check the register from bge_rxeof().  It is commented out for now,
not to penalize normal operation.  Actual performance impact should be
measured later.
- Correct integer casting from u_long to uint32_t.  Casting is not really
needed for all supported platforms but we better do this correctly[2].

Tested by:	bde[1]
Suggested by:	bde[2]
2006-12-11 18:00:34 +00:00
Jung-uk Kim
7ee00338c5 - Add BGE_FLAG_JUMBO flag which idicates jumbo frame capability. Some day we
may be able to support jumbo frames for BCM5714 and BCM5780.
- Rename BGE_IS_5705_OR_BEYOND() to BGE_IS_5705_PLUS() for consistency.
2006-12-04 22:12:21 +00:00
Jung-uk Kim
0dae9719c3 Use bge_flags to save chipset family and remove dead code while I am here. 2006-12-04 19:50:49 +00:00
Gleb Smirnoff
426742bf4d Fix my error in rev. 1.152
Submitted by:	oleg
2006-12-04 14:35:17 +00:00