5 hours agoShorten conditional branch code. master github/master
kib [Mon, 30 Nov 2015 10:18:15 +0000 (10:18 +0000)]
Shorten conditional branch code.

Reviewed by: andrew
Sponsored by: The FreeBSD Foundation

5 hours agoRemove unneeded instructions.
kib [Mon, 30 Nov 2015 10:17:13 +0000 (10:17 +0000)]
Remove unneeded instructions.

Reviewed by: andrew
Sponsored by: The FreeBSD Foundation

5 hours agoAdd more functions and types to the LinuxKPI.
hselasky [Mon, 30 Nov 2015 09:24:12 +0000 (09:24 +0000)]
Add more functions and types to the LinuxKPI.

MFC after: 1 week
Sponsored by: Mellanox Technologies

6 hours agoadd missing lib80211 include.
adrian [Mon, 30 Nov 2015 09:02:28 +0000 (09:02 +0000)]
add missing lib80211 include.

7 hours agoFix the build
ngie [Mon, 30 Nov 2015 08:02:52 +0000 (08:02 +0000)]
Fix the build

ichan is only used if AH_DEBUG_ALQ if defined

Pointyhat to: adrian

8 hours agoAdd missing lib declaration.
adrian [Mon, 30 Nov 2015 06:56:25 +0000 (06:56 +0000)]
Add missing lib declaration.

8 hours agoConvert ifconfig to use lib80211.
adrian [Mon, 30 Nov 2015 06:34:16 +0000 (06:34 +0000)]
Convert ifconfig to use lib80211.

* remove regdomain.[ch] - it's now part of lib80211.
* convert ifieee80211.c to use the ioctl routines in lib80211 and
  implement the "error? exit" wrapper behaviour the callers expect.

8 hours agofix ht/40 configuration for ar9331 (hornet).
adrian [Mon, 30 Nov 2015 06:26:59 +0000 (06:26 +0000)]
fix ht/40 configuration for ar9331 (hornet).

The synth programming here requires the real centre frequency,
which for HT20 channels is the normal channel, but HT40 is
/not/ the primary channel.  Everything else was using 'freq',
which is the correct centre frequency, but the hornet config
was using 'ichan' to do the lookup which was also the primary

So, modify the HAL call that does the mapping to take a frequency
in MHz and return the channel number.


* Carambola 2, AR9331, tested both HT/20 and HT/40 operation.

9 hours agoRemove in_setifarnh definition.
melifaro [Mon, 30 Nov 2015 06:02:35 +0000 (06:02 +0000)]
Remove in_setifarnh definition.

9 hours agoMove flowtable rte checks to separate function.
melifaro [Mon, 30 Nov 2015 05:59:22 +0000 (05:59 +0000)]
Move flowtable rte checks to separate function.

9 hours agoAdd new rt_foreach_fib_walk_del() function for deleting route entries
melifaro [Mon, 30 Nov 2015 05:51:14 +0000 (05:51 +0000)]
Add new rt_foreach_fib_walk_del() function for deleting route entries
  by filter function instead of picking into routing table details in
  each consumer.
Remove now-unused rt_expunge() (eliminating last external RTF_RNH_LOCKED
This simplifies future nexthops/mulitipath changes and rtrequest1_fib()
  locking refactoring.

Actual changes:
Add "rt_chain" field to permit rte grouping while doing batched delete
  from routing table (thus growing rte 200->208 on amd64).
Add "rti_filter" /  "rti_filterdata" / "rti_spare" fields to rt_addrinfo
  to pass filter function to various routing subsystems in standard way.
Convert all rt_expunge() customers to new rt_addinfo-based api and eliminate

10 hours agoAdd lib80211 to include path.
adrian [Mon, 30 Nov 2015 04:59:01 +0000 (04:59 +0000)]
Add lib80211 to include path.

(This commit was missing from my lib80211 commit.)

10 hours agoAdd lib80211, a small (but hopefully soon to grow) set of library
adrian [Mon, 30 Nov 2015 04:41:50 +0000 (04:41 +0000)]
Add lib80211, a small (but hopefully soon to grow) set of library
routines to interface with net80211.

This is all from the ifconfig program; the duplicate code from ifconfig
will be removed when it starts using this API.

Differential Revision:

12 hours agoPrint machine check address for Book-E.
jhibbits [Mon, 30 Nov 2015 02:40:41 +0000 (02:40 +0000)]
Print machine check address for Book-E.

Bits in mcsr indicate if the address is valid, and whether it's a physical
address or effective address.

Sponsored by: Alex Perez/Inertial Computing

12 hours agoAdd Freescale QorIQ GPIO driver.
jhibbits [Mon, 30 Nov 2015 02:23:56 +0000 (02:23 +0000)]
Add Freescale QorIQ GPIO driver.

Still missing interrupt support, to come later.

Sponsored by: Alex Perez/Inertial Computing

16 hours agoFix buildworld after r291453, similar to r284346: url->user and url->pwd
dim [Sun, 29 Nov 2015 22:37:48 +0000 (22:37 +0000)]
Fix buildworld after r291453, similar to r284346: url->user and url->pwd
are arrays, so they can never be NULL.

Reported by: many
Pointy hat to: des

17 hours agoAs the kernel allocates and frees vnodes, it fully initializes them
mckusick [Sun, 29 Nov 2015 21:42:26 +0000 (21:42 +0000)]
As the kernel allocates and frees vnodes, it fully initializes them
on every allocation and fully releases them on every free.  These
are not trivial costs: it starts by zeroing a large structure then
initializes a mutex, a lock manager lock, an rw lock, four lists,
and six pointers. And looking at vfs.vnodes_created, these operations
are being done millions of times an hour on a busy machine.

As a performance optimization, this code update uses the uma_init
and uma_fini routines to do these initializations and cleanups only
as the vnodes enter and leave the vnode_zone. With this change the
initializations are only done kern.maxvnodes times at system startup
and then only rarely again. The frees are done only if the vnode_zone
shrinks which never happens in practice. For those curious about the
avoided work, look at the vnode_init() and vnode_fini() functions in
kern/vfs_subr.c to see the code that has been removed from the main
vnode allocation/free path.

Reviewed by: kib
Tested by:   Peter Holm

18 hours agoFor performance reasons, it is useful to have a single string used as
mckusick [Sun, 29 Nov 2015 21:01:02 +0000 (21:01 +0000)]
For performance reasons, it is useful to have a single string used as
the name of a filesystem when setting it as the first parameter to the
getnewvnode() function. Most filesystems call getnewvnode from just one
place so can use a literal string as the first parameter. However, NFS
calls getnewvnode from two places, so we create a global constant string
that can be used by the two instances. This change also collapses two
instances of getnewvnode() in the UFS filesystem to a single call.

Reviewed by: kib
Tested by:   Peter Holm

21 hours agoadd missing initvals.
adrian [Sun, 29 Nov 2015 18:14:18 +0000 (18:14 +0000)]
add missing initvals.

Sorry y'all.

22 hours agoInstall the public sanitizer headers. These are useful for programs
dim [Sun, 29 Nov 2015 16:28:40 +0000 (16:28 +0000)]
Install the public sanitizer headers.  These are useful for programs
that want to directly interface with sanitizer internals.

24 hours agoUse .netrc for HTTP sites and proxies, not just FTP.
des [Sun, 29 Nov 2015 14:26:59 +0000 (14:26 +0000)]
Use .netrc for HTTP sites and proxies, not just FTP.

PR: 193740
Submitted by: TEUBEL Gy├Ârgy <>
MFC after: 1 week

26 hours agoImprove error reporting to clearly show problematic rules.
trasz [Sun, 29 Nov 2015 13:14:45 +0000 (13:14 +0000)]
Improve error reporting to clearly show problematic rules.

MFC after: 1 month
Sponsored by: The FreeBSD Foundation

26 hours agoSimplify rule retrieval and improve error handling.
trasz [Sun, 29 Nov 2015 12:33:56 +0000 (12:33 +0000)]
Simplify rule retrieval and improve error handling.

MFC after: 1 month
Sponsored by: The FreeBSD Foundation

26 hours agoFix make depend
uqs [Sun, 29 Nov 2015 12:23:08 +0000 (12:23 +0000)]
Fix make depend

26 hours agoFix some memory management problems.
trasz [Sun, 29 Nov 2015 12:21:02 +0000 (12:21 +0000)]
Fix some memory management problems.

MFC after: 1 month
Sponsored by: The FreeBSD Foundation

27 hours agoHandle asprintf(3) errors in a standards-compliant way.
trasz [Sun, 29 Nov 2015 12:09:12 +0000 (12:09 +0000)]
Handle asprintf(3) errors in a standards-compliant way.

MFC after: 1 month
Sponsored by: The FreeBSD Foundation

27 hours agoRewrite the rctl(8) utility to make it possible to add multiple rules
trasz [Sun, 29 Nov 2015 12:01:36 +0000 (12:01 +0000)]
Rewrite the rctl(8) utility to make it possible to add multiple rules
in a single run.  This speeds up operation with large rulesets.

MFC after: 1 month
Sponsored by: The FreeBSD Foundation

27 hours agoMinor cleanup.
kib [Sun, 29 Nov 2015 11:37:25 +0000 (11:37 +0000)]
Minor cleanup.

Systematically use ANSI C functions definitions.
Correct type of the flags argument to the dev_pager_putpages() function.
Use vm_pager_free_nonreq().

Sponsored by: The FreeBSD Foundation
MFC after: 1 week

27 hours agoUser and group identifiers the rctl(8) utility receives from the kernel
trasz [Sun, 29 Nov 2015 11:30:17 +0000 (11:30 +0000)]
User and group identifiers the rctl(8) utility receives from the kernel
are always in numeric form; don't try to resolve them by names.  This
speeds up rule listing with large rulesets by about 50%.

MFC after: 1 month
Sponsored by: The FreeBSD Foundation

27 hours agoAHCI: Fix AHCI driver for ARM.
mmel [Sun, 29 Nov 2015 11:28:04 +0000 (11:28 +0000)]
AHCI: Fix AHCI driver for ARM.
On ARM, we must ensure proper interdevice write ordering.
The AHCI interrupt status register must be updated in HW before
registers in interrupt controller.
Unfortunately, only way how we can do it is readback.

Discussed with: mav
Approved by: kib (mentor)
Differential Revision:

32 hours agoMake ELFv2 powerpc64 kernels build and run. Loader support will come in a
nwhitehorn [Sun, 29 Nov 2015 07:16:08 +0000 (07:16 +0000)]
Make ELFv2 powerpc64 kernels build and run. Loader support will come in a
separate commit.

32 hours agoFix build with new binutils. This gets a working kernel with GCC 5.2 and
nwhitehorn [Sun, 29 Nov 2015 06:40:09 +0000 (06:40 +0000)]
Fix build with new binutils. This gets a working kernel with GCC 5.2 and
binutils 2.24. Without this, the self-relocation code in locore64.S was
failing due to a misaligned TOC section.

MFC after: 2 weeks

33 hours agoDisable a couple of tests, perhaps temporarily, since they use private
deischen [Sun, 29 Nov 2015 06:16:25 +0000 (06:16 +0000)]
Disable a couple of tests, perhaps temporarily, since they use private
symbols that are not exported from librt.

33 hours agoUnbreak symbol versioning. I have no idea when it was broken, but it's been
deischen [Sun, 29 Nov 2015 06:14:51 +0000 (06:14 +0000)]
Unbreak symbol versioning.  I have no idea when it was broken, but it's been
at least a few months if not a year or more.

33 hours agoAdd support for the integrated wifi for the QCA953x base config and
adrian [Sun, 29 Nov 2015 05:49:49 +0000 (05:49 +0000)]
Add support for the integrated wifi for the QCA953x base config and


* AP143 reference design board

33 hours agoAdd initial support for the QCA953x SoC (honeybee) wifi.
adrian [Sun, 29 Nov 2015 05:47:52 +0000 (05:47 +0000)]
Add initial support for the QCA953x SoC (honeybee) wifi.

This is a 2x2 2GHz 802.11n part.  It works enough at the moment to
bring up, scan and associate.  I haven't started using this as
a day to day AP.

The specifics:

* add honeybee initvals
* add in changes; a mix from the QCA HAL and ath9k;
* fix a bug in AR_SREV_AR9580_10_OR_LATER(), which is only used
  for one capability check and we don't even implement it - so it's
  a big no-op.

Shady things:

* ath9k has the "platform data" define the 25/40MHz clock.
  This HAL .. doesn't.  Honeybee gets hard-coded to 25MHz which
  it likely shouldn't be.  I'll have to go and identify/fix those.


* Qualcomm Atheros AP143 reference design board.

Obtained from: Qualcomm Atheros; Linux ath9k

33 hours agosfxge: add prefast annotation to common code return types
arybchik [Sun, 29 Nov 2015 05:42:49 +0000 (05:42 +0000)]
sfxge: add prefast annotation to common code return types

Using a typedef for common code return types (rather than "int")
allows the Prefast static analyser to understand when a function
has been successful (and thus when its postconditions must hold).

This greatly reduces then number of false positives reported by
prefast for error paths in common code functions.

Submitted by:   Andy Moreton <amoreton at>
Sponsored by:   Solarflare Communications, Inc.
MFC after:      2 days

33 hours agou32 -> uint32_t.
adrian [Sun, 29 Nov 2015 05:42:18 +0000 (05:42 +0000)]
u32 -> uint32_t.

33 hours agosfxge: cleanup: fix prefast annotations on mac stats updates
arybchik [Sun, 29 Nov 2015 05:38:40 +0000 (05:38 +0000)]
sfxge: cleanup: fix prefast annotations on mac stats updates

Submitted by:   Andy Moreton <amoreton at>
Sponsored by:   Solarflare Communications, Inc.
MFC after:      2 days
X-MFC with:     r291397

33 hours ago[ath_hal] add AR9461 (jupiter) 2.1 support.
adrian [Sun, 29 Nov 2015 05:34:00 +0000 (05:34 +0000)]
[ath_hal] add AR9461 (jupiter) 2.1 support.

Obtained from: Linux ath9k

34 hours agosfxge: modify nvram update functions for uio platform to support RFID-selectable...
arybchik [Sun, 29 Nov 2015 05:08:23 +0000 (05:08 +0000)]
sfxge: modify nvram update functions for uio platform to support RFID-selectable presets

Dynamic config partitions on boards that support RFID are divided into
a number of segments, each formatted like a partition, with header,
trailer and end tags. The first segment is the current active

The segments are initialised by manftest and each contain a different
configuration e.g. firmware variant. The firmware can be instructed
via RFID to copy a segment over the first segment, hence changing the
active configuration. This allows ops to change the configuration of
a board prior to shipment using RFID.

Changes to the dynamic config may need to be written to all segments (in
particular firmware versions written by manftest) or just the first
segment (changes to the active configuration). See SF-111324-SW.
If only the first segment is written the code still needs to be aware of
the possible presence of subsequent segments as writing to a segment may
cause its size to increase, which would overwrite the subsequent
segments and invalidate them.

Boards that do not support RFID will only have one segment in their
dynamic config partition.

Submitted by:   Paul Fox <pfox at>
Sponsored by:   Solarflare Communications, Inc.
MFC after:      2 days
Differential Revision:

45 hours agodrm/i915: Reduce diff with Linux 3.8
dumbbell [Sat, 28 Nov 2015 17:38:27 +0000 (17:38 +0000)]
drm/i915: Reduce diff with Linux 3.8

There is no functional change. The goal is to ease the future update to
Linux 3.8's i915 driver.

MFC after: 2 months

45 hours agodrm/i915: Further reduce the diff in i915_dma.c
dumbbell [Sat, 28 Nov 2015 17:37:41 +0000 (17:37 +0000)]
drm/i915: Further reduce the diff in i915_dma.c

MFC after: 2 months

47 hours agodrm/i915: Reduce diff with Linux 3.8
dumbbell [Sat, 28 Nov 2015 15:22:46 +0000 (15:22 +0000)]
drm/i915: Reduce diff with Linux 3.8

There is no functional change. The goal is to ease the future update to
Linux 3.8's i915 driver.

MFC after: 2 months

2 days agoAHCI: Use bus_dmamap_sync(9) when accessing DMA buffers.
mmel [Sat, 28 Nov 2015 14:30:42 +0000 (14:30 +0000)]
AHCI: Use bus_dmamap_sync(9) when accessing DMA buffers.

Reviewed by: mav
Approved by: kib (mentor)
Differential Revision:

2 days agoARM: Implement atomic_swap_int(9). It's used in DRM2 code.
mmel [Sat, 28 Nov 2015 12:12:28 +0000 (12:12 +0000)]
ARM: Implement atomic_swap_int(9). It's used in DRM2 code.

Approved by: kib (mentor)

2 days agoARM: Add support for new KRAIT 300 CPU revision.
mmel [Sat, 28 Nov 2015 12:11:44 +0000 (12:11 +0000)]
ARM: Add support for new KRAIT 300 CPU revision.

Approved by: kib (mentor)

2 days agoARM: Cumulative fixes for GIC
mmel [Sat, 28 Nov 2015 12:09:36 +0000 (12:09 +0000)]
ARM: Cumulative fixes for GIC
 - fix detection of interrupt root controller
 - allow (but warn) unsupported configuration bits
 - dont send EOI for spurious interrupts
 - print more informations for spurious interrupts
 - use device_printf() where appropriate

Reviewed by: ian (earlier version)
Approved by: kib (mentor)

2 days agoRemove sv_prepsyscall, sv_sigsize and sv_sigtbl members of the struct
kib [Sat, 28 Nov 2015 08:49:07 +0000 (08:49 +0000)]
Remove sv_prepsyscall, sv_sigsize and sv_sigtbl members of the struct

sv_prepsyscall is unused.

sv_sigsize and sv_sigtbl translate signal number from the FreeBSD
namespace into the ABI domain.  It is only utilized on i386 for iBCS2
binaries.  The issue with this approach is that signals for iBCS2 were
delivered with the FreeBSD signal frame layout, which does not follow
iBCS2.  The same note is true for any other potential user if
sv_sigtbl.  In other words, if ABI needs signal number translation, it
really needs custom sv_sendsig method instead.

Sponsored by: The FreeBSD Foundation

2 days agoDisconnect iBCS2 emulator from the build. The ibcs2 option, the build
kib [Sat, 28 Nov 2015 08:31:32 +0000 (08:31 +0000)]
Disconnect iBCS2 emulator from the build.  The ibcs2 option, the build
glue and the sources are not removed for now.

Discussed with: emaste
Sponsored by: The FreeBSD Foundation

2 days ago[ath_hal] use the correct revision information for QCA953x.
adrian [Sat, 28 Nov 2015 06:50:09 +0000 (06:50 +0000)]
[ath_hal] use the correct revision information for QCA953x.

This probe/attaches correctly in my local branch and now displays
a useful message:

ath0: <Qualcomm Atheros QCA953x> at mem 0x18100000-0x1811ffff irq 0 on nexus0
ath0: AR9530 mac 1280.0 RF5110 phy 0.0

2 days agoAdd AR9530 (honeybee) config option.
adrian [Sat, 28 Nov 2015 01:09:30 +0000 (01:09 +0000)]
Add AR9530 (honeybee) config option.

2 days agoRegen src.conf.5 for recent option changes.
ume [Sat, 28 Nov 2015 00:55:49 +0000 (00:55 +0000)]
Regen src.conf.5 for recent option changes.

2 days agoFix breakage by recent collation change.
ume [Sat, 28 Nov 2015 00:41:37 +0000 (00:41 +0000)]
Fix breakage by recent collation change.
LC_ALL has to be exported.

2 days ago* Add device string for QCA955x (scorpion);
adrian [Sat, 28 Nov 2015 00:27:16 +0000 (00:27 +0000)]
* Add device string for QCA955x (scorpion);
* Add device ID and device string for QCA953x (honeybee).

2 days agowrap in ATH_DEBUG.
adrian [Sat, 28 Nov 2015 00:14:37 +0000 (00:14 +0000)]
wrap in ATH_DEBUG.

Thanks sparc64 build!

2 days ago[ath] conditionally print out the rate series information if ATH_DEBUG_XMIT is set.
adrian [Fri, 27 Nov 2015 22:33:40 +0000 (22:33 +0000)]
[ath] conditionally print out the rate series information if ATH_DEBUG_XMIT is set.

2 days agoTake also the send queue and sent queue into account when triggering
tuexen [Fri, 27 Nov 2015 22:11:46 +0000 (22:11 +0000)]
Take also the send queue and sent queue into account when triggering
the sending of outgoing stream reset requests.

MFC after: 3 days

2 days agokbdmap: include filename when reporting fopen() failure
emaste [Fri, 27 Nov 2015 21:27:39 +0000 (21:27 +0000)]
kbdmap: include filename when reporting fopen() failure

Previously only one of two cases reported the file name. Use the same
error string in both cases.

Sponsored by: The FreeBSD Foundation

2 days agoIn vm_pageout_grow_cache(), do not re-try the inactive queue when
kib [Fri, 27 Nov 2015 19:43:36 +0000 (19:43 +0000)]
In vm_pageout_grow_cache(), do not re-try the inactive queue when
active queue scan initiated write.

Re-trying from the inactive queue when doing active scan makes the
loop never end if number of domains is greater than 1 and inactive or
active scan cannot reach the target.

Reported and tested by: Andrew Gallatin <>
Reviewed by: alc
Sponsored by: The FreeBSD Foundation
MFC after: 2 weeks

2 days agoAdd helper to catch single step debug event and distinguish it from bkpt
zbb [Fri, 27 Nov 2015 19:03:59 +0000 (19:03 +0000)]
Add helper to catch single step debug event and distinguish it from bkpt

Some architectures (including ARMv6/v7) do not have separate single step
events and cannot see difference between breakpoint and single step.
Add db_pc_is_singlestep() to avoid skipping instruction we stepped on
to trigger debug event.
This commit does not change the existing functionality but adds possibility
to implement custom db_pc_is_singlestep().

Reviewed by:   imp
Submitted by:  Zbigniew Bodek <>
Obtained from: Semihalf
Sponsored by:  Juniper Networks Inc.
Differential Revision:

2 days agoAdd support to libkvm for reading vmcores from other architectures.
jhb [Fri, 27 Nov 2015 18:58:26 +0000 (18:58 +0000)]
Add support to libkvm for reading vmcores from other architectures.
- Add a kvaddr_type to represent kernel virtual addresses instead of
  unsigned long.
- Add a struct kvm_nlist which is a stripped down version of struct nlist
  that uses kvaddr_t for n_value.
- Add a kvm_native() routine that returns true if an open kvm descriptor
  is for a native kernel and memory image.
- Add a kvm_open2() function similar to kvm_openfiles().  It drops the
  unused 'swapfile' argument and adds a new function pointer argument for
  a symbol resolving function.  Native kernels still use _fdnlist() from
  libc to resolve symbols if a resolver function is not supplied, but cross
  kernels require a resolver.
- Add a kvm_nlist2() function similar to kvm_nlist() except that it uses
  struct kvm_nlist instead of struct nlist.
- Add a kvm_read2() function similar to kvm_read() except that it uses
  kvaddr_t instead of unsigned long for the kernel virtual address.
- Add a new kvm_arch switch of routines needed by a vmcore backend.
  Each backend is responsible for implementing kvm_read2() for a given
  vmcore format.
- Use libelf to read headers from ELF kernels and cores (except for
  powerpc cores).
- Add internal helper routines for the common page offset hash table used
  by the minidump backends.
- Port all of the existing kvm backends to implement a kvm_arch switch and
  to be cross-friendly by using private constants instead of ones that
  vary by platform (e.g. PAGE_SIZE).  Static assertions are present when
  a given backend is compiled natively to ensure the private constants
  match the real ones.
- Enable all of the existing vmcore backends on all platforms.  This means
  that libkvm on any platform should be able to perform KVA translation
  and read data from a vmcore of any platform.

Tested on: amd64, i386, sparc64 (marius)
Differential Revision:

2 days agoAdd support for exynos5_ehci in loader
zbb [Fri, 27 Nov 2015 18:22:04 +0000 (18:22 +0000)]
Add support for exynos5_ehci in loader

Create new driver which initializes Arndale PHY and calls ehci_init

Reviewed by:   hselasky
Submitted by:  Wojciech Macek <>
Obtained from: Semihalf
Sponsored by:  Juniper Networks Inc.
Differential Revision:

2 days agoIncrease malloc area in loader/usb
zbb [Fri, 27 Nov 2015 18:20:21 +0000 (18:20 +0000)]
Increase malloc area in loader/usb

Previous value was not enough on Arndale platform.

Reviewed by:   hselasky
Submitted by:  Wojciech Macek <>
Obtained from: Semihalf
Sponsored by:  Juniper Networks Inc.
Differential Revision:

2 days agoRun callouts during infinite waiting inside cv_wait
zbb [Fri, 27 Nov 2015 18:19:11 +0000 (18:19 +0000)]
Run callouts during infinite waiting inside cv_wait

During cv_wait we may be waiting for an event triggered by callout.
Run callbacks here to avoid code blocking.

Reviewed by:   hselasky
Submitted by:  Wojciech Macek <>
Obtained from: Semihalf
Sponsored by:  Juniper Networks Inc.
Differential Revision:

2 days agoImplement simple ops for umass_disk
zbb [Fri, 27 Nov 2015 18:17:53 +0000 (18:17 +0000)]
Implement simple ops for umass_disk

The initial IOCTL implementation supports reading disk physical
Two additional functions were added. They allow reading/writing raw
data to the disk (default partition).

Submitted by:  Wojciech Macek <>
Obtained from: Semihalf
Sponsored by:  Juniper Networks Inc.
Differential Revision:

2 days agoDo not zero memory in umass_detach
zbb [Fri, 27 Nov 2015 18:16:10 +0000 (18:16 +0000)]
Do not zero memory in umass_detach

The detach function is called very often, for example from
get_capacity function. We don't want to loose any pointers
here, so disable detaching for umass driver.

Submitted by:  Wojciech Macek <>
Obtained from: Semihalf
Sponsored by:  Juniper Networks Inc.
Differential Revision:

2 days agoImplement missing bus_space_subregion in kshim
zbb [Fri, 27 Nov 2015 18:14:45 +0000 (18:14 +0000)]
Implement missing bus_space_subregion in kshim

Add missing function, used by exynos5_ehci driver.

Reviewed by:   hselasky
Submitted by:  Wojciech Macek <>
Obtained from: Semihalf
Sponsored by:  Juniper Networks Inc.
Differential Revision:

2 days agoUse properly aligned buffer in usb_alloc
zbb [Fri, 27 Nov 2015 18:13:28 +0000 (18:13 +0000)]
Use properly aligned buffer in usb_alloc

The PA adress must be gathered from an aligned VA,
not the RAW pointer to the memory space.

Reviewed by:   hselasky
Submitted by:  Wojciech Macek <>
Obtained from: Semihalf
Sponsored by:  Juniper Networks Inc.
Differential Revision:

2 days agosfxge: cleanup: report error on failure path in efx_vpd_hunk_verify
arybchik [Fri, 27 Nov 2015 16:23:27 +0000 (16:23 +0000)]
sfxge: cleanup: report error on failure path in efx_vpd_hunk_verify

If the VPD is corrupt and contains an 'RV' keyword before the
END tag, then this function could return without setting the
return code to report the error.

Found by prefast.

Submitted by:   Andy Moreton <amoreton at>
Sponsored by:   Solarflare Communications, Inc.
MFC after:      2 days

2 days agosfxge: cleanup: fix prefast annotations on mac stats updates
arybchik [Fri, 27 Nov 2015 16:21:14 +0000 (16:21 +0000)]
sfxge: cleanup: fix prefast annotations on mac stats updates

Submitted by:   Andy Moreton <amoreton at>
Sponsored by:   Solarflare Communications, Inc.
MFC after:      2 days

2 days agosfxge: fix prefast warning in falconsiena_tx_qcreate
arybchik [Fri, 27 Nov 2015 16:18:59 +0000 (16:18 +0000)]
sfxge: fix prefast warning in falconsiena_tx_qcreate

Keep prefast happy by returning the initial queue index
from falconsiena_tx_qcreate(). No change in behaviour, as
etxo_qcreate already zeros *addedp before the call.

Submitted by:   Andy Moreton <amoreton at>
Sponsored by:   Solarflare Communications, Inc.
MFC after:      2 days

2 days agosfxge: cleanup: fix prefast annotations for stats buffers
arybchik [Fri, 27 Nov 2015 16:16:45 +0000 (16:16 +0000)]
sfxge: cleanup: fix prefast annotations for stats buffers

Submitted by:   Andy Moreton <amoreton at>
Sponsored by:   Solarflare Communications, Inc.
MFC after:      2 days

2 days agosfxge: unlink PIO buffers from VIs in WC mapping in hunt_nic_fini()
arybchik [Fri, 27 Nov 2015 16:07:20 +0000 (16:07 +0000)]
sfxge: unlink PIO buffers from VIs in WC mapping in hunt_nic_fini()

PIO is not yet supported in the FreeBSD driver.

Submitted by:   Andy Moreton <amoreton at>
Sponsored by:   Solarflare Communications, Inc.
MFC after:      2 days

2 days agosfxge: infer external port numbering for Pavia
arybchik [Fri, 27 Nov 2015 16:03:51 +0000 (16:03 +0000)]
sfxge: infer external port numbering for Pavia

Adjust external port mapping table to distinguish Pavia from Monza.
Now the presence of any 40G mode implies at least 2 outputs per
external port.  So Pavia 4x10G ports are now mapped to 1,2,3,4;
Monza 4x10G ports map to 1,1,2,2 as before.

Submitted by:   Richard Houldsworth <rhouldsworth at>
Sponsored by:   Solarflare Communications, Inc.
MFC after:      2 days

2 days agosfxge: cleanup: fix prefast annotation
arybchik [Fri, 27 Nov 2015 15:58:52 +0000 (15:58 +0000)]
sfxge: cleanup: fix prefast annotation

Submitted by:   Andy Moreton <amoreton at>
Sponsored by:   Solarflare Communications, Inc.
MFC after:      2 days

2 days agosfxge: do not use unnamed union in siena_mc_combo_rom_hdr_t
arybchik [Fri, 27 Nov 2015 15:54:36 +0000 (15:54 +0000)]
sfxge: do not use unnamed union in siena_mc_combo_rom_hdr_t

GCC 4.2.1 used on FreeBSD 8 and 9 branches does not like unnamed
union member in the structure. It is not strictly required in head,
but nice to have to minimize difference with out-of-tree driver.

Sponsored by:   Solarflare Communications, Inc.
MFC after:      2 days

2 days agosfxge: cleanup: error probe correction
arybchik [Fri, 27 Nov 2015 15:50:17 +0000 (15:50 +0000)]
sfxge: cleanup: error probe correction

Submitted by:   Richard Houldsworth <rhouldsworth at>
Sponsored by:   Solarflare Communications, Inc.
MFC after:      2 days

3 days agoUse netbsd usage() implementation in newfs_msdos
emaste [Fri, 27 Nov 2015 14:40:21 +0000 (14:40 +0000)]
Use netbsd usage() implementation in newfs_msdos

In r289629 newfs_msdos option descriptions are available in

Obtained from: NetBSD

3 days agoFix panic when trying to sort unsupported command in OOA queue.
mav [Fri, 27 Nov 2015 14:29:04 +0000 (14:29 +0000)]
Fix panic when trying to sort unsupported command in OOA queue.

Handle unsupported commands as not conflicting/blocking.

3 days agomkfs_msdos: sync with NetBSD
emaste [Fri, 27 Nov 2015 14:20:32 +0000 (14:20 +0000)]
mkfs_msdos: sync with NetBSD

Add a sanity test and clean up whitespace.

Obtained from: NetBSD

3 days agoRemove VI_AGE vnode iflag, it is unused.
kib [Fri, 27 Nov 2015 01:45:40 +0000 (01:45 +0000)]
Remove VI_AGE vnode iflag, it is unused.

Noted by: bde
Sponsored by: The FreeBSD Foundation

3 days agoMove the comment about resident pages preventing vnode from leaving
kib [Fri, 27 Nov 2015 01:16:35 +0000 (01:16 +0000)]
Move the comment about resident pages preventing vnode from leaving
active list, into the header comment for vdrop(), which is the
function that decides whether to leave the vnode on the list.  Note
that dirty page write-out in vinactive() is asynchronous.

Discussed with: alc
Sponsored by: The FreeBSD Foundation
MFC after: 1 week

3 days agovidfont: with vt(4) omit size from vidcontrol -f
emaste [Fri, 27 Nov 2015 00:04:39 +0000 (00:04 +0000)]
vidfont: with vt(4) omit size from vidcontrol -f

When using syscons, vidfont extracts the font size from the filename
passes it to vidcontrol -f. In vt(4) mode the size argument is not
required, and some of the fonts in /usr/share/vt/fonts do not have the
size in the filename, which caused vidfont to fail. Thus, just omit the
size argument in vt(4) mode.

MFC after: 1 week
Sponsored by: The FreeBSD Foundation

3 days agoWhen the sending of an SCTP outgoing stream reset request fails,
tuexen [Thu, 26 Nov 2015 23:12:41 +0000 (23:12 +0000)]
When the sending of an SCTP outgoing stream reset request fails,
don't report it to the user since all stream have been marked
as pending.

MFC after: 1 week

3 days agor291198 inadvertantly reverted a local patch for the default location
des [Thu, 26 Nov 2015 23:05:40 +0000 (23:05 +0000)]
r291198 inadvertantly reverted a local patch for the default location
of ssh-askpass and xauth, breaking X11 forwarding.

3 days agoFix whitespace on addition of IPSEC option
emaste [Thu, 26 Nov 2015 21:35:50 +0000 (21:35 +0000)]
Fix whitespace on addition of IPSEC option

3 days agoCorrect arm64 gic_v3 sizeof argument
emaste [Thu, 26 Nov 2015 21:05:55 +0000 (21:05 +0000)]
Correct arm64 gic_v3 sizeof argument

No functional change as 'struct resource *' and 'struct resource **'
have the same size, but the former is the proper type.

PR: 204768
Submitted by: David Binderman

3 days agoRemove trailing whitespace.
jhb [Thu, 26 Nov 2015 19:42:10 +0000 (19:42 +0000)]
Remove trailing whitespace.

3 days agoRemove kvm_sparc.c. This is for 32-bit sparc support and was imported
jhb [Thu, 26 Nov 2015 19:39:15 +0000 (19:39 +0000)]
Remove kvm_sparc.c.  This is for 32-bit sparc support and was imported
from 4.4BSD.  It has never been used by FreeBSD.

3 days agoCorrect an error in vm_reserv_reclaim_contig(). In the highly unusual
alc [Thu, 26 Nov 2015 19:12:18 +0000 (19:12 +0000)]
Correct an error in vm_reserv_reclaim_contig().  In the highly unusual
case that the reservation contained "low", the starting position in the
popmap for the free page search was incorrectly calculated.  The most
likely (and visible) symptom of this error was the assertion failure,
"vm_reserv_reclaim_contig: pa is too low".

3 days agoRemove residual functions declaration left after r291365.
mav [Thu, 26 Nov 2015 18:56:21 +0000 (18:56 +0000)]
Remove residual functions declaration left after r291365.

3 days ago[wpa] use IFM_IEEE80211_ADHOC for now on FreeBSD for IBSS operation.
adrian [Thu, 26 Nov 2015 17:28:40 +0000 (17:28 +0000)]
[wpa] use IFM_IEEE80211_ADHOC for now on FreeBSD for IBSS operation.

PR: bin/203086
Submitted by: avos

3 days agoRename sysctl node hw.imx6 to hw.imx. Move its definition to imx_machdep.c
ian [Thu, 26 Nov 2015 17:26:52 +0000 (17:26 +0000)]
Rename sysctl node hw.imx6 to hw.imx.  Move its definition to imx_machdep.c
so that code shared between imx5 and imx6 can work with OIDs under that node.

Add last_reset_status (integer) and last_reset_reason (string) OIDs that
provide info about the last chip reset (power-on, software reset, watchdog

3 days ago[wpa] bring up interface in ap_mode=2
adrian [Thu, 26 Nov 2015 17:26:28 +0000 (17:26 +0000)]
[wpa] bring up interface in ap_mode=2

This is required for WPA-NONE operation.

PR: bin/203086
Submitted by: avos@

4 days agoOne more round of port scanner rewrite.
mav [Thu, 26 Nov 2015 13:04:58 +0000 (13:04 +0000)]
One more round of port scanner rewrite.

 - Make scan aborted by event restart immediately and infinitely.
 - Improve handling of some loop events from firmware.
 - Remove loop down timer, adding its functionality to scanner thread.
 - Some more unification and simplification.

4 days agoWhen receiving an SCTP/UDP packet and the interface performed
tuexen [Thu, 26 Nov 2015 09:25:20 +0000 (09:25 +0000)]
When receiving an SCTP/UDP packet and the interface performed
the UDP checksum computation and signals that it was OK,
clear this bit when passing the packet to SCTP. Since the
bits indicating a valid UDP checksum and a valid SCTP
checksum are the same, the SCTP stack would assume
that also an SCTP checksum check has been performed.

MFC after: 1 week

4 days agoClean up trailing whitespace
ngie [Thu, 26 Nov 2015 08:58:13 +0000 (08:58 +0000)]
Clean up trailing whitespace

MFC after: 1 week

4 days agor291359 was incorrect. Skip over tokens that start with `#' as fgetln can
ngie [Thu, 26 Nov 2015 07:58:22 +0000 (07:58 +0000)]
r291359 was incorrect. Skip over tokens that start with `#' as fgetln can
return more than one '\n' delimited line in a buffer

Handle empty lines too, just in case

MFC after: 3 days
X-MFC with: r291359

4 days agoSkip over lines that start with # (comments)
ngie [Thu, 26 Nov 2015 07:03:59 +0000 (07:03 +0000)]
Skip over lines that start with # (comments)

MFC after: 3 days