Commit Graph

212323 Commits

Author SHA1 Message Date
Adrian Chadd
ac31839dd2 [bwn] Add PHY-N call hooks. 2016-05-17 07:12:00 +00:00
Adrian Chadd
98d0edeff0 [bwn] add PHY-N glue.
It defaults to stubbing out PHY-N bindings, but it can be flipped to
call into the b43 PHY-N port.
2016-05-17 07:11:12 +00:00
Adrian Chadd
e744622654 [bwn] add the BWN_GPL_PHY option.
This will eventually enable building the GPL PHY hooks needed for
running b43 based PHYs.  For now it'll just build PHY-N.
2016-05-17 07:10:30 +00:00
Adrian Chadd
dbf8e132e1 [bwn] add initial bwn(4) N-PHY code, ported from Linux b43.
This is a GPLv2 PHY-N implementation based on the Linux b43 driver,
ported over to work in bwn(4).

I've tested this on the BCM4321 11abgn device, in 11bg and 11a modes.
The b43 PHY code only supports 11abg, no 11n, and 20MHz only wide
channels.

Yes, this is a GPLv2 driver, so it won't be included in the
default builds.

Tested:

* BCM4321 11abgn device (Apple!), 11bg and 11a STA mode.

Obtained from:	Linux b43
2016-05-17 07:09:24 +00:00
Adrian Chadd
8ef24a0d4b [bhnd] Finish bhnd(4) PCI/PCIe-G1 hostb support.
Now that we've got access to SPROM and can access board identification,
this implements all known remaining hardware work-arounds for the bhnd(4)
PCI and PCIe-G1 cores operating endpoint mode.

Additionally, this adds an initial set of skeleton PCIe-G2 hostb and pcib
drivers, required by fullmac and newer softmac devices.

Submitted by:	Landon Fuller <landonf@landonf.org>
Differential Revision:	https://reviews.freebsd.org/D6377
2016-05-17 06:52:53 +00:00
Stanislav Galabov
32f8bbf8cd Add proper PCIe init for MT7628/MT7688 SoCs
PCIe PHY needs different initialization on MT7628/MT7688 SoCs than it does
on MT7620.
However, LEDE (and OpenWRT) dts files have the PCIe node for MT7628/MT7688
as compatible with mt7620-pci.
We already can handle this properly in our driver, so we just need to add
compat strings to fbsd-mt7628an.dtsi and the PCIe driver.

Approved by:	adrian (mentor)
Sponsored by:	Smartcom - Bulgaria AD
Differential Revision:	https://reviews.freebsd.org/D6395
2016-05-17 06:45:25 +00:00
Stanislav Galabov
179f14534e Import LEDE dts files for Ralink/Mediatek
This is an import of the reworked LEDE dts files. Besides other things
they make it easier for us to reuse.

The only diffs left are for the following SoCs:
MT7620A (fbsd-mt7620a.dtsi)
MT7621 (fbsd-mt7621.dtsi)
MT7628 (fbsd-mt7628an.dtsi)
RT3883 (fbsd-rt3883.dtsi)

So we include the fbsd-*.dtsi files at the end of the original LEDE dtsi
files, using '#include "fbsd-xxxx.dtsi"'.
For example, for MT7621, the LEDE dtsi file is mt7621.dtsi. At the end of
it we add:
#include "fbsd-mt7621.dtsi"

Approved by:	adrian (mentor)
Obtained from:	LEDE project
Sponsored by:	Smartcom - Bulgaria AD
Differential Revision:	https://reviews.freebsd.org/D6394
2016-05-17 06:42:24 +00:00
Stanislav Galabov
1027d6d672 Fix issues with mt762x etherswitch driver
Fix issues that crept in with initial import.

Approved by:	adrian (mentor)
Sponsored by:	Smartcom - Bulgaria AD
Differential Revision:	https://reviews.freebsd.org/D6393
2016-05-17 06:30:46 +00:00
Andrew Rybchenko
2be4ef39bc sfxge(4): only raise an exception after MC assert or reboot in the common code
Fix efx_mcdi_request_poll so it only raises an exception if EIO is
reported from a detected MC assert or reboot. This prevents
an unnecessary exception being raised if an MCDI response error code
is trandlated to EIO.

Submitted by:   Andy Moreton <amoreton at solarflare.com>
Sponsored by:   Solarflare Communications, Inc.
MFC after:      1 week
Differential Revision:  https://reviews.freebsd.org/D6392
2016-05-17 06:28:03 +00:00
Andrew Rybchenko
fdbffbab18 sfxge(4): restore clearing of MCDI new epoch flag in common code
Submitted by:   Andy Moreton <amoreton at solarflare.com>
Sponsored by:   Solarflare Communications, Inc.
MFC after:      1 week
Differential Revision:  https://reviews.freebsd.org/D6390
2016-05-17 06:27:19 +00:00
Andrew Rybchenko
78e5c87c3b sfxge(4): fix Medford timer quantum calculation in common code
The event/timer block used sysclk in Huntington, but has been
moved to the dpcpu clock domain for Medford. Fix the computed
timer quantum to use the right clock.

Submitted by:   Andy Moreton <amoreton at solarflare.com>
Sponsored by:   Solarflare Communications, Inc.
MFC after:      1 week
Differential Revision:  https://reviews.freebsd.org/D6389
2016-05-17 06:26:02 +00:00
Andrew Rybchenko
d8484af2ba sfxge(4): query and use current MTU if setting the MTU fails
This allows the driver to fall back to the largest usable MTU if a
user attempts to configure an unprivileged function with an MTU higher
than that of the attached port.

Submitted by:   Mark Spender <mspender at solarflare.com>
Sponsored by:   Solarflare Communications, Inc.
MFC after:      1 week
Differential Revision:  https://reviews.freebsd.org/D6387
2016-05-17 06:25:00 +00:00
Andrew Rybchenko
5df3232c85 sfxge(4): store licensing state in efx_lic
Check licensing support at NIC startup to avoid multiple checks later.
As state is stored, licensing initialisation is moved later in start
procedure.

Submitted by:   Richard Houldsworth <rhouldsworth at solarflare.com>
Sponsored by:   Solarflare Communications, Inc.
MFC after:      1 week
Differential Revision:  https://reviews.freebsd.org/D6385
2016-05-17 06:23:50 +00:00
Kevin Lo
b0f7be91aa The EEPROM is lying about antennas. Don't hardcode things based on the chip
version which is not what the vendor driver happens to do.
2016-05-17 06:04:33 +00:00
Don Lewis
b74e373971 swprintf() and apparently wcsftime() want the their output buffer size
specified in terms of the the number of wide characters and not
sizeof(buffer).

Reported by:	Coverity
CID:		1007605, 1007606
MFC after:	1 week
2016-05-17 05:05:30 +00:00
Greg Lehey
e5d4b0faa5 Correct use of incorrect grammar. 2016-05-17 04:40:00 +00:00
Don Lewis
78db15ccf7 When clearing rtmsg, pass &rtmsg to bzero() instead of the address of
just the header

Reported by:	Coverity
CID:		1007568, 1194256
MFC after:	1 week
2016-05-17 04:03:45 +00:00
Bjoern A. Zeeb
54d9f34ea3 Mark the unused arguments of various SYSINIT functions __unused.
MFC after:	2 weeks
Sponsored by:	The FreeBSD Foundation
2016-05-17 00:32:36 +00:00
Adrian Chadd
d5a1741219 [mips] also add otus/urtwn USB modules.
I'm using both AR933x (because the boards fit in small boxes) as well
as AR934x for doing USB wifi testing on MIPS.

So far so good, for both of them.
2016-05-17 00:31:37 +00:00
Adrian Chadd
e08a4f72e9 [mips] add urtwn and otus NIC modules.
I'm using this platform for testing USB wifi on MIPS.
2016-05-17 00:30:34 +00:00
Simon J. Gerraty
9d0fa50eed Use != 0 to be clear 2016-05-17 00:27:18 +00:00
Peter Wemm
40f58305bb Attempt to fix r299660:
slba is used only for the GPT case.
elba is used if either GPT or LOADER_GELI_SUPPORT is enabled.
2016-05-17 00:24:53 +00:00
Adrian Chadd
d567592b68 [bhnd] Centralize fetching of board information
Centralizes fetching of board information (vendor, type, revision, etc),
and adds support for matching quirks against board identification info.

* Adds a BHND_BUS_READ_BOARD_INFO(), allowing bhnd bus/bus parent(s) to
  handle implementation-specific fetching of board info.
* Integrates board type constants from the latest Broadcom ISC-licensed
  bcmdevs.h included in dd-wrt's Broadcom driver source drops.
* Adds support for matching on chip/board quirks to bhnd_device_quirks()/
  bhnd_chip_quirks().
* Use the new board/chip quirk matching to match Apple devices that failed
  to set BFL2_PCIEWAR_OVR in SROM.

Submitted by:	Landon Fuller <landonf@landonf.org>
Differential Revision:	https://reviews.freebsd.org/D6361
2016-05-17 00:23:46 +00:00
Simon J. Gerraty
0d2181d9ac Allow -f - to read from stdin. 2016-05-17 00:08:43 +00:00
Adrian Chadd
041b2de9cc [mips/broadcom] Add initial support for Broadcom MIPS processor
Relies on BHND(4) driver.

There files contains machine-dependent code for Broadcom MIPS processor and
provide UART driver.

This is a work in progress; it and the current bhnd code is enough to boot
on the ASUS RT-N16 and RT-N53 platforms.

Submitted by:	Michael Zhilin <mizhka@gmail.com>
Differential Revision:	https://reviews.freebsd.org/D6251
2016-05-17 00:00:01 +00:00
Adrian Chadd
188d3a278e [mips] Improve MIPS trampoline code
This patch fix trampoline build. inckern.S increases stack and calls _startC
of elf_trampoline, so inckern.S should be called before elf_trampoline. gcc4.2 puts
text (code) into image according to order of source files in this call, so order has changed.

In addition make will install trampoline kernel. It allows to use kernel for firmware build.

Submitted by:	Michael Zhilin <mizhka@gmail.com>
Differential Revision:	https://reviews.freebsd.org/D6242
2016-05-16 23:56:31 +00:00
Adrian Chadd
9c60232add [mips/broadcom] Add initial code for interrupts on the Broadcom MIPS processor
Broadcom MIPS processor doesn't reset TI flag if additional manipulation
is done.

Thanks to @sobomax!
2016-05-16 23:54:28 +00:00
Don Lewis
647bedd5da Don't walk off the end of the array when proto isn't explicitly
listed above.  Instead update the catch-all "Others" bucket.

Reported by:	Coverity
CID:		1007571, 1007572
MFC after:	1 week
2016-05-16 23:47:08 +00:00
Adrian Chadd
fb403678c2 [bhnd] Add logging macros to BHND.
There are 5 logging levels:

* ERROR
* WARN
* INFO
* DEBUG
* TRACE

There are 2 logging context:

* with
* without device

DEBUG and TRACE records are printed only if bootverbose.
Logging records are printed with source code line information if acceptable
logging level is DEBUG or TRACE.

Submitted by:	Michael Zhilin <mizhka@gmail.com>
Differential Revision:	https://reviews.freebsd.org/D6247
2016-05-16 23:40:32 +00:00
Adrian Chadd
9d8ae244a3 [bhnd] Add support for matching of MIPS & ARM cores
Extend macros for MIPS & ARM cores. Now only BCM cores can be matched by matching mechanism.

Submitted by:	Michael Zhilin <mizhka@gmail.com>
Differential Revision:	https://reviews.freebsd.org/D6246
2016-05-16 23:37:18 +00:00
Don Lewis
010e93758f Set ai2 to NULL in in find_host() before the loop and after calling
freeaddrinfo() on it to indicate that it doesn't point to a valid
addrinfo list.  This fixes this Coverity issues:
	1006368 Uninitialized pointer read
	1018506 Double free
	1305590 Resource leak
that can be triggered in the hp->hostname[0] != '\0' case.

Don't treat a character as a boolean.

Fix these Coverity issues:
	1009293 Unchecked return value from library
	1194246 Wrong size argument
by tweaking the status file extend code.

Reported by:	Coverity
CID:		1006368, 1018506, 1305590, 1009293, 1194246
Reviewed by:	rmacklem
Feedback from:	hrs
MFC after:	1 week
Differential Revision:	D6398
2016-05-16 23:29:04 +00:00
Don Lewis
b6ecea3082 Actually use the loop interation limit so carefully computed on the
previous line to prevent buffer overflow.  This turns out to not be
important because the upstream xdr code already capped the object
size at the proper value.  Using the correct limit here looks a lot
less scary and should please Coverity.

Reported by:	Coverity
CID:		1199309, 1199310
MFC after:	1 week
2016-05-16 23:00:48 +00:00
Adrian Chadd
a971082444 [bwn] add opt_wlan.h / opt_bwn.h for build-time control
This is a separate commit as I have local changes to bwn for now and
this needs a manual merge/commit.

Sponsored by:	Palm Springs
2016-05-16 22:57:36 +00:00
Adrian Chadd
5025b8d583 [bwn] add opt_wlan.h and opt_bwn.h so we can enable bwn debugging as appropriate.
Tested:

* BCM4322, STA mode (11a)

Sponsored by:	Palm Springs
2016-05-16 22:56:45 +00:00
Adrian Chadd
5217d1308f [bwn] switch to ieee80211_add_channel()
This is an updated version of D6140.

Tested:

* BCM4321 11abgn, STA mode (11a)

Submitted by:	avos
Differential Revision:	https://reviews.freebsd.org/D6140
2016-05-16 22:39:17 +00:00
John Baldwin
ce83de10cb Use polling spin loops for timeouts during early boot.
Some ACPI operations such as mutex acquires and event waits accept a
timeout.  The ACPI OSD layer implements these timeouts by using regular
sleep timeouts.  However, this doesn't work during early boot before
event timers are setup.  Instead, use polling combined with DELAY()
to spin.

This fixes booting on upcoming Intel systems with Kaby Lake processors.

Tested by:	"Jeffrey E Pieper" <jeffrey.e.pieper@intel.com>
Reviewed by:	jimharris
MFC after:	1 week
2016-05-16 21:33:31 +00:00
Adrian Chadd
f52cfd7fdf [bwn] check DUALPHY; add BCM4322 to the don't-override list.
* DUALPHY in TGSHIGH tells us there's a phy that is dualband, rather than
  two separate PHYs/MACs (which we almost but don't quite yet support.)
  Use it.

* Add the BCM4322 PCI ID to the list of devices we don't override.
  This means the 2g/5g flags are preserved, and thus we get 5GHz
  operation (with N-PHY, of course.)

Tested:

* BCM4311, STA mode (11bg)
* BCM4312, STA mode (11bg)
* BCM4321, STA mode (11abg)

Sponsored by:	Palm Springs
2016-05-16 20:26:30 +00:00
Adrian Chadd
ad5ba0d73e [siba] fix up debugging.
* unbreak non-debug builds - don't default to debugging SCAN; that was
  left-over from my testing.
* include opt_siba.h, now that it's generated as appropriate.
* stick the debug enum outside the debug block, just so it's there for
  any code that wants to set siba_debug for some reason (like say,
  my debugging muckup.)
* make DPRINTF() use __VA_ARGS__ for formatting too, so it correctly
  handles printing w/ no args.
* Make DPRINTF() use device_printf().

Sponsored by:	Palm Springs
2016-05-16 20:22:52 +00:00
Adrian Chadd
d7821a33bb [siba] add SIBA_DEBUG option.
Sponsored by:	Palm Springs
2016-05-16 20:18:54 +00:00
Pedro F. Giffuni
63aa6c0cd9 dev/ow: Tag an unreachable switch default.
Coverity reports an uninitialized "dir" in case the switch defaults
without hitting any case. Respect the original intent and quell the
false positive with the relatively new __unreachable() builtin.

CID:	1331566
2016-05-16 20:04:38 +00:00
Pedro F. Giffuni
98b6ade62d libefi: Tag an unreachable switch default.
Coverity reports an uninitialized "len" in case the switch defaults
without hitting any case. Respect the original intent and quell the
false positive with the relatively new __unreachable() builtin.

CID:	1347796
2016-05-16 20:00:09 +00:00
Don Lewis
d2c82c0cfe Fix off by one error that overflowed the rep_len array when doing
the final NUL termination.

Reported by:	Coverity
CID:		1007617
MFC after:	1 week
2016-05-16 19:48:02 +00:00
Pedro F. Giffuni
c69cee69f9 Add a small set of logical operators to DDB command language.
This are based on Mach3.
Documentation is pending but has been promised.

Submitted by:	Dan Partelly
Reviewed by:	adrian, jhb (older version)

Differential Revision:	https://reviews.freebsd.org/D4230
RelNotes:	yes
2016-05-16 19:42:38 +00:00
Adrian Chadd
3c4efeae16 [siba] make the debug code somewhat useful again.
It's still not configurable by a kernel option; that'll come next.

Sponsored by:	Palm Springs
2016-05-16 19:39:05 +00:00
Andriy Voskoboinyk
af524a9f4b urtwn: add support for hardware multicast filter setup.
Tested with RTL8188EU and RTL8188CUS.
2016-05-16 19:10:59 +00:00
Bjoern A. Zeeb
d58f3e80b8 Add HWPMC_HOOKS to std.armv6 to make them available
so the module could be loaded.

Discussed with:	andrew
Reviewed by:	andrew
Sponsored by:	DARPA/AFRL
Differential Revision:	https://reviews.freebsd.org/D6359
2016-05-16 19:07:58 +00:00
Hans Petter Selasky
0f9f74597d Only lock Giant when needed in the LinuxKPI.
Suggested by:	ngie @
MFC after:	1 week
Sponsored by:	Mellanox Technologies
2016-05-16 17:41:25 +00:00
Alexander Motin
daa0dffb21 Reduce verbosity of "now sending synthesized status" message.
MFC after:	1 week
2016-05-16 17:18:26 +00:00
Alexander Motin
b2699a1bae No need to check login status for ZOMBIE ports.
ZOMBIE ports are always logged out, and so initiator may try to relogin.

MFC after:	1 weeks
2016-05-16 16:44:34 +00:00
Don Lewis
e29182f6c0 Fix an off by one error to avoid overflowing rp[].
Reported by:	Coverity
CID:		1007579
2016-05-16 16:16:46 +00:00