Commit Graph

36192 Commits

Author SHA1 Message Date
Vincenzo Maffione
f79ba6d75b netmap: improvements to the netmap kloop (CSB mode)
Changelist:
    - Add the proper memory barriers in the kloop ring processing
      functions.
    - Fix memory barriers usage in the user helpers (nm_sync_kloop_appl_write,
      nm_sync_kloop_appl_read).
    - Fix nm_kr_txempty() helper to look at rhead rather than rcur. This
      is important since the kloop can read a value of rcur which is ahead
      of the value of rhead (see explanation in nm_sync_kloop_appl_write)
    - Remove obsolete ptnetmap_guest_write_kring_csb() and
      ptnet_guest_read_kring_csb(), and update if_ptnet(4) to use those.
    - Prepare in advance the arguments for netmap_sync_kloop_[tr]x_ring(),
      to make the kloop faster.
    - Provide kernel and user implementation for nm_ldld_barrier() and
      nm_ldst_barrier()

MFC after:	2 weeks
2019-01-23 14:51:36 +00:00
Vincenzo Maffione
8c9874f5b1 netmap: fix knote() argument to match the mutex state
The nm_os_selwakeup function needs to call knote() to wake up kqueue(9)
users. However, this function can be called from different code paths,
with different lock requirements.
This patch fixes the knote() call argument to match the relavant lock state.
Also, comments have been updated to reflect current code.

PR:	https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=219846
Reported by:	Aleksandr Fedorov <aleksandr.fedorov@itglobal.com>
Reviewed by:	markj
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D18876
2019-01-23 14:21:23 +00:00
Vladimir Kondratyev
20694769bd Add quirk to enable mic and headphones redirection on HP Spectre laptops.
Tested on HP AF006UR.

MFC after:	2 weeks
2019-01-22 22:39:46 +00:00
Andriy Voskoboinyk
264eeebe12 iwn(4): drop i_seq field initialization for A-MPDU frames.
It is done by net80211 since r319460.

MFC after:	24 days
X-MFC-With:	343094
2019-01-22 01:44:47 +00:00
Patrick Kelsey
8f82136aec onvert vmx(4) to being an iflib driver.
Also, expose IFLIB_MAX_RX_SEGS to iflib drivers and add
iflib_dma_alloc_align() to the iflib API.

Performance is generally better with the tunable/sysctl
dev.vmx.<index>.iflib.tx_abdicate=1.

Reviewed by:	shurd
MFC after:	1 week
Relnotes:	yes
Sponsored by:	RG Nets
Differential Revision:	https://reviews.freebsd.org/D18761
2019-01-22 01:11:17 +00:00
Navdeep Parhar
2a857082dc cxgbe(4): Allow negative values in hw.cxgbe.fw_install and take them to
mean that the driver should taste the firmware in the KLD and use that
firmware's version for all its fw_install checks.

The driver gets firmware version information from compiled-in values by
default and this change allows custom (or older/newer) firmware modules
to be used with the stock driver.

There is no change in default behavior.

MFC after:	1 week
Sponsored by:	Chelsio Communications
2019-01-21 18:42:16 +00:00
Mark Johnston
8f77f60f94 hwpmc: Plug memory disclosures from PMC_OP_{GETPMCINFO,GETCPUINFO}.
admbugs:	765
Reported by:	Vlad Tsyrklevich <vlad@tsyrklevich.net>
MFC after:	1 day
Security:	Kernel memory disclosure
Sponsored by:	The FreeBSD Foundation
2019-01-21 18:07:02 +00:00
Navdeep Parhar
8d5106760c cxgbe(4): Use a truncated firmware header for version checks. All the
version numbers are towards the begining of the header.

MFC after:	1 week
Sponsored by:	Chelsio Communications
2019-01-21 17:58:06 +00:00
Kyle Evans
afbc939b81 iwm(4): Fix possible null pointer indirection
Obtained from:	DragonFlyBSD (obtained from Haiku)
MFC after:	1 week
2019-01-21 01:45:35 +00:00
Andriy Voskoboinyk
c15f336dae urtw(4): add length checks in Rx path.
- Check if buffer can contain Rx descriptor before accessing it.
- Verify upper / lower bounds for frame length.
- Do not pass too short frames into ieee80211_find_rxnode().

While here:
- Move cleanup to the function end.
- Reuse IEEE80211_IS_DATA() macro.

MFC after:	1 week
2019-01-21 00:53:38 +00:00
Andriy Voskoboinyk
d4e1661a09 iwn(4): drop return code from iwn_*attach functions (they cannot fail)
While here, add missing trace 'end' marker in iwn5000_attach().

MFC after:	1 week
2019-01-21 00:09:54 +00:00
Andriy Voskoboinyk
fb10d4ee38 run(4): add more length checks in Rx path.
- Discard frames that are bigger than MCLBYTES (to prevent buffer overrun).
- Check buffer length before accessing its contents.
- Fix len <-> dmalen check - the last includes Rx Wireless information
structure size.
- Fix out-of-bounds read during Rx node search for ACK / CTS frames
(monitor mode only).

While here:
- Mark few suspicious places with comments.
- Move common cleanup to the function end.

MFC after:	1 week
2019-01-21 00:03:35 +00:00
Navdeep Parhar
6baf1e4803 cxgbe(4): Clear the reply-pending status of a hashfilter when the reply
indicates an error.  Also, do not remove it twice from the hf list in
this case.

Submitted by:	Krishnamraju Eraparaju @ Chelsio
MFC after:	1 week
Sponsored by:	Chelsio Communicatons
2019-01-20 23:30:16 +00:00
Oleksandr Tymoshenko
30cef2b7f9 Add KBD_BOOTPROTO quirk for Logitech G510s USB keyboard
PR:		232136
Submitted by:	dgilbert@eicat.ca
MFC after:	1 week
2019-01-20 20:29:26 +00:00
Toomas Soome
be9f17db85 ixgbe: this statement may fall through warnings with gcc
The recent gcc versions (7 and 8 at least) can check for switch case
statements for fall through (implicit-fallthrough). When fall through
is intentional, the default method for warning suppression is to place
comment /* FALLTHROUGH */ exactly before next case statement.

Differential Revision:	https://reviews.freebsd.org/D18577
2019-01-19 20:45:41 +00:00
Oleksandr Tymoshenko
b25765b4fa [aic7xxx] Use correct product name 29320LPE instead of non-existent 39320LPE
The PCI id belongs to Adaptec 29320LPE controller. The same fix also was
merged[1] to OpenBSD driver ~6 years ago.

[1] https://github.com/openbsd/src/commit/f997b5

PR:		172133
Submitted by:	henning.petersen@t-online.de
MFC after:	 1 week
2019-01-19 05:31:48 +00:00
Vladimir Kondratyev
5bff3b694f psm(4): detect Lenovo top-button clickpads
libinput has special handling for Lenovo ThinkPad *40 series, where it
treats clicks on the top button area as if they came from the TrackPoint:
https://wayland.freedesktop.org/libinput/doc/latest/t440-support.html

Detect these devices and set the corresponding evdev property.

Submitted by:		Greg V <greg@unrelenting.technology>
MFC after:		2 weeks
Differential Revision:	https://reviews.freebsd.org/D18676
2019-01-18 22:20:29 +00:00
Oleksandr Tymoshenko
03d9c6aa55 [usb] Add HID_IGNORE quirks for multiple UPS devices
Without HID_IGNORE quirk enabled these models appear in the system as a uhid
devices while NUT (Network UPS Tool) expects them to be ugen.

PR:		131521
Submitted by:	Naoyuki Tai <ntai@smartfruit.com>, John Bayly <john.bayly@tipstrade.net>
MFC after:	1 week
2019-01-18 21:00:54 +00:00
Konstantin Belousov
6465f3158a nvdimm: initialize SPA uuids statically.
The SPA ids are published numbers, so it's safe (if not a bit
annoying) to copy them into a source file.

Submitted by:	D Scott Phillips <d.scott.phillips@intel.com>
Sponsored by:	Intel Corporation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D18733
2019-01-18 10:54:36 +00:00
Konstantin Belousov
fc4a961a3b nvdimm: add a driver for the NVDIMM root device
The NVDIMM root device is parent to the individual ACPI NVDIMM
devices.  Add a driver for the NVDIMM root device that can own
enumeration of NVDIMM devices as well as NVDIMM SPA ranges that the
system has.

Submitted by:	D Scott Phillips <d.scott.phillips@intel.com>
Sponsored by:	Intel Corporation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D18346
2019-01-18 10:45:27 +00:00
Conrad Meyer
236b57fe36 ioat(4): Set __result_use_check on ioat_acquire_reserve
Even M_WAITOK callers must check for failure.  For example, if the device is
quiescing, either due to automatic error-recovery induced reset, or due to
administrative detach, the routine will return ENXIO and the acquire
reference will not be held.  So, there is no mode in which it is safe to
assume the routine succeeds without checking.

Sponsored by:	Dell EMC Isilon
2019-01-17 23:21:02 +00:00
Oleksandr Tymoshenko
284a8f6f12 [usb] Add quirk for SmartG2 USB memory key
PR:		167001
Submitted by:	Daan Vreeken [PA4DAN] <Daan@vitsch.nl>
MFC after:	1 week
2019-01-16 22:29:34 +00:00
Andriy Voskoboinyk
0613dc6f15 iwn(4): (partially) rewrite A-MPDU Tx path
Generic Tx stats fixes:
- do not try to parse "aggregation status" for single frames; send them
to iwn_tx_done() instead;
- try to attach mbuf / node reference pair to reported BA events;
allows to fix reported status for ieee80211_tx_complete() and ifnet counters
(previously all A-MPDU frames were counted as failed - see PR 210211);
requires few more firmware bug workarounds;
- preserve short / long retry counters for wlan_amrr(4)
(disabled for now - causes significant performance degradation).
- Add new IWN_DEBUG_AMPDU debug category.
- Add one more check into iwn_tx_data() to prevent aggregation ring
overflow.
- Workaround 'seqno % 256' != 'current Tx slot' case (until D9195 is not
in the tree).
- Improve watchdog timer updates (previously watchdog check was omitted
when at least one frame was transmitted).
- Stop Tx when memory leak in currently used ring was detected (unlikely
to happen).
- Few other minor fixes.

Was previously tested with:
 - Intel 6205, STA mode (Tx aggregation behaves much better now).
 - Intel 4965AGN, STA mode (still unstable).

PR:		192641, 210211
Reviewed by:	adrian, dhw
MFC after:	1 month
Differential Revision:	https://reviews.freebsd.org/D10728
2019-01-16 12:33:06 +00:00
Andriy Voskoboinyk
8733962697 rtwn(4): clear 'basic' rate bit before calculating RTS/CTS rate.
Rate tables have this bit set to indicate minimal set of basic rates;
however, it overlappes with MCS bit, so rate2ridx() will treat them as
an 11n rate.

Due to the current rates setup the issue can be reproduced only
in 5GHz band with 11n / protection enabled.

Tested with RTL8821AU, HOSTAP mode.

MFC after:	5 days
2019-01-16 12:11:29 +00:00
Andriy Voskoboinyk
a461b7e5db rtwn_usb(4): add new USB id for RTL8821AU
Reported by:	Mike Tancsa <mike@sentex.net>
Tested by:	Mike Tancsa <mike@sentex.net>
MFC after:	3 days
2019-01-16 10:33:51 +00:00
Marcin Wojtas
4c220feb7e Suppress excessive error prints in ENA TX hotpath
In FreeBSD, this is normal situation that the Tx ring is being full. In
hat case, the packet is put back into drbr and the next attempt to send
it is taken after the cleanup.

Too much logs like this can cause system instability and even cause the
device reset (because keep alive or cleanup could be missed).

To fix that, the log level of this message is changed to debug.

Upon this change upgrade the driver version to v0.8.2.

Submitted by: Michal Krawczyk <mk@semihalf.com>
Obtained from: Semihalf
Sponsored by: Amazon, Inc.
2019-01-16 02:13:21 +00:00
Bjoern A. Zeeb
b20d0a438e With the sync from Dragonfly BSD in r318216 a bug slipped in (also still present
upstream it seems).

The tlv variable was changed to a pointer but the advancement of the data pointer
was left as sizeof(tlv).  While the sizeof the (now) pointer equals the
sizeof 2 x uint32_t (size of the struct) on 64bit platforms, on 32bit platforms
the size of the advancement of the data pointer was wrong leading to
firmware load issues.

Correctly advance the data pointer by the size of the structure and not by
the size of a pointer.

PR:		219683
Submitted by:	waddlesplash gamil.com (Haiku) on irc
MFC after:	1 week
2019-01-15 22:31:54 +00:00
Oleksandr Tymoshenko
89ec2f414c [drm] Fix off-by-one error when accessing driver-specific ioctl handlers array
PR:		231513
Submitted by:	Young_X <YangX92@hotmail.com>
Approved by:	imp
MFC after:	1 week
2019-01-15 21:06:58 +00:00
John Baldwin
475d54fac3 Reject new sessions if the necessary queues aren't initialized.
ccr reuses the control queue and first rx queue from the first port on
each adapter.  The driver cannot send requests until those queues are
initialized.  Refuse to create sessions for now if the queues aren't
ready.  This is a workaround until cxgbe allocates one or more
dedicated queues for ccr.

PR:		233851
MFC after:	1 week
Sponsored by:	Chelsio Communications
Differential Revision:	https://reviews.freebsd.org/D18478
2019-01-15 18:53:45 +00:00
Gleb Smirnoff
756a541279 Allocate pager bufs from UMA instead of 80-ish mutex protected linked list.
o In vm_pager_bufferinit() create pbuf_zone and start accounting on how many
  pbufs are we going to have set.
  In various subsystems that are going to utilize pbufs create private zones
  via call to pbuf_zsecond_create(). The latter calls uma_zsecond_create(),
  and sets a limit on created zone. After startup preallocate pbufs according
  to requirements of all pbuf zones.

  Subsystems that used to have a private limit with old allocator now have
  private pbuf zones: md(4), fusefs, NFS client, smbfs, VFS cluster, FFS,
  swap, vnode pager.

  The following subsystems use shared pbuf zone: cam(4), nvme(4), physio(9),
  aio(4). They should have their private limits, but changing that is out of
  scope of this commit.

o Fetch tunable value of kern.nswbuf from init_param2() and while here move
  NSWBUF_MIN to opt_param.h and eliminate opt_swap.h, that was holding only
  this option.
  Default values aren't touched by this commit, but they probably should be
  reviewed wrt to modern hardware.

This change removes a tight bottleneck from sendfile(2) operation, that
uses pbufs in vnode pager. Other pagers also would benefit from faster
allocation.

Together with:	gallatin
Tested by:	pho
2019-01-15 01:02:16 +00:00
Oleksandr Tymoshenko
7c895edb66 [led] propagate error from set_led() to the caller
Do not lose error condition by always returning 0 from set_led.
None of the calls to set_led checks for return value at the moment so
none of API consumers in base is affected.

PR:		231567
Submitted by:	Bertrand Petit <bsdpr@phoe.frmug.org>
MFC after:	1 week
2019-01-15 00:52:41 +00:00
Conrad Meyer
e49ec46114 amdtemp(4): Add support for Family 15h, Model >=60h
Family 15h is a bit of an oddball.  Early models used the same temperature
register and spec (mostly[1]) as earlier CPU families.

Model 60h-6Fh and 70-7Fh use something more like Family 17h's Service
Management Network, communicating with it in a similar fashion.  To support
them, add support for their version of SMU indirection to amdsmn(4) and use
it in amdtemp(4) on these models.

While here, clarify some of the deviceid macros in amdtemp(4) that were
added with arbitrary, incorrect family numbers, and remove ones that were
not used.  Additionally, clarify intent and condition of heterogenous
multi-socket system detection.

[1]: 15h adds the "adjust range by -49°C if a certain condition is met,"
which previous families did not have.

Reported by:	D. C. <tjoard AT gmail.com>
PR:		234657
Tested by:	D. C. <tjoard AT gmail.com>
2019-01-12 22:36:33 +00:00
Hans Petter Selasky
f4dbf0d82d snd_uaudio: Add quirks for Edirol UA-25EX in advanced driver mode.
Extend the vendor class USB audio quirk to cover devices without
the USB audio control descriptor.

PR:			234794
MFC after:		1 week
Sponsored by:		Mellanox Technologies
2019-01-12 11:14:59 +00:00
Navdeep Parhar
1dca7005b1 cxgbe(4): Move some INTx specific code to a more appropriate place. 2019-01-12 04:44:25 +00:00
Ram Kishore Vegesna
b9732f789d Remove accessing remote node and domain objects while processing cam actions.
Issue:
  ocs_fc(4) driver panics. It's induced by setting the port_state
sysctl to offline, then online, then offline, then online, and so
forth and so on in rapid succession.

Reason:
  While we set the port_state to online fc discovery will start and OS
is enumerating the target discs by calling ocs_action(),  then set the
port state to "offline" which deletes domain/sport/nodes.

  In ocs_action()->XPT_GET_TRAN_SETTINGS we are accessing the remote
node which can be invalid to get the wwpn, wwnn and port.

Fix:
  Removed accessing of remote node and domain in some ocs_action() cases.
  Populated the required values from ocs_fcport.
  This removes the dependency of node and domain structures while
processing XPT_PATH_INQ and XPT_GET_TRAN_SETTINGS.
   We will invalidate the target entries after the device lost
timeout(30 seconds).

Approved by: ken, mav
MFC after: 3 weeks
2019-01-11 15:59:24 +00:00
Andriy Voskoboinyk
fdc9504f51 rtwn_usb(4): add IQ calibration support for RTL8192CU
The code is similar to the one for RTL8188E* and probably
should be shared with RTL8188CE (needs to be tested).

Checked with RTL8188CUS, STA mode.

MFC after:	5 days
2019-01-10 05:49:47 +00:00
Mark Johnston
c540c6d92c Complete the removal of obsolete ioctl handlers.
PR:		234706
Reviewed by:	imp
MFC after:	3 days
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D18778
2019-01-09 17:23:08 +00:00
Warner Losh
d60f35d973 Add quirk for 128MB Creative Nomad.
PR: 78984
Submitted by: Mark Kirkwood
2019-01-09 06:21:49 +00:00
Gleb Smirnoff
a68cc38879 Mechanical cleanup of epoch(9) usage in network stack.
- Remove macros that covertly create epoch_tracker on thread stack. Such
  macros a quite unsafe, e.g. will produce a buggy code if same macro is
  used in embedded scopes. Explicitly declare epoch_tracker always.

- Unmask interface list IFNET_RLOCK_NOSLEEP(), interface address list
  IF_ADDR_RLOCK() and interface AF specific data IF_AFDATA_RLOCK() read
  locking macros to what they actually are - the net_epoch.
  Keeping them as is is very misleading. They all are named FOO_RLOCK(),
  while they no longer have lock semantics. Now they allow recursion and
  what's more important they now no longer guarantee protection against
  their companion WLOCK macros.
  Note: INP_HASH_RLOCK() has same problems, but not touched by this commit.

This is non functional mechanical change. The only functionally changed
functions are ni6_addrs() and ni6_store_addrs(), where we no longer enter
epoch recursively.

Discussed with:	jtl, gallatin
2019-01-09 01:11:19 +00:00
Chuck Tuffli
5312bd8eb0 Add NVMe drive to NOIOB quirk list
Dell-branded Intel P4600 NVMe drives benefit from NVMe 1.3's NOIOB
feature. Unfortunately just like Intel DC P4500s, they don't advertise
themselves as benefiting from this...

This changes adds P4600s to the existing list of old drives which
benefit from striping.

PR:		233969
Submitted by:	David Fugate <dave.fugate@gmail.com>
Reviewed by:	imp, mav
Approved by:	imp (mentor)
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D18772
2019-01-08 15:30:56 +00:00
Xin LI
e0dd0fe31e Added support for the SIOCGI2C ioctl.
Submitted by:	Ram Kishore Vegesna <ram.vegesna@broadcom.com>
Obtained from:	Broadcom
MFC after:	2 weeks
2019-01-08 05:41:04 +00:00
Warner Losh
a7db1b744a Fix a race between setting up the interrupt handler and it firing by
setting the data prior to setting up the interrupt. Now we only set
the cookie afterwards, and that (a) cannot be helpd and (b) isn't used
in the ISR.

PR: 147127
Submitted by: hps@
2019-01-07 06:19:51 +00:00
Warner Losh
7afbd60504 Fix TI PCI1520 PCI Cardbus bridge, but others affected.
On system with Celeron 1.5GHz CPU, sometimes when a PCMCIA to Compact Flash
adapter containing a Compact Flash card is inserted in the cardbus slot the
system hangs. This problem has not been observed in systems with a 2.8GHz
XEON CPU or faster.

Analysis of the cbb driver shows functional interrupts are routed to PCI
BEFORE the interrupt handler for functional interrupts has been registered.

Fix applied as described in the bug.

PR: 128040
Submitted by: Arthur Hartwig
2019-01-07 05:59:58 +00:00
Konstantin Belousov
d91cc9dd63 Fix use of busdma(9) KPI in ahci(4).
Use BUS_DMA_NOWAIT for loads at initialization time.
Report actual numeric error code if any problem occurs at the
initialization.

Reported and tested by:	pho
Reviewed by:	mav
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D18741
2019-01-07 02:39:40 +00:00
David Bright
9f0bfc517c asmc: Add support for Mac mini 4,1 (Mid-2010)
MFC after:	1 week
2019-01-06 23:43:12 +00:00
Mark Johnston
cb56711d68 Add a bounds check to the tws(4) passthrough ioctl handler.
tws_passthru() was doing a copyin of a user-specified request
without validating its length, so a malicious request could overrun
the buffer.  By default, the tws(4) device file is only accessible
as root.

admbug:		825
Reported by:	Anonymous of the Shellphish Grill Team
Reviewed by:	delphij
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D18536
2019-01-05 15:28:20 +00:00
Hans Petter Selasky
4604b6a18d Reduce timeout for reading the USB HUB port status to 1000ms and try to filter
out dead USB HUB devices by implementing an error counter, so that the USB
enumeration thread does not spend all its time reading from non-responding
devices, blocking user-space access in the end.

Tested by:	Matthias Apitz <guru@unixarea.de>
MFC after:	1 week
Sponsored by:	Mellanox Technologies
2019-01-04 21:09:38 +00:00
David Bright
98ae4866ba asmc: Patch to add MacBook Pro 9,2 support
PR:		211513
Submitted by:	William Theesfeld Jr <wtheesfeld@mailbox.org>
Reported by:	William Theesfeld Jr <wtheesfeld@mailbox.org>
MFC after:	1 week
2019-01-04 18:21:49 +00:00
Andriy Voskoboinyk
48f21a05da rtwn_pci(4): sync r88ee_power_on() with OpenBSD
Tested with RTL8188EE, STA mode

Submitted by:	Farhan Khan <khanzf@gmail.com>
MFC after:	3 days
Differential Revision:	https://reviews.freebsd.org/D18727
2019-01-04 04:26:39 +00:00
Navdeep Parhar
1a35ae9353 cxgbe(4): Clear FW_OK if the firmware reports an error.
Sponsored by:	Chelsio Communications
2019-01-04 04:15:17 +00:00
Hans Petter Selasky
fdb955f51f Improve USB generic debug messages. Print process ID and name when opening
and closing usb/ugenX.Y character device nodes.

MFC after:	1 week
Sponsored by:	Mellanox Technologies
2019-01-03 14:27:51 +00:00
Andriy Voskoboinyk
920dfe026c rtwn_usb(4): add USB id for TP-LINK TL-WN821N v5.
It is already mentioned in manpage, but was missing from the driver.

MFC after:	4 days
2019-01-02 18:35:40 +00:00
Andriy Voskoboinyk
0fe1808c72 rtwn_pci(4): fix panic with INVARIANTS (due to inverted assertion logic)
MFC after:	4 days
2019-01-02 17:13:55 +00:00
Andriy Voskoboinyk
b3f3786e5d rtwn_pci(4): add support for RTL8188EE chipset.
Initially based on https://reviews.freebsd.org/D15692;
later deduplicated and improved a bit (Tx reports, IQ calibration support).

Submitted by:	Farhan Khan <khanzf@gmail.com>
MFC after:	4 days
Relnotes:	yes
Differential Revision:	https://reviews.freebsd.org/D15692
2019-01-02 06:48:53 +00:00
Andriy Voskoboinyk
a163403b62 rtwn(4): rename set_name -> set_rom_opts method and reuse it for RTL8188E*
MFC after:	4 days
2019-01-02 06:03:19 +00:00
Andriy Voskoboinyk
0db82209dc rtwn(4): rename common RTL8188E* structures.
No functional change intended.

MFC after:	4 days
2019-01-02 05:43:33 +00:00
Andriy Voskoboinyk
44c68782f1 rtwn(4): do not try to start RTL8188E* MCU during device shutdown.
MFC after:	4 days
2019-01-02 05:37:30 +00:00
Andriy Voskoboinyk
4e4bcfcfb7 Move USB-specific parts from rtwn(4) to rtwn_usb(4)
MFC after:	4 days
2019-01-02 05:30:41 +00:00
Andriy Voskoboinyk
17d5fbf21b rtwn_pci(4): add support for event-based Tx reports.
It will be used for RTL8188EE (and, probably, others).

MFC after:	4 days
2019-01-02 05:21:06 +00:00
Andriy Voskoboinyk
b5a81dd4c5 rtwn_pci(4): use proper bus_dmamap_sync flags after Tx (sync with r342672)
MFC after:	4 days
2019-01-02 04:56:36 +00:00
Andriy Voskoboinyk
5be70ac877 rtwn(4): drop obsolete comment + use 'nop' function for 92eu calibration
RTL8192EU was not tested with previously added code.

MFC after:	4 days
2019-01-02 04:27:39 +00:00
Andriy Voskoboinyk
58d3c148fd rtwn(4): add IQ calibration support for RTL8188E*
Tested with:
 * RTL8188EE, STA mode.
 * RTL8188EU, STA mode.

MFC after:	4 days
2019-01-02 04:19:28 +00:00
Andriy Voskoboinyk
db70ff37a0 rtwn(4): provide register definitions for RTL8188CE calibration routines.
No functional change intended.

MFC after:	4 days
2019-01-02 04:08:37 +00:00
Andriy Voskoboinyk
387c3f1495 rtwn_pci: fix excessive packet loss on Tx with RTL8188EE.
Use proper flags for bus_dmamap_sync() in Tx path.

Tested with:	RTL8188EE, STA mode

MFC after:	4 days
2019-01-01 23:41:16 +00:00
Scott Long
808a5e94da Port over the SCSI sense handling fix from mpr(4) in r342528, and fix
whitespace to match.
2018-12-31 23:30:31 +00:00
Scott Long
e94a449387 Fix whitespace from r342528 2018-12-31 23:27:56 +00:00
Ian Lepore
1cc7e361a6 When allocating a new keyboard at vt_upgrade() time, unwind any cngrabs
done on the old keyboard and then do the corresponding number of grabs
on the new keyboard.

This fixes a race that can leave the system with a non-functioning
keyboard.  It goes like this...

 - The bios claims there is an AT keyboard, atkbd attaches.
 - SI_SUB_INT_CONFIG_HOOKS runs.
 - USB probes devices. Devices begin attaching, including disks.
 - GELI prompts for a password for a just-attached disk, which results
   in a cngrab() while atkbd is the keyboard.
 - A USB keyboard attaches.
 - vt_upgrade() runs and switches the keyboard to the new USB keyboard,
   but because cngrab was never called for it, it's not activated and
   keystrokes are ignored.
 - Now there is no functional keyboard and no way to get one; even
   plugging in a different USB keyboard doesn't help, because the console
   is still grabbed, still waiting for a GELI pw.

Discussed with:	     ray@
2018-12-31 01:09:23 +00:00
Marius Strobl
ab00a509ee o Don't allocate resources for SDMA in sdhci(4) if the controller or the
front-end doesn't support SDMA or the latter implements a platform-
  specific transfer method instead. While at it, factor out allocation
  and freeing of SDMA resources to sdhci_dma_{alloc,free}() in order to
  keep the code more readable when adding support for ADMA variants.

o Base the size of the SDMA bounce buffer on MAXPHYS up to the maximum
  of 512 KiB instead of using a fixed 4-KiB-buffer. With the default
  MAXPHYS of 128 KiB and depending on the controller and medium, this
  reduces the number of SDHCI interrupts by a factor of ~16 to ~32 on
  sequential reads while an increase of throughput of up to ~84 % was
  seen.

  Front-ends for broken controllers that only support an SDMA buffer
  boundary of a specific size may set SDHCI_QUIRK_BROKEN_SDMA_BOUNDARY
  and supply a size via struct sdhci_slot. According to Linux, only
  Qualcomm MSM-type SDHCI controllers are affected by this, though.

  Requested by: Shreyank Amartya (unconditional bump to 512 KiB)

o Introduce a SDHCI_DEPEND macro for specifying the dependency of the
  front-end modules on the sdhci(4) one and bump the module version
  of sdhci(4) to 2 via an also newly introduced SDHCI_VERSION in order
  to ensure that all components are in sync WRT struct sdhci_slot.

o In sdhci(4):
  - Make pointers const were applicable,
  - replace a few device_printf(9) calls with slot_printf() for
    consistency, and
  - sync some local functions with their prototypes WRT static.
2018-12-30 23:08:06 +00:00
Navdeep Parhar
450ffb7cb2 cxgbe(4): Attach to two T540 variants.
MFC after:	1 week
2018-12-30 01:57:11 +00:00
Alexander Motin
4968e1a2e6 Fix incorrectly inserted copyright in r342557.
Reported by:	rgrimes
MFC after:	1 month
2018-12-27 22:44:07 +00:00
Alexander Motin
4d07b68988 Reimplement nvd(4) detach handling.
Previous code typically crashed in case of NVMe device unplug or even clean
detach while some I/Os are still in flight.  To fix this the new code calls
disk_gone() and waits for confirmation of all references gone before calling
disk_destroy(), freeing other resources and allowing controller detach.

While there, fix disk lists locking and reimplement unit numbers assignment.

MFC after:	1 month
Sponsored by:	iXsystems, Inc.
2018-12-27 18:28:19 +00:00
Hans Petter Selasky
218ae8fd6c Add USB quirk for SPL Crimson Rev 1.
PR:			234380
MFC after:		1 week
Sponsored by:		Mellanox Technologies
2018-12-27 08:29:05 +00:00
Alexander Motin
a646135771 Add descriptions to NVMe interrupts.
MFC after:	1 month
2018-12-26 23:41:52 +00:00
Kashyap D Desai
8c58ee6f5b Driver version upgrade.
Submitted by: Sumit Saxena <sumit.saxena@broadcom.com>
Reviewed by:  Kashyap Desai <Kashyap.Desai@broadcom.com>
Approved by:  ken
MFC after:  3 days
Sponsored by:   Broadcom Inc
2018-12-26 10:48:39 +00:00
Kashyap D Desai
e315cf4dc4 Problem statement:
Due to hardware errata in Aero controllers, reads to certain
fusion registers could intermittently return all zeroes.
This behavior is transient in nature and subsequent reads will return
valid value.

Fix:
For Aero controllers, any read will retry the read operations
from certain registers for maximum three times, if read returns zero.

Submitted by: Sumit Saxena <sumit.saxena@broadcom.com>
Reviewed by:  Kashyap Desai <Kashyap.Desai@broadcom.com>
Approved by:  ken
MFC after:  3 days
Sponsored by:   Broadcom Inc
2018-12-26 10:47:52 +00:00
Kashyap D Desai
b518670c21 This patch will add support for 32 bit atomic request descriptor for Aero adapters.
For Aero adapters-
1. Driver will use 32 bit atomic descriptor to fire IOs and DCMDs.
2. Driver will use 64 bit request descriptor to fire IOC INIT.
3. If Aero firmware supports 32 bit atomic descriptor, then only driver will use it
otherwise driver will use 64 bit request descriptor.

For rest of adapters(Ventura, Invader and Thunderbolt), driver will use 64 bit request
descriptors only.

Submitted by: Sumit Saxena <sumit.saxena@broadcom.com>
Reviewed by:  Kashyap Desai <Kashyap.Desai@broadcom.com>
Approved by:  ken
MFC after:  3 days
Sponsored by:   Broadcom Inc
2018-12-26 10:47:08 +00:00
Kashyap D Desai
2909aab4cf This patch will add support for latest generation MegaRAID adapters- Aero(39xx).
Driver will throw a warning message when a Configurable secure type controller is
encountered.

Submitted by: Sumit Saxena <sumit.saxena@broadcom.com>
Reviewed by:  Kashyap Desai <Kashyap.Desai@broadcom.com>
Approved by:  ken
MFC after:  3 days
Sponsored by:   Broadcom Inc
2018-12-26 10:46:23 +00:00
Kashyap D Desai
1f4800625f Update mpr driver version to v23.00.00.00-fbsd
Submitted by: Sreekanth Reddy <sreekanth.reddy@broadcom.com>
Reviewed by:  Kashyap Desai <Kashyap.Desai@broadcom.com>
Approved by:  ken
MFC after:  3 days
Sponsored by:   Broadcom Inc
2018-12-26 10:44:30 +00:00
Kashyap D Desai
46b23587c2 Update copyright information
Submitted by: Sreekanth Reddy <sreekanth.reddy@broadcom.com>
Reviewed by:  Kashyap Desai <Kashyap.Desai@broadcom.com>
Approved by:  ken
MFC after:  3 days
Sponsored by:   Broadcom Inc
2018-12-26 10:43:31 +00:00
Kashyap D Desai
34213bec59 On Aero/Sea A0 cards retry MPT Fusion registers reads for max three times
Due to HW Errta on Aero/Sea A0 chipset on secure boot mode & on heavy IO load,
sometimes read operation on MPT Fusion registers will give zero value,
So, as a workaround driver will retry the MPT Fusion register
read operation for max three times upon reading zero value form these
registers.

Submitted by: Sreekanth Reddy <sreekanth.reddy@broadcom.com>
Reviewed by:  Kashyap Desai <Kashyap.Desai@broadcom.com>
Approved by:  ken
MFC after:  3 days
Sponsored by:   Broadcom Inc
2018-12-26 10:42:45 +00:00
Kashyap D Desai
34c5490d26 Enable atomic type descriptor support only for Sea & Aero cards
Enable atomic type descriptor support only for Sea & Aero cards,
due to HW errata this atomic descriptor support has to be disabled
on Ventura cards.

Submitted by: Sreekanth Reddy <sreekanth.reddy@broadcom.com>
Reviewed by:  Kashyap Desai <Kashyap.Desai@broadcom.com>
Approved by:  ken
MFC after:  3 days
Sponsored by:   Broadcom Inc
2018-12-26 10:41:53 +00:00
Kashyap D Desai
f36649b71c Add Sea,Aero adapter support
Added deviceID's for Sea,Aero to mpr Driver
Aero:
        0x00E0 Invalid
        0x00E1 Configurable Secure
        0x00E2 Hard Secure
        0x00E3 Tampered
Sea:
        0x00E4 Invalid
        0x00E5 Configurable Secure
        0x00E6 Hard Secure
        0x00E7 Tampered

For Tampered & Invalid type cards, driver will claim the device & quit the probe function with below error message,
"HBA is in Non Secure mode"

for Configurable Secure type cards, driver will display below message in .probe() callback function,
"HBA is in Configurable Secure mode"

Submitted by: Sreekanth Reddy <sreekanth.reddy@broadcom.com>
Reviewed by:  Kashyap Desai <Kashyap.Desai@broadcom.com>
Approved by:  ken
MFC after:  3 days
Sponsored by:   Broadcom Inc
2018-12-26 10:41:14 +00:00
Kashyap D Desai
89d1c21f45 Added support for NVMe Task Management
Following list of changes done in the driver as a part of TM handling on the NVMe drives.
Below changes are only applicable on NVMe drives and only when custom NVMe TM handling bit is set to zero by IOC.

1. Issue LUN reset & Target reset TMs with Target reset method field set to Protocol Level reset (0x3),
2. For LUN & target reset TMs use the timeout value as ControllerResetTO value provided by firmware using PCie Device Page 0,
3. If LUN reset fails to terminates the IO then directly escalate to host reset instead of going for target reset TM,
4. For Abort TM use the timeout value as NVMeAbortTO value given by the IOC using Manufacturing Page 11,
5. Log message "PCie Host Reset failed" message up on receiving P

Submitted by: Sreekanth Reddy <sreekanth.reddy@broadcom.com>
Reviewed by:  Kashyap Desai <Kashyap.Desai@broadcom.com>
Approved by:  ken
MFC after:  3 days
Sponsored by:   Broadcom Inc
2018-12-26 10:40:27 +00:00
Kashyap D Desai
23daf8f40b Copy back the Sense data at proper location expected by the application
typedef struct mps_pass_thru
{
               uint64_t               PtrRequest;
               uint64_t               PtrReply;
               uint64_t               PtrData;
               uint32_t               RequestSize;
               uint32_t               ReplySize;
               uint32_t               DataSize;
               uint32_t               DataDirection;
               uint64_t               PtrDataOut;
               uint32_t               DataOutSize;
               uint32_t               Timeout;
} mps_pass_thru_t, * ptrmpssas_pass_thru_t;

In the above mps_pass_thru structure; Application expects PrtReply buffer
should contain both MPI reply followed by sense data. So, updated driver
to copy sense data at PtrReply + sizeof(MPI2 reply) location where
application wants the driver to copy back the sense data info.

Submitted by: Sreekanth Reddy <sreekanth.reddy@broadcom.com>
Reviewed by:  Kashyap Desai <Kashyap.Desai@broadcom.com>
Approved by:  ken
MFC after:  3 days
Sponsored by:   Broadcom Inc
2018-12-26 10:39:22 +00:00
Kashyap D Desai
8736c018d2 Update MPI header files version to 2.00.52 from 2.00.48
Submitted by: Sreekanth Reddy <sreekanth.reddy@broadcom.com>
Reviewed by:  Kashyap Desai <Kashyap.Desai@broadcom.com>
Approved by:  ken
MFC after:  3 days
Sponsored by:   Broadcom Inc
2018-12-26 10:38:12 +00:00
Hans Petter Selasky
a89c806508 Fix reading of USB sample rate descriptor for SPL Crimson Rev 1.
Read first one entry, then try to read the full rate descriptor table.

PR:			234380
MFC after:		1 week
Sponsored by:		Mellanox Technologies
2018-12-25 10:15:48 +00:00
Alexander Motin
511662d083 Remove CAM SIM lock from NVMe SIM.
CAM does not require SIM lock since FreeBSD 10.4, and NVMe code never
required it at all, using per-queue locks instead.  This formally allows
parallel request submission in CAM mode as much as single per-device and
per-queue locks of CAM allow.

MFC after:	1 month
2018-12-24 23:28:11 +00:00
Scott Long
46b9415ff9 Further refactoring for task management commands. Also fix a related
typo from the previous commit.
2018-12-24 06:14:32 +00:00
Scott Long
3921a9f75c Commands for user-initated device resets should come from the high-priority
allocator.  Prior to this change, they would leak from the normal allocator.
2018-12-24 05:54:36 +00:00
Scott Long
b7f1ee7970 First step in refactoring and fixing the error recovery and task management
code in the mpr and mps drivers.  Eliminate duplicated code and fix some
comments.
2018-12-24 05:05:38 +00:00
Konstantin Belousov
cbbdd28318 nvdimm SPA geom: Update bio fields needed for devstat_end_transaction_bio().
Reported by:	bde
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
2018-12-23 19:14:31 +00:00
Bruce Evans
c907940bf9 Fix devstat on md devices, second attempt. r341765 depends on
g_io_deliver() finishing initialization of the bio, but g_io_deliver()
actually destroys the bio.  INVARIANTS makes the bug obvious by
overwriting the bio with garbage.

Restore the old order for calling devstat (except don't restore not calling
it for the error case), and translate to the devstat KPI so that this order
works.

Reviewed by:	kib
2018-12-22 22:59:11 +00:00
Vincenzo Maffione
58e185425a netmap: fix txsync check in netmap poll
To check if txsync can be skipped, it is necessary to look for
unseen TX space. However, this means comparing ring->cur
against ring->tail, rather than ring->head against ring->tail
(like nm_ring_empty() does).
This change also adds some more comments to explain the optimization
performed at the beginning of netmap_poll().

MFC after:	3 days
Sponsored by:	Sunny Valley Networks
2018-12-22 16:23:42 +00:00
Vincenzo Maffione
e1ed1fbdea netmap: fix bug in netmap_poll() optimization
The bug was introduced by r339639, although it is present in the upstream
netmap code since 2015. It is due to resetting the want_rx variable to
POLLIN, rather than resetting it to POLLIN|POLLRDNORM.
It only affects select(), which uses POLLRDNORM. poll() is not affected,
because it uses POLLIN.
Also, it only affects FreeBSD, because Linux skips the optimization
implemented by the piece of code where the bug occurs.

MFC after:	3 days
Sponsored by:	Sunny Valley Networks
2018-12-22 15:15:45 +00:00
Navdeep Parhar
6c5c0137a9 Remove unused macros from t4_tom.h. 2018-12-21 20:46:45 +00:00
Conrad Meyer
86312e466c mps(4), mpr(4): remove SATA ID command cancellation hack
Add a generic mechanism to override mp?_wait_command's timeout behavior,
which continues to invoke reinit by default.  Invokers who set
cm_timeout_handler may avoid automatic reinit and do their own handling.

Adapt mp?sas_get_sata_identify to this mechanism and remove its callout
hack.

Reviewed by:	scottl
Sponsored by:	Dell EMC Isilon
Differential Revision:	https://reviews.freebsd.org/D18614
2018-12-21 20:30:52 +00:00
Conrad Meyer
8277ce2b78 mps(4), mpr(4): Fix lifetime of command buffer for mp?sas_get_sata_identify
In the event that the ID command timed out, mps(4)/mpr(4) did not free the
command until it could be cancelled.  However, it freed the associated
buffer (cm_data).  Fix the lifetime issue by freeing the associated buffer
only after Abort Task or controller reset.

Reviewed by:	scottl
Sponsored by:	Dell EMC Isilon
Differential Revision:	https://reviews.freebsd.org/D18612
2018-12-21 20:29:16 +00:00
Vincenzo Maffione
77a2baf551 netmap: move buf_size validation code to its own function
This code validates the netmap buf_size against the interface MTU
and maximum descriptor size, to make sure the values are consistent.
Moving this functionality to its own function is needed because this
function is also called by Linux-specific code.

MFC after:	3 days
2018-12-21 11:50:14 +00:00
Vincenzo Maffione
c52382bd40 netmap: pipes: make sure both ends use the same number of slots 2018-12-21 11:32:55 +00:00
Bruce Evans
9e5ed8593f Use VOP_ADVISE() with POSIX_FADV_DONTNEED instead of IO_DIRECT to
implement not double-caching for reads from vnode-backed md devices.
Use VOP_ADVISE() similarly instead of !IO_DIRECT unsimilarly for writes.
Add a "cache" option to mdconfig to allow changing the default of not
caching.

This depends on a recent commit to fix VOP_ADVISE().  A previous version
had optimizations for sequential i/o's (merge the i/o's and only uncache
for discontiguous i/o's and for full blocks), but optimizations and
knowledge of block boundaries belong in VOP_ADVISE().  Read-ahead should
also be handled better, by supporting it in md and discarding it in
VOP_ADVISE().

POSIX_FADV_DONTNEED is ignored by zfs, but so is IO_DIRECT.

POSIX_FADV_DONTNEED works better than IO_DIRECT if it is not ignored,
since it only discards from the buffer cache immediately, while
IO_DIRECT also discards from the page cache immediately.

IO_DIRECT was not used for writes since it was claimed to be too slow,
but most of the slowness for writes is from doing them synchronously by
default.  Non-synchronous writes still deadlock in many cases.

IO_DIRECT only has a special implementation for ffs reads with DIRECTIO
configured.  Otherwise, if it is not ignored than it uses the buffer and
page caches normally except for discarding everything after each i/o,
and then it has much the same overheads as POSIX_FADV_DONTNEED.  The
overheads for reading with ffs and DIRECTIO were similar in tests of md.

Reviewed by:	kib
2018-12-21 08:15:31 +00:00
Navdeep Parhar
ad025209ba cxgbe/iw_cxgbe: Remove redundant CTRs from c4iw_alloc/c4iw_rdev_open.
This information is readily available elsewhere.

Sponsored by:	Chelsio Communications
2018-12-20 22:39:58 +00:00
Navdeep Parhar
6bb034658d cxgbe/iw_cxgbe: Do not terminate CTRx messages with \n. 2018-12-20 22:31:07 +00:00
Conrad Meyer
0c3bbec309 tpm(4): Fix GCC build after r342084 (TPM 2.0 driver commit)
Move static variable definition (cdevsw) to a more conventional location
(the C file it is used in), rather than a header.

This fixes the GCC warning, -Wunused-variable ("defined but not used") when
the tpm20.h header is included in files other than tpm20.c (e.g.,
tpm_tis.c).

X-MFC-with:	r342084
Sponsored by:	Dell EMC Isilon
2018-12-20 20:55:33 +00:00
Navdeep Parhar
9877f73541 cxgbe(4): Make sure the rx queues start off with the correct timestamp
settings on initialization.

Sponsored by:	Chelsio Communications
2018-12-20 20:34:21 +00:00
Warner Losh
9cd5259d97 Fix panic message when we can't create thread for one wire temperature
reading.
2018-12-20 05:46:56 +00:00
Navdeep Parhar
8953e80f5e cxgbe/iw_cxgbe: Use -ve errno when interfacing with linuxkpi/OFED.
Submitted by:	Krishnamraju Eraparaju @ Chelsio
Sponsored by:	Chelsio Communications
2018-12-20 01:35:45 +00:00
Marcin Wojtas
efa9b503c6 Fix obtaining RSP address in TPM CRB for non-amd64 platforms
On amd64 the RSP address can be read in single 8-byte transaction,
which is obviously not possible on 32-bit platforms. Fix that
by performing 2 4-byte read on them.

Obtained from: Semihalf
Sponsored by: Stormshield
2018-12-20 01:05:09 +00:00
Navdeep Parhar
b562884d63 cxgbe/iw_cxgbe: Add a knob for testing that lets iWARP connections cycle
through 4-tuples quickly.

Submitted by:	Krishnamraju Eraparaju @ Chelsio
Sponsored by:	Chelsio Communications
2018-12-20 01:00:21 +00:00
Navdeep Parhar
121684b714 cxgbe/iw_cxgbe: Use DSGLs to write to card's memory when appropriate.
Submitted by:	Krishnamraju Eraparaju @ Chelsio
Sponsored by:	Chelsio Communications
2018-12-19 23:29:01 +00:00
Navdeep Parhar
377328701d cxgbe(4): Do not issue mbox commands after t4_fw_bye.
Sponsored by:	Chelsio Communications
2018-12-19 19:21:29 +00:00
David Bright
39a8ee1351 asmc: Add support for MacPro1,1
PR:		203431
Submitted by:	jjr@alisa.org & holindho@saunalahti.fi
Reported by:	jjr@alisa.org
MFC after:	1 week
2018-12-19 16:45:37 +00:00
Mark Johnston
0e4a3d93ee Remove a use of a negative array index from fxp(4).
This fixes a warning seen when compiling amd64 GENERIC with clang 7.
Also remove the workaround added in r337324.  clang 7 and gcc 4.2
generate the same code with or without the code change.

Reviewed by:	imp (previous version)
MFC after:	3 days
Differential Revision:	https://reviews.freebsd.org/D18603
2018-12-19 04:54:32 +00:00
Navdeep Parhar
b156a400a6 cxgbe/t4_tom: fixes for issues on the passive open side.
- Fix PR 227760 by getting the TOE to respond to the SYN after the call
  to toe_syncache_add, not during it.  The kernel syncache code calls
  syncache_respond just before syncache_insert.  If the ACK to the
  syncache_respond is processed in another thread it may run before the
  syncache_insert and won't find the entry.  Note that this affects only
  t4_tom because it's the only driver trying to insert and expand
  syncache entries from different threads.

- Do not leak resources if an embryonic connection terminates at
  SYN_RCVD because of L2 lookup failures.

- Retire lctx->synq and associated code because there is never a need to
  walk the list of embryonic connections associated with a listener.
  The per-tid state is still called a synq entry in the driver even
  though the synq itself is now gone.

PR:		227760
MFC after:	2 weeks
Sponsored by:	Chelsio Communications
2018-12-19 01:37:00 +00:00
Gleb Smirnoff
32c4f3bb78 Use mbufq instead of ifqueue to queue mbufs. 2018-12-18 19:38:13 +00:00
Andriy Gapon
3e9ec69a35 ichwd: add a few assertions about tco_version
Those should ensure correctness of ichwd_find_ich_lpc_bridge() and
ichwd_find_ich_lpc_bridge() as well as make it easier for both humans
and static analyzers to see the relation between tco_version and ich and
smb variables in ichwd_identify().

Reported by:	Coverity
CID:		1396314, 1396317
MFC after:	10 days
2018-12-18 17:17:53 +00:00
Andriy Voskoboinyk
12df38ad62 iwi(4): do not leak node reference when IWI_FLAG_ASSOCIATED flag is set.
MFC after:	6 days
2018-12-18 05:08:56 +00:00
Mark Johnston
fd930cdbd0 Remove UMS support code from radeonkms.
The code is unreachable since the entries of radeon_ioctls[] are not
associated with any device: we provide only the KMS entry points.
Moreover, r600_cp_dispatch_texture() contains an integer overflow bug
that can be triggered from userspace.[1]

Reported by:	Anonymous of the Shellphish Grill Team[1]
Reviewed by:	dumbbell
MFC after:	2 weeks
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D18516
2018-12-17 21:48:20 +00:00
Mark Johnston
e710f8caf5 Catch up with r338948.
MFC with:	r342178
2018-12-17 21:34:09 +00:00
Andriy Gapon
9744b779a8 fix formatting and style in ig4iic_acpi_probe afetr r339754
This includes removing stray whitespace, adding a line after the
variable declaration block and removing a redundant check.

MFC after:	1 week
X-MFC with:	r339754
2018-12-17 21:33:25 +00:00
Mark Johnston
c491ffc3fb Revert r336326.
In testing on a Dell Latitude 7480, having ig4.ko loaded during a
suspend caused the system to hang.  It turns out that ig4iic_intr() was
being called after the device entered D3, and entered an infinite loop
because a read of the I2C status register returned all ones, causing us
to attempt to read a byte from the data buffer until one of the status
bits clears.  This occured because ig4iic_pci0 shares an interrupt with
the VGA device on this laptop, so ig4iic_intr() gets called even when
there is no work to do.  This is exactly the problem fixed by r342170,
which resolves the hang for me and allows suspend/resume to work with
ig4.ko loaded.  So, re-enable autoloading of ig4.ko in the hope that
r342170 resolves the problem universally.

Reviewed by:	gonzo
MFC after:	1 month (pending an MFC of r342170)
Differential Revision:	https://reviews.freebsd.org/D18587
2018-12-17 21:13:05 +00:00
David Bright
71b475e7dd asmc: Add support for mid-2011 Macmini 5,2
PR:		225911
Submitted by:	trev <fbsdbugs4@sentry.org>
Reported by:	trev <fbsdbugs4@sentry.org>
MFC after:	1 week
2018-12-17 17:21:45 +00:00
Andriy Gapon
82a5a27527 add support for marking interrupt handlers as suspended
The goal of this change is to fix a problem with PCI shared interrupts
during suspend and resume.

I have observed a couple of variations of the following scenario.
Devices A and B are on the same PCI bus and share the same interrupt.
Device A's driver is suspended first and the device is powered down.
Device B generates an interrupt. Interrupt handlers of both drivers are
called. Device A's interrupt handler accesses registers of the powered
down device and gets back bogus values (I assume all 0xff). That data is
interpreted as interrupt status bits, etc. So, the interrupt handler
gets confused and may produce some noise or enter an infinite loop, etc.

This change affects only PCI devices.  The pci(4) bus driver marks a
child's interrupt handler as suspended after the child's suspend method
is called and before the device is powered down.  This is done only for
traditional PCI interrupts, because only they can be shared.

At the moment the change is only for x86.

Notable changes in core subsystems / interfaces:
- BUS_SUSPEND_INTR and BUS_RESUME_INTR methods are added to bus
  interface along with convenience functions bus_suspend_intr and
  bus_resume_intr;
- rman_set_irq_cookie and rman_get_irq_cookie functions are added to
  provide a way to associate an interrupt resource with an interrupt
  cookie;
- intr_event_suspend_handler and intr_event_resume_handler functions
  are added to the MI interrupt handler interface.

I added two new interrupt handler flags, IH_SUSP and IH_CHANGED, to
implement the new intr_event functions.  IH_SUSP marks a suspended
interrupt handler.  IH_CHANGED is used to implement a barrier that
ensures that a change to the interrupt handler's state is visible
to future interrupts.
While there, I fixed some whitespace issues in comments and changed a
couple of logically boolean variables to be bool.

MFC after:	1 month (maybe)
Differential Revision: https://reviews.freebsd.org/D15755
2018-12-17 17:11:00 +00:00
Greg Lehey
867bb99bbb Work around BIOS quirks on HPE Proliant MicroServer Gen10
PR:		221350
Submitted by:	Bob Bishop
Reported by:	Rafal Lukawiecki
Reviewed by:	jhb
MFC after:	2 weeks
2018-12-17 07:09:46 +00:00
Andriy Voskoboinyk
b5a2424b58 Add revision number for TP-Link TL-WN722N to prevent ambiguity between
different chipsets.

MFC after:	3 days
X-MFC with:	341786
2018-12-17 05:07:57 +00:00
Andriy Voskoboinyk
3c3e1b0a98 Add new USB id in rtwn_usb(4) (RTL8812AU)
PR:		234029
Submitted by:	<hakotani000@gmail.com>
MFC after:	4 days
2018-12-15 14:58:45 +00:00
Conrad Meyer
26649bb5e8 efirt: When present, attempt to use EFI runtime services to shutdown
PR:		maybe related to 233998 (inconclusive at this time)
Submitted by:	byuu <byuu AT tutanota.com> (previous version)
Reviewed by:	imp
Differential Revision:	https://reviews.freebsd.org/D18506
2018-12-15 05:46:04 +00:00
Marcin Wojtas
c9073141b4 Fix error check for ACPI_ID_PROBE in the TPM2.0 driver
Updated API does not return pointer, so adjust the
TPM2.0 driver accordingly.

Reported by: jhb
Obtained from: Semihalf
Sponsored by: Stormshield
2018-12-14 22:22:43 +00:00
Oleksandr Tymoshenko
e7bf6d7ae9 [twsi] Make extres/clk part conditional based on the EXT_RESOURCES option value
This should fix kernel build for ARMADA38X and possibly some other ARM configs

Approved by:	manu
2018-12-14 21:17:42 +00:00
Emmanuel Vadot
6a9997ed67 pwm: Convert period and duty to unsigned int
We don't need a 64 bits value to store nanoseconds

Discused with:	ian, jhibbits
2018-12-14 18:37:26 +00:00
Mark Johnston
8b2de3f0d4 Add support for the nForce MCP89 adapter.
PR:		234015
Submitted by:	Andrejs Bogdanovs <sinchiroca86@gmail.com>
MFC after:	1 week
2018-12-14 18:16:35 +00:00
Marcin Wojtas
8a263d8fca Fix TPM driver compilation from r342084
Include recent ACPI_ID_PROBE API change.
2018-12-14 17:43:35 +00:00
Marcin Wojtas
a2d5ed9442 Introduce driver for TPM 2.0 in CRB and FIFO (TIS) modes
It was written basing on:
TCG PC Client Platform TPM Profile (PTP) Specification Version 22, Revision 1.03.
It only supports Locality 0. Interrupts are only supported in FIFO mode.

The driver in FIFO mode was tested on x86 with Infineon SLB9665 discrete TPM chip.
Driver in both modes was also tested on qemu with swtpm running on host.

Submitted by: Kornel Duleba <mindal@semihalf.com>
Obtained from: Semihalf
Sponsored by: Stormshield
Differential Revision: https://reviews.freebsd.org/D18048
2018-12-14 16:14:36 +00:00
Kashyap D Desai
92a1d56ccc Compilation failure on ppc and mips due to Revision 342066.
Adding extra memset on chain frame.

Submitted by: Sumit Saxena <sumit.saxena@broadcom.com>
Reviewed by:  Kashyap Desai <Kashyap.Desai@broadcom.com>
Approved by:  ken
MFC after:  3 days
Sponsored by:   Broadcom Inc
2018-12-14 10:49:48 +00:00
Andriy Gapon
701ded4e30 ichwd: add Sunrise Point-LP ID
Submitted by:	Tetsuya Uemura <t_uemura@macome.co.jp>
Tested by:	Tetsuya Uemura <t_uemura@macome.co.jp>
MFC after:	2 weeks
Relnotes:	maybe
2018-12-14 09:30:43 +00:00
Andriy Gapon
8b65c16f6e ichwd: add support for clearing No Reboot bit in TCOv4
This is based on a patch developed by
Tetsuya Uemura <t_uemura@macome.co.jp>.
Many thanks!

Submitted by:	Tetsuya Uemura <t_uemura@macome.co.jp> (earlier version)
Tested by:	Tetsuya Uemura <t_uemura@macome.co.jp>
MFC after:	2 weeks
2018-12-14 09:28:20 +00:00
Kashyap D Desai
3fa18dc335 Driver version upgrade 07.708.02.00-fbsd
Submitted by: Sumit Saxena <sumit.saxena@broadcom.com>
Reviewed by:  Kashyap Desai <Kashyap.Desai@broadcom.com>
Approved by:  ken
MFC after:  3 days
Sponsored by:   Broadcom Inc
2018-12-14 08:06:39 +00:00
Kashyap D Desai
56d91e4964 This patch will increase debug level as current logging level has
very minimal prints and even few important messages will not get logged.

Submitted by: Sumit Saxena <sumit.saxena@broadcom.com>
Reviewed by:  Kashyap Desai <Kashyap.Desai@broadcom.com>
Approved by:  ken
MFC after:  3 days
Sponsored by:   Broadcom Inc
2018-12-14 08:05:49 +00:00
Kashyap D Desai
e80341d50f Change IOC INIT wait time to 180 secs to keep it inline with timeout
used by internal DCMDs.

Submitted by: Sumit Saxena <sumit.saxena@broadcom.com>
Reviewed by:  Kashyap Desai <Kashyap.Desai@broadcom.com>
Approved by:  ken
MFC after:  3 days
Sponsored by:   Broadcom Inc
2018-12-14 08:05:01 +00:00
Kashyap D Desai
3d27317677 This patch will add support for NVME PRPs creation by driver for fastpath
capable IOs. NVME specification supports specific type of scatter gather list
called as PRP (Physical Region Page) for IO data buffers. Since NVME drive is
connected behind SAS3.5 tri-mode adapter, MegaRAID driver/firmware has to convert
OS SGLs in native NVMe PRP format. For IOs sent to firmware, MegaRAID firmware
does this job of OS SGLs to PRP translation and send PRPs to backend NVME device.
For fastpath IOs, driver will do this OS SGLs to PRP translation.

Submitted by: Sumit Saxena <sumit.saxena@broadcom.com>
Reviewed by:  Kashyap Desai <Kashyap.Desai@broadcom.com>
Approved by:  ken
MFC after:  3 days
Sponsored by:   Broadcom Inc
2018-12-14 08:04:16 +00:00
Kashyap D Desai
79b4460b0f This patch will add support for new DCMD to get PD information and a single data structure
to specify LD and JBOD.

Submitted by: Sumit Saxena <sumit.saxena@broadcom.com>
Reviewed by:  Kashyap Desai <Kashyap.Desai@broadcom.com>
Approved by:  ken
MFC after:  3 days
Sponsored by:   Broadcom Inc
2018-12-14 08:03:28 +00:00
Kashyap D Desai
2a1d3bcde8 To improve RAID 1/10 Write performance, OS drivers need to issue the
required Write IOs as Fast Path IOs (after the appropriate checks
allowing Fast Path to be used) to the appropriate physical drives
(translated from the OS logical IO) and wait for all Write IOs to complete.

Design: A write IO on RAID volume will be examined if it can be sent in
Fast Path based on IO size and starting LBA and ending LBA falling on to
a Physical Drive boundary. If the underlying RAID volume is a RAID 1/10,
driver issues two fast path write IOs one for each corresponding physical
drive after computing the corresponding start LBA for each physical drive.
Both write IOs will have the same payload and are posted to HW such that
replies land in the same reply queue.

If there are no resources available for sending two IOs, driver will send
the original IO from upper layer to RAID volume through the Firmware.

When both IOs are completed by HW, the resources will be released
and SCSI IO completion handler will be called.

Submitted by: Sumit Saxena <sumit.saxena@broadcom.com>
Reviewed by:  Kashyap Desai <Kashyap.Desai@broadcom.com>
Approved by:  ken
MFC after:  3 days
Sponsored by:   Broadcom Inc
2018-12-14 08:02:44 +00:00
Kashyap D Desai
821df4b93e Detect sequential Write IOs and pass the hint that it is part of sequential
stream to help HBA Firmware do the Full Stripe Writes. For read IOs on
certain RAID volumes like Read Ahead volumes,this will help driver to
send it to Firmware even if the IOs can potentially be sent to
hardware directly (called fast path) bypassing firmware.

Design: 8 streams are maintained per RAID volume as per the combined
firmware/driver design. When there is no stream detected the LRU stream
is used for next potential stream and LRU/MRU map is updated to make this
as MRU stream. Every time a stream is detected the MRU map
is updated to make the current stream as MRU stream.

Submitted by: Sumit Saxena <sumit.saxena@broadcom.com>
Reviewed by:  Kashyap Desai <Kashyap.Desai@broadcom.com>
Approved by:  ken
MFC after:  3 days
Sponsored by:   Broadcom Inc
2018-12-14 08:01:49 +00:00
Kashyap D Desai
c376f8641e This patch will add new interface to support more than 256 JBODs.
Submitted by: Sumit Saxena <sumit.saxena@broadcom.com>
Reviewed by:  Kashyap Desai <Kashyap.Desai@broadcom.com>
Approved by:  ken
MFC after:  3 days
Sponsored by:   Broadcom Inc
2018-12-14 08:00:45 +00:00
Kashyap D Desai
503c4f8d7f This patch will add support for divert bitmap in RAID map. Divert bitmap is supported for
SAS3.5 adapters only.

Submitted by: Sumit Saxena <sumit.saxena@broadcom.com>
Reviewed by:  Kashyap Desai <Kashyap.Desai@broadcom.com>
Approved by:  ken
MFC after:  3 days
Sponsored by:   Broadcom Inc
2018-12-14 08:00:01 +00:00
Kashyap D Desai
4ad8357607 This patch will add support for new Dynamic RaidMap to have different sizes
for different number of supported VDs for SAS3.5 MegaRAID adapters.

Submitted by: Sumit Saxena <sumit.saxena@broadcom.com>
Reviewed by:  Kashyap Desai <Kashyap.Desai@broadcom.com>
Approved by:  ken
MFC after:  3 days
Sponsored by:   Broadcom Inc
2018-12-14 07:59:09 +00:00
Kashyap D Desai
7aade8bfb8 This patch will add support for next generation(SAS3.5) of Tri mode(SAS, SATA, NVMe)
MegaRAID adapters.

Submitted by: Sumit Saxena <sumit.saxena@broadcom.com>
Reviewed by:  Kashyap Desai <Kashyap.Desai@broadcom.com>
Approved by:  ken
MFC after:  3 days
Sponsored by:   Broadcom Inc
2018-12-14 07:57:00 +00:00
Chuck Tuffli
87b3975e36 nda(4) fix check for Dataset Management support
In the nda(4) driver, only set DISKFLAG_CANDELETE (a.k.a. can support
BIO_DELETE) if the drive supports Dataset Management. There are reports
that without this check, VMWare Workstation does not work reliably.

Fix is to check the ONCS field in the NVMe Controller Data structure for
support. This check previously existed but did not survive the
big-endian changes.

Reported by: yuripv@yuripv.net
Reviewed by: imp, mav, jimharris
Approved by: imp (mentor)
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D18493
2018-12-13 13:25:37 +00:00
Emmanuel Vadot
cf60d56e05 sdhci_xenon: Add Marvell 8k compatible string
Sponsored by:	Rubicon Communications, LLC ("Netgate")
2018-12-12 22:09:35 +00:00
Emmanuel Vadot
2a3fb901a7 twsi: Clean up marvell part and add support for Marvell 7k/8k
Sponsored by:	Rubicon Communications, LLC ("Netgate")
2018-12-12 22:05:07 +00:00
Emmanuel Vadot
2091650b73 fdt: Add support for simple-mfd bus
Quoting the binding Documentation :

"These devices comprise a nexus for heterogeneous hardware blocks containing
more than one non-unique yet varying hardware functionality."

Reviewed by:	loos
Sponsored by:	Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D17751
2018-12-12 21:56:45 +00:00