Commit Graph

33787 Commits

Author SHA1 Message Date
Pedro F. Giffuni
336c5fb5cd Fix some cases where an index was used before its limits check.
Obtained from:	DragonFlyBSD (git 799ba435)
MFC after:	5 days
2017-04-29 06:41:51 +00:00
Hans Petter Selasky
8b48354659 Improve sysadmin visibility of physical port error counters in the
mlx5en driver.

MFC after:		1 week
Sponsored by:		Mellanox Technologies
2017-04-28 19:38:57 +00:00
Jung-uk Kim
a0f9777dc4 Simplify the code a bit. No functional change. 2017-04-28 16:42:52 +00:00
Jung-uk Kim
0e37dd1fee Fix end coordinate of the drawable area of border. Although the name tr_end
suggests it is the end coordinate, tr_end.tp_row is width and tr_end.tp_col
is height of the drawable area in reality.

PR:		202288
2017-04-28 16:39:09 +00:00
John Baldwin
1ffd07bde6 Various fixes for PCI _OSC handling so HotPlug works again.
- Rename the default implementation of 'pcib_request_feature' and add
  a pcib_request_feature() wrapper function (as is often done for
  new-bus APIs implemented via kobj) that accepts a single function.
  Previously the call to pcib_request_feature() ended up invoking the
  method on the great-great-grandparent of the bridge device instead
  of the grandparent.  For a bridge that was a direct child of pci0 on
  x86 this resulted in the method skipping over the Host-PCI bridge
  driver and being invoked against nexus0
- When invoking _OSC from a Host-PCI bridge driver, invoke
  device_get_softc() against the Host-PCI bridge device instead of the
  child bridge that is requesting HotPlug.  Using the wrong softc data
  resulted in garbage being passed for the ACPI handle causing the
  _OSC call to fail.
- While here, perform some other cleanups to _OSC handling in the ACPI
  Host-PCI bridge driver:
  - Don't invoke _OSC when requesting a control that has already been
    granted by the firmware.
  - Don't set the first word of the capability array before invoking
    _OSC.  This word is always set explicitly by acpi_EvaluateOSC()
    since it is UUID-independent.
  - Don't modify the set of granted controls unless _OSC doesn't exist
    (which is treated as always successful), or the _OSC method
    doesn't fail.
  - Don't require an _OSC status of 0 for success.  _OSC always
    returns the updated control mask even if it returns a non-zero
    status in the first word.
  - Whine if _OSC ever tries to revoke a previously-granted control.
    (It is not supposed to do that.)
- While here, add constants for the _OSC status word in acpivar.h
  (though currently unused).

Reported by:	adrian
Reviewed by:	imp
MFC after:	1 week
Tested on:	Lenovo x220
Differential Revision:	https://reviews.freebsd.org/D10520
2017-04-27 16:32:42 +00:00
John Baldwin
32455e8912 Revert r317446 and bring back cy(4).
Requested by:	bde
2017-04-27 16:14:32 +00:00
Hans Petter Selasky
791c9d7848 Don't free uninitialized sysctl contexts in the mlx4en driver. This
can cause NULL pointer panics during failed device attach.

Differential Revision:	https://reviews.freebsd.org/D8876
MFC after:		1 week
Sponsored by:		Mellanox Technologies
2017-04-27 14:39:52 +00:00
John Baldwin
a63222db3a Remove the cy(4) driver for Cyclades serial adapters.
This driver has been disconnected from the build since the new tty
layer was introduced in 8.0 and was never updated for new tty.
2017-04-26 18:23:09 +00:00
Olivier Houchard
b05e505d6d Check if the device is marked as dma-coherent in the FDT, and if so, let
busdma know, so that on architectures where dma isn't always coherent, we
know we don't have to write-back/invalidates cachelines on DMA operations.

Reviewed by:	andrew, mav
2017-04-26 16:13:22 +00:00
John Baldwin
ee990cefd9 Remove the source to digi(4).
This was forgotten when the driver was removed in r305235.
2017-04-25 23:29:41 +00:00
Navdeep Parhar
034b4dcfa8 cxgbe/iw_cxgbe: Pull in some updates to c4iw_wait_for_reply from the
iw_cxgb4 Linux driver.

Obtained from:	Chelsio Communications
MFC after:	3 days
Sponsored by:	Chelsio Communications
2017-04-25 16:54:27 +00:00
Brooks Davis
a7dc31283a Remove the NATM framework including the en(4), fatm(4), hatm(4), and
patm(4) devices.

Maintaining an address family and framework has real costs when we make
infrastructure improvements.  In the case of NATM we support no devices
manufactured in the last 20 years and some will not even work in modern
motherboards (some newer devices that patm(4) could be updated to
support apparently exist, but we do not currently have support).

With this change, support remains for some netgraph modules that don't
require NATM support code. It is unclear if all these should remain,
though ng_atmllc certainly stands alone.

Note well: FreeBSD 11 supports NATM and will continue to do so until at
least September 30, 2021.  Improvements to the code in FreeBSD 11 are
certainly welcome.

Reviewed by:	philip
Approved by:	harti
2017-04-24 21:21:49 +00:00
Landon J. Fuller
eb23aa8008 Add support for dumping bcma/siba EROM tables to the console via a new
BHND_EROM_DUMP() method.

Dump the EROM tables to the coneole on mips/broadcom devices if bootverbose
is enabled; this functionality is primarily useful when debugging SoC EROM
parsing and device matching issues during early boot.

Reviewed by:	mizhka
Approved by:	adrian (mentor)
Sponsored by:	Plausible Labs
Differential Revision:	https://reviews.freebsd.org/D10122
2017-04-24 18:35:25 +00:00
Landon J. Fuller
b78f353f8a Drop unused/unnecessary return statement.
Reported by:	Coverity
CID:		1373118
Approved by:	adrian (mentor, implicit)
2017-04-24 18:09:52 +00:00
Andrew Turner
574a7c6c47 Call the PSCI reset from cpu_reset on arm64. When rebooting from DDB the
kernel calls this directly so the event handler is not called, meaning
the computer fails to reboot.

Tested by:	cognet
MFC after:	1 week
Sponsored by:	DARPA, AFRL
2017-04-24 11:06:10 +00:00
Alexander Motin
1c779b2849 Switch isp_reset to scratchpad not requiring ISP_MBOXDMASETUP.
MFC after:	1 week
2017-04-24 10:16:12 +00:00
Alexander Motin
5a5b6d1979 Use proper alignment constant for uma_zcreate().
Previous code panicked on KASSERT with INVARIANTS enabled.

MFC after:	2 weeks
2017-04-24 08:44:51 +00:00
Sepherosa Ziehau
cc0c6ebc14 hyperv/hn: Use channel0, i.e. TX ring0, for TCP SYN/SYN|ACK.
Hyper-V hot channel effect:
Operation latency on hot channel is only _half_ of the operation
latency on cold channels.

This commit takes the advantage of the above Hyper-V host channel
effect, and can reduce more than 75% latency and more than 50%
latency stdev, i.e. lower and more stable/predictable latency,
for various types of web server workloads.

MFC after:	3 days
Sponsored by:	Microsoft
2017-04-24 07:52:27 +00:00
Alexander Motin
48c4767756 Report NTB link speed to console and interface.
MFC after:	2 weeks
2017-04-23 14:25:51 +00:00
Bruce Evans
bfbcb15f76 Change the drawing method for the mouse cursor in planar mode to support
colors.

Colors are still hard-coded as 15 (normally lightwhite) for the interior
and 0 (normally black) for the border, but these are now values used in
2 expressions instead of built in to the algorithm.  The algorithm used
a fancy and/or method, but this gives no control over the colors except
and'ing all color planes off gives black and or'ing all color planes on
gives lightwhite.  Just draw the border and interior in separate colors
using the same method as for characters, including its complications to
optimize for VGA adaptors.  Optimization is not really needed here, but
for the VGA case it avoids being slower than the and/or method.  The
optimization is worth about 30%.
2017-04-23 08:59:35 +00:00
Bruce Evans
6284ff8398 Optimize setting of the foreground color in the main planar method much
like for the background color.

This is a about 5% faster for output that actually reaches the screen.
2017-04-21 17:57:23 +00:00
Bruce Evans
3df57f416b Merge the main ega drawing method into the main vga planar method and
remove the former.

All other EGA/VGA methods were already shared, with VGA-only features
mostly not used and no decisions in inner loops to optimize fof VGA,
but this method was split up because it is the only important one and
using VGA methods if possible is about twice as fast.  The speed is
mostly not from splitting to reduce branches but from doing half as
many bus accesses, so make this easier to maintain by not splitting.
There is now 1 extra branch in an inner loop where it costs less than
1% of the bus access overhead on Haswell even if the compiler schedules
it poorly.
2017-04-21 15:12:43 +00:00
Bruce Evans
56e7a784ac Oops, the previous commit swapped the main ega method with the main
vga planar method (for testing that was supposed to be local that the
former still works).  The ega method works on vga but is about twice
as slow.  The vga method doesn't work on ega.

Optimize the main vga planar method a little.  For changing the
background color (which was otherwise optimized better than most
things), don't switch the write mode from 3 to 0 just to select
the pixel mask of 0xff obscurely by writing 0.  Just write 0xff
directly.
2017-04-21 06:55:17 +00:00
Bruce Evans
2d445fb18c Eliminate the ega renderer switch. It did nothing useful except hold
a pointer to the main ega drawing method which is misoptimized be in
a different function than the main vga planar mode drawing method.
Vga initialization handles everything with no extra code except for
selecting the different function.
2017-04-20 17:22:03 +00:00
Bruce Evans
55d26fc07c When the character width is 9, remove vertical lines in the mouse cursor
corresponding to the gaps between characters.  This fixes distortion
of the cursor due to expanding it across the gaps.

Again for character width 9, when the cursor characters are not in the
graphics range (0xb0-0xdf), the gaps were always there (filled in the
background color for the previous char).  They still look strange, but
don't cause distortion.  When the cursor characters are in the graphics
range, the gaps are filled by repeating the previous line.  This gives
distortion with cilia.  Removing vertical lines reduces the distortion
to vertical cilia.

Move the default for the cursor characters out of the graphics range.
With character width 9, this gives gaps instead of distortion and
other problems.  With character width 8, it just fixes a smaller set
of other problems.  Some distortion and other problems can be recovered
using vidcontrol -M.  Presumably the default was to fill the gaps
intentionally, but it is much better to leave gaps.  The gaps can even
be considered as a feature for text processing -- they give sub-pointers
to character boundaries.  The other problems are: (1) with character
width 9, characters near the cursor are moved into the graphics range
and thus distorted if any of their 8th bits is set; (2) conflicts with
national characters in the graphics range.

The default range for the graphics cursor characters is now 8-11.  This
doesn't conflict with anything, since the glyphs for the characters in
this range are unreachable.

Use the 10x16 mouse cursor in text mode too (if the font size is >= 14).

When the character width is 9, removal of 1 or 2 vertical lines makes
10x16 cursor no wider than the 9x13 one usually was.  We could even
handle cursors 1 pixel wider in 2 character cells and gaps without
more clipping than given by the gaps (the worst case is 1 pixel in the
left cell, 1 removed in the middle gap, 8 in the right cell and 1
removed in the right gap.  The pixel in the right gap is removed so
it doesn't matter if it is in the font).

When the character width is 8, we now clip the 10-wide cursor by 1
pixel in the worst case.  This clipping is usually invisible since it
is of the border and and the border usually merges with the background
so is invisible.  There should be an option to use reverse video to
highlight the border and its tip instead of the interior (graphics
mode can do better using separate colors).  This needs the 9x13 cursor
again.

Ideas from: ache (especially about the bad default character range)
2017-04-20 16:34:09 +00:00
Konstantin Belousov
be4bf62684 Write-combine framebuffer writes through user-space mappings, if possible.
Note that KVA mapping of the framebuffer already uses write-combining
mode, so the change, besides improving speed of user mode writes, also
satisfies requirement of the IA32 architecture of using consistent
caching modes for multiple mappings of the same page.

Reported and tested by:	bde
Sponsored by:	The FreeBSD Foundation
MFC after:	 1 week
2017-04-20 15:18:15 +00:00
Olivier Houchard
5d840968f8 Update comment ot reflect realilty, we know also take care of CPUs that
provide a enable-method.

Suggested by:	jhibbits
2017-04-20 15:06:16 +00:00
Olivier Houchard
21ce594e7a ePAPR states that any non-boot CPU will come in "disabled" state. So we should
not consider a "disabled" cpu as a CPU we have to ignore, and we should use
them if they provide a "enable-method".
While I'm there, support "ok" as well as "okay", while ePAPR only accepts
"okay", linux accepts "ok" too so we can expect it to be used.

Reviewed by:	andrew (partially)
2017-04-20 13:56:06 +00:00
Bruce Evans
ecb56aaf60 Attempt to determine the modes in which 8-bit wide characters are actually
9 wide.

I only need this to improve the mouse cursor, but it has always been
needed to select and/or adjust fonts.

This is complicated because there are no standard parameter tables
giving this bit of information directly, and the device register bit
giving the information can't be trusted even if it is read from the
hardware.  Use a heuristic to guess if the device register can be
trusted.  (The device register is normally read from the BIOS mode
table, but on my system where the device register is wrong, the mode
table doesn't match the hardware and is not used; the device registers
are used in this case.)
2017-04-20 13:46:55 +00:00
Alexander Motin
d1025db49e Some cosmetic polishing for pre-timeouts.
MFC after:	1 week
2017-04-20 09:01:31 +00:00
David C Somayajulu
9a5f785486 Cleanup QLA_LOCK/QLA_UNLOCK macros
remove unused QLA_TX_LOCK/QLA_TX_UNLOCK macros
format qla_error_recovery()

MFC after:3 days
2017-04-20 03:41:42 +00:00
Gleb Smirnoff
69db34c309 Fix build without SC_PIXEL_MODE defined. 2017-04-19 22:48:27 +00:00
Jung-uk Kim
2696ce471c Revert r316796. It is not necessary since r317173. 2017-04-19 22:43:11 +00:00
Jung-uk Kim
b249b33322 Always clear borders when the terminal is flushed.
PR:		202288
2017-04-19 22:41:24 +00:00
Jung-uk Kim
5971d9cf1c Micro-optimize vt_set_border(). 2017-04-19 22:21:15 +00:00
Bruce Evans
35ffedf6bc Fix missing support for drawing the mouse cursor in depth 24 of direct
mode.

Use the general DRAWPIXEL() macro with its bigger case statement
(twice) instead of our big case statement (once).  DRAWPIXEL() is more
complicated since it is not missing support for depth 24 or
complications for colors in depth 16 (we currently hard-code black and
white so the complications for colors are not needed).  DRAWPIXEL()
also does the bpp calculation in the inner loop.  Compilers optimize
DRAWPIXEL() well enough, and the main text drawing method always
depended on this.  In direct mode, mouse cursor drawing is now similar
to normal text drawing except it draws in 2 hard-coded colors instead
of 1 variable color.

This also fixes a nested hard-coding of colors.  DRAWPIXEL() uses the
palette in all cases, but the direct code didn't use the palette for
its hard-coded black.  This only had an effect in depth 8, since
changing the palette is not supported in other depths.
2017-04-19 18:35:34 +00:00
Bruce Evans
38862a5553 Stop using a saveunder method for mouse cursor drawing in the vga
direct mode renderer.  I thought that reads were not much slower than
writes, so that the method only tripled the time for the whole function,
but I recently measured that video memory reads can be up to 53 times
slower than writes in tighter loops than here.  Loop overheap here
reduces the multiplier to only 16-20 on Haswell.

Start cleaning up and fixing larger bugs in this function.  Only replace
the 22-line removal loop by a 3-line one for now, since adjusting the
old loop would have required many palette calculations which are better
done in the DRAW_PIXEL() macro.  This also fixes missing support for
depth 24, but only for removal.

Removal is currently sloppy at the right bottom corner.  It sometimes
leaks border color into the text window.  This is soon cleaned up by the
caller.  The planar renderer has complications to clip at the corner.
2017-04-19 16:24:51 +00:00
Bruce Evans
7b8306bcd2 When we don't use the parameter table in the BIOS, also don't use most
of our tweaked modes based on it.  In practice, this means limiting the
tweaked modes to at most 80x50 based on 80x25, so there are no 90-column,
80x30 or 80x60 modes.

This happens when the the initial mode is is not in the parameter
table.  We always detected this case, but assumed that the (necessarily
nonstandard) parameters of the initial mode could be tweaked just as
blindly as the probably-standard parameters of initial modes in the
table.

On 1 laptop system with near-VGA where the initial mode is nonstandard,
this is because the hardware apparently doesn't support 9-bit mode,
but otherwise has standard timing.  The initial mode has 8-bit mode
CRTC horizontal parameters similar to those in syscons' 90-column modes
and in EGA modes.  Tweaking these values for the 90-column modes has
little effect except to print the extra 10 columns off the screen.
Tweaking from 80x25 to 80x30 requires changing from 400 scan lines to
480.  This can probably be made to work, but syscons blindly applies
values based on standard timing.  This gives blank output.  Tweaking
from 80x25 to 80x50 doesn't change the CRTC timing and works.
2017-04-19 14:49:18 +00:00
Sepherosa Ziehau
9ba5e29c5c hyperv: Use kmem_malloc for hypercall memory due to NX bit change.
Reported by:	dexuan@
MFC after:	now
Sponsored by:	Microsoft
2017-04-19 02:39:48 +00:00
Alexander Motin
7ce9096841 Block FPDMA TRIM for ASMedia HBAs.
Experiments show FPDMA TRIM command timeouts on ASMedia HBAs, while the
same SSDs working fine on Intel HBAs.

MFC after:	2 weeks
2017-04-18 08:04:15 +00:00
Gleb Smirnoff
9ed01c32e0 All these files need sys/vmmeter.h, but now they got it implicitly
included via sys/pcpu.h.
2017-04-17 17:07:00 +00:00
Gleb Smirnoff
6286dc78d4 Remove unneeded include of vm_phys.h. 2017-04-17 16:51:04 +00:00
Navdeep Parhar
46f48ee519 cxgbe: Add tunables to control the number of LRO entries and the number
of rx mbufs that should be presorted before LRO.  There is no change in
default behavior.

MFC after:	1 week
Sponsored by:	Chelsio Communications
2017-04-17 09:00:20 +00:00
Mark Murray
150890b0c6 Replace the RC4 algorithm for generating in-kernel secure random
numbers with Chacha20. Keep the API, though, as that is what the
other *BSD's have done.

Use the boot-time entropy stash (if present) to bootstrap the
in-kernel entropy source.

Reviewed by: delphij,rwatson
Approved by: so(delphij)
MFC after: 2 months
Relnotes: yes
Differential Revision: https://reviews.freebsd.org/D10048
2017-04-16 09:11:02 +00:00
Ian Lepore
44c63714ce Add imx6ul SoC support, and get the PHY number from the FDT data. If there
is no phy-handle property, fall back to using MII_PHY_ANY.

This still doesn't support an mdio bus with multiple PHYs on it, or the
possibility that the PHY being used by this instance of ffec is on the
mdio bus of some other instance (which is now a possibility with imx6ul).
Adding that support will require changes in fdt_get_phyaddr(), which is
currently making some assumptions that don't work with modern fdt data.
2017-04-16 03:49:14 +00:00
Ian Lepore
e8b1516a8b Add support for the Micrel KSZ8081 ethernet PHY.
The only thing this phy needs that the ukphy driver doesn't provide is
that the value in the proprietary Phy Control 2 Register must be saved
before doing a soft reset and restored afterwards.  Most modern phys have
"sticky bits" for low-level config that survive a reset, but on this one
the values in all registers go back to defaults, wiping out any board-
specific config set up by the bootloader/bios/whatever.
2017-04-16 01:40:17 +00:00
Bruce Evans
f027ee38b7 Add a 10x16 mouse cursor and use it in all graphics (strictly, pixel)
modes if the font size is >= 14.

This is the X cursor XC_left_ptr (#68) (glyph #45 in an X cursor font).
Also found in vt.  The old 9x13 cursor is the 10x16 one trimmed not very
well.

8x8 fonts need a smaller cursor instead of a larger one, except when
the pixel size is small.  Text mode is still limited to width and height
1 more than the font (so the 9x13 is already 4 pixels too high for it).
2017-04-15 20:03:50 +00:00
Bruce Evans
e560b71d3b Structure the mouse cursor data so that it is easier to switch, and
access it via pointers (still to only 1 instance, now with a less
generic name).

Restructure the "and" and "or" masks as border and interior masks
(where the "and" mask was for the union of the border and the interior).
"and" and "or" were only a detail in a not very good implementation,
and after fixing that the union was only used to calculate the border
at runtime.

Use the metric data in more places to clip to active pixels earlier.
2017-04-15 19:27:39 +00:00
Navdeep Parhar
d491f8ca2f cxgbe: Add a tunable to configure the SGE time scaler, which is
available starting with T6.  The values in the timer holdoff registers
are multiplied by the scaling factor before use.

dev.<nexus>.<n>.holdoff_timers shows the final values of the
timers in microseconds.

MFC after:	1 week
Sponsored by:	Chelsio Communications
2017-04-15 17:00:50 +00:00
Navdeep Parhar
e3951def25 cxgbe/iw_cxgbe: Report the actual values of various parameters as
configured by the firmware.

MFC after:	3 days
Sponsored by:	Chelsio Communications
2017-04-14 20:15:17 +00:00
Navdeep Parhar
7f77a37048 cxgbe/iw_cxgbe: Report accurate page_size_cap in ib_query_device.
MFC after:	3 days
Sponsored by:	Chelsio Communications
2017-04-14 19:18:50 +00:00
Navdeep Parhar
080491b13c cxgbe/iw_cxgbe: hw supports 64K (not 32K) Protection Domains.
MFC after:	3 days
Sponsored by:	Chelsio Communications
2017-04-14 19:15:31 +00:00
Bruce Evans
42106dcc4b Oops, the previous revision was missing the update of the shift variable. 2017-04-14 17:38:43 +00:00
Bruce Evans
b95fde5020 Adjust shifting so that cursor widths up to 17 (was 9) work in vga planar
mode.

Direct mode always supported widths up to 32, except for its hard-coded
16s matching the pixmap size.  Text mode is still limited to 9 its 2x2
character cell method and missing adjustments for the gap between
characters, if any.

Cursor heights can be almost anything in graphics modes.
2017-04-14 17:02:24 +00:00
Kevin Lo
5d70641052 Remove RTL8153 quirk since ure(4) supports this chip. 2017-04-14 14:38:27 +00:00
Bruce Evans
a5126f539e Optimize drawing of the mouse cursor in vga planar mode almost as
much as possible, by avoiding null ANDs and ORs to the frame buffer.

Mouse cursors are fairly sparse, especially for their frame.  Pixels
are written in groups of 8 in planar mode and the per-group sparseness
is not as large, but it still averages about 40% with the current
9x13 mouse cursor.  The average drawing time is reduced by about this
amount (from 22 usec constant to 12.5 usec average on Haswell).

This optimization is relatively larger with larger cursors.  Width 10
requires 6 frame buffer accesses per line instead of 4 if not done
sparsely, but rarely more than 4 if done sparsely.
2017-04-14 14:00:13 +00:00
Bruce Evans
ddac85e5a0 Further unobfuscate the method of drawing the mouse cursor in vga planar
mode.

Don't manually unroll the 2 inner loops.  On Haswell, doing so gave a
speedup of about 0.5% (about 4 cycles per iteration out of 1400), but
hard-coded a limit of width 9 and made better better optimizations
harder to see.  gcc-4.2.1 -O does the unrolling anyway, unless tricked
with a volatile hack.  gcc's unrolling is not very good and gives a
a speedup of about half as much (about 2 cycles per iteration).  (All
timing on i386.)

Manual unrolling was only feasible because the inner loop only iterates
once or twice.  Usually twice, but a dynamic check is needed to decide,
and was not moved from the second-innermost loop manually or by gcc.
This commit basically adds another dynamic check in the inner loop.

Cursor widths of 10-17 require 3 iterations in the inner loop and this
is not so easy to unroll -- even gcc stops at 2.
2017-04-14 12:03:34 +00:00
Pyun YongHyeon
d2c2bbeaee Remove dead code. 2017-04-14 08:27:42 +00:00
Pyun YongHyeon
f9beb16729 Don't overwrite mapped bits.
Found by:	PVS-Studio
2017-04-14 08:11:50 +00:00
Pyun YongHyeon
9935c65a28 Remove unnecessary assignment.
Found by:	PVS-Studio
2017-04-14 07:27:23 +00:00
Sepherosa Ziehau
1e85137841 hyperv/kvp: Remove always false condition.
Reported by:	PVS
MFC after:	3 days
Sponsored by:	Microsoft
2017-04-14 05:29:27 +00:00
Sepherosa Ziehau
e25942b0eb hyperv/storvsc: Use ULL for 64bits value shift.
Reported by:	PVS
MFC after:	3 days
Sponsored by:	Microsoft
2017-04-14 05:25:21 +00:00
Sepherosa Ziehau
7737abe4f2 hyperv/kbd: Remove unnecessary assignment.
Reported by:	PVS
MFC after:	3 days
Sponsored by:	Microsoft
2017-04-14 05:18:42 +00:00
Pyun YongHyeon
8d16945419 Remove unnecessary check aginst NULL. txp_ext_command() with
TXP_CMD_WAIT argument allocates a response buffer.  If the allocation
fails, txp_ext_command() returns an error and it's handed in caller.

Found by:	PVS-Studio
2017-04-14 03:23:03 +00:00
Pyun YongHyeon
90b45a3200 Remove unnecessary comparison.
Found by:	PVS-Studio
2017-04-14 02:33:26 +00:00
Pyun YongHyeon
857b699d7e Fix a potentially forever loop.
Found by:	PVS-Studio
2017-04-14 02:24:02 +00:00
Jung-uk Kim
bae56e46c4 Attempt to clear logos more thoroughly.
PR:		202288
Reviewed by:	cem
2017-04-13 23:00:26 +00:00
Navdeep Parhar
0a600b6312 cxgbe: Query some more RDMA related parameters from the firmware.
MFC after:	3 days
Sponsored by:	Chelsio Communications
2017-04-13 17:16:36 +00:00
Alexander Motin
35e492f3bd Update list of Conexant and Realtek codecs.
MFC after:	2 weeks
2017-04-13 14:40:48 +00:00
Conrad Meyer
b4cb6e275e drm2: Add some missing PCIIDs for some Haswell systems
Submitted by:	Jia-Shiun Li <jiashiun at gmail.com>
2017-04-13 01:56:15 +00:00
David C Somayajulu
d6d22a0555 Fix rss_ind_table entry for num_funcs > 1
MFC after:3 days
2017-04-13 01:17:49 +00:00
Bruce Evans
1b986d6aea Improve drawing of the vga planar mode mouse image a little. Unobfuscate
the method a lot.

Reduce the AND mask to the complement of the cursor's frame, so that area
inside the frame is not drawn first in black and then in lightwhite.  The
AND-OR method is only directly suitable for the text mouse image, since
it doesn't go to the hardware there.  Planar mode Mouse cursor drawing
takes 10-20 usec on my Haswell system (approx. 100 graphics accesses
at 130 nsec each), so the transient was not visible.

The method used the fancy read mode 1 and its color compare and color
don't care registers with value 0 in them so that all colors matched.
All that this did was make byte reads of frame buffer memory return 0xff,
so that the x86 case could obfuscate read+write as "and".  The read must
be done for its side effect on the graphics controller but is not used,
except it must return 0xff to avoid affecting the write when the write
is obfuscated as a read-modify-write "and".  Perhaps that was a good
optimization for 8088 CPUs where each extra instruction byte took as
long as a byte memory access.

Just use read+write after removing the fancy read mode.  Remove x86
ifdefs that did the "and".  After removing the "and" in the non-x86
part of the ifdefs, fix 4 of 6 cases where the shift was wrong.
2017-04-12 20:18:38 +00:00
Bruce Evans
8bae6e480d Fix removal of mouse image by the vga planar renderer in the right border
in unusual cases.  Optimize and significantly clean up removal in this
renderer.  Optimize removal in the vga direct renderer.

Removal only needs to be done in the border (the part with pixels) in
both cases.  The planar renderer used the condition scp->xoff > 0 to
test whether a right border exists.  This actually tests for a left
border, and when the total horizontal border is 8 pixels, rounding gives
only a right border.  This was the unusual broken case.  An example
is easy to configure using something like "vidcontrol -f 8x16 iso-8x16
-g 79x25 MODE_27".

Optimize the planar case a little by only removing 9x13 active pixels
out of 16x16.  Optimize it a lot by not doing anything if there is no
overlap with the border.  Don't unroll the main loop or hard-code so
many assumptions about font sizes in it.  On my Haswell system, graphics
memory and i/o accesses takes about 520 cycles each so optimizations from
unrolling are in the noise.

Optimize the direct case to not do anything if there is no overlap with
the border.  Do a sanity check on the saveunder's coordinates.  This
requires a previous change to pass non-rounded coordinates.
2017-04-12 18:52:06 +00:00
Bruce Evans
ac07ac7c74 Trival style fix to previous commit to add this detail.
The previous commit also fixed the coordinates passed to the mouse
removal renderer.  The coordinates were rounded down to a character
boundary, and thus essentially unusable.  The renderer had to keep
track of the previous position, or clear a larger area.  The latter
is only safe in the border, which is all that needs special handling
anyway.

I think no renderer depends on the bug.  They have the following
handling:
- gfb sparc64: this seems to assume non-rounded coordinates
- gfb other: does nothing (seems to be missing border handling)
- vga text: does nothing (doesn't need border handling)
- vga planar: clears extras in the border, with some bugs.  The fixes
  will use the precise coordinates to optimize.
- vga direct: clears at the previous position with no check that it
  is active, and clears everything.  Checking finds this bug.
- others: are there any?
2017-04-12 17:38:00 +00:00
Bruce Evans
accdee8d46 Fix removing of the mouse image in vga planar mode with 8x8 fonts, and
reduce hard-coded assumptions on font sizes so that the cursor size
can be more independent of the font size.  Moving the mouse in the
buggy mode left trails of garbage.

The mouse cursor currently has size 9x13 in all modes.  This can occupy
2x3 character cells with 8x8 fonts, but the algorithm was hard-coded
for only 2x2 character cells.  Rearrange to hard-code only a maximum
cursor size (now 10x16) and to not hard-code in the logic.  The number
of cells needed is now over-estimated in some cases.

2x3 character cells should also be used in text mode with 8x8 fonts
(except with large pixels, the cursor size should be reduced), but
hard-coding for 2x2 in the implementation makes it not very easy to
expand, and it practice it shifts out bits to reduce to 2x2.

In graphics modes, expansion is easier and there is no shifting out
for 9x13 cursors (but 9 is a limit for hard-coding for 2 8-bit VGA
cells wide).  A previous commit removed the same buggy hard-coding for
removal at a lower level in planar mode.  Another previous commit fixed
the much larger code for lower-level removal in direct mode; this is
independent of the font size so worked for 8x8 fonts.  Text mode always
depended on the higher-level removal here, and always worked since
everything was hard-coded consistently for 2x2 character cells.
2017-04-12 17:06:24 +00:00
Bruce Evans
af032a9dec Fix clobbering of the default attribute and the screen position in
scteken_init().  Move the internals of scteken_sync() into a local
function to help do this.

scteken_init() reset or adjusted the default attribute and screen
position at least 3 and 5 times, respectively.  Warm init shouldn't
do any more than reset the "input" state.
  (scterm-sc.c (which still works after minor editing), only resets
  the escape state and the saved cursor position, and then does a
  nearly-null sync of the current color.)

This mainly broke mode changes, and was most noticeable when the
background color is not teken's default (usually black).  Then the
screen gets cleared in the wrong color.  vidcontrol restores the
default normal attribute and tries to restore the default reverse
attribute.  vidcontrol doesn't clear the screen again after restoring
the attribute(s), and it is too late to do it there without flicker.
Now the default normal attribute is restored before the change affects
the rendering.

When the foreground color is not teken's default, clearing with the
wrong attributes gave strange cursor colors for some cursor types.

The default reverse attribute is not restored since it is unsupported.

2/3 of the clobbering was from 2 resetting window resizing calls.  The
second one is needed to restore the size, but must not reset.  Window
resizing also sanitizes the cursor position, and after the main reset
resets the window size, the cursor row would often be adjusted from
24 to 23 if it were not already reset to 0.  scteken_sync() is good
for restoring the window size and the cursor position in the correct
order, but was unusable at init time since scp->ts is not always
initialized then.  Adjust to use its internals.

I didn't notice any problems from the cursor reset.  The cursor should
be reset, and a previous fix was to reset it consistently a little
later.

Doing nothing for warm init works almost as well, if not better.  It
is not very useful to reset the escape state for mode changes, since
the reset is especially likely to be null then.  The escape state is
most likely to be non-initial and corrupted by its most normal uses
-- sloppy non-atomic output where a context switch or just mixing
stdout with stderr splits up escape sequences.
2017-04-12 16:21:55 +00:00
Andriy Voskoboinyk
6b322760df rtwn: remove out-of-bounds access + fix debug output.
Omit unused rates while initializing / dumping Tx power values.

They were not accessed anywhere (except for debugging), so this is
(mostly) no-op.

Tested with
 * RTL8188EU, STA mode.
 * RTL8812AU, STA mode.

Found by:	PVS-Studio
2017-04-12 07:21:54 +00:00
David C Somayajulu
54064a2fd3 Fix defects reported by Coverity
1. Deadcode in ecore_init_cache_line_size(), qlnx_ioctl() and
	qlnx_clean_filters()
2. ARRAY_VS_SINGLETON issue in qlnx_remove_all_mcast_mac() and
	qlnx_update_rx_prod()

MFC after:5 days
2017-04-12 00:52:09 +00:00
Bruce Evans
f3ac3a6e6f Special rendering methods for removing mouse cursors cannot be removed
like I hoped, since they are needed for removing parts over the border.
Continue fixing bugs in them.

In the vga planar mode renderer, remove removal of the part of the
image over the text window.  This was hard-coded for nearly 8x16 fonts
and in practice didn't remove enough for 8x8 fonts.  This used the
wrong attribute over cutmarked regions.  The caller refreshes with the
correct attribute later, so the attribute bug only caused flicker.
The caller uses the same hard-coding, so the refreshes fix up all the
spots with the wrong attribute, but keep missing the missed spots.
This still gives trails of bits of cursors for cursor motions in the
affected configurations (mainly depth 4 modes with 8x8) fonts.  8x14
fonts barely escape the problem since although the cursor is drawn
as 16x16, its active part is only 9x13 and the active part fits in
the hard-coded 2x2 character cell window for 8x14 fonts.  8x8 fonts
need a 2x3 window.

In the fb non-sparc64 renderer, the buggy image removal was buggier
and was already avoided by returning before it.  Remove it completely
and fix nearby style bugs.  It was essentially the same as for the vga
planar mode renderer (obfuscated by swapping x and y).  This was buggier
since fb should handle more types of hardware so the hard-coding is
wronger.

The remaining fb image removal is also buggier.  It never supported
software cursors drawn into the border, and the hardware cursor is
probably broken by other bugs to be fixed soon.
2017-04-10 06:19:09 +00:00
Alexander Motin
e9da70a35e Fix few minor issues found by Clang Analyzer.
MFC after:	2 weeks
2017-04-09 07:53:31 +00:00
Patrick Kelsey
67d955aab4 Corrected misspelled versions of rendezvous.
The MFC will include a compat definition of smp_no_rendevous_barrier()
that calls smp_no_rendezvous_barrier().

Reviewed by:	gnn, kib
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D10313
2017-04-09 02:00:03 +00:00
Bruce Evans
eeab8fcc4b Quick fix for removal of the mouse cursor in vga direct graphics modes
(that is, in all supported 8, 15, 16 and 24-color modes).  Moving the
mouse cursor while holding down a button (giving cut marking) left a
trail of garbage from misremoved mouse cursors (usually colored
rectangles and not cursor shapes).  Cases with a button not held down
worked better and may even have worked.

No renderer support for removing (software) mouse cursors is needed
(and many renderers don't have any), since sc_remove_mouse_image()
marks for update the region containing the image and usually much
more.  The mouse cursor can be (partially) over as many as 4 character
cells, and removing it in only the 1-4 cells occupied by it would be
best for efficiency and for avoiding flicker.  However,
sc_remove_mouse_image() can only mark a single linear region and
usually marks a full row of cells and 1 more to be sure to cover the
4 cells.  It always does this, so using the special rendering method
just wastes even more time and gives even more flicker.  The special
methods will be removed soon.

The general method always works.  vga_pxlmouse_direct() appeared to
defer to it by returning immediately if !on.  However,
vga_pxlmouse_direct() actually did foot-shooting using a disguised
saveunder method.  Normal order near a mouse move is:
  (1) remove the mouse cursor in the renderer (optional)
  (2) remove the mouse cursor again and refresh the screen over the
      mouse cursor and much more from the vtb.  When the mouse has
      actually moved and a button is down, many attributes in this
      region are changed to be up to date with the new cut marking
  (3) draw the keyboard cursor again if it was clobbered by the update
  (4) draw the mouse cursor image in its new position.
The bug was to remove the mouse cursor again in step (4), before the
drawing it again in (4), using a saveunder that was valid in step (1)
at best.  The quick fix is to use the saveunder in step (1) and not
in step (4).  Using it in step (4) also used it before it was
initialized, initially and after  mode and screen switches.
2017-04-08 10:00:39 +00:00
Bruce Evans
e53fbbe661 Fix removal of the keyboard cursor image in text mode, especially
in the vga renderer.  Removal used stale attributes and didn't try to
merge with the current attribute for cut marking, so special rendering
of cut marking was lost in many cases.  The gfb renderer is too broken
to support special rendering of cut marking at all, so this change is
supposed to be just a style fix for it.  Remove all traces of the
saveunder method which was used to implement this bug.

Fix drawing of the cursor image in text mode, only in the vga
renderer.  This used a stale attribute from the frame buffer instead
of from the saveunder, but did merge with the current attribute for
cut marking so it caused less obvious bugs (subtle misrendering for
the character under the cursor).

The saveunder method may be good in simpler drivers, but in syscons
the 'under' is already saved in a better way in the vtb.  Just redraw
it from there, with visible complications for cut marking and
invisible complications for mouse cursors.  Almost all drawing
requests are passed a flag 'flip' which currently means to flip to
reverse video for characters in the cut marking region, but should
mean that the the characters are in the cut marking regions so should
be rendered specially, preferably using something better than reverse
video.  The gfb renderer always ignores this flag.  The vga renderer
ignored it for removal of the text cursor -- the saveunder gave the
stale rendering at the time the cursor was drawn.  Mouse cursors need
even more complicated methods.  They are handled by drawing them last
and removing them first.  Removing them usually redraws many other
characters with the correct cut marking (but transiently loses the
keyboard cursor, which is redrawn soon).  This tended to hide the
saveunder bug for forward motions of the keyboard cursor.  But slow
backward motions of the keyboard cursor always lost the cut marking,
and fast backwards motions lost in for about 4 in every 5 characters,
depending on races with the scrn_update() timeout handler.  This is
because the forward motions are usually into the region redrawn for
the mouse cursor, while backwards motions rarely are.

Text cursor drawing in the vga renderer used also used a
possibly-stale copy of the character and its attribute.  The vga
render has the "optimization" of sometimes reading characters from the
screen instead of from the vtb (this was not so good even in 1990 when
main memory was only a few times faster than video RAM).  Due to care
in update orders, the character is never stale, but its attribute
might be (just the cut marking part, again due to care in order).

gfb doesn't have the scp->scr pointer used for the "optimization", and
vga only uses this pointer for text mode.  So most cases have to
refresh from the vtb, and we can be sure that the ordering of vtb
updates and drawing is as required for this to work.
2017-04-08 08:24:25 +00:00
Sean Bruno
64c9d60dad bnxt(4): add support for WOL Magic.
Submitted by:	venkatkumar.duvvuru@broadcom.com
Differential Revision:	https://reviews.freebsd.org/D10124
2017-04-07 16:15:50 +00:00
Sean Bruno
60596476cf Move pause frame counter out of struct if_ctx and into struct if_softc_ctx_t
so that we can use it in iflib to detect pause frames.

The igb(4) driver definitely used to use this in its old timer function and
I see no reason to restrict it to that driver only.

Sponsored by:	Limelight Networks
2017-04-07 00:33:03 +00:00
David E. O'Brien
9b6f7440b5 Remove dead code.
The #ifdef __FreeBSD__ section within the OpenBSD tpm_attach() implementation
can never be active.
2017-04-06 22:21:49 +00:00
Ed Maste
4ab072262a remove archaic register keyword from ixgb and ex
Reviewed by:	sbruno
2017-04-06 17:16:41 +00:00
Conrad Meyer
7013b24d32 bwn(4): Fix trivial null dereference
Reported by:	PVS-Studio
Sponsored by:	Dell EMC Isilon
2017-04-06 17:08:59 +00:00
Sean Bruno
8d64ff50b3 tx and rx interrupts are not combined in bnxt(4) and should be handled
independantly.

Submitted by:	venkatkumar.duvvuru@broadcom.com>
Differential Revision:	https://reviews.freebsd.org/D10297
2017-04-06 16:22:54 +00:00
Navdeep Parhar
1c7d0de794 cxgbe/iw_cxgbe: Remove another bad cast. This should have been
included in r316571.

MFC after:	3 days
Sponsored by:	Chelsio Communications
2017-04-06 16:19:19 +00:00
Navdeep Parhar
ba81aae287 cxgbe/iw_cxgbe: Replace a magic constant with something more readable
(and accurate).

T4 and later have an extra bit for page shift so the maximum page size
is 8TB (shift of 12 + 31) instead of 128MB (12 + 15).  This saves space
in the chip's PBL (physical buffer list) when registering very large
memory regions.

MFC after:	3 days
Sponsored by:	Chelsio Communications
2017-04-06 14:50:15 +00:00
Navdeep Parhar
870b2660d4 cxgbe/iw_cxgbe: Remove bad cast that resulted in incorrect length for
memory regions larger than 4GB.

MFC after:	3 days
Sponsored by:	Chelsio Communications
2017-04-06 13:58:59 +00:00
Hans Petter Selasky
c9dd0b48c9 Cleanup the bitmap_xxx() functions in the LinuxKPI:
- Move all bitmap related functions from bitops.h to bitmap.h, similar
  to what Linux does.

- Apply some minor code cleanup and simplifications to optimize the
  generated code when using static inline functions.

- Implement the following list of bitmap functions which are needed by
  drm-next and ibcore:
  - bitmap_find_next_zero_area_off()
  - bitmap_find_next_zero_area()
  - bitmap_or()
  - bitmap_and()
  - bitmap_xor()

- Add missing include directives to the qlnxe driver
  (davidcs@ has been notified)

MFC after:		1 week
Sponsored by:		Mellanox Technologies
2017-04-06 13:30:31 +00:00
Sean Bruno
ec2408187e Don't overrite vf->flags variable at the end of ixgbe(4) ixgbe_add_vf().
Found by PVS-Studio Static code analyzer.

PR:		217748
Submitted by:	razmyslov@viva64.com
MFC after:	1 week
2017-04-05 22:01:49 +00:00
Sean Bruno
6916de8666 Fix a double free in ixgbe_rxeof()
Submitted by:	rstone
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D10255
2017-04-05 19:52:49 +00:00
Sepherosa Ziehau
b3b75d9c84 hyperv/hn: Fixat RNDIS rxfilter after the successful RNDIS init.
Under certain conditions on certain versions of Hyper-V, the RNDIS
rxfilter is _not_ zero on the hypervisor side after the successful
RNDIS initialization, which breaks the assumption of any following
code (well, it breaks the RNDIS API contract actually).  Clear the
RNDIS rxfilter explicitly, drain packets sneaking through, and drain
the interrupt taskqueues scheduled due to the stealth packets.

Reported by:	dexuan@
MFC after:	3 days
Sponsored by:	Microsoft
Differential Revision:	https://reviews.freebsd.org/D10230
2017-04-05 08:25:22 +00:00
Sepherosa Ziehau
498ef762ec hyperv/storvsc: Fixup SRB status.
This unbreaks GEN2 Hyper-V cd support.

Submitted by:	Hongjiang Zhang <honzhan microsoft com>
Reviewed by:	dexuan@
MFC after:	3 days
Sponsored by:	Microsoft
Differential Revision:	https://reviews.freebsd.org/D10212
2017-04-05 08:15:47 +00:00
Sepherosa Ziehau
3f1b91c58d hyperv/kbd: Add support for synthetic keyboard.
Synthetic keyboard is the only supported keyboard on GEN2 Hyper-V.

Submitted by:	Hongjiang Zhang <honzhan microsoft com>
MFC after:	1 week
Sponsored by:	Microsoft
Differential Revision:	https://reviews.freebsd.org/D10196
2017-04-05 05:01:23 +00:00
Navdeep Parhar
3128b167ed cxgbe(4): Program the global RSS key once instead of once per ifnet.
MFC after:	3 days
Sponsored by:	Chelsio Communications
2017-04-04 23:14:03 +00:00
Sean Bruno
fd70242dbc no_desc_avail is tracked in iflib now making this redundant.
Sponsored by:	Limelight Networks
2017-04-04 16:54:46 +00:00
David C Somayajulu
11e25f0da3 Add 25/40/100Gigabit Ethernet Driver version v1.3.0 for Cavium Inc's.
Qlogic 45000 Series Adapters

MFC after:2 weeks
2017-04-04 06:16:59 +00:00
Justin Hibbits
2fad65cfa0 Don't calltsec_receive_intr_locked() from the error interrupt handler.
The tsec_error_intr_locked() is called with the global lock owned (e.g.
the transmit and the receive lock are both owned).  We must not call
tsec_receive_intr_locked() while owning the transmit lock.  The normal
receive interrupt takes care that frames are received, this is none of
the business of the error interrupt.

Submitted by:	Sebastian Huber <sebastian.huber_AT_embedded-brains.de>
2017-04-04 02:55:55 +00:00
Justin Hibbits
2c0dbbcb8a Defragment the transmit mbuf chain only if necessary.
Use a method similar to the if_dwc driver.  Use a wmb() before the flags of the
first transmit buffer of a frame are written.

Group transmit/receive structure members for better cache efficiency.

Tested on P1020RDB.  TCP transmit throughput increases from 60MiB/s to
90MiB/s.

Submitted by:	Sebastian Huber <sebastian.huber_AT_embedded-brains.de>
2017-04-04 02:48:27 +00:00
Justin Hibbits
72b58db80f Fix mis-manual merge.
Timeout is now effectively a boolean rather than a time-remaining.  This was
missed in r316478, but included in the original patch (mis-merged with a manual
merge).
2017-04-04 02:37:41 +00:00
Justin Hibbits
b11512cc9c Fix set-but-not-used warnings
Submitted by:	Sebastian Huber <sebastian_DOT_huber_AT_embedded-brains_DOT_de>
2017-04-04 00:46:48 +00:00
Justin Hibbits
88011b597f Use a common tsec_mii_wait() function to busy wait for status changes.
The status indicators are not set immediatly after a command.  Discard
the first value.

Unlock the PHY mutex after a timeout in tsec_init_locked().

Tested on the P1020RDB.

Submitted by:	Sebastian Huber <sebastian_DOT_huber_AT_embedded-brains_DOT_de>
2017-04-04 00:43:09 +00:00
Sean Bruno
548b549ade Remove unsafe and non-functional DDB functions that I added long ago
for debugging.
2017-04-03 21:19:12 +00:00
Sean Bruno
c45420ccac Remove rx_processing_limit sysctl and now orphaned function em_set_sysctl_value
Sponsored by:	Limelight Networks
2017-04-03 21:17:57 +00:00
Andriy Voskoboinyk
c422c270b5 iwn: use correct mask for queue ids (0xf -> 0x1f). 2017-04-02 13:24:58 +00:00
Gavin Atkinson
3f4760c8e1 Add IDs for several missing Intel SMBus controllers.
Obtained from:	Data sheets, Linux defines, local hardware
MFH:		2 weeks
2017-04-02 11:36:25 +00:00
Alexander Motin
7e907868b3 Add IDs for Intel Cougar Point USB 2.0 controller.
MFC after:	1 week
2017-04-02 11:32:05 +00:00
Bruce Evans
3a98d83edb Reset the DAC to 6-bit mode before calling the BIOS to set the screen
mode.  This works around bugs in at least 2 Intel BIOSes for our
subsequent setting of the DAC back to 8-bit mode.  The bug caused dark
(mostly 1/4-intensity) colors for all except the first setting to a
VESA graphics mode (including for settings to the current mode).

Remove restoration (with less bits) of the palette in vesa_unload()
after resetting the DAC to 6-bit mode.  Depend on the BIOS to keep
the palette consistent with the DAC for the simpler reset case like
we do everywhere else in places that are actually important.

Setting the video mode should reset everything to defaults, although
we usually don't want that.  Even the buggy BIOSes set the DAC to the
default 6-bit mode, and set the palette to a default that matches the
DAC.  We don't undo the reset for most things, but we do undo it for
the DAC (more precisely, we change to an 8-bit DAC if possible, and
this is the only way that we set to an 8-bit DAC; it is accidental
that if the DAC was in 8-bit mode from a previous mode switch then
setting it to 8-bit mode is an undo).  The buggy BIOSes are confused
by our setting of the DAC to 8-bit mode in the "undo" case.  They
should multiply palette entries by 4 to match, but they actually leave
all palette entries except #2 (green) and #248-255 (unused) untouched.
Green is mysteriously scaled from 0x2a to 0x6a, and #248-255 are scaled
correctly.

Our support for the 8-bit DAC had almost no effect except to enable
bugs.  Syscons barely supports 16 colors, so it doesn't benefit much
from having a palette with 16 million colors instead of only 256K.
Applications can manage the palette using FBIO_{GET,SET}PALETTE, but
the palette managed by this is only used in the less interesting modes
(text and non-truecolor graphics modes up to 8 bits wide), and the
kernel loses the changes on any mode switch (including to another vt
in a different mode).
2017-04-02 08:39:32 +00:00
Justin Hibbits
6e1c39e9b2 Use the newly added mpc85xx_get_system_clock()
Simplify the platform clock acquisition by using the new helper function.
2017-04-01 22:35:03 +00:00
Zbigniew Bodek
19fbe8bdbc Rework BGX detection to support both new and old firmware
Improve existing BGX detection and adjust it to support both
new and older ThunderX firmwares. Match BGX FDT nodes by name
and reg. Match PHY instances by qlm-mode and name.
Tested on Firmware Version: 2016-09-30 09:12:11

Obtained from:	Semihalf
Differential Revision:	https://reviews.freebsd.org/D9863
2017-03-31 18:04:34 +00:00
Kevin Lo
0642eac437 Add support for ThingM blink(1) notification LED to uled(4). 2017-03-31 08:20:59 +00:00
David C Somayajulu
a7c62c116c Add support for optional Soft LRO
MFC after:5 days
2017-03-30 22:43:32 +00:00
Gavin Atkinson
255bba06cf ichsmb: switch device_probe() from a large case statement to a lookup table.
The case statement was getting unmanageably large, and I'm about to add
several more devices to it.

MFC after:	2 weeks
2017-03-29 23:13:04 +00:00
David C Somayajulu
9986117559 Upgrade firmware and other related files to version 5.4.64 2017-03-29 23:00:07 +00:00
Navdeep Parhar
a6bef5c275 cxgbe: Don't call t4_edc_err_read for errors not related to the EDCs.
MFC after:	3 days
Sponsored by:	Chelsio Communications
2017-03-29 19:25:31 +00:00
Bruce Evans
912da69951 The switch to kernel terminal context needs to update more than the cursor
position.  Especially the screen size, and potentially everything except
the input state and attributes.  Do this by changing the cursor position
setting method to a general syncing method.

Use proper constructors instead of copying to create kernel terminal
contexts.  We really want clones and not new instances, but there is
no method for cloning and there is nothing in the active instance that
needs to be cloned exactly.

Add proper destructors for kernel terminal contexts.  I doubt that the
destructor code has every been reached, but if it was then it leaked the
memory of the clones.

Remove freeing of statically allocated memory for the non-kernel terminal
context for the same terminal as the kernel.  This is in the nearly
unreachable code.  This used to not happen because delicate context
swapping made the user context use the dynamic memory and kernel
context the static memory.  I didn't restore this swapping since it
would have been unnatural to have all kernel contexts except 1 dynamic.

The constructor for terminal context has bad layering for reasons
related to the bug.  It has to return static memory early before
malloc() works.  Callers also can't allocate memory until after the
first constructor selects an emulator and tells upper layers the size
of its context.  After that, the cloning hack required the cloning
code to allocate the memory, but for all other constructors it would
be better for the terminal layer to allocate and deallocate the
memory in all cases.

Zero the memory when allocating terminal contexts dynamically.
2017-03-29 14:46:26 +00:00
Navdeep Parhar
ce22fbcf83 cxgbe/iw_cxgbe: T6 has no limit on the amount of memory that can be
registered in one ib_reg_phys_mr.
2017-03-28 23:39:11 +00:00
Andriy Voskoboinyk
350086f249 iwn: remove unneeded cast. 2017-03-28 22:40:51 +00:00
Andriy Voskoboinyk
50e04f492d iwn: drop duplicate synchronization requests.
Rx descriptor / payload is already synchronized in iwn_notif_intr()
(before accessing desc->type / desc->qid fields).

Tested with Intel 6205, STA mode.
2017-03-28 22:31:48 +00:00
Gavin Atkinson
44f3702036 Remove #define PCIS_SERIALBUS_SMBUS_PROGIF, unused since r200091 2017-03-28 21:54:36 +00:00
Navdeep Parhar
74308c6816 cxgbe/iw_cxgbe: Defer the handling of error CQEs and RDMA_TERMINATE to
the thread that deals with socket state changes.  This eliminates
various bad races with the ithread.

Submitted by:	KrishnamRaju ErapaRaju @ Chelsio (original version)
MFC after:	3 days
Sponsored by:	Chelsio Communications
2017-03-27 22:00:03 +00:00
Michael Zhilin
bf73b5a299 [etherswitch] add support for Marvell 88E6065 ethernet switch incl. 802.1q
This patch brings 802.1q support for Marvell 88E606x ethernet switches.
Test is done on 88E6065 chip (Aterm WR1200).

Submitted by:	Hiroki Mori <yamori813@yahoo.co.jp>
Reviewed by:	mizhka
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D10144
2017-03-27 19:06:29 +00:00
Sean Bruno
935ca1ae7c Access *correct* ifp data structure when debug sysctl is invoked.
Submitted by:	Kevin Bowling <kevin.bowling@kev009.com>
Sponsored by:	Limelight Networks
Differential Revision:	https://reviews.freebsd.org/D10126
2017-03-27 15:08:02 +00:00
Sean Bruno
a066d74b07 Change the default rss_type to M_HASHTYPE_OPAQUE_HASH.
Submitted by:	Venkat Duvvuru <venkatkumar.duvvuru@broadcom.com>
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D9905
2017-03-27 14:55:23 +00:00
Andriy Voskoboinyk
7beeab43a1 iwm: fix build without IWM_DEBUG.
Reported by:	O. Hartmann <ohartmann@walstatt.org>
Reviewed by:	adrian
Differential Revision:	https://reviews.freebsd.org/D10146
2017-03-27 07:02:27 +00:00
Navdeep Parhar
dee33b4bd5 cxgbe/iw_cxgbe: Remove unused code.
MFC after:	3 days
2017-03-27 03:11:51 +00:00
Andriy Voskoboinyk
53d5e4e71c iwn: fix debug message 2017-03-26 18:06:51 +00:00
Andriy Voskoboinyk
60ff4558ee iwn: fix error handling for one well-known corner case. 2017-03-26 17:59:51 +00:00
Andriy Voskoboinyk
d25646a482 iwn: drop unneeded bus_dmamap_sync() calls.
1) They are using wrong tag (Tx) + map (Rx) combination.
2) Rx descriptor is already synchronized in iwn_notif_intr()
3) It's not needed for transmitted data since device does not change
mbuf contents.

Tested with Intel 6205 (amd64), STA mode.
2017-03-26 16:46:39 +00:00
Bruce Evans
89a1e6c3eb Fix 3 entries in mode tables related to mono and 90-column text modes.
Newer VGAs don't support any mono modes, but bugs in the tables created
2 virtual mono modes (#45 90x43 and #112 80x43) that behaved more
strangely than crashing.  90-column modes are tweaked 80-column ones
and also fail to work on newer VGAs.  #45 did crash (hang) on some
hardware.
2017-03-26 14:31:29 +00:00
Bruce Evans
d91400bf98 Restore switching to a separate kernel terminal "input" state and extend
it to a separate state for each CPU.

Terminal "input" is user or kernel output.  Its state includes the current
parser state for escape sequences and multi-byte characters, and some
results of previous parsing (mainly attributes), and in teken the cursor
position, but not completed output.  This state must be switched for kernel
output since the kernel can preempt anything, including itself, and this
must not affect the preempted state more than necessary.  Since vty0 is
shared, it is necessary to affect the frame buffer and cursor position and
history, but escape sequences must not be affected and attributes for
further output must not be affected.

This used to work.  The syscons terminal state contained mainly the parser
state for escape sequences and attributes, but not the cursor position,
and was switched.  This was first broken by SMP and/or preemptive kernels.
Then there should really be a separate state for each thread, and one more
for ddb, or locking to prevent preemption.  Serialization of printf() helps.
But it is arcane that full syscons escape sequences mostly work in kernel
printf(), and I have never seen them used except by me to test this fix.
They worked perfectly except for the races, since "input" from the kernel
was not special in any way.

This was broken to use teken.  The general switch was removed, and the
kernel normal attribute was switched specially.  The kernel reverse
attribute (config option SC_CONS_REVERSE_ATTR) became unused, and is
still unusable because teken doesn't support default reverse attributes
(it used to only be used via the ANSI escape sequence to set reverse
video).

The only new difficulty for using teken seems to be that the cursor
position is in the "input" state, so it must be updated in the active
input state for each half of the switch.  Do this to complete the
restoration.

The per-CPU state is mainly to make per-CPU coloring work cleanly, at
a cost of some space.  Each CPU gets its own full set of attribute
(not just the current attribute) maintained in the usual way.  This
also reduces races from unserialized printf()s.  However, this gives
races for serialized printf()s that otherwise have none.  Nothing
prevents the CPU doing the a printf() changing in the middle of an
escape sequence.
2017-03-26 13:03:16 +00:00
Andriy Voskoboinyk
15044a59f3 iwn: deduplicate code in iwn_tx_data() and iwn_tx_data_raw().
Some code was additionally moved for (future) lock splitting.

Tested with Intel 6205, STA mode.

Differential Revision:	https://reviews.freebsd.org/D10106
2017-03-26 09:41:08 +00:00
Andriy Voskoboinyk
b4750b8855 iwn: omit unneeded bus_dmamap_sync() calls when compiled without
'options IWN_DEBUG'
2017-03-26 09:10:01 +00:00
Andriy Voskoboinyk
7d6a0b8e00 iwn: fix return code conflict in iwn_init_locked()
Do not try to use errno(2) codes here; instead, just return unique
value (1) when radio is disabled via hardware switch and another
one (-1) for any other error in initialization path.

Tested with Intel 6205, STA mode.
2017-03-25 22:07:21 +00:00
Sean Bruno
e407efca16 Add ids for ALC233 found on Intel Skull Mountain NUC. 2017-03-25 19:12:09 +00:00
Andriy Voskoboinyk
64b92f2691 iwn: do not try to update node configuration when the node does not exist.
Firmware will just respond with status '0x8' (node does not exist) or
will hang -> cause 'device timeout's (sometimes).
2017-03-25 15:57:47 +00:00
Andriy Voskoboinyk
8972534f35 iwn: add few missing notification types into iwn_intr_str() 2017-03-25 13:15:43 +00:00
Adrian Chadd
6c3c52590e [iwm] Add the BSS's basic rates to iwm's LQ command, not all the rates.
Makes the firmware use appropriate Tx rates for ACKs.

Obtained from: dragonflybsd.git ab1d3efc208e797c1e09759cd506c95c0aeaa06e
2017-03-25 02:55:13 +00:00
Adrian Chadd
cd20383e4a [iwm] Enable Energy Based Scan (EBS).
This can significantly reduce scan duration thus saving time and power.
EBS failure reported by FW disables EBS for current connection. It is
re-enabled upon new connection attempt on any WLAN interface.

Obtained from:	dragonflybsd.git 89f579e9823a5c446ca172cf82bbc210d6a054a4
2017-03-25 02:49:20 +00:00
Adrian Chadd
5f00681c7d [iwm] GC unused code from if_iwm_scan.c, copyied from iwn or iwlwifi/dvm.
Obtained from:	dragonflybsd.git 10881df269b93c26e5ee6af629c36db5672e6e52
2017-03-25 02:44:25 +00:00
Adrian Chadd
8d3bbea007 [iwm] Tiny cleanup in iwm_rx_addbuf().
Obtained from:	dragonflybsd.git 3370bc5504ebb3c1b9bb960a185cd0c8052a2845
2017-03-25 02:42:52 +00:00
Navdeep Parhar
4aff1c38d1 cxgbe/iw_cxgbe: allocations that use GFP_KERNEL (which is M_WAITOK on
FreeBSD) cannot fail.

MFC after:	3 days
2017-03-25 02:28:21 +00:00
Navdeep Parhar
d4ce83cd36 cxgbe/iw_cxgbe: alloc_ep expects a gfp_t, and it's always ok to sleep during
alloc_ep.
2017-03-25 01:45:04 +00:00
Navdeep Parhar
a8d61a0a7b cxgbe/iw_cxgbe: c4iw_connect should always returns a -ve errno on failure.
MFC after:	3 days
2017-03-25 01:38:17 +00:00
Alexander Motin
00be964c08 Add brackets to fix incorrect macro expansion.
Reported by:	Andreas Hollmann / PVS-Studio
MFC after:	2 weeks
2017-03-24 16:26:11 +00:00
Alexander Motin
7e31684ea4 Unify initiator and target DMA setup and command sending.
The code is so alike that it is pointless to keep it separate.

MFC after:	2 weeks
2017-03-24 14:44:03 +00:00
Sean Bruno
cb101e1257 Add missing 'else' to conditional. This doesn't really affect the code
flow or configuration in any way.
2017-03-24 14:27:29 +00:00
Sean Bruno
fdb25f38cb Add missing 'else' to 3-state conditional during setup of interrupts.
We don't want to overwrite the 82574 interrupt setup with a different
configuration.

PR:		218041
Submitted by:	razmyslov@viva64.com
2017-03-24 14:25:56 +00:00
Kevin Lo
dd4b1792c7 Don't initialize if_output to ether_output(), ether_ifattach() does it for
us already.  While here, remove NOTYET code since if_watchdog is no longer
used.

Reviewed by:	royger
MFC after:	3 days
2017-03-24 01:23:07 +00:00
Landon J. Fuller
4cb7084e29 Add Northstar/BCM4706 core ID for ChipCommon.
Approved by:	adrian (mentor, implicit)
2017-03-23 22:14:08 +00:00
Landon J. Fuller
5658bc0a95 Add a workaround for the BCM4706's dangling core region EROM entries.
Approved by:	adrian (mentor, implicit)
2017-03-23 22:12:14 +00:00
Alexander Motin
961da6389a isp field in struct isp_pcmd is also unused.
MFC after:	2 weeks
2017-03-23 21:18:10 +00:00
Alexander Motin
96ae113f37 Remove write-only crn field from struct isp_pcmd.
MFC after:	2 weeks
2017-03-23 21:11:55 +00:00
Landon J. Fuller
591e79bc76 [mips/broadcom]: Early boot NVRAM support
Add support for early boot access to NVRAM variables, using a new
bhnd_nvram_data_getvar_direct() API to support zero-allocation direct
reading of NVRAM variables from a bhnd_nvram_io instance backed by the
CFE NVRAM device.

Approved by:	adrian (mentor)
Differential Revision:	https://reviews.freebsd.org/D9913
2017-03-23 19:29:12 +00:00
Andriy Gapon
48ff53e324 aacraid: rework r315083 for a clean build with and without AACRAID_DEBUG
r315083 essentially reverted r263954 which was made for a good reason,
but didn't take into account AACRAID_DEBUG.
Now both types of build should be clean.

MFC after:	5 days
No MFC to:	stable/10
2017-03-23 11:59:17 +00:00
Adrian Chadd
a00bfbb19d [iwm] Make ucode capabilities and api flags handling more like iwlwifi.
Obtained from:	dragonflybsd.git 757eecf0e6c92745aa2eee95811e573c8300850e
2017-03-23 04:50:38 +00:00
Adrian Chadd
d045c744f1 [iwm] Remove a couple of unneeded IWM_UCODE_TLV_FLAGS_* flags.
* All the supported firmwares have these flags set.

* This removes the following flags:
  IWM_UCODE_TLV_FLAGS_PM_CMD_SUPPORT,
  IWM_UCODE_TLV_FLAGS_NEWBT_COEX,
  IWM_UCODE_TLV_FLAGS_BF_UPDATED,
  IWM_UCODE_TLV_FLAGS_D3_CONTINUITY_API,
  IWM_UCODE_TLV_FLAGS_STA_KEY_CMD,
  IWM_UCODE_TLV_FLAGS_DEVICE_PS_CMD,
  IWM_UCODE_TLV_FLAGS_SCHED_SCAN,
  IWM_UCODE_TLV_FLAGS_RX_ENERGY_API,
  IWM_UCODE_TLV_FLAGS_TIME_EVENT_API_V2

* Also remove definitions and code for dealing with the v1 time-event api.

* Remove unneeded calc_rssi() function.

Obtained from:	dragonflybsd.git d078c812418d0e2c3392e99fa25fc776d07bdfad
2017-03-23 04:43:04 +00:00
Adrian Chadd
51c2814518 [iwm] Move mbuf hacks after sanity checks in iwm_mvm_rx_rx_mpdu().
* This avoids leaving the mbuf in a weird state, when dropping a packet.

Obtained from:	dragonflybsd.git 96eaecf93d9f731459a0df8efc72cfad034320bd
2017-03-23 04:34:25 +00:00
Adrian Chadd
6d218ca4c9 [iwm] Get rid of struct iwm_rx_data argument for iwm_mvm_rx_rx_mpdu.
Obtained from:	dragonflybsd.git b5cdd8067951dc90271ab104ef555b3b5a4d5d5a
2017-03-23 04:33:15 +00:00
Peter Grehan
e9517d2481 Bring the handling of the y axis in the ums driver in-line with the other
axes.

No functional change.

Submitted by:	Vicki Pfau (vi AT endrift.com)
Approved by:	hps
MFC after:	3 days
Differential Revision:	https://reviews.freebsd.org/D9595
2017-03-22 17:06:57 +00:00
Alexander Motin
ea8e769e42 Switch from using periph_links to sim_links.
periph_links field belongs to periph drivers and must not be used here.

MFC after:	2 weeks
2017-03-22 11:06:33 +00:00
Alexander Motin
2d24b6af63 Cleanup response queue processing.
MFC after:	2 weeks
2017-03-22 08:56:03 +00:00
Alexander Motin
cf8242898d Remove another remnants left after r246713.
MFC after:	2 weeks
2017-03-21 14:14:11 +00:00
Alexander Motin
97dfdd4efa Remove some dead code left after r246713.
MFC after:	2 weeks
2017-03-21 13:49:43 +00:00
Alexander Motin
31c161a615 Improve command timeout handling.
Let firmware do its best first, and if it can't, try software recovery.
I would remove software timeout handler completely, but found bunch of
complains on command timeout on sparc64 mailing list few years ago, so
better be safe in case of interrupt loss.

MFC after:	2 weeks
2017-03-21 13:10:37 +00:00
Alexander Motin
01728721bf Remove questionable reqp->req_time access.
MFC after:	2 weeks
2017-03-21 11:26:31 +00:00
Alexander Motin
13d9c92192 Clean/unify some macro usage.
MFC after:	2 weeks
2017-03-21 10:34:34 +00:00
Alexander Motin
abdc2e314b Addition to r315579: drop the lock while allocating IRQs.
MFC after:	12 days
2017-03-21 08:56:13 +00:00
Alexander Motin
98339da12a Remove some more dead code.
MFC after:	2 weeks
2017-03-20 20:44:14 +00:00
Landon J. Fuller
a668f3d89e Integrate BCM4706 PMU (rev6) support, derived from the ISC-licensed Broadcom
sbchipc.h and hndpmu.c sources included in the RT-N16 and later firmware
source drops.

Approved by:	adrian (mentor, implicit)
2017-03-20 19:27:35 +00:00
Andriy Voskoboinyk
90589b904f rtwn: fix node id assignment.
Do not assign new id if node is reused.

Tested with RTL8821AU, HOSTAP mode + RTL8188EU, STA mode
(with inactivity timeout == 90)
2017-03-20 08:10:35 +00:00
Marius Strobl
0f34084f95 o Add support for eMMC DDR bus speed mode at 52 MHz to sdhci(4) and
mmc(4). For the most part, this consists of support for:
  - Switching the signal voltage (VCCQ) to 1.8 V or (if supported
    by the host controller) to 1.2 V,
  - setting the UHS mode as appropriate in the SDHCI_HOST_CONTROL2
    register,
  - setting the power class in the eMMC device according to the
    core supply voltage (VCC),
  - using different bits for enabling a bus width of 4 and 8 bits
    in the the eMMC device at DDR or higher timings respectively,
  - arbitrating timings faster than high speed if there actually
    are additional devices on the same MMC bus.

  Given that support for DDR52 is not denoted by SDHCI capability
  registers, availability of that timing is indicated by a new
  quirk SDHCI_QUIRK_MMC_DDR52 and only enabled for Intel SDHCI
  controllers so far. Generally, what it takes for a sdhci(4)
  front-end to enable support for DDR52 is to hook up the bridge
  method mmcbr_switch_vccq (which especially for 1.2 V signaling
  support is chip/board specific) and the sdhci_set_uhs_timing
  sdhci(4) method.

  As a side-effect, this change also fixes communication with
  some eMMC devices at SDR high speed mode with 52 MHz due to
  the signaling voltage and UHS bits in the SDHCI controller no
  longer being left in an inappropriate state.

  Compared to 52 MHz at SDR high speed which typically yields
  ~45 MB/s with the eMMC chips tested, throughput goes up to
  ~80 MB/s at DDR52.

  Additionally, this change already adds infrastructure and quite
  some code for modes up to HS400ES and SDR104 respectively (I did
  not want to add to much stuff at a time, though). Essentially,
  what is still missing in order to be able to activate support
  for these latter is is support for and handling of (re-)tuning.

o In sdhci(4), add two tunables hw.sdhci.quirk_clear as well as
  hw.sdhci.quirk_set, which (when hooked up in the front-end)
  allow to set/clear sdhci(4) quirks for debugging and testing
  purposes. However, especially for SDHCI controllers on the
  PCI bus which have no specific support code so far and, thus,
  are picked up as generic SDHCI controllers, hw.sdhci.quirk_set
  allows for setting the necessary quirks (if required).

o In mmc(4), check and handle the return values of some more
  function calls instead of assuming that everything went right.
  In case failures actually are not problematic, indicate that
  by casting the return value to void.

Reviewed by:	jmcneill
2017-03-19 23:27:17 +00:00
Konstantin Belousov
133cbe3b59 Update the list of cpudev ioctls which require write access.
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2017-03-19 21:25:27 +00:00
Alexander Motin
9abc1e2b0c Remove some useless code.
MFC after:	2 weeks
2017-03-19 21:25:13 +00:00
Konstantin Belousov
3966c3803f Style.
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2017-03-19 21:24:07 +00:00
Andriy Voskoboinyk
2e184b72c3 rtwn: drop unneeded (after r315583) code.
Tested with RTL8188EU, HOSTAP mode + RTL8821AU, STA mode
(fast-frames / A-MSDU).
2017-03-19 20:51:28 +00:00
Alexander Motin
08826086fe Add initial support for multiple MSI-X vectors.
For 24xx and above use 2 vectors (default and response queue).
For 26xx and above use 3 vectors (default, response and ATIO queues).
Due to global lock interrupt hardlers never run simultaneously now, but
at least this allows to save one regitster read per interrupt.

MFC after:	2 weeks
2017-03-19 19:11:40 +00:00
Alexander Motin
9c81a61ee1 Remove hackish code delaying ATIOs to unknown virtual port.
Since we support RQSTYPE_RPT_ID_ACQ, that functionality is only useful
in loop mode, which probably doesn't worth having this hack in 2017.

MFC after:	2 weeks
2017-03-19 13:46:11 +00:00
Alexander Motin
e2a658cb0c Move <= 23xx PDB workaround to generic code.
It is chip-specific and has nothing to do with platform.

MFC after:	2 weeks
2017-03-19 10:28:04 +00:00
Alexander Motin
a41dd87f61 Remove some dead stuff.
MFC after:	2 weeks
2017-03-19 09:36:43 +00:00
Alexander Motin
5a5632c2de Move 24xx RQSTYPE_NOTIFY handling to generic code.
This code has nothing to do with specific platform.

MFC after:	2 weeks
2017-03-19 09:30:03 +00:00
Adrian Chadd
15e58d4d26 [ath] prepare for "correct" group (bcast/mcast) address frame handling and software/hardware queue TID mapping.
When I initially did this 11n TX work in days of yonder, my 802.11 standards
clue was ... not as finely tuned.  One of the things in 802.11-2012 (which
I guess technically was after I did this work, but I'm sure it was like this
in the previous rev?) is that among other traffic classes, three things are
important:

* group addressed frames should be default non-QoS, even if they're QoS frames, and
* group addressed frames should have a seqno out of a different space than the
  per-TID QoS one; and because of this
* group addressed frames, being non-QoS, should never be in the Block-ACK window
  for TX.

Now, net80211 and now this code cheats by using the non-QOS TID, but ideally
we'd introduce a separate seqno space just for multicast/group traffic for
TX and RX comparison.

Later extensions (eg reliable multicast / multimedia) express what one should do
when doing multicast traffic in a TID.  Now, technically we /could/ do group traffic
as QoS traffic and throw it into a per-TID seqno space, but this definitely
introduces ordering issues when you take into account things like CABQ behaviour.
(Ie, if some traffic in the TID goes into the CABQ and some doesn't, because
it's doing a split of multicast and non-multicast traffic, then you have
seqno ordering issues.)

So, until someone implements 802.11vv reliable multicast / multimedia extensions,
group traffic is non-QoS.

Next, software/hardware queue TID mapping.  In the past I believed the WME tagging
of frames because well, net80211 had a habit of tagging things like management
traffic with it.  But, then we also map QoS traffic categories to TIDs as well.
So, we should obey the TID!  But! then it put some management traffic into higher
WME categories too, as those frames don't have QoS TIDs.  But! It'd do things like
put things like QoS action frames into higher WME categories, when they should
be kept in-order with the rest of the traffic for that TID.  So! Given all of this,
the ath(4) driver does overrides to not trust the WME category.

I .. am undoing some of this.  Now, the TID has a 1:1 mapping to the hardware
queue.  The TID is the primary source of truth now for all QoS traffic.
The WME is only used for non-QoS traffic.  This now means that any TID traffic
queued should be consistently queued regardless of WME, so things like the
"TX finished, do more TX" that is occuring right now for transmit handling
should be "better".

The consistent {TID, WME} -> hardware queue mapping is important for
transmit completion.  It's used to schedule more traffic for that
particular TID, because that {many TID}:{1 TXQ} mapping in ath_tx_tid_sched()
is used for driving completion.  Ie, when the hardware queue completes,
it'll walk that list of scheduled TIDs attached to that TXQ.

The eventual aim is to get ready for some other features around putting
some data into other hardware queues (eg for better PS-POLL support,
uAPSD, support, correct-er TDMA support, etc) which requires that
I tidy all of this up in preparation for then introducing further
TID scheduling that isn't linked to a hardware TXQ (likely a per-WME, per-TID
driver queue, and a per-node driver queue) to enable that.

Tested:

* AR9380, STA mode
* AR9380, AR9580, AP mode
2017-03-19 05:00:14 +00:00
Alexander Motin
87b04de6cb Reorganize RQSTYPE_NOTIFY handling for chips <= 23xx.
There were two copies of the code: one in generic code was half-broken, and
another in platform code was never called.  Leave only one in generic code
and working.

MFC after:	2 weeks
2017-03-18 19:27:16 +00:00
Alexander Motin
981ffc4e21 Move RQSTYPE_ABTS_RCVD parsing into generic code.
MFC after:	2 weeks
2017-03-18 17:01:11 +00:00
Alexander Motin
15c62456d1 Extend nt_lun to full 8 byte.
MFC after:	2 weeks
2017-03-18 16:09:36 +00:00
Alexander Motin
98b08fbea5 Remove dead remnants of SPI target.
MFC after:	2 weeks
2017-03-18 15:42:22 +00:00
Alexander Motin
782a8e7ca3 Use isp_target_put_entry() in places where it can be.
This unifies the code and removes some duplication.

MFC after:	2 weeks
2017-03-18 13:42:08 +00:00
Bruce Evans
4eb235fb4f Fix bright colors for syscons, and make them work for the first time
for vt.  Restore syscons' rendering of background (bg) brightness as
foreground (fg) blinking and vice versa, and add rendering of blinking
as background brightness to vt.

Bright/saturated is conflated with light/white in the implementation
and in this description.

Bright colors were broken in all cases, but appeared to work in the
only case shown by "vidcontrol show".  A boldness hack was applied
only in 1 layering-violation place (for some syscons sequences) where
it made some cases seem to work but was undone by clearing bold using
ANSI sequences, and more seriously was not undone when setting
ANSI/xterm dark colors so left them bright.  Move this hack to drivers.

The boldness hack is only for fg brightness.  Restore/add a similar hack
for bg brightness rendered as fg blinking and vice versa.  This works
even better for vt, since vt changes the default text mode to give the
more useful bg brightness instead of fg blinking.

The brightness bit in colors was unnecessarily removed by the boldness
hack.  In other cases, it was lost later by teken_256to8().  Use
teken_256to16() to not lose it.  teken_256to8() was intended to be
used for bg colors to allow finer or bg-specific control for the more
difficult reduction to 8; however, since 16 bg colors actually work
on VGA except in syscons text mode and the conversion isn't subtle
enough to significantly in that mode, teken_256to8() is not used now.

There are still bugs, especially in vidcontrol, if bright/blinking
background colors are set.

Restore XOR logic for bold/bright fg in syscons (don't change OR
logic for vt).  Remove broken ifdef on FG_UNDERLINE and its wrong
or missing bit and restore the correct hard-coded bit.  FG_UNDERLINE
is only for mono mode which is not really supported.

Restore XOR logic for blinking/bright bg in syscons (in vt, add
OR logic and render as bright bg).  Remove related broken ifdef
on BG_BLINKING and its missing bit and restore the correct
hard-coded bit.  The same bit means blinking or bright bg depending
on the mode, and we want to ignore the difference everywhere.

Simplify conversions of attributes in syscons.  Don't pretend to
support bold fonts.  Don't support unusual encodings of brightness.
It is as good as possible to map 16 VGA colors to 16 xterm-16
colors.  E.g., VGA brown -> xterm-16 Olive will be converted back
to VGA brown, so we don't need to convert to xterm-256 Brown.  Teken
cons25 compatibility code already does the same, and duplicates some
small tables.  This is mostly for the sc -> te direction.  The other
direction uses teken_256to16() which is too generic.
2017-03-18 11:13:54 +00:00
Alexander Motin
44a2a27af5 Do some notify acks cleanup.
ISPASYNC_TARGET_NOTIFY_ACK makes no sense without argument.

MFC after:	2 weeks
2017-03-18 10:34:29 +00:00
Marius Strobl
c11bbc7dab Again, fixes regarding style(4), to comments, includes and unused
parameters.
2017-03-17 22:57:37 +00:00
Andrew Turner
83d9fd40d5 Make the default FDT implementation of platform_mp_setmaxid use the cpu
nodes from the DTB by default. This will allow us to enumerate the CPUs
without hard coding the CPU count into code.

Reviewed by:	br
Sponsored by:	ABT Systems Ltd
Differential Revision:	https://reviews.freebsd.org/D9827
2017-03-17 12:45:53 +00:00
Marius Strobl
9dbf8c467e - Adds macros for the content of SDHCI_ADMA_ERR and SDHCI_HOST_CONTROL2
registers.
- Add slot type capability bits. These bits should allow recognizing
  removable card slots, embedded cards and shared buses (shared bus
  supposedly is always comprised of non-removable cards).
- Dump CAPABILITIES2, ADMA_ERR, HOST_CONTROL2 and ADMA_ADDRESS_LO
  registers in sdhci_dumpregs().
- The drive type support flags in the CAPABILITIES2 register are for
  drive types A,C,D, drive type B is the default setting (value 0) of
  the drive strength field in the SDHCI_HOST_CONTROL2 register.

Obtained from:	DragonFlyBSD (9e3c8f63, 455bd1b1)
2017-03-16 22:42:17 +00:00
Marius Strobl
72dec0792a - Add support for eMMC "partitions". Besides the user data area, i. e.
the default partition, eMMC v4.41 and later devices can additionally
  provide up to:
  1 enhanced user data area partition
  2 boot partitions
  1 RPMB (Replay Protected Memory Block) partition
  4 general purpose partitions (optionally with a enhanced or extended
    attribute)

  Of these "partitions", only the enhanced user data area one actually
  slices the user data area partition and, thus, gets handled with the
  help of geom_flashmap(4). The other types of partitions have address
  space independent from the default partition and need to be switched
  to via CMD6 (SWITCH), i. e. constitute a set of additional "disks".

  The second kind of these "partitions" doesn't fit that well into the
  design of mmc(4) and mmcsd(4). I've decided to let mmcsd(4) hook all
  of these "partitions" up as disk(9)'s (except for the RPMB partition
  as it didn't seem to make much sense to be able to put a file-system
  there and may require authentication; therefore, RPMB partitions are
  solely accessible via the newly added IOCTL interface currently; see
  also below). This approach for one resulted in cleaner code. Second,
  it retains the notion of mmcsd(4) children corresponding to a single
  physical device each. With the addition of some layering violations,
  it also would have been possible for mmc(4) to add separate mmcsd(4)
  instances with one disk each for all of these "partitions", however.
  Still, both mmc(4) and mmcsd(4) share some common code now e. g. for
  issuing CMD6, which has been factored out into mmc_subr.c.

  Besides simply subdividing eMMC devices, some Intel NUCs having UEFI
  code in the boot partitions etc., another use case for the partition
  support is the activation of pseudo-SLC mode, which manufacturers of
  eMMC chips typically associate with the enhanced user data area and/
  or the enhanced attribute of general purpose partitions.

  CAVEAT EMPTOR: Partitioning eMMC devices is a one-time operation.

- Now that properly issuing CMD6 is crucial (so data isn't written to
  the wrong partition for example), make a step into the direction of
  correctly handling the timeout for these commands in the MMC layer.
  Also, do a SEND_STATUS when CMD6 is invoked with an R1B response as
  recommended by relevant specifications. However, quite some work is
  left to be done in this regard; all other R1B-type commands done by
  the MMC layer also should be followed by a SEND_STATUS (CMD13), the
  erase timeout calculations/handling as documented in specifications
  are entirely ignored so far, the MMC layer doesn't provide timeouts
  applicable up to the bridge drivers and at least sdhci(4) currently
  is hardcoding 1 s as timeout for all command types unconditionally.
  Let alone already available return codes often not being checked in
  the MMC layer ...

- Add an IOCTL interface to mmcsd(4); this is sufficiently compatible
  with Linux so that the GNU mmc-utils can be ported to and used with
  FreeBSD (note that due to the remaining deficiencies outlined above
  SANITIZE operations issued by/with `mmc` currently most likely will
  fail). These latter will be added to ports as sysutils/mmc-utils in
  a bit. Among others, the `mmc` tool of the GNU mmc-utils allows for
  partitioning eMMC devices (tested working).

- For devices following the eMMC specification v4.41 or later, year 0
  is 2013 rather than 1997; so correct this for assembling the device
  ID string properly.

- Let mmcsd.ko depend on mmc.ko. Additionally, bump MMC_VERSION as at
  least for some of the above a matching pair is required.

- In the ACPI front-end of sdhci(4) describe the Intel eMMC and SDXC
  controllers as such in order to match the PCI one.
  Additionally, in the entry for the 80860F14 SDXC controller remove
  the eMMC-only SDHCI_QUIRK_INTEL_POWER_UP_RESET.

OKed by:	imp
Submitted by:	ian (mmc_switch_status() implementation)
2017-03-16 22:23:04 +00:00
Andrew Turner
86b5c43667 If ofw_bus_msimap fails don't try to use the invalid MSI/MSI-X parent node.
Sponsored by:	ABT Systems Ltd
2017-03-16 17:49:37 +00:00
Bruce Evans
4ca582c4f2 The previous fix didn't ifdef out enough for sparc64 to actually work.
Fix this by using more dynamic initialization with simpler ifdefs for
the machine dependencies.  Find a frame buffer address in a more
portable way that at least compiles on sparc64.
2017-03-16 07:40:33 +00:00
Alexander Motin
d10e4cd0c0 Remove not very useful ATIO/INOT stats.
While there polish respective debug logging.

MFC after:	2 weeks
2017-03-15 19:49:45 +00:00
Navdeep Parhar
94036cfff0 cxgbe/iw_cxgbe: Use the socket and not the toepcb to reach for the
inpcb.  t4_tom detaches the inpcb from the toepcb as soon as the
hardware is done with the connection (in final_cpl_received) but the
socket is around as long as the cm_id and the rest of iWARP state is.

This fixes an intermittent NULL dereference during abort.

Submitted by:	KrishnamRaju ErapaRaju @ Chelsio
MFC after:	3 days
Sponsored by:	Chelsio Communications
2017-03-15 19:10:04 +00:00
Michael Zhilin
4c0fdc5a3d [bhnd] fix mask for PMU control
This patch fixes typo which results in extra bits of PMU control register.

PR:     217782
Submitted by:	Svyatoslav <razmyslov at viva64.com>
Found by:	PVS-Studio
2017-03-15 18:57:18 +00:00
Alexander Motin
0e6bc811e4 Refactor interrupt handling.
Instead of single isp_intr() function doing all possible magic, introduce
four different functions to handle mailbox operation completions, async
events, response and ATIO queues.  The goal is to isolate different code
paths to make code more readable, and to make easier support for multiple
interrupt vectors.  Even oldest hardware in many cases can identify what
code path it should run on interrupt.  Contemporary hardware can assign
them to different interrupt vectors.

MFC after:	2 weeks
2017-03-15 14:58:29 +00:00
Sean Bruno
b207ed2b4a Actually set the MTU to the requested value and fixup handling of jumbo
frames.

Submitted by:	Matt Macy <mmacy@nextbsd.org>
Reported by:	pho
Sponsored by:	Limelight Networks
2017-03-15 14:44:59 +00:00
Alexander Motin
ce9f323727 Fix panic when SIM dereferenced before allocation.
MFC after:	2 weeks
2017-03-15 11:16:26 +00:00
Alexander Motin
b0a66d29b8 Fix ancient bug from r84597, which broke 23xx after r315234.
MFC after:	13 days
2017-03-15 10:33:44 +00:00
Kevin Lo
354d72b4f1 Fix unreachable code in wi_pci_resume().
PR:	217784
Submitted by:	Svyatoslav <razmyslov at viva64.com>
Found by:	PVS-Studio
2017-03-15 09:31:58 +00:00
Eric van Gyzen
40769242ed Add some ntohl() love to r315277
inet_ntoa() and inet_ntoa_r() take the address in network
byte-order.  When I removed those calls, I should have
replaced them with ntohl() to make the hex addresses slightly
less unreadable.  Here they are.

See r315277 regarding classic blunders.

vangyzen: you're deep in "no good deed" territory, it seems
    --badger

Reported by:	ian
MFC after:	3 days
MFC when:	I finally get it right
Sponsored by:	Dell EMC
2017-03-14 20:57:54 +00:00
Konstantin Belousov
d1780e8dac Use atop() instead of OFF_TO_IDX() for convertion of addresses or
addresses offsets, as intended.

Suggested and reviewed by:	alc
Sponsored by:	The FreeBSD Foundation
MFC after:	2 weeks
2017-03-14 19:39:17 +00:00
Alexander Motin
9c2e9bcfbe Remove some dead/broken code paths around async handling
MFC after:	2 weeks
2017-03-14 18:42:33 +00:00
Eric van Gyzen
47d803ea71 KTR: log IPv4 addresses in hex rather than dotted-quad
When I made the changes in r313821, I fell victim to one of the
classic blunders, the most famous of which is: never get involved
in a land war in Asia.  But only slightly less well known is this:
Keep your brain turned on and engaged when making a tedious, sweeping,
mechanical change.  KTR can correctly log the immediate integral values
passed to it, as well as constant strings, but not non-constant strings,
since they might change by the time ktrdump retrieves them.

Reported by:	glebius
MFC after:	3 days
Sponsored by:	Dell EMC
2017-03-14 18:27:48 +00:00
Alexander Motin
6327b0d287 Remove tangled isp_mbox_continue() mechanism.
It was implemented to reduce context switches when uploading firmware to
card's RAM.  But this mechanism is not used last 10 years since all mbox
operations are now polled, and it was never used for cards produced in
last 15 years.  Newer cards can use DMA to upload firmware.

MFC after:	2 weeks
2017-03-14 17:34:44 +00:00
Fabien Thomas
d42aefee43 Fix arm stack frame walking support:
- Adjust stack offset for Clang
- Correctly fill registers for fake stack frame (soft PMC)

MFC after:	1 week
Sponsored by:	Stormshield
Differential Revision:	https://reviews.freebsd.org/D7396
2017-03-14 16:06:57 +00:00
Sean Bruno
883722a43c Restore changes for RSS routing improvements made in 314369 that were
reverted in the IFLIB update I made in 315217.

Submitted by:	Venkat Duvvuru <venkatkumar.duvvuru@broadcom.com>
2017-03-14 13:54:18 +00:00
Alexander Motin
0cbfd9bb18 Remove dangerous and questionable isp_mboxcmd_qnw() call.
MFC after:	2 weeks
2017-03-14 08:45:33 +00:00
Alexander Motin
a1fa02673a Improvements around attach, reset and detach.
This change fixes DMA resource leak on driver unload.  Also it removes
DMA resources allocation for hardcoded number of requests before fetching
the real number from firmware.  Also it prepares ground for more flexible
IRQs allocation according to firmware capabilities.

MFC after:	2 weeks
2017-03-14 08:03:56 +00:00
Alexander Motin
4599b54219 Remove remnant of r315163.
MFC after:	13 days
2017-03-14 06:57:55 +00:00
Sean Bruno
95246abb21 IFLIB updates
- unconditionally enable BUS_DMA on non-x86 architectures
- speed up rxd zeroing via customized function
- support out of order updates to rxd's
- add prefetching to hardware descriptor rings
- only prefetch on 10G or faster hardware
- add seperate tx queue intr function
- preliminary rework of NETMAP interfaces, WIP

Submitted by:	Matt Macy <mmacy@nextbsd.org>
Sponsored by:	Limelight Networks
2017-03-13 22:53:06 +00:00
Conrad Meyer
da1d1cd3fe scif_sas_controller: Fix inverted logic range check
PR:		217742
Submitted by:	Svyatoslav <razmyslov at viva64.com>
Sponsored by:	Viva64 (PVS-Studio)
2017-03-13 17:58:08 +00:00
Navdeep Parhar
73832aae54 cxgbe(4): Fix an always-true assertion (reported by PVS-Studio).
sys/dev/cxgbe/t4_main.c: PVS-Studio: Expression is Always True (CWE-571) (3)

PR:		217746
Submitted by:	Svyatoslav (razmyslov at viva64 com)
MFC after:	1 week
2017-03-13 17:16:29 +00:00
Scott Long
286ab2b514 Add constants and descriptions for some new PCI class definitions 2017-03-13 07:45:15 +00:00
Oleksandr Tymoshenko
5bc8258168 [evdev] Fix Right Alt and Keypad Enter event codes for atkbd(4) and kbdmux(4) drivers
Submitted by:	Vladimir Kondratiev <wulf@cicgroup.ru>
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D9320
2017-03-12 19:28:44 +00:00
Oleksandr Tymoshenko
6bc7e1b21b [evdev] Fix race condition between client's event queue reading and dropping
Submitted by:	Vladimir Kondratiev <wulf@cicgroup.ru>
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D9320
2017-03-12 19:27:44 +00:00
Oleksandr Tymoshenko
670aa764b0 [evdev] Do not ignore result evdev_register in UI_DEV_CREATE handler
Make sure that uinput state field reflects actual state by checking
evdev_register result for errors

Submitted by:	Vladimir Kondratiev <wulf@cicgroup.ru>
Differential Revision:	https://reviews.freebsd.org/D9320
2017-03-12 19:26:24 +00:00
Warner Losh
1c2eb3e8d1 Export the actual LID state via sysctl. This allows more complex
policies about when to suspend based on other events happening AND the
lid being closed through the use of clever devd or other scripts.
2017-03-12 18:00:02 +00:00
Alexander Motin
c44f58fce9 Remove strange config_intrhook_establish() magic.
Interrupts are enabled as part of chip reset just during driver attach.
Later "enabling" of already enabled interrupts is useless.

MFC after:	2 weeks
2017-03-12 16:55:18 +00:00
Alexander Motin
ab23521a49 Try to slight untangle I/O and loop status handling.
MFC after:	2 weeks
2017-03-12 15:36:07 +00:00
Alexander Motin
229203af68 Remove code for unsupported FreeBSD versions.
MFC after:	2 weeks
2017-03-12 14:17:57 +00:00
Ian Lepore
bf8bdd6762 Extend the pl011 small-fifos fix to other SoCs that indicate rev 5
hardware but lack the larger fifos rev 5 hardware should have.

The linux world (where our FDT data comes from) solved this by adding
a new property to pl011 nodes, "arm,primecell-periphid".  When this
property is present, its values override the values in the hardware
periphid registers.  For pl011 rev 5 hardware with small fifos, they
override the id so that it appears to be rev 4 hardware.

The driver now uses the new property when present.  It also continues
to check the device compat string, to handle older fdt data that may
still be in use on existing systems (on RPi systems it is common to
update system software without updating fdt data which is part of the
boot firmware).

Reviewed by:	imp
2017-03-11 22:34:02 +00:00
Andriy Gapon
f0985602f2 aacraid: fix build with AACRAID_DEBUG=2
MFC after:	10 days
2017-03-11 18:40:39 +00:00
Alexander Motin
67445003fb Partially fix target task management requests handling.
- XPT_NOTIFY_ACKNOWLEDGE was not handled, causing stuck requests.
 - XPT_ABORT was not even trying to abort active ATIOs/INOTs.
 - Initiator's tag was not stored and not used where needed.
 - List of TM request types needed update.
 - mpt_scsi_tgt_status() missed some useful debugging.

After this change global TM requests, such as reset, should work properly.
ABORT TASK (ABTS) requests are still not passes to CTL, that is not good
and should be fixed.

MFC after:	2 weeks
2017-03-11 14:25:14 +00:00
Bruce Evans
b8188f52eb Fix the attribute for scteken_clear() (change it back from the user
user default normal attribute to the current attribute).

This change only fixes a logic error.  scterm_clear() used to be
used for terminal reset, but teken uses a general fill function for
that, leaving scterm_clear() only used for initialization and mode
change, when using the user default attribute is correct.  It is not
really a terminal function, but needs to sync its changes with the
terminal layer.  Syncing of the attribute is currently broken for
terminal reset, but works for initialization and mode change.
2017-03-11 13:56:06 +00:00
Bruce Evans
ad530aa98b Add a scteken_set_cursor() (sc to teken) method and use it to fix
some cases of initialization and resetting of the teken cursor position.
(This bad name is consistent with others, but it is too easy to confuse
with scteken_cursor() which goes in the opposite direction.)

The following cases were broken:
- for booting without a syscons console, the teken and sc positions for
  ttyv0 were (0, 0), but are supposed to be somewhere in the middle of
  the screen (after carefully preserved BIOS and loader messages) (at
  least if there is no mode switch that loses the messages).
- after mode switches, the screen is cleared and the cursor is supposed to
  be moved to (0, 0), but it was only moved there for sc.

The following case was hacked to work:
- for booting with a syscons console, it was arranged that scteken_init()
  for the console could see a nonzero cursor position and adjust, although
  this broke the sc seeing it in the non-console case above.
2017-03-11 11:31:06 +00:00
Emmanuel Vadot
4d5bf0bb88 drm(old): Remove i915 and radeon drivers
They cannot be used anymore with the userland bits we provide.
Furthermore, their KMS versions support the same hardware.

Submitted by:	dumbbell
Reviewed by:	emaste, manu
Sponsored by:	AsiaBSDCon
Differential Revision:	https://reviews.freebsd.org/D5614
2017-03-11 03:01:18 +00:00
Alexander Motin
ead3ad6b5c Add PIM_EXTLUNS support to mpt(4).
Target mode is still limited to 256 LUNs due to the way driver is written,
but initiator can now use full 8 byte LUN space.

MFC after:	2 weeks
2017-03-10 14:44:59 +00:00
Bruce Evans
eeb7d30e06 Rename scteken_revattr() to scteken_sc_to_te_attr(). scteken_revattr()
looked like it might handle reverse attributes, but it actually handles
conversion of attributes in the direction indicated by the new name.
Reverse attributes are just broken.

Rename scteken_attr() to scteken_te_to_sc_attr().  scteken_attr() looked
like it might give teken attributes, but it actually gives sc attributes.

Change scteken_te_to_sc_attr() to return int instead of unsigned int.
u_char would be enough, and it promotes to int, and syscons uses int
or u_short for its attributes everywhere else (u_short holds a shifted
form and it promotes to int too).
2017-03-10 14:25:38 +00:00
Alexander Motin
501b16854f Improve residuals reporting in target mode.
MFC after:	2 weeks
2017-03-10 13:39:16 +00:00
Alexander Motin
4461a4a5ed Fix panic on wildcard target LUN disable.
MFC after:	2 weeks
2017-03-10 13:14:06 +00:00
Bruce Evans
8f2cc27067 Start fixing some bugs in attribute handling.
This change just does cleanups missed in r56043 17 years ago.  The
default attributes were still stored in structs for the purpose of
changing them and passing around pointers to the defaults, but r56043
added another layer that made the defaults invariant and only used for
initialization and reset.  Just use the defaults directly.  This was
already done for the kernel defaults.  The defaults for reverse
attributes aren't actually used, but are ignored in layers that no
longer support them.
2017-03-10 11:44:09 +00:00
Alexander Motin
93612a52c7 Fix FC target mode in mpt(4), broken in multiple ways.
- Not set BufferLength caused receive of empty ATIOs.
 - CDB length guessing was broken at least for RC16.
 - mpt_req_untimeout() was called with wrong req parameter.
 - Sense data reporting was broken in several ways.

With this change my LSI7204EP-LC can pass at least basic tests as target.
The code is still far from perfect, but finally I found second hw/driver
after isp(4) that really can work in CAM target mode.

MFC after:	2 weeks
2017-03-10 10:35:52 +00:00
Bruce Evans
1b835e81ca Fix compilation on sparc64. The frame buffer address is in a field that
is unavailable on sparc64 only.  This makes the new ec_putc() a non-op
on sparc64 but still calls it.  On other non-x86 arches, it should
compile but might not work.

Reported by:	gjb
2017-03-10 10:25:48 +00:00
Alexander Motin
471f963d40 Report some more data in XPT_PATH_INQ.
I am not sure they are used anywhere, but why not.

MFC after:	2 weeks
2017-03-09 17:53:37 +00:00
Alexander Motin
555dbebf3d Add support for XPT_GET_SIM_KNOB in FC mode.
MFC after:	2 weeks
2017-03-09 17:35:35 +00:00
Alexander Motin
4f38902fba Report FC link speed.
MFC after:	2 weeks
2017-03-09 17:06:34 +00:00
Alexander Motin
aacbef6cc1 Fix unused variable when built without INVARIANT_SUPPORT.
MFC after:	2 weeks
2017-03-09 07:55:58 +00:00
Oleksandr Tymoshenko
50868fa68b [spigen] make spigen device ready to be compiled as a module
- Add flag to indicate that device is opened by userland
- Replace "always fail" detach method with proper detach implementation

MFC after:	1 week
2017-03-09 01:00:27 +00:00
Andriy Voskoboinyk
9d5228cd85 iwn: add promiscuous mode support.
Tested with Intel 6205, STA / MONITOR modes.
2017-03-08 22:49:22 +00:00
Ian Lepore
43597fd575 Update the comment for the Wacom WACF00e to make it clear it's not an
accidental duplicate of WACF004.

PR:		217306
2017-03-08 20:58:56 +00:00
Ian Lepore
a90beeeb44 Add the pnp id for a Wacom 'WACF00e' tablet.
PR:		217306
Submitted by:	large.hadron.collider@gmx.com
2017-03-08 20:41:27 +00:00
Ian Lepore
2cb357c5cd Handle fifo size differences between older and newer revs of pl011 hardware.
Starting with rev 5 (which is inexplicably indicated by a version number
of '3' in the Peripheral ID register), the pl011 doubled the size of the
rx and tx fifos, to 32 bytes, so read the ID register and set the size
variables in the softc accordingly.

An interesting wrinkle in this otherwise-simple concept is that the
bcm2835 SoC, used in Raspberry Pi systems among others, has the rev 5
pl011 hardware, but somehow also has the older 16-byte fifos.  We check
the FDT data to see if the hardware is part of a bcm283x system and use
the smaller size if so.

Thanks to jchandra@ for pointing out that newer hardware has bigger fifos.
2017-03-08 18:53:32 +00:00