Unconditionally acquire periph reference on CCB allocation failure.

cam_periph_acquire() can return error if periph already invalidated, but
that may be unacceptable and cause deadlock if the invalidated periph can't
be destroyed without "executing" the scheduled request.

Coverity CID:	1109822
MFC after:	2 months


git-svn-id: svn+ssh://svn.freebsd.org/base/head@256888 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
Use the vdev's ashift to calculate the supported min block size passed to
zio_compress_data(..) when compressing l2arc buffers.

This eliminates l2arc I/O errors, which resulted in very poor performance on
vdev's configured with block size greater than 512b due to compression
assuming a smaller min block size than the vdev supports.

MFC after:	2 days


git-svn-id: svn+ssh://svn.freebsd.org/base/head@256889 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
Fix memory and references leak due to unfreed path.

Coverity CID:	1109815


git-svn-id: svn+ssh://svn.freebsd.org/base/head@256893 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
Fix memory and references leak due to unfreed path.

Coverity CID:	1054773


git-svn-id: svn+ssh://svn.freebsd.org/base/head@256895 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
Standards-conformance and code deduplication:
- Use bus reference phandles in place of FDT offsets as IRQ domain keys
- Unify the identical macio/fdt/mambo OpenPIC drivers into one
- Be more forgiving (following ePAPR) about what we need from the device
  tree to identify an OpenPIC
- Correctly map all IRQs into an interrupt domain
- Set IRQ_*_CONFORM for interrupts on an unknown PIC type instead of
  failing attachment for that device.


git-svn-id: svn+ssh://svn.freebsd.org/base/head@256898 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
Allow lots of interrupts (useful on multi-domain platforms) and do not
set device_quiet() on all devices attached under nexus(4).


git-svn-id: svn+ssh://svn.freebsd.org/base/head@256899 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
Set BUS_PROBE_NOWILDCARD on this attachment as a stopgap. Unconditionally
poking at registers in unknown devices is not the best probe mechanism.
This should be reverted and a better solution found later.


git-svn-id: svn+ssh://svn.freebsd.org/base/head@256900 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
Catch up on 6 years of improvements in Open Firmware nexus devices by
importing the sparc64 one. At least 90% of this code is MI and will be
moved into /sys/dev/ofw at some point in the future.


git-svn-id: svn+ssh://svn.freebsd.org/base/head@256901 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
MFP4: 223121 (PIC portion), 225861, 227822, 229692 (PIC only), 229693,
230523, 1123614

Implement a driver for Robert Norton's PIC as an FDT interrupt
controller. Devices whose interrupt-parent property points to a beripic
device will have their interrupt allocation, activation , and setup
operations routed through the IC rather than down the traditional bus
hierarchy.

This driver largely abstracts the underlying CPU away allowing the
PIC to be implemented on CPU's other than BERI. Due to insufficient
abstractions a small amount of MIPS specific code is currently required
in fdt_mips.c and to implement counters.

MFC after:	3 days
Sponsored by:	DARPA/AFRL


git-svn-id: svn+ssh://svn.freebsd.org/base/head@256911 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
Sync BERI kernel configs with P4:

Switch the majority of device configuration to FDT from hints.

Add BERI_*_BASE configs to reduce duplication in the MDROOT and SDROOT
kernels.

Add NFS and GSSAPI support by default.

MFC after:	3 days
Sponsored by:	DARPA/AFRL


git-svn-id: svn+ssh://svn.freebsd.org/base/head@256912 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
Ignore registers on devices where the reg property is malformed. Issue a
warning if this happens under bootverbose. This prevents some
strange-looking entries in dmesg for SMU devices on Apple G5 systems.


git-svn-id: svn+ssh://svn.freebsd.org/base/head@256914 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
Stop conflating WITHOUT_CLANG with WITHOUT_CLANG_IS_CC.  This allows
bootstrapping a copy of clang without building clang for the base system
which is useful for nanobsd and similar setups.  It's still probably
wrong to conflate what is installed as /usr/bin/cc with the selection
of a bootstrap compiler under WITH*_CLANG_IS_CC, but that's for another
day.

MFC after:	1 week
Sponsored by:	DARPA/AFRL


git-svn-id: svn+ssh://svn.freebsd.org/base/head@256915 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
Mask out non-address bits in the mac address register, for proper
detection of an all-zeroes address.  Also remove a misplaced return.

Reviewed by:	br@


git-svn-id: svn+ssh://svn.freebsd.org/base/head@256919 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
The TCP delayed ACK logic isn't aware of LRO passing up large aggregated
segments thinking it received only one segment. This causes it to enable
the delay the ACK for 100ms to wait for another segment which may never
come because all the data was received already.

Doing delayed ACK for LRO segments is bogus for two reasons: a) it pushes
us further away from acking every other packet; b) it introduces additional
delay in responding to the sender.  The latter is especially bad because it
is in the nature of LRO to aggregated all segments of a burst with no more
coming until an ACK is sent back.

Change the delayed ACK logic to detect LRO segments by being larger than
the MSS for this connection and issuing an immediate ACK for them to keep
the ACK clock ticking without interruption.

Reported by:	julian, cperciva
Tested by:	cperciva
Reviewed by:	lstewart
MFC after:	3 days


git-svn-id: svn+ssh://svn.freebsd.org/base/head@256920 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
Thou shalt not leak build host state into the system being compiled.

The VERSION variable is encoded into the SUNW_ctf sections of the kernel
and every kernel module when dtrace is enabled; starting with 9.2-RELEASE
(when dtrace was turned on in GENERIC) this means that different host kernels
will result in very different kernel binaries being generated.  This tripped
up freebsd-update builds after the build boxes were updated from 9.x to 10.x.

MFC after:	3 days (stable/9)
X-MFC after:	0 days (stable/10)
Security:	Rendered two members of so@ temporarily insane


git-svn-id: svn+ssh://svn.freebsd.org/base/head@256921 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
Rename the "alfred" command to "auto", and document it.  Retain support
for "portsnap alfred" for now.

Discussed:	many times, most recently on svn-src-all
MFC after:	1 week


git-svn-id: svn+ssh://svn.freebsd.org/base/head@256923 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
Add a dummy statement to the beginning of the pthread_cleanup_pop() macro
to allow a call of the macro to be labelled as in:

label:
  pthread_cleanup_pop();

Reviewed by:	imp
MFC after:	3 days


git-svn-id: svn+ssh://svn.freebsd.org/base/head@256925 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
Fix AHCI ATAPI emulation when backed with /dev/cd0

- remove assumption that the backing file/device had
  512-byte sectors
- fix incorrect iovec size variable that would result
  in a buffer overrun when an o/s issued an i/o request
  with more s/g elements than the blockif api

Reviewed by:	Zhixiang Yu (zxyu.core@gmail.com)
MFC after:	3 days


git-svn-id: svn+ssh://svn.freebsd.org/base/head@256926 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
Add a manpage for the getenv() family of functions in the kernel.


git-svn-id: svn+ssh://svn.freebsd.org/base/head@256927 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
Enable ATSE_CFI_HACK in BERI configs, stable MAC addresses are useful.

MFC after:	3 days
Sponsored by:	DARPA/AFRL


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