Commit Graph

32351 Commits

Author SHA1 Message Date
Sepherosa Ziehau
a711c28f62 hyperv/hn: Rename RXBUF connect/disconnect functions.
Minor cleanup and wording in error messages.

MFC after:	1 week
Sponsored by:	Microsoft
Differential Revision:	https://reviews.freebsd.org/D7823
2016-09-12 05:09:45 +00:00
Adrian Chadd
5abc0b2590 [ath] set the relevant TOA/TOD locationing bits when trying to do locationing.
* Don't do RTS/CTS - experiments show that we get ACK frames for each of them
  and this ends up causing the timestamps to look all funny.
* Set the HAL_TXDESC_POS bit, so the AR9300 HAL sets up the hardware to return
  location and CSI information.
2016-09-12 04:55:13 +00:00
Adrian Chadd
bd3b336251 [ath] tweak the TX EDMA debugging a bit.
I've used this to debug some amusing issues with the EDMA code.

Tested:

* AR9380, STA mode
* AR9380, TDMA mode (master, slave)
2016-09-12 04:50:40 +00:00
Navdeep Parhar
4cf3aa135b cxgbe(4): Catch up with the rename of tlscaps -> cryptocaps. TLS is one
of the capabilities of the crypto engine in T6.

Sponsored by:	Chelsio Communications
2016-09-12 00:15:40 +00:00
Navdeep Parhar
9113e53d54 cxgbe(4): Add support for additional port types and link speeds.
Sponsored by:	Chelsio Communications.
2016-09-11 23:08:57 +00:00
Conrad Meyer
f44abf1fe7 ioat(4): Start poll timer when descriptors are released to HW
Rather than when the software creates the descriptors.

Sponsored by:	Dell EMC Isilon
2016-09-11 20:15:41 +00:00
Conrad Meyer
dc46505973 ioat(4): De-spam ioat_process_events KTR logs
Sponsored by:	Dell EMC Isilon
2016-09-11 20:14:19 +00:00
Oleksandr Tymoshenko
2b3f6d6650 Add evdev protocol implementation
evdev is a generic input event interface compatible with Linux
evdev API at ioctl level. It allows using unmodified (apart from
header name) input evdev drivers in Xorg, Wayland, Qt.

This commit has only generic kernel API. evdev support for individual
hardware drivers like ukbd, ums, atkbd, etc. will be committed later.

Project was started by Jakub Klama as part of GSoC 2014. Jakub's
evdev implementation was later used as a base, updated and finished
by Vladimir Kondratiev.

Submitted by:	Vladimir Kondratiev <wulf@cicgroup.ru>
Reviewed by:	adrian, hans
Differential Revision:	https://reviews.freebsd.org/D6998
2016-09-11 18:56:38 +00:00
Navdeep Parhar
769ef07a38 cxgbe(4): Rename the debug_flags driver tunable/sysctl to dflags.
Tunables that end with _flags are special.

Sponsored by:	Chelsio Communications
2016-09-11 18:05:37 +00:00
Navdeep Parhar
82c1d6b762 cxgbe(4): Deal with the slightly different SGE_STAT_CFG in T6.
Sponsored by:	Chelsio Communications
2016-09-11 17:57:53 +00:00
Navdeep Parhar
ed7e5640a5 cxgbe(4): Use smaller min/max bursts for fl descriptors with a T6.
Sponsored by:	Chelsio Communications
2016-09-11 17:51:17 +00:00
Navdeep Parhar
0dbc6cfd75 cxgbe(4): Update the pad_boundary calculation for T6, which has a
different range of boundaries.

Sponsored by:	Chelsio Communications
2016-09-11 17:22:54 +00:00
Navdeep Parhar
472a6004cf cxgbe(4): Use correct macro for header length with T6 ASICs. This
affects the transmit of the VF driver only.

Sponsored by:	Chelsio Communications
2016-09-11 16:11:51 +00:00
Navdeep Parhar
774168be39 cxgbe(4): Set up fl_starve_threshold2 accurately for T6.
Sponsored by:	Chelsio Communications
2016-09-11 16:06:17 +00:00
Navdeep Parhar
3aea32935c cxgbe(4): Avoid a NULL dereference in the clearstats ioctl handler.
Port softc's are not initialized when the adapter is in recovery mode.
2016-09-09 17:15:16 +00:00
Navdeep Parhar
9e7cb06c17 cxgbe(4): Do not prescreen frames before attempting LRO.
Sponsored by:	Chelsio Communications
2016-09-09 07:34:14 +00:00
Adrian Chadd
01decb509d [gpio] include intr.h when building with INTRNG.
Trying to build a MIPS platform that uses INTRNG needs this
for this to work right in gpiobusvar.h :

#ifdef INTRNG
struct intr_map_data_gpio {
        struct intr_map_data    hdr;
...
};
#endif
2016-09-09 04:54:41 +00:00
Adrian Chadd
90d3a30a16 [ath_hal] fixes for finer grain timestamping, some 11n macros
* change the HT_RC_2_MCS to do MCS0..23
* Use it when looking up the ht20/ht40 array for bits-per-symbol
* add a clk_to_psec (picoseconds) routine, so we can get sub-microsecond
  accuracy for the math
* .. and make that + clk_to_usec public, so higher layer code that is
  returning clocks (eg the ANI diag routines, some upcoming locationing
  experiments) can be converted to microseconds.

Whilst here, add a comment in ar5416 so i or someone else can revisit the
latency values.
2016-09-09 04:45:25 +00:00
Andriy Gapon
19afdc91b9 intpm: make sure to register smbus driver before intpm driver
Otherwise we can fail to create an smbus child of intpm.

MFC after:	1 week
2016-09-08 12:43:24 +00:00
Andriy Gapon
a2f51f57d1 intpm: better clean up resources after a failed attachment
bus_generic_detach() fails when called from attach method
thus preventing further clean up actions.

MFC after:	1 week
2016-09-08 12:27:34 +00:00
Andriy Gapon
c47117f43a intpm: do not try attaching to unsupported controller revisions
While there set a different device description for the controllers
found in various FCHs (Hudson, Bolton, CPU integrated).

MFC after:	1 week
2016-09-08 12:24:46 +00:00
Andriy Gapon
6c29523e00 intpm: fix attachment to supported AMD FCHs 2016-09-08 12:12:39 +00:00
Hans Petter Selasky
2b5b3a0923 Correctly map the USB mouse tilt delta values into buttons 5 and 6
instead of 3 and 4 which is used for the scroll wheel, according to
X.org.

PR:		170358
MFC after:	1 week
2016-09-08 10:10:05 +00:00
Sepherosa Ziehau
b33720da59 hyperv/hn: Factor out NVS NDIS initialization
MFC after:	1 week
Sponsored by:	Microsoft
Differential Revision:	https://reviews.freebsd.org/D7811
2016-09-08 07:45:20 +00:00
Sepherosa Ziehau
5152795ab9 hyperv/hn: Function renaming.
While I'm here, remove obvious comment.

MFC after:	1 week
Sponsored by:	Microsoft
Differential Revision:	https://reviews.freebsd.org/D7810
2016-09-08 07:34:31 +00:00
Sepherosa Ziehau
74decee899 hyperv/kvp: Fix IPv4/IPv6 address injection support.
The GUID string provided by hypervisor has leading and trailing braces,
while our GUID string does not have braces at all.  Both braces should
be ignored, when the GUID strings are compared.

Submitted by:	Hongjiang Zhang <honzhan microsoft com>
Modified by:	sephe
MFC after:	1 week
Sponsored by:	Microsoft
Differential Revision:	https://reviews.freebsd.org/D7809
2016-09-08 07:16:56 +00:00
Sepherosa Ziehau
a74e025394 hyperv/hn: Pass MTU around.
MFC after:	1 week
Sponsored by:	Microsoft
Differential Revision:	https://reviews.freebsd.org/D7808
2016-09-08 06:42:30 +00:00
Sepherosa Ziehau
021deece8f hyperv/hn: Factor out function to do NVS initialization.
MFC after:	1 week
Sponsored by:	Microsoft
Differential Revision:	https://reviews.freebsd.org/D7807
2016-09-08 06:23:08 +00:00
Sepherosa Ziehau
f7a9af2829 hyperv/hn: Push RXBUF size adjustment down.
It is not used in other places.

MFC after:	1 week
Sponsored by:	Microsoft
Differential Revision:	https://reviews.freebsd.org/D7806
2016-09-08 06:06:54 +00:00
Sepherosa Ziehau
c8fca9324a hyperv/hn: Pull vmbus channel open up.
While I'm here, pull up the channel callback related code too.

MFC after:	1 week
Sponsored by:	Microsoft
Differential Revision:	https://reviews.freebsd.org/D7805
2016-09-08 05:27:43 +00:00
John Baldwin
6af45170c1 Chelsio T4/T5 VF driver.
The cxgbev/cxlv driver supports Virtual Function devices for Chelsio
T4 and T4 adapters.  The VF devices share most of their code with the
existing PF4 driver (cxgbe/cxl) and as such the VF device driver
currently depends on the PF4 driver.

Similar to the cxgbe/cxl drivers, the VF driver includes a t4vf/t5vf
PCI device driver that attaches to the VF device.  It then creates
child cxgbev/cxlv devices representing ports assigned to the VF.
By default, the PF driver assigns a single port to each VF.

t4vf_hw.c contains VF-specific routines from the shared code used to
fetch VF-specific parameters from the firmware.

t4_vf.c contains the VF-specific PCI device driver and includes its
own attach routine.

VF devices are required to use a different firmware request when
transmitting packets (which in turn requires a different CPL message
to encapsulate messages).  This alternate firmware request does not
permit chaining multiple packets in a single message, so each packet
results in a firmware request.  In addition, the different CPL message
requires more detailed information when enabling hardware checksums,
so parse_pkt() on VF devices must examine L2 and L3 headers for all
packets (not just TSO packets) for VF devices.  Finally, L2 checksums
on non-UDP/non-TCP packets do not work reliably (the firmware trashes
the IPv4 fragment field), so IPv4 checksums for such packets are
calculated in software.

Most of the other changes in the non-VF-specific code are to expose
various variables and functions private to the PF driver so that they
can be used by the VF driver.

Note that a limited subset of cxgbetool functions are supported on VF
devices including register dumps, scheduler classes, and clearing of
statistics.  In addition, TOE is not supported on VF devices, only for
the PF interfaces.

Reviewed by:	np
MFC after:	2 months
Sponsored by:	Chelsio Communications
Differential Revision:	https://reviews.freebsd.org/D7599
2016-09-07 18:13:57 +00:00
John Baldwin
e06ab612d2 Don't break out of the m_advance() loop if len drops to zero.
If a packet contains the Ethernet header (14 bytes) in the first mbuf
and the payload (IP + UDP + data) in the second mbuf, then the attempt
to fetch the l3hdr will return a NULL pointer.  The first loop iteration
will drop len to zero and exit the loop without setting 'p'.  However,
the desired data is at the start of the second mbuf, so the correct
behavior is to loop around and let the conditional set 'p' to m_data of
the next mbuf (and leave offset as 0).

Reviewed by:	np
Sponsored by:	Chelsio Communications
2016-09-07 18:08:43 +00:00
Andriy Voskoboinyk
d204cea9f8 rum: fix possible panic on device detach (similar to r302034).
Tested with WUSB54GC, STA/AP modes.
2016-09-07 16:19:20 +00:00
Alexander Motin
07c3504304 Fix channel initialization in FBS mode.
Due to reading initialized variable, FIS receive area was always allocated
as 256 bytes, suitable for command-based switching, instead of 4096 bytes,
required for FIS-based switching.  This caused memory corruption in case of
port multipliers used on FBS-capable HBAs (Marvell).

MFC after:	1 week
2016-09-07 13:51:34 +00:00
Andriy Gapon
9626ccde7f amdsbwd: add support for FCH in family 16h models 30h-3Fh processors
Requested by:	Mike Tancsa <mike@sentex.net>
Tested by:	Mike Tancsa <mike@sentex.net>
MFC after:	1 week
2016-09-07 13:45:35 +00:00
Andriy Voskoboinyk
4c90f11b3c rum: use mgmt frame rate for EAPOL frames. 2016-09-07 12:07:02 +00:00
Sepherosa Ziehau
b67f3d2873 hyperv/hn: Nuke unused bits
MFC after:	1 week
Sponsored by:	Microsoft
Differential Revision:	https://reviews.freebsd.org/D7795
2016-09-07 09:20:58 +00:00
Sepherosa Ziehau
b44fb279e8 hyperv/hn: Simplify per-packet-info construction.
MFC after:	1 week
Sponsored by:	Microsoft
Differential Revision:	https://reviews.freebsd.org/D7794
2016-09-07 06:02:29 +00:00
Sepherosa Ziehau
61ac564fd0 hyperv/hn: Cleanup RNDIS packet message encapsulation.
MFC after:	1 week
Sponsored by:	Microsoft
Differential Revision:	https://reviews.freebsd.org/D7793
2016-09-07 05:41:01 +00:00
Sepherosa Ziehau
5761f5dfdd hyperv/hn: Avoid bit fields for TXCSUM setup.
MFC after:	1 week
Sponsored by:	Microsoft
Differential Revision:	https://reviews.freebsd.org/D7792
2016-09-07 05:27:43 +00:00
John Baldwin
da0fc9250c Reset PCI pass through devices via PCI-e FLR during VM start and end.
Add routines to trigger a function level reset (FLR) of a PCI-express
device via the PCI-express device control register.  This also includes
support routines to wait for pending transactions to complete as well
as calculating the maximum completion timeout permitted by a device.

Change the ppt(4) driver to reset pass through devices before attaching
to a VM during startup and before detaching from a VM during shutdown.

Reviewed by:	imp, wblock (earlier version)
MFC after:	1 month
Sponsored by:	Chelsio Communications
Differential Revision:	https://reviews.freebsd.org/D7751
2016-09-06 21:15:35 +00:00
Jared McNeill
319336a943 Add generic device-tree cpufreq driver.
This driver supports two bindings:
 - cpufreq-dt: systems which share clock and voltage across all CPUs
 - arm_big_little_dt: systems which share clock and voltage across all
   CPUs in a single cluster

Reviewed by:		andrew, imp
Relnotes:		yes
Differential Revision:	https://reviews.freebsd.org/D7741
2016-09-06 20:43:26 +00:00
John Baldwin
64414cc00f Update the I/O MMU in bhyve when PCI devices are added and removed.
When the I/O MMU is active in bhyve, all PCI devices need valid entries
in the DMAR context tables. The I/O MMU code does a single enumeration
of the available PCI devices during initialization to add all existing
devices to a domain representing the host. The ppt(4) driver then moves
pass through devices in and out of domains for virtual machines as needed.
However, when new PCI devices were added at runtime either via SR-IOV or
HotPlug, the I/O MMU tables were not updated.

This change adds a new set of EVENTHANDLERS that are invoked when PCI
devices are added and deleted. The I/O MMU driver in bhyve installs
handlers for these events which it uses to add and remove devices to
the "host" domain.

Reviewed by:	imp
Sponsored by:	Chelsio Communications
Differential Revision:	https://reviews.freebsd.org/D7667
2016-09-06 20:17:54 +00:00
Wojciech Macek
aab9fdaf6f Import missing enum declaration in pci_host_generic header file
Other files including pci_host_generic.h failed to compile
due to missing declaration of enum pci_id_type.

Obtained from:         Semihalf
Submitted by:          Michal Stanek <mst@semihalf.com>
Sponsored by:          Annapurna Labs
Reviewed by:           wma
Differential Revision: https://reviews.freebsd.org/D7561
2016-09-06 15:11:37 +00:00
Wojciech Macek
d8f1c69cc2 Remove check for 64-bit FDT ranges in pci-host-generic
This allows 32-bit platforms to use pci-host-generic.

Obtained from:         Semihalf
Submitted by:          Michal Stanek <mst@semihalf.com>
Sponsored by:          Annapurna Labs
Reviewed by:           wma
Differential Revision: https://reviews.freebsd.org/D7560
2016-09-06 15:06:08 +00:00
Ed Maste
68c6ae00ad bhnd: remove redundant ;s at the end of functions or switch statements 2016-09-06 13:34:10 +00:00
Andriy Voskoboinyk
93ae47478c rum: use m_get2() in Rx path. 2016-09-06 12:00:16 +00:00
Andriy Voskoboinyk
b7c8904780 rtwn: fix firmware readiness check in rtwn_load_firmware(). 2016-09-06 11:08:32 +00:00
Andriy Voskoboinyk
9afea60f98 iwm: fix scanning for hidden SSIDs.
Setup SSIDs in scan command so firmware will send direct probe request(s)
while scanning.

Tested by:	dbkirk@gmail.com

PR:		211519
MFC after:	1 week
2016-09-06 10:08:32 +00:00
Andriy Voskoboinyk
c84bb70268 rum: fix frame length checks in Rx path.
Split usbd_xfer_status() check:
- Check xfer length: must be longer, than Rx descriptor size.
- Check frame size: must be shorter than xfer length.
- Discard too short frames.

Tested with WUSB54GC, STA/MONITOR modes.
2016-09-06 06:40:59 +00:00
Sepherosa Ziehau
50002d3dfa hyperv/hn: Avoid bit fields for LSOv2 setup.
MFC after:	1 week
Sponsored by:	Microsoft
Differential Revision:	https://reviews.freebsd.org/D7786
2016-09-06 04:37:53 +00:00
Sepherosa Ziehau
14ee29ba93 hyperv/hn: Fix VLAN tag setup for outgoing VLAN packets.
MFC after:	1 week
Sponsored by:	Microsoft
Differential Revision:	https://reviews.freebsd.org/D7785
2016-09-06 03:31:31 +00:00
Sepherosa Ziehau
b349357819 hyperv/hn: Stringent RNDIS packet message length/offset check.
While I'm here, use definition in net/rndis.h

MFC after:	1 week
Sponsored by:	Microsoft
Differential Revision:	https://reviews.freebsd.org/D7782
2016-09-06 03:20:06 +00:00
Navdeep Parhar
48214203c4 Fix send/recv limit mixup. 2016-09-05 23:12:24 +00:00
Landon J. Fuller
824b48eff3 bhnd(4): Implement backplane interrupt handling.
This adds bhnd(4) bus-level support for querying backplane interrupt vector
routing, and delegating machine/bridge-specific interrupt handling to the
concrete bhnd(4) driver implementation.

On bhndb(4) bridged PCI devices, we provide the PCI/MSI interrupt directly
to attached cores.

On MIPS devices, we report a backplane interrupt count of 0, effectively
disabling the bus-level interrupt assignment. This allows mips/broadcom
to temporarily continue using hard-coded MIPS IRQs until bhnd_mips PIC
support is implemented.

Reviewed by:	mizhka
Approved by:	adrian (mentor, implicit)
2016-09-05 22:11:46 +00:00
Landon J. Fuller
7d6162806b bwn(4): ignore BCM4321's unpopulated USB11 host controller core.
Broadcom Intensi-fi chipsets provided a common set of IP cores; on PCI/PCIe
devices, the USB11 host controller is left floating.

Approved by:	adrian (mentor, implicit)
2016-09-05 21:55:27 +00:00
Landon J. Fuller
fb88110c09 bhnd(4): Add device classes for USB host/dev/dual-mode controller cores.
Approved by:	adrian (mentor, implicit)
2016-09-05 21:48:16 +00:00
Andriy Voskoboinyk
c57ee45ba9 rum: do not restart device when protmode / rtsthreshold is changed. 2016-09-05 19:42:35 +00:00
Navdeep Parhar
5aaa3bc3b9 cxgbe/t4_tom: toepcb should be all-zero on allocation because the code
that cleans up on failure assumes that non-NULL values indicate
initialized items.

Sponsored by:	Chelsio Communications
2016-09-05 19:37:47 +00:00
Michael Zhilin
29d492ace1 [BHND/USB] Port of EHCI/OHCI support from ZRouter
This patch adds driver implementation for BHND USB core. Driver has been
imported from ZRouter project with small adaptions for FreeBSD 11.

Also it's enabled for BroadCom MIPS74k boards by default. It's fully tested
on Asus boards (RT-N16: external USB, RT-N53: USB bus between SoC and WiFi
chips).

Reviewed by:    adrian (mentor), ray
Approved by:	adrian (mentor)
Obtained from:	ZRouter
Differential Revision:  https://reviews.freebsd.org/D7781
2016-09-05 16:06:52 +00:00
Hans Petter Selasky
64cb5e2a26 Resolve deadlock between device_detach() and usbd_do_request_flags()
by reviving the SX control request lock and refining which lock
protects the common scratch area in "struct usb_device".

The SX control request lock was removed by r246759 because it caused a
lock order reversal with the USB enumeration lock inside
usbd_transfer_setup() as a function of r246616. It was thought that
reducing the number of locks would resolve the LOR, but because some
USB device drivers use usbd_do_request_flags() inside callback
functions, like in taskqueues, a deadlock may occur when these are
drained from device_detach(). By restoring the SX control request
lock usbd_do_request_flags() is allowed to complete its execution
when a USB device driver is detaching. By using the SX control request
lock to protect the scratch area, the LOR introduced by r246616 is
also resolved.

Bump the FreeBSD version while at it to force recompilation of all USB
kernel modules.

Found by:	avos@
MFC after:	1 week
2016-09-05 15:35:58 +00:00
Jared McNeill
8dd48c60a0 Add driver for Silergy Corp. SY8106A buck regulator. 2016-09-05 13:39:54 +00:00
Sepherosa Ziehau
0bbb7d483b hyperv/hn: Stringent RNDIS control message length check.
MFC after:	1 week
Sponsored by:	Microsoft
Differential Revision:	https://reviews.freebsd.org/D7758
2016-09-05 05:07:40 +00:00
Sepherosa Ziehau
7a466137f0 hyperv/hn: Stringent NVS RNDIS packets length checks.
MFC after:	1 week
Sponsored by:	Microsoft
Differential Revision:	https://reviews.freebsd.org/D7755
2016-09-05 04:47:31 +00:00
Sepherosa Ziehau
dc65be7a3d hyperv/hn: Stringent NVS notification length check.
MFC after:	1 week
Sponsored by:	Microsoft
Differential Revision:	https://reviews.freebsd.org/D7753
2016-09-05 03:39:04 +00:00
Sepherosa Ziehau
19c8ea1086 hyperv/vmbus: Stringent header length and total length check.
While I'm here, minor style changes.

MFC after:	1 week
Sponsored by:	Microsoft
Differential Revision:	https://reviews.freebsd.org/D7752
2016-09-05 03:21:31 +00:00
Dimitry Andric
02d4a225db With clang 3.9.0, compiling uplcom results in the following warnings:
sys/dev/usb/serial/uplcom.c:543:29: error: implicit conversion from 'int' to 'int8_t' (aka 'signed char') changes value from 192 to -64 [-Werror,-Wconstant-conversion]
        if (uplcom_pl2303_do(udev, UT_READ_VENDOR_DEVICE, UPLCOM_SET_REQUEST, 0x8484, 0, 1)
            ~~~~~~~~~~~~~~~~       ^~~~~~~~~~~~~~~~~~~~~
sys/dev/usb/usb.h:179:53: note: expanded from macro 'UT_READ_VENDOR_DEVICE'
#define UT_READ_VENDOR_DEVICE   (UT_READ  | UT_VENDOR | UT_DEVICE)
                                 ~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~

This is because UT_READ is 0x80, so the int8_t argument is wrapped to a
negative value.  Fix this by using uint8_t instead.

Reviewed by:	imp, hselasky
MFC after:	3 days
Differential Revision: https://reviews.freebsd.org/D7776
2016-09-04 16:59:35 +00:00
Landon J. Fuller
eb83f2e1ea bhndb(4): Fix probing of bhndb-attached bhnd_nvram devices.
This fixes bhnd(4) nvram handling on devices that map SPROM CSRs via PCI
configuration space.

The probe method previously required that a bhnd(4) device be attached to the
parent bridge; now that the bhnd_nvram device is always attached first, this
unnecessary sanity check always failed.

Approved by:	adrian (mentor, implicit)
2016-09-04 01:47:21 +00:00
Landon J. Fuller
63fb0e8236 bhndb(4): Skip disabled cores when performing bridge configuration probing.
On BCM4321 chipsets, both PCI and PCIe cores are included, with one of
the cores potentially left floating.

Since the PCI core appears first in the device table, and the PCI
profiles appear first in the resource configuration tables, this resulted in
incorrectly matching and using the PCI/v1 resource configuration on PCIe
devices, rather than the correct PCIe/v1 profile.

Approved by:	adrian (mentor, implicit)
2016-09-04 01:43:54 +00:00
Landon J. Fuller
f32befd1a2 siba(4): Add missing bhnd_device/bhnd_device_quirk table terminator entries.
This resulted in an over-read on siba chipsets that failed to match the
existing entries.

Approved by:	adrian (mentor, implicit)
2016-09-04 01:25:46 +00:00
Landon J. Fuller
111d7cb2e3 Migrate bhndb(4) to the new bhnd_erom API.
Adds support for probing and initializing bhndb(4) bridge state using
the bhnd_erom API, ensuring that full bridge configuration is available
*prior* to actually attaching and enumerating the bhnd(4) child device,
allowing us to safely allocate bus-level agent/device resources during
bhnd(4) bus enumeration.

- Add a bhnd_erom_probe() method usable by bhndb(4). This is an analogue
  to the existing bhnd_erom_probe_static() method, and allows the bhndb
  bridge to discover the best available erom parser class prior to newbus
  probing of its children.
- Add support for supplying identification hints when probing erom
  devices. This is required on early EXTIF-only chipsets, where chip
  identification registers are not available.
- Migrate bhndb over to the new bhnd_erom API, using bhnd_core_info
  records rather than bridged bhnd(4) device_t references to determine
  the bridged chipsets' capability/bridge configuration.
- The bhndb parent (e.g. if_bwn) is now required to supply a hardware
  priority table to the bridge. The default table is currently sufficient
  for our supported devices.
- Drop the two-pass attach approach we used for compatibility with bhndb(4) in
  the bhnd(4) bus drivers, and instead perform bus enumeration immediately,
  and allocate bridged per-child bus-level resources during that enumeration.

Approved by:	adrian (mentor)
Differential Revision:	https://reviews.freebsd.org/D7768
2016-09-04 00:58:19 +00:00
Landon J. Fuller
664a749708 Implement a generic bhnd(4) device enumeration table API.
This defines a new bhnd_erom_if API, providing a common interface to device
enumeration on siba(4) and bcma(4) devices, for use both in the bhndb bridge
and SoC early boot contexts, and migrates mips/broadcom over to the new API.

This also replaces the previous adhoc device enumeration support implemented
for mips/broadcom.

Migration of bhndb to the new API will be implemented in a follow-up commit.


- Defined new bhnd_erom_if interface for bhnd(4) device enumeration, along
  with bcma(4) and siba(4)-specific implementations.
- Fixed a minor bug in bhndb that logged an error when we attempted to map the
  full siba(4) bus space (18000000-17FFFFFF) in the siba EROM parser.
- Reverted use of the resource's start address as the ChipCommon enum_addr in
  bhnd_read_chipid(). When called from bhndb, this address is found within the
  host address space, resulting in an invalid bridged enum_addr.
- Added support for falling back on standard bus_activate_resource() in
  bhnd_bus_generic_activate_resource(), enabling allocation of the bhnd_erom's
  bhnd_resource directly from a nexus-attached bhnd(4) device.
- Removed BHND_BUS_GET_CORE_TABLE(); it has been replaced by the erom API.
- Added support for statically initializing bhnd_erom instances, for use prior
  to malloc availability. The statically allocated buffer size is verified both
  at runtime, and via a compile-time assertion (see BHND_EROM_STATIC_BYTES).
- bhnd_erom classes are registered within a module via a linker set, allowing
  mips/broadcom to probe available EROM parser instances without creating a
  strong reference to bcma/siba-specific symbols.
- Migrated mips/broadcom to bhnd_erom_if, replacing the previous MIPS-specific
  device enumeration implementation.

Approved by:	adrian (mentor)
Differential Revision:	https://reviews.freebsd.org/D7748
2016-09-03 23:57:17 +00:00
Dimitry Andric
2db7b9f259 With clang 3.9.0, compiling cxgb results in the following warning:
sys/dev/cxgb/cxgb_sge.c:2873:44: error: implicit conversion from 'int'
to 'char' changes value from 128 to -128 [-Werror,-Wconstant-conversion]
                        *mtod(m, char *) = CPL_ASYNC_NOTIF;
                                         ~ ^~~~~~~~~~~~~~~

This is because CPL_ASYNC_NOTIF is 0x80, so the plain char argument is
wrapped to a negative value.  Fix this by using uint8_t instead.

Reviewed by:	np
MFC after:	3 days
Differential Revision: https://reviews.freebsd.org/D7772
2016-09-03 19:01:11 +00:00
Navdeep Parhar
5a63431265 Use correct CTR<n> variant. 2016-09-03 18:54:26 +00:00
Dimitry Andric
3128fa9a5a With clang 3.9.0, compiling ppbus(4) results in the following warnings:
sys/dev/ppbus/ppb_1284.c:296:46: error: implicit conversion from 'int'
to 'char' changes value from 144 to -112 [-Werror,-Wconstant-conversion]
        if ((error = do_peripheral_wait(bus, SELECT | nBUSY, 0))) {
                     ~~~~~~~~~~~~~~~~~~      ~~~~~~~^~~~~~~
sys/dev/ppbus/ppb_1284.c:785:48: error: implicit conversion from 'int'
to 'char' changes value from 240 to -16 [-Werror,-Wconstant-conversion]
                if (do_1284_wait(bus, nACK | SELECT | PERROR | nBUSY,
                    ~~~~~~~~~~~~      ~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~
sys/dev/ppbus/ppb_1284.c:786:29: error: implicit conversion from 'int'
to 'char' changes value from 240 to -16 [-Werror,-Wconstant-conversion]
                                        nACK | SELECT | PERROR | nBUSY)) {
                                        ~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~

This is because nBUSY is 0x80, so the plain char argument is wrapped to
a negative value.  Fix this in a minimal fashion, by using uint8_t in a
few places.

Reviewed by:	emaste
MFC after:	3 days
Differential Revision: https://reviews.freebsd.org/D7771
2016-09-03 13:48:44 +00:00
Dimitry Andric
402e32a8af Define drmP.h's __OS_HAS_AGP and __OS_HAS_MTRR macros in a defined and
portable way.

Reviewed by:	dumbbell
MFC after:	3 days
Differential Revision: https://reviews.freebsd.org/D7770
2016-09-03 13:33:28 +00:00
Sepherosa Ziehau
225c6e916e hyperv/ic: Cleanup timesync channel callback.
MFC after:	1 week
Sponsored by:	Microsoft
Differential Revision:	https://reviews.freebsd.org/D7745
2016-09-02 06:23:28 +00:00
Sepherosa Ziehau
1feb13270d hyperv/ic: Cleanup shutdown channel callback.
MFC after:	1 week
Sponsored by:	Microsoft
Differential Revision:	https://reviews.freebsd.org/D7744
2016-09-02 06:15:30 +00:00
Sepherosa Ziehau
9c040f41df hyperv/ic: Minor style fix.
MFC after:	1 week
Sponsored by:	Microsoft
Differential Revision:	https://reviews.freebsd.org/D7743
2016-09-02 06:08:08 +00:00
Sepherosa Ziehau
2a469fff98 hyperv/hn: Use the per-packet-info types defined by net/rndis.h
MFC after:	1 week
Sponsored by:	Microsoft
Differential Revision:	https://reviews.freebsd.org/D7737
2016-09-02 05:30:38 +00:00
Sepherosa Ziehau
4e835450fd hyperv/hn: Simplify RX hash related bits.
MFC after:	1 week
Sponsored by:	Microsoft
Differential Revision:	https://reviews.freebsd.org/D7736
2016-09-02 03:19:55 +00:00
Sepherosa Ziehau
a191051577 hyperv/hn: Rework RXCSUM related bits
MFC after:	1 week
Sponsored by:	Microsoft
Differential Revision:	https://reviews.freebsd.org/D7735
2016-09-02 03:10:30 +00:00
Navdeep Parhar
af4251f3a1 cxgbe/cxgbei: Provide a knob to set the DDP threshold for iSCSI
transfers.

The Initiator and Target both perform zero copy receive for transfers
greater than or equal to this threshold.

Sponsored by:	Chelsio Communications
2016-09-02 00:21:24 +00:00
Navdeep Parhar
22536e1556 cxgbe/cxgbei: Count various events related to iSCSI operation and make
these counters available in the sysctl MIB.

Sponsored by:	Chelsio Communications
2016-09-01 23:58:36 +00:00
Conrad Meyer
985efa77cc ioat(4): Despam relatively common hardware reset messages
Reported by:	ngie@
2016-09-01 23:56:02 +00:00
Navdeep Parhar
fec7f83342 cxgbe/cxgbei: Minor changes in the iSCSI CPL handlers.
- Use m_copydata instead of bcopy.
- Add new assertions.
- Log some more information.

Sponsored by:	Chelsio Communications
2016-09-01 22:40:55 +00:00
Navdeep Parhar
7cba15b16e cxgbe/cxgbei: Retire all DDP related code from cxgbei and switch to
routines available in t4_tom to manage the iSCSI DDP page pod region.

This adds the ability to use multiple DDP page sizes to the iSCSI
driver, among other improvements.

Sponsored by:	Chelsio Communications
2016-09-01 20:43:01 +00:00
Bruce Evans
90adad104b The log message for the previous commit didn't mention the most the
important detail that sc_cngetc() now opens and closes the keyboard
on every call again.  This was moved from sc_cngetc() to scn_cngrab/
ungrab() in r228644, but the change wasn't quite complete.  After
fixes for nesting in kbdd_poll() in ukbd and kbdmux, these opens
and closes should have no significant effect if done while grabbed.
They fix unusual cases when cngetc() is called while not grabbed.

This commit is the main fix for screen locking in sc_cnputc():
detect deadlock or likely-deadlock and handle it by buffering the
output atomically and printing it later if the deadlock condition
clears (and sc_cnputc() is called).

The most common deadlock is when the screen lock is held by ourself.
Then it would be safe to acquire the lock recursively if the console
driver is calling printf() in a safe context, but we don't know when
that is.  It is not safe to ignore the lock even in kdb or panic mode.
But ignore it in panic mode.  The only other known case of deadlock
is when another thread holds the lock but is running on a stopped CPU.
Detect that case approximately by using trylock and retrying for 1000
usec.  On a 4 GHz CPU, 100 usec is almost long enough -- screen switches
take slightly longer than that.  Not retrying at all is good enough
except for stress tests, and planned future versions will extend the
timeout so that the stress tests work better.

To see the behaviour when deadlock is detected, single step through
sctty_outwakeup() (or sc_puts() to start with deadlock).  Another
(serial) console is needed to the buffered-only output, but the
keyboard works in this context to continue or step out of the
deadlocked region.  The buffer is not large enough to hold all the
output for this.
2016-09-01 19:18:26 +00:00
Michael Zhilin
d5f271dde9 [BHND/PMU] Correct shift of bits in BHND_PMU_SET_BITS macro
The purpose of BHND_PMU_{GET,SET}_BITS macro is to transform values from/into
register format. SET macro shifts value to left and applies filter mask.
GET macro applies filter mask and then shifts value to right.

Reviewed by:    landonf, adrian (mentor)
Approved by:    adrian (mentor)
Differential Revision: https://reviews.freebsd.org/D7721
2016-09-01 13:38:46 +00:00
Sepherosa Ziehau
b34d3ad6cc hyperv/hn: Fix VLAN tag construction.
MFC after:	1 week
Sponsored by:	Microsoft
Differential Revision:	https://reviews.freebsd.org/D7716
2016-09-01 07:04:47 +00:00
Sepherosa Ziehau
fc4a9fc4c0 hyperv/hn: Stringent per-packet-info verification.
While I'm here, minor style changes.

MFC after:	1 week
Sponsored by:	Microsoft
Differential Revision:	https://reviews.freebsd.org/D7709
2016-09-01 06:05:08 +00:00
Sepherosa Ziehau
2c2e52605f hyperv/hn: Remove unused function
MFC after:	1 week
Sponsored by:	Microsoft
Differential Revision:	https://reviews.freebsd.org/D7706
2016-09-01 05:29:58 +00:00
Eric Joyner
ff9b61ca07 Fix linker warnings (errors on gcc) that resulted from r304510.
The variables that are extern in the netmap header file should be
defined in ixl_txrx.c (the file that is included in both ixl(4)/ixlv(4),
not in the main driver source files.

Reported by:	ed@, dim@, ngie@
2016-09-01 01:08:18 +00:00
Navdeep Parhar
a9feb2cdbb cxgbe/t4_tom: Two new routines to allocate and write page pods for a
buffer in the kernel's address space.
2016-09-01 00:51:59 +00:00
Navdeep Parhar
968267fdb8 cxgbe/t4_tom: Add general purpose routines to deal with page pod regions
and allocations within them.  Switch to these routines to manage the TOE
DDP region.

Sponsored by:	Chelsio Communications
2016-08-31 23:23:46 +00:00
Bruce Evans
a95582c6fd Add some locking to sc_cngetc().
Keyboard input needs Giant locking, and that is not possible to do
correctly here.  Use mtx_trylock() and proceed unlocked as before if
we can't acquire Giant (non-recursively), except in kdb mode don't
even try to acquire Giant.  Everything here is a hack, but it often
works.  Even if mtx_trylock() succeeds, this might be a LOR.

Keyboard input also needs screen locking, to handle screen updates
and switches.  Add this, using the same simplistic screen locking
as for sc_cnputc().

Giant must be acquired before the screen lock, and the screen lock
must be dropped when calling the keyboard driver (else it would get a
harmless LOR if it tries to acquire Giant).  It was intended that sc
cn open/close hide the locking calls, and they do for i/o functions
functions except for this complication.

Non-console keyboard input is still only Giant-locked, with screen
locking in some called functions.  This is correct for the keyboard
parts only.

When Giant cannot be acquired properly, atkbd and kbdmux tend to race
and work (they assume that the caller acquired Giant properly and don't
try to acquire it again or check that it has been acquired, and the
races rarely matter), while ukbd tends to deadlock or panic (since it
does the opposite, and has other usb threads to deadlock with).

The keyboard (Giant) locking here does very little, but the screen
locking completes screen locking for console mode except for not
detecting or handling deadlock.
2016-08-31 11:10:39 +00:00
Sepherosa Ziehau
4bddf0c813 hyperv/timesync: Rework time adjustment policy
- By default, adjust time upon SYNC request.  It can be disabled
  through hw.hvtimesync.ignore_sync_req.  SYNC request will be
  sent by hypervisor the host is resumed, rebooted, etc.
- By default, adjust time upon SAMPLE request, if there is 100ms
  difference between VM time and hypervisor time.  This can be
  disabled through hw.hvtimesync.sample_drift.

And nuke the unnecessary task, since channel callback is running
in a Hyper-V taskqueue nowadays.

Submitted by:	YanZhe Chen <t-yachen microsoft com>
Discussed with:	Dexuan Cui <decui microsoft com>, Hongjiang Zhang <honzhan microsoft com>, sephe
MFC after:	1 week
Sponsored by:	Microsoft
Differential Revision:	https://reviews.freebsd.org/D7707
2016-08-31 06:00:20 +00:00
Sepherosa Ziehau
cf38cf1b7a hyperv/hn: Consolidate NVS transaction execution.
MFC after:	1 week
Sponsored by:	Microsoft
Differential Revision:	https://reviews.freebsd.org/D7704
2016-08-31 05:27:30 +00:00
Ed Maste
718d07c040 iscsi_initiator: make logout_req::reason unsigned char
Previously this reported an error from Clang 3.9.0: implict conversion
from 'int' to 'char' changes value from 128 to -128.

Discussed with:	dim, trasz
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D7699
2016-08-30 19:20:26 +00:00
Bruce Evans
cc43fd1ab5 Fix keyboard polling "on/off" to support recursion. vt depends on
this, and sc will soon depend on it again.

The on/off request is passed without modification to lower layers,
so the bug was smaller in this layer than in in lower layers (the
sequence on;on;off left polling off when it should be on, but the
sequence on;on;off;on;off...  doesn't allow the interrupt handler
to eat the input after an "off" that should't turn off polled mode,
provided lower layers don't have the bug, since this layer is virtual.

The bug was small in lower layers too.  Normally everything is Giant
locked for keyboards, and this locks out the interrupt handler in
on;on;off;on;off... sequences.  However, PR 211884 says that fixing
this bug in ukbd in r303765 apparently causes the eating-by-interrupt
behaviour that the fix is to prevent.

Discussed with: emax
2016-08-30 12:36:14 +00:00