Commit Graph

24373 Commits

Author SHA1 Message Date
Aleksandr Rybalko
869785b49c Add more SPI flash IDs.
Submitted by:	Luiz Otavio O Souza.
Submitted by:	ZRouter.org project.
Approved by:	adrian (menthor)
2012-09-25 22:12:07 +00:00
Adrian Chadd
0a54471901 Oops - don't do the clrdmask check in ath_tx_xmit_normal() - the wrong
lock may be held.

Kim reported that the TID lock wasn't held when ath_tx_update_clrdmask()
was called. Well, the underlying hardware TXQ for that TID.

I'm betting it's the cabq stuff. ath_tx_xmit_normal() can be called
for both real and software cabq.  For software cabq, the real destination
txq is different to the txq. So, the lock check will fail.

Reported by:	Kim Culhan <w8hdkim@gmail.com>
2012-09-25 20:41:43 +00:00
Ryan Stone
a916893f23 Some aac(4) adapters will always report that a direct access device is
offline in response to a INQUIRY command that does not retreive vital
product data(I personally have observed the behaviour on an Adaptec 2405
and a 5805).  Force the peripheral qualifier to "connected" so that upper
layers correctly recognize that a disk is present.

This bug was uncovered by r216236.  Prior to that fix, aac(4) was
accidentally clearing the peripheral qualifier for all inquiry commands.

This fixes an issue where passthrough devices were not created for
disks behind aac(4) controllers suffering from the bug.  I have
verified that if a disk is not present that we still properly detect
that and not create the passthrough device.

Sponsored by:	Sandvine Incorporated
MFC after:	1 week
2012-09-25 19:12:12 +00:00
Alexander Motin
aa91d1a85c Reduce delays in several wait loops from 10ms to 10us, same is it is done
in Linux. This substantially increases graphics performance on Ivy Bridge.

Submitted by:	avg@
Reviewed by:	kib@
2012-09-25 10:52:49 +00:00
Adrian Chadd
23f44d2b30 Call ath_tx_tid_unsched() after the node has been flushed, so the
state can be printed correctly.
2012-09-25 05:56:59 +00:00
Jim Harris
6aa3468375 Use CAM_SEL_TIMEOUT and CAM_DEV_NOT_THERE to report missing targets or
LUNs respectively.  This removes a huge number of error messages
from CAM during bus scans.

Copied almost verbatim from mav's commit r237460.

Submitted by:	Mike Tancsa <mike at sentex dot net>
MFC after:	3 days
2012-09-24 21:45:41 +00:00
Jim Harris
95161fc323 Specify MTX_RECURSE for the controller's io_lock. Without it, tws(4)
immediately panics on boot with INVARIANTS enabled.  The driver already
clearly expects to be able to recurse on this mutex - the main I/O
is always recursing on this lock.

Reported and tested by:  Mike Tancsa <mike at sentex dot net>
MFC after: 1 week
2012-09-24 21:40:22 +00:00
Adrian Chadd
0368251456 Migrate the ath(4) KTR logging to use an ATH_KTR() macro.
This should eventually be unified with ATH_DEBUG() so I can get both
from one macro; that may take some time.

Add some new probes for TX and TX completion.
2012-09-24 20:35:56 +00:00
Adrian Chadd
6d24c7dbab Debugging output fixes:
* use the correct frame status - although the completion descriptor is
  the _last_ in the frame/aggregate, the status is currently stored in
  the _first_ buffer.

* Print out ath_buf specific fields once, not per descriptor in an ath_buf.
2012-09-24 19:48:41 +00:00
Hans Petter Selasky
391d3f18dc DWC OTG host mode improvements:
- Make HSIC selection dynamic.
 - Make LOW speed USB devices work through HIGH speed USB HUB.
2012-09-24 16:34:13 +00:00
Alexander Motin
076b76e871 Fix panic caused by wrong pointer dereference, left after pin sense rewrite
at r230551.

Also while there, make sense polling use reported for each node separately
instead of reporting accumulated total status.

Submitted by:	Barbara <barbara.freebsd@gmail.com> (1)
MFC after:	3 days
2012-09-24 08:23:05 +00:00
Adrian Chadd
0c54de88e6 Prepare for software retransmission of non-aggregate frames but ensure
it's disabled.

The previous commit to enable CLRDMASK setting didn't do it at all
correctly for non-aggregate sessions - so the CLRDMASK bit would be
cleared and never re-set.

* move ath_tx_update_clrdmask() to be called by functions that setup
  descriptors and queue frames to the hardware, rather than scattered
  everywhere.

* Force CLRDMASK to be set on all non-aggregate session frames being
  transmitted.

* Use ath_tx_normal_comp() now on non-aggregate sessoin frames
  that are queued via ath_tx_xmit_normal().  That way the TID hwq is
  updated and they can trigger (eventual) filter frame queue resets
  and software retransmits.

There's still a bit more work to do in this area to reverse the silly
short-sightedness on my part, however it's likely going to be better
to fix this now than just reverting the patch.

Thanks to people on the freebsd-wireless@ mailing list for promptly
pointing this out.
2012-09-24 06:42:20 +00:00
Adrian Chadd
94eefcf1dc In (eventual) preparation for supporting disabling the whole 11n/software
retry path - add some code to make it obvious (to me!) how to disable
the software tx path.
2012-09-24 06:00:51 +00:00
Sean Bruno
126a39ce60 This patch fixes a nit in the em, lem, and igb driver statistics. Increment
adapter->dropped_pkts instead of if_ierrors because if_ierrors is
overwritten by hw stats collection.

Submitted by:	Andrew Boyer <aboyer@averesystems.com>
Reviewed by:	Jack F Vogel <jfv@freebsd.org>
MFC after:	2 weeks
2012-09-23 22:53:39 +00:00
Hans Petter Selasky
3eabad2587 DWC OTG host mode improvements. Add support for the 3-strikes and you are
gone rule. Optimise use of channels so that when a channel
is not ready another channel is used. Instead of using the SOF interrupt
use the system timer to drive the host statemachine. This might
give lower throughput and higher latency, but reduces the CPU usage
significantly. The DWC OTG host mode support should not be considered
for serious USB host controller applications. Some problems are still
seen with LOW speed USB devices.
2012-09-23 12:19:19 +00:00
Hans Petter Selasky
3c12706c5e Correct driver name.
MFC after:	1 weeks
2012-09-23 09:39:04 +00:00
Kevin Lo
cecaa4738c Remove unused variable ma. 2012-09-23 08:44:12 +00:00
Hans Petter Selasky
9b42038b8a Apply some more casting. 2012-09-22 08:02:42 +00:00
Hans Petter Selasky
8692ca3647 Apply correct casting. 2012-09-22 07:27:24 +00:00
Hans Petter Selasky
2a4e4c6772 Fix typo. 2012-09-20 15:11:59 +00:00
Kevin Lo
26f370d011 Fix typo: s/protocl/protocol 2012-09-20 10:07:31 +00:00
Gavin Atkinson
3cdfd8d3b2 The correct generic term for PCIS_STORAGE_NVM is "NVM" not "NVM Express".
Submitted by:	jimharris
MFC after:	6 days
2012-09-20 08:30:17 +00:00
Adrian Chadd
4e81f27c59 Introduce the CLRDMASK gating based on tid->clrdmask, enabling filtered
frames to occur.

* Create a new function which will set the bf_flags CLRDMASK bit
  if required.
* For raw frames, always set CLRDMASK.
* For BAR, ADDBA frames, always set CLRDMASK.
* For everything else, check if CLRDMASK needs to be set before
  calling tx_setds() or tx_setds11n().
* When unpausing a queue or drain/resetting it, set tid->clrdmask=1
  just to ensure traffic starts flowing.

What I need to do:

* Modify that function to _clear_ the CLRDMASK if it's not required,
  or retried frames may have CLRDMASK set when they don't need to.
  (Which isn't a huge deal, but..)

Whilst I'm here:

* ath_tx_normal_xmit() should really act like the AMPDU session TX
  functions - any incomplete frames will end up being assigned
  ath_tx_normal_comp() which will decrement tid->hwq_depth - but that
  won't have been incremented.

  So whilst I'm here, add a comment to do that.

* Fix the debug print function to be slightly clearer about things;
  it's not a good sign when I can't interpret my own debugging output.

I've done some testing on AR9280/AR5416/AR9160 STA and AP modes.
2012-09-20 03:13:20 +00:00
Adrian Chadd
d05b576d61 Place the comment where it should be. 2012-09-20 03:04:19 +00:00
Adrian Chadd
088d8b81f3 Add a work-around for some strange net80211 BAR races in the wireless
stack.

There are unfortunately quite a few odd cases in BAR TX and BAR TX
retransmission that I haven't yet fully diagnosed.  So for now, add
this work-around so the resume() function isn't called too often,
decrementing pause to -1 (and causing things to stay paused.)
2012-09-20 03:03:01 +00:00
Jim Harris
7e2fd60604 In nvme(4), set device description for BUS_PROBE_GENERIC case.
Reported by:	jhb
2012-09-19 18:25:25 +00:00
Gavin Atkinson
a5c5eaae8c Recognise NVM Express devices and pretty-print their name.
MFC after:	1 week
2012-09-19 18:22:14 +00:00
Jim Harris
d891b199bf Report nvme(4) as a generic driver for NVMe devices if PCI class, subclass
and programming interface codes match.

Sponsored by:	Intel
2012-09-19 16:21:23 +00:00
Jim Harris
6483d5a592 Add constants for programming interfaces for NVM/solid state storage
controller sub-class code.

Reference:  PCI Code and ID Assignment Specification Rev 1.2

Sponsored by:	Intel
Inspired by:	gavin
MFC after: 	1 week
X-MFC-With:	r240694
2012-09-19 15:43:30 +00:00
Gavin Atkinson
536f8fdecf Add PCI subclass for NVM Express devices.
Reference:
http://www.nvmexpress.org/index.php/download_file/view/42/1/NVM_Express_1_0b.pdf
section 2.1.5.

MFC after:	1 week
2012-09-19 12:54:25 +00:00
Gavin Atkinson
e935190a33 Switch some PCI register reads from using magic numbers to using the names
defined in pcireg.h

MFC after:	1 week
2012-09-19 12:27:23 +00:00
John Baldwin
26e76e98ef As a followup to r234501, ensure that the native ioctl path always allocates
a 4kb buffer if a request uses a buffer size of 0.  (The Linux ioctl path
already did this.)

PR:		kern/155658
Submitted by:	Andreas Longwitz
MFC after:	1 week
2012-09-19 11:54:32 +00:00
Gavin Atkinson
d11d0374ab Add entries for two USB devices I have locally.
MFC after:	1 week
2012-09-18 22:25:49 +00:00
Gavin Atkinson
389c8bd51e Align the PCI Express #defines with the style used for the PCI-X
#defines.  This also has the advantage that it makes the names more
compact, iand also allows us to correct the non-uniform naming of
the PCIM_LINK_* defines, making them all consistent amongst themselves.

This is a mostly mechanical rename:
  s/PCIR_EXPRESS_/PCIER_/g
  s/PCIM_EXP_/PCIEM_/g
  s/PCIM_LINK_/PCIEM_LINK_/g

When this is MFC'd, #defines will be added for the old names to assist
out-of-tree drivers.

Discussed with:	jhb
MFC after:	1 week
2012-09-18 22:04:59 +00:00
Adrian Chadd
0aa5c1bbf5 Oops - take a copy of ath_tx_status from the buffer before the TX processing
is done.

The aggregate path was definitely accessing 'ts' before it was actually
being assigned.

This had the side effect of over-filtering frames, since occasionally that
bit would be '1'.

Whilst here, do the same thing in the non-aggregate completion function -
as calling the filter function may also invalidate bf.

Pointy hat to: adrian, for not noticing this over many, many code reviews.
2012-09-18 20:33:04 +00:00
Jim Harris
8a382371f1 Add #if 0 around nvme_async_event_cb() until NVMe AER functionality
can be tested.

This fixes a build warning found only with clang.
2012-09-18 18:23:21 +00:00
Jim Harris
be4dcf1bfa Add __aligned(4) to NVMe defined data structures.
This fixes issue in nvmecontrol(8), where clang throws a cast-align
warning when casting a __packed structure pointer to a uint32_t
pointer as part of printing raw hex output.

Reported by: dhw
2012-09-18 18:16:52 +00:00
Andriy Gapon
e67c0426bc hwpmc amd_pcpu_fini: fix a bug in code locked under DEBUG
MFC after:	16 days
2012-09-18 13:33:39 +00:00
Adrian Chadd
f1bc738ece Implement my first cut at filtered frames in aggregation sessions.
The hardware can optionally "filter" frames if successive transmissions
to a given node (ie, "entry in the keycache") fail.  That way the hardware
can implement a kind of early abort of all the other frames queued to
that destination, rather than simply trying to TX each frame to that
destination (and failing.)

The background:

* If a frame comes back as being filtered, the hardware didn't try to
  TX it (or it was outside the TX burst opportunity.) So, take it as a hint
  that some (but not all, see below) frames to the destination may be
  filtered.

* If the CLRDMASK bit is set in a TX descriptor, the "filter to this
  destination" bit in the keycache entry is cleared and TX to that host
  will be unconditionally retried.

* Right now everything has the CLRDMASK bit set, so filtered frames
  tend to be aggregates and frames that fall outside of the WME burst
  window. It was a bit worse in the past as I had messed up the TX
  flags and CLRDMASK wasn't being set on aggregate frames.

The annoying bits:

* It's easy (ish) to do for aggregate session frames - firstly, they
  can be retried in any order as long as they're within the BAW, and
  there's already a bunch of infrastructure tracking how many frames
  the TID has queued to the hardware (tid->hwq_depth.) However, for
  frames that bypassed the software queue, hwq_depth doesn't get
  incremented. I'll fix that in a subsequent commit.

* For non-aggregate session frames, the only retries that can occur
  are ones for sequence numbers that hvaen't successfully been TXed yet.
  Since there's no re-ordering going on in non-aggregate sessions, if any
  subsequent seqno frames make it out, any filtered frames before that
  seqno need to be dropped.

  Hence why this initially is just for aggregate session frames.

* Since there may be intermediary frames to the destination that
  have CLRDMASK set - for example, any directly dispatched management
  frames to that destination - it's possible that there will be some
  filtered frames followed up by some non filtered frames.  Thus,
  it can't be assumed that once you see a filtered frame for the given
  destination node, all subsequent frames for all TIDs will be filtered.

Ok, with that in mind:

* Create a per-TID filtered frame queue for frames that the hardware
  returns as filtered.

* Track filtered frames per-tid, rather than per-node.  It just makes
  the locking much easier.

* When a filtered frame appears in the completion function, the node
  transitions to "filtered", and all subsequent completed error frames
  (filtered or otherwise) are put on the filtered frame queue.  The TID
  is paused once (during the transition from non-filtered to filtered).

* If a filtered frame retry count exceeds SWMAX_RETRIES, a BAR should be
  sent.

* Once all the frames queued to the hardware for the given filtered frame
  TID, transition back from filtered frame to non-filtered frame, which
  means pre-pending all the filtered frames onto the head of the software
  queue, clearing the filtered frame state and unpausing the TID.

Things get quite hairy around handling completion (aggr, non-aggr, norm,
direct-dispatched frames to a hardware queue); whether it's an "error",
"cleanup" or "BAR" state as well as filtered, which order to do things
in (eg do filtered BEFORE checking for BAR, as the filter completion
may be needed to actually transmit a BAR frame.)

This work has definitely reminded me that I have to tidy up all the locking
and remove some of the ridiculous lock/unlock/lock/unlock going on in the
completion functions.

It's also reminded me that I should really split out TID versus hardware TXQ
locking, even if the underlying locking is still the destination hardware TXQ.

Finally, this is all pre-requisite for working on AP mode power save support
(PS-POLL, uAPSD) as well as improving performance to misbehaving nodes (as
they can transition into filter mode, stopping any TX until everything has
caught up.)

Finally (ish) - this should also be done for non-aggregate sessions as
there are still plenty of laptops and mobile devices that don't speak
802.11n but do wish for stable, useful power save AP support where packets
aren't simply dropped.  This requires software retransmission for
non-aggregate sessions to be implemented, which includes the caveats I've
mentioned above.

Finally finally - this doesn't yet do anything about the CLRDMASK bit in the
TX descriptor.  That's still unconditionally set to 1.  I'll debug the
current work (mostly ensuring I haven't busted up the hairy transitions
between BAR, filtered, error (all frames in an aggregate failing) and
cleanup (when transitioning from aggregation -> non-aggregation.))

Finally finally finally - this is all original work by yours truely, rather
than ported from the Atheros internal driver codebase or Linux ath9k.

Tested:
 * AR9280, AR5416 in STA mode
 * AR9280, AR9130 in hostap mode
 * Lots and lots of iperf testing in very marginal and non-marginal conditions,
   complete with inducing filtered frames + BAR TX conditions.
2012-09-18 10:14:17 +00:00
Andriy Gapon
154fc7b6c7 acpi_cpu: explicitly notify userland about c-state changes
... after they are committed.
A notification is sent per CPU.

Reviewed by:	imp
MFC after:	3 weeks
2012-09-18 08:17:29 +00:00
Kevin Lo
08466b02d4 Remove bogus break statements.
Obtained from:	DragonFly
2012-09-18 02:19:43 +00:00
Adrian Chadd
8122c3163f Add a couple of accessor inline functions for state that exists in net80211.
Obtained from:	Qualcomm Atheros
2012-09-18 01:27:24 +00:00
Adrian Chadd
d94f2d7f34 Rename AH_MIMO_MAX_CHAINS to AH_MAX_CHAINS, for compatibility with
internal atheros HAL code.
2012-09-17 23:24:45 +00:00
Jim Harris
bb0ec6b359 This is the first of several commits which will add NVM Express (NVMe)
support to FreeBSD.  A full description of the overall functionality
being added is below.  nvmexpress.org defines NVM Express as "an optimized
register interface, command set and feature set fo PCI Express (PCIe)-based
Solid-State Drives (SSDs)."

This commit adds nvme(4) and nvd(4) driver source code and Makefiles
to the tree.

Full NVMe functionality description:
Add nvme(4) and nvd(4) drivers and nvmecontrol(8) for NVM Express (NVMe)
device support.

There will continue to be ongoing work on NVM Express support, but there
is more than enough to allow for evaluation of pre-production NVM Express
devices as well as soliciting feedback.  Questions and feedback are welcome.

nvme(4) implements NVMe hardware abstraction and is a provider of NVMe
namespaces.  The closest equivalent of an NVMe namespace is a SCSI LUN.
nvd(4) is an NVMe consumer, surfacing NVMe namespaces as GEOM disks.
nvmecontrol(8) is used for NVMe configuration and management.

The following are currently supported:
nvme(4)
- full mandatory NVM command set support
- per-CPU IO queues (enabled by default but configurable)
- per-queue sysctls for statistics and full command/completion queue
     dumps for debugging
- registration API for NVMe namespace consumers
- I/O error handling (except for timeoutsee below)
- compilation switches for support back to stable-7

nvd(4)
- BIO_DELETE and BIO_FLUSH (if supported by controller)
- proper BIO_ORDERED handling

nvmecontrol(8)
- devlist: list NVMe controllers and their namespaces
- identify: display controller or namespace identify data in
      human-readable or hex format
- perftest: quick and dirty performance test to measure raw
      performance of NVMe device without userspace/physio/GEOM
      overhead

The following are still work in progress and will be completed over the
next 3-6 months in rough priority order:
- complete man pages
- firmware download and activation
- asynchronous error requests
- command timeout error handling
- controller resets
- nvmecontrol(8) log page retrieval

This has been primarily tested on amd64, with light testing on i386.  I
would be happy to provide assistance to anyone interested in porting
this to other architectures, but am not currently planning to do this
work myself.  Big-endian and dmamap sync for command/completion queues
are the main areas that would need to be addressed.

The nvme(4) driver currently has references to Chatham, which is an
Intel-developed prototype board which is not fully spec compliant.
These references will all be removed over time.

Sponsored by:        Intel
Contributions from:  Joe Golio/EMC <joseph dot golio at emc dot com>
2012-09-17 19:23:01 +00:00
Hans Petter Selasky
d7dd13419e Add UQ_UMS_IGNORE quirk.
Wrap two long lines.
Some minor spelling correction.

PR:	usb/171721
2012-09-17 19:06:35 +00:00
Hans Petter Selasky
e2524b2ec9 Implement support for USB Audio v2.0. Remove some redundant
USB audio v1.0 debug data, hence userspace tools like lsusb
exist to show this information properly.
2012-09-17 15:43:57 +00:00
John Baldwin
0fca6f8bf5 Add locking to mlx(4) to make it MPSAFE along with some other fixes:
- Use callout(9) rather than timeout(9).
- Add a mutex as an I/O lock that protects the adapter and is used
  for the I/O path.
- Add an sx lock as a configuration lock that protects the relationship
  of configured volumes.
- Freeze the request queue when a DMA load is deferred with EINPROGRESS
  and unfreeze the queue when the DMA callback is invoked.
- Explicitly poll the hardware while waiting to submit a command to
  allow completed commands to free up slots in the command ring.
- Remove driver-wide 'initted' variable from mlx_*_fw_handshake() routines.
  That state should be per-controller instead.  Add it as an argument
  since the first caller knows when it is the first caller.
- Remove explicit bus_space tag/handle and use bus_*() rather than
  bus_space_*().
- Move duplicated PCI device ID probing into a  mlx_pci_match() routine.
- Don't check for PCIM_CMD_MEMEN (the PCI bus will enable that when
  allocating the resource) and use pci_enable_busmaster() rather than
  manipulating the register directly.

Tested by:	no one despite multiple requests (hope it works)
2012-09-17 15:27:30 +00:00
Gavin Atkinson
058ede33bf - Add #defines for the bits within the iPCI Express PCIR_EXPRESS_LINK_CTL
register
- Add missing register PCIR_EXPRESS_ROOT_CAP
- Correct a spelling mistake (SLAT -> SLOT) [1]

Reviewed by:	jhb [1]
2012-09-17 12:51:48 +00:00
Kevin Lo
4e4eb12038 Remove unused variable cd.
This variable is initialized but not used.
2012-09-17 09:32:11 +00:00
Adrian Chadd
c6e9cee205 Take credit for the work I've done in this source file. 2012-09-17 03:17:42 +00:00
Matt Jacob
6f7aeb5fe3 Minor correction.
MFC after:	1 day
2012-09-17 02:50:16 +00:00
Matt Jacob
8b382bc2b5 Add some edits to the changed comments so that they make more sense.
MFC after:	1 day
2012-09-17 02:49:02 +00:00
Adrian Chadd
de8e4d6436 Add a per-TID filter queue and filter state bits.
These are intended for software TX filtering support, where the NIC
decides there has been too many successive failues to a destination
and will filter it.

Although the filtering is done per-destination (via the keycache),
the state and queue is kept per-TID for now.  It simplifies the overall
architecture design and locking.

Whilst here, add ATH_TID_UNLOCK_ASSERT().
2012-09-17 01:21:55 +00:00
Adrian Chadd
355cae39e9 Add a debug bit for TX destination filtering. 2012-09-17 01:18:47 +00:00
Adrian Chadd
e69db8df7d Improve performance of the Sample rate algorithm on 802.11n networks.
* Don't treat high percentage failures as "sucessive failures" - high
  MCS rates are very picky and will quite happily "fade" from low
  to high failure % and back again within a few seconds.  If they really
  don't work, the aggregate will just plain fail.

* Only sample MCS rates +/- 3 from the current MCS.  Sample will back off
  quite quickly, so there's no need to sample _all_ MCS rates between
  a high MCS rate and MCS0; there may be a lot of them.

* Modify the smoothing rate to be 75% rather than 95% - it's more adaptive
  but it comes with a cost of being slightly less stable at times.
  A per-node, hysterisis behaviour would be nicer.
2012-09-17 01:09:17 +00:00
Ed Schouten
7cbef24e1a Prefer __containerof() above member2struct().
The first does proper checking of the argument types, while the latter
does not.
2012-09-15 19:28:54 +00:00
Eitan Adler
0af1b47258 s/ is is / is /g
s/ a a / a /g

Approved by:	cperciva
MFC after:	3 days
2012-09-14 22:00:03 +00:00
Eitan Adler
582212fa04 s/teh/the/g
Approved by:	cperciva
MFC after:	3 days
2012-09-14 21:59:55 +00:00
Eitan Adler
96240c89f0 Correct double "the the"
Approved by:	cperciva
MFC after:	3 days
2012-09-14 21:28:56 +00:00
Jim Harris
cc31866200 isci(4): Fix SCSI/ATA translation for SCSI_WRITE_BUFFER w/ mode==0x7
(download microcode with offsets, save, and activate).

SATI translation layer was incorrectly using allocation length instead
of blocks, and was constructing the ATA command incorrectly.

Also change #define to specify that the 512 block size here is
specific for DOWNLOAD_MICROCODE, and does not relate to the device's
logical block size.

Submitted by: scottl (with small modifications)
MFC after: 3 days
2012-09-14 20:05:38 +00:00
Grzegorz Bernacki
68b7bd0469 If virtual addresses are not set use one to one mapping.
Do not map memory and IO space at address 0.

Obtained from: Semihalf
2012-09-14 09:45:13 +00:00
Grzegorz Bernacki
2c99056488 Add fdt_get_unit() function.
Obtained from:	Semihalf
2012-09-14 09:36:35 +00:00
Grzegorz Bernacki
2f0da24b47 Set busaddr and bussize to 0 when fdt_get_range() fails.
Obtained from:	Semihalf
2012-09-14 09:33:35 +00:00
Hans Petter Selasky
b792f659e3 DWC OTG improvements. Implement full support for SPLIT transactions, in other
words FULL/LOW speed devices through HIGH speed HUBs. Improve support for
suspend and resume in host mode.
2012-09-14 07:52:57 +00:00
Attilio Rao
0a15e5d30d Remove all the checks on curthread != NULL with the exception of some MD
trap checks (eg. printtrap()).

Generally this check is not needed anymore, as there is not a legitimate
case where curthread != NULL, after pcpu 0 area has been properly
initialized.

Reviewed by:	bde, jhb
MFC after:	1 week
2012-09-13 22:26:22 +00:00
John Baldwin
2cfd0c4638 - Add some registers defined in PCI 3.0 including new AER bits.
- Add constants for the rest of the fields in the PCI-express device
  capability and control registers.
- Tweak some of the recently added PCI-e capability constants (always
  use hex for offsets in config space, and include a shortened
  version of the relevant register in the name of field constants).

MFC after:	1 week
2012-09-13 19:05:24 +00:00
Adrian Chadd
9b967f5d12 Don't use AR_PHY_MODE to setup half/quarter rate.
I'm not sure where in the deep, distant past I found the AR_PHY_MODE
registers for half/quarter rate mode, but unfortunately that doesn't
seem to work "right" for non-AR9280 chips.

Specifically:

* don't touch AR_PHY_MODE
* set the PLL bits when configuring half/quarter rate

I've verified this on the AR9280 (5ghz fast clock) and the AR5416.

The AR9280 works in both half/quarter rate; the AR5416 unfortunately
only currently works at half rate.  It fails to calibrate on quarter rate.
2012-09-13 18:24:13 +00:00
Eitan Adler
2bfb8a83f6 Define missing DEBUGOUT# macros. DEBUGOUT[45] are not yet used but are
being defined pre-emptively to avoid future build breakage

PR:		kern/168967
Submitted by:	fuzhli <fuzl@arraynetworks.com.cn>
Approved by:	cperciva
MFC after:	1 week
2012-09-13 14:40:24 +00:00
Konstantin Belousov
c5e3d0ab11 Rename the IVY_RNG option to RDRAND_RNG.
Based on submission by:	Arthur Mesh <arthurmesh@gmail.com>
MFC after:	2 weeks
2012-09-13 10:12:16 +00:00
Navdeep Parhar
8a599c0859 Install interrupt handlers early, during attach, for the reason
explained in r239913 by jhb.

MFC after:	1 week
2012-09-13 09:18:13 +00:00
Navdeep Parhar
57c60f98b8 Use native FreeBSD facilities everywhere except the shared code in common/
MFC after:	1 week
2012-09-13 09:10:10 +00:00
Adrian Chadd
03a51ef8f4 Enable fractional 5G mode on half/quarter rate channels.
Obtained from:	Linux ath9k
2012-09-13 07:25:41 +00:00
Adrian Chadd
77ffc4c1fc Flip on half/quarter rate support.
No, this isn't HT/5 and HT/10 support.  This is the 11a half/quarter
rate support primarily used by the 4.9GHz and GSM band regulatory
domains.

This is definitely a work in progress.

TODO:

* everything in the last commit;
* lots more interoperability testing with the AR5212 half/quarter rate
  support for the relevant chips;
* Do some interop testing on half/quarter rate support between _all_
  the 11n chips - AR5416, AR9160, AR9280 (and AR9285/AR9287 when 2GHz
  half/quarter rate support is coded up.)
2012-09-13 07:24:14 +00:00
Adrian Chadd
ce801478d2 Introduce an AR5416 flavour of the IFS and mac usec/timing configuration
used when running the chips in half/quarter rate.

This sets up some default parameters which are then overridden by the
driver (which manually configures things like slot timing at interface
start time.)

Although this is a copy-and-modify from the AR5212 HAL, I did peek
at the reference HAL and the ath9k driver to see what they did.
Ath9k in particular doesn't hard-code this - instead, their version
of ar5416InitUserSettings() does all of the relevant math.

TODO:

* do the math, not hard code things!
* fix the mac clock calculation for the AR9287; since it runs the
  MAC clock at a higher rate, requiring all the duration calculations
  to change;
* Do a whole lot more validation for half/quarter rates.

Obtained from:	Qualcomm Atheros, Linux ath9k
2012-09-13 07:22:40 +00:00
Adrian Chadd
41b53a9aaf Call the ar5212SetCoverageClass() function for now.
Some of the math is a little wrong thanks to clocks in 11a mode running
at 44MHz when in fast clock mode (rather than 40MHz, which the chips
before AR9280 ran 11a in).  That'll have to be addressed in a future commit.
2012-09-13 07:19:53 +00:00
Adrian Chadd
c19a7918f3 Add register defintions for the AR5416 TX/RX latency fields.
Obtained from:	Qualcomm Atheros
2012-09-13 07:17:58 +00:00
Adrian Chadd
1690edb32c Compensate for half/quarter rate differences in MAC clock speed.
This fixes the incorrect slot (and likely ACK/RTS timeout) values
which I see when enabling half/quarter rate support on the AR9280.

The resulting math matches the expected calculated default values.
2012-09-13 07:17:29 +00:00
Navdeep Parhar
8a7ba352b0 Update interface to firmware 1.6.2 and include the firmware in the driver.
Obtained from:	Chelsio
MFC after:	1 week
2012-09-13 06:32:52 +00:00
Peter Grehan
60ff334285 No need to leak these into the includer's namespace.
Submitted by:	Bryan Venteicher bryanv at daemoninthecloset org
2012-09-13 00:42:56 +00:00
Peter Grehan
c44ef550e1 Relax requirement of certain mb()s
Submitted by:	Bryan Venteicher bryanv at daemoninthecloset org
2012-09-13 00:36:46 +00:00
Hans Petter Selasky
beefefd4b0 Fix TX FIFO sizes. Correct FIFO handling in Host mode. 2012-09-12 19:15:29 +00:00
Alexander Motin
189d85cc15 Fix AHCI 1.2 version checks. This should be mostly cosmetic.
Submitted by:	Dmitry Luhtionov <dmitryluhtionov@gmail.com>
MFC after:	1 week
2012-09-12 09:20:37 +00:00
Kevin Lo
92665d2b55 Restart the USB transfer if the error is not USB_ERR_CANCELLED. 2012-09-12 07:59:28 +00:00
Hans Petter Selasky
d4b6c03ea9 Reduce DWC OTG polling rate by using the SOF interrupt. 2012-09-12 07:34:09 +00:00
Hans Petter Selasky
537aca954f Fix missing parts of DWC OTG host mode support. The host mode support
of the DWC OTG is very simple in PIO mode, and we need to re-transmit
data when NAK is received among other things. We probably will need
to implement some kind of rate limitation on the NAK-ing.
2012-09-11 22:08:19 +00:00
Andriy Gapon
31482433f4 revert r240344: cpu_devices[] is used in other functions and must be kept
Reported by:	gjb, glebius
Pointyhat to:	avg
MFC after:	1 day
X-MFC note:	fake MFC, reminder to never MFC r240344
2012-09-11 17:21:25 +00:00
Scott Long
a46570c76d Remove a prefetch() directive that, after careful testing, does more harm
than good.

Submitted by:	Fabien Thomas
Reviewed by:	jfv
2012-09-11 16:59:04 +00:00
Andriy Gapon
ccb92b3c78 acpi_cpu: free result of device_get_children
MFC after:	1 week
2012-09-11 06:26:20 +00:00
Adrian Chadd
5d9b19f731 Clear the correct descriptor when going through the chained together
gather DMA descriptor list.

Pointy hat to: adrian@, for even USING bf->bf_desc here instead of 'ds'.
2012-09-11 04:11:42 +00:00
John Baldwin
a89828a2b0 Remove some more NetBSD compat shims and other unused bits from these
drivers:
- Remove scsi_low_pisa.*, they were unused.
- Remove <compat/netbsd/physio_proc.h> and calls to the stubs in that
  header.  They were empty nops.
- Retire sl_xname and use device_get_nameunit() and device_printf() with
  the underlying device_t instead.
- Remove unused {ct,ncv,nsp,stg}print() functions.
- Remove empty SOFT_INTR_REQUIRED() macro and the unused sl_irq member.
2012-09-10 18:49:49 +00:00
Hans Petter Selasky
e828eaabf4 Poll VBUS status every second, hence the AT91 GPIO library doesn't support
registering interrupt handlers yet for GPIO events.
2012-09-10 13:50:34 +00:00
Hans Petter Selasky
460febc7be Fix for IRQ hang in DWC OTG host mode. 2012-09-10 12:23:56 +00:00
Hans Petter Selasky
92a80a4cef Cleanup interrupt handling in Host Mode. 2012-09-10 08:23:56 +00:00
Alexander Motin
df980c683c At least from A70M FCH chipsets AMD started to use their real vendor ID
(1022) in HPET. But according to report they still haven't fixed problem
with level-triggered interrupts.
Make workaround used for earlier chipsets apply to this new ID also.

PR:		amd64/171355
MFC after:	3 days
2012-09-09 20:00:00 +00:00
Hans Petter Selasky
58ecbe49f5 Implement missing USB suspend and resume support for DWC OTG driver. 2012-09-09 17:23:57 +00:00
Hans Petter Selasky
268ae63a2a Add support for DWC OTG. 2012-09-09 14:53:34 +00:00
Hans Petter Selasky
9cfd07315e Add support for host mode to the DWC OTG controller driver.
The DWC OTG host mode support should still be considered
experimental. Isochronous support for DWC OTG is not
fully implemented. Some code added derives from
Aleksandr Rybalko's dotg.c driver.
2012-09-09 14:41:34 +00:00
Adrian Chadd
21840808c8 Make sure the aggregate fields are properly cleared - both in the
ath_buf and when forming a non-aggregate frame.

The non-11n setds function is called when TXing aggregate frames (and
yes, I should fix this!) and the non-11n TX aggregation code doesn't clear
the delimiter field.  I figure it's nicer to do that.
2012-09-09 05:06:16 +00:00
Adrian Chadd
a71362cec6 Remove TDMA #define entries from if_ath.c; they now exist in if_ath_tdma.h. 2012-09-09 04:53:10 +00:00
Adrian Chadd
76af1a93c9 Correctly mask out the RTS/CTS flags when forming aggregates.
This had the side effect of clearing HAL_TXDESC_CLRDMASK for a bunch of
frames, meaning they'd end up being potentially filtered if there were
an error.  This is fine in the previous world as they'd just be
software retried but now that I'm working on filtered frames, these
descriptors would be endlessly retried until another valid frame would
come along that had CLRDMASK set.
2012-09-08 02:56:09 +00:00
Matt Jacob
10bf42c215 Remove useless extra test.
Pointed out by:	Sascha of DragonFly BSD
MFC after:	2 weeks
2012-09-07 22:45:31 +00:00
John Baldwin
ecbb462c38 Use callout(9) instead of timeout(9) to manage timers. 2012-09-07 19:42:36 +00:00
Xin LI
a8bc743735 It seems that what the code really meant is that when a write is completed,
do a BUS_DMASYNC_POSTWRITE over the DMA map.  The way it currently is would
only do POSTREAD for read transactions.

Submitted by:	Sascha Wildner
MFC after:	1 month
2012-09-07 19:00:27 +00:00
John Baldwin
51ba7b6f3e Remove remaining 4.x compat shims. No resulting changes (verified by
md5).
2012-09-07 18:41:19 +00:00
Fabien Thomas
35db642499 Complete and merge the list between Sandy/Ivy bridge of events
that can run on specific PMC.

MFC after:	1 month
2012-09-07 14:45:59 +00:00
Adrian Chadd
2a9f83af64 Ensure that single-frame aggregate session frames are retransmitted
with the correct configuration.

Occasionally an aggregate TX would fail and the first frame would be
retransmitted as a non-AMPDU frame.  Since bfs_aggr=1 and bfs_nframes > 1
(from the previous AMPDU attempt), the aggr completion function would be
called and be very confused about what's going on.

Noticed by:	Kim <w8hdkim@gmail.com>
PR:		kern/171394
2012-09-07 00:24:27 +00:00
John Baldwin
b9b256e49a Remove NetBSD compat shims for drivers originally shared with NetBSD/pc98.
NetBSD/pc98 was never merged into the main NetBSD tree and is no longer
developed.  Adding locking to these drivers would have made the compat
shims hard to impossible to maintain, so remove the shims to ease
future changes.

These changes were verified by md5.  Some additional shims can be removed
that do affect the compiled results that I will probably do in another
round.

Approved by:	nyan (tentatively)
2012-09-06 18:53:33 +00:00
Fabien Thomas
1e862e5ad0 Add Intel Ivy Bridge support to hwpmc(9).
Update offcore RSP token for Sandy Bridge.
Note: No uncore support.

Will works on Family 6 Model 3a.

MFC after: 1 month
Tested by: bapt, grehan
2012-09-06 13:54:01 +00:00
Kevin Lo
3aa5b33a42 Add missing braces
Obtained from:	DragonFly
2012-09-06 02:07:58 +00:00
Gavin Atkinson
77c0749cb2 Add #defines for the bits in the PCI Express SLOT registers. Names
have been chosen based on the bit names in the PCI Express Base
Specification 3.0, and to match the predominant style of the existing
bit definitions.

MFC after:	1 week
2012-09-05 19:01:39 +00:00
John Baldwin
1832280a9e - Explicitly call twe_done() to poll the hardware when looping in
twe_start() to simulate the behavior on 4.x where the driver dropped
  spl to allow interrupts to run to free up space in the command
  queue.  Be careful to only poll if we are going to make at least
  one more attempt to queue the current command.  Also, when polling,
  be careful to not call twe_startio() to queue more commands to avoid
  recursion.
- Move the buffer for formatting AEN messages into the softc instead of
  using a single driver-wide static buffer.

Requested by:	scottl (1)
Tested by:	Mike Tancsa @ Sentex
2012-09-05 14:31:58 +00:00
Konstantin Belousov
ef9461ba0e Add support for new Intel on-CPU Bull Mountain random number
generator, found on IvyBridge and supposedly later CPUs, accessible
with RDRAND instruction.

From the Intel whitepapers and articles about Bull Mountain, it seems
that we do not need to perform post-processing of RDRAND results, like
AES-encryption of the data with random IV and keys, which was done for
Padlock. Intel claims that sanitization is performed in hardware.

Make both Padlock and Bull Mountain random generators support code
covered by kernel config options, for the benefit of people who prefer
minimal kernels. Also add the tunables to disable hardware generator
even if detected.

Reviewed by:	markm, secteam (simon)
Tested by:	bapt, Michael Moll <kvedulv@kvedulv.de>
MFC after:	3 weeks
2012-09-05 13:18:51 +00:00
Mike Silbersack
66437e8374 Only stop the BXE controller if it was first started. Stopping
an uninitialized controller can cause IPMI bus errors on some
systems.

Reviewed by:	yongari
Obtained from:	McAfee, Inc.
MFC after:	2 weeks
2012-09-05 06:51:28 +00:00
Gavin Atkinson
5163813777 Support another uchcom(4) device.
MFC after:	1 week
2012-09-04 23:13:24 +00:00
Xin LI
dac366886e Update arcmsr(4) to vendor version 1.20.00.25.
Many thanks to Areca for continuing to support FreeBSD.

Submitted by:	Ching-Lung Huang <ching2048 areca com tw>
MFC after:	2 weeks
2012-09-04 05:15:54 +00:00
Hans Petter Selasky
aead9631e7 Add required USB AUDIO v2.0 structure definitions.
PR:	misc/171254
2012-09-03 19:17:25 +00:00
Hans Petter Selasky
f83fab0234 Add more DWC OTG register definitions.
Submitted by:	Nick Hudson
2012-09-03 15:22:02 +00:00
Alan Cox
4cc8c59523 Correct an error in gxemul_disk_write(). It was issuing the command to
read from rather than write to the emulated disk.

Reviewed by:	jmallett
2012-09-03 02:32:00 +00:00
Adrian Chadd
be7f7a955b Disable strong signal diversity when enabling radar pulse detection
for the AR5212 era NICs.
2012-09-02 05:01:10 +00:00
Adrian Chadd
11f0fa784e AR5212 radar pulse fixes.
Fix the strong signal diversity capability setting - I had totally
messed up the indentation.

Set the default values to match what's in the .ini for now, rather than
what values I had previously gleaned from places.  This seems to work
quite well for the early AR5212 NICs I have.  Of course, later NICs
have different PHYs and the radar configuration is very card/board
dependent..

Tested:

 * ath1: AR5212 mac 5.3 RF5111 phy 4.1
   ath1: 2GHz radio: 0x0023; 5GHz radio: 0x0017

This detects 1, 5, 25, 50, 75, 100uS pulses reliably (with no interference.)

However, 10uS pulses don't detect reliably. That may be around the
transition between short and long pulses so some further tuning may
improve things.
2012-09-02 04:56:29 +00:00
Adrian Chadd
9c1b997551 Fix the PHY / CRC error bug in the AR5212 HAL, which apparently also pops
up on (at least) the AR5413.

The 30 second summary - if a CRC error frame comes in during PHY error
processing, that CRC bit will be set for all subsequent frames until
a non-CRC error frame is processed.

So to allow for accurate PHY error processing (Radar, and ANI on the AR5212
HAL chips) just tag the frame as being both CRC and PHY - let the driver
decide what to do with it.

PR:		kern/169362
2012-09-01 05:43:30 +00:00
Scott Long
cfc0969ad4 Heavily optimize the case of small RX packets of 160 bytes or less. For
this case, allocate a plain mbuf and copy the frame into it, then send the
copy up the stack, leaving the original mbuf+cluster in place in the
receive ring for immediate re-use.  This saves a trip through 2 of the
3 zones of the compound mbuf allocator, a trip through busdma, and a trip
through the 1 of the 3 mbuf destructors.  For our load at Netflix, this can
lower CPU consumption by as much as 20%.  The copy algorithm is based on
investigative work from Luigi Rizzo earlier in the year.

Reviewed by:	jfv
Obtained from:	Netflix
2012-08-31 10:07:38 +00:00
Scott Long
6aedf62f32 Essentially revert r239912. The amr_periodic function hadn't been armed in
over 10 years and was dead code; the previous revision exposed it as such to
CLANG.  The solution is to cull the whole thing.
2012-08-31 09:42:46 +00:00
Oleksandr Tymoshenko
f70f23cc3e Add PrimeCell UART (PL011) driver
Obtained from:	Semihalf
2012-08-30 20:31:53 +00:00
John Baldwin
ec9a9cf1e0 Attach interrupt handlers during attach instead of during the first time
the interface is brought up.  Without this, the boot time interrupt
round-robin assignment does not think the allocated interrupt resources
are active and leaves them assigned to CPU 0.

While here, add descriptive tags to each interrupt handler when MSI-X
is used.

Reviewed by:	np
MFC after:	1 week
2012-08-30 17:47:39 +00:00
John Baldwin
28435fb7f6 Use callout(9) rather than timeout(9). Note that the periodic timer in
amr(4) is never started, so this should be even more of a NOP than
normal.
2012-08-30 17:37:01 +00:00
Hans Petter Selasky
710764f7c2 Preparations for adding USB HOST mode to the DWC OTG driver.
Merge register file with external one and put all register
definitions in a separate file.

Submitted by:	ray @
2012-08-30 16:19:05 +00:00
Alexander Motin
7d0ec9dd3f Add bunch of ATI HDMI HDA controller IDs.
Submitted by:	Dmitry Luhtionov <dmitryluhtionov@gmail.com>
MFC after:	1 week
2012-08-30 15:47:20 +00:00
Alexander Motin
49a4a59a54 Add IDs for JMicron JMB360/JMB362 AHCI SATA controllers.
MFC after:	1 week
2012-08-30 15:23:59 +00:00
Adrian Chadd
dae1b5d00a Migrate the AR9285 diversity configuration LNA configuration to use
some HAL definitions rather than local definitions.

The original source (ath9k) pulled this stuff from the QCA driver and
removed the HAL_* prefix.  I'm just restoring the correct order of things.

Obtained from:	Qualcomm Atheros
2012-08-30 06:55:47 +00:00
Jim Harris
a099c5cca0 Do not call sati_check_data_io() for SATI_UNMAP sequences.
This routine is intended only for commands such as INQUIRY where
the controller may fill out a smaller amount of data than allocated
by the host.

The end result of this bug was that isci(4) would report non-zero
resid for successful SCSI_UNMAP commands.

Sponsored by:	Intel
MFC after:	3 days
2012-08-30 00:43:14 +00:00
Adrian Chadd
fb20fd244e There's no nede to allocate a DMA map just before calling bus_dmamem_alloc().
In fact, bus_dmamem_alloc() happily NULLs the dmat pointer passed in,
before replacing it with its own.

This fixes a MIPS crash when kldload'ing if_ath/if_ath_pci -
bus_dmamap_destroy() was passed in a NULL dmat pointer and was doing
all kinds of very bad things.

Reviewed by:	scottl
2012-08-29 16:58:51 +00:00
Adrian Chadd
28bb46617d Set the HAL combined antenna diversity capability if the AR9285
EEPROM settings allow it.
2012-08-29 04:11:00 +00:00
Adrian Chadd
46e2649633 Add a new capability bit - whether the hardware supports AR9285 style
combined diversity.
2012-08-29 04:09:54 +00:00
Adrian Chadd
d6af4e0f06 Add AR5413 radar parameters and strong signal diversity capability.
This is a re-implementation based on the reference carrier code
for the AR5413.

Tested:
 * Pulse detection for AR5212 and AR5413, to ensure the
   correct behaviour for both chips

PR:		kern/170904
Obtained from:	Qualcomm Atheros
2012-08-29 03:58:13 +00:00
Adrian Chadd
0146ef1ae2 Add a (temporarily located) definition. 2012-08-29 03:50:59 +00:00
Adrian Chadd
21cb20bb94 Remove - not needed. 2012-08-29 00:53:58 +00:00
Adrian Chadd
b5c5592d2b Remove extra debugging - there's no longer any need. 2012-08-29 00:53:41 +00:00
Adrian Chadd
8a1e4fa08b Add a new flash part - 4MB SPI flash from Winbond. 2012-08-28 22:17:22 +00:00
Adrian Chadd
bb1bf7ed0a Only print the descriptor contents!
Found by:	magical CLANG build environments

Submitted by:	Sevan <venture37@gmail.com>
2012-08-27 23:27:41 +00:00
Adrian Chadd
a1d97d2e9d Don't grab an unreferenced pointer to the VAP bss node. 2012-08-27 23:18:41 +00:00
Adrian Chadd
f6fd8c7af8 Improve the sample rate logging. 2012-08-27 20:30:07 +00:00
Adrian Chadd
5b0c1ea0c9 Ensure that all firstep values are available in ANI.
The comparison assumes maxFirstepLevel is a count, rather than a maximum
value.  The array is 3 entries in size however 'maxFirstepLevel' is 2.

This bug also exists in the AR5212 HAL.
2012-08-27 20:10:38 +00:00
Adrian Chadd
810f2a9cbc Fix the debugging output to correctly log CCK errors. 2012-08-27 20:03:08 +00:00
John Baldwin
6b5b57ae9f Rework the DMA handling in ida(4) and add locking to make this driver
MPSAFE.
- Preallocate a full set of QCBs during attach rather than allocating new
  ones on demand to avoid allocations in the I/O path.
- Remove the explicit bus space tag/handle and use bus_*() on the
  relevant 'struct resource' instead.
- Defer logical drive probing to an intrhook.
- Fix ida_detach() to detach and delete child devices (logical drives).
- Update the DMA handling to support EINPROGRESS by moving the work to
  submit a mapped request into the bus_dma callback routine as well as
  add support for freezing the queue when EINPROGRESS is encountered.

Tested by:	Marco Steinbach  coco executive-computing de
2012-08-27 17:24:07 +00:00
Robert Watson
7b957f4fe7 Add terasic_de4led, a led(4) driver for the on-board 8-element LED on the
Terasic DE-4 board.  Allow LED configuration to be set using loader
tunables, not just from userspace, and preconfigure LED 8 as a kernel
heartbeat.  For now, this is a Nexus-attached, BERI-only driver, but it
could be used with other hard and soft cores on Altera FPGAs as well, in
principle.

Sponsored by:	DARPA, AFRL
2012-08-26 09:21:59 +00:00
Adrian Chadd
222d73f11d Move this magic check to only occur if no eeprom data is given.
Tested on:

	* AP99 (AR7241+AR9287)
2012-08-26 04:26:49 +00:00
Adrian Chadd
e12a307eff Add EEPROM data hooks for the AR9287.
Tested:
	* AP99 Reference board (AR7241 + AR9287)
2012-08-26 04:26:25 +00:00
Oleksandr Tymoshenko
e1f04cd024 Piggyback MIPS changes and add ARM syscons support for devices with
framebuffer

While here - sort #if defined() order alphabetically
2012-08-25 23:59:31 +00:00
Alexander Motin
cf977ac20a Return "locally assigned" Enclosure Logical Identifier instead of 8 zero
bytes. Zeroes there are incorrect and tend to cause false device ID matches.
2012-08-25 23:01:57 +00:00
Robert Watson
ec5bd1da7d Add terasic_mtl(4), a device driver for the Terasic Multi-Touch LCD,
used with Terasic's DE-4 and other similar FPGA boards.  This display
is 800x480 and includes a capacitive touch screen, multi-touch
gesture recognition, etc.  This device driver depends on a Cambridge-
provided IP core that allows the MTL device to be hooked up to the
Altera Avalon SoC bus, and also provides a VGA-like text frame buffer.

Although it is compiled as a single device driver, it actually
implements a number of different device nodes exporting various
aspects of this multi-function device to userspace:

- Simple memory-mapped driver for the MTL 24-bit pixel frame buffer.
- Simple memory-mapped driver for the MTL control register set.
- Simple memory-mapped driver for the MTL text frame buffer.
- syscons attachment for the MTL text frame buffer.

This driver attaches directly to Nexus as is common for SoC device
drivers, and for the time being is considered BERI-specific, although
in principle it might be used with other hard and soft cores on
Altera FPGAs.

Control registers, including touchscreen input, are simply memory
mapped; in the future it would be desirable to hook up a more
conventional device node that can stream events, support kqueue(2)/
poll(2)/select(2), etc.

This is the first use of syscons on MIPS, as far as I can tell, and
there are some loose ends, such as an inability to use the hardware
cursor.  More fundamentally, it appears that syscons(4) assumes that
either a host is PC-like (i386, amd64) *or* it must be using a
graphical frame buffer.  While the MTL supports a graphical frame
buffer, using the text frame buffer is preferable for console use.
Fixing this issue in syscons(4) requires non-trivial changes, as the
text frame buffer support assumes that direct memory access can be
done to the text frame buffer without using bus accessor methods,
which is not the case on MIPS.  As a workaround for this, we instead
double-buffer and pretend to be a graphical frame buffer exposing
text accessor methods, leading to some quirks in syscons behaviour.

Sponsored by:	DARPA, AFRL
2012-08-25 22:35:29 +00:00
Oleksandr Tymoshenko
c36ad1ffa3 Do not swap byte order if we assign default value for intr_cells 2012-08-25 20:18:12 +00:00
Brooks Davis
087d31736a Add isf(4), a driver for the Intel StrataFlash family of NOR flash parts.
The driver attempts to support all documented parts, but has only been
tested with the 512Mbit part on the Terasic DE4 FPGA board.  It should be
trivial to adapt the driver's attach routine to other embedded boards
using with any parts in the family.

Also import isfctl(8) which can be used to erase sections of the flash.

Sponsored by:	DARPA, AFRL
2012-08-25 18:08:20 +00:00
Robert Watson
697a77c1c4 Add altera_jtag_uart(4), a device driver for Altera's JTAG UART soft core,
which presents a UART-like interface over the Avalon bus that can be
addressed over JTAG.  This IP core proves extremely useful, allowing us to
connect trivially to the FreeBSD console over JTAG for FPGA-embedded hard
and soft cores.  As interrupts are optionally configured for this soft
core, we support both interrupt-driven and polled modes of operation,
which must be selected using device.hints.  UART instances appear in /dev
as ttyu0, ttyu1, etc.

However, it also contains a number of quirks, which make it difficult to
tell when JTAG is connected, and some buffering issues.  We work around
these as best we can, using various heuristics.

While the majority of this device driver is not only not BERI-specific,
but also not MIPS-specific, for now add its defines in the BERI files
list, as the console-level parts are aware of where the first JTAG UART
is mapped on Avalon, and contain MIPS-specific address translation, to
use before Newbus and device.hints are available.

Sponsored by:	DARPA, AFRL
2012-08-25 11:30:36 +00:00
Robert Watson
d432e92a84 Add a device driver for the Altera University Program SD Card IP Core,
which can be synthesised in Altera FPGAs.  An altera_sdcardc device
probes during the boot, and /dev/altera_sdcard devices come and go as
inserted and removed.  The device driver attaches directly to the
Nexus, as is common for system-on-chip device drivers.

This IP core suffers a number of significant limitations, including a
lack of interrupt-driven I/O -- we must implement timer-driven polling,
only CSD 0 cards (up to 2G) are supported, there are serious memory
access issues that require the driver to verify writes to memory-mapped
buffers, undocumented alignment requirements, and erroneous error
returns.  The driver must therefore work quite hard, despite a fairly
simple hardware-software interface.  The IP core also supports at most
one outstanding I/O at a time, so is not a speed demon.

However, with the above workarounds, and subject to performance
problems, it works quite reliably in practice, and we can use it for
read-write mounts of root file systems, etc.

Sponsored by:	DARPA, AFRL
2012-08-25 11:19:20 +00:00
Robert Watson
cf8248866d Add altera_avgen(4), a generic device driver to be used by hard and soft
CPU cores on Altera FPGAs.  The device driver allows memory-mapped devices
on Altera's Avalon SoC bus to be exported to userspace via device nodes.
device.hints directories dictate device name, permissible access methods,
physical address and length, and I/O alignment.  Devices can be accessed
using read(2)/write(2), but also memory mapped in userspace using mmap(2).

Devices attach directly to the Nexus, as is common for embedded device
drivers; in the future something more mature might be desirable.  There is
currently no facility to support directing device-originated interrupts to
userspace.

In the future, this device driver may be renamed to socgen(4), as it can
in principle also be used with other system-on-chip (SoC) busses, such as
Axi on ASICs and FPGAs.  However, we have only tested it on Avalon busses
with memory-mapped ROMs, frame buffers, etc.

Sponsored by:	DARPA, AFRL
2012-08-25 11:07:43 +00:00
Robert Watson
8122a592ee Provide basic glue to allow syscons to be used on MIPS, modelled
on PowerPC support.  This was clearly not something syscons was
designed to do (very specific assumptions about the nature of VGA
consoles on PCs), but fortunately others have long since blazed
the way on making it work regardless of that.

Sponsored by:	DARPA, AFRL
2012-08-25 08:09:37 +00:00
Robert Watson
b03d880eea In the gxemul console, check the RB_SERIAL boot flag, and change the
relative priority of the gxemul console in line with its role as a
"seiral console".  This allows it to override video console drivers
that might otherwise take precdence, subject to that boot flag.

Sponsored by:	DARPA, AFRL
2012-08-25 07:48:52 +00:00
Robert Watson
a06584ab56 Rename the gxemul console device to "ttyu0" to match the expectations of
the default MIPS /etc/ttys.

Sponsored by:	DARPA, AFRL
2012-08-25 07:47:12 +00:00
Jim Harris
c588600407 Clear freeze bit before calling xpt_release_devq.
This ensures that any ccbs which immediately start during the call to
xpt_release_devq see an accurate picture of the frozen_lun_mask.

Sponsored by:	Intel
MFC after:	3 days
2012-08-24 22:04:16 +00:00
Adrian Chadd
b7005313dd Remove the hard-coded AR5416-series parameters and instead use the
DFS parameters fetched from the HAL.

Check whether the specific chipset supports RADAR reporting before
enabling DFS; or some of the (unset) DFS methods may fail.

Tested:

* AR5210 (correctly didn't enable radar PHY reporting)
* AR5212 (correctly enabled radar PHY reporting w/ the correct default
  parameters.)

TODO:

* Now that I have this capability check in place, I could remove the
  (empty) DFS methods from AR5210/AR5211.
* Test on AR5416, AR9160, AR9280.

PR:		kern/170904
2012-08-24 17:39:57 +00:00
Adrian Chadd
51816abcd0 Correctly handle the "pe_enabled" flag - both when configuring DFS and
fetching the current DFS configuration.

PR:		kern/170904
2012-08-24 17:37:51 +00:00
Adrian Chadd
7d6b932c44 Add an accessor macro for getting access to the default DFS parameters.
PR:		kern/170904
2012-08-24 17:37:12 +00:00
Adrian Chadd
217ad7d2a5 Add default values for the NumTxMaps capability. 2012-08-24 07:35:18 +00:00
Adrian Chadd
47152caed8 Add the method to fetch the default DFS parameters for the AR5212 PHY.
I need to check whether new parameters were added for the AR5413 NIC.

PR:		kern/170904
2012-08-24 07:32:35 +00:00
Adrian Chadd
54798be082 Implement an API to fetch the default DFS parameters for the given chip.
The only chip this is currently implemented for is the AR5416 HAL family.
A follow-up commit will add AR5212 support.

PR:		kern/170904
2012-08-24 01:29:46 +00:00
Adrian Chadd
e0c214d1bb Bring over some new EEPROM regulatory domain flags.
Obtained from:	Qualcomm Atheros
2012-08-24 01:14:00 +00:00
Adrian Chadd
41466eb9a6 Oops, another copy/paste issue. 2012-08-24 00:54:31 +00:00
Adrian Chadd
85ca341a79 Add ath_hal_get_curmode() - this is used by the Osprey HAL.
Obtained from:	Qualcomm Atheros
2012-08-24 00:52:37 +00:00
Adrian Chadd
9b13447210 Add rfkill HAL accessor methods. 2012-08-24 00:43:10 +00:00
Adrian Chadd
8edfeb1264 Oops, fix copy/paste silliness. 2012-08-24 00:40:01 +00:00
Adrian Chadd
7148a61d16 Add some more capabilities (unused at the present.)
Obtained from:	Qualcomm Atheros
2012-08-24 00:36:47 +00:00
Adrian Chadd
b042e6a3e0 Add the MFP capability to ath_hal_getcapability().
Obtained from:	Qualcomm Atheros
2012-08-24 00:33:25 +00:00
Adrian Chadd
9f24e32b4a Add some more diagnostic codes.
Obtained from:	Qualcomm Atheros
2012-08-24 00:17:39 +00:00
Adrian Chadd
830c1c46f3 Wrap this a little so it's slightly easier on the eyes. 2012-08-24 00:15:26 +00:00
Adrian Chadd
c84b4ebb24 Add some new flags:
* mfp support;
* 4.9ghz support in the HAL;
* device type - specifically, the bus type and whether it's a HB63
  NIC (which requires some subtle chainmask handling differences
  in the AR5416 HAL.)

Obtained from:	Qualcomm Atheros
2012-08-24 00:09:49 +00:00
Warner Losh
6e31adaf33 Fetch the chip select in the bridge driver, like all the other spi
bridges do.
2012-08-23 22:38:37 +00:00
Hans Petter Selasky
a0942dd7b2 Add tunable for XHCI port routing.
MFC after:	1 week
2012-08-23 17:40:20 +00:00
Warner Losh
bb1ef63f08 The check for MAXPHYS doesn't make sense, so remove it.
Report errors indicated by the transport.  If this is too chatty, I'll
throw it behind a debug write.
Remove commented out debugs that are no longer useful.
2012-08-23 04:35:55 +00:00
Adrian Chadd
38c0190699 Add a placeholder and typedefs for MFP (management frame protection.)
Obtained from:	Qualcomm Atheros
2012-08-23 03:37:01 +00:00
Adrian Chadd
353cf342f4 Add some more interrupt handling bits.
Obtained from:	Qualcomm Atheros
2012-08-23 03:25:09 +00:00
Adrian Chadd
a3611b5984 Add AR9380 devid HAL definitions and probe/attach strings.
Obtained from:	Device IDs are from Qualcomm Atheros
2012-08-23 03:03:00 +00:00
Adrian Chadd
168c1a30e8 Add chipset names. 2012-08-23 02:58:06 +00:00
Hans Petter Selasky
6623910e4a Add new USB device ID.
Submitted by:	Dmitry Luhtionov
MFC after:	1 week
2012-08-22 18:30:13 +00:00
Jim Harris
3e0a9f1ff2 Fix/add support for SCSI UNMAP to ATA DSM translation.
This addresses kernel panic observed when sending SCSI UNMAP
commands to SATA disks attached to isci(4).

1) Flesh out callback routines to allocate/free buffers needed for
   translating SCSI UNMAP data to ATA DSM data.
2) Add controller-level pool for storing buffers previously allocated
   for UNMAP translation, to lessen chance of no buffer available
   under memory pressure.
3) Ensure driver properly handles case where buffer pool is empty
   and contigmalloc returns NULL.

Sponsored by: Intel
Reported by: Maksim Yevmenkin <max at netflix dot com>
Discussed with:  scottl
MFC after: 3 days
2012-08-21 22:28:14 +00:00
Navdeep Parhar
87a74dd6e3 Deal with the case where a syncache entry added by the TOE driver is
evicted from the syncache but a later syncache_expand succeeds because
of syncookies.  The TOE driver has to resort to more direct means to
install its hooks in the socket in this case.
2012-08-21 22:23:17 +00:00
Hans Petter Selasky
a451c791cc Style. 2012-08-21 20:18:01 +00:00
Hans Petter Selasky
b7d049b789 Fix USB drivers for KB920X target.
Add missing clock settings.
VBUS GPIO IRQ is still missing (TODO).
2012-08-21 20:10:59 +00:00
Navdeep Parhar
f9796f4373 Avoid a NULL pointer dereference. 2012-08-21 19:45:19 +00:00
Navdeep Parhar
36fd646e38 Cannot hold a mutex around vm_fault_quick_hold_pages, so don't. Tweak
some comments while here.
2012-08-21 19:39:09 +00:00
Navdeep Parhar
c91bcaaab5 Minor cleanup: use bitwise ops instead of pointless wrappers around
setbit/clrbit.
2012-08-21 18:30:16 +00:00
Navdeep Parhar
06fd9875aa Correctly handle the case where an inp has already been dropped by the time
the TOE driver reports that an active open failed.  toe_connect_failed is
supposed to handle this but it should be provided the inpcb instead of the
tcpcb which may no longer be around.
2012-08-21 18:09:33 +00:00
Hiroki Sato
f8e8af9cf2 Add s35390a_rtc(4) driver for Seiko Instruments S-35390A RTC.
Submitted by:	Yusuke Tanaka
2012-08-21 17:31:10 +00:00
Adrian Chadd
208be709c4 Initialise an uninitialised variable.
GCC on -9 didn't pick this up; clang did.

Submitted by:	David Wolfskill
2012-08-21 16:44:25 +00:00
Matt Jacob
662daadde0 Remove dependence on MAXPHYS.
MFC after:	1 month
2012-08-21 16:18:11 +00:00
Adrian Chadd
79b5235666 Fix a build issue when ATH_DEBUG isn't defined - just initialise and use
qnum.
2012-08-20 18:57:41 +00:00
Adrian Chadd
0f8423a27a Wrap debugging in #ifdef ATH_DEBUG 2012-08-20 15:30:26 +00:00
Adrian Chadd
4aa8818b55 Flesh out some initial EDMA TX FIFO fill, complete and refill routines.
Note: This is totally sub-optimal and a work in progress.

* Support filling an empty FIFO TXQ with frames from the ath_buf queue
  in the ath_txq list.  However, since there's (currently) no clean, easy
  way to separate the frames that are in the FIFO versus just waiting,
  the code waits for the FIFO to be totally empty before it attempts to
  queue more.  This is highly sub-optimal but is enough to get the ball
  rolling.

* A _lot_ of the code assumes that the TX status is filled out in the
  struct ath_buf bf_status field.  So for now, memcpy() the completion over.

* None of the TX drain / reset routines will attempt to complete completed
  frames before draining, so it can't be used for 802.11n TX aggregation.
  (This won't work anyway, as the aggregation TX descriptor API hasn't
  yet been converted; and that'll happen in some future commits.)

* Fix an issue where the FIFO counter wasn't being incremented, leading
  to the queue logic just plain not working.

* HAL_EIO means "descriptor wasn't valid", versus "not finished, don't
  continue." So don't stop processing descriptors when HAL_EIO is hit.

* Don't service frame completion from the beacon queue.  It isn't currently
  fully setup like a real queue and the first attempt at accessing the
  queue lock will panic the kernel.

Tested:

* AR9380, STA mode

This commit is brought to you by said AR9380 in STA mode.
2012-08-20 06:11:04 +00:00
Adrian Chadd
42083b3d66 Advance the descriptor pointer by sc->sc_tx_desclen bytes, rather than
sizeof(struct ath_desc).  This isn't correct for EDMA TX descriptors.

This popped up during iperf tests. Ping tests never created frames that
had enough segments to overflow into a second descriptor.  However,
an iperf TCP test would do that after a few seconds; the second descriptor
would almost always certainly have garbage.

Tested:

* AR9380, STA mode
* AR9280, STA mode (802.11n TX, legacy TX)
2012-08-20 06:02:09 +00:00
Adrian Chadd
bd68600c99 Make sure all of the buffers are printed, rather than (n-1). 2012-08-20 05:47:07 +00:00
Andreas Tobler
9c3fbfbd6a Add a new sound driver for PowerMacs, found here on my Quad G5.
It allows simple playback and volume control like the other Mac drivers,
not more.
2012-08-19 19:40:33 +00:00
Andreas Tobler
a894f6a0d4 Add a new temperature driver for certain PowerMacs. Found here on my Quad G5. 2012-08-19 19:37:14 +00:00
Andreas Tobler
58af3406d2 Unify the sysctl description with the other PowerMac temperature drivers. 2012-08-19 19:34:10 +00:00
Andreas Tobler
3b29957407 Avoid using the degree symbol. Looks ugly on the console. 2012-08-19 19:32:38 +00:00
Andreas Tobler
11e31cd29a Do the ADC init only at startup and not during every sensor read call.
This reduces the number of interrupts.
2012-08-19 19:31:36 +00:00
Adrian Chadd
e913fcda9d Extend the TX descriptor debug printing to be properly aware of
EDMA code.

* create a new TX EDMA descriptor struct to represent TX EDMA descriptors
  when doing debugging;
* implement an EDMA printing function which:
  + hardcodes the TX map size to 4 for now;
  + correctly prints out the number of segments - there's one descriptor
    for up to 4 buffers (segments), not one for each segment;
  + print out 4 DS buffer and len pointers;
  + print out the correct number of DWORDs in the TX descriptor.

TODO:

* Remove all of the hard-coded stuff. Ew.
2012-08-19 02:22:16 +00:00
Adrian Chadd
e2137b86d6 When assembling the descriptor list, make sure that the "first" descriptor
is marked correctly.

The existing logic assumed that the first descriptor is i == 0, which
doesn't hold for EDMA TX.  In this instance, the first time filltxdesc()
is called can be up to i == 3.

So for a two-buffer descriptor:

* firstSeg is set to 0;
* lastSeg is set to 1;
* the ath_hal_filltxdesc() code will treat it as the last segment in
  a descriptor chain and blank some of the descriptor fields, causing
  the TX to stop.

When firstSeg is set to 1 (regardless of lastSeg), it overrides the
lastSeg setting.  Thus, ath_hal_filltxdesc() won't blank out these
fields.

Tested: AR9380, STA mode.  With this, association is successful.
2012-08-19 02:16:22 +00:00
Konstantin Belousov
d1c3436c1c Add drm and i915 ioctl translations for 32 bit process on 64 bit host.
Submitted by:	meowthink@gmail.com
MFC after:	2 weeks
2012-08-18 18:26:25 +00:00
Hiroki Sato
26ca49652b - Add OF_hasprop() and ofw_bus_has_prop(). These can be used to check
existence of the property.

- Fix ofw_bus_is_compatible{,_strict}() to prevent substring match in the
  compatible string.

Reviewed by:	raj
2012-08-18 11:25:07 +00:00
Hans Petter Selasky
419ce5a654 Add new USB device ID.
PR:		usb/170688
MFC after:	1 week
2012-08-17 16:27:11 +00:00
Navdeep Parhar
e682d02e12 Support for TCP DDP (Direct Data Placement) in the T4 TOE module.
Basically, this is automatic rx zero copy when feasible.  TCP payload is
DMA'd directly into the userspace buffer described by the uio submitted
in soreceive by an application.

- Works with sockets that are being handled by the TCP offload engine
  of a T4 chip (you need t4_tom.ko module loaded after cxgbe, and an
  "ifconfig +toe" on the cxgbe interface).
- Does not require any modification to the application.
- Not enabled by default.  Use hw.t4nex.<X>.toe.ddp="1" to enable it.
2012-08-17 00:49:29 +00:00
Navdeep Parhar
5f7a640879 Initialize various DDP parameters in the main cxgbe(4) driver:
- Setup multiple DDP page sizes.  When the driver attempts DDP it will
  try to combine physically contiguous pages into regions of these sizes.

- Set the indicate size such that the payload carried in the indicate can
  be copied in the header mbuf (and the 16K rx buffer can be recycled).

- Set DDP threshold to the max payload that the chip will coalesce and
  deliver to the driver (this is ~16K by default, which is also why the
  offload rx queue is backed by 16K buffers).  If the chip is able to
  coalesce up to the max it's allowed to, it's a good sign that the peer
  is transmitting in bulk without any TCP PSH.

MFC after:	2 weeks
2012-08-16 22:33:56 +00:00
Jung-uk Kim
1df130f1d4 Merge ACPICA 20120816. 2012-08-16 20:54:52 +00:00
Navdeep Parhar
efc9fddc3d Make room for DDP page pods in the default configuration profile. While
here, bump up the L2 table's size to 4K entries.

MFC after:	2 weeks
2012-08-16 20:30:14 +00:00
Navdeep Parhar
1f1b5a0f6f Add a routine (t4_set_tcb_field) to update arbitrary parts of a hardware
TCB.  Filters are programmed by modifying the TCB too (via a different
routine) and the reply to any TCB update is delivered via a
CPL_SET_TCB_RPL.  Figure out whether the reply is for a filter-write or
something else and route it appropriately.

MFC after:	2 weeks
2012-08-16 20:15:29 +00:00
Navdeep Parhar
1b4cc91fcc Allow for a different handler for each type of firmware message.
MFC after:	2 weeks
2012-08-16 18:31:50 +00:00
Matt Jacob
344aebe2c2 On lun disable, complete all INOTs and ATIOs with CAM_REQ_ABORTED.
Reviewed by:	ken (silently), chuck
MFC after:	3 weeks
2012-08-16 15:32:16 +00:00
Alexander Motin
52e9cf7de5 Fix "speaker" volume control, broken at r230451.
Reported and tested by:	Slawa Olhovchenkov <slw@zxy.spb.ru>
MFC after:	1 month
2012-08-16 07:43:15 +00:00
Oleksandr Tymoshenko
22cbf66621 Fix argument type for bus_space_map 2012-08-15 18:37:01 +00:00
Jack F Vogel
252781f47d Customer report of a panic on boot due to the old
"m_getjcl:invalid cluster type" that occurred some
time back with the igb driver. This happens often when
booting over the net. I believe the NIC hardware is left
in a warm state when handed over to the driver, and a stray
RX interrupt happens earlier than the code is prepared for
it to happen. This change was verified to fix the problem,
its kind of a bandaid... but it is similar to what was done
in the igb code.
2012-08-15 17:12:40 +00:00
Hans Petter Selasky
07da61a6cc Streamline use of cdevpriv and correct some corner cases.
1) It is not useful to call "devfs_clear_cdevpriv()" from
"d_close" callbacks, hence for example read, write, ioctl and
so on might be sleeping at the time of "d_close" being called
and then then freed private data can still be accessed.
Examples: dtrace, linux_compat, ksyms (all fixed by this patch)

2) In sys/dev/drm* there are some cases in which memory will
be freed twice, if open fails, first by code in the open
routine, secondly by the cdevpriv destructor. Move registration
of the cdevpriv to the end of the drm open routines.

3) devfs_clear_cdevpriv() is not called if the "d_open" callback
registered cdevpriv data and the "d_open" callback function
returned an error. Fix this.

Discussed with:	phk
MFC after:	2 weeks
2012-08-15 16:19:39 +00:00
Konstantin Belousov
a055e7ceb4 Fix build 2012-08-15 15:53:27 +00:00
Hans Petter Selasky
c01fc06ee9 Revert r239178 and implement two new functions, namely
"device_free_softc()" and "device_claim_softc()",
to allow USB serial drivers refcounting the softc.
These functions are used to grab the softc from
auto-free and to free the softc back to the correct
malloc type, respectivly.

Discussed with:	jhb
MFC after:	2 weeks
2012-08-15 15:42:57 +00:00
Hans Petter Selasky
84e1a128d1 Add new USB device quirk.
Submitted by:	Kra OTN
MFC after:	2 weeks
2012-08-15 15:35:20 +00:00
Adrian Chadd
2b200bb4ce Extend the non-aggregate TX descriptor chain routine to be aware of:
* the descriptor ID, and
* the multi-buffer support that the EDMA chips support.

This is required for successful MAC transmission of multi-descriptor
frames.  The MAC simply hangs if there are NULL buffers + 0 length pointers,
but the descriptor did have TxMore set.

This won't be done for the 11n aggregate path, as that will be modified
to use the newer API (ie, ath_hal_filltxdesc() and then set first|middle|
last_aggr), which will deprecate some of the current code.

TODO:

* Populate the numTxMaps field in the HAL, then make sure that's fetched
  by the driver.  Then I can undo that hack.

Tested:

* AR9380, AP mode, TX'ing non-aggregate 802.11n frames;
* AR9280, STA/AP mode, doing aggregate and non-aggregate traffic.
2012-08-15 08:14:16 +00:00
Adrian Chadd
b74e3fbae4 Bump up the rate control table size to incorporate 3 stream entries. 2012-08-15 08:06:06 +00:00
Adrian Chadd
5000c38d44 Remove this comment, it's no longer relevant. 2012-08-15 07:56:48 +00:00
Adrian Chadd
6c03eb4c31 Extend the duration calculations to work with three and four stream
rates.
2012-08-15 07:52:49 +00:00
Adrian Chadd
b193c0b591 Add a missing comma.
Pointy hat to: me, for not doing a 'clean' build first.
2012-08-15 07:50:42 +00:00
Adrian Chadd
b36437c83b Add 3 stream rates to the sample rate control module. 2012-08-15 07:32:34 +00:00
Adrian Chadd
193bfa21ea Extend the sample mask from 32 bits to 64 bits.
This is required to support > MCS15 as more than 32 bit rate entries are
suddenly available.

This is quite messy - instead of doing typecasts at each mask operation,
this should be migrated to use a macro and have that do the typecast.
2012-08-15 07:10:10 +00:00
Adrian Chadd
85bf9bc3d5 Implement a sequential descriptor ID value and stuff it in the ath_buf.
This will be used by the EDMA TX code to assign descriptor IDs in order
to provide some debugging.
2012-08-15 06:48:34 +00:00
Oleksandr Tymoshenko
e53470fee3 Merging of projects/armv6, part 10
- Support for Texas Instruments SoCs:
	- AM335x
	- OMAP4

- Kernel configs, DTS for Beaglebone and Pandaboard

Submitted by:	Ben Gray, Damjan Marion
2012-08-15 06:31:32 +00:00
Oleksandr Tymoshenko
8dee0fd04c Merging of projects/armv6, part 8
r235162:

  Initial LPC32x0 support. Includes DTS file for Embedded Artists EA3250
  board.

  Peripherals currently supported:
  - Serial ports
  - Interrupt controller
  - Timers
  - Ethernet
  - USB host
  - Framebuffer (in conjunction with SSD1289 LCD controller)
  - RTC
  - SPI
  - GPIO

Submitted by:	Jakub Wojciech Klama <jceel@freebsd.org>
2012-08-15 05:37:10 +00:00
Oleksandr Tymoshenko
75f1438be6 Merging of projects/armv6, part 6
r229271:
    Import files needed to build ARMADA XP kernel.

Submitted by:	Grzegorz Bernacki
2012-08-15 04:07:18 +00:00
Oleksandr Tymoshenko
b011f8c450 Merging of projects/armv6, part 5
- Driver for SMSC LAN95XX and LAN8710A ethernet controllers
- Driver for LAN8710A PHY

Submitted by:	Ben Gray, Damjan Marion, Tim Kientzle
2012-08-15 04:03:55 +00:00
Oleksandr Tymoshenko
8bb9363760 Merging of projects/armv6, part 4
r233822:
  Remove useless and wrong piece of code in fdt_get_range() which i
  overwrites passed phandle_t node. Modify debug printf in fdt_reg_to_rl()
  to be consistent (that is, print start and end *virtual* addresses).

r230560:
  Handle "ranges;"
  Make fdt_reg_to_rl() responsible for mapping the device memory, instead
  on just hoping that there's only one simplebus, and using fdt_immr_va as
  the base VA.

r230315
  Add a function to get the PA from range, instead of (ab)using
  fdt_immr_pa, and use it for the UART driver
2012-08-15 03:49:10 +00:00
Oleksandr Tymoshenko
3c92de458b Merging of projects/armv6, part 4
r232281:
Fix byte order.
2012-08-15 03:33:57 +00:00
Navdeep Parhar
8340ece577 The size of the buffers in an Ethernet freelist has to be higher than the
interface's MTU.  Initialize such freelists with correct values.

This wasn't a problem for common MTUs (1500 and 9000) as the buffers (2048
and 9216 in size) happened to have enough spare room.  I ran into it when
playing around with unusual MTUs.

MFC after:	2 weeks
2012-08-15 01:03:13 +00:00
Adrian Chadd
edd3e98f13 Dump out the TX FIFO depth. 2012-08-14 22:34:22 +00:00
Adrian Chadd
bad98824c0 Break out the TX completion code into a separate function, so it can be
re-used by the upcoming EDMA TX completion code.

Make ath_stoptxdma() public, again so the EDMA TX code can use it.

Don't check for the TXQ bitmap in the ISR when doing EDMA work as it
doesn't apply for EDMA.
2012-08-14 22:32:20 +00:00
Adrian Chadd
e5661062ee Add an assertion to check that the given TXQ is _not_ locked. 2012-08-14 22:30:17 +00:00
Gavin Atkinson
c64253a898 Rename command defines to match names used in the datasheet, in order to
make maintaining this driver from the documentation easier in the future.
This is a mostly mechanical change.

In uslcom_param(), move the zeroing of the final two fields of the
flowctrl structure outside of the "if CRTSCTS" section - not only were
they being zeroed in both the clauses, but these two fields have nothing
to do with hardware flow control anyway.
2012-08-14 22:21:46 +00:00
Navdeep Parhar
2951cbabf0 if_iqdrops should include frames truncated within the chip.
MFC after:	2 weeks
2012-08-14 22:15:12 +00:00
Navdeep Parhar
9fb8886b29 Convert some fixed parameters to tunables (with reasonable default
values).

- cong_drop specifies what to do on congestion: nothing, backpressure,
  or drop.
- fl_pktshift specifies the padding before Ethernet payload.
- fl_pad specifies the boundary upto which to pad Ethernet payload.
- spg_len controls the length of the status page.

MFC after:	2 weeks
2012-08-14 21:47:41 +00:00
Alexander Motin
8684fef07d Fix multichannel input signals tracing on some CODECs like ALC260.
Reported and tested by:	Slawa Olhovchenkov <slw@zxy.spb.ru>
MFC after:	1 month
2012-08-14 14:07:34 +00:00
Andreas Tobler
6e8fcacda4 Fix typo in comment. 2012-08-14 05:16:35 +00:00
John Baldwin
06e8730c59 Add locking to the twe(4) driver and make it MPSAFE:
- Add per-controller configuration (sx) and I/O (mutex) locks.  The
  configuration lock protects the relationship of volumes and drives
  while the I/O lock protects access to the controller's registers and
  the main I/O path.
- Remove some checks for M_WAITOK malloc()'s failing.
- Remove the explicit bus space tag/handle from the softc and use
  bus_*() rather than bus_space_*().
- Reuse the existing new-bus sysctl context instead of creating a
  new one.
- Remove compat shims for FreeBSD 4.x.
- Use pci_enable_busmaster() rather than doing it by hand, and rely
  on bus_alloc_resource() to enable PCI I/O decoding.

Tested by:	Mike Tancsa  mike sentex net
Reviewed by:	scottl (partially)
MFC after:	1 month
2012-08-13 21:29:34 +00:00
Ed Maste
033ed050a0 Reword comment to try to improve clarity, and fix a typo. 2012-08-13 19:14:45 +00:00
Hans Petter Selasky
f61fc4bd7d Fix for missing locks due to recent change.
PR:		usb/170606
MFC after:	2 weeks
2012-08-13 18:34:04 +00:00