Commit graph

228096 commits

Author SHA1 Message Date
Alan Somers 9ccdc62331 Reap dead code
usr.bin/dc/inout.c
	Reap some dead code that was killed back in 2003 in OpenBSD, in
	version 1.8 of this file.

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

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

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

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

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

  hw.bwn_pci.preferred="1"

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

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

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

... or devinfo(8):

pcib2
  pci2
    bwn_pci0
      bhndb0
        bhnd0
          bwn0
          ...

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

  - BCM4312
  - BCM4318
  - BCM4321

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

  - BCM43224
  - BCM43225

Approved by:	adrian (mentor, implicit)
Sponsored by:	The FreeBSD Foundation & Plausible Labs
Differential Revision:	https://reviews.freebsd.org/D13041
2017-12-02 02:21:27 +00:00
Justin Hibbits 89c3a53299 Override memattr for mmap on the Freescale DIU driver
The Display Interface Unit (DIU) uses main memory for the framebuffer, which
is already mapped as cache coherent physical memory.  Prevent mmap() from
using its own attributes which may otherwise conflict.
2017-12-02 01:42:07 +00:00
Landon J. Fuller 78baa4d625 bhnd_pmu(4): Do not leak our chipc provider reference or clkctl state in
failure paths of bhnd_pmu_attach()

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

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

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

Approved by:	adrian (mentor, implicit)
Sponsored by:	The FreeBSD Foundation
2017-12-02 00:09:58 +00:00
Warner Losh 1227a4f4ea Fix all warnings related to geli and ZFS support on x86.
Default WARNS to 0 still, since there's still some warnings on other
architectures.

Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D13301
2017-12-02 00:07:37 +00:00
Warner Losh 0979948fe2 Tweaks to the beri boot loader so that it builds w/o warnings.
Sponsored by: Netflix
2017-12-02 00:07:31 +00:00
Warner Losh 59d395e062 Undefine _STANDALONE since this is test code. This is unsastifying,
but since we sadly only have one test, put this in as a stopgap.

Sponsored by: Netflix
2017-12-02 00:07:25 +00:00
Warner Losh dcaa2d76dc Fix random() and srandom() prototypes to match the standard.
These prototypes were needlessly different from the standard. Fix them
to be the same, and fix the surrounding code after the changes.

Sponsored by: Netflix
2017-12-02 00:07:19 +00:00
Warner Losh 9462787dba Move geli to common DO32 stuff
define DO32 since this is only build in amd64/i386
Remove files not needed.

Sponsored by: Netflix
2017-12-02 00:07:14 +00:00
Warner Losh 3a7d67e741 We don't need both _STAND and _STANDALONE. There's more places that
use _STANDALONE, so change the former to the latter.

Sponsored by: Netflix
2017-12-02 00:07:09 +00:00
Warner Losh b65d776328 Cleanup CFALGS usage here
Only define the CFLAGS we need.
SSP_CFLAGS is now defined globally, no need to define it here.
Define -D_STANDALONE globally for src/stand builds.

Sponsored by: Netflix
2017-12-02 00:07:04 +00:00
Warner Losh 4f6b287494 Minor flags cleanup
Move kernel includes and libsa includes together at the top of defs.mk
Move all machine specific defines from Makefile.inc to their friends
in defs.mk.
Add comments and remove now useless junk after the move.

Sponsored by: Netflix
2017-12-02 00:06:58 +00:00
Warner Losh 4291beb51b Remove stale dependency on ufsread.c
Remove the now-useless dependency on ufsread.c. In some cases, it was
on the wrong file. But in all cases, we now automatically generate
.depend files, so we don't need it explicitly.

Sponsored by: Netflix
2017-12-02 00:06:52 +00:00
Warner Losh 94ebc05f37 Fix missing .Dd bump 2017-12-01 22:52:45 +00:00
Mark Johnston e1703ef5ae Plug a name cache lock leak.
Reviewed by:	mjg
MFC after:	1 week
Sponsored by:	Dell EMC Isilon
2017-12-01 22:51:02 +00:00
Warner Losh 8e0cd68ff4 Correct history for Unix 2nd Edition through 6th Edition for the
system calls. Man pages are missing for v2 and v5, so any entries for
those versions were inferred by new implementations of these functions
in libc.

Obtained from: http://www.tuhs.org/cgi-bin/utree.pl
2017-12-01 22:48:20 +00:00
Konstantin Belousov b05a4a9db7 vmstat: fix style(9) violations and bump WARNS.
Based on the patch by:	Pawel Biernacki <pawel.biernacki@gmail.com>
Sponsored by:	Mysterious Code Ltd. (Pawel),
	  The FreeBSD Foundation (me)
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D13228
2017-12-01 22:38:28 +00:00
Warner Losh aeb71118e6 Mark all the system calls that were in 1st Edition Unix as such in the
HISTORY section. Note: Any system calls that were added prior to v7,
but after v1 weren't changed.

Obtained from: http://www.tuhs.org/cgi-bin/utree.pl?file=V1/man/man2
2017-12-01 22:26:36 +00:00
Eitan Adler f99112ded5 fmt(1): Fix usage of Nm macro 2017-12-01 21:44:23 +00:00
Kyle Evans 515694c636 a10_gpio: Add support for more modern pin configuration
a10_gpio previously accepted only {allwinner,}drive and {allwinner,}pull for
drive/bias setting, while newer DTS is using drive-strength and
bias-{disable,pull-up,pull-down} properties. Accept these properties as
well.

Additionally make bias and drive strength optional rather than required; not
setting them should just indicate that we do not need to configure these
properties.

Tested on:	BananaPi-M3 (a83t)
Reviewed by:	manu
Approved by:	emaste (implicit)
Obtained from:	NetBSD (partially)
Differential Revision:	https://reviews.freebsd.org/D13284
2017-12-01 20:51:08 +00:00
Stephen Hurd a027c8e958 Add support for SIOCGIFXMEDIA to iflib
SIOCGIFXMEDIA is required for extended ethernet media types,
but iflib did not support it.

Reported by:	Bhargava Chenna Marreddy <bhargava.marreddy@broadcom.com>
Sponsored by:	Limelight Networks
Differential Revision:	https://reviews.freebsd.org/D13312
2017-12-01 17:58:20 +00:00
Edward Tomasz Napierala 536062099a Add "vmaddr" ps(1) keyword.
Obtained from:	CheriBSD
MFC after:	2 weeks
Sponsored by:	DARPA, AFRL
2017-12-01 11:32:05 +00:00
Konstantin Belousov 36bce27be9 Destroy seltd st_mtx and st_wait in seltdfini().
A correct destruction is important for WITNESS(4) and LOCK_PROFILING(9).

Submitted by:	Sebastian Huber <sebastian.huber@embedded-brains.de>
MFC after:	1 week
2017-12-01 11:18:19 +00:00
Konstantin Belousov e8502826ce Add comment for vm_map_find_min().
Reviewed by:	alc
Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
X-Differential revision:	https://reviews.freebsd.org/D13155
2017-12-01 10:53:08 +00:00
Ed Schouten 1bf4012c84 Eliminate the last user of basename_r() in the base system.
In this case it's fairly easy to make use of basename().
2017-12-01 10:25:52 +00:00
Andrey V. Elsukov d8ba1ddc0f Do better cleaning in key_destroy() for VIMAGE case.
SPDB was cleaned using TAILQ_CONCAT() instead of calling key_unlink()
for each SP, thus we need to properly clean lists in each bucket of
V_sphashtbl to avoid panic in hashdestroy() when INVARIANTS is enabled.

Do the same for V_acqaddrhashtbl and V_acqseqhashtbl.

When we are called in DEFAULT_VNET, destroy also all global locks and
drain key_timer callout.

Reported by:	kp
Tested by:	kp
MFC after:	1 week
2017-12-01 09:59:42 +00:00
Toomas Soome e4f6a1bfa3 loader.efi: efipart should exclude iPXE stub block protocol
iPXE does insert stub  BLOCK IO protocol handle to rework other issues,
this handle is not usable as it does not provide actual implementation.

We can detect this situation by checking and validating the BlockSize
property, so this update does make sure we have BlockSize at least 512B
and its value is power of 2.

PR:		223969
Reported by:	Jeff Pieper
Reviewed by:	imp
Differential Revision:	https://reviews.freebsd.org/D13297
2017-12-01 06:37:12 +00:00
Ed Schouten 21631605fd Add an mlink for cloudabi32(4).
We already provide this for cloudabi64(4), so not adding it for
cloudabi32(4) is fairly inconsistent.

MFC after:	1 week
2017-12-01 05:57:05 +00:00
Eitan Adler 5f0345185b Revert license change.
This isn't identical to the one permitted by UCB since
it is copyright multiple people.
2017-12-01 03:22:40 +00:00
Glen Barber 30ba43e1a6 Fix port build flags passed to make(1) after r326315, where
it was missed for embedded image builds.

MFC after:	3 days
MFC with:	r326315
Sponsored by:	The FreeBSD Foundation
2017-11-30 20:53:57 +00:00
Glen Barber c205468e00 Fix an indentation nit.
Sponsored by:	The FreeBSD Foundation
2017-11-30 20:52:01 +00:00
Mark Johnston 3384cf0b45 Document gmirror sysctls.
MFC after:	2 weeks
2017-11-30 20:37:12 +00:00
Mark Johnston 2ceafb776e Update gmirror metadata less frequently when synchronizing.
We periodically record synchronization progress in the metadata
block of the disk being synchronized; this allows an interrupted
synchronization to be resumed. However, the frequency of these
updates heavily pessimized synchronization time on some media. This
change modifies gmirror to update metadata based on a time period,
and adds a sysctl to control that period. The default value results
in a much lower update frequency and increases the completion time
for an interrupted rebuild only marginally.

Reported by:	Andre Albsmeier <andre@fbsd.e4m.org>
MFC after:	3 weeks
2017-11-30 20:36:29 +00:00
Pedro F. Giffuni 64de3fdd58 SPDX: use the Beerware identifier. 2017-11-30 20:33:45 +00:00
Jung-uk Kim 82f0844956 Properly skip the first CPU. It only accidentally worked because the
CPU_FOREACH() loop always starts from BSP (cpu0) and the if condition
is always false for APs.

Reported by:	cem
2017-11-30 20:21:42 +00:00
Ed Schouten aea6d042a9 Port cloudabi32.ko to FreeBSD/arm64.
This change adds an implementation of a sysent for running CloudABI
armv6 and armv7 binaries on FreeBSD/arm64. It is a somewhat literal copy
of the armv6 version, except that it's been patched up to use the proper
registers.

Just like for cloudabi32.ko on FreeBSD/amd64, we make use of a vDSO that
automatically pads system call parameters to 64-bit value. These are
stored in a buffer on the stack, meaning we need to use copyin() and
copyout() unconditionally.
2017-11-30 17:58:48 +00:00
Pedro F. Giffuni c967e4ffa6 SPDX: oops .. not from CMU. 2017-11-30 15:58:38 +00:00
Pedro F. Giffuni 796df753f4 SPDX: Consider code from Carnegie-Mellon University.
Interesting cases, most likely from CMU Mach sources.
2017-11-30 15:48:35 +00:00
Pedro F. Giffuni cf3329887e SPDX: wrong license. 2017-11-30 15:45:42 +00:00
Alan Somers 3613ea59c7 Fix assertion when ZFS fails to open certain devices
"panic: vdev_geom_close_locked: cp->private is NULL"
This panic will result if ZFS fails to open a device due to either of the
following reasons:

1) The device's sector size is greater than 8KB.
2) ZFS wants to open the device RW, but it can't be opened for writing.

The solution is to change the initialization order to ensure that the
assertion will be satisfied.

PR:		221066
Reported by:	David NewHamlet <wheelcomplex@gmail.com>
Reviewed by:	avg
MFC after:	3 weeks
Sponsored by:	Spectra Logic Corp
Differential Revision:	https://reviews.freebsd.org/D13278
2017-11-30 15:36:06 +00:00
Alan Somers fb20566033 Revert r326399
Accidentally committed wrong file

Pointy hat to:	asomers
Sponsored by:	Spectra Logic Corp
2017-11-30 15:34:55 +00:00
Alan Somers de65823b48 Fix assertion when ZFS fails to open certain devices
"panic: vdev_geom_close_locked: cp->private is NULL"
This panic will result if ZFS fails to open a device due to either of the
following reasons:

1) The device's sector size is greater than 8KB.
2) ZFS wants to open the device RW, but it can't be opened for writing.

The solution is to change the initialization order to ensure that the
assertion will be satisfied.

PR:		221066
Reported by:	David NewHamlet <wheelcomplex@gmail.com>
Reviewed by:	avg
MFC after:	3 weeks
Sponsored by:	Spectra Logic Corp
Differential Revision:	https://reviews.freebsd.org/D13278
2017-11-30 15:28:29 +00:00
Pedro F. Giffuni 8820ecc040 SPDX: Fix some cases wrongly attributed to MIT.
In the cases of BSD-style license variants without clauses, use 0BSD for
the time being in lack of a better description.
2017-11-30 15:10:11 +00:00
Emmanuel Vadot 38c9c65ee4 r326394 is calling malloc with M_WAITOK under a lock, revert for now
Reported by:	andrew
2017-11-30 14:06:54 +00:00
Emmanuel Vadot 31e8b07376 devfs: Avoid a malloc/free if we just need to increment the refcount
MFC after:	1 week
Sponsored by:	Gandi.net
2017-11-30 12:38:42 +00:00
Edward Tomasz Napierala 2276703108 Make the ddb(4) "set" command list variables when called without parameters.
Obtained from:	CheriBSD
MFC after:	2 weeks
Sponsored by:	DARPA, AFRL
2017-11-30 12:22:15 +00:00
Hans Petter Selasky b58e7aacf6 Properly define the VLAN_XXX() function macros to avoid miscompilation when
used inside "if" statements comparing with another value.

Detailed explanation:
"if (a ? b : c != 0)" is not the same like "if ((a ? b : c) != 0)"
which is the expected behaviour of a function macro.

Affects:
toecore, linuxkpi and ibcore.

Reviewed by:	kib
MFC after:	3 days
Sponsored by:	Mellanox Technologies
2017-11-30 11:35:22 +00:00