freebsd.git
9 years agoAssert that the mapping loop makes progress.
kib [Tue, 24 Mar 2015 12:46:21 +0000 (12:46 +0000)]
Assert that the mapping loop makes progress.

Sponsored by: The FreeBSD Foundation
MFC after: 1 week

9 years agosfxge: cleanup: fix index variable type to match upper boundary type
arybchik [Tue, 24 Mar 2015 11:33:34 +0000 (11:33 +0000)]
sfxge: cleanup: fix index variable type to match upper boundary type

Sponsored by:   Solarflare Communications, Inc.

9 years agosfxge: cleanup: add a blank line before each #if to improve readability
arybchik [Tue, 24 Mar 2015 11:25:19 +0000 (11:25 +0000)]
sfxge: cleanup: add a blank line before each #if to improve readability

Sponsored by:   Solarflare Communications, Inc.

9 years agosfxge: cleanup: remove trailing whitespaces
arybchik [Tue, 24 Mar 2015 11:22:12 +0000 (11:22 +0000)]
sfxge: cleanup: remove trailing whitespaces

Sponsored by:   Solarflare Communications, Inc.

9 years agoMake ix_crcstrip a public symbol for the moment; it probably is not
bz [Tue, 24 Mar 2015 09:46:47 +0000 (09:46 +0000)]
Make ix_crcstrip a public symbol for the moment;  it probably is not
the right solution but I will leave it to experts to untangle this
problem to properly stop the build failures.

At the moment only if_ix.c includes dev/netmap/ixgbe_netmap.h which is
good as ixgbe_netmap.h defines a couple of (file) static variables--thus
local to if_ix.c.
static int ix_crcstrip however now also got checked from ix_txrx.c
(as an extern) and should not be visible there.  In fact we do see
powerpc and powerpc64 build failures because of this.  It is unclear
to me why on other (clang built?) architectures this does not lead
to a reference of an undefined symbol and similar build breakage.

9 years agoUse the feedback value from the synchronization endpoint as fallback
hselasky [Tue, 24 Mar 2015 09:21:53 +0000 (09:21 +0000)]
Use the feedback value from the synchronization endpoint as fallback
when there is no recording channel.

MFC after: 3 days
PR:  198444

9 years agoMFV of 280411,tzdata{2015b}
edwin [Tue, 24 Mar 2015 05:52:28 +0000 (05:52 +0000)]
MFV of 280411,tzdata{2015b}

Release 2015b - 2015-03-19 23:28:11 -0700

  Changes affecting future time stamps

    Mongolia will start observing DST again this year, from the last
    Saturday in March at 02:00 to the last Saturday in September at 00:00.
    (Thanks to Ganbold Tsagaankhuu.)

    Palestine will start DST on March 28, not March 27.  Also,
    correct the fall 2014 transition from September 26 to October 24.
    Adjust future predictions accordingly.  (Thanks to Steffen Thorsen.)

  Changes affecting past time stamps

    The 1982 zone shift in Pacific/Easter has been corrected, fixing a 2015a
    regression.  (Thanks to Stuart Bishop for reporting the problem.)

    Some more zones have been turned into links, when they differed
    from existing zones only for older time stamps.  As usual,
    these changes affect UTC offsets in pre-1970 time stamps only.
    Their old contents have been moved to the 'backzone' file.
    The affected zones are: America/Antigua, America/Cayman,
    Pacific/Midway, and Pacific/Saipan.

  Changes affecting time zone abbreviations

    Correct the 1992-2010 DST abbreviation in Volgograd from "MSK" to "MSD".
    (Thanks to Hank W.)

9 years agoDisable coredump_devctl because it could lead to leaking paths to
rpaulo [Tue, 24 Mar 2015 02:17:17 +0000 (02:17 +0000)]
Disable coredump_devctl because it could lead to leaking paths to
jails.

9 years agofiledesc: microoptimize fget_unlocked by getting rid of fd < 0 branch
mjg [Tue, 24 Mar 2015 00:10:11 +0000 (00:10 +0000)]
filedesc: microoptimize fget_unlocked by getting rid of fd < 0 branch

Casting fd to an unsigned type simplifies fd range coparison to mere checking
if the result is bigger than the table.

9 years agoWhen an ICMP message is received and the MTU shrinks, only
tuexen [Mon, 23 Mar 2015 23:34:21 +0000 (23:34 +0000)]
When an ICMP message is received and the MTU shrinks, only
mark outstanding chunks for retransmissions.

MFC after: 3 days

9 years agocxgbe(4): Do not call sbuf_trim on an sbuf with a drain function.
np [Mon, 23 Mar 2015 23:06:32 +0000 (23:06 +0000)]
cxgbe(4): Do not call sbuf_trim on an sbuf with a drain function.

MFC after: 1 week

9 years agoDo not save/restore the TLS pointer on context switch for armv6. The
ian [Mon, 23 Mar 2015 22:42:42 +0000 (22:42 +0000)]
Do not save/restore the TLS pointer on context switch for armv6.  The
pointer cannot be changed directly by userland code on armv6 (it can be on
armv4), so there's no need to save/restore.

Submitted by: Michal Meloun

9 years agoAdd llvm patch corresponding to r280400.
dim [Mon, 23 Mar 2015 21:15:07 +0000 (21:15 +0000)]
Add llvm patch corresponding to r280400.

9 years agoPull in r230348 from upstream llvm trunk (by Tim Northover):
dim [Mon, 23 Mar 2015 21:13:29 +0000 (21:13 +0000)]
Pull in r230348 from upstream llvm trunk (by Tim Northover):

  ARM: treat [N x i32] and [N x i64] as AAPCS composite types

  The logic is almost there already, with our special homogeneous
  aggregate handling. Tweaking it like this allows front-ends to emit
  AAPCS compliant code without ever having to count registers or add
  discarded padding arguments.

  Only arrays of i32 and i64 are needed to model AAPCS rules, but I
  decided to apply the logic to all integer arrays for more consistency.

This fixes a possible "Unexpected member type for HA" error when
compiling lib/msun/bsdsrc/b_tgamma.c for armv6.

Reported by: Jakub Palider <jpa@semihalf.com>

9 years agoReduce priority of ATA/SATA drivers.
mav [Mon, 23 Mar 2015 19:47:52 +0000 (19:47 +0000)]
Reduce priority of ATA/SATA drivers.

Legacy ata(4) -> BUS_PROBE_LOW_PRIORITY;  more functional ahci(4), siis(4),
mvs(4) -> BUS_PROBE_DEFAULT;  BUS_PROBE_VENDOR leave for vendor drivers.

MFC after: 2 weeks

9 years agoBe consistent with M_ZERO when allocating ccbs.
benno [Mon, 23 Mar 2015 18:45:37 +0000 (18:45 +0000)]
Be consistent with M_ZERO when allocating ccbs.

There are four places, all in cam_xpt.c, where ccbs are malloc'ed. Two of
these use M_ZERO, two don't. The two that don't meant that allocated ccbs
had trash in them making it hard to debug errors where they showed up. Due
to this, use M_ZERO all the time when allocating ccbs.

Submitted by: Scott Ferris <scott.ferris@isilon.com>
Sponsored by: EMC/Isilon Storage Division
Reviewed by: scottl, imp
Differential: https://reviews.freebsd.org/D2120

9 years agoxlint: update.
pfg [Mon, 23 Mar 2015 18:45:29 +0000 (18:45 +0000)]
xlint: update.

Bring some important updates from NetBSD up to about 2008/04/25.
The main feature is initial support for C99.

This is a very basic update to make it easier to merge new
compiler attirbutes but more updates are likely to follow.

Obtained from: NetBSD
MFC after: 2 weeks

9 years agocp,mv: Use futimens() instead of utimensat() if possible.
jilles [Mon, 23 Mar 2015 17:35:05 +0000 (17:35 +0000)]
cp,mv: Use futimens() instead of utimensat() if possible.

9 years agoAdd missing variables password/bootlock_password.
dteske [Mon, 23 Mar 2015 17:31:22 +0000 (17:31 +0000)]
Add missing variables password/bootlock_password.
NB: Using NULL for default values in-case someone
or something uncomments it and reboots. See
check-password.4th(8) for additional details.

MFC after: 3 days
X-MFC-to: stable/10 stable/9

9 years agoIncrease max input for password/bootlock_password from 16 to 255.
dteske [Mon, 23 Mar 2015 16:43:46 +0000 (16:43 +0000)]
Increase max input for password/bootlock_password from 16 to 255.
When taking user input, don't show asterisks as the user types
but instead spin a twiddle. Implement Ctrl-U to clear user input.
If the buffer is empty, either because the user has yet to type
anything, presses Ctrl-U at any time, or presses backspace enough
to end in an empty buffer, the twiddle is erased to provide feed-
back to the user.

MFC after: 3 days
X-MFC-to: stable/10 stable/9

9 years agoPrevent password/bootlock_password features of loader.conf(5) from
dteske [Mon, 23 Mar 2015 16:31:27 +0000 (16:31 +0000)]
Prevent password/bootlock_password features of loader.conf(5) from
locking out everyone in the case of setting a password longer than
the maximum (currently 16 characters). Now the required password is
truncated to the maximum input that can be read from the user.

PR: kern/198760
MFC after: 3 days
MFH: stable/10 stable/9

9 years agoFix sgetkey indentation to be consistent with the rest of the file.
dteske [Mon, 23 Mar 2015 16:22:56 +0000 (16:22 +0000)]
Fix sgetkey indentation to be consistent with the rest of the file.
Remove some blank lines, adjust some comments and update copyright.

MFC after: 3 days
X-MFC-to: stable/10 stable/9

9 years agoRenumber clauses to avoid missing 3
emaste [Mon, 23 Mar 2015 16:04:04 +0000 (16:04 +0000)]
Renumber clauses to avoid missing 3

9 years agosfxge: remove unnecessary and wrong prediction
arybchik [Mon, 23 Mar 2015 15:53:26 +0000 (15:53 +0000)]
sfxge: remove unnecessary and wrong prediction

Sponsored by:   Solarflare Communications, Inc.
Differential Revision: https://reviews.freebsd.org/D2085

9 years agosfxge: do not check MCDI status word
arybchik [Mon, 23 Mar 2015 15:52:57 +0000 (15:52 +0000)]
sfxge: do not check MCDI status word

This is a temporary workaround until we determine a reliable sequence
of operations for detecting MC reboots.

Sponsored by:   Solarflare Communications, Inc.
Differential Revision: https://reviews.freebsd.org/D2084

9 years agosfxge: FreeBSD before 10 does not have bus_space_*_8 on amd64
arybchik [Mon, 23 Mar 2015 15:52:05 +0000 (15:52 +0000)]
sfxge: FreeBSD before 10 does not have bus_space_*_8 on amd64

bus_space_*_8() are not always macros, so it is not correct to use
#ifndef.

Sponsored by:   Solarflare Communications, Inc.
Differential Revision: https://reviews.freebsd.org/D2083

9 years agosfxge: add statistics for each Tx queue
arybchik [Mon, 23 Mar 2015 15:49:11 +0000 (15:49 +0000)]
sfxge: add statistics for each Tx queue

Sponsored by:   Solarflare Communications, Inc.
Differential Revision: https://reviews.freebsd.org/D2082

9 years agosfxge: remove obsolete Tx non-multi queue support
arybchik [Mon, 23 Mar 2015 15:47:37 +0000 (15:47 +0000)]
sfxge: remove obsolete Tx non-multi queue support

Tx multi queue is added in FreeBSD 8.0. So, the changeset drops earlier
versions support.

Sponsored by:   Solarflare Communications, Inc.
Differential Revision: https://reviews.freebsd.org/D2081

9 years agosfxge: add barriers to BAR write macros
arybchik [Mon, 23 Mar 2015 15:45:39 +0000 (15:45 +0000)]
sfxge: add barriers to BAR write macros

In theory the barriers are required to cope with write combining and
reordering. Two barriers are added (sometimes merged to one):
 1. Before the first write to guarantee that previous writes to the region
    have been done
 2. Before the last write to guarantee that write to the last dword/qword is
    done after previous writes
Barriers are inserted before in the assumption that it is better to
postpone barriers as much as it is possible (more chances that the
operation has already been already done and barrier does not stall CPU).

On x86 and amd64 bus space write barriers are just compiler memory barriers
which are definitely required.

Sponsored by:   Solarflare Communications, Inc.
Differential Revision: https://reviews.freebsd.org/D2077

9 years agosfxge: assert either kernel or internal copy of interface flags
arybchik [Mon, 23 Mar 2015 15:44:17 +0000 (15:44 +0000)]
sfxge: assert either kernel or internal copy of interface flags

ioctl to put interface down sets ifp->if_flags which holds the intended
administratively defined state and calls driver callback to apply it.
When everything is done, driver updates internal copy of
interface flags sc->if_flags which holds the operational state.
So, transmit from Rx path is possible when interface is intended to be
administratively down in accordance with ifp->if_flags, but not applied
yet and the operational state is up in accordance with sc->if_flags.

Sponsored by:   Solarflare Communications, Inc.
Differential Revision: https://reviews.freebsd.org/D2075

9 years agoRemove a useless assignment.
tuexen [Mon, 23 Mar 2015 15:12:02 +0000 (15:12 +0000)]
Remove a useless assignment.

MFC after: 1 week

9 years agoAdd the start of the arm64 machine headers. This is the subset needed to
andrew [Mon, 23 Mar 2015 11:54:56 +0000 (11:54 +0000)]
Add the start of the arm64 machine headers. This is the subset needed to
start getting userland libraries building.

Reviewed by: imp
Sponsored by: The FreeBSD Foundation

9 years agoBump mask to be 64 bits - this fixes seeing MCS rates > 19.
adrian [Mon, 23 Mar 2015 03:43:59 +0000 (03:43 +0000)]
Bump mask to be 64 bits - this fixes seeing MCS rates > 19.

Tested:

* AR9380, STA mode, associated to a 3x3 AP (also FreeBSD)

9 years agoDocument "none" for VersionAddendum.
bdrewery [Mon, 23 Mar 2015 02:45:12 +0000 (02:45 +0000)]
Document "none" for VersionAddendum.

PR: 193127
MFC after: 2 weeks

9 years agoSmall style(9) cleanup.
pfg [Sun, 22 Mar 2015 23:42:21 +0000 (23:42 +0000)]
Small style(9) cleanup.

Fix yet more issues, but certainly not all.

Pointed out by: bde

9 years agoBuild expr with -fwrapv, since it relies on signed integer wrapping
dim [Sun, 22 Mar 2015 22:40:32 +0000 (22:40 +0000)]
Build expr with -fwrapv, since it relies on signed integer wrapping
having defined behavior.

Reported by: rodrigc
MFC after: 3 days

9 years agoThe sysctls that return process argv and envv return binary data, so clear
ian [Sun, 22 Mar 2015 21:18:44 +0000 (21:18 +0000)]
The sysctls that return process argv and envv return binary data, so clear
the SBUF_INCLUDENUL flag.

Pointed out by:     tijl@

9 years agoFix typo in jail(8) man page
allanjude [Sun, 22 Mar 2015 20:38:28 +0000 (20:38 +0000)]
Fix typo in jail(8) man page

PR: 198790
Differential Revision: https://reviews.freebsd.org/D2111
Submitted by: Jimmy Olgeni
Approved by: wblock (mentor)
Sponsored by: ScaleEngine Inc.

9 years agoStop calling x86_efi_copyin and x86_efi_getdev directly. This is to help
andrew [Sun, 22 Mar 2015 18:17:55 +0000 (18:17 +0000)]
Stop calling x86_efi_copyin and x86_efi_getdev directly. This is to help
port loader.efi to both 32 and 64-bit ARM where we can use this file with
minimal changes.

Differential Revision: https://reviews.freebsd.org/D2031
Reviewed by: imp

9 years agoAdd FREEBSD-Xlist files for llvm, clang and lldb.
dim [Sun, 22 Mar 2015 17:56:49 +0000 (17:56 +0000)]
Add FREEBSD-Xlist files for llvm, clang and lldb.

These are generated, and not "optimized" in any way, since I am not
entirely sure of the syntax or format of this type of file.  Feel free
to suggest ways of shortening these lists.

The general idea is the same for all three files, though:
* Get rid of upstream build infrastructure (CMakeLists, Makefiles, etc)
* Delete tests, tools and utilities we don't want or use (including
  samples)
* Remove various bits of upstream metadata files that we don't want or
  use (.arcconfig, .gitignore, etc)

9 years agoInitialise the pps / packet tracking timestamp so 11n aggregation works again.
adrian [Sun, 22 Mar 2015 17:54:00 +0000 (17:54 +0000)]
Initialise the pps / packet tracking timestamp so 11n aggregation works again.

There's a bug in the ticks handling where when initialised at '0', once
the ticks counter wrapped the comparison math would never trigger.
The pps calculation would never happen, and thus aggregation was never
enabled.

It manifests itself as "oh you only get 11n transmit aggregation for the
first 10 minutes of uptime."

I'm sure there are other ticks related issues lurking in net80211.

Tested:

* ath / iwn, both with 'wlandebug +11n' and a little bit of iperf to
  kick off the transmit A-MPDU negotiation once the pps gets high enough.

9 years agoConvert savecore to libxo. The 'verbose' paths still use printf since they're
scottl [Sun, 22 Mar 2015 17:29:14 +0000 (17:29 +0000)]
Convert savecore to libxo.  The 'verbose' paths still use printf since they're
meant for interactivity on the command line and contain a lot of redundant
information.

Obtained from: Netflix, Inc.

9 years agoRemove MAXBSIZE use from drivers where it has nothing to do.
mav [Sun, 22 Mar 2015 16:10:28 +0000 (16:10 +0000)]
Remove MAXBSIZE use from drivers where it has nothing to do.

In some cases limits are just not needed, in others -- DFLTPHYS is the
right constant to use instead.

MFC after: 1 month

9 years agoSmall style(9) cleanup.
pfg [Sun, 22 Mar 2015 15:37:05 +0000 (15:37 +0000)]
Small style(9) cleanup.

#define should always be followed by a tab not space.

9 years agoFix for out of order device destruction notifications when using the
hselasky [Sun, 22 Mar 2015 13:11:56 +0000 (13:11 +0000)]
Fix for out of order device destruction notifications when using the
delist_dev() function. In addition to this change:
- add a proper description of this function
- add a proper witness assert inside this function
- switch a nearby line to use the "cdp" pointer instead of cdev2priv()

MFC after: 3 days

9 years agomsdosfs: mark unused compat-mount fields
kib [Sun, 22 Mar 2015 09:09:26 +0000 (09:09 +0000)]
msdosfs: mark unused compat-mount fields

The magic number MSDOSFS_ARGSMAGIC, which used to distinguish
"old" vs "new" msdosfs mount arguments, has not been used since
2005; it should just go away now.

Likewise, the local-to-Unicode table that changed at the same
time is unused.

Leave the space reserved in the old style mount arguments, though,
since we still support the old mount call (via the cmount entry
point).

Submitted by: Chris Torek <chris.torek@gmail.com>
MFC after: 2 weeks

9 years agoAdd initial D-Link DIR-655 (A1) support.
adrian [Sun, 22 Mar 2015 02:15:09 +0000 (02:15 +0000)]
Add initial D-Link DIR-655 (A1) support.

This is based on the AP135 design - QCA9558 SoC, 3x3 2GHz wifi, but no
5GHz (11n or 11ac) chip is available.

It however still has 128MiB of RAM, 16MiB of NOR flash and the AR8327N
gigabit switch - so it's quite a beefy router device.

Tested:

* Well, a unit, naturally

Obtained from: Completely messing up an amazon.com order and getting this instead, and asking "hey, wonder if I could.."

9 years agoDescribe the behavior when both -f and a message are given. Pointed out by
wblock [Sun, 22 Mar 2015 01:25:57 +0000 (01:25 +0000)]
Describe the behavior when both -f and a message are given.  Pointed out by
Raphael Abreu <raphael.lorenzeto@gmail.com> on freebsd-doc.

MFC after: 1 week

9 years agore-enable building modules for the AR933x
adrian [Sat, 21 Mar 2015 23:39:34 +0000 (23:39 +0000)]
re-enable building modules for the AR933x

* add ipfw
* delete ath / ath_ahb for now, until I can have Warner beat me
  with the clue stick about putting in conditional build things into
  the ath Makefile so the module builds can just have the HAL bits
  that are relevant for a particular target.

9 years agoQuieten some of the log spam from AR9300 sysctl tree walk and chip setup/reset
adrian [Sat, 21 Mar 2015 23:12:46 +0000 (23:12 +0000)]
Quieten some of the log spam from AR9300 sysctl tree walk and chip setup/reset
path.

* For now there's no exposed control over classic / LNA antenna diversity,
  so just stub them out.  Adding this will take quite a bit of time.

* Add a function to fetch the CTS timeout.

PR: kern/198558

9 years agoPull in r231972 from upstream compiler-rt trunk (by Jörg Sonnenberger):
dim [Sat, 21 Mar 2015 21:49:25 +0000 (21:49 +0000)]
Pull in r231972 from upstream compiler-rt trunk (by Jörg Sonnenberger):

  Always include stddef.h to make sure size_t exists.

  From Alexander Esilevich.

Requested by: andrew

9 years agoproc: use MTX_NEW flag in proc_init
mjg [Sat, 21 Mar 2015 20:25:34 +0000 (20:25 +0000)]
proc: use MTX_NEW flag in proc_init

This allows us to get rid of bzero which was added specifically to make
mtx_init on p_mtx reliable.

This also fixes a potential problem where mtx_init on other mutexes
could trip over on unitialized memory and fire an assertion.

Reviewed by: kib

9 years agocred: add proc_set_cred_init helper
mjg [Sat, 21 Mar 2015 20:24:54 +0000 (20:24 +0000)]
cred: add proc_set_cred_init helper

proc_set_cred_init can be used to set first credentials of a new
process.

Update proc_set_cred assertions so that it only expects already used
processes.

This fixes panics where p_ucred of a new process happens to be non-NULL.

Reviewed by: kib

9 years agofork: assign refed credentials earlier
mjg [Sat, 21 Mar 2015 20:24:03 +0000 (20:24 +0000)]
fork: assign refed credentials earlier

Prior to this change the kernel would take p1's credentials and assign
them tempororarily to p2. But p1 could change credentials at that time
and in effect give us a use-after-free.

No objections from: kib

9 years agoCorrectly pass the -mllvm -enable-gvn=false flag in CLANG_OPT_SMALL
dim [Sat, 21 Mar 2015 19:13:13 +0000 (19:13 +0000)]
Correctly pass the -mllvm -enable-gvn=false flag in CLANG_OPT_SMALL
(this has to be passed as a combination of two flags).  Should fix the
case where the clang version is before 3.5.0.

Submitted by: Pedro Arthur <bygrandao@gmail.com>
X-MFC-With: r279018, r279378

9 years agoIntroduce vm_object_color() and use it in mmap(2) to set the color of
alc [Sat, 21 Mar 2015 17:56:55 +0000 (17:56 +0000)]
Introduce vm_object_color() and use it in mmap(2) to set the color of
named objects to zero before the virtual address is selected.  Previously,
the color setting was delayed until after the virtual address was
selected.  In rtld, this delay effectively prevented the mapping of a
shared library's code section using superpages.  Now, for example, we see
the first 1 MB of libc's code on armv6 mapped by a superpage after we've
gotten through the initial cold misses that bring the first 1 MB of code
into memory.  (With the page clustering that we perform on read faults,
this happens quickly.)

Differential Revision: https://reviews.freebsd.org/D2013
Reviewed by: jhb, kib
Tested by: Svatopluk Kraus (armv6)
MFC after: 6 weeks

9 years agoMake TARGET_ARCH=powerpc64 work without TARGET=powerpc.
imp [Sat, 21 Mar 2015 16:54:01 +0000 (16:54 +0000)]
Make TARGET_ARCH=powerpc64 work without TARGET=powerpc.

9 years agoerror is only used if MAC is defined, so make its declaration conditional
cognet [Sat, 21 Mar 2015 16:16:17 +0000 (16:16 +0000)]
error is only used if MAC is defined, so make its declaration conditional
as well.

9 years agoWhen waiting on PTE allocation, another thread could free the l2_dtable while
cognet [Sat, 21 Mar 2015 15:32:59 +0000 (15:32 +0000)]
When waiting on PTE allocation, another thread could free the l2_dtable while
we're not looking at it.
Fix this by increasing l2->l2_occupancy before we try to alloc (and decrease
it if the allocation failed, or if another thread did a similar allocation).

Submitted by: Kohji Okuno <okuno.kohji@jp.panasonic.com>
MFC after: 1 week

9 years agoSomewhat modernize the SysV shm code:
kib [Sat, 21 Mar 2015 15:01:19 +0000 (15:01 +0000)]
Somewhat modernize the SysV shm code:
- Use real locking, replace Giant with global sx protecting the
  subsystem.  Since the subsystem' lock is no longer dropped during
  the sleepsk, remove not needed SHMSEG_WANTED segment flag, and
  revert r278963.
- To do proper code simplification possible after the change of the
  lock, restructure several functions into _locked body and
  originally-named wrapper which calls into _locked variant.  This
  allows to eliminate the 'goto done2' spread over the code.
- Merge shm_find_segment_by_shmid() and shm_find_segment_by_shmidx().
- Consistently change all function prototypes to ANSI C.

Reviewed by: mjg (who has earlier version of the similar patch to
 introduce real locking)
Tested by: pho
Sponsored by: The FreeBSD Foundation
MFC after: 2 weeks

9 years agoThe synchronisation value returned by the so-called feedback endpoint
hselasky [Sat, 21 Mar 2015 09:45:45 +0000 (09:45 +0000)]
The synchronisation value returned by the so-called feedback endpoint
appears to be too inaccurate that it can be used to synchronize the
playback data stream. If there is a recording endpoint associated with
the playback endpoint, use that instead. That means if the isochronous
OUT endpoint is asynchronus the USB audio driver will automatically
start recording, if possible, to get exact information about the
needed sample rate adjustments. In no recording endpoint is present,
no rate adaption will be done.

While at it fix an issue where the hardware buffer pointers don't get
reset at the first device PCM trigger.

Make some variables 32-bit to avoid problems with multithreading.

MFC after: 3 days
PR:  198444

9 years agoMake the autofs LDAP script cope with server returning entries with
trasz [Sat, 21 Mar 2015 09:42:37 +0000 (09:42 +0000)]
Make the autofs LDAP script cope with server returning entries with
ENTRY_ATTRIBUTE (eg cn) after the VALUE_ATTRIBUTE (eg automountInformation),
instead of before.

PR: 198557
MFC after: 1 month
Sponsored by: The FreeBSD Foundation

9 years agoFix the LED configuration so the switch PHY LEDs work fine.
adrian [Sat, 21 Mar 2015 06:44:41 +0000 (06:44 +0000)]
Fix the LED configuration so the switch PHY LEDs work fine.

Tested:

* TP-Link TL-WDR3600; yes, by testing all five ethernet ports.

Obtained from: Linux OpenWRT

9 years agoMigrate these configs to use the geom map search function.
adrian [Sat, 21 Mar 2015 06:18:25 +0000 (06:18 +0000)]
Migrate these configs to use the geom map search function.

Now that the search function reliably works, this allows for
smaller images.

9 years agoAdd support for the TP-Link TL-WDR4300 and TL-WDR3600.
adrian [Sat, 21 Mar 2015 06:16:23 +0000 (06:16 +0000)]
Add support for the TP-Link TL-WDR4300 and TL-WDR3600.

These are actually almost the same units; except one is 3x3 5GHz, and
one is 2x2 5GHz.

Tested:

* TP-Link TL-WDR3600

TODO:

* The ath0/ath1 MAC addresses are ye garbage (00:02:03:04:05:06); fixing
  that will take a little more time.  It works fine with the ath0/ath1
  MAC addresses set manually.

* Go through and yank the AR9344 on-board switch config (arswitch1);
  it's not required here for this AP.

9 years agoRe-enable the modules for now; I'm using them in some other test builds.
adrian [Sat, 21 Mar 2015 06:13:30 +0000 (06:13 +0000)]
Re-enable the modules for now; I'm using them in some other test builds.

9 years agoNow that the switch PHY fully works, don't limit arge0 to only being up
adrian [Sat, 21 Mar 2015 06:12:46 +0000 (06:12 +0000)]
Now that the switch PHY fully works, don't limit arge0 to only being up
if the WAN port is up.

This way I can use it for arbitrary ports/vlans.

9 years agoAdd GPIO function mux configuration for AR934x SoCs.
adrian [Sat, 21 Mar 2015 06:08:35 +0000 (06:08 +0000)]
Add GPIO function mux configuration for AR934x SoCs.

The AR934x (and maybe others in this family) have a more complicated
GPIO mux.  The AR71xx just has a single function register for a handful
of "GPIO or X" options, however the AR934x allows for one of roughly
100 behaviours for each GPIO pin.

So, this adds a quick hints based mechanism to configure the output
functions, which is required for some of the more interesting board
configurations.  Specifically, some use external LNAs to improve
RX, and without the MUX/output configured right, the 2GHz RX side
will be plain terrible.

It doesn't yet configure the "input" side yet; I'll add that if
it's required.

Tested:

* TP-Link TL-WDR3600, testing 2GHz STA/AP modes, checking some
  basic RX sensitivity things (ie, "can I see the AP on the other
  side of the apartment that intentionally has poor signal reception
  from where I am right now.")

Whilst here, fix a silly bug in the maxpin routine; I was missing
a break.

9 years agoadd QCA955x PCIe configuration registers.
adrian [Sat, 21 Mar 2015 06:00:46 +0000 (06:00 +0000)]
add QCA955x PCIe configuration registers.

These are /not/ absolute addresses, as the QCA955x SoC has 2 PCIe RC's
(and 1 PCIe EP.)

9 years agoNote that the AR724x PCIe registers are actually from the PCI_CTRL
adrian [Sat, 21 Mar 2015 05:59:45 +0000 (05:59 +0000)]
Note that the AR724x PCIe registers are actually from the PCI_CTRL
register range.

9 years agocoredump: protect corefilename access with a lock
mjg [Sat, 21 Mar 2015 04:39:33 +0000 (04:39 +0000)]
coredump: protect corefilename access with a lock

Previously format string traversal could happen while the string itself was
being modified.

Use allproc_lock as coredumping is a rare operation and as such we don't
have to create a dedicated lock.

Submitted by: Tiwei Bie <btw mail.ustc.edu.cn>
Reviewed by: kib
X-Additional: JuniorJobs project

9 years agoUpdate copyright(s)
dteske [Sat, 21 Mar 2015 03:54:11 +0000 (03:54 +0000)]
Update copyright(s)

MFC after: 3 days
X-MFC-to: stable/10

9 years agoWhitespace cleanup(s).
dteske [Sat, 21 Mar 2015 03:52:43 +0000 (03:52 +0000)]
Whitespace cleanup(s).

MFC after: 3 days
X-MFC-to: stable/10

9 years agoDisable timestamping on devfs read/write operations by default.
delphij [Sat, 21 Mar 2015 01:14:11 +0000 (01:14 +0000)]
Disable timestamping on devfs read/write operations by default.

Currently we update timestamps unconditionally when doing read or
write operations.  This may slow things down on hardware where
reading timestamps is expensive (e.g. HPET, because of the default
vfs.timestamp_precision setting is nanosecond now) with limited
benefit.

A new sysctl variable, vfs.devfs.dotimes is added, which can be
set to non-zero value when the old behavior is desirable.

Differential Revision: https://reviews.freebsd.org/D2104
Reported by: Mike Tancsa <mike sentex net>
Reviewed by: kib
Relnotes: yes
Sponsored by: iXsystems, Inc.
MFC after: 2 weeks

9 years agobsdgrep: fix regression in the -f option since r268799
pfg [Sat, 21 Mar 2015 00:21:30 +0000 (00:21 +0000)]
bsdgrep: fix regression in the -f option since r268799

Caused by an incomplete merge from NetBSD.

PR: 198725
MFC after: 3 days

9 years agoDisable insecure SSLv2 support from the base OpenSSL.
jkim [Fri, 20 Mar 2015 23:48:11 +0000 (23:48 +0000)]
Disable insecure SSLv2 support from the base OpenSSL.

Differential Revision: https://reviews.freebsd.org/D1304

9 years agoMake vlan_config() the signle point of validity checks.
glebius [Fri, 20 Mar 2015 21:09:03 +0000 (21:09 +0000)]
Make vlan_config() the signle point of validity checks.

Sponsored by: Nginx, Inc.

9 years agoIn vlan_clone_match_ethervid():
glebius [Fri, 20 Mar 2015 20:42:58 +0000 (20:42 +0000)]
In vlan_clone_match_ethervid():
- Use ifunit() instead of going through the interface list ourselves.
- Remove unused parameter.
- Move the most important comment above the function.

Sponsored by: Nginx, Inc.

9 years agoFix grammar in epair(4) man page
allanjude [Fri, 20 Mar 2015 20:08:36 +0000 (20:08 +0000)]
Fix grammar in epair(4) man page

PR: 196839
Differential Revision: https://reviews.freebsd.org/D2090
Submitted by: Jason Unovitch (original)
Approved by: wblock (mentor)
Sponsored by: ScaleEngine Inc.

9 years agoAdd a driver for the Dallas/Maxim DS1307, another common i2c RTC.
loos [Fri, 20 Mar 2015 19:51:24 +0000 (19:51 +0000)]
Add a driver for the Dallas/Maxim DS1307, another common i2c RTC.

Many thanks to ian who gently provided me the DS1307 breakout board.

Tested on: Raspberry pi
Differential Revision: https://reviews.freebsd.org/D2022
Reviewed by: rpaulo

9 years agoWhen creating VM images, copy the contents of the created filesystem into
cperciva [Fri, 20 Mar 2015 19:40:19 +0000 (19:40 +0000)]
When creating VM images, copy the contents of the created filesystem into
a new filesystem before packaging it into a disk image.  This prevents
"remnants" of deleted files from showing up in the VM images, and reduces
their compressed size (by about 10% for the cloudware images) as a result.

Looks good to: gjb

9 years agoAdd the missing manual page link to the recently added function.
loos [Fri, 20 Mar 2015 19:29:59 +0000 (19:29 +0000)]
Add the missing manual page link to the recently added function.

9 years agoMerge OpenSSL 1.0.1m.
jkim [Fri, 20 Mar 2015 19:16:18 +0000 (19:16 +0000)]
Merge OpenSSL 1.0.1m.

9 years agoAdd a helper function to read clock frequencies from videocore and use this
andrew [Fri, 20 Mar 2015 16:54:21 +0000 (16:54 +0000)]
Add a helper function to read clock frequencies from videocore and use this
to get the default frequency of the sdhci device.

While here use a u_int to hold the frequency as it may be too large to fit
in a 32-bit signed integer. This is the case when we have a 250MHz clock.

9 years agoAdd missing variable initialization.
mav [Fri, 20 Mar 2015 16:05:13 +0000 (16:05 +0000)]
Add missing variable initialization.

Reported by: Coverity
CID: 1288938
MFC after: 3 days

9 years agoImport OpenSSL 1.0.1m.
jkim [Fri, 20 Mar 2015 15:28:40 +0000 (15:28 +0000)]
Import OpenSSL 1.0.1m.

9 years agoAdd comment explaining existing powerd behavior on SMP systems.
mav [Fri, 20 Mar 2015 15:07:05 +0000 (15:07 +0000)]
Add comment explaining existing powerd behavior on SMP systems.

MFC after: 1 week

9 years agoSplit out the common bcm283x fixes from the bcm2835 specific files.
andrew [Fri, 20 Mar 2015 14:25:51 +0000 (14:25 +0000)]
Split out the common bcm283x fixes from the bcm2835 specific files.

9 years agoRemove now unneeded headers from the Broadcom DWC driver
andrew [Fri, 20 Mar 2015 14:23:40 +0000 (14:23 +0000)]
Remove now unneeded headers from the Broadcom DWC driver

9 years agoMove the code to set the device power to the bcm2835 mailbox driver so it
andrew [Fri, 20 Mar 2015 14:16:39 +0000 (14:16 +0000)]
Move the code to set the device power to the bcm2835 mailbox driver so it
can be reused by other drivers.

9 years agoTiny comment fix.
glebius [Fri, 20 Mar 2015 14:16:26 +0000 (14:16 +0000)]
Tiny comment fix.

9 years agoNow, when r272244 introduced counter(9) based counters for all interfaces,
glebius [Fri, 20 Mar 2015 14:05:17 +0000 (14:05 +0000)]
Now, when r272244 introduced counter(9) based counters for all interfaces,
revert the r271538, which did that for vlan(4) only.

No objections: melifaro
Sponsored by: Nginx, Inc.

9 years agoExpand the bitcount* API to support 64-bit integers, plain ints and longs
jhb [Fri, 20 Mar 2015 10:27:06 +0000 (10:27 +0000)]
Expand the bitcount* API to support 64-bit integers, plain ints and longs
and create a "hidden" API that can be used in other system headers without
adding namespace pollution.
- If the POPCNT instruction is enabled at compile time, use
  __builtin_popcount*() to implement __bitcount*(), otherwise fall back
  to software implementations.
- Use the existing bitcount16() and bitcount32() from <sys/systm.h> to
  implement the non-POPCNT __bitcount16() and __bitcount32() in
  <sys/types.h>.
- For the non-POPCNT __bitcount64(), use a similar SWAR method on 64-bit
  systems.  For 32-bit systems, use two __bitcount32() operations on the
  two halves.
- Use __bitcount32() to provide a __bitcount() that operates on plain ints.
- Use either __bitcount32() or __bitcount64() to provide a
  __bitcountl() that operates on longs.
- Add public bitcount*() wrappers for __bitcount*() for use in the kernel
  in <sys/libkern.h>.
- Use __builtinl() instead of __builtin_popcountl() in BIT_COUNT().

Discussed with: bde

9 years agoAllow to override default kernel virtual address assignment on ARM
zbb [Fri, 20 Mar 2015 10:15:34 +0000 (10:15 +0000)]
Allow to override default kernel virtual address assignment on ARM

Each plaform performs virtual memory split between kernel and user space
and assigns kernel certain amount of memory space. However, is is sometimes
reasonable to change the default values. Such situation may happen on
systems where the demand for kernel buffers is high, many devices occupying
memory etc. This of course comes with the cost of decreasing user space
memory range so shall be used with care. Most embedded systems will not
suffer from this limtation but rather take advantage of this potential
since default behavior is left unchanged.

Submitted by:  Wojciech Macek <wma@semihalf.com>
Reviewed by:   imp
Obtained from: Semihalf

9 years agoPermit multiple arguments for the nonnull attribute.
pfg [Fri, 20 Mar 2015 01:07:48 +0000 (01:07 +0000)]
Permit multiple arguments for the nonnull attribute.

This is very useful for non-trivial functions and doesn't
affect existing uses.

MFC after: 5 days

9 years agoDefine BINDIR for some test utilities.
hselasky [Thu, 19 Mar 2015 15:55:02 +0000 (15:55 +0000)]
Define BINDIR for some test utilities.

MFC after: 3 days
Sponsored by: Mellanox Technologies

9 years agoFix some style issues.
hselasky [Thu, 19 Mar 2015 15:36:36 +0000 (15:36 +0000)]
Fix some style issues.

MFC after: 1 week

9 years agoAdd more known bugs to the USB audio manual page.
hselasky [Thu, 19 Mar 2015 15:32:55 +0000 (15:32 +0000)]
Add more known bugs to the USB audio manual page.

MFC after: 1 week

9 years agoUse VT-d interrupt remapping block (IR) to perform FSB messages
kib [Thu, 19 Mar 2015 13:57:47 +0000 (13:57 +0000)]
Use VT-d interrupt remapping block (IR) to perform FSB messages
translation.  In particular, despite IO-APICs only take 8bit apic id,
IR translation structures accept 32bit APIC Id, which allows x2APIC
mode to function properly.  Extend msi_cpu of struct msi_intrsrc and
io_cpu of ioapic_intsrc to full int from one byte.

KPI of IR is isolated into the x86/iommu/iommu_intrmap.h, to avoid
bringing all dmar headers into interrupt code. The non-PCI(e) devices
which generate message interrupts on FSB require special handling. The
HPET FSB interrupts are remapped, while DMAR interrupts are not.

For each msi and ioapic interrupt source, the iommu cookie is added,
which is in fact index of the IRE (interrupt remap entry) in the IR
table. Cookie is made at the source allocation time, and then used at
the map time to fill both IRE and device registers. The MSI
address/data registers and IO-APIC redirection registers are
programmed with the special values which are recognized by IR and used
to restore the IRE index, to find proper delivery mode and target.
Map all MSI interrupts in the block when msi_map() is called.

Since an interrupt source setup and dismantle code are done in the
non-sleepable context, flushing interrupt entries cache in the IR
hardware, which is done async and ideally waits for the interrupt,
requires busy-wait for queue to drain.  The dmar_qi_wait_for_seq() is
modified to take a boolean argument requesting busy-wait for the
written sequence number instead of waiting for interrupt.

Some interrupts are configured before IR is initialized, e.g. ACPI
SCI.  Add intr_reprogram() function to reprogram all already
configured interrupts, and call it immediately before an IR unit is
enabled.  There is still a small window after the IO-APIC redirection
entry is reprogrammed with cookie but before the unit is enabled, but
to fix this properly, IR must be started much earlier.

Add workarounds for 5500 and X58 northbridges, some revisions of which
have severe flaws in handling IR.  Use the same identification methods
as employed by Linux.

Review: https://reviews.freebsd.org/D1892
Reviewed by: neel
Discussed with: jhb
Tested by: glebius, pho (previous versions)
Sponsored by: The FreeBSD Foundation
MFC after: 3 weeks

9 years agoStart to import support for the AArch64 architecture from ARM. This change
andrew [Thu, 19 Mar 2015 13:53:47 +0000 (13:53 +0000)]
Start to import support for the AArch64 architecture from ARM. This change
only adds support for kernel-toolchain, however it is expected further
changes to add kernel and userland support will be committed as they are
reviewed.

As our copy of binutils is too old the devel/aarch64-binutils port needs
to be installed to pull in a linker.

To build either TARGET needs to be set to arm64, or TARGET_ARCH set to
aarch64. The latter is set so uname -p will return aarch64 as existing
third party software expects this.

Differential Revision: https://reviews.freebsd.org/D2005
Relnotes: Yes
Sponsored by: The FreeBSD Foundation