Commit Graph

34243 Commits

Author SHA1 Message Date
Stephen Hurd
96b2e63f10 bnxt: Use correct firmware call for number of queues supported
1) Based on the suggestion from firmware team, derive
   scctx->isc_ntxqsets_max & scctx->isc_nrxqsets_max based on FUNC_QCFG
   (instead of FUNC_QCAPS).
2) Bump-up driver version to "1.0.0.2".

Submitted by:	Bhargava Chenna Marreddy <bhargava.marreddy@broadcom.com>
Reviewed by:	shurd, sbruno
Approved by:	sbruno (mentor)
Sponsored by:	Broadcom Limited
Differential Revision:	https://reviews.freebsd.org/D12128
2017-09-06 20:14:34 +00:00
Konstantin Belousov
b99b705d9c Skylake server core PMC support for hwpmc(4).
Reviewed by:	emaste
Sponsored by:	The FreeBSD Foundation
Hardware provided by:	Intel
MFC after:	2 weeks
Differential revision:	https://reviews.freebsd.org/D12221
2017-09-06 17:19:48 +00:00
Hans Petter Selasky
5b4b1bb3a1 Add new USB quirk.
PR:			221775
MFC after:		1 week
Sponsored by:		Mellanox Technologies
2017-09-06 13:59:57 +00:00
Scott Long
6eea4f463d Checkpoint the next phase in debug message cleanup, this time focusing on
error recovery messages.

Sponsored by:	Netflix
2017-09-06 09:19:54 +00:00
Conrad Meyer
1b93938ae4 amdsmn(4): Do not probe not matching hostbridges
Similar to r323195, but for amdsmn(4) driver (which borrowed some design).

Ignore hostbs that do not match our PCI device id criteria.

Sponsored by:	Dell EMC Isilon
2017-09-05 21:00:33 +00:00
Conrad Meyer
40f7bccb5d amdtemp(4): Do not probe not matching hostbridges
Some systems have hostbs that do not match our PCI device id criteria.
Detect and ignore these devices in probe.

PR:		218264
Sponsored by:	Dell EMC Isilon
2017-09-05 20:35:25 +00:00
Conrad Meyer
a03d621bfa amdtemp(4): Add support for Family 17h temperature sensor
The sensor value is formatted similarly to previous models (same
bitfield sizes, same units), but must be read off of the internal
System Management Network (SMN) from the System Management Unit (SMU)
co-processor.

PR:		218264
Reported and tested by:	Nils Beyer <nbe AT renzel.net>
Reviewed by:	avg (no +1), mjoras, truckman
Sponsored by:	Dell EMC Isilon
Differential Revision:	https://reviews.freebsd.org/D12217
2017-09-05 15:19:14 +00:00
Conrad Meyer
907f50fe04 Add smn(4) driver for AMD System Management Network
AMD Family 17h CPUs have an internal network used to communicate between
the host CPU and the PSP and SMU coprocessors.  It exposes a simple
32-bit register space.

Reviewed by:	avg (no +1), mjoras, truckman
Sponsored by:	Dell EMC Isilon
Differential Revision:	https://reviews.freebsd.org/D12217
2017-09-05 15:13:41 +00:00
Sepherosa Ziehau
7f1e5ebba8 hyperv/hn: Log RSS capabilities mask.
This helps to detect when UDP hash types can be supported.

MFC after:	3 days
Sponsored by:	Microsoft
Differential Revision:	https://reviews.freebsd.org/D12177
2017-09-05 06:20:02 +00:00
Sepherosa Ziehau
8c068aa51e hyperv/hn: Implement SIOCGIFRSS{KEY,HASH}.
The conditional compiling in the review request is removed, since
these IOCTLs will be available in stable/10 and stable/11.

Reviewed by:	gallatin
MFC after:	1 week
Sponsored by:	Microsoft
Differential Revision:	https://reviews.freebsd.org/D12175
2017-09-05 06:05:48 +00:00
Alexander Motin
3dcd9d784a Increase negotiation polling period from 10ms to 100ms.
There is no big need to burn CPU if other side may be not there yet.  For
example, the PLX hardware by default enables the NTB link up on reset, not
dependig on driver to do it.  In case of Intel hardware this also reduces
race between MSI-X workaround negotiation and upper layers, using the same
scratchpad registers in different time.

MFC after:	12 days
2017-09-02 13:28:45 +00:00
Alexander Motin
b7dd3fbede Make NTB drivers report more info via NewBus methods.
MFC after:	12 days
2017-09-02 11:56:16 +00:00
Alexander Motin
08dc78166d Link Interface has no Link Error registers.
MFC after:	13 days
2017-09-01 09:48:19 +00:00
Navdeep Parhar
95bb5b694e cxgbe/iw_cxgbe: Set TCP_NODELAY before initiating connection so that
t4_tom picks it up right away.  This is less work than waiting for
the connection to be established before applying the setting.

MFC after:	2 weeks
Sponsored by:	Chelsio Communications
2017-09-01 01:34:12 +00:00
Navdeep Parhar
0a3bf7fb7e cxgbe/t4_tom: There may not be a tid to update if the connection isn't
established.

MFC after:	2 weeks
Sponsored by:	Chelsio Communications
2017-08-31 23:34:08 +00:00
Jung-uk Kim
2f6a1a81bb Merge ACPICA 20170831. 2017-08-31 22:47:04 +00:00
Alexander Motin
84f8cfec2f Clear doorbell bits after masking them before processing.
In theory this allows to avoid one more expensive doorbell register read
later in some scenarios.  But in practice it also significantly increases
packet rate on PLX hardware, that I can't explain yet, possibly work-
arounding some interrupt delays.

MFC after:	13 days
Sponsored by:	iXsystems, Inc.
2017-08-31 21:37:22 +00:00
Navdeep Parhar
3ef7429927 cxgbe/t4_tom: Add a knob to select the congestion control algorigthm
used by the TOE hardware for fully offloaded connections.  The knob
affects new connections only.

MFC after:	2 weeks
Sponsored by:	Chelsio Communications
2017-08-31 20:33:22 +00:00
Alexander Motin
171e3d1a1f Remove unneeded pmap_change_attr() calls.
Reported by:	kib
MFC after:	13 days
2017-08-31 17:02:06 +00:00
Alexander Motin
0faf59149c Add/polish some defines.
MFC after:	13 days
2017-08-31 16:32:11 +00:00
Konstantin Belousov
5a21cd1941 The nvme module should explicitly declare dependency on the cam.
If both nvme and cam are compiled as modules, nvme cannot be kldloaded
otherwise.

Reviewed by:	imp
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2017-08-31 14:21:32 +00:00
Alexander Motin
b6c46372af Fix port control for PEX 8749.
That chip has three Station Ports, so previous address math was incorrect.

MFC after:	13 days
Sponsored by:	iXsystems, Inc.
2017-08-31 13:41:44 +00:00
Alexander Motin
c7dabb6563 Make ntb_set_ctx() always generate fake link event.
It allows application driver get initial link state without racing with
hardware interrupts, thanks to the context rmlock held here.

MFC after:	1 week
Sponsored by:	iXsystems, Inc.
2017-08-31 10:59:39 +00:00
Alexander Motin
ba4b25cbba Make ntb_transport(4) ready receive early link events.
Those events may be reported as soon as callback is registered, if the link
is enabled by hardware or some other application.

While there, clean link_is_up variable on link down event.

MFC after:	1 week
2017-08-31 10:53:10 +00:00
Navdeep Parhar
2f318252cb cxgbe(4): Add two new debug flags -- one to allow manual firmware
install after full initialization, and another to disable the TCB
cache (T6+).  The latter works as a tunable only.

Note that debug_flags are for debugging only and should not be set
normally.

MFC after:	1 week
Sponsored by:	Chelsio Communications
2017-08-30 23:41:04 +00:00
Alexander Motin
ed9652da5f Add NTB driver for PLX/Avago/Broadcom PCIe switches.
This driver supports both NTB-to-NTB and NTB-to-Root Port modes (though
the second with predictable complications on hot-plug and reboot events).
I tested it with PEX 8717 and PEX 8733 chips, but expect it should work
with many other compatible ones too.  It supports up to two NT bridges
per chip, each of which can have up to 2 64-bit or 4 32-bit memory windows,
6 or 12 scratchpad registers and 16 doorbells.  There are also 4 DMA engines
in those chips, but they are not yet supported.

While there, rename Intel NTB driver from generic ntb_hw(4) to more specific
ntb_hw_intel(4), so now it is on par with this new ntb_hw_plx(4) driver and
alike to Linux naming.

MFC after:	2 weeks
Sponsored by:	iXsystems, Inc.
2017-08-30 21:16:32 +00:00
Sean Bruno
a969350226 Revert r323008 and its conversion of e1000/iflib to using SX locks.
This seems to be missing something on the 82574L causing NFS root mounts
to hang.

Reported by:	kib
2017-08-30 18:56:24 +00:00
Navdeep Parhar
e3d00a3e03 cxgbe(4): Zero out the memory allocated for the debug dump.
cudbg_collect seems to expect it this way.

MFC after:	1 week
Sponsored by:	Chelsio Communications
2017-08-30 18:46:38 +00:00
Konstantin Belousov
405058aa7a Only make the if_ix module depend on netmap when netmap is configured.
Approved by:	erj
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2017-08-30 18:19:25 +00:00
Ed Maste
53d534724a bhnd: initialize variable before use
Reported by:	Clang
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
2017-08-30 17:39:51 +00:00
Ed Maste
89fdc67c9c usb: Add external "Intenso Memory" disk UQ_MSC_NO_INQUIRY quirk
PR:		221852
Submitted by:	Fabian Keil
Reviewed by:	hselasky
Obtained from:	ElectroBSD
MFC after:	1 week
2017-08-30 01:44:11 +00:00
Sean Bruno
e17e5b4134 Continuation of lock cleanup in e1000.
Post-cold sleep instead of DELAY when waiting for firmware.

Convert softc mutex to an SX lock.  Change all waits to sleeps
once interrupts are enabled (and it is safe to sleep).

Submitted by:	Matt Macy <matt@mattmacy.io>
Sponsored by:	Limelight Networks
Differential Revision:	https://reviews.freebsd.org/D12101
2017-08-30 00:20:43 +00:00
Navdeep Parhar
fc740a161b cxgbe(4): Update T6/T5/T4 firmwares to 1.16.59.0.
These firmwares come from a pre-release snapshot.  The final firmwares
in this Chelsio release cycle will likely be .61.0 or later and those
will be the next "long lived" firmwares in FreeBSD head and stable
branches.  .59 is being provided in head (only) for wider test exposure.

Obtained from:	Chelsio Communications
Sponsored by:	Chelsio Communications
2017-08-29 23:37:26 +00:00
Warner Losh
c2005bba77 Fix a few overlooked spots where the coded uses 16-bit NSIDs. Chuck
Tuffli had submitted a more thorough patch that I was unaware of when
I did my work and this brings in the bits I missed from that patch.

PR: 220267
Submitted by: Chuck Tuffli
2017-08-29 15:46:34 +00:00
Warner Losh
519772814d Add CAM/NVMe support for CAM_DATA_SG
This adds support in pass(4) for data to be described with a
scatter-gather list (sglist) to augment the existing (single) virtual
address.

Differential Revision: https://reviews.freebsd.org/D11361
Submitted by: Chuck Tuffli
Reviewed by: imp@, scottl@, kenm@
2017-08-29 15:29:57 +00:00
Warner Losh
850564b948 Add new compile-time option NVME_USE_NVD that sets the default value
of the runtime hw.nvme.use_vnd tunable. We still default to nvd unless
otherwise requested.

Sponsored by: Netflix
2017-08-28 23:54:25 +00:00
Warner Losh
c02565f9fa Set the max transactions for NVMe drives better.
Provided a better estimate for the number of transactions that can be
pending at one time. This will be number of queues * number of
trackers / 4, as suggested by Jim Harris. This gives a better estimate
of the number of transactions that CAM should queue before applying
back pressure. This should be revisted when we have real multi-queue
support in CAM and the upper layers of the I/O stack.

Sponsored by: Netflix
2017-08-28 23:54:20 +00:00
Navdeep Parhar
1ba8c29ca8 cxgbe(4): Do not access the mailbox without appropriate locks while
creating hardware VIs.

This fixes a bad race on systems with hw.cxgbe.num_vis > 1.

Reported by:	olivier@
MFC after:	1 week
Sponsored by:	Chelsio Communications
2017-08-28 22:41:15 +00:00
Andriy Voskoboinyk
0cc18edf18 rtwn(4): some initial preparations for (basic) VHT support.
Rename RTWN_RIDX_MCS to RTWN_RIDX_HT_MCS before adding 802.11ac
MCS rate indexes (they have different offset).

No functional change intended.
2017-08-28 22:14:16 +00:00
Marius Strobl
e023501c6a Don't set any WOL enabling hardware bits if WOL isn't requested
according to the enabled interface capability bits. Also remove
some dead code, which tried to preserve already set contents of
E1000_WUC while that register is completely overwritten shortly
after in all cases.
2017-08-28 22:09:12 +00:00
Navdeep Parhar
7023d9d4c6 cxgbe(4): Maintain one ifmedia per physical port instead of one per
Virtual Interface (VI).  All autonomous VIs that share a port share the
same media.

MFC after:	1 week
Sponsored by:	Chelsio Communications
2017-08-28 21:44:25 +00:00
Alexander Motin
546ec4e544 Mask doorbells while processing them.
This fixes interrupt storms on hardware using legacy level-triggered
interrupts, since doorbell processing could take time after interrupt
handler completion, that triggered extra interrupts in a loop.

MFC after:	2 weeks
Sponsored by:	iXsystems, Inc.
2017-08-28 20:00:21 +00:00
Alexander Motin
e6f000753e Fix fake interrupt when set doorbell is unmasked.
Since the doorbell bit is already set when interrupt handler is called,
the event was not propagated to upper layer.  It was working normally
because present code was not using masking actively, but that is going
to change.

MFC after:	2 weeks
Sponsored by:	iXsystems, Inc.
2017-08-28 19:52:57 +00:00
Maxim Sobolev
f7ca2bbe44 Add ability to label md(4) devices.
This feature comes from the fact that we rely memory-backed md(4)
in our build process heavily. However, if the build goes haywire
the allocated resources (i.e. swap and memory-backed md(4)'s) need
to be purged. It is extremely useful to have ability to attach
arbitrary labels to each of the virtual disks so that they can
be identified and GC'ed if neecessary.

MFC after:	4 weeks
Differential Revision:	https://reviews.freebsd.org/D10457
2017-08-28 15:54:07 +00:00
Navdeep Parhar
573443c542 cxgbe(4): vi_mac_funcs should include the base Ethernet function. It is
already used in the driver as if it does.

MFC after:	3 days
Sponsored by:	Chelsio Communications
2017-08-28 07:50:54 +00:00
Navdeep Parhar
358346b456 cxgbe(4): Remove write only variable from t4_port_init.
MFC after:	3 days
2017-08-28 04:06:40 +00:00
Navdeep Parhar
0fa7560dfd cxgbe(4): Fix some assertions during driver detach. The netmap queues
can't be initialized if the VI isn't.

MFC after:	3 days
2017-08-28 03:25:41 +00:00
Navdeep Parhar
f6d9d14b93 cxgbe(4): Verify that the driver accesses the firmware mailbox in a
thread-safe manner.

MFC after:	3 days
2017-08-28 03:13:16 +00:00
Andriy Voskoboinyk
ac1b5d811f rtwn(4): deduplicate r92c_write_txpower(). 2017-08-27 13:02:51 +00:00
Andriy Voskoboinyk
5c7083ce99 rtwn(4): change type for Tx power values (RTL8192C / RTL8188EU).
Tx power values can easily fit into uint8_t + only 8 bits are written
to registers; values may overflow only in case if ROM contains
malformed data (but limit is checked anyway).

Tested with RTL8188CUS, dev.rtwn.1.debug=0x2000 (no changes).
2017-08-27 12:44:56 +00:00
Konstantin Belousov
c9dad45f69 Add PCI Id for MosChip MCS9900.
Submitted by:	Robert Clausecker <fuz@fuz.su>
PR:	214670
MFC after:	1 week
2017-08-27 11:37:07 +00:00
Scott Long
757ff64216 Start overhauling debug printing in the MPS and MPR drivers. The focus of this
commit it to make initiazation less chatty in the normal case, and more useful
and informative when real debugging is turned on.

Reviewed by:	ken (earlier version)
Sponsored by:	Netflix
2017-08-27 06:24:06 +00:00
Navdeep Parhar
7cb574039b cxgbe(4): Dump the mailbox contents in the same format as CH_DUMP_MBOX.
MFC after:	3 days
Sponsored by:	Chelsio Communications
2017-08-25 23:31:15 +00:00
Sean Bruno
7d0d648446 Add a different #define for the maximum number of transmit and
recieve descriptors for the igb(4) class of devices.  This will
allow a better definition for maximum going forward.  Some igb(4)
devices support more than the default 4K.

Reported by:	Jason (j@nitrology.com)
Sponsored by:	Limelight Networks
2017-08-25 22:38:55 +00:00
Warner Losh
030edcce02 Fill in reserved areas from NVMe spec in the IDENTIFY structure
(struct nvme_controller_data) as defined in the NVM Express
specification, revsion 1.3.

Sponsored by: Netflix
2017-08-25 21:38:43 +00:00
Warner Losh
696c950297 NVME Namespace ID is 32-bits, so widen interface to reflect that.
Sponsored by: Netflix
2017-08-25 21:38:38 +00:00
Warner Losh
223a9b93ac Add feature codes from NVMe 1.3 specification:
o Automomous Power State Transition
o Host Memory Buffer
o Timestamp
o Keep Alive Timer
o Host Controlled Thermal Management
o Non-Operational Power State Config

Also note that feature codes 0x78-0x7f are reserved for the NVMe
Management Interface.

Sponsored by: Netflix
2017-08-25 21:38:29 +00:00
Bruce Evans
f7eb827c48 Fix bugs in (mostly) not-yet-activated parts of early/emergency output:
- map the hard-coded frame buffer address above KERNBASE.  Using the
  physical address only worked because of larger mapping bugs.

  The hard-coded frame buffer address only works on x86.  Use messy ifdefs
  to try to avoid warnings about unused code for other arches.

- remove the sysctl for reading and writing the table kernel console
  attributes.  Writing only worked for emergency output since normal
  output uses unalterd copies.

- fix the test for the emergency console being usable

- explain why a hard-coded attribute is used very early.  Emergency output
  works on x86 even before the pcpu pointer is initialized.
2017-08-25 10:57:17 +00:00
Bruce Evans
9bc7c36337 Support setting the colors of cursors for the VGA renderer.
Advertise this by changing the defaults to mostly red.  If you don't like
this, change them (almost) back using:
   vidcontrol -c charcolors,base=7,height=0
   vidcontrol -c mousecolors,base=0[,height=15]

The (graphics mode only) mouse cursor colors were hard-coded to a black
border and lightwhite interior.  Black for the border is the worst
possible default, since it is the same as the default black background
and not good for any dark background.  Reversing this gives the better
default of X Windows.  Coloring everything works better still.  Now
the coloring defaults to a lightwhite border and red interior.

Coloring for the character cursor is more complicated and mode
dependent.  The new coloring doesn't apply for hardware cursors.  For
non-block cursors, it only applies in graphics mode.  In text mode,
the cursor color was usually a hard-coded (dull)white for the background
only, unless the foreground was white when it was a hard-coded black
for the background only, unless the foreground was white and the
background was black it was reverse video.  In graphics mode, it was
always reverse video for the block cursor.  Reverse video is worse,
especially over cutmarking regions, since cutmarking still uses simple
reverse video (nothing better is possible in text mode) and double
reverse video for the cursor gives normal video.  Now, graphics mode
uses the same algorithm as the best case for text mode in all cases
for graphics mode.  The hard-coded sequence { white, black, } for the
background is now { red, white, blue, } where the first 2 colors can
be configured.  The blue color at the end is a sentinel which prevents
reverse video being used in most cases but breaks the compatibility
setting for white on black and black on white characters.  This will
be fixed later.  The compatibility setting is most needed for mono modes.

The previous commit to syscons.c changed sc_cnterm() to be more careful.
It followed null pointers in some cases.  But sc_cnterm() has been
unreachable for 15+ years since changes for multiple consoles turned
off calls to the the cnterm destructor for all console drivers.  Before
them, it was only called at boot time.  So no driver with an attached
console has ever been unloadable and not even the non-console destructors
have been tested much.
2017-08-25 07:04:41 +00:00
Warner Losh
0012e436e3 Use _Static_assert
These files are compiled in userland too, so we can't use sys/systm.h
and rely on CTASSERT. Switch to using _Static_assert instead.

MFC After: 3 days
Sponsored by: Netflix
2017-08-25 04:33:06 +00:00
Warner Losh
0c26c1992f Sanity check sizes
Add compile time sanity checks to make sure that packed structures are
the proper size, typically as defined in the NVMe standard.
2017-08-25 04:05:53 +00:00
Warner Losh
abb61405a6 Enable bus mastering on the device before resetting the device. The
card has to do PCIe transactions to complete the reset process, but
can't do them, per the PCIe spec, unless bus mastering is enabled.

Submitted by: Kinjal Patel
PR: 22166
2017-08-25 03:15:18 +00:00
Bruce Evans
0c7a1e15ad Oops, the previous commit was missing 1 line. 2017-08-25 02:41:01 +00:00
Bruce Evans
7db291d201 Fix missing switching of the terminal emulator when switching the
terminal state for kernel console output.

r56043 in 2000 added many complications to support dynamic selection
of the terminal emulator using modules and the ioctl CONS_SETTERM.
This was never completed.  There are still no modules, but it is easy
to restore the scterm and dumb emulators at compile time.  Then
boot-time configuration for the preferred one doesn't work right, but
CONS_SETTERM almost works after fixing this bug.  CONS_SETTERM only
switches the emulator for the user state, leaving the kernel state(s)
still using the boot-time emulator.  The fix is especially important
when switching from sc to scteken, since the scteken state has pointers
in it.

Rename kernel_console_ts to sc_kts.
2017-08-25 02:37:32 +00:00
Eric Joyner
b82c9ba1c4 ixv(4): Add more robust mailbox API negotiation
The previous update to the driver to 3.2.12-k changed the VF's API version
to 1.2, but did not let the VF fall back to 1.1 or 1.0 versions. So, this
patch tries 1.2 first, then the older versions in succession if that fails.

This should allow the VF driver to negotiate 1.1 and work with older PF
drivers, such as the one used in Amazon's EC2 service.

PR:		220872
Submitted by:	Jeb Cramer <jeb.j.cramer@intel.com>
MFC after:	1 week
Sponsored by:	Intel Corporation
2017-08-24 22:56:22 +00:00
David C Somayajulu
b1c4d096e6 Fix qlnx_tso_check() so that every window of
(ETH_TX_LSO_WINDOW_BDS_NUM - nbds_in_hdr) has atleast
ETH_TX_LSO_WINDOW_MIN_LEN bytes

MFC after:5 days
2017-08-24 19:09:42 +00:00
Hans Petter Selasky
8ac4c959ab Compile fixes for LINT on 32-bit platforms.
MFC after:		2 weeks
Sponsored by:		Mellanox Technologies
2017-08-24 08:09:42 +00:00
Alexander Motin
b4af3e8a85 Add missing restart_queue initialization.
MFC after:	1 week
2017-08-23 19:00:06 +00:00
Hans Petter Selasky
1251590741 Add new mlx5ib(4) driver to the kernel source tree which supports
Remote DMA over Converged Ethernet, RoCE, for the ConnectX-4 series of
PCI express network cards.

There is currently no user-space support and this driver only supports
kernel side non-routable RoCE V1. The krping kernel module can be used
to test this driver. Full user-space support including RoCE V2 will be
added as part of the ongoing upgrade to ibcore from Linux 4.9. Otherwise
this driver is feature equivalent to mlx4ib(4). The mlx5ib(4) kernel
module will only be built when WITH_OFED=YES is specified.

MFC after:		2 weeks
Sponsored by:		Mellanox Technologies
2017-08-23 12:09:37 +00:00
David C Somayajulu
7fb518469e Upgrade FW to 5.4.66
sysctls to display stats, stats polled every 2 seconds
Modify QLA_LOCK()/QLA_UNLOCK() to not sleep after acquiring mtx_lock
Add support to turn OFF/ON error recovery following heartbeat failure for
debug purposes.
Set default max values to 32 Tx/Rx/SDS rings

MFC after:5 days
2017-08-21 20:27:45 +00:00
Bruce Evans
36e19a0f8c Fix setting of defaults for the text cursor.
There was already a per-vty defaults field, but it was useless since it was
only initialized when propagating the global settings and thus no different
from the current global settings and not per-vty.  The global defaults field
was also invariant after boot time, but not quite so useless.

Fix this by adding a second selection bit the the control flags of the
relevant ioctl().  vidcontrol doesn't support this yet.  Setting either
default propagates the change to the current setting for the same level
and then to all lower levels.

Improve the 3-way escape sequence used by termcap to control the cursor.
The "normal" (ve) case has always used reset, so the user could set
it to anything, but since the reset is to a global value this is not
very useful, especially since the "very visible" (vs) case doesn't
reset but inconsistently forces to a blinking block.  Change vs to
first reset and then XOR the blinking bit so that it is predictably
different from ve.
2017-08-19 23:13:33 +00:00
Bruce Evans
4ea1f4f5ea Rename curr_curs_attr to base_curr_attr. The actual current cursor
attribute field is curs_attr.  The base field holds user data translated
in a reversible way and is needed because current field holds this in
an irreversible way for efficiency.

Factor out some common code for the reversible translation.  This is
slightly simpler now, and much easier to expand.

Translate the magic flags value -1 to a single control flag internally
up front so other flags can be trusted later.  This can be used for the
relevant ioctl() too.

Remove CONS_CURSOR_FLAGS which contained all the control flags.  It was
unused and not useful.  After adding more flags, there will be tests on
a couple at a time but never on them all.  This API should have used this
to disallow unknown flags.
2017-08-19 21:40:42 +00:00
Bruce Evans
7692d200c1 Use better hard-coded defaults for the cursor shape, and remove nearby
redundant initializations.

Hard-code base = 0, height = (approx. 1/8 of the boot-time font height)
in all cases, and remove the BIOS/MD support for setting these values.
This asks for an underline cursor sized for the boot-time font instead
of various less hard-coded but worse values.  I used that think that
the x86 BIOS always gave the same values as the above hard-coding, but
on 1 of my systems it gives the wrong value of base = 1.

The remaining BIOS fields are shift_state and bell_pitch.  These are now
consistently not explicitly reinitialized to 0.  All sc_get_bios_value()
functions except x86's are now empty, and the only useful thing that x86
returns is shift_state.  This really belongs in atkbdc, but heavier
use of the BIOS to read the more useful typematic rate has been removed
there.  fb still makes much heavier use of the BIOS.
2017-08-19 19:33:16 +00:00
Andrew Turner
43f0edd4e7 Remove redundant declarations. Newer gcc has a warning for these so will
fail when building with -Werror.

Sponsored by:	DARPA, AFRL
2017-08-19 17:18:27 +00:00
Vladimir Kondratyev
76136d200d Add support for generic MS Windows 7/8/10-compatible USB HID touchscreens
found in many laptops.

Reviewed by:		hps, gonzo, bcr (manpages)
Approved by:		gonzo (mentor)
Differential Revision:	https://reviews.freebsd.org/D12017
2017-08-19 17:00:10 +00:00
Bruce Evans
15e0c6511a Fix syscons escape sequence for setting the local cursor type. This sequence
was aliased to a vt sequence, causing and fixing various bugs.

For syscons, this restores support for arg 2 which sets blinking block
too forcefully, and restores bugs for arg 0 and 1.  Arg 2 is used for
vs in the cons25 entry in termcap, but I've never noticed an application
that uses this.  The bugs involve replacing local settings by global
ones and need better handling of defaults to fix.

For vt, this requires moving the aliasing code from teken to vt where
it belongs.  This sequences is very important for cons25 compatibility
in vt since it is used by the cons25 termcap entries for ve, vi and
vs.  vt can't properly support vs for either cons25 or xterm since it
doesn't support blinking.  For xterm, the termcap entry for vs asks
for something different using 12;25h instead of 25h.

Rename C25CURS for this to C25LCT and change its description to be closer
to echoing the old comment about it.  CURS is too generic.

Fix missing syscons escape sequence for setting the global cursor shape
(and type).  Only support this in syscons since vt can't emulate anything
in it.
2017-08-18 15:40:40 +00:00
Bruce Evans
e4501d816b Fix vt100 escape sequence for showing and hiding the cursor in syscons.
It should toggle between 2 states, but it used a cut-down version of
support for a related 3-state syscons escape sequence and inherited
bugs from that.  The usual misbehaviour was that hiding and showing
the cursor reset it to a global default.

Support for the 3-state sequence remains broken by aliasing to the 2-state
sequence.  This works better but incompatibly for the 2 cases that it
supports.
2017-08-18 12:45:00 +00:00
Bruce Evans
dd833891de Fix missing syscons escape sequence for setting the border color. 2017-08-18 10:38:49 +00:00
Ryan Libby
19a9c3df5e safe: quiet -Wtautological-compare
Code was testing that an unsigned type was >= 0.

Reviewed by:	markj
Approved by:	markj (mentor)
Sponsored by:	Dell EMC Isilon
2017-08-18 08:05:33 +00:00
Bruce Evans
60e47915b4 Undeprecate the CONS_CURSORTYPE ioctl. It was "deprecated" in 2001,
but it was actually extended then and it is still used (just once) in
/usr/src by its primary user (vidcontrol), while its replacement is
still not used in /usr/src.

yokota became inactive soon after deprecating CONS_CURSORTYPE (this
was part of a large change to make cursor attributes per-vty).

vidcontrol has incomplete support even for the old ioctl.  I will
update it soon.  Then there are many broken escape sequences to fix.
This is just to prepare for setting cursor colors using vidcontrol.
2017-08-16 10:59:37 +00:00
Navdeep Parhar
b58fd65490 cxgbe/t4_tom: Use correct name for the ISS-valid bit in options2.
MFC after:	3 days
Sponsored by:	Chelsio Communications
2017-08-15 19:21:27 +00:00
Hans Petter Selasky
48a597ef59 Add new USB quirk.
Submitted by:		devel@stasyan.com
PR:			221328
MFC after:		1 week
Sponsored by:		Mellanox Technologies
2017-08-15 08:44:36 +00:00
Sepherosa Ziehau
93b4e111bb hyperv: Update copyright for the files changed in 2017
MFC after:	3 days
Sponsored by:	Microsoft
Differential Revision:	https://reviews.freebsd.org/D11982
2017-08-14 06:00:50 +00:00
Sepherosa Ziehau
d0cd8231e0 hyperv/hn: Re-set datapath after synthetic parts reattached.
Do this even for non-transparent mode VF. Better safe than sorry.

MFC after:	3 days
Sponsored by:	Microsoft
Differential Revision:	https://reviews.freebsd.org/D11981
2017-08-14 05:55:16 +00:00
Sepherosa Ziehau
c2d50b263f hyperv/hn: Minor cleanup
MFC after:	3 days
Sponsored by:	Microsoft
Differential Revision:	https://reviews.freebsd.org/D11979
2017-08-14 05:46:50 +00:00
Sepherosa Ziehau
a97fff1913 hyperv/hn: Fix/enhance receiving path when VF is activated.
- Update hn(4)'s stats properly for non-transparent mode VF.
- Allow BPF tapping to hn(4) for non-transparent mode VF.
- Don't setup mbuf hash, if 'options RSS' is set.
  In Azure, when VF is activated, TCP SYN and SYN|ACK go through hn(4)
  while the rest of segments and ACKs belonging to the same TCP 4-tuple
  go through the VF.  So don't setup mbuf hash, if a VF is activated
  and 'options RSS' is not enabled.  hn(4) and the VF may use neither
  the same RSS hash key nor the same RSS hash function, so the hash
  value for packets belonging to the same flow could be different!
- Disable LRO.
  hn(4) will only receive broadcast packets, multicast packets, TCP
  SYN and SYN|ACK (in Azure), LRO is useless for these packet types.
  For non-transparent, we definitely _cannot_ enable LRO at all, since
  the LRO flush will use hn(4) as the receiving interface; i.e.
  hn_ifp->if_input(hn_ifp, m).

While I'm here, remove unapplied comment and minor style change.

MFC after:	3 days
Sponsored by:	Microsoft
Differential Revision:	https://reviews.freebsd.org/D11978
2017-08-14 05:40:52 +00:00
Sepherosa Ziehau
3bed4e54f8 hyperv/hn: Update VF's ibytes properly under transparent VF mode.
While, I'm here add comment about why updating VF's imcast stat is
not necessary.

MFC after:	3 days
Sponsored by:	Microsoft
Differential Revision:	https://reviews.freebsd.org/D11948
2017-08-14 05:30:02 +00:00
Ian Lepore
a6e709f29c Add hinted attachment for non-FDT systems. Also, print a message if
setting up the timer fails, because on some types of chips that's the
first attempt to access the device.  If the chip is missing/non-responsive
then you'd get a driver that attached and didn't register the rtc, with
no clue about why.  On other chip types there are inits that come before
timer setup, and they already print messages about errors.
2017-08-14 02:23:10 +00:00
Ian Lepore
098f6cb6e6 Minor fixes and enhancements for the s35390a i2c RTC driver...
- Add FDT probe code.
- Do i2c transfers with exclusive bus ownership.
- Use config_intrhook_oneshot() to defer chip setup because some i2c
  busses can't do transfers without interrupts.
- Add a detach() routine.
- Add to module build.
2017-08-14 00:00:24 +00:00
Ian Lepore
90cff13c3c Remove the old ds1374 driver and use the ds13rtc driver instead. Adjust
several mips config files accordingly.
2017-08-13 22:07:42 +00:00
Ian Lepore
3777ed4378 Change "chiptype" to "compatible". Making the hint name the same as the FDT
property name should make it easier to document the list of names accepted
by both configuration mechanisms.
2017-08-13 21:45:46 +00:00
Ian Lepore
bb2e8108e1 Add a new driver, ds13rtc, that handles all DS13xx series i2c RTC chips.
This driver supports only basic timekeeping functionality.  It completely
replaces the ds133x driver.  It can also replace the ds1374 driver, but that
will take a few other changes in MIPS code and config, and will be committed
separately.  It does NOT replace the existing ds1307 driver, which provides
access to some of the extended features on the 1307 chip, such as controlling
the square wave output signal.  If both ds1307 and ds13rtc drivers are
present, the ds1307 driver will outbid and win control of the device.

This driver can be configured with FDT data, or by using hints on non-FDT
systems.  In addition to the standard hints for i2c devices, it requires
a "chiptype" string of the form "dallas,ds13xx" where 'xx' is the chip id
(i.e., the same format as FDT compat strings).
2017-08-13 21:02:40 +00:00
Nathan Whitehorn
c670f31f19 Move NVME controller shutdown from being called as part of module unloading
to being called through the newbus DEVICE_SHUTDOWN() path. This ensures that
the NVME controller gets shut down before the device and bus disappear
and prevents data corruption on shutdown on at least Samsung EVO 960 SSDs.

PR:		kern/211852
Reviewed by:	imp
MFC after:	2 weeks
2017-08-12 22:13:06 +00:00
Ian Lepore
4541b9aab6 Bid for the device with BUS_PROBE_GENERIC, because this is very much a
generic driver with minimal feature support for a large number of chips.
More featureful per-chip drivers might exist (especially out-of-tree) and
those should win the bidding even if they use BUS_PROBE_DEFAULT.
2017-08-12 17:39:32 +00:00
Navdeep Parhar
5d973bad2a cxgbe(4): Save the last reported link parameters and compare them with
the current state to determine whether to generate a link-state change
notification.  This fixes a bug introduced in r321063 that caused the
driver to sometimes skip these notifications.

Reported by:	Jason Eggleston @ LLNW
MFC after:	3 days
Sponsored by:	Chelsio Communications
2017-08-12 14:02:19 +00:00
Ian Lepore
c82d887d47 Stop calling atrtc_set() from the xen timer clock_settime() method. That
removes the only reference to atrtc_set() from outside of atrtc.c, so make
it static.

The xen timer driver registers as a realtime clock with 1us resolution.  In
the past that resulted in only the xen timer's clock_settime() getting
called, so it would call atrtc_set() to set the hardware clock as well.  As
of r32090, the clock_settime() method of all registered realtime clocks gets
called, so the xen driver no longer needs to chain-call the lower-resolution
driver.

Thanks to royger@ for talking me through the xen stuff, and for testing.
2017-08-11 19:02:11 +00:00
David C Somayajulu
45f1312387 Performance enhancements to reduce CPU utililization for large number of
TCP connections (order of tens of thousands), with predominantly Transmits.

Choice to perform receive operations either in IThread or Taskqueue Thread.

Submitted by:Vaishali.Kulkarni@cavium.com
MFC after:5 days
2017-08-11 17:43:25 +00:00
Kenneth D. Merry
6d4ffcb4ac Changes to make mps(4) and mpr(4) handle reinit with reallocation.
When the mps(4) and mpr(4) drivers need to reinitialize the
firmware, they sometimes need to reallocate all of the memory
allocated by the driver.  The reallocation happens whenever the IOC
Facts change.  That should only happen after a firmware upgrade.

If the reinitialization happens as a result of a timed out command
sent to the card, the command that timed out and triggered the
reinit may have been freed if iocfacts_allocate() reallocated all
memory.  If the caller attempts to access the command after that,
the kernel will panic because the caller will be dereferencing
freed memory.

The solution is to set a flag in the softc when we reallocate,
and avoid dereferencing the command strucure if we've reallocated.

The changes are largely the same in both drivers, since mpr(4) is a
derivative of mps(4).

 o In iocfacts_allocate(), if the IOC Facts have changed and we
   need to reallocate, set the REALLOCATED flag in the softc.

 o Change wait_command() to take a struct mps_command ** instead of
   a struct mps_command *.  This allows us to NULL out the caller's
   command pointer if we have to reinit the controller and the data
   structures get reallocated.  (The REALLOCATED flag will be set
   in the softc if that has happened.)

 o In every place that calls wait_command(), make sure we handle
   the case where the command is NULL after the call.

 o The mpr(4) driver has mpr_request_polled() which can also
   reinitialize the card.  Also check for reallocation there.

Reviewed by:	scottl, slm
MFC after:	1 week
Sponsored by:	Spectra Logic
2017-08-10 14:59:17 +00:00
Sean Bruno
5f593927a8 Purge deprecated locking macros.
Submitted by:	Matt Macy <matt@mattmacy.io>
Sponsored by:	Limelight Networks
2017-08-10 14:54:36 +00:00
Marcin Wojtas
e2b9d20234 Enable OF_setprop API function to add property in FDT
This patch modifies function ofw_fdt_setprop (called by OF_setprop),
so that it can add property, when replacing is not possible.
Adding property is needed to fixup FDT's that have missing
properties.

Submitted by: Patryk Duda <pdk@semihalf.com>
Reviewed by: nwhitehorn, cognet (mentor)
Approved by: cognet (mentor)
Obtained from: Semihalf
Differential Revision: https://reviews.freebsd.org/D11879
2017-08-10 13:45:56 +00:00
David C Somayajulu
b284b46dc4 Provide compile to choose receive processing in either Ithread or Taskqueue Thread. 2017-08-09 22:18:49 +00:00
Alexander Motin
2b2a6eb95e Missing remanant of 322309.
MFC after:	1 week
2017-08-09 13:46:16 +00:00
Alexander Motin
6750c3d0fa Use "Ibex Peak" codename for "5 Series/3400 Series" chipsets.
This is shorter and unifies naming with later chipsets.

MFC after:	1 week
2017-08-09 12:21:17 +00:00
Alexander Motin
aaa9b2b3f3 Add new Intel Lewisburg and Union Point chipset PCI IDs.
While there, polish some old AHCI ones, since they are still reused.

MFC after:	1 week
2017-08-09 12:03:12 +00:00
Hans Petter Selasky
768a720e95 Print maximum MTU when trying to set invalid MTU in the mlx4en(4) driver.
Useful for debugging.

Submitted by:		Sepherosa Ziehau <sephe@dragonflybsd.org>
MFC after:		3 days
Sponsored by:		Mellanox Technologies
2017-08-09 10:32:51 +00:00
Hans Petter Selasky
a3d0173d98 Increment queue drops in the network statistics when transmitted packets
are dropped by the mlx4en(4) driver.

Submitted by:		Sepherosa Ziehau <sephe@dragonflybsd.org>
MFC after:		3 days
Sponsored by:		Mellanox Technologies
2017-08-09 10:30:55 +00:00
Hans Petter Selasky
f7833544f1 Add support for RX and TX statistics when the mlx4en(4) PCI device
is in VF or SRIOV mode typically in a virtual machine environment.

Submitted by:		Sepherosa Ziehau <sephe@dragonflybsd.org>
MFC after:		3 days
Sponsored by:		Mellanox Technologies
2017-08-09 10:27:21 +00:00
Sepherosa Ziehau
9c6cae2431 hyperv/hn: Implement transparent mode network VF.
How network VF works with hn(4) on Hyper-V in transparent mode:

- Each network VF has a cooresponding hn(4).
- The network VF and the it's cooresponding hn(4) have the same hardware
  address.
- Once the network VF is attached, the cooresponding hn(4) waits several
  seconds to make sure that the network VF attach routing completes, then:
  o  Set the intersection of the network VF's if_capabilities and the
     cooresponding hn(4)'s if_capabilities to the cooresponding hn(4)'s
     if_capabilities.  And adjust the cooresponding hn(4) if_capable and
     if_hwassist accordingly. (*)
  o  Make sure that the cooresponding hn(4)'s TSO parameters meet the
     constraints posed by both the network VF and the cooresponding hn(4).
     (*)
  o  The network VF's if_input is overridden.  The overriding if_input
     changes the input packet's rcvif to the cooreponding hn(4).  The
     network layers are tricked into thinking that all packets are
     neceived by the cooresponding hn(4).
  o  If the cooresponding hn(4) was brought up, bring up the network VF.
     The transmission dispatched to the cooresponding hn(4) are
     redispatched to the network VF.
  o  Bringing down the cooresponding hn(4) also brings down the network
     VF.
  o  All IOCTLs issued to the cooresponding hn(4) are pass-through'ed to
     the network VF; the cooresponding hn(4) changes its internal state
     if necessary.
  o  The media status of the cooresponding hn(4) solely relies on the
     network VF.
  o  If there are multicast filters on the cooresponding hn(4), allmulti
     will be enabled on the network VF. (**)
- Once the network VF is detached.  Undo all damages did to the
  cooresponding hn(4) in the above item.

NOTE:
No operation should be issued directly to the network VF, if the
network VF transparent mode is enabled.  The network VF transparent mode
can be enabled by setting tunable hw.hn.vf_transparent to 1.  The network
VF transparent mode is _not_ enabled by default, as of this commit.

The benefit of the network VF transparent mode is that the network VF
attachment and detachment are transparent to all network layers; e.g. live
migration detaches and reattaches the network VF.

The major drawbacks of the network VF transparent mode:
- The netmap(4) support is lost, even if the VF supports it.
- ALTQ does not work, since if_start method cannot be properly supported.

(*)
These decisions were made so that things will not be messed up too much
during the transition period.

(**)
This does _not_ need to go through the fancy multicast filter management
stuffs like what vlan(4) has, at least currently:
- As of this write, multicast does not work in Azure.
- As of this write, multicast packets go through the cooresponding hn(4).

MFC after:	3 days
Sponsored by:	Microsoft
Differential Revision:	https://reviews.freebsd.org/D11803
2017-08-09 05:59:45 +00:00
Marcin Wojtas
edf3dd3b0a Enable using ofw_bus_find_compatible in early platform code
Before this patch function ofw_bus_find_compatible was using
memory allocations in order to find compatible node and the property's
length. This way there was always a suited buffer for property,
however this approach had also disadvantages - ofw_bus_find_compatible
couldn't be used when malloc is not available, e.g. during fdt fixup stage.

In order to remove the usage limitation of ofw_bus_find_compatible(),
this patch modifies the function to use ofw_bus_node_is_compatible()
(instead of the one without _int suffix), which uses a fixed
buffer on stack instead of dynamic allocations.

Submitted by: Patryk Duda <pdk@semihalf.com>
Reviewed by: nwhitehorn, cognet (mentor)
Approved by: cognet (mentor)
Obtained from: Semihalf
Differential Revision: https://reviews.freebsd.org/D11880
2017-08-09 01:06:40 +00:00
Marcin Wojtas
a355bb8846 Add support for "compatible" parameter in ofw_fdt_fixup
Sometimes it's convenient to provide fixup to many boards
that use the same SoC family (eg. Marvell Armada 38x).
Instead of putting multiple entries in fdt_fixup_table,
use one entry which refers to all boards with given SoC.

Submitted by: Patryk Duda <pdk@semihalf.com>
Reviewed by: nwhitehorn, cognet (mentor)
Approved by: cognet (mentor)
Obtained from: Semihalf
Differential Revision: https://reviews.freebsd.org/D11878
2017-08-09 00:56:29 +00:00
Marcin Wojtas
bfd084c8c4 Enable parsing simple-bus 'ranges' with multiple entries
This patch makes possible to boot with up to 8 ranges in soc.
Dynamic allocation cannot be used, because ftd_get_ranges
function is called early, when malloc is not available.

Change is required for the alignment of Marvell Armada 38x
device trees present in sys/gnu/dts/arm - originally
the platform has 6 entries in simple-bus 'ranges'.

Submitted by: Patryk Duda <pdk@semihalf.com>
Reviewed by: manu, nwhitehorn, cognet (mentor)
Approved by: cognet (mentor)
Obtained from: Semihalf
Differential Revision: https://reviews.freebsd.org/D11876
2017-08-09 00:45:25 +00:00
Warner Losh
5b896b567d Turns out to be even simpler to just not create /dev/efi if we don't
have a efi runtime.
2017-08-08 21:01:11 +00:00
Warner Losh
9057f54d74 Fail to open efirt device when no EFI on system.
libefivar expects opening /dev/efi to indicate if the we can make efi
runtime calls. With a null routine, it was always succeeding leading
efi_variables_supported() to return the wrong value. Only succeed if
we have an efi_runtime table. Also, while I'm hear, out of an
abundance of caution, add a likely redundant check to make sure
efi_systbl is not NULL before dereferencing it. I know it can't be
NULL if efi_cfgtbl is non-NULL, but the compiler doesn't.
2017-08-08 20:44:16 +00:00
John Baldwin
d081dfc7cd Fix a NULL pointer dereference in mly_user_command().
If mly_user_command fails to allocate a command slot it jumps to an 'out'
label used for error handling.  The error handling code checks for a data
buffer in 'mc->mc_data' to free before checking if 'mc' is NULL.  Fix by
just returning directly if we fail to allocate a command and only using
the 'out' label for subsequent errors when there is actual cleanup to
perform.

PR:		217747
Reported by:	PVS-Studio
Reviewed by:	emaste
MFC after:	1 week
2017-08-08 17:49:57 +00:00
Warner Losh
d0e75394cf Use the correct queue depth for nda devices.
Submitted by: Matt Williams
2017-08-08 16:06:16 +00:00
Konstantin Belousov
16997138d3 Fix logic error in the the assert, causing the condition to be always true.
Also improve the formatting of the corresponding KASSERT message.

Based on the submission by:	Svyatoslav <razmyslov@viva64.com>
Found by:	PVS-Studio
PR:	217741
Reviewed by:	emaste
Sponsored by:	The FreeBSD Foundation (kib)
MFC after:	1 week
2017-08-08 15:46:29 +00:00
Michael Gmelin
9c52035814 Fix typo in cyapa out of bounds check.
PR:		217783
Submitted by:	razmyslov@viva64.com
MFC after:	1 week
2017-08-08 13:27:32 +00:00
Hans Petter Selasky
8508e4d730 Make sure the received IP header gets 32-bit aligned for short packets
in the mlx5en(4) driver.

MFC after:		1 week
Sponsored by:		Mellanox Technologies
2017-08-08 11:49:36 +00:00
Hans Petter Selasky
869dd4b498 Count drop events due to lack of PCI bandwidth as queue drops and not as
input errors in the mlx5en(4) driver. This improves the sysadmin view of
physical port errors.

Submitted by:		gallatin@
MFC after:		1 week
Sponsored by:		Mellanox Technologies
2017-08-08 11:36:57 +00:00
Hans Petter Selasky
1a59bf5f7a Fix for mlx4en(4) to properly call m_defrag().
The m_defrag() function can only defrag mbuf chains which have a valid
mbuf packet header. In r291699 when the mlx4en(4) driver was converted
into using BUSDMA(9), the call to m_defrag() was moved after the part
of the transmit routine which strips the header from the mbuf chain.
This effectivly disabled the mbuf defrag mechanism and such packets
simply got dropped.

This patch removes the stripping of mbufs from a chain and loads all
mbufs using busdma. If busdma finds there are no segments, unload
the DMA map and free the mbuf right away, because that means all
data in the mbuf has been inlined in the TX ring. Else proceed
as usual.

Add a per-ring rounter for the number of defrag attempts and
make sure the oversized_packets counter gets zeroed while at it.

The counters are per-ring to avoid excessive cache misses in the
TX path.

Submitted by:		mjoras@
Differential Revision:	https://reviews.freebsd.org/D11683
MFC after:		1 week
Sponsored by:		Mellanox Technologies
2017-08-08 11:35:02 +00:00
Marius Strobl
79f39c6aa1 - If available, use TRIM instead of ERASE for implementing BIO_DELETE.
This also involves adding a quirk table as TRIM is broken for some
  Kingston eMMC devices, though. Compared to ERASE (declared "legacy"
  in the eMMC specification v5.1), TRIM has the advantage of operating
  on write sectors rather than on erase sectors, which typically are
  of a much larger size. Thus, employing TRIM, we don't need to fiddle
  with coalescing BIO_DELETE requests that are also of (write) sector
  units into erase sectors, which might not even add up in all cases.
- For some SanDisk iNAND devices, the CMD38 argument, e. g. ERASE,
  TRIM etc., has to be specified via EXT_CSD[113], which now is also
  handled via a quirk.
- My initial understanding was that for eMMC partitions, the granularity
  should be used as erase sector size, e. g. 128 KB for boot partitions.
  However, rereading the relevant parts of the eMMC specification v5.1,
  this isn't actually correct. So drop the code which used partition
  granularities for delmaxsize and stripesize. For the most part, this
  change is a NOP, though, because a) for ERASE, mmcsd_delete() used
  the erase sector size unconditionally for all partitions anyway and
  b) g_disk_limit() doesn't actually take the stripesize into account.
- Take some more advantage of mmcsd_errmsg() in mmcsd(4) for making
  error codes human readable.
2017-08-07 23:33:05 +00:00
Ruslan Bukin
ca20f8ec29 o Replace __riscv__ with __riscv
o Replace __riscv64 with (__riscv && __riscv_xlen == 64)

This is required to support new GCC 7.1 compiler.
This is compatible with current GCC 6.1 compiler.

RISC-V is extensible ISA and the idea here is to have built-in define
per each extension, so together with __riscv we will have some subset
of these as well (depending on -march string passed to compiler):

__riscv_compressed
__riscv_atomic
__riscv_mul
__riscv_div
__riscv_muldiv
__riscv_fdiv
__riscv_fsqrt
__riscv_float_abi_soft
__riscv_float_abi_single
__riscv_float_abi_double
__riscv_cmodel_medlow
__riscv_cmodel_medany
__riscv_cmodel_pic
__riscv_xlen

Reviewed by:	ngie
Sponsored by:	DARPA, AFRL
Differential Revision:	https://reviews.freebsd.org/D11901
2017-08-07 14:09:57 +00:00
Navdeep Parhar
cc2050c5eb cxgbe(4): Avoid a NULL dereference that would occur during module unload
if there were problems earlier during attach.

MFC after:	3 days
Sponsored by:	Chelsio Communications
2017-08-06 19:45:59 +00:00
Navdeep Parhar
019c1a0111 cxgbe(4): Allow the TOE timer tunables to be set with microsecond
precision.  These timers are already displayed in microseconds in the
sysctl MIB.  Add variables to track these tunables while here.

MFC after:	3 days
Sponsored by:	Chelsio Communications
2017-08-04 15:57:10 +00:00
Warner Losh
8a5d94f94d Make nvd vs nda choice boot-time rather than build-time
Introduce hw.nvme.use_nvd tunable. This tunable allows both nvd and
nda to be installed in the kernel, while allowing only one of them to
create devices. This is an all-or-nothing setting, and you can't
change it after boot-time. However, it will allow easier A/B testing.

Differential Revision: https://reviews.freebsd.org/D11825
2017-08-04 03:40:01 +00:00
Navdeep Parhar
6320b0f850 cxgbe(4): Always use the first and not the last virtual interface
associated with a port in begin_synchronized_op.

MFC after:	3 days
Sponsored by:	Chelsio Communications
2017-08-04 01:28:06 +00:00
Navdeep Parhar
f856f099cb cxgbe(4): Initial import of the "collect" component of Chelsio unified
debug (cudbg) code, hooked up to the main driver via an ioctl.

The ioctl can be used to collect the chip's internal state in a
compressed dump file.  These dumps can be decoded with the "view"
component of cudbg.

Obtained from:	Chelsio Communications
MFC after:	2 months
Sponsored by:	Chelsio Communications
2017-08-03 14:43:30 +00:00
Hans Petter Selasky
713dd5cb9e Resolve locking issue for non-sleepable context in the mlx5core.
Code inspection reveals the busdma unload and free functions
do not write to the belonging dma tag and does not need to be
serialized. This allows mlx5_fwp_free() to be called from
software interrupt context.

MFC after:	3 days
Sponsored by:	Mellanox Technologies
2017-08-03 09:14:43 +00:00
Hans Petter Selasky
1d4905b5b0 Using GFP_ATOMIC with firmware commands is not supported after busdma was
introduced in the mlx5core, because busdma might sleep when loading memory
into DMA.

MFC after:	3 days
Sponsored by:	Mellanox Technologies
2017-08-03 09:11:51 +00:00
Mark Johnston
069555390b Remove D_TRACKCLOSE now that ksyms no longer has a close method.
Reported by:	jhb
X-MFC with:	r321963
2017-08-03 05:55:01 +00:00
Sepherosa Ziehau
fe167cce54 hyperv/kvp: Use proper size macro for adapter id.
Submitted by:	Christopher Ertl <Christopher.Ertl microsoft com>
MFC after:	3 days
Sponsored by:	Microsoft
2017-08-03 01:44:40 +00:00
Mark Johnston
22e406c80b Rework and simplify the ksyms(4) implementation.
- Store the symbol table contents in an anonymous swap-backed object. Have
  mmap(/dev/ksyms) map that object, and stop mapping the symbol table into
  the calling process in ksyms_open(). Previously we would cache a pointer
  to the pmap of the opening process, and mmap(/dev/ksyms) would create a
  mapping using the physical address found by a pmap lookup at the initial
  mapping address. However, this assumes that the cached pmap is valid,
  which may not be the case. [1]
- Remove the ksyms ioctl interface. It appears to have been added to work
  around a limitation in libelf that no longer exists; see r321842.
  Moreover, the interface is difficult to support and isn't present in
  illumos. Since ksyms was added specifically to support lockstat(1), it
  is expected that this removal won't have any real impact.
- Simplify ksyms_read() to avoid unnecessary copying.
- Don't call the device handle destructor if we fail to capture a snapshot
  of the kernel's symbol table. devfs will do that for us.

Reported by:	Ilja van Sprundel <ivansprundel@ioactive.com> [1]
Reviewed by:	kib (previous revision)
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D11789
2017-08-03 00:38:13 +00:00
Marius Strobl
cd85acba1a - Correct the remainder of confusing and error prone mix-ups between
"br" or "bridge" where - according to the terminology outlined in
  comments of bridge.h and mmcbr_if.m  around since their addition in
  r163516 - the bus is meant and used instead. Some of these instances
  are also rather old, while those in e. g. mmc_subr.c are as new as
  r315430 and were caused by choosing mmc_wait_for_request(), i. e. the
  one pre-r315430 outliner existing in mmc.c, as template for function
  parameters in mmc_subr.c inadvertently. This correction translates to
  renaming "brdev" to "busdev" and "mmcbr" to "mmcbus" respectively as
  appropriate.
  While at it, also rename "reqdev" to just "dev" in mmc_subr.[c,h]
  for consistency with was already used in mmm.c pre-r315430, again
  modulo mmc_wait_for_request() that is.
- Remove comment lines from bridge.h incorrectly suggesting that there
  would be a MMC bridge base class driver.
- Update comments in bridge.h regarding the star topology of SD and SDIO;
  since version 3.00 of the SDHCI specification, for eSD and eSDIO bus
  topologies are actually possible in form of so called "shared buses"
  (in some subcontext later on renamed to "embedded" buses).
2017-08-02 21:11:51 +00:00
Roger Pau Monné
d4ed36cde2 pci: fix write order when sizing BARs
According to the PCI Local Specification rev. 3.0 in case of a 64-bit
BAR both the low and the high parts of the register should be set to
~0 before attempting to read back the size.

So far I have found no single device that has problems with the
previous approach, but I think it's better to stay on the safe size.

This commit should not introduce any functional change.

MFC after:		3 weeks
Sponsored by:		Citrix Systems R&D
Reviewed by:		jhb
Differential revision:	https://reviews.freebsd.org/D11750
2017-08-01 10:47:44 +00:00
Alexander Motin
40715e9ed7 Add explicit check for PCI bus to r321720.
Reported by:	jhb
MFC after:	6 days
2017-08-01 09:22:10 +00:00
Ian Lepore
94759a2448 Add a driver for the Intersil ISL12xx family of i2c RTC chips.
Supports ISL1209, ISL1218, ISL1219, ISL1220, ISL1221 (just basic RTC
functionality, not all the other fancy stuff the chips can do).
2017-08-01 04:16:52 +00:00
Sepherosa Ziehau
f41e0df406 hyperv/hn: Add comment about ether_ifattach event subscription.
MFC after:	3 days
Sponsored by:	Microsoft
Differential Revision:	https://reviews.freebsd.org/D11710
2017-08-01 02:55:43 +00:00
Sepherosa Ziehau
962f035786 hyperv/hn: Renaming and minor cleanup
This prepares for the upcoming transparent VF support.

MFC after:	3 days
Sponsored by:	Microsoft
Differential Revision:	https://reviews.freebsd.org/D11708
2017-08-01 02:45:54 +00:00
Ian Lepore
012e41a7a8 Bugfixes and enhancements...
Don't enable the oscillator when it is found to be stopped at init time,
just let the first setting of valid time start it.  But still report a dead
battery if it's stopped at init time.

Don't force the chip into 24hr mode, just cope with whatever mode it is
already in.

Schedule the clock_settime() callbacks to align the RTC clock to top of
second when setting it.
2017-07-31 22:00:00 +00:00
Ian Lepore
13fd9ff767 No need to call getnanotime() now that the waiting is done by the central
subr_rtc code, switch from CLOCKF_SETTIME_NO_TS to CLOCKF_SETTIME_NO_ADJ
so that we get fed a timestamp, but it's not adjusted to compensate for
inaccuracy in setting time.
2017-07-31 21:53:00 +00:00
Scott Long
2068b2aa88 Fix a logic bug in the split PCI interrupt code that slipped through
Reported by:	Harry Schmalzbauer
2017-07-31 16:55:56 +00:00
Ian Lepore
def6c0c3ee Restore a few rather important lines of code that got fumbled in r321746. 2017-07-31 16:46:16 +00:00
Ian Lepore
bf9c1267f3 Check the clock-halted flag every time the clock is read, not just once
at startup.  The flag stays set until the clock is loaded with good time,
so we need to keep saying the time is invalid until that happens.
2017-07-31 15:24:40 +00:00
Ian Lepore
ccf32b9887 Add a detach() method. 2017-07-31 14:58:01 +00:00
Ian Lepore
cf24e991a6 Switch from using iic_transfer() to iicdev_readfrom/writeto(), mostly so
that transfers will be done with proper ownership of the bus. No
behavioral changes.  Also add a detach() method.
2017-07-31 14:57:02 +00:00
Hans Petter Selasky
3f38293d29 Remove some dead statistics related code and a structure field from the
mlx4en driver which is used by its Linux counterpart, but not under
FreeBSD.

Sponsored by:	Mellanox Technologies
MFC after:	1 week
2017-07-31 12:09:24 +00:00
Hans Petter Selasky
f40410e868 Make sure on-stack buffer is properly aligned.
Sponsored by:	Mellanox Technologies
MFC after:	1 week
2017-07-31 12:03:45 +00:00
Hans Petter Selasky
b0259ad374 Fix broken usage of the mlx4_read_clock() function:
- return value has too small width
 - cycle_t is unsigned and cannot be less than zero

Sponsored by:	Mellanox Technologies
MFC after:	1 week
2017-07-31 09:15:15 +00:00
Ian Lepore
4c0c8a36da Remove now-unused variable. 2017-07-31 03:19:16 +00:00
Ian Lepore
02d094ff04 Use the new clock_schedule() to arrange for clock_settime() to be called
at the right time to keep the RTC hardware time in sync, instead of using
pause_sbt() to sleep until the right time.
2017-07-31 01:36:51 +00:00
Scott Long
b618318ae3 Don't re-parse PCI IDs in order to set card-specific flags, use
the flags field in the PCIID table.
2017-07-31 00:05:49 +00:00
Andriy Voskoboinyk
9dba612805 rtwn_usb: add support for fragmented Rx.
Since device can pass multiple frames in a single payload temporary
Rx buffer was big enough to hold all of them; now the driver can
concatenate a single frame from multiple payloads.

The Rx buffer size may be configured via tunable (dev.rtwn.%d.rx_buf_size).

Tested with:
 - rtl8188cus, rtl8188eu and rtl8821au (STA mode).
 - (by kevlo) rtl8192cu and rtl8188eu.

PR:		218527
Reviewed by:	kevlo
Differential Revision:	https://reviews.freebsd.org/D11705
2017-07-30 23:35:21 +00:00
Scott Long
055e2653d4 Change from using underbar function names to normal function names for
the informational print functions.  Collapse the debug API a bit to be
more generic and not require as much code duplication.  While here, fix
a bug in MPS that was already fixed in MPR.
2017-07-30 22:34:24 +00:00
Andriy Voskoboinyk
a08e9300f3 zyd: code cleanup + drop unneeded cast.
No functional change intended.
2017-07-30 22:17:08 +00:00
Andriy Voskoboinyk
ff97f477b9 rtwn: drop unnecessary / wrong conversion.
The 'chan' field occupies only one byte.
2017-07-30 21:50:45 +00:00
Ian Lepore
2e639013ed Fix AM/PM mode handling. The bits to mask off in the hours register changes
between 12/24 hour mode.  Also fix conversion between 12 and 24 hour mode.
It's not as easy as adding/subtracting 12, because the clock doesn't roll
over 11->0, it rolls over 12->1; 0 isn't a valid hour in AM/PM mode.
2017-07-30 19:58:31 +00:00
Ian Lepore
d0462804d4 Bugfixes and enhancements...
Don't enable the oscillator when it is found to be stopped at init time,
just let the first setting of valid time start it.  But still report a dead
battery if it's stopped at init time.

Don't force the chip into 24hr mode, just cope with whatever mode it is
already in.

Align the RTC clock to top of second when setting it.
2017-07-30 18:46:38 +00:00
Hans Petter Selasky
bd9175e1aa Properly range check length of parsed information elements in RSU driver.
Found by:		Ilja van Sprundel <ivansprundel@ioactive.com>
MFC after:		3 days
Sponsored by:		Mellanox Technologies
2017-07-30 16:45:28 +00:00
Ian Lepore
723a81dec6 Switch from using iic_transfer() to iicdev_readfrom/writeto(), mostly so
that transfers will be done with proper ownership of the bus. No
behavioral changes.
2017-07-30 16:17:06 +00:00
Alexander Motin
26567f6924 Attach ichwd(4) only to ISA bus of the LPC bridge.
Resource allocation for parent device does not look good by itself, but
attempt to allocate them for unrelated device just does not end up good.
On Asus X99-E WS/USB3.1 system reporting ISA bridge via both PCI and ACPI
this reported to cause kernel panic on shutdown due to messed resources:
https://bugs.freenas.org/issues/25237.

MFC after:	1 week
2017-07-30 15:19:07 +00:00
Scott Long
252b2b4f4f Split the interrupt setup code into two parts: allocation and configuration.
Do the allocation before requesting the IOCFacts message.  This triggers
    the LSI firmware to recognize the multiqueue should be enabled if available.
    Multiqueue isn't used by the driver yet, but this also fixes a problem with
    the cached IOCFacts not matching latter checks, leading to potential problems
    with error recovery.

    As a side-effect, fetch the driver tunables as early as possible.

Reviewed by:	slm
Obtained from:	Netflix
Differential Revision:	D9243
2017-07-30 06:53:58 +00:00
Ian Lepore
e25f1cf5be Fix building this driver on non-FDT platforms. 2017-07-30 00:00:30 +00:00
Ian Lepore
207fe81ea8 Replace the pcf8563 i2c RTC driver with a new nxprtc driver which handles
all the chips in the NXP PCA212x and PCA/PCF85xx series.  In addition to
supporting more chips, this driver uses the countdown timer on the chips as
a fractional seconds counter, giving it a resolution of about 15 milliseconds.
2017-07-29 23:45:57 +00:00
Ian Lepore
d35f6548e6 Add inline functions to convert between sbintime_t and decimal time units.
Use them in some existing code that is vulnerable to roundoff errors.

The existing constant SBT_1NS is a honeypot, luring unsuspecting folks into
writing code such as long_timeout_ns*SBT_1NS to generate the argument for a
sleep call.  The actual value of 1ns in sbt units is ~4.3, leading to a
large roundoff error giving a shorter sleep than expected when multiplying
by the trucated value of 4 in SBT_1NS.  (The evil honeypot aspect becomes
clear after you waste a whole day figuring out why your sleeps return early.)
2017-07-29 17:00:23 +00:00
Kristof Provost
83699dfd09 vtnet: Support jumbo frames without TSO/GSO
Currently in Virtio driver without TSO/GSO features enabled, the max scatter
gather segments for the TX path can be 4, which limits the support for 9K JUMBO
frames. 9K JUMBO frames results in more than 4 scatter gather segments and
virtio driver fails to send the frame down to host OS. With TSO/GSO feature
enabled max scatter gather segments can be 64, then 9K JUMBO frames are fine,
this is making virtio driver to support JUMBO frames only with TSO/GSO.

Increasing the VTNET_MIN_TX_SEGS which is the case for non TSO/GSO to 32 to
support upto 64K JUMBO frames to Host.

Submitted by:	Lohith Bellad <lohithbsd@gmail.com>
Reviewed by:	adrian
Differential Revision:	https://reviews.freebsd.org/D8803
2017-07-29 09:22:48 +00:00
Navdeep Parhar
f8d0488ec6 cxgbe/iw_cxgbe: Log the end point's history and flags to the trace
buffer just before it's freed.

MFC after:	1 week
Sponsored by:	Chelsio Communications
2017-07-28 22:28:45 +00:00
Jung-uk Kim
5f9b24fa43 Merge ACPICA 20170728. 2017-07-28 22:23:29 +00:00
Mark Johnston
1e16346226 Fix style bugs in ksyms.c.
No functional change intended.

MFC after:	3 days
2017-07-28 03:18:18 +00:00
Mark Johnston
7c86ae1a00 Restrict permissions on /dev/ksyms to 0400.
The ksyms(4) device was added specifically for use by lockstat(1), which
as a DTrace consumer must run as root.

Discussed with:	emaste
MFC after:	3 days
2017-07-28 03:14:31 +00:00
Sean Bruno
b7e0bde0af Drop IXL RX lock during TCP_LRO, fixes LOR mahem while holding the RX
queue lock when the uppoer stack is called inside TCP_LRO

Submitted by:	Kevin Bowling <kevin.bowling@kev009.com>
Reviewed by:	erj
Sponsored by:	Limelight Networks
Differential Revision:	https://reviews.freebsd.org/D11724
2017-07-27 23:01:07 +00:00
Sean Bruno
9bc7588cb6 Deprecate unused int isc_max_txqsets and int isc_max_rxqsets as they
were redundant and not being used to set anything up.

Submitted by:	Matt Macy <mmacy@mattmacy.io>
Reported by:	Jeb Cramer <cramerj@intel.com>
Sponsored by:	Limelight Networks
2017-07-27 21:21:43 +00:00
Kenneth D. Merry
fefd924a01 Remove duplicate assignments from r321622.
Submitted by:	mav
MFC after:	3 days
Sponsored by:	Spectra Logic
2017-07-27 15:51:56 +00:00
Kenneth D. Merry
a0acb3512c Fix probing FC targets with hard addressing turned on.
This largely reverts FreeBSD SVN change 289937 from October 25th, 2015.

The intent of that change was to keep loop IDs persistent across
chip reinits.

The problem is that the change turned on the PREVLOOP /
PREV_ADDRESS bit (bit 7 in Firmware Options 2), which tells the
Qlogic chip to not participate in the loop if it can't get the
requested loop address.  It also turned off soft addressing on 2400
(4Gb) and newer controllers.

The isp(4) driver defaults to loop address 0, and the tape drives
I have tested default to loop address 0 if hard addressing is turned
on.  So when hard loop addressing is turned on on the drive, the isp(4)
driver just refuses to participate in the loop.

The solution is to largely revert that change.  I left some elements
in place that are related to virtual ports, since they were new.

This does work with IBM tape drives with hard and soft addressing
turned on.  I have tested it with 4Gb, 8Gb, and 16Gb controllers.

sys/dev/isp.c:
	Largely revert FreeBSD SVN change 289937.  I left the
	ispmbox.h changes in place.

	Don't use the PREV_ADDRESS bit on initialization.  It tells
	the chip to not participate if it can't get the requested
	loop ID.

	Do use soft addressing on 2400 and newer chips.

	Use hard addressing when the user has requested a specific
	initiator ID.  (hint.isp.X.iid=N in /boot/loader.conf)

	Leave some of the virtual port options from that change in
	place, but don't turn on the PREV_ADDRESS bit.

Reviewed by:	mav
MFC after:	3 days
Sponsored by:	Spectra Logic
2017-07-27 15:33:57 +00:00
Ed Maste
059178b639 uart: add AX99100 chipset support
PR:		215837
Submitted by:	joe@thrallingpenguin.com
MFC after:	2 weeks
2017-07-27 02:53:18 +00:00
Luiz Otavio O Souza
0e779c2f7b Fix the port vlan support in e6000 based switches.
Reduce the use of local copies of switch register data.

The switch now works with the upstream dsa node (i.e. the upstream DTS).

Tested on:	ClearFog Pro (88E6176), SG-3100 (88E6141)
Sponsored by:	Rubicon Communications, LLC (Netgate)
2017-07-27 02:38:53 +00:00
Marius Strobl
7fcf47802a - Check the slot type capability, set SDHCI_SLOT_{EMBEDDED,NON_REMOVABLE}
for embedded slots. Fail in the sdhci(4) initialization for slot type
  shared, which is completely unsupported by this driver at the moment. [1]
  For Intel eMMC controllers, taking the embedded slot type into account
  obsoltes setting SDHCI_QUIRK_ALL_SLOTS_NON_REMOVABLE so remove these quirk
  entries.
- Hide the 1.8 V VDD capability when the slot is detected as non-embedded,
  as the SDHCI specification explicitly states that 1.8 V VDD is applicable
  to embedded slots only. [2]
- Define some easy bits of the SDHCI specification v4.20. [3]
- Don't leak bus_dma(9) resources in failure paths of sdhci_init_slot().

Obtained from:	DragonFlyBSD 65704a46 [1], 7ba10b88 [2], 0df14648 [3]
2017-07-26 22:04:23 +00:00
Marius Strobl
7a777659ff Correctly use the size of a pointer rather than that of a pointer to a
pointer.

Reported by:	Coverity
CID:		1378432
2017-07-26 21:59:37 +00:00
Ian Lepore
34199ee049 Add support for tracking nested calls to iicbus_request/release_bus().
Usually it is sufficient to use iicbus_transfer_excl(), or one of the
higher-level convenience functions that use it, to reserve the bus for the
duration of each register access.  Occasionally it is important that a
series of accesses or read-modify-write operations must be done without any
other intervening access to the device, to prevent corrupting state.

Without support for nested request/release, slave device drivers would have
to stop using high-level convenience functions and resort to working with
arrays of iic_msg structs just for a few operations (often involving
one-time device setup or infrequent configuration changes).

The changes here appear large from a glance at the diff, but in fact they're
nearly trivial, and the large diff is because of changes in indentation and
the re-wrapping of comments caused by that.  One notable change is that
iicbus_release_bus() now ignores the IICBUS_CALLBACK(IIC_RELEASE_BUS) return
value.  The old error handling left the bus in a kind of limbo state where
it was still owned at the iicbus layer, but drivers rarely check the return
of the release call, and it's unclear what they would do to recover from an
error return anyway.  No existing low-level drivers return any kind of error
from IIC_RELEASE_BUS except one EINVAL for "you don't own the bus", to which
the right response is probably to carry on with the process of releasing the
reference to the bus anyway.
2017-07-26 21:06:26 +00:00
Ian Lepore
7ec74c580d Add a pair of convenience routines for doing simple "register" read/writes
on i2c devices, where the "register" can be any length.

Many (perhaps most) common i2c devices are organized as a collection of
(usually 1-byte-wide) registers, and are accessed by first writing a 1-byte
register index/offset number, then by reading or writing the data.
Generally there is an auto-increment feature so the when multiple bytes
are read or written, multiple contiguous registers are accessed.

Most existing slave device drivers allocate an array of iic_msg structures,
fill in all the transfer info, and invoke iicbus_transfer().  These new
functions commonize all that and reduce register access to a simple call
with a few arguments.
2017-07-26 20:40:24 +00:00
Navdeep Parhar
c45b18681f cxgbe(4): Some updates to the common code.
- Updated register ranges.
- Helper routines for access to TP registers.
- Updated routine to read flash parameters.

Obtained from:	Chelsio Communications
MFC after:	2 weeks
Sponsored by:	Chelsio Communications
2017-07-26 20:20:58 +00:00
Adrian Chadd
40fea7fd71 [iwm] Sync rs (rate-selection) API definitions from Linux iwlwifi.
* While there clean up alignments and line wrapping in existing
  definitions for rs API in if_iwmreg.h

Obtained from:	dragonflybsd.git 085e37a042bdb17081e495e46919359ce43aa118
2017-07-26 05:52:37 +00:00
Adrian Chadd
f55c604bdf [iwm] Add iwm_mvm_send_lq_cmd() from Linux iwlwifi to if_iwm_util.c.
Obtained from:	dragonflybsd.git 8a5dd7783e407856754093f5b1c9c757c64534b7
2017-07-26 05:51:31 +00:00
Adrian Chadd
1ecccab8fe [iwm] Sync statistics API definitions with Linux iwlwifi.
Obtained from:	dragonflybsd.git 75895a53a9c1ba60d75be9b4bf6e49a37f91a7cf
2017-07-26 05:40:52 +00:00
Adrian Chadd
7a3e63e7b3 [iwm] Cleanup mbufq draining. Add iwm_xmit_queue_drain() like in iwn(4).
* iwm_xmit_queue_drain() calls ieee80211_free_node(), removing a possible
  memory leak, compared to using just mbufq_drain().

* Remove duplicate mbufq_drain() from iwm_mvm_rm_sta(), this should be
  handled in the caller.

Obtained from:	dragonflybsd.git 339d45fda40072e0aca5ece639173204716f11fe
2017-07-26 05:29:08 +00:00
Adrian Chadd
2aa3dbb059 [iwm] if_iwm - Use chan list from ieee80211_scan_state for scan, not ic_channels.
* Limiting the channel list with "ifconfig wlan0 chanlist ..." now will
  actually set the list of channels scanned by iwm.

Tested:

* Intel 7260, STA mode, setting chanlist to 1-14 and 36-254, and indeed it does what
  it should!
2017-07-26 05:26:01 +00:00
Scott Long
6c85e33ee8 Quiet a message that sounds far more dire than it really is. 2017-07-26 01:48:13 +00:00
Marius Strobl
21794534db Improve the clarity of a comment added in r321385 by not referring to
volatile SDHCI specification lingo.
2017-07-25 20:36:44 +00:00
Sean Bruno
5a1813ecc1 bnxt: Implement interrupt coalescing options using sysctl.
Submitted by:	 bhargava.marreddy@broadcom.com
Differential Revision:	https://reviews.freebsd.org/D11702
2017-07-25 15:33:34 +00:00
Sean Bruno
e0ef5a7306 Drop ixgbe RX lock during TCP_LRO processing. This eliminates a "storm"
of LOR detection and a bit of lock release/acquire collision when using LRO.

Submitted by:   Kevin Bowling <kevin.bowling@kev009.com>
MFC after:      2 days
Differential Revision:  https://reviews.freebsd.org/D11712
2017-07-25 14:38:30 +00:00
Navdeep Parhar
dcbe705600 cxgbe(4): Display some more TOE parameters related to retransmission
and keepalive in the sysctl MIB.  Provide tunables to change some of
these parameters.  These are supposed to be setup by the firmware so
these tunables are for experimentation only.

MFC after:	2 weeks
Sponsored by:	Chelsio Communications
2017-07-24 19:17:13 +00:00
Sepherosa Ziehau
40905afa0f hyperv/hn: Ignore LINK_SPEED_CHANGE status.
This status will be reported if the backend NIC is wireless; it's not
useful.  Due to the high frequency of the reporting, this could be
pretty annoying; ignore it.

MFC after:	3 days
Sponsored by:	Microsoft
Differential Revision:	https://reviews.freebsd.org/D11651
2017-07-24 04:00:43 +00:00
Sepherosa Ziehau
499c3e1739 hyperv/hn: Export VF list and VF-HN mapping
The VF-HN map will be used later on to implement "transparent VF".

MFC after:	3 days
Sponsored by:	Microsoft
Differential Revision:	https://reviews.freebsd.org/D11618
2017-07-24 03:52:32 +00:00
Vladimir Kondratyev
e650280282 Change my email address to wulf@FreeBSD.org in copyright headers.
Approved by:	gonzo (mentor)
MFC after:	2 weeks
2017-07-23 20:41:58 +00:00
Vladimir Kondratyev
4c0a4665b8 evdev: Macroize common locking sequences
Reviewed by:	gonzo
Approved by:	gonzo (mentor)
MFC after:	2 weeks
2017-07-23 20:35:26 +00:00
Vladimir Kondratyev
ea2e26b1ed evdev: style(9), sort headers alphabetically
Pointed out by:	bde
Reviewed by:	gonzo
Approved by:	gonzo (mentor)
MFC after:	2 weeks
2017-07-23 20:32:54 +00:00
Navdeep Parhar
98d227f3e8 cxgbe(4): Install the firmware bundled with the driver to the card if it
doesn't seem to have one.  This lets the driver recover automatically
from incomplete firmware upgrades (panic, reboot, power loss, etc. in
the middle of an upgrade).

MFC after:	2 weeks
Sponsored by:	Chelsio Communications
2017-07-23 18:10:47 +00:00
Marius Strobl
aca38eab8a o Add support for eMMC HS200 and HS400 bus speed modes at 200 MHz to
sdhci(4), mmc(4) and mmcsd(4). For the most part, this consists of:
  - Correcting and extending the infrastructure for negotiating and
    enabling post-DDR52 modes already added as part of r315598. In
    fact, HS400ES now should work as well but hasn't been activated
    due to lack of corresponding hardware.
  - Adding support executing standard SDHCI initial tuning as well
    as re-tuning as required for eMMC HS200/HS400 and the fast UHS-I
    SD card modes. Currently, corresponding methods are only hooked
    up to the ACPI and PCI front-ends of sdhci(4), though. Moreover,
    sdhci(4) won't offer any modes requiring (re-)tuning to the MMC/SD
    layer in order to not break operations with other sdhci(4) front-
    ends. Likewise, sdhci(4) now no longer offers modes requiring the
    set_uhs_timing method introduced in r315598 to be implemented/
    hooked up (previously, this method was used with DDR52 only, which
    in turn is only available with Intel controllers so far, i. e. no
    such limitation was necessary before). Similarly for 1.2/1.8 V VCCQ
    support and the switch_vccq method.
  - Addition of locking to the IOCTL half of mmcsd(4) to prevent races
    with detachment and suspension, especially since it's required to
    immediately switch away from RPMB partitions again after an access
    to these (so re-tuning can take place anew, given that the current
    eMMC specification v5.1 doesn't allow tuning commands to be issued
    with a RPMB partition selected). Therefore, the existing part_mtx
    lock in the mmcsd(4) softc is additionally renamed to disk_mtx in
    order to denote that it only refers to the disk(9) half, likewise
    for corresponding macros.

  On the system where the addition of DDR52 support increased the read
  throughput to ~80 MB/s (from ~45 MB/s at high speed), HS200 yields
  ~154 MB/s and HS400 ~187 MB/s, i. e. performance now has more than
  quadrupled compared to pre-r315598.

  Also, with the advent of (re-)tuning support, most infrastructure
  necessary for SD card UHS-I modes up to SDR104 now is also in place.
  Note, though, that the standard SDHCI way of (re-)tuning is special
  in several ways, which also is why sending the actual tuning requests
  to the device is part of sdhci(4). SDHCI implementations not following
  the specification, MMC and non-SDHCI SD card controllers likely will
  use a generic implementation in the MMC/SD layer for executing tuning,
  which hasn't been written so far, though.

  However, in fact this isn't a feature-only change; there are boards
  based on Intel Bay Trail where DDR52 is problematic and the suggested
  workaround is to use HS200 mode instead. So far exact details are
  unknown, however, i. e. whether that's due to a defect in these SoCs
  or on the boards.

  Moreover, due to the above changes requiring to be aware of possible
  MMC siblings in the fast path of mmc(4), corresponding information
  now is cached in mmc_softc. As a side-effect, mmc_calculate_clock(),
  mmc_delete_cards(), mmc_discover_cards() and mmc_rescan_cards() now
  all are guaranteed to operate on the same set of devices as there no
  longer is any use of device_get_children(9), which can fail in low
  memory situations. Likewise, mmc_calculate_clock() now longer will
  trigger a panic due to the latter.

o Fix a bug in the failure reporting of mmcsd_delete(); in case of an
  error when the starting block of a previously stored erase request
  is used (in order to be able to erase a full erase sector worth of
  data), the starting block of the newly supplied bio_pblkno has to be
  returned for indicating no progress. Otherwise, upper layers might
  be told that a negative number of BIOs have been completed, leading
  to a panic.

o Fix 2 bugs on resume:
  - Things done in fork1(9) like the acquisition of an SX lock or the
    sleepable memory allocation are incompatible with a MTX_DEF taken.
    Thus, mmcsd_resume() must not call kproc_create(9), which in turn
    uses fork1(9), with the disk_mtx (formerly part_mtx) held.
  - In mmc_suspend(), the bus is powered down, which in the typical
    case of a device being selected at the time of suspension, causes
    the device deselection as part of the bus acquisition by mmc(4) in
    mmc_scan() to fail as the bus isn't powered up again before later
    in mmc_go_discovery(). Thus, power down with the bus acquired in
    mmc_suspend(), which will trigger the deselection up-front.

o Fix a memory leak in mmcsd_ioctl() in case copyin(9) fails. [1]

o Fix missing variable initialization in mmc_switch_status(). [2]

o Fix R1_SWITCH_ERROR detection in mmc_switch_status(). [3]

o Handle the case of device_add_child(9) failing, for example due to
  a memory shortage, gracefully in mmc(4) and sdhci(4), including not
  leaking memory for the instance variables in case of mmc(4) (which
  might or might not fix [4] as the latter problem has been discovered
  independently).

o Handle the case of an unknown SD CSD version in mmc_decode_csd_sd()
  gracefully instead of calling panic(9).

o Again, check and handle the return values of some additional function
  calls in mmc(4) instead of assuming that everything went right or mark
  non-fatal errors by casting the return value to void.

o Correct a typo in the Linux IOCTL compatibility; it should have been
  MMC_IOC_MULTI_CMD rather than MMC_IOC_CMD_MULTI.

o Now that we are reaching ever faster speeds (more improvement in this
  regard is to be expected when adding ADMA support to sdhci(4)), apply
  a few micro-optimizations like predicting mmc(4) and sdhci(4) debugging
  to be off or caching erase sector and maximum data sizes as well support
  of block addressing in mmsd(4) (instead of doing 2 indirections on every
  read/write request for determining the maximum data size for example).

Reported by:	Coverity
CID:		1372612 [1], 1372624 [2], 1372594 [3], 1007069 [4]
2017-07-23 16:11:47 +00:00
Sean Bruno
5eedcb0969 Do not update stats counter in SWI context. Defer to the already existing
admin thread.

Submitted by:	Matt Macy <mmacy@mattmacy.io>
Sponsored by:	Limelight Networks
2017-07-21 17:42:54 +00:00
Luiz Otavio O Souza
4dd4446129 Restore the changes done in r313982: Replace zero with NULL for pointers.
Spotted by:	Harry Schmalzbauer
MFC after:	1 week
Sponsored by:	Rubicon Communications, LLC (Netgate)
2017-07-21 03:59:56 +00:00
Luiz Otavio O Souza
a02dbe4ca1 Do not allow the use of the loopback interface in netmap.
The generic support in netmap send the packets using if_transmit() and the
loopback do not support packets coming from if_transmit()/if_start().

This avoids the use of the loopback interface and the subsequent crash that
happens when the application send packets to the loopback interface.

Details in:	https://github.com/luigirizzo/netmap/issues/322
Reported by:	Vincenzo Maffione <v.maffione@gmail.com>
Sponsored by:	Rubicon Communications, LLC (Netgate)
2017-07-21 03:28:35 +00:00
Sepherosa Ziehau
6478f3180c hyperv/storvsc: Force SPC3 for CDROM attached.
This unbreaks the CDROM attaching on GEN2 VMs.  On GEN1 VMs, CDROM is
attached to emulated ATA controller.

PR:		220790
Submitted by:	Hongjiang Zhang <honzhan microsoft com>
MFC after:	3 days
Sponsored by:	Microsoft
Differential Revision:	https://reviews.freebsd.org/D11634
2017-07-20 07:13:26 +00:00
Enji Cooper
2df7231dbf Some trivial style(9) fixes
- Delete trailing whitespace.
- Fix leading indentation (convert single column spaces to tabs).
- Convert "[Ff]all through" to "FALLTHROUGH", per implicit project
  style/spelling.

Reviewed by:	sbruno
Differential Revision:	D11665
2017-07-20 04:32:06 +00:00
Sean Bruno
d8c2808fcf Restore igb(4) code dropped during iflib conversion
- restore newer code for vf, i350, i210, i211
 - restore dmac init code for i354 and i350
 - restore WUC/WUFC update
 - check for igb mac type before attempting trying to assert
   a media changed event.
 - handle link events for igb(4) and em(4) devices differently
   and appropriately for their respective model types.

Submitted by:	Matt Macy <mmacy@mattmacy.io>
Sponsored by:	Limelight Networks
2017-07-19 22:41:22 +00:00
David C Somayajulu
12e46bad2c Raise the watchdog timer interval to 2 ticks, there by guaranteeing
that it fires between 1ms and 2ms. `
Treat two consecutive occurrences of Heartbeat failures as a legitimate
Heartbeat failure

MFC after:3 days
2017-07-19 19:08:37 +00:00
Kenneth D. Merry
417aa6b850 Fix spurious timeouts on commands sent to mps(4) and mpr(4) controllers.
mps_wait_command() and mpr_wait_command() were using getmicrotime() to
determine elapsed time when checking for a timeout in polled mode.
getmicrotime() isn't guaranteed to monotonically increase, and that
caused spurious timeouts occasionally.

Switch to using getmicrouptime(), which does increase monotonically.
This fixes the spurious timeouts in my test case.

Reviewed by:	slm, scottl
MFC after:	3 days
Sponsored by:	Spectra Logic
2017-07-19 15:39:01 +00:00
Andrey V. Elsukov
27a8713f74 Add HPE FlexFabric 10Gb 4-port 536FLR-T device id to the bxe(4) driver.
Tested by:	David Miguel Almas <dmalmas gmail com>
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D11478
2017-07-19 14:21:29 +00:00
Navdeep Parhar
089400e72d cxgbe/t4_tom: Log more details about the newly ESTABLISHED tid to the
trace buffer.

MFC after:	3 days
2017-07-19 01:49:01 +00:00
Ryan Libby
d576ccdf01 qlnx: gcc build errors
Propagate warning flags from kern.opts.mk and then fix minor -Werror
issues when building with gcc from -Wredundant-decls, -Wnested-externs,
-Wuninitialized.

Reviewed by:	davidcs
Approved by:	markj (mentor)
Sponsored by:	Dell EMC Isilon
Differential Revision:	https://reviews.freebsd.org/D11413
2017-07-18 06:15:05 +00:00
Navdeep Parhar
1e5f943084 cxgbe(4): New ioctls to flash bootrom and boot config to the card.
MFC after:	2 weeks
Sponsored by:	Chelsio Communications
2017-07-18 00:50:58 +00:00
Adrian Chadd
112d57f2ad [iwm] actually use the new rxon function now.
It turns out the /next/ dragonflybsd git actually uses the scan channel list,
so just kick this along to make the next commit easier.

Obtained from:	dragonflybsd.git 53a009d6f66108b40d622ed90ea95eba5c0e5432
2017-07-17 21:32:35 +00:00
Adrian Chadd
fe845d8e27 [iwm] if_iwm - Factor out and improve iwm_mvm_scan_rxon_flags() in if_iwm_scan.c.
From the original commit:

==

* Actually look at the first channel in the list. If it's a 2.4GHz channel,
  set IWM_PHY_BAND_24 flag. The IWM_PHY_BAND_5 flag is 0 anyway, so we
  don't need to look further.

* While there factor out the iwm_mvm_rrm_scan_needed() tlv capability check.

Taken-From: Linux iwlwifi
==

However, this only really does the latter.  The sc_ic channel list isn't the
scan channel list, it's the /whole list/ for the set of active channels,
so I don't know what the right thing to do is here.

So I'll commit this as an intermediary commit and we'll have to revisit whether
to finish the refactor as-is.

Tested:

* Intel 7260, STA mode

Obtained from:	dragonflybsd.git 53a009d6f66108b40d622ed90ea95eba5c0e5432
2017-07-17 21:29:18 +00:00
Navdeep Parhar
01285747aa cxgbe(4): Various link/media related improvements.
- Deal with changes to port_type, and not just port_mod when a
  transceiver is changed.  This fixes hot swapping of transceivers of
  different types (QSFP+ or QSA or QSFP28 in a QSFP28 port, SFP+ or
  SFP28 in a SFP28 port, etc.).

- Always refresh media information for ifconfig if the port is down.
  The firmware does not generate tranceiver-change interrupts unless at
  least one VI is enabled on the physical port.  Before this change
  ifconfig diplayed potentially stale information for ports that were
  administratively down.

- Always recalculate and reapply L1 config on a transceiver change.

- Display PAUSE settings in ifconfig.  The driver sysctls for this
  continue to work as well.

MFC after:	2 weeks
Sponsored by:	Chelsio Communications
2017-07-17 00:42:13 +00:00
Xin LI
a1103e048b Update arcmsr(4) to 1.40.00.00 in order to add support of
ARC-1884 SATA RAID controllers.

Many thanks to Areca for continuing to support FreeBSD.

Submitted by:	黃清隆 <ching2048 areca com tw>
MFC after:	3 days
2017-07-14 14:53:13 +00:00
Warner Losh
df4245150a This adds CAM pass(4) support for NVMe IO's. Applications indicate
the IO type (Admin or NVM) using XPT op-codes XPT_NVME_ADMIN or
XPT_NVME_IO.

Submitted by:   Chuck Tuffli <chuck@tuffli.net>
Differential Revision:  https://reviews.freebsd.org/D10247
2017-07-14 14:52:20 +00:00
Ryan Libby
33c66d8aeb ixl: gcc build errors
Fix minor -Werror issues when building with gcc from -Wredundant-decls,
-Wunused, -Wbool-operations.  Also ensure the M_IXL malloc type is only
defined once.

Reviewed by:	efj
Approved by:	markj (mentor)
Sponsored by:	Dell EMC Isilon
Differential Revision:	https://reviews.freebsd.org/D11414
2017-07-14 00:10:51 +00:00
Eric Joyner
3820007146 ixl(4)/ixlv(4): Stop leaking every busdma entry in receive path
From Brett:

In short, busdma maps for received packets were not being unloaded in the
interrupt handler before the packets were passed up the network stack. The fix
was to add a busdma sync and unload for the two receive maps.

This bug is significant for certain busdma providers, for example IOMMUs,
where not unloading the maps means that 1) the IOMMU mappings that allow the
NIC to DMA the received packets into host memory stay open indefinitely,
potentially violating a desired security policy, and 2) resources such as
device address space addresses and host memory for bookkeeping are never freed.

Without an IOMMU or bounce buffering enabled for the ixl device, I don't think
adding these calls will have any significant performance impact. With the
IOMMU enabled, I have noticed a performance impact on the receive side, which
is expected.

Submitted by:	Brett Gutstein <bgutstein@rice.edu>
Reviewed by:	erj@
MFC after:	1 week
2017-07-13 22:12:41 +00:00
Ian Lepore
2d5f51fb22 Put an #ifdef notyet wrapper around a function that's not being used yet,
to avoid compile warnings.
2017-07-13 02:20:07 +00:00
Ian Lepore
7164f27ddc Support the "disable-over-current" property for imx ehci controllers.
It turns out that this is more than a power optization.  The OTG port
won't work on boards that have this property unless this setting is honored.

Also ensure that the usb phy device attaches before ehci.
2017-07-13 02:16:15 +00:00
Sean Bruno
fb6aa95d9f Reset unsupported SFP tuneable back to original entry name.
Reported by:	olivier@
2017-07-12 17:35:32 +00:00
Zbigniew Bodek
516d335588 Fix error check for Rx mbuf allocation in ENA driver
ena_alloc_rx_mbuf() will return positive error code
on failure. Act accordingly.

Submitted by: Krishna Yenduri <kyenduri at brkt.com>
2017-07-10 22:11:30 +00:00
Hans Petter Selasky
7bb7b27fb1 Make sure the mlx4en RX DMA ring gets stamped with software ownership
in order to prevent the flow of QP to error in the firmware once
UPDATE_QP is called.

MFC after:	3 days
Sponsored by:	Mellanox Technologies
2017-07-10 19:26:50 +00:00
Bruce Evans
16d02c733f Fix attribute flipping for cut marking in pixel mode. The text-mode
code was used, so the lightness bit was not flipped, so the flipping
was unnecessarily null in some cases.  E.g., the unusal color scheme
of lightwhite on white (white = lightgrey in kernelspeak) is not
completely unusable, except null flipping of it gave no visible marks
for cut marking.  Now flipping it works in pixel mode only.

Fix text cursor attribute adjustment over cut marking in text mode for
the usual cursor type (non-blinking full block).  Apply the flipping
for cut marking first and adjust that instead of vice versa.  This
gives a uniform color scheme for the usual text cursor type in text
mode: a white block background with no change to the character
foreground except for variations to avoid collisions.  The old order
gave a white character fg with no change in the bg in non-colliding
cases.  Versions before r316636 changed the bg to the non-cut-marked
one about half the time using a saveunder bug; this accidentally gave
something resembling a block cursor half the time.
2017-07-10 09:00:35 +00:00
Alexander Motin
ae77193109 "Port Type not registered" is not a real error for GIT_PT. 2017-07-10 06:25:30 +00:00
Warner Losh
4e38d89520 Include opt files in the kernel with "" instead of <>. 2017-07-10 05:08:01 +00:00
Warner Losh
15c440e1a6 Better contain MMCCAM parts of this file
Remove some useless to the general user debugs
Put debugs under sdhci_debug.
Fix some style(9) regressions

Submitted by: marius@
2017-07-10 03:38:17 +00:00
Mark Johnston
8ee96d1452 Add a helper function to agp(4) which installs a single GTT entry.
Submitted by:	dumbbell
MFC after:	1 week
2017-07-09 22:53:24 +00:00
Warner Losh
3685b3988d Back out enabling the card interrupt detection bit. It is not ready to
commit.

Noticed by: marius@
2017-07-09 20:49:02 +00:00
Warner Losh
1b99d52f26 Added mmcnull, an emulated lightweight MMC controller
This emulated device attaches to the ISA bus and registers itself as
HBA supporting MMC/SD cards. This allows to develop and test MMC XPT
and MMC / SDIO peripheral drivers even in the VM such as bhyve.

Submitted by: Ilya Babulin
2017-07-09 17:02:47 +00:00
Warner Losh
a94a63f0a6 An MMC/SD/SDIO stack using CAM
Implement the MMC/SD/SDIO protocol within a CAM framework. CAM's
flexible queueing will make it easier to write non-storage drivers
than the legacy stack. SDIO drivers from both the kernel and as
userland daemons are possible, though much of that functionality will
come later.

Some of the CAM integration isn't complete (there are sleeps in the
device probe state machine, for example), but those minor issues can
be improved in-tree more easily than out of tree and shouldn't gate
progress on other fronts. Appologies to reviews if specific items
have been overlooked.

Submitted by: Ilya Bakulin
Reviewed by: emaste, imp, mav, adrian, ian
Differential Review: https://reviews.freebsd.org/D4761

merge with first commit, various compile hacks.
2017-07-09 16:57:24 +00:00
Bruce Evans
9cb3ac3bef Move open coding of construction of attributes for cut regions and
text cursors to functions so that it is easier to fix and improve.
This commit doesn't fix anything except for removing unnecessary
complications and adding comments.
2017-07-09 12:13:37 +00:00
Alexander Leidinger
3ddbb27c55 Switch prison check from PROV_DRIVER to PRIV_KMEM_WRITE (like /dev/mem).
Access to the dri device gives effectively access to the entire memory of the machine (you can program
the graphic card to do DMA).

For current/stable/release this is a NOP, as access to memory is not allowed in a jail. This puts the dri
device into the same (in)security class than /dev/mem for future use.

Discussed with:		anholt(?) several years ago
Sponsored by:		Hackathon Essen 2017
2017-07-09 06:50:15 +00:00
Bruce Evans
28bbe30cce Add many bitmaps (now there are 13) for mouse cursors and logic to try
to choose the best one.

The old 9x13 cursor was was sort of correct for CGA 640x200 text mode,
but distorted for all other modes.  This mode is still available on
all systems with VGA, but stopped being useful in ~1985.  It has very
unsquare pixels with an aspect ratio of 240:100 on 4:3 monitors.  On
16:9 monitors, the unsquareness in this mode is reduced to only 180:100
iff the monitor stretches the pixels to the full screen.

Newer modes and systems have smaller distortions, but with many more
variations.  Square pixels first became common with VGA 640x480 mode
on 4:3 monitors.  However, standard VGA text mode also has 9-bit wide
characters and only 25 lines, so it has 720x400 pixels.  This has
unsquare pixels with an aspect ratio of 135:100 on 4:3 monitors.  On
16:9 monitors, it gives almost-square pixels with an aspect ration of
101:100 iff the monitor stretches, but in modes that were square on
4:3 monitors square similar monitor stretching breaks the squareness.

Guess the physical aspect ratio using heuristics.  The old version of
X that I use is further from doing this using info from PnP monitors
that is unavailable in syscons (X doesn't understand if the monitor
is doing stretching and doesn't even understand how its its own mode
changes affect the pixel size).  Monitors with aspect ratio control
should be configured to _not_ stretch 4:3 modes to 16:9.  Otherwise,
use the machdep.vga_aspect_scale sysctl to compensate.  Only 1 of my
4 monitors/laptops requires this.  It always stretches to 16:9.

The mouse data has new aspect ratio fields for selecting the best
cursor and a new name field for display in debugging messages.

Selecting the mouse cursor is now a slow operation so it is not done
for every drawing of the cursor.  To avoid a new initialization method,
it is done whenever the text cursor is set or changed.  Also remove
dead code in settings of text cursors.

Use larger mouse cursors (sometimes the full 10x16 one) for 8x8 fonts
in cases where this works better (mostly in graphics mode).
2017-07-08 17:30:33 +00:00
Bruce Evans
aa24f48b36 Add files to help manage the (vga) syscons mouse cursor.
To mostly fix distortion of mouse cursors by non-square pixels, I
needed 8 variants of the same cursor shape for large fonts and
another 7 variants for small fonts.  Some variants are shared,
leaving only 13 variants in 26 glyphs altogether.  Keep these in
the BDF source file cursor.bdf.  cursor.bdf has another 5 unused
experimental cursors in 10 glyphs.  cursor.awk is a simple awk
script for converting this and similar bdf files into C declarations
for copying into scvgarndr.c.  syscons doesn't use any of this yet.
2017-07-08 15:01:55 +00:00
Hans Petter Selasky
a90f44b281 Implement fix for BULK IN-token retry mechanism. When the hardware is
programmed for infinite IN token retry after NAK, the SAF1761
hardware, however, does not retry the IN-token. This problem is
described in the SAF1761 errata, section 18.1.1.

While at it:
- Add some minor chip specific initialization for RTEMS.
- Add debug print for status registers in the interrupt filter.

Submitted by:	Christian Mauderer <christian.mauderer@embedded-brains.de>
MFC after:	1 week
2017-07-07 12:03:58 +00:00
Ian Lepore
a14af83085 Fix drivers that assume ticks starts at zero. These drivers all have logic
similar to "if (ticks > localvar+interval) {localvar=ticks; ...}" where
localvar is initialized to zero.  Ticks is initialized to a negative value
since r278230, and that leads to these if statements never being true.
2017-07-06 17:03:22 +00:00
Andriy Voskoboinyk
c5ad99fc69 rtwn: add Rx descriptor structures for common code.
Remove any chipset specific usage of Rx descriptor structure / bits
from common code to prevent misuse of fields that may differ
between various chipsets.

Checked with: 	RTL8821AU in STA mode.
2017-07-06 07:37:33 +00:00
Ryan Libby
32981ab80a hptmv: avoid gcc variably-modified warning
gcc produces a "variably modified X at file scope" warning for
structures that use these size definitions.

PR:		211540
Reviewed by:	markj
Approved by:	markj (mentor)
Sponsored by:	Dell EMC Isilon
Differential revision:	https://reviews.freebsd.org/D11416
2017-07-06 05:32:22 +00:00
David C Somayajulu
423ec132f5 Release mtx hw_lock before calling pause() in qla_stop() and
qla_error_recovery()

MFC after: 5 days
2017-07-06 05:16:06 +00:00
David C Somayajulu
b5c2be723b Allow MTU changes without ifconfig down/up
MFC after:5 days
2017-07-05 19:25:09 +00:00
Mark Johnston
edab404aec Defer ACPI taskqueue creation to SI_SUB_KICK_SCHEDULER.
This addresses a deadlock during boot when EARLY_AP_STARTUP is configured:
a taskqueue thread may call pause() with an ACPI mutex held, and thread0
may block on this mutex before configuring the eventtimer. In this case
the taskqueue thread will sleep forever waiting for its callout to fire.

PR:		220277
Submitted by:	jhb
MFC after:	3 days
2017-07-05 17:39:17 +00:00
Eric Joyner
8eb6488ebb ixgbe(4): Update HEAD (p3) to 3.2.12-k
Includes:

- Support for X550EM devices.
- Support for Bypass adapters.
- Flow Director code moved to separate files
- SR-IOV code moved to separate files
- Netmap code moved to separate files

Differential Revision:	https://reviews.freebsd.org/D11232
Submitted by:	Jeb Cramer <cramerj@intel.com>
Reviewed by:	erj@
Tested by:	Jeff Pieper <jeffrey.e.pieper@intel.com>
Sponsored by:	Intel Corporation
2017-07-05 17:27:03 +00:00
Andriy Voskoboinyk
3737697159 rtwn_usb: reject too long (>16K) mbufs.
While here move RTWN_TXBUFSZ constant from common to USB specific code
(it's not used anywhere else).
2017-07-04 07:07:08 +00:00
Zbigniew Bodek
1b069f1c69 Replace mbuf defragmentation with collapse
Collapse should be more effective than defragmentation.
Added missing declaration of ena_check_and_collapse_mbuf().

Submitted by:   Michal Krawczyk <mk@semihalf.com>
Obtained from:  Semihalf
Sponsored by:   Amazon.com Inc.
2017-07-04 00:10:29 +00:00
Zbigniew Bodek
8a573700af Fix creation of dma tags and TSO settings
TSO settings were not reflecting real HW capabilities.

DMA tags were created with wrong window - high address was the same as
low, so excluding window was not working.

Capabilities of TX dma transaction were not set properly - TSO max size
had been increased and size of one segment had been adjusted.

Submitted by:   Michal Krawczyk <mk@semihalf.com>
Obtained from:  Semihalf
Sponsored by:   Amazon.com Inc.
2017-07-04 00:08:47 +00:00
Zbigniew Bodek
63b4364a9a Remove RX mtx from ENA driver
RX lock is no longer required. There can only be one RX cleanup task
running at a time, RX cleanup cannot be executed if interface is not
yet initialized and ena_down() will not free any RX resources if any io
interrupt is being handled - RX cleanup task is only called from an
interrupt handler.

Submitted by:   Michal Krawczyk <mk@semihalf.com>
Obtained from:  Semihalf
Sponsored by:   Amazon.com Inc.
2017-07-04 00:06:56 +00:00
Zbigniew Bodek
b4b2903275 Call drbr_advance() before leaving TX routine
If drbr_advance() is not called before doing cleanup and packet is
already enqueued for sending (tx_info is holding pointer to mbuf), then
mbuf is cleaned both in drbr_flush() and in cleanup routine, when all
mbufs hold by tx_buffer_info are being released.

This causes panic, because mbuf is released twice.

Submitted by:   Michal Krawczyk <mk@semihalf.com>
Obtained from:  Semihalf
Sponsored by:   Amazon.com Inc.
2017-07-04 00:04:31 +00:00
Zbigniew Bodek
93471047c0 Unmask all IO irqs after driver state is set as running
If driver left MSI-x handlling routine because interface was put down,
it is not unmasking IRQs, so any requesting interrupt will be awaiting
for unmasking.

On ena_up() routine all interrupts are being unmasked and any awaiting
interrupt will be handled right away.

If handler was executed before driver state was set as running, handling
routine is being ended immediately, leaving IO irqs for given queue
masked.

Submitted by:   Michal Krawczyk <mk@semihalf.com>
Obtained from:  Semihalf
Sponsored by:   Amazon.com Inc.
2017-07-04 00:02:28 +00:00
Zbigniew Bodek
b38cf61385 Acquire locks before calling drbr_flush()
It is required to hold lock that is associated with buffer ring before
flushing drbr.

Submitted by:   Michal Krawczyk <mk@semihalf.com>
Obtained from:  Semihalf
Sponsored by:   Amazon.com Inc.
2017-07-04 00:00:42 +00:00
Zbigniew Bodek
3d3a90f9ab Add missing lock upon initialization of the interface
Lack of this lock was causing crash if down was called in
parallel with the initialization routine.

Submitted by:   Michal Krawczyk <mk@semihalf.com>
Obtained from:  Semihalf
Sponsored by:   Amazon.com Inc.
2017-07-03 23:59:11 +00:00
Marius Strobl
8022c8eba3 Correct a typo in the comment part of r320577, later on copied into
the commit message; as actually implemented, the intent is to retry
up to 2 ms for controllers to enable bus power.
Noticed by: ian@, rgrimes@

Additional note: Among others, the problem addressed by r320577 is
the APL32 ("Storage Controllers May Not Be Power Gated") erratum.
Hopefully, along with r318282, r320577 works around the remaining
problems seen with Intel Apollo Lake eMMC and SDXC controllers.
2017-07-03 20:47:32 +00:00