Commit Graph

34747 Commits

Author SHA1 Message Date
Michal Meloun
962eb1c03f Revert r328511, it was committed with <patch>.diff instead of <patch>.txt as
commit log.
2018-01-30 04:05:03 +00:00
Li-Wen Hsu
156531d65a Fix kernel build after r328523, correct variable names
Reviewed by:	delphij
Differential Revision:	https://reviews.freebsd.org/D14105
2018-01-29 04:04:52 +00:00
Ian Lepore
2480071fbc Add a NO_GETMAXLUN quirk for the JMicron JMS567 USB to SATA bridge, to
prevent lengthy timeout pauses while probing/attaching drives.
2018-01-29 03:24:02 +00:00
Warner Losh
d6b6639713 Add ISA PNP tables to ISA drivers. Fix a few incidental comments.
ACPI ISA PBP tables not tagged, there's bigger issues with them.
2018-01-29 00:22:30 +00:00
Warner Losh
2ced565834 Tag the current round of deprecated drivers.
Differential Revision: https://reviews.freebsd.org/D13818
2018-01-29 00:14:46 +00:00
Warner Losh
29077eb456 Use atomic load and stores to ensure that the compiler doesn't
optimize away these loops. Change boolean to int to match what atomic
API supplies. Remove wmb() since the atomic_store_rel() on status.done
ensure the prior writes to status. It also fixes the fact that there
wasn't a rmb() before reading done. This should also be more efficient
since wmb() is fairly heavy weight.

Sponsored by: Netflix
Reviewed by: kib@, jim harris
Differential Revision: https://reviews.freebsd.org/D14053
2018-01-29 00:00:52 +00:00
Warner Losh
8cc3cfa86d Out of an abundance of caution, NUL out the first byte in the PNP
info.
2018-01-28 23:58:22 +00:00
Michal Meloun
6403138990 diff --git a/sys/dev/extres/clk/clk.c b/sys/dev/extres/clk/clk.c
index c6a1f466ceb..c3708a0ce27 100644
--- a/sys/dev/extres/clk/clk.c
+++ b/sys/dev/extres/clk/clk.c
@@ -642,10 +642,11 @@ clknode_adjust_parent(struct clknode *clknode, int idx)
 	if (clknode->parent_cnt == 0)
 		return;
 	if ((idx == CLKNODE_IDX_NONE) || (idx >= clknode->parent_cnt))
-		panic("Invalid clock parent index\n");
+		panic("%s: Invalid parent index %d for clock %s",
+		    __func__, idx, clknode->name);

 	if (clknode->parents[idx] == NULL)
-		panic("%s: Attempt to set invalid parent %d for clock %s",
+		panic("%s: Invalid parent index %d for clock %s",
 		    __func__, idx, clknode->name);

 	/* Remove me from old children list. */
@@ -674,8 +675,8 @@ clknode_init_parent_idx(struct clknode *clknode, int idx)
 	if ((idx == CLKNODE_IDX_NONE) ||
 	    (idx >= clknode->parent_cnt) ||
 	    (clknode->parent_names[idx] == NULL))
-		panic("%s: Invalid clock parent index: %d\n", __func__, idx);
-
+		panic("%s: Invalid parent index %d for clock %s",
+		    __func__, idx, clknode->name);
 	clknode->parent_idx = idx;
 }
2018-01-28 15:20:45 +00:00
Alexander Motin
3986af1f65 Use bus_dmamem_alloc(9) KPI instead of contigmalloc(9).
I suppose it should make this code NUMA-aware with recent NUMA drop-in,
trying to allocate shared memory buffers from domain closer to NT-bridge.

MFC after:	2 weeks
2018-01-26 22:22:26 +00:00
Navdeep Parhar
ea3c5e5d04 cxgbe(4): Accept old names of a couple of tunables. 2018-01-26 00:45:40 +00:00
Navdeep Parhar
39e7cb038b cxgbe(4): Do not display harmless warning in non-debug builds.
MFC after:	3 days
Sponsored by:	Chelsio Communications
2018-01-26 00:03:14 +00:00
Ruslan Bukin
3d22784fb7 Add support for SDHCI controller found in Qualcomm Snapdragon 410e.
Tested on DragonBoard 410c.

Sponsored by:	DARPA, AFRL
2018-01-25 17:00:35 +00:00
Ruslan Bukin
11e11bd6d8 Add basic driver for Qualcomm USB 2.0 EHCI controller.
This driver relies on system initialization in u-boot.

Tested on DragonBoard 410c.

Sponsored by:	DARPA, AFRL
2018-01-25 16:58:23 +00:00
Michael Zhilin
1b8be09a20 [etherswitch] fix LINT build for rtl8366rb
Build with rtl8366rb has been broken due to incorrect retrieval of pointer
to device_t.

Reported by:	lwhsu
Differential Revision:	https://reviews.freebsd.org/D14044
2018-01-25 05:48:42 +00:00
Emmanuel Vadot
09ac343759 arm: lpc: Remove support
Code hasn't been touch this it's original commit in 2012 beside api changes.

Reviewed by:	ian
Differential Revision:	https://reviews.freebsd.org/D13625
Discussed with:		freebsd-arm@freebsd.org (no reply)
2018-01-24 22:04:16 +00:00
Michael Zhilin
0774131e27 [etherswitch] check if_alloc returns NULL
This patch is cosmetic. It checks if allocation of ifnet structure failed.
It's better to have this check rather than assume positive scenario.

Submitted by:	Dmitry Luhtionov <dmitryluhtionov@gmail.com>
Reported by:	Dmitry Luhtionov <dmitryluhtionov@gmail.com>
2018-01-24 21:33:18 +00:00
John Baldwin
c0154062c7 Store IV in output buffer in GCM software fallback when requested.
Properly honor the lack of the CRD_F_IV_PRESENT flag in the GCM
software fallback case for encryption requests.

Submitted by:	Harsh Jain @ Chelsio
Sponsored by:	Chelsio Communications
2018-01-24 20:16:48 +00:00
John Baldwin
2bc40b6ca9 Don't read or generate an IV until all error checking is complete.
In particular, this avoids edge cases where a generated IV might be
written into the output buffer even though the request is failed with
an error.

Sponsored by:	Chelsio Communications
2018-01-24 20:15:49 +00:00
John Baldwin
04043b3dcd Expand the software fallback for GCM to cover more cases.
- Extend ccr_gcm_soft() to handle requests with a non-empty payload.
  While here, switch to allocating the GMAC context instead of placing
  it on the stack since it is over 1KB in size.
- Allow ccr_gcm() to return a special error value (EMSGSIZE) which
  triggers a fallback to ccr_gcm_soft().  Move the existing empty
  payload check into ccr_gcm() and change a few other cases
  (e.g. large AAD) to fallback to software via EMSGSIZE as well.
- Add a new 'sw_fallback' stat to count the number of requests
  processed via the software fallback.

Submitted by:	Harsh Jain @ Chelsio (original version)
Sponsored by:	Chelsio Communications
2018-01-24 20:14:57 +00:00
John Baldwin
bf5b662033 Clamp DSGL entries to a length of 2KB.
This works around an issue in the T6 that can result in DMA engine
stalls if an error occurs while processing a DSGL entry with a length
larger than 2KB.

Submitted by:	Harsh Jain @ Chelsio
Sponsored by:	Chelsio Communications
2018-01-24 20:13:07 +00:00
John Baldwin
f7b61e2fcc Fail crypto requests when the resulting work request is too large.
Most crypto requests will not trigger this condition, but a request
with a highly-fragmented data buffer (and a resulting "large" S/G
list) could trigger it.

Sponsored by:	Chelsio Communications
2018-01-24 20:12:00 +00:00
John Baldwin
5929c9fb13 Don't discard AAD and IV output data for AEAD requests.
The T6 can hang when processing certain AEAD requests if the request
sets a flag asking the crypto engine to discard the input IV and AAD
rather than copying them into the output buffer.  The existing driver
always discards the IV and AAD as we do not need it.  As a workaround,
allocate a single "dummy" buffer when the ccr driver attaches and
change all AEAD requests to write the IV and AAD to this scratch
buffer.  The contents of the scratch buffer are never used (similar to
"bogus_page"), and it is ok for multiple in-flight requests to share
this dummy buffer.

Submitted by:	Harsh Jain @ Chelsio (original version)
Sponsored by:	Chelsio Communications
2018-01-24 20:11:00 +00:00
John Baldwin
acaabdbbee Reject requests with AAD and IV larger than 511 bytes.
The T6 crypto engine's control messages only support a total AAD
length (including the prefixed IV) of 511 bytes.  Reject requests with
large AAD rather than returning incorrect results.

Sponsored by:	Chelsio Communications
2018-01-24 20:08:10 +00:00
John Baldwin
020ce53af3 Always set the IV location to IV_NOP.
The firmware ignores this field in the FW_CRYPTO_LOOKASIDE_WR work
request.

Submitted by:	Harsh Jain @ Chelsio
Sponsored by:	Chelsio Communications
2018-01-24 20:06:02 +00:00
John Baldwin
d3f25aa152 Always store the IV in the immediate portion of a work request.
Combined authentication-encryption and GCM requests already stored the
IV in the immediate explicitly.  This extends this behavior to block
cipher requests to work around a firmware bug.  While here, simplify
the AEAD and GCM handlers to not include always-true conditions.

Submitted by:	Harsh Jain @ Chelsio
Sponsored by:	Chelsio Communications
2018-01-24 20:04:08 +00:00
Edward Tomasz Napierala
28f3d8b2c2 Add SPDX identifiers to linux_ptrace.c and cfumass.c.
MFC after:	2 weeks
2018-01-24 17:04:01 +00:00
Edward Tomasz Napierala
43ee6e9d7b Add SPDX tags to iscsi(4).
MFC after:	2 weeks
2018-01-24 16:58:26 +00:00
Navdeep Parhar
76aca1d671 cxgb(4): Validate offset/len in the GET_EEPROM ioctl.
Reported by:	Ilja Van Sprundel <ivansprundel@ioactive.com>
2018-01-24 05:16:11 +00:00
Ian Lepore
8917c34a82 Follow changes in r328307 by using new IIC_RECURSIVE flag.
The driver now ensures only one thread at a time is running in the API
functions (clock_gettime() and clock_settime()) by specifically requesting
ownership of the i2c bus without using IIC_RECURSIVE, then it does all IO
using IIC_RECURSIVE so that each individual IO operation doesn't try to
re-acquire the bus.

The other IO done by the driver happens at attach or intr_config_hooks time,
when there can't be multiple threads running with the same device instance.
So, the IIC_RECURSIVE flag can be safely ORed into the wait flags for all IO
done by the driver, because it's all either done in a single-threaded
environment, or protected within a block bounded by explict
iicbus_acquire_bus() and iicbus_release_bus() calls.
2018-01-24 03:09:56 +00:00
Ian Lepore
548778ed13 Follow changes in r328307 by using new IIC_RECURSIVE flag.
The driver now ensures only one thread at a time is running in the API
functions (clock_gettime() and clock_settime()) by specifically requesting
ownership of the i2c bus without using IIC_RECURSIVE, then it does all IO
using IIC_RECURSIVE so that each individual IO operation doesn't try to
re-acquire the bus.

The other IO done by the driver happens at attach or intr_config_hooks time,
when there can't be multiple threads running with the same device instance.
So, the IIC_RECURSIVE flag can be safely ORed into the wait flags for all IO
done by the driver, because it's all either done in a single-threaded
environment, or protected within a block bounded by explict
iicbus_acquire_bus() and iicbus_release_bus() calls.
2018-01-24 03:09:41 +00:00
Ian Lepore
ac8f374abf Fix a bug introduced with recursive bus ownership support in r321584.
The recursive ownership support added in r321584 was unconditionally in
effect all the time -- whenever a given i2c slave device instance tried to
lock the i2c bus for exclusive use when it already owned the bus, the call
returned immediately without waiting.  However, many i2c slave drivers use
bus ownership to enforce that only a single thread at a time can be using
the slave device.  The recursive locking changes broke this use case.

Now there is a new flag, IIC_RECURSIVE, which can be mixed in with the
other flags passed to iicbus_acquire_bus() to allow drivers to indicate
when recursive locking is desired.  Using the flag implies that the driver
is managing concurrent access to the device by different threads in some way.

This immediately fixes all existing i2c slave drivers except for the two
i2c RTC drivers which use the recursive locking feature; those will be
fixed in a followup commit.
2018-01-23 23:30:19 +00:00
Ian Lepore
18d61b59bf Switch to using the bcd_clocktime conversion functions that validate the BCD
data without panicking, and have common code for handling AM/PM mode.
2018-01-23 21:36:26 +00:00
Ian Lepore
e324bd4bd6 Switch to using the bcd_clocktime conversion functions that validate the BCD
data without panicking, and have common code for handling AM/PM mode.
2018-01-23 21:31:43 +00:00
Ian Lepore
234add65f7 Switch to using the bcd_clocktime conversion functinos that validate the BCD
data without panicking, and have common code for handling AM/PM mode.
2018-01-23 21:18:15 +00:00
Eric Joyner
2149fa3ec8 ixv(4): Stop setting editing ifnet flags in ixv_if_init()
In iflib, the device-specific init() function isn't supposed to edit
the struct ifnet driver flags. If it does, it'll cause an MPASS() assert
in iflib to fail.

PR:		225312
Reported by:	bhughes@
2018-01-22 20:56:21 +00:00
Pedro F. Giffuni
7d81f67b88 drm2: Basic use of mallocarray(9).
These functions deal the same type of overflows we do with mallocarray(9).
Using our mallocarray will panic, which different from the previous
behavior (returning NULL), but neither behavior is more correct.

As a sidenote, drm_calloc_large() is not currently used at all.

Reviewed by:	dumbbell
Differential Revision:	https://reviews.freebsd.org/D13835
2018-01-22 15:55:51 +00:00
Pedro F. Giffuni
d821d36419 Unsign some values related to allocation.
When allocating memory through malloc(9), we always expect the amount of
memory requested to be unsigned as a negative value would either stand for
an error or an overflow.
Unsign some values, found when considering the use of mallocarray(9), to
avoid unnecessary casting. Also consider that indexes should be of
at least the same size/type as the upper limit they pretend to index.

MFC after:	3 weeks
2018-01-22 02:08:10 +00:00
Edward Tomasz Napierala
1ee5bed72a Add missing manufacturer/serial number string descriptors.
MFC after:	2 weeks
Sponsored by:	The FreeBSD Foundation
2018-01-21 17:31:31 +00:00
Pedro F. Giffuni
ac2fffa4b7 Revert r327828, r327949, r327953, r328016-r328026, r328041:
Uses of mallocarray(9).

The use of mallocarray(9) has rocketed the required swap to build FreeBSD.
This is likely caused by the allocation size attributes which put extra pressure
on the compiler.

Given that most of these checks are superfluous we have to choose better
where to use mallocarray(9). We still have more uses of mallocarray(9) but
hopefully this is enough to bring swap usage to a reasonable level.

Reported by:	wosch
PR:		225197
2018-01-21 15:42:36 +00:00
Jean-Sébastien Pédron
90b0eb9b4a psm: Log syncmask[1], not syncmask[0] twice
MFC after:	1 week
2018-01-20 19:04:21 +00:00
Michal Meloun
f8759facd2 Convert extres/phy to kobj model.
Similarly as other extres pseudo-drivers, implement phy by using kobj model.
This detaches it from provider device, so single device driver can export
multiple different phys. Additionally, this  allows phy to be subclassed to
more specialized drivers, like is USB OTG phy, or PCIe phy with hot-plug
capability.

Tested by:	manu (previous version, on Allwinner board)
MFC after:	1 month
2018-01-20 17:02:17 +00:00
Emmanuel Vadot
2b541904af clk: Get new parent freq after set_freq
During set_freq a clknode might have reparent (using a better parent that
have a higher frequency for example), before refreshing the cache, re-get
the parent frequency.

Reviewed by:	mmel
2018-01-20 14:47:27 +00:00
Edward Tomasz Napierala
ad2c142415 Remove unused index.
MFC after:	2 weeks
Sponsored by:	The FreeBSD Foundation
2018-01-20 14:05:55 +00:00
Edward Tomasz Napierala
42e42a9aa4 Add missing SPDX tags; the rest of the license text is the same as in other
USB templates.

MFC after:	2 weeks
Sponsored by:	The FreeBSD Foundation
2018-01-20 14:03:55 +00:00
Edward Tomasz Napierala
8e06491a4e Add sysctls to control device side USB identifiers. This makes it
possible to change string and numeric vendor and product identifiers,
as well as anything else there might be to change for a particular
device side template, eg the MAC address.

Reviewed by:	hselasky@
MFC after:	2 weeks
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D13920
2018-01-20 13:58:34 +00:00
Jean-Sébastien Pédron
b9b766ae47 psm: Don't try to detect trackpoint packets if the Elantech device has none
This fixes a panic when `EVDEV_SUPPORT` is enabled: if a trackpoint
packet was detected but there was no trackpoint, we still tried to emit an
evdev event even though the associated relative evdev device (`evdev_r`)
was not initialized.

PR:		225339
MFC after:	1 week
2018-01-20 11:21:22 +00:00
Jean-Sébastien Pédron
9402bd96df psm: Skip sync check when PSM_CONFIG_NOCHECKSYNC is set
In psmprobe(), we set the initial `syncmask` to the vendor default value
if the `PSM_CONFIG_NOCHECKSYNC` bit is unset. However, we currently only
set it for the Elantech touchpad later in psmattach(), thus `syncmask`
is always configured.

Now, we check `PSM_CONFIG_NOCHECKSYNC` and skip sync check if it is set.
This fixes Elantech touchpad support for units which have `hascrc` set.

To clarify that, when we log the `syncmask` and `syncbits` fields, also
mention if they are actually used.

Finally, when we set `PSM_CONFIG_NOCHECKSYNC`, clear `PSM_NEED_SYNCBITS`
flag.

PR:		225338
MFC after:	1 week
2018-01-20 11:02:18 +00:00
Landon J. Fuller
f248a99a0e bhnd_chipc(4): Fix leak of child device ivars by explicitly deleting
any children prior to detach.

With the newbus child deletion ordering changes introduced in r307518,
parent devices are now detached (and their driver set to NULL) prior to
detaching and deleting child devices; child-related bus methods (e.g.
BUS_CHILD_DETACHED, BUS_CHILD_DELETED) are no longer be dispatched to the
parent device driver after it returns 0 (success) from DEVICE_DETACH.

Sponsored by:   The FreeBSD Foundation
2018-01-20 01:55:34 +00:00
Landon J. Fuller
a225321fbc bhnd/bwn(4): Define a bhnd(4) softmodem device class for the v.90 modem
codec core, and mark the core as unpopulated on all BCM4306 bwn(4) devices.

Sponsored by:	The FreeBSD Foundation
2018-01-19 22:43:08 +00:00
Landon J. Fuller
72759b4824 bwn(4): Add missing BCM4306 PCI IDs.
Sponsored by:	The FreeBSD Foundation
2018-01-19 22:37:48 +00:00
Landon J. Fuller
aea6ca2486 bwn(4): Fix DMA translation lookup on devices limited to 30-bit host
addressing. The host addressing constraint does not apply to device address
space, and shouldn't be passed to bhnd_get_dma_translation() as the
maximum supported device address width.

Sponsored by:	The FreeBSD Foundation
2018-01-19 22:33:25 +00:00
Landon J. Fuller
711221efd8 bhndb_pci(4): Implement bridge support for CardBus-attached devices.
- Extend the probe method to accept devclasses that inherit from the pci
   devclass (e.g. cardbus).
 - Some BCM4306-based CardBus adapters appear to advertise 4K SPROM, but
   only the first 2K is mapped into BAR0. We can safely assume that the
   SPROM data fits within the first 2K of the SPROM, rather than rejecting
   the SPROM mapping as invalid.

Sponsored by:	The FreeBSD Foundation
2018-01-19 22:22:02 +00:00
Landon J. Fuller
1c8edc1ed8 bhnd(4): fix a few bugs in pwrctl/fixed-clock device support.
- Do not panic on siba(4) detach when the bhnd(4) bus calls
   bhnd_get_pmu_info() on a PMU-less device.
 - Fix bhnd_pwrctl attach/detach on fixed-clock devices:
    - Treat bhnd_pwrctl_updateclk() as a no-op on fixed-clock devices.
    - Use bhnd_pwrctl_updateclk() to perform the appropriate clock
      transition on detach.

Sponsored by:	The FreeBSD Foundation
2018-01-19 21:58:48 +00:00
Landon J. Fuller
5ad00fa2cf bhnd_chipc(4): Fix the assignment of non-wildcard child unit numbers
introduced in r326102 and r326109; all chipc children should be added with
a wildcard unit (-1).

Sponsored by:	The FreeBSD Foundation
2018-01-19 21:36:28 +00:00
Nathan Whitehorn
9a8196ce19 Remove SFBUF_OPTIONAL_DIRECT_MAP and such hacks, replacing them across the
kernel by PHYS_TO_DMAP() as previously present on amd64, arm64, riscv, and
powerpc64. This introduces a new MI macro (PMAP_HAS_DMAP) that can be
evaluated at runtime to determine if the architecture has a direct map;
if it does not (or does) unconditionally and PMAP_HAS_DMAP is either 0 or
1, the compiler can remove the conditional logic.

As part of this, implement PHYS_TO_DMAP() on sparc64 and mips64, which had
similar things but spelled differently. 32-bit MIPS has a partial direct-map
that maps poorly to this concept and is unchanged.

Reviewed by:		kib
Suggestions from:	marius, alc, kib
Runtime tested on:	amd64, powerpc64, powerpc, mips64
2018-01-19 17:46:31 +00:00
Hans Petter Selasky
77e7601e6d Add new USB ID to U3G driver.
PR:		134299
MFC after:	1 week
Sponsored by:	Mellanox Technologies
2018-01-19 13:06:36 +00:00
Hans Petter Selasky
cdadbbb03d Improve support for USB based 3G/4G/5G dongles from Huawei.
PR:		192345
Sponsored by:	Mellanox Technologies
2018-01-19 12:59:14 +00:00
Ruslan Bukin
e6dd0a0e92 UART Clock Selection Register holds a divider value for a supplied clock,
not a final baud rate. The value for this register has to be calculated.

Sponsored by:	DARPA, AFRL
2018-01-18 18:19:31 +00:00
Ruslan Bukin
9f7743f2c8 Support for UART device found in Qualcomm Snapdragon 410E SoC.
Tested on DragonBoard 410c.

Reviewed by:	andrew
Sponsored by:	DARPA, AFRL
Differential Revision:	https://reviews.freebsd.org/D13972
2018-01-18 17:43:32 +00:00
Landon J. Fuller
19a63eb534 bwn(4): Enable, by default, the opt-in support for bhnd(4) introduced in
r326454.

bwn(4)/bhnd(4) has been tested with most chipsets currently supported by
bwn(4), and this change should be transparent to existing bwn(4) users;
please report any regressions that you do encounter.

To revert to using siba_bwn(4) instead of bhnd(4), place the following
lines in loader.conf(5):

  hw.bwn_pci.preferred="0"

Once we're satisfied that the switch to bhnd(4) has seen sufficient broader
testing, bwn(4) will be migrated to use the native bhnd(9) interface
directly, and support for siba_bwn(4) will be dropped (see D13518).

Sponsored by:	The FreeBSD Foundation
2018-01-17 22:33:19 +00:00
Warner Losh
7e5f6f2588 Move setting of CAM_SIM_QUEUED to before we actually submit it to the
hardware. Setting it after is racy, and we can lose the race on a
heavily loaded system.

Reviewed by: scottl@, gallatin@
Sponsored by: Netflix
2018-01-17 17:08:26 +00:00
Fabien Thomas
9f4f1d4d1f Fix pmcstat exit from kernel introduced by r325275.
pmcstat request for close will generate a close event.
This event will be in turn received by pmcstat to close the file.

Reviewed by:	kib
Tested by:	pho
MFC after:	1 week
Sponsored by: Stormshield
2018-01-17 16:41:22 +00:00
Konstantin Belousov
bd50262f70 PTI for amd64.
The implementation of the Kernel Page Table Isolation (KPTI) for
amd64, first version. It provides a workaround for the 'meltdown'
vulnerability.  PTI is turned off by default for now, enable with the
loader tunable vm.pmap.pti=1.

The pmap page table is split into kernel-mode table and user-mode
table. Kernel-mode table is identical to the non-PTI table, while
usermode table is obtained from kernel table by leaving userspace
mappings intact, but only leaving the following parts of the kernel
mapped:

    kernel text (but not modules text)
    PCPU
    GDT/IDT/user LDT/task structures
    IST stacks for NMI and doublefault handlers.

Kernel switches to user page table before returning to usermode, and
restores full kernel page table on the entry. Initial kernel-mode
stack for PTI trampoline is allocated in PCPU, it is only 16
qwords.  Kernel entry trampoline switches page tables. then the
hardware trap frame is copied to the normal kstack, and execution
continues.

IST stacks are kept mapped and no trampoline is needed for
NMI/doublefault, but of course page table switch is performed.

On return to usermode, the trampoline is used again, iret frame is
copied to the trampoline stack, page tables are switched and iretq is
executed.  The case of iretq faulting due to the invalid usermode
context is tricky, since the frame for fault is appended to the
trampoline frame.  Besides copying the fault frame and original
(corrupted) frame to kstack, the fault frame must be patched to make
it look as if the fault occured on the kstack, see the comment in
doret_iret detection code in trap().

Currently kernel pages which are mapped during trampoline operation
are identical for all pmaps.  They are registered using
pmap_pti_add_kva().  Besides initial registrations done during boot,
LDT and non-common TSS segments are registered if user requested their
use.  In principle, they can be installed into kernel page table per
pmap with some work.  Similarly, PCPU can be hidden from userspace
mapping using trampoline PCPU page, but again I do not see much
benefits besides complexity.

PDPE pages for the kernel half of the user page tables are
pre-allocated during boot because we need to know pml4 entries which
are copied to the top-level paging structure page, in advance on a new
pmap creation.  I enforce this to avoid iterating over the all
existing pmaps if a new PDPE page is needed for PTI kernel mappings.
The iteration is a known problematic operation on i386.

The need to flush hidden kernel translations on the switch to user
mode make global tables (PG_G) meaningless and even harming, so PG_G
use is disabled for PTI case.  Our existing use of PCID is
incompatible with PTI and is automatically disabled if PTI is
enabled.  PCID can be forced on only for developer's benefit.

MCE is known to be broken, it requires IST stack to operate completely
correctly even for non-PTI case, and absolutely needs dedicated IST
stack because MCE delivery while trampoline did not switched from PTI
stack is fatal.  The fix is pending.

Reviewed by:	markj (partially)
Tested by:	pho (previous version)
Discussed with:	jeff, jhb
Sponsored by:	The FreeBSD Foundation
MFC after:	2 weeks
2018-01-17 11:44:21 +00:00
Landon J. Fuller
84d6a5d4a7 bhndb_pci(4): fix incorrect BHND_PCI_SRSH_PI workaround
On a SPROM-less device, the PCI(e) bridge core will be initialized with its
power-on-reset defaults; this can leave the SPROM-derived BHND_PCI_SRSH_PI
value pointing to the wrong backplane address. This value is used by the
PCI core when performing address translation between the static register
windows in BAR0 that map the PCI core's register block, and backplane
address space.

Previously, bhndb_pci(4) incorrectly used the potentially invalid static
BAR0 PCI register windows when attempting to correct the BHND_PCI_SRSH_PI
value in the PCI core's SPROM shadow.

Instead, we now read/update BHND_PCI_SRSH_PI by fetching the PCI core's
backplane address from the core enumeration table, and then using a dynamic
register window to explicitly map the PCI core's register block into BAR0.

Sponsored by:	The FreeBSD Foundation
2018-01-17 03:34:26 +00:00
Conrad Meyer
e170090541 random(4): Add CCP random source definitions
The implementation will follow (D12723).  For now, get the changes to
commit-protected files out of the way.

Approved by:	secteam (gordon)
Sponsored by:	Dell EMC Isilon
Differential Revision:	https://reviews.freebsd.org/D13925
2018-01-16 02:56:27 +00:00
Konstantin Belousov
99801b12f9 When re-evaluating cpu_features, also re-print CPU identification.
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2018-01-14 12:33:05 +00:00
Bryan Venteicher
a12d97c55a Sync VirtIO IDs with Linux 2018-01-14 06:03:40 +00:00
Jeff Roberson
b6715dab8f Move VM_NUMA_ALLOC and DEVICE_NUMA under the single global config option NUMA.
Sponsored by:	Netflix, Dell/EMC Isilon
Discussed with:	jhb
2018-01-14 03:36:03 +00:00
Pedro F. Giffuni
b0ae8f91ac Fix build after r327949.
Reported by:	Cy Schubert
2018-01-14 00:31:34 +00:00
Nick Hibma
7f64a99075 Add support for Quectel EC25.
Submitted by:	Samuel Crookes
MFC after:	3 days
2018-01-13 23:31:21 +00:00
Pedro F. Giffuni
26c1d774b5 dev: make some use of mallocarray(9).
Focus on code where we are doing multiplications within malloc(9). None of
these is likely to overflow, however the change is still useful as some
static checkers can benefit from the allocation attributes we use for
mallocarray.

This initial sweep only covers malloc(9) calls with M_NOWAIT. No good
reason but I started doing the changes before r327796 and at that time it
was convenient to make sure the sorrounding code could handle NULL values.
2018-01-13 22:30:30 +00:00
Bryan Venteicher
a019e26c0f Fix possible panic when creating VirtIO console dev aliases
Since we have no control over the name, the MAKEDEV_CHECKNAME flag must be
used to return an error on an invalid (to devfs) name instead of panicing.

r305900 that originally added this feature also introduced a few other bugs:
  - Proper locking not performed
  - Theoretically broke the expectation that the control event buffer would
    not span more than one pages, but did not update the CTASSERT that was
    in place to prevent this. However, since the struct virtio_console_control
    and the bulk buffer together were quite small, this could not have happened.

Also workaround an QEMU VirtIO spec violation in that it includes the NUL
terminator in the buffer length when the spec says it is not included.

PR:		223531
MFC after:	1 week
2018-01-13 21:39:46 +00:00
Kyle Evans
5996fd28fe Add SPDX tags to syscon bits, correct inconsistency in Copyright line. 2018-01-13 19:00:41 +00:00
Kyle Evans
a9f41deff6 Introduce aw_syscon(4) for earlier attachment
Attaching syscon_generic earlier than BUS_PASS_DEFAULT makes it more
difficult for specific syscon drivers to attach to the syscon node and to
get ordering right. Further discussion yielded the following set of
decisions:

- Move syscon_generic to BUS_PASS_DEFAULT
- If a platform needs a syscon with different attach order or probe
behavior, it should subclass syscon_generic and match on the SoC specific
compat string
- When we come across a need for a syscon that attaches earlier but only
specifies compatible = "syscon", we should create a syscon_exclusive driver
that provides generic access but probes earlier and only matches if "syscon"
is the only compatible. Such fdt nodes do exist in the wild right now, but
we don't really use them at the moment.

Additionally:

- Any syscon provider that has needs any more complex than a spinlock solely
for syscon access and a single memory resource should subclass syscon
directly rather than attempting to subclass syscon_generic or add complexity
to it. syscon_generic's attach/detach methods may be made public should the
need arise to subclass it with additional attach/detach behavior.

We introduce aw_syscon(4) that just subclasses syscon_generic but probes
earlier to meet our requirements for if_awg and implements #2 above for this
specific situation. It currently only matches a64/a83t/h3 since these are
the only platforms that really need it at the time being.

Discussed with:	ian
Reviewed by:	manu, andrew, bcr (manpages, content unchanged since review)
Differential Revision:	https://reviews.freebsd.org/D13793
2018-01-13 18:46:31 +00:00
Marius Strobl
9007ed84d6 Use the correct revision specifier (EXT_CSD revision rather than
system specification version) for deciding whether the EXT_CSD
register includes the EXT_CSD_GEN_CMD6_TIME field.

Submitted by:	Masanobu SAITOH
2018-01-13 17:36:11 +00:00
Marius Strobl
61ef738d5e Fix a bug introduced in r327355; in mmcsd_ioctl_cmd() when ensuring
that userland doesn't switch partitions on its own, compare against
the partition mmcsd_ioctl_cmd() is going to switch to (based on the
device node used) rather than the currently selected partition.
2018-01-13 16:32:09 +00:00
Alexander Motin
f531e07502 Add IDs for Nuvoton NCT6793/NCT6795.
MFC after:	2 weeks
2018-01-13 16:31:07 +00:00
Marius Strobl
78f8baa866 Fix a bug introduced in r327339; at the point in time re-tuning is
executed, the interrupt aggregation code might have disabled the
SDHCI_INT_DMA_END and/or SDHCI_INT_RESPONSE bits in slot->intmask
and the SDHCI_SIGNAL_ENABLE register respectively. So when restoring
the interrupt masks based on the previous contents of slot->intmask
in sdhci_exec_tuning(), ensure that the SDHCI_INT_ENABLE register
doesn't lose these two bits.
While at it and in the spirit of r327339, let sdhci_tuning_intmask()
set the tuning error and re-tuning interrupt bits based on the
SDHCI_TUNING_ENABLED rather than the SDHCI_TUNING_SUPPORTED flag
being set, i. e. only when (re-)tuning is actually used. Currently,
this changes makes no net difference, though.
2018-01-13 16:21:13 +00:00
Emmanuel Vadot
a4cafeb098 dwmmc_hisi: Fix build when option MMCCAM is defined 2018-01-13 14:10:45 +00:00
Justin Hibbits
ed03d62a4c Remove fdt fixups for powerpc, they are no longer needed.
If a fixup really is needed, it should be fixed in u-boot, not in FreeBSD.

Suggested by:	nwhitehorn
2018-01-13 02:56:09 +00:00
Navdeep Parhar
e62fb4b142 cxgbe/iw_cxgbe: Remove duplicates to fix compilation with recent gcc. 2018-01-13 00:04:11 +00:00
Jeff Roberson
6f4acaf4c9 Add support for NUMA domains to bus dma tags. This causes all memory
allocated with a tag to come from the specified domain if it meets the
other constraints provided by the tag.  Automatically create a tag at
the root of each bus specifying the domain local to that bus if
available.

Reviewed by:	jhb, kib
Tested by:	pho
Sponsored by:	Netflix, Dell/EMC Isilon
Differential Revision:	https://reviews.freebsd.org/D13545
2018-01-12 23:34:16 +00:00
Eitan Adler
8f07d847a1 sys/dev/e1000: fix uses of 1 << 31
Reviewed by:		erj (D13858)
2018-01-12 06:37:53 +00:00
Eitan Adler
02ca39cff2 sys/dev/mlx[45]: fix uses of 1 << 31
Reviewed by:		kib (D13858)
2018-01-12 06:36:44 +00:00
Eric Joyner
1b65356b43 e1000: Fix typos in value written to register and a comment
The value written to E1000_TARC(0) wasn't intended to have every bit but
E1000_TARC0_CB_MULTIQ_3_REQ cleared; a ~ was missing.

Also change the referenced spec update section in the comment to the correct
section.

Sponsored by:	Intel Corporation
2018-01-11 19:24:51 +00:00
Andrew Turner
224c3776f6 Add the start of INTRNG support for ACPI.
This adds a new acpi_bus interface with a map_intr method. This is similar
to the Open Firmware map_intr method and allows us to create the needed
mapping from ACPI space to INTRNG space.

Obtained from:	ABT Systems Ltd
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D8617
2018-01-11 17:09:12 +00:00
Pedro F. Giffuni
92e1020a52 dev/bhnd: Make use of mallocarray(9).
This makes a calloc-like definition check for overflows as is common
practice.
2018-01-11 15:44:03 +00:00
Pedro F. Giffuni
efaa3e0789 dev/(e1000,ixl): Make some use of mallocarray(9).
Reviewed by:	erj
Differential Revision: https://reviews.freebsd.org/D13833
2018-01-11 15:25:26 +00:00
Wojciech Macek
f078ecf642 CXGBE: fix get_filt to be endianness-aware
Unconditional 32-bit shift is not endianness-safe.
Modify the logic to work both on LE and BE.

Submitted by:          Wojciech Macek <wma@freebsd.org>
Reviewed by:           np
Obtained from:         Semihalf
Sponsored by:          IBM, QCM Technologies
Differential revision: https://reviews.freebsd.org/D13102
2018-01-11 09:17:02 +00:00
Pedro F. Giffuni
c93a33340f dev/bxe: make use of mallocarray(9).
Use mallocarray in a couple of cases where a calloc-like operation is
taking place.
2018-01-10 20:05:19 +00:00
Andriy Gapon
cf38c8c630 amdsbwd: fix handling of timeout values beyond the supported range
The driver now fully observes watchdog(9) protocol.
Previously a too large timeout was silently clamped while the correct
behavior is to disable the watchdog and leave the error as is
(i.e. to not report success).

Also, previously a too small value caused the timer to stop while the
correct behavior is to use the minimal supported value.

MFC after:	2 weeks
2018-01-10 17:35:00 +00:00
Ian Lepore
a369070143 Convert a collection of unrelated bitwise flags to a collection of boolean
vars in the softc.  It makes the code more compact and readable, and
actually uses less memory too.
2018-01-10 02:57:03 +00:00
Ian Lepore
b33d84e005 Bugfix: don't lose the am/pm mode flag when setting the time. Unlike most
RTC chips that have a control register bit for am/pm mode, the DS13xx series
uses one of the high bits in the hour register.  Thus, when setting the time
in am/pm mode, the am/pm mode flag has to be ORed into the hour.
2018-01-10 02:31:59 +00:00
Ian Lepore
b93c58e168 Bugfix: on RTC chips with a 32-bit binary counter, after reading the time,
return immediately rather than falling through to the logic that reads
BCD-encoded time.
2018-01-10 02:28:10 +00:00
Jonathan T. Looney
f05c495660 Fix backwards MD_VERIFY logic for md devices.
If the MD_VERIFY flag is set, we should use O_VERIFY. If the MD_VERIFY flag
is not set, we should not.

Reviewed by:	stevek
Sponsored by:	Netflix
Differential Revision:	https://reviews.freebsd.org/D13814
2018-01-10 00:08:57 +00:00
Warner Losh
dc8ab16ecc Consolidate two identical copies of sysres_ids. 2018-01-09 16:42:24 +00:00
Andrew Turner
8ab09f8a4e Add a function to find the PSCI version the firmware implements from
outside the PSCI driver.

MFC after:	1 week
Sponsored by:	DARPA, AFRL
2018-01-09 15:57:09 +00:00
Andriy Gapon
fac38b96d2 usbdevs: add ASMedia vendor ID
MFC after:	1 week
2018-01-09 13:42:08 +00:00
Kyle Evans
ea9e0e28e0 Fix bogus pass for syscon_generic introduced in r327621
ian@ pointed out that BUS_PASS_DEFAULT + $anything is bogus, given that
BUS_PASS_DEFAULT is defined as __INT_MAX. Instead, we take a page out of
imx6_usbphy's book and use BUS_PASS_DEFAULT - 1000 to achieve the desired
effect of syscon_generic attaching before if_awg and other potential
consumers, but late enough that more specialized implementations should have
no problem attaching instead.

Reported by:	ian
2018-01-07 02:19:54 +00:00
Kyle Evans
e7cfe78afe Move syscon_generic to attach much later
It still needs to be before if_awg at least in order to be available for
other operations, but it should not be attaching before interrupt
controllers at the very least.

This should make errors involving syscon register space colliding with other
devices a little more innocent, but these conflicts should really be tracked
down and resolved. One such conflict is with the Raspberry Pi 3 local
interrupt controller, noticed by tuexen@

Reported by:	tuexen
2018-01-06 14:21:32 +00:00
Konstantin Belousov
0530a9360f Make it possible to re-evaluate cpu_features.
Add cpuctl(4) ioctl CPUCTL_EVAL_CPU_FEATURES which forces re-read of
cpu_features, cpu_features2, cpu_stdext_features, and
std_stdext_features2.

The intent is to allow the kernel to see the changes in the CPU
features after micocode update.  Of course, the update is not atomic
across variables and not synchronized with readers.  See the man page
warning as well.

Reviewed by:	imp (previous version), jilles
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D13770
2018-01-05 21:06:19 +00:00
Landon J. Fuller
07a0a243ec bhnd(4): Add missing BCM4312 backplane clock speed entry.
The default 80MHz clock speed returned by bhnd_pmu_si_clock() was already
correct; this just prevents the "No backplane clock specified" warning
printf from being emitted when querying backplane clock speed.

Sponsored by:	The FreeBSD Foundation
2018-01-04 19:47:01 +00:00
Ed Maste
b081d0e406 ath: fix possible memory disclosure in ioctl handler
Submitted by:	Domagoj Stolfa <domagoj.stolfa@gmail.com>
MFC after:	1 week
2018-01-03 19:28:13 +00:00
Navdeep Parhar
218c5b2115 cxgbe(4): Add a knob to enable/disable PCIe relaxed ordering. Disable it by
default when running on Intel CPUs.

This is a crude fix for the performance issues alluded to in these Linux commits:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=87e09cdec4dae08acdb4aa49beb793c19d73e73e
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=a99b646afa8a02571ea298bedca6592d818229cd

MFC after:	1 week
Sponsored by:	Chelsio Communications
2018-01-03 19:24:57 +00:00
Ed Maste
22760c6d0a ath: revert accidental change committed with r327526
It will be recommitted with the correct commit message.
2018-01-03 19:24:21 +00:00
Ed Maste
47b5c71929 embed_mfs: correctly test grep return value
Reported by:	br
MFC with:	r326992
Sponsored by:	The FreeBSD Foundation
2018-01-03 19:22:10 +00:00
Mike Karels
d626b50b9d make SW_WATCHDOG dynamic
Enable the hardclock-based watchdog previously conditional on the
SW_WATCHDOG option whenever hardware watchdogs are not found, and
watchdogd attempts to enable the watchdog. The SW_WATCHDOG option
still causes the sofware watchdog to be enabled even if there is a
hardware watchdog. This does not change the other software-based
watchdog enabled by the --softtimeout option to watchdogd.

Note that the code to reprime the watchdog during kernel core dumps is
no longer conditional on SW_WATCHDOG. I think this was previously a bug.

Reviewed by:	imp alfred bjk
MFC after:	1 week
Relnotes:	yes
Differential Revision:	https://reviews.freebsd.org/D13713
2018-01-03 00:56:30 +00:00
Oleksandr Tymoshenko
9d1208bbd2 nctgpio: add new device id for the GPIO chip in PCEngines APU3
PR:		224512
Submitted by:	mike@sentex.net
MFC after:	2 weeks
2018-01-02 20:58:05 +00:00
Ed Maste
c24972459f ath: fix possible memory disclosures in ioctl handlers
Apply the fix from r327499 to additional ioctl handlers.

Reported by:	Ilja van Sprundel <ivansprundel@ioactive.com>
MFC after:	1 week
MFC with:	r327499
Sponsored by:	The FreeBSD Foundation
2018-01-02 19:34:23 +00:00
Ed Maste
85f385b9aa ath: fix memory disclosure from ath_btcoex_ioctl
The ath_btcoex_ioctl handler allocated a buffer without M_ZERO and
returned it to userland without writing to it.

The device has permissions only for root so this is not urgent, and the
fix can be MFCd and considered for a future EN.

Reported by:	Ilja van Sprundel <ivansprundel@ioactive.com>
Submitted by:	Domagoj Stolfa <domagoj.stolfa@gmail.com>
Reviewed by:	adrian
MFC after:	1 week
2018-01-02 19:29:30 +00:00
Ed Maste
5d8501f487 hpt{nr,rr}: plug info leak in hpt_ioctl
The hpt{nr,rr} ioctl handler allocates a buffer without M_ZERO and calls
hpt_do_ioctl(), which might not overwrite the entire buffer.

Also zero bytesReturned in case it is not written by hpt_do_ioctl().

The hpt27{nr,rr} device has permissions only for root so this is not urgent,
and the fix can be MFCd and considered for a future EN.

The same issue was reported in the hpt27xx driver by Ilja Van Sprundel.

Reviewed by:	jhb, kib
MFC after:	3 days
Sponsored by:	The FreeBSD Foundation
2018-01-02 18:31:32 +00:00
Ed Maste
51cbc81510 hpt27xx: plug info leak in hpt_ioctl
The hpt27xx ioctl handler allocates a buffer without M_ZERO and calls
hpt_do_ioctl(), which might not overwrite the entire buffer.

Also zero bytesReturned in case it is not written by hpt_do_ioctl().

The hpt27xx device has permissions only for root so this is not urgent,
and the fix can be MFCd and considered for a future EN.

Reported by:	Ilja van Sprundel <ivansprundel@ioactive.com>
Submitted by:	Domagoj Stolfa <domagoj.stolfa@gmail.com> (M_ZERO)
Reviewed by:	jhb, kib
MFC after:	3 days
Security:	info leak in root-only ioctl
Sponsored by:	The FreeBSD Foundation
2018-01-02 18:29:44 +00:00
Adrian Chadd
9fbe631a1a [net80211] convert all of the WME use over to a temporary copy of WME info.
This removes the direct WME info access in the ieee80211com struct and instead
provides a method of fetching the data.  Right now it's a no-op but eventually
it'll turn into a per-VAP method for drivers that support it (eg iwn, iwm,
upcoming ath10k work) as things like p2p support require this kind of behaviour.

Tested:

* ath(4), STA and AP mode

TODO:

* yes, this is slightly stack size-y, but it is an important first step
  to get drivers migrated over to a sensible WME API.  A lot of per-phy things
  need to be converted to per-VAP before P2P, 11ac firmware, etc stuff shows up.
2018-01-02 00:07:28 +00:00
Oleksandr Tymoshenko
de87887b78 Fix GCC build broken by r32744
Indicate in function declaration that vt_palette_init does not take any arguments
2017-12-31 23:40:06 +00:00
Oleksandr Tymoshenko
c127b9f9d1 Unbreak build broken by r327444
During review iterations function signature has changed in definition
but not in actual call. Fix call to match the definition.

Reported by:	Herbert J. Skuhra
Pointyhat to: gonzo
MFC after:	2 weeks
2017-12-31 21:29:20 +00:00
Oleksandr Tymoshenko
29f61a2f42 vt(4): add support for configurable console palette
Introduce new set of loader tunables kern.vt.color.N.rgb, where N is a
number from 0 to 15. The value is either comma-separated list decimal
numbers ranging from 0 to 255 that represent values of red, green, and
blue components respectively (i.e. "128,128,128") or 6-digit hex triplet
commonly used to represent colors in HTML or xterm settings (i.e. #808080)

Each tunable overrides one of the 16 hardcoded palette codes and can be set
in loader.conf(5)

Reviewed by:	bcr(docs), jilles, manu, ray
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D13645
2017-12-31 20:21:05 +00:00
Emmanuel Vadot
74e0613ead dwmmc: Fully subclass driver
Fully subclass the dwmmc driver and split every driver into multiple files.

There is still a few quirks in the dwmmc driver that will need some work.

Tested On: Pine64 Rock64

Differential Revision:	https://reviews.freebsd.org/D13615
2017-12-30 22:01:17 +00:00
Nathan Whitehorn
01d1c9d889 Avoid use of the fdt_get_property_*() API, which is intrinsically
incompatible with FDT versions < 16. This also simplifies the code a bit.

MFC after:	1 month
2017-12-30 20:28:29 +00:00
Nathan Whitehorn
223d42a4de Check more aggressively for whether the desired properties actually exist.
If they don't, the code would look up some random part of the device tree
and seize the console inappropriately.

MFC after:	2 weeks
2017-12-30 20:23:14 +00:00
Cy Schubert
57229a86bf Fix r327383:
.../sys/dev/ep/elink.c:31:1: error: '/*' within block comment
[-Werror,-Wcomment]
/* $NetBSD: elink.c,v 1.6 1995/01/07 21:37:54 mycroft Exp $
^
2017-12-30 19:27:22 +00:00
Pedro F. Giffuni
8a2141f0e3 elink.[ch]: Move historic VCS tags after the license.
This matches better our common practices and style.
2017-12-30 15:13:33 +00:00
Konstantin Belousov
abbfe9e5d1 Move i386/isa/elink.[hc] to dev/ep.
The ep(4) driver is the only consumer of the two functions from
elink.c.  I removed the standalone module as well, and most likely,
the module metadata is not needed anywhere, but this is for later
cleanup.

Discussed with:	imp, jhb
Sponsored by:	The FreeBSD Foundation
2017-12-30 11:42:49 +00:00
Conrad Meyer
66ad253880 Add AHCI/XHCI device IDs found on AMD 1950X+X399 system
A follow-up to r327094.

Sponsored by:	Dell EMC Isilon
2017-12-29 22:24:41 +00:00
Marius Strobl
6c06949f41 - Don't allow userland to switch partitions; it's next to impossible
to recover from that, especially when something goes wrong.
- When userland changes EXT_CSD, update the kernel copy before using
  relevant EXT_CSD bits in mmcsd_switch_part().
2017-12-29 19:07:50 +00:00
Marius Strobl
cc22204bbc - There is no need to keep the tuning error and re-tuning interrupts
enabled (though, no interrupt generation enabled for them) all the
  time as soon as (re-)tuning is supported; only enable them and let
  them generate interrupts when actually using (re-)tuning.
- Also disable all interrupts except SDHCI_INT_DATA_AVAIL ones while
  executing tuning and not just their signaling.
2017-12-29 12:48:19 +00:00
Navdeep Parhar
348694dada cxgbe(4): Reduce duplication by consolidating minor variations of the
same code into a single routine.

Sponsored by:	Chelsio Communications
2017-12-29 02:30:21 +00:00
Pedro F. Giffuni
8e1f85caa3 if_txpreg.h: drop clauses 3 and 4.
Obtained from:	OpenBSD (CVS 1.35)
2017-12-29 00:59:56 +00:00
Pedro F. Giffuni
11c08a3f62 dev/txp: Update if_txpreg.h to match OpenBSD's version.
Resolve a minor mismatch: TXP_CMD_READ_VERSION instead of
TXP_CMD_VERSIONS_READ.
Curiously the later is defined but not used in OpenBSD.

Obtained from:	OpenBSD (CVS 1.31-1.34)
MFC after:	1 week
2017-12-29 00:27:12 +00:00
Marius Strobl
54ef33c2a8 Probe Intel Denverton eMMC 5.0 controllers. 2017-12-28 22:03:08 +00:00
Sean Bruno
6fe4c0a063 e1000: Add support for Ice Lake and Cannon Lake
Ths add initial support for Ice Lake and Cannon Lake ethernet devices.

This also addressed errata 1.5.4.4 for Sky Lake and Kabby Lake devices:
https://www.intel.com/content/dam/www/public/us/en/documents/specification-updates/i218-i219-ethernet-connection-spec-update.pdf?asset=9561

Submitted by:	Kevin Bowling <kevin.bowling@kev009.com>
Relnotes:	Yes
Sponsored by:	Limelight Networks
Differential Revision:	https://reviews.freebsd.org/D13660
2017-12-28 21:26:40 +00:00
John Baldwin
a4f66e5f21 Minor formatting and style tweaks to some comments. 2017-12-28 18:51:35 +00:00
Pedro F. Giffuni
8a97717048 SPDX: fix wrong license ID tag in dev/cesa. 2017-12-28 03:10:57 +00:00
Pedro F. Giffuni
bd9ba70127 SPDX: fix wrong license ID tag in dev/spibus. 2017-12-28 03:04:36 +00:00
Navdeep Parhar
adbb3637ec cxgbe/iw_cxgbe: Fix iWARP over VLANs (catch up with r326169).
Submitted by:	KrishnamRaju ErapaRaju @ Chelsio
Sponsored by:	Chelsio Communications
2017-12-27 22:44:50 +00:00
Eitan Adler
caa7e52f3f kernel: Fix several typos and minor errors
- duplicate words
- typos
- references to old versions of FreeBSD

Reviewed by:	imp, benno
2017-12-27 03:23:21 +00:00
Kyle Evans
198ca831a1 extres/syscon: Commit missing bits from r327106
r327106 introduced kobj to syscon so it can be subclassed and fit in with
the rest of the syscon framework. The diff for syscon.c was misapplied in a
clean tree prior to commit, so bring it back to what was included in the
review and tested. The entire file has basically been rewritten from what
was present prior to the kobj work.

Pointy hat to:	me
2017-12-26 16:38:04 +00:00
Emmanuel Vadot
b6d40d9394 Change the remaining files using my personnal email address to my freebsd one 2017-12-25 22:09:25 +00:00
Alexander Kabaev
151ba7933a Do pass removing some write-only variables from the kernel.
This reduces noise when kernel is compiled by newer GCC versions,
such as one used by external toolchain ports.

Reviewed by: kib, andrew(sys/arm and sys/arm64), emaste(partial), erj(partial)
Reviewed by: jhb (sys/dev/pci/* sys/kern/vfs_aio.c and sys/kern/kern_synch.c)
Differential Revision: https://reviews.freebsd.org/D10385
2017-12-25 04:48:39 +00:00
Kyle Evans
cd04523f0e Move syscon into extres framework
This should help reduce confusion between syscon/syscons a little bit.
syscon is a resource generally modeled by FDT platforms, and not to be
confused with syscons.
2017-12-23 14:30:44 +00:00
Kyle Evans
4d68f3daa0 syscon: Introduce kobj and split out fdt bits
Allow more flexibility by kobj'ifying syscon and splitting out fdt specific
bits in preparation of a move to the extres framework.

The generic fdt driver has been moved to syscon_generic.c and the fdt
requirement has been removed from the syscon interface, as is common to the
extres framework.

Reviewed by:	strejda
Differential Revision:	https://reviews.freebsd.org/D13521
2017-12-23 14:27:42 +00:00
Warner Losh
5fe4723c70 Create a new ISA_PNP_INFO macro. Use this macro every where we have
ISA PNP card support (replace by hand version in if_ed). Move module
declarations to the end of some files. Fix PCCARD_PNP_INFO to use
nitems(). Remove some stale comments about pc98, turns out the comment
was simply wrong.
2017-12-23 06:49:27 +00:00
Warner Losh
75d0374765 Expand cryptic comment with inforation I've learned in the mean time
about CIS3/CIS4, including studies I've done on my large collection of
PC Cards bought off e-bay over the years since the original entry as
well as conversations I've had at conferences.
2017-12-23 06:11:19 +00:00
Warner Losh
a914e889e3 These drivers have a sentinel at the end of the device list. Exclude
it.
2017-12-23 05:32:20 +00:00
Warner Losh
6efa5583c7 Fix typos from last commit, these should have been #. 2017-12-22 20:48:49 +00:00
Alexander Motin
d171d2f281 Add AHCI/XHCI device IDs found on AMD Ryzen+B350 system.
MFC after:	2 weeks
2017-12-22 20:44:21 +00:00
Navdeep Parhar
f549e3521d cxgbe(4): Do not forward interrupts to queues with freelists. This
leaves the firmware event queue (fwq) as the only queue that can take
interrupts for others.

This simplifies cfg_itype_and_nqueues and queue allocation in the driver
at the cost of a little (never?) used configuration.  It also allows
service_iq to be split into two specialized variants in the future.

MFC after:	2 months
Sponsored by:	Chelsio Communications
2017-12-22 19:10:19 +00:00
Warner Losh
d2064cf030 Use '#' rather than some made up name for fields we want to ignore. 2017-12-22 17:53:27 +00:00
Pedro F. Giffuni
fdac1d623b SPDX: Reverse License ID tags from the lmc driver.
While the BSD-2-Clause license is there, the GPLv2 is also present.
I am unsure of the implications of having both licenses as they are here.

I'll just leave it untagged and open for interpretation.
2017-12-22 17:15:02 +00:00
Warner Losh
a5ec991c27 Need to NULL terminate this list. It worked before by accidental data
in the module following it that terminated the search.
2017-12-22 17:13:54 +00:00
Warner Losh
56f3600c8b PC Card PNP tables are terminated by a NULL sentinel. This shouldn't
be recorded in the linker hints, so subtract one to omit it.
2017-12-22 16:59:50 +00:00
Navdeep Parhar
426b6bd53c cxgbe(4): Read the MFG diags version from the VPD and make it available
in the sysctl MIB.

MFC after:	1 week
Sponsored by:	Chelsio Communications
2017-12-21 15:19:43 +00:00
Eric Joyner
788a123054 ixgbe(4): Fix build error on i386.
Reported by:	markj
2017-12-21 00:35:14 +00:00
Warner Losh
4571c92f4b Simplify the code a bit.
Replace clumsy for(;;) { if (foo) break; ...} with simpler
while (!foo) { ... }.

Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D13546
2017-12-20 19:14:16 +00:00
Warner Losh
bb0107830d Add device location wiring to the pci bus.
This allows one to specify, for example, that if there's an igb card
in bus 12, slot 0, function 0, it should be assigned igb5. If there
isn't, or there's one in a different slot, normal numbering rules
apply (hinted units are skipped). Adding 'hint.igb.5.at="pci12:0:0"'
or 'hint.igb.5.at="pci0:12:0:0"' to /boot/device.hints will accomplish
this. The double quotes are important.

The kernel only accepts the strings (in shell notation):
	pci$d:$b:$s:$f
and	pci$b:$s:$f
where $d is the pci domain, $b is the pci bus number, $s is the slot
number and $f is the function number. A string compare is done with
the current device to avoid another string parser in the kernel. All
numbers are unsigned decimal without leading zeros.

Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D13546
2017-12-20 19:14:05 +00:00
Warner Losh
4484c8f5d2 Return domain, bus, slot, and function for the transport settings in
PATH_INQ requests for nvme.

Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D13546
2017-12-20 19:13:55 +00:00
Ian Lepore
5cf10fb96a Add a new kernel config option, MD_ROOT_READONLY, which forces on the
MD_READONLY flag for the md device automatically instantiated during
kernel init for an mdroot filesystem.

Note that there is specifically and by design no tunable or sysctl
control over this feature.  Without this option, you already have control
over whether the mdroot fs is writeable using vfs.root.mountfrom.options
from loader(8), the root_rw_mount rcvar, and by using "mount -u[rw] /"
or equivelent on the fly.  This option is being added to provide a way
to make the mdroot fs truly immutable before userland code begins running.

Differential Revision:	https://reviews.freebsd.org/D13411
2017-12-20 18:23:22 +00:00
Eric Joyner
c19c7afee3 ixgbe(4): Convert driver to use iflib
Initial update to the ixgbe PF and VF drivers to support the iflib interface.

The PF driver version is bumped to 4.0.0, and the VF driver version is bumped to 2.0.0.

Special thanks to sbruno@ for the support in helping make this conversion happen.

Submitted by:	Jeb Cramer <cramerj@intel.com>, Krzysztof Galazka (Chris) <krzysztof.galazka@intel.com>, Piotr Pietruszewski <piotr.pietruszewski@intel.com>
Reviewed by:	sbruno@, shurd@, #IntelNetworking
Tested by:	Jeffrey Pieper <jeffrey.e.pieper@intel.com>, Sergey Kozlov <kozlov.sergey.404@gmail.com>
Sponsored by:	Limelight Networks, Intel Corporation
Differential Revision:	https://reviews.freebsd.org/D11727
2017-12-20 18:15:06 +00:00
Stephen Hurd
ff46fd16e5 Add log messages for unknown and unhandled phy types
Previously, it silently only supported auto, instead, log a message
indicating why only auto is supported.

Submitted by:	Bhargava Chenna Marreddy <bhargava.marreddy@broadcom.com>
Sponsored by:	Broadcom Limited
Differential Revision:	https://reviews.freebsd.org/D13358
2017-12-19 22:15:46 +00:00
Stephen Hurd
a0b660301a On Link up & down, update media types
It's possible to change the SFP module when link is down, which would
change the available media types.  This is part of D13358.

Submitted by:	Bhargava Chenna Marreddy <bhargava.marreddy@broadcom.com>
Sponsored by:	Broadcom Limited
2017-12-19 22:06:25 +00:00
Stephen Hurd
980da9f2f0 Support short HWRM commands
New Stratus bnxt devices require support for short HWRM commands for VFs
to function.  Enable their use, but only use them if it's both supported
and required... prefer the long HWRM commands when possible.

Submitted by:	Bhargava Chenna Marreddy <bhargava.marreddy@broadcom.com>
Sponsored by:	Broadcom Limited
Differential Revision:	https://reviews.freebsd.org/D13269?id=36180
2017-12-19 21:07:30 +00:00
Stephen Hurd
6a0dc418a6 Don't populate NVRAM sysctls for VFs
Only the PF allows NVRAM interaction on bnxt devices.

Submitted by:	Bhargava Chenna Marreddy <bhargava.marreddy@broadcom.com>
Sponsored by:	Broadcom Limited
2017-12-19 20:32:45 +00:00
Stephen Hurd
78fcf2de93 Add byte swapping in bnxt_cfg_async_cr() request
The firmware is always in little endian, use htole*() for all request fields
larger than one byte.

Submitted by:	Bhargava Chenna Marreddy <bhargava.marreddy@broadcom.com>
Sponsored by:	Broadcom Limited
2017-12-19 18:12:18 +00:00
Stephen Hurd
96fc97c81f Update Matthew Macy contact info
Email address has changed, uses consistent name (Matthew, not Matt)

Reported by:	Matthew Macy <mmacy@mattmacy.io>
Differential Revision:	https://reviews.freebsd.org/D13537
2017-12-19 17:59:00 +00:00
Konstantin Belousov
e44f4f3547 mlx5en: Avoid SFENCe on x86
The IA32 memory model guarantees that all writes are seen in the program
order.  Also, any access to the uncacheable memory flushes the store
buffers.  As the consequence, SFENCE instruction is (almost) never needed,
in particular, it is not needed to ensure the correct order of updates as
seen by a PCIe device.

Use atomic_thread_fence_rel() instead of wb() to only emit compiler barriers
on x86 there.  Other architectures get the right barrier instruction as
well.

Reviewed by:	hselasky
Sponsored by:	Mellanox Technologies
MFC after:	1 week
2017-12-19 14:11:41 +00:00
Conrad Meyer
e054cac74a Implement ACPI CPU support when Processor object is not present
By the ACPI standard (ACPI 5 chapter 8.4 Declaring Processors) Processors
can be implemented in 2 distinct ways:

* Through a Processor object type (which provides P_BLK)
* Through a Device object type

Prior to this change, the FreeBSD driver only supported the former.  AMD
Epyc / Poweredge systems we are testing both implement the latter only.  Add
the missing support.

Because P_BLK is not defined in the device object case, C-states entering
must be completely controlled via _CST methods rather than P_LVL2/3.

John Baldwin points out that ACPI 6.0 formally deprecates the Processor
keyword, so eventually processors will only be enumerated as Device objects.

Submitted by:	attilio
Reviewed by:	jhb, markj, Anton Rang <rang AT acm.org>
Relnotes:	maybe
Sponsored by:	Dell EMC Isilon
Differential Revision:	https://reviews.freebsd.org/D13457
2017-12-19 02:49:11 +00:00
Warner Losh
989c7f0b7c Although we only have one quirk at the moment, guard against the day
we have more than one by checking the actual quirk bit before delaying
the reset.

Noticed by: rpokala@
2017-12-18 20:11:21 +00:00
Warner Losh
ce1ec9c178 When we're disabling the nvme device, some drives have a controller
bug that requires 'hands off' for a period of time (2.3s) before we
check the RDY bit. Sicne this is a very odd quirk for a very limited
selection of drives, do this as a quirk. This prevented a successful
reset of the card when the card wedged.

Also, make sure that we comply with the advice from section 3.1.5 of
the 1.3 spec says that transitioning CC.EN from 0 to 1 when CSTS.RDY
is 1 or transitioning CC.EN from 1 to 0 when CSTS.RDY is 0 "has
undefined results". Short circuit when EN == RDY == desired state.

Finally, fail the reset if the disable fails. This will lead to a
failed device, which is what we want. (note: nda device needs
work for coping with a failed device).

Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D13389
2017-12-18 18:38:00 +00:00
Landon J. Fuller
6585f74d30 bhnd(4): Fix the pa0itssit/pa1itssit NVRAM variable type definitions
required by bwn(4); idle TSSI target values are expressed as signed
integers.

Sponsored by:	The FreeBSD Foundation
2017-12-16 05:22:16 +00:00
Landon J. Fuller
80a7c0f53b bhndb(4): Enable addrext support on DMA64 devices, and fix an incorrect DMA
DMA boundary constraint applied in bhndb_dma_tag_create().

Sponsored by:	The FreeBSD Foundation
2017-12-16 04:35:37 +00:00
Landon J. Fuller
6467a17b49 bhnd(4)/bwn(4): Fix a number of small issues reported by Coverity.
- Fix reference of uninitialized error value in bhndb_generic_resume() if
  the dynamic window count is 0.

- Fix incorrect bhnd_pmu(4) UPTME_MASK and PLL0_PC2_WILD_INT_MASK
  constants.

- Variable definitions referenced by our generated SPROM layouts will never
  be NULL, but add explicit asserts to make that clear.

- Add missing variable initialization in bhnd_nvram_sprom_ident().

- Fix leak of driver array in bhnd_erom_probe_driver_classes().

- Fix zero-length memset() in bhndb_pci_eio_init().

- Fix an off-by-one error and potential invalid OOBSEL bit shift operation
  in bcma_dinfo_init_intrs().

- Remove dead code in siba_suspend_hw().

- Fix duplicate call to bhnd_pmu_enable_regulator() in both the enable and
  disable code paths of bhnd_compat_cc_pmu_set_ldoparef().

Reported by:	Coverity
CIDs:		1355194, 1362020, 1362022, 1373114, 1366563, 1373115,
		1381569, 1381579, 1383555, 1383566, 1383571
Sponsored by:	The FreeBSD Foundation
2017-12-15 04:51:47 +00:00
Landon J. Fuller
0bffd21750 Add basic bwn(4) support for the (BCMA-based) BCM43224 and BCM43225.
- Add the BCM4322X D11 core revision and missing BCM43224 PCI device ID to
  our device tables.
- Disable the DMA engine parity check (rather than adding parity support
  to the to-be-replaced bwn(4) DMA implementation).

Currently, N-PHY support in bwn(4) is GPL licensed, and is not included by
default. Until this is replaced with Broadcom's ISC-licensed N-PHY
implementation, bwn(4) must be rebuilt to enable N-PHY support.

To build bwn(4) with N-PHY support, add the following lines to your kernel
configuration file and rebuild the kernel (and modules):

	options BWN_GPL_PHY

To test bwn(4) with a BCM43224/BCM43225 device, install the firmware from
the net/bwn-firmware-kmod port, and place the following lines in
loader.conf(5):

	hw.bwn_pci.preferred="1"

	if_bwn_pci_load="YES
	bwn_v4_ucode_load="YES"
	bwn_v4_n_ucode_load="YES"
	bwn_v4_lp_ucode_load="YES"

Approved by:	adrian (mentor, implicit)
Sponsored by:	The FreeBSD Foundation
2017-12-14 06:45:04 +00:00
Justin Hibbits
b7bdc6a94f Allow bman-portals and qman-portals to attach to simple-bus
Official Linux dts's put the individual portals under a simple-bus, rather
than under a '*-portals' grouping.  This adds a hack to permit that, which
gets us closer to using stock device trees for DPAA-based devices.
2017-12-14 04:41:07 +00:00
Landon J. Fuller
c7f55202d3 bhndb(4): Fix two register window overcommit bugs introduced in r326297:
- The window target must always be updated when stealing a register window.
- Fix missing initialization of bhndb(4) region alloc_flags when
  registering statically mapped port regions (caught by scan-build).

Approved by:	adrian (mentor, implicit)
Sponsored by:	The FreeBSD Foundation
2017-12-14 03:41:12 +00:00
Landon J. Fuller
03362f9a6f bhnd_chipc(4): Correct typo in flag macros that broke clearing of GPIO
pin flags.

Approved by:	adrian (mentor, implicit)
Sponsored by:	The FreeBSD Foundation
2017-12-14 03:12:05 +00:00
Landon J. Fuller
7f1c814bb3 bhnd(4): Add missing enclosing parentheses to the bhnd bus space macros to
avoid precedence bugs.

Approved by:	adrian (mentor, implicit)
Sponsored by:	The FreeBSD Foundation
2017-12-14 03:03:08 +00:00
Landon J. Fuller
566ca880a1 bhnd(4): Include board_devid in the bhnd_board_info structure, and populate
the expected default board_vendor value on MIPS SoCs.

This is required by bwn(4) to differentiate between single-band and
dual-band device variants that otherwise share a common chip ID.

Approved by:	adrian (mentor, implicit)
Sponsored by:	The FreeBSD Foundation
2017-12-14 01:58:05 +00:00
Pedro F. Giffuni
9b10f59a10 SPDX: mostly fixes to previous changes.
Introduce the recently approved BSD-1-Clause and replace 0BSD which
never did fit well our use cases.
2017-12-13 16:13:17 +00:00
Warner Losh
d6f64df912 1k objects on the stack are a bad idea. While it's likely safe in this
context, it's also safe to allocate the memory and free it instead.

Noticed by: Eugene Grosbein's script
2017-12-12 20:22:09 +00:00
Kyle Evans
ce5252c4ba Correct a typo in syscon driver 'modify' logic
Not previously caught because the current consumer (not yet in tree) doesn't
use the 'modify' bits (yet).

Reported by:	rpokala
2017-12-11 22:55:51 +00:00
Kyle Evans
b9f5a3d3c0 Add generic 'syscon' driver
Upstream dts for allwinner will require a syscon driver, since the emac node
coming in 4.15 will be using xref to /soc/syscon for configuring the emac
clock. Add a generic syscon driver to attach to /soc/syscon for use by
if_awg, providing basic read/write functionality to consumers.

syscon driver will also be used by arm64 at least for A64+H5 emac/if_awg.

Written by:	mmel
Reviewed by:	manu
Differential Revision:	https://reviews.freebsd.org/D13295
2017-12-11 18:04:04 +00:00
Ian Lepore
3102bbe940 Do not give up if writing to the chip's control and status registers fails
during startup.  When a brand new chip leaves the factory, it is in a
special power-saving mode that disables most functions on the chip to
save battery power.  The chip is stuck in this mode until the first write
to the time registers, which automatically clears the special power-saving
mode and starts the oscillator.

Also, the day-of-week register in this chip counts 1-7, not 0-6, so write
the values accordingly.

These changes are based on the patch submitted by Brian Scott, but I
elimated warnings since this condition is expected, and added some comments,
and so in general blame me for any mistakes.

PR:		223642
2017-12-10 18:55:42 +00:00
Edward Tomasz Napierala
22d3bb2625 Move the DIAGNOSTIC check for lost iSCSI PDUs from icl_conn_close()
to icl_conn_free().  It's perfectly valid for the counter to be non-zero
in the former.

MFC after:	2 weeks
Sponsored by:	playkey.net
2017-12-09 15:34:40 +00:00
Pedro F. Giffuni
6e778a7efd SPDX: license IDs for some ISC-related files. 2017-12-08 15:57:29 +00:00
Andrew Turner
fb006e46e7 Set the io width when using an ACPI uart. Previously it would only ever be
set when finding the uart from the device tree.

Sponsored by:	DARPA, AFRL
2017-12-08 10:05:23 +00:00
Conrad Meyer
556127b650 mlx4: Remove redundant declarations to fix GCC build
These were made redundant in r325841.

Reviewed by:	hselasky
MFC after:	1 week (hselasky will MFC)
Sponsored by:	Dell EMC Isilon
Differential Revision:	https://reviews.freebsd.org/D13401
2017-12-07 19:57:51 +00:00
Warner Losh
762a7f4f5f Define xpt_path_inq.
This provides a nice wrarpper around the XPT_PATH_INQ ccb creation and
calling.

Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D13387
2017-12-06 23:05:22 +00:00
Gleb Smirnoff
17eea3202a Garbage collect IFCAP_POLLING_NOCOUNT. It wasn't used since very
beginning of polling(4).  The module always ignored return value
from driver polling handler.
2017-12-06 23:03:34 +00:00
Justin Hibbits
823cdec7bb Allow custom overrides of mmap attribute for VT framebuffer
Summary:
As in /dev/fb, allow the framebuffer driver to override the default memattr for
mmap(2).  This is analogous to the change in 306555.

Reviewed By: ray
Differential Revision: https://reviews.freebsd.org/D13331
2017-12-06 02:06:14 +00:00
Ed Maste
e1734edf76 Implement "vidcontrol -h <history_size>" for vt(4)
PR:		210415
Submitted by:	Siva Mahadevan
Reviewed by:	ray (earlier)
MFC after:	1 month
Relnotes:	yes
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D11814
2017-12-05 22:19:59 +00:00
Ed Maste
7fe94db265 vnic: apply hardware L3 checksum only for IPv4
Previously we set the csum_l3 flag for IPv4 and IPv6, but only IPv4
should have header checksumming applied.

Prompted by Linux commit fa6d7cb5d76cf0467c61420fc9238045aedfd379.

Reviewed by:	bz
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D13366
2017-12-05 22:02:46 +00:00
Stephen Hurd
d14c853ba3 iflib: Support to padding Ethernet frames to a min size
Some bnxt devices do not correctly send frames smaller than
52 bytes (without CRC), so add a quirk that will pad frames to an
arbitrary size before passing off to the encap routine.

Reported by:	Bhargava Chenna Marreddy <bhargava.marreddy@broadcom.com>
Sponsored by:	Limelight Networks
Differential Revision:	https://reviews.freebsd.org/D13269
2017-12-05 21:00:31 +00:00
Conrad Meyer
08f16d0c01 ioat(4): Add Skylake Xeon PCI-ID
SKX IOAT is just another 3.2 version of the CBDMA engine.

Submitted by:	Deepak Veliath <deepak.veliath AT isilon.com>
Sponsored by:	Dell EMC Isilon
2017-12-05 18:48:58 +00:00
George V. Neville-Neil
b61cdf0e4e Add support for RealTek 8812 over USB
Tested with ALFA AWUS036ACH

MFC after:	1 week
2017-12-03 22:02:30 +00:00
Landon J. Fuller
8d14ca9c99 Introduce bwn(4) support for the bhnd(4) bus.
Currently, bwn(4) relies on the siba_bwn(4) bus driver to provide support
for the on-chip SSB interconnect found in Broadcom's older PCI(e) Wi-Fi
adapters. Non-PCI Wi-Fi adapters, as well as the newer BCMA interconnect
found in post-2009 Broadcom Wi-Fi hardware, are not supported by
siba_bwn(4).

The bhnd(4) bus driver (also used by the FreeBSD/MIPS Broadcom port)
provides a unified kernel interface to a superset of the hardware supported
by siba_bwn; by attaching bwn(4) via bhnd(4), we can support both modern
PCI(e) Wi-Fi devices based on the BCMA backplane interconnect, as well as
Broadcom MIPS WiSoCs that include a D11 MAC core directly attached to their
SSB or BCMA backplane.

This diff introduces opt-in bwn(4) support for bhnd(4) by providing:

 - A small bwn(4) driver subclass, if_bwn_bhnd, that attaches via
   bhnd(4) instead of siba_bwn(4).
 - A bhndb(4)-based PCI host bridge driver, if_bwn_pci, that optionally
   probes at a higher priority than the siba_bwn(4) PCI driver.
 - A set of compatibility shims that perform translation of bwn(4)'s
   siba_bwn function calls into their bhnd(9) API equivalents when bwn(4)
   is attached via a bhnd(4) bus parent. When bwn(4) is attached via
   siba_bwn(4), all siba_bwn function calls are simply passed through to
   their original implementations.

To test bwn(4) with bhnd(4), place the following lines in loader.conf(5):

  hw.bwn_pci.preferred="1"

  if_bwn_pci_load="YES
  bwn_v4_ucode_load="YES"
  bwn_v4_lp_ucode_load="YES"

To verify that bwn(4) is using bhnd(4), you can check dmesg:

  bwn0: <Broadcom 802.11 MAC/PHY/Radio, rev 15> ... on bhnd0

... or devinfo(8):

pcib2
  pci2
    bwn_pci0
      bhndb0
        bhnd0
          bwn0
          ...

bwn(4)/bhnd(4) has been tested for regressions with most chipsets currently
supported by bwn(4), including:

  - BCM4312
  - BCM4318
  - BCM4321

With minimal changes to the DMA code (not included in this commit), I was
also able to test support for newer BCMA devices by bringing up basic
working Wi-Fi on two previously unsupported, BCMA-based N-PHY chipsets:

  - BCM43224
  - BCM43225

Approved by:	adrian (mentor, implicit)
Sponsored by:	The FreeBSD Foundation & Plausible Labs
Differential Revision:	https://reviews.freebsd.org/D13041
2017-12-02 02:21:27 +00:00
Landon J. Fuller
78baa4d625 bhnd_pmu(4): Do not leak our chipc provider reference or clkctl state in
failure paths of bhnd_pmu_attach()

Approved by:	adrian (mentor, implicit)
Sponsored by:	The FreeBSD Foundation
2017-12-02 01:10:45 +00:00
Landon J. Fuller
d16875a806 bhndb(4): Fix leak of child devices and MSI vectors.
- Add missing call to device_delete_children() in bhndb_detach(), without
  which we're left with stale child devices on module unload.
- Pass the parent PCI device to pci_release_msi(), not the bhndb_pci(4)
  child.

Approved by:	adrian (mentor, implicit)
Sponsored by:	The FreeBSD Foundation
2017-12-02 01:07:41 +00:00
Landon J. Fuller
19b3e4aa48 bhnd_chipc(4): Break cyclic references to the ChipCommon device
bhnd_chipc's children may hold strong provider references to their parent;
we must detach any children before attempting to deregister the bhnd_chipc
device as a bus service provider.

Approved by:	adrian (mentor, implicit)
Sponsored by:	The FreeBSD Foundation
2017-12-02 00:52:59 +00:00
Landon J. Fuller
1fe84e6f44 bhndb(4): Fix incorrect assertion in bhndb_deregister_intr_handler().
When deregistered, a handler should be in an 'active' state.

Approved by:	adrian (mentor, implicit)
Sponsored by:	The FreeBSD Foundation
2017-12-02 00:09:58 +00:00
Pedro F. Giffuni
64de3fdd58 SPDX: use the Beerware identifier. 2017-11-30 20:33:45 +00:00
Pedro F. Giffuni
796df753f4 SPDX: Consider code from Carnegie-Mellon University.
Interesting cases, most likely from CMU Mach sources.
2017-11-30 15:48:35 +00:00
Eitan Adler
6c025136ca Fix typo
Reported by: mjg, zrj@dragonflybsd.org
2017-11-30 07:24:33 +00:00
Konstantin Belousov
ef23f141bc Implement hardware mlx5(4) rx timestamps.
Driver support is only provided for ConnectX4/5.

System-time timestamp is calculated based on the free-running counter
timestamp provided by hardware.  Driver periodically samples the
counter to calibrate it against the system clock and uses linear
interpolation to convert.  Stability of the crystal which drives the
clock is +-50 ppm at the operational temperature, which makes the
algorithm good enough.

The calculation is somewhat delicate because all values are 64bit and
overflow the naive formula for linear interpolation.  The calculation
drops the least significant bits in advance, see the PREC shift in
mlx5_mbuf_tstmp().

Hardware stamps can be turned off by 'ifconfig mceN -hwrxtsmp'.  Buggy
firmware might result in small but visible errors in the reported
timestamps, detectable e.g. by nonsensical (negative) RTT values for
LAN pings.

Reviewed by:	gallatin, hselasky
Sponsored by:	Mellanox Technologies
Differential revision:	https://reviews.freebsd.org/D12638
2017-11-29 10:04:11 +00:00
Nathan Whitehorn
2bfca5775b Back out OF module installation in the event of failure. PS3 firmware gives
some ancient FDT version (2) that fails the init check in OFW_FDT. It is
still possible to make progress, but not while the OF layer is going crazy.
2017-11-28 06:31:39 +00:00
Bryan Venteicher
1b108b19ed Correctly report the vmxnet3 link down media status
Reported by:	lew@perftech.com
MFC after:	1 week
2017-11-28 06:21:37 +00:00
Landon J. Fuller
802cb4229e siba(4): Add support for devices have neither PMU nor PWRCTL support.
Very early BHND Wi-Fi devices (e.g. BCM4318) do not support any form of
dynamic clock control; on these devices, any PMU requests that cannot be
met by the device's fixed clock state will return an appropriate error
code.

Approved by:	adrian (mentor, implicit)
Sponsored by:	The FreeBSD Foundation
2017-11-28 00:42:44 +00:00
Landon J. Fuller
eaa5fb4b80 bhndb(4): Implement bridge support for the BCM4312 and other PCI_V0 chipsets.
Very early (PCI_V0) Broadcom PCI Wi-Fi chipsets have a few quirks when
compared to later PCI(e) core revisions:

- The standard static BAR0 mapping of the PCI core registers is discontiguous,
  with siba's cfg0 register block mapped distinctly from the other core
  registers.
- No dedicated ChipCommon register mapping is provided; instead, the
  single configurable register window must be used to access both
  ChipCommon and D11 core registers. The D11 core's operational semantics
  guarantee the safety of -- after disabling interrupts -- borrowing
  the single dynamic register window to perform the few ChipCommon
  operations required by a driver.

To support these early PCI devices:

- Allow defining multiple discontiguous BHNDB_REGWIN_T_CORE register
  windows that map a single port/region, and producing bridged resource
  allocations backed by those discontiguous windows.
- Support stealing existing register window allocations to fulfill indirect
  bhnd(4) bus I/O requests within address ranges tagged with
  BHNDB_ALLOC_FULFILL_ON_OVERCOMMIT.
- Fix an inverted test of bhndb_is_pcie_attached() that disabled
  PCI-only clock bring-up required by these devices.

Approved by:	adrian (mentor, implicit)
Sponsored by:	The FreeBSD Foundation
2017-11-28 00:12:14 +00:00
Landon J. Fuller
b8bfab43ad siba(4): fix workaround for BCM4312 D11 core backplane timeouts
The SIBA_QUIRK_PCIE_D11_SB_TIMEOUT quirk should match on all BCM4312
revisions, and backplane service timeouts must also be disabled.

Approved by:	adrian (mentor, implicit)
Sponsored by:	The FreeBSD Foundation
2017-11-27 22:38:44 +00:00
Landon J. Fuller
3fcd245ef1 bhnd(4): Print the core's hardware revision in bhnd(4)'s
BUS_PROBE_NOMATCH().

Approved by:	adrian (mentor, implicit)
Sponsored by:	The FreeBSD Foundation
2017-11-27 22:29:35 +00:00
Landon J. Fuller
ac59515b98 bhnd(4): Fix bcma/siba core reset behavior
Add missing support for specifying I/O control flags during core reset,
and resolve a number of siba(4)-specific reset issues:

- Add missing check for target reject flags in siba_is_hw_suspended().
- Remove incorrect wait on SIBA_TMH_BUSY when modifying any target state
  register; this should only be done when waiting for initiated
  transactions to clear.
- Add missing wait on SIBA_IM_BY when asserting SIBA_IM_RJ.
- Overwrite any previously set SIBA_TML_REJ flag when bringing the core
  out of reset. This fixes a lockup that occured when we brought up a core
  (after reboot) that had previously been placed into RESET by siba_bwn(4).

Approved by:	adrian (mentor, implicit)
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D13039
2017-11-27 22:13:30 +00:00
Landon J. Fuller
05ed3f9063 bhnd(4) update inline documentation comments and man pages.
This includes a number of copyedits for the inline code documentation
comments, updates to the existing bhnd(4), bhndb(4), bcma(4), and siba(4)
man pages, and new man pages for bhnd_chipc(4), bhnd_pmu(4), bhndb_pci(4),
bhnd(9), and bhnd_erom(9).

Approved by:	adrian (mentor)
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D13021
2017-11-27 21:30:49 +00:00
Pedro F. Giffuni
718cf2ccb9 sys/dev: further adoption of SPDX licensing ID tags.
Mainly focus on files that use BSD 2-Clause license, however the tool I
was using misidentified many licenses so this was mostly a manual - error
prone - task.

The Software Package Data Exchange (SPDX) group provides a specification
to make it easier for automated tools to detect and summarize well known
opensource licenses. We are gradually adopting the specification, noting
that the tags are considered only advisory and do not, in any way,
superceed or replace the license texts.
2017-11-27 14:52:40 +00:00
Nathan Whitehorn
763864aa95 Do not bind to CPUs with SMT, which use a different CPU numbering convention
that does not play well with this driver.

MFC after:	2 weeks
2017-11-25 21:46:51 +00:00
Alexander Motin
3228add807 Slightly fix bidirectional stream number allocation.
This logic is still imperfect, since it allows at most 15 bidirectional
streams out of 30 allowed by specification, but at least now those should
work better.  On the other side I don't remember I ever saw controller
supporting the bidirectional streams, so this is likely a nop change.

MFC after:	1 month
2017-11-25 09:42:14 +00:00
Hans Petter Selasky
c3125bc5bf Compile fixes for 32-bit architectures.
Sponsored by:	Mellanox Technologies
2017-11-24 12:08:50 +00:00
Hans Petter Selasky
82725ba9bf Merge ^/head r325999 through r326131. 2017-11-23 14:28:14 +00:00
Hans Petter Selasky
9ac7c5a64c Make sure the iSCSI I/O limits are set properly so that the ISCSIDSEND IOCTL
can be used prior to the ISCSIDHANDOFF IOCTL which set the negotiated values.
Else the login PDU will fail when passing the "-r" option to "iscsictl" which
means iSCSI over RDMA instead of TCP/IP.

Discussed with:	np@ and trasz@
Sponsored by:	Mellanox Technologies
MFC after:	1 week
2017-11-23 13:57:44 +00:00
Hans Petter Selasky
8d73c9ba61 The __internal_mr is freed as part of the protection domain, pd.
There is no need to free this mr. This fixes an issue accessing
freed memory in ISER.

Sponsored by:	Mellanox Technologies
2017-11-23 12:25:11 +00:00
Andrew Turner
a72d6c8975 Zero struct efi_tm before setting the needed values. We don't use the dst
or timezone fields so ensure these are set.

Reported by:	emaste
Sponsored by:	DARPA, AFRL
2017-11-23 10:34:38 +00:00
Landon J. Fuller
2f909a9f74 bhnd(4): Add a basic ChipCommon GPIO driver sufficient to support bwn(4)
The driver is functional on both BHND Wi-Fi adapters and MIPS SoCs, but
does not currently include support for features not required by bwn(4),
including GPIO interrupt handling.

Approved by:	adrian (mentor, implicit)
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D12708
2017-11-22 23:10:20 +00:00
Landon J. Fuller
4e96bf3a37 bhnd(4): extend the PMU APIs to support bwn(4)
The bwn(4) driver requires a number of extensions to the bhnd(4) PMU
interface to support external configuration of PLLs, LDOs, and other
parameters that require chipset or PHY-specific workarounds.

These changes add support for:

- Writing raw voltage register values to PHY-specific LDO regulator
  registers (required by LP-PHY).
- Enabling/disabling PHY-specific LDOs (required by LP-PHY)
- Writing to arbitrary PMU chipctrl registers (required for common PHY PLL
  reset support).
- Requesting chipset/PLL-specific spurious signal avoidance modes.
- Querying clock frequency and latency.

Additionally, rather than updating legacy PWRCTL support to conform to the
new PMU interface:

- PWRCTL API is now provided by a bhnd_pwrctl_if.m interface.
- Since PWRCTL is only found in older SSB-based chipsets, translation from
  bhnd(4) bus APIs to corresponding PWRCTL operations is now handled
  entirely within the siba(4) driver.
- The PWRCTL-specific host bridge clock gating APIs in bhnd_bus_if.m have
  been lifted out into a standalone bhnd_pwrctl_hostb_if.m interface.

Approved by:	adrian (mentor, implicit)
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D12664
2017-11-22 20:27:46 +00:00
Landon J. Fuller
9ed453245b bhnd(4): Add support for querying DMA address translation parameters
BHND Wi-Fi chipsets and SoCs share a common DMA engine, operating within
backplane address space. To support host DMA on Wi-Fi chipsets, the bridge
core maps host address space onto the backplane; any host addresses must
be translated to their corresponding backplane address.


- Defines a new bhnd_get_dma_translation(9) API to support querying DMA
  address translation parameters from the bhnd(4) bus.
- Extends bhndb(4) to provide DMA translation descriptors from a DMA
  address translation table defined in the host bridge-specific
  bhndb_hwcfg.
- Defines bhndb(4) DMA address translation tables for all supported host
  bridge cores.
- Extends mips/broadcom's bhnd_nexus driver to return an identity (no-op)
  DMA translation descriptor; no translation is required when addressing
  the SoC backplane.

Approved by:	adrian (mentor)
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D12582
2017-11-21 23:25:22 +00:00
Landon J. Fuller
caeff9a3c2 bhnd(4): implement MIPS and PCI(e) interrupt support
On BHND MIPS SoCs, this replaces the use of hard-coded MIPS IRQ#s in the
common bhnd(4) core drivers; we now register an INTRNG child PIC that
handles routing of backplane interrupt vectors via the MIPS core.

On BHND PCI devices, backplane interrupt vectors are now routed to the
PCI/PCIe host bridge core when bus_setup_intr() is called, where they are
dispatched by the PCI core via a host interrupt (e.g. INTx/MSI).

The bhndb(4) bridge driver tracks registered interrupt handlers for the
bridged bhnd(4) devices and manages backplane interrupt routing, while
delegating actual bus interrupt setup/teardown to the parent bus on behalf
of the bridged cores.

Approved by:	adrian (mentor, implicit)
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D12518
2017-11-21 23:15:20 +00:00
Andrew Turner
a3dff126f9 Add a driver for the EFI RTC. This uses the EFI Runtime Services to query
the system time.

As we seem to only read this time on boot, and this is the only source of
time on many arm64 machines we need to enable this by default there. As
this is not always the case with U-Boot firmware, or when we have been
booted from a non-UEFI environment we only enable the device driver when
the Runtime Services are present and reading the time doesn't result in an
error.

PR:		212185
Reviewed by:	imp, kib
Tested by:	emaste
Relnotes:	yes
Sponsored by:	DARPA, AFRL
Differential Revision:	https://reviews.freebsd.org/D12650
2017-11-21 17:23:16 +00:00
Hans Petter Selasky
2b378326f8 Make sure all initialized mutexes are destroyed in the iser module,
else WITNESS will panic. Prefix all mutex names with "iser_" to
prevent future WITNESS issues.

Sponsored by:	Mellanox Technologies
MFC after:	1 week
2017-11-21 13:56:30 +00:00
Navdeep Parhar
8ee789e9fa cxgbe(4): Fix unsafe mailbox access in cudbg.
MFC after:	1 week
Sponsored by:	Chelsio Communications
2017-11-21 01:18:58 +00:00
Navdeep Parhar
8e628d6d65 cxgbe(4): Add a custom board to the device id list.
MFC after:	1 week
Sponsored by:	Chelsio Communications
2017-11-20 19:50:48 +00:00
Pedro F. Giffuni
7282444b10 sys/dev: further adoption of SPDX licensing ID tags.
Mainly focus on files that use BSD 3-Clause license.

The Software Package Data Exchange (SPDX) group provides a specification
to make it easier for automated tools to detect and summarize well known
opensource licenses. We are gradually adopting the specification, noting
that the tags are considered only advisory and do not, in any way,
superceed or replace the license texts.

Special thanks to Wind River for providing access to "The Duke of
Highlander" tool: an older (2014) run over FreeBSD tree was useful as a
starting point.
2017-11-20 19:36:21 +00:00
Vladimir Kondratyev
3e10195c86 evdev: change USB scancode 0x54 from KEY_SLASH to KEY_KPSLASH
Submitted by:		dumbbell
Reviewed by:		gonzo, wulf
Approved by:		gonzo (mentor)
MFC after:		2 weeks
Differential Revision:	https://reviews.freebsd.org/D12983
2017-11-20 19:25:22 +00:00
Vladimir Kondratyev
b12ac17ef1 Fix evdev codes for slash and asterisk numpad keys of AT-keyboards
Reviewed by:	gonzo
Approved by:	gonzo (mentor)
MFC after:	2 weeks
2017-11-20 19:20:05 +00:00
Vladimir Kondratyev
303dbb854f evdev: Export EVDEV_SUPPORT kernel option through feature facility
Suggested by:	netchild
Reviewed by:	gonzo
Approved by:	gonzo (mentor)
MFC after:	1 week
2017-11-20 19:17:43 +00:00
Justin Hibbits
727ca2fdfd Eliminate 1 XX_VirtToPhys() and 2 XX_PhysToVirt() calls from if_dtsec(4)
XX_VirtToPhys(), by way of pmap_kextract(), is an expensive operation.
Profiling via dtrace during a series of iperf tests I found 16111 / 30432
stack frames were located in mmu_booke_kextract(), so eliminating this
expensive call should improve performance slightly.  XX_PhysToVirt() is not
as expensive, but redundant calls in this context is wasteful.
2017-11-20 04:32:01 +00:00
Hans Petter Selasky
937d37fc6c Merge ^/head r325842 through r325998. 2017-11-19 12:36:03 +00:00
Hans Petter Selasky
b108f35740 Remove duplicate static function prototype to fix compilation of
mlx5_fs_tree.c after r325638 when using GCC.

Found by:	kib @
MFC after:	1 week
Sponsored by:	Mellanox Technologies
2017-11-18 20:32:09 +00:00
Pedro F. Giffuni
df57947f08 spdx: initial adoption of licensing ID tags.
The Software Package Data Exchange (SPDX) group provides a specification
to make it easier for automated tools to detect and summarize well known
opensource licenses. We are gradually adopting the specification, noting
that the tags are considered only advisory and do not, in any way,
superceed or replace the license texts.

Special thanks to Wind River for providing access to "The Duke of
Highlander" tool: an older (2014) run over FreeBSD tree was useful as a
starting point.

Initially, only tag files that use BSD 4-Clause "Original" license.

RelNotes:	yes
Differential Revision:	https://reviews.freebsd.org/D13133
2017-11-18 14:26:50 +00:00
Navdeep Parhar
879462e916 cxgbe(4): Add core Vdd to the sysctl MIB.
Sponsored by:	Chelsio Communications
2017-11-17 23:22:39 +00:00
Justin Hibbits
c3f3cd058f Add jumbo frame support to dtsec(4)
MFC after:	2 weeks
2017-11-17 04:29:32 +00:00
Hans Petter Selasky
41dbd9dd1d Update iser backend code to use new ibcore APIs.
Sponsored by:	Mellanox Technologies
2017-11-16 13:28:00 +00:00
Navdeep Parhar
d3d5e96893 cxgbe(4): Remove rsrv_noflowq from intrs_and_queues structure as it does
not influence or get affected by the number of interrupts or queues.

Sponsored by:	Chelsio Communications
2017-11-16 02:42:37 +00:00
Navdeep Parhar
d406c47d71 cxgbe(4): Sanitize t4_num_vis during MOD_LOAD like all other t4_*
tunables.  Add num_vis to the intrs_and_queues structure as it affects
the number of interrupts requested and queues created.  In future
cfg_itype_and_nqueues might lower it incrementally instead of going
straight to 1 when enough interrupts aren't available.

Sponsored by:	Chelsio Communications
2017-11-16 01:33:53 +00:00
Navdeep Parhar
8c61c6bbda cxgbe(4): Combine all _10g and _1g tunables and drop the suffix from
their names.  The finer-grained knobs weren't practically useful.

Sponsored by:	Chelsio Communications
2017-11-15 23:48:02 +00:00
Hans Petter Selasky
55b1c6e7e4 Merge ^/head r325663 through r325841. 2017-11-15 11:28:11 +00:00
Hans Petter Selasky
c3191c2e2b Update the mlx4 core and mlx4en(4) modules towards Linux v4.9.
Background:
The coming ibcore update forces an update of mlx4ib(4) which in turn requires
an updated mlx4 core module. This also affects the mlx4en(4) module because
commonly used APIs are updated. This commit is a middle step updating the
mlx4 modules towards the new ibcore.

This change contains no major new features.

Changes in mlx4:
  a) Improved error handling when mlx4 PCI devices are
  detached inside VMs.
  b) Major update of codebase towards Linux 4.9.

Changes in mlx4ib(4):
  a) Minimal changes needed in order to compile using the
  updated mlx4 core APIs.

Changes in mlx4en(4):
  a) Update flow steering code in mlx4en to use new APIs for
  registering MAC addresses and IP addresses.
  b) Update all statistics counters to be 64-bit.
  c) Minimal changes needed in order to compile using the
  updated mlx4 core APIs.

Sponsored by:	Mellanox Technologies
MFC after:	1 week
2017-11-15 11:14:39 +00:00
Wojciech Macek
ec7f8d58b9 CXGBE: fix big-endian behaviour
The setbit/clearbit pair casts the bitfield pointer
to uint8_t* which effectively treats its contents as
little-endian variable. The ffs() function accepts int as
the parameter, which is big-endian. Use uint8_t here to
avoid mismatch, as we have only 4 doorbells.

Submitted by:          Wojciech Macek <wma@freebsd.org>
Reviewed by:           np
Obtained from:         Semihalf
Sponsored by:          QCM Technologies
Differential revision: https://reviews.freebsd.org/D13084
2017-11-15 06:45:33 +00:00
Warner Losh
eab9d0a85b Inline pcie_link_{status,caps} where needed. Remove them as they
aren't really needed and I don't want to document them.

Suggested by: jhb@
Sponsored by: Netflix
2017-11-15 02:24:47 +00:00
Bjoern A. Zeeb
c04716b1ad Unbreak IPv6.
No longer return ENXIO when trying to send an IPv6 packet in
nicvf_sq_add_hdr_subdesc().
Restructure the code so that the upper layer protocol parts are
agnostic of the L3 protocol (and no longer specific to IPv4).
With this basic IPv6 packets go through.  We are still seeing
weird behaviour which needs further diagnosis.

PR:			223669
In collaboration with:	emaste
MFC after:		3 days
2017-11-14 16:47:05 +00:00
Ed Maste
3bfef74a1f vnic: report that the driver supports multicast
The driver is currently hardcoded to force promiscuous mode, so all of
the MAC filtering code is presently unused and multicast should "just
work."  Report to the higher layers that multicast is supported.

PR:		223573
Reported by:	bz
Sponsored by:	The FreeBSD Foundation, Packet.net (hardware)
2017-11-14 16:31:11 +00:00
Hans Petter Selasky
dd00abf2d7 Make sure the ib_wr_opcode enum is signed by adding a negative dummy element.
Different compilers may optimise the enum type in different ways. This ensures
coherency when range checking the value of enums in ibcore.

Sponsored by:	Mellanox Technologies
MFC after:	1 week
2017-11-14 14:51:37 +00:00
Navdeep Parhar
f93039d9de Fix iw_cxgbe build in the projects branch.
Submitted by:	Krishnamraju Eraparaju @ Chelsio
2017-11-14 07:04:06 +00:00
Warner Losh
4e3b274457 Provide link speed data in XPT_GET_TRAN_SETTINGS. Provide full version
information for that and XPT_PATH_INQ. Provide macros to encode/decode
major/minor versions.  Read the link speed and lane count to compute
the base_transfer_speed for XPT_PATH_INQ.

Sponsored by: Netflix
2017-11-14 05:05:16 +00:00
Warner Losh
d505913c91 Provide pcie_link_status and pcie_link_cap convenience functions.
Sponsored by: Netflix
2017-11-14 05:05:05 +00:00