Commit Graph

110578 Commits

Author SHA1 Message Date
Jared McNeill
6a94069a5e Reduce complexity of RSB by always using polling mode. Unfortunately
gpiobus methods can be called with non-sleepable locks held.

Reviewed by:	mmel
2016-05-15 16:43:47 +00:00
Jared McNeill
4e760f013d Add gpio-leds for Sinovoip BananaPi BPI-M3.
The green LED on the board is wired to AXP813 GPIO0 and the blue
LED is wired to AXP813 GPIO1.
2016-05-15 15:56:48 +00:00
Jared McNeill
fafd846c91 Add support for the AXP813/AXP818 power key and GPIO pins. 2016-05-15 15:54:41 +00:00
Jared McNeill
37cc9a031b Allow RSB to be used from interrupt handlers.
The driver uses polling mode if cold or !THREAD_CAN_SLEEP() and now
implements the bus_* interface.
2016-05-15 15:52:34 +00:00
Michal Meloun
1dd6c13536 TEGRA: Also attach gpioc to tegra_gpio driver. Forgotten in r299854. 2016-05-15 15:31:44 +00:00
Michal Meloun
7f460e50ab TEGRA: Don't use common name 'iicb' for tegra specific IIC driver.
Using commn name for different drivers breaks generic kernel creation.
2016-05-15 15:14:46 +00:00
Michal Meloun
c953c6ed19 OFWIICBUS: Make ofwiicbus_devclass externaly visible.
It's needed for binding of iic controllers.
2016-05-15 15:13:56 +00:00
Michal Meloun
d85aca8d66 TEGRA: Don't use common name 'gpio' for tegra specific GPIO driver.
Using commn name for different drivers breaks generic kernel creation.
2016-05-15 14:47:50 +00:00
Michal Meloun
e3da01a384 OFWGPIOBUS: Make ofwgpiobus_devclass externaly visible.
It's needed for binding of gpio controllers.
2016-05-15 14:43:52 +00:00
Adrian Chadd
1e383b4bca [bwn] remove N-PHY registers for now.
I've submitted an alternative proposal to -core about just importing
the (converted) GPL PHY code in an alternate directory under sys/gnu/
so I don't have to rewrite it all to be BSD licenced.
2016-05-15 14:39:41 +00:00
Emmanuel Vadot
3d8b512e0b Allow arm generic_timer code to be included even if not present in the
SoC.

Reviewed by:	andrew
Approved by:	cognet (mentor)
Differential Revision:	https://reviews.freebsd.org/D6372
2016-05-15 13:20:59 +00:00
Edward Tomasz Napierala
dd49c93695 Remove NULL checks after M_WAITOK allocations from isp(4).
MFC after:	1 month
Sponsored by:	The FreeBSD Foundation
2016-05-15 08:36:12 +00:00
Edward Tomasz Napierala
0d1654c39b Make it possible to reroot into NFS. This means one can have
eg an NFSv4 root over WiFi: boot from md_root (small rootfs image
preloaded by loader(8)), setup WiFi, and then reroot into the actual
root, over NFS.

Note that it's currently limited to NFSv4, and due to problems with
nfsuserd(8) it requres a workaround on the server side: one needs
to set the vfs.nfsd.enable_stringtouid=1 sysctl and not run nfsuserd(8)
on either the server or the client side.

Reviewed by:	rmacklem@
MFC after:	1 month
Relnotes:	yes
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D6347
2016-05-15 08:34:59 +00:00
Adrian Chadd
e542607041 [bwn] add DUALPHY; this may be useful for PHY-N and later dual-phy probing.
Obtained from:	Landon Fuller <landonf@landonf.org>
2016-05-15 07:02:34 +00:00
Adrian Chadd
882abba02f [bwn] commit the N-PHY register set.
Obtained from:	Linux b43 (register definitions.)
2016-05-15 06:11:40 +00:00
Mark Johnston
c81c183dae Use Node Information flag names instead of hard-coding their values.
MFC after:	1 week
2016-05-15 03:22:13 +00:00
Mark Johnston
e8800f3c2f Fix a few style issues in the ICMP sysctl descriptions.
MFC after:	1 week
2016-05-15 03:19:53 +00:00
Mark Johnston
82366c228b Add sysctl descriptions for net.inet6.ip6 and net.inet6.icmp6.
icmp6.redirtimeout, icmp6.nd6_maxnudhint and ip6.rr_prune are left
undocumented as they appear to have no effect. Some existing sysctl
descriptions were modified for consistency and style, and the
ip6.tempvltime and ip6.temppltime handlers were rewritten to be a bit
simpler and to avoid setting the sysctl value before validating it.

MFC after:	3 weeks
2016-05-15 03:18:03 +00:00
Mark Johnston
415f6c24dd Remove an always-false error check in the AIFADDR_IN6 handler.
CID:		1250792
MFC after:	1 week
2016-05-15 03:01:40 +00:00
Rick Macklem
72393e3d80 Fix fuse so that stale buffer cache data isn't read.
When I/O on a file under fuse is switched from buffered to DIRECT_IO,
it was possible to read stale (before a recent modification) data from
the buffer cache. This patch invalidates the buffer cache for the
file to fix this.

PR:		194293
MFC after:	2 weeks
2016-05-15 00:45:17 +00:00
Adrian Chadd
b327475b51 [bwn] add the full suite of SPROM flags
Obtained from:	Linux b43
2016-05-15 00:03:14 +00:00
Adrian Chadd
2ad2bda1a1 [bwn] handle core rev 12, we can mostly do that new. 2016-05-14 23:50:44 +00:00
Adrian Chadd
c3d021a603 [bwn] disable 11na channel setup for now, since we definitely, positively
don't do 11na yet.
2016-05-14 23:50:15 +00:00
Adrian Chadd
45606ae1d5 [bwn] fill out phyctl_1 fields for N-PHY (and later, eventually.)
N-PHY and later require a lot more plcp specific setup for the PHY
to know what to transmit.  I've been spoilt by the atheros, intel
and realtek parts where you don't have to hand-assemble the PLCP
but .. well, apparently Broadcom require a lot more work.

This, and PHY-N itself, was the last major missing bit to get 11a
OFDM transmit to work.  Without this, CCK transmit worked but
OFDM transmit would always fail (with stat.phy_err set to 0x80.)

I have no idea what 0x80 is, and I went mad reading the broadcom
vendor driver to try and figure it out.

Tested:

* BCM4312 (PHY-LP)
* BCM4321 (PHY-N), 11a, 11bg.
2016-05-14 23:48:26 +00:00
Adrian Chadd
80c3f55282 [bwn] set the 5ghz transmit flag for 5ghz transmit.
Turns out trying to do 11a transmit without this set works poorly.
2016-05-14 23:45:47 +00:00
Adrian Chadd
e9e6f47e20 [bwn] disable writing slottime timing out to improve performance.
this is from b43 linux, there's a comment in there which notes
one nic family suffers performance degredation with this being set.
2016-05-14 23:45:16 +00:00
Adrian Chadd
7fb49b1e66 [bwn] make rf-kill work for PHY-N. 2016-05-14 23:44:30 +00:00
Adrian Chadd
d54c38a3e9 [bwn] decode the RX RSSI for PHY-N.
I'm still figuring this out, but it at least works somewhat.
2016-05-14 23:43:43 +00:00
Adrian Chadd
6553a04cad [bwn] use the new enum type. 2016-05-14 23:43:05 +00:00
Adrian Chadd
1fb1f6f918 [bwn] debugging changes.
Now that I have 5g working on PHY-N, that "changing band" message
happens quite a bit.  Make it a debug log, not an explicit printf.
2016-05-14 23:42:37 +00:00
Adrian Chadd
53a9eeb782 [bwn] Explicitly only work for SIBA parts; add some placeholder debugging.
Set phy-full-init always to 1 for now; PHY-N supports being able to do
partial init for things like fast channel changes but I'm going to
ignore it all.
2016-05-14 23:41:28 +00:00
Adrian Chadd
cd39b27e70 [bwn] missed commit! 2016-05-14 23:38:51 +00:00
Adrian Chadd
1ea968180f [bwn] add new types, prepare for PHY-N; prepare for rev 5xx firmware.
This is a big commit with a whole lot of little changes, all in
preparation for PHY-N and rev 5xx firmware.

* add in a write method that does an explicit flush
* change the txpwr recalc type to return an enum, versus just an int.
* add in PHY-N RX frame format bits, for decoding RX RSSI and such
* add in the header space calculation for rev 5xx firmware.
* add in a whole bunch of new types that the newer and 5g phy code
  needs.  Notably, broadcom has a split 5GHz band concept -
  5G-Low, 5G(-Mid) and 5G-High.  I kept encountering this at my
  day job and wondered whether it was just some marketing thing.
  Nope, turns out it isn't; it's an actual PHY thing.

* Add a "am I a siba bus device" method, that returns true.
  The aim is to convert all the siba/bhnd specific bits in if_bwn
  over to be wrapped in this check, so when landon does a BHND
  drive through he knows which bits need updating.

Now, this the /complete/ set of changes for rev 5xx firmware.
Notably, the TX descriptor handling isn't at all done yet and the
format has changed.  So don' try blindly flipping this on just yet!
2016-05-14 23:38:21 +00:00
Jared McNeill
292e26ba55 Add pmic (AXP813) child node to r_rsb for Sinovoip BananaPi BPI-M3. 2016-05-14 23:36:00 +00:00
Konstantin Belousov
56e61f57b0 Eliminate pvh_global_lock from the amd64 pmap.
The only current purpose of the pvh lock was explained there
On Wed, Jan 09, 2013 at 11:46:13PM -0600, Alan Cox wrote:
> Let me lay out one example for you in detail.  Suppose that we have
> three processors and two of these processors are actively using the same
> pmap.  Now, one of the two processors sharing the pmap performs a
> pmap_remove().  Suppose that one of the removed mappings is to a
> physical page P.  Moreover, suppose that the other processor sharing
> that pmap has this mapping cached with write access in its TLB.  Here's
> where the trouble might begin.  As you might expect, the processor
> performing the pmap_remove() will acquire the fine-grained lock on the
> PV list for page P before destroying the mapping to page P.  Moreover,
> this processor will ensure that the vm_page's dirty field is updated
> before releasing that PV list lock.  However, the TLB shootdown for this
> mapping may not be initiated until after the PV list lock is released.
> The processor performing the pmap_remove() is not problematic, because
> the code being executed by that processor won't presume that the mapping
> is destroyed until the TLB shootdown has completed and pmap_remove() has
> returned.  However, the other processor sharing the pmap could be
> problematic.  Specifically, suppose that the third processor is
> executing the page daemon and concurrently trying to reclaim page P.
> This processor performs a pmap_remove_all() on page P in preparation for
> reclaiming the page.  At this instant, the PV list for page P may
> already be empty but our second processor still has a stale TLB entry
> mapping page P.  So, changes might still occur to the page after the
> page daemon believes that all mappings have been destroyed.  (If the PV
> entry had still existed, then the pmap lock would have ensured that the
> TLB shootdown completed before the pmap_remove_all() finished.)  Note,
> however, the page daemon will know that the page is dirty.  It can't
> possibly mistake a dirty page for a clean one.  However, without the
> current pvh global locking, I don't think anything is stopping the page
> daemon from starting the laundering process before the TLB shootdown has
> completed.
>
> I believe that a similar example could be constructed with a clean page
> P' and a stale read-only TLB entry.  In this case, the page P' could be
> "cached" in the cache/free queues and recycled before the stale TLB
> entry is flushed.

TLBs for addresses with updated PTEs are always flushed before pmap
lock is unlocked.  On the other hand, amd64 pmap code does not always
flushes TLBs before PV list locks are unlocked, if previously PTEs
were cleared and PV entries removed.

To handle the situations where a thread might notice empty PV list but
third thread still having access to the page due to TLB invalidation
not finished yet, introduce delayed invalidation.  Comparing with the
pvh_global_lock, DI does not block entered thread when
pmap_remove_all() or pmap_remove_write() (callers of
pmap_delayed_invl_wait()) are executed in parallel.  But _invl_wait()
callers are blocked until all previously noted DI blocks are leaved,
thus ensuring that neccessary TLB invalidations were performed before
returning from pmap_remove_all() or pmap_remove_write().

See comments for detailed description of the mechanism, and also for
the explanations why several pmap methods, most important
pmap_enter(), do not need DI protection.

Reviewed by:	alc, jhb (turnstile KPI usage)
Tested by:	pho (previous version)
Sponsored by:	The FreeBSD Foundation
Differential revision:	https://reviews.freebsd.org/D5747
2016-05-14 23:35:11 +00:00
Jared McNeill
eceba010ba Add and enable Allwinner RSB and AXP81x power management IC drivers. 2016-05-14 23:34:57 +00:00
Jared McNeill
ceba82fdf5 Add a basic driver for X-Powers AXP813 and AXP818 power management ICs.
This driver simply installs a shutdown event handler for handling
RB_POWEROFF at shutdown. Tested on a Sinovoip BananaPi BPI-M3.
2016-05-14 23:33:57 +00:00
Adrian Chadd
36fcc18d80 [bwn] add an implementation of "cordic" and imaginary math.
This is used by the PHY-N code.

Obtained from:	http://bcm-v4.sipsolutions.net/802.11/PHY/Cordic
2016-05-14 23:33:13 +00:00
Adrian Chadd
9193516e94 [bwn] TX logging / completion fixes
* Log the per-completion status out if requested
* If we get a PHY failure, the retrycnt is set to 0 and ack=0, so
  the logic was incorrect.  So, for ack=0, ensure we don't log
  a retrycnt of 0 (or rate control breaks) or a negative retrycnt
  (or rate control also breaks.)

Tested:

* BCM4321 (11abgn N-PHY), BCM4312 (LP-PHY)
2016-05-14 23:27:55 +00:00
Jared McNeill
4b9a54a9fc Add a driver for the Allwinner Reduced Serial Bus (RSB).
The RSB controller speaks a simplified two wire protocol at speeds up to
20MHz. It is used on sun8i and sun9i family SoCs to communicate with
power management ICs.

RSB isn't really I2C or SMBus, but the driver exposes an iicbus interface
to simplify power management IC drivers (which may need to support both
RSB and I2C connectivity).
2016-05-14 23:27:54 +00:00
Adrian Chadd
0cfd65ecdc [bwn] add in new microcode and phy initval information.
This is required for PHY-N and later hardware.

Tested:

* BCN4321 (11abgn), PHY-N
2016-05-14 23:23:50 +00:00
Jared McNeill
472c6f0685 Add node for A83T NMI interrupt controller. 2016-05-14 23:22:52 +00:00
Adrian Chadd
52bef765d7 [bwn] implement reset improvements in preparation for PHY-N support
* Ensure we set 20MHz wide channels (hard-coded) for PHY-N.
* Change the core rese tto take a flag saying "gmode" vesus uint32_t
  flags.  This is important for BCMA support where the "gmode" bit
  is different.
* Refactor out the mac-phy clock reset routine (usde by PHY-N).

Tested:

* BCM4321 (PHY-N), BCM4312 (PHY-LP)

TODO:

* Checkpoint test on PHY-G hardware, just to check.
2016-05-14 23:20:46 +00:00
Adrian Chadd
dc94ad18cd [bwn] use the shared bwn_sqrt() routine. 2016-05-14 23:13:44 +00:00
Adrian Chadd
baed0627b7 [bwn] disable bgscan for now.
I'll re-enable this when I've verified all of the locking / concurrency
access to the hardware is "right".

Tested:

* BCM4321 (PHY-N), BCM4312 (PHY-LP)
2016-05-14 23:10:47 +00:00
Adrian Chadd
c41639c2b7 [bwn] add in the new phy common and utils files.
They're not yet used by included code; that'll come next.
2016-05-14 23:08:34 +00:00
Adrian Chadd
c68e865e8f [bwn] begin migrating PHY common routines into if_bwn_phy_common.[ch].
This isn't compiled in yet; so some code here duplicates what
is in the existing code.  I'll migrate it all out in subsequent
commits.

Obtained from:	b43 (definitions), bcm-v4 specifications website
2016-05-14 20:11:48 +00:00
Adrian Chadd
020cb2200b [bwn] add Q52 macros.
The PHY-N code uses a different format for gain values, so these macros
are used for converting to/from and print out values.
2016-05-14 20:09:37 +00:00
Oleksandr Tymoshenko
0cc376c134 Use OF_prop_free instead of direct call to free(9)
Reviewed by:	jhibbits
2016-05-14 20:06:38 +00:00
Oleksandr Tymoshenko
68dd3f144c Use OF_prop_free instead of direct call to free(9)
Reviewed by:	sgalabov
2016-05-14 20:05:35 +00:00
Adrian Chadd
6699a81195 [bwn] add BCMA chip identifiers.
This will eventually live in sys/dev/bhnd/, but I won't use that until
we migrate the whole driver over.

So, this'll live here for now.

Obtained from:	Linux b43 (definitions)
2016-05-14 20:03:24 +00:00
Rick Macklem
1390cca2b1 Fix fuse to use DIRECT_IO when required.
When a file is opened write-only and a partial block was written,
buffered I/O would try and read the whole block in. This would
result in a hung thread, since there was no open (fuse filehandle)
that allowed reading. This patch avoids the problem by forcing
DIRECT_IO for this case.
It also sets DIRECT_IO when the file system specifies the FN_DIRECTIO
flag in its reply to the open.

Tested by:	nishida@asusa.net, freebsd@moosefs.com
PR:		194293, 206238
MFC after:	2 weeks
2016-05-14 20:03:22 +00:00
Adrian Chadd
93e99e4f1a [bwn] add more debugging bits.
I'm hoping to migrate the device_printf() bits out into macros so we can
control it later.

Also, add some new debug sections that I'll soon be using.
2016-05-14 20:02:02 +00:00
Adrian Chadd
7780dd710c [bwn] migrate sqrt and add another couple of util routines.
bwn_sqrt() is in the PHY-LP code but is also needed by the upcoming
PHY-N support.

The other two routines are used by the PHY-N code.

The next commit will introduce it into the compile and pull bwn_sqrt()
out of the PHY-LP source.
2016-05-14 19:52:04 +00:00
Jared McNeill
f4f53c0a5a Add DTS files for the Allwinner A83T SoC and the Sinovoip BananaPi BPI-M3
development board.
2016-05-14 18:47:36 +00:00
Oleksandr Tymoshenko
27b917c85e Use OF_prop_free instead of direct call to free(9) 2016-05-14 18:44:30 +00:00
John Baldwin
fdce57a042 Add an EARLY_AP_STARTUP option to start APs earlier during boot.
Currently, Application Processors (non-boot CPUs) are started by
MD code at SI_SUB_CPU, but they are kept waiting in a "pen" until
SI_SUB_SMP at which point they are released to run kernel threads.
SI_SUB_SMP is one of the last SYSINIT levels, so APs don't enter
the scheduler and start running threads until fairly late in the
boot.

This change moves SI_SUB_SMP up to just before software interrupt
threads are created allowing the APs to start executing kernel
threads much sooner (before any devices are probed).  This allows
several initialization routines that need to perform initialization
on all CPUs to now perform that initialization in one step rather
than having to defer the AP initialization to a second SYSINIT run
at SI_SUB_SMP.  It also permits all CPUs to be available for
handling interrupts before any devices are probed.

This last feature fixes a problem on with interrupt vector exhaustion.
Specifically, in the old model all device interrupts were routed
onto the boot CPU during boot.  Later after the APs were released at
SI_SUB_SMP, interrupts were redistributed across all CPUs.

However, several drivers for multiqueue hardware allocate N interrupts
per CPU in the system.  In a system with many CPUs, just a few drivers
doing this could exhaust the available pool of interrupt vectors on
the boot CPU as each driver was allocating N * mp_ncpu vectors on the
boot CPU.  Now, drivers will allocate interrupts on their desired CPUs
during boot meaning that only N interrupts are allocated from the boot
CPU instead of N * mp_ncpu.

Some other bits of code can also be simplified as smp_started is
now true much earlier and will now always be true for these bits of
code.  This removes the need to treat the single-CPU boot environment
as a special case.

As a transition aid, the new behavior is available under a new kernel
option (EARLY_AP_STARTUP).  This will allow the option to be turned off
if need be during initial testing.  I plan to enable this on x86 by
default in a followup commit in the next few days and to have all
platforms moved over before 11.0.  Once the transition is complete,
the option will be removed along with the !EARLY_AP_STARTUP code.

These changes have only been tested on x86.  Other platform maintainers
are encouraged to port their architectures over as well.  The main
things to check for are any uses of smp_started in MD code that can be
simplified and SI_SUB_SMP SYSINITs in MD code that can be removed in
the EARLY_AP_STARTUP case (e.g. the interrupt shuffling).

PR:		kern/199321
Reviewed by:	markj, gnn, kib
Sponsored by:	Netflix
2016-05-14 18:22:52 +00:00
Jared McNeill
c9aad79aa9 Add allwinner,sun8i-a83t-i2c to the list of compatible devices. 2016-05-14 18:02:47 +00:00
Michael Tuexen
574679afe9 Fix a locking bug which only shows up on Mac OS X.
MFC after: 1 week
2016-05-14 13:44:49 +00:00
Jared McNeill
3e104ce8ba Update comment at top of file to mention all currently supported Allwinner
SoCs. Previously mentioned A20 and A31, added A31S, A83T, and H3.
2016-05-14 10:39:57 +00:00
Bjoern A. Zeeb
9e1252ae20 Revert r299739. That did not make it better.
Instead disconnect gpiokeys from the build until it's fixed and buildable;
the SUBDIR list was not ordered properly anyway ;-)
2016-05-14 09:39:21 +00:00
Bjoern A. Zeeb
404c979523 Blind long shot. Add ofw_gpiobus.c to the SRCS list in the hope to
make the remaining MIPS kernels compile which set MODULES_OVERRIDE="gpio..."
2016-05-14 09:18:50 +00:00
Bjoern A. Zeeb
b3b9415f8f Update file list for sfgxe(4) again and hey, my amd64 kernels compile again. 2016-05-14 08:55:15 +00:00
Bjoern A. Zeeb
2e9090dfbe Revert parts of r299575 in order to make more MIPS kernels build
again hopefully.
Rather than blindly removing a supposedly unused variable as reported by
the Clang Static Analyzer, inspect the code and hide them with proper
#ifdefs as they are used in certain conditional parts of the code.
2016-05-14 08:54:34 +00:00
Andrew Rybchenko
1943fefa8f sfxge(4): remove unused EFX PHY symbols
Submitted by:   Andy Moreton <amoreton at solarflare.com>
Sponsored by:   Solarflare Communications, Inc.
MFC after:      1 week
2016-05-14 06:20:08 +00:00
Andrew Rybchenko
0489c34fc2 sfxge(4): remove obsolete EFX_MON types
Submitted by:   Andy Moreton <amoreton at solarflare.com>
Sponsored by:   Solarflare Communications, Inc.
MFC after:      1 week
2016-05-14 06:18:49 +00:00
Andrew Rybchenko
45de2df438 sfxge(4): remove unimplemented sensor reconfigure method
Submitted by:   Andy Moreton <amoreton at solarflare.com>
Sponsored by:   Solarflare Communications, Inc.
MFC after:      1 week
2016-05-14 06:17:55 +00:00
Andrew Rybchenko
6faddc3444 sfxge(4): remove unimplemented sensor reset method
Submitted by:   Andy Moreton <amoreton at solarflare.com>
Sponsored by:   Solarflare Communications, Inc.
MFC after:      1 week
2016-05-14 06:17:03 +00:00
Andrew Rybchenko
39abff47d7 sfxge(4): fix build with -Werror=pointer-sign
-Werror=pointer-sign is enabled in OmniOS GLD driver build.

Sponsored by:   Solarflare Communications, Inc.
MFC after:      1 week
2016-05-14 06:16:14 +00:00
Andrew Rybchenko
0c9092472f sfxge(4): remove unimplemented MAC reset method
Submitted by:   Andy Moreton <amoreton at solarflare.com>
Sponsored by:   Solarflare Communications, Inc.
MFC after:      1 week
2016-05-14 06:14:28 +00:00
Andrew Rybchenko
34ce59874d sfxge(4): cleanup: remove unused define EFX_EVQ_FALCON_TIMER_QUANTUM_NS
Sponsored by:   Solarflare Communications, Inc.
MFC after:      1 week
2016-05-14 06:13:24 +00:00
Andrew Rybchenko
05716a35e7 sfxge(4): cleanup: remove unused variable flags
Sponsored by:   Solarflare Communications, Inc.
MFC after:      1 week
2016-05-14 06:12:26 +00:00
Bjoern A. Zeeb
d8ab84fec4 Remove more files from sfxge(4) which are no longer in the tree
in order to make the universe a more happy place.
2016-05-14 06:09:01 +00:00
Kristof Provost
3fcb1aaef1 vtnet: fix panic on unload
Since r276367 added the virtio_mmio support vtnet_modevent() gets called twice.
This resulted in a memory leak during load and a panic on unload.

Count the loads so we only initialise once (just like cxgbe(4)), and only clean
up in the final unload.

PR:		209428
Submitted by:	novel@FreeBSD.org
MFC after:	1 week
2016-05-14 06:07:15 +00:00
Andrew Rybchenko
8a53d16bd7 sfxge(4): remove unimplemented EFX PHY methods
Submitted by:   Andy Moreton <amoreton at solarflare.com>
Sponsored by:   Solarflare Communications, Inc.
MFC after:      1 week
2016-05-14 06:06:48 +00:00
Andrew Rybchenko
2d9312f664 sfxge(4): import TLV layout from firmwaresrc
Submitted by:   Laurence Evans <levans at solarflare.com>
Sponsored by:   Solarflare Communications, Inc.
MFC after:      1 week
2016-05-14 06:05:45 +00:00
Andrew Rybchenko
7a3e390b24 sfxge(4): remove obsolete EFSYS_OPT_PHY_PROPS option and APIs
Submitted by:   Andy Moreton <amoreton at solarflare.com>
Sponsored by:   Solarflare Communications, Inc.
MFC after:      1 week
2016-05-14 06:04:29 +00:00
Andrew Rybchenko
d31404ab6f sfxge(4): remove PHY property method stubs
Submitted by:   Andy Moreton <amoreton at solarflare.com>
Sponsored by:   Solarflare Communications, Inc.
MFC after:      1 week
2016-05-14 06:03:18 +00:00
Andrew Rybchenko
16e5d7bfd0 sfxge(4): move ef10 definitions to ef10_impl.h
Submitted by:   Andy Moreton <amoreton at solarflare.com>
Sponsored by:   Solarflare Communications, Inc.
MFC after:      1 week
2016-05-14 06:02:00 +00:00
Andrew Rybchenko
d5bd0d6b06 sfxge(4): prepare for moving EF10 definitions to ef10_impl.h
Move legacy privilege masks near to their only user.
Move Huntington definitions to the top of hunt_impl.h to prepare
for moving the remaining EF10 definitions to ef10_impl.h.

Submitted by:   Andy Moreton <amoreton at solarflare.com>
Sponsored by:   Solarflare Communications, Inc.
MFC after:      1 week
Differential Revision:  https://reviews.freebsd.org/D6343
2016-05-14 06:00:00 +00:00
Andrew Rybchenko
f7aa4b3d07 sfxge(4): rename falconsiena_filter types
Falcon support has been removed, so this code only supports Siena.

Submitted by:   Andy Moreton <amoreton at solarflare.com>
Sponsored by:   Solarflare Communications, Inc.
MFC after:      1 week
Differential Revision:  https://reviews.freebsd.org/D6342
2016-05-14 05:59:18 +00:00
Oleksandr Tymoshenko
bebd526933 Use OF_prop_free instead of direct call to free(9)
Reviewed by:	mmel@
2016-05-14 05:00:17 +00:00
Oleksandr Tymoshenko
f4eefe43b2 Use OF_prop_free instead of direct call to free(9)
Reviewed by:	mmel@
2016-05-14 04:59:36 +00:00
Oleksandr Tymoshenko
39a997283f Use OF_prop_free instead of direct call to free(9)
Approved by:	jmcneill
2016-05-13 22:28:02 +00:00
Oleksandr Tymoshenko
bb307f247a Use OF_prop_free instead of direct call to free(9) 2016-05-13 22:05:16 +00:00
Mark Johnston
ce59ff90af Fix a bug in r298340: "sim" was referenced after being unset. 2016-05-13 20:54:54 +00:00
Alan Cox
d3ffaee8e6 Eliminate an unused #include. For a brief period of time, _unrhdr.h was
used to implement PCID support on amd64.

Reviewed by:	kib
2016-05-13 20:14:41 +00:00
Ed Maste
4de3a46c66 Use awk to run bhnd's awk script, to allow noexec src dir
PR:		209435
Submitted by:	Landon Fuller <landonf@landonf.org>
Differential Revision:	https://reviews.freebsd.org/D6312
2016-05-13 18:56:56 +00:00
Alexander Motin
d2a2ccbc65 Fix FCP_CMD LENGTH mask in ATIO7 IOCB.
This caused "long IU length (16384) ignored" errors following by others.

MFC after:	2 weeks
2016-05-13 18:55:03 +00:00
Ed Maste
89f0b8c618 Remove sh accidentally added to dependency lines in r299684
Submitted by:	Landon Fuller <landonf@landonf.org>
2016-05-13 18:54:48 +00:00
Adrian Chadd
c390729786 [bwn] add N-PHY related register defintions.
* Add the siba bus phy/mac/bandwidth clock definitions (TGSLOW*)
* Add the PHY-N register gateway (BWN_PHY_N())
* Add the PHY-N TX phystat1 register - we need to actually fill out
  more of the PHY encoding information when we assemble a frame.
* Various ancillary stuff

Nothing uses this yet, but I do have CCK/OFDM somewhat working
in 2GHz mode on a PHY-N device.

Obtained from:	b43 (definitions)
2016-05-13 18:41:36 +00:00
Emmanuel Vadot
0aa4b81381 Add support for Allwinner H3 SoC.
For now clocks, GPIO, Pinmux, UART, MMC, EHCI is supported.
Tested on OrangePi-One

Reviewed by:	jmcneill
Approved by:	cognet (mentor)
Differential Revision:	https://reviews.freebsd.org/D6311
2016-05-13 18:20:54 +00:00
Navdeep Parhar
96807c23ce cxgbe(4): Update T5 and T4 firmwares to 1.15.37.0.
These firmwares were obtained from the "Chelsio T5/T4 Unified Wire
v2.12.0.3 for Linux" release.  Changes since 1.14.4.0 (which is the
firmware in -STABLE branches) are in the "Release Notes" accompanying
the Unified Wire release and are copy-pasted here as well.

22.1. T5 Firmware
+++++++++++++++++++++++++++++++++

Version : 1.15.37.0
Date    : 04/27/2016
================================================================================

FIXES
-----

BASE:
 - Fixed an issue in FW_RSS_VI_CONFIG_CMD handling where the default ingress
   queue was ignored.
 - Fixed an issue where adapter failed to load fw by adjusting DRAM frequency.
 - Fixed an issue in watchdog which was causing VM bring-up failure after reboot.
 - Fixed 40G link failures with some switches when auto-negotiation enabled.
 - Fixed to improve on link bring-up time.
 - Per port buffer groups size doubled to improve performance.
 - Fixed an issue where bogus d3hot bits were set causing traffic stall.
 - Fixed an issue where sometimes adapter was not seen after reboot.
 - Fixed an issue where iWARP was crashing in conjunction with traffic management.
 - Fixed an issue where link failed to come up after removing twinax cable and
   inserting optical module.

ETH
 - Fixed a link flap issue on T580-CR.

OFLD
 - Fixed a potential iSCSI data corruption issue by disabling RxFragEn flag.

FOiSCSI
 - Fixed an issue in recovery path where connection was getting closed before
   recovery processing was done.
 - Fixed an issue in TCP port reuse.
 - Fixed an issue in recovery path when large number (>64) of iSCSI connections
   were in use.
 - Returned ENETUNREACH if IP was not been provisioned yet and driver tried to
   use given inerface.
 - Fixed an issue where fw was sending ENETUNREACH event for normal tcp
   disconnection.

DCBX
 - Fixed an issue where iscsi tlv is sent incorrectly to host. (DCBX CEE)
 - Fixed an issue where apply bit set for APP id was affecting the ETS and PFC
  settings.(DCBX IEEE)
 - Fixed an issue where app priority values are not handled correctly in fw.
  (DCBX IEEE)
 - Fixed an issue where enable/disable dcbx can cause crash. (DCBX CEE,DCBX IEEE)

FOFCoE
 - Removed BB6 support.

ENHANCEMENTS
------------

BASE:
 - Added new interface to program DCA settings in SGE contexts; allow 32-byte
   IQE size
 - Added PTP interface fw_ptp_ts to support PTP Frequeny and Offset adjustment.
 - Added MPS raw interface.

ETH:
 - New mailbox command FW_DCB_IEEE_CMD api added for IEEE dcbx.

OFLD:
 - WR opcode is returned to host in cqe error response.

22.2. T4 Firmware
+++++++++++++++++

Version : 1.15.37.0
Date    : 04/27/2016
================================================================================

FIXES
-----

BASE:
 - Fixed an issue in FW_RSS_VI_CONFIG_CMD handling where default ingress queue
   was ignored.
 - Fixed an issue in watchdog which was causing VM bring-up failure after reboot.
 - Per port buffer groups size doubled to improve performance.
 - Fixed an issue where iWARP was crashing in conjunction with traffic management.

FOiSCSI:
 - Fixed an issue in recovery path where connection was getting closed before
   recovery processing was done.
 - Fixed an issue in TCP port reuse.
 - Fixed an issue in recovery path when large number (>64) of iSCSI connections
   were in use.
 - Returned ENETUNREACH if IP had not been provisioned yet and driver tried to
   use given inerface.

DCBX
 - Fixed an issue where iscsi tlv is sent incorrectly to host.(DCBX CEE)
 - Fixed an issue where enable/disable dcbx can cause crash in firmware.(DCBX CEE)

FOiSCSI
 - Fixes an issue where fw was sending ENETUNREACH event for normal tcp
   disconnection.

FOFCoE
 - Removed BB6 support.

ENHANCEMENTS
------------

BASE:
 - Added MPS raw interface.

ETH:
 - New mailbox command FW_DCB_IEEE_CMD api added for IEEE dcbx.
================================================================================

Obtained from:	Chelsio Communications
MFC after:	6 weeks
Relnotes:	yes
Sponsored by:	Chelsio Communications
2016-05-13 17:38:59 +00:00
Dimitry Andric
16fba18fc0 After r299241, which added bhnd(4), use sh to run the shell scripts for
generating nvram maps, to allow a noexec-mounted source directory.

Reported by:	Johan Hendriks <joh.hendriks@gmail.com>
PR:		209435
2016-05-13 16:35:37 +00:00
Andrew Turner
5db4448f06 Add support to the arm64 busdma to handle the cache. For now this is
disabled, however when we enable it it will default to assume memory is
not cache-coherent, unless either the tag was created or the parent was
marked as cache-coherent.

Obtained from:	ABT Systems Ltd
Relnotes:	yes
Sponsored by:	The FreeBSD Foundation
2016-05-13 16:03:50 +00:00
Bjoern A. Zeeb
587fe827b3 hunt_ev.c was deleted with r299596. Remove it from the files list to
(hopefully) unbreak amd64 LINT kernels.

MFC after:	1 week
2016-05-13 15:32:16 +00:00
Bjoern A. Zeeb
d68b7cfac5 Remove the extra _RD as _RDTUN already includes it.
Submitted by:	emaste
MFC after:	2 weeks
2016-05-13 15:29:40 +00:00
Andrew Turner
f3ad8ea007 Add DMA sync operations around accessing the dwmmc descriptor ring. Even
with it maps as cache-coherent we still need to call bus_dmamap_sync.

Obtained from:	ABT Systems Ltd
Sponsored by:	The FreeBSD Foundation
2016-05-13 15:15:54 +00:00
Bjoern A. Zeeb
2474dccf1a We already turn the AMD erratum383 workaround on for certain VM_GUEST_VM
if specific CPU features are not present.
Some simulation environments, e.g. gem5, have been found to require more
TLB management from the kernel in certain setups. It is currently unclear why.
Turning on the workaround_erratum383 seems to help and make problems (panics)
go away.
Given this is a fairly uncommon environment so far, allowing the workaround
to be manually enabled from loader in order to make debugging and comparing
traces easier, but also to allow gem5 run FreeBSD in X86 timing mode, seems
to be the least intrusive option for now until the issue if fully understood.

Sponsored by:	DARPA/AFRL
Reviewed by:	kib, alc (earlier)
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D6206
2016-05-13 15:11:17 +00:00
Hans Petter Selasky
fdddd267d7 Handle case of class being set, but not parent when calling
device_register() in the LinuxKPI.

Obtained from:	kmacy @
MFC after:	1 week
Sponsored by:	Mellanox Technologies
2016-05-13 13:01:02 +00:00