Commit Graph

108906 Commits

Author SHA1 Message Date
Justin Hibbits
ac6c1372f4 Add the bus_alloc_resource_anywhere() convenience function.
Summary:
Many instances of bus_alloc_resource() simply use 0 and ~0 for start and end to
denote 'anywhere' with a given count.  To clean this up, introduce a
bus_alloc_resource_anywhere() convenience function.

Bump __FreeBSD_version for the new API.

Reviewed By: jhb
Differential Revision: https://reviews.freebsd.org/D5370
2016-02-27 03:35:28 +00:00
Justin Hibbits
eff83876b6 Replace several bus_alloc_resource() calls with bus_alloc_resource_any()
Most of these are BARs, and we allocate them in their entirety.  The one outlier
in this is amdsbwd, which calls bus_set_resource() prior.

Reviewed by:	jhb
Differential Revision:	https://reviews.freebsd.org/D5370 (partial)
2016-02-27 03:34:01 +00:00
Bryan Drewery
aae63957af Import bsd.clang-analyze.mk based on NetBSD's version.
This allows 'make analyze' or 'make OBJ.clang-analyzer' to run the
Clang static analyzer and present results on stdout.

Obtained from:	NetBSD (CVS Rev. 1.3)
Sponsored by:	EMC / Isilon Storage Division
Differential Revision:	https://reviews.freebsd.org/D5449
2016-02-26 22:14:00 +00:00
Bryan Drewery
4e47b95cc9 Remove more references to targets we've never had.
Sponsored by:	EMC / Isilon Storage Division
2016-02-26 22:13:35 +00:00
Andriy Voskoboinyk
f09a089ee6 net80211: fix 'uma_zalloc_arg: zone "32" with non-sleepable locks held'
when 'sysctl net.wlan.devices' is executed.

PR:		207497
Submitted by:	glebius
Approved by:	adrian (mentor)
2016-02-26 20:47:08 +00:00
Jared McNeill
81e802c14b Fix inverted test for lock status while waiting for PLL to become stable.
Reviewed by:	andrew
Approved by:	adrian (mentor)
2016-02-26 20:33:32 +00:00
Andrew Turner
aa8a1ea56f Make the CUBIEBOARD config include the A10 config with a few needed
additions. This is used by the release scripts so we need to keep it
around for now.

Sponsored by:	ABT Systems Ltd
2016-02-26 18:54:26 +00:00
Marcel Moolenaar
6bcf245ebc Bump VM_MAX_MEMSEGS from 2 to 3 to match the number of VM segment
identifiers present in vmmapi.h. In particular, it's now possible
to create a VM_FRAMEBUFFER segment.
2016-02-26 16:18:47 +00:00
Andrew Turner
7133fe0f33 Almost all copies of platform_mp_init_secondary just called
intr_pic_init_secondary. Replace them with a direct call. On BCM2836
and ARMADA XP we need to add this function, but it can be empty.

Reviewed by:	ian, imp
Sponsored by:	ABT Systems Ltd
Differential Revision:	https://reviews.freebsd.org/D5460
2016-02-26 16:04:47 +00:00
Marcel Moolenaar
7eb9cc0975 Add vm_set_register() and vm_set_desc() callbacks. These callbacks
translate directly into calls to their namesake API functions in
libvmmapi.

It is an improvement over the existing setreg(), setmsr(), setcr()
setgdt() and exec() callbacks in that the new additions give full
control and don't assume we're booting FreeBSD, like exec() and
don't assume one only wants to set the value of RSP, like setreg().
2016-02-26 16:00:16 +00:00
Andrew Turner
3210b87554 Remove platform_mp_probe as it's almost identical on most ARM SoCs, and
slightly wrong on the others. We should just check if mp_ncpus is set to
more than one CPU as we may wish to run on a single core even when SMP is
available.

Reviewed by:	ian
Sponsored by:	ABT Systems Ltd
Differential Revision:	https://reviews.freebsd.org/D5458
2016-02-26 15:54:34 +00:00
Marcel Moolenaar
8265d91646 Check that the userboot version is at least 3, rather than
3 exactly. The structure may be of a newer version and as
long as it is backward compatible with 3, we can work with
it.

While here: whitespace nits.
2016-02-26 15:52:55 +00:00
Ruslan Bukin
14232d424d o Use uint64_t for page number as it doesn't fit uint32_t.
o Implement growkernel bits for L1 level of pagetables.

This allows us to boot with 128GB of physical memory.

Sponsored by:	DARPA, AFRL
Sponsored by:	HEIF5
2016-02-26 14:04:00 +00:00
Andrew Turner
461a7671c7 Add the start of support for the Allwinner A31 clocks. It only adds
support for the i2c, mmc, and gmac clocks. Further clocks can be added as
needed.

Submitted by:	Emmanuel Vadot <manu@bidouilliste.com>
Reviewed by:	jmcneill
Differential Revision:	https://reviews.freebsd.org/D5339
2016-02-26 13:53:09 +00:00
Ed Schouten
afc055d90f Remove the errno argument from unp_drop().
While there, add a comment to clarify that ECONNRESET should always be
returned for POSIX conformance.

Suggested by:	Steven Hartland
2016-02-26 12:46:34 +00:00
Wojciech Macek
2445e7c84e Restore ThunderX Pass1.1 PCI changes removed by r295962
If Enhanced Allocation is not used, we can't allocate any random
    range. All internal devices have hardcoded place where they can
    be located within PCI address space. Fortunately, we can read
    this value from BAR.

Obtained from:         Semihalf
Sponsored by:          Cavium
Approved by:           cognet (mentor)
Reviewed by:           zbb
Differential revision: https://reviews.freebsd.org/D5455
2016-02-26 12:16:11 +00:00
Sepherosa Ziehau
5f609a0812 hyperv/hn: Make transmission path channel aware
Chimney sending buffer still needs conversion, which will be done
along with the upcoming vRSS support.

MFC after:	1 week
Sponsored by:	Microsoft OSTC
Differential Revision:	https://reviews.freebsd.org/D5457
2016-02-26 09:50:35 +00:00
Sepherosa Ziehau
c10a0b9e69 hyperv/hn: Remove the useless num_outstanding_sends
We rely on taskqueue draining now.

MFC after:	1 week
Sponsored by:	Microsoft OSTC
Differential Revision:	https://reviews.freebsd.org/D5456
2016-02-26 09:45:48 +00:00
Sepherosa Ziehau
3f919777b6 hyperv/hn: Associate TX/RX ring with channel
This fixes the TX/RX ring selection for TX/RX done.

MFC after:	1 week
Sponsored by:	Microsoft OSTC
Differential Revision:	https://reviews.freebsd.org/D5454
2016-02-26 09:41:00 +00:00
Sepherosa Ziehau
6619838c04 hyperv/hn: Pass channel to TX/RX done
This is preamble to associate the TX/RX rings to their channel.

While I'm here, revoke unused netvsc_recv_rollup.

MFC after:	1 week
Sponsored by:	Microsoft OSTC
Differential Revision:	https://reviews.freebsd.org/D5453
2016-02-26 09:35:45 +00:00
Sepherosa Ziehau
654bf1ec96 hyperv/hn: Pass channel as the channel callback argument
This is the preamble to pass channel back to hn(4) upon TX/RX done.

Reviewed by:	Hongjiang Zhang <honzhan microsoft com>
MFC after:	1 week
Sponsored by:	Microsoft OSTC
Differential Revision:	https://reviews.freebsd.org/D5452
2016-02-26 09:29:50 +00:00
Sepherosa Ziehau
b96a7ad189 hyperv: Always set device for channels
And unregister hv_device only for primary channels, who own the hv_device.

MFC after:	1 week
Sponsored by:	Microsoft OSTC
Differential Revision:	https://reviews.freebsd.org/D5451
2016-02-26 09:23:17 +00:00
Sepherosa Ziehau
a14df6ad64 hyperv: Remove useless channel inbound_lock
It serves no purpose.

Reviewed by:	Hongjiang Zhang <honzhan microsoft com>
MFC after:	1 week
Sponsored by:	Microsoft OSTC
Differential Revision:	https://reviews.freebsd.org/D5450
2016-02-26 09:17:31 +00:00
Wojciech Macek
3b654e081a Add ns16550a compatible string in UART 8250 driver
Obtained from:         Semihalf
Submitted by:          Michal Stanek <mst@semihalf.com>
Sponsored by:          Annapurna Labs
Approved by:           cognet (mentor)
Reviewed by:           imp, wma
Differential revision: https://reviews.freebsd.org/D5404
2016-02-26 08:43:36 +00:00
Wojciech Macek
a2862b1169 Add support for Enhanced Allocation in pciconf
* Modified pciconf to print EA capability structure
 * Added register description to pcireg.h

Obtained from:         Semihalf
Sponsored by:          Cavium
Approved by:           cognet (mentor)
Reviewed by:           jhb
Differential revision: https://reviews.freebsd.org/D5440
2016-02-26 08:35:04 +00:00
Stanislav Galabov
de867427d8 So far bsd.stand.mk wasn't included in the following files:
sys/boot/fdt/Makefile
sys/boot/uboot/fdt/Makefile
sys/boot/uboot/lib/Makefile

This causes compilation issues on MIPS due to trying to link PIC with non-PIC
code. This revision includes bsd.stand.mk in the above files.

Reviewed by:	imp
Approved by:	adrian (mentor)
Sponsored by:	Smartcom - Bulgaria AD
Differential Revision:	https://reviews.freebsd.org/D5311
2016-02-26 08:16:44 +00:00
Stanislav Galabov
8b2db3b713 Currently BERI's loader is including the 32-bit version of the FICL MIPS sysdep.h (sys/boot/ficl/mips/sysdep.h) instead of the 64-bit version (sys/boot/ficl/mips64/sysdep.h).
Although this may not be an issue in practice, it would be more correct if the 64-bit version was used. Also, using the 64-bit version would make it easier to add support for 64-bit ubldr on MIPS.

Approved by:	adrian (mentor)
Differential Revision:	https://reviews.freebsd.org/D5310
2016-02-26 08:06:25 +00:00
Adrian Chadd
0b3105a37d Add modules support for the bhnd code.
Submitted by:	Landon Fuller <landonf@landonf.org>
Obtained from:	https://github.com/landonf/freebsd/compare/user/landonf/bcm4331-CURRENT
2016-02-26 03:34:32 +00:00
Adrian Chadd
4ad7e9b01a Bring over the initial rewrite of the broadcom bus support found in their
SoCs and various chips (including, famously, their wifi chips.)

This is "just" (all 20,000 lines of it) code to enumerate the various
versions of busses inside these devices, including the PCI bridge and
the direct SIBA bridge found in MIPS chips.

It also includes shared code for some bus operations (suspend, resume, etc);
EEPROM/SROM/etc parsing and other things that are shared between chips.

Eventually this'll replace the code that bwi/bwn uses for the internal
bus, as well as some apparently upcoming mips74k broadcom SoC support
which uses bwn!

Thanks to Landon Fuller <landonf@landonf.org> for all this work!

Obtained from:	https://github.com/landonf/freebsd/compare/user/landonf/bcm4331-CURRENT
2016-02-26 03:34:08 +00:00
Sepherosa Ziehau
9021e53b29 hyperv: Use atomic_fetchadd_int to get GPADL id.
Reviewed by:	Hongjiang Zhang <honzhan microsoft com>
MFC after:	1 week
Sponsored by:	Microsoft OSTC
Differential Revision:	https://reviews.freebsd.org/D5439
2016-02-26 02:26:19 +00:00
David C Somayajulu
4ef8ebfd62 Upgrade the firmware carried in driver and loaded during hardware
initialization (a.k.a STORM firmware) to version 7.13.1 (latest version)
2016-02-25 22:44:00 +00:00
Andrew Turner
6daa2c8751 Fix a mistake that crept in when moving between git and svn, pic_ipi_send
should not be called from platform_mp_init_secondary.

Sponsored by:	ABT Systems Ltd
2016-02-25 22:13:43 +00:00
Andrew Turner
243b36c321 Remove platform_ipi_send, it's an unneeded as all implementations are
identical.

Sponsored by:	 ABT Systems Ltd
2016-02-25 20:48:23 +00:00
Jared McNeill
dd03610a2e Add Allwinner A20 HDMI support.
The HDMI driver will attach a framebuffer device when a display is
connected. If the EDID can be read and contains a preferred mode, it
will be used. Otherwise the framebuffer will default to 800x600.

In addition, if the EDID contains a CEA-861 extension block and the
"basic audio" flag is set, audio playback at 48kHz 16-bit stereo is
enabled on the controller.

Reviewed by:		andrew
Approved by:		gonzo (mentor)
Differential Revision:	https://reviews.freebsd.org/D5383
2016-02-25 20:17:18 +00:00
Mark Johnston
4de485fe5f Lock the NDP default router list and count defrouter references.
This addresses a number of race conditions that can cause crashes as a
result of unsynchronized access to the list.

PR:		206904
Tested by:	Larry Rosenman <ler@lerctr.org>,
		Kevin Bowling <kevin.bowling@kev009.com>
MFC after:	2 months
Differential Revision: https://reviews.freebsd.org/D5315
2016-02-25 20:12:05 +00:00
Mark Johnston
0acf5d0bfd Improve error handling for posix_fallocate(2) and posix_fadvise(2).
- Set td_errno so that ktrace and dtrace can obtain the syscall error
  number in the usual way.
- Pass negative error numbers directly to the syscall layer, as they're
  not intended to be returned to userland.

Reviewed by:	kib
Sponsored by:	EMC / Isilon Storage Division
Differential Revision: https://reviews.freebsd.org/D5425
2016-02-25 19:58:23 +00:00
Ed Maste
621a9c54dd pass -fPIC to the assembler, not linker
-fPIC has no effect on linking although it seems to be ignored by
GNU ld.bfd.  However, it causes ld.lld to terminate with an invalid
argument error.

Reviewed by:	dchagin, kib
MFC after:	1 month
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D5444
2016-02-25 19:26:14 +00:00
Andrew Turner
7ea3f5b654 Add support for the Allwinner A31 watchdog to the existing A10 watchdog
driver. This mostly involves selecting the register offsets to use at
runtime based on the hardware we are talking to.

Submitted by:	Emmanuel Vadot <manu@bidouilliste.com>
Differential Revision:	https://reviews.freebsd.org/D5327
2016-02-25 16:50:36 +00:00
Zbigniew Bodek
af8fe8f169 Introduce HW TSO support for VNIC
This feature was added in Pass2.0.
Significantly improves VNIC's TCP performance on Tx.

Reviewed by:   wma
Obtained from: Semihalf
Sponsored by:  Cavium
Differential Revision: https://reviews.freebsd.org/D5424
2016-02-25 14:29:57 +00:00
Zbigniew Bodek
3bdcfead19 Enable CQ count threshold interrupt on VNIC Pass2.0
On Pass2.0 can trigger interrupt on both timer and CQ count.

Reviewed by:   wma
Obtained from: Semihalf
Sponsored by:  Cavium
Differential Revision: https://reviews.freebsd.org/D5423
2016-02-25 14:28:10 +00:00
Zbigniew Bodek
3ad422a9d3 Fix VNIC support for Pass2.0 ThunderX chips
- Check chip revision using pass1_silicon() routine.
- Configure CPI correctly for Pass2.0

Reviewed by:   wma
Obtained from: Semihalf
Sponsored by:  Cavium
Differential Revision: https://reviews.freebsd.org/D5422
2016-02-25 14:26:13 +00:00
Zbigniew Bodek
73f8bb5343 Remove soft reset from the VNIC's PF driver
This is not needed and causes revid register of the PCI
configuration space to clear on Pass2.0.

Reviewed by:   wma
Obtained from: Semihalf
Sponsored by:  Cavium
Differential Revision: https://reviews.freebsd.org/D5421
2016-02-25 14:24:32 +00:00
Zbigniew Bodek
332c869727 Improve VNIC performance on Tx path by immediate packet transmission
Don't postpone Tx if the Tx lock can be acquired now.
This gives 3x better performance on egress.

Reviewed by:   wma
Obtained from: Semihalf
Sponsored by:  Cavium
Differential Revision: https://reviews.freebsd.org/D5325
2016-02-25 14:23:02 +00:00
Zbigniew Bodek
6dc234599f Clean-up network interface settings for VNIC
- Remove unrelevant bits
- Remove redundant code
- Reset variables and then set given bits

Reviewed by:   wma
Obtained from: Semihalf
Sponsored by:  Cavium
Differential Revision: https://reviews.freebsd.org/D5324
2016-02-25 14:21:04 +00:00
Zbigniew Bodek
44f2eb96bd Enable HWSTATS capability for VNIC
VNIC manages counters in hardware hence it is desired to have this
option enabled to avoid redundant stats update in ether_input_internal().

Reviewed by:   wma
Obtained from: Semihalf
Sponsored by:  Cavium
Differential Revision: https://reviews.freebsd.org/D5323
2016-02-25 14:19:02 +00:00
Zbigniew Bodek
44dd269352 Prefetch next CQ descriptor in Completion Queue handling loop of VNIC
Reviewed by:   wma
Obtained from: Semihalf
Sponsored by:  Cavium
Differential Revision: https://reviews.freebsd.org/D5322
2016-02-25 14:17:13 +00:00
Zbigniew Bodek
053f3d0e7e Enable LRO support for VNIC driver
Support for software LRO when enabled in the capabilities

Reviewed by:   wma
Obtained from: Semihalf
Sponsored by:  Cavium
Differential Revision: https://reviews.freebsd.org/D5321
2016-02-25 14:14:46 +00:00
Zbigniew Bodek
856dce91c0 Add support for hardware Tx and Rx checksums to VNIC driver
- The network controller verifies Rx TCP/UDP/SCTP checksums by default.
  Communicate this to the stack when the packet is not marked as erroneous
  to avoid redundant checksum calculation in kernel.
- It is not uncommon to get the mbuf with m_len that is less than
  the minimal size for the IP, TCP, UDP, etc. when HW checsumming
  is enabled. To avoid data corruption performed by the HW that is
  intended to write IP and TCP/UDP/SCTP checksums to the data segment,
  the mbuf needs to be pulled up by the required number of bytes.
- Make sure that one can modify the mbufs that require checsum calculation
  rather than check for NULL mbuf on each transmission.

Reviewed by:   wma
Obtained from: Semihalf
Sponsored by:  Cavium
Differential Revision: https://reviews.freebsd.org/D5320
2016-02-25 14:12:51 +00:00
Andrew Turner
ccf8caad14 Add the Allwinner A31 and A31s padconf support. It's currently unused, but
will be needed when we bring in further support for these SoCs.

Submitted by:	Emmanuel Vadot <manu@bidouilliste.com>
Differential Revision:	https://reviews.freebsd.org/D5340
2016-02-25 12:17:41 +00:00
Sepherosa Ziehau
f7d33dfef2 hyperv: Wait 5 seconds for hyperv result, instead of 500ms
This addresses various devices (network, stoarge) attach failure.

Reported by:	Hongxiong Xian <v-hoxian microsoft com>
Tested by:	Hongxiong Xian <v-hoxian microsoft com>
MFC after:	1 week
Sponsored by:	Microsoft OSTC
Differential Revision:	https://reviews.freebsd.org/D5435
2016-02-25 09:27:50 +00:00
Kristof Provost
14b5e85b18 pf: Fix possible out-of-bounds write
In the DIOCRSETADDRS ioctl() handler we allocate a table for struct pfr_addrs,
which is processed in pfr_set_addrs(). At the users request we also provide
feedback on the deleted addresses, by storing them after the new list
('bcopy(&ad, addr + size + i, sizeof(ad));' in pfr_set_addrs()).

This means we write outside the bounds of the buffer we've just allocated.
We need to look at pfrio_size2 instead (i.e. the size the user reserved for our
feedback). That'd allow a malicious user to specify a smaller pfrio_size2 than
pfrio_size though, in which case we'd still read outside of the allocated
buffer. Instead we allocate the largest of the two values.

Reported By:	Paul J Murphy <paul@inetstat.net>
PR:		207463
MFC after:	5 days
Differential Revision:	https://reviews.freebsd.org/D5426
2016-02-25 07:33:59 +00:00
Sepherosa Ziehau
fd458696b3 hyperv/hn: Hold the TX ring lock then drain TX desc buf_ring
Reported by:	Hongxiong Xian <v-hoxian microsoft com>
MFC after:	1 week
Sponsored by:	Microsoft OSTC
2016-02-25 07:03:10 +00:00
Justin Hibbits
a4965cf07b Fix the build.
Pointy-hat to:	jhibbits
Spotted by:	bde
2016-02-25 04:32:17 +00:00
Sepherosa Ziehau
ea134429d0 hyperv/hn: Implement ifnet.if_transmit method
It will be turned on by default later.

MFC after:	1 week
Sponsored by:	Microsoft OSTC
Differential Revision:	https://reviews.freebsd.org/D5415
2016-02-25 03:21:25 +00:00
Steven Hartland
e283644b87 Removed unused label and fix mutex_exit order
Remove unused done label from zfs_setacl fixing PVS-Studio V729.

Fix mutex_exit order to mirror the mutex_enter order.

MFC after:	1 week
Sponsored by:	Multiplay
2016-02-25 03:01:24 +00:00
Steven Hartland
5bae00d6b4 Fix NULL pointer dereferences
Fix NULL pointer dereferences identified as V522 by PVS-Studio.

MFC after:	1 week
Sponsored by:	Multiplay
2016-02-25 02:46:47 +00:00
Jared McNeill
6da9071523 Fix dedicated DMA transfers.
For sources and destinations marked "noincr", the previous code was
incorrectly programming the dedicated DMA channel control register
using bit definitions for normal DMA channels. This code path is not
currently used, but will be used by the HDMI audio driver in review.

Reviewed by:		andrew
Approved by:		gonzo (mentor)
Differential Revision:	https://reviews.freebsd.org/D5382
2016-02-25 01:24:02 +00:00
Navdeep Parhar
e8c6ba7265 cxgbe(4): Add a sysctl to retrieve the maximum speed/bandwidth supported by a
port.

dev.cxgbe.<n>.max_speed
dev.cxl.<n>.max_speed

Sponsored by:	Chelsio Communications
2016-02-25 01:10:56 +00:00
Konstantin Belousov
70209aca16 In bpf_getdltlist(), do not call copyout(9) while holding bpf lock.
Copy the data into temprorary malloced buffer and drop the lock for
copyout.

Reported, reviewed and tested by:	cem
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2016-02-24 22:00:35 +00:00
Dimitry Andric
14e9c9161c Merge ^/head r295902 through r296006. 2016-02-24 21:38:51 +00:00
Bryan Drewery
cba0af0aeb Remove hack from r2408 that is no longer needed.
Sponsored by:	EMC / Isilon Storage Division
2016-02-24 20:02:58 +00:00
Bryan Drewery
bd18fd57db DIRDEPS_BUILD: Regenerate without local dependencies.
These are no longer needed after the recent 'beforebuild: depend' changes
and hooking DIRDEPS_BUILD into a subset of FAST_DEPEND which supports
skipping 'make depend'.

Sponsored by:	EMC / Isilon Storage Division
2016-02-24 17:20:11 +00:00
Bryan Drewery
b9cd412e7b FAST_DEPEND: Always run depend via beforebuild which removes many hacks.
This will generate dependencies rather than depending on the previous behavior
of depending on the guessed OBJS: *.h dependecies or a user running
'make depend'.

Experimentation showed that depending only on headers was not enough and
prone to .ORDER errors.  Downstream users may also have added
dependencies into beforedepend or afterdepend targets.  The safest way to
ensure dependencies are generated before build is to run 'make depend'
beforehand rather than just depending on DPSRCS+SRCS.

Note that the OBJS_DEPEND_GUESS mechanism (a.k.a .if !exists(.depend) then
foo.o: *.h) is still useful as it improves incremental builds with missing
.depend.* files and allows 'make foo.o' to usually work, while this
'beforebuild: depend' ensures that the build will always find all dependencies.
The 'make foo.o' case has no means of a 'beforebuild' hook.

This also removes several hacks in the DIRDEPS_BUILD:
- NO_INSTALL_INCLUDES is no longer needed as it mostly was to work around
  .ORDER problems with building the needed headers early.
- DIRDEPS_BUILD: It is no longer necesarry to track "local dependencies" in
  Makefile.depend.

  These were only in Makefile.depend for 'clean builds' since nothing would
  generate the files due to skipping 'make depend' and early dependency
  bugs that have been fixed, such as adding headers into SRCS for the
  OBJS_DEPEND_GUESS mechanism.  Normally if a .depend file does not exist then
  a dependency is added by bsd.lib.mk/bsd.prog.mk from OBJS: *.h.  However,
  meta.autodep.mk creates a .depend file from created meta files and inserts
  that into Makefile.depend.  It also only tracks *.[ch] files though which can
  miss some dependencies that are hooked into 'make depend'.  This .depend
  that is created then breaks incremental builds due to the !exists(.depend)
  checks for OBJS_DEPEND_GUESS.  The goal was to skip 'make depend' yet it only
  really works the first time.  After that files are not generated as expected,
  which r288966 tried to address but was using buildfiles: rather than
  beforebuild: and was reverted in r291725.  As noted previously,
  depending only on headers in beforebuild: would create .ORDER errors
  in some cases.

  meta.autodep.mk is still used to generate Makefile.depend though via:
    gendirdeps: Makefile.depend
    .END: gendirdeps

  This commit allows removing all of the "local dependencies" in
  Makefile.depend which cuts down on churn and removes some of the
  arch-dependent Makefile.depend files.

  The "local dependencies" were also problematic for bootstrapping.

Sponsored by:	EMC / Isilon Storage Division
2016-02-24 17:19:18 +00:00
Bryan Drewery
70ca9ec4b9 Hook the meta/nofilemon build into using FAST_DEPEND.
FAST_DEPEND is intended to be the "skip 'make depend' and mkdep"
feature.  Since DIRDEPS_BUILD does this already with some of its own
hacks, and filemon doesn't need this, and nofilemon does, teach it how
to handle each of these cases.

In meta+filemon mode filemon will handle dependencies itself via the
meta mode logic in bmake.  We still want to set MK_FAST_DEPEND=yes to
enable some logic that indicates that 'make depend' is skipped in the
traditional sense.  The actual .depend.* files will be skipped.

When nofilemon is set though we still need to track and generate dependencies.

Sponsored by:	EMC / Isilon Storage Division
2016-02-24 17:19:13 +00:00
Bryan Drewery
68add21344 FAST_DEPEND: Don't waste time generating an empty .depend file.
The .depend file will still be generated if _EXTRADEPEND is used.  The target
is kept with a dependency on DPSRCS though so that 'make depend' will generate
all files.

Sponsored by:	EMC / Isilon Storage Division
2016-02-24 17:19:09 +00:00
Bryan Drewery
d7beff082b FAST_DEPEND: Rework how guessed dependencies are handled.
Rather than depend on .depend not existing, check the actual
.depend.OBJ file that will be used for that object.  If it doesn't
exist then use the guessed dependencies.

FAST_DEPEND may never have a .depend file.  Not having one means all of the
previous logic would over-depend all object files on all headers which is not
what we wanted.  It also means that if a .depend is generated before a build
is done for _EXTRADEPEND (such as for PROG or LIB) then all of these
dependencies would not be used since the .depend wasn't generated from mkdep
and the real .depend.* files are not generated until the build.

Sponsored by:	EMC / Isilon Storage Division
2016-02-24 17:19:05 +00:00
Bryan Drewery
cc66670114 Support beforebuild in the kernel.
Sponsored by:	EMC / Isilon Storage Division
2016-02-24 17:19:02 +00:00
Bryan Drewery
de1a3bd97e Remove ilinks in cleandepend directly via CLEANDEPENDFILES.
The 'cleanilinks' target is kept since it may still be useful as added in
r200178, though never documented.

Sponsored by:	EMC / Isilon Storage Division
2016-02-24 17:18:58 +00:00
Ed Schouten
72c8072ee5 Make asynchronous connection failures on UNIX sockets fail with ECONNRESET.
While making CloudABI work well on Linux, I discovered that I had a
FreeBSD-ism in one of my unit tests. The test did the following:

- Create UNIX socket 1, bind it, make it listen.
- Create UNIX socket 2, connect it to UNIX socket 1.
- Close UNIX socket 1.
- Obtain SO_ERROR from socket 2.

On FreeBSD this returns ECONNABORTED, while on Linux it returns
ECONNRESET. I dug through some of the relevant specifications[1] and it
looks like Linux is all right here. ECONNABORTED should only be returned
when the local connection (socket 2) is aborted; not the peer (socket 1).

It is of course slightly misleading: the function in which we set this
error is called uipc_abort(), but keep in mind that we're aborting the
peer, thus resetting the local socket.

[1] http://pubs.opengroup.org/onlinepubs/9699919799/functions/connect.html

Reviewed by:	cem
Sponsored by:	Nuxi, the Netherlands
Differential Revision:	https://reviews.freebsd.org/D5419
2016-02-24 17:10:32 +00:00
Ruslan Bukin
17696c12f5 Add support for symmetric multiprocessing (SMP).
Tested on Spike simulator with 2 and 16 cores (tlb enabled),
so set MAXCPU to 16 at this time.

This uses FDT data to get information about CPUs
(code based on arm64 mp_machdep).

Invalidate entire TLB cache as it is the only way yet.

Sponsored by:	DARPA, AFRL
Sponsored by:	HEIF5
2016-02-24 16:50:34 +00:00
Konstantin Belousov
0791e0c0e7 Provide more correct sizing of the KVA consumed by a vnode, used by
the virtvnodes calculation.  Include the size of fs-specific v_data as
the nfs nclnode inline, the NFS nclnode is bigger than either ZFS
znode or UFS inode.  Include the size of namecache_ts and short cache
path element, multiplied by the name cache population factor, again
inline.

Inline defines are used to avoid pollution of the vnode.h with the
subsystem-private objects.  Non-significant unsynchronized changes of
the definitions are fine, we do not care about that precision, and
e.g. ZFS consumes much malloced memory per vnode for reasons
unaccounted in the formula.

Lower the partition of kmem dedicated to vnodes, from 1/7 to 1/10.

The measures reduce vnode cache pressure on kmem and bring the vnode
cache memory use below some apparent thresholds that were exceeded by
r291244 due to more robust vnode reuse.

Reported and tested by:	marius (i386, previous version)
Reviewed by:	bde
Sponsored by:	The FreeBSD Foundation
MFC after:	2 weeks
2016-02-24 15:15:46 +00:00
Andrey V. Elsukov
23a6c7330c Fix bug in filling and handling ipfw's O_DSCP opcode.
Due to integer overflow CS4 token was handled as BE.

PR:		207459
MFC after:	1 week
2016-02-24 13:16:03 +00:00
Andrey V. Elsukov
b833ff5ab4 Fix useless check. m_pkthdr.len should be equal to orglen.
MFC after:	2 weeks
2016-02-24 12:28:49 +00:00
Konstantin Belousov
abb8f08388 Return dst as the result from memcpy(9) on amd64.
PR:	207422
MFC after:	1 week
2016-02-24 11:58:15 +00:00
Ed Schouten
c0af8d16d8 Call cap_rights_init() properly.
Even though or'ing the individual rights works in this specific case, it
may not work in general. Pass them in as varargs.
2016-02-24 10:54:26 +00:00
Sepherosa Ziehau
600d84765f hyperv/vmbus: Use free(9) for interrupt page; it is allocated by malloc(9)
MFC after:	1 week
Sponsored by:	Microsoft OSTC
Differential Revision:	https://reviews.freebsd.org/D5417
2016-02-24 08:54:50 +00:00
Wojciech Macek
fb05500b24 Make pci_host_generic and thunderx_pci common
* provided OFW interface for pci_host_generic (for handling devices which are present in DTS under the PCI node)
  * removed support for internal PCI from arm64/cavium
  * cleaned up and made most of the code common

Obtained from:         Semihalf
Sponsored by:          Cavium
Approved by:           cognet (mentor)
Reviewed by:           zbb
Differential revision: https://reviews.freebsd.org/D5261
2016-02-24 06:05:30 +00:00
Maxim Sobolev
a97562ad6c o kill few remaining references to the GEOM_UNCOMPRESS;
o add GEOM_UZIP_DEBUG.
2016-02-24 05:17:52 +00:00
Maxim Sobolev
3c3cbe9cf4 Kill few remaininng instances of GEOM_UNCOMPRESS. 2016-02-24 05:16:24 +00:00
Sepherosa Ziehau
0bc2abddc8 hyperv/utils: Code rearrange and cleanup
Split heartbeat, shutdown and timesync out of utils code
and name them properly.

Submitted by:	Jun Su <junsu microsoft com>
Reviewed by:	adrian, sephe, Hongjiang Zhang <honzhan microsoft com>
MFC after:	1 week
Sponsored by:	Microsoft OSTC
Differential Revision:	https://reviews.freebsd.org/D5216
2016-02-24 05:01:18 +00:00
Adrian Chadd
dc2e095538 Migrate UNCOMPRESS -> UZIP 2016-02-24 03:06:26 +00:00
Adrian Chadd
443a0f85dd Fixes to make it compile under gcc-4.2. 2016-02-24 02:52:49 +00:00
Kirk McKusick
24b6748c42 The UFS filesystem requires that the last block of a file always be
allocated. When shortening the length of a file in which the new end
of the file contains a hole, the hole must have a block allocated.

Reported by: Maxim Sobolev
Reviewed by: kib
Tested by:   Peter Holm
2016-02-24 01:58:40 +00:00
Eric Joyner
e4c893dd01 ixl(4)/ixlv(4): Remove a couple unnecessary register writes/flushes.
The one in ixl_xmit() has brought up to us as being unnecessary at least a
couple times.

Differential Revision:	https://reviews.freebsd.org/D5208
Tested by:	jeffrey.e.pieper@intel.com
Sponsored by:	Intel Corporation
2016-02-24 01:11:51 +00:00
Eric Joyner
e84c2dea93 ixl(4): Fix potential driver interrupt setup issues and startup crash.
- Limit queue autoconfiguration to 8 queues to prevent the driver from
  requesting a large number of MSI-X vectors at boot.

- Fix potential kernel panic that occurs when the driver loads and cannot
  get all requested MSIX vectors. Instead, attach() will fail with an error.
  - Move taskqueue setup to later in attach() to prevent having to free
    taskqueues if some other error in attach() occurs.

Differential Revision:	 https://reviews.freebsd.org/D5205
MFC after:	1 month
Tested by:	jeffrey.e.pieper@intel.com
Sponsored by:	Intel Corporation
2016-02-24 00:42:43 +00:00
Maxim Sobolev
5497acc527 Obsolete mkulzma(8) and geom_uncompress(4), their functionality
is now provided by mkuzip(8) and geom_uzip(4) respectively.

MFC after:	1 month
2016-02-24 00:39:36 +00:00
Jim Harris
361e1fb408 nvme: fix intx handler to not dereference ioq during initialization
This was a regression from r293328, which deferred allocation
of the controller's ioq array until after interrupts are enabled
during boot.

PR:		207432
Reported and tested by: Andy Carrel <wac@google.com>
MFC after:	3 days
Sponsored by:	Intel
2016-02-24 00:01:10 +00:00
Maxim Sobolev
8f8cb840b0 Improve mkuzip(8) and geom_uzip(4), merge in LZMA support from mkulzma(8)
and geom_uncompress(4):

1. mkuzip(8):

 - Proper support for eliminating all-zero blocks when compressing an
   image. This feature is already supported by the geom_uzip(4) module
   and CLOOP format in general, so it's just a matter of making mkuzip(8)
   match. It should be noted, however that this feature while it sounds
   great, results in very slight improvement in the overall compression
   ratio, since compressing default 16k all-zero block produces only 39
   bytes compressed output block, which is 99.8% compression ratio. With
   typical average compression ratio of amd64 binaries and data being
   around 60-70% the difference between 99.8% and 100.0% is not that
   great further diluted by the ratio of number of zero blocks in the
   uncompressed image to the overall number of blocks being less than
   0.5 (typically). However, this may be important from performance
   standpoint, so that kernel are not spinning its wheels decompressing
   those empty blocks every time this zero region is read. It could also
   be important when you create huge image mostly filled with zero
   blocks for testing purposes.

 - New feature allowing to de-duplicate output image. It turns out that
   if you twist CLOOP format a bit you can do that as well. And unlike
   zero-blocks elimination, this gives a noticeable improvement in the
   overall compression ratio, reducing output image by something like
   3-4% on my test UFS2 3GB image consisting of full FreeBSD base system
   plus some of the packages (openjdk, apache etc), about 2.3GB worth of
   file data (800+MB compressed). The only caveat is that images created
   with this feature "on" would not work on older versions of FeeBSDxi
   kernel, hence it's turned off by default.

 - provide options to control both features and document them in manual
   page.

 - merge in all relevant LZMA compression support from the mkulzma(8),
   add new option to select between both.

 - switch license from ad-hoc beerware into standard 2-clause BSD.

2. geom_uzip(4):

 - implement support for de-duplicated images;

 - optimize some code paths to handle "all-zero" blocks without reading
   any compressed data;

 - beef up manual page to explain that geom_uzip(4) is not limited only
   to md(4) images. The compressed data can be written to the block
   device and accessed directly via magic of GEOM(4) and devfs(4),
   including to mount root fs from a compressed drive.

 - convert debug log code from being compiled in conditionally into
   being present all the time and provide two sysctls to turn it on or
   off. Due to intended use of the module, it can be used in
   environments where there may not be a luxury to put new kernel with
   debug code enabled. Having those options handy allows debug issues
   without as much problem by just having access to serial console or
   network shell access to a box/appliance. The resulting additional
   CPU cycles are just few int comparisons and branches, and those are
   minuscule when compared to data decompression which is the main
   feature of the module.

 - hopefully improve robustness and resiliency of the geom_uzip(4) by
   performing some of the data validation / range checking on the TOC
   entries and rejecting to attach to an image if those checks fail.

 - merge in all relevant LZMA decompression support from the
   geom_uncompress(4), enable automatically when appropriate format is
   indicated in the header.

 - move compilation work into its own worker thread so that it does not
   clog g_up. This allows multiple instances work in parallel utilizing
   smp cores.

 - document new knobs in the manual page.

Reviewed by:		adrian
MFC after:		1 month
Differential Revision:	https://reviews.freebsd.org/D5333
2016-02-23 23:59:08 +00:00
Jung-uk Kim
0eda5b3f23 Silence PVS-Studio warning (V595). It can never be NULL here. 2016-02-23 23:57:24 +00:00
Bryan Drewery
200241b504 Fix build after r295934. 2016-02-23 23:37:10 +00:00
Jung-uk Kim
2f977ab449 Silence PVS-Studio warning (V595). 2016-02-23 23:09:45 +00:00
Jung-uk Kim
8444599e1e Silence PVS-Studio warning (V595). 2016-02-23 22:55:44 +00:00
Jung-uk Kim
7054df7f5b Remove brightness notify handler before reinstalling new one. 2016-02-23 22:50:45 +00:00
Jung-uk Kim
3e4f6cc6c7 Fix white spaces. 2016-02-23 22:30:45 +00:00
Jung-uk Kim
8d4a1dbf7b Fix style(9) bugs. 2016-02-23 22:22:15 +00:00
Mariusz Zaborski
94e6fdd806 According to the sys/kern/capabilities.conf, gethostid(3) should be allowed.
Pointed out by:	Milosz Kaniewski <m.kaniewski@wheelsystems.com>
Approved by:	pjd (mentor)
MFC after:	3 days
Sponsored by:	Wheel Systems, http://wheelsystems.com
2016-02-23 22:02:25 +00:00
Bryan Drewery
6971a63795 Fix build after r29592. 2016-02-23 21:21:47 +00:00
Andriy Voskoboinyk
ffadb4acda net80211: fix TIM cleanup.
Remove duplicate 'ni->ni_associd = 0' assignment from
ieee80211_node_leave(), since it breaks iv_set_tim() in
ic->ic_node_cleanup() (associd is cleared right after this call).

Tested with RTL8188EU (HOSTAP mode) and
WUSB54GC (STA mode, with powersaving enabled).

Approved by:	adrian (mentor)
Differential Revision:	https://reviews.freebsd.org/D5398
2016-02-23 21:11:42 +00:00
Michael Tuexen
9a59fb36b2 Don't leak an address in an error path.
CID:		1351729
MFC after:	3 days
2016-02-23 18:50:34 +00:00
Hans Petter Selasky
b265897c37 Configure the correct bMaxPacketSize for control endpoints before
requesting the initial complete device descriptor and not as part of
the subsequent babble error recovery. Babble means that the received
USB packet was bigger than than configured maximum packet size. This
only affects enumeration of FULL speed USB devices which use a
bMaxPacketSize different from 8 bytes. This patch might help fix
enumeration of USB devices which exhibit USB I/O errors in dmesg
during boot.

MFC after:	1 week
2016-02-23 18:17:01 +00:00
Randall Stewart
6e0efc6a39 This fixes the fastpath code to have a better module initialization sequence when
included in loader.conf. It also fixes it so that no matter if some one incorrectly
specifies a load order, the lists and such will be initialized on demand at that
time so no one can make that mistake.

Reviewed by:	hiren
Differential Revision:	D5189
2016-02-23 17:53:39 +00:00
Hans Petter Selasky
ecc7ce0f3e Be more verbose when truncating number of HID items.
Suggested by:	Larry Rosenman <ler@lerctr.org>
MFC after:	1 week
2016-02-23 14:58:20 +00:00
Ruslan Bukin
48eeabc1a9 Set a dependencies for stack(9) RISC-V MD part.
Pointed out by:	andrew
2016-02-23 14:29:22 +00:00
Ruslan Bukin
cea32c0742 o Grab physical memory regions information from the device tree.
o Increase memory size.
2016-02-23 14:21:46 +00:00
Svatopluk Kraus
fe6928058c Remove redundant __ARM_ARCH >= 6 check in armv6 specific files. 2016-02-23 10:12:50 +00:00
Sepherosa Ziehau
1b3ce7e39f hyperv/stor: Fix print format
Detected by:	PVS Static Analysis
MFC after:	1 week
Sponsored by:	Microsoft OSTC
Differential Revision:	https://reviews.freebsd.org/D5388
2016-02-23 09:29:45 +00:00
Sepherosa Ziehau
b87683cb78 hyperv/hn: Use IFQ_DRV_PREPEND instead of IF_PREPEND
IF_PREPEND promises out-of-order packet sending when the TX desc list
is depleted. It was overlooked and copied blindly when the transmission
path was partially rewritten.

MFC after:	1 week
Sponsored by:	Microsoft OSTC
Differential Revision:	https://reviews.freebsd.org/D5386
2016-02-23 09:25:20 +00:00
Ed Schouten
70907712be Make handling of mmap()'s prot argument more strict.
- Make the system call fail if prot contains bits other than read, write
  and exec.
- Similar to OpenBSD's W^X, don't allow write and exec to be set at the
  same time. I'd like to see for now what happens if we enforce this
  policy unconditionally. If it turns out that this is far too strict,
  we'll loosen this requirement.
2016-02-23 09:22:00 +00:00
Sepherosa Ziehau
a0a3cf18ec hyperv/hn: Factor out hn_send_pkt() from hn_start_locked()
It will be shared w/ the upcoming ifnet.if_transmit method
implementation.

No functional change.

MFC after:	1 week
Sponsored by:	Microsoft OSTC
Differential Revision:	https://reviews.freebsd.org/D5385
2016-02-23 09:20:33 +00:00
Ian Lepore
3f817dd216 Stop using the global fdtbus_bs_tag and instead use the tag from the softc
that was set up properly at init time.
2016-02-23 03:34:36 +00:00
Ian Lepore
b1c2e02c10 This code no longer references fdtbus_bs_tag, no need for a special extern
declaration of it for aarch64.
2016-02-23 03:01:46 +00:00
Ian Lepore
99c4102214 Now that we have OF_decode_addr(), with proper MD implementations, to obtain
the bus space tag and handle for a uart console, use the values returned by
that routine to set the global uart_bus_space_mem, instead of assuming that
there will be a global variable named fdtbus_bs_tag to set it from.

Also, use OF_getencprop() instead calling fdt32_to_cpu() separately.
2016-02-23 02:57:45 +00:00
Justin Hibbits
9ef05032c0 Allow the size argument for law_enable() to be non-power-of-2.
Although the local access windows are powers of 2 in size, allow arguments that
aren't power of 2, and round up.
2016-02-23 02:28:19 +00:00
Kevin Lo
c9b6e63dd3 Add device ID for 'AboCom 802.11n' usb.
PR:	207412
Submitted by:	Philippe Michaud-Boudreault <pitwuu at gmail dot com>
2016-02-23 01:56:58 +00:00
Marius Strobl
0a01ff4d7d Fix and clean up usage of DMA and TSO segments:
- At Intel it is believed that most of their products support "only"
  40 DMA segments so lower {EM,IGB}_MAX_SCATTER accordingly. Actually,
  40 is more than plenty to handle full size TSO packets so it doesn't
  make sense to further distinguish between MAC variants that really
  can do 64 DMA segments. Moreover, capping at 40 DMA segments limits
  the stack usage of {em,igb}_xmit() that - given the rare use of more
  than these - previously hardly was justifiable, while still being
  sufficient to avoid the problems seen with em(4) and EM_MAX_SCATTER
  set to 32.
- In igb(4), pass the actually supported TSO parameters up the stack.
  Previously, the defaults set in if_attach_internal() were applied,
  i. e. a maximum of 35 TSO segments, which made supporting more than
  these in the driver pointless. However, this might explain why no
  problems were seen with IGB_MAX_SCATTER at 64.
- In em(4), take the 5 m_pullup(9) invocations performed by em_xmit()
  in the TSO case into account when reporting TSO parameters upwards.
  In the worst case, each of these calls will add another mbuf and,
  thus, the requirement for an additional DMA segment. So for best
  performance, it doesn't make sense to advertize a maximum of TSO
  segments that typically will require defragmentation in em_xmit().
  Again, this leaves enough room to handle full size TSO packets.
- Drop TSO macros from if_lem.h given that corresponding MACS don't
  support TSO in the first place.

Reviewed by:	erj, sbruno, jeffrey.e.pieper_intel.com
Approved by:	erj
MFC after:	3 days
Differential Revision:	https://reviews.freebsd.org/D5238
2016-02-23 01:19:26 +00:00
Ian Lepore
e28fbecafb Make imx6 systems work again after recent import of new dts files.
Linux-driven changes to the way the chip's two interrupt controllers are
defined (we only support one of them) led to no interrupt processing, so
the system would hang after device instantiation.  This workaround just
rewrites the FDT data on the fly to get interrupt handling back under the
control of the main GIC device.

If/when we ever support deep sleep modes that involve powering down the
main GIC, we'll have to undo this change, write a driver for the GPC-PIC,
and somehow manage the handoff of responsibilities between the two drivers
as the chip transitions in/out of deep sleep mode.
2016-02-23 01:08:39 +00:00
Dimitry Andric
76f3831738 Merge ^/head r295845 through r295901. 2016-02-22 22:21:53 +00:00
Bryan Drewery
590363ef99 Always remove .depend.* in case switching between FAST_DEPEND on/off.
This was missed in r295666.

Sponsored by:	EMC / Isilon Storage Division
2016-02-22 21:01:25 +00:00
Ian Lepore
0d2550a169 If the user has set a u-boot env var named rootpath, automatically
import it into the loader(8) env as dhcp.root-path, so that it overrides
any dhcp/bootp server-provided path.

Now if you have a dhcp server available you can easily net-boot a u-boot
system even if you don't control the dhcp server config, by setting just
two variables in the u-boot env:

  loaderdev=net
  rootpath=<nfsserverip>:<pathname>

Previously you had to either accept all the dhcp parameters from the
server without the ability to locally provide the rootpath, or you had
to forego dhcp and set more vars (ipaddr, netmask, serverip, rootpath).
2016-02-22 18:53:55 +00:00
Ruslan Bukin
e1b6d4a9f4 Add basic trap handlers for illegal instruction and breakpoint
exceptions.
2016-02-22 14:54:50 +00:00
Ruslan Bukin
041c26e7ff Fix comment. 2016-02-22 14:19:45 +00:00
Ruslan Bukin
c7977d4cee Remove duplicates. 2016-02-22 14:13:05 +00:00
Ruslan Bukin
0b7bfc0beb Provide stack(9) MD stubs for RISC-V so ktr(9) can be compiled in. 2016-02-22 14:01:46 +00:00
Ruslan Bukin
dfb5ca561e Fix ktrace call. 2016-02-22 13:52:08 +00:00
Wojciech Macek
0422bce8b2 Add Intel 10Gb support to ARM64 GENERIC kernel config
Obtained from:         Semihalf
Sponsored by:          Cavium
Approved by:           cognet (mentor)
Reviewed by:           zbb
Differential revision: https://reviews.freebsd.org/D5347
2016-02-22 13:34:43 +00:00
Svatopluk Kraus
eb21eee06e Remove armv6 specific part from armv4 specific file and update comment.
No functional change.
2016-02-22 12:57:08 +00:00
Svatopluk Kraus
7758916f44 Move ARM_L2_PIPT option to std.armv6 for all armv6 platforms.
Only L2 PIPT cache is supported for __ARM_ARCH >= 6.

In fact, this is just a pure proclamation as this option is used
only in armv4 specific files now.
2016-02-22 11:47:28 +00:00
Svatopluk Kraus
b352b10400 As <machine/vm.h> is included from <vm/vm.h>, there is no need to
include it explicitly when <vm/vm.h> is already included.

Reviewed by:	alc, kib
Differential Revision:	https://reviews.freebsd.org/D5380
2016-02-22 09:10:23 +00:00
Svatopluk Kraus
35a0bc1260 As <machine/vmparam.h> is included from <vm/vm_param.h>, there is no
need to include it explicitly when <vm/vm_param.h> is already included.

Suggested by:	alc
Reviewed by:	alc
Differential Revision:	https://reviews.freebsd.org/D5379
2016-02-22 09:08:04 +00:00
Svatopluk Kraus
d6849317c5 As <machine/param.h> is included from <sys/param.h>, there is no need
to include it explicitly when <sys/param.h> is already included.

Reviewed by:	alc, kib
Differential Revision:	https://reviews.freebsd.org/D5378
2016-02-22 09:04:36 +00:00
Svatopluk Kraus
a1e1814d76 As <machine/pmap.h> is included from <vm/pmap.h>, there is no need to
include it explicitly when <vm/pmap.h> is already included.

Reviewed by:	alc, kib
Differential Revision:	https://reviews.freebsd.org/D5373
2016-02-22 09:02:20 +00:00
Sepherosa Ziehau
ed3960349b hyperv/hn: Add TX method for txeof processing.
Preamble to implement ifnet.if_transmit method.

Reviewed by:	adrian
Approved by:	adrian (mentor)
MFC after:	1 week
Sponsored by:	Microsoft OSTC
Differential Revision:	https://reviews.freebsd.org/D5346
2016-02-22 06:28:18 +00:00
Sepherosa Ziehau
5cb0a42c8c hyperv/hn: Staticize and rename packet TX done function
It is only used in hv_netvsc_drv_freebsd.c; and rename it to hn_tx_done()
mainly to reserve "xmit" for ifnet.if_transmit implement.

While I'm here, remove unapplied comment.

Reviewed by:	adrian
Approved by:	adrian (mentor)
MFC after:	1 week
Sponsored by:	Microsoft OSTC
Differential Revision:	https://reviews.freebsd.org/D5345
2016-02-22 06:22:47 +00:00
Sepherosa Ziehau
009a73c4ba hyperv/hn: Rename TX related function and struct fields a bit
Preamble to implement the ifnet.if_transmit method.

Reviewed by:	adrian
Approved by:	adrian (mentor)
MFC after:	1 week
Sponsored by:	Microsoft OSTC
Differential Revision:	https://reviews.freebsd.org/D5344
2016-02-22 06:17:26 +00:00
Andriy Voskoboinyk
6e2ab41693 urtwn: shutdown the device properly
- R92C path: NetBSD (mostly)
- R88E path: TP-Link driver

Tested with RTL8188EU and RTL8188CUS.

Reviewed by:	kevlo
Approved by:	adrian (mentor)
Differential Revision:	https://reviews.freebsd.org/D5198
2016-02-22 01:15:02 +00:00
Pyun YongHyeon
15b185341d ifnet lock was changed to use sx(9) long time ago.
Don't hold a driver lock for if_free(9).
2016-02-22 00:58:04 +00:00
Andriy Voskoboinyk
7873b2abd6 urtwn: add an option to compile the driver without firmware specific code
- Add URTWN_WITHOUT_UCODE option (will disable any firmware specific code
when set).
- Do not exclude the driver from build when MK_SOURCELESS_UCODE is set
(URTWN_WITHOUT_UCODE will be enforced unconditionally).
- Do not abort initialization when firmware cannot be loaded;
behave like the URTWN_WITHOUT_UCODE option was set.
- Drop some unused variables from urtwn_softc structure.

Tested with RTL8188EU and RTL8188CUS in HOSTAP and STA modes.

Reviewed by:	kevlo
Approved by:	adrian (mentor)
Differential Revision:	https://reviews.freebsd.org/D4849
2016-02-22 00:48:53 +00:00
Andrew Turner
fe3232f39a Make efi_time and EFI_GetTimeOfDay static, neither are used by other parts
of the efi code.

Sponsored by:	ABT Systems Ltd
2016-02-21 21:20:23 +00:00
Andriy Voskoboinyk
5036353a49 rtwn: import r290048.
- Fix scanning from AUTH state.

Tested by: Simone Mario Lombardo <evil.lombo@gmail.com>

PR:		203105
Reviewed by:	kevlo
Approved by:	adrian (mentor)
Differential Revision:	https://reviews.freebsd.org/D4820
2016-02-21 18:51:48 +00:00
Ian Lepore
85143dd18d Allow a dynamic env to override a compiled-in static env by passing in the
override indication in the env data.

Submitted by:	bde
2016-02-21 18:35:01 +00:00
Ian Lepore
37d65816e1 Minor style cleanups.
Submitted by:		bde
2016-02-21 18:17:09 +00:00
Pedro F. Giffuni
99c006f9ba ostiInitiatorIOCompleted(): wrong sizeof() argument.
Detected by:	PVS Static Analysis
CID:		1331601, 1331523
2016-02-21 16:45:22 +00:00
Dag-Erling Smørgrav
f4d6a773f8 Implement /proc/$$/limits.
PR:		207386
Submitted by:	Szymon Śliwa <knight.erraunt@gmail.com>
MFC after:	3 weeks
2016-02-21 14:56:05 +00:00
Dimitry Andric
9893f787ec Merge ^/head r295601 through r295844. 2016-02-21 13:49:26 +00:00
Andrew Turner
f4cd39e3b2 Add a missing call to dev_cleanup from the arm64 loader.efi.
Sponsored by:	ABT Systems Ltd
2016-02-20 17:29:04 +00:00
Konstantin Belousov
2fe1339ea2 Some BIOSes ACPI bytecode needs to take (sleepable) acpi mutex for
acpi_GetInteger() execution.  Intel DMAR interrupt remapping code
needs to know UID of the HPET to properly route the FSB interrupts
from the HPET, even when interrupt remapping is disabled, and the code
is executed under some non-sleepable mutexes.

Cache HPET UIDs in the device softc at the attach time and provide
lock-less method to get UID, use the method from the dmar hpet
handling code instead of calling GetInteger().

Reported and tested by:	Larry Rosenman <ler@lerctr.org>
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2016-02-20 13:37:04 +00:00
Konstantin Belousov
94a4ee3be7 Switch /dev/hpet to use make_dev_s(9). Device needs si_drv1
initializated, do it correctly even though hpet cannot be loaded as
module.

Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2016-02-20 13:21:59 +00:00
Kristof Provost
c90369f880 in pf_print_state_parts, do not use skw->proto to print the protocol but our
local copy proto that we very carefully set beforehands. skw being NULL is
perfectly valid there.

Obtained from:	OpenBSD (henning)
2016-02-20 12:53:53 +00:00
Zbigniew Bodek
36e9c2cef0 Revert r295756:
Extract common code from PowerPC's ofw_pci

Import portions of the PowerPC OF PCI implementation into
new file "ofw_pci.c", common for other platforms. The files ofw_pci.c and
ofw_pci.h from sys/powerpc/ofw no longer exist. All required declarations
are moved to sys/dev/ofw/ofw_pci.h.

This creates a new ofw_pci_write_ivar() function and modifies
ofw_pci_nranges(), ofw_pci_read_ivar(), ofw_pci_route_interrupt()
methods.
Most functions contain existing ppc implementations in the majority
unchanged. Now there is no need to have multiple identical copies
of methods for various architectures.

Submitted by:  Marcin Mazurek <mma@semihalf.com>
Obtained from: Semihalf
Sponsored by:  Annapurna Labs
Reviewed by:   jhibbits, mmel
Differential Revision: https://reviews.freebsd.org/D4879

This needs to return to the drawing board as it breaks both
PowerPC and Sparc64 build.

Pointed out by: jhibbits
2016-02-20 12:28:20 +00:00
Svatopluk Kraus
c4a4eb59e3 Rename busdma_machdep.c to busdma_machdep-v4.c, pmap.c to pmap-v4.c
and trap.c to trap-v4.c to be plain and consistent with other armv4
specific files.
2016-02-20 07:45:21 +00:00
Justin Hibbits
e903856979 Fix the definition of RM_MAX_END.
Even though casting from signed to unsigned is well-defined in C, it's better to
first cast to the larger unsigned type, then negate.
2016-02-20 01:34:13 +00:00
Justin Hibbits
7915adb560 Introduce a RMAN_IS_DEFAULT_RANGE() macro, and use it.
This simplifies checking for default resource range for bus_alloc_resource(),
and improves readability.

This is part of, and related to, the migration of rman_res_t from u_long to
uintmax_t.

Discussed with:	jhb
Suggested by:	marcel
2016-02-20 01:32:58 +00:00
Eric Joyner
2bc4747cc4 ixl(4)/ixlv(4): Revert m_collapse() in ixl_xmit() to m_defrag().
The m_collapse() call would fail when transmitting medium-sized packets
when the interface mtu was set to 9000, so revert back to m_defrag(),
which does not fail.

Differential Revision:	https://reviews.freebsd.org/D5207
Tested by:	jeffrey.e.pieper@intel.com
Sponsored by:	Intel Corporation
2016-02-19 22:48:20 +00:00
David C Somayajulu
bb329d4b5a Remove dead code. Code Cleanup. Improve clarity in debug messages
MFC after:5 days
2016-02-19 22:46:52 +00:00
Eric Joyner
42d7398e7e ixl(4): Fix errors in queue interrupt setup in MSIX mode.
- I40E_PFINT_DYN_CTLN needs to be cleared, and not have a queue index
  written to it.
- The interrupt linked list for each queue is changed to only include
  the queue's Rx and Tx queues.

Differential Revision:	https://reviews.freebsd.org/D5206
Reviewed by:	sbruno
Tested by:	jeffrey.e.pieper@intel.com
Sponsored by:	Intel Corporation
2016-02-19 22:45:09 +00:00
Eric Joyner
300d145480 ixl(4): Remove unsupported device IDs.
There is no official support for 20G SKUs on FreeBSD, and the KX_A
device ID was never used.

Differential Revision:	https://reviews.freebsd.org/D5204
Reviewed by:	sbruno, jeffrey.e.pieper@intel.com
Sponsored by:	Intel Corporation
2016-02-19 22:33:50 +00:00
Eric Joyner
c11f1016ec ixl(4): Fix two important RSS bugs.
- Change tc_mapping field to assign 64 queues instead of 16 to the PF's VSI;
  add comments to describe how this is done.

- Set hash lut size to 512 when setting filter control; the lut size defaults
  to 128 if this isn't set.

Differential Revision:	https://reviews.freebsd.org/D5203
Reviewed by:	gallatin
Tested by:	jeffrey.e.pieper@intel.com
Sponsored by:	Intel Corporation
2016-02-19 21:58:14 +00:00
David C Somayajulu
34b133bcd5 Modified the use of bxe_grc_dump() function so that it can be invoked directly at any potential error path, where a fwdump is needed. The fwdump (a.k.a grcdump) is stored in a driver buffer. The sysctl grcdump_done indicates if a fwdump was taken and waiting to be retrieved.
The sysctl trigger_grcdump can be used to manually trigger a fwdump.

MFC after:5 days
2016-02-19 21:32:49 +00:00
Pedro F. Giffuni
e0f6860d51 qlxgb: fix mismatch.
Found by:	PVS Static Analysis
Reviewed by:	davidcs
MFC after:	1 month
2016-02-19 18:05:02 +00:00
Stefan Eßer
5a1a8ad938 Fix syntax error introduced in previous commit where I removed one
character to few. I should have waited for the kernel compile to finish,
even though the change seemed so trivial.
2016-02-19 16:53:21 +00:00
Stefan Eßer
755ae20cd7 Remove redundant check for "(dinfo != NULL)", it has already been performed
as the first part of this complex loop conditional.

Found by:    PVS Static Analysis
2016-02-19 16:43:03 +00:00
Pedro F. Giffuni
308c3c240f Ext2: cleanup setting of ctime/mtime/birthtime.
This adopts the same change as r291936 for UFS.
Directly clear IN_ACCESS or IN_UPDATE when user supplied the time, and
copy the value into the inode.

This keeps the behaviour cleaner and is consistent with UFS.

Reviewed by:	bde
MFC after:	1 month (only 10)
2016-02-19 15:53:08 +00:00
Pedro F. Giffuni
930143bd86 firewire: fix a mismatch introduced in r230558.
Found by:	PVS Static Analysis
Reviewed by:	sbruno
MFC after:	1 month
2016-02-19 15:35:20 +00:00
Andrew Turner
0bd11ac8f9 Add initial support for the Allwinner A31i and A31s. This just adds the
FDT platform code to detect when we are booting on one of these SoCs. The
driver changes will be added shortly.

Submitted by:	Emmanuel Vadot <manu@bidouilliste.com>
Differential Revision:	https://reviews.freebsd.org/D5338
2016-02-19 14:15:31 +00:00
Andrew Turner
f9a32acb48 Include ofw_bus_subr.h before ofw_pci.h for the definition of struct
ofw_bus_iinfo.

Sponsored by:	ABT Systems Ltd
2016-02-19 14:05:28 +00:00
Michael Tuexen
64a3a6304e Use the SCTP level pointer, not the interface level.
MFC after:	3 days
2016-02-19 11:25:18 +00:00
Svatopluk Kraus
b38523dc0f Remove not used static function pmap_kenter_attr(). 2016-02-19 10:40:04 +00:00
Svatopluk Kraus
3d5822f1a9 Remove not used definitions and fix some style nits.
No functional changes.
2016-02-19 10:32:17 +00:00
Svatopluk Kraus
a569bb2f9f Remove AP_KRW definition not needed after r295801. 2016-02-19 09:52:11 +00:00
Svatopluk Kraus
08674c4573 Rename pte.h to pte-v4.h and start including directly either pte-v4.h
or pte-v6.h in files which needs it.

There are quite internal definitions in pte-v4.h and pte-v6.h headers
specific for corresponding pmap implementation. These headers should be
included only in very few files and an intention is to not hide for
which implementation such files are.

Further, sys/arm/arm/elf_trampoline.c is an example of file which
uses armv4 like pmap implementation for both armv4 and armv6 platforms.
This is another reason why pte.h which includes specific header
according to __ARM_ARCH is not created.
2016-02-19 09:23:32 +00:00
Svatopluk Kraus
12fdcefc8d Move common definitions from both pmap-v4.h and pmap-v6.h into pmap.h.
(1) MI interface needed for vm subsystem.
(2) MD interface created for ARM architecture to be used in files
    shared by armv4 and armv6 platforms.
2016-02-19 08:41:47 +00:00
Svatopluk Kraus
3e1cfddd47 Rename pmap.h to pmap-v4.h and remove pmap-v6.h include from it.
Create new pmap.h which includes specific header according to
__ARM_ARCH.

Note that <machine/pmap.h> is included from <vm/pmap.h> so one common
<machine/pmap.h> must exist.
2016-02-19 08:35:29 +00:00
Marcelo Araujo
d931334bd4 Fix regression introduced on 272446r.
lagg(4) supports the protocol none, where it disables any traffic without
disabling the lagg(4) interface itself.

PR:		206921
Submitted by:	Pushkar Kothavade <pushkarbk@gmail.com>
Reviewed by:	rpokala
Approved by:	bapt (mentor)
MFC after:	3 weeks
Sponsored by:	gandi.net
Differential Revision:	https://reviews.freebsd.org/D5076
2016-02-19 06:35:53 +00:00
Andriy Voskoboinyk
665d5ae9a2 net80211: add few missing subtype names.
- Add definitions for Timing Advertisement and Control Wrapper frames.
- Refresh ieee80211_mgt_subtype_name and ieee80211_ctl_subtype_name
arrays.
- Count Timing Advertisement frames as discarded management frames in all
modes.

Approved by:	adrian (mentor)
Differential Revision:	https://reviews.freebsd.org/D5331
2016-02-19 05:59:38 +00:00
Sepherosa Ziehau
563d00ab5c hyperv/hn: Free the txdesc buf_ring when the TX ring is destroyed
Reviewed by:	adrian
Approved by:	adrian (mentor)
MFC after:	1 week
Sponsored by:	Microsoft OSTC
Differential Revision:	https://reviews.freebsd.org/D5318
2016-02-19 05:13:56 +00:00
Sepherosa Ziehau
ea2f3d1776 hyperv/hn: Enable IP header checksum offloading for WIN8 (WinServ2012)
Tested on Windows Server 2012.

Reviewed by:	adrian
Approved by:	adrian (mentor)
MFC after:	1 week
Sponsored by:	Microsoft OSTC
Differential Revision:	https://reviews.freebsd.org/D5317
2016-02-19 05:08:44 +00:00
Sepherosa Ziehau
5788ded618 hyperv/hn: Add option to bind TX taskqueues to the specified CPU
It will be used to help tracking host side transmission ring selection
issue; and it will be turned on by default, once we have concrete result.

Reviewed by:	adrian, Jun Su <junsu microsoft com>
Approved by:	adrian (mento)
MFC after:	1 week
Sponsored by:	Microsoft OSTC
Differential Revision:	https://reviews.freebsd.org/D5316
2016-02-19 05:03:17 +00:00
Adrian Chadd
ad73b30173 document some ACPI related sysctls.
Submitted by:	Oliver Pinter <oliver.pinter@hardenedbsd.org>
Sponsored by:	HardenedBSD
Differential Revision:	https://reviews.freebsd.org/D5263
2016-02-19 05:02:17 +00:00
Justin Hibbits
43cd61606b Replace several bus_alloc_resource() calls using default arguments with bus_alloc_resource_any()
Since these calls only use default arguments, bus_alloc_resource_any() is the
right call.

Differential Revision: https://reviews.freebsd.org/D5306
2016-02-19 03:37:56 +00:00
Kevin Lo
277db30576 Remove bogus cast. 2016-02-19 01:57:51 +00:00
Kevin Lo
29899c0add Add missing parentheses.
Found by:	PVS-Studio
2016-02-19 01:56:59 +00:00
Mark Johnston
88c2beac9c Ensure that we test the event condition when a disabled kevent is enabled.
r274560 modified kqueue_register() to only test the event condition if the
corresponding knote is not disabled. However, this check takes place before
the EV_ENABLE flag is used to clear the KN_DISABLED flag on the knote, so
enabling a previously-disabled kevent would not result in a notification for
a triggered event. This change fixes the problem by testing for EV_ENABLED
before possibly checking the event condition.

This change also updates a kqueue regression test to exercise this case.

PR:		206368
Reviewed by:	kib
Sponsored by:	EMC / Isilon Storage Division
Differential Revision:	https://reviews.freebsd.org/D5307
2016-02-19 01:49:33 +00:00
Mark Johnston
fe169828c3 Return an error if both EV_ENABLE and EV_DISABLE are specified for a kevent.
Currently, this combination results in EV_DISABLE being ignored.

Reviewed by:	kib
Sponsored by:	EMC / Isilon Storage Division
Differential Revision:	https://reviews.freebsd.org/D5307
2016-02-19 01:35:01 +00:00
Bryan Drewery
f84e07cb58 FAST_DEPEND: Apply conditional -MF from r291945 to kernel as well.
Sponsored by:	EMC / Isilon Storage Division
2016-02-19 00:41:41 +00:00
Bryan Drewery
9fb02a70d0 Avoid reading .depend.* in simple cases where not needed.
This will speed up some tree-walks with FAST_DEPEND which otherwise
would include length(SRCS) .depend files.

This also uses a trick suggested by sjg@ to still read them in when
specifying _V_READ_DEPEND=1 in the env/make args.

Sponsored by:	EMC / Isilon Storage Division
2016-02-19 00:41:24 +00:00
Navdeep Parhar
40bf7442fa cxgbe: catch up with the latest hardware-related definitions.
Obtained from:	Chelsio Communications
Sponsored by:	Chelsio Communications
2016-02-19 00:29:16 +00:00
Jung-uk Kim
bfe2514a08 Remove a bogus bzero() call.
Found by:	PVS-Studio
2016-02-18 23:32:11 +00:00
Jung-uk Kim
33b5cd539e Optimize ROL and ROR emulations and fix comments. 2016-02-18 23:03:37 +00:00
Jung-uk Kim
7de2983dd0 Silence VPS-Studio errors (V646). These is no functional change. 2016-02-18 23:00:01 +00:00
Michael Tuexen
861f6d1196 Add protection code.
MFC after:	3 days
CID:		748858
2016-02-18 21:33:10 +00:00
Michael Tuexen
fdc4c9d067 Add some protection code.
CID:		1331893
MFC after:	3 days
2016-02-18 21:21:45 +00:00
Michael Tuexen
6df7c000d3 Fix reporting of mapped addressed in getpeername() and getsockname() for
IPv6 SCTP sockets.
This bugs were found because of an issue reported by PVS / D5245.
2016-02-18 21:05:04 +00:00
Jung-uk Kim
c2a9e596ed Silence VPS-Studio errors (V512). These buffer underflows are intentional. 2016-02-18 19:37:39 +00:00
Gleb Smirnoff
cd82d21b2e Fix obvious typo, that lead to incorrect sorting.
Found by:	PVS-Studio
2016-02-18 19:05:30 +00:00
Zbigniew Bodek
910905c74f Fix build for i386 and arm64 after r295755
- Take bus_space_tag_t type into consideration when returning
  default, zero value.
- Include missing rman.h required by ofw_pci.h
2016-02-18 15:44:45 +00:00
Ruslan Bukin
229f3f0d9c Increase kernel and user VA space.
This allows us to boot with more than 128MB of physical memory.

Sponsored by:	DARPA, AFRL
Sponsored by:	HEIF5
2016-02-18 15:28:57 +00:00
Warner Losh
787db28adf Remove a stray else. It isn't needed (due to the return at the end of
the if statement it pairs with). While not an error today, a careless
edit in the future could cause problems (though given the nature of
this specific code, the problems quite likely would be some variation
of "most direct access SCSI storage devices won't attach," which is
unlikely to go unnoticed).

PVS-Studio: V705
2016-02-18 15:12:52 +00:00
Ruslan Bukin
2a9aa1a646 Use medany (Medium/Anywhere) GCC code model for RISC-V.
This will allow us to use bigger relocations and all
the 64-bit VA space.
2016-02-18 14:38:37 +00:00
Ed Maste
796a99fc5c Remove dd xfer stats emitted during buildworld
They result in gratuitous differences when comparing build log output.
2016-02-18 14:17:28 +00:00
Zbigniew Bodek
a259e55bb9 Extract common code from PowerPC's ofw_pci
Import portions of the PowerPC OF PCI implementation into
new file "ofw_pci.c", common for other platforms. The files ofw_pci.c and
ofw_pci.h from sys/powerpc/ofw no longer exist. All required declarations
are moved to sys/dev/ofw/ofw_pci.h.

This creates a new ofw_pci_write_ivar() function and modifies
ofw_pci_nranges(), ofw_pci_read_ivar(), ofw_pci_route_interrupt() methods.
Most functions contain existing ppc implementations in the majority
unchanged. Now there is no need to have multiple identical copies
of methods for various architectures.

Submitted by:  Marcin Mazurek <mma@semihalf.com>
Obtained from: Semihalf
Sponsored by:  Annapurna Labs
Reviewed by:   jhibbits, mmel
Differential Revision: https://reviews.freebsd.org/D4879
2016-02-18 13:07:21 +00:00