Add few more minor parts of DevSleep support from AHCI 1.3.1 proposal.


git-svn-id: svn+ssh://svn.freebsd.org/base/head@258173 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
Don't allow vfs.lorunningspace or vfs.hirunningspace to be set such
that lorunningspace is greater than hirunningspace as the system
performs terribly if it is mistuned in this fashion.

MFC after:	1 week


git-svn-id: svn+ssh://svn.freebsd.org/base/head@258174 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
Clean up the macros to avoid using casts.

Suggested by: bde and jhb


git-svn-id: svn+ssh://svn.freebsd.org/base/head@258175 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
Fix accounting for hw.realmem on the i386 and amd64 platforms.

sys/i386/i386/machdep.c:
sys/amd64/amd64/machdep.c:
	The value reported by FreeBSD as "real memory" when booting
	doesn't match what is later reported by sysctl as hw.realmem.
	This is due to the fact that the value printed during the
	boot process is fetched from smbios data (when possible),
	and accounts for holes in physical memory. On the other
	hand, the value of hw.realmem is unconditionally set to be
	one larger than the highest page of the physical address
	space.

	Fix this by setting hw.realmem to the same value printed
	during boot, this makes hw.realmem honour it's name and
	account properly for physical memory present in the system.

Submitted by:	Roger Pau Monné
Reviewed by:	gibbs


git-svn-id: svn+ssh://svn.freebsd.org/base/head@258176 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
Remove an incorrectly copied and pasted clause from these license
statements.

Approved by:	Yohanes Nugroho <yohanes@gmail.com>
MFC after:	1 week


git-svn-id: svn+ssh://svn.freebsd.org/base/head@258177 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
Improve robustness of the Xen balloon driver.

sys/dev/xen/balloon/balloon.c:
	Remove unused and commented out code.

	Fix deadlock caused by performing a sleepable malloc
	while holding the balloon mutex.

	Perform proper accounting of the memory used by the domain.

Submitted by:	Roger Pau Monné
Sponsored by:	Citrix Systems R&D
Reviewed by:	gibbs
MFC after:	2 days


git-svn-id: svn+ssh://svn.freebsd.org/base/head@258178 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
Merge in gcc svn r120505 to include definition of TREE_OVERFLOW_P:

http://gcc.gnu.org/viewcvs/gcc/trunk/gcc/tree.h?revision=120505&view=markup

This repairs build breakage for non x86 arch's that use gcc to build
intruduced at svn R258157


git-svn-id: svn+ssh://svn.freebsd.org/base/head@258179 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
Replace CAP_POLL_EVENT and CAP_POST_EVENT capability rights (which I had
a very hard time to fully understand) with much more intuitive rights:

	CAP_EVENT - when set on descriptor, the descriptor can be monitored
		with syscalls like select(2), poll(2), kevent(2).

	CAP_KQUEUE_EVENT - When set on a kqueue descriptor, the kevent(2)
		syscall can be called on this kqueue to with the eventlist
		argument set to non-NULL value; in other words the given
		kqueue descriptor can be used to monitor other descriptors.
	CAP_KQUEUE_CHANGE - When set on a kqueue descriptor, the kevent(2)
		syscall can be called on this kqueue to with the changelist
		argument set to non-NULL value; in other words it allows to
		modify events monitored with the given kqueue descriptor.

Add alias CAP_KQUEUE, which allows for both CAP_KQUEUE_EVENT and
CAP_KQUEUE_CHANGE.

Add backward compatibility define CAP_POLL_EVENT which is equal to CAP_EVENT.

Sponsored by:	The FreeBSD Foundation
MFC after:	3 days


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

Sponsored by:	The FreeBSD Foundation
MFC after:	3 days


git-svn-id: svn+ssh://svn.freebsd.org/base/head@258182 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
Fix a couple of issues with -F:
- Fix ALWAYS_INSTALL to take precedence over the FreeBSD ID checks.
  In particular, always install a file where the only change was
  the FreeBSD ID even if -F is specified.
- Fix the -F option in the case that the only upstream change is a
  change in the FreeBSD ID and the local file is removed.
- Add tests for these two cases.


git-svn-id: svn+ssh://svn.freebsd.org/base/head@258185 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
Fixed a tx watchdog chip reset that could occur on mostly idle links.
Fixed various link related issues and 10GBaseT is now linking properly.
Modified the types for the driver tunables to be consistent with the sysctl APIs.

Approved by:	davidch (mentor)


git-svn-id: svn+ssh://svn.freebsd.org/base/head@258187 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
MFV: netcat from OpenBSD 5.4.

No functional change.


git-svn-id: svn+ssh://svn.freebsd.org/base/head@258195 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
The vendor specified field is 88 bytes, not 8 bytes.

Submitted by:	Kristof Provost <kristof@sigsegv.be>


git-svn-id: svn+ssh://svn.freebsd.org/base/head@258196 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
Update the onfi_params struct to ONFI revision 3.2 (06 12 2013).

Submitted by:	Kristof Provost <kristof@sigsegv.be> (cleanup) and me (orig).


git-svn-id: svn+ssh://svn.freebsd.org/base/head@258197 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
Search for and validate the ONFI params as specified in the standard.

The ONFI spec states that at least two bytes of the signature ("ONFI")
must be present, and the CRC must be correct to have a valid parameter
page.  If the page is not valid there are at least two backup pages where
the data can also be found.

Submitted by:	Kristof Provost <kristof@sigsegv.be> (cleanup) and me (orig).


git-svn-id: svn+ssh://svn.freebsd.org/base/head@258199 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
ONFI parameters are little-endian, hence we must take care to convert them
to native endianness.  We must also pay attention to unaligned accesses.

Copy the interesting parameters to a new struct so the rest of the code can
forget about these problems.

Submitted by:	Kristof Provost <kristof@sigsegv.be> (cleanup) and me (orig).


git-svn-id: svn+ssh://svn.freebsd.org/base/head@258200 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
Move the luns field to the end of the struct, for serendipitous packing.
(I was supposed to do this before committing it initially.)


git-svn-id: svn+ssh://svn.freebsd.org/base/head@258201 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
Rework the routine that returns a pointer to the table of software ECC
byte positions within the OOB area to support chips with unusual OOB
sizes such as 218 or 224 bytes.

The table for 128 byte OOB works for these but it assumes 3 bytes of ECC
per 256 byte block, and in the case of an ONFI chip the params page may
ask for something different.  In other words, this is better but not
yet perfect.


git-svn-id: svn+ssh://svn.freebsd.org/base/head@258202 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
gcc: Add a new option -Wvla to warn variable length array.

Obtained from:	gcc 4.3 (rev. 122851; GPLv2)
MFC after:	3 weeks


git-svn-id: svn+ssh://svn.freebsd.org/base/head@258204 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
libcpp: preprocessor speedup patches from mainline.

* lex.c (_cpp_clean_line): Add uses of __builtin_expect.  Don't
look backward at the end of the line unless we saw a backslash.

* internal.h (struct cpp_reader): Add new fields:
nonexistent_file_hash and nonexistent_file_ob.
* files.c: Include "obstack.h".
(find_file_in_dir): Before trying to open the file, look up the
path name in the hash table of nonexistent files.  After failing
to open the file, add the path name to the hash table.
(_cpp_find_file): Cache the results of looking up the file name
starting with the quote and bracket chain heads, if we can.
(nonexistent_file_hash_eq): New static function.
(_cpp_init_files): Initialize pfile->nonexistent_file_hash and
pfile->nonexistent_file_ob.
(_cpp_cleanup_files): Free pfile->nonexistent_file_hash and
pfile->nonexistent_file_ob.

Obtained from:	gcc 4.3 (rev. 120263, 124929 ; GPLv2)
MFC after:	3 weeks


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