Commit Graph

31612 Commits

Author SHA1 Message Date
Andriy Voskoboinyk
a7c31fe1e9 urtwn, rtwn, rsu: switch to ieee80211_add_channel_list_2ghz().
- Use device's channel list instead of default one (from
ieee80211_init_channels()); adds 12 - 14 2GHz channels.
- Add ic_getradiocaps() method.
2016-05-26 16:39:11 +00:00
Andriy Voskoboinyk
2a06b6b33f urtw: switch to ieee80211_add_channel_list_2ghz().
- Use device's channel list instead of default one (from
ieee80211_init_channels()).
- Add ic_getradiocaps() method.
2016-05-26 16:15:10 +00:00
Andriy Voskoboinyk
0a02496f4b ral: switch to ieee80211_add_channel_list_*()
- Use device's channel list instead of default one (from
ieee80211_init_channels()).
- Add ic_getradiocaps() method.

Added channels:
- 2GHz (all): 12, 13, 14.
- 5GHz:
 * rt2661: 165
 * rt2860: 38, 46, 54, 62, 102, 110, 118, 126, 134, 151, 159, 165, 167,
169, 171, 173.

Differential Revision:	https://reviews.freebsd.org/D6182
2016-05-26 16:05:19 +00:00
Andriy Voskoboinyk
5a62dab132 zyd: switch to ieee80211_add_channel_list_*()
- Use device's channel list instead of default one (adds 12, 13 and 14
2GHz channels).
- Add ic_getradiocaps() method.

Differential Revision:	https://reviews.freebsd.org/D6171
2016-05-26 15:56:27 +00:00
Ian Lepore
c45b842250 Rename gpiobus_map_pin() to gpiobus_acquire_pin(), to better reflect the
fact that the caller is requesting exclusive use of the pin, and also to
better match the inverse operation which is named gpiobus_release_pin().
2016-05-26 15:45:36 +00:00
Andriy Voskoboinyk
83829b483d ural: switch to ieee80211_add_channel_list_*()
- Use device's channel list instead of default one (+ 12, 13 and 14
2GHz channels).
- Add ic_getradiocaps() method.

Differential Revision:	https://reviews.freebsd.org/D6170
2016-05-26 15:12:54 +00:00
Andriy Voskoboinyk
99bb30a9e0 run: switch to ieee80211_add_channel_list_*()
- Use device's channel list instead of default one (from
ieee80211_init_channels()).
- Add ic_getradiocaps() method.

Differential Revision:	https://reviews.freebsd.org/D6144
2016-05-26 15:05:37 +00:00
Andriy Voskoboinyk
354df9d4eb rtwn: replace hardcoded rate indices with their names (similar to r289758).
- Use macros to define rate indices; don't hardcode them in code.
- Add method for 'rate' -> 'rate index' conversion
(and array for the opposite).
- Determine if rate is CCK / OFDM via appropriate macro.

Reviewed by:	adrian
Differential Revision:	https://reviews.freebsd.org/D4837
2016-05-26 14:17:57 +00:00
Andrew Rybchenko
6dd81be2d2 sfxge(4): correct parenthesis location in if coundition
Found by lint on illumos.

Submitted by:   Garrett D'Amore <garrett at damore.org>
Sponsored by:   Solarflare Communications, Inc.
MFC after:      1 week
2016-05-26 13:19:44 +00:00
Edward Tomasz Napierala
bcec64bc61 Add a special case for iSER data tranfers.
Obtained from:	Mellanox Technologies
MFC after:	1 month
Sponsored by:	The FreeBSD Foundation
2016-05-26 12:43:15 +00:00
Edward Tomasz Napierala
4686f1a660 Fix crash on removal of an unconnected iSER session.
MFC after:	1 month
Sponsored by:	The FreeBSD Foundation
2016-05-26 11:40:07 +00:00
Andriy Voskoboinyk
1447d404e0 iwn: add watchdog for scanning.
Restart device if scanning was not done in time.

Tested by:	david@catwhisker.org

PR:		209198
Differential Revision:	https://reviews.freebsd.org/D6176
2016-05-26 11:12:36 +00:00
Jared McNeill
627c360fa7 Enable USB PHY regulators when requested by the host controller driver.
Previously the USB PHY driver would enable all regulators at attach time.
This prevented boards from booting when powered by the USB OTG port, as
it didn't take VBUS presence into consideration.
2016-05-26 10:50:39 +00:00
Edward Tomasz Napierala
95c4a39244 Make iser(4) buildable again by adjusting it for the recent changes
in ICL interface.

 - the ordering of parameters to icl_conn_task_setup is different, so that
   the "cookie" is last.
 - the icl_conn_connected() method is gone, replaced by much simpler mechanism.
   I'd rather keep the ICL interface as small as possible.
 - I don't really like the s/offload/driver/g.  The "tcp" is not a driver;
   "iser" is not really a driver either.  I'd prefer to leave it as it is.
 - the check for ic_session_type_discovery() in iser_conn_handoff() is gone,
   as handoff cannot happen for discovery sessions.
 - ic_session_login_phase() and ic_session_type_discovery() are gone.  If you
   had your handoff method called - you're no longer in either of those.
 - the way maxtags is passed is different; now it's simply ic->ic_maxtags.
   It's cleaner, and the old way would cause weird things to happen if
   fail_on_disconnection=1 and the user changed the maxtags sysctl before
   reconnecting (basically the CAM idea of maxtags would be different from
   iSER one).
 - icl_hba_misc() is gone; declare support for PIM_UNMAPPED by setting
   ic->ic_unmapped flag.
 - the way we find the "iser" ICL module is rewritten - we have a flag
   for icl_register() that says if the module is iSER-capable or not.
 - icl_conn_release() is gone; iser_conn_release() is called from
   iser_conn_free() (no functional change in this case) and at the beginning
   of icl_conn_connect(), to handle reconnection.

MFC after:	1 month
Sponsored by:	The FreeBSD Foundation
2016-05-26 10:30:03 +00:00
Edward Tomasz Napierala
f83f88912d The taskqueue_enqueue_fast() was removed in r296272.
MFC after:	1 month
Sponsored by:	The FreeBSD Foundation
2016-05-26 09:53:24 +00:00
Edward Tomasz Napierala
4814a0a4ce Bring in the Mellanox implementation of iSER (iSCSI over RDMA) initiator,
written by Sagi Grimberg <sagig at mellanox.com> and Max Gurtovoy
<maxg at mellanox.com>.

This code comes from https://github.com/sagigrimberg/iser-freebsd, branch
iser-rebase-11-current-r291993.  It's not connected to the build just yet;
it still needs some tweaks to adapt to my changes to iSCSI infrastructure.

Big thanks to Mellanox for their support for FreeBSD!

Obtained from:	Mellanox Technologies
MFC after:	1 month
Relnotes:	yes
2016-05-26 09:49:29 +00:00
Adrian Chadd
6c6f602b53 [gpiospi] add initial gpio SPI bit bang driver.
Submitted by:	ray
Obtained from:	zrouter
2016-05-26 07:20:33 +00:00
Adrian Chadd
d67fe28ba6 [spigen] add initial spigen driver from green@
This is a simple ioctl and mmap API to issue SPI transactions from
userland.  It's useful for simple devices (eg spi temperature sensors,
etc) for experimentation.

TODO:

* Write some documentation!

Submitted by:	green
2016-05-26 07:02:20 +00:00
Adrian Chadd
055486964b [spibus] implement maximum clock frequency lookup from ofw.
Obtained from:	loos
2016-05-26 06:37:33 +00:00
Adrian Chadd
63b92359c1 [spibus] add missing break.
Pointy hat to: me
2016-05-26 06:36:58 +00:00
Adrian Chadd
f3e8760ff5 [spibus] add initial placeholders for transfer mode and frequency.
This doesn't yet implement it in the controllers or the transfer
calls, but it's a start.

Obtained from:	loos (frequency), ray/zrouter (transfer mode)
2016-05-26 06:35:11 +00:00
Sepherosa Ziehau
2b0bce640b hyperv: Rework guest id settings according to Hyper-V spec
MFC after:	1 week
Sponsored by:	Microsoft OSTC
Differential Revision:	https://reviews.freebsd.org/D6553
2016-05-26 03:50:52 +00:00
Ian Lepore
93ff47244a Add a convenience macro that masks all the bits related to clock divisors
in all versions of the sdhci spec (the HI bits are just unused reserved
bits in earlier versions).
2016-05-26 02:55:41 +00:00
Adrian Chadd
40424a256a [mx25l] add Winbond w25x64 support.
PR:		https://github.com/freebsd/freebsd/pull/16
Submitted by:	https://github.com/epipenau
2016-05-26 01:19:13 +00:00
Adrian Chadd
72ebcd5db5 [bhnd] Fix release of uninitialized SPROM shadow in chipc detach.
This was triggering a panic on detach; the SPROM shadow is now
maintained by the bhnd_sprom_chipc driver, and should be removed
from chipc.

Submitted by:	Landon Fuller <landonf@landonf.org>
Differential Revision:	https://reviews.freebsd.org/D6548
2016-05-26 00:44:16 +00:00
Adrian Chadd
785df0cb3f [bhnd] Integrate bhnd_chipc's BUS_ADD_CHILD() with a child resource mapping table.
This adds support for automatically configuring bhnd_chipc bus children
with associated resources, using an internal 'hints' table based directly
on Michael Zhilin's chipc resource mapping work.

The bhnd_sprom_chipc driver has been converted to use DEVICE_IDENTIFY()
with the new resource table.

This should be nearly drop-in compatible with the child device drivers
in D6250.

Submitted by:	Landon Fuller <landonf@landonf.org>
Reviewed by:	Michael Zhilin <mizhka@gmail.com>
Differential Revision:	https://reviews.freebsd.org/D6525
2016-05-26 00:43:08 +00:00
Hans Petter Selasky
fa201e28fc Prepare for activation of LinuxKPI module parameters as read-only
tunable SYSCTL's. Linux module parameters are associated with the
module they belong to. FreeBSD does not share this concept of a parent
module. Instead add macros which define the prefix to use for the
module parameters in the LinuxKPI consumers.

While at it convert all "bool" LinuxKPI module parameters to "byte"
type, because we don't have a "bool" type of SYSCTL in FreeBSD.

Sponsored by:	Mellanox Technologies
MFC after:	1 week
2016-05-25 12:03:21 +00:00
Hans Petter Selasky
10aab8b611 Check for signals when locking the USB enumeration thread from
userspace, so that USB applications can be killed if an enumeration
thread should be stuck for various reasons.

MFC after:	1 week
2016-05-25 07:48:36 +00:00
Stanislav Galabov
83cb053574 Align radiotap structures in ral(4)
Currently all radiotap structures in ral(4) are packed, but are not
aligned, which causes ral based devices to crash when one does
'ifconfig wlan0 up' for a wlan interface with a ral wlandev on arches
that care about structure alignment (e.g., MIPS).

Adding an aligned attribute helps fix this problem and ral devices
can be properly brought up.

Reviewed by:	adrian
Sponsored by:	Smartcom - Bulgaria AD
2016-05-25 06:29:23 +00:00
Sepherosa Ziehau
dade2a02e3 hyperv: Preserve required bits when disable Hypercall
MFC after:	1 week
Sponsored by:	Microsoft OSTC
Differential Revision:	https://reviews.freebsd.org/D6530
2016-05-25 06:01:47 +00:00
Sepherosa Ziehau
6d6baea80d hyperv/vmbus: Rework SynIC setup and teardown
- Avoid bit fields.
- Fix SINT setup (preserve required bits).

MFC after:	1 week
Sponsored by:	Microsoft OSTC
Differential Revision:	https://reviews.freebsd.org/D6529
2016-05-25 05:53:12 +00:00
Sepherosa Ziehau
c1d5ebc5a4 hyperv/vmbus: Nuke unnecessary MSR read
MFC after:	1 week
Sponsored by:	Microsoft OSTC
Differential Revision:	https://reviews.freebsd.org/D6528
2016-05-25 05:45:43 +00:00
Sepherosa Ziehau
8239b2f287 hyperv/vmbus: Pass vmbus softc to vmbus_synic_setup
MFC after:	1 week
Sponsored by:	Microsoft OSTC
Differential Revision:	https://reviews.freebsd.org/D6527
2016-05-25 05:37:42 +00:00
Sepherosa Ziehau
c4592280be hyperv/vmbus: Minor style and white space cleanup
MFC after:	1 week
Sponsored by:	Microsoft OSTC
Differential Revision:	https://reviews.freebsd.org/D6523
2016-05-25 05:30:48 +00:00
Sepherosa Ziehau
20bce8fa9f hyperv/vmbus: Move two global flags into vmbus softc
And pack them into one flag field.

MFC after:	1 week
Sponsored by:	Microsoft OSTC
Differential Revision:	https://reviews.freebsd.org/D6522
2016-05-25 05:22:35 +00:00
Sepherosa Ziehau
14aa3e8097 hyperv/vmbus: Move vcpuid into vmbus softc per-cpu data
MFC after:	1 week
Sponsored by:	Microsoft OSTC
Differential Revision:	https://reviews.freebsd.org/D6521
2016-05-25 05:06:15 +00:00
Sepherosa Ziehau
95a45414a0 hyperv/vmbus: Move event/message taskqueue/task to vmbus softc
MFC after:	1 week
Sponsored by:	Microsoft OSTC
Differential Revision:	https://reviews.freebsd.org/D6520
2016-05-25 04:59:20 +00:00
Sepherosa Ziehau
bd5465a441 hyperv/vmbus: Allocate/setup IDT vector after all ISR resources are ready
And release IDT vector before releasing ISR resources on interrupt
teardown path.  We still have some work to do on the interrupt tearing
down path.

MFC after:	1 week
Sponsored by:	Microsoft OSTC
Differential Revision:	https://reviews.freebsd.org/D6519
2016-05-25 03:39:42 +00:00
Sepherosa Ziehau
01ac237df2 hyperv/vmbus: Check hyperv_dmamem_alloc return value
Though it is highly unlikely this function would fail w/ BUS_DMA_WAITOK,
we had better to check its return value; better safe then sorry here.

MFC after:	1 week
Sponsored by:	Microsoft OSTC
Differential Revision:	https://reviews.freebsd.org/D6518
2016-05-25 03:30:56 +00:00
Justin Hibbits
0e9f21dc24 Set the TLB caching properties for portals at attach time.
This was found while reworking the device tree nodes for dtsec to match the
Linux device tree.  Instead of waiting and expecting later code to call
dpaa_portal_map_registers(), do the equivalent immediately upon mapping.
Otherwise, it's possible to access the pages before that function is called, and
hang the CPU.
2016-05-25 01:23:19 +00:00
Adrian Chadd
5ad9ac037d [bhnd] Normalize bhnd(4) device matching API
This unifies handling of core, chip, and board-level device
matching, and adds support for matching device drivers
against the bus attach type (e.g. SoC vs WiFi adapter).

Core-level quirks on Broadcom's chipsets generally are specific
to some combination of chip model, core revision, chip
package (e.g. 12x9 SMT package), SROM revision, etc.

Unifying the match APIs for all three attribute types (core, chip,
board/srom) allows defining a single device quirk table that
matches across all of those attributes.

Submitted by:	Landon Fuller <landonf@landonf.org>
Differential Revision:	 https://reviews.freebsd.org/D6515
2016-05-24 21:20:17 +00:00
Adrian Chadd
b80427f906 [bhnd] fix compilation due to incompatible types
Submitted by:	Michael Zhilin <mizhka@gmail.com>
Differential Revision: https://reviews.freebsd.org/D6532
2016-05-24 15:39:57 +00:00
Edward Tomasz Napierala
09c84055a0 Add kern.icl.iser_offloads sysctl.
MFC after:	1 month
Sponsored by:	The FreeBSD Foundation
2016-05-24 14:34:36 +00:00
Sean Bruno
6115013663 Reject ioctl commands for FLSHGCHR and FLSHPCHR if the size is greater
than sc->areq.  This is a bounds check to ensure we're not just cramming
arbitrarily sized nonsense into the driver and overflowing the heap.

PR:		209545
Submitted by:	cturt@hardenedbsd.org
MFC after:	2 weeks
2016-05-24 13:57:23 +00:00
Alexander Motin
b72a6f8a8f Re-enable write combining, disabled by default at r295486.
if_ntb(4) strongly benefits from WC, improving throughput from 350Mbit/s
to 8-10Gbit/s on my tests.

MFC after:	1 week
2016-05-24 12:40:03 +00:00
Andrew Rybchenko
131bc376b9 sfxge(4): enable Medford support
Reviewed by:    gnn
Sponsored by:   Solarflare Communications, Inc.
MFC after:      1 week
Differential Revision:  https://reviews.freebsd.org/D6510
2016-05-24 12:20:23 +00:00
Andrew Rybchenko
1baf53ec8d sfxge(4): bump driver version to the closest out-of-tree version
Sponsored by:   Solarflare Communications, Inc.
MFC after:      1 week
2016-05-24 12:19:14 +00:00
Andrew Rybchenko
929c7feb83 sfxge(4): cleanup: update copyright to 2016
Sponsored by:   Solarflare Communications, Inc.
MFC after:      1 week
Differential Revision:  https://reviews.freebsd.org/D6509
2016-05-24 12:16:57 +00:00
Andrew Rybchenko
ecaa500c4b sfxge(4): provide option to disable not a local MAC address check
Option EFSYS_OPT_ALLOW_UNCONFIGURED_NIC disables check that the adapter
MAC address is not a local address (beginning 02).

Submitted by:   Laurence Evans <levans at solarflare.com>
Reviewed by:    gnn
Sponsored by:   Solarflare Communications, Inc.
MFC after:      1 week
Differential Revision:  https://reviews.freebsd.org/D6508
2016-05-24 12:15:30 +00:00
Andrew Rybchenko
bdb482bfa0 sfxge(4): be ready to receive events immediately after event queues are created
Submitted by:   Mark Spender <mspender at solarflare.com>
Reviewed by:    gnn
Sponsored by:   Solarflare Communications, Inc.
MFC after:      1 week
Differential Revision:  https://reviews.freebsd.org/D6507
2016-05-24 12:14:19 +00:00
Edward Tomasz Napierala
93fb610fe8 Rename kern.icl.drivers to kern.icl.offloads, for consistency.
MFC after:	1 month
Sponsored by:	The FreeBSD Foundation
2016-05-24 08:54:41 +00:00
Edward Tomasz Napierala
b891159418 Add mechanism for choosing iSER-capable ICL modules.
MFC after:	1 month
Sponsored by:	The FreeBSD Foundation
2016-05-24 08:44:45 +00:00
Sepherosa Ziehau
8982969f05 hyperv/vmbus: Free message taskqueue during interrupt teardown
MFC after:	1 week
Sponsored by:	Microsoft OSTC
Differential Revision:	https://reviews.freebsd.org/D6506
2016-05-24 07:07:11 +00:00
Sepherosa Ziehau
b28956a456 hyperv/vmbus: Factor out functions for vmbus interrupt set/teardown
This paves way for further cleanup and fix.

MFC after:	1 week
Sponsored by:	Microsoft OSTC
Differential Revision:	https://reviews.freebsd.org/D6505
2016-05-24 06:42:14 +00:00
Sepherosa Ziehau
bcc9e3e995 hyperv/vmbus: Git rid of sc version of pcpu data extraction macro
MFC after:	1 week
Sponsored by:	Microsoft OSTC
Differential Revision:	https://reviews.freebsd.org/D6503
2016-05-24 06:10:21 +00:00
Sepherosa Ziehau
0408d8b80a hyperv/vmbus: Use busdma(9) for messages and event flags
And
- Move message and event flags to vmbus_softc per-cpu data.
- Get rid of hv_setup_arg, which serves no purpose now.

MFC after:	1 week
Sponsored by:	Microsoft OSTC
Differential Revision:	https://reviews.freebsd.org/D6502
2016-05-24 06:01:39 +00:00
Sepherosa Ziehau
fc2d20095c hyperv/vmbus: Move SynIC setup/teardown from hyperv file to vmbus file
Avoid unnecessary exposure.

MFC after:	1 week
Sponsored by:	Microsoft OSTC
Differential Revision:	https://reviews.freebsd.org/D6501
2016-05-24 05:51:51 +00:00
Sepherosa Ziehau
5c8e70d86c hyperv/vmbus: Rename local variable and break long lines
No functional changes.

MFC after:	1 week
Sponsored by:	Microsoft OSTC
Differential Revision:	https://reviews.freebsd.org/D6500
2016-05-24 05:43:55 +00:00
Sepherosa Ziehau
d8313c45a6 hyperv/busdma: Take BUS_DMA_ZERO into account
MFC after:	1 week
Sponsored by:	Microsoft OSTC
Differential Revision:	https://reviews.freebsd.org/D6499
2016-05-24 05:26:52 +00:00
Sepherosa Ziehau
86931e66f6 hyperv/vmbus: Pass vmbus_softc and curcpu to hv_vmbus_isr()
MFC after:	1 week
Sponsored by:	Microsoft OSTC
Differential Revision:	https://reviews.freebsd.org/D6498
2016-05-24 05:18:26 +00:00
Sepherosa Ziehau
a995872175 hyperv/vmbus: Move vmbus interrupt counter into vmbus softc
MFC after:	1 week
Sponsored by:	Microsoft OSTC
Differential Revision:	https://reviews.freebsd.org/D6497
2016-05-24 05:06:01 +00:00
Adrian Chadd
40dcddfcca [bwn] begin separating out the attach path from the SIBA specific bits.
* convert phy_getinfo() to take a "gmode" flag, rather than the siba
  TGSHIGH flags and then check for 2GHz.  This should ensure that
  gmode is set correctly even on DUALPHY NICs.
* move the siba_powerup() call and the TGSHIGH decoding into a
  call to bwn_is_bus_siba(), and return an error if it's called
  on anything else.  We don't yet do anything else, but when we do..

Tested:

* BCM4322, 11a STA
2016-05-24 04:58:58 +00:00
Adrian Chadd
972459a6ca [bwn] add BCM43225 to the BHND device list.
This is all for the bhnd(4) work in progress.  It's enough to probe/attach
all the bhnd internals, but we're missing OTP support and some cleanup
code.  And, well, all the rest of the bhnd(4) migration.

So no, this won't give you BCM43225 support.  Sorry!
2016-05-24 04:55:00 +00:00
Sean Bruno
bf10f1a085 Update some of the TBD entries in ciss(4) to match what's in the pci
IDS data.

Submitted by:	Dmitry Luhtionov <dmitryluhtionov@gmail.com>
MFC after:	2 weeks
2016-05-24 01:42:21 +00:00
Luiz Otavio O Souza
8ba8cb912b Move the OFW iicbus code to dev/iicbus to stop polluting dev/ofw with
unrelated code.

Discussed with:		nwhitehorn (a long time ago)
2016-05-24 01:33:49 +00:00
Adrian Chadd
a7978cf36d [bwn] add extra debugging for non-SIBA devices.
This is a no-op at the present moment, but will eventually remind me
where the SIBA specific demons lie.

Tested:

* BCM4322, STA mode
2016-05-24 01:20:30 +00:00
Adrian Chadd
f4a3eb0297 [bhnd] Implement pass-through resource management for ChipCommon.
This patchset adds support to bhnd_chipc for sharing SYS_RES_MEMORY
resources with its children, allowing us to hang devices off of
bhnd_chipc that rely on access to a subset of the device register space
that bhnd_chipc itself must also allocate.

We could avoid most of this heavy lifting if RF_SHAREABLE+SYS_RES_MEMORY
wasn't limited to use with allocations at the same size/offset.

As a work-around, I implemented something similar to vga_pci.c, which
implements similar reference counting of of PCI BAR resources for its
children.

With these changes, chipc will use reference counting of SYS_RES_MEMORY
allocation/activation requests, to decide when to allocate/activate/
deactivate/release resources from the parent bhnd(4) bus.

The requesting child device is allocated a new resource from chipc's
rman, pointing to (possibly a subregion of) the refcounted bhnd resources
allocated by chipc.

Other resource types are just passed directly to the parent bhnd bus;
RF_SHAREABLE works just fine with IRQs.

I also lifted the SPROM device code out into a common driver, since this
now allows me to hang simple subclasses off of a common driver off of both
bhndb_pci and bhnd_chipc.

Tested:

* (landonf) Tested against BCM4331 and BCM4312, confirmed that SPROM still
  attaches and can be queried.

Submitted by:	Landon Fuller <landonf@landonf.org>
Reviewed by:	mizkha@gmail.com
Differential Revision:	https://reviews.freebsd.org/D6471
2016-05-24 01:12:19 +00:00
Conrad Meyer
ab7c85b4b9 ntb_hw(4): Only record the first three MSIX vectors
Don't overrun the msix_data array by reading the (unused) link state
interrupt information.

Reported by:	mav (earlier version)
Sponsored by:	EMC / Isilon Storage Division
Differential Revision:	https://reviews.freebsd.org/D6489
2016-05-23 19:46:58 +00:00
Andrew Rybchenko
899466f91e sfxge(4): cleanup: remove unused EFX preempt macros
The EFSYS_PREEMPT_DISABLE() and EFSYS_PREEMPT_ENABLE() macros
were used to ensure correct timing of I2C operations. The APIs
for I2C operations have been removed, so these macros have no
callers.

Submitted by:   Andy Moreton <amoreton at solarflare.com>
Sponsored by:   Solarflare Communications, Inc.
MFC after:      1 week
2016-05-23 13:17:37 +00:00
Sepherosa Ziehau
fc4d679fd7 hyperv/vmbus: Move IDT vector to vmbus_softc
Prepare to get rid of the hv_setup_arg.

MFC after:	1 week
Sponsored by:	Microsoft OSTC
Differential Revision:	https://reviews.freebsd.org/D6449
2016-05-23 07:32:34 +00:00
Sepherosa Ziehau
e2468dfeff hyperv/vmbus: Get rid of vmbus_devp
While I'm here, nuke useless print in vmbus_attach().

MFC after:	1 week
Sponsored by:	Microsoft OSTC
Differential Revision:	https://reviews.freebsd.org/D6447
2016-05-23 07:23:19 +00:00
Sepherosa Ziehau
c4b78721e3 hyperv/vmbus: Declare Synic message and event w/ proper types
Avoid ugly casts.

MFC after:	1 week
Sponsored by:	Microsoft OSTC
Differential Revision:	https://reviews.freebsd.org/D6446
2016-05-23 07:14:04 +00:00
Sepherosa Ziehau
ae39ebd8df hyperv: Move Hypercall setup to an early place.
It does not belong to the vmbus.

While I'm here rework the Hypercall setup, e.g. use busdma(9)
and avoid bit fields.

Discussed with:	Jun Su <junsu microsoft com>
MFC after:	1 week
Sponsored by:	Microsoft OSTC
Differential Revision:	https://reviews.freebsd.org/D6445
2016-05-23 07:06:53 +00:00
Sepherosa Ziehau
a46b3df617 hyperv/hn: Use hyperv busdma(9) helper.
MFC after:	1 week
Sponsored by:	Microsoft OSTC
Differential Revision:	https://reviews.freebsd.org/D6444
2016-05-23 06:52:42 +00:00
Sepherosa Ziehau
7e118515ca hyperv: Add helpers for busdma(9) operation
MFC after:	1 week
Sponsored by:	Microsoft OSTC
Differential Revision:	https://reviews.freebsd.org/D6443
2016-05-23 06:35:11 +00:00
Adrian Chadd
ec607da0e5 [siba] update device ids.
Tested:

* BCM4322 11abgn, STA mode
2016-05-23 05:52:47 +00:00
Sepherosa Ziehau
b9f1312664 hyperv: Move guest id setup to early place
And
- Rework the guest id composition.
- Nuke useless saved guest_id.

MFC after:	1 week
Sponsored by:	Microsoft OSTC
Differential Revision:	https://reviews.freebsd.org/D6430
2016-05-23 05:11:38 +00:00
Adrian Chadd
2e79170e4f [nvram2env] fix nvram2env to scan all of memory, not 1/4th
The variable "size" stores number of words (4bytes). But the loop over
memory uses size as number of bytes to scan memory. As result it fetches
only 1/4th of memory.

This patch solves this problem and nvram2env fetches all NVRAM variables.

Test plan:

Pre-requisites: any MIPS board with ASCII-based NVRAM mapped into memory

* Add "device nvram2env" into kernel configuration
* Specify hints: base is mandatory (according to nvram2env(4))

hint.nvram.0.base=0x1c7f8000 (it's valid address for Asus RT-N53 with
flags = 0x4)

* Build & load kernel with bootverbose

Actual result: only part of nvram variables are found
Expected result: all variables are found

Submitted by:	Michael Zhilin <mizhka@gmail.com>
Differential Revision:	https://reviews.freebsd.org/D6466
2016-05-23 03:51:15 +00:00
Adrian Chadd
9d292ea16d [bhnd] Add support for querying the attachment type of the bhnd bus.
This adds a BHND_BUS_GET_ATTACH_TYPE(); the primary use-case is to let
chipc make a coarse-grained determination as to whether UART, SPI, etc
drivers ought to be attached, and on fullmac devices, whether a real
CPU driver ought to be skipped for the ARM core, etc.

Tested:

* BCM4331 (BHND)
* BCM4312 (SIBA)

Submitted by:	Landon Fuller <landonf@landonf.org>
Differential Revision:	https://reviews.freebsd.org/D6492
2016-05-23 03:47:44 +00:00
Adrian Chadd
aa87465313 [ixl] fix build for RSS.
Untested.
2016-05-23 03:46:36 +00:00
Andriy Voskoboinyk
90ea1c8c7b urtwn: cleanup some unused code in urtwn_tx_data().
- Drop unused 'subtype' variable.
- Remove obsolete comment (hardware crypto support was added in r292175).
2016-05-22 20:12:07 +00:00
Andriy Voskoboinyk
db585a35a8 urtwn: setup per-frame retry limit.
Override global retry limit (which is set in R92C_RL) via per-frame
TX descriptor field. Obsoletes D3840 (should work better with 2+ vaps).

Tested with RTL8188EU and RTL8192CUS in STA mode (maxretry = [3-9]).
2016-05-22 19:43:40 +00:00
Andrey A. Chernov
23b26e530d Improve panic message by specifying on which cpu it really is. 2016-05-22 15:22:45 +00:00
Luiz Otavio O Souza
9d6672e13b Fix the deciKelvin to Celsius conversion in kernel.
After r285994, sysctl(8) was fixed to use 273.15 instead of 273.20 as 0C
reference and as result, the temperature read in sysctl(8) now exibits a
+0.1C difference.

This commit fix the kernel references to match the reference value used in
sysctl(8) after r285994.

Sponsored by:	Rubicon Communications (Netgate)
2016-05-22 13:58:32 +00:00
Luiz Otavio O Souza
ad802dc4e3 Remove a couple of extra blank lines. 2016-05-22 04:09:05 +00:00
Luiz Otavio O Souza
0397efe813 Sort and remove a couple of unnecessary headers. 2016-05-22 04:02:34 +00:00
Luiz Otavio O Souza
03302aa37f Get rid of two consumers of gpiobus acquire/release.
The GPIO hardware should not be owned by a single device, this defeats any
chance of use of the GPIO controller as an interrupt source.

ow(4) is now the only consumer of this 'feature' before we can remove it
for good.

Discussed with:	ian, bsdimp
2016-05-22 03:55:57 +00:00
Luiz Otavio O Souza
16119eeded Use a better prefix for defines, return BUS_PROBE_DEFAULT for probe routine.
Refuse to attach if the number of given pins is not enough for our needs.
2016-05-22 03:34:18 +00:00
Luiz Otavio O Souza
fc5f218ade Fix probe routine to return BUS_PROBE_DEFAULT instead of BUS_PROBE_SPECIFIC.
While here fix a few style(9) issues.
2016-05-22 03:12:49 +00:00
Edward Tomasz Napierala
a3fd63f223 Properly reset session state when using proxy and fail_on_disconnection=1.
Without it the reconnection would fail due to mismatched sequence numbers.

MFC after:	1 month
Sponsored by:	The FreeBSD Foundation
2016-05-21 11:26:03 +00:00
Edward Tomasz Napierala
7deb68ab2c Provide a way for ICL modules to declare they support PIM_UNMAPPED.
MFC after:	1 month
Sponsored by:	The FreeBSD Foundation
2016-05-21 11:10:48 +00:00
Edward Tomasz Napierala
b218ca6fdd Pass maxtags value to the ICL module. iSER needs it.
MFC after:	1 month
Sponsored by:	The FreeBSD Foundation
2016-05-21 10:59:36 +00:00
John Baldwin
1081d2766c Move the KTR for the update of ddp_active_id on each completion under
VERBOSE_TRACES.

Sponsored by:	Chelsio Communications
2016-05-20 23:08:22 +00:00
Edward Tomasz Napierala
906a424b26 Call the ICL module's handoff method even when using ICL proxy.
The upcoming iSER code uses this.

MFC after:	1 month
Sponsored by:	The FreeBSD Foundation
2016-05-20 17:38:51 +00:00
Alexander Motin
873b0260d4 Pass proper for 23xx arguments to isp_endcmd(). 2016-05-20 11:56:16 +00:00
Wojciech Macek
7056927eb8 Fix VNIC module unloading
Fix panics which were present when BGX and PF module were unloaded.

Reviewed by:	zbb
Obtained from:	Semihalf
Sponsored by:	Cavium
Differential Revision:	https://reviews.freebsd.org/D6346
2016-05-20 11:02:04 +00:00
Wojciech Macek
f4aafb9ea6 Allow building VNIC as a module
Add directory structure and fix dependencies to be able to
build and use Cavium VNIC driver as a module.

Reviewed by:	zbb
Obtained from:	Semihalf
Sponsored by:	Cavium
Differential Revision:	https://reviews.freebsd.org/D6345
2016-05-20 11:00:06 +00:00
Alexander Motin
96b5475b7a Pass task management response information from CTL through CAM to isp(4),
utilizing previously unused arg field of struct ccb_notify_acknowledge.

This makes new QUERY TASK, QUERY TASK SET and QUERY ASYNC EVENT requests
really functional for CAM target mode drivers.
2016-05-20 10:26:12 +00:00
Andriy Voskoboinyk
4328ca5a21 wi: fix a typo.
The max size of bitmask is IEEE80211_MODE_BYTES, not IEEE80211_MODE_MAX.

Reuse it in bwn(4) while I'm here.

Noticed by:	kevlo
2016-05-20 08:58:06 +00:00
Andrew Turner
6d2f7ef617 Handle PCI_RES_BUS on the generic and ThunderX PCIe drivers. This has been
tested on the Pass 1.1 and 2.0 ThunderX machines in the Netperf cluster.

Reviewed by:	jhb
Obtained from:	ABT Systems Ltd
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D6453
2016-05-20 08:29:00 +00:00
Hans Petter Selasky
82d2623e5a Verify one sysctl parameter at a time. When a mlx5en sysctl parameter
is updated only verify the changed one instead of all.

No functional change.

Sponsored by:	Mellanox Technologies
Tested by:	Netflix
MFC after:	1 week
2016-05-20 07:07:27 +00:00
Hans Petter Selasky
af89c4aff6 Optimise use of doorbell and remove redundant NOPs
Store the last doorbell write in the mlx5e_sq structure and write the
doorbell to the hardware when the transmit routine finishes
transmitting all queued mbufs.

Sponsored by:	Mellanox Technologies
Tested by:	Netflix
MFC after:	1 week
2016-05-20 06:59:38 +00:00
Hans Petter Selasky
376bcf6331 Implement TX completion event interleaving.
This patch implements a sysctl which allows setting a factor, N, for
how many work queue elements can be generated before requiring a
completion event. When a completion event happens the code simulates N
completion events instead of only one. When draining a transmit queue,
N-1 NOPs are transmitted at most, to force generation of the final
completion event.  Further a timer is running every HZ ticks to flush
any remaining data off the transmit queue when the tx_completion_fact
> 1.

The goal of this feature is to reduce the PCI bandwidth needed when
transmitting data.

Sponsored by:	Mellanox Technologies
Tested by:	Netflix
MFC after:	1 week
2016-05-20 06:54:58 +00:00
Adrian Chadd
b1940deb18 [ath] convert recent changes over to HAL format.
This is needed to compile the ath tools, that includes this code
to run in userland.

Tested:

* Carambola 2, AR9331, STA mode
2016-05-20 06:06:21 +00:00
Jason A. Harmening
523a6367e4 iic_rdwr_data->nmsgs is uint32_t, so limit the allowable number of messages to prevent memory exhaustion and short allocations on 32-bit systems. Since iicrdwr is intended to be a workalike of a Linux i2c-dev call, use the same limit of 42 that Linux uses.
Also check the return value of copyin(9) to prevent unnecessary allocation in the failure case.

Submitted by:	ngie
Reviewed by:	kib
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D5155
2016-05-20 03:03:04 +00:00
Adrian Chadd
223666cefe [bhnd] Add BHND SoC support (only BCMA case)
This patch introduces support of BHND on SoC: nexus-to-bhnd drivers.

bhnd_soc is attached under nexus and responsible for all BHND-style calls
from bhnd(4) bus to parents.

bcma_nexus is bhnd(4) bus, attached to bhnd_soc and implement all
nexus-style behaviour of BHND.

Submitted by:	Michael Zhilin <mizhka@gmail.com>
Reviewed by:	Landon Fuller <landonf@landonf.org>
Differential Revision:	https://reviews.freebsd.org/D6248
2016-05-20 01:02:58 +00:00
Adrian Chadd
249f3d3f77 [bhnd] Add bhnd bridge support for bus_adjust_resource().
Adds support for adjusting active bus resource allocations, limiting the
range to the constraints of the register window within which the resource
is mapped.

This is the final set of bhnd changes required to support delegating
ChipCommon's register space to child devices.

Submitted by:	Landon Fuller <landonf@landonf.org>
Differential Revision:	https://reviews.freebsd.org/D6470
2016-05-20 00:49:10 +00:00
Adrian Chadd
0e141e3c32 [bhnd] Add remaining bus_(read|write|set)_(1|2|4) APIs
This adds bhnd-compatible implementations of bus_(read|write|set)_(1|2|4) APIs,
and upgrades the SPROM parsing code to use bhnd_bus_read_region_stream_2().

This a precursor to bridge support for resource adjustment and the new
ChipCommon bus support.

Tested:

* Tested against BCM4331
* Kernel build verified via tinderbox.

Submitted by:	Landon Fuller <landonf@landonf.org>
Differential Revision:	https://reviews.freebsd.org/D6469
2016-05-20 00:45:16 +00:00
John Baldwin
6f33eaa5f0 Implement a proper detach method for the PCI-PCI bridge driver.
- Add a pcib_detach() function for the PCI-PCI bridge driver.  It
  tears down the NEW_PCIB and hotplug state including destroying
  resource managers, deleting child devices, and disabling hotplug
  events.
- Add a detach method to the ACPI PCI-PCI bridge driver which calls
  pcib_detach() and then frees the copy of the _PRT interrupt routing
  table.
- Add a detach method to the PCI-Cardbus bridge driver which frees
  the PCI bus resources in addition to calling cbb_detach().
- Explicitly clear any pending hotplug events during attach to ensure
  future events will generate an interrupt.
- If a the Command Completed bit is set in the slot status register
  when the command completion timeout fires, treat it as if the
  command completed and the completion interrupt was just lost rather
  than forcing a detach.
- Don't wait for a Command Completed notification if Command Completion
  interrupts are disabled.  The spec explicitly says no interrupt is
  enabled when clearing CCIE, and on my T400 no interrupt is generated
  when CCIE is changed from cleared to set, either.  In addition, the
  T400 doesn't appear to set the Command Completed bit in the cases
  where it doesn't generate an interrupt, so don't schedule the timer
  either.  (If the CC bit were always set, one could always set the timer
  and rely on the logic of treating CC set as a missed interrupt.)

Reviewed by:	imp (older version)
Differential Revision:	https://reviews.freebsd.org/D6424
2016-05-20 00:03:22 +00:00
Andriy Voskoboinyk
b789292fd8 iwm: add 'opt_wlan.h' include into source files.
Include net80211 options file, so IEEE80211_DEBUG_REFCNT option will be
handled correctly.
2016-05-19 23:31:00 +00:00
Andriy Voskoboinyk
12d532388d ath: refactor/split getchannels() method.
Split getchannels() method in ath_hal/ah_regdomain.c into a subset
of functions for better readability.

Note: due to different internal structure, it cannot use
ieee80211_add_channel*() (however, some parts are done in a
similar manner).

Differential Revision:	https://reviews.freebsd.org/D6139
2016-05-19 23:00:30 +00:00
Andriy Voskoboinyk
ace1dfdd0b iwm: restart device after watchdog timeouts. 2016-05-19 22:43:21 +00:00
Andriy Voskoboinyk
5216e2b620 mwl: switch to ieee80211_add_channel*(). 2016-05-19 22:28:46 +00:00
Andriy Voskoboinyk
0587ad6b48 ipw: switch to ieee80211_add_channel()
- Convert to ieee80211_add_channel().
- Add ic_getradiocaps() method.

Differential Revision:	https://reviews.freebsd.org/D6236
2016-05-19 22:19:35 +00:00
Andriy Voskoboinyk
8121cf4585 wi: switch to ieee80211_add_channel()
- Convert to ieee80211_add_channel().
- Add ic_getradiocaps() method.

Differential Revision:	https://reviews.freebsd.org/D6235
2016-05-19 22:14:35 +00:00
Alexander Motin
514a71eba7 Fix delaying requests to unknown virtual ports 2s after init.
This code was originally implemented 7 years ago, but never really worked
due to trivial error.  I think this functionality may be not required.
Initiators supporting optional periodic command status checks detected
those terminated commands and retried them 3 seconds later.  But thinking
about less featured initiators and the fact that it is our race makes
virtual ports "unknown" it may be good to have this feature.
2016-05-19 17:48:56 +00:00
Alexander Motin
352427b341 Add proper reporting for early task management errors.
This covers unknown requests and requests to unknown virtual ports.
Previously it "worked" only because of timeout handling on initiator.
2016-05-19 17:02:33 +00:00
Alexander Motin
0bd83292ef Add IOCB debugging for ISPCTL_RESET_DEV and ISPCTL_ABORT_CMD. 2016-05-19 16:53:53 +00:00
Edward Tomasz Napierala
d66a906bc2 Make ICL proxy use kernel code for handling iSCSI sequence numbers
for PDUs to/from iscsid(8).  This fixes StatSN for Logout PDUs sent
by iscsi_session_logout().

MFC after:	1 month
Sponsored by:	The FreeBSD Foundation
2016-05-19 14:57:37 +00:00
Edward Tomasz Napierala
2f0586b2ce Make it possible to interrupt proxy-mode iscsid receive.
MFC after:	1 month
Sponsored by:	The FreeBSD Foundation
2016-05-19 14:37:24 +00:00
Kenneth D. Merry
9a6844d55f Add support for managing Shingled Magnetic Recording (SMR) drives.
This change includes support for SCSI SMR drives (which conform to the
Zoned Block Commands or ZBC spec) and ATA SMR drives (which conform to
the Zoned ATA Command Set or ZAC spec) behind SAS expanders.

This includes full management support through the GEOM BIO interface, and
through a new userland utility, zonectl(8), and through camcontrol(8).

This is now ready for filesystems to use to detect and manage zoned drives.
(There is no work in progress that I know of to use this for ZFS or UFS, if
anyone is interested, let me know and I may have some suggestions.)

Also, improve ATA command passthrough and dispatch support, both via ATA
and ATA passthrough over SCSI.

Also, add support to camcontrol(8) for the ATA Extended Power Conditions
feature set.  You can now manage ATA device power states, and set various
idle time thresholds for a drive to enter lower power states.

Note that this change cannot be MFCed in full, because it depends on
changes to the struct bio API that break compatilibity.  In order to
avoid breaking the stable API, only changes that don't touch or depend on
the struct bio changes can be merged.  For example, the camcontrol(8)
changes don't depend on the new bio API, but zonectl(8) and the probe
changes to the da(4) and ada(4) drivers do depend on it.

Also note that the SMR changes have not yet been tested with an actual
SCSI ZBC device, or a SCSI to ATA translation layer (SAT) that supports
ZBC to ZAC translation.  I have not yet gotten a suitable drive or SAT
layer, so any testing help would be appreciated.  These changes have been
tested with Seagate Host Aware SATA drives attached to both SAS and SATA
controllers.  Also, I do not have any SATA Host Managed devices, and I
suspect that it may take additional (hopefully minor) changes to support
them.

Thanks to Seagate for supplying the test hardware and answering questions.

sbin/camcontrol/Makefile:
	Add epc.c and zone.c.

sbin/camcontrol/camcontrol.8:
	Document the zone and epc subcommands.

sbin/camcontrol/camcontrol.c:
	Add the zone and epc subcommands.

	Add auxiliary register support to build_ata_cmd().  Make sure to
	set the CAM_ATAIO_NEEDRESULT, CAM_ATAIO_DMA, and CAM_ATAIO_FPDMA
	flags as appropriate for ATA commands.

	Add a new get_ata_status() function to parse ATA result from SCSI
	sense descriptors (for ATA passthrough over SCSI) and ATA I/O
	requests.

sbin/camcontrol/camcontrol.h:
	Update the build_ata_cmd() prototype

	Add get_ata_status(), zone(), and epc().

sbin/camcontrol/epc.c:
	Support for ATA Extended Power Conditions features.  This includes
	support for all features documented in the ACS-4 Revision 12
	specification from t13.org (dated February 18, 2016).

	The EPC feature set allows putting a drive into a power power mode
	immediately, or setting timeouts so that the drive will
	automatically enter progressively lower power states after various
	idle times.

sbin/camcontrol/fwdownload.c:
	Update the firmware download code for the new build_ata_cmd()
	arguments.

sbin/camcontrol/zone.c:
	Implement support for Shingled Magnetic Recording (SMR) drives
	via SCSI Zoned Block Commands (ZBC) and ATA Zoned Device ATA
	Command Set (ZAC).

	These specs were developed in concert, and are functionally
	identical.  The primary differences are due to SCSI and ATA
	differences.  (SCSI is big endian, ATA is little endian, for
	example.)

	This includes support for all commands defined in the ZBC and
	ZAC specs.

sys/cam/ata/ata_all.c:
	Decode a number of additional ATA command names in ata_op_string().

	Add a new CCB building function, ata_read_log().

	Add ata_zac_mgmt_in() and ata_zac_mgmt_out() CCB building
	functions.  These support both DMA and NCQ encapsulation.

sys/cam/ata/ata_all.h:
	Add prototypes for ata_read_log(), ata_zac_mgmt_out(), and
	ata_zac_mgmt_in().

sys/cam/ata/ata_da.c:
	Revamp the ada(4) driver to support zoned devices.

	Add four new probe states to gather information needed for zone
	support.

	Add a new adasetflags() function to avoid duplication of large
	blocks of flag setting between the async handler and register
	functions.

	Add new sysctl variables that describe zone support and paramters.

	Add support for the new BIO_ZONE bio, and all of its subcommands:
	DISK_ZONE_OPEN, DISK_ZONE_CLOSE, DISK_ZONE_FINISH, DISK_ZONE_RWP,
	DISK_ZONE_REPORT_ZONES, and DISK_ZONE_GET_PARAMS.

sys/cam/scsi/scsi_all.c:
	Add command descriptions for the ZBC IN/OUT commands.

	Add descriptions for ZBC Host Managed devices.

	Add a new function, scsi_ata_pass() to do ATA passthrough over
	SCSI.  This will eventually replace scsi_ata_pass_16() -- it
	can create the 12, 16, and 32-byte variants of the ATA
	PASS-THROUGH command, and supports setting all of the
	registers defined as of SAT-4, Revision 5 (March 11, 2016).

	Change scsi_ata_identify() to use scsi_ata_pass() instead of
	scsi_ata_pass_16().

	Add a new scsi_ata_read_log() function to facilitate reading
	ATA logs via SCSI.

sys/cam/scsi/scsi_all.h:
	Add the new ATA PASS-THROUGH(32) command CDB.  Add extended and
	variable CDB opcodes.

	Add Zoned Block Device Characteristics VPD page.

	Add ATA Return SCSI sense descriptor.

	Add prototypes for scsi_ata_read_log() and scsi_ata_pass().

sys/cam/scsi/scsi_da.c:
	Revamp the da(4) driver to support zoned devices.

	Add five new probe states, four of which are needed for ATA
	devices.

	Add five new sysctl variables that describe zone support and
	parameters.

	The da(4) driver supports SCSI ZBC devices, as well as ATA ZAC
	devices when they are attached via a SCSI to ATA Translation (SAT)
	layer.  Since ZBC -> ZAC translation is a new feature in the T10
	SAT-4 spec, most SATA drives will be supported via ATA commands
	sent via the SCSI ATA PASS-THROUGH command.  The da(4) driver will
	prefer the ZBC interface, if it is available, for performance
	reasons, but will use the ATA PASS-THROUGH interface to the ZAC
	command set if the SAT layer doesn't support translation yet.
	As I mentioned above, ZBC command support is untested.

	Add support for the new BIO_ZONE bio, and all of its subcommands:
	DISK_ZONE_OPEN, DISK_ZONE_CLOSE, DISK_ZONE_FINISH, DISK_ZONE_RWP,
	DISK_ZONE_REPORT_ZONES, and DISK_ZONE_GET_PARAMS.

	Add scsi_zbc_in() and scsi_zbc_out() CCB building functions.

	Add scsi_ata_zac_mgmt_out() and scsi_ata_zac_mgmt_in() CCB/CDB
	building functions.  Note that these have return values, unlike
	almost all other CCB building functions in CAM.  The reason is
	that they can fail, depending upon the particular combination
	of input parameters.  The primary failure case is if the user
	wants NCQ, but fails to specify additional CDB storage.  NCQ
	requires using the 32-byte version of the SCSI ATA PASS-THROUGH
	command, and the current CAM CDB size is 16 bytes.

sys/cam/scsi/scsi_da.h:
	Add ZBC IN and ZBC OUT CDBs and opcodes.

	Add SCSI Report Zones data structures.

	Add scsi_zbc_in(), scsi_zbc_out(), scsi_ata_zac_mgmt_out(), and
	scsi_ata_zac_mgmt_in() prototypes.

sys/dev/ahci/ahci.c:
	Fix SEND / RECEIVE FPDMA QUEUED in the ahci(4) driver.

	ahci_setup_fis() previously set the top bits of the sector count
	register in the FIS to 0 for FPDMA commands.  This is okay for
	read and write, because the PRIO field is in the only thing in
	those bits, and we don't implement that further up the stack.

	But, for SEND and RECEIVE FPDMA QUEUED, the subcommand is in that
	byte, so it needs to be transmitted to the drive.

	In ahci_setup_fis(), always set the the top 8 bits of the
	sector count register.  We need it in both the standard
	and NCQ / FPDMA cases.

sys/geom/eli/g_eli.c:
	Pass BIO_ZONE commands through the GELI class.

sys/geom/geom.h:
	Add g_io_zonecmd() prototype.

sys/geom/geom_dev.c:
	Add new DIOCZONECMD ioctl, which allows sending zone commands to
	disks.

sys/geom/geom_disk.c:
	Add support for BIO_ZONE commands.

sys/geom/geom_disk.h:
	Add a new flag, DISKFLAG_CANZONE, that indicates that a given
	GEOM disk client can handle BIO_ZONE commands.

sys/geom/geom_io.c:
	Add a new function, g_io_zonecmd(), that handles execution of
	BIO_ZONE commands.

	Add permissions check for BIO_ZONE commands.

	Add command decoding for BIO_ZONE commands.

sys/geom/geom_subr.c:
	Add DDB command decoding for BIO_ZONE commands.

sys/kern/subr_devstat.c:
	Record statistics for REPORT ZONES commands.  Note that the
	number of bytes transferred for REPORT ZONES won't quite match
	what is received from the harware.  This is because we're
	necessarily counting bytes coming from the da(4) / ada(4) drivers,
	which are using the disk_zone.h interface to communicate up
	the stack.  The structure sizes it uses are slightly different
	than the SCSI and ATA structure sizes.

sys/sys/ata.h:
	Add many bit and structure definitions for ZAC, NCQ, and EPC
	command support.

sys/sys/bio.h:
	Convert the bio_cmd field to a straight enumeration.  This will
	yield more space for additional commands in the future.  After
	change r297955 and other related changes, this is now possible.
	Converting to an enumeration will also prevent use as a bitmask
	in the future.

sys/sys/disk.h:
	Define the DIOCZONECMD ioctl.

sys/sys/disk_zone.h:
	Add a new API for managing zoned disks.  This is very close to
	the SCSI ZBC and ATA ZAC standards, but uses integers in native
	byte order instead of big endian (SCSI) or little endian (ATA)
	byte arrays.

	This is intended to offer to the complete feature set of the ZBC
	and ZAC disk management without requiring the application developer
	to include SCSI or ATA headers.  We also use one set of headers
	for ioctl consumers and kernel bio-level consumers.

sys/sys/param.h:
	Bump __FreeBSD_version for sys/bio.h command changes, and inclusion
	of SMR support.

usr.sbin/Makefile:
	Add the zonectl utility.

usr.sbin/diskinfo/diskinfo.c
	Add disk zoning capability to the 'diskinfo -v' output.

usr.sbin/zonectl/Makefile:
	Add zonectl makefile.

usr.sbin/zonectl/zonectl.8
	zonectl(8) man page.

usr.sbin/zonectl/zonectl.c
	The zonectl(8) utility.  This allows managing SCSI or ATA zoned
	disks via the disk_zone.h API.  You can report zones, reset write
	pointers, get parameters, etc.

Sponsored by:	Spectra Logic
Differential Revision:	https://reviews.freebsd.org/D6147
Reviewed by:	wblock (documentation)
2016-05-19 14:08:36 +00:00
Hans Petter Selasky
6e2392aea4 Fix bad sizeof().
Submitted by:	David Binderman <dcb314@hotmail.com>
PR:	209636
2016-05-19 11:02:39 +00:00
Adrian Chadd
0550ee2477 [bwn] quieten the "invalid firmware state".
That pops up in the rev 5xx / 6xx microcode on the later cores
(4312, 4322.) I'm not sure why this is happening yet and I'll
dig into it, but Linux b43 does the same thing.
2016-05-19 05:09:20 +00:00
Adrian Chadd
4afc7f78aa [bwn] program in the MAC capabilities somewhere where later microcode
expects it.

Obtained from:	Linux b43
2016-05-19 05:06:48 +00:00
Adrian Chadd
a5d89c93cc [bwn] add extra debugging. 2016-05-19 04:29:25 +00:00
Adrian Chadd
fefdffc6a5 [bwn] toggle the PHY clock during chip reset.
Tested:

* BCM4311, STA mode
* BCM4312, STA mode
* BCM4321, STA mode
* BCM4322, STA mde
2016-05-19 04:28:49 +00:00
Adrian Chadd
867d6884dd [bwn] enable dual-phy on BCM4322MC.
Tested (with later commits):

* BCM4322MC, STA mode, 2G + 5G
2016-05-19 04:23:54 +00:00
Adrian Chadd
923840c646 [bwn] rename TGS low registers to be consistent with naming scheme. 2016-05-19 04:22:58 +00:00
Adrian Chadd
af8366c448 [siba] use consistent naming. 2016-05-19 04:11:49 +00:00
Adrian Chadd
a2872fec7e [siba] implement PMU behaviour for chips with a separate PMU module.
* PMU controls the clock setup
* Correctly set idle low power handling
* Use a hard-coded powerup delay for some of the newer hardware
  (including the BCM4322, which I've tested with.)

Tested:

* BCM4322, 2G + 5G STA mode

Obtained from:	Linux b43 (PMU behaviour)
2016-05-19 04:11:00 +00:00
Adrian Chadd
d2dca326c4 [siba] handle the PMU resource setup/init for 0x4322 series chips.
Tested (with other changes):

* BCM4322 11abgn device, chip id 0x4322.
2016-05-19 04:03:41 +00:00
Adrian Chadd
b02b864ef6 [siba] fix up some comments and debug output. 2016-05-19 04:02:13 +00:00
Adrian Chadd
27acc00c5b [siba] add DMA debugging section, for changes later on to DMA addressing. 2016-05-19 04:01:33 +00:00
Justin Hibbits
af20e818eb Add an alternate compatible string for eTSEC devices.
Newer device trees now use fsl,etsec2 to denote eTSEC nodes.  Same device, new
name.
2016-05-19 00:04:58 +00:00
Oleksandr Tymoshenko
14131c0ba4 Use OF_prop_free instead of direct call to free(9)
Reviewed by:	marius
2016-05-18 23:39:31 +00:00
Alexander Motin
93d07b9a26 Unify Multi ID target code by reusing isp_find_chan_by_did(). 2016-05-18 16:15:09 +00:00
Andrew Rybchenko
b108666635 sfxge(4): cleanup: remove trailing whitespaces
Sponsored by:   Solarflare Communications, Inc.
MFC after:      1 week
2016-05-18 09:57:11 +00:00
Sepherosa Ziehau
a2dc39b5e6 hyperv/vmbus: Use consistent device description as other devices
MFC after:	1 week
Sponsored by:	Microsoft OSTC
Differential Revision:	https://reviews.freebsd.org/D6418
2016-05-18 07:18:11 +00:00
Adrian Chadd
dbc06ae538 [siba] fix incorrect SPROM offsets.
All my fault.
2016-05-18 07:17:30 +00:00
Sepherosa Ziehau
4910efc98e hyperv/vmbus: Minor function definition style fixup
Reviewed by:	Jun Su <junsu microsoft com>
MFC after:	1 week
Sponsored by:	Microsoft OSTC
Differential Revision:	https://reviews.freebsd.org/D6417
2016-05-18 07:09:44 +00:00
Sepherosa Ziehau
50b2a96140 hyperv/vmbus: Fix SYSINIT function prototype and usage.
Reviewed by:	Jun Su <junsu microsoft com>
MFC after:	1 week
Sponsored by:	Microsoft OSTC
Differential Revision:	https://reviews.freebsd.org/D6416
2016-05-18 07:01:32 +00:00
Adrian Chadd
957d19d07c [siba] use the correct SPROM offsets.
I transcribed the linux ssb offsets and .. didn't pick up that our SIBA
SPROM code has an offset of 0x1000.

This fixes a bunch of odd parsing values that showed up when I tried
using a newer NIC.  The NIC still doesn't yet work but now the SPROM
values are right.

Oops!
2016-05-18 07:01:22 +00:00
Sepherosa Ziehau
6279cdb1fb hyperv/vmbus: Reindent and cleanup devmethods.
While I'm here, use DEVMETHOD_END.

MFC after:	1 week
Sponsored by:	Microsoft OSTC
Differential Revision:	https://reviews.freebsd.org/D6415
2016-05-18 06:52:20 +00:00
Sepherosa Ziehau
1c21090e08 hyperv/vmbus: Staticize vmbus_devclass
Reviewed by:	Jun Su <junsu microsoft com>
MFC after:	1 week
Sponsored by:	Microsoft OSTC
Differential Revision:	https://reviews.freebsd.org/D6414
2016-05-18 06:43:15 +00:00
Sepherosa Ziehau
27ba130d14 hyperv: Set vm_guest to VM_GUEST_VM, if hypervisor is not Hyper-V
Reviewed by:	kib
MFC after:	1 week
Sponsored by:	Microsoft OSTC
Differential Revision:	https://reviews.freebsd.org/D6412
2016-05-18 06:36:28 +00:00
Sepherosa Ziehau
9627a270d2 hyperv/vmbus: Nuke unnecessary function indirection
MFC after:	1 week
Sponsored by:	Microsoft OSTC
Differential Revision:	https://reviews.freebsd.org/D6411
2016-05-18 06:29:03 +00:00
Sepherosa Ziehau
fee8b5f96d hyperv/vmbus: Remove useless modevent handler
MFC after:	1 week
Sponsored by:	Microsoft OSTC
Differential Revision:	https://reviews.freebsd.org/D6410
2016-05-18 06:19:22 +00:00
Adrian Chadd
a74bf02069 [bwn] add initial 5xx firmware API support
* Add the new TX/RX frame formats;
* Use the right TX/RX format based on the frame info;
* Disable the 5xx firmware check, since now it should
  somewhat work (but note, we don't yet use it unless
  you manually add ucode11/initvals11 from the 5.x driver
  to bwn-kmod-firmware;

* Misc: update some comments/debugging now I know what's
  actually going on.

Tested:

* BCM4321MC, STA mode, both 4xx and 666 firmware, DMA mode

TODO:

* The newer firmware ends up logging "warn: firmware state (0)";
  not sure yet what's going on there.  But, yes, it still works.
  I'm committing this via a BCM4321MC, 11a station, firmware
  rev 666.

Obtained from:	Linux b43 (TX/RX descriptor format for 5xx)
2016-05-18 05:56:25 +00:00
Sepherosa Ziehau
679afe0d78 hyperv/vmbus: Function renaming vmbus_msg_swintr -> vmbus_msg_task
It is not an SWI handler for a long time.

MFC after:	1 week
Sponsored by:	Microsoft OSTC
Differential Revision:	https://reviews.freebsd.org/D6409
2016-05-18 04:04:14 +00:00
Sepherosa Ziehau
a5dcd30f69 hyperv/vmbus: Utilize curcpu
MFC after:	1 week
Sponsored by:	Microsoft OSTC
Differential Revision:	https://reviews.freebsd.org/D6408
2016-05-18 03:58:04 +00:00