Always check the limits of array index variables before using them.

Obtained from:	DragonFlyBSD
MFC after:	1 week
Add a missing brace to callout_init_rm() to fix syntax.

MFC after:	1 week
Provide compatibility shim for atomic_dec_64_nv.

X-MFC-with:	r270247
MFC after:	13 days
Revert r270227. GCC doesn't like the lack of LL suffix,
so this makes powerpc build failing.
vt(4): Fix an inconsistency between the mouse cursor bitmap and its mask

MFC after:	1 week
Document MAC address selection and setting for atse(4).

Submitted by:	brooks
MFC after:	3 days
Sponsored by:	DARPA/AFRL
vt(4): Handle global and per-window mouse cursor toggle in one place

Before the global flag was set/unset using the CONS_MOUSECTL ioctl, and
the per-window flag through the MOUSE_SETLEVEL or MOUSE_SETMODE ioctls.

Also, if the cursor is already enabled/disabled, return immediatly. This
avoids to reset the cursor's position to the center of the screen.

This matches syscons' behavior.

While here, remove a trailing space and a redundant variable
declaration.
vt(4): Mark cursor old position as dirty before reading the dirty area

Otherwise, the redraw is done during the next vt_flush run.

MFC after:	1 week
vt(4): If the cursor is globally disabled, don't mark its position as dirty

This avoids unnecessary redraw. In particular, during boot, where the
cursor is disabled and its fake position is [0;0], this triggered a
refresh of the whole screen each time vt_flush() is called.

MFC after:	1 week
vt(4): If the cursor didn't move, don't mark its position as dirty

Currently, this has no effect, because the cursor is always redrawn
anyway. But this will be useful after improvements to the vd_bitbltchr_t
callback API.

The vt_device structure members used to store the position of the cursor
as of the last redraw are renamed from vd_mdirty{x,y} to vd_mold{x,y}.
The associated comment is fixed too. Also, their value is now expressed
in pixels, not in character columns/row.

MFC after:	1 week
vt(4): Mark the current cursor position as dirty

Like r270273, this has no effect for now, because the cursor is always
drawn. This is in preparation of future changes to vd_bitbltchr_t API.

MFC after:	1 week
Use __FBSDID() properly.

Suggested by:	pluknet@
MFC after:	2 weeks
Sponsored by:	The FreeBSD Foundation
Add guards to ptrdiff_t definition in include/stddef.h

Back in 2011 obrien has added the #define macro in sys/sys/stddef.h to
guard ptrdiff_t. Add similar protection to the identical code in
include/stddef.h.

Submitted by:   Mariusz Zaborski <oshogbo@FreeBSD.org>
MFC after:      1 week
vt(4): Mark cursor position as dirty when we enable/disable it

MFC after:	1 week
Make the iSCSI stack use __FBSDID() properly.

MFC after:	2 weeks
Sponsored by:	The FreeBSD Foundation
vt(4): Pause the flush timer while swithing window

This fixes bad looking refresh when switching window: squares instead
of text, flashing screen, and so on. In the worst case, vt_flush() came
at a very inappropriate timing and the screen was not refreshed at all
(leaving squares all over the place).

This doesn't fix the flickering of the screen with vt_vga, because the
sync signal is temporarily stopped and the video memory is cleared.

MFC after:	1 week
Fix includes.

Suggested by:	pluknet@
MFC after:	2 weeks
Sponsored by:	The FreeBSD Foundation
Use proper include paths in kernel iSCSI code.

MFC after:	2 weeks
Sponsored by:	The FreeBSD Foundation
Add `-A' flag to pkg-install(8) invocation when installing dependencies.

MFC after:	3 days
X-MFC-to:	stable/10, stable/9
Reported by:	gjb
Discussed with:	jelischer, gjb, bdrewery
* Add new net/sff8436.h containing constants used to access
  QSFP+ data via i2c inteface. These constants has been taken
  from SFF-8436 "QSFP+ 10 Gbs 4X PLUGGABLE TRANSCEIVER" standard
  rev 4.8.
* Add support for printing QSFP+ information from 40G NICs
  such as Chelsio T5.

This commit does not contain ioctl changes necessary for this
functionality work, there will be another commit soon.

Example:
cxl1: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
        options=ec07bb<RXCSUM,TXCSUM,VLAN_MTU,VLAN_HWTAGGING,JUMBO_MTU,.....>
        ether 00:07:43:28:ad:08
        nd6 options=29<PERFORMNUD,IFDISABLED,AUTO_LINKLOCAL>
        media: Ethernet 40Gbase-LR4 <full-duplex>
        status: active
        plugged: QSFP+ 40GBASE-LR4 (MPO Parallel Optic)
        vendor: OEM PN: OP-QSFP-40G-LR4 SN: 20140318001 DATE: 2014-03-18
        module temperature: 64.06 C voltage: 3.26 Volts
        lane 1: RX: 0.47 mW (-3.21 dBm) TX: 2.78 mW (4.46 dBm)
        lane 2: RX: 0.20 mW (-6.94 dBm) TX: 2.80 mW (4.47 dBm)
        lane 3: RX: 0.18 mW (-7.38 dBm) TX: 2.79 mW (4.47 dBm)
        lane 4: RX: 0.90 mW (-0.45 dBm) TX: 2.80 mW (4.48 dBm)

Tested on:	Chelsio T5
Tested on:	Mellanox/Huawei passive/active cables/transceivers.
MFC after:	2 weeks
Sponsored by:	Yandex LLC