]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
8 years agoFor pointers use NULL instead of 0.
Marcelo Araujo [Mon, 16 May 2016 00:36:12 +0000 (00:36 +0000)]
For pointers use NULL instead of 0.

MFC after: 2 weeks.

8 years agoFor pointers use NULL instead of 0.
Marcelo Araujo [Mon, 16 May 2016 00:35:39 +0000 (00:35 +0000)]
For pointers use NULL instead of 0.

MFC after: 2 weeks.

8 years agoFor pointers use NULL instead of 0.
Marcelo Araujo [Mon, 16 May 2016 00:34:48 +0000 (00:34 +0000)]
For pointers use NULL instead of 0.

MFC after: 2 weeks.

8 years agoUse strlcpy() instead of strncpy() when copying ifname to ensure
Don Lewis [Mon, 16 May 2016 00:25:24 +0000 (00:25 +0000)]
Use strlcpy() instead of strncpy() when copying ifname to ensure
that it is NUL terminated.  Additional NUL padding is not required
for short names.

Use sizeof(destination) in a few places instead of IFNAMSIZ.

Cast afp->af_ridreq and afp->af_addreq  to make the intent of
the code more obvious.

Reported by: Coverity
CID: 1009628100963010096311009632100963310096351009638
CID: 1009639100964010096411009642100964310096441009645
CID: 1009646100964710100491010050101005110100521010053
CID: 1010054101129310112941011295101129610112971011298
CID: 1011299130582113517201351721
MFC after: 1 week

8 years agoFix fuse for "cp" of a mode 0444 file to the file system.
Rick Macklem [Sun, 15 May 2016 23:15:10 +0000 (23:15 +0000)]
Fix fuse for "cp" of a mode 0444 file to the file system.

When "cp" of a file with read-only (mode 0444) to a fuse mounted
file system was attempted it would fail with EACCES. This was because
fuse would attempt to open the file WRONLY and the open would fail.
This patch changes the fuse_vnop_open() to test for an extant read-write
open and use that, if it is available.
This makes the "cp" of a read-only file to the fuse mounted file system
work ok.
There are simpler ways to fix this than adding the fuse_filehandle_validrw()
function, but this function is useful for future patches related to
exporting a fuse filesystem via NFS.

MFC after: 2 weeks

8 years agoAdd Allwinner A83T thermal sensor controller support.
Jared McNeill [Sun, 15 May 2016 22:36:55 +0000 (22:36 +0000)]
Add Allwinner A83T thermal sensor controller support.

The A83T thermal sensor controller has three sensors. Sensor 0 corresponds
to CPU cluster 0, sensor 1 to CPU cluster 1, and sensor 2 to the GPU. This
driver exports the temperature sensor readings via sysctl.

Calibration data is obtained from SRAM found in the Secure ID module.

Reviewed by: manu
Differential Revision: https://reviews.freebsd.org/D6378

8 years agoMake subsequent code reachable.
Cy Schubert [Sun, 15 May 2016 22:35:11 +0000 (22:35 +0000)]
Make subsequent code reachable.

Reported by: Coverity CID 1354625
MFC after: 3 days

8 years agoUse strlcpy() instead of strncpy() when copying ifname to ensure
Don Lewis [Sun, 15 May 2016 22:31:03 +0000 (22:31 +0000)]
Use strlcpy() instead of strncpy() when copying ifname to ensure
that it is NUL terminated.  Additional NUL padding is not required
for short names.

Reported by: Coverity
CID: 1009974
MFC after: 1 week

8 years agoUse strlcpy() instead of strncpy() when copying ifname to ensure
Don Lewis [Sun, 15 May 2016 22:17:41 +0000 (22:17 +0000)]
Use strlcpy() instead of strncpy() when copying ifname to ensure
that it is NUL terminated.  Additional NUL padding is not required
for short names.

Reported by: Coverity
CID: 99186, 991864, 991865
MFC after: 1 week

8 years agoUse strlcpy() instead of strncpy() when copying ifname to ensure
Don Lewis [Sun, 15 May 2016 22:06:21 +0000 (22:06 +0000)]
Use strlcpy() instead of strncpy() when copying ifname to ensure
that it is NUL terminated.  Additional NUL padding is not required
for short names.

MFC after: 1 week

8 years agoUse strlcpy() instead of strncpy() when copying ifname to ensure
Don Lewis [Sun, 15 May 2016 21:45:04 +0000 (21:45 +0000)]
Use strlcpy() instead of strncpy() when copying ifname to ensure
that it is NUL terminated.  Additional NUL padding is not required
for short names.

Reported by: Coverity
CID: 974852
MFC after: 1 week

8 years agoWhen handling SIOCSIFNAME ensure that the new interface name is NUL
Don Lewis [Sun, 15 May 2016 21:37:36 +0000 (21:37 +0000)]
When handling SIOCSIFNAME ensure that the new interface name is NUL
terminated.  Reject the rename attempt if the name is too long.

MFC after: 1 week

8 years agoopt_kdtrace.h is not needed for SDT probes as of r258541.
Mark Johnston [Sun, 15 May 2016 20:04:43 +0000 (20:04 +0000)]
opt_kdtrace.h is not needed for SDT probes as of r258541.

8 years agoEnable SATA power regulator at boot on Sinovoip BananaPi BPI-M3.
Jared McNeill [Sun, 15 May 2016 17:25:31 +0000 (17:25 +0000)]
Enable SATA power regulator at boot on Sinovoip BananaPi BPI-M3.

8 years agoReduce complexity of RSB by always using polling mode. Unfortunately
Jared McNeill [Sun, 15 May 2016 16:43:47 +0000 (16:43 +0000)]
Reduce complexity of RSB by always using polling mode. Unfortunately
gpiobus methods can be called with non-sleepable locks held.

Reviewed by: mmel

8 years agoAdd gpio-leds for Sinovoip BananaPi BPI-M3.
Jared McNeill [Sun, 15 May 2016 15:56:48 +0000 (15:56 +0000)]
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.

8 years agoAdd support for the AXP813/AXP818 power key and GPIO pins.
Jared McNeill [Sun, 15 May 2016 15:54:41 +0000 (15:54 +0000)]
Add support for the AXP813/AXP818 power key and GPIO pins.

8 years agoAllow RSB to be used from interrupt handlers.
Jared McNeill [Sun, 15 May 2016 15:52:34 +0000 (15:52 +0000)]
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.

8 years agoTEGRA: Also attach gpioc to tegra_gpio driver. Forgotten in r299854.
Michal Meloun [Sun, 15 May 2016 15:31:44 +0000 (15:31 +0000)]
TEGRA: Also attach gpioc to tegra_gpio driver. Forgotten in r299854.

8 years agoTEGRA: Don't use common name 'iicb' for tegra specific IIC driver.
Michal Meloun [Sun, 15 May 2016 15:14:46 +0000 (15:14 +0000)]
TEGRA: Don't use common name 'iicb' for tegra specific IIC driver.
Using commn name for different drivers breaks generic kernel creation.

8 years agoOFWIICBUS: Make ofwiicbus_devclass externaly visible.
Michal Meloun [Sun, 15 May 2016 15:13:56 +0000 (15:13 +0000)]
OFWIICBUS: Make ofwiicbus_devclass externaly visible.
It's needed for binding of iic controllers.

8 years agoTEGRA: Don't use common name 'gpio' for tegra specific GPIO driver.
Michal Meloun [Sun, 15 May 2016 14:47:50 +0000 (14:47 +0000)]
TEGRA: Don't use common name 'gpio' for tegra specific GPIO driver.
Using commn name for different drivers breaks generic kernel creation.

8 years agoOFWGPIOBUS: Make ofwgpiobus_devclass externaly visible.
Michal Meloun [Sun, 15 May 2016 14:43:52 +0000 (14:43 +0000)]
OFWGPIOBUS: Make ofwgpiobus_devclass externaly visible.
It's needed for binding of gpio controllers.

8 years ago[bwn] remove N-PHY registers for now.
Adrian Chadd [Sun, 15 May 2016 14:39:41 +0000 (14:39 +0000)]
[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.

8 years agoAllow arm generic_timer code to be included even if not present in the
Emmanuel Vadot [Sun, 15 May 2016 13:20:59 +0000 (13:20 +0000)]
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

8 years agoinstall: When preserving timestamps, also copy the nanoseconds part.
Jilles Tjoelker [Sun, 15 May 2016 13:17:05 +0000 (13:17 +0000)]
install: When preserving timestamps, also copy the nanoseconds part.

8 years agoRemove NULL checks after M_WAITOK allocations from isp(4).
Edward Tomasz Napierala [Sun, 15 May 2016 08:36:12 +0000 (08:36 +0000)]
Remove NULL checks after M_WAITOK allocations from isp(4).

MFC after: 1 month
Sponsored by: The FreeBSD Foundation

8 years agoMake it possible to reroot into NFS. This means one can have
Edward Tomasz Napierala [Sun, 15 May 2016 08:34:59 +0000 (08:34 +0000)]
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

8 years ago[bwn] add DUALPHY; this may be useful for PHY-N and later dual-phy probing.
Adrian Chadd [Sun, 15 May 2016 07:02:34 +0000 (07:02 +0000)]
[bwn] add DUALPHY; this may be useful for PHY-N and later dual-phy probing.

Obtained from: Landon Fuller <landonf@landonf.org>

8 years ago[bwn] commit the N-PHY register set.
Adrian Chadd [Sun, 15 May 2016 06:11:40 +0000 (06:11 +0000)]
[bwn] commit the N-PHY register set.

Obtained from: Linux b43 (register definitions.)

8 years agorouted(8): Use arc4random_uniform instead of arc4random.
Pedro F. Giffuni [Sun, 15 May 2016 06:06:22 +0000 (06:06 +0000)]
routed(8): Use arc4random_uniform instead of arc4random.

Use arc4random_uniform() when the desired random number upper bound
is not a power of two.

While here, we don't need srandom() and friends anymore.

Obtained from: OpenBSD (CVS rev. 1.20)

8 years agoMake hostid_save depend on hostid
Enji Cooper [Sun, 15 May 2016 06:00:13 +0000 (06:00 +0000)]
Make hostid_save depend on hostid

MFC after: 2 weeks
Sponsored by: EMC / Isilon Storage Division

8 years agoFix broken dependency with routed when MK_ROUTED != no
Enji Cooper [Sun, 15 May 2016 05:45:54 +0000 (05:45 +0000)]
Fix broken dependency with routed when MK_ROUTED != no

Remove routed as a requirement in NETWORKING, and put it in routed as a BEFORE
requirement instead

MFC after: 2 weeks
Sponsored by: EMC / Isilon Storage Division

8 years agoConditionalize installing etc/rc.d/atm{1,2,3}
Enji Cooper [Sun, 15 May 2016 05:38:47 +0000 (05:38 +0000)]
Conditionalize installing etc/rc.d/atm{1,2,3}

`BEFORE: netif` was already in etc/rc.d/atm1, so no additional changes
are needed in that script

MFC after: 2 weeks
Sponsored by: EMC / Isilon Storage Division

8 years agoRemove etc/rc.d/{zfs,zvol} if MK_ZFS != no
Enji Cooper [Sun, 15 May 2016 05:22:15 +0000 (05:22 +0000)]
Remove etc/rc.d/{zfs,zvol} if MK_ZFS != no

MFC after: 2 weeks
X-MFC with: r299840
Sponsored by: EMC / Isilon Storage Division

8 years agoConditionalize etc/rc.d/{zfs,zvol} install on MK_ZFS != no
Enji Cooper [Sun, 15 May 2016 04:39:36 +0000 (04:39 +0000)]
Conditionalize etc/rc.d/{zfs,zvol} install on MK_ZFS != no

MFC after: 2 weeks
Sponsored by: EMC / Isilon Storage Division

8 years agoMake FILESYSTEMS, dumpon, and var not depend on zfs and zvol
Enji Cooper [Sun, 15 May 2016 04:38:50 +0000 (04:38 +0000)]
Make FILESYSTEMS, dumpon, and var not depend on zfs and zvol

Make zfs and zvol come before all of the items that depended on them
previously

MFC after: 2 weeks
Sponsored by: EMC / Isilon Storage Division

8 years agoReduce redundancy after release-pkg merge to head in r298107
Enji Cooper [Sun, 15 May 2016 04:19:50 +0000 (04:19 +0000)]
Reduce redundancy after release-pkg merge to head in r298107

- Use BINDIR instead of FILESDIR
- Default all <FILESGROUPS>MODEs to BINMODE with a single for-loop at the
  bottom of the Makefile
- Move all of the conditionals under the relevant MK_* != no build conditional
  blocks

Sponsored by: EMC / Isilon Storage Division

8 years agoFix .Dd
Enji Cooper [Sun, 15 May 2016 03:44:32 +0000 (03:44 +0000)]
Fix .Dd

Today is the 14th, not the 10th of May

Reported by: igor (derp)
Sponsored by: EMC / Isilon Storage Division

8 years agoFix fully canonicalized example for `myvariable.27...`
Enji Cooper [Sun, 15 May 2016 03:43:36 +0000 (03:43 +0000)]
Fix fully canonicalized example for `myvariable.27...`

`6` doesn't occur in the OID; it was spurious

Bump .Dd for the change

MFC after: 2 weeks
Sponsored by: EMC / Isilon Storage Division

8 years agoRemove trailing whitespace in license tort
Enji Cooper [Sun, 15 May 2016 03:41:01 +0000 (03:41 +0000)]
Remove trailing whitespace in license tort

MFC after: 1 week
Reported by: igor
Sponsored by: EMC / Isilon Storage Division

8 years agoRemove NO_WERROR and add WARNS?= 6
Enji Cooper [Sun, 15 May 2016 03:38:40 +0000 (03:38 +0000)]
Remove NO_WERROR and add WARNS?= 6

This now compiles cleanly on all architectures

MFC after: 1 month
Tested with: clang 3.8, gcc 4.2.1, gcc 4.5, make tinderbox
Sponsored by: EMC / Isilon Storage Division

8 years agoFix -Wcast-align warnings
Enji Cooper [Sun, 15 May 2016 03:36:19 +0000 (03:36 +0000)]
Fix -Wcast-align warnings

Use memcpy instead of using direct assignment of void* pointers with
CMSG_DATA(..), which changes alignment

MFC after: 3 weeks
Reported by: clang
Sponsored by: EMC / Isilon Storage Division

8 years agoUse Node Information flag names instead of hard-coding their values.
Mark Johnston [Sun, 15 May 2016 03:22:13 +0000 (03:22 +0000)]
Use Node Information flag names instead of hard-coding their values.

MFC after: 1 week

8 years agoFix a few style issues in the ICMP sysctl descriptions.
Mark Johnston [Sun, 15 May 2016 03:19:53 +0000 (03:19 +0000)]
Fix a few style issues in the ICMP sysctl descriptions.

MFC after: 1 week

8 years agoAdd sysctl descriptions for net.inet6.ip6 and net.inet6.icmp6.
Mark Johnston [Sun, 15 May 2016 03:18:03 +0000 (03:18 +0000)]
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

8 years agorouted(8): Misc. cleanups to squelch Coverity.
Pedro F. Giffuni [Sun, 15 May 2016 03:04:21 +0000 (03:04 +0000)]
routed(8): Misc. cleanups to squelch Coverity.

table.c:
Copy into fixed size buffer.

trace.c:
Argument got dup2() cannot be negative.
Copy into fixed size buffer.

CID: 10067851006786, 271301
Obtained from: NetBSD
MFC after: 2 weeks.

8 years agoRemove an always-false error check in the AIFADDR_IN6 handler.
Mark Johnston [Sun, 15 May 2016 03:01:40 +0000 (03:01 +0000)]
Remove an always-false error check in the AIFADDR_IN6 handler.

CID: 1250792
MFC after: 1 week

8 years agorouted(8): Dereference before null check.
Pedro F. Giffuni [Sun, 15 May 2016 02:41:20 +0000 (02:41 +0000)]
routed(8): Dereference before null check.

CID: 272432
Obtained from: NetBSD (CVS ref. 1.16)
MFC after: 2 weeks.

8 years agorouted(8): Avoid NULL de-reference and two possible memory leaks.
Pedro F. Giffuni [Sun, 15 May 2016 02:30:34 +0000 (02:30 +0000)]
routed(8): Avoid NULL de-reference and two possible memory leaks.

The reports and fixes are straightforward but it's nice to be able
to confirm against NetBSD.

CID: 271080, 272306, 272307
Obtained from: NetBSD (CVS ref. 1.21 - 1.23)
MFC after: 2 weeks.

8 years agoUse SNMPD_INPUT_FAILED instead of SNMP_CODE_FAILED
Enji Cooper [Sun, 15 May 2016 00:54:21 +0000 (00:54 +0000)]
Use SNMPD_INPUT_FAILED instead of SNMP_CODE_FAILED

SNMPD_INPUT_FAILED is `enum snmpd_input_err` type (which matches the return
code from the function). SNMP_CODE_FAILED is `enum snmp_code` type.

MFC after: 1 week
Sponsored by: EMC / Isilon Storage Division

8 years agoFix fuse so that stale buffer cache data isn't read.
Rick Macklem [Sun, 15 May 2016 00:45:17 +0000 (00:45 +0000)]
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

8 years agoRemove NO_WERROR.clang from this Makefile
Enji Cooper [Sun, 15 May 2016 00:42:18 +0000 (00:42 +0000)]
Remove NO_WERROR.clang from this Makefile

This compiles with clang without warnings

MFC after: 1 month
Sponsored by: EMC / Isilon Storage Division

8 years agoReplace malloc + memset(.., 0, ..) with calloc calls
Enji Cooper [Sun, 15 May 2016 00:40:05 +0000 (00:40 +0000)]
Replace malloc + memset(.., 0, ..) with calloc calls

MFC after: 1 week
Sponsored by: EMC / Isilon Storage Division

8 years agoUse strdup instead of malloc + strlcpy
Enji Cooper [Sun, 15 May 2016 00:25:36 +0000 (00:25 +0000)]
Use strdup instead of malloc + strlcpy

Fix error messages on failure for calloc/strdup

MFC after: 3 weeks
Sponsored by: EMC / Isilon Storage Division

8 years agoCorrect function names that failed in error messages
Enji Cooper [Sun, 15 May 2016 00:24:21 +0000 (00:24 +0000)]
Correct function names that failed in error messages

It should be calloc/strdup, not malloc

MFC after: 3 weeks
Sponsored by: EMC / Isilon Storage Division

8 years agoUse sizeof(..)s for the destination buffers instead of hardcoded values corresponding
Enji Cooper [Sun, 15 May 2016 00:13:36 +0000 (00:13 +0000)]
Use sizeof(..)s for the destination buffers instead of hardcoded values corresponding
to the destination buffer sizes

MFC after: 1 week
Sponsored by: EMC / Isilon Storage Division

8 years agoReplace QUADFMT with %ju and QUADXFMT with %jx and cast values with uintmax_t
Enji Cooper [Sun, 15 May 2016 00:10:37 +0000 (00:10 +0000)]
Replace QUADFMT with %ju and QUADXFMT with %jx and cast values with uintmax_t

This will cure some -Wformat warnings

MFC after: 1 week
Reported by: clang, gcc
Sponsored by: EMC / Isilon Storage Division

8 years agoBump WARNS to 6
Enji Cooper [Sun, 15 May 2016 00:08:09 +0000 (00:08 +0000)]
Bump WARNS to 6

MFC after: 1 month
Sponsored by: EMC / Isilon Storage Division

8 years agoFix up r299769
Enji Cooper [Sun, 15 May 2016 00:05:28 +0000 (00:05 +0000)]
Fix up r299769

Similar to r299802, it was noted that using nitems on scalar pointers is
invalid.

Use strdup instead of malloc + strlcpy (which is what the old code was doing
anyhow).

MFC after: 1 week
Pointyhat to: ngie
Sponsored by: EMC / Isilon Storage Division

8 years ago[bwn] add the full suite of SPROM flags
Adrian Chadd [Sun, 15 May 2016 00:03:14 +0000 (00:03 +0000)]
[bwn] add the full suite of SPROM flags

Obtained from: Linux b43

8 years agoReplace malloc + memset(.., 0, ..) with calloc calls
Enji Cooper [Sun, 15 May 2016 00:02:55 +0000 (00:02 +0000)]
Replace malloc + memset(.., 0, ..) with calloc calls

MFC after: 1 week
Sponsored by: EMC / Isilon Storage Division

8 years agoFix up both r299764 and r299770
Enji Cooper [Sun, 15 May 2016 00:01:23 +0000 (00:01 +0000)]
Fix up both r299764 and r299770

nitems was wrong too, as it was being tested against a pointer instead of a buffer on
the stack.

Since the old code was just doing malloc, then strlcpy'ing the contents of the source
buffer into the destination buffer, replace it all with a call to strdup..

Reported by: bde
MFC after: 1 week
X-MFC with: r299764, r299770
Supersized Duncecap to: ngie
Sponsored by: EMC / Isilon Storage Division

8 years ago[bwn] handle core rev 12, we can mostly do that new.
Adrian Chadd [Sat, 14 May 2016 23:50:44 +0000 (23:50 +0000)]
[bwn] handle core rev 12, we can mostly do that new.

8 years ago[bwn] disable 11na channel setup for now, since we definitely, positively
Adrian Chadd [Sat, 14 May 2016 23:50:15 +0000 (23:50 +0000)]
[bwn] disable 11na channel setup for now, since we definitely, positively
don't do 11na yet.

8 years ago[bwn] fill out phyctl_1 fields for N-PHY (and later, eventually.)
Adrian Chadd [Sat, 14 May 2016 23:48:26 +0000 (23:48 +0000)]
[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.

8 years ago[bwn] set the 5ghz transmit flag for 5ghz transmit.
Adrian Chadd [Sat, 14 May 2016 23:45:47 +0000 (23:45 +0000)]
[bwn] set the 5ghz transmit flag for 5ghz transmit.

Turns out trying to do 11a transmit without this set works poorly.

8 years ago[bwn] disable writing slottime timing out to improve performance.
Adrian Chadd [Sat, 14 May 2016 23:45:16 +0000 (23:45 +0000)]
[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.

8 years ago[bwn] make rf-kill work for PHY-N.
Adrian Chadd [Sat, 14 May 2016 23:44:30 +0000 (23:44 +0000)]
[bwn] make rf-kill work for PHY-N.

8 years ago[bwn] decode the RX RSSI for PHY-N.
Adrian Chadd [Sat, 14 May 2016 23:43:43 +0000 (23:43 +0000)]
[bwn] decode the RX RSSI for PHY-N.

I'm still figuring this out, but it at least works somewhat.

8 years ago[bwn] use the new enum type.
Adrian Chadd [Sat, 14 May 2016 23:43:05 +0000 (23:43 +0000)]
[bwn] use the new enum type.

8 years ago[bwn] debugging changes.
Adrian Chadd [Sat, 14 May 2016 23:42:37 +0000 (23:42 +0000)]
[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.

8 years ago[bwn] Explicitly only work for SIBA parts; add some placeholder debugging.
Adrian Chadd [Sat, 14 May 2016 23:41:28 +0000 (23:41 +0000)]
[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.

8 years ago[bwn] missed commit!
Adrian Chadd [Sat, 14 May 2016 23:38:51 +0000 (23:38 +0000)]
[bwn] missed commit!

8 years ago[bwn] add new types, prepare for PHY-N; prepare for rev 5xx firmware.
Adrian Chadd [Sat, 14 May 2016 23:38:21 +0000 (23:38 +0000)]
[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!

8 years agoAdd pmic (AXP813) child node to r_rsb for Sinovoip BananaPi BPI-M3.
Jared McNeill [Sat, 14 May 2016 23:36:00 +0000 (23:36 +0000)]
Add pmic (AXP813) child node to r_rsb for Sinovoip BananaPi BPI-M3.

8 years agoEliminate pvh_global_lock from the amd64 pmap.
Konstantin Belousov [Sat, 14 May 2016 23:35:11 +0000 (23:35 +0000)]
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

8 years agoAdd and enable Allwinner RSB and AXP81x power management IC drivers.
Jared McNeill [Sat, 14 May 2016 23:34:57 +0000 (23:34 +0000)]
Add and enable Allwinner RSB and AXP81x power management IC drivers.

8 years agoAdd a basic driver for X-Powers AXP813 and AXP818 power management ICs.
Jared McNeill [Sat, 14 May 2016 23:33:57 +0000 (23:33 +0000)]
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.

8 years ago[bwn] add an implementation of "cordic" and imaginary math.
Adrian Chadd [Sat, 14 May 2016 23:33:13 +0000 (23:33 +0000)]
[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

8 years agoAvoid NULL de-references.
Pedro F. Giffuni [Sat, 14 May 2016 23:32:03 +0000 (23:32 +0000)]
Avoid NULL de-references.

CID: 271079
Obtained from: NetBSD
MFC after: 2 weeks.

8 years agoConvert tok from enum tok to int32_t in function calls
Enji Cooper [Sat, 14 May 2016 23:29:41 +0000 (23:29 +0000)]
Convert tok from enum tok to int32_t in function calls

get_token(..) returns int32_t, not enum tok, and in many cases tests for items
not in enum tok (e.g. '('). Make the typing consistent with get_token, which
includes a domino effect of changing enum tok to int32_t.

MFC after: 2 weeks
Sponsored by: EMC / Isilon Storage Division

8 years ago[bwn] TX logging / completion fixes
Adrian Chadd [Sat, 14 May 2016 23:27:55 +0000 (23:27 +0000)]
[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)

8 years agoAdd a driver for the Allwinner Reduced Serial Bus (RSB).
Jared McNeill [Sat, 14 May 2016 23:27:54 +0000 (23:27 +0000)]
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).

8 years ago[bwn] add in new microcode and phy initval information.
Adrian Chadd [Sat, 14 May 2016 23:23:50 +0000 (23:23 +0000)]
[bwn] add in new microcode and phy initval information.

This is required for PHY-N and later hardware.

Tested:

* BCN4321 (11abgn), PHY-N

8 years agoAdd node for A83T NMI interrupt controller.
Jared McNeill [Sat, 14 May 2016 23:22:52 +0000 (23:22 +0000)]
Add node for A83T NMI interrupt controller.

8 years agoUse a consistent errno save/restore pattern before running strtoul
Enji Cooper [Sat, 14 May 2016 23:22:38 +0000 (23:22 +0000)]
Use a consistent errno save/restore pattern before running strtoul

- Save errno
- Set errno to 0
- Call strtoul
- Test errno (optional, but many calls to strtoul did this afterwards)

Some of the code was setting errno = 0 after calling strtoul, not setting
errno = 0, or setting errno to saved_errno after the call, but before the
test. These all have unwanted behavioral side-effects, depending on the
initial value of errno and whether or not the input to strtoul was correct
or incorrect.

MFC after: 3 weeks
Sponsored by: EMC / Isilon Storage Division

8 years agorouted(8): Use arc4random.
Pedro F. Giffuni [Sat, 14 May 2016 23:22:19 +0000 (23:22 +0000)]
routed(8): Use arc4random.

CID: 1305962
Obtained from: NetBSD (CVS Rev. 1.34, Itojun)

8 years ago[bwn] implement reset improvements in preparation for PHY-N support
Adrian Chadd [Sat, 14 May 2016 23:20:46 +0000 (23:20 +0000)]
[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.

8 years ago[bwn] use the shared bwn_sqrt() routine.
Adrian Chadd [Sat, 14 May 2016 23:13:44 +0000 (23:13 +0000)]
[bwn] use the shared bwn_sqrt() routine.

8 years agoDo minimal work necessary to cure a -Wunused-but-set-variable warning from gcc
Enji Cooper [Sat, 14 May 2016 23:13:23 +0000 (23:13 +0000)]
Do minimal work necessary to cure a -Wunused-but-set-variable warning from gcc

How errno is saved before and restored after strtoul calls needs a rethink

MFC after: 1 week
Reported by: gcc 5.x
Sponsored by: EMC / Isilon Storage Division

8 years ago[bwn] disable bgscan for now.
Adrian Chadd [Sat, 14 May 2016 23:10:47 +0000 (23:10 +0000)]
[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)

8 years ago[bwn] add in the new phy common and utils files.
Adrian Chadd [Sat, 14 May 2016 23:08:34 +0000 (23:08 +0000)]
[bwn] add in the new phy common and utils files.

They're not yet used by included code; that'll come next.

8 years agorouted: Fix use after free.
Pedro F. Giffuni [Sat, 14 May 2016 23:07:26 +0000 (23:07 +0000)]
routed: Fix use after free.

For the multihomed case, ifp be used after being freed. NULL the value
after freeing it and avoid getting into the branch without reassigning
a new value.

CID: 272671
Obtained from: NetBSD
MFC after: 2 weeks

8 years agoFix up r299764
Enji Cooper [Sat, 14 May 2016 22:43:07 +0000 (22:43 +0000)]
Fix up r299764

I meant to use nitems, not sizeof(..) with the destination buffer. Using sizeof(..)
on a pointer will always truncate the output in the destination buffer incorrectly

Pointyhat to: ngie
MFC after: 1 week
X-MFC with: r299764
Sponsored by: EMC / Isilon Storage Division

8 years agoUse the size of the destination buffer instead of the malloc size, repeated, in order
Enji Cooper [Sat, 14 May 2016 22:40:35 +0000 (22:40 +0000)]
Use the size of the destination buffer instead of the malloc size, repeated, in order
to mute a -Wstrlcpy-strlcat-size warning

MFC after: 1 week
Reported by: clang
Sponsored by: EMC / Isilon Storage Division

8 years agorouted(8): use NULL instead of zero for pointers.
Pedro F. Giffuni [Sat, 14 May 2016 22:40:08 +0000 (22:40 +0000)]
routed(8): use NULL instead of zero for pointers.

8 years agoMute sign compare warning by casting rc to u_int to match nbindings' type
Enji Cooper [Sat, 14 May 2016 22:29:11 +0000 (22:29 +0000)]
Mute sign compare warning by casting rc to u_int to match nbindings' type

rc cannot be negative -- that was already tested for earlier on in
the function

MFC after: 1 week
Reported by: clang, gcc
Sponsored by: EMC / Isilon Storage Division

8 years agoFix logically dead code pointed out by clang/Coverity
Enji Cooper [Sat, 14 May 2016 22:04:44 +0000 (22:04 +0000)]
Fix logically dead code pointed out by clang/Coverity

parse_context, parse_user_security: test for validity of results from
parse_ascii(..) with by casting to int32_t and comparing to -1; comparing
unsigned types to negative values will always be false.

Reported by: clang, Coverity
CID: 10114321011433
MFC after: 3 weeks
Sponsored by: EMC / Isilon Storage Division

8 years agoFix theoretical buffer overflow issues in snmp_oid2asn_oid
Enji Cooper [Sat, 14 May 2016 21:32:52 +0000 (21:32 +0000)]
Fix theoretical buffer overflow issues in snmp_oid2asn_oid

Increase the size of `string` by 1 to account for the '\0' terminator. In the event
that `str` doesn't contain any non-alpha chars, i would be set to MAXSTR, and
the subsequent strlcpy call would overflow by a character.

Remove unnecessary `string[i] = '\0'` -- this is already handled by strlcpy.

MFC after: 1 week
Reported by: clang
Sponsored by: EMC / Isilon Storage Division