ANSIfy function declarations.

Sponsored by:	Yandex LLC
Remove __P() macro.

Suggested by:	kevlo
Sponsored by:	Yandex LLC
Plug memory leaks on UNMAP and XCOPY with invalid parameters.

MFC after:	1 week
Do not pre-allocate reservation keys memory for every possible initiator.

In configurations with many ports, like iSCSI, each LUN is typically
accessed only by limited subset of ports.  Allocating that memory on
demand allows to reduce CTL memory usage from 5.3MB/LUN to 1.3MB/LUN.

MFC after:	1 month
Do not corrupt the listen string when parsing it.

This fixes problem with ctld reload when it is configured to listen on two
portals with same IP, but different ports.

MFC after:	1 week
Remove some unused code.
Increase BERI loader section alignment to 16

The .text, .bss, and .data sections claimed 16-byte alignment, but were
only aligned to 8 by the linker script.

Discovered with strip(1) from elftoolchain, which performs validation
absent from the binutils strip(1).

Sponsored by:	DARPA, AFRL
Do not pre-allocate UNIT ATTENTIONs storage for every possible initiator.

Abusing ability of major UAs cover minor ones we may not account UAs for
inactive ports.  Allocate UAs storage for port and start accounting only
after some initiator from that port fetched its first POWER ON OCCURRED.

This reduces per-LUN CTL memory usage from >1MB to less then 100K.

MFC after:	1 month
Unify function names after r275458.

MFC after:	1 month
Revert device_getenv_int() for now as it duplicates resource_int_value().
We should perhaps implement a device_getenv_*() and device_setenv_*() API
as a convenience wrapper on top of resource_*_value() and resource_set_*().
Increase CTL ports limit from 128 to 256 and LUNs limit from 256 to 1024.

After recent optimizations this change is no longer blocked by CTL memory
consumption.  Those limits are still not free, but much cheaper now.

MFC after:	1 week
Relnotes:	yes
Sponsored by:	iXsystems, Inc.
Assign argemdio0 to the correct base address and assign argemdio1 to its
proper place *after* argemdio0

Correctly place arge0 and arge1 on their respective bus positions.

Sponsored by:	Nicholas Esborn <nick@desert.net>
Add libcuse and libxo.
There is only one argemdio device on this board.

Sponsored by:	Nicholas Esborn <nick@desert.net>
Workaround for possible bug in the SAF1761 chip. Wait 125us before
re-using a hardware propritary transfer descriptor, PTD, in USB host
mode. If the PTD's are recycled too quickly, it has been observed that
the hardware simply fails to schedule the requested job or resets
completely disconnecting all devices.
Optimise the bit searching loops, by quickly skipping the 16 first set
bits if all the 16 first bits are set. This way the worst case
searching time is reduced from 32 to 16 cycles.
Const poison in a few places to ensure we don't modify things
through the module data pointer.
Switch is an 8316, so make the comments say that.

Delete extraneous comment line that manifested itself from cut-n-pasting.

Sponsored by:	Nicholas Esborn <nick@desert.net>
Fix style(9) and remove m_freem(NULL).
Add XXX comment, it looks incorrect, because m_pkthdr.len is already
incremented by M_PREPEND().

Sponsored by:	Yandex LLC
Add GET LBA STATUS command support to CTL.

It is implemented for LUNs backed by ZVOLs in "dev" mode and files.
GEOM has no such API, so for LUNs backed by raw devices all LBAs will
be reported as mapped/unknown.

MFC after:	2 weeks
Sponsored by:	iXsystems, Inc.