Commit Graph

33787 Commits

Author SHA1 Message Date
Landon J. Fuller
26e4f22037 bhnd(4): Fix a SPROM identification regression introduced in r315866
In r315866, we introduced a direct read of the 8-bit sromrev field from the
memory mapped SPROM/OTP device. On OTP devices that require 16-bit access
alignment, this read fails, preventing identification of the SPROM layout.

So, let's perform an aligned read of the combined 16-bit sromrev/crc field
instead.

Approved by:	adrian (mentor, implicit)
2017-05-23 22:30:15 +00:00
Konstantin Belousov
6992112349 Commit the 64-bit inode project.
Extend the ino_t, dev_t, nlink_t types to 64-bit ints.  Modify
struct dirent layout to add d_off, increase the size of d_fileno
to 64-bits, increase the size of d_namlen to 16-bits, and change
the required alignment.  Increase struct statfs f_mntfromname[] and
f_mntonname[] array length MNAMELEN to 1024.

ABI breakage is mitigated by providing compatibility using versioned
symbols, ingenious use of the existing padding in structures, and
by employing other tricks.  Unfortunately, not everything can be
fixed, especially outside the base system.  For instance, third-party
APIs which pass struct stat around are broken in backward and
forward incompatible ways.

Kinfo sysctl MIBs ABI is changed in backward-compatible way, but
there is no general mechanism to handle other sysctl MIBS which
return structures where the layout has changed. It was considered
that the breakage is either in the management interfaces, where we
usually allow ABI slip, or is not important.

Struct xvnode changed layout, no compat shims are provided.

For struct xtty, dev_t tty device member was reduced to uint32_t.
It was decided that keeping ABI compat in this case is more useful
than reporting 64-bit dev_t, for the sake of pstat.

Update note: strictly follow the instructions in UPDATING.  Build
and install the new kernel with COMPAT_FREEBSD11 option enabled,
then reboot, and only then install new world.

Credits: The 64-bit inode project, also known as ino64, started life
many years ago as a project by Gleb Kurtsou (gleb).  Kirk McKusick
(mckusick) then picked up and updated the patch, and acted as a
flag-waver.  Feedback, suggestions, and discussions were carried
by Ed Maste (emaste), John Baldwin (jhb), Jilles Tjoelker (jilles),
and Rick Macklem (rmacklem).  Kris Moore (kris) performed an initial
ports investigation followed by an exp-run by Antoine Brodin (antoine).
Essential and all-embracing testing was done by Peter Holm (pho).
The heavy lifting of coordinating all these efforts and bringing the
project to completion were done by Konstantin Belousov (kib).

Sponsored by:	The FreeBSD Foundation (emaste, kib)
Differential revision:	https://reviews.freebsd.org/D10439
2017-05-23 09:29:05 +00:00
Adrian Chadd
e08d8565f1 [arswitch] add phy debugging to the internal PHY read/write functions. 2017-05-23 03:48:42 +00:00
Stephen McConnell
18982e8fb0 Fix powerpc compiler error.
Approved by:	ken
2017-05-22 20:27:29 +00:00
Gleb Smirnoff
33c6ba0c65 Fix regression in ndis(4) after r286410. This adds a bunch of checks for
whether this is a Ethernet or 802.11 device and does proper dereferencing.

PR:		213237
Submitted by:	<ota j.email.ne.jp>
MFC after:	2 weeks
2017-05-22 20:00:01 +00:00
David C Somayajulu
9f4ec0869b Check for IPV6 TCP/UDP CSUM offload in pkt header during transmits.
Submitted by:Shminderjit.Singh@cavium.com
2017-05-22 19:57:28 +00:00
Zbigniew Bodek
9b8d05b8ac Add support for Amazon Elastic Network Adapter (ENA) NIC
ENA is a networking interface designed to make good use of modern CPU
features and system architectures.

The ENA device exposes a lightweight management interface with a
minimal set of memory mapped registers and extendable command set
through an Admin Queue.

The driver supports a range of ENA devices, is link-speed independent
(i.e., the same driver is used for 10GbE, 25GbE, 40GbE, etc.), and has
a negotiated and extendable feature set.

Some ENA devices support SR-IOV. This driver is used for both the
SR-IOV Physical Function (PF) and Virtual Function (VF) devices.

ENA devices enable high speed and low overhead network traffic
processing by providing multiple Tx/Rx queue pairs (the maximum number
is advertised by the device via the Admin Queue), a dedicated MSI-X
interrupt vector per Tx/Rx queue pair, and CPU cacheline optimized
data placement.

The ENA driver supports industry standard TCP/IP offload features such
as checksum offload and TCP transmit segmentation offload (TSO).
Receive-side scaling (RSS) is supported for multi-core scaling.

The ENA driver and its corresponding devices implement health
monitoring mechanisms such as watchdog, enabling the device and driver
to recover in a manner transparent to the application, as well as
debug logs.

Some of the ENA devices support a working mode called Low-latency
Queue (LLQ), which saves several more microseconds. This feature will
be implemented for driver in future releases.

Submitted by:	Michal Krawczyk <mk@semihalf.com>
		Jakub Palider <jpa@semihalf.com>
		Jan Medala <jan@semihalf.com>
Obtained from: Semihalf
Sponsored by: Amazon.com Inc.
Differential revision: https://reviews.freebsd.org/D10427
2017-05-22 14:46:13 +00:00
Roger Pau Monné
477a40c74f xen/netfront: don't drop the RX lock in xn_rxeof
Since netfront uses different locks for the RX and TX paths there's no need to
drop the RX lock before calling if_input.

Suggested by:	jhb
Tested by:	cperciva
Sponsored by:	Citrix Systems R&D
MFC with:	r318523
2017-05-22 11:33:44 +00:00
Hans Petter Selasky
fe3ca95c9d mlx4: Use the CQ quota for SRIOV when creating completion EQs
When creating EQs to handle CQ completion events for the PF or for
VFs, we create enough EQE entries to handle completions for the max
number of CQs that can use that EQ.

When SRIOV is activated, the max number of CQs a VF (or the PF) can
obtain is its CQ quota (determined by the Hypervisor resource
tracker).  Therefore, when creating an EQ, the number of EQE entries
that the VF should request for that EQ is the CQ quota value (and not
the total number of CQs available in the firmware).

Under SRIOV, the PF, also must use its CQ quota, because the resource
tracker also controls how many CQs the PF can obtain.

Using the firmware total CQs instead of the CQ quota when creating EQs
resulted wasting MTT entries, due to allocating more EQEs than were
needed.

MFC after:		3 days
Sponsored by:		Mellanox Technologies
2017-05-19 12:22:48 +00:00
Wojciech Macek
2dd020069e Poll PHY status using internal e6000sw registers
e6000sw family automatically reflects PHY status in each port's registers.
Therefore it is not necessary to do a full PHY polling squence, which
results in much quicker operation and much less significant usage of
the SMI bus.

Care must be taken that the resulting ifmedia_active is identical to
what the PHY will compute, or gratuitous link status changes will
occur whenever the PHYs update function is called.

This patch implements above improvement. On the occasion set a pointer to
the proc structure to be part of software context instead of being
a global variable.

Submitted by: Marcin Wojtas <mw@semihalf.com>
Obtained from: Semihalf
Sponsored by: Stormshield
Reviewed by: loos
Differential revision: https://reviews.freebsd.org/D10714
2017-05-19 08:24:23 +00:00
Roger Pau Monné
bf319173f2 xen/netfront: don't drop the ring RX lock with inconsistent ring state
Make sure the RX ring lock is only released when the state of the ring is
consistent, or else concurrent calls to xn_rxeof might get an inconsistent ring
state and thus some packets might be processed twice.

Note that this is not very common, and could only happen when an interrupt is
delivered while in xn_ifinit.

Reported by:	cperciva
Tested by:	cperciva
MFC after:	1 week
Sponsored by:	Citrix Systems R&D
2017-05-19 08:19:51 +00:00
Wojciech Macek
fcb93d7493 Enable proper configuration of CESA MBUS windows
For all Marvell devices, MBUS windows configuration is done
in a common place. Only CESA was an exception, so move its
related code from driver to mv_common.c. This way it uses
same proper DRAM information, same as  all other interfaces
instead of parsing DT /memory node directly.

Submitted by: Marcin Wojtas <mw@semihalf.com>
Obtained from: Semihalf
Sponsored by: Stormshield
Reviewed by: loos
Differential revision: https://reviews.freebsd.org/D10723
2017-05-19 08:19:39 +00:00
Wojciech Macek
0a6542a309 Improve busy-wait loop during switch phy access in e6000sw
Hitherto implementation of PHY polling resulted in a risk of an
endless loop and very high occupation of the SMI bus. Improve the
operation by limiting the polling tries and adding sleepable
pause.

Submitted by: Marcin Wojtas <mw@semihalf.com>
Obtained from: Semihalf
Sponsored by: Stormshield
Reviewed by: loos
Differential revision: https://reviews.freebsd.org/D10713
2017-05-19 08:16:47 +00:00
Roger Pau Monné
e5d27b37e3 xen/blkfront: correctly detach a disk with active users
Call disk_gone when the backend switches to the "Closing" state and blkfront
still has pending users. This allows the disk to be detached, and will call
into xbd_closing by itself when the geom layout cleanup has finished.

Reported by:		bapt
Tested by:		manu
Reviewed by:		bapt
Sponsored by:		Citrix Systems R&D
MFC after:		1 week
Differential revision:	https://reviews.freebsd.org/D10772
2017-05-19 08:11:15 +00:00
Mark Johnston
ed67acb779 Don't bother enqueuing a page immediately before freeing it.
No functional change intended.

MFC after:	1 week
2017-05-18 18:37:19 +00:00
Mark Johnston
02fb845bbf Fix a few uses of kern_yield() in the TTM and the LinuxKPI.
kern_yield(0) effectively causes the calling thread to be rescheduled
immediately since it resets the thread's priority to the highest possible
value. This can cause livelocks when the pattern
"while (!trylock()) kern_yield(0);" is used since the thread holding the
lock may linger on the runqueue for the CPU on which the looping thread is
running.

MFC after:	1 week
2017-05-18 18:35:14 +00:00
John Baldwin
5033c43b7a Add a driver for the Chelsio T6 crypto accelerator engine.
The ccr(4) driver supports use of the crypto accelerator engine on
Chelsio T6 NICs in "lookaside" mode via the opencrypto framework.

Currently, the driver supports AES-CBC, AES-CTR, AES-GCM, and AES-XTS
cipher algorithms as well as the SHA1-HMAC, SHA2-256-HMAC, SHA2-384-HMAC,
and SHA2-512-HMAC authentication algorithms.  The driver also supports
chaining one of AES-CBC, AES-CTR, or AES-XTS with an authentication
algorithm for encrypt-then-authenticate operations.

Note that this driver is still under active development and testing and
may not yet be ready for production use.  It does pass the tests in
tests/sys/opencrypto with the exception that the AES-GCM implementation
in the driver does not yet support requests with a zero byte payload.

To use this driver currently, the "uwire" configuration must be used
along with explicitly enabling support for lookaside crypto capabilities
in the cxgbe(4) driver.  These can be done by setting the following
tunables before loading the cxgbe(4) driver:

    hw.cxgbe.config_file=uwire
    hw.cxgbe.cryptocaps_allowed=-1

MFC after:	1 month
Relnotes:	yes
Sponsored by:	Chelsio Communications
Differential Revision:	https://reviews.freebsd.org/D10763
2017-05-17 22:13:07 +00:00
Stephen McConnell
67feec5045 Add tri-mode support (SAS/SATA/PCIe).
This includes NVMe device support and adds support for the following adapters:
    SAS 3408
    SAS 3416
    SAS 3508
    SAS 3516
    SAS 3616
    SAS 3708
    SAS 3716

Reviewed by:    ken, scottl, asomers, mav
Approved by:	ken, scottl, mav
MFC after:      2 weeks
Relnotes:	yes
Differential Revision: https://reviews.freebsd.org/D10095
2017-05-17 21:33:37 +00:00
Zbigniew Bodek
9c06c1c42a Add missing unlock in e6000sw driver
This patch adds missing unlock on attach failure.

Submitted by:  Zbigniew Bodek <zbb@semihalf.com>
Obtained from: Semihalf
Sponsored by:  Stormshield
Reviewed by: loos
Differential revision: https://reviews.freebsd.org/D10712
2017-05-17 15:59:45 +00:00
Zbigniew Bodek
7118192a72 Fix broken malloc in e6000sw
Malloc should always return something when M_WAITOK flag is used,
but keep this code and change flag to M_NOWAIT as it is under a lock
(allows for possible future change). Free ifnet structure to avoid
memory leak on failure.

Submitted by:  Zbigniew Bodek <zbb@semihalf.com>
Obtained from: Semihalf
Sponsored by:  Stormshield
Reviewed by: loos
Differential revision: https://reviews.freebsd.org/D10711
2017-05-17 15:58:39 +00:00
Josh Paetzel
5bcd39c054 Increase the number of LUNs this hardware can support.
Experimentally we know this value works, but the hardware
may support an even higher value.

PR:	213876
Reported by:	J.Catrysse@proximedia.be
MFC after:	1 week
2017-05-17 13:22:13 +00:00
Ed Maste
3e85b721d6 Remove register keyword from sys/ and ANSIfy prototypes
A long long time ago the register keyword told the compiler to store
the corresponding variable in a CPU register, but it is not relevant
for any compiler used in the FreeBSD world today.

ANSIfy related prototypes while here.

Reviewed by:	cem, jhb
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D10193
2017-05-17 00:34:34 +00:00
John Baldwin
720e7bb69c Add support for child devices that aren't ports.
Invoke any identify routines of child drivers during attach before attaching
children, and delete any remaining devices after deleting ports.

MFC after:	1 month
Sponsored by:	Chelsio Communications
2017-05-16 23:18:50 +00:00
David C Somayajulu
7a377fbeb1 QL_DPRINT macro modfied to handle multiple args; print line#.
Submitted by:Shminderjit.Singh@cavium.com
MFC after:3 days
2017-05-16 21:46:30 +00:00
David C Somayajulu
77388ed2f3 1. Move Rx Processing to fp_taskqueue(). With this CPU utilization for processing interrupts drops to around 1% for 100G and under 1% for other speeds.
2. Use sysctls for TRACE_LRO_CNT and TRACE_TSO_PKT_LEN
3. remove unused mtx tx_lock
4. bind taskqueue kernel thread to the appropriate cpu core
5. when tx_ring is full, stop further transmits till at least 1/16th of the Tx Ring is empty. In our case 1K entries. Also if there are rx_pkts to process, put the taskqueue thread to sleep for 100ms, before enabling interrupts.
6. Use rx_pkt_threshold of 128.

MFC after:3 days
2017-05-16 21:34:40 +00:00
Sean Bruno
1e3ab5fd4a Add version tag to the driver.
Start at version 1.0.0.0

Submitted by:	bhargava.marreddy@broadcom.com
Reviewed by:	venkatkumar.duvvuru@broadcom.com
Differential Revision:	https://reviews.freebsd.org/D10616
2017-05-16 18:05:34 +00:00
Luiz Otavio O Souza
018101a836 Add the Marvell SDHCI controller to the list of supported devices in
sdhci_fdt.

Enable the SDHCI controller, bus and devices on ARMADA38X kernel.

Tested on:	ClearFog Pro
Reviewed by:	Marcin Wojtas <mw at semihalf.com>
Sponsored by:	Rubicon Communications, LLC (Netgate)
Differential Revision:	https://reviews.freebsd.org/D10606
2017-05-16 05:10:15 +00:00
Jung-uk Kim
e314be0a8d - Revert r317171. [1]
- Fix overlapping corners and fix an off-by-one bug.

MFC after:	3 days
Requested by:	emaste [1]
2017-05-15 23:12:04 +00:00
Navdeep Parhar
3f1466a535 cxgbe(4): Avoid an out of bounds access when an attempt to unbind a tx
queue from a traffic class fails.

Reported by:	x ksi <s3810 at pjwstk edu pl>
MFC after:	3 days
2017-05-15 18:18:32 +00:00
Toomas Soome
6afab5ccc5 e1000api: misleading-indentation
Two blocks in e1000_ich8lan.c are misaligned, causing noise with some
compilers (gcc 6).

Reviewed by:	imp, erj
Differential Revision:	https://reviews.freebsd.org/D10741
2017-05-15 16:53:02 +00:00
Marius Strobl
806202b507 - Unlike as in the PCI case, when attached to ACPI, Intel Bay Trail
and Braswell eMMC and SDXC controllers share the same IDs. Like in
  the PCI case, Braswell eMMC needs the SDHCI_QUIRK_DATA_TIMEOUT_1MHZ
  quirk (see r311794 for the corresponding change to the sdhci(4) PCI
  PCI front-end), though. However, due to the shared ACPI IDs, this
  is trickier to do.
- Intel Apollo Lake eMMC and SDXC controllers are affected by the
  APL18 ("Using 32-bit Addressing Mode With SD/eMMC Controller May
  Lead to Unpredictable System Behavior") silicon bug [1]. When this
  erratum hits, typically both SDHCI and XHCI controllers wedge.
  According to Intel, using ADMA2 with 64-bit addressing and 96-bit
  descriptors serves as a workaround. Until such times when sdhci(4)
  has ADMA2 support, flag DMA as broken for affected interfaces.
  This turns out to work around the problem, too, at the cost of
  performance.
- In the sdhci(4) ACPI front-end, probe the Intel Apollo Lake eMMC
  and SDXC controllers, too.

1: http://www.intel.com/content/dam/www/public/us/en/documents/specification-updates/pentium-celeron-n-series-j-series-datasheet-spec-update.pdf
2017-05-14 21:33:01 +00:00
Marius Strobl
c5c43da884 Describe Intel Apollo Lake and Braswell USB 3.0 controllers. 2017-05-14 14:27:59 +00:00
Navdeep Parhar
c8da9163bf cxgbe(4): netmap-only interrupts for a VI do not have an associated rxq
or ofld_rxq and should be ignored by vi_intr_iq.

MFC after:	3 days.
Sponsored by:	Chelsio Communications
2017-05-14 09:07:13 +00:00
Adrian Chadd
b168d62f00 [iwm] Recognize IWM_FW_PAGING_BLOCK_CMD wide cmd response correctly.
Obtained from:	dragonflybsd.git ef688cebb9b29b67f7a011846589971987949e0d
2017-05-12 06:35:20 +00:00
Adrian Chadd
2df3ab2828 [iwm] Revert "if_iwm - SCAN_ABORT_UMAC response doesn't use a wide id"
This reverts commit cef47a9cbb0a3ce5f18369fed9403d2764884bc2.

Obtained from:	dragonflybsd.git f62d325820ee7f7c2bcf721ada9cef8b70f74471
2017-05-12 06:34:43 +00:00
Adrian Chadd
26ce1fcd09 [iwm] Fix iwm_mvm_send_cmd_pdu(_status) declarations. Make id a uint32_t.
* This fixes cases where the group id of wide commands got lost, e.g. this
  happened to the IWM_SCAN_ABORT_UMAC command.

Obtained from:	dragonflybsd.git 71310fab0caca79bb5da43d9d642e77a4c27eea2
2017-05-12 06:33:55 +00:00
Adrian Chadd
c048736782 [iwm] Adjust if_iwm_sta.h prototypes, don't pass iwm_node to rm_sta().
* Since a RUN -> INIT/SCAN transition seems to immediately destroy the
  ieee80211_node for the AP, we can't read the in_assoc value from there.
  Instead just directly pass that information via a boolean_t argument.

* Adds iwm_mvm_rm_sta_id() function, which just unconditionally removes
  the station from the firmware.

* The iwm_mvm_rm_sta() function shouldn't actually remove the station from
  firmware when we are still associated (i.e. during a RUN -> INIT/SCAN
  transition).

 * So when disassociating we will first call iwm_mvm_rm_sta() to drain the
   queues/fifos. Later during disassociation we will then use
   iwm_mvm_rm_sta_id() to actually remove the station.

Inspired-By: Linux iwlwifi

Obtained from:	dragonflybsd.git 81b3c1fe9122fa22f33d97103039cc375f656231
2017-05-12 06:33:07 +00:00
Adrian Chadd
be793bcd46 [iwm] Make powersaving more similar to Linux iwlwifi behaviour.
* Add a per-vap ps_disabled flag, and use it for a workaround which fixes
  an association issue when powersaving is enabled.

* Compute flag that should correpsond to the mvmif->bss_conf.ps flag in
  Linux's iwlwifi (e.g. this disallows powersaving when not associated
  yet).

Inspired-By: Linux iwlwifi

Obtained from:	dragonflybsd.git dc2e69bdfe8c9d7049c8a28da0adffbfbc6de5c0
2017-05-12 06:31:57 +00:00
Adrian Chadd
a8f12a3682 [iwm] Clean up if_iwm_power.c a bit. Fix iwm_power_scheme debug print.
Obtained from:	dragonflybsd.git 52c3adbee676d8558065618e5ad694ea5c6697e0
2017-05-12 06:30:50 +00:00
Adrian Chadd
48452813cb [iwm] Switch arguments from iwm_node* to iwm_vap* in if_iwm_power.c.
* Power management handling is per-vap, not per-node, so we should pass
  the iwm_vap in these arguments.

Obtained from:	dragonflybsd.git 62a4e7957a736b4de38938b02fa7eb9b45bc5d0d
2017-05-12 06:30:06 +00:00
Adrian Chadd
f1bd8a14fa [iwm] Already call iwm_mvm_power_update_mac() during SCAN<->AUTH paths.
* Otherwise we would never update powersaving settings until we complete
  an association, after the first authentication attempt.

* This corresponds to what Linux iwlwifi seems to do.

Obtained from:	dragonflybsd.git aa128dc02a17c2e616232ef0fa997121e969c995
2017-05-12 06:21:03 +00:00
Adrian Chadd
f7be9693b2 [iwm] Refuse connection to APs with beacon interval < 16.
Obtained from:	dragonflybsd.git aba448de727e9b122adadeb36fd00a8ad6018d4f
2017-05-12 06:16:11 +00:00
Adrian Chadd
00f22ee771 [iwm] Handle AUTH->SCAN/INIT and ASSOC->SCAN/INIT better
* Tear down the relevant firmware state (i.e. the station, the vif binding)
  in these transition cases.

* Before this case would leave the firmware state lying around, resulting
  in errors and firmware panics in the subsequent association attempts.

Obtained from:	dragonflybsd.git 94b501399fde6368ae388a669c95b099a6e66e93
2017-05-12 06:05:34 +00:00
Adrian Chadd
f48f696087 [iwm] Factor out firmware station handling into if_iwm_sta.c.
* This adds iwm_mvm_rm_sta(), which will be used to tear down firmware
  state for better/cleaner iwm_newstate() handling.

* Makes iwm_enable_txq() and iwm_mvm_flush_tx_path() non-static, add
  the declarations to if_iwm_util.h for now.

Obtained from:	dragonflybsd.git 85d1c6190c4c3564b1a347f253e823aa95c202b2
2017-05-12 06:03:23 +00:00
Adrian Chadd
16604ae07c [iwm] Deduplicate code in iwm_auth() from an if condition.
Obtained from:	dragonflybsd.git 03c6e6970115727c9d39f9358e0500ab4f4634cd
2017-05-12 05:53:28 +00:00
Adrian Chadd
f7f5c0102c [iwm] No need for iwm_assoc() in AUTH->ASSOC transition.
* Hence no need to keep stuff in separate iwm_assoc() function, just
  inline the stuff into iwm_newstate().

Obtained from:	dragonflybsd.git e8f7d88e0d030f138f95ecdb7c1a729d9fb0d6ab
2017-05-12 05:51:50 +00:00
Adrian Chadd
b80e7ca55b [iwm] Properly implement iwm_wme_update callback function.
* Inspired by iwn(4) and Linux iwlwifi.

* Read wme parameters into a buffer within struct iwm_vap in
  iwm_wme_update().

* If we aren't associated yet, the new settings will soon be sent
  by iwm_mvm_mac_ctxt_changed() during association.

* If we are already associated, explicitly call iwm_mvm_mac_ctxt_changed()
  from iwm_wme_update() to send the new settings to the firmware.

* Change iwm_mvm_ac_to_tx_fifo mapping, to fit the freebsd net80211
  WME stream class numbering, instead of Linux's enum ieee80211_ac_numbers.

Obtained from:	dragonflybsd.git b8bd6cd746d1f45e616ccfcbeed06dfe452a1108
2017-05-12 05:50:38 +00:00
Adrian Chadd
702287e43a [iwm] Process multiple frames per RX buffer.
* Factor out iwm_handle_rxb() function from iwm_notif_intr().

* Removing the IWM_FH_RCSR_CHNL0_RX_CONFIG_SINGLE_FRAME_MSK flag allows
  the device to put multiple frames (both command responses and 80211
  frames) into a single RX buffer.

* Uses m_copym() to split up the receive buffers when multiple 80211
  frames are received in one RX buffer. The effect is basically the same
  as when using m_split(), but we want to keep the original mbuf around
  when calling iwm_mvm_rx_rx_mpdu() to make error handling a bit easier
  for now.

* Contains a small optimization to avoid the m_copym() when only a single
  80211 frame is received in one RX buffer (i.e. matching the existing
  behaviour).

Obtained from:	dragonflybsd.git b5eb43f0280bbcfd26af51cf5a4b8e8ff3590b67
2017-05-12 05:49:24 +00:00
Adrian Chadd
5f39493aa4 [iwm] Change UCODE_TLV_API #define-s from bitmasks to indexes.
* Fixes oversight from commit 757eecf0e6c92745aa2eee95811e573c8300850e.
  fw_has_api now uses the isset macro instead of a simple logical-and.

Obtained from:	dragonflybsd.git c00575de8491dc402abf52c8c7e1cca1ef79e257
2017-05-12 05:30:01 +00:00
Adrian Chadd
a88f1dbf42 [iwm] Sync iwm_read_firmware()'s loop to iwlwifi's code.
Obtained from:	dragonflybsd.git d1c10ccfcf2d6d2a664f17197add0b4f93333181
2017-05-12 05:28:49 +00:00
Adrian Chadd
b72d4b835b [iwm] change the check for ADD_STA status, use IWM_ADD_STA_STATUS_MASK.
Obtained from:	dragonflybsd.git 74d41163ddac72b0d7ea7b7873d53fe134723a12
2017-05-12 05:22:29 +00:00
Adrian Chadd
5d2fcafc23 [iwm] Sanity check channel for IEEE80211_CHAN_ANYC in if_iwm_mac_ctxt.c.
* This avoids panicing in some broken vap state handling cases.

Obtained from:	dragonflybsd.git 10d5b77b5421e7cbcc426160edbe858d1d610a29
2017-05-12 05:21:50 +00:00
Adrian Chadd
2863c11c8f [if_iwm] Get rid of another usage of the IWM_DEFAULT_MACID/_COLOR constant.
Obtained from:	dragonflybsd.git c009badecf7b1389cd86adde9fd35f6113c75b5b
2017-05-12 05:21:02 +00:00
Adrian Chadd
bdba683047 [if_iwm] Partly sync if_iwm_binding.c to Linux iwlwifi code.
* Store macid and color values in struct iwm_vap, to avoid hardcoded
  constants a bit.

* Add iwm_mvm_binding_remove_vif() function (will be used in disconnecting
  from an access point without resetting the whole device).

* Not adding code from Linux iwlwifi yet, to handle one PHY context to
  be bound to several VAPs/virtual-interfaces, it's definitely not needed
  in the near future.

Obtained from:	dragonflybsd.git f16ef74977e51e1bfc7a625dd18b98b02158e0e5
2017-05-12 05:19:08 +00:00
Justin Hibbits
fff0aa3e6e Use UMA_ALIGN_PTR to specify pointer alignment
Suggested by:	jhb
2017-05-12 04:10:02 +00:00
Scott Long
855fe445b3 Improve error messages during command timeout for the mpr and mps
drivers.

Sponsored by:	Netflix
2017-05-11 15:19:04 +00:00
Justin Hibbits
f9e7a80482 Fix uma_zcreate() align argument, now that the constraint is asserted.
The alignment argument is the mask of low bits to mask off when allocating
items in a zone, not the block-size alignment.
2017-05-11 03:47:58 +00:00
Sepherosa Ziehau
554e6778b6 hyperv/vmbus: Reorganize vmbus device tree
For GEN1 Hyper-V, vmbus is attached to pcib0, which contains the
resources for PCI passthrough and SR-IOV.  There is no
acpi_syscontainer0 on GEN1 Hyper-V.

For GEN2 Hyper-V, vmbus is attached to acpi_syscontainer0, which
contains the resources for PCI passthrough and SR-IOV.  There is
no pcib0 on GEN2 Hyper-V.

The ACPI VMBUS device now only holds its _CRS, which is empty as
of this commit; its existence is mainly for upward compatibility.

Device tree structure is suggested by jhb@.

Tested-by:	dexuan@
Collabrated-wth:	dexuan@
MFC after:	1 week
Sponsored by:	Microsoft
Differential Revision:	https://reviews.freebsd.org/D10565
2017-05-10 05:28:14 +00:00
David C Somayajulu
03b856d6f3 llh_func_filter needs to be configured for 100G
MFC after:3 days
2017-05-10 01:01:20 +00:00
Navdeep Parhar
b2d8f4934e Adjust whitespace and fix a comment. No functional change.
MFC after:	3 days
2017-05-10 00:42:28 +00:00
Luiz Otavio O Souza
915780d764 Add a new SDHCI quirk, SDHCI_QUIRK_BROKEN_AUTO_STOP, to workaround
controllers that do not support or have broken ACMD12 implementations.

Reviewed by:	jmcneill
Obtained from:	NetBSD
MFC after:	2 weeks
Sponsored by:	Rubicon Communications, LLC (Netgate)
Differential Revision:	https://reviews.freebsd.org/D10602
2017-05-09 19:01:57 +00:00
Navdeep Parhar
1404daa76c cxgbe(4): Do not assume that if_qflush is always followed by inteface-down.
MFC after:	3 days
Sponsored by:	Chelsio Communications
2017-05-09 18:33:41 +00:00
Navdeep Parhar
e006d2a6fd cxgbe(4): Fixes related to the knob that controls link autonegotiation.
- Do not leak the adapter lock in sysctl_autoneg.
- Accept only 0 or 1 as valid settings for autonegotiation.
- A fixed speed must be requested by the driver when autonegotiation is
  disabled otherwise the firmware will reject the l1cfg command.  Use
  the top speed supported by the port for now.

MFC after:	3 days
Sponsored by:	Chelsio Communications
2017-05-09 08:08:28 +00:00
Adrian Chadd
f32adafde1 [iwm] Move in_phyctxt from struct iwm_node to phy_ctxt in struct iwm_vap.
* This better matches how things are organized in Linux's iwlwifi.

Obtained from:	dragonflybsd.git 0cf16dd2e0e09a3e5140e50222ac2e69bcdb19a2
2017-05-09 05:32:35 +00:00
Adrian Chadd
c44c4d8d92 [iwm] Allow listening on both chains/atennas to get diversity.
This might improve throughput slightly when far from the accesspoint,
apparently by allowing the firmware to listen on either of the two
antennas (if there are two, i.e. on 7260/7265/8260), whichever has
a better reception.

Obtained from:	dragonflybsd.git 3b7fc5aac51f81062da0a2c8fdac23e683fbd548
2017-05-09 05:31:38 +00:00
Adrian Chadd
08e1076cf6 [iwm] Add basic powermanagement support via ifconfig wlan0 powersave.
* The DEVICE_POWER_FLAGS_CAM_MSK flag was removed in the upstream iwlwifi
  in Linux commit ceef91c89480dd18bb3ac51e91280a233d0ca41f.

* Add sc_ps_disabled flag to struct iwm_softc, which corresponds to
  mvm->ps_disabled in struct iwl_mvm in Linux iwlwifi.

* Adds a hw.iwm.power_scheme tunable which corresponds to the power_scheme
  module parameter in Linux iwlwifi. Set this to 1 for completely
  disabling power management, 2 (default) for balanced powermanagement,
  and 3 for lowerpower mode (which does dtim period skipping).

* Imports the constants.h file from iwlwifi as if_iwm_constants.h.

* This doesn't allow changing the powermanagement setting while connected,
  also one can only choose between enabled and disabled powersaving with
  ifconfig (so switching between balanced and low-power mode requires
  rebooting to change the tunable).

* After any changes to powermanagement (i.e. "ifconfig wlan0 powersave" to
  enable powermanagement, or "ifconfig wlan0 -powersave" for disabling
  powermanagement), one has to disconnect and reconnect to the accespoint
  for the change to take effect.

Obtained from:	dragonflybsd.git d7002a7990d077c92585978ea998474af50f91e0
2017-05-09 04:15:07 +00:00
Adrian Chadd
522f6fe474 [iwm] Add iwm_nic_unlock() calls missing from previous commit.
Obtained from:	dragonflybsd.git f88ab372284e63c4c13da93e9026a203b9b4cdc5
2017-05-09 02:42:53 +00:00
Adrian Chadd
ab492a5732 [iwm] iwm_{read,write}_prph() don't grab the nic lock in iwm themselves.
* Fix a couple of cases where the nic lock ended up not being grabbed
  during an iwm_read_prph() or iwm_write_prph().

Obtained from:	dragonflybsd.git 6c5470f2db219c61e362c981fea969d97e1b8293
2017-05-09 02:41:33 +00:00
Adrian Chadd
616201d1f7 [iwm] include opt_iwm.h and opt_wlan.h consistently in all files. 2017-05-09 02:38:23 +00:00
David C Somayajulu
77d57b28dd Fix bug where MTX_DEF lock was held while taskqueue_drain() was invoked.
Check IFF_DRV_RUNNING flag is set prior to calling ql_hw_set_multi()

MFC after:3 days
2017-05-09 01:01:41 +00:00
Adrian Chadd
01c914420d [mips] [rt2880] Add oldest Ralink MIPS SOC RT2880 support code.
* Target module have ic plus etherswitch ip175c.
* Also add etherswitch support code on rt driver.

Reviewed by:	mizhka
Differential Revision:	https://reviews.freebsd.org/D10336
2017-05-06 06:20:34 +00:00
Adrian Chadd
2f57841ee4 [mx25l] add new device ids.
Submitted by:	Hiroki Mori <yamori813@yahoo.co.jp>
Differential Revision:	https://reviews.freebsd.org/D10621
2017-05-06 06:08:44 +00:00
Adrian Chadd
034aec8568 [etherswitch] [e6000sw] fix compile issue under clang/arm
Submitted by:	Hiroki Mori <yamori813@yahoo.co.jp>
Approved by:	mizhka
Differential Revision:	https://reviews.freebsd.org/D10563
2017-05-06 06:07:44 +00:00
Adrian Chadd
a99badc23e [ip17x] [etherswitch] fdt away and mii hang workaround on ip17x
Add workaround mii access because of rt1310 is hang up on etherswitch mii poll.
And FDT away on arm platform.

Tested:

* wzr2-g300n

Submitted by:	Hiroki Mori <yamori813@yahoo.co.jp>
Reviewed by:	mizhka
Differential Revision:	https://reviews.freebsd.org/D10295
2017-05-06 05:53:42 +00:00
Adrian Chadd
6bf13692f9 [cfi] fix CFI flash reset command for MX29LV320T/B.
MX flash MX29LV320T/B datasheet say reset is 0xf0.

Submitted by:	Hiroki Mori <yamori813@yahoo.co.jp>
Approved by:	mizhka
Differential Revision:	https://reviews.freebsd.org/D10177
2017-05-06 05:52:01 +00:00
Adrian Chadd
4aa177430c [infineon] [etherswitch] no hardcode tagging port setting at amd6996fc
Tagging port can set by etherswitchcfg command.

Tested:

* on Netgear_WGR614Cv7

Submitted by:	Hiroki Mori <yamori813@yahoo.co.jp>
Reviewed by:	mizhka
2017-05-06 05:50:07 +00:00
Navdeep Parhar
6790499792 cxgbe/t4_tom: Per-connection rate limiting for TCP sockets handled by
the TOE.  For now this capability is always enabled in kernels with
options RATELIMIT.  t4_tom will check if_capenable once the base driver
gets code to support rate limiting for any socket (TOE or not).

This was tested with iperf3 and netperf ToT as they already support
SO_MAX_PACING_RATE sockopt.  There is a bug in firmwares prior to
1.16.45.0 that affects the BSD driver only and results in rate-limiting
at an incorrect rate.  This will resolve by itself as soon as 1.16.45.0
or later firmware shows up in the driver.

Relnotes:	Yes
Sponsored by:	Chelsio Communications
2017-05-05 20:06:49 +00:00
Navdeep Parhar
1dc02549c3 cxgbe(4): The Tx scheduler initialization either works or doesn't. It
doesn't need a refresh in either case.

Sponsored by:	Chelsio Communications
2017-05-05 19:34:05 +00:00
Navdeep Parhar
49c0beb6f5 cxgbe(4): Update the VF device ids too. This should have been part
of r317820.

Reported by:	jhb@
MFC after:	1 week
Sponsored by:	Chelsio Communications
2017-05-05 16:52:25 +00:00
Sepherosa Ziehau
786e5b94b9 hyperv/kbd: Channel read expects non-NULL channel argument.
MFC after:	now
Sponsored by:	Microsoft
2017-05-05 03:28:30 +00:00
Navdeep Parhar
63febe64f1 cxgbe(4): Update the list of PCIe devices claimed by the driver. At
this point any board with a T6 should just work.

Obtained from:	Chelsio Communications
MFC after:	1 week
Sponsored by:	Chelsio Communications
2017-05-05 00:54:23 +00:00
Vladimir Kondratyev
ae3b1e4a34 Reduce synaptics touch sensitivity
Increase hw.psm.synaptics.min_pressure default value from 16 to 32
to nearly match Linux driver (30-35 hysteresis loop).
This makes libinput tap detection more reliable.

Reviewed by:	gonzo
Approved by:	gonzo (mentor)
MFC after:	2 weeks
2017-05-04 23:19:27 +00:00
Vladimir Kondratyev
bc2b1516be psm(4): Remove sys/libkern.h header inclusion
It is already included via sys/systm.h

Reviewed by:	gonzo
Approved by:	gonzo (mentor)
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D10266
2017-05-04 23:17:21 +00:00
Vladimir Kondratyev
21cb8f6288 Set predefined logical touchpad sizes for several ancient Elan hw v.2
models. This change is based on Linux driver.
Determine logical trace size. It used for calculation of touch sizes
in surface units for MT-protocol type B evdev reports.

Reviewed by:	gonzo
Approved by:	gonzo (mentor)
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D10266
2017-05-04 23:12:45 +00:00
Vladimir Kondratyev
6c85d7cb32 Report 3-rd and 4-th fingers as first finger for Elan hw v.2 and v.3 as
Linux does. It should not affect gesture processing in current state as it
ignores finger coords on 3-finger tap detection but it should make evdev
reports looking more Linux-alike.

Reviewed by:	gonzo
Approved by:	gonzo
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D10266
2017-05-04 23:08:55 +00:00
Vladimir Kondratyev
eb65854355 Enable palm detection on two finger touches for multitouch trackpads.
Reviewed by:	gonzo
Approved by:	gonzo (mentor)
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D10266
2017-05-04 23:04:52 +00:00
Vladimir Kondratyev
848714bcb4 psm(4): reduce cursor jumping on palm detection
This is done with discarding pointer movements rather then mouse packets

Reviewed by:	gonzo
Approved by:	gonzo (mentor)
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D10266
2017-05-04 23:02:34 +00:00
Vladimir Kondratyev
8a98c8c412 Adjust Elantech palm width threshold to nearly match synaptics defaults
Reviewed by:	gonzo
Approved by:	gonzo (mentor)
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D10266
2017-05-04 22:53:45 +00:00
Vladimir Kondratyev
51de77dd3d Reduce default tap_min_queue size for Elan touchpads
Elan hw v.4 touchpads often sends touchpad release packet right after
touchpad touch one. Most probably this happens due to PS/2 limited bandwith.
Reducing of tap_min_queue size to 1 makes multifinger tap detection
more reliable in this case.

Reviewed by:	gonzo
Approved by:	gonzo (mentor)
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D10266
2017-05-04 22:51:22 +00:00
Vladimir Kondratyev
933ef2d3b2 Fix triple-finger taps reported as double-finger for Elan hw v.4 touchpads
Wait for all advertised head packets after status packet have been received.
This fixes rare but quite annoying issue in Elan hw v.4 touchpads support
when triple-finger taps are reported as double-finger taps under several
circumstances.

Reviewed by:	gonzo
Approved by:	gonzo (mentor)
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D10266
2017-05-04 22:47:18 +00:00
Gleb Smirnoff
93ed1e805b The nandsim(4) simulator driver doesn't have any protection against
races at least in its ioctl handler, and at the same time it creates
device entry with 0666 permissions.

To plug possible issues in it:
- Mark it as needing Giant.
- Switch device mode to 0600.

Submitted by:	C Turt
Reviewed by:	imp
MFC after:	1 week
Security:	Possible double free in ioctl handler
2017-05-04 20:42:31 +00:00
Luiz Otavio O Souza
cd39450155 Add support for the no-1-8-v and wp-inverted properties in generic SDHCI
FDT glue.

MFC after:	2 weeks
Sponsored by:	Rubicon Communications, LLC (Netgate)
2017-05-04 18:56:11 +00:00
Sean Bruno
00c230410f bnxt: Add support for new Broadcom 100Gb adapter BCM57454
Submitted by:	bhargava.marreddy@broadcom.com
Reviewed by:	venkatkumar.duvvuru@broadcom.com
Differential Revision:	https://reviews.freebsd.org/D10595
2017-05-04 15:26:28 +00:00
Alexander Motin
31da007f7e Fix typo in r317659.
MFC after:	2 weeks
2017-05-03 16:34:03 +00:00
Kenneth D. Merry
57b6261f94 Correct loop mode CRN resets to adhere to FCP-4 section 4.10
Prior to this change, the CRN (Command Reference Number) is reset on any
firmware LIP, LOOP DOWN, or LOOP RESET event in violation of FCP-4 which
specifies that the CRN should only be reset in response to a LIP Reset
(LIPyx) primitive. FCP-4 also indicates PLOGI/LOGO and PRLI/PRLO ELS
actions as conditions for resetting the CRN for the associated initiator
port.

These violations manifest themselves when the HBA is removed from the
loop, or a target device is removed (especially during an outstanding
command) without power cycling. If the HBA and and the target device
determine upon re-establishing the loop that no PLOGI or PRLI is
required, and the target does not issue a LIPxy to the initiator, the
CRN for the target will have been improperly reset by the isp driver. As
a result, the target port will silently ignore all FCP commands issued
during the device probe (which will time out) preventing the device from
attaching.

This change corrects thie CRN reset behavior in response to loop state
changes, also introduces CRN resets for the above mentioned ELS actions
as encountered through async PDB change events.

This change also adds cleanup of outstanding commands in isp_loop_dead()
that was previously missing.

sys/dev/isp/isp.c
	Add the last login state to debug output when syncing the pdb

sys/dev/isp/isp_freebsd.c
	Replace binary statement setting aborted ccb status in
	isp_watchdog() with the XS_SETERR macro used elsewhere

	In isp_loop_dead(), abort or complete pending commands as done
	in isp_watchdog()

	In isp_async(), segregate the ISPASYNC_LOOP_RESET action from
	ISPASYNC_LIP, ISPASYNC_LOOP_DOWN, and ISPASYNC_LOOP_UP
	fallthroughs, and only reset the CRN in the RESET case. Also add
	checks to handle false LOOP RESET actions that do not have a
	proper associated LIP primitive, and log the primitive in the
	debug messages

	In isp_async(), remove the goto from ISP_ASYNC_DEV_STAYED, and
	only reset the CRN in the DEV_CHANGED action

	In isp_async(), when processing an ISPASYNC_CHANGE_PDB status,
	reset CRN(s) for the associated nphdl (or all ports) if the
	change reason is some form of ELS login/logout. Also remove
	assignment to fc since it is not used in the scope

sys/dev/isp/ispmbox.h
	Add macro definition for the global N-Port handle, and correct a
	macro typo 'PDB24XX_AE_PRLI_DONJE'

sys/dev/isp/ispvar.h
	Add macros FCP_AL_DA_ALL, FCP_AL_PA, and FCP_IS_DEST_ALPD for
	more legible code when determining if an AL_PD port matches the
	portid for a given struct fcparam* by value or by virtue of the
	AL_PD port being 0xFF

Submitted by:	Reid Linnemann
Sponsored by:	Spectra Logic
MFC after:	1 week
2017-05-03 13:17:01 +00:00
Navdeep Parhar
2204b42716 cxgbe(4): Support routines for Tx traffic scheduling.
- Create a new file, t4_sched.c, and move all of the code related to
  traffic management from t4_main.c and t4_sge.c to this file.
- Track both Channel Rate Limiter (ch_rl) and Class Rate Limiter (cl_rl)
  parameters in the PF driver.
- Initialize all the cl_rl limiters with somewhat arbitrary default
  rates and provide routines to update them on the fly.
- Provide routines to reserve and release traffic classes.

MFC after:	1 month
Sponsored by:	Chelsio Communications
2017-05-02 20:38:10 +00:00
Alexander Motin
4e352a4583 Make some UART consoles to not spin wait for data to be sent.
At least with Tx FIFO enabled it shows me ~10% reduction of verbose boot
time with serial console at 115200 baud.

Reviewed by:	marcel
MFC after:	2 weeks
2017-05-01 19:47:10 +00:00
Luiz Otavio O Souza
ebde1aafa8 When the switch is set to operate in the Multi Chip Addressing Mode we
cannot access the GLOBAL2 register directly.

Despite the comment in code (which was misleading), the indirect access is
only used to read the switch CONFIG data from the scrap register and not
for the GLOBAL2 access.

Use the dsa data to define when the switch is in the Multi Chip Addressing
Mode (a even address different than zero).

While here fix a typo.

Sponsored by:	Rubicon Communications, LLC (Netgate)
2017-04-30 07:51:31 +00:00
Luiz Otavio O Souza
948dad6add Set the correct default for #address-cells variable when the property does
not exist.

This has never caused any issue because #address-cells is mandatory.

Sponsored by:	Rubicon Communications, LLC (Netgate)
MFC after:	2 weeks
2017-04-30 07:31:48 +00:00
Yoshihiro Takahashi
9b046370ae Add TUNABLE_INT to radeonkms driver parameters.
They are required by PowerMac G5 DP.

PR:		217852
Submitted by:	Hiroo Ono
MFC after:	1 week
2017-04-29 09:47:15 +00:00
Pedro F. Giffuni
336c5fb5cd Fix some cases where an index was used before its limits check.
Obtained from:	DragonFlyBSD (git 799ba435)
MFC after:	5 days
2017-04-29 06:41:51 +00:00
Hans Petter Selasky
8b48354659 Improve sysadmin visibility of physical port error counters in the
mlx5en driver.

MFC after:		1 week
Sponsored by:		Mellanox Technologies
2017-04-28 19:38:57 +00:00
Jung-uk Kim
a0f9777dc4 Simplify the code a bit. No functional change. 2017-04-28 16:42:52 +00:00
Jung-uk Kim
0e37dd1fee Fix end coordinate of the drawable area of border. Although the name tr_end
suggests it is the end coordinate, tr_end.tp_row is width and tr_end.tp_col
is height of the drawable area in reality.

PR:		202288
2017-04-28 16:39:09 +00:00
John Baldwin
1ffd07bde6 Various fixes for PCI _OSC handling so HotPlug works again.
- Rename the default implementation of 'pcib_request_feature' and add
  a pcib_request_feature() wrapper function (as is often done for
  new-bus APIs implemented via kobj) that accepts a single function.
  Previously the call to pcib_request_feature() ended up invoking the
  method on the great-great-grandparent of the bridge device instead
  of the grandparent.  For a bridge that was a direct child of pci0 on
  x86 this resulted in the method skipping over the Host-PCI bridge
  driver and being invoked against nexus0
- When invoking _OSC from a Host-PCI bridge driver, invoke
  device_get_softc() against the Host-PCI bridge device instead of the
  child bridge that is requesting HotPlug.  Using the wrong softc data
  resulted in garbage being passed for the ACPI handle causing the
  _OSC call to fail.
- While here, perform some other cleanups to _OSC handling in the ACPI
  Host-PCI bridge driver:
  - Don't invoke _OSC when requesting a control that has already been
    granted by the firmware.
  - Don't set the first word of the capability array before invoking
    _OSC.  This word is always set explicitly by acpi_EvaluateOSC()
    since it is UUID-independent.
  - Don't modify the set of granted controls unless _OSC doesn't exist
    (which is treated as always successful), or the _OSC method
    doesn't fail.
  - Don't require an _OSC status of 0 for success.  _OSC always
    returns the updated control mask even if it returns a non-zero
    status in the first word.
  - Whine if _OSC ever tries to revoke a previously-granted control.
    (It is not supposed to do that.)
- While here, add constants for the _OSC status word in acpivar.h
  (though currently unused).

Reported by:	adrian
Reviewed by:	imp
MFC after:	1 week
Tested on:	Lenovo x220
Differential Revision:	https://reviews.freebsd.org/D10520
2017-04-27 16:32:42 +00:00
John Baldwin
32455e8912 Revert r317446 and bring back cy(4).
Requested by:	bde
2017-04-27 16:14:32 +00:00
Hans Petter Selasky
791c9d7848 Don't free uninitialized sysctl contexts in the mlx4en driver. This
can cause NULL pointer panics during failed device attach.

Differential Revision:	https://reviews.freebsd.org/D8876
MFC after:		1 week
Sponsored by:		Mellanox Technologies
2017-04-27 14:39:52 +00:00
John Baldwin
a63222db3a Remove the cy(4) driver for Cyclades serial adapters.
This driver has been disconnected from the build since the new tty
layer was introduced in 8.0 and was never updated for new tty.
2017-04-26 18:23:09 +00:00
Olivier Houchard
b05e505d6d Check if the device is marked as dma-coherent in the FDT, and if so, let
busdma know, so that on architectures where dma isn't always coherent, we
know we don't have to write-back/invalidates cachelines on DMA operations.

Reviewed by:	andrew, mav
2017-04-26 16:13:22 +00:00
John Baldwin
ee990cefd9 Remove the source to digi(4).
This was forgotten when the driver was removed in r305235.
2017-04-25 23:29:41 +00:00
Navdeep Parhar
034b4dcfa8 cxgbe/iw_cxgbe: Pull in some updates to c4iw_wait_for_reply from the
iw_cxgb4 Linux driver.

Obtained from:	Chelsio Communications
MFC after:	3 days
Sponsored by:	Chelsio Communications
2017-04-25 16:54:27 +00:00
Brooks Davis
a7dc31283a Remove the NATM framework including the en(4), fatm(4), hatm(4), and
patm(4) devices.

Maintaining an address family and framework has real costs when we make
infrastructure improvements.  In the case of NATM we support no devices
manufactured in the last 20 years and some will not even work in modern
motherboards (some newer devices that patm(4) could be updated to
support apparently exist, but we do not currently have support).

With this change, support remains for some netgraph modules that don't
require NATM support code. It is unclear if all these should remain,
though ng_atmllc certainly stands alone.

Note well: FreeBSD 11 supports NATM and will continue to do so until at
least September 30, 2021.  Improvements to the code in FreeBSD 11 are
certainly welcome.

Reviewed by:	philip
Approved by:	harti
2017-04-24 21:21:49 +00:00
Landon J. Fuller
eb23aa8008 Add support for dumping bcma/siba EROM tables to the console via a new
BHND_EROM_DUMP() method.

Dump the EROM tables to the coneole on mips/broadcom devices if bootverbose
is enabled; this functionality is primarily useful when debugging SoC EROM
parsing and device matching issues during early boot.

Reviewed by:	mizhka
Approved by:	adrian (mentor)
Sponsored by:	Plausible Labs
Differential Revision:	https://reviews.freebsd.org/D10122
2017-04-24 18:35:25 +00:00
Landon J. Fuller
b78f353f8a Drop unused/unnecessary return statement.
Reported by:	Coverity
CID:		1373118
Approved by:	adrian (mentor, implicit)
2017-04-24 18:09:52 +00:00
Andrew Turner
574a7c6c47 Call the PSCI reset from cpu_reset on arm64. When rebooting from DDB the
kernel calls this directly so the event handler is not called, meaning
the computer fails to reboot.

Tested by:	cognet
MFC after:	1 week
Sponsored by:	DARPA, AFRL
2017-04-24 11:06:10 +00:00
Alexander Motin
1c779b2849 Switch isp_reset to scratchpad not requiring ISP_MBOXDMASETUP.
MFC after:	1 week
2017-04-24 10:16:12 +00:00
Alexander Motin
5a5b6d1979 Use proper alignment constant for uma_zcreate().
Previous code panicked on KASSERT with INVARIANTS enabled.

MFC after:	2 weeks
2017-04-24 08:44:51 +00:00
Sepherosa Ziehau
cc0c6ebc14 hyperv/hn: Use channel0, i.e. TX ring0, for TCP SYN/SYN|ACK.
Hyper-V hot channel effect:
Operation latency on hot channel is only _half_ of the operation
latency on cold channels.

This commit takes the advantage of the above Hyper-V host channel
effect, and can reduce more than 75% latency and more than 50%
latency stdev, i.e. lower and more stable/predictable latency,
for various types of web server workloads.

MFC after:	3 days
Sponsored by:	Microsoft
2017-04-24 07:52:27 +00:00
Alexander Motin
48c4767756 Report NTB link speed to console and interface.
MFC after:	2 weeks
2017-04-23 14:25:51 +00:00
Bruce Evans
bfbcb15f76 Change the drawing method for the mouse cursor in planar mode to support
colors.

Colors are still hard-coded as 15 (normally lightwhite) for the interior
and 0 (normally black) for the border, but these are now values used in
2 expressions instead of built in to the algorithm.  The algorithm used
a fancy and/or method, but this gives no control over the colors except
and'ing all color planes off gives black and or'ing all color planes on
gives lightwhite.  Just draw the border and interior in separate colors
using the same method as for characters, including its complications to
optimize for VGA adaptors.  Optimization is not really needed here, but
for the VGA case it avoids being slower than the and/or method.  The
optimization is worth about 30%.
2017-04-23 08:59:35 +00:00
Bruce Evans
6284ff8398 Optimize setting of the foreground color in the main planar method much
like for the background color.

This is a about 5% faster for output that actually reaches the screen.
2017-04-21 17:57:23 +00:00
Bruce Evans
3df57f416b Merge the main ega drawing method into the main vga planar method and
remove the former.

All other EGA/VGA methods were already shared, with VGA-only features
mostly not used and no decisions in inner loops to optimize fof VGA,
but this method was split up because it is the only important one and
using VGA methods if possible is about twice as fast.  The speed is
mostly not from splitting to reduce branches but from doing half as
many bus accesses, so make this easier to maintain by not splitting.
There is now 1 extra branch in an inner loop where it costs less than
1% of the bus access overhead on Haswell even if the compiler schedules
it poorly.
2017-04-21 15:12:43 +00:00
Bruce Evans
56e7a784ac Oops, the previous commit swapped the main ega method with the main
vga planar method (for testing that was supposed to be local that the
former still works).  The ega method works on vga but is about twice
as slow.  The vga method doesn't work on ega.

Optimize the main vga planar method a little.  For changing the
background color (which was otherwise optimized better than most
things), don't switch the write mode from 3 to 0 just to select
the pixel mask of 0xff obscurely by writing 0.  Just write 0xff
directly.
2017-04-21 06:55:17 +00:00
Bruce Evans
2d445fb18c Eliminate the ega renderer switch. It did nothing useful except hold
a pointer to the main ega drawing method which is misoptimized be in
a different function than the main vga planar mode drawing method.
Vga initialization handles everything with no extra code except for
selecting the different function.
2017-04-20 17:22:03 +00:00
Bruce Evans
55d26fc07c When the character width is 9, remove vertical lines in the mouse cursor
corresponding to the gaps between characters.  This fixes distortion
of the cursor due to expanding it across the gaps.

Again for character width 9, when the cursor characters are not in the
graphics range (0xb0-0xdf), the gaps were always there (filled in the
background color for the previous char).  They still look strange, but
don't cause distortion.  When the cursor characters are in the graphics
range, the gaps are filled by repeating the previous line.  This gives
distortion with cilia.  Removing vertical lines reduces the distortion
to vertical cilia.

Move the default for the cursor characters out of the graphics range.
With character width 9, this gives gaps instead of distortion and
other problems.  With character width 8, it just fixes a smaller set
of other problems.  Some distortion and other problems can be recovered
using vidcontrol -M.  Presumably the default was to fill the gaps
intentionally, but it is much better to leave gaps.  The gaps can even
be considered as a feature for text processing -- they give sub-pointers
to character boundaries.  The other problems are: (1) with character
width 9, characters near the cursor are moved into the graphics range
and thus distorted if any of their 8th bits is set; (2) conflicts with
national characters in the graphics range.

The default range for the graphics cursor characters is now 8-11.  This
doesn't conflict with anything, since the glyphs for the characters in
this range are unreachable.

Use the 10x16 mouse cursor in text mode too (if the font size is >= 14).

When the character width is 9, removal of 1 or 2 vertical lines makes
10x16 cursor no wider than the 9x13 one usually was.  We could even
handle cursors 1 pixel wider in 2 character cells and gaps without
more clipping than given by the gaps (the worst case is 1 pixel in the
left cell, 1 removed in the middle gap, 8 in the right cell and 1
removed in the right gap.  The pixel in the right gap is removed so
it doesn't matter if it is in the font).

When the character width is 8, we now clip the 10-wide cursor by 1
pixel in the worst case.  This clipping is usually invisible since it
is of the border and and the border usually merges with the background
so is invisible.  There should be an option to use reverse video to
highlight the border and its tip instead of the interior (graphics
mode can do better using separate colors).  This needs the 9x13 cursor
again.

Ideas from: ache (especially about the bad default character range)
2017-04-20 16:34:09 +00:00
Konstantin Belousov
be4bf62684 Write-combine framebuffer writes through user-space mappings, if possible.
Note that KVA mapping of the framebuffer already uses write-combining
mode, so the change, besides improving speed of user mode writes, also
satisfies requirement of the IA32 architecture of using consistent
caching modes for multiple mappings of the same page.

Reported and tested by:	bde
Sponsored by:	The FreeBSD Foundation
MFC after:	 1 week
2017-04-20 15:18:15 +00:00
Olivier Houchard
5d840968f8 Update comment ot reflect realilty, we know also take care of CPUs that
provide a enable-method.

Suggested by:	jhibbits
2017-04-20 15:06:16 +00:00
Olivier Houchard
21ce594e7a ePAPR states that any non-boot CPU will come in "disabled" state. So we should
not consider a "disabled" cpu as a CPU we have to ignore, and we should use
them if they provide a "enable-method".
While I'm there, support "ok" as well as "okay", while ePAPR only accepts
"okay", linux accepts "ok" too so we can expect it to be used.

Reviewed by:	andrew (partially)
2017-04-20 13:56:06 +00:00
Bruce Evans
ecb56aaf60 Attempt to determine the modes in which 8-bit wide characters are actually
9 wide.

I only need this to improve the mouse cursor, but it has always been
needed to select and/or adjust fonts.

This is complicated because there are no standard parameter tables
giving this bit of information directly, and the device register bit
giving the information can't be trusted even if it is read from the
hardware.  Use a heuristic to guess if the device register can be
trusted.  (The device register is normally read from the BIOS mode
table, but on my system where the device register is wrong, the mode
table doesn't match the hardware and is not used; the device registers
are used in this case.)
2017-04-20 13:46:55 +00:00
Alexander Motin
d1025db49e Some cosmetic polishing for pre-timeouts.
MFC after:	1 week
2017-04-20 09:01:31 +00:00
David C Somayajulu
9a5f785486 Cleanup QLA_LOCK/QLA_UNLOCK macros
remove unused QLA_TX_LOCK/QLA_TX_UNLOCK macros
format qla_error_recovery()

MFC after:3 days
2017-04-20 03:41:42 +00:00
Gleb Smirnoff
69db34c309 Fix build without SC_PIXEL_MODE defined. 2017-04-19 22:48:27 +00:00
Jung-uk Kim
2696ce471c Revert r316796. It is not necessary since r317173. 2017-04-19 22:43:11 +00:00
Jung-uk Kim
b249b33322 Always clear borders when the terminal is flushed.
PR:		202288
2017-04-19 22:41:24 +00:00
Jung-uk Kim
5971d9cf1c Micro-optimize vt_set_border(). 2017-04-19 22:21:15 +00:00
Bruce Evans
35ffedf6bc Fix missing support for drawing the mouse cursor in depth 24 of direct
mode.

Use the general DRAWPIXEL() macro with its bigger case statement
(twice) instead of our big case statement (once).  DRAWPIXEL() is more
complicated since it is not missing support for depth 24 or
complications for colors in depth 16 (we currently hard-code black and
white so the complications for colors are not needed).  DRAWPIXEL()
also does the bpp calculation in the inner loop.  Compilers optimize
DRAWPIXEL() well enough, and the main text drawing method always
depended on this.  In direct mode, mouse cursor drawing is now similar
to normal text drawing except it draws in 2 hard-coded colors instead
of 1 variable color.

This also fixes a nested hard-coding of colors.  DRAWPIXEL() uses the
palette in all cases, but the direct code didn't use the palette for
its hard-coded black.  This only had an effect in depth 8, since
changing the palette is not supported in other depths.
2017-04-19 18:35:34 +00:00
Bruce Evans
38862a5553 Stop using a saveunder method for mouse cursor drawing in the vga
direct mode renderer.  I thought that reads were not much slower than
writes, so that the method only tripled the time for the whole function,
but I recently measured that video memory reads can be up to 53 times
slower than writes in tighter loops than here.  Loop overheap here
reduces the multiplier to only 16-20 on Haswell.

Start cleaning up and fixing larger bugs in this function.  Only replace
the 22-line removal loop by a 3-line one for now, since adjusting the
old loop would have required many palette calculations which are better
done in the DRAW_PIXEL() macro.  This also fixes missing support for
depth 24, but only for removal.

Removal is currently sloppy at the right bottom corner.  It sometimes
leaks border color into the text window.  This is soon cleaned up by the
caller.  The planar renderer has complications to clip at the corner.
2017-04-19 16:24:51 +00:00
Bruce Evans
7b8306bcd2 When we don't use the parameter table in the BIOS, also don't use most
of our tweaked modes based on it.  In practice, this means limiting the
tweaked modes to at most 80x50 based on 80x25, so there are no 90-column,
80x30 or 80x60 modes.

This happens when the the initial mode is is not in the parameter
table.  We always detected this case, but assumed that the (necessarily
nonstandard) parameters of the initial mode could be tweaked just as
blindly as the probably-standard parameters of initial modes in the
table.

On 1 laptop system with near-VGA where the initial mode is nonstandard,
this is because the hardware apparently doesn't support 9-bit mode,
but otherwise has standard timing.  The initial mode has 8-bit mode
CRTC horizontal parameters similar to those in syscons' 90-column modes
and in EGA modes.  Tweaking these values for the 90-column modes has
little effect except to print the extra 10 columns off the screen.
Tweaking from 80x25 to 80x30 requires changing from 400 scan lines to
480.  This can probably be made to work, but syscons blindly applies
values based on standard timing.  This gives blank output.  Tweaking
from 80x25 to 80x50 doesn't change the CRTC timing and works.
2017-04-19 14:49:18 +00:00
Sepherosa Ziehau
9ba5e29c5c hyperv: Use kmem_malloc for hypercall memory due to NX bit change.
Reported by:	dexuan@
MFC after:	now
Sponsored by:	Microsoft
2017-04-19 02:39:48 +00:00
Alexander Motin
7ce9096841 Block FPDMA TRIM for ASMedia HBAs.
Experiments show FPDMA TRIM command timeouts on ASMedia HBAs, while the
same SSDs working fine on Intel HBAs.

MFC after:	2 weeks
2017-04-18 08:04:15 +00:00
Gleb Smirnoff
9ed01c32e0 All these files need sys/vmmeter.h, but now they got it implicitly
included via sys/pcpu.h.
2017-04-17 17:07:00 +00:00
Gleb Smirnoff
6286dc78d4 Remove unneeded include of vm_phys.h. 2017-04-17 16:51:04 +00:00
Navdeep Parhar
46f48ee519 cxgbe: Add tunables to control the number of LRO entries and the number
of rx mbufs that should be presorted before LRO.  There is no change in
default behavior.

MFC after:	1 week
Sponsored by:	Chelsio Communications
2017-04-17 09:00:20 +00:00
Mark Murray
150890b0c6 Replace the RC4 algorithm for generating in-kernel secure random
numbers with Chacha20. Keep the API, though, as that is what the
other *BSD's have done.

Use the boot-time entropy stash (if present) to bootstrap the
in-kernel entropy source.

Reviewed by: delphij,rwatson
Approved by: so(delphij)
MFC after: 2 months
Relnotes: yes
Differential Revision: https://reviews.freebsd.org/D10048
2017-04-16 09:11:02 +00:00
Ian Lepore
44c63714ce Add imx6ul SoC support, and get the PHY number from the FDT data. If there
is no phy-handle property, fall back to using MII_PHY_ANY.

This still doesn't support an mdio bus with multiple PHYs on it, or the
possibility that the PHY being used by this instance of ffec is on the
mdio bus of some other instance (which is now a possibility with imx6ul).
Adding that support will require changes in fdt_get_phyaddr(), which is
currently making some assumptions that don't work with modern fdt data.
2017-04-16 03:49:14 +00:00
Ian Lepore
e8b1516a8b Add support for the Micrel KSZ8081 ethernet PHY.
The only thing this phy needs that the ukphy driver doesn't provide is
that the value in the proprietary Phy Control 2 Register must be saved
before doing a soft reset and restored afterwards.  Most modern phys have
"sticky bits" for low-level config that survive a reset, but on this one
the values in all registers go back to defaults, wiping out any board-
specific config set up by the bootloader/bios/whatever.
2017-04-16 01:40:17 +00:00
Bruce Evans
f027ee38b7 Add a 10x16 mouse cursor and use it in all graphics (strictly, pixel)
modes if the font size is >= 14.

This is the X cursor XC_left_ptr (#68) (glyph #45 in an X cursor font).
Also found in vt.  The old 9x13 cursor is the 10x16 one trimmed not very
well.

8x8 fonts need a smaller cursor instead of a larger one, except when
the pixel size is small.  Text mode is still limited to width and height
1 more than the font (so the 9x13 is already 4 pixels too high for it).
2017-04-15 20:03:50 +00:00
Bruce Evans
e560b71d3b Structure the mouse cursor data so that it is easier to switch, and
access it via pointers (still to only 1 instance, now with a less
generic name).

Restructure the "and" and "or" masks as border and interior masks
(where the "and" mask was for the union of the border and the interior).
"and" and "or" were only a detail in a not very good implementation,
and after fixing that the union was only used to calculate the border
at runtime.

Use the metric data in more places to clip to active pixels earlier.
2017-04-15 19:27:39 +00:00
Navdeep Parhar
d491f8ca2f cxgbe: Add a tunable to configure the SGE time scaler, which is
available starting with T6.  The values in the timer holdoff registers
are multiplied by the scaling factor before use.

dev.<nexus>.<n>.holdoff_timers shows the final values of the
timers in microseconds.

MFC after:	1 week
Sponsored by:	Chelsio Communications
2017-04-15 17:00:50 +00:00
Navdeep Parhar
e3951def25 cxgbe/iw_cxgbe: Report the actual values of various parameters as
configured by the firmware.

MFC after:	3 days
Sponsored by:	Chelsio Communications
2017-04-14 20:15:17 +00:00