Commit Graph

32778 Commits

Author SHA1 Message Date
Andriy Voskoboinyk
935b4fcccd rsu: add support for hardware multicast filter setup.
The algorithm is the same as in rtwn(4).

Tested with Asus USB-N10 (STA) + RTL8188CUS (AP).
2016-11-27 18:06:03 +00:00
Hans Petter Selasky
c0f71e317b Fix spelling. 2016-11-27 12:04:54 +00:00
Andriy Voskoboinyk
5dbbb84e42 rsu: various scanning fixes.
- Set IEEE80211_FEXT_SCAN_OFFLOAD flag; firmware can send null data
frames when associated.
- Check IEEE80211_SCAN_ACTIVE scan flag instead of IEEE80211_F_ASCAN
ic flag; the last is never set since r170530.
- Eliminate software scan (net80211) <-> site_survey (driver) race:
 * override ic_scan_curchan and ic_scan_mindwell pointers so net80211
will not try to finish scanning automatically;
 * inform net80211 about current status via ieee80211_cancel_scan()
and ieee80211_scan_done();
 * remove corresponding workaround from rsu_join_bss().

Now the driver can associate to an AP with hidden SSID.

Tested with Asus USB-N10.
2016-11-27 12:03:34 +00:00
Landon J. Fuller
77cb4d3e50 bhnd(4): Unify NVRAM/SPROM parsing, implement compact SPROM layout encoding.
- Defined an abstract NVRAM I/O API (bhnd_nvram_io), decoupling NVRAM/SPROM
  parsing from the actual underlying NVRAM data provider (e.g. CFE firmware
  devices).
- Defined an abstract NVRAM data API (bhnd_nvram_data), decoupling
  higher-level NVRAM operations (indexed lookup, data conversion, etc) from
  the underlying NVRAM file format parsing/serialization.
- Implemented a new high-level bhnd_nvram_store API, providing indexed
  variable lookup, pending write tracking, etc on top of an arbitrary
  bhnd_nvram_data instance.
- Migrated all bhnd(4) NVRAM device drivers to the common bhnd_nvram_store
  API.
- Implemented a common bhnd_nvram_val API for parsing/encoding NVRAM
  variable values, including applying format-specific behavior when
  converting to/from the NVRAM string representations.
- Dropped the now unnecessary bhnd_nvram driver, and moved the
  broadcom/mips-specific CFE NVRAM driver out into sys/mips/broadcom.
- Implemented a new nvram_map file format:
        - Variable definitions are now defined separately from the SPROM
          layout. This will also allow us to define CIS tuple NVRAM
          mappings referencing the common NVRAM variable definitions.
        - Variables can now be defined within arbitrary named groups.
        - Textual descriptions and help information can be defined inline
          for both variables and variable groups.
        - Implemented a new, compact encoding of SPROM image layout
          offsets.
- Source-level (but not build system) support for building the NVRAM file
  format APIs (bhnd_nvram_io, bhnd_nvram_data, bhnd_nvram_store) as a
  userspace library.

The new compact SPROM image layout encoding is loosely modeled on Apple
dyld compressed LINKEDIT symbol binding opcodes; it provides a compact
state-machine encoding of the mapping between NVRAM variables and the SPROM
image offset, mask, and shift instructions necessary to decode or encode
the SPROM variable data.

The compact encoding reduces the size of the generated SPROM layout data
from roughly 60KB to 3KB. The sequential nature SPROM layout opcode tables
also simplify iteration of the SPROM variables, as it's no longer
neccessary to iterate the full NVRAM variable definition table, but
instead simply scan the SPROM revision's layout opcode table.

Approved by:    adrian (mentor)
Differential Revision:  https://reviews.freebsd.org/D8645
2016-11-26 23:22:32 +00:00
Andriy Voskoboinyk
babfcab670 rsu: fix R92S_TXDW1_QSEL_H2C definition (0x1f -> 0x13).
Without this fix firmware ignores all but first 32 commands
(= almost everything (except plain Tx / Rx) stops working).

Tested with ASUS USB-N10.
2016-11-26 20:26:29 +00:00
Sepherosa Ziehau
2641e75742 hyperv/vmbus: Add a simplified version of channel close.
So that the caller can know the channel close error and react accordingly.

MFC after:	1 week
Sponsored by:	Microsoft
Differential Revision:	https://reviews.freebsd.org/D8600
2016-11-25 09:13:10 +00:00
Sepherosa Ziehau
892b35bc36 hyperv/vmbus: Propagate close error.
MFC after:	1 week
Sponsored by:	Microsoft
Differential Revision:	https://reviews.freebsd.org/D8599
2016-11-25 08:57:52 +00:00
Sepherosa Ziehau
0743140a63 hyperv/vmbus: Always try disconnect/free bufring memory upon channel close
While I'm here, minor wording and style changes.

MFC after:	1 week
Sponsored by:	Microsoft
Differential Revision:	https://reviews.freebsd.org/D8598
2016-11-25 08:31:13 +00:00
Sepherosa Ziehau
f2aeeaff6f hyperv/vmbus: Don't free the bufring if its GPADL can't be disconnected.
MFC after:	1 week
Sponsored by:	Microsoft
Differential Revision:	https://reviews.freebsd.org/D8570
2016-11-25 07:41:42 +00:00
Sepherosa Ziehau
32ab625a61 hyperv/vmbus: Return EISCONN if the bufring GPADL can't be disconnected.
So that the callers of vmbus_chan_open_br() could handle the passed in
bufring memory properly.

MFC after:	1 week
Sponsored by:	Microsoft
Differential Revision:	https://reviews.freebsd.org/D8569
2016-11-25 07:24:11 +00:00
Sepherosa Ziehau
12fbfdab73 hyperv/vmbus: No stranded bufring GPADL is allowed.
MFC after:	1 week
Sponsored by:	Microsoft
Differential Revision:	https://reviews.freebsd.org/D8568
2016-11-25 07:03:45 +00:00
Sepherosa Ziehau
11629f1cd6 hyperv/vmbus: GPADL disconnect error on a revoked channel is benign.
MFC after:	1 week
Sponsored by:	Microsoft
Differential Revision:	https://reviews.freebsd.org/D8567
2016-11-25 06:48:53 +00:00
Sepherosa Ziehau
fd2b520f2f hyperv/vmbus: Don't close unopened channels.
MFC after:	1 week
Sponsored by:	Microsoft
Differential Revision:	https://reviews.freebsd.org/D8566
2016-11-25 06:12:18 +00:00
Sepherosa Ziehau
ba9238f89f hyperv/vmbus: Fix sysctl tree leakage, if channel open fails.
MFC after:	1 week
Sponsored by:	Microsoft
Differential Revision:	https://reviews.freebsd.org/D8565
2016-11-25 06:01:45 +00:00
Sepherosa Ziehau
6d147fc18b hyperv/vmbus: Minor style changes.
MFC after:	1 week
Sponsored by:	Microsoft
Differential Revision:	https://reviews.freebsd.org/D8564
2016-11-25 05:46:15 +00:00
Sepherosa Ziehau
eb812ea9ab hyperv/vmbus: Commit the GPADL id only after the connection succeeds.
Minor style change.

MFC after:	1 week
Sponsored by:	Microsoft
Differential Revision:	https://reviews.freebsd.org/D8563
2016-11-25 05:35:29 +00:00
Dexuan Cui
cdb316ee87 hyperv/vmbus,pcib: unbreak build in case NEW_PCIB is undefined
vmbus_pcib requires NEW_PCIB, but in case that's not defined, we at
least shouldn't break build.

Reviewed by:	sephe
Approved by:	sephe (mentor)
MFC after:	3 days
Sponsored by:	Microsoft
2016-11-25 04:35:40 +00:00
Andriy Gapon
18ec6fbc3a virtio_pci: fix announcement of MSI-X interrupts for queues
Queues that do not need interrupts - for instance, output queues - do
not have a corresponding entry in vtpci_msix_vq_interrupts.
So, it was wrong to increment a pointer into that array when iterating
over such a queue.

I ran into this bug while trying to use virtio_console(4) that allocates
a lot of queues with every other being an output queue without an
interrupt handler (if MultiplePorts feature is negotiated).

MFC after:	2 weeks
2016-11-24 21:32:04 +00:00
Andriy Gapon
8be1b98cae virtio_console: correctly determine presense of payload and its length
MFC after:	2 weeks
2016-11-24 21:12:32 +00:00
Andriy Gapon
810f2b5030 firewire: initialize tag label to -1 in fw_xfer_alloc()
Zero can be confused for a potentially valid value.
For example, if I load and unload sbp driver I get a lot of messages
like the following:

fw_tl_free: the xfer is not in the queue (tlabel=0, flag=0x0)
send: dst=0x00 tl=0x00 rt=0 tcode=0x0 pri=0x0 src=0x000
recv: dst=0x01 tl=0x21 rt=1 tcode=0x1 pri=0x0 src=0xffc0
KDB: stack backtrace:
db_trace_self_wrapper() at db_trace_self_wrapper+0x2b/frame 0xfffffe04464407e0
fw_tl_free() at fw_tl_free+0x18d/frame 0xfffffe0446440820
fw_xfer_unload() at fw_xfer_unload+0xca/frame 0xfffffe0446440840
fw_xferlist_remove() at fw_xferlist_remove+0x2f/frame 0xfffffe0446440870
sbp_detach() at sbp_detach+0x1e0/frame 0xfffffe04464408e0
device_detach() at device_detach+0x80/frame 0xfffffe0446440900
devclass_driver_deleted() at devclass_driver_deleted+0x6a/frame 0xfffffe0446440940
devclass_delete_driver() at devclass_delete_driver+0x7d/frame 0xfffffe0446440980
driver_module_handler() at driver_module_handler+0xff/frame 0xfffffe04464409d0
module_unload() at module_unload+0x32/frame 0xfffffe04464409f0
linker_file_unload() at linker_file_unload+0x24b/frame 0xfffffe0446440a40
kern_kldunload() at kern_kldunload+0xbc/frame 0xfffffe0446440a70
amd64_syscall() at amd64_syscall+0x314/frame 0xfffffe0446440bf0
Xfast_syscall() at Xfast_syscall+0xfb/frame 0xfffffe0446440bf0

MFC after:	2 weeks
2016-11-24 09:47:56 +00:00
Andriy Gapon
dc6040d671 fwohci: report whether PhysicalUpperBound register is implemented
Please see section 5.15 of 1394 OHCI Specification.
If the register is not implemented, then the physical response unit is
limited to the first 4GB of the physical memory.
In that case the non-cooperative debugging over firewire (using /dev/fwmem)
can not be expected to work if a target has more RAM than that.
The method is described in gdb.4 and the Developer's Handbook.

It seems that most of the consumer hardware does not implement
PhysicalUpperBound register.

MFC after:	1 week
2016-11-24 09:43:42 +00:00
Sepherosa Ziehau
25641fc705 hyperv/hn: Fix primary channel revocation
Since hypervisor will not drain the TX bufring, once the channels are
revoked:
- Setup vmbus orphan handler properly.
- Make sure that suspension will not wait the TX bufring draining
  forever.
- GC the pending TX descs on detach path, before freeing the busdma
  stuffs.

MFC after:	1 week
Sponsored by:	Microsoft
Differential Revision:	https://reviews.freebsd.org/D8559
2016-11-24 07:35:16 +00:00
Sepherosa Ziehau
91955558f5 hyperv/vmbus: Fix the multi-channel revoking on vmbus side.
- Reference count the sub-channel when channel offer message is
  processed, so that immediate rescind message on the same channel
  will not race sub-channel open on driver side.
- Drop the above reference when sub-channel is closed, this closely
  mimics the hypervisor's reaction when primary channel is closed
  on the VM side.  No drivers use sub-channel after primary channel
  is closed.

MFC after:	1 week
Sponsored by:	Microsoft
Differential Revision:	https://reviews.freebsd.org/D8546
2016-11-24 06:01:29 +00:00
Sepherosa Ziehau
5ab84aaf2f hyperv/vmbus: Fix the primary channel revoking on vmbus side.
Drivers can now use vmbus_chan_{is_revoked,set_orphan,unset_orphan}() and
vmbus_xact_ctx_orphan() to fix their attach/detach DEVMETHODs for revoked
primary channels.

MFC after:	1 week
Sponsored by:	Microsoft
Differential Revision:	https://reviews.freebsd.org/D8545
2016-11-24 05:18:45 +00:00
Sepherosa Ziehau
494ec41ae2 hyperv/vmbus: Implement orphan support for transaction API
It will be used to fix the primary channel revocation support.

MFC after:	1 week
Sponsored by:	Microsoft
Differential Revision:	https://reviews.freebsd.org/D8525
2016-11-24 04:58:13 +00:00
Stephen Hurd
8882bc0eb7 Add new device IDs
Add device IDs for new hardware, sort the device IDs, add comment
regarding fragice NPAR/VF detection.

Approved by:	davidch
MFC after:	6 days
Sponsored by:	Broadcom Limited
2016-11-24 00:49:00 +00:00
Stephen Hurd
0535a446ab Fix version string
This is no longer on github, but in FreeBSD base.

Approved by:	davidch
MFC after:	6 days
Sponsored by:	Broadcom Limited
2016-11-24 00:15:32 +00:00
Sepherosa Ziehau
713ff628ac hyperv/vmbus: Merge free/active locks.
These functions are only used by management stuffs, so there are
no needs to introduce extra complexity.

MFC after:	1 week
Sponsored by:	Microsoft
Differential Revision:	https://reviews.freebsd.org/D8524
2016-11-23 08:30:02 +00:00
Sepherosa Ziehau
fb6216bd43 hyperv/vmbus: Set a mark on the revoked channel.
This will be used to fix device detach DEVMETHOD for revoked primary
channel.

MFC after:	1 week
Sponsored by:	Microsoft
Differential Revision:	https://reviews.freebsd.org/D8522
2016-11-23 05:03:44 +00:00
Stephen Hurd
200b12cd44 Add missing break to switch statement
Minimal impact, would allow selection of LR media when KR is connected.

Reported by:	Coverity
Approved by:	davidch
MFC after:	7 days
Sponsored by:	Broadcom Limited
2016-11-23 00:26:31 +00:00
Adrian Chadd
c969f82d85 [ath] obey the peer A-MPDU density and max-size.
* Obey the peer A-MPDU density if it's larger than the currently configured
  one.

* Pay attention to the peer A-MPDU max-size and don't assume we can transmit
  a full A-MPDU (64k!) if the peer announces smaller values.

Relnotes:	ath(4): Fix A-MPDU transmit; obey A-MPDU density and max size.
2016-11-22 02:42:00 +00:00
Oleksandr Tymoshenko
fd98051117 [bytgpio] prepare bytgpio(4) for modularization
- Add detach method
- module should depend on gpiobus, not gpio
2016-11-21 19:43:01 +00:00
Andrew Turner
ef022bb1de Include the missing accommon.h from the ACPI uart code.
Obtained from:	ABT Systems Ltd
Sponsored by:	The FreeBSD Foundation
2016-11-21 19:38:57 +00:00
Andrew Turner
eba1a249df Add support to find the arm64 serial using the ACPI tables. This uses the
Serial Port Console Redirection Table to find the device to use.

Obtained from:	ABT Systems Ltd
Sponsored by:	The FreeBSD Foundation
2016-11-21 19:26:58 +00:00
Michael Zhilin
b15317c431 [etherswitch] add ukswitch hint that is phy offset at mdio register
This patch allows to specify PHY register offset for ukswitch. For instance,
switch MAICREL KS8995XA connected via MDIO to SoC, but PHY register starts
at 1. So hint for this case is: hint.ukswitch.0.phyoffset=1

No change/effect if hint is not set.

Submitted by:	Hiroki Mori <yamori813@yahoo.co.jp>
Reviewed by:	adrian, mizhka
Approved by:	adrian(mentor)
Differential Revision:	https://reviews.freebsd.org/D8584
2016-11-21 19:26:22 +00:00
Andrew Turner
f94f8e62ab To allow for an ACPI attachment to the generic PCIe driver split off the
FDT attachment to a new file. A separate ACPI attachment will then be added
to allow arm64 servers with ACPI to use it over FDT.

This should also help with merging this with the ofwpci driver, with
further work needed to remove restrictions this driver places on resource
allocation.

Obtained from:	ABT Systems Ltd
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D7319
2016-11-21 18:24:05 +00:00
Sean Bruno
cb3c7e7f93 Add Intel Atom Cherryview SOC HSUART support
PR:	207910
Submitted by:	johannes@brilliantservice.co.jp
MFC after:	1 week
2016-11-21 14:43:31 +00:00
Andrew Turner
0812ab3141 Add an arm64 specific uart cpu driver. As arm64 may use ACPI to find the
uart we need to handle both it and FDT, and as such we need to have an
architecture specific driver.

Obtained from:	ABT Systems Ltd
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D7796
2016-11-21 11:27:14 +00:00
Kevin Lo
f55d404d45 Update struct r12a_rom.
Reviewed by:	avos
2016-11-21 09:23:42 +00:00
Sepherosa Ziehau
a7ba764844 hyperv/hn: Don't abuse hn_{tx,rx}_ring_inuse.
Just in case, the # of TX/RX rings is changed upon synthetic parts
re-attach.

MFC after:	1 week
Sponsored by:	Microsoft
Differential Revision:	https://reviews.freebsd.org/D8520
2016-11-21 05:54:31 +00:00
Sepherosa Ziehau
7960e6ba99 hyperv/hn: Allow enabling IPv6 TX checksum offloading and IPv6 TSO.
They are still disabled by default.

MFC after:	1 week
Sponsored by:	Microsoft
Differential Revision:	https://reviews.freebsd.org/D8490
2016-11-21 05:41:08 +00:00
Sepherosa Ziehau
fdc4f478ed hyperv/hn: Fix WITNESS warnings
And re-enable SIOCADDMULTI/SIOCDELMULTI, after WITNESS warning is fixed.

MFC after:	1 week
Sponsored by:	Microsoft
Differential Revision:	https://reviews.freebsd.org/D8489
2016-11-21 05:21:15 +00:00
Sepherosa Ziehau
8f3bf5f97b hyperv/vmbus: Support transction result busy-wait.
MFC after:	1 week
Sponsored by:	Microsoft
Differential Revision:	https://reviews.freebsd.org/D8488
2016-11-21 05:09:43 +00:00
Sepherosa Ziehau
dc13fee60c hyperv/hn: Implement RNDIS multi-packet message support.
Currently, it is only applied to packet sent through chimney sending
buffers.  Not enabled by default yet.

This one gives 20%~30% performance boost for non-TSO usage in both
bit/packet rate tests and nginx performance test.

MFC after:	1 week
Sponsored by:	Microsoft
Differential Revision:	https://reviews.freebsd.org/D8560
2016-11-21 05:00:51 +00:00
Oleksandr Tymoshenko
06ae3ba328 [bytgpio] Fix USB disconnect event after listsing pins on gpioc2
- Do not set input flag when reading value from GPIO pin, it is not
  required and for gpioc2(S5 bank) setting both input and output flags
  leads to some kind of electric interference (curren drop?) that
  causes USB devices to disconnect

- Check pad configuration when attaching device and provide IN/OUT
  capabilities only for pads that are configured as GPIO. Do not let
  user code to configure or change value of non-GPIO pads. There is
  no information for NC bank in intel's datasheet so for now function
  check is ignored for pins in it

Reported by:	Frank H.
MFC after:	3 days
2016-11-20 18:38:32 +00:00
Emmanuel Vadot
dac458e0d6 Enable the use of spigen on FDT platform
MFC after:	2 weeks
2016-11-20 18:20:28 +00:00
Warner Losh
0cf14228c4 Implement HGST Log page 0xc1, as documented in the HGST SN100 and
SN150 product manuals. Subpage 0x32 is documented, but not implemented.

Sponsored by: Netflix, Inc
2016-11-19 17:13:08 +00:00
Warner Losh
ab1dd0917b Print Intel's expanded Temperature log page.
Sponsored by: Netflix, Inc
2016-11-19 17:13:03 +00:00
Warner Losh
d01f26f590 Add log pages that Intel SSDs provide. It turns out that many of these
are widely implemented beyond just Intel drives.

Sponsored by: Netflix, Inc
2016-11-19 17:12:58 +00:00
Warner Losh
aea528795a Add log pages defined through NVM Express 1.2.1.
Sponsored by: Netflix, Inc
2016-11-19 17:12:53 +00:00
Warner Losh
dc58cdf95e Expand the SMART / Health Information Log Page (Page 02) printout
based on NVM Express 1.2.1 Standard.

Sponsored by: Netflix, Inc
2016-11-19 17:12:49 +00:00
Ruslan Bukin
57b28934e9 Add receiver timeout interrupt enable bit implemented in some
system on chips.

Submitted by:	kan
Sponsored by:	DARPA, AFRL
2016-11-19 16:00:05 +00:00
Andrew Turner
f74776ed75 Make fdt_is_compatible a static function. It's only used in fdt_common.c.
Sponsored by:	ABT Systems Ltd
2016-11-19 13:57:21 +00:00
Kevin Lo
0ae37b2f01 For RTL8812AU:
- The Tx power (diff) values should be signed
- Fix an off by one error when reading Tx power (diff) values

Reviewed by:	avos, adrian
Differential Revision:	https://reviews.freebsd.org/D8571
2016-11-19 07:28:00 +00:00
Stephen Hurd
5f6bf12a3d Check link status after init
Because link state change events aren't enabled until the end of init(),
the initial link up event could be missed.  Check the current media status
immediately after enabling the default completion ring interrupt.

Approved by:	sbruno
MFC after:	12 days
Sponsored by:	Broadcom Limited
2016-11-18 21:18:51 +00:00
Dexuan Cui
8c582c7c58 hyperv/pcib: change the file name: pcib.c -> vmbus_pcib.c
This makes the file name and the variable naming in the file consistent.

Reviewed by:	sephe
Approved by:	sephe (mentor)
MFC after:	1 week
Sponsored by:	Microsoft
2016-11-18 06:44:18 +00:00
Dexuan Cui
50182f1312 hyperv/vmbus,pcib: Add MODULE_DEPEND on pci
We'd better add this dependency explicitly, though usually the pci
driver is built into the kernel by default.

Reviewed by:	sephe
Approved by:	sephe (mentor)
MFC after:	1 week
Sponsored by:	Microsoft
2016-11-18 06:24:22 +00:00
Stephen Hurd
00c468348f Add missing newline in error mesage
Approved by:	davidch
MFC after:	13 days
Sponsored by:	Broadcom Corporation
2016-11-17 23:05:34 +00:00
Imre Vadász
b22fe30db1 [iwm] Sync iwm_nvm_read_chunk() function with Linux iwlwifi.
This fixes an error handling detail in iwm_nvm_read_chunk(), where an
error response from the firmware for an NVM read shouldn't be fatal if
the offset was non-zero.

Approved by:	adrian (mentor)
Obtained from:	DragonFlyBSD git 250a1c33fca1725121fe499f9cebc90267d209f9
Differential Revision:	https://reviews.freebsd.org/D8542
2016-11-17 20:00:20 +00:00
Ruslan Bukin
5515b0cb39 Do not reallocate driver softc for uart unnecessarily.
Do not assume that all uart drivers use uart_softc structure as is.
Some do a sensible thing and do declare their uart class and driver
properly and arrive into uart_bus_attach with suitably sized softc.

Submitted by:	kan
Sponsored by:	DARPA, AFRL
2016-11-17 16:06:53 +00:00
Ruslan Bukin
8e621af540 Make gpiobus early driver at BUS_PAS_BUS.
The gpiobus driver is attached explicitly and generally should be
at the same pass as its parent. Making it use BUS_PAS_BUS ensures
that it attaches immediately after parent adds it (assuming the
parent itself attached at BUS_PAS_BUS and above).

Submitted by:	kan
Sponsored by:	DARPA, AFRL
2016-11-17 15:37:44 +00:00
Ruslan Bukin
ead1785e1e Declare dwc_otg_detach as non-static (same as dwc_otg_attach),
so it can be called from fdt-glue drivers.

Submitted by:	kan
Sponsored by:	DARPA, AFRL
2016-11-17 15:12:03 +00:00
Ruslan Bukin
cec8009ca1 Allow operation with UTMI+ phy.
Submitted by:	kan
Sponsored by:	DARPA, AFRL
2016-11-17 15:08:30 +00:00
Ruslan Bukin
a8d6954281 Remove outdated comment.
Pointed out by:	andrew (original author)
Sponsored by:	DARPA, AFRL
2016-11-17 14:43:13 +00:00
Ruslan Bukin
b192bae67e Add support for UART found in the Ingenic XBurst system on chips.
These CPUs has non-standard UART enable bit hidden in the UART FIFO
Control Register.

Sponsored by:	DARPA, AFRL
2016-11-17 14:41:22 +00:00
Ruslan Bukin
f3b37a1f47 Add driver for DM9000 Ethernet MAC Controller.
This device found in the Ingenic jz4780 SoC.

Submitted by:	kan
Sponsored by:	DARPA, AFRL
2016-11-17 11:48:07 +00:00
Michael Zhilin
c702a80e27 [etherswitch] add infineon adm6996fc support on etherswitch
This is Infineon ADM6996FC/M/MX driver code on etherswitch framework.
Support PORT and DOT1Q VLAN.
This code suppose ADM6996FC SDC/SDIO connect to SOC network interface
MDC/MDIO.
This code tested on Netgear WGR614Cv7.

Submitted by:	Hiroki Mori <yamori813@yahoo.co.jp>
Reviewed by:	adrian, mizhka
Approved by:	adrian(mentor)
Differential Revision:	https://reviews.freebsd.org/D8495
2016-11-17 07:33:37 +00:00
Hans Petter Selasky
33299e3d96 Make sure MAC address is reprogrammed when if_init() callback is
invoked. Else promiscious mode must be used to pass traffic. While at
it fix a debug print macro.

MFC after:	1 week
2016-11-16 14:39:03 +00:00
Dexuan Cui
871c968b3a hyperv/pcib: enable PCIe pass-through (a.k.a. Discrete Device Assignment)
The feature enables us to pass through physical PCIe devices to FreeBSD VM
running on Hyper-V (Windows Server 2016) to get near-native performance with
low CPU utilization.

The patch implements a PCI bridge driver to support the feature:

1) The pcib driver talks to the host to discover device(s) and presents
the device(s) to FreeBSD's pci driver via PCI configuration space (note:
to access the configuration space, we don't use the standard I/O port
0xCF8/CFC method; instead, we use an MMIO-based method supplied by Hyper-V,
which is very similar to the 0xCF8/CFC method).

2) The pcib driver allocates resources for the device(s) and initialize
the related BARs, when the device driver's attach method is invoked;

3) The pcib driver talks to the host to create MSI/MSI-X interrupt
remapping between the guest and the host;

4) The pcib driver supports device hot add/remove.

Reviewed by:	sephe
Approved by:	sephe (mentor)
MFC after:	1 week
Sponsored by:	Microsoft
Differential Revision:	https://reviews.freebsd.org/D8332
2016-11-16 09:25:00 +00:00
Dexuan Cui
522c192d38 hyperv/vmbus: add new vmbus methods to support PCIe pass-through
The new methods will be used by the coming pcib driver.

Reviewed by:	sephe
Approved by:	sephe (mentor)
MFC after:	1 week
Sponsored by:	Microsoft
Differential Revision:	https://reviews.freebsd.org/D8409
2016-11-16 09:08:32 +00:00
Dexuan Cui
c8b32f717d hyperv/vmbus: add a new method to get vcpu_id
vcpu_id is host's representation of guest CPU.
We get the mapping between vcpu_id and FreeBSD kernel's cpu id when VMBus
driver is loaded. Later, when a driver, like the coming pcib driver, talks
to the host and needs to refer to a guest CPU, the driver must use the
vcpu_id.

Reviewed by:	jhb, sephe
Approved by:	sephe (mentor)
MFC after:	1 week
Sponsored by:	Microsoft
Differential Revision:	https://reviews.freebsd.org/D8410
2016-11-16 09:02:17 +00:00
Justin Hibbits
b2f831c009 Simplify the page tracking for VA<->PA translations.
Drop the tracking down to the pmap layer, with optimizations to only track
necessary pages.  This should give a (slight) performance improvement, as well
as a stability improvement, as the tracking is already mostly handled by the
pmap layer.
2016-11-16 05:24:42 +00:00
Justin Hibbits
099a0e1bea Add a GPIO poweroff and reset driver.
Summary:
This implements part of the gpio-poweroff and gpio-restart device tree
bindings.  Optional properties are not handled currently.  It also currently
only supports level-triggered reset.

Reviewed By: gonzo
Differential Revision: https://reviews.freebsd.org/D8521
2016-11-16 02:14:07 +00:00
Michael Zhilin
2567d71370 [etherswitch] enable phy4/mac4 of ip175c
If MII1 interface is disabled, then enable phy4/mac4.

Submitted by:	Hiroki Mori <yamori813@yahoo.co.jp>
Reviewed by:	mizhka, adrian
Approved by:	adrian (mentor)
Differential Revision:	https://reviews.freebsd.org/D6832
2016-11-15 22:30:25 +00:00
Michael Zhilin
477e3eff7e [etherswitch] add RTL8366SR support
Add RTL8366SR support at etherswitch driver. Tested on RTL8366RB and
RTL8366SR.

Submitted by:	Hiroki Mori <yamori813@yahoo.co.jp>
Reviewed by:	adrian, mizhka
Approved by:	adrian(mentor)
Differential Revision:	https://reviews.freebsd.org/D6796
2016-11-15 21:58:04 +00:00
Michael Zhilin
4677ca5bf1 [etherswitch] add Marvell 88e6060 switch support
Add 88e6060 basic support: only port-based VLAN is supported.
No vlan(4) support.

Submitted by:	Hiroki Mori <yamori813@yahoo.co.jp>
Reviewed by:	mizhka, adrian
Approved by:	adrian(mentor)
Differential Revision:	https://reviews.freebsd.org/D8344
2016-11-15 21:49:01 +00:00
Stephen Hurd
d933e97f9d New driver for Broadcom NetXtreme-C and NetXtreme-E devices.
This driver uses the iflib framework supporting Broadcom
25/50Gbps devices.

Reviewed by:	gallatin, wblock
Approved by:	davidch
MFC after:	2 weeks
Relnotes:	yes
Sponsored by:	Broadcom Limited
Differential Revision:	https://reviews.freebsd.org/D7551
2016-11-15 20:35:29 +00:00
Michael Zhilin
ba3eb10d85 [BHND] correct spelling error in macro name
This commit is part of D6920 review. One of macro had wrong prefix:
 BMCA => BCMA

Reviewed by:	landonf, adrian (mentor)
Approved by:	adrian (mentor)
Differential Revision:	https://reviews.freebsd.org/D6920
2016-11-15 20:05:22 +00:00
Oleksandr Tymoshenko
97fc5dbe89 [evdev] Add evdev support to kbdmux(4) driver
To enable event sourcing from kbdmux(4) kern.evdev.rcpt_mask value
should have bit 1 set (this is default)

Submitted by:	Vladimir Kondratiev <wulf@cicgroup.ru>
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D8437
2016-11-15 04:12:19 +00:00
Sepherosa Ziehau
168fce73b5 hyperv/vss: Add driver and tools for VSS
VSS stands for "Volume Shadow Copy Service".  Unlike virtual machine
snapshot, it only takes snapshot for the virtual disks, so both
filesystem and applications have to aware of it, and cooperate the
whole VSS process.

This driver exposes two device files to the userland:

    /dev/hv_fsvss_dev

    Normally userland programs should _not_ mess with this device file.
    It is currently used by the hv_vss_daemon(8), which freezes and
    thaws the filesystem.  NOTE: currently only UFS is supported, if
    the system mounts _any_ other filesystems, the hv_vss_daemon(8)
    will veto the VSS process.

    If hv_vss_daemon(8) was disabled, then this device file must be
    opened, and proper ioctls must be issued to keep the VSS working.

    /dev/hv_appvss_dev

    Userland application can opened this device file to receive the
    VSS freeze notification, hold the VSS for a while (mainly to flush
    application data to filesystem), release the VSS process, and
    receive the VSS thaw notification i.e. applications can run again.

    The VSS will still work, even if this device file is not opened.
    However, only filesystem consistency is promised, if this device
    file is not opened or is not operated properly.

hv_vss_daemon(8) is started by devd(8) by default.  It can be disabled
by editting /etc/devd/hyperv.conf.

Submitted by:	Hongjiang Zhang <honzhan microsoft com>
Reviewed by:	kib, mckusick
MFC after:	3 weeks
Sponsored by:	Microsoft
Differential Revision:	https://reviews.freebsd.org/D8224
2016-11-15 02:36:12 +00:00
Andriy Voskoboinyk
800762ee73 rtwn: drop excessive includes.
Since rom_defs.h is included in rxxx_var.h there is no need to
include both of them.

Submitted by:	kevlo
2016-11-14 20:37:07 +00:00
Sean Bruno
751e35548b Update WOL support for newer em(4) devices.
Do not overwrite the contents of the WUC register, add E1000_WUC_PME_EN
to the register contents, leaving the default contents intact.

PR:		208343
Submitted by:	Kaho Toshikazu <kaho@elam.kais.kyoto-u.ac.jp>
Reviewed by:	jeffrey piper <jeffrey.e.pieper@intel.com>
Approved by:	erj@
MFC after:	2 weeks
2016-11-14 17:19:03 +00:00
Michal Meloun
aa1f683bf3 Allow DRM2 code to be built on platforms without AGP.
This patch is taken from original drm-3.8 code.

Differential Revision: https://reviews.freebsd.org/D8454
MFC after: 3 weeks
2016-11-13 13:31:23 +00:00
Justin Hibbits
3e7ddf02dc Make dpaa work with only slightly modified Linux device trees.
Linux has a slightly different device tree definition for DPAA than originally
done in the FreeBSD driver.  This changes the driver to be mostly compatible
with the Linux device tree definitions.  Currently the differences are:

bman-portals: compatible = "fsl,bman-portals" (Linux is "simple-bus")
qman-portals: compatible = "fsl,qman-portals" (Linux is "simple-bus")
fman: compatible = "fsl,fman" (Linux is "simple-bus")

The Linux device tree doesn't specify anything for rgmii in the mdio.  This
change still requires the device tree to specify the phy-handle, and doesn't yet
support tbi.
2016-11-12 20:45:03 +00:00
Gavin Atkinson
bfcd23a946 iwm: If firmware load fails during init via iwm_preinit() we bail out
before calling ieee80211_ifattach() so the taskqueue hasn't been
initialized. Don't try to drain it, we'll panic.
Looks like this issue was introduced in r303326.

Reviewed by:	avos, sbruno, adrian
Differential Revision:	https://reviews.freebsd.org/D8499
2016-11-12 18:33:56 +00:00
Andriy Voskoboinyk
a14f9888d9 rtwn: enable 11n support for RTL8188CE.
- Increase Rx buffer size from MCLBYTES to MJUMPAGESIZE.
- Provide an additional defragmentation routine for frames larger
than MCLBYTES; that is required by A-MSDU / Atheros Fast-Frames
support to work with current Tx path implementation.

Enabled features list for RTL8188CE:
- Atheros Fast-Frames;
- A-MPDU (Tx / Rx);
- A-MSDU (Tx / Rx; 4k only);
- Short Guard Interval.

Tested with:
- RTL8188CE (STA+AP) + RTL8821AU (STA).
- RTL8188CE (STA) + RTL8188CUS (AP).

Relnotes:	yes
2016-11-12 17:58:37 +00:00
Alexander Motin
1f842820e1 Set of improvements to acpi_hp(4) driver.
- Attach only to WMI devices that provide supported GUIDs.  HP Spectre x360
has two WMI devices, only one of which provides the GUIDs.
 - Pass proper device to ACPI_WMI_REMOVE_EVENT_HANDLER() on detach.
 - Improve error WMI handling separating status and data paths.  This allows
to hide sysctls not supported by specific hardware/BIOS.
 - Improve CMI block parser to make it work on HP Spectre x360 laptop.
 - In verbose mode log all unknown events to help futher improvements.
2016-11-12 05:09:39 +00:00
Jakub Wojciech Klama
f7b1d7f419 Reserve space for control message payload (currently a port name).
Approved by:	trasz (mentor)
Sponsored by:	iXsystems, Inc.
2016-11-12 01:41:43 +00:00
Justin Hibbits
5bb79eade4 Replace another fdt_is_compatible() call. 2016-11-11 21:29:48 +00:00
Conrad Meyer
3a37091931 ioat(4): Fix race between process_events and reset_hw
In the case where a hardware error is detected during
ioat_process_events, hardware may advance (by one descriptor, probably)
and a subsequent ioat_process_events may race the intended ioat_reset_hw
followup.  In that case, the second process_events would observe a
completion update that does not match the software "last_seen" status,
and attempt to successfully complete already-failed descriptors.

Guard against this race with the resetting_cleanup flag.

Reviewed by:	bdrewery, markj
Sponsored by:	Dell EMC Isilon
2016-11-11 20:09:54 +00:00
Konstantin Belousov
836055542f Increase the max allowed size of the microcode update blob for x86.
Newer CPUs (SkyLakes) have updates of 100K size, which is bigger than
current limit 32K. Increase it to 4M but leave the check around to
prevent kernel memory allocator abuse.  Some time ago, the memory for
update was allocated by contigmalloc(9), and it was reasonable to be
conservative as much as possible.  Since all uses of contigmalloc(9)
appear to be either misunderstanding or too cautious, and were
removed, provide more slack than strictly neccessary.

Submitted by:	Oliver Pinter
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D8486
2016-11-11 18:57:41 +00:00
Justin Hibbits
472df8b8bd Use ofw_bus_node_is_compatible() instead of fdt_is_compatible()
No need to have two functions that do the same thing, let's let fdt_* go away,
and use ofw_bus_* equivalents instead.

Requested by:	andrew
2016-11-11 18:10:13 +00:00
Andrew Turner
a2696bf3c0 Use ofw_bus_node_is_compatible in more drivers used on arm.
Sponsored by:	ABT Systems Ltd
2016-11-11 15:42:12 +00:00
Andriy Gapon
88cc0bb940 iicsmb: SMB_MAXBLOCKSIZE can be used again
The constant was set to the correct value in r308242.
While there, fix iicsmb_bread() to not use a value of an out parameter
'count'.

MFC after:	3 weeks
X-MFC after:	r308242
2016-11-11 15:11:54 +00:00
Andriy Gapon
678d569fc2 intpm: clean up intsmb_bread and intsmb_pcall
The hardware does not implement SMBus Process Call command, so remove
ifdef-ed out code from intsmb_pcall.  The code used exactly the same
start sequence as for Write Word command.

intsmb_bread code used to access an in value of the count parameter,
but that parameter is supposed to be an out only parameter.
For example, smb(4) does not initialize it before calling smbus_bread.

MFC after:	3 weeks
2016-11-11 15:08:12 +00:00
Andriy Gapon
f43618f59f smb: fix SMB_READB, SMB_READW, SMB_PCALL to work as documented
Previously, those ioctls were defined as 'in' only, so rdata.byte and
rdata.word were never updated in the userland.  The read data went only
to rbuf if it was provided.  Thus, consumers were forced to always use it.

Now the ioctls are marked as in-out.
Compatibility handlers are provided for old ioctls.

PR:		213481
Reported by:	Lewis Donzis <lew@perftech.com>
MFC after:	2 weeks
Relnotes:	maybe
Differential Revision: https://reviews.freebsd.org/D8430
2016-11-11 14:41:02 +00:00
Andrew Turner
c6c4276bb7 Replace OF_getprop ... fdt32_to_cpu with OF_getencprop. The latter
correctly adjusts for the endian.

MFC after:	1 week
Sponsored by:	ABT Systems Ltd
2016-11-11 14:19:12 +00:00
Andriy Gapon
593077d613 pmc_process_csw_out: ignore deleted counters
I see the fllowing panic on AMD when exiting pmcstat:

panic: [pmc,1473] pp_pmcval outside of expected range cpu=2 ri=17
pp_pmcval=fffffffffa529f5b pm_reloadcount=10000

It seems that at least on AMD a performance counter keeps counting after
overflowing.  When pmcstat exits it sets counters that it used to
PMC_STATE_DELETED and waits until their use count goes to zero.
amd_intr() wouldn't reload a counter in that state and, thus, a counter
would be allowed to overflow.  That means that the counter's value would
be allowed to go outside the expected range.

MFC after:	2 weeks
2016-11-10 11:12:45 +00:00
Alexander Motin
c925d87e2a Fix copy/paste bug in r308464.
MFC after:	1 week
2016-11-09 17:57:55 +00:00
Alexander Motin
2b064d4653 Add some device IDs found in my new laptop. 2016-11-09 08:57:59 +00:00