Commit Graph

32778 Commits

Author SHA1 Message Date
Hans Petter Selasky
82364f24b5 Allow higher sample rates to have more jitter than lower ones.
PR:		208791
MFC after:	3 days
2016-11-09 07:09:27 +00:00
Kevin Lo
a28ed036b6 Sort DLINK section and add USB device ID of D-Link DWA-131 rev E1. 2016-11-09 06:47:29 +00:00
Bryan Drewery
28323add09 Fix improper use of "its".
Sponsored by:	Dell EMC Isilon
2016-11-08 23:59:41 +00:00
Emmanuel Vadot
ad6d341799 Do not warn if the 'assigned-clock-parents' property does not exists.
MFC after:	2 weeks
2016-11-08 10:05:11 +00:00
Hans Petter Selasky
dd3dde9828 Range check the jitter values to avoid bogus sample rate adjustments.
The expected deviation should not be more than 1Hz per second. The USB
v2.0 specification also mandates this requirement. Refer to chapter
5.12.4.2 about feedback.

PR:		208791
MFC after:	3 days
2016-11-08 08:09:48 +00:00
Scott Long
a965389b5a Convert the Q-Pair and PRP list memory allocations to use BUSDMA. Add a
bunch of safery belts and error handling in related codepaths.

Reviewed by:	jimharris
Obtained from:	Netflix
Differential Revision:	D8453
2016-11-08 00:24:49 +00:00
Sean Bruno
525e07418c The igb driver currently requires a VF interface to have a non-zero MAC
address, but the associated PF is giving the VF an all zeros MAC address
when one is not administratively assigned. The driver should check for
this case and generate a random address, similar to how the linux igbvf
driver does.

Submitted by:	skoumjian@juniper.net (Scott Koumjian)
MFH:		2 weeks
Differential Revision:	https://reviews.freebsd.org/D8399
2016-11-07 22:24:37 +00:00
Oleksandr Tymoshenko
aabc5ce043 Refactor FDT part of gpioled driver
- Split driver in two parts: FDT and non-FDT
- Instead of reattach gpioled nodes to GPIO bus use
    gpio_pin_get_by_ofw_idx and add ofwbus and simplebus as parrent buses

Reviewed by:	loos
Differential Revision:	https://reviews.freebsd.org/D8233
2016-11-07 21:15:39 +00:00
Scott Long
e0629b31f3 Fix the fallout from r308268 (mpt driver causes endless witness warnings in
VMWare and elsewhere) with the precision of a dull, rusty butter knife.

Reported by:	tuexen
Obtained from:	Netflix
2016-11-07 17:34:19 +00:00
Hans Petter Selasky
6f4cab6cc3 Add timer to watch the RQ when we are out of mbufs.
The firmware/hardware does not generate additional completion
events unless we post new buffers. Use a timer to try to post
more buffers in case we are temporarily out of mbufs. Else
the receive schedule completely stops.

Sponsored by:	Mellanox Technologies
MFC after:	1 week
2016-11-07 11:39:45 +00:00
Hans Petter Selasky
cb02244355 Add more firmware related structures and update existing ones in the
MLX5 core module. Update the set and query diagnostics counter API.

Sponsored by:	Mellanox Technologies
MFC after:	1 week
2016-11-07 11:28:50 +00:00
Hans Petter Selasky
627ef61aab Query flow table capabilities according to the correct capability bit
for infiniband.

Sponsored by:	Mellanox Technologies
MFC after:	1 week
2016-11-07 11:26:25 +00:00
Hans Petter Selasky
adea303c2a Correct checksum fields in the "mlx5_mini_cqe8" structure. The fields
in question are currently not used.

Sponsored by:	Mellanox Technologies
MFC after:	1 week
2016-11-07 11:22:50 +00:00
Hans Petter Selasky
91951e3978 Ensure the firmware is notified of any host memory allocation
failures. Else firmware commands may time out waiting for host
memory.

Sponsored by:	Mellanox Technologies
MFC after:	1 week
2016-11-07 11:20:13 +00:00
Hans Petter Selasky
97ac390861 When a firmware command times out do not free the command structure to
avoid use after free.

Sponsored by:	Mellanox Technologies
MFC after:	1 week
2016-11-07 11:15:40 +00:00
Andriy Voskoboinyk
d067ef0f0d rtwn: add HOSTAP / IBSS mode support for RTL8188CE.
NOTE: some multi-vap configurations (e.g., STA+IBSS) are not stable;
that will be fixed later.

Tested with:
 - RTL8188CE, STA + AP mode;
 - RTL8188CE, IBSS mode;
 - RTL8188CUS, IBSS mode;
 - RTL8188EU, IBSS mode.

Relnotes:	yes
2016-11-06 23:13:13 +00:00
Andriy Voskoboinyk
77cbc47958 rtwn_pci: omit tx_done() stage if device is not running.
rtwn_usb: drain USB transfers during device shutdown; this fixes possible
panic with 'options IEEE80211_SUPPORT_SUPERG' during device detach.

Tested with RTL8188CE, STA mode.
2016-11-06 19:17:39 +00:00
Andriy Voskoboinyk
519e6c0fc2 rtwn: fix Tx ring cleanup.
Do not try to clear stale Tx descriptor entries when there are some
running vaps; just free node references - rtwn_pci_tx_done() will free
mbufs without creating holes in the Tx descriptor space.
Also, reset only 2 first entries in the beacon ring - other will not be
used anyway.

Tested with RTL8188CE, STA + STA mode.
2016-11-06 18:11:19 +00:00
Andriy Voskoboinyk
1acd7ad907 rtwn: reduce shutdown time for RTL8188CE. 2016-11-06 17:24:16 +00:00
Andriy Voskoboinyk
1318032e9a rtwn: reset watchdog timer on device shutdown. 2016-11-06 17:12:02 +00:00
Andriy Voskoboinyk
c15d869233 rtwn: fix Rx filter setup for some multi-vap configuratons.
- Correctly refresh Rx filter when AP (IBSS) vap is created after STA vap.
- Block any RCR updates during TSF correction (IBSS mode).
- Set CBSSID* bits during vap creation, not when it was started / stopped.
- Cache current state to prevent unnecessary register reads.

Tested with RTL8188CE, STA + AP mode.
2016-11-05 23:21:30 +00:00
Andriy Voskoboinyk
8361f9cd07 rtwn: pause beacon queue during scanning.
Tested with RTL8821AU, AP + AP mode.
2016-11-05 22:47:09 +00:00
Sean Bruno
b1b6afa587 r295133 attempted to deactivate TSO in the 100Mbit link case with this
adapter to work around bugs in TSO handling at this speed.

em_init_locked is called during first boot of the adapter and will
see that link_speed is unitialized, effectively turning off tso for
all cards at all speeds, which I believe was *not* the intent.

Move the handling of TSO deactivation to the link handler where we can
more effectively make the decision about what to do.  In addition,
completely purge the TSO capabilities instead of disabling just CSUM_TSO.

Thanks to jhb for explanation of the hw capabilites api.

Thanks to royger and cognet for testing the 100Mbit failure case to
ensure that their adapters do indeed still work.

MFC after:	1 week
Sponsored by:	Limelight Networks
2016-11-05 16:30:42 +00:00
Sean Bruno
4f3a4c0163 r266979 missed a call to enable capabilities of the hw leading to an
inability to enable features of the device.

PR:             213845
Submitted by:   pherman@frenchfries.net
MFC after:      1 week
2016-11-05 16:17:07 +00:00
Scott Long
694cb8b815 Record the LogInfo field when reporting the IOCStatus. Helps in
debugging errors.

Submitted by:	slm
Obtained from:	Netflix
MFC after:	3 days
2016-11-04 17:25:47 +00:00
Emmanuel Vadot
90aabaafa5 Add clk_set_assigned
assigned-clock-parents are DT properties used to configure
some default parent clocks on one node.

Reviewed by:	mmel
MFC after:	2 weeks
2016-11-04 17:04:45 +00:00
Oleksandr Tymoshenko
95a3636709 [gpio] Add GPIO driver for Intel Bay Trail SoC
Bay Trail has three banks of GPIOs exposed to userland as /dev/gpiocN,
where N is 1, 2, and 3. Pins in each bank are pre-named to match names
on boards schematics: GPIO_S0_SCnn, GPIO_S0_NCnn, and GPIO_S5_nn.

Controller supports edge-triggered and level-triggered interrupts but
current version of the driver does not have interrupts support
2016-11-04 16:24:38 +00:00
Sepherosa Ziehau
afe30aa97f hyperv/vmbus: Reset ch_dev, once the child is deleted.
So it will not be mis-used later on, e.g. in vmbus_chan_printf().

Submitted by:	dexuan
Reported by:	dexuan
MFC after:	1 week
Sponsored by:	Microsoft
2016-11-04 01:14:41 +00:00
Adrian Chadd
0cbe6805b2 [ath] add the MIMO per-chain RSSI and noise floor information.
This is a long time coming.  The general pieces have been floating around
in a local repo since circa 2012 when I dropped the net80211 support
into the tree.

This allows the per-chain RSSI and NF to show up in 'ifconfig wlanX list sta'.
I haven't yet implemented the EVM hookups so that'll show up; that'll come
later.

Thanks to Susie Hellings <susie@susie.id.au> who did the original work
on this a looong time ago for a company we both worked at.
2016-11-03 23:05:39 +00:00
Andriy Gapon
19a8946bce smbus: remove smbus_trans / SMB_TRANS
This change reverts most of r281985.

The method did not map to anything defined by SMBus protocol and could
not be implemented for SMBus controllers.

This change is obviously not backwards compatible, but I have good
reasons to believe that there have never been any users of SMB_TRANS.

Discussed with:	grembo, jhb
MFC after:	6 weeks
2016-11-03 07:40:52 +00:00
Oleksandr Tymoshenko
38ae0c59b9 [evdev] Add evdev support to atkbd(4) driver
To enable event sourcing from atkbd kern.evdev.rcpt_mask value
should have bit 3 set.

Submitted by:	Vladimir Kondratiev <wulf@cicgroup.ru>
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D8381
2016-11-03 00:56:59 +00:00
Justin Hibbits
47a4ca603b Since it's no longer accessing a powerpc-specific register, drop the #ifdef. 2016-11-02 23:44:30 +00:00
Justin Hibbits
e8f58f1fb8 Fix the build. protctl is only used on powerpc.
While here, remove the need to check the SVR SPR, as others may be compatible
with the p1022-esdhc type.
2016-11-02 23:43:18 +00:00
Conrad Meyer
ea9e23edf3 ioat(4): Read CHANSTS register for suspended/halted checks
The device doesn't accurately update the CHANCMP address with the device state
when the device is suspended or halted.  So, read the CHANSTS register to check
for those states.

We still need to read the CHANCMP address for the last completed descriptor.

Sponsored by:	Dell EMC Isilon
2016-11-02 23:18:16 +00:00
Andriy Gapon
d8aeed01eb dev/cpuctl: put debug output under CPUCTL_DEBUG rather than DEBUG
DEBUG is a well-known flag.
It doesn't imply that there is a particular interest in cpuctl.

MFC after:	1 week
2016-11-02 17:47:19 +00:00
Andriy Gapon
eb6befba30 fix typo in a comment
MFC after:	5 weeks
X-MFC with:	r308219
2016-11-02 17:12:15 +00:00
Andriy Gapon
1d061e4ef2 smbus: remove the potentially very dangerous slave probing code
MFC after:	5 weeks
2016-11-02 17:07:18 +00:00
Andriy Gapon
e3d255499a ichiic/ig4: completely disengage from smbus
MFC after:	5 weeks
2016-11-02 17:04:00 +00:00
Andriy Gapon
0112b52b61 Add support for microcode update on newer AMD CPUs (10h+)
This includes new code for parsing microcode files as well as
the kernel-side change to apply the update on all processors
at the same time.

Developed with help from Borislav Petkov, formerly bp@amd64.org.

Tested using Athlon II X2 processor on a system where BIOS does
not have the latest microcode version:
/boot/firmware/microcode_amd.bin: updating cpu /dev/cpuctl0 to revision 0x10000c7... done.

The microcode file is taken from here:
https://web.archive.org/web/20160528230514/http://www.amd64.org/microcode.html
(note that the original site seems to be down at the moment)
It can also be found here:
https://git.kernel.org/cgit/linux/kernel/git/firmware/linux-firmware.git/tree/amd-ucode

Reviewed by:	kib, stas
MFC after:	2 weeks
Relnotes:	maybe
Differential Revision: https://reviews.freebsd.org/D8384
2016-11-02 16:15:49 +00:00
Scott Long
4ab1cdc5ad Add a fallback to the device mapper logic. We've seen systems in the field
that are apparently misconfigured by the manufacturer and cause the mapping
logic to fail.  The fallback allows drive numbers to be assigned based on the
PHY number that they're attached to.  Add sysctls and tunables to overrid
this new behavior, but they should be considered only necessary for debugging.

Reviewed by:	 imp, smh
Obtained from:	Netflix
MFC after:	3 days
Sponsored by:	D8403
2016-11-02 15:13:25 +00:00
Sean Bruno
7846f73cc8 Removed unused M_TSO_LEN.
MFC after:	2 weeks
2016-11-02 14:25:30 +00:00
Sepherosa Ziehau
30c90f019f hyperv/kvp: Don't mix message status codes and function return values.
While I'm here, move message status codes to hv_utilreg.h, since they
will be used by the upcoming VSS stuffs.

Submitted by:	Hongjiang Zhang <honzhan microsoft com>
MFC after:	1 week
Sponsored by:	Microsoft
Differential Revision:	https://reviews.freebsd.org/D8391
2016-11-02 07:18:27 +00:00
Sepherosa Ziehau
2a5a7ca81d hyperv: GC unused functions.
MFC after:	1 week
Sponsored by:	Microsoft
Differential Revision:	https://reviews.freebsd.org/D8406
2016-11-02 05:41:23 +00:00
Oleksandr Tymoshenko
dcc414b888 [psm] Fix choosing wrong mode for synaptic device + trackpoint
With guest trackpoint present trackpoint probing switched synaptics
device to absolute mode with different protocol instead of keeping it
in relative mode.

PR:		213757
Submitted by:	Vladimir Kondratyev <wulf@cicgroup.ru>
MFC after:	1 week
2016-11-02 01:27:20 +00:00
Justin Hibbits
eecaab5275 Merge i.MX and PowerPC SDHCI drivers
Summary:
i.MX5 and PowerPC use a very similar eSDHC controller, which is also
similar to the uSDHC controller used by i.MX6.  The imx_sdhci driver works
almost completely with PowerPC, with some minor tweaks.

There is one caveat with this: reset currently does not work on PowerPC, so has
been #ifdef'd out until this can be tracked down and fixed.  If resets are done
the controller will timeout all data transactions.  Without a reset, it appears
to work just fine.

This is part 3, following up r308186 and r308187.

Test Plan:
This has been tested on a PowerPC QorIQ P1022 board.  It has not been
tested on i.MX, but no regressions are expected.

Reviewed By: imp
Differential Revision: https://reviews.freebsd.org/D8407
2016-11-02 00:57:04 +00:00
Justin Hibbits
2b96b955e9 Toggle card insert/remove interrupt enable bits on events
Some controllers (namely Freescale's eSDHC, tested) will continue to assert
the card removed or card insert interrupts even after being handled.  To work
around this, disable watching the interrupt that just occurred until the
opposite interrupt is triggered.

Linux has a similar change in its driver to address the same problem.
2016-11-02 00:54:39 +00:00
Justin Hibbits
3d9df07abf Move imx_sdhci driver over to a dev/sdhci in preparation for QorIQ support.
Freescale uses eSDHC in both i.MX (ARM) and QorIQ (PowerPC), with slight
differences.  This is part one in unifying the drivers.

Reviewed by:	imp
2016-11-02 00:51:09 +00:00
Imre Vadász
06d706238b [iwm] Set full-offload scan flag. Fixes fw panic when already associated.
* Starting a scan from wpa_supplicant or via ifconfig while associated,
  should no longer cause firmware panics or abort early.

Tested:

* AC7260, STA mode

Approved by:	adrian (mentor)
Differential Revision:	https://reviews.freebsd.org/D8412
2016-11-01 22:47:58 +00:00
Imre Vadász
6dc2f84316 [iwm] Get rid of SYNC_RESP_STRUCT and SYNC_RESP_PTR macros.
* SYNC_RESP_STRUCT and SYNC_RESP_PTR originate from the OpenBSD version of
  iwm, and they weren't serving any real purpose in the FreeBSD port.

* We just do a single bus_dmamap_sync for syncing the complete received frame,
  instead of explicitly bus_dmamap_sync-ing subranges of the frame like in
  the OpenBSD iwm code.

Approved by:	adrian (mentor)
Differential Revision:	https://reviews.freebsd.org/D7939
2016-11-01 22:38:26 +00:00
Conrad Meyer
8e269d996a ioat(4): Allocate contiguous descriptors
This allows us to make strong assertions about descriptor address
validity.  Additionally, future generations of the ioat(4) hardware will
require contiguous descriptors.

Reviewed by:	markj
Sponsored by:	Dell EMC Isilon
2016-11-01 19:18:54 +00:00
Conrad Meyer
a0992979e9 ioat(4): Simplify by removing dynamic scaling
This paves the way for a contiguous descriptor array.

A contiguous descriptor array has the benefit that we can make strong
assertions about whether an address is a valid descriptor or not.  The
other benefit is that future generations of I/OAT hardware will require
a contiguous descriptor array anyway.  The downside is that after system
boot, big chunks of contiguous memory is much harder to find.  So
dynamic scaling after boot is basically impossible.

Reviewed by:	markj
Sponsored by:	Dell EMC Isilon
2016-11-01 19:18:52 +00:00
Sepherosa Ziehau
a457fab84c hyperv/vmbus: Avoid extra header copy.
MFC after:	1 week
Sponsored by:	Microsoft
Differential Revision:	https://reviews.freebsd.org/D8395
2016-11-01 08:30:06 +00:00
Sepherosa Ziehau
8966e5d5b3 hyperv/hn: Directly fill chimney sending buffer for small packets.
MFC after:	1 week
Sponsored by:	Microsoft
Differential Revision:	https://reviews.freebsd.org/D8394
2016-11-01 08:20:33 +00:00
Sepherosa Ziehau
edd3f31541 hyperv/hn: Move TSO packet fixup to an earlier place for if_transmit.
While TSO packet header may be still cache-hot.

MFC after:	1 week
Sponsored by:	Microsoft
Differential Revision:	https://reviews.freebsd.org/D8393
2016-11-01 07:41:26 +00:00
Hans Petter Selasky
d03403c4b1 Make sure the virtual T-axis buttons generate button release event(s)
for continuous tilting.

PR:		213957
MFC after:	3 days
2016-11-01 07:15:39 +00:00
Sepherosa Ziehau
23bf9e1527 hyperv/hn: Regroup if_start related functions.
And put them under HN_IFSTART_SUPPORT, which is by default on until
we whack the if_start related bits from base system.

MFC after:	1 week
Sponsored by:	Microsoft
Differential Revision:	https://reviews.freebsd.org/D8392
2016-11-01 07:10:43 +00:00
Sepherosa Ziehau
15516c776e hyperv/hn: Rename cleaned up file.
MFC after:	1 week
Sponsored by:	Microsoft
Differential Revision:	https://reviews.freebsd.org/D8390
2016-11-01 06:54:25 +00:00
Sepherosa Ziehau
ba015837bf hyperv/hn: Cosmetic cleanup; no functional changes.
MFC after:	1 week
Sponsored by:	Microsoft
Differential Revision:	https://reviews.freebsd.org/D8389
2016-11-01 04:44:11 +00:00
Li-Wen Hsu
d9fea9f287 - Fix make in sys/modules/bhnd
Reviewed by:	landonf, imp
Differential Revision:	https://reviews.freebsd.org/D8385
2016-11-01 03:49:31 +00:00
Conrad Meyer
8532d381a9 Add BUF_TRACKING and FULL_BUF_TRACKING buffer debugging
Upstream the BUF_TRACKING and FULL_BUF_TRACKING buffer debugging code.
This can be handy in tracking down what code touched hung bios and bufs
last. The full history is especially useful, but adds enough bloat that
it shouldn't be enabled in release builds.

Function names (or arbitrary string constants) are tracked in a
fixed-size ring in bufs. Bios gain a pointer to the upper buf for
tracking. SCSI CCBs gain a pointer to the upper bio for tracking.

Reviewed by:	markj
Sponsored by:	Dell EMC Isilon
Differential Revision:	https://reviews.freebsd.org/D8366
2016-10-31 23:09:52 +00:00
Hans Petter Selasky
e2efc9becb Make sure the virtual T-axis buttons gets cleared for USB mice which has
less than 6 buttons.

PR:		213919
MFC after:	3 days
2016-10-31 18:38:50 +00:00
Roger Pau Monné
78eb32933b xen: add a grant-table user-space device
A grant-table user-space device will allow user-space applications to map
and share grants (Xen way to share memory) among Xen domains. This grant
table user-space device has been tested with the QEMU Qdisk Xen backed.

Submitted by:		jaggi
Reviewed by:		royger
Differential review:	https://reviews.freebsd.org/D7293
2016-10-31 13:12:58 +00:00
Roger Pau Monné
b2fd6999db xen/netfront: fix statistics
Fix the statistics used by netfront.

Reported by:    Trond.Endrestol@ximalas.info
Submitted by:   ae
Reviewed by:    royger, Wei Liu <wei.liu2@citrix.com>
MFC after:	4 weeks
PR:		213439
2016-10-31 11:31:11 +00:00
Kevin Lo
a24d62b533 Add preliminary support for the RTL8153.
Reviewed by:	hselasky
2016-10-31 05:58:11 +00:00
Sepherosa Ziehau
427e366e43 hyperv/hn: Don't start shared TX taskq, if the hypervisor is not Hyper-V.
- Move the SYSINIT to DRIVER/SECOND, i.e. after the vm_guest becomes
  determistic.
- Minor style changes.

MFC after:	1 week
Sponsored by:	Microsoft
Differential Revision:	https://reviews.freebsd.org/D8370
2016-10-31 05:22:00 +00:00
Sepherosa Ziehau
82d71ca917 hyperv/hn: Reset do_lro, if the hash types are not TCP related.
Mainly because the host side only set TCPCS and IPCS even for
UDP datagrams.

MFC after:	1 week
Sponsored by:	Microsoft
Differential Revision:	https://reviews.freebsd.org/D8369
2016-10-31 05:05:12 +00:00
Sepherosa Ziehau
7ccc20da6a hyperv/hn: Cleanup RXBUF ack processing.
- Increase the # of retries.
- Add comment.
- Log error, if RXBUF ack fails.
- Add stat for RXBUF ack failures.

RXBUF ack really should _not_ fail...

MFC after:	1 week
Sponsored by:	Microsoft
Differential Revision:	https://reviews.freebsd.org/D8368
2016-10-31 04:54:15 +00:00
Sepherosa Ziehau
8ff20a73f6 hyperv/hn: Rework temporary channel packet buffer expanding.
And use large default temporary channel packer buffer; we really
don't want it to be expanded at run time.

MFC after:	1 week
Sponsored by:	Microsoft
Differential Revision:	https://reviews.freebsd.org/D8367
2016-10-31 04:46:02 +00:00
Sepherosa Ziehau
e6ed06f904 hyperv/hn: Rename cleaned up RNDIS source file.
MFC after:	1 week
Sponsored by:	Microsoft
Differential Revision:	https://reviews.freebsd.org/D8361
2016-10-31 01:36:28 +00:00
Andriy Gapon
448897d366 add iic interface to ig4 driver, move isl and cyapa to iicbus
Summary:
The hardware does not expose a classic SMBus interface.
Instead it has a lower level interface that can express a far richer
I2C protocol than what smbus offers.  However, the interface does not
provide a way to explicitly generate the I2C stop and start conditions.
It's only possible to request that the stop condition is generated
after transferring the next byte in either direction.  So, at least
one data byte must always be transferred.
Thus, some I2C sequences are impossible to generate, e.g., an equivalent
of smbus quick command (<start>-<slave addr>-<r/w bit>-<stop>).

At the same time isl(4) and cyapa(4) are moved to iicbus and now they use
iicbus_transfer for communication.  Previously they used smbus_trans()
interface that is not defined by the SMBus protocol and was implemented
only by ig4(4).  In fact, that interface was impossible to implement
for the typical SMBus controllers like intpm(4) or ichsmb(4) where
a type of the SMBus command must be programmed.

The plan is to remove smbus_trans() and all its uses.
As an aside, the smbus_trans() method deviates from the standard,
but perhaps backwards, FreeBSD convention of using 8-bit slave
addresses (shifted by 1 bit to the left).  The method expects
7-bit addresses.

There is a user facing consequence of this change.
A user must now provide device hints for isl and cyapa that specify an iicbus to use
and a slave address on it.
On Chromebook hardware where isl and cyapa devices are commonly found
it is also possible to use a new chromebook_platform(4) driver that
automatically configures isl and cyapa devices.  There is no need to
provide the device hints in that case,

Right now smbus(4) driver tries to discover all slaves on the bus.
That is very dangerous.  Fortunately, the probing code uses smbus_trans()
to do its job, so it is really enabled for ig4 only.
The plan is to remove that auto-probing code and smbus_trans().

Tested by:	grembo, Matthias Apitz <guru@unixarea.de> (w/o
		chromebook_platform)
Discussed with:	grembo, imp
Reviewed by:	wblock (docs)
MFC after:	1 month
Relnotes:	yes
Differential Revision: https://reviews.freebsd.org/D8172
2016-10-30 12:15:33 +00:00
Andriy Gapon
3c1f73b18d hwpmc: fix a race between amd_stop_pmc and amd_intr
It is possible that wrmsr in amd_stop_pmc() causes an overflow in a counter
that it disables.  In that case a non-maskable interrupt is generated.  The
interrupt handler code was written in such a way that it would re-enable the
counter.  That would lead to an unexpected interrupt later on.

This problem was easy to reproduce with
$ pmcstat -T -P instructions -t $pid
if the target process is sufficiently busy and there are context switches from
time to time.  There would be a lot of interrupts to "race" with amd_stop_pmc()
called during the context switches.  The problem affected only AMD processors.

While there, trace whether amd_intr() claimed an interrupt.

Reviewed by:	jhb
MFC after:	2 weeks
2016-10-30 09:38:10 +00:00
Conrad Meyer
0d0f264099 ioat(4): Use memory completion rather than device register
The CHANSTS register is a split 64-bit register on CBDMA units before
hardware v3.3.  If a torn read happens during ioat_process_events(),
software cannot know when to stop completing descriptors correctly.

So, just use the device-pushed main memory channel status instead.

Remove the ioat_get_active() seatbelt as well.  It does nothing if the
completion address is valid.

Sponsored by:	Dell EMC Isilon
2016-10-28 23:53:37 +00:00
Conrad Meyer
76305bb865 ioat(4): Add failpoint for delay() in ioat_release
Sponsored by:	Dell EMC Isilon
2016-10-28 23:53:36 +00:00
Conrad Meyer
5a8af401ae ioat(4): Assert the submit lock in ioat_submit_single
Sponsored by:	Dell EMC Isilon
2016-10-28 23:53:35 +00:00
Conrad Meyer
05e4cffbb0 ioat(4): Add additional tracing
These probes help track down driver bugs.

Sponsored by:	Dell EMC Isilon
2016-10-28 23:53:33 +00:00
Navdeep Parhar
041e5aed63 cxgbe(4): Accurate statistics for all chip settings.
There are 4 independent knobs in T5+ chips to include or exclude PAUSE
frames from the "total frames" and "multicast frames" counters in either
direction.  This change lets the driver deal with any combination of
these settings.
2016-10-28 23:01:11 +00:00
Warner Losh
aee4341421 Remove a PCI ID for a raid controller from Adaptec that was planned,
but never released. Since no real hardware was released with this ID,
just drop it from the aacraid driver. This paves the path for future
drivers for hardware that actually has this ID.

Submitted by: Scott Benesh from Microsemi.
Differential Revision: https://reviews.freebsd.org/D8377
MFC After: 3 days
2016-10-28 20:23:38 +00:00
Sean Bruno
c371f1143c The buffer address is always overwritten in the extended descriptor format,
we have to refresh it ... always.  This fixes problems reported in NetMap
with em(4) devices after conversion to extended descriptor format in
svn r293331.

Submitted by:	luigi@
Reported by:	franco@opnsense.org
MFC after:	2 days
2016-10-28 13:37:58 +00:00
Hans Petter Selasky
b133b47342 Fix indentation and remove duplicate queue stopped stats increment.
Found by:	Ryan Stone <rysto32@gmail.com>
Sponsored by:	Mellanox Technologies
MFC after:	1 week
2016-10-28 12:36:59 +00:00
Sepherosa Ziehau
fb448904d9 hyeprv/hn: Rename cleaned up RNDIS header file.
MFC after:	1 week
Sponsored by:	Microsoft
Differential Revision:	https://reviews.freebsd.org/D8360
2016-10-28 08:53:18 +00:00
Sepherosa Ziehau
ec60eff9ab hyperv/hn: Change header guardian; in preparation for the upcoming rename.
MFC after:	1 week
Sponsored by:	Microsoft
Differential Revision:	https://reviews.freebsd.org/D8359
2016-10-28 08:41:30 +00:00
Sepherosa Ziehau
d568f3ecfa hyperv/hn: Cleanup RNDIS related files.
MFC after:	1 week
Sponsored by:	Microsoft
Differential Revision:	https://reviews.freebsd.org/D8358
2016-10-28 08:32:54 +00:00
Sepherosa Ziehau
8ef7124558 hyperv/hn: Pull data path code up.
MFC after:	1 week
Sponsored by:	Microsoft
Differential Revision:	https://reviews.freebsd.org/D8357
2016-10-28 08:18:49 +00:00
Sepherosa Ziehau
91938ebba8 hyperv/hn: Reorganize RX path; mainly pull non-control code path up
MFC after:	1 week
Sponsored by:	Microsoft
Differential Revision:	https://reviews.freebsd.org/D8356
2016-10-28 08:08:46 +00:00
Sepherosa Ziehau
96a98cbf14 hyperv/hn: Nuke unnecessary indirection.
MFC after:	1 week
Sponsored by:	Microsoft
Differential Revision:	https://reviews.freebsd.org/D8355
2016-10-28 07:59:02 +00:00
Sepherosa Ziehau
68468712a7 hyperv/hn: Rename cleaned up NVS source file.
MFC after:	1 week
Sponsored by:	Microsoft
Differential Revision:	https://reviews.freebsd.org/D8354
2016-10-28 07:48:17 +00:00
Sepherosa Ziehau
e61005fedc hyperv/hn: Rename cleaned up NVS header file.
MFC after:	1 week
Sponsored by:	Microsoft
Differential Revision:	https://reviews.freebsd.org/D8353
2016-10-28 05:56:23 +00:00
Sepherosa Ziehau
0cf2aff4fa hyperv/hn: Change header guardian; in preparation for the upcoming rename.
MFC after:	1 week
Sponsored by:	Microsoft
Differential Revision:	https://reviews.freebsd.org/D8352
2016-10-28 05:31:34 +00:00
Luigi Rizzo
844a6f0c53 Various fixes for ptnet/ptnetmap (passthrough of netmap ports). In detail:
- use PCI_VENDOR and PCI_DEVICE ids from a publicly allocated range
  (thanks to RedHat)
- export memory pool information through PCI registers
- improve mechanism for configuring passthrough on different hypervisors
Code is from Vincenzo Maffione as a follow up to his GSOC work.
2016-10-27 09:46:22 +00:00
Sepherosa Ziehau
2ae974568d hyperv/hn: NVS inclusion cleanup and forward declare functions.
MFC after:	1 week
Sponsored by:	Microsoft
Differential Revision:	https://reviews.freebsd.org/D8347
2016-10-27 05:33:48 +00:00
Sepherosa Ziehau
e3946ae44a hyperv/hn: Move send context to NVS domain.
Since all sends are encapsulated in NVS messages.

MFC after:	1 week
Sponsored by:	Microsoft
Differential Revision:	https://reviews.freebsd.org/D8346
2016-10-27 05:26:04 +00:00
Sepherosa Ziehau
19b2340a76 hyperv/hn: Move hn_softc to if_hnvar.h
While I'm here, use consistent macro names.

MFC after:	1 week
Sponsored by:	Microsoft
Differential Revision:	https://reviews.freebsd.org/D8345
2016-10-27 05:13:00 +00:00
Sepherosa Ziehau
d6e37dc70f hyperv/hn: Shuffle chimney sending buffer alloc/free around.
This paves way for more chimney sending buffer reorganization.

MFC after:	1 week
Sponsored by:	Microsoft
Differential Revision:	https://reviews.freebsd.org/D8343
2016-10-27 05:04:54 +00:00
Sepherosa Ziehau
14a31e99d7 hyperv/hn: Define empty packet filter.
MFC after:	1 week
Sponsored by:	Microsoft
Differential Revision:	https://reviews.freebsd.org/D8342
2016-10-27 04:55:19 +00:00
Sepherosa Ziehau
5341cc1c91 hyperv/hn: Move %b format string for capabilities near their definition.
MFC after:	1 week
Sponsored by:	Microsoft
Differential Revision:	https://reviews.freebsd.org/D8341
2016-10-27 04:42:39 +00:00
Sepherosa Ziehau
90321eb752 hyperv/hn: Nuke unnecessary M_NETVSC
MFC after:	1 week
Sponsored by:	Microsoft
Differential Revision:	https://reviews.freebsd.org/D8340
2016-10-27 04:28:01 +00:00
Sepherosa Ziehau
20b3dcf039 hyperv/hn: Properly configure RSS according to RSS capabilities
MFC after:	1 week
Sponsored by:	Microsoft
Differential Revision:	https://reviews.freebsd.org/D8338
2016-10-27 03:43:27 +00:00
Kevin Lo
3d8102824b Disable CLKREQ for ASPM since re(4) doesn't implement link level power saving.
Reviewed by:  yongari
2016-10-27 02:20:13 +00:00
Andrew Turner
0c5434ae58 Pull the common FDT interrupt values into a new header rather than be magic
numbers.

Sponsored by:	DARPA, AFRL
2016-10-26 15:18:08 +00:00
Andrew Turner
1fb2428f1c Stop including a possibly GPLd header from the GPIO code. Add the only
needed macro to ofw_gpiobus.c.

Reported by:	emaste
Sponsored by:	DARPA, AFRL
2016-10-26 12:41:44 +00:00
Sepherosa Ziehau
eaaa9935d4 hyperv/vmbus: Implement vmbus_chan_printf.
And use it for vmbus channel logging, which can log the channel
owner's name properly, instead of vmbus0.

Submitted by:	QianYue You <t-youqi microsoft com>
MFC after:	1 week
Sponsored by:	Microsoft
2016-10-26 05:06:23 +00:00
Sepherosa Ziehau
91833b0f3c hyperv/vmbus: Add missing white space.
Submitted by:	QianYue You <t-youqi microsoft com>
MFC after:	1 week
Sponsored by:	Microsoft
2016-10-26 04:26:17 +00:00
Conrad Meyer
b8acc2d67e uhso(4): Fix a null pointer dereference
The directly following m_defrag() call can wait, so there is no reason this
call can't as well.

Reported by:	Coverity
CID:		1353551
Sponsored by:	Dell EMC Isilon
2016-10-25 18:36:15 +00:00
Gleb Smirnoff
72b09927ed Check m_getcl() return value.
CID:	611376
2016-10-25 16:28:30 +00:00
Andrew Turner
c2dd354bf4 Create a new PSCI error code and use it to signal that starting the CPU is
impossible as the PSCI firmware is missing.

Sponsored by:	ABT Systmes Ltd
2016-10-25 14:18:27 +00:00
Edward Tomasz Napierala
88f9a4ff75 Make the USB attach strings in dmesg include product name.
Note to self: MFC this to 9 and 8.

Reviewed by:	hselasky@, imp@
MFC after:	1 month
Differential Revision:	https://reviews.freebsd.org/D8259
2016-10-25 07:48:19 +00:00
Bryan Drewery
1648616981 Use proper if_getdrvflags() API.
This is a NOP.

Sponsored by:	Dell EMC Isilon
2016-10-25 03:55:56 +00:00
Sepherosa Ziehau
7888d6422d hyperv/hn: Set baudrate properly
PR:		208931
Submitted by:	Eugene Grosbein <ports grosbein net>
Reported by:	Eugene Grosbein <ports grosbein net>
MFC after:	1 week
Sponsored by:	Microsoft
2016-10-25 01:41:39 +00:00
Navdeep Parhar
77e9044c47 cxgbe(4): Fix bug in the calculation of the number of physically
contiguous regions in an mbuf chain.

If the payload of an mbuf ends at a page boundary count_mbuf_nsegs would
incorrectly consider the next mbuf's payload physically contiguous based
solely on a KVA comparison.

MFC after:	1 week
Sponsored by:	Chelsio Communications
2016-10-24 19:09:56 +00:00
Sepherosa Ziehau
5bf51473c0 hyperv/ic: Rework framework/message version negotiation.
Submitted by:	Hongjiang Zhang <honzhan microsoft com>
Modified by:	sephe
MFC after:	1 week
Sponsored by:	Microsoft
Differential Revision:	https://reviews.freebsd.org/D8280
2016-10-24 05:36:19 +00:00
Sepherosa Ziehau
f0dcc3114c hyperv/hn: Nuke unused forward declaration.
MFC after:	1 week
Sponsored by:	Microsoft
Differential Revision:	https://reviews.freebsd.org/D8314
2016-10-24 05:20:02 +00:00
Sepherosa Ziehau
121e98e697 hyperv/hn: Fix RX filter settings.
MFC after:	1 week
Sponsored by:	Microsoft
Differential Revision:	https://reviews.freebsd.org/D8313
2016-10-24 05:10:35 +00:00
Sepherosa Ziehau
665bc5ff49 hyperv/hn: Start link status check, if no network changes were pending.
Link status check is much more lightweight than network change detection.

MFC after:	1 week
Sponsored by:	Microsoft
Differential Revision:	https://reviews.freebsd.org/D8311
2016-10-24 05:01:34 +00:00
Sepherosa Ziehau
6827d9497a hyperv/hn: Properly handle synthetic parts reattach failure.
MFC after:	1 week
Sponsored by:	Microsoft
Differential Revision:	https://reviews.freebsd.org/D8310
2016-10-24 03:42:34 +00:00
Sepherosa Ziehau
6aa8c9a4e0 hyperv/hn: Fix chimney sending buffer leakage upon NVS sending failure.
This will not happen in real world, since TX consumption of the vmbus
TX bufring is limitted.  Better safe than sorry.

MFC after:	1 week
Sponsored by:	Microsoft
Differential Revision:	https://reviews.freebsd.org/D8309
2016-10-24 03:34:19 +00:00
Sepherosa Ziehau
b7009d5392 hyperv/hn: Move chimney buffer index and size to txdesc.
All RNDIS control messages have used SG list for a while.  This makes
the send context suitable for further refactoring.

MFC after:	1 week
Sponsored by:	Microsoft
Differential Revision:	https://reviews.freebsd.org/D8308
2016-10-24 03:26:34 +00:00
Justin Hibbits
b474a02784 Use the correct name for the qm_portals class.
This file was copy&pasted from bman_fdt, and it still shows.
2016-10-23 19:59:56 +00:00
Oleksandr Tymoshenko
e012a280a5 EVDEV: ums evdev support improvements: locking and event reporting
- Use ums lock as evdev lock
- Do not cap axes values to sysmouse limits for evdev reports
- Do not map T-axis events to buttons for evdev reports
- Use shortcuts for event reporting

Submitted by:	Vladimir Kondratiev <wulf@cicgroup.ru>
MFC after:	1 week
2016-10-22 22:55:10 +00:00
Oleksandr Tymoshenko
73362d0e56 EVDEV: Add shortcut functions for event types
Add wrappers around generic evdev_push_event for specific event types:
EV_KEY/EV_REL/EV_ABS etc...

Submitted by:	Vladimir Kondratiev <wulf@cicgroup.ru>
2016-10-22 22:52:50 +00:00
Andriy Gapon
4afdfe9761 jedec_ts: a driver for thermal sensors on memory modules
The driver currently supports chips that are fully compliant with the
JEDEC SPD / EEPROM / TS standard (JEDEC Standard 21-C,
TSE2002 Specification, frequenlty referred to as JEDEC JC 42.4).

Additionally some chips from STMicroelectronics are supported as well.
They are compliant except for their Device ID pattern.

Given the continued lack of any common sensor infrastructure, the driver
uses an ad-hoc sysctl to report the temperature.

Reviewed by:	wblock (documentation)
MFC after:	2 weeks
Relnotes:	yes
Differential Revision: https://reviews.freebsd.org/D8174
2016-10-22 08:00:46 +00:00
Justin Hibbits
3413fe9770 Initialize the ofw_bus_devinfo on the portals to prevent a crash.
If the device tree doesn't contain a cpu-handle field in any bman-portal or
qman-portal, it will exit without setting up the devinfo, leaving it
uninitialized.  This will lead to attempts to free random memory, and ultimately
panic.
2016-10-22 02:11:53 +00:00
Navdeep Parhar
aaa4ddd9d0 cxgbe(4): Dump any mailbox command that times out. 2016-10-22 00:48:58 +00:00
Alexander Motin
a7a560be79 Add names for some DASP devices.
Submitted by:	Dmitry Luhtionov <dmitryluhtionov@gmail.com>
MFC after:	1 week
2016-10-21 15:23:54 +00:00
Ed Maste
984ff0d910 netmap: fix kernel build on GCC-using architectures
GCC produced a multiple declaration warning from the
SYSCTL_DECL(_dev_netmap).
2016-10-21 13:51:47 +00:00
Sepherosa Ziehau
525607d10c hyperv/hn: Function renaming; consistent w/ hardware capabilities query.
MFC after:	1 week
Sponsored by:	Microsoft
Differential Revision:	https://reviews.freebsd.org/D8296
2016-10-21 08:21:23 +00:00
Sepherosa Ziehau
970ead008d hyperv/hn: Add network change support.
Currently the network change is simulated by link status changes.

MFC after:	1 week
Sponsored by:	Microsoft
Differential Revision:	https://reviews.freebsd.org/D8295
2016-10-21 08:02:05 +00:00
Sepherosa Ziehau
31f05efd89 hyperv/hn: Check NVS version for HASHVAL pktinfo on sending path.
MFC after:	1 week
Sponsored by:	Microsoft
Differential Revision:	https://reviews.freebsd.org/D8293
2016-10-21 07:46:35 +00:00
Sepherosa Ziehau
0634f75c72 hyperv/hn: Always query RSS capabilities.
- This avoid distributing NDIS version check.
- Only NDIS 6.20 required (earlier NDIS uses different indirect table
  format).

MFC after:	1 week
Sponsored by:	Microsoft
Differential Revision:	https://reviews.freebsd.org/D8291
2016-10-21 07:37:29 +00:00
Sepherosa Ziehau
ffaa5deb38 netmap: Unbreak LINT-VIMAGE building
Sponsored by:	Microsoft
2016-10-21 06:32:45 +00:00
Sepherosa Ziehau
e3f94e5133 netmap: Unbreak i386 LINT building
Sponsored by:	Microsoft
2016-10-21 06:05:16 +00:00
Justin Hibbits
47cabd046d Remove a hack requiring dtsec0 to always be enabled for mdio.
Instead replace it with a different hack, that turns fman into a simplebus
subclass, and maps its children within its address space.

Since all PHY communication is done through dtsec0's mdio space, the FDT
contains a reference to the dtsec0 mdio handle in all nodes that need it.
Instead of using Freescale's implementation for MII access, use our own (copied
loosely from the eTSEC driver, and could possibly be merged eventually).  This
lets us access the registers directly rather than needing a full dtsec interface
just to access the registers.

Future directions will include turning fman into more of a simplebus, and not
mapping the region and playing games.  This will require changes to the dtsec
driver to make it a child of fman, and possibly other drivers as well.
2016-10-21 02:16:11 +00:00
Justin Hibbits
525b23c541 Remove an unnecessary debug printf. 2016-10-21 02:07:03 +00:00
Wojciech Macek
7902c8dca8 Driver for PCI Ethernet NIC on Alpine V1 and V2.
Obtained from:         Semihalf
Submitted by:          Michal Stanek <mst@semihalf.com>
Sponsored by:          Annapurna Labs
Reviewed by:           wma
Differential Revision: https://reviews.freebsd.org/D7814
2016-10-20 11:31:11 +00:00
Hans Petter Selasky
4d76235fe3 Add support for adjusting the hardware buffering delay for USB audio.
Requested by:	Goran Mekic <meka@tilda.center>
MFC after:	1 week
2016-10-19 18:45:06 +00:00
Konstantin Belousov
cb31871867 Partial workaround for Intel PCI adapters reading past the end of the
host-programmed DMA regions.  This change seemingly fixes the
descriptor fetches, but the packet memory accesses are left
problematic.

Reviewed by:	emaste, erj, sbruno
Sponsored by:	The FreeBSD Foundation
MFC after:	2 weeks
Differential revision:	https://reviews.freebsd.org/D8282
2016-10-19 18:15:44 +00:00
Sepherosa Ziehau
e41136c060 hyperv/vmbus: Expose channel management taskqueue for driver to use.
MFC after:	3 days
Sponsored by:	Microsoft
2016-10-19 09:12:14 +00:00
David C Somayajulu
c7873d969c 1. Use taskqueue_create() instead of taskqueue_create_fast() for both
fastpath and slowpath taskqueues.
2. Service all transmits in taskqueue threads.
3. additional stats counters for  keeping track of
	- bd availability
	- tx buf ring not emptied in the fp task queue.
	  These are drained via timeout taskqueue.
	- tx attempts during link down.

MFC after: 5 days
2016-10-18 21:33:57 +00:00
Andriy Voskoboinyk
1a58c70409 rtwn(4): fix build with 'options IEEE80211_SUPPORT_SUPERG' 2016-10-18 21:17:31 +00:00
Luigi Rizzo
a2a7409151 remove stale and unused code from various files
fix build on 32 bit platforms
simplify logic in netmap_virt.h

The commands (in net/netmap.h) to configure communication with the
hypervisor may be revised soon.
At the moment they are unused so this will not be a change of API.
2016-10-18 16:18:25 +00:00
Luigi Rizzo
d782d9fd35 remove conditional code for an obsolete feature. if_ptnet now does better. 2016-10-18 15:50:20 +00:00
Luigi Rizzo
6ad42d71b2 remove trailing whitespace. No code changes. 2016-10-18 15:41:57 +00:00
Sean Bruno
225d33ff5c Restore svn r306772 that was overwritten by netmap import at svn r307394
#include <sys/selinfo.h> should be here as all drivers that support
netmap need to use this file regardless.
2016-10-18 14:48:41 +00:00
Michal Meloun
fd02931841 REGULATOR: Move functions for handling with regulator ranges to
common file. They can be useful for other PMICs.

MFC after: 2 weeks
2016-10-18 12:27:46 +00:00
Justin Hibbits
f77405e334 Use proper integer-pointer type conversions.
As part of an effort to extend Book-E to the 64-bit world, make the necessary
changes to the DPAA/dTSEC driver set to be integer-pointer conversion clean.
This means no more casts to int, and use uintptr_t where needed.

Since the NCSW source is effectively obsolete, direct changes to the source tree
are safe.
2016-10-18 00:55:15 +00:00
Navdeep Parhar
b806e571bf cxgbe(4): Adjust whitespace to line up the column titles in cim_qcfg
with the values displayed.
2016-10-17 20:57:54 +00:00
Andriy Voskoboinyk
7453645f2a rtwn(4), urtwn(4): merge common code, add support for 11ac devices.
All devices:
- add support for rate adaptation via ieee80211_amrr(9);
- use short preamble for transmitted frames when needed;
- multi-bss support:
 * for RTL8821AU: 2 VAPs at the same time;
 * other: 1 any VAP + 1 sta VAP.
RTL8188CE:
- fix IQ calibration bug (reason of significant speed degradation);
- add h/w crypto acceleration support.
USB:
- A-MPDU Tx support;
- short GI support;
Other:
- add support for RTL8812AU / RTL8821AU chipsets
(a/b/g/n only; no ac yet);
- split merged code into subparts:
 * bus glue (usb/*, pci/*, rtl*/usb/*, rtl*/pci/*)
 * common (if_rtwn*)
 * chip-specific (rtl*/*)
- various other bugfixes.

Due to code reorganization, module names / requirements were changed too:
urtwn urtwnfw -> rtwn rtwn_usb rtwnfw
rtwn  rtwnfw  -> rtwn rtwn_pci rtwnfw

Tested with RTL8188CE, RTL8188CUS, RTL8188EU and RTL8821AU.

Tested by:	kevlo, garga,
		Peter Garshtja <peter.garshtja@ambient-md.com>,
		Kevin McAleavey <kevin.mcaleavey@knosproject.com>,
		Ilias-Dimitrios Vrachnis <id@vrachnis.com>,
		<otacilio.neto@bsd.com.br>
Relnotes:	yes
2016-10-17 20:38:24 +00:00
Hans Petter Selasky
d3bf5efc1f Fix device delete child function.
When detaching device trees parent devices must be detached prior to
detaching its children. This is because parent devices can have
pointers to the child devices in their softcs which are not
invalidated by device_delete_child(). This can cause use after free
issues and panic().

Device drivers implementing trees, must ensure its detach function
detaches or deletes all its children before returning.

While at it remove now redundant device_detach() calls before
device_delete_child() and device_delete_children(), mostly in
the USB controller drivers.

Tested by:		Jan Henrik Sylvester <me@janh.de>
Reviewed by:		jhb
Differential Revision:	https://reviews.freebsd.org/D8070
MFC after:		2 weeks
2016-10-17 10:20:38 +00:00
Warner Losh
013da020e2 Assume all coreboot BIOSes have the need for these workarounds because
coreboot implements the keyboard controller and it's common to all
Chromebooks. The workaround won't hurt and may help.
2016-10-17 04:07:12 +00:00
Luigi Rizzo
a9e644cd24 add two missing files for the netmap import 2016-10-16 15:22:17 +00:00
Luigi Rizzo
37e3a6d349 Import the current version of netmap, aligned with the one on github.
This commit, long overdue, contains contributions in the last 2 years
from Stefano Garzarella, Giuseppe Lettieri, Vincenzo Maffione, including:
+ fixes on monitor ports
+ the 'ptnet' virtual device driver, and ptnetmap backend, for
  high speed virtual passthrough on VMs (bhyve fixes in an upcoming commit)
+ improved emulated netmap mode
+ more robust error handling
+ removal of stale code
+ various fixes to code and documentation (some mixup between RX and TX
  parameters, and private and public variables)

We also include an additional tool, nmreplay, which is functionally
equivalent to tcpreplay but operating on netmap ports.
2016-10-16 14:13:32 +00:00
Konstantin Belousov
e4b9ff3a9e Do not try to create /dev/efi device node before devfs is initialized.
Split efirt.ko initialization into early stage where runtime services
KPI environment is created, to be used e.g. for RTC, and the later
devfs node creation stage, per module.

Switch the efi device to use make_dev_s(9) instead of make_dev(9).  At
least, this gracefully handles the duplicated device name issue.

Remove ARGSUSED comment from efidev_ioctl(), all unused arguments are
annotated with __unused attribute.

Reported by:	ambrisko, O. Hartmann <ohartman@zedat.fu-berlin.de>
Reviewed by:	imp
Sponsored by:	The FreeBSD Foundation
MFC after:	2 weeks
2016-10-16 06:07:43 +00:00
Jared McNeill
72f1cf0446 Add driver for GPIO controlled regulator.
Reviewed by:		gonzo, manu, mmel
Differential Revision:	https://reviews.freebsd.org/D8257
2016-10-15 20:04:14 +00:00
Andriy Gapon
2698bbbb5a aibs / atk0110: add support for querying sensors via GGRP and GITM
Comparing to the Linux driver there is still one missing feature.
The Linux driver finds and enables "Embedded Controller" item in
the 0x11 group if it's not enabled yet.

I tested the new method, Torfinn Ingolfsen tested the old method
and helped to fix several bugs in the earlier versions of the patch.

Tested by:	Torfinn Ingolfsen <torfinn.ingolfsen@getmail.no>
Reviewed by:	rpaulo
MFC after:	3 weeks
Differential Revision: https://reviews.freebsd.org/D8227
2016-10-15 09:10:35 +00:00
Sepherosa Ziehau
4e3e6410ad hyperv/vmbus: Add __FBSDID
Sponsored by:	Microsoft
2016-10-14 05:47:59 +00:00
Sepherosa Ziehau
857d55affe hyperv/hn: Management parts always need suspend and resume.
MFC after:	3 days
Sponsored by:	Microsoft
2016-10-14 05:41:51 +00:00
Sepherosa Ziehau
e52a79e5c1 hyperv/stor: Fix off-by-one bug; this brings back TRIM support.
Submitted by:	Hongjiang Zhang <honzhan microsoft com>
Reported by:	Lili Deng <v-lide microsoft com>
MFC after:	3 days
Sponsored by:	Microsoft
Differential Revision:	https://reviews.freebsd.org/D8238
2016-10-14 05:32:47 +00:00
Navdeep Parhar
721f5406c8 cxgbe(4): Allow the interface MTU to be set as high as the actual
hardware limit.

Submitted by:	jpaetzel@
Differential Revision:	https://reviews.freebsd.org/D8237
2016-10-13 19:40:21 +00:00
Konstantin Belousov
5975e53d40 Fix a race in vm_page_busy_sleep(9).
Suppose that we have an exclusively busy page, and a thread which can
accept shared-busy page.  In this case, typical code waiting for the
page xbusy state to pass is
again:
	VM_OBJECT_WLOCK(object);
	...
	if (vm_page_xbusied(m)) {
		vm_page_lock(m);
 		VM_OBJECT_WUNLOCK(object);    <---1
		vm_page_busy_sleep(p, "vmopax");
 		goto again;
	}

Suppose that the xbusy state owner locked the object, unbusied the
page and unlocked the object after we are at the line [1], but before we
executed the load of the busy_lock word in vm_page_busy_sleep().  If it
happens that there is still no waiters recorded for the busy state,
the xbusy owner did not acquired the page lock, so it proceeded.

More, suppose that some other thread happen to share-busy the page
after xbusy state was relinquished but before the m->busy_lock is read
in vm_page_busy_sleep().  Again, that thread only needs vm_object lock
to proceed.  Then, vm_page_busy_sleep() reads busy_lock value equal to
the VPB_SHARERS_WORD(1).

In this case, all tests in vm_page_busy_sleep(9) pass and we are going
to sleep, despite the page being share-busied.

Update check for m->busy_lock == VPB_UNBUSIED in vm_page_busy_sleep(9)
to also accept shared-busy state if we only wait for the xbusy state to
pass.

Merge sequential if()s with the same 'then' clause in
vm_page_busy_sleep().

Note that the current code does not share-busy pages from parallel
threads, the only way to have more that one sbusy owner is right now
is to recurse.

Reported and tested by:	pho (previous version)
Reviewed by:	alc, markj
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D8196
2016-10-13 14:41:05 +00:00
Andriy Gapon
f1519c0157 convert iicsmb to use iicbus_transfer for all operations
Previously the driver used more low level operations like iicbus_start
and iicbus_write.  The problem is that those operations are not
implemented by iicbus(4) and the calls were effectively routed to
a driver to which the bus is attached.
But not all of the controllers implement such low level operations
while all of the drivers are expected to have iicbus_transfer.

While there fix incorrect implementation of iicsmb_bwrite and iicsmb_bread.
The former should send a byte count before the actual bytes, while the
latter should first receive the byte count and then receive the bytes.

I have tested only these commands:
- quick (r/w)
- send byte
- receive byte
- read byte
- write byte

MFC after:	1 month
Differential Revision: https://reviews.freebsd.org/D8170
2016-10-13 07:25:18 +00:00
Warner Losh
b2a7ac4802 Fix building on i386 and arm. But 'public domain' headers on the files
with no creative content. Include "lost" changes from git:
o Use /dev/efi instead of /dev/efidev
o Remove redundant NULL checks.

Submitted by: kib@, dim@, zbb@, emaste@
2016-10-13 06:56:23 +00:00
Andriy Voskoboinyk
bdc7291ec9 net80211: convert all ieee80211_input_mimo*() consumers
to ieee80211_add_rx_params() + drop last (ieee80211_rx_stats) parameter

Note: there is an additional check for ieee80211_get_rx_params()
return value (which does not exist in the original diff).

Reviewed by:	adrian
Differential Revision:	https://reviews.freebsd.org/D8207
2016-10-12 20:50:13 +00:00
Oleksandr Tymoshenko
968d859d09 [fdt] Add one more heuristic to determine MAC address of the SMSC device
- If check for net,ethernet/usb,device compatible node fails, try to find
    .../usb/hub/ethernet, where ... is bus path that can depend on actual HW.
    net,ethernet/usb,device compatibity strings are FreeBSD custom invention
    that is used only in RPi DTBs and since there is no other way to tie USB
    device to FDT node we just do our best effort here to work with upstream
    device tree

- Use -1 value to indicate invalid phandle_t, 0 is valid phandle value and
    shouldn't be used as error signal
2016-10-12 19:53:10 +00:00
Ed Maste
c874ff0f63 Use M_WAITOK in PIO_KEYMAP ioctl
The malloc return value is not checked.

Submitted by:	CTurt <ecturt@gmail.com>
MFC after:	1 week
2016-10-12 12:56:18 +00:00
Andriy Gapon
94dce59911 smbus: allow child devices to be added via hints
This will allow to add slave drivers in the same fashion as for iicbus.

Also, allow other code to add a child device and set its 'addr' ivar.
The ivar can only be set if it's unset, it can not be changed.
That could be used, for example, by a platform driver that has
a precise description of the hardware and, thus, knows what drivers
can handle what slaves.

The slave auto-probing code is unsafe and broken because it uses
7-bit slave addresses.  It's going to be removed.

Note: internally the driver uses address of zero as an unset address
while smbus_get_addr() returns it as -1 for compatibility reasons.
The address is expected to be unset only for children that do not
work with slaves like, for example, smb(4).

Reviewed by:	jhb
Differential Revision: https://reviews.freebsd.org/D8173
2016-10-12 06:58:01 +00:00
Oleksandr Tymoshenko
bf798f819a Make BCM28x USB driver compatible with upstream device tree
This should have been committed in r307093: resource allocation depends
on source of the device tree. upstream dts has extra interrupt that we can
ignore
2016-10-12 03:36:46 +00:00
Warner Losh
f79d484dff Create /dev/efidev to provide an ioctl interface to
userland.  It supports userland interfaces to UEFI Runtime Services. This is
indended to the the MI portion of EFI RuntimeServices support.

Differential Revision: https://reviews.freebsd.org/D8128
Reviewed by: kib@, wblock@, Ganael Laplanche
2016-10-11 22:24:30 +00:00
Andrew Rybchenko
b36a7ad2c9 sfxge(4): update external port mapping for Medford
Extend the mapping table for external port numbering to support port modes
which output to the second external port only. Where supported, map from
the current port mode rather than inferring from all the available modes.
Updated comments for clarity.

Submitted by:   Richard Houldsworth <rhouldsworth at solarflare.com>
Sponsored by:   Solarflare Communications, Inc.
MFC after:      2 days
Differential Revision:  https://reviews.freebsd.org/D8210
2016-10-11 13:08:48 +00:00
Sepherosa Ziehau
4afe249835 hyperv/hn: Rework link status support.
This is the preamble for network device SR-IOV and
NDIS_STATUS_NETWORK_CHANGE handling.

MFC after:	1 week
Sponsored by:	Microsoft
Differential Revision:	https://reviews.freebsd.org/D8209
2016-10-11 02:54:56 +00:00
Sepherosa Ziehau
cca23e7c3c hyperv/vmbus: Allow driver to inject synchronous task into channel taskq.
MFC after:	1 week
Sponsored by:	Microsoft
Differential Revision:	https://reviews.freebsd.org/D8208
2016-10-11 02:43:23 +00:00
Andrew Rybchenko
622429035a sfxge(4): sync tlv_layout.h with firmwaresrc and update port-mode definition use
It fixes driver attach issue to a new firmware which reports a new
port-modes.

Reviewed by:    gnn
Submitted by:   Tom Millington <tmillington at solarflare.com>
Sponsored by:   Solarflare Communications, Inc.
MFC after:      2 days
Differential Revision:  https://reviews.freebsd.org/D8203
2016-10-10 09:54:01 +00:00
Sepherosa Ziehau
5d67f6752b hyperv/hn: Suffix NDIS offload size with NDIS version.
MFC after:	1 week
Sponsored by:	Microsoft
Differential Revision:	https://reviews.freebsd.org/D8091
2016-10-10 06:14:38 +00:00
Sepherosa Ziehau
43147058fd hyperv/hn: Generalize RSS capabilities query.
- Support NDIS < 6.30.
- Stringent response checks.

MFC after:	1 week
Sponsored by:	Microsoft
Differential Revision:	https://reviews.freebsd.org/D8090
2016-10-10 05:59:30 +00:00
Sepherosa Ziehau
c21d553cfa hyperv/hn: Fix if_hw_tsomax setup.
MFC after:	1 week
Sponsored by:	Microsoft
Differential Revision:	https://reviews.freebsd.org/D8089
2016-10-10 05:50:01 +00:00
Sepherosa Ziehau
65ca331080 hyperv/hn: Fix checksum offload settings
The _correct_ way to identify the supported checksum offloading and
TSO parameters is to query OID_TCP_OFFLOAD_HARDWARE_CAPABILITIES.

MFC after:	1 week
Sponsored by:	Microsoft
Differential Revision:	https://reviews.freebsd.org/D8088
2016-10-10 05:41:39 +00:00
Andriy Voskoboinyk
4623c73135 iwm: add missing 'Rx errors' counter incrementation. 2016-10-09 10:21:28 +00:00
Andriy Voskoboinyk
3f3d4d6100 wpi: restore frame header before submitting an mbuf to
ieee80211_tx_complete()

This change allows to pass packet length to rate control modules and
fixes IFCOUNTER_OBYTES calculation.

Tested with Intel 3945BG, STA mode.
2016-10-08 20:41:08 +00:00
Oleksandr Tymoshenko
c736a75712 Implement EVDEV_FLAG_MT_AUTOREL flag (autorelease touchpoints)
Automaticaly release (send ABS_MT_TRACKING_ID = -1) MT-slots
that has not been listed in current MT protocol type B report.

Slot is counted as listed if corresponding ABS_MT_SLOT event
has been sent regardless of other MT events.

Events are sent on SYN_REPORT event.

Submitted by:	Vladimir Kondratiev <wulf@cicgroup.ru>
2016-10-08 17:59:53 +00:00
Oleksandr Tymoshenko
bfbd1bb744 Allow using of driver's mutex instead internal one for evdev locking.
Add new API call: evdev_register_mtx which takes lock argument that
should be used instead of internal one for evdev locking. Useful for
cases if evdev_push_event() is always called with driver's lock taken
and reduces amount of lock aquisitions. This allows to avoid LOR
between ev_open/ev_close invocations and evdev_push_event() Such LOR
can happen when ev_open/ev_close methods acquire driver lock and
evdev_push_event() is called with this lock taken.

Submitted by:	Vladimir Kondratiev <wulf@cicgroup.ru>
2016-10-08 17:58:26 +00:00
Adrian Chadd
e97796e2b6 [net80211] extend the ieee80211_rx_stats struct to include more information.
There are a variety of more interesting RX statistics that we should
keep track of but we don't.  This is a starting point for adding more
information.

Specifically:

* now the RX rate information and some of the packet status is
  passed up;
* The 32 bit or 64 bit TSF is passed up;
* the PHY mode is passed up;
* the "I'm decap'ed AMSDU!" state is passed up;
* number of RX chains is bumped to 4.

This is all mostly a placeholder for getting the data into the RX status
before we pass it up to net80211 - unfortunately we don't yet enforce
that drivers provide it, nor do we pass the provided info back up the
stack so anyone can use the data.

We're going to need to use some of this data moving forward.
Notably, now that some hardware can do AMSDU decap for us (the intel iwm
driver can do it when we flip it on; the ath10k port I'm doing does
it for us) then we need to pass it up through the stack so the duplicate
RX sequence numbers and crypto/IV details don't cause the packet to
be dropped and/or counted against a replay counter.

It's also the beginning of being able to do more interesting node
accounting in net80211.  Specifically, once drivers start populating
per-packet rate information, AMPDU information, timestamps, etc,
we can start providing histograms of rate-versus-RSSI, account
for receive time spent per node and other such interesting things.

(Note: I'm also hoping to include ranging and RTT information for
future chipset support; and it's likely going to include it in
this kind of fashion.)
2016-10-08 01:12:29 +00:00
Navdeep Parhar
35b5ef914c cxgbe(4): Add an ioctl to copy a firmware config file to the card's flash. 2016-10-07 19:02:39 +00:00
David C Somayajulu
da834d52c1 Add support for adding up to 64 Multicast addresses with a single
mailbox command

MFC after:5 days
2016-10-06 21:39:04 +00:00
Navdeep Parhar
d4d953bf37 cxgbe(4): Fix whitespace in the pm_stats display. 2016-10-06 21:25:17 +00:00
Sean Bruno
87de0cd185 Move netmap selinfo.h in to sensible location.
netmap_kern.h currently requires all drivers including it to include
selinfo.h.

Submitted by:	mmacy@nextbsd.org
Reviewed by:	gnn
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D5334
2016-10-06 17:54:34 +00:00
Oleksandr Tymoshenko
0901b57792 Fix extended buttons support on synaptic clickpad
Fix regression introduced by r306355 on synaptic clickpads with
extended buttons (buttons stopped working)

PR:		205690
Submitted by:	Vladimir Kondratyev <wulf@cicgroup.ru>
2016-10-06 01:01:00 +00:00
Jung-uk Kim
493deb390b Merge ACPICA 20160930. 2016-10-04 20:27:15 +00:00
Gleb Smirnoff
37d0ac15e6 Fix indentation.
CID:	1363671
2016-10-04 16:44:40 +00:00
Oleksandr Tymoshenko
5163e77fad const-ify struct evdev_methods
Submitted by:	Vladimir Kondratiev <wulf@cicgroup.ru>
Suggested by:	hselasky
2016-10-03 17:20:34 +00:00
Andriy Voskoboinyk
f6930bec33 net80211: ieee80211_ratectl*: switch to reusable KPI
Replace various void * / int argument combinations with common structures:
- ieee80211_ratectl_tx_status for *_tx_complete();
- ieee80211_ratectl_tx_stats for *_tx_update();

While here, improve amrr_tx_update() for a bit:
1. In case, if receiver is not known (typical for Ralink USB drivers),
refresh Tx rate for all nodes on the interface.
2. There was a misuse:
- otus(4) sends non-decreasing counters (as originally intended);
- but ural(4), rum(4) and run(4) are using 'read & clear' registers
to obtain statistics for some period of time (and those 'last period'
values are used as arguments for tx_update()). If arguments are not big
enough, they are just discarded after the next call.

Fix: move counting into *_tx_update()
(now otus(4) will zero out all node counters after every tx_update() call)

Tested with:
- Intel 3945BG (wpi(4)), STA mode.
- WUSB54GC (rum(4)), STA / HOSTAP mode.
- RTL8188EU (urtwn(4)), STA mode.

Reviewed by:	adrian
Differential Revision:	https://reviews.freebsd.org/D8037
2016-10-02 20:35:55 +00:00
Warner Losh
604d83bdce Implement iicbus_write_ivar and impelemnt the NOSTOP ivar in both read
and write.
2016-10-02 17:36:55 +00:00
Oleksandr Tymoshenko
a6b15a3429 Modularize evdev
- Convert "options EVDEV" to "device evdev" and "device uinput", add
    modules for both new devices. They are isolated subsystems and do not
    require any compile-time changes to general kernel subsytems
- For hybrid drivers that have evdev as an optional way to deliver input
    events add option EVDEV_SUPPORT. Update all existing hybrid drivers
    to use it instead of EVDEV
- Remove no-op DECLARE_MODULE in evdev, it's not required, MODULE_VERSION
    is enough
- Add evdev module dependency to uinput

Submitted by:	Vladimir Kondratiev <wulf@cicgroup.ru>
2016-10-02 03:20:31 +00:00
Oleksandr Tymoshenko
886f6623f6 Fix gcc compilation error
input_absinfo.code is unsigned so condition is always false
2016-10-02 03:06:58 +00:00
Eric van Gyzen
fb6ddd454a lmc(4): fix the build without the bpf device
"make buildkernel" now works with and without "device bpf".

Reported by:	Dave Mischler <dave@mischler.com>
MFC after:	3 days
Sponsored by:	Dell EMC
2016-10-01 22:21:10 +00:00
Oleksandr Tymoshenko
2685a39acf Provide way for framebuffer driver to request mmap(2) mapping type
On ARM if memattr is not overriden mmap(2) maps framebuffer
memory as WBWA which means part of changes to content in userland
end up in cache and appear on screen gradually as cache lines are
evicted. This change adds configurable memattr that hardware fb
implementation can set to get the memory mapping type it
requires:

- Add new flag FB_FLAG_MEMATTR that indicates that framebuffer
    driver overrides default memattr
- Add new field fb_memattr to struct fb_info to specify requested
    memattr

Reviewed by:	ray
Differential Revision:	https://reviews.freebsd.org/D8064
2016-10-01 17:43:02 +00:00
Justin Hibbits
a3ee15f9bf Revert r306473.
Some objections were noted, and it was purely a cosmetic change anyway.
2016-10-01 01:10:51 +00:00
Oleksandr Tymoshenko
fa26e8edee Declare a module for evdev and add dependency to ukbd(4) and ums(4)
Prepare for making evdev a module. "Pure" evdev device drivers (like
touchscreen) and evdev itself can be built as a modules regardless of
"options EVDEV" in kernel config. So if people does not require evdev
functionality in hybrid drivers like ums and ukbd they can, for instance,
kldload evdev and utouchscreen to run FreeBSD in kiosk mode.
2016-09-30 21:04:56 +00:00
David C Somayajulu
999a0d8658 Upgrade Firmware/Bootloader/ResetSeq/Minidump to revision 5.4.62
MFC after:5 days
2016-09-30 19:21:02 +00:00
David C Somayajulu
106961b640 Revert commit
r306284 - Fixes for issues under high workloads

Will fix and recommit patch
2016-09-30 18:08:16 +00:00
Andriy Voskoboinyk
d6c3624cce ral (rt2860): eliminate duplicate ieee80211_process_callback() call
(left after r287197)

MFC after:	1 week
2016-09-30 13:37:50 +00:00
Hans Petter Selasky
97549c34ec Move the ConnectX-3 and ConnectX-2 driver from sys/ofed into sys/dev/mlx4
like other PCI network drivers. The sys/ofed directory is now mainly
reserved for generic infiniband code, with exception of the mthca driver.

- Add new manual page, mlx4en(4), describing how to configure and load
mlx4en.

- All relevant driver C-files are now prefixed mlx4, mlx4_en and
mlx4_ib respectivly to avoid object filename collisions when compiling
the kernel. This also fixes an issue with proper dependency file
generation for the C-files in question.

- Device mlxen is now device mlx4en and depends on device mlx4, see
mlx4en(4). Only the network device name remains unchanged.

- The mlx4 and mlx4en modules are now built by default on i386 and
amd64 targets. Only building the mlx4ib module depends on
WITH_OFED=YES .

Sponsored by:	Mellanox Technologies
2016-09-30 08:23:06 +00:00
Sepherosa Ziehau
1a3c881209 hyperv/hn: Add stubs for OFFLOAD_CURRENT_CONFIG and NETWORK_CHANGE status
MFC after:	1 week
Sponsored by:	Microsoft
Differential Revision:	https://reviews.freebsd.org/D8068
2016-09-30 06:58:45 +00:00