freebsd.git
7 years ago[ar71xx_gpio] handle AR934x and QCA953x GPIO OE polarity.
adrian [Sun, 31 Jul 2016 06:51:34 +0000 (06:51 +0000)]
[ar71xx_gpio] handle AR934x and QCA953x GPIO OE polarity.

For reasons I won't comment on, the AR934x and QCA953x GPIO_OE register
value is inverted - bit set == input, bit clear == output.

So, fix this in the output setting, in reading the initial state from
the boot loader, and also setting any gpiofunc pins that are necessary.

7 years agoConditionalize code which defines sysctls per _KERNEL #ifdef guard
ngie [Sun, 31 Jul 2016 06:34:49 +0000 (06:34 +0000)]
Conditionalize code which defines sysctls per _KERNEL #ifdef guard

This resolves several issues when compiling libzpool (userspace library), i.e.
-Wimplicit-function-declaration and -Wmissing-declarations issues.

MFC after: 2 weeks
Reported by: clang
Tested with: clang 3.8.1, gcc 4.2.1, gcc 5.3.0
Sponsored by: EMC / Isilon Storage Division

7 years agoRemove calls to `die` added for associated bugs
ngie [Sun, 31 Jul 2016 06:28:40 +0000 (06:28 +0000)]
Remove calls to `die` added for associated bugs

Panics are no longer hit with ^/head@r303573 on amd64

PR:     194586, 194587, 194589
Sponsored by:   EMC / Isilon Storage Division

7 years ago[gpioled] add support for inverting the LED polarity.
adrian [Sun, 31 Jul 2016 06:24:26 +0000 (06:24 +0000)]
[gpioled] add support for inverting the LED polarity.

No, this isn't a star trek science joke - sometimes LEDs are wired
up to be active low, so this is needed.

Submitted by: Dan Nelson <dnelson_1901@yahoo.com>

7 years agoCast result from third parameter to int instead of promoting it to size_t
ngie [Sun, 31 Jul 2016 06:03:27 +0000 (06:03 +0000)]
Cast result from third parameter to int instead of promoting it to size_t

This resolves a -Wformat issue when the value is used as a format width
precision specifier, i.e. %*s

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

7 years agoFix regression with /i caused by r303047
ngie [Sun, 31 Jul 2016 05:31:09 +0000 (05:31 +0000)]
Fix regression with /i caused by r303047

'\n' was specifically added to -e arguments prior to r303047. Restore
historical behavior which in turn fixes usr.sbin/etcupdate/preworld_test:main .

The fix is being committed to address the issue in the short term and may be
iterated upon as noted in bug 211399

Discussed with: mi, pfg
Differential Revision: https://reviews.freebsd.org/D7368
PR: 195929, 211399 [*]
MFC after: 18 days
X-MFC with: r303047
Reported by: Jenkins
Sponsored by: EMC / Isilon Storage Division

7 years agoindent(1): Bail out if there's no more space on the parser stack.
pfg [Sun, 31 Jul 2016 04:58:06 +0000 (04:58 +0000)]
indent(1): Bail out if there's no more space on the parser stack.

Also increase the stack size still keeping a conservative value of 256.
This is based on a similar changes done for PostgreSQL which instead
uses a stack size of 1000.

Differential Revision: https://reviews.freebsd.org/D6966  (Partial)
Submitted by: Piotr Stefaniak (with changes)

7 years agoindent(1): Consistently indent declarations.
pfg [Sun, 31 Jul 2016 04:14:20 +0000 (04:14 +0000)]
indent(1): Consistently indent declarations.

This fixes a very visible issue that may be hidden by some indent.pro
settings as in the example from FreeBSD's /usr/share.

From Piotr's log:
____
To prevent losing tabs from indentation in declarations, FreeBSD indent's
r125624 added code for the most common case when it's an identifier that
is indented, but didn't do anything with the original code that did the
same for any other cases. The other cases are: lparens (function pointer
declaration), asterisks (pointer declaration), stray semicolons, and
commas leading identifiers instead of trailing them.

Use the code added in r125624 (and improved in later commits) to write a
new function indent_declaration() and use it in all places that meant to
indent declarations. In order to indent only once per line, reuse existing
ps.dumped_decl_indent variable that was only used when formatting for
troff (-troff) until now.
____

Reference:
https://github.com/pstef/freebsd_indent/commit/ddd263db2a59978f43468989eff65299cf3ce7e1

Differential Revision: https://reviews.freebsd.org/D6966  (Partial)
Submitted by: Piotr Stefaniak

7 years agoReflect CLDR timedef changes
ache [Sun, 31 Jul 2016 03:26:53 +0000 (03:26 +0000)]
Reflect CLDR timedef changes

7 years agoRemove another vestige of scripted conversion
ache [Sun, 31 Jul 2016 03:11:10 +0000 (03:11 +0000)]
Remove another vestige of scripted conversion

7 years agoresolvconf(8) now needs an additional @RESTARTCMD@ replacement when installing.
pfg [Sun, 31 Jul 2016 02:54:27 +0000 (02:54 +0000)]
resolvconf(8) now needs an additional @RESTARTCMD@ replacement when installing.

After r303062, which brought openresolv 3.8.1, we need to replace an
additional @RESTARTCMD@ in resolvconf.

Reported by: Guy Yur
X-MFC with: r303062

7 years agoRemove vestige of scripted conversion
ache [Sun, 31 Jul 2016 02:43:45 +0000 (02:43 +0000)]
Remove vestige of scripted conversion

7 years agoIn addition to prev. commit. Since potentially glob2() can return error
ache [Sun, 31 Jul 2016 02:28:50 +0000 (02:28 +0000)]
In addition to prev. commit. Since potentially glob2() can return error
without setting errno, restore errno before its call.

7 years agoBoth C99 and POSIX directly prohibits any standard function to set errno
ache [Sun, 31 Jul 2016 01:14:06 +0000 (01:14 +0000)]
Both C99 and POSIX directly prohibits any standard function to set errno
to 0. Breaking this rule in 2001 NetBSD hack was imported which attempts
to workaround very limited glob() return codes amount. Use POSIX-compatible
workaround now with E2BIG which can't comes from other functions used
instead of prohibited 0.

7 years agosx: increment spin_cnt before cpu_spinwait in xlock
mjg [Sat, 30 Jul 2016 22:23:31 +0000 (22:23 +0000)]
sx: increment spin_cnt before cpu_spinwait in xlock

The change is a no-op only done for consistency with the rest of the file.

7 years agorwlock: s/READER/WRITER/ in wlock lockstat annotation
mjg [Sat, 30 Jul 2016 22:21:48 +0000 (22:21 +0000)]
rwlock: s/READER/WRITER/ in wlock lockstat annotation

7 years agoWrap previous MSIX workaround into #ifndef EARLY_AP_STARTUP.
mav [Sat, 30 Jul 2016 21:06:59 +0000 (21:06 +0000)]
Wrap previous MSIX workaround into #ifndef EARLY_AP_STARTUP.

With EARLY_AP_STARTUP we can successfully negotiate MSIX earlier.

Requested by: jhb@

7 years agoRename devname to udevname after including stdlib.h in r303445
bz [Sat, 30 Jul 2016 20:39:39 +0000 (20:39 +0000)]
Rename devname to udevname after including stdlib.h in r303445
as gcc trips over the devname(3) and reports 'shadows a global declaration'.

This should unbreak gcc based world builds.

7 years agoTry to declare _hw_pci for all sysctl cases needed after r303497.
bz [Sat, 30 Jul 2016 20:31:12 +0000 (20:31 +0000)]
Try to declare _hw_pci for all sysctl cases needed after r303497.

MFC after: 5 days
X-MFC with: r303497

7 years ago[iwm] Fix iwm_poll_bit() usage in iwm_stop_device(), fixup r303418.
ivadasz [Sat, 30 Jul 2016 19:03:32 +0000 (19:03 +0000)]
[iwm] Fix iwm_poll_bit() usage in iwm_stop_device(), fixup r303418.

* iwm_poll_bit() returns 1 on success and 0 on failure, whereas
  iwl_poll_bit() in Linux's iwlwifi returns >= 0 on success and < 0 on
  failure.

* Because of the wrong iwm_poll_bit return code check, no warning was
  printed if tx DMA stopping failed.

Approved by: adrian (mentor)
Differential Revision: https://reviews.freebsd.org/D7371

7 years agoImprove boot loader quote parsing
allanjude [Sat, 30 Jul 2016 17:53:37 +0000 (17:53 +0000)]
Improve boot loader quote parsing

parse() is the boot loader's interp_parse.c is too naive about quotes

both single and double quotes were allowed to be mixed, and single
quotes did not follow the usual semantics (re variable expansion).

The old code did not check for terminating quotes

This update implements:
 * distinguishing single and double quote
 * variable expansion will not be done inside single quote protected area
 * will preserve inner quote for values like "value 'some list'"
 * ending quote check.

this diff does not implement ending quote order check, it shouldn't
be too hard, needs some improvements on parser state machine.

PR: 204602
Submitted by: Toomas Soome <tsoome@me.com>
Relnotes: yes
Differential Revision: https://reviews.freebsd.org/D6000

7 years agobcache should support reads shorter than sector size
allanjude [Sat, 30 Jul 2016 17:45:56 +0000 (17:45 +0000)]
bcache should support reads shorter than sector size

dosfs (fat file systems) can perform reads of partial sectors
bcache should support such reads.

Submitted by: Toomas Soome <tsoome@me.com>
Reviewed by: cem
Differential Revision: https://reviews.freebsd.org/D6475

7 years agoBlock MSIX negotiation until SMP started and IRQ reshuffled.
mav [Sat, 30 Jul 2016 15:56:36 +0000 (15:56 +0000)]
Block MSIX negotiation until SMP started and IRQ reshuffled.

7 years agoMake MAC address generation more random.
mav [Sat, 30 Jul 2016 15:51:16 +0000 (15:51 +0000)]
Make MAC address generation more random.

'ticks' approach does not work at boot time.

7 years agoFix infinite loops introduced at r303429.
mav [Sat, 30 Jul 2016 10:32:28 +0000 (10:32 +0000)]
Fix infinite loops introduced at r303429.

7 years agoCache getbintime(9) answer in timehands, similarly to getnanotime(9)
kib [Sat, 30 Jul 2016 09:25:57 +0000 (09:25 +0000)]
Cache getbintime(9) answer in timehands, similarly to getnanotime(9)
and getmicrotime(9).

Suggested and reviewed by: bde (previous version)
Sponsored by: The FreeBSD Foundation
MFC after: 1 month

7 years agoUse nitems() from sys/param.h.
araujo [Sat, 30 Jul 2016 07:28:15 +0000 (07:28 +0000)]
Use nitems() from sys/param.h.

MFC after: 2 weeks.
Sponsored by: gandi.net (BSD Day Taiwan)

7 years agoUse nitems() from sys/param.h.
araujo [Sat, 30 Jul 2016 07:15:54 +0000 (07:15 +0000)]
Use nitems() from sys/param.h.

MFC after: 2 weeks.
Sponsored by: gandi.net (BSD Day Taiwan)

7 years agoUse nitems() from sys/param.h.
araujo [Sat, 30 Jul 2016 07:06:23 +0000 (07:06 +0000)]
Use nitems() from sys/param.h.

MFC after: 2 weeks.
Sponsored by: gandi.net (BSD Day Taiwan)

7 years agoRestore an ifdef that should not have been removed in r303535.
markj [Sat, 30 Jul 2016 07:05:32 +0000 (07:05 +0000)]
Restore an ifdef that should not have been removed in r303535.

X-MFC-With: r303535

7 years agoUse nitems() from sys/param.h.
araujo [Sat, 30 Jul 2016 07:04:46 +0000 (07:04 +0000)]
Use nitems() from sys/param.h.

MFC after: 2 weeks.
Sponsored by: gandi.net (BSD Day Taiwan)

7 years agoUse nitems() from sys/param.h.
araujo [Sat, 30 Jul 2016 07:02:33 +0000 (07:02 +0000)]
Use nitems() from sys/param.h.

MFC after: 2 weeks.
Sponsored by: gandi.net (BSD Day Taiwan)

7 years agoUse nitems() from sys/param.h.
araujo [Sat, 30 Jul 2016 06:35:49 +0000 (06:35 +0000)]
Use nitems() from sys/param.h.

Sponsored by: gandi.net (BSD Day Taiwan)
MFC after:  2 weeks.

7 years agoUse nitems() from sys/param.h
araujo [Sat, 30 Jul 2016 06:32:18 +0000 (06:32 +0000)]
Use nitems() from sys/param.h

Sponsored by: gandi.net (BSD Day Taiwan)

7 years agoUse nitems() from sys/param.h.
araujo [Sat, 30 Jul 2016 06:19:34 +0000 (06:19 +0000)]
Use nitems() from sys/param.h.

Sponsored by: gandi.net (BSD Day Taiwan)

7 years agoExplicitly test for cu_fgets returning NULL or !NULL
ngie [Sat, 30 Jul 2016 04:40:44 +0000 (04:40 +0000)]
Explicitly test for cu_fgets returning NULL or !NULL

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

7 years agoAdd libprocstat prebuild library dependencies.
markj [Sat, 30 Jul 2016 03:43:55 +0000 (03:43 +0000)]
Add libprocstat prebuild library dependencies.

X-MFC-With: r303531

7 years agoRework r303074 case 4. Don't immediatelly skip directory entries which
ache [Sat, 30 Jul 2016 03:11:54 +0000 (03:11 +0000)]
Rework r303074 case 4. Don't immediatelly skip directory entries which
cause MAXPATHLEN exceeded. Process them first through gl_errfunc() and
GLOB_ERR.

7 years agoInclude fasttrap handling for DATAMODEL_ILP32 when compiling for amd64.
markj [Sat, 30 Jul 2016 03:11:53 +0000 (03:11 +0000)]
Include fasttrap handling for DATAMODEL_ILP32 when compiling for amd64.

MFC after: 1 month

7 years agolibdtrace: Don't hard-code the native data model.
markj [Sat, 30 Jul 2016 03:09:57 +0000 (03:09 +0000)]
libdtrace: Don't hard-code the native data model.

MFC after: 1 month

7 years agolibproc: Add proc_getmodel().
markj [Sat, 30 Jul 2016 03:09:23 +0000 (03:09 +0000)]
libproc: Add proc_getmodel().

This is used by libdtrace to determine the data model of target processes.
This allows for the creation of pid provider probes in 32-bit processes on
amd64.

MFC after: 1 month

7 years agoAdd descriptions for fields in struct proc_handle.
markj [Sat, 30 Jul 2016 03:07:14 +0000 (03:07 +0000)]
Add descriptions for fields in struct proc_handle.

Remove the unused kq field and some unnecessary includes.

MFC after: 1 month

7 years agolibrtld_db: Use the auxv to figure out where to look up loader symbols.
markj [Sat, 30 Jul 2016 03:05:23 +0000 (03:05 +0000)]
librtld_db: Use the auxv to figure out where to look up loader symbols.

Previously, librtld_db just hardcoded /libexec/ld-elf.so, which isn't
correct for processes that aren't using the native ABI. With this change,
librtld_db can be used to inspect non-native processes; in particular,
dtrace -c now works for 32-bit executables on amd64.

MFC after: 1 month

7 years agoReset errno for readdirfunc() before contunue.
ache [Sat, 30 Jul 2016 02:09:11 +0000 (02:09 +0000)]
Reset errno for readdirfunc() before contunue.

7 years agoRemove usage of _WITH_DPRINTF
bapt [Sat, 30 Jul 2016 01:16:06 +0000 (01:16 +0000)]
Remove usage of _WITH_DPRINTF

7 years agoRemove last traces of _WITH_GETLINE
bapt [Sat, 30 Jul 2016 01:13:54 +0000 (01:13 +0000)]
Remove last traces of _WITH_GETLINE

7 years agoRemove usage of _WITH_GETLINE from usr.sbin
bapt [Sat, 30 Jul 2016 01:10:05 +0000 (01:10 +0000)]
Remove usage of _WITH_GETLINE from usr.sbin

7 years agoRemove usage of _WITH_GETLINE from usr.bin
bapt [Sat, 30 Jul 2016 01:07:47 +0000 (01:07 +0000)]
Remove usage of _WITH_GETLINE from usr.bin

7 years agoindent(1): Yet more style issues.
pfg [Sat, 30 Jul 2016 01:04:18 +0000 (01:04 +0000)]
indent(1): Yet more style issues.

strchr(3) returns a pointer not a boolean.
Attempt to make the style somewhat more ocnsistent with what indent
had before recent changes.

Pointed out by: bde

7 years agoRemove _WITH_GETLINE and _WITH_DPRINTF guards
bapt [Sat, 30 Jul 2016 01:00:16 +0000 (01:00 +0000)]
Remove _WITH_GETLINE and _WITH_DPRINTF guards

When adding getline(3) and dprintf(3) into libc, those guards were added
to prevent breaking too many ports.

7 years later the ports tree have been fixed, it is time to remove this
FreeBSDism

While here remove the extra parenthesis surrounding dprintf(3)

7 years agoindent(1): Attempt to preserve some consistent style.
pfg [Fri, 29 Jul 2016 23:30:33 +0000 (23:30 +0000)]
indent(1): Attempt to preserve some consistent style.

Remove the excessive braces from r303485 and align the comments to the
right as done in the rest of the code. This is not nice but there is no
clear way to make it nice (and KNF).

Pointed out by: bde

7 years agoVarious fixes to the t4/5nex character device.
jhb [Fri, 29 Jul 2016 22:11:29 +0000 (22:11 +0000)]
Various fixes to the t4/5nex character device.

- Remove null open/close methods.
- Don't set d_flags to 0 explicitly.
- Remove t5_cdevsw as the .d_name member isn't really used and doesn't
  warrant a separate cdevsw just for the name.
- Use ENOTTY as the error value for an unknown ioctl request.
- Use make_dev_s() to close race with setting si_drv1.

Sponsored by: Chelsio Communications

7 years agolibunwind: correct return code in unwinding trace log message
emaste [Fri, 29 Jul 2016 21:37:00 +0000 (21:37 +0000)]
libunwind: correct return code in unwinding trace log message

Obtained from: LLVM r277215
MFC after: 3 days
Sponsored by: The FreeBSD Foundation

7 years agoFix markup for -j in cpuset(1) synopsis
vangyzen [Fri, 29 Jul 2016 21:18:20 +0000 (21:18 +0000)]
Fix markup for -j in cpuset(1) synopsis

MFC after: 3 days
Sponsored by: Dell Inc.

7 years agoFix two return types in the cpuset(9) and bitset(9) man pages
vangyzen [Fri, 29 Jul 2016 21:12:48 +0000 (21:12 +0000)]
Fix two return types in the cpuset(9) and bitset(9) man pages

The *_FFS() and *_COUNT() functions return int, not size_t.

MFC after: 3 days
Sponsored by: Dell Inc.

7 years agolibblacklist: Do not use %m for logging, use strerror(errno)
lidl [Fri, 29 Jul 2016 21:11:32 +0000 (21:11 +0000)]
libblacklist: Do not use %m for logging, use strerror(errno)

The blacklist library can accept a function to use for logging,
defaulting to vsyslog(), if no function is specified.  Make the
blacklist library use strerror(errno) explicitly, instead of %m,
so that the passed in function does not need to support the
syslog specific placeholder.

This matches a change already submitted and accepted upstream.

MFC after: 1 week
Sponsored by: The FreeBSD Foundation

7 years agoUse vm_page_undirty() instead of manually setting a page field.
markj [Fri, 29 Jul 2016 21:05:37 +0000 (21:05 +0000)]
Use vm_page_undirty() instead of manually setting a page field.

Reviewed by: alc
MFC after: 3 days

7 years agoMake resizewin.1 manpage use .Fx macro
lidl [Fri, 29 Jul 2016 21:05:17 +0000 (21:05 +0000)]
Make resizewin.1 manpage use .Fx macro

Fix capitalization of "PuTTY" also.

MFC after: 1 week

7 years agoFix NTBT_QP_LINKS negotiation.
mav [Fri, 29 Jul 2016 21:03:30 +0000 (21:03 +0000)]
Fix NTBT_QP_LINKS negotiation.

I believe it never worked correctly for more the one queue even in Linux.
This fixes case when one of consumer drivers is not loaded on one side,
but its queues still announced as ready if something else brought link up.

While there, remove some pointless NULL checks.

7 years agosdp: Destroy the RDMA ID after destroying the connection's queue pair.
markj [Fri, 29 Jul 2016 21:03:02 +0000 (21:03 +0000)]
sdp: Destroy the RDMA ID after destroying the connection's queue pair.

This is the ordering documented by rdma_destroy_qp(). Also add a useful
KASSERT to sdp_pcbfree().

Sponsored by: EMC / Isilon Storage Division

7 years agosdp: Use malloc(9) instead of the Linux compat layer.
markj [Fri, 29 Jul 2016 21:01:04 +0000 (21:01 +0000)]
sdp: Use malloc(9) instead of the Linux compat layer.

SDP transmit and receive rings are always created in a sleepable context,
so we can use M_WAITOK and remove error checks.

Sponsored by: EMC / Isilon Storage Division

7 years agosdp: Use the correct socket buffer in sdp_post_recvs_needed().
markj [Fri, 29 Jul 2016 20:54:43 +0000 (20:54 +0000)]
sdp: Use the correct socket buffer in sdp_post_recvs_needed().

Sponsored by: EMC / Isilon Storage Division

7 years agoClear scratchpad after MSIX negotiation to not leak garbage.
mav [Fri, 29 Jul 2016 20:52:18 +0000 (20:52 +0000)]
Clear scratchpad after MSIX negotiation to not leak garbage.

7 years agosdp: Always free received control packets after they're handled.
markj [Fri, 29 Jul 2016 20:51:52 +0000 (20:51 +0000)]
sdp: Always free received control packets after they're handled.

Sponsored by: EMC / Isilon Storage Division

7 years agoFix the KASSERT format string arguments after r303507.
markj [Fri, 29 Jul 2016 20:48:42 +0000 (20:48 +0000)]
Fix the KASSERT format string arguments after r303507.

7 years agosdp: Use the PCB as the rx completion handler argument.
markj [Fri, 29 Jul 2016 20:39:32 +0000 (20:39 +0000)]
sdp: Use the PCB as the rx completion handler argument.

The generic socket may be detached from the PCB before the completion
queue is drained and destroyed, so this change closes a race condition
in connection teardown.

Sponsored by: EMC / Isilon Storage Division

7 years agosdp: Destroy the PCB lock before freeing to the zone.
markj [Fri, 29 Jul 2016 20:36:01 +0000 (20:36 +0000)]
sdp: Destroy the PCB lock before freeing to the zone.

Sponsored by: EMC / Isilon Storage Division

7 years agosdp: Use an mbufq for received control packets.
markj [Fri, 29 Jul 2016 20:35:04 +0000 (20:35 +0000)]
sdp: Use an mbufq for received control packets.

This is simpler than the hand-rolled queue, and fixes a use-after-free.

Sponsored by: EMC / Isilon Storage Division

7 years agosdp: Remove Linux build files.
markj [Fri, 29 Jul 2016 20:33:43 +0000 (20:33 +0000)]
sdp: Remove Linux build files.

They aren't useful here, and Linux seems to have largely abandoned SDP
anyway.

Sponsored by: EMC / Isilon Storage Division

7 years agoDon't treat NOCPU as a valid CPU to CPU_ISSET.
jhb [Fri, 29 Jul 2016 20:19:14 +0000 (20:19 +0000)]
Don't treat NOCPU as a valid CPU to CPU_ISSET.

If a thread is created bound to a cpuset it might already be bound before
it's very first timeslice, and td_lastcpu will be NOCPU in that case.

MFC after: 1 week

7 years agoindent(1): Use NULL instead of zero for pointers.
pfg [Fri, 29 Jul 2016 19:36:10 +0000 (19:36 +0000)]
indent(1): Use NULL instead of zero for pointers.

7 years agoFix locking issues with aio_fsync().
jhb [Fri, 29 Jul 2016 18:26:15 +0000 (18:26 +0000)]
Fix locking issues with aio_fsync().

- Use correct lock in aio_cancel_sync when dequeueing job.
- Add _locked variants of aio_set/clear_cancel_function and use those
  to avoid lock recursion when adding and removing fsync jobs to the
  per-process sync queue.
- While here, add a basic test for aio_fsync().

PR: 211390
Reported by: Randy Westlund <rwestlun@gmail.com>
MFC after: 1 week
Sponsored by: Chelsio Communications
Differential Revision: https://reviews.freebsd.org/D7339

7 years agoindent(1): Support "f" and "F" floating constant suffixes.
pfg [Fri, 29 Jul 2016 18:00:10 +0000 (18:00 +0000)]
indent(1): Support "f" and "F" floating constant suffixes.

Actually this just brings back r303487 with the correct commit log.

Differential Revision: https://reviews.freebsd.org/D6966  (Partial)
Obtained from: Piotr Stefaniak

7 years agoRevert r303487: Wrong commit log.
pfg [Fri, 29 Jul 2016 17:55:38 +0000 (17:55 +0000)]
Revert r303487: Wrong commit log.

Will be brought back with the correct log.

7 years agoAdd a loader tunable (hw.pci.enable_pcie_hp) to disable PCI-e HotPlug.
jhb [Fri, 29 Jul 2016 17:54:21 +0000 (17:54 +0000)]
Add a loader tunable (hw.pci.enable_pcie_hp) to disable PCI-e HotPlug.

Some systems and/or devices (such as riser cards) do not include a
non-compliant implementation of PCI-e HotPlug that can result in devices
not being attached (e.g. the HotPlug code might assume that a card is
being unplugged and will power the slot off and detach it).  This
tunable can be set to 0 to disable support for PCI-e HotPlug ignoring
the incorrect HotPlug state on these slots.

PR: 211081
Reported by: Sergey Renkas <serg_ic@mail.ru> (SuperMicro X7 riser card)
Reported by: Jeffrey E Pieper <jeffrey.e.pieper@intel.com>
  (Intel X520 adapter)
MFC after: 1 week
Relnotes: yes

7 years agoChange the return type of freelocale(3) to void.
ed [Fri, 29 Jul 2016 17:18:47 +0000 (17:18 +0000)]
Change the return type of freelocale(3) to void.

Our version of this function currently returns an integer indicating
failure or success, whereas POSIX specifies that this function has no
return value. It returns void. Patch up the header, sources and man page
to use the right type. While there, use the opportunity to simplify the
body of this function.

Theoretically speaking, this change breaks the ABI of this function.
That said, I have yet to find any code that makes use of freelocale()'s
return value. I couldn't find any of it in the base system, nor did an
exp-run reveal any breakage caused by this change.

PR: 211394 (exp-run)

7 years agoOnce more refactor KPI between ntb_transport(4) and if_ntb(4)..
mav [Fri, 29 Jul 2016 17:15:41 +0000 (17:15 +0000)]
Once more refactor KPI between ntb_transport(4) and if_ntb(4)..

New design allows to attach multiple consumers to ntb_transport(4) instance.
Previous design obtained from Linux theoretically allowed that, but was not
practically usable (Linux also has only one consumer driver now).

7 years agoRemove a probe declaration that has been unused since r292469, when
alc [Fri, 29 Jul 2016 16:43:51 +0000 (16:43 +0000)]
Remove a probe declaration that has been unused since r292469, when
vm_pageout_grow_cache() was replaced.

MFC after: 3 days

7 years agoRevert r291022: x86/intr: allow mutex recursion in intr_remove_handler
royger [Fri, 29 Jul 2016 16:35:58 +0000 (16:35 +0000)]
Revert r291022: x86/intr: allow mutex recursion in intr_remove_handler

This was only needed for Xen, and a better way to deal with this issue has
been found, so this commit can be reverted.

Sponsored by: Citrix Systems R&D
MFC after: 5 days
Reviewed by: kib
Differential revision: https://reviews.freebsd.org/D7363

7 years agoxen-intr: fix removal of event channels during resume
royger [Fri, 29 Jul 2016 16:34:54 +0000 (16:34 +0000)]
xen-intr: fix removal of event channels during resume

Event channel handlers cannot be removed during resume because there might
be an interrupt thread running on a CPU currently blocked in the
cpususpend_handler, which prevents the call to intr_remove_handler from
finishing and completely freezes the system during resume. r291022 tried to
fix this by allowing recursion in intr_remove_handler, but that's clearly
not enough.

Instead don't remove the handlers at the interrupt resume phase, and let
each driver remove the handler by itself during resume. In order to do this,
change the opaque event channel handler cookie to use the global interrupt
vector instead of the event channel port. The event channel port cannot be
used because after resume all event channels are reset, and the port numbers
can change.

Sponsored by: Citrix Systems R&D
MFC after: 5 days

7 years agoindent(1): Removed whitespace shouldn't be considered in column calculations.
pfg [Fri, 29 Jul 2016 16:34:16 +0000 (16:34 +0000)]
indent(1): Removed whitespace shouldn't be considered in column calculations.

This piece of code removed tabs and space characters from after colons
that follow labels by decrementing the e_lab (end of label) "pointer"
which is later used to calculate the width of the string that fprintf()
puts into "output". But pad_output() gets the length from the actual
string, so it miscalculated what the current column is.

Fixed by putting a string terminator at the e_lab "pointer".

Differential Revision: https://reviews.freebsd.org/D6966
(Partial)
Obtained from: Piotr Stefaniak

7 years agoxen-netfront: fix trying to send packets with disconnected netfront
royger [Fri, 29 Jul 2016 16:33:45 +0000 (16:33 +0000)]
xen-netfront: fix trying to send packets with disconnected netfront

In certain circumstances xn_txq_mq_start might be called with num_queues ==
0 during the resume phase after a migration, which can trigger a KASSERT.
Fix this by making sure the carrier is on before trying to transmit, or else
return that the queues are full.

Just as a note, I haven't been able to reproduce this crash on my test
systems, but I still think it's possible and worth fixing.

Reported by: Karl Pielorz <kpielorz_lst@tdx.co.uk>
Sponsored by: Citrix Systems R&D
MFC after: 5 days
Reviewed by: Wei Liu <wei.liu2@citrix.com>
Differential revision: https://reviews.freebsd.org/D7349

7 years agoindent(1): fix struct termination detection.
pfg [Fri, 29 Jul 2016 16:28:51 +0000 (16:28 +0000)]
indent(1): fix struct termination detection.

Small style cleanup while here.

Differential Revision: https://reviews.freebsd.org/D6966 (Partial)
Obtained from: Piotr Stefaniak

7 years agoMention that basename(3) and dirname(3) will change in the future.
ed [Fri, 29 Jul 2016 16:25:09 +0000 (16:25 +0000)]
Mention that basename(3) and dirname(3) will change in the future.

Update the existing manual pages for basename(3) and dirname(3) to
mention that in future versions of FreeBSD, these functions will no
longer use internal buffers for storing the results.

MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D7356

7 years agoindent(1): fix struct termination detection.
pfg [Fri, 29 Jul 2016 16:23:00 +0000 (16:23 +0000)]
indent(1): fix struct termination detection.

Semicolons inside struct declarations don't end the declarations.

Differential Revision: https://reviews.freebsd.org/D6966 (Partial)
Obtained from: Piotr Stefaniak

7 years agoindent(1): Fix breakage caused by single comment following "else".
pfg [Fri, 29 Jul 2016 16:17:54 +0000 (16:17 +0000)]
indent(1): Fix breakage caused by single comment following "else".

indent(1) simply wasn't taught that "else" may be followed by a comment
without any opening brace anywhere on the line, so it was very confused
in such cases.

Differential Revision: https://reviews.freebsd.org/D6966 (Partial)
Obtained from: Piotr Stefaniak

7 years agoindent(1): Avoid potential use-after-free.
pfg [Fri, 29 Jul 2016 16:14:03 +0000 (16:14 +0000)]
indent(1): Avoid potential use-after-free.

last_bl is a char pointer that tracks the last blank character in a
comment, which is used for wrapping long comment lines. Since the
underlying array may be reallocated, make sure last_bl is up to date when
that happens.

Differential Revision: https://reviews.freebsd.org/D6966 (Partial)
Obtained from: Piotr Stefaniak

7 years agoindent(1): Avoid out of bound access of array codebuf.
pfg [Fri, 29 Jul 2016 16:09:05 +0000 (16:09 +0000)]
indent(1): Avoid out of bound access of array codebuf.

dump_line() requires s_code to be a string, because it will call count_spaces().

Differential Revision: https://reviews.freebsd.org/D6966 (Partial)
Obtained from: Piotr Stefaniak

7 years agoFix typo.
imp [Fri, 29 Jul 2016 15:24:50 +0000 (15:24 +0000)]
Fix typo.

7 years agoInclude FBT to modules build on RISC-V.
br [Fri, 29 Jul 2016 12:30:33 +0000 (12:30 +0000)]
Include FBT to modules build on RISC-V.

7 years agoRemove unused variables.
br [Fri, 29 Jul 2016 12:29:17 +0000 (12:29 +0000)]
Remove unused variables.

7 years agoRemove write-only variable.
trasz [Fri, 29 Jul 2016 12:15:55 +0000 (12:15 +0000)]
Remove write-only variable.

MFC after: 1 month

7 years agoImprove error message.
trasz [Fri, 29 Jul 2016 11:33:23 +0000 (11:33 +0000)]
Improve error message.

MFC after: 1 month

7 years agoFix MTP description in the comment.
trasz [Fri, 29 Jul 2016 11:33:01 +0000 (11:33 +0000)]
Fix MTP description in the comment.

MFC after: 1 month

7 years agoAdd a generic EHCI USB driver based on the Allwinner A10 driver. It is ACPI
andrew [Fri, 29 Jul 2016 08:50:36 +0000 (08:50 +0000)]
Add a generic EHCI USB driver based on the Allwinner A10 driver. It is ACPI
only for now, but wouldn't be too difficult to add support for FDT.

Reviewed by: hselasky
Obtained from: ABT Systems Ltd
MFC after: 1 month
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D7352

7 years agohyperv/storvsc: Use busdma(9) and enable PIM_UNMAPPED by default.
sephe [Fri, 29 Jul 2016 06:22:11 +0000 (06:22 +0000)]
hyperv/storvsc: Use busdma(9) and enable PIM_UNMAPPED by default.

The UNMAPPED I/O greatly improves userland direct disk I/O performance
by 35% ~ 135%.

Submitted by: Hongjiang Zhang <honzhan microsoft com>
MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D7195

7 years agohyperv/vmbus: Revoke unnecessary exposure of vmbus softc
sephe [Fri, 29 Jul 2016 06:10:27 +0000 (06:10 +0000)]
hyperv/vmbus: Revoke unnecessary exposure of vmbus softc

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D7348

7 years agohyperv/vmbus: Move driver glue to the beginning of the files
sephe [Fri, 29 Jul 2016 05:58:24 +0000 (05:58 +0000)]
hyperv/vmbus: Move driver glue to the beginning of the files

Just as most of other drivers do.  And move sysinit function close
to its SYSINIT.

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D7347

7 years agohyperv/vmbus: Forward declare static functions
sephe [Fri, 29 Jul 2016 05:49:12 +0000 (05:49 +0000)]
hyperv/vmbus: Forward declare static functions

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D7346

7 years agohyperv/vmbus: Reindent function declarations.
sephe [Fri, 29 Jul 2016 03:16:51 +0000 (03:16 +0000)]
hyperv/vmbus: Reindent function declarations.

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D7344