Commit Graph

21946 Commits

Author SHA1 Message Date
Adrian Chadd
0dbe9289ce Break out the diagnostic codes from ah_internal.h and place them in ah_diagcodes.h.
Since we now have the source code, there's no reason to hide the diag codes
from other areas.

They live in the HAL as they form part of the HAL API and should still be treate
as "potentially flexible; don't publish as a public API." But since they're
already used as a public API (see follow-up commit), we may as well use
them in place of magic constants.
2011-01-20 04:57:26 +00:00
Matthew D Fleming
cbc134ad03 Introduce signed and unsigned version of CTLTYPE_QUAD, renaming
existing uses.  Rename sysctl_handle_quad() to sysctl_handle_64().
2011-01-19 23:00:25 +00:00
Jack F Vogel
182b3808b5 Update driver to version 2.3.8:
CRITICAL FIX - with stats changes the older 82598 will panic
	and trash the stack on driver load, FCOE registers ONLY exist
	in 82599 and must not be read otherwise.

	kern/153951 - to correct incorrect media type on adapters
	with pluggable modules I have eliminated the old static
	table in favor of a new dynamic shared code routine. This
	also has the benefit of detecting changes when a different
	module is inserted.

	Performance/enhancement to the Flow Director code from my
	linux coworker (the developer of the code).

	Fixes from Michael Tuexen - a data corruption problem on the
	82599 (CRITICAL), fix so the buf size correctly adjusts as
	the cluster changes, and max descriptors are set properly.
	Also added 16K clusters for those REALLY big jumbos :)

	In the RX path, the RX LOCK was not being released, and this
	causes LOR problems. Add the code that igb already has.

	Sync with in house shared code, this was necessary for the
	Flow Director fix.

MFC in 2 days
2011-01-19 19:36:27 +00:00
Jack F Vogel
fbfbce8ae9 Fix for kern/152853, pullup at the wrong point
is breaking UDP. Thanks to Petr Lampa for the
patch.
2011-01-19 18:20:11 +00:00
Matthew D Fleming
f8e4b4ef49 sysctl(8) should use the CTLTYPE to determine the type of data when
reading.  (This was already done for writing to a sysctl).  This
requires all SYSCTL setups to specify a type.  Most of them are now
checked at compile-time.

Remove SYSCTL_*X* sysctl additions as the print being in hex should be
controlled by the -x flag to sysctl(8).

Succested by:	bde
2011-01-19 17:04:07 +00:00
Konstantin Belousov
007777f137 Add missed ().
Noted by:	alc
MFC after:	3 days
2011-01-19 16:48:07 +00:00
Alan Cox
18a22f96e0 There is no point in calling vm_object_set_writeable_dirty() on an object
that is definitively known to be swap backed since its only effects are on
vnode-backed objects.

Reviewed by:	kib
2011-01-19 15:43:54 +00:00
Matthew D Fleming
f4f04709ac Fix a few more SYSCTL_PROC() that were missing a CTLFLAG type specifier. 2011-01-19 00:57:58 +00:00
Andreas Tobler
14be64618e There are PowerMacs which do not have a hwsensor-location property
for this sensor. Instead of leaving this location empty we use here
the default name 'sensor'.

Submitted by: Justin Hibbits <chmeeedalf at gmail dot com>
Approved by: nwhitehorn (mentor)
2011-01-18 21:47:30 +00:00
Hans Petter Selasky
8be0933446 Make USB packet filtering code optional.
Approved by:	thompsa (mentor)
2011-01-18 21:18:51 +00:00
Matthew D Fleming
5bc0787f29 Specify a CTLTYPE_FOO so that a future sysctl(8) change does not need
to rely on the format string.
2011-01-18 21:14:23 +00:00
Pyun YongHyeon
ed15702f7e Rework RX filter programming by providing separate handler for
DP8381[56] and SiS 900/7016 controllers.  After r212119, sis(4) no
longer reinitializes controller if ALLMULTI/PROMISC was changed.
However, RX filter handling code assumed some bits of the RX filter
is programmed by driver initialization. This caused ALLMULTI/PROMISC
configuration is ignored under certain conditions.
Fix that issue by reprogramming all bits of RX filter register.
While I'm here follow recommended RX filter programming steps
recommended by National DP8381[56] data sheet(RX filter should be
is disabled before programming).

Reported by:	Paul Schenkeveld < freebsd () psconsult dot nl >
Tested by:	Paul Schenkeveld < freebsd () psconsult dot nl >
MFC after:	3 days
2011-01-18 17:50:14 +00:00
John Baldwin
287e0d97bf Fix some bugs in my last set of changes to ale(4):
- Remove extra unlock from end of ale_start_locked().
- Expand scope of locking in interrupt handler.
- Move ether_ifdetach() earlier and retire now-unneeded DETACH flag.

Tested by:	Aryeh Friedman
Reviewed by:	yongari (earlier version)
2011-01-18 16:27:40 +00:00
John Baldwin
f0c734d5e3 Remove some always-true comparisons.
Submitted by:	clang via rdivacky
2011-01-18 15:23:16 +00:00
John Baldwin
4a26285ea1 Remove bogus check. pcib_get_bus() (like other BUS_ACCESSOR() methods)
doesn't "fail", it may merely return garbage if it is not a valid ivar
for a given device.  Our parent device must be a 'pcib' device, so we
can just assume it implements pcib IVARs, and all pcib devices have a
bus number.

Submitted by:	clang via rdivacky
2011-01-18 14:58:44 +00:00
Pyun YongHyeon
ef278cb4ae Change model names of controller RTL_HWREV_8168_SPIN[123] to real ones.
s/RL_HWREV_8168_SPIN1/RL_HWREV_8168B_SPIN1/g
s/RL_HWREV_8168_SPIN2/RL_HWREV_8168B_SPIN2/g
s/RL_HWREV_8168_SPIN3/RL_HWREV_8168B_SPIN3/g
No functional changes.
2011-01-18 00:46:10 +00:00
Marcel Moolenaar
3470949a74 Check the environment for system devices before using the FDT.
This allows overriding the FDT, and allows specifying a debug
port.
2011-01-17 23:34:36 +00:00
Jung-uk Kim
2fea643112 Add reader/writer lock around mem_range_attr_get() and mem_range_attr_set().
Compile sys/dev/mem/memutil.c for all supported platforms and remove now
unnecessary dev_mem_md_init().  Consistently define mem_range_softc from
mem.c for all platforms.  Add missing #include guards for machine/memdev.h
and sys/memrange.h.  Clean up some nearby style(9) nits.

MFC after:	1 month
2011-01-17 22:58:28 +00:00
Bernhard Schmidt
bd56e71b4b Pull ieee80211_ratectl_node_init() calls from drivers into net80211.
This fixes hostap mode for at least ral(4) and run(4), because there is
no sufficient call into drivers which could be used initialize the node
related ratectl variables.

MFC after:	3 days
2011-01-17 20:15:15 +00:00
Alexander Motin
8b09b5b170 Fix 32bit bit fields handling. This fixes card serial number fetching.
It was just a cosmetic issue, because that number is only reported in logs.

Reported by:	Michael Butler on current@
2011-01-17 19:31:34 +00:00
Pyun YongHyeon
81eee0ebf8 Implement initial jumbo frame support for RTL8168/8111 C/D/E PCIe
GbE controllers. It seems these controllers no longer support
multi-fragmented RX buffers such that driver have to allocate
physically contiguous buffers.

 o Retire RL_FLAG_NOJUMBO flag and introduce RL_FLAG_JUMBOV2 to
   mark controllers that use new jumbo frame scheme.
 o Configure PCIe max read request size to 4096 for standard frames
   and reduce it to 512 for jumbo frames.
 o TSO/checksum offloading is not supported for jumbo frames on
   these controllers. Reflect it to ioctl handler and driver
   initialization.
 o Remove unused rl_stats_no_timeout in softc.
 o Embed a pointer to structure rl_hwrev into softc to keep track
   of controller MTU limitation and remove rl_hwrev in softc since
   that information is available through a pointer to structure
   rl_hwrev.

Special thanks to Realtek for donating sample hardwares which made
this possible.

H/W donated by:	Realtek Semiconductor Corp.
2011-01-17 03:24:33 +00:00
Pyun YongHyeon
f0431c5bb0 Add initial support for RTL8168E/8111E-VL PCIe GbE.
H/W donated by:	Realtek Semiconductor Corp.
2011-01-17 02:23:50 +00:00
Andreas Tobler
b919d343a9 Remove unused variable. Spotted by a cppcheck
(devel/cppcheck, http://sourceforge.net/projects/cppcheck) run.

Approved by: nwhitehorn (mentor)
2011-01-15 19:16:56 +00:00
Marius Strobl
c6397d3f0e - Even after masking the media with IFM_GMASK the result may have bits
besides the duplex ones set so just comparing it with IFM_FDX may lead
  to false negatives.
- Just let the default case handle all unsupported media types.
- In pnphy_status() don't unnecessarily read a register twice.
- Remove unnused macros.

MFC after:	1 week
2011-01-14 20:26:59 +00:00
Marius Strobl
39bb2e5288 - Allow IFM_FLAG0 to be set indicating that auto-negotiation with manual
configuration, which is used to work around issues with certain setups
  (see r161237) by default, should not be triggered as it may in turn
  cause harm in some edge cases.
- Even after masking the media with IFM_GMASK the result may have bits
  besides the duplex ones set so just comparing it with IFM_FDX may lead
  to false negatives.
- Announce PAUSE support also for manually selected 1000BASE-T, but for
  all manually selected media types only in full-duplex mode. Announce
  asymmetric PAUSE support only for manually selected 1000BASE-T.
- Simplify setting the manual configuration bits to only once after we
  have figured them all out. This also means we no longer unnecessarily
  update the hardware along the road.
- Remove a stale comment.

Reviewed by:	yongari (plus additional testing)
MFC after:	3 days
2011-01-14 19:39:12 +00:00
Marius Strobl
5c39059aaf - Don't announce PAUSE support for half-duplex when MIIF_FORCEPAUSE is
set.
- Let mii_phy_auto() also announce PAUSE support for 10baseT-FDX.

MFC after:	1 week
2011-01-14 19:33:58 +00:00
Marius Strobl
87a303dc63 - Even after masking the media with IFM_GMASK the result may have bits
besides the duplex ones set so just comparing it with IFM_FDX may lead
  to false negatives.
- Simplify ciphy_service() to only set the manual configuration bits
  once after we have figured them all out. This also means we no longer
  unnecessarily update the hardware along the road.

MFC after:	1 week
2011-01-14 19:29:53 +00:00
Marius Strobl
34259ba39b - Masking IFM_GMASK when also masking IFM_FDX is redundant and just
complicates the code.
- Don't let atphy_setmedia() announce PAUSE support for half-duplex when
  MIIF_FORCEPAUSE is set.
- Simplify e1000phy_service() and ip1000phy_service() to only set the
  manual configuration bits once after we have figured them all out. For
  ip1000phy_service() this also means we no longer unnecessarily update
  the hardware along the road.

MFC after:	1 week
2011-01-14 19:16:59 +00:00
Pyun YongHyeon
4a814a5edb If driver is not able to allocate RX buffer, do not start driver.
While I'm here move RX buffer allocation and descriptor
initialization up to not touch hardware registers in case of RX
buffer allocation failure.
2011-01-13 23:15:09 +00:00
Pyun YongHyeon
9e18005d99 Make sure to check validity of dma maps before destroying. 2011-01-13 23:00:28 +00:00
Pyun YongHyeon
9325262669 re_reset() should be called only after setting device specific
features.
2011-01-13 22:52:57 +00:00
Pyun YongHyeon
d3b181ae81 Allow TX/RX checksum offloading to be configured independently. 2011-01-13 22:49:10 +00:00
John Baldwin
3b33d63074 - Move ether_ifdetach() earlier and remove now-unneeded IN_DETACH flag.
- Expand locking in interrupt handler.

Reviewed by:	yongari
2011-01-13 21:49:14 +00:00
Hans Petter Selasky
c1338c65d6 - Add support for 64-byte contexts to XHCI driver.
- Remove some dead code.
- Fixed one instance of missing endian conversion.

Approved by:	thompsa (mentor)
2011-01-13 20:03:55 +00:00
Matthew D Fleming
240577c2a7 Fix up a few more sysctl(9) mis-typing found in various LINT builds. 2011-01-13 18:20:27 +00:00
John Baldwin
932b56d242 - Add a locked variant of jme_start() and invoke it directly while holding
the lock instead of queueing it to a task.
- Do not invoke jme_rxintr() to reclaim any unprocessed but received
  packets when shutting down the interface.  Instead, just drop these
  packets to match the behavior of other drivers.
- Hold the driver lock in the interrupt handler to avoid races with
  ioctl requests to down the interface.

Reviewed by:	yongari
2011-01-13 14:42:43 +00:00
John Baldwin
6a9736a878 Use software interrupt priorities for USB kthreads instead of hardware
interrupt priorities.

Reviewed by:	hps
MFC after:	2 weeks
2011-01-13 14:15:36 +00:00
John Baldwin
86a11f3a96 Forgot to remove unlock of the driver lock from age_start_locked() when
converting it to a locked variant.

PR:		kern/153948
2011-01-13 13:04:49 +00:00
Pyun YongHyeon
159ea02c0d Make sure to invoke unlocked foo_start since the taskqueue does not
hold a driver lock. This should fix a regression introduced in
r216925.

PR:	kern/153769
2011-01-12 22:24:07 +00:00
Matthew D Fleming
6dc7dc9a3e sysctl(9) cleanup checkpoint: amd64 GENERIC builds cleanly.
Commit the rest of the devices.
2011-01-12 19:53:56 +00:00
Matthew D Fleming
deceab8792 sysctl(9) cleanup checkpoint: amd64 GENERIC builds cleanly.
Commit the cxgb driver piece.
2011-01-12 19:53:44 +00:00
Matthew D Fleming
8c49f18771 sysctl(9) cleanup checkpoint: amd64 GENERIC builds cleanly.
Commit the Intel drivers.
2011-01-12 19:53:23 +00:00
Pyun YongHyeon
89feeee459 For re(4) controllers that uses new jumbo frame scheme(RTL8168C/D/E),
limit maximum RX buffer size to RE_RX_DESC_BUFLEN instead of
blindly configuring it to 16KB. Due to lack of documentation, re(4)
didn't allow jumbo frame on these controllers. However it seems
controller is confused with jumbo frame such that it can DMA the
received frame to wrong address instead of splitting it into
multiple RX buffers. Of course, this caused panic.

Since re(4) does not support jumbo frames on these controllers,
make controller drop frame that is longer than RE_RX_DESC_BUFLEN
sized frame. Fortunately RTL810x controllers, which do not support
jumbo frame, have no such issues but this change also limited
maximum RX buffer size allowed to RTL810x controllers. Allowing
16KB RX buffer for controllers that have no such capability is
meaningless.

MFC after:	3 days
2011-01-12 03:43:47 +00:00
Jack F Vogel
599564e633 A couple problems discovered by Andrew Boyer:
- failure code in em_xmit got mangled along the way
     and was not properly handling errors.
   - local timer code had a leftover UNLOCK call that
     should be removed.

MFC after 3 days
2011-01-12 00:23:47 +00:00
Jung-uk Kim
b5854f5f59 Work around a witness(4) panic introduced in r217238.
Reported by:	jh
2011-01-11 19:26:39 +00:00
Jung-uk Kim
5947a0a3c8 Fix a witness(4) warning introduced in r217238. 2011-01-11 19:20:01 +00:00
Gavin Atkinson
01a8f075a2 Improve or fix some comments. No functional change.
MFC after:	1 week
2011-01-11 19:05:55 +00:00
John Baldwin
58ccf5b41c Remove unneeded includes of <sys/linker_set.h>. Other headers that use
it internally contain nested includes.

Reviewed by:	bde
2011-01-11 13:59:06 +00:00
Pyun YongHyeon
16a4824bf9 When driver is not running, do not send DUMP command to controller
and just show old (cached) values. Controller will not respond to
the command unless MAC is enabled so DUMP request for down
interface caused request timeout.
2011-01-10 23:47:11 +00:00
Pyun YongHyeon
d6d7d923ad Implement TSO on RealTek RTL8168/8111 C or later controllers.
RealTek changed TX descriptor format for later controllers so these
controllers require MSS configuration in different location of TX
descriptor. TSO is enabled by default for controllers that use new
descriptor format.
For old controllers, TSO is still disabled by default due to broken
frames under certain conditions but users can enable it.
Special thanks to Hayes Wang at RealTek.

MFC after:	2 weeks
2011-01-10 23:28:46 +00:00
Alexander Motin
da839e639b Add IDs for HighPoint RocketRAID 64x controllers.
These controllers consist of two Marvell 88SE9128 6Gbps SATA chips and
PLX PCIe bridge. As result, they seem to be agree to work with ahci(4)
as usual HBAs. The only noticed issue is that RAID BIOS disables all
drive caches during boot, though `camcontrol cmd ...` is able to fix that.

Those who wants RAID functionality can still use closed proprietary driver
from HighPoint site.

MFC after:	1 week
2011-01-10 22:27:52 +00:00
Jung-uk Kim
ea5bef4942 Remove impossible error conditions. 2011-01-10 21:09:38 +00:00
Jung-uk Kim
bd532602ec Add forgotten free(9) in the previous commit for an error case. 2011-01-10 21:01:41 +00:00
Jung-uk Kim
82bf55575d Allow AcpiOsInstallInterruptHandler() and AcpiOsRemoveInterruptHandler() to
install or remove non-SCI interrupt handlers per ACPI Component Architecture
User Guide and Programmer Reference.  ACPICA may install such interrupt
handler when a GPE block device is found, for example.  Add a wrapper for
ACPI_OSD_HANDLER, convert its return values to ours, and make it a filter.
Prefer KASSERT(9) over panic(9) as we have never seen those in reality.
Clean up some style(9) nits and add my copyright.
2011-01-10 20:56:59 +00:00
Jung-uk Kim
b839a7f44b Prefer KASSERT(9) over panic(9) as it was never seen in reality. 2011-01-10 20:26:36 +00:00
Pyun YongHyeon
d2ffe15ae0 Apply DMA address space restriction to controllers that have 4GB
DMA boundary bug and runs with PCI-X mode.  watchdog timeout was
observed on BCM5704 which lives behind certain PCI-X bridge(e.g.
AMD 8131 PCI-X bridge).  It's still not clear whether the root
cause came from that PCI-X bridge or not. The watchdog timeout
indicates the issue is in TX path. If the bridge reorders TX
mailbox write accesses it would generate all kinds of problems but
I'm not sure.  This should be revisited.

Tested by:	Michael L. Squires (mikes <> siralan dot org)
2011-01-10 17:45:09 +00:00
Pyun YongHyeon
92c0b021ce Backout r216973 and r216970. r216973 didn't solve watchdog timeout
issue seen on PCIX BCM5704 controller. r216970 fixed the issue but
the DMA address space restriction was applied to all bge(4)
controllers such that it caused unnecessary performance degradation
for controllers that have no such issues.
2011-01-10 17:37:49 +00:00
Gavin Atkinson
c6ac426dd8 Add support for the Zeagle N2iTion3 Dive Computer to uplcom(4). This brings
the list of supported devices in sync with kernel.org git revision
f36ecd5de93e4c85a9e3d25100c6e233155b12e5, and OpenBSD uplcom.c r1.54
2011-01-09 17:40:04 +00:00
Gavin Atkinson
8f3ce105d2 Sync the list of devices supported by uslcom(4) with Linux, bringing in
all new devices added between our r211022 and their git revision
93ad03d60b5b18897030038234aa2ebae8234748

Also correct a Foxconn entry.

MFC after:	1 week
2011-01-09 17:10:06 +00:00
Jack F Vogel
462e3e88b3 CSUM flags need to be OS version sensitive in ixv code
MFC in 3 days
2011-01-07 23:39:41 +00:00
Jack F Vogel
66863764b8 kern/150247 - virtualization code also needs fix for 7.X to be buildable...
MFC in 3 days
2011-01-07 23:19:13 +00:00
Jack F Vogel
4655a3925a Fix to kern/150247 - make ixgbe buildable for 7.x 2011-01-07 22:58:12 +00:00
Jack F Vogel
006d15596a kern/153772 fix variable names.
Thank you Andrew Boyer for catching these

MFC in 3 days
2011-01-07 22:34:56 +00:00
Bernhard Schmidt
750647ad62 Don't try to free an unassigned pointer.
Submitted by:	Paul B Mahol <onemda at gmail.com>
MFC after:	1 week
2011-01-07 18:41:59 +00:00
John Baldwin
a4a75d679c Use a regular taskqueue rather than a fast taskqueue for mxge(4).
Reviewed by:	gallatin
2011-01-07 16:07:29 +00:00
John Baldwin
c305730dc0 Remove bogus usage of INTR_FAST. "Fast" interrupts are now indicated by
registering a filter handler rather than a threaded handler.  Also remove
a bogus use of INTR_MPSAFE for a filter.
2011-01-06 21:08:06 +00:00
John Baldwin
3a9c343466 Remove an unnecessary INTR_MPSAFE and a comment suggesting it was
unnecessary.
2011-01-06 21:02:14 +00:00
Gavin Atkinson
635c945768 Support the Uniform Industrial Corp (UIC) MSR206 Magnetic Card Reader.
MFC after:	1 week
2011-01-06 19:17:29 +00:00
Matt Jacob
0fa61e2f67 Update firmware to more recent versions.
MFC after:	3 months
2011-01-05 23:15:22 +00:00
Marius Strobl
8929ea6f2e Remove a redundant variable assignment found with the clang static analyzer.
MFC after:	1 week
2011-01-05 14:33:48 +00:00
Pyun YongHyeon
baceff2f49 Limit hardware bug workaround to controllers that have 4GB boundary
bug instead of blindly applying it to all controllers.

Pointed out by:	marius
MFC after:	3 days
2011-01-04 20:06:26 +00:00
Pyun YongHyeon
192d74107e Partially revert change made in r212061. r212061 relied on
bus_dma(9)'s capability which honors boundary restrictions of DMA
tag for dynamic buffers. However it seems this does not work well
and it triggered watchodg timeouts on controller that has the
hardware bug. It's not clear whether there is still another
hardware bug not mentioned in errata. This should be revisited
since this change shall make use of bounce buffers which in turn
reduces performance a lot on systems that have more than 4GB
memory.

Reported by:	Michael L. Squires (mikes <> siralan dot org)
Tested by:	Michael L. Squires (mikes <> siralan dot org)
MFC after:	3 days
2011-01-04 19:10:54 +00:00
Jung-uk Kim
000d939024 Clarify the previous commit. AcpiFinishGpe() will not clear GPE for us
because we set it to edge-trigger.
2011-01-04 17:06:03 +00:00
Robert Watson
2913e88c91 Make "options XENHVM" compile for i386, not just amd64 -- a largely
mechanical change.  This opens the door for using PV device drivers
under Xen HVM on i386, as well as more general harmonisation of i386
and amd64 Xen support in FreeBSD.

Reviewed by:    cperciva
MFC after:      3 weeks
2011-01-04 14:49:54 +00:00
Konstantin Belousov
23b70c1ae2 Finish r210923, 210926. Mark some devices as eternal.
MFC after:	2 weeks
2011-01-04 10:59:38 +00:00
Jung-uk Kim
5568050d57 Clear GPE from a query handler if the task was deferred. 2011-01-04 00:10:29 +00:00
Pawel Jakub Dawidek
4daf3d2552 Wait for commands to complete 10 times longer. This makes my A-DATA 32GB SDHC
card being detected.

Reviewed by:	imp
MFC after:	2 weeks
2011-01-04 00:08:39 +00:00
Jung-uk Kim
80b1151e82 Fix parameters for wakeup(9) and tsleep(9).
MFC after:	3 days
2011-01-03 23:37:42 +00:00
John Baldwin
32341ad63c Add a 'locked' variant of the foo_start() routine and call it directly
from interrupt handlers and watchdog routines instead of queueing a task
to call foo_start().

Reviewed by:	yongari
MFC after:	1 month
2011-01-03 18:28:30 +00:00
Pyun YongHyeon
3c5571b374 Fix endianness bug introduced in r205091.
After controller updates control word in a RX LE, driver converts
it to host byte order. The checksum value in the control word is
stored in big endian form by controller. r205091 didn't account for
the host byte order conversion such that the checksum value was
incorrectly interpreted on big endian architectures which in turn
made all TCP/UDP frames dropped. Make RX checksum offload work
on any architectures by swapping the checksum value.

Reported by:	Sreekanth M. ( kanthms <> netlogicmicro dot com )
Tested by:	Sreekanth M. ( kanthms <> netlogicmicro dot com )
2010-12-31 22:18:41 +00:00
Bernhard Schmidt
c09bfb13d7 The mwl's HAL manages an array of MWL_MBSS_MAX VAPs where the first 8 are
supposed to be APs and the later 24 are pre-configured as STAs. A wrong
condition during initialization is responsible for not configuring the last
8 array members. This is results in being able to create more than 8,
possible uninitialized, AP-VAPs.

PR:		kern/153549
Submitted by:	Erik Fonnesbeck <efonnes at gmail.com>
MFC after:	2 weeks
2010-12-31 09:50:15 +00:00
Pyun YongHyeon
8cb85698f9 Remove debugging leftovers. 2010-12-31 01:23:04 +00:00
Pyun YongHyeon
2608aefc0b Add driver for DM&P Vortex86 RDC R6040 Fast Ethernet.
The controller is commonly found on DM&P Vortex86 x86 SoC.  The
driver supports all hardware features except flow control.  The
flow control was intentionally disabled due to silicon bug.

DM&P Electronics, Inc. provided all necessary information including
sample board to write driver and answered many questions I had.
Many thanks for their support of FreeBSD.

H/W donated by:	DM&P Electronics, Inc.
2010-12-31 00:21:41 +00:00
Pyun YongHyeon
e6713fe53c Add RDC Semiconductor R6040 10/100 PHY driver. 2010-12-30 23:50:25 +00:00
Bernhard Schmidt
a71ad78761 The RX path is missing a few bus_dmamap_*() calls, this results in
modification of memory which was already free'd and eventually in:
wpi0: could not map mbuf (error 12)
wpi0: wpi_rx_intr: bus_dmamap_load failed, error 12
and an usuable device.

PR:		kern/144898
MFC after:	3 days
2010-12-30 18:29:22 +00:00
Konstantin Belousov
d91e813c7b Add reporting of GEOM::candelete BIO_GETATTR for md(4) and geom_disk(4).
Non-zero value of attribute means that device supports BIO_DELETE.

Suggested and reviewed by:	pjd
Tested by:	pho
MFC after:	1 week
2010-12-29 12:11:07 +00:00
Konstantin Belousov
c44d423ed8 Add sysctl vm.md_malloc_wait, non-zero value of which switches malloc-backed
md(4) to using M_WAITOK malloc calls.

M_NOWAITOK allocations may fail when enough memory could be freed, but not
immediately. E.g. SU UFS becomes quite unhappy when metadata write return
error, that would happen for failed malloc() call.

Reported and tested by:	pho
MFC after:	1 week
2010-12-29 11:39:15 +00:00
Colin Percival
eb68ccd676 A lack of console input is not the same thing as a byte of \0 input.
Correctly return -1 from cngetc when no input is available to be read.

This fixes the '(CTRL-C to abort)' spam while dumping.

MFC after:	3 days
2010-12-29 05:13:21 +00:00
Pyun YongHyeon
deb4ef8291 Add device id for RDC M3010 which is found on Vortex86 SoC.
Reviewed by:	mav
2010-12-28 17:45:43 +00:00
John Baldwin
e58ed10207 Use bus_alloc_resource_any().
MFC after:	2 weeks
2010-12-28 16:57:29 +00:00
Alan Cox
82de724fe1 Introduce and use a new VM interface for temporarily pinning pages. This
new interface replaces the combined use of vm_fault_quick() and
pmap_extract_and_hold() throughout the kernel.

In collaboration with:	kib@
2010-12-25 21:26:56 +00:00
John Baldwin
0d81cf1227 Don't try to reserve a resource that is already allocated. If the ECDT
table is present, then the acpi_ec(4) driver will allocate its resources
from nexus0 before the acpi0 device reserves resources for child devices.

Reviewed by:	jkim
2010-12-23 18:50:14 +00:00
John Baldwin
ea23319939 Use resource_list_reserve() to reserve I/O port and memory resources for
ACPI devices even if they are not allocated by a device driver since the
resources are in use and should not be allocated to another device.
2010-12-22 20:27:20 +00:00
Marius Strobl
142d932b79 - Add a comment regarding the fact that as documented in the datasheet
manual 1000BASE-T modes of DP83865 only work together with other National
  Semiconductor PHYs.
- Spell 10BASE-T correctly
- Remove some redundant braces.
2010-12-21 21:12:18 +00:00
John Baldwin
a11df0cbe6 Only use the BIOS-supplied IRQ for the atkbdc device for a child atkbd
device.  Specifically, do not reuse it for a child psm device.

Tested by:	many
2010-12-21 12:49:37 +00:00
Alan Cox
c2f86e4192 The local variable "rv" is still required by vm_fault_hold_user_pages(). 2010-12-20 23:41:31 +00:00
Alan Cox
acd11c7499 Introduce vm_fault_hold() and use it to (1) eliminate a long-standing race
condition in proc_rwmem() and to (2) simplify the implementation of the
cxgb driver's vm_fault_hold_user_pages().  Specifically, in proc_rwmem()
the requested read or write could fail because the targeted page could be
reclaimed between the calls to vm_fault() and vm_page_hold().

In collaboration with:	kib@
MFC after:	6 weeks
2010-12-20 22:49:31 +00:00
Tijl Coosemans
81bd5041a2 Merge amd64 and i386 bus.h and move the resulting header to x86. Replace
the original amd64 and i386 headers with stubs.

Rename (AMD64|I386)_BUS_SPACE_* to X86_BUS_SPACE_* everywhere.

Reviewed by:	imp (previous version), jhb
Approved by:	kib (mentor)
2010-12-20 16:39:43 +00:00
John Baldwin
da1781dd59 Don't whine about child drivers calling pci_enable_busmaster(). That is
perfectly normal.

MFC after:	1 week
2010-12-20 14:54:24 +00:00
Tijl Coosemans
4485b7e74a Fix a bug introduced in r216518. The ndis_subsys field holds the PCI
subdevice ID in addition to the subvendor ID.

Reported by:	Paul B Mahol 'onemda gmail com'
Approved by:	kib (mentor)
2010-12-19 11:14:34 +00:00
Bernhard Schmidt
6a9e69db1b Fix panic trying to use monitor mode. The iwn_cmd() calls issued by
iwn_config() want to msleep() on the mutex.

PR:		kern/138427
Submitted by:	Henry Hu <henry.hu.sh at gmail.com>
MFC after:	3 days
2010-12-19 10:36:06 +00:00
Pyun YongHyeon
4f1ff93a3b Add support for JMicron JMC251/JMC261 Gigabit/Fast ethernet
controller with Card Read Host Controller. These controllers are
multi-function devices and have the same ethernet core of
JMC250/JMC260. Starting from REVFM 5(chip full mask revision)
controllers have the following features.
 o eFuse support
 o PCD(Packet Completion Deferring)
 o More advanced PHY power saving

Because these controllers started to use eFuse, station address
modified by driver is permanent as if it was written to EEPROM. If
you have to change station address please save your controller
default address to safe place before reprogramming it. There is no
way to restore factory default station address.

Many thanks to JMicron for continuing to support FreeBSD.

HW donated by:	JMicron
2010-12-18 23:52:50 +00:00
Pyun YongHyeon
4d9ab34335 Use system defined PCIR_EXPRESS_DEVICE_CTL instead of using magic
number.
2010-12-18 23:26:38 +00:00
Pyun YongHyeon
cd33cef723 Make sure whether driver allocated resource before releasing it. 2010-12-18 23:24:59 +00:00
Pyun YongHyeon
f25c5972da Fix a regression introduced in r213893. FPGA version requires PHY
probing so allow PHY probing on all possible addresses.
2010-12-18 23:21:16 +00:00
Pyun YongHyeon
1a0b1eafd2 Consistently put a tab character between #define and the macro name. 2010-12-18 23:03:38 +00:00
Bernhard Schmidt
f015cb7882 Add 2 missing bus_dmamap_sync() calls. Those fix random 'scan timeout',
'could not set power mode', 'device config failed' and other errors due
reading invalid memory.

Obtained from:	OpenBSD
MFC after:	3 days
2010-12-18 15:45:10 +00:00
Bernhard Schmidt
9624106633 Fix association on 5GHz channels. The device is initially configured using
a 2GHz channel with appropriate flags set to sc->config. Due to not zeroing
sc->config for auth/assoc those flags are still set while trying to connect
on a 5GHz channel.

MFC after:	3 days
2010-12-18 15:35:10 +00:00
Bernhard Schmidt
5f69ca6227 Fix a panic while disabling the RF kill button, caller of the
wpi_rfkill_resume() function will take care of the lock.

PR:		kern/144898
MFC after:	3 days
2010-12-18 15:25:21 +00:00
Tijl Coosemans
8dca9d3328 No need to zero the softc. It's allocated with M_ZERO.
Use pci_enable_busmaster instead of setting PCIM_CMD_BUSMASTEREN
directly. There's no need to set PCIM_CMD_MEMEN. The bit is set when a
SYS_RES_MEMORY resource is activated.

Remove redundant pci_* function calls from suspend/resume methods. The
bus driver already saves and restores the PCI configuration.

Write 1 byte instead of 4 when setting the HIFN_TRDY_TIMEOUT register.
It is only 1 byte according to the specification.

Reviewed by:	jhb
Approved by:	kib (mentor)
2010-12-18 14:24:24 +00:00
Tijl Coosemans
0e4e9e170c Use convenience functions where possible instead of accessing the PCI
configuration registers directly.

Remove pci_enable_io calls where they are redundant. The PCI bus driver
will set the right bits when the corresponding bus resource is activated.

Remove redundant pci_* function calls from suspend/resume methods. The
bus driver already saves and restores the PCI configuration.

Reviewed by:	jhb
Approved by:	kib (mentor)
2010-12-18 14:21:28 +00:00
Ed Maste
79aac43e42 Add Exar octal PCI UART.
Submitted by:	Mark Johnston
Obtained from:	Sandvine Incorporated
2010-12-18 02:54:51 +00:00
Alan Cox
8c22654d7e Implement and use a single optimized function for unholding a set of pages.
Reviewed by:	kib@
2010-12-17 22:41:22 +00:00
Andriy Gapon
766d7e6539 small cleanup of acpi battery status setting and checking
This is based on the patch submitted by Yuri Skripachov.
Overview of the changes:
- clarify double-use of some ACPI_BATT_STAT_* definitions
- clean up undefined/extended status bits returned by _BST
- warn about charging+discharging bits being set at the same time

PR:		kern/124744
Submitted by:	Yuri Skripachov <y.skripachov@gmail.com>
Tested by:	Yuri Skripachov <y.skripachov@gmail.com>
MFC after:	2 weeks
2010-12-17 16:21:30 +00:00
John Baldwin
ce7a3e4774 - If the atkbdc device is assigned an IRQ resource by ACPI or the PnPBIOS,
allow the child atkbd device to reuse that IRQ resource instead of
  reallocating the same IRQ from the parent bus inside the atkbd driver.
- Don't allocate a shared IRQ for the atkbd driver.  For AT keyboard
  devices on an ISA bus the IRQ is not shareable.  Instead, the bus driver
  should mark the IRQ shareable if the bus supports shared IRQs.
- Don't identify child devices until after the atkbdc device itself has
  attached.
2010-12-16 17:14:37 +00:00
John Baldwin
2f29acd7ec - When moving the IRQ resource from the psmcpnp device to the psm device,
delete the IRQ resource from the psmcpnp device completely.
- Don't allocate the IRQ resource shared.  It is not a shareable interrupt
  on ISA.  The bus driver can set RF_SHAREABLE if the IRQ is actually
  shareable on a non-ISA bus.
2010-12-16 17:08:43 +00:00
John Baldwin
686b1e6bc0 Small style fixes:
- Avoid side-effect assignments in if statements when possible.
- Don't use ! to check for NULL pointers, explicitly check against NULL.
- Explicitly check error return values against 0.
- Don't use INTR_MPSAFE for interrupt handlers with only filters as it is
  meaningless.
- Remove unneeded function casts.
2010-12-16 17:05:28 +00:00
John Baldwin
5e66b8e231 Spelling fix. 2010-12-16 16:55:22 +00:00
John Baldwin
7f3384ab34 Use bus_alloc_resource_any() instead of bus_alloc_resource(). Besides being
cleaner, this fixes problems where the code was using ~0 instead of ~0ul
for the upper bound on "any" resources.

MFC after:	1 month
2010-12-16 15:19:32 +00:00
Jung-uk Kim
5a77b11bd3 Merge ACPICA 20101209. 2010-12-15 23:48:45 +00:00
Jung-uk Kim
e1c9d39ebe Stop lying about supporting cpu_est_clockrate() when TSC is invariant. This
function always returned the nominal frequency instead of current frequency
because we use RDTSC instruction to calculate difference in CPU ticks, which
is supposedly constant for the case.  Now we support cpu_get_nominal_mhz()
for the case, instead.  Note it should be just enough for most usage cases
because cpu_est_clockrate() is often times abused to find maximum frequency
of the processor.
2010-12-14 20:07:51 +00:00
Pyun YongHyeon
e23559db8e Remove unecessary and clearly wrong usage of atomic(9).
Reported by:  avg
2010-12-14 17:39:10 +00:00
Andriy Gapon
c82eedb465 acpi_fujitsu: update for P8010
PR:		kern/121102
Submitted by:	Anish Mistry <amistry@am-productions.biz>
MFC after:	3 weeks
2010-12-11 10:55:18 +00:00
Andriy Gapon
d009878bb9 fix atomic_set_xxx misuse in drm
It seems that atomic_set_xxx and atomic_store_xxx were confused.

Reviewed by:	jhb
MFC after:	3 weeks
2010-12-11 10:18:05 +00:00
Andriy Gapon
5579e006db fix incorrect use of atomic_set_xxx in cxgb
There is no need to use an atomic operation at structure initialization
time.
Note that the file changed is not connected to the build at this time.

Reviewed by:	jhb (general issue)
Approved by:	np
MFC after:	2 weeks
2010-12-11 10:14:08 +00:00
Kenneth D. Merry
d970279c91 Fix setting LUN numbers in the mps(4) driver.
Prior to this change, the addressing method wasn't getting set, and
so the LUN field could be set incorrectly in some instances.

This fix should allow for LUN numbers up to 16777215 (and return an error
for anything larger, which wouldn't fit into the flat addressing model).

Submitted by:	scottl (in part)
2010-12-11 00:36:35 +00:00
Joerg Wunsch
029e96939d Implement more of __ibsta: END and SRQI status bits (taken out of the
uPD7210 IRQ status).

MFC after:	1 week
2010-12-10 22:20:11 +00:00
Kenneth D. Merry
49dfe4a2d4 Fix an event handling bug with the mps(4) driver.
This bug manifested itself after repeated device arrivals and
departures.  The root of the problem was that the last entry in the
reply array wasn't initialized/allocated.  So every time we got
around to that event, we had a bogus address.

There were a couple more problems with the code that are also fixed:

 - The reply mechanism was being treated as sequential (indexed by
   sc->replycurindex) even though the spec says that the driver
   should use the ReplyFrameAddress field of the post queue
   descriptor to figure out where the reply is.  There is no
   guarantee that the reply descriptors will be used in sequential
   order.

 - The second word of the reply post queue descriptor wasn't being
   checked in mps_intr_locked() to make sure that it wasn't
   0xffffffff.  So the driver could potentially come across a
   partially DMAed descriptor.

 - The number of replies allocated was one less than the actual
   size of the queue.  Instead, it was the size of the number of
   replies that can be used at one time.  (Which is one less than
   the size of the queue.)

mps.c:		When initializing the entries in the reply free
		queue, make sure we initialize the full number that
		we tell the chip we have (sc->fqdepth), not the
		number that can be used at any one time (sc->num_replies).

		When allocating replies, make sure we allocate the
		number of replies that we've told the chip exist,
		not just the number that can be used simultaneously.

		Use the ReplyFrameAddress field of the post queue
		descriptor to figure out which reply is being
		referenced.  This is what the spec says to do, and
		the spec doesn't guarantee that the replies will be
		used in order.

		Put a check in to verify that the reply address passed
		back from the card is valid.  (Panic if it isn't, we'll
		panic when we try to deference the reply pointer in any
		case.)

		In mps_intr_locked(), verify that the second word of the
		post queue descriptor is not 0xffffffff in addition to
		verifying that the unused flag is not set, so we can
		make sure we didn't get a partially DMAed descriptor.

		Remove references to sc->replycurindex, it isn't needed
		now.

mpsvar.h:	Remove replycurindex from the softc, it isn't needed now.

Reviewed by:	scottl
2010-12-10 21:45:10 +00:00
Pyun YongHyeon
7e86a37e0d Remove unecessary and clearly wrong usage of atomic(9).
Reported by:	avg, jhb, attilio
2010-12-10 21:43:20 +00:00
Andreas Tobler
7cea3d952b On the Xserve G5 we find the LM75 instead of the DS1775. The core
functionality is the same, a difference is that the DS1775 has a better
precision than the LM75. But we do not use it in our setup. Make the
LM75 work the same as the DS1775.

Fix a typo in device_set_desc.

Tested by: Paul Mather <paul at gromit dlib vt edu>

Approved by:	nwhitehorn (mentor)
2010-12-10 20:27:50 +00:00
Tijl Coosemans
61faa8d87d Use SYS_RES_IOPORT instead of PCIM_CMD_PORTEN when calling pci_enable_io.
Approved by:	kib (mentor)
2010-12-10 15:05:49 +00:00
Joerg Wunsch
933be1f00c Fix __retval vs. retval confusion: retval is meant to store the (userland)
pointer where data is to be returned by ibask() (currently unimplemented),
while __retval holds the value returned by the libgpib ibfoo() functions.

The confusion resulted in the ibfoo() functions returning an uninitialized
value except in situations where the GPIB activity has been terminated
abnormally.

MFC after:	3 days
2010-12-10 14:04:41 +00:00
Alexander Motin
ee65f30a14 Add IDs of HighPoint RocketRAID 62x cards (Marvell 88SE9128 chips).
PR:		kern/152926
Submitted by:	Mike Tancsa <mike@sentex.net>
MFC after:	1 week
2010-12-08 20:35:20 +00:00
Attilio Rao
cb1f5a37e9 Use convenience macro for minimum and maximum value capping when
re-arming the watchdog timeout.

Sponsored by:	Sandvine Incorporated
Submitted by:	Mark Johnston <mjohnston at sandvine dot com>
Reviewed by:	des
MFC after:	10 days
2010-12-08 15:32:54 +00:00
Pyun YongHyeon
65c12bf571 r184610 changed the way how TX frames are handled on AX88178 and
AX88772 controllers. ASIX added a new feature for AX88178/AX88772
controllers which allows combining multiple TX frames into a single
big frame. This was to overcome one of USB limitation where it
can't generate more than 8k interrupts/sec which in turn means USB
ethernet controllers can not send more than 8k packets per second.
Using ASIX's feature greatly enhanced TX performance(more than 3~4
times) compared to 7.x driver. However it seems r184610 removed
boundary checking for buffered frames which in turn caused
instability issues under certain conditions. In addition, using
ASIX's feature triggered another issue which made USB controller
hang under certain conditions. Restarting ethernet controller
didn't help under this hang condition and unplugging and replugging
the controller was the only solution. I believe there is a silicon
bug in TX frame combining feature on AX88178/AX88772 controllers.

To address these issues, reintroduce the boundary checking for both
AX88178 and AX88772 after copying a frame to USB buffer and do not
use ASIX's multiple frame combining feature. Instead, use USB
controller's multi-frame transmit capability to enhance TX
performance as suggested by Hans[1].
This should fix a long standing axe(4) instability issues reported
on AX88772 and AX88178 controllers. While I'm here remove
unnecessary TX frame length check since upper stack always
guarantee the size of a frame to be less than MCLBYTES.

Special thanks to Derrick Brashear who tried numerous patches
during last 4 months and waited real fix with patience. Without
this enthusiastic support, patience and H/W donation I couldn't fix
it since I was not able to trigger the issue on my box.

Suggested by:	hselasky [1]
Tested by:	Derrick Brashear (shadow <> gmail dot com>
H/W donated by:	Derrick Brashear (shadow <> gmail dot com>
PR:		usb/140883
2010-12-08 01:24:05 +00:00
Weongyo Jeong
6e3cb00068 Introduces IFF_CANTCONFIG interface flag to point that the interface
isn't configurable in a meaningful way.  This is for ifconfig(8) or
other tools not to change code whenever IFT_USB-like interfaces are
registered at the interface list.

Reviewed by:	brooks
No objections:	gavin, jkim
2010-12-07 20:23:47 +00:00
Ed Maste
0c761ee78d Add a comment to clarify that some BIOSes may clear the hw watchdog
indicator bit, preventing us from reporting in that case.

X-MFC-with:	r215868
2010-12-07 19:18:00 +00:00
John Baldwin
4a588c1ba7 Use proper resource ID's for HPET IRQ resources. This mostly consists of
looking to see if there is an existing IRQ resource for a given IRQ
provided by the BIOS and using that RID if so.  Otherwise, allocate a new
RID for the new IRQ.

Reviewed by:	mav (a while ago)
2010-12-07 18:49:11 +00:00
Hans Petter Selasky
0e777d8457 Re-add a status check which sneaked out during r214804.
This change can fix some USB error messages showing up
during bootup.

MFC after:	3 days
Approved by:	thompsa (mentor)
2010-12-07 08:20:20 +00:00
Colin Percival
518c824362 Set correct maximum I/O length. We can only handle I/O of up to
max_request_segments * PAGE_SIZE if the I/O is page-aligned; the
largest I/O we can guarantee will work is PAGE_SIZE less than that.
This unbreaks 'diskinfo -t'.
2010-12-06 20:40:15 +00:00
Bernhard Schmidt
3934c8a53f Fix scanning after loosing a connection. The firmware assumes that as long
as an association ID is set any scan is supposed to be a background scan.
This implies that the firmware will switch back to the associated channel
after a certain threshold, though, we are not notified about that. We
currently catch this case by a timer which will reset the firmware after
a 'scan timeout', though, upper layers are not notified about that and
will simply hang until manual intervention. Fix this by resetting the
firmware's knowledge about any association on RUN -> ASSOC and
!INIT -> SCAN transitions.

Tested by:	Zhihao Yuan <lichray at gmail.com>
MFC after:	1 week
2010-12-06 19:05:44 +00:00
Bernhard Schmidt
1b6b62c900 Fixes for monitor mode:
- Do not call iwn_calib_reset() for monitor mode. We do not want to query
  information and do runtime calibration while in monitor mode. Poking the
  firmware with adjustments for calibration results in firmware asserts.
  This could happened on RUN -> RUN transition only.
- Adjust blink rate for monitor mode. It's supposed to not freak out and
  turn off after a while.
- While here, remove one useless assignment of calib.state, it gets
  overwritten later in the function.

Submitted by:	Brandon Gooch <jamesbrandongooch at gmail.com>
MFC after:	1 week
2010-12-06 18:28:39 +00:00
John Baldwin
6074a71604 When masking direct and processor devices during an inquiry, properly
preserve the upper bits of the first data byte.

Reviewed by:	scottl
MFC after:	1 week
2010-12-06 17:06:21 +00:00
John Baldwin
b596082ba7 When masking direct and processor devices during an inquiry, properly
preserve the upper bits of the first data byte.

While here, shorten a few nearby lines.

PR:		kern/152768
Reported by:	Sascha Wildner  saw of online.de
Reviewed by:	scottl
MFC after:	1 week
2010-12-06 17:02:56 +00:00
Kevin Lo
7df9d5acad Fix double ;; 2010-12-06 10:24:06 +00:00
Bernhard Schmidt
2d5c617a52 For 6000 series and newer devices the DC calibration results are no
longer requested of the boot firmware. Instead of sending those results
to the runtime firmware the firmware is told to do the DC calibration
itself.

MFC after:	1 week
2010-12-05 09:00:32 +00:00
Jack F Vogel
1ce42f7249 Correct build error. 2010-12-04 06:38:21 +00:00
Jack F Vogel
aa8dea58c6 Remove the bogus test in the TX context setup for IPV6,
the size can be smaller than the constant when you are
doing HW TAGGING, and you still need to process this
packet in a normal way. I'm not sure where the notion
to just return came from, but its wrong.

MFC after: 3 days
2010-12-04 02:04:02 +00:00
Jack F Vogel
9d43b64dbf Small cut and paste bug in flow control string fixed.
Second, correct the discard/refresh_mbufs code to behave
more like igb, there have been panics due to discards and
this should fix them.

MFC after: 3 days
2010-12-04 01:59:58 +00:00
Jack F Vogel
43fcb978a7 This small little change is a bug that drove me nuts
finding. The test to compare the mbuf m_len against
a fixed value and then returning needs to be removed.

When using VLANS and doing HW_TAGGING, and IPV6, the
ICMP6 packets actually fail this condition, the constant
assumes that the tag is IN the frame, and its not, so
the length is actually tiny. Furthermore, I'm not sure
what the point was to just return??

MFC after: 3 days
2010-12-04 01:43:38 +00:00
Pyun YongHyeon
6e854927d1 If RX lockup workaround is enabled, fxp(4) will periodically reset
the controller to workaround silicon bug of i82557. Each reset will
re-establish link which in turn triggers MII status change
callback. The callback will try to reconfigure controller if the
controller is not i82557 to enable flow-control. This caused
endless link UP/DOWN when the workaround was enabled on non-i82557
controller.

To fix the issue, apply RX lockup workaround only for i82557.
Previously it blindly checked undocumented EEPROM location such
that it sometimes enabled the workaround for other controllers. At
this time, only i82557 is known to have the silicon bug.
This fixes a regression introduced in r215906 which enabled flow
control support for all controllers except i82557.

Reported by:	Karl Denninger (karl <> denninger dot net)
Tested by:	Karl Denninger (karl <> denninger dot net)
MFC after:	3 days
2010-12-02 03:53:29 +00:00
Weongyo Jeong
b172e30376 Explicitly UP and DOWN the usbus interfaces (IFT_USB) when it's attached
or detached.  Normally it should be changed through user land ioctl(2)
system calls but it looks there's no apps for USB and no need.

With this patch, libpcap would detect the usbus interfaces correctly and
tcpdump(1) could dump the USB packets into PCAP format with -w option.
However it couldn't print the output to console because there's no
printer-routine at tcpdump(1).
2010-12-01 03:51:06 +00:00
Kenneth D. Merry
06e794928b Add Serial Management Protocol (SMP) passthrough support to CAM.
This includes support in the kernel, camcontrol(8), libcam and the mps(4)
driver for SMP passthrough.

The CAM SCSI probe code has been modified to fetch Inquiry VPD page 0x00
to determine supported pages, and will now fetch page 0x83 in addition to
page 0x80 if supported.

Add two new CAM CCBs, XPT_SMP_IO, and XPT_GDEV_ADVINFO.  The SMP CCB is
intended for SMP requests and responses.  The ADVINFO is currently used to
fetch cached VPD page 0x83 data from the transport layer, but is intended
to be extensible to fetch other types of device-specific data.

SMP-only devices are not currently represented in the CAM topology, and so
the current semantics are that the SIM will route SMP CCBs to either the
addressed device, if it contains an SMP target, or its parent, if it
contains an SMP target.  (This is noted in cam_ccb.h, since it will change
later once we have the ability to have SMP-only devices in CAM's topology.)

smp_all.c,
smp_all.h:		New helper routines for SMP.  This includes
			SMP request building routines, response parsing
			routines, error decoding routines, and structure
			definitions for a number of SMP commands.

libcam/Makefile:	Add smp_all.c to libcam, so that SMP functionality
			is available to userland applications.

camcontrol.8,
camcontrol.c:		Add smp passthrough support to camcontrol.  Several
			new subcommands are now available:

			'smpcmd' functions much like 'cmd', except that it
			allows the user to send generic SMP commands.

			'smprg' sends the SMP report general command, and
			displays the decoded output.  It will automatically
			fetch extended output if it is available.

			'smppc' sends the SMP phy control command, with any
			number of potential options.  Among other things,
			this allows the user to reset a phy on a SAS
			expander, or disable a phy on an expander.

			'smpmaninfo' sends the SMP report manufacturer
			information and displays the decoded output.

			'smpphylist' displays a list of phys on an
			expander, and the CAM devices attached to those
			phys, if any.

cam.h,
cam.c:			Add a status value for SMP errors
			(CAM_SMP_STATUS_ERROR).

			Add a missing description for CAM_SCSI_IT_NEXUS_LOST.

			Add support for SMP commands to cam_error_string().

cam_ccb.h:		Rename the CAM_DIR_RESV flag to CAM_DIR_BOTH.  SMP
			commands are by nature bi-directional, and we may
			need to support bi-directional SCSI commands later.

			Add the XPT_SMP_IO CCB.  Since SMP commands are
			bi-directional, there are pointers for both the
			request and response.

			Add a fill routine for SMP CCBs.

			Add the XPT_GDEV_ADVINFO CCB.  This is currently
			used to fetch cached page 0x83 data from the
			transport later, but is extensible to fetch many
			other types of data.

cam_periph.c:		Add support in cam_periph_mapmem() for XPT_SMP_IO
			and XPT_GDEV_ADVINFO CCBs.

cam_xpt.c:		Add support for executing XPT_SMP_IO CCBs.

cam_xpt_internal.h:	Add fields for VPD pages 0x00 and 0x83 in struct
			cam_ed.

scsi_all.c:		Add scsi_get_sas_addr(), a function that parses
			VPD page 0x83 data and pulls out a SAS address.

scsi_all.h:		Add VPD page 0x00 and 0x83 structures, and a
			prototype for scsi_get_sas_addr().

scsi_pass.c:		Add support for mapping buffers in XPT_SMP_IO and
			XPT_GDEV_ADVINFO CCBs.

scsi_xpt.c:		In the SCSI probe code, first ask the device for
			VPD page 0x00.  If any VPD pages are supported,
			that page is required to be implemented.  Based on
			the response, we may probe for the serial number
			(page 0x80) or device id (page 0x83).

			Add support for the XPT_GDEV_ADVINFO CCB.

sys/conf/files:		Add smp_all.c.

mps.c:			Add support for passing in a uio in mps_map_command(),
			so we can map a S/G list at once.

			Add support for SMP passthrough commands in
			mps_data_cb().  SMP is a special case, because the
			first buffer in the S/G list is outbound and the
			second buffer is inbound.

			Add support for warning the user if the busdma code
			comes back with more buffers than will work for the
			command.  This will, for example, help the user
			determine why an SMP command failed if busdma comes
			back with three buffers.

mps_pci.c:		Add sys/uio.h.

mps_sas.c:		Add the SAS address and the parent handle to the
			list of fields we pull from device page 0 and cache
			in struct mpssas_target.  These are needed for SMP
			passthrough.

			Add support for the XPT_SMP_IO CCB.  For now, this
			CCB is routed to the addressed device if it supports
			SMP, or to its parent if it does not and the parent
			does.  This is necessary because CAM does not
			currently support SMP-only nodes in the topology.

			Make SMP passthrough support conditional on
			__FreeBSD_version >= 900026.  This will make it
			easier to MFC this change to the driver without
			MFCing the CAM changes as well.

mps_user.c:		Un-staticize mpi_init_sge() so we can use it for
			the SMP passthrough code.

mpsvar.h:		Add a uio and iovecs into struct mps_command for
			SMP passthrough commands.

			Add a cm_max_segs field to struct mps_command so
			that we can warn the user if busdma comes back with
			too many segments.

			Clear the cm_reply when a command gets freed.  If
			it is not cleared, reply frames will eventually get
			freed into the pool multiple times and corrupt the
			pool.  (This fix is from scottl.)

			Add a prototype for mpi_init_sge().

sys/param.h:		Bump __FreeBSD_version to 900026 for the for the
			inclusion of the XPT_GDEV_ADVINFO and XPT_SMP_IO
			CAM CCBs.
2010-11-30 22:39:46 +00:00
Marius Strobl
978f2704bd - Remove the remaining support for older (in this case pre-7.0-RELEASE)
versions of FreeBSD. In fact we are already missing a lot of conditional
  code necessary to support older versions of FreeBSD, including alternatives
  for vital functionality not yet provided by the respective subsystem back
  then (see for example r199663). So this change shouldn't actually break
  this driver on versions of FreeBSD that were supported before. Besides,
  this driver also isn't maintained as an multi-release version outside of
  the main repository, so removing the conditional code shouldn't be a
  problem in that regard either.
- Sprinkle some more const on tables.
2010-11-30 21:08:59 +00:00
Jung-uk Kim
1658038ce7 Rename a variable to match scvidctl.c. 2010-11-30 17:34:15 +00:00
Jung-uk Kim
732e8e1632 Stop hardcoding default font size. 2010-11-30 17:32:28 +00:00
Jung-uk Kim
fd7a9ebcca Clean up code a bit to make it more readable. 2010-11-30 16:46:15 +00:00
Hans Petter Selasky
02c4024199 We need to define a cdev variable associated with each USB device,
hence existing applications like webcamd are expecting that.
This problem was introduced by SVN change 214221 where cdev=
was replaced by ugen= by accident. Solve this problem by
redefining cdev= in devd notifications.

MFC after 3 days.

Approved by:	thompsa (mentor)
2010-11-30 08:25:57 +00:00
Jung-uk Kim
82515b4f1f Clean up code a bit to make it more readable. 2010-11-29 22:20:44 +00:00
Jung-uk Kim
0cb06f72d5 Honor font size for the video mode when default fonts are compiled in kernel
and VESA mode is enabled from loader.
2010-11-29 22:19:19 +00:00
MIHIRA Sanpei Yoshiro
54de08a963 Add new device ids.
Buffalo (Melco Inc.) WLI-UC-G

PR:		141777
2010-11-29 15:08:18 +00:00
Gavin Atkinson
f6fa0b2b95 Support the Falcom Twist USB GSM/GPRS modem in uftdi(4)
PR:		usb/151862
Submitted by:	Alessandro de Manzano <demanzano dqmicro.it>
MFC after:	1 week
2010-11-29 08:17:44 +00:00
Marius Strobl
1510a2b019 Several chipset drivers alter parameters relevant for the DMA tag creation,
i.e. alignment, max_address, max_iosize and segsize (only max_address is
thought to have an negative impact regarding this issue though), after
calling ata_dmainit() either directly or indirectly so these values have
no effect or at least no effect on the DMA tags and the defaults are used
for the latter instead. So change the drivers to set these parameters
up-front and ata_dmainit() to honor them.

Reviewd by:	mav
MFC after:	1 month
2010-11-28 18:53:29 +00:00
Pyun YongHyeon
45b0a3494d Add initial AX88772A support.
H/W donated by:	Derrick Brashear (shadow <> gmail dot com)
2010-11-28 01:56:44 +00:00
Pyun YongHyeon
8c09fbe458 Introduce new macro AXE_IS_178_FAMILY and AXE_IS_772. Include
AX88772A and AX88772B for future extension. While here add TX
buffer size for 178 family controllers.
2010-11-28 01:43:28 +00:00
Pyun YongHyeon
ff5fbbc49b Do full controller initialization in axe_reset() for controllers
that require special configuration from EEPROM. This will put
controllers into known sane state.
2010-11-28 01:16:37 +00:00
Pyun YongHyeon
d743bdd2f6 Make sure to change to currently selected media. 2010-11-28 01:03:06 +00:00
Pyun YongHyeon
0369b60472 Do not reinitialize controller if it's already running. 2010-11-28 01:00:39 +00:00
Pyun YongHyeon
675c1ae83d Move axe_reset() to axe_init(). 2010-11-28 00:57:48 +00:00
Pyun YongHyeon
6dd81ec722 Apply GPIO configuration for all CICADA PHYs.
While I'm here show selected phymode to ease of debugging.
2010-11-28 00:52:02 +00:00
Matt Jacob
c4f65bca0b Partially revert 208119. We were overwriting tunable settings.
Obtained from:	Oleg Sharoyko
MFC after:	1 week
2010-11-27 20:33:08 +00:00
Alexander Motin
8a1d183fb7 Do hard reset before soft reset for SATA channels. Soft reset reported to be
not enough to restore device readiness in some situations.

Tested by: 	Roger Hammerstein <cheeky.m@live.com> on ServerWorks HT1000.
2010-11-27 07:03:31 +00:00
Jack F Vogel
f0fe67b43c Interrupt handler, and stats changes from Michael Tuexen,
thanks Michael!
2010-11-27 01:34:09 +00:00
Marius Strobl
12d314a661 Allow pause support advertisement to be turned off again.
Submitted by:	yongari (ip1000phy(4))
2010-11-27 01:26:59 +00:00
Ed Maste
84fe19c742 Fix build by correcting function name. Pointed out by dougb. 2010-11-27 00:26:19 +00:00
Jack F Vogel
38104ecc27 and the header... 2010-11-27 00:00:33 +00:00
Jack F Vogel
aa26851c4f A couple fixes got clobbered, putting them back. 2010-11-26 23:57:13 +00:00
Jack F Vogel
1a4e34498c Update ixgbe driver to verion 2.3.6
- This adds a VM SRIOV interface, ixv, it is however
	  transparent to the user, it links with the ixgbe.ko,
	  but when ixgbe is loaded in a virtualized guest with
	  SRIOV configured this will be detected.
	- Sync shared code to latest
	- Many bug fixes and improvements, thanks to everyone
	  who has been using the driver and reporting issues.
2010-11-26 22:46:32 +00:00
Jack F Vogel
f4b4ba3ed2 Unwanted extra call to set_vlan_hw added back by mistake. 2010-11-26 22:36:47 +00:00
Marius Strobl
1845b5c37b Fix and implement missing parts of flow control support. This also removes
the dev.fxp.%d.noflow tunable as the same effect can now be achieved with
ifconfig(8) by setting the flowcontrol media option as desired (besides
the tunable never having a chance to actually enable flow control support
so far).
In joint forces with:	yongari
2010-11-26 21:52:33 +00:00
Marius Strobl
60c1e4c405 Ensure Bay flow control is disabled as we're going to use IEEE 802.3 annex
31B full duplex flow control instead.
2010-11-26 21:41:42 +00:00
Attilio Rao
fe4424cbbd - Advertise when the reboot came from a watchdog-induced reset.
- Fix a bug where TCO_BOOT_STS was supposed to be cleared after
  TCO_SECOND_TO_STS and not before.

Sponsored by:	Sandvine Incorporated
Submitted by:	Mark Johnston <mjohnston at sandvine dot com>
Reviewed by:	des
MFC after:	10 days
2010-11-26 15:35:08 +00:00
Pyun YongHyeon
9f4e8f4601 Enable ethernet flow-control on all alc(4) controllers. This change
should reduce a lot of dropped frames under high network load.
2010-11-26 02:10:56 +00:00
Pyun YongHyeon
fc519a189b Enable ethernet flow-control on all jme(4) controllers. 2010-11-26 02:01:16 +00:00
Pyun YongHyeon
7bcbe6cb58 Allocate 1 MSI/MSI-X vector. Originally jme(4) was designed to
support multi-queue but the hardware limitation made it hard to
implement supporting multi-queue. Allocating more than necessary
vectors is resource waste and it can be added back when we
implement multi-queue support.
2010-11-26 01:58:25 +00:00
Pyun YongHyeon
cd96c3c984 Disable retrying RX descriptor loading. The counter is used to set
number of retry to be performed whenever controller found RX
descriptor was empty. RX empty interrupt is generated only when the
retry counter is over. Experimentation shows retrying RX descriptor
loading increased number of dropped frames under flow-control
enabled environments so disable it and have controller generate RX
empty interrupt as fast as it can.
While I'm here fix RXCSR_DESC_RT_CNT macro.
2010-11-26 01:48:29 +00:00
Weongyo Jeong
b443638277 Removes a unused function `usb_bus_find'. 2010-11-25 22:56:26 +00:00
Brian Somers
86e38263d2 Don't zero 'Info' after setting it up in the ASR_IOCTL_COMPAT case.
MFC after:	2 days
2010-11-25 21:51:43 +00:00
John Baldwin
9d76324839 Add device IDs for two more ServerWorks Host-PCI bridges so that we can
read their starting PCI bus number for older systems that do not support
ACPI (or have a broken _BBN method).

PR:		kern/148108
MFC after:	1 week
2010-11-25 15:42:33 +00:00
Weongyo Jeong
fe1c24e3d6 Handles the unit number correctly that the previous commit had a problem
(wrong unit number for a host controller) when the module is load /
unloaded repeatly.  Attaching the USB pf is moved to usbus device's
attach.

Pointed by:	yongari
2010-11-25 03:30:43 +00:00
Weongyo Jeong
537e254f0a Assigning the unit number for each interfaces could not use ubus->parent
because it could differ depending on the host controller type.  It could
lead the duplicate unit number assignment.
2010-11-25 03:02:53 +00:00
Jack F Vogel
12203744da The purpose of this change is to add a routine to
disable ASPM L0S and L1 LINK states on 82573, 82574,
and 82583. The theory is that this is behind certain
hangs being experienced by some customers.

Also included a small optimization in the rxeof routine
that was in my internal code.

Change the PBA size for pchlan, it was incorrect.

MFC after: 3 days
2010-11-24 22:24:07 +00:00
Weongyo Jeong
10798b4875 Fixes a compiler warning when it's compiled with INVARIANTS.
Pointy hat to:	me
2010-11-24 21:43:36 +00:00
Weongyo Jeong
e376f9c3e7 Removes all duplicated code with BPF that it's greatly simplified and
take all benefits whenever BPF code is improved.

Pointed by:	jkim
Reviewed by:	thompsa
2010-11-24 19:11:32 +00:00
Jack F Vogel
ffdb071a24 Add shared code glue for new 82580 devices. 2010-11-24 01:13:55 +00:00
Jack F Vogel
46b9f1ff9f - New 82580 devices supported
- Fixes from John Baldwin: vlan shadow tables made per/interface,
  make vlan hw setup only happen when capability enabled, and
  finally, make a tuneable interrupt rate. Thanks John!
- Tweaked watchdog handling to avoid any false positives, now
  detection is in the TX clean path, with only the final check
  and init happening in the local timer.
- limit queues to 8 for all devices, with 82576 or 82580 on
  larger machines it can get greater than this, and it seems
  mostly a resource waste to do so. Even 8 might be high but
  it can be manually reduced.
- use 2k, 4k and now 9k clusters based on the MTU size.
- rework the igb_refresh_mbuf() code, its important to
  make sure the descriptor is rewritten even when reusing
  mbufs since writeback clobbers things.

MFC: in a few days, this delta needs to get to 8.2
2010-11-23 22:12:02 +00:00
Marius Strobl
e0fe5c6dd3 - Sprinkle const on tables.
- Remove an alpha remnant.
- Minor comment and style fixes.
2010-11-23 21:09:42 +00:00
Weongyo Jeong
3c0efe7424 Fixes a kernel crash when usb module is reloaded after unload that it
didn't destroy the cdev properly.

Pointy hat to:	me
Reported by:	Brandon Gooch <jamesbrandongooch at gmail dot com>, jkim
2010-11-23 20:23:25 +00:00
Nick Hibma
294fe04afc Make the Huawei E1820 work (Emile Coetzee).
Shorten the descriptive strings for Huawei devices. The vendor or
operator name should not be included in the device name.

Submitted by:	Emile Coetzee
MFC after:	3 days
2010-11-23 08:15:14 +00:00
Alexander Motin
96ecb95ed9 Fix small typo.
Submitted by:	Artem Belevich
2010-11-22 23:04:25 +00:00
Marius Strobl
9a68cbd33d - Fix and enable support for flow control.
- Partially revert r172334; as it turns out the DELAYs in gem_reset_{r,t}x()
  are actually necessary although bus space barriers and gem_bitwait() are
  used, otherwise the controller may trigger an IOMMU errors on at least
  sparc64. This is in line with what Linux and OpenSolaris do.
2010-11-22 22:13:26 +00:00
Marius Strobl
36334c57d9 - Fix and enable support for flow control.
- Fix compilation with CAS_DEBUG defined.
2010-11-22 22:06:30 +00:00
Marius Strobl
a16ce54ca6 - Also probe BCM5214 and BCM5222.
- Add some DSP init code for BCM5221. The values derived from Apple's GMAC
  driver and the same init code also exists in Linux's sungem_phy driver.
- Only read media status bits when they are valid.

Obtained from:	NetBSD, OpenBSD
2010-11-22 22:03:11 +00:00
Jung-uk Kim
f68ff88c87 Resume critical PCI devices (and their children) first, then everything else
later.  This give us better chance to catch device driver problems.
2010-11-22 21:58:00 +00:00
Marius Strobl
4b9b1e1163 Add support for flow control.
Obtained from:	NetBSD (partially)
2010-11-22 21:24:29 +00:00
Marius Strobl
b84d962610 Given that unlike f.e. rgephy(4) these drivers doen't explicitly start an
autonegotiation along with manual media selection and also only report flow
control status when BMCR_AUTOEN is set (at least with gentbi(4) determining
the flow control status results in false-positives when not set), use
MIIF_NOMANPAUSE.
2010-11-22 21:20:11 +00:00
Marius Strobl
1aeedb9617 Given that unlike f.e. rgephy(4) this driver doesn't explicitly start an
autonegotiation along with manual media selection and ukphy_status() also
only reports flow control status when BMCR_AUTOEN is set (at least with
gentbi(4) determining the flow control status results in false-positives
when not set), use MIIF_NOMANPAUSE.
2010-11-22 21:13:42 +00:00
Marius Strobl
7a05baaebe Add missing newlines.
MFC after:	3 days
2010-11-22 20:57:44 +00:00
Andrew Gallatin
4ed8ca8f25 Fix a TSO checksum bug on mxge(4):
The Myri10GE NIC will assume all TSO frames contain partial checksum,
and will emit TSO segments with bad TCP checksums if a TSO frame
contains a full checksum.  The mxge driver takes care to make sure
that TSO is disabled when checksum offload is disabled for this
reason.  However, modules that modify packet contents (like pf) may
end up completing a checksum on a TSO frame, leading to the NIC emitting
TSO segments with bad checksums.

To workaround this, restore the partial checksum in the mxge driver
when we're fed a TSO frame with a full checksum.

Reported by: Bob Healey

MFC after:	3 days
2010-11-22 16:43:05 +00:00
Weongyo Jeong
18ec652552 Adds a USB packet filter feature to the stack that it could capture
packets which go through each USB host controllers.  Its implementations
are almost based on BPF code and very similar with it except it's
little bit customized for USB packet only.  The userland program
usbdump(8) would be committed soon.

Discussed with:	hps, thompsa, yongari
2010-11-22 01:11:28 +00:00
John Baldwin
d2014f5180 Various small typos and grammar nits in comments. 2010-11-18 22:17:20 +00:00
Alexander Motin
95e97044c7 Make ATA_CAM wrapper to report SATA power management capabilities to CAM to
make it configure device to initiate transitions if controller configured
to accept them. This makes hint.ata.X.pm_level=1 mode working.
2010-11-18 19:28:45 +00:00
Marius Strobl
bab85d8dcc Fix a bug introduced with r215298; when atphy_reset() is called from
atphy_attach() the current media has not been set, yet, leading to a
NULL-dereference in atphy_setmedia().

Submitted by:	jkim (initial version)
2010-11-18 17:58:59 +00:00
Alexander Motin
5c2a4ae217 Even if we are skipping SATA hard reset - set power management bits in
SControl register. This should make things consistent and help to avoid
unexpected PHY events that I've noticed in some cases on VIA controllers.
2010-11-18 11:58:17 +00:00
Alexander Motin
1f6aa21d47 Record that there is no devices if SATA reset found none. 2010-11-18 10:34:18 +00:00
Alexander Motin
ee597c8246 Some VIA SATA controllers provide access to non-standard SATA registers via
PCI config space. Use them to implement hot-plug and link speed reporting.
Tested on ASRock PV530 board with VX900 chipset.
2010-11-18 08:03:40 +00:00
Pyun YongHyeon
2f4fcd485d MCP55 is the only NVIDIA controller that supports VLAN tag
insertion/stripping and it also supports TSO over VLAN. Implement
TSO over VLAN support for MCP55 controller.

While I'm here clean up SIOCSIFCAP ioctl handler. Since nfe(4)
sets ifp capabilities based on various hardware flags in device
attach, there is no need to check hardware flags again in
SIOCSIFCAP ioctl handler. Also fix a bug which toggled both TX and
RX checksum offloading even if user requested either TX or RX
checksum configuration change.

Tested by:	Rob Farmer ( rfarmer <> predatorlabs dot net )
2010-11-17 18:09:02 +00:00
Alexander Motin
040545848d Add IDs for VIA VX900 chipset SATA controller.
(Missed part of r215428)
2010-11-17 17:52:04 +00:00
Alexander Motin
2cbfd42740 Add IDs for VIA VX900 chipset SATA controller.
MFC after:	1 week
2010-11-17 16:17:35 +00:00
Nathan Whitehorn
17a6d97402 Make drm(4) build, if not work reliably, on PowerPC. 2010-11-16 03:43:06 +00:00
Jung-uk Kim
8299c44bdd Restore the previous behaviour of substring match. 2010-11-15 23:38:52 +00:00
Jung-uk Kim
51460278cf Plug memory leakage introduced in r204989.
Reported by:	yongari
2010-11-15 23:13:25 +00:00
Pyun YongHyeon
b0630da9ad Plug memory leakage introduced in r215327.
Submitted by:	jkim
2010-11-15 22:05:08 +00:00
Marius Strobl
d0fae855ef Return from mii_attach() after calling bus_generic_attach(9) on the device_t
of the MAC driver in order to attach miibus(4) on the first pass instead of
falling through to also calling it on the device_t of miibus(4). The latter
code flow was intended to attach the PHY drivers the same way regardless of
whether it's the first or a repeated pass, modulo the bus_generic_attach()
call in miibus_attach() which shouldn't be there. However, it turned out
that these variants cause miibus(4) to be attached twice under certain
conditions when using MAC drivers as modules.

Submitted by:	yongari
MFC after:	3 days
2010-11-15 21:41:45 +00:00
Kevin Lo
7dc246bc0f Remove unused struct rue_type 2010-11-15 06:04:25 +00:00
Doug Barton
eb581844e4 Remove references to MAKEDEV(8) 2010-11-15 05:25:51 +00:00
Andrew Thompson
fcc8d2e17b Add the Sierra MC8700. 2010-11-15 02:27:01 +00:00
Pyun YongHyeon
64436f6e91 Add flow control for all re(4) controllers. re(4) controllers do
not provide any MAC configuration interface for resolved flow
control parameters. There is even no register that configures water
mark which will control generation of pause frames.
However enabling flow control surely enhanced performance a lot.
2010-11-15 00:06:19 +00:00
Pyun YongHyeon
aee0e78619 Add flow control for 3C905B and newer controllers. Note, these
controllers support RX pause only.

Reviewed by:	marius
2010-11-14 23:53:13 +00:00
Pyun YongHyeon
7e7a45ce6f P5N32-SLI PREMIUM from ASUSTeK is known to have MSI/MSI-X issue
such that nfe(4) does not work with MSI-X. When MSI-X support was
introduced, I remember MCP55 controller worked without problems so
the issue could be either PCI bridge or BIOS issue. But I also
noticed snd_hda(4) disabled MSI on all MCP55 chipset so I'm still
not sure this is generic issue of MCP55 chipset. If this was PCI
bridge issue we would have added it to a system wide black-list
table but it's not clear to me at this moment whether it was caused
by either broken BIOS or silicon bug of MCP55 chipset.

To workaround the issue, maintain a MSI/MSI-X black-list table in
driver and lookup base board manufacturer and product name from the
table before attempting to use MSI-X. If driver find an matching
entry, nfe(4) will not use MSI/MSI-X and fall back on traditional
INTx mode. This approach should be the last resort since it relies
on smbios and if another instance of MSI/MSI-X breakage is reported
with different maker/product, we may have to get the PCI bridge
black-listed instead of adding an new entry.

PR:	kern/152150
2010-11-14 23:37:43 +00:00
Dima Dorfman
b2e7926915 Add a special INIT product ID used by some models of the HUAWEI
K3765 datacard. After ejecting this device, it reappears using
the normal K3765 ID. It does not switch automatically

Reviewed by:	n_hibma
Obtained from:	OpenBSD
MFC after:	2 weeks
2010-11-14 23:05:57 +00:00
Marius Strobl
d6a4eec458 Use the correct variable for determining the verbosity level in mpt_lprtc().
While at it, fix the whitespace of that macro.

PR:		149502
Submitted by:	Andrew Boyer
MFC after:	1 week
2010-11-14 22:34:33 +00:00
Marius Strobl
fb772a6c98 Move the limiting of the PHY to 10/100 modes of operation due to limitations
of certain MAC models from brgphy(4) to bge(4) where it belongs. While at it,
update the list of models having that restriction to what OpenBSD uses, which
in turn seems to have obtained that information from the Linux tg3 driver.
2010-11-14 15:15:22 +00:00
Marius Strobl
78102c2f8b Remove redundant cases and a style(9) bug. 2010-11-14 14:25:04 +00:00
Marius Strobl
991ab941ee - Change these drivers to take advantage and use the generic IEEE 802.3
annex 31B full duplex flow control as well as the IFM_1000_T master
  support committed in r215297. For atphy(4) and jmphy(4) this includes
  changing these PHY drivers to no longer unconditionally advertise
  support for flow control but only if the selected media has IFM_FLOW
  set (or MIIF_FORCEPAUSE is set).
- Rename {atphy,jmphy}_auto() to {atphy,jmphy}_setmedia() as these handle
  other media types as well.

Reviewed by:	yongari (plus additional testing)
Obtained from:	NetBSD (partially), OpenBSD (partially)
MFC after:	2 weeks
2010-11-14 13:31:01 +00:00
Marius Strobl
efd4fc3fb3 o Flesh out the generic IEEE 802.3 annex 31B full duplex flow control
support in mii(4):
  - Merge generic flow control advertisement (which can be enabled by
    passing by MIIF_DOPAUSE to mii_attach(9)) and parsing support from
    NetBSD into mii_physubr.c and ukphy_subr.c. Unlike as in NetBSD,
    IFM_FLOW isn't implemented as a global option via the "don't care
    mask" but instead as a media specific option this. This has the
    following advantages:
    o allows flow control advertisement with autonegotiation to be
      turned on and off via ifconfig(8) with the default typically
      being off (though MIIF_FORCEPAUSE has been added causing flow
      control to be always advertised, allowing to easily MFC this
      changes for drivers that previously used home-grown support for
      flow control that behaved that way without breaking POLA)
    o allows to deal with PHY drivers where flow control advertisement
      with manual selection doesn't work or at least isn't implemented,
      like it's the case with brgphy(4), e1000phy(4) and ip1000phy(4),
      by setting MIIF_NOMANPAUSE
    o the available combinations of media options are readily available
      from the `ifconfig -m` output
  - Add IFM_FLOW to IFM_SHARED_OPTION_DESCRIPTIONS and IFM_ETH_RXPAUSE
    and IFM_ETH_TXPAUSE to IFM_SUBTYPE_ETHERNET_OPTION_DESCRIPTIONS so
    these are understood by ifconfig(8).
o Make the master/slave support in mii(4) actually usable:
  - Change IFM_ETH_MASTER from being implemented as a global option via
    the "don't care mask" to a media specific one as it actually is only
    applicable to IFM_1000_T to date.
  - Let mii_phy_setmedia() set GTCR_MAN_MS in IFM_1000_T slave mode to
    actually configure manually selected slave mode (like we also do in
    the PHY specific implementations).
  - Add IFM_ETH_MASTER to IFM_SUBTYPE_ETHERNET_OPTION_DESCRIPTIONS so it
    is understood by ifconfig(8).
o Switch bge(4), bce(4), msk(4), nfe(4) and stge(4) along with brgphy(4),
  e1000phy(4) and ip1000phy(4) to use the generic flow control support
  instead of home-grown solutions via IFM_FLAGs. This includes changing
  these PHY drivers and smcphy(4) to no longer unconditionally advertise
  support for flow control but only if the selected media has IFM_FLOW
  set (or MIIF_FORCEPAUSE is set) and implemented for these media variants,
  i.e. typically only for copper.
o Switch brgphy(4), ciphy(4), e1000phy(4) and ip1000phy(4) to report and
  set IFM_1000_T master mode via IFM_ETH_MASTER instead of via IFF_LINK0
  and some IFM_FLAGn.
o Switch brgphy(4) to add at least the the supported copper media based on
  the contents of the BMSR via mii_phy_add_media() instead of hardcoding
  them. The latter approach seems to have developed historically, besides
  causing unnecessary code duplication it was also undesirable because
  brgphy_mii_phy_auto() already based the capability advertisement on the
  contents of the BMSR though.
o Let brgphy(4) set IFM_1000_T master mode on all supported PHY and not
  just BCM5701. Apparently this was a misinterpretation of a workaround
  in the Linux tg3 driver; BCM5701 seem to require RGPHY_1000CTL_MSE and
  BRGPHY_1000CTL_MSC to be set when configuring autonegotiation but
  this doesn't mean we can't set these as well on other PHYs for manual
  media selection.
o Let ukphy_status() report IFM_1000_T master mode via IFM_ETH_MASTER so
  IFM_1000_T master mode support now is generally available with all PHY
  drivers.
o Don't let e1000phy(4) set master/slave bits for IFM_1000_SX as it's
  not applicable there.

Reviewed by:	yongari (plus additional testing)
Obtained from:	NetBSD (partially), OpenBSD (partially)
MFC after:	2 weeks
2010-11-14 13:26:10 +00:00
Xin LI
add5afdc93 Workaround build for PAE case for now - revert the PHYS
case to previous panic behavior.

I have a real fix that changes the sg dma tag allocation
to be limited to the under 4GB address space but would
prefer to have review before committing.
2010-11-14 05:05:41 +00:00
Nick Hibma
c175c7deff Add the switch config for the XS Stick.
It speaks AT commands on 2 out of 3 serial ports, but it has not been
verified to work at all speaking PPP yet.
2010-11-13 20:45:16 +00:00
Hans Petter Selasky
876cab6fc2 Fix compiler warnings.
Submitted by:	Alexander Best (arundel)
Approved by:	thompsa (mentor)
2010-11-13 19:26:45 +00:00
Xin LI
231c8b7113 Update to vendor release 1.20.00.19.
Bug fixes:
  * Fixed "inquiry data fails comparion at DV1 step"
  * Fixed bad range input in bus_alloc_resource for ADAPTER_TYPE_B
  * Fixed arcmsr driver prevent arcsas support for Areca SAS HBA ARC13x0

Many thanks to Areca for continuing to support FreeBSD.

This commit is intended for MFC before 8.2-RELEASE.

Submitted by:   Ching-Lung Huang <ching2048 areca com tw>
2010-11-13 08:58:36 +00:00
Pyun YongHyeon
603b8e29db Fix regression introduced in r215132. Caller always holds a driver
lock before accessing mii, so locking is not needed here.

Reported by:	Rob Farmer (rfarmer <> predatorlabs dot net)
2010-11-12 19:33:13 +00:00
Jung-uk Kim
68d5e11c9f Create C1 state when _CST is valid but _CST does not have one. Some BIOSes
do not report C1 state in _CST object, probably because it is a mandatory
state with or without existence of the optional _CST.

Reviewed by:	avg
2010-11-12 17:10:12 +00:00
Andrew Thompson
54873b4cd6 Add a GPIO driver for the Gateworks Cambria platform.
The external gpio pins are connected to a PLD on the i2c bus, unfortunatley
this device does not conform by failing to send an ack after each byte written.
The iicbb driver will abort the transfer when the address is not ack'd and it
would introduce a lot of churn to be able to pass a flag down to
iicbb_start/iicbb_write. Instead we do bad things by grabbing the iicbus but
then doing our own bit banging.
2010-11-11 20:18:33 +00:00
Pyun YongHyeon
52a1393e4c Add basic WOL support for MCP ethernet controllers. It seems the
controller does not perform automatic switching from 1000Mbps link
to 10/100Mbps link when WOL is activated. Implement establishing
10/100Mps link with auto-negotiation in driver. Link status change
handler was modified to remove taskqueue based approach since driver
now needs synchronous handling for link establishment.

Submitted by:	Yamagi Burmeister (lists <> yamagi.org ) (initial version)
Tested by:	Yamagi Burmeister (lists <> yamagi.org )
MFC after:	1 week
2010-11-11 18:08:50 +00:00
Rafal Jaworowski
96fe0b3552 Return IEEE 1275 compliant error codes.
Submitted by:	nwhitehorn
2010-11-11 13:42:46 +00:00
Nick Hibma
0ea0127a4d Add a man page for usb_quirk module, plus references in other man pages,
and updated comments in the usb_quirk.h header file.

The main purpose of this is to expose the quirks for ejecting 3G
modules. usb_modeswitch in Linux does a great job of collecting
information on these, and with the quirks module people can try out the
modeswitch config file entries on FreeBSD, hence the SCSI strings in the
man page.

MFC after:	2 weeks
2010-11-10 23:45:44 +00:00
Jung-uk Kim
93a8847473 Make APM emulation look more closer to its origin. Use device_get_softc(9)
instead of hardcoding acpi(4) unit number as we have device_t for it.
2010-11-10 18:50:12 +00:00
Nick Hibma
e7702e9e1b Allow specification of eject method through quirks, so people can test
drive eject methods before supplying patches.
2010-11-10 18:41:38 +00:00
Jung-uk Kim
7c2bf852d7 Refactor acpi_machdep.c for amd64 and i386, move APM emulation into a new
file acpi_apm.c, and place it on sys/x86/acpica.
2010-11-10 01:29:56 +00:00
Nathan Whitehorn
0bad71a347 Make all OF client interface calls return the maximum kind of
does-not-exist error when no client interface module is installed instead
of dereferencing NULL pointers. This eases implementation of platforms
that may or may not have Open Firmware.
2010-11-09 19:45:29 +00:00
Rebecca Cran
b1ce21c6ef Fix typos.
PR:	bin/148894
Submitted by:	olgeni
2010-11-09 10:59:09 +00:00
Pyun YongHyeon
5e6906ee36 Only moderate TX completion interrupts. Relying on taskqueue to
suppress RX interrupts seems to give better RX performance than
RX interrupt moderation.
2010-11-09 01:52:09 +00:00
Pyun YongHyeon
483cc44070 Follow the lead of vendor's interrupt moderation mechanism.
It seems RTL8169/RTL8168/RTL810xE has a kind of interrupt
moderation mechanism but it is not documented at all. The magic
value dramatically reduced number of interrupts without noticeable
performance drops so apply it to all RTL8169/RTL8169 controllers.
Vendor's FreeBSD driver also applies it to RTL810xE controllers but
their Linux driver explicitly cleared the register, so do not
enable interrupt moderation for RTL810xE controllers.

While I'm here sort 8169 specific registers.

Obtained from:	RealTek FreeBSD driver
2010-11-08 21:50:50 +00:00
Juli Mallett
e875cf292c Recognize the BCM5482S. 2010-11-08 21:23:28 +00:00
Nathan Whitehorn
134a9563c7 Provide support for IIC_M_NOSTOP/IIC_M_NOSTART for bit-banging and
otherwise low-level controllers.

Reviewed by:	thompsa
2010-11-08 19:53:16 +00:00
Jung-uk Kim
affa18265a Consistently use padding `_' in the comment. 2010-11-08 19:52:14 +00:00
Pyun YongHyeon
2bc085c69c Reduce spin wait time consumed in GMII register access routine.
There were a couple of attempts in the past to reduce it since it
took more than 1ms. Because mii_tick() periodically polls link
status, waiting more than 1ms for each GMII register access was
overkill. Unfortunately all previous attempts were failed with
various ways on different controllers.
This time, add additional 20us dealy at the end of GMII register
access which seems to requirement of all RealTek controllers to
issue next GMII register access request. This is the same way what
Linux does.
2010-11-08 19:15:31 +00:00
Alexander Motin
ba3a999598 Teach ahci(4), siis(4) and ATA_CAM ata(4) wrapper report to CAM residual
I/O length on underruns, that often happens for some SCSI commands.
2010-11-08 15:36:15 +00:00
Andrew Thompson
cac6df751b Set the pin to output on attach, we can't assume it already is.
Reviewed by:	gonzo
2010-11-08 03:08:01 +00:00
Nick Hibma
96a6480a53 Bugfix: Set the bit that marks a device number in use.
This would cause a panic when disconnecting the second serial device.

Submitted by:	Lucius Windschuh
2010-11-07 15:36:07 +00:00
Marius Strobl
97901c4bc9 Fix indentation in r213894. 2010-11-07 12:29:26 +00:00
Pyun YongHyeon
fec5229ac0 Fix a long standing bug in programming station address for Yukon
controllers. sk(4) never reprogrammed station address for Yukon
controllers so overriding station address with ifconfig(8) was not
possible.
Fix the bug by reprogramming all registers that control station
address, flow-control and virtual station address. Virtual station
address has no use at this moment since driver does not make use of
fail over feature.

Tested by:	"Mikhail T." <mi+thun <> aldan.algebra.com>
MFC after:	1 week
2010-11-06 22:07:22 +00:00
Pyun YongHyeon
adfe075ce0 If we got an invalid station address, generate random address. This
might be caused by broken BIOS.

Reported by:	"Mikhail T." <mi+thun <> aldan.algebra.com>
MFC after:	1 week
2010-11-06 21:54:32 +00:00
Alexander Motin
285ba17329 Mark command submission timeouts as timeouts. This should trigger device
resets and increase chances of getting device back again.
2010-11-06 19:11:49 +00:00
Bernhard Schmidt
a7c6aabdc3 Instead of using the AMRR ratectl algo as default for drivers which have
the IEEE80211_C_RATECTL flag set, default to NONE for all drivers. Only if
a driver calls ieee80211_ratectl_init() check if the NONE algo is still
selected and try to use AMRR in that case. Drivers are still free to use
any other algo by calling ieee80211_ratectl_set() prior to the
ieee80211_ratectl_init() call.

After this change it is now safe to assume that a ratectl algo is always
available and selected, which renders the IEEE80211_C_RATECTL flag pretty
much useless. Therefore revert r211314 and 211546.

Reviewed by:	rpaulo
MFC after:	2 weeks
2010-11-06 18:17:20 +00:00
Alexander Motin
618c8d01f2 Add support for odd-sized PIO transfers, sometimes used by ATAPI. 2010-11-06 14:22:50 +00:00
Nick Hibma
b38fd2d93c Bugfix: In rev 213509 Alexander committed a duplicate ID for ZTE STOR
based devices (QUALCOMMINC 0x2000). He made it use SCSI eject instead of
ZTE STOR eject. This prevented my ZTE MF626 dongle from switching.

- Apply both eject methods for ZTE STOR based devices. Works on my as
  well as mav's device.
- Remove the duplicate.
- Sort the usbdevs entries for Qualcomm so this won't happen again.
- Add bootverbose message displaying the fact that we are ejecting (and
  how).

Reviewed by:	mav
MFC after:	2 weeks
2010-11-05 21:17:55 +00:00
Jung-uk Kim
e7bb9ab605 Add a forgotten change from the previous commit. 2010-11-05 20:24:26 +00:00
Jung-uk Kim
9fe3e6c023 Fix a use-after-free bug for extended IRQ resource[1]. When _PRS buffer is
copied as a template for _SRS, a string pointer for descriptor name is also
copied and it becomes stale as soon as it gets de-allocated[2].  Now _CRS is
used as a template for _SRS as ACPI specification suggests if it is usable.
The template from _PRS is still utilized but only when _CRS is not available
or broken.  To avoid use-after-free the problem in this case, however, only
mandatory fields are copied, optional data is removed, and structure length
is adjusted accordingly.

Reported by:	hps[1]
Analyzed by:	avg[2]
Tested by:	hps
2010-11-05 19:50:09 +00:00
Marius Strobl
8edfedadeb Correct an inverted check in r213893. 2010-11-05 19:38:28 +00:00
Pyun YongHyeon
0534aae0ce Add simple MAC statistics counter reading support. Unfortunately
useful counters like rl_missed_pkts is 16 bits quantity which is
too small to hold meaningful information happened in a second. This
means driver should frequently read these counters in order not to
lose accuracy and that approach is too inefficient in driver's
view. Moreover it seems there is no way to trigger an interrupt to
detect counter near-full or wraparound event as well as lacking
clearing the MAC counters. Another limitation of reading the
counters from RealTek controllers is lack of interrupt firing at
the end of DMA cycle of MAC counter read request such that driver
have to poll the end of the DMA which is a time consuming process
as well as inefficient. The more severe issue of the MAC counter
read request is it takes too long to complete the DMA. All these
limitation made maintaining MAC counters in driver impractical. For
now, just provide simple sysctl interface to trigger reading the
MAC counters. These counters could be used to track down driver
issues. Users can read MAC counters maintained in controller with
the following command.
#sysctl dev.re.0.stats=1

While I'm here add check for validity of dma map and allocated
memory before unloading/freeing them.

Tested by:	rmacklem
2010-11-05 19:28:00 +00:00
Nick Hibma
6416c259d4 Implement ucom_set_pnpinfo_usb() providing ttyname and port number
information through devd. My E220 now produces the notification (1 line):

	+u3g0 at bus=1 hubaddr=1 port=0 devaddr=2 interface=0 \
	vendor=0x12d1 product=0x1003 devclass=0x00 devsubclass=0x00 \
	sernum="" release=0x0000 intclass=0xff intsubclass=0xff \
	ttyname=U0 ttyports=2 on uhub0

Note: serial/ufoma and net/uhso still provide port number and tty name
(uhso only) information through sysctls, which should now be removed.

Reviewed by:	hpselasky
2010-11-05 19:12:48 +00:00
Pyun YongHyeon
63472df74a style(9). 2010-11-05 18:24:50 +00:00
Pyun YongHyeon
4baa031067 Remove extra white spaces. 2010-11-05 18:23:43 +00:00
Pyun YongHyeon
66366ca4bf Enable 64bit DMA addressing for RTL810xE/RTL8168/RTL8111 PCIe
controllers. Some old PCI controllers may work with DAC but it was
known to be buggy so 64bit DMA addressing is used only on PCIe
controllers.
2010-11-05 18:19:54 +00:00
Nick Hibma
761481dc63 - Remove an unused entry from the softc (only used in a debugging printf).
- Fix the loop count on detach (causing a panic on detaching a serial
  dongle).
- Increase a buffer in case some driver want extra long tty device names
  (postfixing the purpose of the tty for example, e.g. u3g.ppp).
2010-11-05 09:06:23 +00:00
Nick Hibma
0834ed4757 Bugfix: Move the 'at <location string' to the beginning of the attach
notification. devd would stop evaluating at 'at' (not '<k>=<v>') and
hence prevent 'port=X' (and 'bus=<"on" string>) from making it into the
environment for the devd action.

Reviewed by:	hselasky
MFC after:	2 weeks
2010-11-05 08:30:16 +00:00
Nick Hibma
6df3eebb63 Don't terminate the notification with \n. This is done in
usb_device.c:devctl_notify_f().
2010-11-04 21:06:36 +00:00
Hans Petter Selasky
cbb75751a7 Add code to warm reset a USB 3.0 port.
Approved by:	thompsa (mentor)
2010-11-04 19:24:21 +00:00
Hans Petter Selasky
d74698ca2e Add new USB quirk.
Submitted by:	Dmitry Luhtionov
Approved by:	thompsa (mentor)
2010-11-04 19:05:35 +00:00
Jung-uk Kim
495a414454 Adjust a comment to clarify why \_SB_ and \_TZ_ are defined as device type
in ACPICA.  Reshuffle the code a bit to make sure this kludge only applies
to these two specical cases and to make it cleaner.
2010-11-03 23:16:35 +00:00
Nick Hibma
015bb88ff2 - Simplify the way unit/subunit allocation is done in ucom.
- hw.usb.ucom.cons_unit is now split into
  hw.usb.ucom.cons_unit/...cons_subunit.

Note: The tunable/sysctl hw.usb.ucom.cons_unit needs to be reviewed if

a) a console was defined a USB serial devices, and a USB device with
more than 1 subunit is present, and this device is attached before the
device functioning as a console

or

b) a console was defined on a USB device with more than 1 subunit

Reviewed by:	hps
MFC after:	2 weeks
2010-11-03 21:50:49 +00:00
Hans Petter Selasky
8908d48d82 Clean up leftover USB device ID after r213856. This fixes:
options USB_VERBOSE

Submitted by:	Lucius Windschuh
Approved by:	thompsa (mentor)
2010-11-03 07:51:33 +00:00
Alexander Motin
82d2b37bc0 Remove stale line, accidentally slipped into r214016.
MFC after:	3 days
2010-11-02 09:31:24 +00:00
Jack F Vogel
e4c690b4f0 Sync the lem code up with the vlan and other fixes in em.
Delete a unneeded test from the beginning of em_xmit.
CRITICAL: shared code fix for 82574, a mutex might not be
          released, this can cause hangs.
2010-11-01 20:19:25 +00:00
Marius Strobl
e598f12273 Turn a panic into a printf so IFM_ETH_MASTER on !IFM_1000_T is complained
about but otherwise ignored. When allowing the master to be set manually via
ifconfig(8) by adding the former to IFM_SUBTYPE_ETHERNET_OPTION_DESCRIPTIONS
(as it should be) it seems to be unfavorable that a machine can be made to
panic with a simple ifconfig(8) invocation.
2010-10-31 22:59:49 +00:00
Marius Strobl
3b18190fe9 Try to make the style consistent (including regarding NetBSD bits not yet
merged) and adhere style(9).
2010-10-31 22:46:39 +00:00
Marius Strobl
4a446e3e8e Make a comment reflect reality. 2010-10-31 22:41:53 +00:00
Nathan Whitehorn
50fd2a5b9c Add a driver for the Apple Uninorth AGP host bridge found in all PowerPC
Macintoshes with an AGP bus.
2010-10-31 18:27:05 +00:00
Marius Strobl
f5a1822131 Correct a bug in r213893; within a PHY driver MIIF_PHYPRIVn should be used
instead of MIIF_MACPRIVn. This didn't make a functional difference though.
2010-10-30 20:51:25 +00:00
Pyun YongHyeon
d0b2f7efb7 Don't bother to enable ASPM L1 to save more power. Even though I am
not able to trigger the issue with sample boards, some users seems
to suffer from freeze/lockup when system is booted without UTP cable
plugged in. I'm not sure whether this is BIOS issue or controller
bug. This change fixes AR8132 lockup issue seen on EEE PC.

Reported by:	kmoore
Tested by:	kmoore
2010-10-30 01:12:54 +00:00
Justin T. Gibbs
8f1382d1f2 sys/dev/xen/blkback/blkback.c:
In xbb_detach() only perform cleanup of our taskqueue and
	device statistics structures if they have been initialized.
	This avoids a panic when xbb_detach() is called on a partially
	initialized device instance, due to an early failure in
	attach.

Sponsored by:	Spectra Logic Corporation
2010-10-28 04:14:28 +00:00
Jack F Vogel
35928b338e In the data setup code for doing offloads the
ip and tcp pointers were not reset after some
pullups. In practice this led to an NFS mount
failure when using UDP reported by Kevin Lo,
thanks Kevin. Fix from yongari, thank you!
2010-10-28 00:16:54 +00:00
Hans Petter Selasky
8427ed847d Add support for setting per-interface PnP information.
Submitted by:	Nick Hibma
Approved by:	thompsa (mentor)
2010-10-27 17:38:05 +00:00
Pyun YongHyeon
1108273af4 Add initial BCM5718 family support. The BCM5718 family includes
the dual port BCM5717 and BCM5718 devices which are intended for
mainstream workstation and entry-level server designs and
represents the twelfth generation of NetXtreme Ethernet controllers.
This family is the successor to the BCM5714/BCM5715 family and
supports IPv4/IPv6 checksum offloading, TSO, VLAN hardware tagging,
jumbo frames, MSI/MSIX, IOV, RSS and TSS.

This change set supports all hardware features except IOV and
RSS/TSS. Unlike its predecessors, only extended RX buffer
descriptors can be posted to the jumbo producer ring. Single RX
buffer descriptors for jumbo frame are not supported. RSS requires
a more substantial set of changes and will apply to a larger set
of NetXtreme devices so RSS/TSS multi-queue support will be
implemented in a future releases.

Special thanks to Broadcom who kindly sent a sample board to me
and to davidch who gave provided the initial support code.

Submitted by:	davidch (initial version)
HW donated by:	Broadcom
2010-10-27 17:20:19 +00:00
Pyun YongHyeon
f8d8720ebc Add BCM5717C 10/100/1000TX PHY id. 2010-10-27 17:16:40 +00:00
Jung-uk Kim
ae19af49e0 Add two new loader tunables 'hw.acpi.install_interface' and
'hw.acpi.remove_interface'.  hw.acpi.install_interface lets you install new
interfaces.  Conversely, hw.acpi.remove_interface lets you remove OS
interfaces from the pre-defined list in ACPICA.  For example,

	hw.acpi.install_interface="FreeBSD"

lets _OSI("FreeBSD") method to return 0xffffffff (or success) and

	hw.acpi.remove_interface="Windows 2009"

lets _OSI("Windows 2009") method to return zero (or failure).  Both are
comma-separated lists and leading white spaces are ignored.  For example,
the following examples are valid:

	hw.acpi.install_interface="Linux, FreeBSD"
	hw.acpi.remove_interface="Windows 2006, Windows 2006.1"
2010-10-26 18:59:50 +00:00
Jack F Vogel
7deff7f9b4 Bug fix delta to the em driver:
- Chasin down bogus watchdogs has led to an improved
	  design to this handling, the hang decision takes
	  place in the tx cleanup, with only a simple report
	  check in local_timer. Our tests have shown no false
	  watchdogs with this code.
	- VLAN fixes from jhb, the shadow vfta should be per
	  interface, but as global it was not. Thanks John.
	- Bug fixes in the support for new PCH2 hardware.
	- Thanks for all the help and feedback on the driver,
	  changes to lem with be coming shortly as well.
2010-10-26 00:07:58 +00:00
Nathan Whitehorn
495ed64c16 The EHCI_CAPLENGTH and EHCI_HCIVERSION registers are actually sub-registers
within the first 4 bytes of the EHCI memory space. For controllers that
use big-endian MMIO, reading them with 1- and 2-byte reads would then
return the wrong values. Instead, read the combined register with a 4-byte
read and mask out the interesting quantities.
2010-10-25 15:51:43 +00:00
Alexander Motin
6ea7128dbd Make hw.snd.vpc_0db to be also a loader tunable. 2010-10-25 08:25:44 +00:00
Alexander Motin
5b9392e840 Add missing mtx_destroy() on channel attach failure. 2010-10-25 07:41:21 +00:00
Pyun YongHyeon
713ca255b8 Add TSO support over VLAN for i82550/i82551. Controller requires
VLAN hardware tagging to make TSO work over VLAN. So if VLAN
hardware tagging is disabled explicitly clear TSO over VLAN. While
I'm here allow disabling VLAN TX checksum offloading.

Tested by:	Liudas < liudasb <> centras dot lt >
MFC after:	10 days
2010-10-24 21:59:51 +00:00
Pyun YongHyeon
427d3f3322 Use bge_chipid to compare controller ids. r214251 incorrectly used
bge_chiprev.

Reported by:	Buganini <buganini <> gmail dot com >
2010-10-24 20:54:46 +00:00
Marius Strobl
4a1f2d1b35 - Given that as of r214264 all PHY drivers using mii(4) finally have been
converted to use the mii_phy_add_media()/mii_phy_setmedia() pair instead
  of mii_add_media()/mii_anar() remove the latter.
- Declare mii_media mii_media_table static as it shouldn't be used outside
  of mii_physubr.c.

MFC after:	never
2010-10-24 12:59:43 +00:00
Marius Strobl
bcbab52daf - Add IFM_10_2 and IFM_10_5 media via tlphy(4) only in case the respective
interface also has such connectors.
- In tl_attach() unify three different ways of obtaining the device and
  vendor IDs and remove the now obsolete tl_dinfo from tl_softc.
- Given that tlphy(4) only handles the integrated PHYs of NICs driven by
  tl(4) make it only probe on the latter.
- Switch mlphy(4) and tlphy(4) to use mii_phy_add_media()/mii_phy_setmedia().
- Simplify looking for the respective companion PHY in mlphy(4) and tlphy(4)
  by ignoring the native one by just comparing the device_t's directly rather
  than the device name.
2010-10-24 12:51:02 +00:00
Marius Strobl
743d2b468a Take advantage of mii_phy_add_media()/mii_phy_setmedia(). 2010-10-24 11:38:25 +00:00
Marius Strobl
f6613deb1f - Take advantage of mii_phy_dev_probe().
- Use mii_phy_add_media() instead of mii_add_media(). I'm not sure how
  this driver actually managed to work before as mii_add_media() is
  intended to be used to gether with mii_anar() while mii_phy_add_media()
  is intended to be used with mii_phy_setmedia(), however this driver
  mii_add_media() along with mii_phy_setmedia().
2010-10-24 11:37:01 +00:00
Pyun YongHyeon
ca4f898699 Apply the same workaround for SDI flow control used on BCM5906 A1
to BCM6906 A0/A2. This should fix a long standing BCM5906 A2 lockup
issues. Data sheet explicitly mentions BCM5906 A0, A1 and A2 use
de-pipelined mode on these revisions.
Special thanks to Buganini who tried all combinations of
experimental patches for more than 10 days.

Tested by:	Buganini <buganini <> gmail dot com >
2010-10-23 21:25:50 +00:00
Bernhard Schmidt
82510b7eca The firmware does pad notifications to an even number of bytes (at least
the association notification), the included information though always
contains an elem block with an odd number of bytes. We handle the last
byte as if it might contain a whole elem block, this of course is not
true as one byte is not enough to hold a block, we therefore discard the
complete frame. The solution here is to subtract one from the actual
notification length, this is also what the Linux driver does. With this
change the frames ends exactly where the last elem block ends.

This commit also reverts r214160 which is no longer required and now even
wrong.

MFC after:	1 week
2010-10-23 11:26:22 +00:00
Hans Petter Selasky
8bb77249db Add possibility to generate devctl notifications regardless of UGEN presence.
Submitted by:  Nick Hibma
Approved by:    thompsa (mentor)
2010-10-22 20:13:45 +00:00
Pyun YongHyeon
8d5f71818f Add workaround for BCM5906 A1 controller silicon bug. When
auto-negotiation results in half-duplex operation, excess collision
on the ethernet link may cause internal chip delays that may result
in subsequent valid frames being dropped due to insufficient
receive buffer resources. The workaround is to choose de-pipeline
method as a flow control decision for SDI. De-pipeline method
allows only 1 data in TxMbuf at a time such that a request to RDMA
from SDI is made only when TxMbuf is empty. Thanks for david for
providing detailed errata information.
2010-10-22 19:30:56 +00:00
Pyun YongHyeon
f6a6548885 Enable TX MAC state machine lockup fix for both BCM5755 or higher
and BCM5906. Publicly available data sheet just says it may happen
due to corrupted TxMbuf.
2010-10-22 18:31:44 +00:00
John Baldwin
ba577448a2 - Add a new PCI quirk to whitelist an old chipset that doesn't support
PCI-express or PCI-X capabilities if we are running in a virtual machine.
- Whitelist the Intel 82440 chipset used by QEMU.

Tested by:	jfv
MFC after:	1 week
2010-10-22 11:42:02 +00:00
Bernhard Schmidt
9f95314538 The firmware always sets bit 14 and 15, to get the real associd we need
to clear those bits.

MFC after:	1 week
2010-10-21 19:30:55 +00:00
Bernhard Schmidt
f3c95fe748 Instead of calling return when reaching the end of the assoc notification
break the loop instead. We want to run the code after the while loop
to set an associd and capinfo. If we don't do this net80211 will drop
frames because it assumes the node has not yet been associated.

MFC after:	1 week
2010-10-21 19:28:52 +00:00
John Baldwin
fb2439a6f6 Clarify a misleading comment. The test in pci_reserve_map() was meant to
ignore BARs that are invalid due to having a size of zero, not to ignore
BARs with an existing base of zero.  While here, reorganize the code
slightly to make the intent clearer.

Reported by:	avg
MFC after:	1 week
2010-10-21 17:46:23 +00:00
Sergey Kandaurov
d63e9da300 Update PD state firmware definitions: add copyback, system.
Reviewed by:	jhb
Approved by:	avg (mentor)
MFC after:	1 week
2010-10-21 10:38:52 +00:00
Jung-uk Kim
d815d0abb7 Update PCI power management registers per PCI Bus Power Management Interface
Specification Rev. 1.2.  Rename pp_pcmcsr field of PM capabilities to pp_bse
to avoid further confusions and adjust some comments accordingly.  The real
PMCSR (Power Management Control/Status Register) is PCIR_POWER_STATUS and
it is actually BSE (PCI-to-PCI Bridge Support Extensions) register.
2010-10-20 23:41:16 +00:00
Jung-uk Kim
f3e0b10973 Introduce a new tunable 'hw.pci.do_power_suspend'. This tunable lets you
avoid PCI power state transition from D0 to D3 for suspending case.  Default
is 1 or enabled.
2010-10-20 16:47:09 +00:00
Jung-uk Kim
347263c935 Do not apply do_power_resume for suspending P2P bridge as we did in r214064. 2010-10-20 16:40:14 +00:00
Alexander Motin
6c87235098 Workaround strange situation when EDMA_RESQIP register returns zero instead
of proper value. It caused bunch of "EMPTY CRPB" messages and potentially
may cause premature requests completion, which could cause data corruption.
For most cases it seems enough to just reread register to get proper value.
To protect against worse cases - erase processed queue entries with
impossible values and ignore them if problem still happen.
2010-10-20 07:47:31 +00:00
Alexander Motin
c0609c547a Some style cleanup:
- remove commented debugging code;
- wrap long lines.
2010-10-20 07:22:34 +00:00
Pyun YongHyeon
69b5727f16 Correct handling of shared interrupt in sis_intr(). r212116 incorrectly
released a drver lock for shared interrupt case such that it caused
panic. While I'm here check whether driver is still running before
serving TX/RX handler.

Reported by:	Jerahmy Pocott < QUAKENET1 <> optusnet dot com dot au >
Tested by:	Jerahmy Pocott < QUAKENET1 <> optusnet dot com dot au >
MFC after:	3 days
2010-10-20 00:19:25 +00:00
Pyun YongHyeon
d598b626c0 Add workaround for BCM5906 controller silicon bug. If device
receive two back-to-back send BDs with less than or equal to 8
total bytes then the device may hang. The two back-to-back send
BDs must be in the same frame for this failure to occur.
Thanks to davidch for detailed errata information.

Reviewed by:	davidch
2010-10-19 23:04:23 +00:00
Justin T. Gibbs
ff662b5c98 Improve the Xen para-virtualized device infrastructure of FreeBSD:
o Add support for backend devices (e.g. blkback)
 o Implement extensions to the Xen para-virtualized block API to allow
   for larger and more outstanding I/Os.
 o Import a completely rewritten block back driver with support for fronting
   I/O to both raw devices and files.
 o General cleanup and documentation of the XenBus and XenStore support code.
 o Robustness and performance updates for the block front driver.
 o Fixes to the netfront driver.

Sponsored by: Spectra Logic Corporation

sys/xen/xenbus/init.txt:
	Deleted: This file explains the Linux method for XenBus device
	enumeration and thus does not apply to FreeBSD's NewBus approach.

sys/xen/xenbus/xenbus_probe_backend.c:
	Deleted: Linux version of backend XenBus service routines.  It
	was never ported to FreeBSD.  See xenbusb.c, xenbusb_if.m,
	xenbusb_front.c xenbusb_back.c for details of FreeBSD's XenBus
	support.

sys/xen/xenbus/xenbusvar.h:
sys/xen/xenbus/xenbus_xs.c:
sys/xen/xenbus/xenbus_comms.c:
sys/xen/xenbus/xenbus_comms.h:
sys/xen/xenstore/xenstorevar.h:
sys/xen/xenstore/xenstore.c:
	Split XenStore into its own tree.  XenBus is a software layer built
	on top of XenStore.  The old arrangement and the naming of some
	structures and functions blurred these lines making it difficult to
	discern what services are provided by which layer and at what times
	these services are available (e.g. during system startup and shutdown).

sys/xen/xenbus/xenbus_client.c:
sys/xen/xenbus/xenbus.c:
sys/xen/xenbus/xenbus_probe.c:
sys/xen/xenbus/xenbusb.c:
sys/xen/xenbus/xenbusb.h:
	Split up XenBus code into methods available for use by client
	drivers (xenbus.c) and code used by the XenBus "bus code" to
	enumerate, attach, detach, and service bus drivers.

sys/xen/reboot.c:
sys/dev/xen/control/control.c:
	Add a XenBus front driver for handling shutdown, reboot, suspend, and
	resume events published in the XenStore.  Move all PV suspend/reboot
	support from reboot.c into this driver.

sys/xen/blkif.h:
	New file from Xen vendor with macros and structures used by
	a block back driver to service requests from a VM running a
	different ABI (e.g. amd64 back with i386 front).

sys/conf/files:
	Adjust kernel build spec for new XenBus/XenStore layout and added
	Xen functionality.

sys/dev/xen/balloon/balloon.c:
sys/dev/xen/netfront/netfront.c:
sys/dev/xen/blkfront/blkfront.c:
sys/xen/xenbus/...
sys/xen/xenstore/...
	o Rename XenStore APIs and structures from xenbus_* to xs_*.
	o Adjust to use of M_XENBUS and M_XENSTORE malloc types for allocation
	  of objects returned by these APIs.
	o Adjust for changes in the bus interface for Xen drivers.

sys/xen/xenbus/...
sys/xen/xenstore/...
	Add Doxygen comments for these interfaces and the code that
	implements them.

sys/dev/xen/blkback/blkback.c:
	o Rewrite the Block Back driver to attach properly via newbus,
	  operate correctly in both PV and HVM mode regardless of domain
	  (e.g. can be in a DOM other than 0), and to deal with the latest
	  metadata available in XenStore for block devices.

	o Allow users to specify a file as a backend to blkback, in addition
	  to character devices.  Use the namei lookup of the backend path
	  to automatically configure, based on file type, the appropriate
	  backend method.

	The current implementation is limited to a single outstanding I/O
	at a time to file backed storage.

sys/dev/xen/blkback/blkback.c:
sys/xen/interface/io/blkif.h:
sys/xen/blkif.h:
sys/dev/xen/blkfront/blkfront.c:
sys/dev/xen/blkfront/block.h:
	Extend the Xen blkif API: Negotiable request size and number of
	requests.

	This change extends the information recorded in the XenStore
	allowing block front/back devices to negotiate for optimal I/O
	parameters.  This has been achieved without sacrificing backward
	compatibility with drivers that are unaware of these protocol
	enhancements.  The extensions center around the connection protocol
	which now includes these additions:

	o The back-end device publishes its maximum supported values for,
	  request I/O size, the number of page segments that can be
	  associated with a request, the maximum number of requests that
	  can be concurrently active, and the maximum number of pages that
	  can be in the shared request ring.  These values are published
	  before the back-end enters the XenbusStateInitWait state.

	o The front-end waits for the back-end to enter either the InitWait
	  or Initialize state.  At this point, the front end limits it's
	  own capabilities to the lesser of the values it finds published
	  by the backend, it's own maximums, or, should any back-end data
	  be missing in the store, the values supported by the original
	  protocol.  It then initializes it's internal data structures
	  including allocation of the shared ring, publishes its maximum
	  capabilities to the XenStore and transitions to the Initialized
	  state.

	o The back-end waits for the front-end to enter the Initalized
	  state.  At this point, the back end limits it's own capabilities
	  to the lesser of the values it finds published by the frontend,
	  it's own maximums, or, should any front-end data be missing in
	  the store, the values supported by the original protocol.  It
	  then initializes it's internal data structures, attaches to the
	  shared ring and transitions to the Connected state.

	o The front-end waits for the back-end to enter the Connnected
	  state, transitions itself to the connected state, and can
	  commence I/O.

	Although an updated front-end driver must be aware of the back-end's
	InitWait state, the back-end has been coded such that it can
	tolerate a front-end that skips this step and transitions directly
	to the Initialized state without waiting for the back-end.

sys/xen/interface/io/blkif.h:
	o Increase BLKIF_MAX_SEGMENTS_PER_REQUEST to 255.  This is
	  the maximum number possible without changing the blkif
	  request header structure (nr_segs is a uint8_t).

	o Add two new constants:
	  BLKIF_MAX_SEGMENTS_PER_HEADER_BLOCK, and
	  BLKIF_MAX_SEGMENTS_PER_SEGMENT_BLOCK.  These respectively
	  indicate the number of segments that can fit in the first
	  ring-buffer entry of a request, and for each subsequent
	  (sg element only) ring-buffer entry associated with the
          "header" ring-buffer entry of the request.

	o Add the blkif_request_segment_t typedef for segment
	  elements.

	o Add the BLKRING_GET_SG_REQUEST() macro which wraps the
	  RING_GET_REQUEST() macro and returns a properly cast
	  pointer to an array of blkif_request_segment_ts.

	o Add the BLKIF_SEGS_TO_BLOCKS() macro which calculates the
	  number of ring entries that will be consumed by a blkif
	  request with the given number of segments.

sys/xen/blkif.h:
	o Update for changes in interface/io/blkif.h macros.

	o Update the BLKIF_MAX_RING_REQUESTS() macro to take the
	  ring size as an argument to allow this calculation on
	  multi-page rings.

	o Add a companion macro to BLKIF_MAX_RING_REQUESTS(),
	  BLKIF_RING_PAGES().  This macro determines the number of
	  ring pages required in order to support a ring with the
	  supplied number of request blocks.

sys/dev/xen/blkback/blkback.c:
sys/dev/xen/blkfront/blkfront.c:
sys/dev/xen/blkfront/block.h:
	o Negotiate with the other-end with the following limits:
	      Reqeust Size:   MAXPHYS
	      Max Segments:   (MAXPHYS/PAGE_SIZE) + 1
	      Max Requests:   256
	      Max Ring Pages: Sufficient to support Max Requests with
	                      Max Segments.

	o Dynamically allocate request pools and segemnts-per-request.

	o Update ring allocation/attachment code to support a
	  multi-page shared ring.

	o Update routines that access the shared ring to handle
	  multi-block requests.

sys/dev/xen/blkfront/blkfront.c:
	o Track blkfront allocations in a blkfront driver specific
	  malloc pool.

	o Strip out XenStore transaction retry logic in the
	  connection code.  Transactions only need to be used when
	  the update to multiple XenStore nodes must be atomic.
	  That is not the case here.

	o Fully disable blkif_resume() until it can be fixed
	  properly (it didn't work before this change).

	o Destroy bus-dma objects during device instance tear-down.

	o Properly handle backend devices with powef-of-2 sector
	  sizes larger than 512b.

sys/dev/xen/blkback/blkback.c:
	Advertise support for and implement the BLKIF_OP_WRITE_BARRIER
	and BLKIF_OP_FLUSH_DISKCACHE blkif opcodes using BIO_FLUSH and
	the BIO_ORDERED attribute of bios.

sys/dev/xen/blkfront/blkfront.c:
sys/dev/xen/blkfront/block.h:
	Fix various bugs in blkfront.

       o gnttab_alloc_grant_references() returns 0 for success and
	 non-zero for failure.  The check for < 0 is a leftover
	 Linuxism.

       o When we negotiate with blkback and have to reduce some of our
	 capabilities, print out the original and reduced capability before
	 changing the local capability.  So the user now gets the correct
	 information.

	o Fix blkif_restart_queue_callback() formatting.  Make sure we hold
	  the mutex in that function before calling xb_startio().

	o Fix a couple of KASSERT()s.

        o Fix a check in the xb_remove_* macro to be a little more specific.

sys/xen/gnttab.h:
sys/xen/gnttab.c:
	Define GNTTAB_LIST_END publicly as GRANT_REF_INVALID.

sys/dev/xen/netfront/netfront.c:
	Use GRANT_REF_INVALID instead of driver private definitions of the
	same constant.

sys/xen/gnttab.h:
sys/xen/gnttab.c:
	Add the gnttab_end_foreign_access_references() API.

	This API allows a client to batch the release of an array of grant
	references, instead of coding a private for loop.  The implementation
	takes advantage of this batching to reduce lock overhead to one
	acquisition and release per-batch instead of per-freed grant reference.

	While here, reduce the duration the gnttab_list_lock is held during
	gnttab_free_grant_references() operations.  The search to find the
	tail of the incoming free list does not rely on global state and so
	can be performed without holding the lock.

sys/dev/xen/xenpci/evtchn.c:
sys/dev/xen/evtchn/evtchn.c:
sys/xen/xen_intr.h:
	o Implement the bind_interdomain_evtchn_to_irqhandler API for HVM mode.
	  This allows an HVM domain to serve back end devices to other domains.
	  This API is already implemented for PV mode.

	o Synchronize the API between HVM and PV.

sys/dev/xen/xenpci/xenpci.c:
	o Scan the full region of CPUID space in which the Xen VMM interface
	  may be implemented.  On systems using SuSE as a Dom0 where the
	  Viridian API is also exported, the VMM interface is above the region
	  we used to search.

	o Pass through bus_alloc_resource() calls so that XenBus drivers
	  attaching on an HVM system can allocate unused physical address
	  space from the nexus.  The block back driver makes use of this
	  facility.

sys/i386/xen/xen_machdep.c:
	Use the correct type for accessing the statically mapped xenstore
	metadata.

sys/xen/interface/hvm/params.h:
sys/xen/xenstore/xenstore.c:
	Move hvm_get_parameter() to the correct global header file instead
	of as a private method to the XenStore.

sys/xen/interface/io/protocols.h:
	Sync with vendor.

sys/xeninterface/io/ring.h:
	Add macro for calculating the number of ring pages needed for an N
	deep ring.

	To avoid duplication within the macros, create and use the new
	__RING_HEADER_SIZE() macro.  This macro calculates the size of the
	ring book keeping struct (producer/consumer indexes, etc.) that
	resides at the head of the ring.

	Add the __RING_PAGES() macro which calculates the number of shared
	ring pages required to support a ring with the given number of
	requests.

	These APIs are used to support the multi-page ring version of the
	Xen block API.

sys/xeninterface/io/xenbus.h:
	Add Comments.

sys/xen/xenbus/...
	o Refactor the FreeBSD XenBus support code to allow for both front and
	  backend device attachments.

	o Make use of new config_intr_hook capabilities to allow front and back
	  devices to be probed/attached in parallel.

	o Fix bugs in probe/attach state machine that could cause the system to
	  hang when confronted with a failure either in the local domain or in
	  a remote domain to which one of our driver instances is attaching.

	o Publish all required state to the XenStore on device detach and
	  failure.  The majority of the missing functionality was for serving
	  as a back end since the typical "hot-plug" scripts in Dom0 don't
	  handle the case of cleaning up for a "service domain" that is not
	  itself.

	o Add dynamic sysctl nodes exposing the generic ivars of
	  XenBus devices.

	o Add doxygen style comments to the majority of the code.

	o Cleanup types, formatting, etc.

sys/xen/xenbus/xenbusb.c:
	Common code used by both front and back XenBus busses.

sys/xen/xenbus/xenbusb_if.m:
	Method definitions for a XenBus bus.

sys/xen/xenbus/xenbusb_front.c:
sys/xen/xenbus/xenbusb_back.c:
	XenBus bus specialization for front and back devices.

MFC after:	1 month
2010-10-19 20:53:30 +00:00
Jung-uk Kim
220666153d Remove undocumented and stale debug.acpi.do_powerstate tunable. It was
added with hw.pci.do_powerstate but the PCI version was splitted into two
separate tunables later and now this is completely stale.  To make it worse,
PCI devices enumerated in ACPI tree ignore this tunable as it is handled by
a function in acpi_pci.c instead.
2010-10-19 20:38:21 +00:00
Jung-uk Kim
a7a3177f27 Remove PCI_SET_POWERSTATE method from acpi.c and eradicate all PCI-specific
knowledges from the file.  All PCI devices enumerated in ACPI tree must use
correct one from acpi_pci.c any way.  Reduce duplicate codes as we did for
pci.c in r213905.  Do not return ESRCH from PCIB_POWER_FOR_SLEEP method.
When the method is not found, just return zero without modifying the given
default value as it is completely optional.  As a side effect, the return
state must not be NULL.  Note there is actually no functional change by
removing ESRCH because acpi_pcib_power_for_sleep() always returns zero.
Adjust debugging messages and add new ones under bootverbose to help
debugging device power state related issues.

Reviewed by:	jhb, imp (earlier versions)
2010-10-19 19:53:06 +00:00
Bernhard Schmidt
96a911f614 There is no reason to call rt_ifmsg(), remove it.
Submitted by:	Paul B Mahol <onemda at gmail.com>
MFC after:	1 week
2010-10-19 19:11:36 +00:00
Jung-uk Kim
edc0cb7dc8 Make any PCI devices enumerated in ACPI tree honor do_power_resume as well. 2010-10-19 18:43:11 +00:00
Jung-uk Kim
6d018c85e1 Remove PCI header type 0 restriction from power state changes. PCI config.
registers for bridges are saved and restored since r200341.

OK'ed by:	imp, jhb
2010-10-19 17:15:22 +00:00
Jung-uk Kim
b56b75259b Do not apply do_power_resume for suspending case. When do_powerstate was
splitted into do_power_resume and do_power_nodriver, it became stale.
2010-10-19 17:05:51 +00:00
Rebecca Cran
8834bc521e Fix grammar. 2010-10-18 14:26:29 +00:00
Alexander Motin
bda55b6adb Set of legacy mode SATA enchancements:
- Implement proper combined mode decoding for Intel controllers to properly
identify SATA and PATA channels and associate ATA channels with SATA ports.
This fixes wrong reporting and in some cases hard resets to wrong SATA ports.
- Improve SATA registers support to handle hot-plug events and potentially
interface errors. For ICH5/6300ESB chipsets these registers accessible via
PCI config space. For later ones they may be accessible via PCI BAR(5).
- For controllers not generating interrupts on hot-plug events, implement
periodic status polling. Use it to detect hot-plug on Intel and VIA
controllers. Same probably could also be used for Serverworks and SIS.
2010-10-18 11:30:13 +00:00
Marius Strobl
c1ff8fd19a Revert r213867; while this driver really doesn't use any of the generic
subroutines, at least mii_capabilities is used within itself.
2010-10-18 08:36:03 +00:00
Marcel Moolenaar
3d5c947d9d Allow the MDIOCATTACH ioctl operation to originate from within the kernel.
To protect against malicious software, we demand that the file name is at
a particular location (i.e. appended to the mdio structure) for it to be
treated as in-kernel.
2010-10-18 04:26:32 +00:00
Alexander Motin
0aa99d33b5 Allow umass to use bigger transactions for USB 3.0 devices. It is less
important for USB 2.0 devices and some of them reported to have problems
with large transactions. But USB 3.0 benchmarks show that limited number
of transactions per second on USB makes impossible to reach high transfer
speeds without using bigger transactions.

On my tests this change allows to read up to 220MB/s from USB-attached SSD
(at block size of 256-512KB), comparing to only 113MB/s without it.

Reviewed by:	hselasky
2010-10-16 19:29:37 +00:00
Marius Strobl
1636dde957 Convert the PHY drivers to honor the mii_flags passed down and convert
the NIC drivers as well as the PHY drivers to take advantage of the
mii_attach() introduced in r213878 to get rid of certain hacks. For
the most part these were:
- Artificially limiting miibus_{read,write}reg methods to certain PHY
  addresses; we now let mii_attach() only probe the PHY at the desired
  address(es) instead.
- PHY drivers setting MIIF_* flags based on the NIC driver they hang
  off from, partly even based on grabbing and using the softc of the
  parent; we now pass these flags down from the NIC to the PHY drivers
  via mii_attach(). This got us rid of all such hacks except those of
  brgphy() in combination with bce(4) and bge(4), which is way beyond
  what can be expressed with simple flags.

While at it, I took the opportunity to change the NIC drivers to pass
up the error returned by mii_attach() (previously by mii_phy_probe())
and unify the error message used in this case where and as appropriate
as mii_attach() actually can fail for a number of reasons, not just
because of no PHY(s) being present at the expected address(es).

This file was missed in r213893.
2010-10-15 23:34:31 +00:00
Jung-uk Kim
debfe32ccd Remove unnecessary castings and fix couple of style(9) nits. 2010-10-15 21:41:59 +00:00
Jung-uk Kim
6e877573df Move setting power state for children into a separate function as they were
essentially the same.  This also restores hw.pci.do_power_resume tunable,
which was broken since r211430.

Reviewed by:	jhb
2010-10-15 21:39:51 +00:00
Andreas Tobler
da89fa28c6 Add three new drivers for fan control and temperature reading on the
PowerMac7,2.

- The fcu driver lets us read and write the fan RPMs for all fans in the
  PowerMac7,2. This driver is PowerMac specific.
- The ds1775 is a driver to read the temperature for the drive bay sensor.
- The max6690 is another driver to read temperatures. Here it is used to
  read the inlet, the backside and the U3 heatsink temperature.

An additional driver, the ad7417, will follow later.

Thanks to nwhitehorn for guiding me through this driver development.

Approved by:	nwhitehorn (mentor)
2010-10-15 20:08:16 +00:00
Marius Strobl
e60f6da1d6 Now that all previous users of mii_phy_probe() have been converted
in r213893 and r213894 to use mii_attach() instead remove the former
and along with it the "EVIL HACK".

MFC after:	never
2010-10-15 15:46:58 +00:00
Matthew D Fleming
09631173be Currently only opt_compat.h is included by the mps(4) driver. Also
enable /dev/mps0, which was missing from my previous patches enabling
f/w upload and download.

opt_compat.h issue noticed by scottl.
2010-10-15 15:24:59 +00:00
Marius Strobl
d6c65d276e Converted the remainder of the NIC drivers to use the mii_attach()
introduced in r213878 instead of mii_phy_probe(). Unlike r213893 these
are only straight forward conversions though.

Reviewed by:	yongari
2010-10-15 15:00:30 +00:00
Marius Strobl
8e5d93dbb4 Convert the PHY drivers to honor the mii_flags passed down and convert
the NIC drivers as well as the PHY drivers to take advantage of the
mii_attach() introduced in r213878 to get rid of certain hacks. For
the most part these were:
- Artificially limiting miibus_{read,write}reg methods to certain PHY
  addresses; we now let mii_attach() only probe the PHY at the desired
  address(es) instead.
- PHY drivers setting MIIF_* flags based on the NIC driver they hang
  off from, partly even based on grabbing and using the softc of the
  parent; we now pass these flags down from the NIC to the PHY drivers
  via mii_attach(). This got us rid of all such hacks except those of
  brgphy() in combination with bce(4) and bge(4), which is way beyond
  what can be expressed with simple flags.

While at it, I took the opportunity to change the NIC drivers to pass
up the error returned by mii_attach() (previously by mii_phy_probe())
and unify the error message used in this case where and as appropriate
as mii_attach() actually can fail for a number of reasons, not just
because of no PHY(s) being present at the expected address(es).

Reviewed by:	jhb, yongari
2010-10-15 14:52:11 +00:00
Matthew D Fleming
e658ccea60 Fixes to mps_user_command():
- fix the leak of command struct on error
 - simplify the cleanup logic
 - EINPROGRESS is not a fatal error
 - buggy comment and error message

Reviewed by:   ken
2010-10-14 23:26:08 +00:00
Hans Petter Selasky
e11ad60db2 Add new USB device IDs to the list of supported devices.
PR:	usb/151043
Approved by:    thompsa (mentor)
2010-10-14 22:14:55 +00:00
Hans Petter Selasky
f3aa3ca3d8 - Add more USB devices to usbdevs and rename some previously unknown ones.
- Add more USB mass storage quirks.

Submitted by: Dmitry Luhtionov
PR: usb/149934, usb/143045
Approved by:    thompsa (mentor)
2010-10-14 22:06:52 +00:00
Marius Strobl
a55fb8a458 Add a NetBSD-compatible mii_attach(), which is intended to eventually
replace mii_phy_probe() altogether. Compared to the latter the advantages
of mii_attach() are:
- intended to be called multiple times in order to attach PHYs in multiple
  passes (f.e. in order to only use sub-ranges of the 0 to MII_NPHY - 1
  range)
- being able to pass along the capability mask from the NIC to the PHY
  drivers
- being able to specify at which address (phyloc) to probe for a PHY
  (instead of always probing at all addresses from 0 to MII_NPHY - 1)
- being able to specify which PHY instance (offloc) to attach
- being able to pass along MIIF_* flags from the NIC to the PHY drivers
  (f.e. as required to indicated to the PHY drivers that flow control is
  supported by the NIC driver, which actually is the motivation for this
  change).

While at it, I used the opportunity to get rid of some hacks in mii(4)
like miibus_probe() generally doing work besides sheer probing and the
"EVIL HACK" (which will vanish entirely along with mii_phy_probe()) by
passing the struct ifnet pointer via an argument of mii_attach() as well
as to fix some resource leaks in mii(4) in case something fails.
Commits which will update the PHY drivers to honor the MII flags passed
down from the NIC drivers and take advantage of mii_attach() to get rid
of certain types of hacks in NIC and PHY drivers as well as a conversion
of the remaining uses of mii_phy_probe() will follow shortly.

Reviewed by:	jhb, yongari
Obtained from:	NetBSD (partially)
2010-10-14 22:01:40 +00:00
Hans Petter Selasky
e781dd4fbb Add more USB device IDs to supported list of devices.
Submitted by:	Nick Hibma
PR:	usb/149900
Approved by:    thompsa (mentor)
2010-10-14 21:53:42 +00:00
Hans Petter Selasky
7ee713e89e Fix forwarding of Line Register Status changes to TTY layer.
PR: usb/149675
Approved by:    thompsa (mentor)
2010-10-14 21:45:41 +00:00
Hans Petter Selasky
f7d8cf85e3 Remove unused EHCI register definition.
Define reserved EHCI register.

Approved by:    thompsa (mentor)
2010-10-14 21:41:08 +00:00
Hans Petter Selasky
53e0bf6e70 Revert most of r197682 (EHCI Hardware BUG workaround). Implement
proper solution which is to not use the TERMINATE pointer, but rather
link to a halted TD. The initial fix was due to a misunderstanding
about how the EHCI hardware works. Thanks to Alan Stern for clearing
this up. This patch can increase mass storage read performance
significantly when the IRQ rate is less than 8000 IRQ/s.

Approved by:    thompsa (mentor)
2010-10-14 21:38:06 +00:00
Marius Strobl
4d0056a865 Just like xmphy(4) this driver doesn't use any of the generic subroutines
so there's no need to fill mii_{ext,}capabilities either.
2010-10-14 21:30:13 +00:00
Hans Petter Selasky
59c9250333 Avoid using endless retransmission at EHCI hardware level, hence this hide
errors from the applications. Only use endless retransmission while in the
non-addressed state on a High-Speed device.

Approved by:    thompsa (mentor)
2010-10-14 21:26:06 +00:00
Hans Petter Selasky
1678e1358b Correct EHCI root HUB interface descriptor.
Approved by:    thompsa (mentor)
2010-10-14 21:18:18 +00:00
Hans Petter Selasky
b494261c69 Correct EHCI port register read.
Approved by:    thompsa (mentor)
2010-10-14 21:14:33 +00:00
Hans Petter Selasky
6001d01180 - Add more USB devices to usbdevs and rename some previously unknown ones.
- Add more USB mass storage quirks.

Submitted by: Dmitry Luhtionov
PR: usb/149934, usb/143045
Approved by:    thompsa (mentor)
2010-10-14 21:09:37 +00:00
Hans Petter Selasky
51fd3d75fe - Add support for LibUSB in 32-bit compatibility mode.
Approved by:    thompsa (mentor)
2010-10-14 20:38:18 +00:00
Rui Paulo
ea7303d127 Revert r213765. This is required because our build infrastructure uses
the host lex instead of the lex built during buildworld. I will MFC the
lex changes soon and in a few weeks this I'll commit again r213765.
2010-10-14 19:19:19 +00:00
Pyun YongHyeon
96486faa6e Make sure to not use stale ip/tcp header pointers. The ip/tcp
header parser uses m_pullup(9) to get access to mbuf chain.
m_pullup(9) can allocate new mbuf chain and free old one if the
space left in the mbuf chain is not enough to hold requested
contiguous bytes. Previously drivers can use stale ip/tcp header
pointer if m_pullup(9) returned new mbuf chain.

Reported by:	Andrew Boyer (aboyer <> averesystems dot com)
MFC after:	10 days
2010-10-14 18:31:40 +00:00
Pyun YongHyeon
cb2f3e7f9b Backout r204230. TX mbuf parser for VLAN is still required to
enable TX checksum offloading if VLAN hardware tagging is disabled.
2010-10-14 17:57:52 +00:00
Pyun YongHyeon
39d76ed635 It seems some multi-port dc(4) controllers shares SROM of the first
port such that reading station address from second port always
returned 0xFF:0xFF:0xFF:0xFF:0xFF:0xFF Unfortunately it seems there
is no easy way to know whether SROM is shared or not. Workaround
the issue by traversing dc(4) device list and see whether we're
using second port and use station address of controller 0 as base
station address of second port.

PR:		kern/79262
MFC after:	2 weeks
2010-10-14 17:22:38 +00:00
Matthew D Fleming
3f237b0b0c Support firmware download. 2010-10-14 16:44:44 +00:00
Matthew D Fleming
13ac67a784 Re-work the internals of adding items to the driver's scatter-gather
list.  Use the new internals to simplify adding transaction context
elements, and in future diffs, more complicated SGLs.
2010-10-14 16:44:05 +00:00
Pyun YongHyeon
7ed3f0f0e8 Fix a regression introduced in r213710. r213710 removed the use of
auto polling such that it made all controllers obtain link status
information from the state of the LNKRDY input signal. Broadcom
recommends disabling auto polling such that driver should rely on
PHY interrupts for link status change indications. Unfortunately it
seems some controllers(BCM5703, BCM5704 and BCM5705) have PHY
related issues so Linux took other approach to workaround it.
bge(4) didn't follow that and it used to enable auto polling to
workaround it. Restore this old behavior for BCM5700 family
controllers and BCM5705 to use auto polling. For BCM5700 and
BCM5701, it seems it does not need to enable auto polling but I
restored it for safety.
Special thanks to marius who tried lots of patches with patience.

Reported by:	marius
Tested by:	marius
2010-10-13 22:29:48 +00:00
Hans Petter Selasky
7e05daae8f USB network (NCM driver):
- correct the ethernet payload remainder which
must be post-offseted by -14 bytes instead of
0 bytes. This is not very clearly defined in the
NCM specification.
- add development feature about limiting the
maximum datagram count in each NCM payload.
- zero-pad alignment data
- add TX-interval tuning sysctl

Approved by:    thompsa (mentor)
2010-10-13 22:04:55 +00:00
Pyun YongHyeon
d4f5240abd Add more checks for resolved link speed in bge_miibus_statchg().
Link UP state could be reported first before actual completion of
auto-negotiation. This change makes bge(4) reprogram BGE_MAC_MODE,
BGE_TX_MODE and BGE_RX_MODE register only after controller got a
valid link.
2010-10-13 21:53:37 +00:00
Hans Petter Selasky
d751769d2c USB Network:
- Add new driver for iPhone tethering
- Supports the iPhone 3G/3GS/4G ethernet protocol

Approved by:    thompsa (mentor)
2010-10-13 21:36:42 +00:00
Hans Petter Selasky
fb78ea8bd1 USB WLAN:
- Add new device ID

PR:	usb/150989
Approved by:    thompsa (mentor)
2010-10-13 20:56:54 +00:00
Hans Petter Selasky
d58bfbb688 USB network (UHSO):
- Correct network interface flags.

PR:	usb/149039
Submitted by:	Fredrik Lindberg
Approved by:    thompsa (mentor)
2010-10-13 20:51:06 +00:00
Hans Petter Selasky
3b6f59eeaa Correct some root HUB descriptor fields in multiple controller drivers.
Remove an unused structure.

Approved by:    thompsa (mentor)
2010-10-13 20:37:19 +00:00
Rui Paulo
3065282fdb Revert r213793. 2010-10-13 17:38:23 +00:00
Rui Paulo
eab0cdc504 Don't do a logical AND of the result of strcmp() with a constant.
Found with:	clang
2010-10-13 17:17:50 +00:00
Jung-uk Kim
1debbf5d79 Clean up unused headers. 2010-10-13 17:06:25 +00:00
Jung-uk Kim
e41724b279 Remove acpi_bus_number() completely. It had to be removed in r212761.
Pointed out by:	jhb
2010-10-13 16:30:41 +00:00
Rui Paulo
30aa84b727 Pass a format string to make_dev(). 2010-10-13 14:41:52 +00:00
Rui Paulo
577fedb6b1 Fix a brain-o: wrong case statement semantics.
Found with:	clang
2010-10-13 14:39:54 +00:00
Rui Paulo
a6d8c83fd9 WPA_CSE_WEP104 was being incorrectly checked.
Found with:	clang
2010-10-13 14:37:52 +00:00
Rui Paulo
1d90e6b224 Mark acpi_bus_number() as __unused. This allows clang to this file
without any warnings.
2010-10-13 11:38:24 +00:00
Rui Paulo
cd1fa5bd4d Explicitly tell the compiler that we don't care about the return value
of kbdd_ioctl().
2010-10-13 11:37:12 +00:00
Rui Paulo
c42a2be28f Define YY_NO_INPUT. This makes aicasm buildable by clang with Werror
turned on.
2010-10-13 10:33:01 +00:00
Jung-uk Kim
ac731af567 Use AcpiReset() from ACPICA instead of rolling our own, which is actually
incomplete.  If FADT says the register is available, enable the capability
by default.  Remove the previous default value from acpi(4).
2010-10-13 00:21:53 +00:00
Pyun YongHyeon
a4431eba57 Protect bge(4) from accessing invalid NIC internal memory regions
on BCM5906.

Tested by:	Buganini < buganini <> gmail dot com >
2010-10-12 19:31:25 +00:00
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
Pyun YongHyeon
7aa4b937e0 Allow write DMA to request larger DMA burst size to get better
performance on BCM5785.

Obtained from:	OpenBSD
2010-10-01 17:46:15 +00:00
Pyun YongHyeon
d8b57f98ab Fix IFCAP_TXCSUM/IFCAP_RXCSUM handling. Previously bge(4) used
IFCAP_HWCSUM to know which capability should be changed such that
disabling RX checksun offloading resulted in disabling TX checksum
offloading.
2010-09-30 22:34:15 +00:00
Alexander Motin
3a2c9a26b5 Do not use regular interrupts on NVidia HPETs. NVidia MCP5x chipsets have
number of unexplained interrupt problems. For some reason, using HPET
interrupts there breaks HDA sound. Legacy route mode interrupts reported
to work fine there.
2010-09-30 16:23:01 +00:00
Alexander Motin
ba8834a379 Revert r132291.
Restore setting PIO/WDMA timings for VIA UDMA133 controllers.
Linux disables only AST register writing there, but no all timings.
2010-09-30 16:09:52 +00:00
Pyun YongHyeon
2280c16b56 Implement hardware MAC statistics for BCM5705 or newer Broadcom
controllers. bge(4) exported MAC statistics on controllers that
maintain the statistics in the NIC's internal memory. Newer
controllers require register access to fetch these values. These
counters provide useful information to diagnose driver issues.
2010-09-29 21:56:31 +00:00
Pyun YongHyeon
6854be25a8 After r207391, brgphy(4) passes resolved flow-control settings to
parent driver. Use that information to configure flow-control.
One drawback is there is no way to disable flow-control as we still
don't have proper way to not advertise RX/TX pause capability to
link partner. But I don't think it would cause severe problems and
users can selectively disable flow-control in switch port.
2010-09-29 21:19:25 +00:00
Oleksandr Tymoshenko
5f958b8534 Fix legal staff in GPIO sources:
- license clause now contains "AUTHOR AND CONTRIBUTORS"
        instead of just "AUTHOR"
    - Add license/copyright to gpioc.c

Spotted by: Edward Tomasz Napierala, Andrew Turner
2010-09-29 20:53:33 +00:00
Ed Maste
851f59d7e2 Previously, the aac driver did not handle enclosure management AIFs,
which were raised during hot-swap events. Now such events trigger cam
rescans, as is done in the mps driver.

Submitted by:	Mark Johnston <mjohnston at sandvine dot com>
2010-09-29 14:22:00 +00:00
John Baldwin
2d43c32e3c If rt2560_bbp_init() fails, don't drop the lock as the callers of
rt2560_init_locked() expect the lock to be held on return.

Reported by:	Anton Shterenlikht  mexas of bristol ac uk
MFC after:	1 week
2010-09-29 11:52:44 +00:00
Pyun YongHyeon
dedcdf574b Set the number of RX frames to receive after RX MBUF low watermark
has reached. This reduced number of dropped frames when
flow-control is enabled. Previously it dropped incoming frames once
RX MBUF low watermark has reached. The value used in MAC RX MBUF
low watermark is greater than or equal to 4 so receiving two more
RX frames should not be a problem.

Obtained from:	OpenBSD
2010-09-29 00:00:45 +00:00
Oleksandr Tymoshenko
6b34b16ea5 Initial GPIO bus support. Includes:
- GPIO bus controller interface
  - GPIO bus interface
  - Implementation of GPIO led(4) compatible device
  - Implementation of iic(4) bus over GPIO (author: Luiz Otavio O Souza)

Tested by: Luiz Otavio O Souza, Alexandr Rybalko
2010-09-28 03:24:53 +00:00
Jack F Vogel
7d9119bdc4 Update code from Intel:
- Sync shared code with Intel internal
	- New client chipset support added
	- em driver - fixes to 82574, limit queues to 1 but use MSIX
	- em driver - large changes in TX checksum offload and tso
	  code, thanks to yongari.
	- some small changes for watchdog issues.
	- igb driver - local timer watchdog code was missing locking
	  this and a couple other watchdog related fixes.
	- bug in rx discard found by Andrew Boyer, check for null pointer

MFC: a week
2010-09-28 00:13:15 +00:00
Marius Strobl
7b9a15f73c Use the mii_data provided via mii_attach_args and mii_pdata respectively
instead of reaching out for the softc of the parent.
2010-09-27 20:31:03 +00:00
Marius Strobl
485fc5eb4e - Remove clause 3 and 4 from TNF licenses.
- Remove closes 3 & 4 from Manuel Bouyer's license.

Obtained from:	NetBSD
2010-09-26 22:11:41 +00:00
Marius Strobl
cd23a6e019 Take mpt_req_on_{free,pending}_list() out from under INVARIANTS as these
are generally useful and not just for debugging.
2010-09-24 23:54:03 +00:00
Marius Strobl
67a1357c25 Improve r56796; the reply handler actually may remove the request from
the chain in which case it shouldn't be removed twice.
Reported by:	Staale Kristoffersen

MFC after:	1 week
2010-09-24 16:40:46 +00:00
Alexander Motin
433d4558c1 Add missing le32toh(), same as recently done in ata-siliconimage.c. 2010-09-24 07:14:14 +00:00