Fix incorrect assertions.
Add more __BEGIN_DECLS / __END_DECLS to <sys/capability.h>.

capability.h currently only wraps some of its declarations in __BEGIN_DECLS/__END_DECLS, so cap_enter(), cap_sandboxed(), etc. are usable from C++ code but cap_rights_init(), cap_rights_is_valid() etc. are not. This commit fixes this distinction.

Approved by:	rwatson (mentor)
MFC after:	1 week
Sponsored by:	DARPA, AFRL
Add a check to validate that memory BARs of passthru devices are 4KB aligned.

Also, the MSI-x table offset is not required to be 4KB aligned so take this
into account when computing the pages occupied by the MSI-x tables.
Fix mismerge in r262121

A break statement was lost in the merge.  The error had no functional
impact, but restore it to reduce the diff against upstream.
Remove an unnecessary header.

Reported by:	nwhitehorn
Approved by:	adrian (mentor, implicit)
De-virtualize pf_mtag_z [1]
Process V_pf_overloadqueue in vnet context [2]

This fixes two VIMAGE kernel panics and allows to simultaneously run host-pf
and vnet jails. pf inside jails remains broken.

PR:		kern/182964
Submitted by:	glebius@FreeBSD.org [2], myself [1]
Tested by:	rodrigc@FreeBSD.org, myself
MFC after:	2 weeks
Commit a first cut at ports of boot2 and loader to 64-bit MIPS, with a
particular interest in (and support for) SRI International and the
University of Cambridge's BERI FPGA soft-core processor.  This includes
micro device drivers for the Altera JTAG UART console, memory-mapped
flash, and the Altera SD Card IP core in both boot2 and loader.  boot2
can be written to the on-board Intel StrataFlash on the DE4 board, and
loader can be placed in StrataFlash or the SD Card.

Plenty of XXX comments, but works quite well locally in practice and I
am using it daily.  Although I had originally ported the ARM version
of boot2, the current version is x86-derived as that proved more
feature-complete.  As we don't currently use partitions on our flash
disks, support for that has been commented out relative to x86, but
would be easy to add back.  FDT support has not yet been hooked up,
although some skeleton parts have been put in place for that.

This may well be a useful starting point for ports to other 32-bit and
64-bit MIPS-ISA systems.

This merge is synchronised to CheriBSD github commit
e41d74fd719525d4dd7a7ee499114679165eeaf6, but with some additions of
$FreeBSD.

MFC after:	3 weeks
Sponsored by:	DARPA, AFRAL
Replace Apache-style license on two Makefiles with stock 2-clause BSD;
license, although the former is pretty safe, it wasn't intended to be
used in the version of MIPS boot2/loader upstreamed to FreeBSD.

MFC after:	3 weeks
Sponsored by:	DARPA, AFRL
Add in a flag to control whether the low or high data word of a register access
is latched in first.

The AR8327 apparently requires the low data word be latched in first.

Obtained from:	Linux OpenWRT
Store away the chip version and revision; some AR8327 code depends upon
the chip revision.
Add in the AR8327 probe/attach code and switch type.

It detects fine, but (as expected) it won't attach just yet, let alone
pass traffic.

Tested:

* DB120, AR8327 switch
Change arswitch_ports_init() to arswitch_port_init(), and teach it to take
a single port to setup.

This may end up later being used as part of some logic to program
the PHY for a single port, rather than having to reinitialise them
all at once.

Tested:

* DB120
[automated] Merge in upstream-github/master