Commit Graph

22931 Commits

Author SHA1 Message Date
Adrian Chadd
ac3fb727ff * Force the MAC to wakeup before we try resetting it, to ensure
it actually _gets_ reset properly.
* Add some more comments describing why things are done.

Obtained from:	Atheros
2011-11-09 14:34:25 +00:00
Adrian Chadd
985c86c038 Tidy up the AR9287 HAL a tiny bit - fix up AR9280 references. 2011-11-09 14:30:58 +00:00
Hans Petter Selasky
5086c26a6c Some minor corrections to a modem driver.
PR:		usb/162307
MFC after:	3 days
2011-11-09 09:15:57 +00:00
Adrian Chadd
2e4464a4af Migrate the AR5416 ANI code to use the previously introduced method
to fetch the current channel busy statistics, rather than duplicating
it here.

This forms the (very crude) basis for doing basic channel surveying.

Sponsored by:	Hobnob, Inc.
2011-11-09 05:48:20 +00:00
Adrian Chadd
26ae0bb475 Disable OFDM weak signal detection by default. Leave this to be
enabled if required by STA operation.

This quietens a lot of OFDM errors seen in hostap mode, where
there are no beacon RSSI levels to tune the dynamic range of the
baseband.

This may reduce reception range at the fringes, but does increase
stability.

Sponsored by:	Hobnob, Inc.
2011-11-09 05:45:30 +00:00
Adrian Chadd
eb81a8f672 Use a restricted set of parameters when operating in hostap mode.
The 5ghz hostap mode (where DFS is being done) requires ANI to be disabled
or the radar detection parameters don't work as advertised (as they're based
on signal strength level, and tweaking ANI affects the signal strangth,
dynamic range and power increase the baseband is looking for in order to
detect it as a "signal".)

Obtained from:	Linux, Atheros
Sponsored by:	Hobnob, Inc.
2011-11-09 05:43:48 +00:00
Adrian Chadd
7f6a8cca83 Add logic to ANI to tweak the firstep parameter when in hostap mode.
This is normally done based on the beacon RSSI but this isn't available
in hostap mode.

Obtained from:	Atheros
Sponsored by:	Hobnob, Inc.
2011-11-09 05:41:40 +00:00
Adrian Chadd
fcf3bb80d5 .. and add some ANI fixes missing from the last ANI commit.
Obtained from:	Atheros
Sponsored by:	Hobnob, Inc.
2011-11-09 05:39:17 +00:00
Adrian Chadd
581449cb66 Include some ANI fixes for the AR5416.
* If we fall through from an ANI command (eg because it's out of range,
  or it's disabled) then fall through to the next ANI command rather then
  being stuck there.

* Fix some off-by-one comparisons, meaning the final level in some parameters
  were never tweaked.

Obtained from:	Atheros
Sponsored by:	Hobnob, Inc.
2011-11-09 05:37:11 +00:00
Adrian Chadd
d3054f72e0 Add a new HAL parameter which forces a full reset rather than warm reset.
This forces a full reset of the baseband/radio and seems needed to clear
some issues (with Merlin at least) when the baseband gets confused in a
very noisy environment.

Sponsored by:	Hobnob, Inc.
2011-11-09 05:30:24 +00:00
Adrian Chadd
a1dd224b99 Port over a new routine which grabs the percentage of time spent in TX frame, RX frame,
RX clear, RX extension clear.

This is useful for estimating channel business.

The same routines should be written for AR5210->AR5212 where appopriate.

Obtained from:	Atheros
2011-11-09 05:25:30 +00:00
Adrian Chadd
020d7846cb Add in some more PCI/PCIe differentiation. 2011-11-09 04:38:27 +00:00
Adrian Chadd
5b77f8e9f5 Try to make it more obvious when users are using the PCI or PCIe versions of
the 11n chips.
2011-11-09 04:35:33 +00:00
Adrian Chadd
ec3dec2ff3 Fix the compile to work when IEEE80211_DEBUG isn't defined.
Sponsored by:	Hobnob, Inc.
2011-11-09 04:08:01 +00:00
Adrian Chadd
31fdf3d6d2 Fix the KTR option to compile by default - it was referencing
some unmerged interrupt status debugging code from my branch.

* Add ah_intrstate[8] which will have the record of the last
  call to ath_hal_getintr().
* Wrap the KTR code behind ATH_KTR_INTR_DEBUG.
* Add the HAL interrupt debugging behind AH_INTERRUPT_DEBUGGING.

This is only done for the AR5416 and later NICs but it will be
trivial to add to the earlier NICs if required.

Neither are enabled by default, although to minimise HAL binary
API differences, the ah_intrstate[] array is always compiled into
the ath_hal struct.
2011-11-08 22:50:28 +00:00
Adrian Chadd
eb6f0de09d Introduce TX aggregation and software TX queue management
for Atheros AR5416 and later wireless devices.

This is a very large commit - the complete history can be
found in the user/adrian/if_ath_tx branch.

Legacy (ie, pre-AR5416) devices also use the per-software
TXQ support and (in theory) can support non-aggregation
ADDBA sessions. However, the net80211 stack doesn't currently
support this.

In summary:

TX path:

* queued frames normally go onto a per-TID, per-node queue
* some special frames (eg ADDBA control frames) are thrown
  directly onto the relevant hardware queue so they can
  go out before any software queued frames are queued.
* Add methods to create, suspend, resume and tear down an
  aggregation session.
* Add in software retransmission of both normal and aggregate
  frames.
* Add in completion handling of aggregate frames, including
  parsing the block ack bitmap provided by the hardware.
* Write an aggregation function which can assemble frames into
  an aggregate based on the selected rate control and channel
  configuration.
* The per-TID queues are locked based on their target hardware
  TX queue. This matches what ath9k/atheros does, and thus
  simplified porting over some of the aggregation logic.
* When doing TX aggregation, stick the sequence number allocation
  in the TX path rather than net80211 TX path, and protect it
  by the TXQ lock.

Rate control:

* Delay rate control selection until the frame is about to
  be queued to the hardware, so retried frames can have their
  rate control choices changed. Frames with a static rate
  control selection have that applied before each TX, just
  to simplify the TX path (ie, not have "static" and "dynamic"
  rate control special cased.)
* Teach ath_rate_sample about aggregates - both completion and
  errors.
* Add an EWMA for tracking what the current "good" MCS rate is
  based on failure rates.

Misc:

* Introduce a bunch of dirty hacks and workarounds so TID mapping
  and net80211 frame inspection can be kept out of the net80211
  layer. Because of the way this code works (and it's from Atheros
  and Linux ath9k), there is a consistent, 1:1 mapping between
  TID and AC. So we need to ensure that frames going to a specific
  TID will _always_ end up on the right AC, and vice versa, or the
  completion/locking will simply get very confused. I plan on
  addressing this mess in the future.

Known issues:

* There is no BAR frame transmission just yet. A whole lot of
  tidying up needs to occur before BAR frame TX can occur in the
  "correct" place - ie, once the TID TX queue has been drained.

* Interface reset/purge/etc results in frames in the TX and RX
  queues being removed. This creates holes in the sequence numbers
  being assigned and the TX/RX AMPDU code (on either side) just
  hangs.

* There's no filtered frame support at the present moment, so
  stations going into power saving mode will simply have a number
  of frames dropped - likely resulting in a traffic "hang".

* Raw frame TX is going to just not function with 11n aggregation.
  Likely this needs to be modified to always override the sequence
  number if the frame is going into an aggregation session.
  However, general raw frame injection currently doesn't work in
  general in net80211, so let's just ignore this for now until
  this is sorted out.

* HT protection is just not implemented and won't be until the above
  is sorted out. In addition, the AR5416 has issues RTS protecting
  large aggregates (anything >8k), so the work around needs to be
  ported and tested. Thus, this will be put on hold until the above
  work is complete.

* The rate control module 'sample' is the only currently supported
  module; onoe/amrr haven't been tested and have likely bit rotted
  a little. I'll follow up with some commits to make them work again
  for non-11n rates, but they won't be updated to handle 11n and
  aggregation. If someone wishes to do so then they're welcome to
  send along patches.

* .. and "sample" doesn't really do a good job of 11n TX. Specifically,
  the metrics used (packet TX time and failure/success rates) isn't as
  useful for 11n. It's likely that it should be extended to take into
  account the aggregate throughput possible and then choose a rate
  which maximises that. Ie, it may be acceptable for a higher MCS rate
  with a higher failure to be used if it gives a more acceptable
  throughput/latency then a lower MCS rate @ a lower error rate.
  Again, patches will be gratefully accepted.

Because of this, ATH_ENABLE_11N is still not enabled by default.

Sponsored by:	Hobnob, Inc.
Obtained from:	Linux, Atheros
2011-11-08 22:43:13 +00:00
Adrian Chadd
0d5f2f26fe Add support to the TX descriptor printing code to follow ath_buf
chains. This allows for debugging of aggregate frames.

Sponsored by:	Hobnob, Inc.
2011-11-08 22:01:03 +00:00
Adrian Chadd
1f25c0f7a7 Make sure TXEOL is set on default queues. Otherwise we don't get an
interrupt on the completion of a TX queue and this can cause TX
hangs / timeout.

Sponsored by:	Hobnob, Inc.
2011-11-08 21:55:40 +00:00
Adrian Chadd
9352fb7ab0 Refactor out the TX buffer management and completion code in
preparation for TX aggregation.

* Add in logic which calls ath_buf bf->bf_comp if it's set.
  This allows for AMPDU (and RIFS, and FF, if someone desires) code
  to handle completion - which includes freeing subframes, retransmitting
  subframes, etc.

* Break out the buffer free, buffer busy/unbusy default completion handler
  code into separate functions. This allows bf_comp methods to free and
  unbusy each subframe ath_buf as required.

* Break out the statistics update code into a separate function, just
  to clean up the TX completion path a little.

Sponsored by:	Hobnob, Inc.
2011-11-08 21:49:33 +00:00
Adrian Chadd
6edf1dc729 Change the descriptor logic to use bf_lastds to point to the last
descriptor, rather than using the maths involving bf_desc[bf_nseg - 1].

When doing TX aggregation, the status will be updated in the -final-
descriptor of the -final- subframe in an aggregate. Thus bf_lastds
may point to the last descriptor in a completely different ath_buf.

Sponsored by:	Hobnob, Inc.
2011-11-08 21:25:36 +00:00
Adrian Chadd
e346b0732c Change ath_buf allocation to:
* Immediately return NULL if a buffer isn't available;
* Track the "buffers not available" count;
* Clear some fields used for tx aggregation;
* Add ath_buf_clone() which clones the majority of buffer state.
  This is needed when retransmission of a "busy" buffer is required.

Sponsored by:	Hobnob, Inc.
2011-11-08 21:13:05 +00:00
Adrian Chadd
2d43342484 Break out the TX DMA stop code into a separate function.
Sponsored by:	Hobnob, Inc.
2011-11-08 21:06:36 +00:00
Adrian Chadd
55c7b87745 Add a 'vap' to ath_keyset().
Add some code (which is currently disabled) which modifies the group
multicast key cache behaviour. I haven't yet figured out what the
exact/correct behaviour is so I'm leaving it disabled. It's worth
investigating and "correcting", especially for future work with
mesh/ibss and encryption.

Sponsored by:	Hobnob, Inc.
2011-11-08 19:25:52 +00:00
Adrian Chadd
16d4de92f9 Some more various fixes, etc from my 11n branch.
* When doing software TX queue handling and flush, it's possible
  that the deletion of a VAP (eg a STA shutdown) will queue a
  "STA Disassociate" frame whilst the interface is being deleted.
  The VAP is then deleted, and the frame ends up being queued
  to a node that is freed before it can be TX'ed. Things go awry
  at this point.

  There's no way at the present to avoid freeing the underlying node
  when the vap is being deleted. It's too late in the game.

  I suspect the real fix is to make sure the frame is software
  queued with no completion information somehow, so it doesn't
  link back to a node whose underlying VAP has been freed.
  For now, we'll just have to do this.

* Add some comments showing what's going on.

* Move an instance of the ATH_LOCK() around to protect the interrupt
  set. I'll worry about changing that to a PCU lock later on once
  the 11n code is in the tree.

Sponsored by:	Hobnob, Inc.
2011-11-08 19:18:34 +00:00
Adrian Chadd
f52d345218 Add KTR tracepoints to the ath driver, in order to debug TX, RX
and interrupt handling.

Sponsored by:	Hobnob, Inc.
2011-11-08 19:02:59 +00:00
Adrian Chadd
517526efe8 In preparation for supporting 11n TX/RX properly, allow for TX queue draining
and interface resets to be marked as ATH_RESET_DEFAULT, ATH_RESET_FULL,
ATH_RESET_NOLOSS.

Currently a reset is still a reset - ie, all tx/rx frames in the hardware
queues are purged. This means that those frames will be lost to the 11n TX
and RX aggregation state tracking, breaking AMPDU sessions.

The (eventual) new semantics:

* ATH_RESET_DEFAULT:
      full reset, this is the default for reset situations
      which I haven't yet figured out what they should be.
* ATH_RESET_FULL:
      A full reset - for things such as channel changes.
* ATH_RESET_NOLOSS:
      Don't flush TX/RX queues - handle pending RX frames and leave TX
      frames where they are; restart TX DMA from where it was.
2011-11-08 18:56:52 +00:00
Adrian Chadd
4afa805ec7 Break out the node cleanup and node free path, in preparation for
doing software TX queue management.

The software queued TX frames will be freed by the new cleanup
function.

Sponsored by:	Hobnob, Inc.
2011-11-08 18:48:26 +00:00
Adrian Chadd
96ff485dc3 Preparation for correct 802.11n tx/rx handling.
* Change ath_rx_proc() to ath_rx_tasklet(); make that the taskqueue function.
  This way (eventually) ath_rx_proc() can be called from elsewhere in the
  packet reset/processing queue so frames aren't just "flushed" during
  interface resets/reconfigure. This breaks 802.11n RX aggregation tracking.
* Extend ath_tx_proc() to take a 'resched' flag, which marks whether to
  reschedule further RX PCU reads or not.
* Change ath_tx_processq() to take a "dosched" flag, which will eventually
  be used to indicate whether to reschedule the software TX scheduler.

Sponsored by:	Hobnob, Inc.
2011-11-08 18:45:15 +00:00
Adrian Chadd
0f0c074eaa Conditionally compile the PCI latency workaround; I think it's
only required for some earlier NICs.
2011-11-08 18:37:52 +00:00
Pyun YongHyeon
10a4360c80 Retire 'options TI_PRIVATE_JUMBOS' and replace local jumbo
allocator with UMA backed jumbo allocator by default. Previously
ti(4) used sf_buf(9) interface for jumbo buffers but it was broken
at this moment such that enabling jumbo frame caused instant panic.
Due to the nature of sf_buf(9) it heavily relies on VM changes but
it seems ti(4) was not received much blessing from VM gurus.  I
don't understand VM magic and implications used in driver either.
Switching to UMA backed jumbo allocator like other network drivers
will make jumbo frame work on ti(4).
While I'm here, fully allocate all RX buffers. This means ti(4) now
uses 512 RX buffer and 1024 mini RX buffers.

To use sf_buf(9) interface for jumbo buffers, introduce a new
'options TI_SF_BUF_JUMBO'. If it is proven that sf_buf(9) is better
for jumbo buffers, interesting developers can fix the issue in
future.

ti(4) still needs more bus_dma(9) cleanups and should use separate
DMA tag/map for each ring(standard, jumbo, mini, command, event
etc) but it should work on all platforms except PAE.

Special thanks to Jay[1] who provided complete remote debugging
access.

Tested by:	Jay Borkenhagen <jayb <> braeburn dot org > [1]
2011-11-08 18:23:02 +00:00
Adrian Chadd
8f939e7967 Merge in some fixes from the if_ath_tx branch.
* Close down some of the kickpcu races, where the interrupt handler
  can and will run concurrently with the taskqueue.
* Close down the TXQ active/completed race between the interrupt
  handler and the concurrently running tx completion taskqueue
  function.
* Add some tx and rx interrupt count tracking, for debugging.
* Fix the kickpcu logic in ath_rx_proc() to not simply drain and
  restart the TX queue - instead, assume the hardware isn't
  (too) confused and just restart RX DMA. This may break on
  previous chipsets, so if it does I'll add a HAL flag and
  conditionally handle this (ie, for broken chipsets, I'll
  just restore the "stop PCU / flush things / restart PCU"
  logic.)
* Misc stuff

Sponsored by:	Hobnob, Inc.
2011-11-08 18:10:04 +00:00
Adrian Chadd
6b349e5a86 Migrate the STAILQ lists to TAILQs.
A bunch of the 11n TX aggregation logic wants to traverse lists of buffers
in various ways. In order to provide O(1) behaviour in this instance,
use TAILQs.

This does blow out the memory footprint and CPU cycles slightly for some
of these operations. I may convert some of these back to STAILQs once
the rest of the software transmit queue handling has been stabilised.

Sponsored by:	Hobnob, Inc.
2011-11-08 17:08:12 +00:00
Adrian Chadd
87acb7d512 Some cosmetic fixes to ath_rate_sample.
* Use 64 bit integer types for the sample rate statistics.
  When TX'ing 11n aggregates, a 32 bit counter will overflow in a few
  hours due to the high packet throughput.

* Create a default label of "" rather than defaulting to "Mb" - that way
  if a rate hasn't yet been selected, it won't say "-1 Mb".

Sponsored by:	Hobnob, Inc.
2011-11-08 14:46:03 +00:00
Adrian Chadd
3dd85b265f Begin merging in some of my 802.11n TX aggregation driver changes.
* Add a PCU lock, which isn't currently used but will eventually be
  used to serialise some of the driver access.

* Add in all the software TX aggregation state, that's kept per-node
  and per-TID.

* Add in the software and aggregation state to ath_buf.

* Add in hooks to ath_softc for aggregation state and the (upcoming)
  aggregation TX state calls.

* Add / fix the HAL access macros.

Obtained from:	Linux, ath9k
Sponsored by:	Hobnob, Inc.
2011-11-08 02:12:11 +00:00
Adrian Chadd
712a80b873 Bring over the 11n aggregation statistics struct from the if_ath_tx branch. 2011-11-08 01:35:44 +00:00
Adrian Chadd
10830c3812 Merge in ath rate flags and ath_rc_series from my 11n TX branch.
This is in preparation for 802.11n TX aggregation support.
2011-11-08 01:35:05 +00:00
Pyun YongHyeon
f9ea040e0c Do not allow changing MTU to be less than the minimum. 2011-11-07 22:58:49 +00:00
Pyun YongHyeon
aeeee7eec1 If ti_chipinit() fails in ti_stop(), ignore the error and release
all allocated TX/RX buffer resources. If the interface is brought
to up again after the error, we will leak allocated TX/RX buffers.
2011-11-07 22:53:06 +00:00
Pyun YongHyeon
4fce1b52ed Show RX buffer allocation failure and do not blindly send alive
message to firmware. Probably the correct way for this error is to
send a TI_CMD_CODE_STACK_DOWN message to firmware and let firmware
handle the rest.
2011-11-07 22:47:25 +00:00
Pyun YongHyeon
6280f2fb34 Mini ring is not available on Tigon 1 so do not create DMA maps for
mini ring on Tigon 1 to save resources.
2011-11-07 22:17:44 +00:00
Pyun YongHyeon
7beaf112a5 Track which ring was updated in RX handler and update only modified
ring. This should reduce unnecessary register accesses.
2011-11-07 22:11:38 +00:00
Pyun YongHyeon
18707510b7 o Remove unnecessary controller reinitialization.
o Do not blindly UP controller when MTU is changed. Reinitialize
   controller only if driver is running.
 o Remove useless ti_stop() in ti_watchdog() since ti_init_locked()
   always invokes ti_stop().
2011-11-07 18:26:38 +00:00
Pyun YongHyeon
bb6ebb6af8 Remove ti_unit member variable in softc.
While I'm here use PCIR_BAR macro.
2011-11-07 18:19:20 +00:00
Ed Schouten
6472ac3d8a Mark all SYSCTL_NODEs static that have no corresponding SYSCTL_DECLs.
The SYSCTL_NODE macro defines a list that stores all child-elements of
that node. If there's no SYSCTL_DECL macro anywhere else, there's no
reason why it shouldn't be static.
2011-11-07 15:43:11 +00:00
Ed Schouten
d745c852be Mark MALLOC_DEFINEs static that have no corresponding MALLOC_DECLAREs.
This means that their use is restricted to a single C file.
2011-11-07 06:44:47 +00:00
Hans Petter Selasky
e6c503f75a Fix build breakage for 8-stable and older.
MFC after:	0 days
2011-11-06 23:26:26 +00:00
Hans Petter Selasky
13ceb65482 Add support for new USB modem protocol.
PR:		usb/159919
MFC after:	1 week
2011-11-06 23:11:30 +00:00
Marius Strobl
f5cd6038aa Freeze the device queue if a request didn't complete without error and
isn't already frozen.
2011-11-06 22:28:13 +00:00
Ed Schouten
8f80f103b4 Remove MALLOC_DECLAREs of nonexisting malloc-pools.
After careful grepping, it seems none of these pools can be found in our
source tree. They are not in use, nor are they defined.
2011-11-06 20:16:50 +00:00
Matt Jacob
a0ec8e99ae Implement the sysctl's for fibre channel that are listed in the man page.
MFC after:	3 days
2011-11-06 00:44:40 +00:00
Hans Petter Selasky
0527a869a9 Implement support for modem control lines.
Don't short terminate transmitted BULK data.
Assume that the chip reads one USB packet at a time.

PR:		usb/162307
MFC after:	3 days
2011-11-05 12:01:51 +00:00
Pyun YongHyeon
129f7efda9 Implement altq(4) support.
While I'm here fix a logic error in r227098 where it didn't
re-enable interrupts when TX queue is empty.
2011-11-04 23:34:54 +00:00
Pyun YongHyeon
9c6960c61c Because ti(4) drops a driver lock in RX handler, check whether
driver is still running before re-enabling interrupts.
2011-11-04 23:09:57 +00:00
Pyun YongHyeon
85d21e66be Don't abuse if_hwassist and make sure enabling corresponding TX/RX
checksum offloading and VLAN hardware tag insertion/stripping from
the currently enabled hardware offloading capabilities.
Previously if_hwassist, which was initialized to TX/RX checksum
offloading, was blindly used to enable both TX and RX checksum
offloading such that disabling either TX or RX checksum offloading
was not possible.

ti(4) controllers support TX/RX checksum offloading with VLAN
tagging so announce TX/RX checksum offloading capability over VLAN
to vlan(4).

Make VLAN hardware tag insertion/stripping honors currently enabled
interface capability instead of blindly enabling VLAN hardware
tagging. This change allows disabling hardware support of VLAN tag.

Because ti(4) supports VLAN oversized frames, make network stack
know the capability by setting if_hdrlen.

While I'm here, rewrite SIOCSIFCAP handler and make sure to
reinitialize controller whenever TX/RX checksum offloading and VLAN
hardware tagging option is changed.  The requirement of controller
reinitialization comes from the limitation of Tigon I/II firmware.
Tigon I/II firmware requires all related RCBs should be
reinitialized whenever any of its hardware offloading capabilities
change.

vlan(4) is also notified whenever the parent interface's capability
changes such that it can correctly handle TX/RX checksum offloading
based on parent interface's enabled offloading capabilities.

RX checksum offloading handler was changed to make upper stack use
controller computed partial checksum value.  Previously, ti(4) just
set the computed value for any frames(IPv4, IPv6) and the value was
not used in upper stack because driver didn't set CSUM_DATA_VALID
such that upper network stack had to recompute checksum of TCP/UDP
packets. I have no idea how this was not noticed for a long time.
With this change, upper network stack does not have to fully
recompute the checksum such that calculating pseudo checksum based
on partial checksum is sufficient to know whether received packet's
checksum is correct or not. However, I don't know why ti(4) does
not have controller compute pseudo checksum as controller has
ability to do it. I'm just guessing enabling that feature could
trigger a firmware bug or could be slower than computing it on host
side so just leave it as it was.

In order not to produce false positives, ti(4) now checks whether
controller actually computed IP or TCP/UDP checksum by checking
ti_flags field.
2011-11-04 22:53:52 +00:00
Pyun YongHyeon
9645f9eb0b Don't clear upper 4bits from VLAN tag information. It's
responsibility of vlan(4) to extract VLAN id from the tag
information and vlan(4) correctly handles it.
2011-11-04 21:42:13 +00:00
Pyun YongHyeon
148386d9aa Introduce ti_ifmedia_upd_locked() to use in driver initialization
and add missing driver lock for both ti_ifmedia_upd() and
ti_ifmedia_sts().
2011-11-04 21:30:46 +00:00
Pyun YongHyeon
945c212659 Announce IFCAP_LINKSTATE capability and let network stack know link
state changes.  Hide superfluous link up/down message under
bootverbose since if_link_state_change(9) shows that information.
While I'm here, change baudrate with the resolved speed of the
established link instead of blindly setting it 1G. Unfortunately,
it seems there is no way to differentiate 10/100Mbps from
non-gigabit link so just assume we established a 100Mbps link if
current link is not a gigabit link.
2011-11-04 20:43:37 +00:00
Pyun YongHyeon
5948254c2a Make sure to unload loaded DMA area(descriptor, command, event ring). 2011-11-04 20:25:30 +00:00
Pyun YongHyeon
5ddfea8c43 s/u_intXX_t/uintXX_t/g 2011-11-04 19:12:07 +00:00
Pyun YongHyeon
ee715c5ff4 Make ti(4) build with 'options TI_PRIVATE_JUMBOS'.
This was broken in r175872.

We have a UMA backed jumbo allocator and that is much better
implementation than having a local jumbo buffer allocator in
driver. This local allocator would be removed in near future but
fixing build before removal wouldn't be a bad idea.
2011-11-04 18:39:39 +00:00
Pyun YongHyeon
504dc87bf4 style.
No functional changes.
2011-11-04 18:28:10 +00:00
Pyun YongHyeon
7034f3ad36 Use ANSI function definations. 2011-11-04 17:07:53 +00:00
Adrian Chadd
543d97bb43 Call the correct chipset power routine when disabling the AR5416 and later NICs. 2011-11-04 13:32:13 +00:00
Hans Petter Selasky
87a133a7a5 Fix for panic at USB controller attach failure during cold boot.
Reported by:	Jan Henrik Sylvester, Xin LI and more.
MFC after:	3 days
2011-11-04 09:19:18 +00:00
Bjoern A. Zeeb
0bc7cf6fde Add QLogic 10 Gigabit Ethernet & CNA Adapter Driver version 1.30
for 3200 and 8200 series cards.

Submitted by:	David C Somayajulu (david.somayajulu@qlogic.com),
		Qlogic Corporation
MFC After:	3 days
2011-11-03 21:20:22 +00:00
Marius Strobl
b303030684 Sprinkle some const. 2011-11-02 23:23:19 +00:00
Marius Strobl
6ed1c380f1 Remove variable initialized but no longer actually used since r226995.
Found with:	Coverity Prevent(tm)
CID:		10044
2011-11-02 23:22:50 +00:00
Olivier Houchard
11e55f9108 Disable the TX ready interrupts once we received one, some UART won't clear
the IIR_TXRDY bit upon reading.

Reviewed by:	marcel
2011-11-02 20:45:44 +00:00
Marius Strobl
a9ab459b31 Add a PCI front-end to esp(4) allowing it to support AMD Am53C974 and
replace amd(4) with the former in the amd64, i386 and pc98 GENERIC kernel
configuration files. Besides duplicating functionality, amd(4), which
previously also supported the AMD Am53C974, unlike esp(4) is no longer
maintained and has accumulated enough bit rot over time to always cause
a panic during boot as long as at least one target is attached to it
(see PR 124667).

PR:		124667
Obtained from:	NetBSD (based on)
MFC after:	3 days
2011-11-01 21:26:57 +00:00
Marius Strobl
84ceb5f6d3 Increase the IOC port initialization timeouts by ten times to what the
corresponding Linux driver uses. This allows mpt(4) to still recognize
all good SATA devices in presence of a defective one, which takes about
45 seconds.
In the long term we probably should implement the logic used by mpt2sas(4)
allowing IOC port initialization to complete at a later time.

Submitted by:	Andrew Boyer
MFC after:	3 days
2011-11-01 18:28:33 +00:00
Marius Strobl
741d3d922c In r225931 I've missed the only other driver using the pointer returned
by rman_get_virtual(9) to access device registers sparc64 currently cares
about.
Ideally ata(4) should just be converted to access these using bus_space(9)
read/write functions instead as there's really no reason to do it the
former way. However, this part of ata-siliconimage.c should go away in
favor of siis(4) sooner or later anyway and I don't have the hardware to
actually test the SX4 bits of ata-promise.c.
Also ideally the other architectures should also properly handle the
BUS_SPACE_MAP_LINEAR flag of bus_space_map(9) so this code wouldn't need
to be #ifdef'ed.
2011-11-01 17:57:21 +00:00
Marius Strobl
8c1093fc50 - Import the common MII bitbang'ing code from NetBSD and convert drivers to
take advantage of it instead of duplicating it. This reduces the size of
  the i386 GENERIC kernel by about 4k. The only potential in-tree user left
  unconverted is xe(4), which generally should be changed to use miibus(4)
  instead of implementing PHY handling on its own, as otherwise it makes not
  much sense to add a dependency on miibus(4)/mii_bitbang(4) to xe(4) just
  for the MII bitbang'ing code. The common MII bitbang'ing code also is
  useful in the embedded space for using GPIO pins to implement MII access.
- Based on lessons learnt with dc(4) (see r185750), add bus barriers to the
  MII bitbang read and write functions of the other drivers converted in
  order to ensure the intended ordering. Given that register access via an
  index register as well as register bank/window switching is subject to the
  same problem, also add bus barriers to the respective functions of smc(4),
  tl(4) and xl(4).
- Sprinkle some const.

Thanks to the following testers:
Andrew Bliznak (nge(4)), nwhitehorn@ (bm(4)), yongari@ (sis(4) and ste(4))
Thanks to Hans-Joerg Sirtl for supplying hardware to test stge(4).

Reviewed by:	yongari (subset of drivers)
Obtained from:	NetBSD (partially)
2011-11-01 16:13:59 +00:00
Andrey V. Elsukov
1f1928092d Add information about MD_READONLY and MD_COMPRESS flags to the
configuration dump.

MFC after:	1 week
2011-10-31 10:53:27 +00:00
Marius Strobl
803e97938e Add multiple inclusion protection. 2011-10-30 21:45:36 +00:00
Marius Strobl
5e141ae05f - Use device_t rather than the NetBSDish struct device.
- Move esp_devclass to ncr53c9x.c in order to allow different bus front-ends
  to use it.
- Use KOBJMETHOD_END.
- Remove the gl_clear_latched_intr hook as it's not needed for any of the
  chips nor the front-ends supported in FreeBSD and likely never will be.
- Correct the DMA constraints used in the SBus front-end, the LSI64854 isn't
  limited to 32-bit DMA.
- The ESP200 also only supports up to 64k transfers.
- Don't let the DMA and SBus front-end supply a maximum transfer size larger
  than MAXPHYS as that's the maximum the upper layers use and we otherwise
  just waste resources unnecessarily.
- Initialize the ECB callout and don't zero the handle when returning ECBs
  to the free list so that ncr53c9x_callout() actually is called with the
  driver lock held.
- On detach the driver lock should be held across cam_sim_free() according
  to isp(4) and a panic received.
- Check the return value of NCRDMA_SETUP(), i.e. bus_dmamap_load(9), and try
  to handle failures gracefully.
- In ncr53c9x_action() replace N calls to xpt_done() in a switch with just
  one at the end.
- On XPT_PATH_INQ report "NCR" rather than "Sun" as the vendor as the former
  is somewhat more correct as well as the maximum supported transfer size via
  maxio in order to take advantage of controllers that that can handle more
  than DFLTPHYS.
- Print the number of MESSAGE (EXTENDED) rejected.
- Fix the path encoded in the multiple inclusion protection of ncr53c9xvar.h.
- Correct the DMA constraints used in the LSI64854 core to not exceed the
  maximum supported transfer size and include the boundary so we don't need
  to check on every setup of a DMA transfer.
- Let the bus DMA map callbacks do nothing in case of an error.
- Correctly handle > 64k transfers for FAS366 in the LSI64854. A new feature
  flag NCR_F_LARGEXFER was introduced so we just need to check for this one
  and not for individual controllers supporting large transfers in several
  places.
- Let the LSI64854 core load transfer buffers using BUS_DMA_NOWAIT as the
  NCR53C9x core can't handle EINPROGRESS. Due to lack of bounce buffers
  support, sparc64 doesn't actually use EINPROGRESS and likely never will,
  as an example for writing additional front-ends for the NCR53C9x core it
  makes sense to set BUS_DMA_NOWAIT anyway though.
- Some minor cleanup.
2011-10-30 21:17:42 +00:00
Hans Petter Selasky
9157ad4b17 Improve USB mass storage quirk auto detection.
MFC after:	3 days
2011-10-29 12:32:13 +00:00
Adrian Chadd
7ff80a676a Add some new ath(4) debugging bits, from my if_ath_tx 11n TX branch. 2011-10-29 07:17:47 +00:00
Scott Long
51550f824d Fix an implicit dependency between the MFI driver and CAM that had grown due
to an API change in CAM.  It's once again possible to link a static kernel
with 'mfi' without requiring 'scbus' as well.  Ditto for KLD loading.

Submitted by:	kib
Reviewed by:	ken
MFC after:	3 days
2011-10-29 06:26:49 +00:00
Robert Millan
a2c22d416d Add a few improvements to utf-8 -> cp436 console map
(mostly with Catalan characters in mind, but it probably
benefits other languages).

The new mappings are as follows:

▮ -> █
ÀÈÍÏÓÒÚ -> AEIIOOU
ŀ / Ŀ -> l / L

Reviewed by:	ed
Approved by:	kib (mentor)
2011-10-28 20:00:30 +00:00
Xin LI
79b54e441b Don't expose a constant array into global namespace.
Reported by:	Ruslan Yakovlev <quazi bk ru> via yongari
MFC after:	3 days
2011-10-28 17:53:34 +00:00
Adrian Chadd
dcfd99a788 When punting frames to the RX tap, free the mbufs since we've tampered with
their length.

Without this, an error frame mbuf would:

* have its size adjusted;
* thrown at the radiotap code;
* then since it's never consumed, the rxbuf/mbuf is then re-added to the
  RX descriptor list with the small size;
* .. and the hardware ends up (sometimes) only DMA'ing part of a frame into
  the small buffer, chaining RX frames together (setting the more flag).

I discovered this particular issue when doing some promiscuous radiotap
testing; I found that I'd occasionally get rs_more set in RX descriptors
w/ the first frame length being very small (sub-100 bytes.) The driver
handles 2-descriptor RX frames (but not more), so this still worked; it
was just odd.

This is suboptimal and may benefit from being replaced with caching
the m_pkthdr_len and m_len fields, then restoring them after completion.
2011-10-28 15:44:09 +00:00
Pyun YongHyeon
f78094a515 Disable updating InputDiscards counter for BCM5717, BCM5718,
BCM5719 A0 and BCM5720 A0 and add comment why driver does not try
to read it.
2011-10-28 01:10:59 +00:00
Pyun YongHyeon
50515680a8 Add initial BCM5720 support.
Many thanks to Broadcom for continuing support of FreeBSD.

Submitted by:	Geans Pin at Broadcom (initial version)
H/W donated by:	Broadcom
2011-10-28 01:04:40 +00:00
Pyun YongHyeon
2d7c4b9e35 Recognize BCM5720C PHY. 2011-10-28 00:40:19 +00:00
Pyun YongHyeon
941a6e134b Define BGE_FW_HB_TIMEOUT_SEC and remove one more magic value.
bge(4) sends BGE_FW_CMD_DRV_ALIVE command to firmware every 2
seconds.  BGE_FW_CMD_DRV_ALIVE command requires 4 bytes data.  This
data contains timeout value in seconds until the next
BGE_FW_CMD_DRV_ALIVE command.
Broadcom recommends driver set the value 3 times longer than the
interval that it sends BGE_FW_CMD_DRV_ALIVE.  Currently bge(4) uses
3 seconds so probably we have to increase it in future and use
different ALIVE command(e.g. BGE_FW_CMD_DRV_ALIVE3).

No functional changes.
2011-10-27 22:10:52 +00:00
Pyun YongHyeon
9931ba85e3 Rename hard-coded value 1 << 14 with BGE_RX_CPU_DRV_EVENT.
This bit(SW event 7 in publicly available data sheet) is used to
make RX CPU handle a firmware command and the bit is automatically
cleared after RX CPU completed the command.
Generally firmware command takes the following steps.
 1. Write BGE_SRAM_FW_CMD_MB with a command.
 2. Write BGE_SRAM_FW_CMD_LEN_MB with the length of the command in bytes.
 3. Write BGE_SRAM_FW_CMD_DATA_MB with actual command data.
 4. Generate BGE_RX_CPU_EVENT and let firmware handle the command.
 5. Wait for the ACK of the firmware command.

No functional changes.
2011-10-27 21:27:37 +00:00
Pyun YongHyeon
3c20120066 Rename BGE_FW_DRV_ALIVE/BGE_FW_PAUSE to BGE_FW_CMD_DRV_ALIVE/BGE_FW_CMD_PAUSE.
Also add more firmware commands(not used yet).
No functional changes.
2011-10-27 20:54:53 +00:00
Alan Cox
703dec68bf Eliminate vestiges of page coloring in VM_ALLOC_NOOBJ calls to
vm_page_alloc().  While I'm here, for the sake of consistency, always
specify the allocation class, such as VM_ALLOC_NORMAL, as the first of
the flags.
2011-10-27 16:39:17 +00:00
Pyun YongHyeon
224f878512 SRAM offset 0x0C04 is used by driver to inform the IPMI/ASF firmware
about the various driver events like load, unload, reset, suspend,
restart, and ioctl operations.
Define driver's event rather than using hard-coded values.  We don't
still send suspend/resume event to firmware.

Previously bge(4) used BGE_SDI_STATUS to send events. Because driver
has to access firmware mail box to inform current state, using
BGE_SDI_STATUS register was wrong. The end result was the same as
BGE_SDI_STATUS is 0x0C04.

No functional changes.
2011-10-26 23:52:02 +00:00
Pyun YongHyeon
3fed2d5d77 Offset 0x6810 is RX-RISC event register. Rename BGE_CPU_EVENT with
BGE_RX_CPU_EVENT for readability.
Additionally define BGE_TX_CPU_EVENT for TX-RSIC event register(BCM570[0-4] only).
2011-10-26 23:22:32 +00:00
Pyun YongHyeon
7363541837 Define MAC address mail box and use it instead of using
hard-coded value.
2011-10-26 21:11:40 +00:00
Pyun YongHyeon
888b47f0c7 Rename definition of BGE_SOFTWARE_GENCOMM_* to more readable ones.
The origin of GENCOMM seems to come from Alteon Tigon Host/NIC
interface definition where it defines general communications region
which is active when firmware is loaded and running.  This region
was used in communication between the host and processor internal
to the Tigon chip.
Broadcom data sheet also defines the region as 'Software Gencomm'
in NetXtreme memory map but lacks detailed description of its
interface so it was hard to know which ones are used for which
interface.
This change shall slightly enhance readability.

No functional changes.
2011-10-26 21:05:45 +00:00
Pyun YongHyeon
a7fcfcf3ba BCM5719 cannot handle DMA requests for DMA segments that have
larger than 4KB in size.  However the maximum DMA segment size
created in DMA tag is 4KB, so we wouldn't encounter the issue here.
Just record this issue such that let developers not to create a DMA
segment that is larger than 4KB for BCM5719. It's possible to split
a DMA segment into multiple smaller ones in run time but I believe
it's not worth to implement that.
2011-10-26 18:37:02 +00:00
Pyun YongHyeon
d9820cd85e Broadcom says BCM5755 or higher and BCM5906 have short DMA bug.
Apply workaround to these controllers.
2011-10-26 18:27:01 +00:00
Pyun YongHyeon
d462212405 It is known that all Broadcom controllers have 4GB boundary DMA
bug.  Apply workaround to all controllers.
2011-10-26 18:19:50 +00:00
Pyun YongHyeon
5512ca01af Make CPMU handle GPHY power down control on controllers that have
CPMU capability.
2011-10-26 18:05:46 +00:00
Hans Petter Selasky
3d09c7b327 Fix suspend and resume of FULL and HIGH speed USB devices
in the generic XHCI driver. There appears to be some minor
logic missing for this feature to work.

MFC after:	3 days
2011-10-26 17:43:27 +00:00
Adrian Chadd
b390e40af3 As a prelude to bringing over the 11n work, include some extra statistics fields. 2011-10-26 16:09:05 +00:00
Pyun YongHyeon
28276ad648 Fix long standing bge_sysctl_debug_info() issues.
o Protect bge(4) status block access and register dump with driver lock.
 o Add missing bus_dmamap_sync() before dumping status block.
 o Use minimum status block size, 32 bytes, for status block dump on most
   controllers except BCM5700 AX/BX.
While I'm here, make the handler show 5717 Plus in hardware flags.
2011-10-26 01:03:53 +00:00
Adrian Chadd
d79ac7a74f Add in some more 11n related HAL methods. 2011-10-25 23:33:54 +00:00
Adrian Chadd
e674b5f30d The AR5413 datasheet specifies that AR_TxIntrReq should be set consistently
for all frames, so do so.
2011-10-25 23:28:16 +00:00
Adrian Chadd
6897698afe Add some fixes to the 11n aggregation HAL calls:
* preserve AR_TxIntrReq on every descriptor in an aggregate chain,
  not just the first descriptor;
* always blank out the descriptor in ar5416ChainTxDesc() when forming
  aggregates - the way I'm using this in the 11n branch is to first
  chain aggregates together, then use the other HAL calls to fill in
  the details.
2011-10-25 23:24:05 +00:00
Adrian Chadd
00d829dae7 Correct/complete a partially-disabled TX interrupt mitigation configuration.
Although a previous commit disabled TX interrupt mitigation handling and
configuration, the mask register bits weren't setup correctly.
2011-10-25 23:17:53 +00:00
Adrian Chadd
9ff4b713b2 Fix an incorrect flag.
Obtained from:	Atheros
2011-10-25 23:14:40 +00:00
Adrian Chadd
0047ff7096 Save and restore the association ID across interface resets.
Obtained from:	Atheros
MFC after:	1 week
2011-10-25 23:13:36 +00:00
Adrian Chadd
5916ef68df Add some 11n bits from the if_ath_tx 11n branch:
* Add the TID field in the TX status descriptor;
* Add in the 11n first/middle/last functions for fiddling
  with the descriptors. These are from the Linux and the
  reference driver, but I'm not (currently) using them.
* Add further AR_ISR_S5 register definitions.

Obtained from:	Linux ath9k, Atheros
2011-10-25 23:09:07 +00:00
Adrian Chadd
24f5f7ee4e Reduce the NF wait timeout. When doing heavy 11n RX loads, this can actually
interfere with traffic, as the NF load can take quite a while and poking the
AGC every 10uS is just a bit silly.

Instead, just leave the baseband NF calibration where it is and just read it
back next time a longcal interval happens.
2011-10-25 23:01:53 +00:00
Pyun YongHyeon
76a9846cbf Whitespace nits. 2011-10-25 20:45:14 +00:00
Pyun YongHyeon
cdc2a5ec78 Implement TX/RX checksum offloading support for ASIX AX88772B
controller.

AX88772B data sheet does not show detailed information about
checksum offloading related things. It seems the controller has
lots of options to support checksum offloading but I failed to
understand why this feature requires so much complex controller
configuration and status bits.
One of major difference between AX88772B and its predecessor is
AX88772B uses a new RX header format when RX checksum offloading is
enabled.  It also requires the received length of a frame should be
multiple of 4.  Controller will pad necessary bytes to make the
length of received frame to be multiple of 4.  It is driver's
responsibility to offset this pad bytes.
Note, AX88772B could be configured to get partial checksum value in
in RX header. This mode uses different RX header format and
currently we don't use that fature.

This change makes axe(4) use driver specific MII attach handler to
override uether(9)'s default MII attach and announce flow-control
capability for AX88178/AX88772A/AX88772B to PHY drivers.  It seems
original AX88772 also supports flow-control but I didn't enable it
due to lack of test/access to the controller.  The flow-control
threshold parameter is loaded from EEPROM and there is no way to
override this value without reprogramming EEPROM. For AX88772B,
TX/RX IP/TCP/UDP checksum offloading is announced to network stack.
IPv6 and PPPoE checksum offloading is also supported by controller
but we have no way to take advantage of these features.
Driver already knows PHY address so make PHY driver know that
information and remove unnecessary PHY address check used in
miibus_readreg/miibus_writereg callbacks.  Also announce AX88178,
AX88772A and AX88772B support VLAN over-sized frame.

While I'm here clean up headers and remove axe_start() in
axe_init() because the link wouldn't be available right after media
change.
2011-10-25 18:36:18 +00:00
Pyun YongHyeon
5c6b53d82c This change makes it possible to define driver specific attach
handler such that driver can announce interface capabilities and
can do its own MII attach.  Currently all USB ethernet controllers
have no way to establish a link with pause capabilities. Lack of
checksum offloading support also was one of reason to bring this
change in.

This change adds a couple of wrappers to USB ethernet drivers
(uether_ifmedia_upd, uether_init and uether_start). All exported
functions in uether has prefix uether_ so I think it's more
consistent to have wrappers that follow the convention.
This change preserves ABI/KPI so it should be safe to merge this
change to stable/8.

While I'm here add missing __FBSDID and clean up headers.

Reviewed by:	hselasky
2011-10-24 23:38:11 +00:00
Pyun YongHyeon
52ca7ee210 Add support for ALi/ULi, now NVIDIA, M5261/M5263 PCI FastEthernet
controller which is found on ULi M1563 South Bridge & M1689 Bridge.
These controllers look like a tulip clone.
M5263 controller does not support MII bitbang so use DC_ROM
register to access MII registers.  Like other tulip variants, ULi
controller uses a setup frame to configure RX filter and uses new
setup frame format.  It's not clear to me whether the controller
supports a hash based multicast filtering so this patch uses 14
perfect multicast filter to filter multicast frames.  If number of
multicast addresses is greater than 14, controller is put into a
mode that receives all multicast frames.
Due to lack of access to M5261, this change was not tested with
M5261 but it probably works.  Many thanks to Marco who provided
remote access to M5263.

Tested by:	Marco Steinbach <coco <> executive-computing dot de>,
		Martin MATO <martin.mato <> orange dot fr>
2011-10-24 20:48:02 +00:00
Pyun YongHyeon
d7e9ac7523 When driver is run for the first time there would be no established
link such that calling dc_setcfg() right after media change would
be meaningless unless controller in question is not Davicom DM9102.
Ideally dc_setcfg() should be called when speed/duplex is resolved
otherwise it would reprogram controller with wrong speed/duplex
information.  Because MII status change callback already calls
dc_setcfg() I think calling dc_setcfg() in dc_init_locked() is
wrong.  For instance, it would take some time to establish a link
after mii_mediachg(), so blindly calling dc_setcfg() right after
mii_mediachg() will always yield wrong media configuration.

Extend dc_ifmedia_upd() to handle media change and still allow
21143 and Davidcom controllers program speed/duplex regardless of
current resolved speed/duplex of link. In theory 21143 may not need
to call dc_setcfg() right after media change, but leave it as it is
because there are too many variants to test that change.  Probably
dc(4) shall need a PHY reset in dc_ifmedia_upd() but it's hard to
verify correctness of the change.

This change reliably makes ULi M5263 establish a link.

While I'm here correctly report media change result. Previously it
always reported a success.
2011-10-24 20:26:37 +00:00
Pyun YongHyeon
8c094ecc83 Add missing bus_dmamap_sync() in setup frame transmit.
MFC after:	3 days
2011-10-24 17:09:22 +00:00
Pyun YongHyeon
cb94db27d2 Fix a regression introduced in r218832. For TX status check, driver
should use a TX list DMA tag.

MFC after:	3 days
2011-10-24 17:05:59 +00:00
Alexander Motin
c779dc1485 Some dmesg cosmetics:
- for the legacy PCI ATA channels move channel number out of the device
description, same as it is for ahci(4), siis(4) and mvs(4);
 - add device description for the ISA ATA channels.
2011-10-24 08:47:23 +00:00
Bernhard Schmidt
80abcbf807 Let net80211 also know about stopped BA sessions. This fixes some issues
where the driver assumed that BA resources are still available due to
net80211 saying so.

PR:		161407, 159768
Tested by:	cperciva, rene
MFC after:	3 days
2011-10-24 07:37:01 +00:00
Hans Petter Selasky
c8eeb97178 Add new USB IDs to RUN driver. Update usb.conf.
PR:		usb/161798
MFC after:	3 days
2011-10-19 10:09:01 +00:00
Fabien Thomas
dceed24a7c Add a flush of the current PMC log buffer before displaying the next top.
As the underlying block is 4KB if the PMC throughput is low the measurement
will be reported on the next tick. pmcstat(8) use the modified flush API to
reclaim current buffer before displaying next top.

MFC after:	1 month
2011-10-18 15:25:43 +00:00
Ed Schouten
a185bd12f3 Get rid of D_PSEUDO.
It seems the D_PSEUDO flag was meant to allow make_dev() to return NULL.
Nowadays we have a different interface for that; make_dev_p(). There's
no need to keep it there.

While there, remove an unneeded D_NEEDMINOR from the gpio driver.

Discussed with:	gonzo@ (gpio)
2011-10-18 08:09:44 +00:00
Jayachandran C.
29a99755a9 FDT support for MIPS.
Add architecture specific files needed to compile MIPS with
flattened device tree support.
2011-10-18 07:29:21 +00:00
Adrian Chadd
2c0dd4bbe4 Add in a currently-disabled WAR for PCI NICs.
Some earlier series (~AR5212?) play badly with BIOSes.

In these instances, they may require a forced reset (by transitioning
the NIC through D0 -> D3 -> D0) before they probe/attach correctly.

This is currently disabled because:

* I haven't figured out the "right" code to ensure this only happens
  for PCI NICs (not PCIe or Cardbus);
* I haven't at all done wide scale testing for this, and I'm not yet
  ready for said wide-scale testing.

I'm documenting this primarily so users with misbehaving NICs have
something to tinker with.

Obtained from:	Atheros
2011-10-18 03:32:18 +00:00
Adrian Chadd
65d1eb9443 Add a WAR from the reference code - clear the PCI error status
upon detach.

Obtained from:	Atheros
2011-10-18 03:24:17 +00:00
Adrian Chadd
0cbbe87008 Port over some missing code from the ar5212 reference driver reset path.
The final missing bit here is enabling the PCI configuration register
read, but there's currently no glue available for the HAL to read (and
write) PCI configuration space registers.

Obtained from:	Atheros
2011-10-18 03:17:06 +00:00
Adrian Chadd
46614948dd Implement the first part of the BB read workaround.
The AR5008/AR9001 series NICs have a bug where BB register reads
will occasionally be corrupted. This could cause issues with things
such as ANI, which adjust operational parameters based on the
BB radio register reads. This was introduced in the AR5008 chip
and fixed with the first released AR9002 series NIC (AR9280v2.)

A followup commit will implement the acutal WAR when reading
BB registers. I'm still not sure how I'll implement it - whether
it should be done in the osdep layer, or whether it should just
live in the AR5416 HAL. Either way, they can use this capability
bit to determine whether to implement the WAR or not.

Thankyou to various sources inside Atheros who have helped me track
down what this particular issue is.

Obtained from:	Atheros
2011-10-18 03:01:41 +00:00
Adrian Chadd
31a47d8c14 Add in OS_REG_BIT_SET, a macro which does what it says it does.
This will be used in an upcoming commit to the ar5212 HAL.
2011-10-18 02:46:26 +00:00
Adrian Chadd
3f3087fd02 Include opt_ah.h when compiling the driver.
There are HAL methods which are actually direct register
access, rather than simply HAL calls. Because of this, these
register accesses would use the non-debug path in ah_osdep.h
as opt_ah.h isn't included.

With this, the correct register access methods are used,
so debugging traces show things such as TXDP checking and
TSF32 access.
2011-10-18 02:43:59 +00:00
Pyun YongHyeon
965706387b Make sure to report media change status to caller. Previously it
always reported success.
2011-10-17 20:03:38 +00:00
Pyun YongHyeon
0ae9f6a9f3 Add missing driver lock in media status handler. 2011-10-17 19:58:34 +00:00
Pyun YongHyeon
e9e549ef70 Close a race where SIOCGIFMEDIA ioctl get inconsistent link status.
Because driver is accessing a common MII structure in
mii_pollstat(), updating user supplied structure should be done
before dropping a driver lock.

Reported by:	Karim (fodillemlinkarimi <> gmail dot com)
2011-10-17 19:51:38 +00:00
Pyun YongHyeon
57c81d92ae Close a race where SIOCGIFMEDIA ioctl get inconsistent link status.
Because driver is accessing a common MII structure in
mii_pollstat(), updating user supplied structure should be done
before dropping a driver lock.

Reported by:	Karim (fodillemlinkarimi <> gmail dot com)
2011-10-17 19:49:00 +00:00
Xin LI
4783373497 Return BUS_PROBE_DEFAULT instead of 0 (BUS_PROBE_SPECIFIC), allowing
vendor provided driver to override in kernel driver.

MFC after:	3 days
2011-10-17 19:21:42 +00:00
Adrian Chadd
a05e382c09 Don't enable the PHY radar errors in calcrxfilter.
That way the radar errors aren't enabled prematurely.

A DFS tester has reported that radar events are reported
during channel scanning, before DFS is actually enabled.
2011-10-17 14:17:37 +00:00
Bjoern A. Zeeb
8797cafe81 Fix build after r226465.
Cast void * to char * for arithmetics and make function return "no error".

MFC after:	3 days
2011-10-17 13:51:00 +00:00
Jayachandran C.
af6edc2854 FDT changes for 64 bit kernel
Use the offset into the device tree from fdtp as the phandle instead
of using pointer into the device tree.  This will make sure that the
phandle fits into a uint32_t type, even when compiled for 64bit.

Reviewed by:	raj, nathanw, marcel
2011-10-17 13:44:33 +00:00
Adrian Chadd
65d7e4d9f1 Fix an issue with 11g beacon frames which looks to be a limitation
on the largest multi-write size.

From the submitter:

==
I looked further into the magic 88-byte threshold after which the bug
occurs.  It turns out that figure included the 24-byte tx_desc, and up
to 64 bytes of beacon frame (header+data).

rum_write_multi doesn't seem happy with writing >64 bytes at a time to
the MAC register.  If I break it up into separate calls (e.g. bytes
0-63, then bytes 64-65, written at the appropriate offset) I see the
proper beacon frames being transmitted now.
==

Submitted by:	Steven Chamberlain <steven@pyro.eu.org>
MFC after:	3 days
2011-10-17 13:12:47 +00:00
Nathan Whitehorn
b6faf3cfdb Add support for special keys (volume/brightness/eject) on Apple laptops with
ADB keyboards.

Submitted by:	Justin Hibbits <jrh29 at alumni dot cwru dot edu>
MFC after:	9.0-RELEASE
2011-10-16 21:01:42 +00:00
Christian Brueffer
04c4548981 Revert r226398 and instead move the allocation of usrbufs after the error check.
Suggested by:	pjd
MFC after:	1 week
2011-10-16 17:38:20 +00:00
Eitan Adler
36daf0495a - change "is is" to "is" or "it is"
- change "the the" to "the"

Approved by:	lstewart
Approved by:	sahil (mentor)
MFC after:	3 days
2011-10-16 14:30:28 +00:00
Christian Brueffer
32a1cc9317 Properly free resources in case of an error.
CID:		4222
Found with:	Coverity Prevent(tm)
MFC after:	1 week
2011-10-15 22:27:35 +00:00
Eitan Adler
acdfc36a85 - add support for I-O DATA RSA-PCI2/R
PR:		kern/142999
Submitted by:	Takefu Kenji <takefu@airport.fm>
Approved by:	jhb
Approved by:	sahil (mentor)
MFC after:	1 week
2011-10-15 21:06:08 +00:00
Christian Brueffer
0ad684e7b4 Properly free resources in an error case.
CID:		4203
Found with:	Coverity Prevent(tm)
MFC after:	1 week
2011-10-15 15:57:55 +00:00
Marius Strobl
2b6ae84b63 Merge from NetBSD:
- Remove clause 3 and 4 from TNF licenses.
- Fix memset usage.
- Various cleanup.
- Kill caddr_t.
2011-10-15 09:29:43 +00:00
Adrian Chadd
cdd36f96b2 ath_pci PCI setup fixes.
* Break out the PCI setup override code into a new function.
* Re-apply the PCI overrides on powersave resume. The retry timeout
  register isn't currently being saved/resumed by the PCI driver/bus
  code.
2011-10-14 03:24:35 +00:00
Marius Strobl
1e5addb750 Merge from r225950:
Set the sense residual properly.

Reviewed by:	ken
2011-10-13 20:06:19 +00:00
Bernhard Schmidt
a7978bab76 Fix bmiss notifications, events should be sent when NOT scanning.
MFC after:	3 days
2011-10-13 18:17:03 +00:00
John Baldwin
5d0d779b0e If an allocation for a specific resource range fails because it is not in
a decoded range for an ACPI Host-PCI bridge, try to allocate it from the
ACPI system resource range.  If that works, permit the resource allocation
regardless.

MFC after:	1 week
2011-10-12 14:13:32 +00:00
Marius Strobl
6aa1145c84 - Remove unused remnants of MII bitbang'ing.
- Sprinkle const.
2011-10-11 21:52:24 +00:00
Hans Petter Selasky
1984dc56b2 Add USB mass storage quirk for device that emits errors after the automatic
no synchronize cache detection.

Submitted by:	Scott Allendorf
MFC after:	3 days
2011-10-10 16:26:06 +00:00
Hans Petter Selasky
f6c6639af8 Bugfix: The ucom detach function is sometimes called on zeroed structures.
Check for this case and just return, so that the UCOM unit number zero is
not accidentially freed.

Submitted by:	Danish FreeBSD user at EuroBSDcon 2011
MFC after:	3 days
2011-10-10 15:54:44 +00:00
Konstantin Belousov
8be736b2b3 Do not ignore block offsets.
PR:	kern/160943
Submitted by:	Craig Boston <cb severious net>
Reviewed by:	Danny Braniss <danny cs huji ac il>
MFC after:	1 week
2011-10-10 13:26:53 +00:00
Adrian Chadd
3c5ebcdc1d Fix an incorrect use of sizeof().
Obtained from:	OpenBSD sys/dev/ic/bwi.c r1.87
2011-10-10 02:54:58 +00:00
Adrian Chadd
e008215028 Update from OpenBSD: Include 0x4402 in the bbp id mapping table used on older devices.
http://bcm-specs.sipsolutions.net/BackPlane agrees.

Obtained from:	OpenBSD, sys/dev/ic/bwi.c r1.88
2011-10-10 02:49:21 +00:00
Craig Rodrigues
8d1a3b6998 Add a "kern.features.ata_cam" sysctl in the kernel when the ATA_CAM kernel
option is defined.  This sysctl can be queried by feature_present(3).

Query for this feature in /sbin/atacontrol and /usr/sbin/burncd.
If these utilities detect that ATA_CAM is enabled, then these utilities
will error out.  These utilities are compatible with the old ATA
driver, but are incomptible with the new ATA_CAM driver.  By erroring out,
we give end-users an idea as to what remedies to use, and reduce the need for them
to file PR's.  For atacontrol, camcontrol must be used instead,
and for burncd, alternative utilties from the ports collection must be used
such as sysutils/cdrtools.

In future, maybe someone can re-write burncd to work with ATA_CAM,
but at least for now, we give a somewhat useful error message to end users.

PR:		160979
Reviewed by:	jh, Arnaud Lacombe <lacombar at gmail dot com>
Reported by:	Joe Barbish <fbsd8 at a1poweruser dot com>
MFC after:	3 days
2011-10-09 21:42:02 +00:00
Marius Strobl
a131219c6e Recognize the Intel(R) Centrino(R) Wireless-N 130.
PR:	161162
2011-10-09 21:36:14 +00:00
Marius Strobl
882e24b03a Prefer KOBJMETHOD_END. 2011-10-09 20:27:20 +00:00
Marius Strobl
356d17e523 Sprinkle const. 2011-10-09 20:16:51 +00:00
Marius Strobl
112a855de7 - Follow the lead of dcphy(4) and pnphy(4) and move the reminder of the PHY
drivers that only ever attach to a particular MAC driver, i.e. inphy(4),
  ruephy(4) and xlphy(4), to the directory where the respective MAC driver
  lives and only compile it into the kernel when the latter is also there,
  also removing it from miibus.ko and moving it into the module of the
  respective MAC driver.
- While at it, rename exphy.c, which comes from NetBSD where the MAC driver
  it corresponds to also is named ex(4) instead of xl(4) but that in FreeBSD
  actually identifies itself as xlphy(4), and its function names accordingly
  for consistency.
- Additionally while at it, fix some minor style issues like whitespace
  in the register headers and add multi-inclusion protection to inphyreg.h.
2011-10-08 12:33:10 +00:00
Christian Brueffer
37b14fc83c Fix an infinite loop in siba_bwn_suspend().
CID:		3536
Found with:	Coverity Prevent(tm)
MFC after:	1 week
2011-10-08 12:09:57 +00:00
Christian Brueffer
8780431854 Remove dead code, "error" doesn't change between this check and the
previous one.

CID:		3254
Found with:	Coverity Prevent(tm)
MFC after:	1 week
2011-10-08 10:50:48 +00:00
Pyun YongHyeon
50fb449799 BCE_MISC_ID register of BCM5716 returns the same id of BCM5709 so
remove explicit checks for BCM5716.
The BCM5709 and BCM5716 chips are virtually indistinguishable by
software except for the PCI device ID.  The two chips differ in
that BCM5709 supports TCP/IP and iSCSI offload in Windows while
the BCM5716 doesn't.
While I'm here remove now unused definition of BCE_CHIP_NUM_5716
and BCE_CHIP_ID_5716_C0.

Reported by:	sbruno
Reviewed by:	davidch
Tested by:	davidch
2011-10-08 00:00:54 +00:00
Marius Strobl
50e66535b9 Sync with ahc(4)/ahd(4)/sym(4) etc:
Zero any sense not transferred by the device as the SCSI specification
mandates that any untransferred data should be assumed to be zero.

Reviewed by:	ken
2011-10-07 21:23:42 +00:00
Christian Brueffer
8a11984e21 Add missing va_end() to clean up after va_start().
CID:		4725
Found with:	Coverity Prevent(tm)
MFC after:	1 week
2011-10-07 20:54:12 +00:00
Marius Strobl
aee3499ac4 Merge from r225950:
Set the sense residual properly.

Reviewed by:	ken
2011-10-07 08:59:54 +00:00
Adrian Chadd
cdb59558b9 Begin implementing correct MIPS24K sampling mode behaviour.
* Add the interrupt bit in the configuration register
* Correctly set the counter register for the sampling overflow
  interrupt. The interrupt is asserted when bit 31 is set.
  So set the overflow value at 0x80000000 and subtract the
  programmed value as appropriate.
2011-10-07 06:13:38 +00:00
Wesley Shields
28d35e546e Fix a typo in a comment.
Approved by:	kib@
2011-10-06 16:13:47 +00:00
Xin LI
db1fda10b4 Add the 9750 SATA+SAS 6Gb/s RAID controller card driver, tws(4). Many
thanks for their contiued support to FreeBSD.

This is version 10.80.00.003 from codeset 10.2.1 [1]

Obtained from:	LSI http://kb.lsi.com/Download16574.aspx [1]
2011-10-04 21:40:25 +00:00
Adrian Chadd
a57433b96b Add an AR5416 aware version of the "current RSSI" function.
Pre-11n devices and AR5416 use AR_PHY(263) for current RX RSSI.
AR9130 and later have a fourth calibration register (for doing
ADC calibration) and thus the register has moved to AR_PHY(271).

This isn't currently used by any of the active code; I'm committing
this for completeness and in case any third party code attempts to
use it for legacy reasons.
2011-10-04 00:32:10 +00:00
Kenneth D. Merry
1cc052e80f Add descriptor sense support to CAM, and honor sense residuals properly in
CAM.

Desriptor sense is a new sense data format that originated in SPC-3.  Among
other things, it allows for an 8-byte info field, which is necessary to
pass back block numbers larger than 4 bytes.

This change adds a number of new functions to scsi_all.c (and therefore
libcam) that abstract out most access to sense data.

This includes a bump of CAM_VERSION, because the CCB ABI has changed.
Userland programs that use the CAM pass(4) driver will need to be
recompiled.

camcontrol.c:	Change uses of scsi_extract_sense() to use
		scsi_extract_sense_len().

		Use scsi_get_sks() instead of accessing sense key specific
		data directly.

scsi_modes:	Update the control mode page to the latest version (SPC-4).

scsi_cmds.c,
scsi_target.c:	Change references to struct scsi_sense_data to struct
		scsi_sense_data_fixed.  This should be changed to allow the
		user to specify fixed or descriptor sense, and then use
		scsi_set_sense_data() to build the sense data.

ps3cdrom.c:	Use scsi_set_sense_data() instead of setting sense data
		manually.

cam_periph.c:	Use scsi_extract_sense_len() instead of using
		scsi_extract_sense() or accessing sense data directly.

cam_ccb.h:	Bump the CAM_VERSION from 0x15 to 0x16.  The change of
		struct scsi_sense_data from 32 to 252 bytes changes the
		size of struct ccb_scsiio, but not the size of union ccb.
		So the version must be bumped to prevent structure
		mis-matches.

scsi_all.h:	Lots of updated SCSI sense data and other structures.

		Add function prototypes for the new sense data functions.

		Take out the inline implementation of scsi_extract_sense().
		It is now too large to put in a header file.

		Add macros to calculate whether fields are present and
		filled in fixed and descriptor sense data

scsi_all.c:	In scsi_op_desc(), allow the user to pass in NULL inquiry
		data, and we'll assume a direct access device in that case.

		Changed the SCSI RESERVED sense key name and description
		to COMPLETED, as it is now defined in the spec.

		Change the error recovery action for a number of read errors
		to prevent lots of retries when the drive has said that the
		block isn't accessible.  This speeds up reconstruction of
		the block by any RAID software running on top of the drive
		(e.g. ZFS).

		In scsi_sense_desc(), allow for invalid sense key numbers.
		This allows calling this routine without checking the input
		values first.

		Change scsi_error_action() to use scsi_extract_sense_len(),
		and handle things when invalid asc/ascq values are
		encountered.

		Add a new routine, scsi_desc_iterate(), that will call the
		supplied function for every descriptor in descriptor format
		sense data.

		Add scsi_set_sense_data(), and scsi_set_sense_data_va(),
		which build descriptor and fixed format sense data.  They
		currently default to fixed format sense data.

		Add a number of scsi_get_*() functions, which get different
		types of sense data fields from either fixed or descriptor
		format sense data, if the data is present.

		Add a number of scsi_*_sbuf() functions, which print
		formatted versions of various sense data fields.  These
		functions work for either fixed or descriptor sense.

		Add a number of scsi_sense_*_sbuf() functions, which have a
		standard calling interface and print the indicated field.
		These functions take descriptors only.

		Add scsi_sense_desc_sbuf(), which will print a formatted
		version of the given sense descriptor.

		Pull out a majority of the scsi_sense_sbuf() function and
		put it into scsi_sense_only_sbuf().  This allows callers
		that don't use struct ccb_scsiio to easily utilize the
		printing routines.  Revamp that function to handle
		descriptor sense and use the new sense fetching and
		printing routines.

		Move scsi_extract_sense() into scsi_all.c, and implement it
		in terms of the new function, scsi_extract_sense_len().
		The _len() version takes a length (which should be the
		sense length - residual) and can indicate which fields are
		present and valid in the sense data.

		Add a couple of new scsi_get_*() routines to get the sense
		key, asc, and ascq only.

mly.c:		Rename struct scsi_sense_data to struct
		scsi_sense_data_fixed.

sbp_targ.c:	Use the new sense fetching routines to get sense data
		instead of accessing it directly.

sbp.c:		Change the firewire/SCSI sense data transformation code to
		use struct scsi_sense_data_fixed instead of struct
		scsi_sense_data.  This should be changed later to use
		scsi_set_sense_data().

ciss.c:		Calculate the sense residual properly.  Use
		scsi_get_sense_key() to fetch the sense key.

mps_sas.c,
mpt_cam.c:	Set the sense residual properly.

iir.c:		Use scsi_set_sense_data() instead of building sense data by
		hand.

iscsi_subr.c:	Use scsi_extract_sense_len() instead of grabbing sense data
		directly.

umass.c:	Use scsi_set_sense_data() to build sense data.

		Grab the sense key using scsi_get_sense_key().

		Calculate the sense residual properly.

isp_freebsd.h:	Use scsi_get_*() routines to grab asc, ascq, and sense key
		values.

		Calculate and set the sense residual.

MFC after:	3 days
Sponsored by:	Spectra Logic Corporation
2011-10-03 20:32:55 +00:00
Adrian Chadd
79c27adfd5 Fix an unaligned access issue; tidy up OFDM/DS rate decoding from the PLCP.
This fixes a panic on PPC.

Submitted by:	novel
Obtained from:	OpenBSD, sys/dev/ic/bwi.c r1.89
2011-10-03 16:30:18 +00:00
Adrian Chadd
f6f6e2c803 Port over the radar pulse decoding code common to the AR5416 and later chipsets.
Obtained from:	Atheros
2011-10-03 12:12:03 +00:00
Marius Strobl
bda8e754a1 Make sparc64 compatible with NEW_PCIB and enable it:
- Implement bus_adjust_resource() methods as far as necessary and in non-PCI
  bridge drivers as far as feasible without rototilling them.
- As NEW_PCIB does a layering violation by activating resources at layers
  above pci(4) without previously bubbling up their allocation there, move
  the assignment of bus tags and handles from the bus_alloc_resource() to
  the bus_activate_resource() methods like at least the other NEW_PCIB
  enabled architectures do. This is somewhat unfortunate as previously
  sparc64 (ab)used resource activation to indicate whether SYS_RES_MEMORY
  resources should be mapped into KVA, which is only necessary if their
  going to be accessed via the pointer returned from rman_get_virtual() but
  not for bus_space(9) as the later always uses physical access on sparc64.
  Besides wasting KVA if we always map in SYS_RES_MEMORY resources, a driver
  also may deliberately not map them in if the firmware already has done so,
  possibly in a special way. So in order to still allow a driver to decide
  whether a SYS_RES_MEMORY resource should be mapped into KVA we let it
  indicate that by calling bus_space_map(9) with BUS_SPACE_MAP_LINEAR as
  actually documented in the bus_space(9) page. This is implemented by
  allocating a separate bus tag per SYS_RES_MEMORY resource and passing the
  resource via the previously unused bus tag cookie so we later on can call
  rman_set_virtual() in sparc64_bus_mem_map(). As a side effect this now
  also allows to actually indicate that a SYS_RES_MEMORY resource should be
  mapped in as cacheable and/or read-only via BUS_SPACE_MAP_CACHEABLE and
  BUS_SPACE_MAP_READONLY respectively.
- Do some minor cleanup like taking advantage of rman_init_from_resource(),
  factor out the common part of bus tag allocation into a newly added
  sparc64_alloc_bus_tag(), hook up some missing newbus methods and replace
  some homegrown versions with the generic counterparts etc.
- While at it, let apb_attach() (which can't use the generic NEW_PCIB code
  as APB bridges just don't have the base and limit registers implemented)
  regarding the config space registers cached in pcib_softc and the SYSCTL
  reporting nodes set up.
2011-10-02 23:22:38 +00:00
Adrian Chadd
f20aaceeb4 Remove an unused variable. 2011-10-02 14:10:25 +00:00
Adrian Chadd
62f62f4f4a Various interrupt handling and RX interrupt mitigation fixes.
* The AR_ISR_RAC interrupt processing method has a subtle bug in all
  the MAC revisions (including pre-11n NICs) until AR9300v2.
  If you're unlucky, the clear phase clears an update to one of the
  secondary registers, which includes TX status.

  This shows up as a "watchdog timeout" if you're doing very low levels
  of TX traffic. If you're doing a lot of non-11n TX traffic, you'll
  end up receiving a TX interrupt from some later traffic anyway.

  But when TX'ing 11n aggregation session traffic (which -HEAD isn't yet
  doing), you may find that you're only able to TX one frame (due to
  BAW restrictions) and this may end up hitting this race condition.

  The only solution is to not use RAC and instead use AR_ISR and the
  AR_ISR_Sx registers. The bit in AR_ISR which represents the secondary
  registers are not cleared; only the AR_ISR_Sx bits are. This way
  any updates which occur between the read and subsequent write will
  stay asserted and (correctly) trigger a subsequent interrupt.

  I've tested this on the AR5416, AR9160, AR9280. I will soon test
  the AR9285 and AR9287.

* The AR_ISR TX and RX bits (and all others!) are set regardless of
  whether the contents of the AR_IMR register. So if RX mitigation is
  enabled, RXOK is going to be set in AR_ISR and it would normally set
  HAL_INT_RX.

  Fix the code to not set HAL_INT_RX when RXOK is set and RX mitigation
  is compiled in. That way the RX path isn't prematurely called.

  I would see:

  * An interrupt would come in (eg a beacon, or TX completion) where
    RXOK was set but RXINTM/RXMINT wasn't;
  * ath_rx_proc() be called - completing RX frames;
  * RXINTM/RXMINT would then fire;
  * ath_rx_proc() would then be called again but find no frames in the
    queue.

  This fixes the RX mitigation behaviour to not overly call ath_rx_proc().

* Start to flesh out more correct timer interrupt handling - it isn't
  kite/merlin specific. It's actually based on whether autosleep support
  is enabled or not.

This is sourced from my 11n TX branch and has been tested for a few weeks.

Finally, the interrupt handling change should likely be implemented
for AR5210, AR5211 and AR5212.
2011-10-02 14:08:56 +00:00
Adrian Chadd
7e132ca3e3 Document exactly what the RX interrupt mitigation timers do. 2011-10-02 13:51:26 +00:00
Adrian Chadd
75350906bc For now (ie: until autosleep support is fully fleshed out), always clear
all of the RX status fields when initialising a new RX descriptor.
2011-10-02 13:47:03 +00:00
Adrian Chadd
9bf15204ae Disable TX interrupt mitigation just for the time being.
There are some timing concerns which I've yet to fully map out.
In any case, there's an existing software driven mitigation method
for TX interrupts and when TX'ing 11n frames, the whole frame itself
generates an interrupt rather then the subframes.
2011-10-02 13:43:06 +00:00
Adrian Chadd
0e56140a1b Fix a corner case in the HAL debugging changes, where ah was NULL.
Although I tried to fix this earlier by introducing HALDEBUG_G(), it
turns out there seem to be other cases where the pointer value is still
NULL.

* Fix DO_HALDEBUG() and the HALDEBUG macro to check whether ah is NULL
  before deferencing it
* Remove HALDEBUG_G() as it's no longer needed

This is hopefully a merge candidate for 9.0-RELEASE as enabling
debugging at startup could result in a kernel panic.
2011-09-30 05:17:57 +00:00
Andrey V. Elsukov
a6a646124b Add Oxford Semiconductor OXPCIe952 (0x1c38) 1 port serial card.
PR:		kern/160895
Submitted by:	Konstantin V. Krotov
MFC after:	1 week
2011-09-29 15:43:02 +00:00
Alexander Motin
5f8ad41c0d - Add special support for the MFI_CMD ioctl with MFI_CMD_STP command, used
by present MegaCLI version. It has some special meaning for the first s/g
list entry, while the main s/g list begins from the the second entry, and
those lists should remain separate after loading to the busdma map.
 - Fix bug in 32bit ioctl compatibility shims when s/g list consists of
more then on element.

Sponsored by:	iXsystems, inc.
MFC after:	3 days
2011-09-29 08:37:53 +00:00
Alexander Motin
7778ab7e0c MFprojects/hid:
Import the rest of HID improvements from the branch:
 - improve report descriptor parser in libusbhid to handle several kinds of
reports same time;
 - add to the libusbhid API two functions wrapping respective kernel IOCTLs
for reading and writing reports;
 - tune uhid IOCTL interface to allow reading and writing arbitrary report,
when multiple supported by the device;
 - teach usbhidctl to set output and feature reports;
 - make usbhidaction support all the same item names as bhidctl.

Sponsored by: iXsystems, inc.
2011-09-28 14:52:25 +00:00
Adrian Chadd
0e0290482b Don't bother triggering the cabq queue if it's empty.
Obtained from:	Atheros
2011-09-28 03:11:51 +00:00
Adrian Chadd
7b15790a4b Fix lock order to be correcter.
Nothing else locks these two queues (cabq, avp mcastq), but it should
be consistent and correct.
2011-09-28 03:07:51 +00:00
Adrian Chadd
353d29772b Change the default CABQ time to be 70% of the beacon interval,
rather than the whole beacon interval.

The reference driver and Linux ath9k both choose 80% of the
beacon interval and they do it in the driver rather than
the HAL (Ath reference) or ath9k_hw (ath9k.)

This quietens stuck beacon conditions on my AR9220/AR9280
based NICs when a lot of burst broadcast/multicast traffic
is going on. It doesn't seem to annoy the earlier MACs as
much as the AR9280 and later one.

Obtained from:	Linux ath9k, Atheros
2011-09-28 03:05:04 +00:00
Adrian Chadd
c3f2102bef The AR5212 setup path (also used by the AR5416 code) configures a
local variable with a beacon interval of 100 TU. This never gets modified
if the beacon interval configuration changes.

This may have been correct in earlier times, but with the advent of
staggered beacons (which default to 1 / ATH_BCBUF beacon interval, so
25 TU here) this value is incorrect.

It is used to configure the default CABQ readytime. So here, the cabq
was being configured to be much greater than the target beacon timer
(TBTT.)

The driver should be configuring a cabq readytime value rather then
leaving it to the HAL to choose sensible defaults. This should be
done in the future - I'm simply trying to ensure sensible defaults
are chosen.
2011-09-28 03:03:23 +00:00
Adrian Chadd
45a94a8341 Update the default AIFS value for hostap mode.
Obtained from:	Linux ath9k, Atheros reference
2011-09-28 02:54:42 +00:00
Alexander Motin
cf2446231a Add one more ID for the Marvell 88SE9128 6Gbps SATA controller.
MFC after:	3 days
2011-09-27 09:32:34 +00:00
Hans Petter Selasky
2325ea82ad Add quirks for some USB mass storage devices which doesn't respond
after trying to query the synchronize cache support.

Submitted by:	Keith White
PR:		usb/160911
Approved by:	re (kensmith)
MFC after:	1 week
2011-09-27 07:06:02 +00:00
Justin T. Gibbs
578e4bf777 Update netfront so that it queries and honors published
back-end features.

sys/dev/xen/netfront/netfront.c:
	o Add xn_query_features() which reads the XenStore and
	  records the TSO, LRO, and chained ring-request support
	  of the backend.
	o Rename xn_configure_lro() to xn_configure_features() and
	  use this routine to manage the setup of TSO, LRO, and
	  checksum offload.
	o In create_netdev(), initialize if_capabilities and
	  if_hwassist to the capabilities found on all backends.
	  Delegate configuration of if_capenable and the TSO flag
	  if if_hwassist to xn_configure_features().

Reported by:	Hugo Silva (fix inspired by patch provided)
Approved by:	re
MFC after:	1 week
2011-09-21 00:15:29 +00:00
Justin T. Gibbs
ffa06904b5 Modify the netfront driver so it can successfully attach to
PV devices with the ioemu attribute set.

sys/dev/xen/netfront/netfront.c:
	o If a mac address for the interface cannot be found
	  in the front-side XenStore tree, look for an entry
	  in the back-side tree.  With ioemu devices, the
	  emulator does not populate the front side tree and
	  neither does Xend.
	o Return an error rather than panic when an attach
	  attempt fails.

Reported by:	Janne Snabb (fix inspired by patch provided)
PR:		kern/154302
Approved by:	re
2011-09-21 00:13:04 +00:00
Justin T. Gibbs
cf9c09e1f3 Correct suspend/resume support in the Netfront driver.
Sponsored by: BQ Internet

sys/dev/xen/netfront/netfront.c:
	o Implement netfront_suspend(), a specialized suspend
	  handler for the netfront driver.  This routine simply
	  disables the carrier so the driver is idle during
	  system suspend processing.
	o Fix a leak when re-initializing LRO during a link reset.
	o In netif_release_tx_bufs(), when cleaning up the grant
	  references for our TX ring, use gnttab_end_foreign_access_ref
	  instead of attempting to grant the page again.
	o In netif_release_tx_bufs(), we do not track mbufs associated
	  with mbuf chains, but instead just free each mbuf directly.
	  Use m_free(), not m_freem(), to avoid double frees of mbufs.
	o Refactor some code to enhance clarity.

Approved by:	re
MFC after:	1 week
2011-09-21 00:08:25 +00:00
Justin T. Gibbs
06a630f65d Add suspend/resume support to the Xen blkfront driver.
Sponsored by: BQ Internet

sys/dev/xen/blkfront/block.h:
sys/dev/xen/blkfront/blkfront.c:
	Remove now unused blkif_vdev_t from the blkfront soft.

sys/dev/xen/blkfront/blkfront.c:
	o In blkfront_suspend(), indicate the desire to suspend
	  by changing the softc connected state to SUSPENDED, and
	  then wait for any I/O pending on the remote peer to
	  drain.  Cancel suspend processing if I/O does not
	  drain within 30 seconds.
	o Enable and update blkfront_resume().  Since I/O is
	  drained prior to the suspension of the VM, the complicated
	  recovery process performed by other Xen blkfront
	  implementations is avoided.  We simply tear down the
	  connection to our old peer, and then re-connect.
	o In blkif_initialize(), fix a resource leak and botched
	  return if we cannot allocate shadow memory for our
	  requests.
	o In blkfront_backend_changed(), correct our response to
	  the XenbusStateInitialised state.  This state indicates
	  that our backend peer has published sufficient data for
	  blkfront to publish ring information and other XenStore
	  data, not that a connection can occur.  Blkfront now
	  will only perform connection processing in response to
	  the XenbusStateConnected state.  This corrects an issue
	  where blkfront connected before the backend was ready
	  during resume processing.

Approved by:	re
MFC after:	1 week
2011-09-21 00:02:44 +00:00
Justin T. Gibbs
2ca7463bc7 Properly handle suspend/resume events in the Xen device
framework.

Sponsored by:	BQ Internet

sys/xen/xenbus/xenbusb.c:
	o In xenbusb_resume(), publish the state transition of the
	  resuming device into XenbusStateIntiailising so that the
	  remote peer can see it.  Recording the state locally is
	  not sufficient to trigger a re-connect sequence.
	o In xenbusb_resume(), defer new-bus resume processing until
	  after the remote peer's XenStore address has been updated.
	  The drivers may need to refer to this information during
	  resume processing.

sys/xen/xenbus/xenbusb_back.c:
sys/xen/xenbus/xenbusb_front.c:
	Register xenbusb_resume() rather than bus_generic_resume()
	as the handler for device_resume events.

sys/xen/xenstore/xenstore.c:
	o Fix grammer in a comment.
	o In xs_suspend(), pass suspend events on to the child
	  devices (e.g. xenbusb_front/back, that are attached
	  to the XenStore.

Approved by:	re
MFC after:	1 week
2011-09-20 23:44:34 +00:00
Hans Petter Selasky
3e677ca02c Avoid starting the USB transfer if an error is already pending.
This change fixes a race in device side mode during clear-stall from
host, which can cause data to be sent too early on the given
endpoint.

Approved by:	re (kib)
MFC after:	1 week
2011-09-20 14:17:58 +00:00
Adrian Chadd
f3536faf94 Manually set the channel when using monitor mode - the firmware
doesn't select it automatically.

Submitted by:	nox
Reviewed by:	bschmidt
Approved by:	re
PR:		kern/160815
2011-09-20 04:30:23 +00:00
Attilio Rao
c839b5bbf7 #PROCHOT assertion is sticky after reading the MSR (accordingly with
Intel manuals) it must be cleared by writing a 0.
Fix that.

Sponsored by:	Sandvine Incorporated
Reported by:	rstone
Reviewed by:	delphij, emaste, rstone
Approved by:	re (kib)
MFC after:	1 week
2011-09-19 10:58:30 +00:00
Ryan Stone
11dc48dfde Clear transmit checksum offload context state upon lem(4) interface
initialization.  Prior to this change packets may be transmitted with an
incorrect checksum.

Em(4) already has an equivalent change in r213234.

Obtained From:  Sandvine
MFC After:      1 week
Approved by:    re (bz)
2011-09-17 13:48:09 +00:00
Kip Macy
8451d0dd78 In order to maximize the re-usability of kernel code in user space this
patch modifies makesyscalls.sh to prefix all of the non-compatibility
calls (e.g. not linux_, freebsd32_) with sys_ and updates the kernel
entry points and all places in the code that use them. It also
fixes an additional name space collision between the kernel function
psignal and the libc function of the same name by renaming the kernel
psignal kern_psignal(). By introducing this change now we will ease future
MFCs that change syscalls.

Reviewed by:	rwatson
Approved by:	re (bz)
2011-09-16 13:58:51 +00:00
Hans Petter Selasky
7cd72d8565 Reduce USB memory usage during enumeration.
We are allocating some kilobytes of extra memory during USB device enumeration.
This does not change alot under FreeBSD, but makes sense for various embedded
operating systems using the FreeBSD USB stack, which have less memory
resources available.

Approved by:	re (kib)
MFC after:	1 week
2011-09-14 15:16:53 +00:00
Christian Brueffer
31f301d021 Improve the sleep_delay sysctl description by specifying which unit
the number is in.

PR:		159975
Submitted by:	gcooper
Approved by:	re (kib)
MFC after:	1 week
2011-09-13 15:57:29 +00:00
David Christensen
61b6cf3661 - Fix compiler warning in ADD_64() macro.
Approved by:	re
Obtained from:	dimitry@andic.com
MFC after:	One week
2011-09-13 15:49:28 +00:00