dragonfly.git
7 years agoOpenSSH: Suppress warning on login_getcapstr().
zrj [Sun, 25 Sep 2016 15:04:35 +0000 (18:04 +0300)]
OpenSSH: Suppress warning on login_getcapstr().

Taken-from: FreeBSD (r255767 hidden in merge commit)

7 years agogcc47: Suppress last codegen warning.
zrj [Sun, 25 Sep 2016 14:19:48 +0000 (17:19 +0300)]
gcc47: Suppress last codegen warning.

Turns out gcc(compilation as C) differentiates when initializing global variables that
are declared 'extern' on the same line (removal of extern attribute is ok, includes
c-common.h header that properly marks c_family_lang_mask global variable as extern).

Note: do not apply same change to gcc50 since it is compiled as C++ that is not affected.

7 years agogcc47: Fix misplaced NULL usage in strings.
zrj [Sun, 25 Sep 2016 14:17:32 +0000 (17:17 +0300)]
gcc47: Fix misplaced NULL usage in strings.

Specific to c++, just do not do it.

7 years agogcc47: Backport objc fix from gcc trunk.
zrj [Sun, 25 Sep 2016 13:37:22 +0000 (16:37 +0300)]
gcc47: Backport objc fix from gcc trunk.

This prevents spurious warnings when compiling with gcc50.
Fix is needed for objc ABI inline semantics.
Also why we even provide objc language support in base?

Taken-from: gcc trunk (trunk@220175)

7 years agogcc47: Prevent -Wswitch-bool noise.
zrj [Sun, 25 Sep 2016 13:00:29 +0000 (16:00 +0300)]
gcc47: Prevent -Wswitch-bool noise.

In gcc v5 and later -Wswitch-bool is default and creates a lot of
warnings when building gcc v4.7 with gcc v5 compiler.
Since backporting patches to generate "compatible" gcc private headers
would be very error-prune, just take lkml.org/2015/5/27/941 approach.
At this point we only need to catch real issues for backup compiler.

7 years agocrunchgen(1): Fix few spurious warnings.
zrj [Sun, 25 Sep 2016 12:48:16 +0000 (15:48 +0300)]
crunchgen(1): Fix few spurious warnings.

Just add prototypes to help compiler detecting real bugs and not
pollute build logs with false positives.

Note: made crunch_help() static, seems to be fine.

7 years agolibncurses: Set WANRS at 5.
zrj [Sun, 25 Sep 2016 11:13:23 +0000 (14:13 +0300)]
libncurses: Set WANRS at 5.

Turns out private libncurses was completely ignoring WARNS and running loose,
so after previous few changes connect to global lib/Makefile.inc and set
WARNS at 5 (6 is an overkill, also does not survive FORMAT_AUDIT).

7 years agolibncurses: Avoid warning when calling cgetent().
zrj [Sun, 25 Sep 2016 11:08:29 +0000 (14:08 +0300)]
libncurses: Avoid warning when calling cgetent().

Since both read_termcap.c static version of cgetent() and cgetent(3) has second
argument as char** just use __DECONST() trick so to not have big changes.
It should be safe to do that, base libncurses is a private library now.

7 years agolibncurses: Avoid -Woverflow in baud rates.
zrj [Sun, 25 Sep 2016 10:40:48 +0000 (13:40 +0300)]
libncurses: Avoid -Woverflow in baud rates.

NCURSES_OSPEED has type - short so anything >= B38400 overflows.
Since changing NCURSES_OSPEED to use int is an ABI change and given
that overflown values are still unique and only used as identifiers
there is nothing wrong by explictly casting it to used type.

7 years agobootstrap: Expand BOOTSTRAPPING case to avoid warning.
zrj [Sun, 25 Sep 2016 09:18:28 +0000 (12:18 +0300)]
bootstrap: Expand BOOTSTRAPPING case to avoid warning.

Addition to 6d3bd8e3942560036cf2aec0d98a65819c5f3b4c that allows to prevent
"warning: 'encode_b64' defined but not used [-Wunused-function]"

7 years agoath_hal: Add FCC6_FCCA regulatory domain (0x0014)
John Marino [Mon, 26 Sep 2016 00:35:57 +0000 (19:35 -0500)]
ath_hal: Add FCC6_FCCA regulatory domain (0x0014)

Tested on TP-Link N900, AR9380, regdomain 0x0014 (FCC6_FCCA)

Taken From FreeBSD: SVN rev 306323 (25 SEP 2016)

Thanks Adrian!

7 years agokernel/psm: Support newer Synaptics touchpads
Daniel Bilik [Mon, 26 Sep 2016 00:47:17 +0000 (02:47 +0200)]
kernel/psm: Support newer Synaptics touchpads

Taken-from: FreeBSD

7 years agokernel/clock_gettime: Various fixes.
Sascha Wildner [Sun, 25 Sep 2016 22:36:03 +0000 (00:36 +0200)]
kernel/clock_gettime: Various fixes.

* Fix CLOCK_PROF and CLOCK_VIRTUAL to behave like FreeBSD's. They are
  not meant to return the values of ITIMER_PROF and ITIMER_VIRTUAL
  (which are decreasing, see getitimer(2)), like they were implemented
  by 91810a6f0686477493e9915e98cfc5adcbe91363. This also fixes
  CLOCK_PROCESS_CPUTIME_ID.

* Fix CLOCK_PROCESS_THREAD_ID. It was adding the values wrongly in a
  way that could cause tv_nsec to overflow (i.e. become >= 1000000000).

* Fix clock_getres() for CLOCK_{PROCESS,THREAD}_CPUTIME_ID.

* Mention CLOCK_{PROCESS,THREAD}_CPUTIME_ID in clock_gettime()'s manual
  page.

* Bring in some minor manual page fixes from FreeBSD.

Reported-by: zhtw
Dragonfly-bug: <https://bugs.dragonflybsd.org/issues/2951>

7 years agoif_iwm - Switch 7265D and 3165 devices to 7265D firmware.
Imre Vadász [Tue, 20 Sep 2016 22:33:02 +0000 (00:33 +0200)]
if_iwm - Switch 7265D and 3165 devices to 7265D firmware.

7 years agoiwmfw - Import 7265D firmware for AC3165 and newer AC7265 revisions.
Imre Vadász [Tue, 6 Sep 2016 21:20:39 +0000 (23:20 +0200)]
iwmfw - Import 7265D firmware for AC3165 and newer AC7265 revisions.

7 years agoif_iwm - Move struct iwm_cfg chipset configs to if_iwm_7000.c and _8000.c
Imre Vadász [Sun, 25 Sep 2016 19:21:20 +0000 (21:21 +0200)]
if_iwm - Move struct iwm_cfg chipset configs to if_iwm_7000.c and _8000.c

* This is more similar to how code/definitions are distributed in
  Linux's iwlwifi.

* This should make recognizing new chipset variants, and adding additional
  flags from the Linux iwlwifi code easier, without blowing up if_iwm.c

Taken-From: Linux iwlwifi

7 years agoif_iwm - Simplify device id matching code a bit.
Imre Vadász [Sun, 25 Sep 2016 18:59:55 +0000 (20:59 +0200)]
if_iwm - Simplify device id matching code a bit.

* Just add the struct iwm_cfg pointers to the iwm_devices array, to get
  rid of the large switch clause.

7 years agokernel/vmm - Fix build with VMM_DEBUG
Antonio Huete Jimenez [Sun, 25 Sep 2016 10:57:09 +0000 (12:57 +0200)]
kernel/vmm - Fix build with VMM_DEBUG

7 years agopthread: Init libthread_xu also in pthread_key_create()
zrj [Fri, 16 Sep 2016 04:42:37 +0000 (07:42 +0300)]
pthread: Init libthread_xu also in pthread_key_create()

Previously libtreahd_xu was only prepared in pthread_create()
but there are cases where keys need to be initialized before.

Solves runtime of statically linked gfortran programs with -pthread
(libgfortran calls newlocale() when setting up the environment).

7 years ago<pthread.h>: Avoid namespace pollution.
zrj [Thu, 22 Sep 2016 11:32:51 +0000 (14:32 +0300)]
<pthread.h>: Avoid namespace pollution.

Rename MUTEX_TYPE_MAX -> PTHREAD_MUTEX_TYPE_MAX to avoid clashes
with types in user source codes. Adjust all use cases.

While there, remove deprecated unused compat mutex types.

7 years ago<pthread.h>: Mark some __nonnull(x) cases.
zrj [Thu, 22 Sep 2016 11:25:10 +0000 (14:25 +0300)]
<pthread.h>: Mark some __nonnull(x) cases.

7 years ago<pthread.h>: Visibility changes.
zrj [Thu, 22 Sep 2016 07:04:32 +0000 (10:04 +0300)]
<pthread.h>: Visibility changes.

While there, remove prototypes of pthread_attr_{get,set}floatstate()
looks like they never were implemented, so do not advertise them.

7 years ago<pthread.h>: Perform some style(9) cleanup.
zrj [Thu, 22 Sep 2016 06:57:39 +0000 (09:57 +0300)]
<pthread.h>: Perform some style(9) cleanup.

Change indentation to a single tab, since both protype names and arguments
are quite long and later added attribute decorations will only make it worse.

Strictly no functional change, just shifting stuff around for readability and
upcoming changes.

7 years agoUse recently added attributes in few standard headers.
zrj [Thu, 22 Sep 2016 06:19:10 +0000 (09:19 +0300)]
Use recently added attributes in few standard headers.

There attributes are to assits compiler making better analysis
doring compilation time. Like branch prediction and hinting.

While there, for now prefer to use __attribute__((__noreturn__)) to
_Noreturn, since neither OpenBSD or NetBSD has it at all and in our
variant we don't handle it in c++ case ([[noreturn]]) anyway.
Looks to be only a workaround for some old clang++ version.

7 years ago<stdlib.h>: Change visibility of few POSIX extensions to ISO C.
zrj [Thu, 22 Sep 2016 05:44:57 +0000 (08:44 +0300)]
<stdlib.h>: Change visibility of few POSIX extensions to ISO C.

Seems it should be like this.

7 years agostyle(9): Perform some cleanup in few standard headers.
zrj [Thu, 22 Sep 2016 05:32:10 +0000 (08:32 +0300)]
style(9): Perform some cleanup in few standard headers.

For upcomming changes. No functional change.

Kindly-requested-by: swildner@
7 years ago<sys/cdefs.h>: Add support for alloc_align, alloc_size and malloc attributes.
zrj [Tue, 20 Sep 2016 07:27:39 +0000 (10:27 +0300)]
<sys/cdefs.h>: Add support for alloc_align, alloc_size and malloc attributes.

  * __alloc_align tells the compiler that one of the arguments is a
    minimal alignment for pointer to help with pointers analysis.
  * __alloc_size tells the compiler that one of the arguments is a
    size of a pointer returned by function.
  * __malloclike tells the compiler that returned pointer does not
    alias any other pointer to help futher optimizations.

While there, add partial support for clang (as it is in FreeBSD).

7 years ago<sys/cdefs.h>: Be more careful with _Noreturn.
zrj [Tue, 20 Sep 2016 08:48:55 +0000 (11:48 +0300)]
<sys/cdefs.h>: Be more careful with _Noreturn.

With modern gcc started using g++ for bootstraps _Noreturn must
be handled with a bit of extra care.

7 years ago<sys/cdefs.h>: Move __warn_unused_result__ to 3.4
zrj [Tue, 20 Sep 2016 07:14:21 +0000 (10:14 +0300)]
<sys/cdefs.h>: Move __warn_unused_result__ to 3.4

Looks like it is reliably available only at 3.4 so change it.

7 years ago<sys/cdefs.h>: Style(9) fixes.
zrj [Tue, 20 Sep 2016 06:43:53 +0000 (09:43 +0300)]
<sys/cdefs.h>: Style(9) fixes.

Mostly tabs, no functional change except for removal
of extra semicolon in __strong_reference() macro.

7 years agobootstrap: Fix old boostrapping issue once and for all.
zrj [Wed, 21 Sep 2016 10:45:50 +0000 (13:45 +0300)]
bootstrap: Fix old boostrapping issue once and for all.

This was fallout after iconv() removal of 'const' attribute to conform
with POSIX. All the later hacks are starting to accumulate and prevent
easy further base system upgrading. So given that main issue is c++
specific and only needed for bootstraping process deal with it straight
and remove all hacks(include shoehornings) that were caused by it.

To fix bootstrapping problems add WORLD_VERSION variable that indicates
current DragonFly base version and could be used to retrospectively
help bootstrapping from older releases. Makefile changes that depend on
WORLD_VERSION should *only* be used as a once switch and during native
compilations should *not* change default world makefiles logic.

7 years agoif_iwm - Remove OpenBSD-specific comment. Beautify pci cfg space accesses.
Imre Vadász [Sat, 17 Sep 2016 21:06:42 +0000 (23:06 +0200)]
if_iwm - Remove OpenBSD-specific comment. Beautify pci cfg space accesses.

7 years agoif_iwm - Fix typo in commit a7697ea01c11fd493aec52260a02f31df680eb91.
Imre Vadász [Fri, 23 Sep 2016 23:35:04 +0000 (01:35 +0200)]
if_iwm - Fix typo in commit a7697ea01c11fd493aec52260a02f31df680eb91.

* The sc->sc_uc.uc_error_event_table value is now at sc->error_event_table,
  and not sc->umac_error_event_table.

7 years agoif_iwm - Get rid of unneeded IWM_FWDMASEGSZ and IWM_FWMAXSIZE constants
Imre Vadász [Fri, 23 Sep 2016 22:27:49 +0000 (00:27 +0200)]
if_iwm - Get rid of unneeded IWM_FWDMASEGSZ and IWM_FWMAXSIZE constants

* We only need IWM_FH_MEM_TB_MAX_LENGTH bytes for the fw_dma memory.

7 years agoif_iwm - With the previous commits, this DELAY no longer seems to be needed.
Imre Vadász [Fri, 23 Sep 2016 22:31:26 +0000 (00:31 +0200)]
if_iwm - With the previous commits, this DELAY no longer seems to be needed.

7 years agoif_iwm - Sync IWM_MVM_ALIVE waiting and start_fw handling with iwlwifi.
Imre Vadász [Fri, 23 Sep 2016 17:09:13 +0000 (19:09 +0200)]
if_iwm - Sync IWM_MVM_ALIVE waiting and start_fw handling with iwlwifi.

* Use the notification wait API, like it's done in the Linux iwlwifi code,
  to wait for the IWM_MVM_ALIVE notification.

* This also should fix some firmware load interrupt issues, and errors
  in the nic lock using.

Taken-From: Linux iwlwifi

7 years agoif_iwm - Synchronize firmware loading code with Linux iwlwifi.
Imre Vadász [Fri, 9 Sep 2016 22:00:07 +0000 (00:00 +0200)]
if_iwm - Synchronize firmware loading code with Linux iwlwifi.

* While there, rename some functions to match the names and functionality
  of the similarly named functions in Linux iwlwifi.

Taken-From: Linux iwlwifi

7 years agoiwmfw - Fixup revert to version 16 for the 8000C firmware.
Imre Vadász [Thu, 22 Sep 2016 13:24:01 +0000 (15:24 +0200)]
iwmfw - Fixup revert to version 16 for the 8000C firmware.

7 years agoif_iwm - Improve reliability of iwm_release on disassociation a bit.
Imre Vadász [Sat, 17 Sep 2016 20:57:06 +0000 (22:57 +0200)]
if_iwm - Improve reliability of iwm_release on disassociation a bit.

* We need to first call ivp->iv_newstate(), to enqueue the deauth/deassoc
  mgmt frame, then flush the tx queue, before actually calling
  iwm_release().

* cycling a wlan connection via wpa_cli frontend to wpa_supplicant, by
  issuing disconnect and reconnect commandos works quite well.
  (There is still an issue when disconnecting to quickly after completing
   authentication/association).

* Reassociating or roaming via wpa_supplicant is still broken.

7 years agoif_iwm - Remove 1s delay after fw loading. Can't reproduce issues on AC8260.
Imre Vadász [Thu, 22 Sep 2016 09:03:26 +0000 (11:03 +0200)]
if_iwm - Remove 1s delay after fw loading. Can't reproduce issues on AC8260.

The 1s delay was added in the update to version 16 fw, where Family 8000
support was added.

7 years agoif_iwm - SCAN_ABORT_UMAC response doesn't use a wide id
Imre Vadász [Thu, 22 Sep 2016 09:01:51 +0000 (11:01 +0200)]
if_iwm - SCAN_ABORT_UMAC response doesn't use a wide id

7 years agoif_iwm - Revert 8000C firmware (for AC8260) to version 16 for now.
Imre Vadász [Thu, 22 Sep 2016 09:04:39 +0000 (11:04 +0200)]
if_iwm - Revert 8000C firmware (for AC8260) to version 16 for now.

7 years agovkernel - Invalidate pte before setting attributes to the vm_page
Antonio Huete Jimenez [Tue, 20 Sep 2016 23:31:58 +0000 (01:31 +0200)]
vkernel - Invalidate pte before setting attributes to the vm_page

- Fixes a problem at mountroot time where it doesn't find any disk
  even though the disk is detected earlier.

7 years agovkernel - Fix a vkernel lockup on startup
Antonio Huete Jimenez [Tue, 20 Sep 2016 22:03:05 +0000 (00:03 +0200)]
vkernel - Fix a vkernel lockup on startup

- During ap_init() any pending IPIs is processed manually so
  clear gd_npoll as the real kernel does.
- Do not disable interrupts for vkernels during lwkt_send_ipiq3()
  because they don't seem to be re-enabled afterwards as they should.
  I'm not entirely sure this is the right fix, more investigation
  is required.

7 years agoif_iwm - Recognize the IWM_UCODE_TLV_FW_MEM_SEG firmware section type.
Imre Vadász [Tue, 20 Sep 2016 22:35:40 +0000 (00:35 +0200)]
if_iwm - Recognize the IWM_UCODE_TLV_FW_MEM_SEG firmware section type.

* Will be needed for loading version 22 of 7265D firmware.

7 years agoiwmfw - Update to version 17 firmware for all devices supported by iwm.
Imre Vadász [Mon, 19 Sep 2016 19:26:11 +0000 (21:26 +0200)]
iwmfw - Update to version 17 firmware for all devices supported by iwm.

7 years agoif_iwm - Recognize IWM_DTS_MEASUREMENT_NOTIF_WIDE notification.
Imre Vadász [Mon, 19 Sep 2016 19:46:05 +0000 (21:46 +0200)]
if_iwm - Recognize IWM_DTS_MEASUREMENT_NOTIF_WIDE notification.

* Add the command groups enum, and the iwm_phy_ops_subcmd_ids enum
  to if_iwmreg.h definitions.

* The IWM_DTS_MEASUREMENT_NOTIF_WIDE notification will be generated by
  version 17 firmware.

Taken-From: Linux iwlwifi

7 years agoif_iwm - Very basic DTS thermal sensor support (prints temp as debug msg).
Imre Vadász [Thu, 14 Jul 2016 15:39:27 +0000 (17:39 +0200)]
if_iwm - Very basic DTS thermal sensor support (prints temp as debug msg).

* Adds IWM_DEBUG_TEMP debug message type, for printing messages related
  to temperature sensors and thermal/TDP infos.

* The firmware regularly sends us DTS measurement notifications, so just
  print the temperature value as a debugging message.

7 years agoif_iwm - Remove some more fields from struct nvm_data which are irrelevant.
Imre Vadász [Sun, 18 Sep 2016 15:33:01 +0000 (17:33 +0200)]
if_iwm - Remove some more fields from struct nvm_data which are irrelevant.

* These values are only used for dvm devices in Linux's iwlwifi
  (i.e. not relevant for iwm).

7 years agoif_iwm - Only for family 7000 power-down busmaster DMA clocks when stopping.
Imre Vadász [Sun, 18 Sep 2016 12:29:30 +0000 (14:29 +0200)]
if_iwm - Only for family 7000 power-down busmaster DMA clocks when stopping.

Taken-From: Linux iwlwifi

7 years agoif_iwm - Implement apmg_wake_up_wa workaround properly for 7000 family.
Imre Vadász [Fri, 16 Sep 2016 20:44:40 +0000 (22:44 +0200)]
if_iwm - Implement apmg_wake_up_wa workaround properly for 7000 family.

* Add iwm_pcie_set_cmd_in_flight() and iwm_pcie_clear_cmd_in_flight()
  helper methods.

* Use ring->queued tracking in the command queue to set/clear the
  cmd_hold_nic_awake bit at the right points.

Taken-From: Linux iwlwifi

7 years agoif_iwm - Fix up RSSI calculations for scan results and normal RX operations.
Imre Vadász [Sun, 18 Sep 2016 08:07:27 +0000 (10:07 +0200)]
if_iwm - Fix up RSSI calculations for scan results and normal RX operations.

* hard code a noise floor of -96 for now. The noise floor update code
  returns some "interesting" values that I can't map to anything useful
  right now.
* Ensure a default noise floor is set - otherwise the initial scan results
  have a noise floor of '0'.
* Fix up the RSSI calculation to be correctly relative to the noise floor.
  The RSSI routines return an absolute value in dBm - so fix this up.
* Cap RSSI values appropriately.
* Ensure we pass in a 1/2 dB unit value in to net80211.

Taken-From: FreeBSD (SVN r305917)

7 years agoBelatedly bump DF version after SSL libraries were privatized
John Marino [Fri, 16 Sep 2016 14:30:32 +0000 (09:30 -0500)]
Belatedly bump DF version after SSL libraries were privatized

7 years agoUpdate the pciconf(8) database.
Sascha Wildner [Thu, 15 Sep 2016 13:28:43 +0000 (15:28 +0200)]
Update the pciconf(8) database.

September 13, 2016 snapshot from http://pciids.sourceforge.net/

7 years agoif_iwm - Use iwm_mvm_scan_stop_wait to properly abort scans.
Imre Vadász [Sun, 17 Jul 2016 17:30:00 +0000 (19:30 +0200)]
if_iwm - Use iwm_mvm_scan_stop_wait to properly abort scans.

* Add IWM_FLAG_SCAN_RUNNING to sc->sc_flags to track whether the firmware
  is currently running a scan, in order to decide wheter iwm_scan_end
  needs to abort a running scan.

* In iwm_scan_end, if the scan is still running, we now abort it, in order
  to keep the firmware scanning state in sync.

* Try to make things a bit simpler, by reacting on the
  IWM_SCAN_OFFLOAD_COMPLETE and IWM_SCAN_COMPLETE_UMAC notifications,
  instead of IWM_SCAN_ITERATION_COMPLETE and
  IWM_SCAN_ITERATION_COMPLETE_UMAC. This should be fine since we always
  only tell the firmware to do a single scan iteration anyway.

7 years agoif_iwm - Add scan abort functions, to properly cancel a running scan.
Imre Vadász [Mon, 18 Jul 2016 20:03:27 +0000 (22:03 +0200)]
if_iwm - Add scan abort functions, to properly cancel a running scan.

* Uses the notification wait api to wait for the corresponding scan
  complete notification after sending the abort command.

Taken-From: Linux iwlwifi

7 years agoif_iwm - Get rid of iwm_disable_rx_dma, just use iwm_pcie_rx_stop directly.
Imre Vadász [Sun, 11 Sep 2016 20:23:50 +0000 (22:23 +0200)]
if_iwm - Get rid of iwm_disable_rx_dma, just use iwm_pcie_rx_stop directly.

* This also fixes one of many small nic lock handling bugs, and matches
  iwlwifi's code.

7 years agoif_iwm - Use notification wait API to wait for calibration to complete.
Imre Vadász [Sun, 11 Sep 2016 19:10:43 +0000 (21:10 +0200)]
if_iwm - Use notification wait API to wait for calibration to complete.

Taken-From: Linux iwlwifi

7 years agoif_iwm - Add implementation of the notification wait api from iwlwifi.
Imre Vadász [Mon, 18 Jul 2016 19:39:24 +0000 (21:39 +0200)]
if_iwm - Add implementation of the notification wait api from iwlwifi.

Taken-From: Linux iwlwifi

7 years agoif_iwm - Change 2nd arg of iwm_phy_db_set_section() to struct iwm_rx_packet.
Imre Vadász [Sun, 11 Sep 2016 16:12:28 +0000 (18:12 +0200)]
if_iwm - Change 2nd arg of iwm_phy_db_set_section() to struct iwm_rx_packet.

* This matches the function declaration in Linux's iwlwifi.

7 years agoif_iwm - Store paging_mem_size field in firmware image information struct.
Imre Vadász [Sun, 11 Sep 2016 15:48:46 +0000 (17:48 +0200)]
if_iwm - Store paging_mem_size field in firmware image information struct.

7 years agoif_iwm - Get rid of some gratuitous constant renaming wrt. Linux iwlwifi.
Imre Vadász [Tue, 6 Sep 2016 20:01:02 +0000 (22:01 +0200)]
if_iwm - Get rid of some gratuitous constant renaming wrt. Linux iwlwifi.

* IWM_UCODE_SECT_MAX -> IWM_UCODE_SECTION_MAX

* IWM_UCODE_TYPE_* -> IWM_UCODE_* (except for IWM_UCODE_TYPE_MAX which
  stays).

7 years agoif_iwm - Get rid of SYNC_RESP_STRUCT and SYNC_RESP_PTR macros.
Imre Vadász [Sun, 11 Sep 2016 15:18:02 +0000 (17:18 +0200)]
if_iwm - Get rid of SYNC_RESP_STRUCT and SYNC_RESP_PTR macros.

* Not needed, because we just do a single bus_dmamap_sync for syncing the
  complete received frame, instead of explicitly bus_dmamap_sync-ing
  subranges of the frame like in the original OpenBSD code.

7 years agoif_iwm - Remove unused fw_totlen field in struct iwm_fw_sects.
Imre Vadász [Sun, 11 Sep 2016 15:05:22 +0000 (17:05 +0200)]
if_iwm - Remove unused fw_totlen field in struct iwm_fw_sects.

7 years agosys/vfs/hammer: Change unused PFS ioctl flag to reserved
Tomohiro Kusumi [Fri, 9 Sep 2016 17:02:28 +0000 (02:02 +0900)]
sys/vfs/hammer: Change unused PFS ioctl flag to reserved

7 years agosbin/hammer: Add clrpfs()
Tomohiro Kusumi [Fri, 9 Sep 2016 16:00:24 +0000 (01:00 +0900)]
sbin/hammer: Add clrpfs()

The one in getpfs() is okay to clear pfs_id with -1,
because scanpfsid() will overwrite pfs_id without using it.

It's also okay to clear the whole &pfs before init_pfsd().
This is actually better than not clearing header part.

7 years agopowerd - Detect power state changes
Matthew Dillon [Thu, 8 Sep 2016 23:02:07 +0000 (16:02 -0700)]
powerd - Detect power state changes

* The list of available frequencies changes when the power state changes,
  detect such changes and set parameters for all cpus verses making
  incremental changes.

* Fixes issue with powerd leaving the laptop running at a lower frequency
  when the laptop is unplugged and then plugged back in.

7 years agosys/vfs/hammer: Remove wrong comment
Tomohiro Kusumi [Thu, 8 Sep 2016 16:07:09 +0000 (01:07 +0900)]
sys/vfs/hammer: Remove wrong comment

This comment is true for other ioctls, but not for HAMMERIOC_SET_PSEUDOFS.

hammer_mkroot_pseudofs() uses this ip to make sure localization
equals that of PFS#0. In other words, a new PFS can only be created
under PFS#0.

7 years agosbin/hammer: Return -1 if readlink(2) failed
Tomohiro Kusumi [Thu, 8 Sep 2016 12:24:10 +0000 (21:24 +0900)]
sbin/hammer: Return -1 if readlink(2) failed

If the path is a link and readlink(2) failed, it shouldn't continue
with empty buf[].

7 years agosbin/hammer: Refactoring
Tomohiro Kusumi [Thu, 8 Sep 2016 12:22:44 +0000 (21:22 +0900)]
sbin/hammer: Refactoring

fd is < 0 only when both scanpfs() and open(2) failed.

7 years agocorepower: Fix identify method for multi-cpu-package systems
Sepherosa Ziehau [Thu, 8 Sep 2016 13:15:06 +0000 (21:15 +0800)]
corepower: Fix identify method for multi-cpu-package systems

CHIP_LEVEL means physical cpu package, while PACKAGE_LEVEL means
the whole box; admittedly it is kinda confusion to me at least.

7 years agoFix build with NO_OPENSSL set
John Marino [Thu, 8 Sep 2016 06:21:59 +0000 (01:21 -0500)]
Fix build with NO_OPENSSL set

In addition to several missing CFLAGS to point to the private libressl
headers, various issues related to libressl were fixed.  These were
exposed by setting NO_OPENSSL in make.conf (and they were obscured
when the compiler found the original openssl headers).

7 years agolibc - restir arc4random() on fork()
Matthew Dillon [Thu, 8 Sep 2016 06:09:12 +0000 (23:09 -0700)]
libc - restir arc4random() on fork()

* Fix an issue where the arc4random() function was not being re-stirred
  on a fork.

Reported-by: zrj
7 years agoRemove duplicate XAUTH_PATH handling
John Marino [Thu, 8 Sep 2016 03:01:46 +0000 (22:01 -0500)]
Remove duplicate XAUTH_PATH handling

The XAUTH_PATH definition and CFLAG are defined in Makefile.ssh.common
which in included by these two makefiles, so eliminate the redundant
versions.

Reported by: studbolt

7 years agouipc: Make sure that listen is completed.
Sepherosa Ziehau [Wed, 7 Sep 2016 10:54:24 +0000 (18:54 +0800)]
uipc: Make sure that listen is completed.

For unix socket, only HAVEPCCACHED really means the listen has been
completed.

Reported-by: dillon@
7 years agoSwitch base to use private LibreSSL libaries
John Marino [Wed, 7 Sep 2016 22:33:17 +0000 (17:33 -0500)]
Switch base to use private LibreSSL libaries

All base users of the OpenSSL libraries (libssl.so and libcrypto.so) have
been modified to link against the new LibreSSL versions instead.

The OpenSSL libraries are still built by default, but nothing in base will
use them.  However, its certain that a myriad of dports link to OpenSSL
although this may change in the future.

The OpenSSL library building can be suppressed by putting NO_OPENSSL in
/etc/make.conf.  The existing OpenSSL libraries and headers are not (yet)
removed, however, even with that setting.

7 years agoif_iwm - Sync valid_tx_ant and valid_rx_ant mask handling with iwlwifi.
Imre Vadász [Wed, 7 Sep 2016 21:21:54 +0000 (23:21 +0200)]
if_iwm - Sync valid_tx_ant and valid_rx_ant mask handling with iwlwifi.

* This fixes the phy_cfg field sent in the iwm_send_phy_cfg_cmd()
  command, which wasn't taking into account the valid_rx_ant and
  valid_tx_ant masks from nvm_data before.

7 years agoif_iwm - Use chipset configuration structs like iwlwifi does.
Imre Vadász [Tue, 6 Sep 2016 20:55:36 +0000 (22:55 +0200)]
if_iwm - Use chipset configuration structs like iwlwifi does.

* This makes it a bit easier to factor out common parts for e.g. the
  7000 chipset family.

* Add iwm7265d config, and recognize the 7265D chipset variant via the
  hardware revision.

7 years agoif_iwm - Use ic->ic_tq for iwm_endscan_cb instead of a private taskqueue.
Imre Vadász [Tue, 26 Jul 2016 17:34:08 +0000 (19:34 +0200)]
if_iwm - Use ic->ic_tq for iwm_endscan_cb instead of a private taskqueue.

Taken-From: FreeBSD (svn r303326)

7 years agopowerd - Add temperature-based management
Matthew Dillon [Wed, 7 Sep 2016 18:41:25 +0000 (11:41 -0700)]
powerd - Add temperature-based management

* Add temperature-based management, with a default range of 75:85 (in C).
  If the cpu temperature exceeds the low range, powerd will enter
  temperature control mode and begin ramping-down the cpu frequency
  regardless of the load in order to prevent the laptop from reaching
  the high range.

* Add -H lowtemp:hightemp option to allow the range to be set when
  starting or restarting powerd.

* Add code to automatically kill a previously-running powerd when a new
  powerd is started.  This makes the system operator's life easier as there
  is no need to hunt-down and kill the previously-running powerd when
  restarting it with new options.

* No desktop or server should ever get to 75C unless your cooling is broken,
  so this feature is primarily targetted at laptops.  Many laptops can exceed
  80C due to bad cooling design (and poor-design in general), and a vendor
  propensity to goose the specs to make their laptops look good on paper.
  Even the BIOS HOT cap tends to actually be too hot for continuous use.

  But it just isn't a good idea to exceed 80C regardless of what the specs
  say.  The laptop will last a lot longer and this reduces your chances of
  having melt-down or fire.  People who run BSD or Linux systems on laptops
  often do bulk compiles on them and/or other things, such as multiple
  browser windows, tabs, a lot of multi-media, multiple video windows,
  multiple video outputs, etc, which can utilize all available resources
  on the laptop.  Vendors usually don't take all of this into account.
  This feature can allow all of this to happen without burning the laptop
  up.

  You can also use this feature if your laptop gets too hot when sitting on
  your lap :-).

Tested-by: Multiple people.
7 years agocaesar(6): Mention rot13(6) too.
zrj [Wed, 7 Sep 2016 14:26:30 +0000 (17:26 +0300)]
caesar(6): Mention rot13(6) too.

Taken-from: FreeBSD

7 years agoWORLD_CCOPTLEVEL: Unbreak world at -O2
zrj [Wed, 7 Sep 2016 05:19:05 +0000 (08:19 +0300)]
WORLD_CCOPTLEVEL: Unbreak world at -O2

LibreSSL import, -fstrict-aliasing

7 years agokernel - Deal with lost IPIs (VM related) (2)
Matthew Dillon [Wed, 7 Sep 2016 01:09:14 +0000 (18:09 -0700)]
kernel - Deal with lost IPIs (VM related) (2)

* Fix an issue where Xinvltlb interacts badly with a drm console framebuffer,
  imploding the machine.  The 1/16 second watchdog can trigger during certain
  DRM operations due to excessive interrupt disablement in the linux DRM code.

* Avoid kprintf()ing anything by default.

* Also make a minor fix to the watchdog logic to force the higher-level
  Xinvltlb loop to re-test.

7 years agoAdd private versions of libcrypto and libssl (LibreSSL v2.4.2)
John Marino [Tue, 6 Sep 2016 16:06:42 +0000 (11:06 -0500)]
Add private versions of libcrypto and libssl (LibreSSL v2.4.2)

Unless NO_LIBRESSL is defined in make.conf, the next buildworld
will install headers at /usr/include/priv/openssl.  Four new
libraries will be install here:
  /lib/priv/libprivate_crypto.so.38
  /lib/priv/libprivate_ssl.so.39
  /usr/lib/priv/libprivate_crypto.a
  /usr/lib/priv/libprivate_ssl.a
The symlinks are installed:
  /usr/lib/priv/libprivate_crypro.so
  /usr/lib/priv/libprivate_ssl.so

Right now, nothing in userland links to these libraries.  In the
future, the userland will be linked to these LibreSSL private
libraries instead of the base OpenSSL libraries.

7 years agoMerge branch 'vendor/LIBRESSL'
John Marino [Tue, 6 Sep 2016 16:03:50 +0000 (11:03 -0500)]
Merge branch 'vendor/LIBRESSL'

7 years agoif_iwm - Sync nvm parsing code with Linux iwlwifi.
Imre Vadász [Tue, 6 Sep 2016 18:37:05 +0000 (20:37 +0200)]
if_iwm - Sync nvm parsing code with Linux iwlwifi.

* sc->sc_nvm becomes sc->nvm_data and is now a pointer instead of an
  inlined struct.

* Add sc->eeprom_size and sc->nvm_hw_section_num configuration values to
  struct iwm_softc.

* For now continue to avoid negative error return-values, and use pointer
  variables for some return values, as before.

* Continue to omit LAR (location aware regulatory) related code as well.

7 years agoImport LibreSSL v2.4.2 to vendor branch
John Marino [Tue, 6 Sep 2016 16:00:43 +0000 (11:00 -0500)]
Import LibreSSL v2.4.2 to vendor branch

7 years agobcd(6): Add decoding option and few extras.
zrj [Tue, 6 Sep 2016 13:35:45 +0000 (16:35 +0300)]
bcd(6): Add decoding option and few extras.

While there, do the same for ppt(6).

Taken-from: OpenBSD

7 years agosys/vfs/hammer: Change HAMMER_VOLUME_NUMBER_XXX macros to inline functions
Tomohiro Kusumi [Tue, 6 Sep 2016 10:56:44 +0000 (19:56 +0900)]
sys/vfs/hammer: Change HAMMER_VOLUME_NUMBER_XXX macros to inline functions

I've added these macros in 78249d7f in 2015 for a bug fix,
but these macros should have been inline functions.
Not very readable.

7 years agosbin/hammer: Use inline CRC functions in userspace
Tomohiro Kusumi [Mon, 5 Sep 2016 14:45:34 +0000 (23:45 +0900)]
sbin/hammer: Use inline CRC functions in userspace

Remove crc32 prototypes in sbin/hammer/hammer_util.h.
Remove hammer_crc_test_leaf() which is a copy-pasted function
from kernel code.

7 years agosys/vfs/hammer: Add sys/vfs/hammer/hammer_crc.h
Tomohiro Kusumi [Mon, 5 Sep 2016 14:34:53 +0000 (23:34 +0900)]
sys/vfs/hammer: Add sys/vfs/hammer/hammer_crc.h

HAMMER's CRC functions currently defined in sys/vfs/hammer/hammer.h
could be exposed to userspace, since CRCs in various ondisk data
structures are a part of HAMMER's ondisk format. In fact, userspace
has a copy-pasted function from kernel code.

This commit adds a new file sys/vfs/hammer/hammer_crc.h for both
kernel and userspace. CRC functions are moved to this file.

The reason for adding a new file instead of adding these inlined
functions to hammer_{disk,btree,ioctl}.h is because crc32() requires
explicit function prototype in userspace.
(i.e. causes include order issues by userspace headers)

Having function prototypes in hammer_{disk,btree}.h should also be
avoided, because that brings in unnecessary dependencies that could
be avoided for headers for ondisk format.

7 years agokernel - Deal with lost IPIs (VM related)
Matthew Dillon [Tue, 6 Sep 2016 00:11:05 +0000 (17:11 -0700)]
kernel - Deal with lost IPIs (VM related)

* Some (all?) VMs appear to be able to lose IPIs.  Hopefully the same can't
  be said for device interrupts!  Add some recovery code for lost Xinvltlb
  IPIs for now.

  For synchronizing invalidations we use the TSC and run a recovery attempt
  after 1/16 second, and every 1 second there-after, if an Xinvltlb is not
  responded to (smp_invltlb() and smp_invlpg()).  The IPI will be re-issued.

* Some basic testing shows that a VM can stall out a cpu thread for an
  indefinite period of time, potentially causing the above watchdog to
  trigger.  Even so it should not have required re-issuing the IPI, but
  it seems it does, so the VM appears to be losing the IPI(!) when a cpu
  thread stalls out on the host!  At least with the VM we tested under,
  type unknown.

* IPIQ IPIs currently do not have any specific recovery but I think each
  cpu will poll for IPIQs slowly in the idle thread, so they might
  automatically recover anyway.

Reported-by: zach
7 years agoif_iwm - Make sure we call iwm_detach_local only once.
Imre Vadász [Mon, 5 Sep 2016 20:48:56 +0000 (22:48 +0200)]
if_iwm - Make sure we call iwm_detach_local only once.

* Add sc_attached variable to struct iwm_softc, to keep track of whether
  we already called iwm_detach_local.

7 years agoif_iwm - Remove calib_version field from struct iwm_nvm_data.
Imre Vadász [Mon, 5 Sep 2016 16:00:13 +0000 (18:00 +0200)]
if_iwm - Remove calib_version field from struct iwm_nvm_data.

* This value is only used for dvm devices in Linux iwlwifi.

7 years agoif_iwm - Sync iwm_nvm_read_chunk() function with Linux iwlwifi.
Imre Vadász [Sun, 4 Sep 2016 23:14:02 +0000 (01:14 +0200)]
if_iwm - Sync iwm_nvm_read_chunk() function with Linux iwlwifi.

7 years agoif_iwm - Sync if_iwm_phy_db code with Linux iwlwifi.
Imre Vadász [Sun, 4 Sep 2016 22:43:40 +0000 (00:43 +0200)]
if_iwm - Sync if_iwm_phy_db code with Linux iwlwifi.

* DragonFly requires NULL checks before kfree(9) calls.

7 years agoif_iwm - Remove some unneeded #include-s from all .c files.
Imre Vadász [Sun, 4 Sep 2016 20:19:55 +0000 (22:19 +0200)]
if_iwm - Remove some unneeded #include-s from all .c files.

7 years agokernel - Fix indefinite wait buffer during heavy swapping
Matthew Dillon [Mon, 5 Sep 2016 19:33:42 +0000 (12:33 -0700)]
kernel - Fix indefinite wait buffer during heavy swapping

* Fix a deadlock which can occur between CAM and the VM system due to
  a bug in uiomove_nofault() when called via vop_helper_read_shortcut().

  If the backing store is swapped out, vm_fault()/vm_fault_object() attempts
  to page the data in instead of telling uiomove_nofault() to give up.
  This can result in a deadlock against the underlying vm_page's in the
  file that might already be undergoing I/O.

* Probably also reported by other people over the years, but could never
  track it down until now.

Reported-by: Studbolt
7 years agofortune(6): Fix some typos in the datfiles.
Sascha Wildner [Mon, 5 Sep 2016 17:37:42 +0000 (19:37 +0200)]
fortune(6): Fix some typos in the datfiles.

7 years agofortune(6): Add new fortunes from FreeBSD
zrj [Mon, 5 Sep 2016 14:23:51 +0000 (17:23 +0300)]
fortune(6): Add new fortunes from FreeBSD

Tried to avoid dups.
While there, move few fortunes that were deemed non offencive.

Taken-from: FreeBSD