Add new sysctl, kern.supported_abis, containing the list of FreeBSD
MACHINE_ARCH values whose binaries this kernel can run. This patch provides
a feature requested for implementing pkgng ABI identifiers in a robust
way.

The list is designed to indicate whether, say, an i386 package can be run on
the current system. If kern.supported_abis contains "i386", then the answer
is yes. Otherwise, the answer is no.

At the moment, this only supports MACHINE_ARCH and MACHINE_ARCH32. As we
gain support for more interesting combinations, this needs to become more
flexible, possibily through the sysent framework, along with the
hw.machine_arch emulation immediately preceding this code in kern_mib.c.

Reviewed by:	imp
MFC after:	3 days


git-svn-id: svn+ssh://svn.freebsd.org/base/head@258819 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
Add definitions for the additional PIO pins found on recent AT91 SoCs.


git-svn-id: svn+ssh://svn.freebsd.org/base/head@258820 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
In a situation where:
	- The remote host sends a FIN
	- in an ACK for a sequence number for which an ACK has already
	  been received
	- There is still unacked data on route to the remote host
	- The packet does not contain a window update

The packet may be dropped without processing the FIN flag.

PR:		kern/99188
Submitted by:	Staffan Ulfberg <staffan@ulfberg.se>
Discussed with:	andre
MFC after:	never


git-svn-id: svn+ssh://svn.freebsd.org/base/head@258821 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
Partial revert of r258779 and r258780:
	The directory sys/dev/drm2/i915 is apperently contributed code.
	Revert to the broken version of this file to make future imports easier.

Requested by:	kib


git-svn-id: svn+ssh://svn.freebsd.org/base/head@258822 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
Add some code to double-check whether we're correctly populating the
TX ring according to what the firmware requires.

The firmware requires A-MPDU sub-frames to be at a very specific ring
offset - that is, the ring slot offset should be (seqno % 256.)

This holds for every NIC I've tested thus far except the 4965,
which starts erroring out here shortly before the firmware panics.
Which is good, it's doing what it's supposed to (read: capture that
we've screwed up somewhere.)

The specifics about getting this stuff right:

* the initial seqno allocation should match up with the ringid.
* .. yes, this means we can start at a ring offset that isn't zero.
* .. because we program the start seqno in the firmware message
  to setup the AC.
* The initial seqno allocation may be non-zero _and_ frames may be
  being transmitted during a-mpdu negotiation.  I faced similar
  issues on ath(4) and had to software queue frames to that node+TID
  during A-MPDU negotiation.
* seqno allocation should be in lockstep with ring increments.
* If we fail to transmit some segment, no, we shouldn't reuse that
  ring slot.  We should just transmit a BAR (which we aren't yet
  doing, sigh) and move onto the next seqno.
* In theory there shouldn't be any holes in the seqno space when
  we are transmitting frames.

Tested:

* 4965 (throws problems, so yes we have to fix this);
* 5100 (seems ok);
* 6200 (seems ok);
* 2200 (seems ok);
* 2230 (seems ok).


git-svn-id: svn+ssh://svn.freebsd.org/base/head@258823 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
Add some sanity checks to the TLV fetch.

Obtained from:	Linux iwlwifi


git-svn-id: svn+ssh://svn.freebsd.org/base/head@258824 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
Oops - fix bad indent. Sorry!


git-svn-id: svn+ssh://svn.freebsd.org/base/head@258825 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
libcpp: Merge fixes from upstream

GCC preprocessor/29966:
* macro.c (lex_expansion_token): Save and restore cpp_reader's
cur_token.
(_cpp_create_definition): Don't restore cur_token here.
* lex.c (_cpp_lex_token): Added assertion.

GCC preprocessor/28709:
* macro.c (paste_tokens): Remove PASTE_LEFT from the old lhs.

GCC c/31924
* expr.c (interpret_float_suffix): Check for invalid suffix.

GCC preprocessor/14331
* lex.c (_cpp_get_fresh_line):  Don't warn if no newline at EOF.

Fixup whitespacing

Obtained from:	gcc per-4.3 (rev. 121340, 124356, 124358, 124730,
				  125212, 125255 ; GPLv2)
MFC after:	3 weeks


git-svn-id: svn+ssh://svn.freebsd.org/base/head@258826 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
Log the rx ring offset as part of the debug message.


git-svn-id: svn+ssh://svn.freebsd.org/base/head@258827 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
Add a nand flash controller driver for Atmel at91 family.  Tested only
on at91rm9200 so far.

The files.at91 has listed a nand driver for ages, but it never existed.


git-svn-id: svn+ssh://svn.freebsd.org/base/head@258828 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
Overhaul the iwn(4) scan infrastructure to be slightly more "correct"
for these chipsets.

* Correctly set the active/passive flag in the scan request - this is
  NOT a "is the channel active|passive"; it's to do with whether we
  have an SSID to actively scan for or not.  The firmware takes care
  of the active/passive setup of the channel.

* Calculate the active/passive dwell time based on the beacon interval
  and the channel mode, rather than using a hard coded value.

* For now, hardcode the scan service_time.  It's defined as:

  31:22 - number of beacon intervals to come back onto the home channel
          for;
  0:21  - time (microseconds) to come back onto the home channel for.

  When doing an active scan when the NIC is active (whether we're associated
  or not - it only matters if we've setup the NIC to a destination or not)
  this determines how much time to stay on the home channel for when
  scanning.  We can tune this based on the amount of active traffic.

  For now it's 4 beacon intervals and 100 microseconds.

* Fix the "good crc threshold" setting.  It differs based on the NIC
  firmware.  Some older firmware required a workaround; the later
  firmware instead treats the field as a flag.

* Enforce that we are not sending a scan command if one is already
  pending.  Any time this is done is a bug and it absolutely needs
  to be fixed - so be very loud.

* Add the SCAN flag to a few debug messages that are scan related but
  only occuring under STATE.

Now, this does get noisy when you're scanning in an actively busy 2GHz
network as the firmware (for reason I don't quite yet understand) seems
hell bent on staying on some passive channels longer than it should.
However, it should eventually recover and complete the scan.

This is a work in progress; please let me know if things get stuck or
if things improve!

Tested:

* intel centrino 2200
* intel centrino 2230
* intel 6200
* intel 5100
* intel 4965 (gets upset, but that's a known issue)

Obtained from:	linux iwlwifi


git-svn-id: svn+ssh://svn.freebsd.org/base/head@258829 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
Add support for BCM57764, BCM57767, BCM57782, BCM57786 and BCM57787.
Submitted by:	jhb
PR:	184304


git-svn-id: svn+ssh://svn.freebsd.org/base/head@258830 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
* Sort the copyright lines by date
* Ok ok, I've touched this enough to claim part of it.


git-svn-id: svn+ssh://svn.freebsd.org/base/head@258833 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
Please welcome casperd daemon. It (and its services) will be responsible for
giving access to functionality that is not available in capability mode
sandbox. The functionality can be precisely restricted.

Start with the following services:
- system.dns - provides API compatible to:
	- gethostbyname(3),
	- gethostbyname2(3),
	- gethostbyaddr(3),
	- getaddrinfo(3),
	- getnameinfo(3),
- system.grp - provides getgrent(3)-compatible API,
- system.pwd - provides getpwent(3)-compatible API,
- system.random - allows to obtain entropy from /dev/random,
- system.sysctl - provides sysctlbyname(3-compatible API.

Sponsored by:	The FreeBSD Foundation


git-svn-id: svn+ssh://svn.freebsd.org/base/head@258838 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
The RUN_MAX_TXSZ constat is defined as Tx desc + Tx wireless info + MCLBYTES +
max padding.  We were lucky in that run(4) working fine since both
rt2860_rxwi and rt2860_txwi structure sizes are the same.


git-svn-id: svn+ssh://svn.freebsd.org/base/head@258840 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
Fix typos.

MFC after:	3 days
Sponsored by:	The FreeBSD Foundation


git-svn-id: svn+ssh://svn.freebsd.org/base/head@258841 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
Grammar fix.

MFC after:	3 days
Sponsored by:	The FreeBSD Foundation


git-svn-id: svn+ssh://svn.freebsd.org/base/head@258842 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
Forgot to 'svn add' lib/libcasper/ directory.

Reported by:	glebius


git-svn-id: svn+ssh://svn.freebsd.org/base/head@258843 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
Enable missing Access Flag for secondary cores on ARMv6/v7

Spotted by:	Wojciech Macek <wma@semihalf.com>
Obtained from:	Semihalf

> Description of fields to fill in above:                     76 columns --|
> PR:            If a GNATS PR is affected by the change.
> Submitted by:  If someone else sent in the change.
> Reviewed by:   If someone else reviewed your modification.
> Approved by:   If you needed approval for this commit.
> Obtained from: If the change is from a third party.
> MFC after:     N [day[s]|week[s]|month[s]].  Request a reminder email.
> Security:      Vulnerability reference (one per line) or description.
> Empty fields above will be automatically removed.

M    sys/arm/arm/locore.S


git-svn-id: svn+ssh://svn.freebsd.org/base/head@258845 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
Provide reproducibility between builds by building pkg(8) from ports,
instead of using pkg-bootstrap.

This should resolve a problem that was discovered during 10.0-BETA4
freebsd-update(8) builds,

Reported by:	secteam (delphij)
MFC after:	3 days
X-MFC-to-10:	possibly immediately, pending freebsd-update(8) builds
Sponsored by:	The FreeBSD Foundation


git-svn-id: svn+ssh://svn.freebsd.org/base/head@258847 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f