Merge the second part of the unmapped I/O changes.  This enables the
infrastructure in the block layer and UFS filesystem as well as a few
drivers.  The list of MFC revisions is long, so I won't quote changelogs.

r248508,248510,248511,248512,248514,248515,248516,248517,248518,
248519,248520,248521,248550,248568,248789,248790,249032,250936

Submitted by:	kib
Approved by:	kib
Obtained from:	Netflix


git-svn-id: svn://svn.freebsd.org/base/stable/9@251897 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
MFC r248825, 248775

Add unmapped i/o support for the mps and isci drivers.

Submitted by:	mav, jimharris
Obtained from:	Netflix


git-svn-id: svn://svn.freebsd.org/base/stable/9@251899 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
Fix a bug that allowed a tracing process (e.g. gdb) to write
to a memory-mapped file in the traced process's address space
even if neither the traced process nor the tracing process had
write access to that file.

Security:	CVE-2013-2171
Security:	FreeBSD-SA-13:06.mmap
Approved by:	so


git-svn-id: svn://svn.freebsd.org/base/stable/9@251902 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
MFC r248068 (by sbruno):
Add legacy support to geom raid to create a /dev/arX device for support
of upgrading older machines using ataraid(4) to newer releases.

This optional parameter is controlled via kern.geom.raid.legacy_aliases
and will create a /dev/ar0 device that will point at /dev/raid/r0 for
example.

Tested on Dell SC 1425 DDF-1 format software raid controllers installing from
stable/7 and upgrading to stable/9 without having to adjust /etc/fstab


git-svn-id: svn://svn.freebsd.org/base/stable/9@251916 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
Missed mergeinfo for r251916.


git-svn-id: svn://svn.freebsd.org/base/stable/9@251917 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
MFC r248295 (by pjd):
We don't need buffer to handle BIO_DELETE, so don't check buffer size for it.
This fixes handling BIO_DELETE larger than MAXPHYS.


git-svn-id: svn://svn.freebsd.org/base/stable/9@251918 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
MFC r248596 (by kib):
Correct the page count when excess length is trimmed from the bio.


git-svn-id: svn://svn.freebsd.org/base/stable/9@251920 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
MFC r248696:
Make GEOM MULTIPATH to report unmapped bio support if underling path report
it.  GEOM MULTIPATH itself never touches the data and so transparent.


git-svn-id: svn://svn.freebsd.org/base/stable/9@251921 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
MFC r248720:
Remove extra bio_data and bio_length copying to child request after calling
g_clone_bio(), that already copied them.


git-svn-id: svn://svn.freebsd.org/base/stable/9@251922 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
MFC r248721:
GEOM NOP does not touch the data, so pass G_PF_ACCEPT_UNMAPPED flag through.


git-svn-id: svn://svn.freebsd.org/base/stable/9@251924 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
MFC r248722:
geom_slice.c and its consumers like GEOM_LABEL are not touching the data
unless hotspots are used.  Pass G_PF_ACCEPT_UNMAPPED flag through except
such rare cases (obsolete GEOM_SUNLABEL and GEOM_BSD).


git-svn-id: svn://svn.freebsd.org/base/stable/9@251925 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
MFC r249193 (by trasz):
Make it possible to submit FLUSH bios through geom_dev strategy.  This
is required for CTL to work with device-backed LUNs.


git-svn-id: svn://svn.freebsd.org/base/stable/9@251927 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
MFC r249974:
Return "descr" field alike to "Intel RAID1 volume" for GEOM RAID to make
it look better in bsdinstall.


git-svn-id: svn://svn.freebsd.org/base/stable/9@251929 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
MFC r251616:
Don't update provider properties and don't set DISKFLAG_OPEN if d_open()
disk method call returned error.  GEOM considers devices in such case as
still closed, and won't call symmetric d_close() for them.


git-svn-id: svn://svn.freebsd.org/base/stable/9@251931 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
MFC r228526 (by kevlo):
s/timout/timeout


git-svn-id: svn://svn.freebsd.org/base/stable/9@251936 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
MFC r242827 (by rdivacky):
Give tw_osl_dbg_printf format string to pacify clang warning.


git-svn-id: svn://svn.freebsd.org/base/stable/9@251937 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
MFC r248583 (by kib):
Fix twa(4) after the r246713.  The driver copies data around to
satisfy some alignment restrictions.  Do not set TW_OSLI_REQ_FLAGS_CCB
flag for mapped data, pass the csio->data_ptr in the req->data.

Do not put the ccb pointer into req->data ever, ccb is stored in
req->orig_req already.

Submitted by:	Shuichi KITAGUCHI <ki@hh.iij4u.or.jp>
PR:		kern/177020


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

deferal -> deferral

MFC: r248891

Pass correct parameter to CTR5() in bus_dmamap_load_uio.

MFC: r248892

Do not add 1 to nsegs before passing to CTR5(), since nsegs
has already been incremented before these calls.

MFC: r248893

Add CTR5() to bus_dmamap_load_ccb, similar to other bus_dmamap_load_*
functions.

MFC: r248896

Add bus_dmamap_load_bio for non-CAM disk drivers that wish to enable
unmapped I/O.

MFC: r249025

Add support for XPT_CONT_TARGET_IO CCBs in _bus_dmamap_load_ccb().

Declare CCB types in their respective switch blocks.

MFC: r249538

Some compilers issue a warning when wider integer is casted to narrow
pointer.  Supposedly shut down the warning by casting through
uintptr_t.

MFC: r251221

Move an assertion to the right spot; only bus_dmamap_load_mbuf(9)
requires a pkthdr being present but that's not the case for either
_bus_dmamap_load_mbuf_sg() or bus_dmamap_load_mbuf_sg(9).


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

Fix command timeout caused by data underrun during fetching ATAPI sense
data, introduced by r246713 (MFC'ed to stable/9 in r251874). There are two
places where ata_request is filled in ATA_CAM: ata_cam_begin_transaction()
and ata_cam_request_sense(). In the first case DMA should be done for
addresses from the CCB. In second case, DMA should be done to the different
address, the address of the sense buffer inside the CCB structure itself.


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

Allow unmapped I/O via aacd(4). It shouldn't be too hard to add the
same support for aacp(4), I'm lacking the necessary hardware for
testing, though.


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