Commit Graph

22298 Commits

Author SHA1 Message Date
Bernhard Schmidt
b2ad04c708 Add support for RX packet aggregation. 2011-05-08 11:58:23 +00:00
Bernhard Schmidt
fa818eae51 Add support for transmitting frames at MCS rates. 2011-05-08 11:54:38 +00:00
Bernhard Schmidt
1647639a26 Prepare for transmitting frames at MCS rates:
- instead of calling iwn_plcp_signal() for every frame, map the expected
  value directly within wn->ridx
- concat plcp, rflags and xrflags, there is no clean byte boundary within
  the flags, for example the antenna setting uses bit 6, 7 and 8
- there is still need for a custom rate to plcp mapping, as those expected
  by the hardware are not conform to the std
2011-05-08 11:49:50 +00:00
Bernhard Schmidt
e9823bf8c9 Read chainmask information before announcing it. 2011-05-08 11:05:03 +00:00
Bernhard Schmidt
d86e3b2227 Add HT capabilities to probe requests. 2011-05-08 11:03:16 +00:00
Bernhard Schmidt
c9ce626212 Disable background scan support for 4965 adapters.
On legacy channels every once in a while the firmware throws a SYSASSERT
on line 208. On HT channels though this does always happen and I'm not
aware of any workaround currently.
2011-05-08 11:01:53 +00:00
Bernhard Schmidt
b648a23887 RX aggregation is slightly different then the legacy path, we will only
receive one RX_PHY for each aggregate and not one RX_PHY per frame.
2011-05-08 10:57:44 +00:00
Bernhard Schmidt
45e562203f Allocate all TX rings, those will be use for TX packet aggregation. 2011-05-08 10:54:50 +00:00
Bernhard Schmidt
3c2a1fc39d Use the enhanced TX power information availabe on newer EEPROMs. 2011-05-08 10:35:16 +00:00
Bernhard Schmidt
c07d5014de Hook HT channel setup. 2011-05-08 10:31:22 +00:00
Bernhard Schmidt
688f94830d The 6000 series adapters have a slightly different offset for band 6,
2GHz HT40 channels.
2011-05-08 10:21:42 +00:00
Bernhard Schmidt
3016ab149d Re-add 2 device IDs which got lost.
Pointed out by:	benjsc
2011-05-08 10:19:29 +00:00
Hans Petter Selasky
afa524e6cf Cleanup usb_notify_addq_compat(). It should not
be needed any more.

MFC after:	7 days
2011-05-08 08:22:11 +00:00
Adrian Chadd
f678fb43eb These EEPROM bits actually defined whether HT/20 and HT/40 support
for the given channel is available.

It isn't used yet; ar5416GetWirelessModes() needs to be taught
about this rather than assuming HT20/HT40 is available.
2011-05-08 08:18:30 +00:00
Adrian Chadd
5c892e7497 Fiddle with the PLL initialisation order to match ath9k/Atheros HAL.
This seems to make the AR9160 behave better during heavy scanning,
where before it'd hang and require a hard reset to recover.

Obtained From:	Linux ath9k, Atheros
2011-05-08 07:21:09 +00:00
Adrian Chadd
351384c64f Properly indent the WAR code i pasted in from ath9k a few months
ago.
2011-05-08 05:45:06 +00:00
Adrian Chadd
60d3878423 * Add in a comment about ar5416InitUserSettings() potentially
modifying AR_DIAG_SW.

  There's a hardware workaround which sets disabling some errors
  early at startup and clears said bits before the PCU begins
  receiving - it does this to avoid RX descriptor status errors.

  It's possible these bits aren't being completely properly twiddled
  in all instances; but in particular if the diag_reg HAL variable
  is set it won't be setting these bits correctly. I'll review this
  at some point.

 * Disable multicast search on mac address and key id - the driver
   doesn't use it at the moment and thus adhoc may be broken for
   merlin and later.

* Change this to be for Merlin 1.0 (which from what I understand
  wasn't ever publicly released) to be more correct.
2011-05-08 05:25:42 +00:00
Adrian Chadd
5accb5fd53 Fiddle with the AR5416 1.0 chainmask setup.
Apparently all three RX chains need to be enabled before initial calibration
is done, even if only two are configured.

Reorder the alt chain swap bit to match what the Atheros HAL is doing.

Obtained From:	ath9k, Atheros
2011-05-08 03:24:17 +00:00
Adrian Chadd
af8223ba6d Fix the IS_5416 checks to actually work correctly.
I've verified that my AR5416 revision 2.2 (minor revision 0x0A) now
matches the correct checks.
2011-05-07 18:42:41 +00:00
Hans Petter Selasky
4ad5f8c23f Add new USB ID.
Submitted by:	Dmitry Luhtionov
MFC after:	7 days
2011-05-07 16:32:59 +00:00
Adrian Chadd
26e8415d1d Do a HAL capabilities sync pass based on the Atheros HAL.
* Shuffle some of the capability numbers around to match the
  Atheros HAL capability IDs, just for consistency.

* Add some new capabilities to FreeBSD from the Atheros
  HAL which will be be shortly used when new chipsets are added
  (HAL SGI-20 support is for Kiwi/AR9287 support); for
  TX aggregation (MBSSID aggregate support, WDS aggregation
  support); CST/GTT support for carrier sense/TX timeout.
2011-05-07 15:30:23 +00:00
Adrian Chadd
b657b11d8d Update the ext channel cycpwr threshold 1 register for the extension
channel when the channel is HT/40.

The new ANI code (primarily for the AR9300/AR9400) in ath9k sets this
register but the ANI code for the previous 11n chips didn't set this.

Unlike ath9k, only set this for HT/40 channels.

Obtained From:	ath9k
2011-05-07 13:08:48 +00:00
Adrian Chadd
f93ef5516b Read in the extended regulatory domain flags so future code can use them.
These describe FCC/Japan channel and DFS behaviour.

The AR9285 and later chips don't set these bits in the eeprom, the correct
behaviour is to just assume all five bits are enabled.
2011-05-07 11:05:16 +00:00
Adrian Chadd
001ac28926 Instead of returning an unknown mac/bb signature, just return 0. 2011-05-07 06:52:04 +00:00
Adrian Chadd
b810285f24 Add some comments about which HAL capabilities are currently FreeBSD
specific.

The Atheros HAL and FreeBSD HAL share the same capabilities up
until HAL_CAP_11D, where things begin to diverge.

I'll look at tidying these up soon.

Obtained from:	Atheros
2011-05-07 06:47:09 +00:00
Adrian Chadd
de1334e8d7 Some BB hang changes:
* Add Howl (ar9130) to the list of chips that have DFS/BB/MAC hangs
* Don't treat unknown BB hangs as fatal; ath9k/Atheros HAL don't
  treat it as such.
* Add HAL_DEBUG_DFS to the debug fields in ath_hal/ah_debug.h

The BB hang check simply loops over an observation register checking
for a stuck state engine, but it can happen under high traffic
conditions. Ath9k and the Atheros HAL simply log a debug message and
continue.

Private to FreeBSD:

* Add HAL_DEBUG_HANG to the debug fields
* Change the hang debugging to HAL_DEBUG_HANG rather than HAL_DEBUG_DFS
  like in the Atheros HAL.

Obtained from:	Atheros
2011-05-07 06:45:35 +00:00
Pyun YongHyeon
de53eba037 Fix build. 2011-05-07 04:40:44 +00:00
Adrian Chadd
ef1901a3c9 Change AR_SREV_OWL_{X}_OR_LATER to AR_SREV_5416_{X}_OR_LATER.
For now, these are equivalent macros. AR_SREV_OWL{X}_OR_LATER
will later change to exclude Howl (AR9130) in line with what
the Atheros HAL does.

This should not functionally change anything.

Obtained from:	Atheros
2011-05-07 02:59:24 +00:00
Adrian Chadd
d1915e7308 Fix the OWL revision checks.
A quick story, which is partially documented in the commit.

The silicon revision in Linux ath9k and the Atheros HAL use an
AR_SREV_REVISION mask of 0x07.

FreeBSD's HAL uses the AR5212 AR_SREV_REVISION mask of 0x0F.

Thus the OWL silicon revisions were coming through as 0xA, 0xB,
0xC, rather than 0x0, 0x1 and 0x2.

My ath9k-sourced AR_SREV_OWL_<X> macros were thus using the wrong
silicon revision values and wouldn't correctly match.

This commit does a few things:

* Change the AR_SREV_OWL_<x> macros to use the AR_SREV_REVISION_OWL_*
  values, not AR_XSREV_REVISION_OWL macros;
* Disable AR_XSREV_REVISION_OWL_* values;
* Modify the IS_5416 to properly check the MAC is OWL, rather than
  potentially matching on non-OWL revisions (which shouldn't happen
  unless there's a silicon revision of higher than 0x9 in a later
  chip..)
* Add a couple more macros from the Atheros HAL for compatibility.

The main difference now is that the Atheros HAL defines
AR_SREV_OWL_{20,22}_OR_LATER subtly differently - it fails on all HOWL
silicon. The AR_SREV_5416_*_OR_LATER macros match on the relevant OWL
version -and- all HOWL versions, along with subsequent versions.

A subsequent commit is going to migrate the uses of AR_SREV_OWL_X_OR_LATER
to AR_SREV_5416_X_OR_LATER to match what's going on in the Atheros HAL.

There's only two uses of AR_SREV_OWL_X_OR_LATER which currently don't
apply to FreeBSD but it may do in the future.

Yes, it's all confusing!
2011-05-07 02:54:52 +00:00
Pyun YongHyeon
3ea23f341b Remove unneeded use of variable status. This should have been done
in r221557.
2011-05-07 02:19:46 +00:00
Pyun YongHyeon
0b96ba12be XL_DMACTL is 32bit register, use 32bit write macro.
While I'm here add more bits for the register.
2011-05-07 00:25:12 +00:00
Pyun YongHyeon
7498e81a2d Rearm watchdog timer if driver kick controller to recover from TX
underrun error.
While here, prepend 0x to status code to show TX status is hex
number.
2011-05-07 00:18:58 +00:00
Pyun YongHyeon
48dcbc3370 Rename xl_stats_update() callout handler to xl_tick() and move MII
tick driving logic to xl_tick(). Now xl_tick() handles MII tick as
well as periodic updating of statistics.
This change removes a hack used in interrupt handler where it
wanted to update statistics without driving MII tick.
2011-05-07 00:06:02 +00:00
Pyun YongHyeon
4a5c788456 Reuse the TX descriptor(DPD) if xl_encap() failed instead of just
picking the next available one. This may explain why xl(4) sees TX
underrun error with no queued frame. I hope this addresses a long
standing xl(4) watchdog timeout issue as well.

Obtained from:	OpenBSD
2011-05-06 23:49:10 +00:00
Pyun YongHyeon
5a13764b11 Change xl_rxeof() a bit to return the number of processed frames in
RX descriptor ring. Previously it returned the number of frames
that were successfully passed to upper stack which in turn means it
ignored frames that were discarded due to errors. The number of
processed frames in RX descriptor ring is used to detect whether
driver is out of sync with controller's current descriptor pointer.
Returning number of processed frames reduces unnecessary (probably
wrong) re-synchronization.

While here, remove unnecessary local variable initialization.
2011-05-06 23:01:29 +00:00
Pyun YongHyeon
74517b0724 Terminate interrupt handler if driver detect it's not running.
Also add check for driver running state before trying to send
frames. While I'm here, use for loop.
2011-05-06 22:55:53 +00:00
Pyun YongHyeon
f321edf95a Updating status word should be the last operation of UPD structure
renewal.  Disable instruction reordering by adding volatile to
xl_list_onefrag structure.
2011-05-06 22:45:13 +00:00
Pyun YongHyeon
0ecf6b16c8 Call bus_dmamap_sync() only after TX DPD update. 2011-05-06 22:36:43 +00:00
Pyun YongHyeon
4f58a95ce1 Set status word once instead of twice. For 3C90xB/3C90xC, frame
length of status word is ignored. While here move bus_dmamap_sync()
up where DMA map is loaded.
2011-05-06 22:26:57 +00:00
Pyun YongHyeon
78564eda2d Remove unnecessary htole32/le32toh dance. 2011-05-06 22:16:43 +00:00
Pyun YongHyeon
dd0a76883f Rewrite RX filter logic and provide controller specific filter
handler for 3C90x and 3C90xB/C respectively.  This simplifies ioctl
handler as well as enhancing readability.
While I'm here don't reprogram multicast filter when driver is not
running.
2011-05-06 22:01:46 +00:00
Adrian Chadd
e7cb5d548d Add a function which enables or disables RX RIFS searching, and migrate
the code which does this into it.
2011-05-06 15:33:56 +00:00
Nathan Whitehorn
cc734417b3 Do not use Open Firmware to open the device and instead program its start
on our own. This prevents hangs at boot when using a bm(4) NIC where the
cable is not plugged in at boot time.

Obtained from:	NetBSD
MFC after:	1 week
2011-05-06 03:26:24 +00:00
Navdeep Parhar
3792a4d286 Bump up the number of egress queues that the driver is allowed to use.
MFC after:	3 days
2011-05-05 23:09:17 +00:00
Xin LI
8901793222 Detect and set Atom's Tj(max) to 90 if it's not the 45nm D400/D500/N400
series.

MFC after:	2 weeks
2011-05-05 19:15:15 +00:00
Jack F Vogel
3cec53b8a7 Add an initialization to the error variable, without
this there is a rare return path that bogusly appears
to fail when it should not.  Also white space correction.

Thanks to Arnaud Lacombe for noticing the problem.
2011-05-05 17:28:45 +00:00
Alexander Motin
e2d6ccef4b Add PCI ID for Marvell 88SE9182 -- PCIe 2.x x2 relative of the 88SE912x.
Submitted by:	dchagin
MFC after:	1 week
2011-05-05 17:11:26 +00:00
Adrian Chadd
47ff47a858 Don't perform NF calibration for radio chains which aren't in use:
Quoting the ath9k commit message:

At present the noise floor calibration is processed in supported
control and extension chains rather than required chains.
Unnccesarily doing nfcal in all supported chains leads to
invalid nf readings on extn chains and these invalid values
got updated into history buffer. While loading those values
from history buffer is moving the chip to deaf state.

This issue was observed in AR9002/AR9003 chips while doing
associate/dissociate in HT40 mode and interface up/down
in iterative manner. After some iterations, the chip was moved
to deaf state. Somehow the pci devices are recovered by poll work
after chip reset. Raading the nf values in all supported extension chains
when the hw is not yet configured in HT40 mode results invalid values.

Reference:	https://patchwork.kernel.org/patch/753862/

Obtained from:	Linux ath9k
2011-05-05 08:11:22 +00:00
Adrian Chadd
ed8659ed69 Another Howl (AR9130) fix.
I haven't seen a 5ghz AR9130 based board yet though!

Obtained from:	Atheros
2011-05-05 04:43:05 +00:00
Adrian Chadd
d2615832bf Fix up the chipset checks for the AR5416 and later silicon.
The checks should function as follows:

* AR_SREV_<silicon> : check macVersion matches that version id
* AR_SREV_<silicon>_<revision> : check macVersion and macRevision match
    the version / revision respectively

* AR_SREV_<silicon>_<revision>_OR_LATER: check that
  + if the chip silicon version == macVersion, enforce revision >= macRevision
  + if the chip silicon version > macVersion, allow it.

For example, AR_SREV_MERLIN() only matches AR9280 (any revision),
AR_SREV_MERLIN_10() would only match AR9280 version 1.0, but
AR_SREV_MERLIN_20_OR_LATER() matches AR9280 version >= 2.0 _AND_
any subsequent MAC (So AR9285, AR9287, etc.)

The specific fixes which may impact users:

* if there is Merlin hardware > revision 2.0, it'll now be correctly
  matched by AR_SREV_MERLIN_20_OR_LATER() - the older code simply
  would match on either Merlin 2.0 or a subsequent MAC (AR9285, AR9287, etc.)

* Kite version 1.1/1.2 should now correctly match. As these macros
  are used in the AR9285 reset/attach path, and it's assumed that the
  hardware is kite anyway, the behaviour shouldn't change. It'll only
  change if these macros are used in other codepaths shared with
  older silicon.

Obtained from:	Linux ath9k, Atheros
2011-05-05 03:42:04 +00:00
Adrian Chadd
59298273a9 Import some HOWL (AR9130) related fixes from Atheros.
Obtained from:	Atheros
2011-05-05 02:59:31 +00:00
Navdeep Parhar
489eeba940 T4 packet timestamps.
Reference code that shows how to get a packet's timestamp out of
cxgbe(4).  Disabled by default because we don't have a standard way
today to pass this information up the stack.

The timestamp is 60 bits wide and each increment represents 1 tick of
the T4's core clock.  As an example, the timestamp granularity is ~4.4ns
for this card:

# sysctl dev.t4nex.0.core_clock
dev.t4nex.0.core_clock: 228125

MFC after:	1 week
2011-05-05 02:38:08 +00:00
Navdeep Parhar
8820ce5fe7 T4 packet filtering/steering.
- Enable 5-tuple and every-packet lookup.

- Setup the default filter mode to allow filtering/steering based on IP
  protocol, ingress port, inner VLAN ID, IP frag, FCoE, and MPS match
  type; all combined together.  You can also filter based on MAC index,
  Ethernet type, IP TOS/IPv6 Traffic Class, and outer VLAN ID but you'll
  have to modify the default filter mode and exclude some of the
  match-fields in it.

  IPv4 and IPv6 SIP/DIP/SPORT/DPORT are always available in all filter
  rules.

- Add driver ioctls to get/set the global filter mode.

- Add driver ioctls to program and delete hardware filters.  A couple of
  the "switch" actions that rewrite Ethernet and VLAN information and
  switch the packet out of another port may not work as the L2 code is not
  yet in place.  Everything else, including all "drop" and "pass" rules
  with RSS or absolute qid, should work.

Obtained from:	 Chelsio Communications
2011-05-05 02:04:56 +00:00
Pyun YongHyeon
cb777a0752 Enable Ethernet@WireSpeed for BCM5718/BCM57765 family. While I'm
here inverse meaning of PHY flag as Ethernet@WireSpeed is enabled
for most PHYs.
2011-05-05 00:43:40 +00:00
Navdeep Parhar
b815af1b74 Always re-arm an iq's interrupt before leaving the handler.
MFC after:	1 week
2011-05-04 23:07:30 +00:00
Pyun YongHyeon
b4a256ac67 Add initial BCM57765 family support. The BCM57765 family seems to
have similar hardware features of BCM5718 family except the number
of receive return ring is 4. The BCM57765 family is known to
support IEEE 802.3az EEE(Energy Efficient Ethernet) but this change
does not include EEE support code. I hope EEE is implemented in
near future.
This change will support BCM57761, BCM57765, BCM57781, BCM57785,
BCM57791 and BCM57795. All hardware offloading features are
supported and suspend/resume also should work.
Many thanks to Broadcom for continuing support of FreeBSD.

Tested by:	Paul Thornton (prt <> prt dot org)
HW donated by:	Broadcom
2011-05-04 17:04:31 +00:00
Adrian Chadd
5a04ce2fdf Remove this useless bit of code for Kite. The RIFS register value is overriden
by the initvals, so disabling RIFS before calling writeIni() effectively does
nothing.
2011-05-04 09:26:33 +00:00
Marius Strobl
3fcb7a5365 - Remove attempts to implement setting of BMCR_LOOP/MIIF_NOLOOP
(reporting IFM_LOOP based on BMCR_LOOP is left in place though as
  it might provide useful for debugging). For most mii(4) drivers it
  was unclear whether the PHYs driven by them actually support
  loopback or not. Moreover, typically loopback mode also needs to
  be activated on the MAC, which none of the Ethernet drivers using
  mii(4) implements. Given that loopback media has no real use (and
  obviously hardly had a chance to actually work) besides for driver
  development (which just loopback mode should be sufficient for
  though, i.e one doesn't necessary need support for loopback media)
  support for it is just dropped as both NetBSD and OpenBSD already
  did quite some time ago.
- Let mii_phy_add_media() also announce the support of IFM_NONE.
- Restructure the PHY entry points to use a structure of entry points
  instead of discrete function pointers, and extend this to include
  a "reset" entry point. Make sure any PHY-specific reset routine is
  always used, and provide one for lxtphy(4) which disables MII
  interrupts (as is done for a few other PHYs we have drivers for).
  This includes changing NIC drivers which previously just called the
  generic mii_phy_reset() to now actually call the PHY-specific reset
  routine, which might be crucial in some cases. While at it, the
  redundant checks in these NIC drivers for mii->mii_instance not being
  zero before calling the reset routines were removed because as soon
  as one PHY driver attaches mii->mii_instance is incremented and we
  hardly can end up in their media change callbacks etc if no PHY driver
  has attached as mii_attach() would have failed in that case and not
  attach a miibus(4) instance.
  Consequently, NIC drivers now no longer should call mii_phy_reset()
  directly, so it was removed from EXPORT_SYMS.
- Add a mii_phy_dev_attach() as a companion helper to mii_phy_dev_probe().
  The purpose of that function is to perform the common steps to attach
  a PHY driver instance and to hook it up to the miibus(4) instance and to
  optionally also handle the probing, addition and initialization of the
  supported media. So all a PHY driver without any special requirements
  has to do in its bus attach method is to call mii_phy_dev_attach()
  along with PHY-specific MIIF_* flags, a pointer to its PHY functions
  and the add_media set to one. All PHY drivers were updated to take
  advantage of mii_phy_dev_attach() as appropriate. Along with these
  changes the capability mask was added to the mii_softc structure so
  PHY drivers taking advantage of mii_phy_dev_attach() but still
  handling media on their own do not need to fiddle with the MII attach
  arguments anyway.
- Keep track of the PHY offset in the mii_softc structure. This is done
  for compatibility with NetBSD/OpenBSD.
- Keep track of the PHY's OUI, model and revision in the mii_softc
  structure. Several PHY drivers require this information also after
  attaching and previously had to wrap their own softc around mii_softc.
  NetBSD/OpenBSD also keep track of the model and revision on their
  mii_softc structure. All PHY drivers were updated to take advantage
  as appropriate.
- Convert the mebers of the MII data structure to unsigned where
  appropriate. This is partly inspired by NetBSD/OpenBSD.
- According to IEEE 802.3-2002 the bits actually have to be reversed
  when mapping an OUI to the MII ID registers. All PHY drivers and
  miidevs where changed as necessary. Actually this now again allows to
  largely share miidevs with NetBSD, which fixed this problem already
  9 years ago. Consequently miidevs was synced as far as possible.
- Add MIIF_NOMANPAUSE and mii_phy_flowstatus() calls to drivers that
  weren't explicitly converted to support flow control before. It's
  unclear whether flow control actually works with these but typically
  it should and their net behavior should be more correct with these
  changes in place than without if the MAC driver sets MIIF_DOPAUSE.

Obtained from:	NetBSD (partially)
Reviewed by:	yongari (earlier version), silence on arch@ and net@
2011-05-03 19:51:29 +00:00
John Baldwin
83c41143ca Reimplement how PCI-PCI bridges manage their I/O windows. Previously the
driver would verify that requests for child devices were confined to any
existing I/O windows, but the driver relied on the firmware to initialize
the windows and would never grow the windows for new requests.  Now the
driver actively manages the I/O windows.

This is implemented by allocating a bus resource for each I/O window from
the parent PCI bus and suballocating that resource to child devices.  The
suballocations are managed by creating an rman for each I/O window.  The
suballocated resources are mapped by passing the bus_activate_resource()
call up to the parent PCI bus.  Windows are grown when needed by using
bus_adjust_resource() to adjust the resource allocated from the parent PCI
bus.  If the adjust request succeeds, the window is adjusted and the
suballocation request for the child device is retried.

When growing a window, the rman_first_free_region() and
rman_last_free_region() routines are used to determine if the front or
end of the existing I/O window is free.  From using that, the smallest
ranges that need to be added to either the front or back of the window
are computed.  The driver will first try to grow the window in whichever
direction requires the smallest growth first followed by the other
direction if that fails.

Subtractive bridges will first attempt to satisfy requests for child
resources from I/O windows (including attempts to grow the windows).  If
that fails, the request is passed up to the parent PCI bus directly
however.

The PCI-PCI bridge driver will try to use firmware-assigned ranges for
child BARs first and only allocate a "fresh" range if that specific range
cannot be accommodated in the I/O window.  This allows systems where the
firmware assigns resources during boot but later wipes the I/O windows
(some ACPI BIOSen are known to do this) to "rediscover" the original I/O
window ranges.

The ACPI Host-PCI bridge driver has been adjusted to correctly honor
hw.acpi.host_mem_start and the I/O port equivalent when a PCI-PCI bridge
makes a wildcard request for an I/O window range.

The new PCI-PCI bridge driver is only enabled if the NEW_PCIB kernel option
is enabled.  This is a transition aide to allow platforms that do not
yet support bus_activate_resource() and bus_adjust_resource() in their
Host-PCI bridge drivers (and possibly other drivers as needed) to use the
old driver for now.  Once all platforms support the new driver, the
kernel option and old driver will be removed.

PR:		kern/143874 kern/149306
Tested by:	mav
2011-05-03 17:37:24 +00:00
George V. Neville-Neil
040b46f5ba Add in support for multicast.
Submitted by:	Sriram Rapuru at @ Wipro for Exar Inc.
MFC after:	2 weeks
2011-05-03 15:58:24 +00:00
Andriy Gapon
e3888a9820 SNDCTL_DSP_GETIPTR: set pointer to sndbuf_getfreeptr()
Rationale:
- unlike current behavior this seems to be compliant with OSS
  specification:
  http://manuals.opensound.com/developer/SNDCTL_DSP_GETIPTR.html
- this seems to meet expectations of some OSS programs compiled for or
  ported from Linux, e.g. ALSA OSS plugin
- this doesn't seem to break any programs as far as current testing
  shows

Tested by:	nox, hselasky
MFC after:	4 days
2011-05-03 15:50:22 +00:00
David Christensen
f83b279588 - Fixed a typo in an if() statement when setting flow control for MTU
greater than 5000 bytes.

Submitted by:	yongari
2011-05-02 23:34:33 +00:00
Marius Strobl
22a4eced36 Correct spelling in comments.
Submitted by:	brucec
2011-05-02 21:04:23 +00:00
Marius Strobl
aa8cbdbf67 Fix an logic bug which caused jumbo buffers to not be synced.
Reported and tested by: Michael Moll

MFC after:	3 days
2011-05-02 20:45:19 +00:00
David Christensen
e93ad740a0 - Re-committed r220603 which was accidentally backed out by an earlier
commit.
- Fixed a bug in an unused debug macro.

MFC after:	One week.
2011-05-02 20:43:24 +00:00
Marius Strobl
2524d0a675 Probe the PHY accompanying BCM57765.
Tested by: Paul Thornton

MFC after:	1 week
2011-05-02 20:37:30 +00:00
John Baldwin
24c93a6fc4 The ACPI Host-PCI bridge driver actually supports multiple domains via
the optional _SEG function.  Return that value (ap->segment) rather than
0 for the pcib domain ivar.
2011-05-02 19:02:30 +00:00
Xin LI
ba95b1e10e Correct a typo. According to Intel document 318914, the Tj(max) for Core 2
Duo Mobile CPUs should be 105.

Noticed by:	Mark Johnston <markjdb gmail.com>
MFC after:	3 days
2011-05-02 18:41:54 +00:00
John Baldwin
8d43fea45f Don't explicitly list pci_write_ivar() for bus_write_ivar, the method is
already inherited from the PCI bus driver.
2011-05-02 15:01:28 +00:00
John Baldwin
282211ea8b Add an entry for the Kuroutoshikou SERIAL4P-LPPCI2 which uses an Oxford
4 port chip but with a nonstandard clock.

PR:		kern/104212
Submitted by:	Shuichi KITAGUCHI  kit of ysnb net
MFC after:	1 week
2011-05-02 14:34:03 +00:00
John Baldwin
d2c9344ff9 Add implementations of BUS_ADJUST_RESOURCE() to the PCI bus driver,
generic PCI-PCI bridge driver, x86 nexus driver, and x86 Host to PCI bridge
drivers.
2011-05-02 14:13:12 +00:00
Bernhard Schmidt
797b914622 No need for htole32(), which is an uint8_t. 2011-05-01 18:41:57 +00:00
Dag-Erling Smørgrav
0abd21bdb8 Implement BIO_DELETE for vnode devices by simply overwriting the deleted
sectors with all-zeroes.

The zeroes come from a static buffer; null(4) uses a dynamic buffer for
the same purpose (for /dev/zero).  It might be a good idea to have a
static, shared, read-only all-zeroes page somewhere in the kernel that
md(4), null(4) and any other code that needs zeroes could use.

Reviewed by:	kib
MFC after:	3 weeks
2011-04-29 21:18:41 +00:00
John Baldwin
b67d11bbcc Change rman_manage_region() to actually honor the rm_start and rm_end
constraints on the rman and reject attempts to manage a region that is out
of range.
- Fix various places that set rm_end incorrectly (to ~0 or ~0u instead of
  ~0ul).
- To preserve existing behavior, change rman_init() to set rm_start and
  rm_end to allow managing the full range (0 to ~0ul) if they are not set by
  the caller when rman_init() is called.
2011-04-29 18:41:21 +00:00
Adrian Chadd
e57539af23 Cosmetic changes to fit 80 character screen width. 2011-04-29 16:43:30 +00:00
Adrian Chadd
1422779793 Remove some holdovers from the AR5212 origin of this code.
These aren't relevant here.
2011-04-29 12:52:18 +00:00
Kevin Lo
f620e64d23 Guard against default ni_chan
PR: kern/144642
Submitted by: Arthur Hartwig <a_hartwig at fastmaildot fm>
2011-04-29 06:28:29 +00:00
Jack F Vogel
0e6fa41ff1 Add a #define for driver portability to older OS 2011-04-28 23:21:40 +00:00
Jack F Vogel
efa439f740 Small change to make backporting to stable/7,
thanks to Arnaud Lacombe for suggesting it.
2011-04-28 22:21:53 +00:00
John Baldwin
6e9f075a26 Add support for Oxford PCI Express Expresso family devices.
For these devices, the number of supported ports is read from a register
in BAR 0.

PR:		kern/134878
Submitted by:	David Wood  david of wood2 org uk
MFC after:	1 week
2011-04-28 19:19:25 +00:00
John Baldwin
41b1c25960 Trim some additional unnecessary <linker_set.h> includes.
MFC after:	1 week
2011-04-28 17:59:33 +00:00
George V. Neville-Neil
548d35fd69 Exar driver for X3100 10GbE Server/Storage adapters
Features: Jumbo frames (up to 9600), LRO (Large Receive Offload),
          TSO (TCP segmentation offload), RTH (Receive Traffic Hash).

Submitted by: Sriram Rapuru at Exar
MFC after:	2 weeks
2011-04-28 14:33:15 +00:00
Adrian Chadd
9f25ad52ce Introduce AR9130 (HOWL) WMAC support to the FreeBSD HAL.
The AR9130 is an AR9160/AR5416 family WMAC which is glued directly
to the AR913x SoC peripheral bus (APB) rather than via a PCI/PCIe
bridge.

The specifics:

* A new build option is required to use the AR9130 - AH_SUPPORT_AR9130.
  This is needed due to the different location the RTC registers live
  with this chip; hopefully this will be undone in the future.
  This does currently mean that enabling this option will break non-AR9130
  builds, so don't enable it unless you're specifically building an image
  for the AR913x SoC.

* Add the new probe, attach, EEPROM and PLL methods specific to Howl.

* Add a work-around to ah_eeprom_v14.c which disables some of the checks
  for endian-ness and magic in the EEPROM image if an eepromdata block
  is provided. This'll be fixed at a later stage by porting the ath9k
  probe code and making sure it doesn't break in other setups (which
  my previous attempt at this did.)

* Sprinkle Howl modifications throughput the interrupt path - it doesn't
  implement the SYNC interrupt registers, so ignore those.

* Sprinkle Howl chip powerup/down throughout the reset path; the RTC methods
  were

* Sprinkle some other Howl workarounds in the reset path.

* Hard-code an alternative setup for the AR_CFG register for Howl, that
  sets up things suitable for Big-Endian MIPS (which is the only platform
  this chip is glued to.)

This has been tested on the AR913x based TP-Link WR-1043nd mode, in
legacy, HT/20 and HT/40 modes.

Caveats:

* 2ghz has only been tested. I've not seen any 5ghz radios glued to this
  chipset so I can't test it.

* AR5416_INTERRUPT_MITIGATION is not supported on the AR9130. At least,
  it isn't implemented in ath9k. Please don't enable this.

* This hasn't been tested in MBSS mode or in RX/TX block-aggregation mode.
2011-04-28 12:47:40 +00:00
John Baldwin
8adcbaed13 Only align MSI message groups based on the number of messages being
allocated, not the maximum number of messages the device supports.  The
spec only requires the former, and I believe I implemented the latter due
to misunderstanding an e-mail.  In particular, this fixes an issue where
having several devices that all support 16 messages can run out of
IDT vectors on x86 even though the driver only uses a single message.

Submitted by:	Bret Ketchum  bcketchum of gmail
MFC after:	1 week
2011-04-27 20:08:44 +00:00
Bjoern A. Zeeb
a0ae8f04e8 Make various (pseudo) interfaces compile without INET in the kernel
adding appropriate #ifdefs.  For module builds the framework needs
adjustments for at least carp.

Reviewed by:	gnn
Sponsored by:	The FreeBSD Foundation
Sponsored by:	iXsystems
MFC after:	4 days
2011-04-27 19:30:44 +00:00
Attilio Rao
7126ba42f6 - Add the possibility to reuse the already last used timeout when patting
the watchdog, via the watchdog(9) interface.
  For that, the WD_LASTVAL bitwise operation is used. It is mutually
  exclusive with any explicit timout passing to the watchdogs.
  The last timeout can be returned via the wdog_kern_last_timeout()
  KPI.
- Add the possibility to pat the watchdogs installed via the watchdog(9)
  interface from the kernel.
  In order to do that the new KPI wdog_kern_pat() is offered and it does
  accept normalized nanoseconds or WD_LASTVAL.
- Avoid to pass WD_ACTIVE down in the watchdog handlers. All the control
  bit processing should over to the upper layer functions and not passed
  down to the handlers at all.

These changes are intended to be used in order to fix up the watchdog
tripping in situation when the userland is busted, but protection is still
wanted (examples: shutdown syncing / disk dumping).

Sponsored by:	Sandvine Incorporated
Reviewed by:	emaste, des, cognet
MFC after:	2 weeks
2011-04-27 16:43:03 +00:00
Hans Petter Selasky
4309793b64 The maximum NCM frame size must be so that it
will generate a short terminated USB transfer if
the maximum NCM frame size is greater than what
the driver can handle.

Reported by:	Matthias Benesch
MFC after:	7 days
Approved by:	thompsa (mentor)
2011-04-26 19:40:37 +00:00
Hans Petter Selasky
ea719ede02 Fix for missing EHCI datatoggle change case.
Reported by:	Mike Tancsa
MFC after:	3 days
Approved by:	thompsa (mentor)
2011-04-26 18:50:35 +00:00
Jack F Vogel
e2314c6ccb - Add the RX refresh changes from igb to ixgbe
- Also a couple minor tweaks to the TX code from the same source.
- Add the INET ioctl code which has been missing from this driver,
  and which caused IP aliases to reset the interface.
- Last, some minor logic changes that just reflect upcoming
  hardware support, but have no other functional effect now.

MFC after a week
2011-04-25 23:34:21 +00:00
Adrian Chadd
041df70857 Wrap the MIMO stuff in #ifdef AH_SUPPORT_AR5416, as the channel
state doesn't have MIMO stuff in it by default.
2011-04-25 15:51:49 +00:00
Attilio Rao
f451d23cfc Add missing bit in r221015.
Sponsored by:	Sandvine Incorporated
Reviewed by:	des
MFC after:	1 week
X-MFC:		r221015
2011-04-25 14:12:58 +00:00
Attilio Rao
bb83df766c Don't assume that SMI are enabled when attaching ichwd and then do
correct unwind based on former state.

Sponsored by:	Sandvine Incorporated
Reviewed by:	des
MFC after:	1 week
2011-04-25 14:10:33 +00:00
Dag-Erling Smørgrav
bffd599bc9 Whitespace nit 2011-04-25 09:18:05 +00:00
Gleb Smirnoff
4c5a247b54 When msk_detach() is called from msk_attach(), ifp may be
yet not initialized.
2011-04-25 04:55:50 +00:00
Adrian Chadd
c2442d279a Break out the PLL setup into an overridable method.
The only method right now is ar5416InitPLL() which handles multiple
chipsets; this can now be overridden by newer chipset HAL code.
2011-04-24 15:53:57 +00:00
Adrian Chadd
98ebd982c3 Use the refactored ar5416WriteTxPowerRateRegisters() call in the ar9285 code. 2011-04-24 15:48:07 +00:00
Adrian Chadd
b998ae6409 Eliminate code duplication between AR5416/AR9160/AR9280 and AR9285.
Writing the TX power registers is the same between all of these chips
and later NICs (AR9287, AR9271 USB, etc.) so this will reduce code
duplication when those NICs are added to the HAL.
2011-04-24 14:50:29 +00:00
Konstantin Belousov
9af3638096 Fix display of the drm sysctls.
Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
2011-04-23 23:11:44 +00:00
Adrian Chadd
6f5fe81e02 Fix a corner-case of interrupt handling which resulted in potentially
spurious (and fatal) interrupt errors.

One user reported seeing this:

Apr 22 18:04:24 ceres kernel: ar5416GetPendingInterrupts: fatal error,
  ISR_RAC 0x0 SYNC_CAUSE 0x2000

SYNC_CAUSE of 0x2000 is AR_INTR_SYNC_LOCAL_TIMEOUT which is a bus timeout;
this shouldn't cause HAL_INT_FATAL to be set.

After checking out ath9k, ath9k_ar9002_hw_get_isr() clears (*masked)
before continuing, regardless of whether any bits in the ISR registers
are set. So if AR_INTR_SYNC_CAUSE is set to something that isn't
treated as fatal, and AR_ISR isn't read or is read and is 0, then
(*masked) wouldn't be cleared. Thus any of the existing bits set
that were passed in would be preserved in the output.

The caller in if_ath - ath_intr() - wasn't setting the masked value
to 0 before calling ath_hal_getisr(), so anything that was present
in that uninitialised variable would be preserved in the case above
of AR_ISR=0, AR_INTR_SYNC_CAUSE != 0; and if the HAL_INT_FATAL bit
was set, a fatal condition would be interpreted and the chip was
reset.

This patch does the following:

* ath_intr() - set masked to 0 before calling ath_hal_getisr();
* ar5416GetPendingInterrupts() - clear (*masked) before processing
  continues; so if the interrupt source is AR_INTR_SYNC_CAUSE
  and it isn't fatal, the hardware isn't reset via returning
  HAL_INT_FATAL.

This doesn't fix any underlying errors which trigger
AR_INTR_SYNC_LOCAL_TIMEOUT - which is a bus timeout of some
sort - so that likely should be further investigated.
2011-04-23 06:37:09 +00:00
Adrian Chadd
0d07bcba27 Fix the merlin LNA configuration code - these are bit flags, not raw values to be
written into the registers.
2011-04-22 17:57:13 +00:00
Marius Strobl
08b822fcbb Correct spelling in comments.
Submitted by:	brucec
2011-04-22 13:56:21 +00:00
Marius Strobl
867b94791c More spelling fixes.
Submitted by:	N.J. Mann
2011-04-22 12:46:39 +00:00
Adrian Chadd
635636ea69 The second regdomain word is a set of bitflags describing
regulatory domain behaviour. Document what the v14 EEPROM
flags are.
2011-04-22 10:59:20 +00:00
Adrian Chadd
0d2dd30cbd Bring over a pdadc calibration fix from ath9k - unused power detector
gain values should be 58, not the previous values.

Obtained From:	linux ath9k
2011-04-22 10:57:46 +00:00
Marius Strobl
5ab13afc94 Correct spelling.
Submitted by:	brucec
2011-04-22 09:59:16 +00:00
Marius Strobl
7b2f8db838 - Correct spelling. [1]
- Remove variables which are unused besides initialization. [2]

Submitted by:	brucec [1], Christoph Mallon [2]
2011-04-22 09:52:28 +00:00
Marius Strobl
a34f047788 Correct spelling in a comment.
Submitted by:	brucec
2011-04-22 09:44:01 +00:00
Marius Strobl
af5ac863ea Correct spelling in comments.
Submitted by:	brucec
2011-04-22 09:41:51 +00:00
Marius Strobl
19db2a7ba0 Correct spelling in comments.
Submitted by:	brucec
2011-04-22 09:39:05 +00:00
Marius Strobl
6882cb0c9f Correct spelling in comments.
Submitted by:	brucec
2011-04-22 09:22:27 +00:00
Adrian Chadd
88e428c6bc Revert r220907 and r220915.
Changing the size of struct ieee80211_mimo_info changes
the STA info data, breaking ifconfig in general.
2011-04-22 00:44:27 +00:00
David Christensen
a7a0fa5f58 - Centralize driver tunables initialization/validation.
- Centralize PCI resource allocation/release.
- Enable flowid (TSS) support.
- Added "per-fastpath" locks and watchdog timeouts.
- Fixed problem where the CQ producer index was advanced beyond
  the size of the CQ ring during initialization.
- Replaced hard-coded debug levels in some debug print statements.
- More style(9) fixes.

MFC after:	Two weeks
2011-04-21 23:06:00 +00:00
Alexander Motin
c7dd7de64d According to ATA specifications, when ATAPI master is the only device, it
should respond with all zeroes to any access to slave registers. Test with
PATA devices confirmed such behavior. Unluckily, Intel SATA controllers in
legacy emulation mode behave differently, not making any difference between
ATA and ATAPI devices. It causes false positive slave device detection and,
as result, command timeouts.

To workaround this problem, mask result of legacy-emulated soft-reset with
the device presence information received from the SATA-specific registers.
2011-04-21 20:56:34 +00:00
Attilio Rao
d0827a169b Add some more bit definitions:
- TCO_MESSAGEx: TCO specific regs providing the ability to monitor BIOS
  bootup activity.
- TCO_NEWCENTURY: reporting RTC year roll over.
- TCO_NMI2SMI_EN, TCO_NMI_NOW: controlling SMIs conversion to NMIs and
  NMI trigger.
- SMI_GBL_EN: Enabling SMI delivery for all the northbridge controller.

MFC after:	10 days
2011-04-21 14:39:33 +00:00
Alexander Motin
53479021ba - Fix mapping of the last two SATA ports on 6-port Intel controllers.
This improves hard-reset and hot-plug on these ports.
 - Device with ID 0x29218086 is a 2-port variant of ICH9 in legacy mode.
Skip probing for nonexistent slave devices there.
2011-04-21 11:44:16 +00:00
Alexander Motin
f8c9d0d8c8 Use periodic status polling added at r214671 only in ATA_CAM mode. Legacy
mode won't receive much benefit from it due to its hot-plug limitations.
2011-04-21 09:02:19 +00:00
Adrian Chadd
5689734183 Convert to new ieee80211_mimo_info format. 2011-04-21 08:20:56 +00:00
Alexander Motin
2ef549f3e8 Make PATA-like soft-reset in ata(4) more strict in checking disk signature.
It allows to avoid false positive device detection under Xen, that caused
long probe delays due to subsequent IDENTIFY command timeouts.

MFC after:	1 month
2011-04-21 07:26:14 +00:00
Navdeep Parhar
fb12416c9f Ring the freelist doorbell from within refill_fl. While here, fix a bug
that could have allowed the hardware pidx to reach the cidx even though
the freelist isn't empty.  (Haven't actually seen this but it was there
waiting to happen..)

MFC after:	1 week
2011-04-20 23:20:00 +00:00
Hans Petter Selasky
aca2249d54 Only set the sample rate if the USB audio channel reports
that it supports the frequency control request.

MFC after:	7 days
Approved by:	thompsa (mentor)
2011-04-20 19:41:08 +00:00
Navdeep Parhar
b5a6d97e1e Use the correct free routine when destroying a control queue.
X-MFC after:	r220873
2011-04-20 18:04:34 +00:00
Bernhard Schmidt
9cfb2cd173 Now that all bits are in for 1030/6230 adapters enable those.
While here pull the adapter names from the Linux driver and sort
the list by ID.
2011-04-20 17:49:05 +00:00
Bernhard Schmidt
57becf59ea The 6000 series gen2 adapters have 2 firmware images, one with
advanced btcoex support and one without.
2011-04-20 17:43:20 +00:00
Bernhard Schmidt
8bb237d949 Add basic support for advanced bluetooth coexistence required
for 6005 gen2b (1030/6030) adapters.
2011-04-20 16:59:27 +00:00
Navdeep Parhar
657d9381b1 Use Toeplitz hash for RSS.
MFC after:	3 days
2011-04-19 22:14:18 +00:00
Navdeep Parhar
f7dfe243b4 - Move all Ethernet specific items from sge_eq to sge_txq. sge_eq is
now a suitable base for all kinds of egress queues.

- Add control queues (sge_ctrlq) and allocate one of these per hardware
  channel.  They can be used to program filters and steer traffic (and
  more).

MFC after:	1 week
2011-04-19 22:08:28 +00:00
Matthew D Fleming
6e6d95d1b9 Correctly output the entire array for hw.acpi.thermal._ACx.
Reported by:	Taku YAMAMOTO < taku AT tackymt DOT homeip DOT net >
Tested by:	Nick Ulen < uncle AT wolfman DOT devio DOT us >
2011-04-19 20:44:43 +00:00
Bernhard Schmidt
d37f258ba9 Enable DC calibration for all 6000 series devices, except those
with an internal PA.
Override the chainmask also for the 6050.
2011-04-19 19:51:35 +00:00
Bernhard Schmidt
9ff2129fbe Pull some features out of the firmware:
- If a ENH_SENS TLV section exit the firmware is capable of doing
  enhanced sensitivity calibration.
- Newer devices/firmwares have more calibration commands therefore
  hardcoding the noise gain/reset commands no longer works. It is
  supposed to use the next index after the newest calibration type
  support. Read the command index of the TLV section if available.
2011-04-19 19:47:41 +00:00
Dimitry Andric
58ff0f42ba Remove support for the Intel C Compiler from the build infrastructure.
This support has not worked for several years, and is not likely to work
again, unless Intel decides to release a native FreeBSD version of their
compiler. ;)
2011-04-19 18:09:21 +00:00
Marius Strobl
4ef498c23e Remove a comment which is no longer true since r213878, apart from
this driver not using mii(4) in the first place.

Reviewed by:    yongari
2011-04-19 17:49:59 +00:00
Alexander Motin
7bcc595738 Fix some English grammar. 2011-04-19 10:57:40 +00:00
Alexander Motin
1f145eafea According to specification. device should respond to COMRESET with COMINIT
in no more then 10ms. If we detected no device presence within that time,
there is no reason to wait longer.
2011-04-19 10:51:19 +00:00
Alexander Motin
6ac0befde2 Properly handle memory allocation errors during error recovery. 2011-04-19 08:01:17 +00:00
Jung-uk Kim
6af444b118 Do not assume PM timer GAS type is I/O or memory. It may be an unsupported
type, i. e., a broken table.  Also, do not hardcode ACPI timer frequency in
device description.
2011-04-18 23:12:41 +00:00
Matthew D Fleming
8db47cc0d4 Fix a few acpi sysctls that want "IK" formatting to specify CTLTYPE_INT.
This got broken after r217586.

Pointy hat:	to me
Tested by:	David Wolfskill < davit AT catwhisker DOT org >
2011-04-18 19:02:41 +00:00
Alexander Motin
18301f742e Handle ready timeout during polled operation same as done in mvs(4) before. 2011-04-18 16:00:46 +00:00
Adrian Chadd
3788ebed54 For now, only enable GTT. CST is firing very frequently during local tests;
I'll figure out what's going on before re-enabling this as it does add
to the interrupt load.
2011-04-18 14:14:54 +00:00
Adrian Chadd
5594f5c066 Add TX carrier sense timeout statistics. 2011-04-18 14:06:18 +00:00
Adrian Chadd
abc8309448 Bump pad, I'm adding more statistics. 2011-04-18 14:03:37 +00:00
Adrian Chadd
d0a0ebc6c3 Rework the Global TX timeout handling to look more like ath9k.
It correctly now sets the AR_IMR BCNMISC register, along with
the GTT register in AR_IMR_S2.
2011-04-18 14:03:05 +00:00
Alexander Motin
3a3d820b3d - Tune different wait loops to cut some more milliseconds from reset time.
- Do not call ahci_start() before device signature received. It is required
by the specification and caused non-fatal reset timeouts on AMD chipsets.
2011-04-18 13:34:31 +00:00
Adrian Chadd
6ad02dbafe Add global TX timeout handling.
The global TX timeout counter increments whenever a frame is ready
to be transmitted and the medium is busy.
2011-04-18 12:15:43 +00:00
Adrian Chadd
d10f1cdc8c Mark the PHY as inactive before the chip is reset.
It's also marked inactive by the initvals, and enabled after
the baseband/PLL has been configured, but before the RF
registers have been programmed.

The origin and reason for this particular change is currently unknown.

Obtained from:	Linux ath9k
2011-04-17 13:46:13 +00:00
Bernhard Schmidt
9dd0e40b62 Add some new features:
- 6000 series devices need enhanced sensitivity calibration.
- 6000 series devices need a different setting for the shadow reg.
- set the IWN_FLAG_HAS_11N bit if the EEPROM says the device has 11n
  support.

Obtained from:	OpenBSD
2011-04-16 14:56:13 +00:00
Bernhard Schmidt
552e368d27 Bring over the HAL/OPS changes, instead of two const structs it is now
slightly more dynamic.

Obtained from:	OpenBSD
2011-04-16 14:51:46 +00:00
Bernhard Schmidt
61a504f68f Read RX/TX chainmasks directly of the EEPROM. Some chips are known to
have the wrong/broken information stored, keep the hardcoded values for
those.

Obtained from:	OpenBSD
2011-04-16 14:49:29 +00:00
Bernhard Schmidt
a987f807de Just a whitespace sync, some more style(9) conform then others. 2011-04-16 14:40:42 +00:00
Bernhard Schmidt
6cc1bb61fa Sync comments with OpenBSD. 2011-04-16 14:38:57 +00:00
Bernhard Schmidt
80ee921916 Sync debug and error messages with OpenBSD. 2011-04-16 14:38:01 +00:00
Bernhard Schmidt
786b72c5bc Shuffle code around a bit. Mostly to group functional connected things,
others to get the same order as the OpenBSD code.
2011-04-16 14:36:43 +00:00
Adrian Chadd
b39c47d922 Don't do Kite antenna switch selection this way (for now); antenna
diversity is done elsewhere now.
2011-04-16 13:47:17 +00:00
Bernhard Schmidt
5fd12c76a8 Rename some stuff in favour of the OpenBSD names:
- prefer EDCA over WME
- qid for a TXQ ID
- reg for register values
2011-04-16 13:40:32 +00:00
Bernhard Schmidt
4e61a8e57c Fix WME/QoS handling:
- move the TX queue selection into iwn_tx_data/iwn_tx_data_raw
- extract traffic identifier and use it
- do not expect ACKs for frames marked as such
2011-04-16 13:25:19 +00:00
Bernhard Schmidt
baa8b4ad20 Remove if_ierrors which do not necessarily indicate a RX error, also
do account send packets. While here use the IWN_TX_FAIL constant.
2011-04-16 13:12:12 +00:00
Adrian Chadd
52d84465a2 Disable classic-style fast diversity on the AR5416 and later.
Antenna diversity on the >= AR5416 is implemented differently than the
AR5212 and previous chips. So for now, and not to confuse things, just
disable it for now.
2011-04-16 12:46:46 +00:00
Bernhard Schmidt
3096855e8c Instead of hardcoding TX rates and using that to fill the retry table
use the neogotiated ni_rates instead.
2011-04-16 12:42:54 +00:00
Adrian Chadd
18a3a3309f Remove some duplicate code from the AR9285 TX power configuration path. 2011-04-16 11:59:37 +00:00
Bernhard Schmidt
7223fe84f2 Replace RX/TX ring allocation error messages with something more sane
and remove those where the caller already prints one.
2011-04-16 11:14:42 +00:00
Bernhard Schmidt
0df53de1c3 Prevent double-free, also use the same error codes as OpenBSD. 2011-04-16 11:11:22 +00:00
Bernhard Schmidt
47c2ecefcc Add missing bus_dmamap_sync calls as well as remove two duplicate ones.
Obtained from:	OpenBSD
2011-04-16 10:52:11 +00:00
Bernhard Schmidt
fac0198998 Unify TX/RX ring allocation, finish the descriptior DMA stuff before
starting with data.
2011-04-16 10:38:27 +00:00
Bernhard Schmidt
a59641a1a4 Make sure to destroy all DMA tags and maps. 2011-04-16 10:35:02 +00:00
Bernhard Schmidt
1f43fb20f2 Rewrite DMA segment handling to be more inline with the OpenBSD code.
Also change the m_len == 0 hack to have less code churn.
2011-04-16 10:32:46 +00:00
Bernhard Schmidt
58e6c20852 scratch_paddr has the same address pre-assigned, use that instead. 2011-04-16 09:39:08 +00:00
Bernhard Schmidt
f75e83846a In case a new mbuf can't be loaded, reuse the old one. 2011-04-16 09:34:40 +00:00
Bernhard Schmidt
3f01dc2d9d OpenBSD uses IWN_RBUF_SIZE not MJUMPAGESIZE for the RX path, also replace
caddr_t with void * to be in sync.
2011-04-16 08:59:21 +00:00
Bernhard Schmidt
5c222f4bc8 Remove the flags argument of iwn_dma_contig_alloc(), it is always set
as BUS_DMA_NOWAIT. While here also set BUS_DMA_COHERENT.
2011-04-16 08:57:17 +00:00
Bernhard Schmidt
65aa0234f0 RSSI related syncs with the OpenBSD code:
- read RSSI only for the active chains
- cast RSSI/NF to int8_t before passing it up to radiotap
- remove the htole64() for the timestamp

Obtained from:	OpenBSD
2011-04-16 07:32:57 +00:00
Bernhard Schmidt
1eccdf31c1 Pass errors that might happen during state transitions up to net80211. 2011-04-16 07:21:00 +00:00
Bernhard Schmidt
c2c3b03223 Obtain the channel number directly from the laster RXON command, also
chan is an uint8_t.
2011-04-16 07:17:03 +00:00
Bernhard Schmidt
f6bb3360b6 fix the order of the prototypes from the previosu commit 2011-04-15 20:40:49 +00:00
Bernhard Schmidt
89a84499e4 The 6005 series devices need additional temperature offset calibration
as well as the IWN_GP_DRIVER_CALIB_VER6 bit set.

Obtained from:	OpenBSD
2011-04-15 20:35:15 +00:00
Bernhard Schmidt
083e216732 Revert some of local calibration changes in favour of the OpenBSD
implementation. This includes the fix required for the 6050 series
devices.
2011-04-15 20:31:02 +00:00
Bernhard Schmidt
518e267e38 remove debug left-overs 2011-04-15 20:19:18 +00:00
Bernhard Schmidt
af2e228dc4 Split up watchdog and calibration callout. This allows us to use different
timing on both and to remove some monitor mode specific hacks (which has
no calibration).
2011-04-15 20:17:52 +00:00
Bernhard Schmidt
16b483cb8d Split out bluetooth coexistence setup. 2011-04-15 17:10:52 +00:00
Bernhard Schmidt
b558f70709 Fixes for firmware handling:
- there is a local variable for sc->fw_dma, use that instead
- OpenBSD uses 5*hz to wait for firmware to be loaded
- in case the firmware module contains invalid data, actually release it
2011-04-15 16:59:56 +00:00
Bernhard Schmidt
a7387751dd Only handle beacon misses while in RUN state and not scanning. 2011-04-15 16:55:45 +00:00
Bernhard Schmidt
69e775c384 Don't timeout when stopping DMA channels.
Obtained from:	OpenBSD
2011-04-15 16:50:37 +00:00
Alexander Motin
06ccfe1dd7 Some changes around hot-plug and interface power-management:
- use ATA_SE_EXCHANGED (SError.DIAG.X) bit to detect hot-plug events when
power-management enabled and ATA_SE_PHY_CHANGED (SError.DIAG.N) can't be
trusted;
 - on controllers supporting staggered spin-up (SS) put unused channels
into Listen state instead of Off. It should still save some power, but
allow plug-in events to be detected;
 - on controllers supporting cold presence detection (CPD), when power
management enabled, use CPD events to detect hot-plug in addition to PHY
events.
2011-04-15 16:40:31 +00:00
Navdeep Parhar
2be67d2948 Fix a couple of bad races that can occur when a cxgbe interface is taken
down.  The ingress queue lock was unused and has been removed as part of
these changes.

- An in-flight egress update from the SGE must be handled before the
  queue that requested it is destroyed.  Wait for the update to arrive.

- Interrupt handlers must stop processing rx events for a queue before
  the queue is destroyed.  Events that have not yet been processed
  should be ignored once the queue disappears.

MFC after:	1 week
2011-04-15 03:09:27 +00:00
Jung-uk Kim
4a8fa6fe58 Add event handlers for (ACPI) suspend/resume events. Suspend event handlers
are invoked right before device drivers go into sleep state and resume event
handlers are invoked right after all device drivers are waken up.
2011-04-14 22:17:39 +00:00
Navdeep Parhar
6b49a4ece8 There is no need to request a tx credit flush if such a request is already
pending.

MFC after:	3 days
2011-04-14 20:06:23 +00:00
Bernhard Schmidt
9289984d4b Instead of trying to figure out which rxon.flags to clear, restart
from scratch. Remove htole16() calls, rxon.chan is an uint8_t,
ieee80211_chan2ieee() does return an ic_ieee as an int, but I heavily
doubt a htole16() will buy us anything here.
2011-04-14 17:42:21 +00:00
Bernhard Schmidt
8dace48f6b iwn_cleanup() is just a wrapper around iwn_detach(), call it directly
instead.
2011-04-14 17:31:34 +00:00
Bernhard Schmidt
b2d64bef7e Reuse net80211 code:
- IWN_TXOP_TO_US is equal to IEEE80211_TXOP_TO_US
- use IEEE80211_DUR_TU
- ieee80211_add_rates/ieee80211_add_xrates are public, use em
- copied ieee80211_add_ssid it is not public
2011-04-14 17:26:13 +00:00
Bernhard Schmidt
abd8979b98 Remove IWN_FLAG_HAS_5GHZ and IWN_PCI_BAR0, both unused. 2011-04-14 17:19:33 +00:00
Alexander Motin
70b7af2b21 Refactor hard-reset implementation in mvs(4).
Instead of spinning in a tight loop for up to 15 seconds, polling for device
readiness while it spins up, return reset completion just after PHY reports
"connect well" or 100ms connection timeout. If device was found, use callout
for checking device readiness with 100ms period up to full 31 second timeout.

This fixes system freeze for 5-10 seconds on drives hot plug-in.
2011-04-14 07:49:45 +00:00
Ruslan Ermilov
14689886a5 Fixed firmware revision decoding:
- the major is 7-bit binary encoded
- the minor is BCD encoded

PR:		kern/151586
MFC after:	3 days
2011-04-14 07:14:22 +00:00
Jung-uk Kim
5331d61da4 Add some tunable descriptions about x86 timers.
Requested by:	arundel
2011-04-14 00:07:08 +00:00
Pyun YongHyeon
246419ba87 Remove mii(4) dependency and unneeded headers.
Reviewed by:	davidch
2011-04-13 16:35:43 +00:00
Alexander Motin
8d169381e4 Improve SATA Asynchronous Notification feature support in CAM:
- make SATA SIMs announce capabilities to handle SDB with Notification bit;
 - make PMP driver honor this SIMs capability;
 - make SATA XPT to negotiate and enable this feature for ATAPI devices.

This feature allows supporting SATA ATAPI devices to inform system about
some events happened, that may require attention. In my case this allows
LG GH22LS50 SATA DVR-RW drive to report tray open/close events. Events
reported to CAM in form of AC_SCSI_AEN async. Further they could be used
as a hints for checking device status and reporting media change to upper
layers, for example, via spoiling mechanism of GEOM.
2011-04-13 16:20:54 +00:00
Adrian Chadd
235ab70e0a Add in the AR9285 (Kite) diversity to if_ath, enabling TX/RX antenna
diversity.

This is bit dirty and likely should be revised at a later date,
with an eye to unifying/tidying up the whole diversity setup
and allowing developers to do "tricky stuff" as they desire.
For now, this works.
2011-04-13 15:17:23 +00:00
Adrian Chadd
81484cdb07 Add in the last bit of the HAL support for Kite diversity.
* add a new method, specifically for doing per-RX packet
  antenna diversity
* set that HAL method only if it's Kite and a Kite chip that
  does diversity.
2011-04-13 15:12:48 +00:00
Adrian Chadd
1171c869d7 More kite diversity related changes.
* add a diversity flag to the HAL debugging section
* add a check to make sure the kite diversity code doesn't run
  on boards that don't require it, as not all Kite chips will
  implement it.
* add some debug statements when the diversity code makes
  changes to the antenna diversity/combining setup.
2011-04-13 15:08:51 +00:00
Adrian Chadd
ac27b8ff27 Change this to be less noisy. 2011-04-13 14:51:07 +00:00
Adrian Chadd
77823fbc2c Bring over the antenna diversity logic support for Kite.
Again, this is just the code ported from ath9k and included in the build,
it isn't yet enabled.
2011-04-13 11:32:15 +00:00
Alexander Motin
54fc853acf As soon as siis_reset() doesn't waits for device readiness, but only for
controller port readiness (that should set just after PHY ready signal),
reduce wait time from 10s to 1s before trying more aggressive reset method.

This should improve system responsibility in some failure conditions.
2011-04-13 06:36:22 +00:00
Adrian Chadd
c772d0204f Port over a TX gain fix from ath9k specific to the AR9285 (Kite) and AR9271.
Note: this HAL currently only supports the AR9285.

From Linux ath9k:

The problem is that when the attenuation is increased,
the rate will start to drop from MCS7 -> MCS6, and finally
will see MCS1 -> CCK_11Mbps. When the rate is changed b/w
CCK and OFDM, it will use register desired_scale to calculate
how much tx gain need to change.

The output power with the same tx gain for CCK and OFDM modulated
signals are different. This difference is constant for AR9280
but not AR9285/AR9271. It has different PA architecture
a constant. So it should be calibrated against this PA
characteristic.

The driver has to read the calibrated values from EEPROM and set
the tx power registers accordingly.
2011-04-13 04:40:59 +00:00