MFC r236999:
	Include a warning when using the example code as it may not
	work in unusual situations.
	Also slightly optimize the command.

Approved by:	cperciva (implicit)


git-svn-id: svn://svn.freebsd.org/base/stable/9@237287 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
MFC: r232051

Catch up with r195837 (2.5 years ago) which renamed net_add_domain() to domain_add().


git-svn-id: svn://svn.freebsd.org/base/stable/9@237296 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
MFC r236605:
Replace #ifdef CAMDEBUG + if + panic() with single KASSERT().


git-svn-id: svn://svn.freebsd.org/base/stable/9@237303 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
MFC r236602, r236613:
Tune and add some missing CAM_DEBUG() points for better consistency.


git-svn-id: svn://svn.freebsd.org/base/stable/9@237305 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
MFC r236819

Validate IPv4 network mask being passed to ipfw kernel interface.
Incorrect mask can possibly be one of the reasons for kern/127209 existance.

Approved by:        ae(mentor)


git-svn-id: svn://svn.freebsd.org/base/stable/9@237307 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
MFC r236555:
Add -p argument for `camcontrol debug` to allow enabling CAM_DEBUG_PROBE
added at r208911.


git-svn-id: svn://svn.freebsd.org/base/stable/9@237308 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
MFC r236604, r236639:
Do not reinvent a wheel and let default error handler do its job.


git-svn-id: svn://svn.freebsd.org/base/stable/9@237311 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
MFC r236689 (by ken):
Fix a memory leak in the kernel case in scsi_command_string().

Submitted by:   Kashyap Desai <Kashyap.Desai@lsi.com>


git-svn-id: svn://svn.freebsd.org/base/stable/9@237315 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
MFC r236712:
To make CAM debugging easier, compile in some debug flags (CAM_DEBUG_INFO,
CAM_DEBUG_CDB, CAM_DEBUG_PERIPH and CAM_DEBUG_PROBE) by default.
List of these flags can be modified with CAM_DEBUG_COMPILE kernel option.
CAMDEBUG kernel option still enables all possible debug, if not overriden.

Additional 50KB of kernel size is a good price for the ability to debug
problems without rebuilding the kernel. In case where size is important,
debugging can be compiled out by setting CAM_DEBUG_COMPILE option to 0.


git-svn-id: svn://svn.freebsd.org/base/stable/9@237317 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
MFC r236713:
Add CAM_DEBUG_INFO debug messages for periph created/invalidated/destroyed
and for asyncs sent.


git-svn-id: svn://svn.freebsd.org/base/stable/9@237319 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
MFC r236814:
One more major cam_periph_error() rewrite to improve error handling and
reporting. It includes:
 - removing of error messages controlled by bootverbose, replacing them
with more universal and informative debugging on CAM_DEBUG_INFO level,
that is now built into the kernel by default;
 - more close following to the arguments submitted by caller, such as
SF_PRINT_ALWAYS, SF_QUIET_IR and SF_NO_PRINT; consumer knows better which
errors are usual/expected at this point and which are really informative;
 - adding two new flags SF_NO_RECOVERY and SF_NO_RETRY to allow caller
specify how much assistance it needs at this point; previously consumers
controlled that by not calling cam_periph_error() at all, but that made
behavior inconsistent and debugging complicated;
 - tuning debug messages and taken actions order to make debugging output
more readable and cause-effect relationships visible;
 - making camperiphdone() (common device recovery completion handler) to
also use cam_periph_error() in most cases, instead of own dumb code;
 - removing manual sense fetching code from cam_periph_error(); I was told
by number of people that it is SIM obligation to fetch sense data, so this
code is useless and only significantly complicates recovery logic;
 - making ada, da and pass driver to use cam_periph_error() with new limited
recovery options to handle error recovery and debugging in common way;
as one of results, CAM_REQUEUE_REQ and other retrying statuses are now
working fine with pass driver, that caused many problems before.
 - reverting r186891 by raj@ to avoid burning few seconds in tight DELAY()
loops on device probe, while device simply loads media; I think that problem
may already be fixed in other way, and even if it is not, solution must be
different.

Sponsored by:   iXsystems, Inc.


git-svn-id: svn://svn.freebsd.org/base/stable/9@237327 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
MFC r236245

Fix a typo in wbwd so that CRF5 is actually written to the data register
rather than the index register.


git-svn-id: svn://svn.freebsd.org/base/stable/9@237342 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
MFC r236246

Add device ids for the Winbond 83627DHG-P chip and set the registers to
trigger the keyboard reset line on timeout.


git-svn-id: svn://svn.freebsd.org/base/stable/9@237343 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
MFC r236860,r237035: find(1): Extend and move description of -d option to
-depth primary.

The nullary -depth primary is standard and the -d option provides little
advantage.

Commit r236860 originally by issyl0.

PR:		docs/168885


git-svn-id: svn://svn.freebsd.org/base/stable/9@237345 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
MFC of 236825

When synchronously syncing a device (MNT_WAIT), wait for buffers
to become available. Otherwise we may excessively spin and fail
with ``fsync: giving up on dirty''.

Reviewed by: kib
Tested by:   Peter Holm


git-svn-id: svn://svn.freebsd.org/base/stable/9@237351 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
MFC of 236937

In softdep_setup_inomapdep() we may have to allocate both inodedep
and bmsafemap dependency structures in inodedep_lookup() and
bmsafemap_lookup() respectively. The setup of these structures must
be done while holding the soft-dependency mutex. If the inodedep is
allocated first, it may be freed in the I/O completion callback when
the mutex is released to allocate the bmsafemap. If the bmsafemap is
allocated first, it may be freed in the I/O completion callback when
the mutex is released to allocate the inodedep.

To resolve this problem, bmsafemap_lookup has had a parameter added
that allows a pre-malloc'ed bmsafemap to be passed in so that it does
not need to release the mutex to create a new bmsafemap. The
softdep_setup_inomapdep() routine pre-malloc's a bmsafemap dependency
before acquiring the mutex and starting to build the inodedep with a
call to inodedep_lookup(). The subsequent call to bmsafemap_lookup()
is passed this pre-allocated bmsafemap entry so that it need not
release the mutex if it needs to create a new one.

Reported by: Peter Holm
Tested by:   Peter Holm


git-svn-id: svn://svn.freebsd.org/base/stable/9@237352 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
MFC r237061:
Make sure that fstab fd is not leaked on exec.

PR:	kern/169023


git-svn-id: svn://svn.freebsd.org/base/stable/9@237361 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
MFC: r237234

Avoid hard sentence break.


git-svn-id: svn://svn.freebsd.org/base/stable/9@237370 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
MFC: r237235

Document the hw.ahci.force tunable here, too, as it's also used by
ataahci(4) and atanvidia(4).


git-svn-id: svn://svn.freebsd.org/base/stable/9@237372 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
MFC r236952:
 - Limit r214102 workaround to only x86. On arm it causes more problems
then solves because of cache coherency issues. This fixes periodic error
messages on console and command timeouts.
 - Patch SATA PHY configuration for 65nm SoCs to improve SNR same as
Linux does.


git-svn-id: svn://svn.freebsd.org/base/stable/9@237378 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f