freebsd.git
7 years agoInstall ioatcontrol to /usr/bin by default instead of /
ngie [Fri, 27 May 2016 18:40:38 +0000 (18:40 +0000)]
Install ioatcontrol to /usr/bin by default instead of /

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

7 years ago- Sort make variables
ngie [Fri, 27 May 2016 18:39:47 +0000 (18:39 +0000)]
- Sort make variables
- Use SRCTOP instead of ad hoc definition for it

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

7 years agoReplace linux-f10 packages with updated linux-c6.
gjb [Fri, 27 May 2016 18:20:07 +0000 (18:20 +0000)]
Replace linux-f10 packages with updated linux-c6.

PR:  208280
Submitted by:  Johannes Meixner
Sponsored by: The FreeBSD Foundation

7 years agoCorrect the implementation of dtrace_interrupt_disable/enable.
br [Fri, 27 May 2016 17:58:10 +0000 (17:58 +0000)]
Correct the implementation of dtrace_interrupt_disable/enable.

Pointed out by: andrew
Sponsored by: DARPA, AFRL
Sponsored by: HEIF5

7 years agoFix description for -V in the -r case
ngie [Fri, 27 May 2016 17:57:30 +0000 (17:57 +0000)]
Fix description for -V in the -r case

t.verify_test = true is always set when -V is specified, regardless of whether
or not the tool is being run in raw mode

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

7 years agoDocument the default behavior for -c (0)
ngie [Fri, 27 May 2016 17:44:30 +0000 (17:44 +0000)]
Document the default behavior for -c (0)

Bump .Dd for the change

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

7 years agoInitialize `t` with memset(.., 0, ..)
ngie [Fri, 27 May 2016 17:42:59 +0000 (17:42 +0000)]
Initialize `t` with memset(.., 0, ..)

This will help ensure that we're not using random garbage on the stack by
accident with respect to the variable

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

7 years agoWhen building modules, define make variable OPT_FDT if the kernel config
ian [Fri, 27 May 2016 17:40:29 +0000 (17:40 +0000)]
When building modules, define make variable OPT_FDT if the kernel config
includes the FDT option.  Use OPT_FDT to conditionally compile modules
that require FDT support.

In the past we've gotten away with using the arch name as a proxy for FDT
support in makefile conditional logic, but now mips has some platforms with
fdt support and some without and we need a more direct test.

7 years agoPlug route reference underleak that happens with FLOWTABLE after r297225.
glebius [Fri, 27 May 2016 17:31:02 +0000 (17:31 +0000)]
Plug route reference underleak that happens with FLOWTABLE after r297225.

Submitted by: Mike Karels <mike karels.net>

7 years agoDisconnect PIE from the build until it is free of floating point math.
truckman [Fri, 27 May 2016 17:07:07 +0000 (17:07 +0000)]
Disconnect PIE from the build until it is free of floating point math.

Reported by: lidl, adrian

7 years agofd: provide a common exit point for unlock in kern_dup
mjg [Fri, 27 May 2016 17:00:15 +0000 (17:00 +0000)]
fd: provide a common exit point for unlock in kern_dup

While here assert dropped filedesc lock on return from closefp.

7 years agoexec: get rid of one vnode lock/unlock pair in do_execve
mjg [Fri, 27 May 2016 15:03:38 +0000 (15:03 +0000)]
exec: get rid of one vnode lock/unlock pair in do_execve

The lock was temporarily dropped for vrele calls, but they can be
postponed to a point where the lock is not held in the first place.

While here shuffle other code not needing the lock.

7 years agoFix dtrace_interrupt_disable and dtrace_interrupt_enable by having the
andrew [Fri, 27 May 2016 12:02:12 +0000 (12:02 +0000)]
Fix dtrace_interrupt_disable and dtrace_interrupt_enable by having the
former return the current status for the latter to use. Without this we
could enable interrupts when they shouldn't be.

It's still not quite right as it should only update the bits we care about,
bit should be good enough until the correct fix can be tested.

PR: 204270
Obtained from: ABT Systems Ltd
Sponsored by: The FreeBSD Foundation

7 years agosfxge(4): fix typo in monitor types strings in common code
arybchik [Fri, 27 May 2016 11:50:26 +0000 (11:50 +0000)]
sfxge(4): fix typo in monitor types strings in common code

Submitted by:   Garrett D'Amore <garrett at damore.org>
Sponsored by:   Solarflare Communications, Inc.
MFC after:      1 week

7 years agosfxge(4): avoid necessity to add one more constant condition note
arybchik [Fri, 27 May 2016 11:49:46 +0000 (11:49 +0000)]
sfxge(4): avoid necessity to add one more constant condition note

Use for forever loop instead of while.

Found by lint on illumos.

Submitted by:   Garrett D'Amore <garrett at damore.org>
Sponsored by:   Solarflare Communications, Inc.
MFC after:      1 week

7 years agosfxge(4): cope with always true unsigned comparison with 0 to make lint happier
arybchik [Fri, 27 May 2016 11:49:05 +0000 (11:49 +0000)]
sfxge(4): cope with always true unsigned comparison with 0 to make lint happier

Found by lint on illumos.

Submitted by:   Garrett D'Amore <garrett at damore.org>
Sponsored by:   Solarflare Communications, Inc.
MFC after:      1 week

7 years agosfxge(4): unsigned 1 should be shifted to produce bitmask
arybchik [Fri, 27 May 2016 11:48:25 +0000 (11:48 +0000)]
sfxge(4): unsigned 1 should be shifted to produce bitmask

Found by lint on illumos.

Submitted by:   Garrett D'Amore <garrett at damore.org>
Sponsored by:   Solarflare Communications, Inc.
MFC after:      1 week

7 years agosfxge(4): cope with lint for EFX_SET_OWORD_BIT() with const bit arg
arybchik [Fri, 27 May 2016 11:47:56 +0000 (11:47 +0000)]
sfxge(4): cope with lint for EFX_SET_OWORD_BIT() with const bit arg

Found by lint on illumos.

Submitted by:   Garrett D'Amore <garrett at damore.org>
Sponsored by:   Solarflare Communications, Inc.
MFC after:      1 week

7 years agosfxge(4): remove set but not used variable
arybchik [Fri, 27 May 2016 11:47:11 +0000 (11:47 +0000)]
sfxge(4): remove set but not used variable

Found by lint on illumos.

Submitted by:   Garrett D'Amore <garrett at damore.org>
Sponsored by:   Solarflare Communications, Inc.
MFC after:      1 week

7 years agoImprove error message when failing to open a backing file
bapt [Fri, 27 May 2016 11:46:54 +0000 (11:46 +0000)]
Improve error message when failing to open a backing file

When bhyve cannot open a backing file, it now says explicitly which file
could not be opened

Note that the change has only be maed in block_if.c and not in
pci_virtio_block.c as the error will always be catched by the first

PR: 202321 (different patch)
Reviewed by: grehan
MFC after: 3 day
Sponsored by: Gandi.net
Differential Revision: https://reviews.freebsd.org/D6576

7 years agosfxge(4): remove unreachable break after goto
arybchik [Fri, 27 May 2016 11:46:35 +0000 (11:46 +0000)]
sfxge(4): remove unreachable break after goto

Found by lint on illumos.

Submitted by:   Garrett D'Amore <garrett at damore.org>
Sponsored by:   Solarflare Communications, Inc.
MFC after:      1 week

7 years agosfxge(4): add constant condition note to make lint happier
arybchik [Fri, 27 May 2016 11:45:42 +0000 (11:45 +0000)]
sfxge(4): add constant condition note to make lint happier

Found by lint on illumos.

Submitted by:   Garrett D'Amore <garrett at damore.org>
Sponsored by:   Solarflare Communications, Inc.
MFC after:      1 week

7 years agosfxge(4): note unused variables to make lint happier
arybchik [Fri, 27 May 2016 11:44:40 +0000 (11:44 +0000)]
sfxge(4): note unused variables to make lint happier

Found by lint on illumos.

Submitted by:   Garrett D'Amore <garrett at damore.org>
Sponsored by:   Solarflare Communications, Inc.
MFC after:      1 week

7 years agoAttach iser(4) to the build.
trasz [Fri, 27 May 2016 11:39:08 +0000 (11:39 +0000)]
Attach iser(4) to the build.

MFC after: 1 month
Sponsored by: The FreeBSD Foundation

7 years agoBuild iscsi(4) with ICL_KERNEL_PROXY when building with WITH_OFED.
trasz [Fri, 27 May 2016 11:37:56 +0000 (11:37 +0000)]
Build iscsi(4) with ICL_KERNEL_PROXY when building with WITH_OFED.

MFC after: 1 month
Sponsored by: The FreeBSD Foundation

7 years agoFix build on i386.
trasz [Fri, 27 May 2016 11:37:02 +0000 (11:37 +0000)]
Fix build on i386.

MFC after: 1 month
Sponsored by: The FreeBSD Foundation

7 years agoQuell false positives in svc_vc_create and svc_vc_create_conn with cd and xprt
ngie [Fri, 27 May 2016 08:48:33 +0000 (08:48 +0000)]
Quell false positives in svc_vc_create and svc_vc_create_conn with cd and xprt

Both cd and xprt will be non-NULL after their respective malloc(9) wrappers are
called (mem_alloc and svc_xprt_alloc, which calls mem_alloc) as mem_alloc
always gets called with M_WAITOK|M_ZERO today. Thus, testing for them being
non-NULL is incorrect -- it misleads Coverity and it misleads the reader.

Remove some unnecessary NULL initializations as a follow up to help solidify
the fact that these pointers will be initialized properly in sys/rpc/.. with
the interfaces the way they are currently.

Differential Revision: https://reviews.freebsd.org/D6572
MFC after: 2 weeks
Reported by: Coverity
CID: 1007338, 1007339, 1007340
Reviewed by: markj, truckman
Sponsored by: EMC / Isilon Storage Division

7 years agoThe SCHEDULER_STOPPED() macro already contains a predict false statement.
hselasky [Fri, 27 May 2016 07:33:49 +0000 (07:33 +0000)]
The SCHEDULER_STOPPED() macro already contains a predict false statement.
Remove superfluous unlikely() wrapper.

Suggested by: glebius
MFC after: 1 week
Sponsored by: Mellanox Technologies

7 years agohyperv: Test features before enabling optional functionalities
sephe [Fri, 27 May 2016 07:29:31 +0000 (07:29 +0000)]
hyperv: Test features before enabling optional functionalities

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

7 years ago[iwm] remove dead code.
adrian [Fri, 27 May 2016 07:10:11 +0000 (07:10 +0000)]
[iwm] remove dead code.

if_iwm - GC some dead code, left by a partially applied OpenBSD change.

Taken-From: OpenBSD (if_iwm.c r1.69)

Submitted by: Imre Vadasz <imre@vdsz.com>
Obtained from: DragonflyBSD git 07dfed32ea39b980b0b80d27ff938e7c3ca4c0b5

7 years agohyperv: Clean up Hyper-V timecounter a bit.
sephe [Fri, 27 May 2016 07:05:30 +0000 (07:05 +0000)]
hyperv: Clean up Hyper-V timecounter a bit.

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

7 years agohyperv: GC unneeded bits
sephe [Fri, 27 May 2016 06:55:05 +0000 (06:55 +0000)]
hyperv: GC unneeded bits

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

7 years agohyperv/vmbus: Move MSR EOM to hyperv_reg.h
sephe [Fri, 27 May 2016 06:47:04 +0000 (06:47 +0000)]
hyperv/vmbus: Move MSR EOM to hyperv_reg.h

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

7 years agohyperv: Move timer related MSRs into hyperv_reg.h
sephe [Fri, 27 May 2016 06:12:43 +0000 (06:12 +0000)]
hyperv: Move timer related MSRs into hyperv_reg.h

And avoid bit fields for event timer.

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

7 years agoUse vm_page_replace_checked() instead of vm_page_rename() for implementing
alc [Fri, 27 May 2016 06:05:12 +0000 (06:05 +0000)]
Use vm_page_replace_checked() instead of vm_page_rename() for implementing
optimized copy-on-write faults.  This has two advantages: (1) one less radix
tree operation is performed and (2) vm_page_replace_checked() cannot fail,
making the code simpler.

Submitted by: Ryan Libby
Reviewed by: kib
Sponsored by: EMC / Isilon Storage Division
Differential Revision: https://reviews.freebsd.org/D4478

7 years agohyperv: Move CPUID related bits to hyperv_reg.h and give them clean name
sephe [Fri, 27 May 2016 05:58:53 +0000 (05:58 +0000)]
hyperv: Move CPUID related bits to hyperv_reg.h and give them clean name

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

7 years agolibmd: Work around C++'s inability to understand C
cem [Fri, 27 May 2016 05:31:14 +0000 (05:31 +0000)]
libmd: Work around C++'s inability to understand C

Reported by: antoine@ (x265)

7 years agoFix parallel builds by specifying *all* required headers in SRCS.
ian [Fri, 27 May 2016 04:34:42 +0000 (04:34 +0000)]
Fix parallel builds by specifying *all* required headers in SRCS.

Submitted by: manu
Pointy hat: ian

7 years agogcc42: Fix minor C99 parse bug
cem [Fri, 27 May 2016 03:40:52 +0000 (03:40 +0000)]
gcc42: Fix minor C99 parse bug

DR #289[0] came down and gcc4.2.1 was on the wrong side of history.
Partially revert GCC r42574 (just remove the error) to rectify the parse
bug to match Clang and other compliant C99 compilers.

An example declaration gcc tripped on before this fix:

  void foobar(int [static 1]);

An example declaration gcc did not trip on before this fix:

  void foobar(int name[static 1]);

Bump __FreeBSD_cc_version.

[0]: http://www.open-std.org/JTC1/SC22/WG14/www/docs/dr_289.htm

Reported by: allanjude
Sponsored by: EMC / Isilon Storage Division

7 years agoAdd rtwn(4) and rtwnfw(4).
kevlo [Fri, 27 May 2016 03:30:42 +0000 (03:30 +0000)]
Add rtwn(4) and rtwnfw(4).

7 years ago[gpio] add gpiospi to the gpio module.
adrian [Fri, 27 May 2016 01:42:55 +0000 (01:42 +0000)]
[gpio] add gpiospi to the gpio module.

7 years ago[spigen] add the userland ioctl API for spigen.
adrian [Fri, 27 May 2016 01:40:33 +0000 (01:40 +0000)]
[spigen] add the userland ioctl API for spigen.

7 years ago[gpiospi] add debug option.
adrian [Fri, 27 May 2016 01:36:29 +0000 (01:36 +0000)]
[gpiospi] add debug option.

This was missing from the previous commit that introduced gpiospi.
It's required for it to build.

Pointy-hat-to: me

7 years agoOnly build gpio modules on armv6, until it's known that they can be built
ian [Fri, 27 May 2016 01:14:35 +0000 (01:14 +0000)]
Only build gpio modules on armv6, until it's known that they can be built
succesfully on other arches.

7 years agoMake Makefile.mirrors -ALPHA${N}-aware.
gjb [Fri, 27 May 2016 01:07:48 +0000 (01:07 +0000)]
Make Makefile.mirrors -ALPHA${N}-aware.

Approved by: re (implicit)
Sponsored by: The FreeBSD Foundation

7 years agoUpdate head from 11.0-CURRENT to 11.0-ALPHA1, marking the official
gjb [Fri, 27 May 2016 00:01:48 +0000 (00:01 +0000)]
Update head from 11.0-CURRENT to 11.0-ALPHA1, marking the official
start of the code slush.

Approved by: re (implicit)
Sponsored by: The FreeBSD Foundation

7 years agoRevert changes for local testing, inadvertantly commited in r300811.
ian [Thu, 26 May 2016 23:59:42 +0000 (23:59 +0000)]
Revert changes for local testing, inadvertantly commited in r300811.

7 years agoAdd a PPS driver that takes the timing pulse from a gpio pin. Currently
ian [Thu, 26 May 2016 23:56:12 +0000 (23:56 +0000)]
Add a PPS driver that takes the timing pulse from a gpio pin.  Currently
supports only ofw/fdt systems.  Some day, hinted attachment for non-fdt
systems should be possible too.

7 years agoFix unit number of EFI net interfaces and ignore psuedo network interfaces.
jhb [Thu, 26 May 2016 23:32:28 +0000 (23:32 +0000)]
Fix unit number of EFI net interfaces and ignore psuedo network interfaces.

In r277943, the efinet_match() routine was changed to use an off by one
when matching network interfaces.  The effect was that using "net1"
actually used the device attached to "net0".

Digging into the hardware that needed this workaround more, I found that
UEFI was creating two simple network protocol devices for each physical
NIC.  The first device was a "raw" Ethernet device and the second device
was a "IP" device that used the IP protocol on top of the underlying
"raw" device.  The PXE code in the firmware used the "IP" device to pull
across the loader.efi, so currdev was set to "net1" when booting from the
physical interface "net0".  (The loaded image's device handle referenced
the "IP" device that "net1" claimed.)

However, the IP device isn't suitable for doing raw packet I/O (and the
current code to open devices exclusively actually turns the "IP" devices
off on these systems).

To fix, change the efinet driver to only attach to "raw" devices.  This
is determined by fetching the DEVICE_PATH for each handle which supports
the simple network protocol and examining the last node in the path.  If
the last node in the path is a MAC address, the device is assumed to be
a "raw" device and is added as a 'netX' device.  If the last node is not
a MAC address, the device is ignored.

However, this causes a new problem as the device handle associated with
the loaded image no longer matches any of the handles enumerated by
efinet for systems that load the image via the "IP" device.  To handle
this case, expand the logic that resolves currdev from the loaded image
in main().  First, the existing logic of looking for a handle that
matches the loaded image's handle is tried.  If that fails, the device
path of the handle that loaded the loaded image is fetched via
efi_lookup_image_devpath().  This device path is then walked from the
end up to the beginning using efi_handle_lookup() to fetch the handle
associated with a path.  If the handle is found and is a known handle,
then that is used as currdev.  The effect for machines that load the
image via the "IP" device is that the first lookup fails (the handle
for the "IP" device isn't claimed by efinet), but walking up the
image's device path finds the handle of the raw MAC device which is used
as currdev.

With these fixes in place, the hack to subtract 1 from the unit can now
be removed, so that setting currdev to 'net0' actually uses 'net0'.

PR: 202097
Tested by: ambrisko
Sponsored by: Cisco Systems

7 years agofilemon exec: Use imgp->execpath rather than vn_fullpath(9).
bdrewery [Thu, 26 May 2016 23:27:08 +0000 (23:27 +0000)]
filemon exec: Use imgp->execpath rather than vn_fullpath(9).

This will be more accurate as the actual name is provided if ran
from an absolute path in do_execve().

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

7 years agoDIRDEPS_BUILD: Add a Makefile.depend
bdrewery [Thu, 26 May 2016 23:20:44 +0000 (23:20 +0000)]
DIRDEPS_BUILD: Add a Makefile.depend

Sponsored by: EMC / Isilon Storage Division

7 years agoDIRDEPS_BUILD: Fix and hookup rescue/rescue to the build.
bdrewery [Thu, 26 May 2016 23:20:40 +0000 (23:20 +0000)]
DIRDEPS_BUILD: Fix and hookup rescue/rescue to the build.

Sponsored by: EMC / Isilon Storage Division

7 years agoWITH_AUTO_OBJ: Fix crunchgen builds.
bdrewery [Thu, 26 May 2016 23:20:36 +0000 (23:20 +0000)]
WITH_AUTO_OBJ: Fix crunchgen builds.

Passing MAKEOBJDIRPREFIX to the main prog build (rescue) would confuse
WITH_AUTO_OBJ and cause it to create a recursed object directory that
then broke the actual prog build.  This is normally not a problem since
we do not call 'make -f prog.mk obj' before building anything in it.

Crunchgen(1) also assumes that if -o is not passed then if an object
directory does not already exist then it should build in the source
directories.  The normal buildworld process will have already ran 'make
obj' in each of the component directories so this is not a problem.
With WITH_AUTO_OBJ though this is not the case.  So we must tell
crunchgen(1) that MK_AUTO_OBJ=yes will create the directory and to not
require it be present before generating its Makefile.

Sponsored by: EMC / Isilon Storage Division

7 years agoDon't strip paths away from META_XTRAS.
bdrewery [Thu, 26 May 2016 23:20:33 +0000 (23:20 +0000)]
Don't strip paths away from META_XTRAS.

This would otherwise disallow using meta files from a foreign build that
spread them around in directories outside our own .OBJDIR.

Sponsored by: EMC / Isilon Storage Division

7 years agoAvoid redundant 'make objs' tree-walk when building the main prog.
bdrewery [Thu, 26 May 2016 23:20:30 +0000 (23:20 +0000)]
Avoid redundant 'make objs' tree-walk when building the main prog.

The main prog has a dependency on the submake targets to ensure they are
built.  From bsd.crunchgen.mk though we already have our own dependency
on 'make objs' so there is no need for another one.  Crunchgen(1) is
doing the right thing here so it is not modified.

This also prevents the CC fix tainting the submake environment with
META_MODE and causing rebuilds.  The CC passed is is only intended for
the main prog itself.

Sponsored by: EMC / Isilon Storage Division

7 years agoPass CC/CXX/CFLAGS/CXXFLAGS/LDFLAGS to the main crunch exec build.
bdrewery [Thu, 26 May 2016 23:20:27 +0000 (23:20 +0000)]
Pass CC/CXX/CFLAGS/CXXFLAGS/LDFLAGS to the main crunch exec build.

This fixes --sysroot and other CFLAGS/LDFLAGS not being respected
in the crunchgen build since it is not including bsd.sys.mk and
other files.  For example, this fixes building rescue itself without
--sysroot and other CFLAGS.

Sponsored by: EMC / Isilon Storage Division

7 years agoWITH_META_MODE: Only expect a .meta file for the main target.
bdrewery [Thu, 26 May 2016 23:20:24 +0000 (23:20 +0000)]
WITH_META_MODE: Only expect a .meta file for the main target.

Since multiple files are generated from one build command, only
the first to run will actually generate a .meta file.  This fix
prevents 'required but missing' rebuilds on each target.

Sponsored by: EMC / Isilon Storage Division

7 years agoDIRDEPS_BUILD: Don't show finished stats, which confuses crunchgen(1).
bdrewery [Thu, 26 May 2016 23:20:20 +0000 (23:20 +0000)]
DIRDEPS_BUILD: Don't show finished stats, which confuses crunchgen(1).

It would show 'make error:' lines for each auto object directory created.

Sponsored by: EMC / Isilon Storage Division

7 years agoUse netinet/in.h to avoid include/arpa dependency for DIRDEPS_BUILD.
bdrewery [Thu, 26 May 2016 23:20:17 +0000 (23:20 +0000)]
Use netinet/in.h to avoid include/arpa dependency for DIRDEPS_BUILD.

Sponsored by: EMC / Isilon Storage Division

7 years agoAdd some missing .PHONY.
bdrewery [Thu, 26 May 2016 23:20:14 +0000 (23:20 +0000)]
Add some missing .PHONY.

These are relevant for WITH_META_MODE to ensure they are
always reran and don't generate a .meta file.

Sponsored by: EMC / Isilon Storage Division

7 years agoDIRDEPS_BUILD: Build the kernel in the same place as buildkernel would.
bdrewery [Thu, 26 May 2016 23:20:10 +0000 (23:20 +0000)]
DIRDEPS_BUILD: Build the kernel in the same place as buildkernel would.

Sponsored by: EMC / Isilon Storage Division

7 years agoDIRDEPS_BUILD: Update dependencies.
bdrewery [Thu, 26 May 2016 23:20:07 +0000 (23:20 +0000)]
DIRDEPS_BUILD: Update dependencies.

Sponsored by: EMC / Isilon Storage Division

7 years agoFix MAKESYSPATH not being sent to sub-makes after r266566.
bdrewery [Thu, 26 May 2016 23:20:04 +0000 (23:20 +0000)]
Fix MAKESYSPATH not being sent to sub-makes after r266566.

Because bmake defaults to .../share/mk now, this code was not doing anything
to help objdir builds (such as the rescue build).  Export the same default.

Sponsored by: EMC / Isilon Storage Division

7 years agoWITH_META_MODE: Move the kernel support to kern.pre.mk.
bdrewery [Thu, 26 May 2016 23:20:01 +0000 (23:20 +0000)]
WITH_META_MODE: Move the kernel support to kern.pre.mk.

This allows using META_MODE directly from the kernel build directory.
This also allows removing a hack from the DIRDEPS_BUILD kernel target.

Sponsored by: EMC / Isilon Storage Division

7 years agoRemove leftover _crunchide from r283108
bdrewery [Thu, 26 May 2016 23:19:57 +0000 (23:19 +0000)]
Remove leftover _crunchide from r283108

7 years agoexec: Provide execpath in imgp for the process_exec hook.
bdrewery [Thu, 26 May 2016 23:19:39 +0000 (23:19 +0000)]
exec: Provide execpath in imgp for the process_exec hook.

This was previously set after the hook and only if auxargs were present.
Now always provide it if possible.

MFC after: 2 weeks
Reviewed by: kib
Sponsored by: EMC / Isilon Storage Division
Differential Revision: https://reviews.freebsd.org/D6546

7 years agoexec: Add credential change information into imgp for process_exec hook.
bdrewery [Thu, 26 May 2016 23:18:54 +0000 (23:18 +0000)]
exec: Add credential change information into imgp for process_exec hook.

This allows an EVENTHANDLER(process_exec) hook to see if the new image
will cause credentials to change whether due to setgid/setuid or because
of POSIX saved-id semantics.

This adds 3 new fields into image_params:
  struct ucred *newcred Non-null if the credentials will change.
  bool credential_setid True if the new image is setuid or setgid.

This will pre-determine the new credentials before invoking the image
activators, where the process_exec hook is called.  The new credentials
will be installed into the process in the same place as before, after
image activators are done handling the image.

MFC after: 2 weeks
Reviewed by: kib
Sponsored by: EMC / Isilon Storage Division
Differential Revision: https://reviews.freebsd.org/D6544

7 years agoUse a unique error message if we fail to find the simple network protocol.
jhb [Thu, 26 May 2016 23:08:57 +0000 (23:08 +0000)]
Use a unique error message if we fail to find the simple network protocol.

While here, fix the various net driver callbacks to return early instead
of crashing if this fails.  (The 'init' callback from the netif interface
doesn't return an error if the protocol lookup fails.)

Sponsored by: Cisco Systems

7 years agoApply the printf %S band-aid for efinet.c to fix the arm64 build.
jhb [Thu, 26 May 2016 23:07:20 +0000 (23:07 +0000)]
Apply the printf %S band-aid for efinet.c to fix the arm64 build.

7 years agoRemove second copy of the -Wno-format band-aid for printf %S.
jhb [Thu, 26 May 2016 23:06:36 +0000 (23:06 +0000)]
Remove second copy of the -Wno-format band-aid for printf %S.

7 years agortwn, urtwn: drop unused structures.
avos [Thu, 26 May 2016 22:43:02 +0000 (22:43 +0000)]
rtwn, urtwn: drop unused structures.

urtwn(4) uses another implementation of command queue; rtwn(4) don't need
it at all.

7 years agoAdd a convenience function to get a gpio pin's capabilties.
ian [Thu, 26 May 2016 22:35:52 +0000 (22:35 +0000)]
Add a convenience function to get a gpio pin's capabilties.

7 years agoAdd support for triggering interrupts on both rising and falling edges.
ian [Thu, 26 May 2016 22:34:25 +0000 (22:34 +0000)]
Add support for triggering interrupts on both rising and falling edges.
Also, EOI a gpio interrupt in the post_ithread routine before re-enabling.

7 years agoUse routines from the recently added devpath.c.
jhb [Thu, 26 May 2016 22:13:40 +0000 (22:13 +0000)]
Use routines from the recently added devpath.c.

These efipart layer did several devpath related operations inline.  This
just switches it over to using shared code for working with device paths.

Sponsored by: Cisco Systems

7 years agoInclude the new AQM files when compiling a kernel with options DUMMYNET.
truckman [Thu, 26 May 2016 22:07:09 +0000 (22:07 +0000)]
Include the new AQM files when compiling a kernel with options DUMMYNET.

Reported by: Nikolay Denev <nike_d AT cytexbg DOT com>
MFC after: 2 weeks (with r300779)

7 years agoCorrect a typo in a comment.
truckman [Thu, 26 May 2016 22:03:28 +0000 (22:03 +0000)]
Correct a typo in a comment.

MFC after: 2 weeks (with r300779)

7 years agoOutput the device path description for EFI network devices.
jhb [Thu, 26 May 2016 21:48:39 +0000 (21:48 +0000)]
Output the device path description for EFI network devices.

Lookup the DEVICE_PATH for each EFI network device handle and output the
string description using printf with '%S'.  To honor the pager, the newline
at the end of each line is still output with pager_output().

Sponsored by: Cisco Systems

7 years agoModify BOUND_VAR() macro to wrap all of its arguments in () and tweak
truckman [Thu, 26 May 2016 21:44:52 +0000 (21:44 +0000)]
Modify BOUND_VAR() macro to wrap all of its arguments in () and tweak
its expression to work on powerpc and sparc64 (gcc compatibility).

Correct a typo in a nearby comment.

MFC after: 2 weeks (with r300779)

7 years agoAdd some routines for working with EFI DEVICE_PATH objects.
jhb [Thu, 26 May 2016 21:43:22 +0000 (21:43 +0000)]
Add some routines for working with EFI DEVICE_PATH objects.

- efi_lookup_devpath() uses the DEVICE_PATH_PROTOCOL to obtain the
  DEVICE_PATH for a given EFI handle.
- efi_lookup_image_devpath() uses the LOADED_IMAGE_DEVICE_PATH_PROTOCOL
  to lookup the device path of the device used to load a loaded image.
- efi_devpath_name() uses the DEVICE_PATH_TO_TEXT_PROTOCOL to generate
  a string description of a device path.  The returned string is a CHAR16
  string that can be printed via the recently added '%S' format in
  libstand's printf().  Note that the returned string is returned in
  allocated storage that should be freed by calling
  efi_free_devpath_name().
- efi_devpath_last_node() walks a DEVICE_PATH returning a pointer to the
  final node in the path (not counting the terminating node).  That is,
  it returns a pointer to the last meaninful node in a DEVICE_PATH.
- efi_devpath_trim() generates a new DEVICE_PATH from an existing
  DEVICE_PATH.  The new DEVICE_PATH does not include the last
  non-terminating node in the original path.  If the original DEVICE_PATH
  only contains the terminating node, this function returns NULL.
  The caller is responsible for freeing the returned DEVICE_PATH via
  free().
- efi_devpath_handle() attempts to find a handle that corresponds to a
  given device path.  However, if nodes at the end of the device path do
  not have valid handles associated with them, this function will return
  a handle that matches a node earlier in the device path.  In particular,
  this function returns a handle for the node closest to the end of the
  device path which has a valid handle.

Sponsored by: Cisco Systems

7 years agoImport Dummynet AQM version 0.2.1 (CoDel, FQ-CoDel, PIE and FQ-PIE).
truckman [Thu, 26 May 2016 21:40:13 +0000 (21:40 +0000)]
Import Dummynet AQM version 0.2.1 (CoDel, FQ-CoDel, PIE and FQ-PIE).

Centre for Advanced Internet Architectures

Implementing AQM in FreeBSD

* Overview <http://caia.swin.edu.au/freebsd/aqm/index.html>

* Articles, Papers and Presentations
  <http://caia.swin.edu.au/freebsd/aqm/papers.html>

* Patches and Tools <http://caia.swin.edu.au/freebsd/aqm/downloads.html>

Overview

Recent years have seen a resurgence of interest in better managing
the depth of bottleneck queues in routers, switches and other places
that get congested. Solutions include transport protocol enhancements
at the end-hosts (such as delay-based or hybrid congestion control
schemes) and active queue management (AQM) schemes applied within
bottleneck queues.

The notion of AQM has been around since at least the late 1990s
(e.g. RFC 2309). In recent years the proliferation of oversized
buffers in all sorts of network devices (aka bufferbloat) has
stimulated keen community interest in four new AQM schemes -- CoDel,
FQ-CoDel, PIE and FQ-PIE.

The IETF AQM working group is looking to document these schemes,
and independent implementations are a corner-stone of the IETF's
process for confirming the clarity of publicly available protocol
descriptions. While significant development work on all three schemes
has occured in the Linux kernel, there is very little in FreeBSD.

Project Goals

This project began in late 2015, and aims to design and implement
functionally-correct versions of CoDel, FQ-CoDel, PIE and FQ_PIE
in FreeBSD (with code BSD-licensed as much as practical). We have
chosen to do this as extensions to FreeBSD's ipfw/dummynet firewall
and traffic shaper. Implementation of these AQM schemes in FreeBSD
will:
* Demonstrate whether the publicly available documentation is
  sufficient to enable independent, functionally equivalent implementations

* Provide a broader suite of AQM options for sections the networking
  community that rely on FreeBSD platforms

Program Members:

* Rasool Al Saadi (developer)

* Grenville Armitage (project lead)

Acknowledgements:

This project has been made possible in part by a gift from the
Comcast Innovation Fund.

Submitted by: Rasool Al-Saadi <ralsaadi@swin.edu.au>
X-No objection: core
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D6388

7 years agoAdd support for interrupts, sensors and GPIO for AXP209 PMIC.
manu [Thu, 26 May 2016 21:09:07 +0000 (21:09 +0000)]
Add support for interrupts, sensors and GPIO for AXP209 PMIC.
Pressing the PEK (power enable key) will shutdown the board.
Some events are reported to devd via system "PMU" and subsystem
"Battery", "AC" and "USB" such as connected/disconnected.
Some sensors values (power source voltage/current) are reported via
sysctl (dev.axp209_pmu.X.)
It also expose a gpioc node usable in kernel and userland. Only 3 of
the 4 GPIO are exposed (The GPIO3 is different and mostly unused on
boards). Most popular boards uses GPIO1 as a sense pin for OTG power.
Add a dtsi file that adds gpio-controller capability to the device as
upstream doesn't defined it and include it in our custom DTS.

Reviewed by: jmcneill
Approved by: cognet (mentor)
Differential Revision: https://reviews.freebsd.org/D6135

7 years agoRemove vestigial cloudware-install bits missed in r300767.
gjb [Thu, 26 May 2016 21:08:44 +0000 (21:08 +0000)]
Remove vestigial cloudware-install bits missed in r300767.

Sponsored by: The FreeBSD Foundation

7 years agoLet l64a() properly null terminate its result.
ed [Thu, 26 May 2016 20:55:15 +0000 (20:55 +0000)]
Let l64a() properly null terminate its result.

Though the buffer used by l64a() is initialized with null bytes,
repetetive calls may end up having trailing garbage of previous
invocations because we don't end up terminating the string.

Instead of importing NetBSD's fix, use this opportunity to simplify this
function dramatically, for example by just storing the Base64 character
set in a string. There is also no need to do the bitmasking, as we can
just use the proper integer type from <stdint.h>.

MFC after: 1 month
Differential Revision: https://reviews.freebsd.org/D6511

7 years agoIfndef KERNEL the userspace-only routines in sys/md[45].h
cem [Thu, 26 May 2016 20:37:49 +0000 (20:37 +0000)]
Ifndef KERNEL the userspace-only routines in sys/md[45].h

A follow-up to r300773.  Nothing in the kernel uses those definitions, but
apparently libmd includes the sys/md45 headers.  Fix the build.

Reported by: gjb
Pointy-hat: cem
Sponsored by: EMC / Isilon Storage Division

7 years agocrypto routines: Hint minimum buffer sizes to the compiler
cem [Thu, 26 May 2016 19:29:29 +0000 (19:29 +0000)]
crypto routines: Hint minimum buffer sizes to the compiler

Use the C99 'static' keyword to hint to the compiler IVs and output digest
sizes.  The keyword informs the compiler of the minimum valid size for a given
array.  Obviously not every pointer can be validated (i.e., the compiler can
produce false negative but not false positive reports).

No functional change.  No ABI change.

Sponsored by: EMC / Isilon Storage Division

7 years agoFix style(9).
jkim [Thu, 26 May 2016 19:17:51 +0000 (19:17 +0000)]
Fix style(9).

7 years agoUse bit_count(3) instead of four bitcount32() calls.
jkim [Thu, 26 May 2016 18:57:26 +0000 (18:57 +0000)]
Use bit_count(3) instead of four bitcount32() calls.

Reviewed by: asomers, ngie
Differential Revision: https://reviews.freebsd.org/D6543

7 years agoUpdate libc++ to 3.8.0. Excerpted list of fixes (with upstream revision
dim [Thu, 26 May 2016 18:52:49 +0000 (18:52 +0000)]
Update libc++ to 3.8.0.  Excerpted list of fixes (with upstream revision
numbers):

r242679 Implement the plugin-based version of std::search. There are no
        searchers yet; those are coming soon.
r242682 Implement the default searcher for std::experimental::search.
r243728 Add <experimental/any> v2.
r245330 implement more of N4258 - Cleaning up noexcept in the standard
        library. Specifically add new noexcept stuff to vector and
string's move-assignment operations
r245334 Fix PR22606 - Leak pthread_key with static storage duration to
        ensure all of thread-local destructors are called.
r245335 Fix PR23589: std::function doesn't recognize null pointer to
        varargs function.
r247036 Implementation of Boyer-Moore and Boyer-Moore-Horspool
        searchers for the LFTS.
r249325 Implement LWG#2063, and update the issues links to point to the
        github generated pages
r249738 Split <ctype.h> out of <cctype>.
r249739 Split <errno.h> out of <cerrno>.
r249740 Split <float.h> out of <cfloat>.
r249741 Split <inttypes.h> out of <cinttypes>.
r249742 Split <math.h> out of <cmath>.
r249743 Split <setjmp.h> out of <csetjmp>.
r249761 Split <stddef.h> out of <cstddef>.
r249798 Split <stdio.h> out of <cstdio>.
r249800 Split <stdlib.h> out of <cstdlib>.
r249889 Split <wchar.h> out of <cwchar>.
r249890 Split <wctype.h> out of <cwctype>.
r249929 Split <string.h> out of <cstring>.
r250254 ABI versioning macros for libc++.
r251246 Fix LWG#2244: basic_istream::seekg
r251247 Fix LWG#2127: Move-construction with raw_storage_iterator.
r251253 Fix LWG#2476: scoped_allocator_adaptor is not assignable
r251257 Fix LWG#2489: mem_fn() should be noexcept
r251618 Implement P0004R1 'Remove Deprecated iostreams aliases'
r251766 Implement the first part of P0006R0: Adopt Type Traits Variable
        Templates for C++17.
r252195 Implement P0092R1 for C++1z
r252350 Allow deque to handle incomplete types.
r252406 More of P0006R0: type traits variable aliases for C++17.
r252407 Implement LWG#2353: std::next is over-constrained
r252905 Implement P0074: Making owner_less more flexible
r253215 Implement P0013R1: Logical Operator Type Traits.
r253274 Implement P0007: Constant View: A proposal for a std::as_const
        helper function template.
r254119 Add static_assert to set/multiset/map/multimap/forward_list/deque
        that the allocator's value_type match the container's value_type.
r254283 Implement more of P0006; Type Traits Variable Templates.
r255941 LWG2485: get() should be overloaded for const tuple&&.
r256325 Fix LWG Issue #2367 - Fixing std::tuple and std::pair's default
        constructors.
r256652 Fix for ALL undefined behavior in <list>.
r256859 First half of LWG#2354: 'Unnecessary copying when inserting
        into maps with braced-init syntax'

Exp-run: antoine
Relnotes: yes

7 years agoOnly do the touch screen setup when the 'ti,wires' property is present.
loos [Thu, 26 May 2016 18:52:26 +0000 (18:52 +0000)]
Only do the touch screen setup when the 'ti,wires' property is present.

While here fix a typo in a debug message.

7 years agoUpdate a commented line to replace recently-removed images with
gjb [Thu, 26 May 2016 18:50:57 +0000 (18:50 +0000)]
Update a commented line to replace recently-removed images with
images that are published.

Sponsored by: The FreeBSD Foundation

7 years agoRemove the cw*-install target.
gjb [Thu, 26 May 2016 18:48:37 +0000 (18:48 +0000)]
Remove the cw*-install target.

All operations are performed on the original output file,
and nothing is ever done with the copied file (as in, no
modifications and/or publication from the copied file).

Sponsored by: The FreeBSD Foundation

7 years agoDon't reuse the source mbuf in tcp_respond() if it is not writable.
jhb [Thu, 26 May 2016 18:35:37 +0000 (18:35 +0000)]
Don't reuse the source mbuf in tcp_respond() if it is not writable.

Not all mbufs passed up from device drivers are M_WRITABLE().  In
particular, the Chelsio T4/T5 driver uses a feature called "buffer packing"
to receive multiple frames in a single receive buffer.  The mbufs for
these frames all share the same external storage so are treated as
read-only by the rest of the stack when multiple frames are in flight.
Previously tcp_respond() would blindly overwrite read-only mbufs when
INVARIANTS was disabled or panic with an assertion failure if INVARIANTS
was enabled.  Note that the new case is a bit of a mix of the two other
cases in tcp_respond().  The TCP and IP headers must be copied explicitly
into the new mbuf instead of being inherited (similar to the m == NULL
case), but the addresses and ports must be swapped in the reply (similar
to the m != NULL case).

Reviewed by: glebius

7 years agoUpdate default KMODDIR in comment after r299393.
jhb [Thu, 26 May 2016 18:28:10 +0000 (18:28 +0000)]
Update default KMODDIR in comment after r299393.

Submitted by: hselasky

7 years agoDisconnect the OPENSTACK target from the CLOUDWARE list.
gjb [Thu, 26 May 2016 18:26:44 +0000 (18:26 +0000)]
Disconnect the OPENSTACK target from the CLOUDWARE list.

This was reported to not work as expected, and feedback
following the report was never received.  In addition, we
do not publish these anywhere publicly.

The configuration file is not (yet) removed, in hopes that
the remaining details on the original issues can be resolved,
and we can publish the resulting images in the future.

Sponsored by: The FreeBSD Foundation

7 years agoDisconnect the AZURE target from the CLOUDWARE list.
gjb [Thu, 26 May 2016 18:24:00 +0000 (18:24 +0000)]
Disconnect the AZURE target from the CLOUDWARE list.

Microsoft has graciously overtaken publication of FreeBSD
on Azure since 10.3-RELEASE.

Many thanks to Microsoft for their support of FreeBSD on
Azure.

The configuration file and Makefile.azure are not (yet)
planned to be removed, as they may be useful in the future.

Sponsored by: The FreeBSD Foundation

7 years ago[siba] use the generic bus methods where appropriate.
adrian [Thu, 26 May 2016 18:01:03 +0000 (18:01 +0000)]
[siba] use the generic bus methods where appropriate.

Submitted by: jhibbits
Differential Revision: https://reviews.freebsd.org/D802

7 years agoral: add missing ic_getradiocaps() assignment.
avos [Thu, 26 May 2016 17:06:43 +0000 (17:06 +0000)]
ral: add missing ic_getradiocaps() assignment.

7 years agoPrevent parallel object collapses. Both vm_object_collapse_scan() and
kib [Thu, 26 May 2016 16:59:29 +0000 (16:59 +0000)]
Prevent parallel object collapses.  Both vm_object_collapse_scan() and
swap_pager_copy() might unlock the object, which allows the parallel
collapse to execute.  Besides destroying the object, it also might
move the reference from parent to the backing object, firing the
assertion ref_count == 1.

Collapses are prevented by bumping paging_in_progress counters on both
the object and its backing object.

Reported by: cem
Tested by: pho (previous version)
Reviewed by: alc
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
X-Differential revision: https://reviews.freebsd.org/D6085

7 years agoFix a typo in a comment.
ian [Thu, 26 May 2016 16:53:50 +0000 (16:53 +0000)]
Fix a typo in a comment.

7 years agoStyle changes to some most outrageous violations in vm_object_collapse().
kib [Thu, 26 May 2016 16:51:38 +0000 (16:51 +0000)]
Style changes to some most outrageous violations in vm_object_collapse().

Reviewed by: alc
Sponsored by: The FreeBSD Foundation
MFC after: 1 week