Commit Graph

21163 Commits

Author SHA1 Message Date
Matthew D Fleming
45b40ad0da Always set cm_complete_data before calling mps_config_complete().
Reviewed by:	ken
2010-10-12 19:24:29 +00:00
Pyun YongHyeon
5e2f96bf69 Fix a regression introduced in r213495. r213495 disabled mini
receive producer ring only for BCM5700. It was believed that
BCM5700 with external SSRAM is the only controller that supports
mini ring but it seems all BCM570[0-4] requires to disable mini
receive producer ring. Otherwise, it caused unexpected RX DMA
error or watchdog timeouts.

Reported by:	marius, Steve Kargl <sgk <> troutmask dot apl dot washington dot edu>
Tested by:	marius, Steve Kargl <sgk <> troutmask dot apl dot washington dot edu>
2010-10-12 19:22:03 +00:00
Andriy Gapon
5ff14fa9b4 acpi_ec: changes in communication with hardware
Short description of the changes:
- attempt to retry some commands for which it is possible (read, query)
- always make a short sleep before checking EC status in polled mode
- periodically poll EC status in interrupt mode
- change logic for detecting broken interrupt delivery and falling back
  to polled mode
- check that EC is ready for input before starting a new command, wait
  if necessary

This commit is based on the original patch by David Naylor.

PR:		kern/150517
Submitted by:	David Naylor <naylor.b.david@gmail.com>
Reviewed by:	jkim
MFC after:	3 weeks
2010-10-12 17:53:01 +00:00
Bernhard Schmidt
40668dc52b Fix monitor mode which is implemented by doing a firmware scan. This
is a port of stable/6, seems like the code got lost during the
background scan changes in r170530.

Pointed out by:	danfe
MFC after:	2 weeks
2010-10-12 16:52:13 +00:00
Joel Dahl
4e33fc946d Small grammar nit in a printf message. 2010-10-12 11:05:32 +00:00
Gleb Smirnoff
19f5434963 We already have dummy receive buffer in sc->buffer.
Suggested by:	hselasky
2010-10-12 09:41:42 +00:00
Pyun YongHyeon
66151edf96 The IFF_DRV_RUNNING flag is set at the end of bge_init_locked. But
before setting the flag, interrupt was already enabled such that
interrupt handler could be run before setting IFF_DRV_RUNNING flag.
This can lose initial link state change interrupt which in turn
make bge(4) think that it still does not have valid link. Fix this
race by protecting the taskqueue with a driver lock.
While I'm here move reenabling interrupt code after handling of link
state chage.

Reviewed by:	davidch
2010-10-11 23:07:12 +00:00
Pyun YongHyeon
6ede2cfa12 Remove one last reference of BGE_MI_MODE register for auto polling.
Previously bge(4) always enabled auto polling for non-BGE_FLAG_TBI
controllers. With this change, auto polling is not used anymore so
polling through mii(4) was introduced.

Reviewed by:	davidch
2010-10-11 22:56:23 +00:00
Matthew D Fleming
d95f15e7aa Re-work the internal user ioctl command table, and support the FW_UPLOAD
command.

Reviewed by:	ken (previous version)
2010-10-11 22:44:15 +00:00
Matthew D Fleming
452909d7d9 Add function prototypes for static functions.
Requested by:	ken
2010-10-11 22:44:05 +00:00
Matthew D Fleming
01095e3bf1 Fix a memory leak and locking inconsistency in mps(4) ioctl handling.
Check copyin(9) for error and sanity check the length before copyin.

Reviewed by:	ken
2010-10-11 21:38:31 +00:00
Matthew D Fleming
5ef9804274 Fix up the COMPAT_FREEBSD32 ioctl logic for mps(4).
Reviewed by:	ken
2010-10-11 21:26:24 +00:00
Pyun YongHyeon
f95779d97e Do not setup interrupt endpoint for axe(4).
It seems axe(4) controllers support interrupt endpoint such that
enabling interrupt endpoint generates about 1000 interrupts/sec.
Controllers transfer 8 bytes data through interrupt endpoint and
the data include link UP/DOWN state as well as some PHY related
information. Previously axe(4) didn't use the transferred data and
didn't even try to read the data. Because axe(4) counts on mii(4)
to detect link state changes there is no need to use interrupt
endpoint here.

This change fixes generation of unnecessary interrupts which was
seen when interface is brought to UP.

No objections from:	hselasky
2010-10-11 19:20:53 +00:00
Pyun YongHyeon
3a429c8f0e Do not blindly UP the interface when interface's MTU is changed. If
driver is not running there is no need to up the interface. While
I'm here hold driver lock before modifying MTU as it is referenced
in RX handler.
2010-10-08 17:58:07 +00:00
Ed Maste
2c7dee3bf5 In r207768 I silenced a console warning from rum(4). There was legitimate
opposition to the change, since really we need to implement missing
functionality in drivers or the 802.3 layer.

For now, restore a reminder message for a missing rum_update_mcast, but
print it only once.
2010-10-08 01:03:30 +00:00
Kenneth D. Merry
1476ba4087 Turn on serialization of task management commands going down to the
controller, but make it optional.

After a problem report from Andrew Boyer, it looks like the LSI
chip may have issues (the watchdog timer fired) if too many aborts
are sent down to the chip at the same time.  We know that task
management commands are serialized, and although the manual doesn't
say it, it may be a good idea to just send one at a time.

But, since I'm not certain that this is necessary, add a tunable
and sysctl variable (hw.mps.%d.allow_multiple_tm_cmds) to control
the driver's behavior.

mps.c:		Add support for the sysctl and tunable, and add a
		comment about the possible return values to
		mps_map_command().

mps_sas.c:	Run all task management commands through two new
		routines, mpssas_issue_tm_request() and
		mpssas_complete_tm_request().

		This allows us to optionally serialize task
		management commands.  Also, change things so that
		the response to a task management command always
		comes back through the callback.  (Before it could
		come via the callback or the return value.)

mpsvar.h:	Add softc variables for the list of active task
		management commands, the number of active commands,
		and whether we should allow multiple active task
		management commands.  Add an active command flag.

mps.4:		Describe the new sysctl/loader tunable variable.

Sponsored by:	Spectra Logic Corporation
2010-10-07 21:56:10 +00:00
Pyun YongHyeon
84ac96f8ab Fix a long standing bug which regarded some revisions of controller
as 5788. This caused BGE_MISC_LOCAL_CTL register is used to
generate link state change interrupt for non-5788 controllers. The
interrupt handler may or may not detect link state attention as
status block wouldn't be updated when an interrupt was generated
with BGE_MISC_LOCAL_CTL register. All controllers except 5700 and
5788 should use host coalescing mode register to trigger an
interrupt.
2010-10-07 17:14:50 +00:00
Alexander Motin
7be95fbbf9 Add ID for Vodafone (ZTE) Mobile Broadband K3565-Z modem.
Reviewed by:	hselasky
2010-10-07 09:07:48 +00:00
Pyun YongHyeon
8a315a6de4 Add more comments to rings supported by the controller. Different
versions of controller support different number of ring control
blocks such that adjust code a bit to access known number of
send/receive ring control blocks. Previously bge(4) blindly
accessed 16 send/receive RCBs. Also move initializing standard
receive producer ring producer index, jumbo receive producer ring
producer index and mini receive producer ring producer index to
the end of each receive producer ring initialization.

Do not assume mini receive producer ring is available only when
controller has jumbo frame capability, instead explicitly check
ASIC version BCM5700 to disable mini receive producer ring.

Additionally always enable send ring 0 regardless of controller
versions. Previously bge(4) didn't enable send ring 0 if controller
is BGE_IS_5705_PLUS. Becase bge(4) need 1 send ring to send frames
at least, I have no idea how it would have worked so far.

Submitted by:	davidch
2010-10-06 21:23:57 +00:00
Doug Ambrisko
584d21f69e Add the capability to read the complete contents of the NVRAM via sysctl
dev.bce.<unit>.nvram_dump
Add the capability to write the complete contents of the NVRAM via sysctl
	dev.bce.<unit>.nvram_write
These are only available if the kernel option BCE_DEBUG is enabled.
The nvram_write sysctl also requires the kernel option
BCE_NVRAM_WRITE_SUPPORT to be enabled.  These are to be used at your
own caution.  Since the MAC addresses are stored in the NVRAM, if you
dump one NIC and restore it on another NIC the destination NIC's
MAC addresses will not be preserved.  A tool can be made using these
sysctl's to manage the on-chip firmware.

Reviewed by:	davidch, yongari
2010-10-06 18:36:50 +00:00
Pyun YongHyeon
88a7c5d464 Remove bge_tx_buf_ratio, unused member of softc. 2010-10-06 17:47:13 +00:00
Pyun YongHyeon
a813ed787f Overhaul MII register access routine and remove unnecessary
BGE_MI_MODE register accesses. Previously bge(4) used to read
BGE_MI_MODE register to detect whether it needs to disable
autopolling feature or not. Because we don't touch autopolling in
other part of driver there is no reason to read BGE_MI_MODE
register given that we know default value in advance. In order to
achieve the goal, check whether the controller has CPMU(Central
Power Mangement Unit) capability. If controller has CPMU feature,
use 500KHz MII management interface(mdio/mdc) frequency regardless
core clock frequency. Otherwise use default MII clock. While I'm
here, add CPMU register definition.

In bge_miibus_readreg(), rearrange code a bit and remove goto
statement. In bge_miibus_writereg(), make sure to restore
autopolling even if MII write failed. The delay time inserted after
accessing BGE_MI_MODE register increased from 40us to 80us.

The default PHY address is now stored in softc. All PHYs supported
by bge(4) currently uses PHY address 1 but it will be changed when
we add newer controllers. This change will make it easier to change
default PHY address depending on PHY models.

Submitted by:	davidch
2010-10-06 17:35:27 +00:00
Gleb Smirnoff
a4cd76e4a2 Remove extra assignment. 2010-10-06 14:29:50 +00:00
Gleb Smirnoff
fb7a4d496b Add support to Alcatel/TCTMobile X080S USB 3G modem. The device needs
special eject command to reappear as modem. It also requires DIR_IN flag
in the command message, so we supply some dummy data along with the command.

Feedback from X080S owners appreciated. I have not a pure Alcatel/TCTMobile
device, but another one under "Svyaznoy" (Связной) brand, and I didn't yet
managed to get it working. It is successfully recognized, it responds to
AT commands, but it shuts up right after successfull CONNECT response.

Reviewed by:	hps
2010-10-06 14:29:00 +00:00
Pyun YongHyeon
7d3d9608d1 Fix bge(4) build breakage when BGE_REGISTER_DEBUG is defined. 2010-10-06 01:23:40 +00:00
Pyun YongHyeon
eea8956a5b Rearrange code a bit to correctly set PHY flags. This change make
it easy to add more newer ASICs.

Obtained from:	OpenBSD
2010-10-05 23:24:58 +00:00
Pyun YongHyeon
757402fba0 Separate common flags into controller specific and PHY related
flags. There should be no functional changes. This change will make
it easy to add more quirk/flags in future.

Reviewed by:	davidch
2010-10-05 23:03:48 +00:00
Hans Petter Selasky
c791ca5046 Print out correct USB connection speed for USB 3.0 mass storage devices.
Approved by:    thompsa (mentor)
2010-10-04 23:30:44 +00:00
Pyun YongHyeon
ad05f0993c RX buffer allocation failure is not an input error. Controller
successfully received a frame but we failed to pass it to upper
stack due to lack of resources. So update if_iqdrops counter
instead of updating if_ierrors counter.
2010-10-04 23:25:38 +00:00
Pyun YongHyeon
402215616a Don't count input error twice. uether_rxbuf() already updated that
counter.
2010-10-04 23:19:31 +00:00
Hans Petter Selasky
963169b4af This commit adds full support for USB 3.0 devices in host and device
mode in the USB core.  The patch mostly consists of updating the USB
HUB code to support USB 3.0 HUBs. This patch also add some more USB
controller methods to support more active-alike USB controllers like
the XHCI which needs to be informed about various device state events.

USB 3.0 HUBs are not tested yet, due to lack of hardware, but are
believed to work.

After this update the initial device descriptor is only read twice
when we know that the bMaxPacketSize is too small for a single packet
transfer of this descriptor.

Approved by:    thompsa (mentor)
2010-10-04 23:18:05 +00:00
Hans Petter Selasky
2ecb4e919f Add missing #if's
Approved by:    thompsa (mentor)
2010-10-04 22:50:08 +00:00
Hans Petter Selasky
b64cf89faf Add more strict USB string filtering.
Approved by:    thompsa (mentor)
2010-10-04 22:45:17 +00:00
Hans Petter Selasky
8f9750b7fd Serialise USB re-enumeration with the USB explore thread.
This patch can solve problems when multiple USB devices are
re-enumerated at the same time on the same bus.

Approved by:    thompsa (mentor)
2010-10-04 22:21:30 +00:00
Hans Petter Selasky
ce4092bda4 Correct IOCTL return code.
Approved by:    thompsa (mentor)
2010-10-04 22:04:22 +00:00
Hans Petter Selasky
7b039740b7 Add missing USB 3.0 definitions. Correct some wrong ones.
Approved by:    thompsa (mentor)
2010-10-04 21:38:10 +00:00
Hans Petter Selasky
864bc41261 Add missing DRIVER_MODULE() entry for the musbotg driver.
Add some more comments.

Approved by:    thompsa (mentor)
2010-10-04 21:30:15 +00:00
Hans Petter Selasky
3df007ce6b The root mount hold reference was not released on USB controller
attach failures during boot. Fix this.

Approved by:    thompsa (mentor)
2010-10-04 21:24:10 +00:00
Pyun YongHyeon
465a52e06d Make upper stack know driver's output status. This change increased
TX performance from 221kpps to 231kpps.
2010-10-04 21:01:27 +00:00
Pyun YongHyeon
b8e98004a9 Move updating TX packet counter to the inside of send loop. axe(4)
controllers combine multiple TX requests into single one if there
is room in TX buffer of controller. Updating TX packet counter at
the end of TX completion resulted in incorrect TX packet counter as
axe(4) thought it sent 1 packet. There is no easy way to know how
many combined TX were completed in the callback.
Because this change updates TX packet counter before actual
transmission, it may not be ideal one. But I believe it's better
than showing fake 8kpps under high TX load. With this change, TX
shows 221kpps on Linksus USB200M.
2010-10-04 20:49:38 +00:00
Pyun YongHyeon
d255f2a9df Enable fix for read DMA FIFO overruns on controllers that have this
fix. Note, we still need workaround for controllers that lacks this
fix and it needs more work in RX BD updating.

Submitted by:	davidch
2010-10-04 18:09:01 +00:00
Pyun YongHyeon
1cd4773b5d Consistently use ifHCOutOctets/ifHCInOctets instead of Octets as
these names are used in data sheet. Also use UnicastPkts,
MulticastPkts and BroadcastPkts instead of UcastPkts, McastPkts
and BcastPkts to clarify its meaning.

Suggested by:	bde
2010-10-04 18:01:23 +00:00
George V. Neville-Neil
51c070572e Fix two aliases that had the same name but were pointing to different
events.  These are now disamiguated.

MFC after:	1 week
2010-10-04 17:22:18 +00:00
Marius Strobl
5e34065c6c Remove an header that apart from the license is empty. 2010-10-03 17:05:25 +00:00
Marius Strobl
d7a9ad5688 Consistently always explicitly set IFM_HDX for half-duplex.
Obtained from:	OpenBSD (mostly)
2010-10-03 17:00:57 +00:00
Hans Petter Selasky
1354026034 Commit initial version of new XHCI driver which was written from
scratch. This driver adds support for USB3.0 devices. The XHCI
interface is also backwards compatible to USB2.0 and USB1.0 and will
evntually replace the OHCI/UHCI and EHCI drivers.

There will be follow-up commits during the coming week to link the
driver into the default kernel build and add missing USB3.0
functionality in the USB core. Currently only the driver files are
committed.

Approved by:	thompsa (mentor)
2010-10-03 08:12:17 +00:00
Marius Strobl
de1add1e45 - In the spirit of previous simplifications factor out the checks for a
different PHY instance being selected and isolation out into the wrappers
  around the service methods rather than duplicating them over and over
  again (besides, a PHY driver shouldn't need to care about which instance
  it actually is).
- Centralize the check for the need to isolate a non-zero PHY instance not
  supporting isolation in mii_mediachg() and just ignore it rather than
  panicing, which should sufficient given that a) things are likely to
  just work anyway if one doesn't plug in more than one port at a time and
  b) refusing to attach in this case just leaves us in a unknown but most
  likely also not exactly correct configuration (besides several drivers
  setting MIIF_NOISOLATE didn't care about these anyway, probably due to
  setting this flag for no real reason).
- Minor fixes like removing unnecessary setting of sc->mii_anegticks,
  using sc->mii_anegticks instead of hardcoded values etc.
2010-10-02 18:53:12 +00:00
Marius Strobl
915d4d4a17 Try to adhere to style(9) and be consistent within this file. 2010-10-02 17:20:30 +00:00
Konstantin Belousov
d000b49d26 Cosmetic: make it less confusing when displaying RAID 1 level, that might
be 1+0 as well.

PR:	kern/150936
MFC after:	2 weeks
2010-10-02 08:18:19 +00:00
Pyun YongHyeon
1888f3246c Remove extra semicolon. 2010-10-01 17:51:55 +00:00