]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
6 years agoUse C99 boolean type for translate_osrel
Ed Maste [Tue, 13 Mar 2018 16:40:29 +0000 (16:40 +0000)]
Use C99 boolean type for translate_osrel

Migrate to modern types before creating MD Linuxolator bits for new
architectures.

Reviewed by: cem
Sponsored by: Turing Robotic Industries Inc.
Differential Revision: https://reviews.freebsd.org/D14676

6 years agoPrefer uintXX_t to u_intXX_t
Warner Losh [Tue, 13 Mar 2018 16:33:00 +0000 (16:33 +0000)]
Prefer uintXX_t to u_intXX_t

A foolish consistency is the hobgoblin of little minds, adored by
little statesmen and philosophers and divines. With consistency a
great soul has simply nothing to do. -- Ralph Waldo Emerson

6 years agoAdd some argument checks to be more user-friendly.
Alexander Motin [Tue, 13 Mar 2018 15:29:13 +0000 (15:29 +0000)]
Add some argument checks to be more user-friendly.

MFC after: 2 weeks
Sponsored by: iXsystems, Inc.

6 years agoExecute PowerPC64/AIM kernel from direct map region when possible.
Nathan Whitehorn [Tue, 13 Mar 2018 15:03:58 +0000 (15:03 +0000)]
Execute PowerPC64/AIM kernel from direct map region when possible.

When the kernel can be in real mode in early boot, we can execute from
high addresses aliased to the kernel's physical memory. If that high
address has the first two bits set to 1 (0xc...), those addresses will
automatically become part of the direct map. This reduces page table
pressure from the kernel and it sets up the kernel to be used with
radix translation, for which it has to be up here.

This is accomplished by exploiting the fact that all PowerPC kernels are
built as position-independent executables and relocate themselves
on start. Before this patch, the kernel runs at 1:1 VA:PA, but that
VA/PA is random and set by the bootloader. Very early, it processes
its ELF relocations to operate wherever it happens to find itself.
This patch uses that mechanism to re-enter and re-relocate the kernel
a second time witha new base address set up in the early parts of
powerpc_init().

Reviewed by: jhibbits
Differential Revision: D14647

6 years agoCorrect minor typo in comment, efi_dmcap -> efi_tmcap
Kyle Evans [Tue, 13 Mar 2018 15:02:46 +0000 (15:02 +0000)]
Correct minor typo in comment, efi_dmcap -> efi_tmcap

6 years agoefirtc: Pass a dummy tmcap pointer to efi_get_time_locked
Kyle Evans [Tue, 13 Mar 2018 15:01:23 +0000 (15:01 +0000)]
efirtc: Pass a dummy tmcap pointer to efi_get_time_locked

As noted in the comment, UEFI spec claims the capabilities pointer is
optional, but some implementations will choke and attempt to dereference it
without checking. This specific problem was found on a Lenovo Thinkpad X220
that would panic in efirtc_identify.

6 years agoUse C99 designated initializers for struct execsw
Ed Maste [Tue, 13 Mar 2018 13:09:10 +0000 (13:09 +0000)]
Use C99 designated initializers for struct execsw

It it makes use slightly more clear and facilitates grepping.

6 years agobiosdisk.c should not set d_opendata.
Toomas Soome [Tue, 13 Mar 2018 09:58:29 +0000 (09:58 +0000)]
biosdisk.c should not set d_opendata.

Same as 330807, d_opendata is owned by open_disk and we should not
set it.

M    stand/i386/libi386/biosdisk.c

6 years agoat_rtc: check in ACPI FADT boot flags if the RTC is present
Roger Pau Monné [Tue, 13 Mar 2018 09:42:33 +0000 (09:42 +0000)]
at_rtc: check in ACPI FADT boot flags if the RTC is present

Or else disable the device. Note that the detection can be bypassed by
setting the hw.atrtc.enable option in the loader configuration file.
More information can be found on atrtc(4).

Sponsored by: Citrix Systems R&D
Reviewed by: ian
Differential revision: https://reviews.freebsd.org/D14399

6 years agovt_vga: check if VGA is available from ACPI FADT table
Roger Pau Monné [Tue, 13 Mar 2018 09:38:53 +0000 (09:38 +0000)]
vt_vga: check if VGA is available from ACPI FADT table

On x86 the IA-PC Boot Flags in the FADT can signal whether VGA is
available or not.

Sponsored by: Citrix systems R&D
Reviewed by: marcel
Differential revision: https://reviews.freebsd.org/D14397

6 years agoAdd `nvmecontrol format` subcommand.
Alexander Motin [Tue, 13 Mar 2018 03:02:09 +0000 (03:02 +0000)]
Add `nvmecontrol format` subcommand.

It allows to change namespace parameters, such as block size, metadata,
protection information, etc. and/or erase the data.

MFC after: 2 weeks
Sponsored by: iXsystems, Inc.

6 years agolualoader: Sprinkle some verbose_loading salt
Kyle Evans [Tue, 13 Mar 2018 02:59:13 +0000 (02:59 +0000)]
lualoader: Sprinkle some verbose_loading salt

Our module loading messages should be hidden without verbose_loading -- go
ahead and do that as a first step.

6 years agoApply some style(9) to Linuxulator linux_sysvec.c comments
Ed Maste [Tue, 13 Mar 2018 00:40:05 +0000 (00:40 +0000)]
Apply some style(9) to Linuxulator linux_sysvec.c comments

6 years agoimgact_linux.c: use standard indentation
Ed Maste [Mon, 12 Mar 2018 23:28:25 +0000 (23:28 +0000)]
imgact_linux.c: use standard indentation

Sponsored by: Turing Robotic Industries Inc.

6 years agoUse the stack for temporary storage in OTIOCCONS.
Brooks Davis [Mon, 12 Mar 2018 23:04:42 +0000 (23:04 +0000)]
Use the stack for temporary storage in OTIOCCONS.

The old code used the thread's pcb via the uap->data pointer.

Reviewed by: ed
Approved by: CheriBSD
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D14674

6 years agoReject ioctls to SCSI enclosures from 32-bit compat processes.
Brooks Davis [Mon, 12 Mar 2018 23:02:01 +0000 (23:02 +0000)]
Reject ioctls to SCSI enclosures from 32-bit compat processes.

The ioctl objects contain pointers and require translation and some
refactoring of the infrastructure to work. For now prevent opertion
on garbage values. This is very slightly overbroad in that ENCIOC_INIT
is safe.

Reviewed by: imp, kib
Obtained from: CheriBSD
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D14671

6 years agoReject CAMIOGET and CAMIOQUEUE ioctl's on pass(4) in 32-bit compat mode.
Brooks Davis [Mon, 12 Mar 2018 22:58:07 +0000 (22:58 +0000)]
Reject CAMIOGET and CAMIOQUEUE ioctl's on pass(4) in 32-bit compat mode.

These take a union ccb argument which is full of kernel pointers.
Substantial translation efforts would be required to make this work.
By rejecting the request we avoid processing or returning entierly
wrong data.

Reviewed by: imp, ken, markj, cem
Obtained from: CheriBSD
MFC after: 1 week
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D14654

6 years agoMIPS: Implement fue*word* and casueword* in assembly.
Brooks Davis [Mon, 12 Mar 2018 22:10:06 +0000 (22:10 +0000)]
MIPS: Implement fue*word* and casueword* in assembly.

Remove NO_FUEWORD so the 'e' variants are wrapped by the non-'e'
variants.  This is more correct and leaves sparc64 as the outlier.

Reviewed by: jmallett, kib
Obtained from: CheriBSD
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D14603

6 years agoPrint the load and device path as well as BootCurrent and BootOrder
Warner Losh [Mon, 12 Mar 2018 21:40:24 +0000 (21:40 +0000)]
Print the load and device path as well as BootCurrent and BootOrder

Sponsored by: Netflix

6 years agoStar BootCurrent entry when booting.
Warner Losh [Mon, 12 Mar 2018 21:40:19 +0000 (21:40 +0000)]
Star BootCurrent entry when booting.

Sponsored by: Netflix

6 years agoMove the env convenience routines out of boot1.c.
Warner Losh [Mon, 12 Mar 2018 21:40:14 +0000 (21:40 +0000)]
Move the env convenience routines out of boot1.c.

These routines are more generally useful. Even though boot1 is on its
way out, it's better to make these common during the transition than
copy them.

6 years agoUse the one-line-per-file pattern here, and sort the file names.
Warner Losh [Mon, 12 Mar 2018 21:40:09 +0000 (21:40 +0000)]
Use the one-line-per-file pattern here, and sort the file names.

Sponsored by: Netflix

6 years agoGC unused routines.
Warner Losh [Mon, 12 Mar 2018 21:40:05 +0000 (21:40 +0000)]
GC unused routines.

Sponsored by: Netflix

6 years agoRemove d_type from devdesc. It's not needed as we can fetch it from
Warner Losh [Mon, 12 Mar 2018 21:39:59 +0000 (21:39 +0000)]
Remove d_type from devdesc. It's not needed as we can fetch it from
d_dev->dv_type when we need it.

6 years agoUse the actual struct devdesc at the start of all *_devdesc structs
Warner Losh [Mon, 12 Mar 2018 21:39:49 +0000 (21:39 +0000)]
Use the actual struct devdesc at the start of all *_devdesc structs

The current system is fragile and requires very careful layout of all
*_devdesc structures. It also makes it hard to change the base
devdesc. Take a page from CAM and put the 'header' in all the derived
classes and adjust the code to match.

For OFW, move the iHandle h_handle out of a slot conflicting with
d_opendata. Due to quirks in the alignment rules, this worked.
However changing the code to use d_opendata storage now that it's a
pointer is hard, so just have a separate field for it.

All other cleanups were to make the *_devdesc structures match where
they'd taken some liberties that were none-the-less compatible enough
to work.

6 years agoMake struct libi386_devdesc match the struct devdesc better
Warner Losh [Mon, 12 Mar 2018 21:39:42 +0000 (21:39 +0000)]
Make struct libi386_devdesc match the struct devdesc better

Move data to top and call it d_opendata.

6 years agoWe can't use d_opendata for blkio storage.
Warner Losh [Mon, 12 Mar 2018 21:39:38 +0000 (21:39 +0000)]
We can't use d_opendata for blkio storage.

open_disk uses d_opendata for it's own purpse. We can't store blkio
there. Fortunately, blkio is stored elsewhere and we never actually
retrieve blkio from d_opendata. Eliminate it as a source of confusion.
Eliminate all stores of d_opendata in efi since this layer doesn't own
that field.

6 years agoMinor cosmetic changes.
Warner Losh [Mon, 12 Mar 2018 21:39:27 +0000 (21:39 +0000)]
Minor cosmetic changes.

Make sure { on the same line as struct for all struct *devdesc.  Move
some type definitions to next to the dv_type define, since that's what
sets the d_type.

6 years agoe1000g: this statement may fall through
Toomas Soome [Mon, 12 Mar 2018 17:05:53 +0000 (17:05 +0000)]
e1000g: this statement may fall through

The gcc 7 does check for switch statement fall through cases, and if legit,
such complaint can besilenced by /* FALLTHROUGH */ comment. Unfortunately
such comment is quite limited, but will still notify the reader.

This patch is backport from illumos, see
https://www.illumos.org/rb/r/941/

Reviewed by: eadler
Differential Revision: https://reviews.freebsd.org/D14663

6 years agoPrint fuses and fna fields in identify data.
Alexander Motin [Mon, 12 Mar 2018 16:31:25 +0000 (16:31 +0000)]
Print fuses and fna fields in identify data.

MFC after: 2 weeks
Sponsored by: iXsystems, Inc.

6 years agoANSIfy sys/kern/imgact_*
Ed Maste [Mon, 12 Mar 2018 15:45:50 +0000 (15:45 +0000)]
ANSIfy sys/kern/imgact_*

6 years agoLinuxulator: apply style(9) to return
Ed Maste [Mon, 12 Mar 2018 15:35:24 +0000 (15:35 +0000)]
Linuxulator: apply style(9) to return

Sponsored by: Turing Robotic Industries Inc.

6 years agoGive the atrtc_time_lock a unique name.
Ian Lepore [Mon, 12 Mar 2018 15:26:11 +0000 (15:26 +0000)]
Give the atrtc_time_lock a unique name.

Reported by: hps@

6 years agoTighten up periph lock to avoid some races
Warner Losh [Mon, 12 Mar 2018 15:17:16 +0000 (15:17 +0000)]
Tighten up periph lock to avoid some races

Make sure the periph lock is held around rmw access to softc data,
espeically flags, including work flags in iosched.
Add asserts for the periph lock where it should be held.

PR: 226510
Sponsored by: Netflix
Differential Review: https://reviews.freebsd.org/D14456

6 years agoThe vmresult table was missing most of the values apart from two due to
Bjoern A. Zeeb [Mon, 12 Mar 2018 13:32:51 +0000 (13:32 +0000)]
The vmresult table was missing most of the values apart from two due to
extra "_" in the names we grep for. Add the "_" to the pattern.

Reviewed by: jhb
MFC after: 3 days
Sponsored by: iXsystems, Inc.

6 years agofix r297857, do not modify CPU extension bits under virtual machines
Andriy Gapon [Mon, 12 Mar 2018 11:28:09 +0000 (11:28 +0000)]
fix r297857, do not modify CPU extension bits under virtual machines

r297857 was meant for real hardware only.

PR: 213155
Submitted by: mainland@apeiron.net
MFC after: 1 week

6 years agoDo not try to reassemble IPv6 fragments in "reass" rule.
Andrey V. Elsukov [Mon, 12 Mar 2018 09:40:46 +0000 (09:40 +0000)]
Do not try to reassemble IPv6 fragments in "reass" rule.

ip_reass() expects IPv4 packet and will just corrupt any IPv6 packets
that it gets. Until proper IPv6 fragments handling function will be
implemented, pass IPv6 packets to next rule.

PR: 170604
MFC after: 1 week

6 years agoImplement NO_WCAST_QUAL for gcc4.2 architectures
Conrad Meyer [Mon, 12 Mar 2018 05:41:27 +0000 (05:41 +0000)]
Implement NO_WCAST_QUAL for gcc4.2 architectures

6 years agoAdd a new 'debug' command tree and 'dump_reqs' command to grab and parse
Scott Long [Mon, 12 Mar 2018 05:03:32 +0000 (05:03 +0000)]
Add a new 'debug' command tree and 'dump_reqs' command to grab and parse
command and chain frames of in-flight I/O from the driver.

Sponsored by: Netflix

6 years agoImplement a sysctl to dump in-flight I/O state for debugging. The tool to
Scott Long [Mon, 12 Mar 2018 05:02:22 +0000 (05:02 +0000)]
Implement a sysctl to dump in-flight I/O state for debugging.  The tool to
parse it will be committed in a separate action.

Sponsored by: Netflix

6 years agoberi loader: Replace getc/putc with beri_ prefixed versions
Kyle Evans [Mon, 12 Mar 2018 03:54:38 +0000 (03:54 +0000)]
beri loader: Replace getc/putc with beri_ prefixed versions

This matches a convention that we use, at least in ubldr, to prefix
getc/putc with a loader-specific prefix to avoid collisions. This was
encountered while trying to build the beri loader with MK_LOADER_LUA=yes.

No objection from: brooks
Reported by: emaste

6 years agoFix the resource leak of a 'FILE *' which could happen in routine
Garance A Drosehn [Mon, 12 Mar 2018 01:41:16 +0000 (01:41 +0000)]
Fix the resource leak of a 'FILE *' which could happen in routine
ctl_readcf() if a call to malloc failed.

PR: 204955
Reported by: David Binderman

6 years agoarm: Remove SoC Specific -MMCCAM kernelconfig
Emmanuel Vadot [Sun, 11 Mar 2018 23:14:50 +0000 (23:14 +0000)]
arm: Remove SoC Specific -MMCCAM kernelconfig

One should use the GENERIC-MMCCAM for this.

6 years agoRevert r330780, it was improperly tested and results in taking a spin
Ian Lepore [Sun, 11 Mar 2018 20:13:15 +0000 (20:13 +0000)]
Revert r330780, it was improperly tested and results in taking a spin
mutex before acquiring sleep mutexes.

Reported by: kib@

6 years agoRemove MTX_NOPROFILE from atrtc_lock, it was inappropriately copy/pasted
Ian Lepore [Sun, 11 Mar 2018 19:56:07 +0000 (19:56 +0000)]
Remove MTX_NOPROFILE from atrtc_lock, it was inappropriately copy/pasted
from the i8254 driver when I created separate mutexes for each.  The i8254
driver could be the active timecounter, leading to recursion during mutex
profiling, but the atrtc driver cannot be a timecounter, so it isn't needed.

6 years agoUpdate pfkey_open() function to set socket's write buffer size to
Andrey V. Elsukov [Sun, 11 Mar 2018 19:26:34 +0000 (19:26 +0000)]
Update pfkey_open() function to set socket's write buffer size to
128k and receive buffer size to 2MB. In case if system has bigger
default values, do not lower them.

This should partially solve the problem, when setkey(8) returns
EAGAIN error on systems with many SAs or SPs.

PR: 88336
Obtained from: NetBSD/ipsec-tools
MFC after: 2 weeks

6 years agoEliminate atrtc_time_lock, and use atrtc_lock for efirtc locking.
Ian Lepore [Sun, 11 Mar 2018 19:22:58 +0000 (19:22 +0000)]
Eliminate atrtc_time_lock, and use atrtc_lock for efirtc locking.

6 years agoRework key_sendup_mbuf() a bit:
Andrey V. Elsukov [Sun, 11 Mar 2018 19:14:01 +0000 (19:14 +0000)]
Rework key_sendup_mbuf() a bit:

o count in_nomem counter when we have failed to allocate mbuf for
  promisc socket;
o count in_msgtarget counter when we have secussfully sent data to socket;
o Since we are sending messages in a loop, returning error on first fail
  interrupts the loop, and all remaining sockets will not receive this
  message. So, do not return error when we have failed to send data to ALL
  or REGISTERED target. Return error only for KEY_SENDUP_ONE case. Now,
  when some socket has overfilled its receive buffer, this will not break
  other sockets.

MFC after: 2 weeks

6 years agoEverywhere that multiple registers are accessed in sequence, lock/unlock
Ian Lepore [Sun, 11 Mar 2018 18:54:45 +0000 (18:54 +0000)]
Everywhere that multiple registers are accessed in sequence, lock/unlock
just once around the whole group of accesses.

6 years agoAdd KASSERT to check that proper targed was used.
Andrey V. Elsukov [Sun, 11 Mar 2018 18:46:40 +0000 (18:46 +0000)]
Add KASSERT to check that proper targed was used.

MFC after: 2 weeks

6 years agoReplace panic() with KASSERTs.
Andrey V. Elsukov [Sun, 11 Mar 2018 18:37:55 +0000 (18:37 +0000)]
Replace panic() with KASSERTs.

MFC after: 2 weeks

6 years agoUse separate mutexes for atrtc and i8254 locking. Change all the strange
Ian Lepore [Sun, 11 Mar 2018 18:20:49 +0000 (18:20 +0000)]
Use separate mutexes for atrtc and i8254 locking.  Change all the strange
un-function-like RTC_LOCK/UNLOCK macro usage into normal function calls.
Since there is no longer any need to handle register access from a debugger
context, those function calls can just be regular mutex lock/unlock calls.

Requested by:  bde

6 years agoCheck that we have PF_KEY sockets before iterating over all RAW sockets.
Andrey V. Elsukov [Sun, 11 Mar 2018 18:10:59 +0000 (18:10 +0000)]
Check that we have PF_KEY sockets before iterating over all RAW sockets.

MFC after: 2 weeks

6 years agoRemove obsoleted and unused key_sendup() function.
Andrey V. Elsukov [Sun, 11 Mar 2018 18:03:55 +0000 (18:03 +0000)]
Remove obsoleted and unused key_sendup() function.
Also remove declaration for nonexistend key_usrreq() function.

MFC after: 2 weeks

6 years agoAdd myself (fernape) to calendar.freebsd
Fernando Apesteguía [Sun, 11 Mar 2018 17:21:48 +0000 (17:21 +0000)]
Add myself (fernape) to calendar.freebsd

As indicated in Committers guide Chapter 6, point 9
"Optional: Update Ports with Personal Information"

Approved by: tcberner
Differential Revision: https://reviews.freebsd.org/D14653

6 years agoConvert atrtc the new style rtc debugging output. Remove the db show
Ian Lepore [Sun, 11 Mar 2018 16:57:14 +0000 (16:57 +0000)]
Convert atrtc the new style rtc debugging output.  Remove the db show
command handler which provided much the same information.  Removing the
possibility of accessing the hardware regs from the debugger context
paves the way for simplifying the locking code in the driver.

6 years agoRemove obsolete pcaudioio.h.
Brooks Davis [Sun, 11 Mar 2018 16:17:53 +0000 (16:17 +0000)]
Remove obsolete pcaudioio.h.

Nothing uses the #define's values or the types.  (Some NTP code does use
an audio_info_t, but it is in #ifdef'd support for Solaris and is not
this audio_info_t).

Sponsored by: DARPA, AFRL

6 years agoAdd myself (fernape) to commiters-port.dot
Fernando Apesteguía [Sun, 11 Mar 2018 10:47:40 +0000 (10:47 +0000)]
Add myself (fernape) to commiters-port.dot

Approved by: tcberner (mentor)
Differential Revision: https://reviews.freebsd.org/D14639

6 years agoAdd CR2 get/set support.
Peter Grehan [Sun, 11 Mar 2018 08:27:11 +0000 (08:27 +0000)]
Add CR2 get/set support.

Reported/Tested by:  Fabian Freyer
Reviewed by: araujo
Differential Revision: https://reviews.freebsd.org/D14648
MFC after: 3 weeks

6 years agosorry for that. Fix next typo
Jochen Neumeister [Sun, 11 Mar 2018 08:07:40 +0000 (08:07 +0000)]
sorry for that. Fix next typo

Pointy hat to: joneum

6 years agoFix typo
Jochen Neumeister [Sun, 11 Mar 2018 08:02:14 +0000 (08:02 +0000)]
Fix typo

Reported by: tcberner

6 years agoAdd myself to committers-ports.dot
Jochen Neumeister [Sun, 11 Mar 2018 07:33:49 +0000 (07:33 +0000)]
Add myself to committers-ports.dot

6 years agoAdd new opcodes and statuses from NVMe 1.3a.
Alexander Motin [Sun, 11 Mar 2018 06:30:09 +0000 (06:30 +0000)]
Add new opcodes and statuses from NVMe 1.3a.

MFC after: 2 weeks
Sponsored by: iXsystems, Inc.

6 years agoAdd new identify data structures fields from NVMe 1.3a.
Alexander Motin [Sun, 11 Mar 2018 05:09:02 +0000 (05:09 +0000)]
Add new identify data structures fields from NVMe 1.3a.

Some of them are already supported by existing hardware, so reporting
them `nvmecontrol identify` can be useful.

6 years agoextres/regulators: Add sysctls for regulators
Emmanuel Vadot [Sun, 11 Mar 2018 04:37:05 +0000 (04:37 +0000)]
extres/regulators: Add sysctls for regulators

For each regulators create an hw.regulator.<regname>. :
uvolt: Current value
always_on: 1 If the reg is always on
boot_on: 1 If the reg is set at boot time
enable_cnt: Number of consumer(s)
enable_delay: Delay before enabling the regulator
ramp_delay: The Ramp delay
max_uamp: The maximum value of the regulator in uAmps
min_uamp: The minimal value of the regulator in uAmps
max_uvolt: The maximum value of the regulator in uVolts
min_uvolt: The minimal value of the regulator in uVolts

Reviewed by: ian
Differential Revision: https://reviews.freebsd.org/D14578

6 years agostand/interp_lua: correct errorr => error
Kyle Evans [Sun, 11 Mar 2018 04:10:18 +0000 (04:10 +0000)]
stand/interp_lua: correct errorr => error

6 years agoallwinner: Add IR clock to sun8i
Emmanuel Vadot [Sun, 11 Mar 2018 04:01:23 +0000 (04:01 +0000)]
allwinner: Add IR clock to sun8i

Add ir clock definition to sun8i-r-ccu.
No idea if it's working but aw_cir seems happy now and the frequency
is set to 3Mhz as it should.

6 years agoMake FDT-using parts of ofw_machdep.c condition on options FDT. This fixes
Nathan Whitehorn [Sun, 11 Mar 2018 01:09:31 +0000 (01:09 +0000)]
Make FDT-using parts of ofw_machdep.c condition on options FDT. This fixes
the kernel build when options FDT is absent.

6 years agootus(4): check mcast / mgt / ucast rates during Tx descriptor setup
Andriy Voskoboinyk [Sun, 11 Mar 2018 00:38:08 +0000 (00:38 +0000)]
otus(4): check mcast / mgt / ucast rates during Tx descriptor setup

These parameters may be changed via ifconfig(8); by default,
mgt / mcast rates are lowest possible and ucast rate is not set
(matches previous configuration).

While here, store some variables locally for better readability.

6 years agortwn(4): reset Tx power values before calling get_txpower()
Andriy Voskoboinyk [Sat, 10 Mar 2018 23:47:03 +0000 (23:47 +0000)]
rtwn(4): reset Tx power values before calling get_txpower()
for RTL8192C / RTL8188E (like it is done for other chipsets).

6 years agousb/wlan/*: properly include "opt_wlan.h" into all drivers
Andriy Voskoboinyk [Sat, 10 Mar 2018 23:16:24 +0000 (23:16 +0000)]
usb/wlan/*: properly include "opt_wlan.h" into all drivers

Without it driver cannot be loaded when wlan(4) module is built with
'options IEEE80211_DEBUG_REFCNT'.

6 years agorun(4): drop few unused variables.
Andriy Voskoboinyk [Sat, 10 Mar 2018 22:52:39 +0000 (22:52 +0000)]
run(4): drop few unused variables.

Found by: Clang static analyzer

6 years agoMake root mount timeout logic work for filesystems other than ufs.
Ian Lepore [Sat, 10 Mar 2018 22:07:57 +0000 (22:07 +0000)]
Make root mount timeout logic work for filesystems other than ufs.

The vfs.mountroot.timeout tunable and .timeout directive in a mount.conf(5)
file allow specifying a wait timeout for the device(s) hosting the root
filesystem to become usable.  The current mechanism for waiting for devices
and detecting their availability can't be used for zfs-hosted filesystems.
See the comment #20 in the PR for some expanded detail on these points.

This change adds retry logic to the actual root filesystem mount.  That is,
insted of relying on device availability using device name lookups, it uses
the kernel_mount() call itself to detect whether the filesystem can be
mounted, and loops until it succeeds or the configured timeout is exceeded.

These changes are based on the patch attached to the PR, but it's rewritten
enough that all mistakes belong to me.

PR: 208882
X-MFC after: sufficient testing, and hopefully in time for 11.1

6 years agoDon't warn when the "hostname" rc variable is unset, but the hostname
Jamie Gritton [Sat, 10 Mar 2018 20:13:07 +0000 (20:13 +0000)]
Don't warn when the "hostname" rc variable is unset, but the hostname
is already non-empty (common in jails).

6 years agotftpd: fix the build of tests on i386 after 330696
Alan Somers [Sat, 10 Mar 2018 18:07:31 +0000 (18:07 +0000)]
tftpd: fix the build of tests on i386 after 330696

It's those darn printf format specifiers again

Reported by: cy, kibab
MFC after: 20 days
X-MFC-With: 330696

6 years agoMake iscsictl(1) display "Disabled" status for disabled sessions.
Edward Tomasz Napierala [Sat, 10 Mar 2018 14:33:00 +0000 (14:33 +0000)]
Make iscsictl(1) display "Disabled" status for disabled sessions.

MFC after: 2 weeks

6 years agoCheck for duplicates when modifying an iSCSI session. Previously we did
Edward Tomasz Napierala [Sat, 10 Mar 2018 14:21:37 +0000 (14:21 +0000)]
Check for duplicates when modifying an iSCSI session.  Previously we did
this check on open, but "iscsictl -M", or an iSCSI redirect received by
iscsid(8) could end up with two sessions with the same target name and
portal.

MFC after: 2 weeks

6 years ago[rpi] remove IRQ support for BCM233x RNG
Oleksandr Tymoshenko [Sat, 10 Mar 2018 02:49:58 +0000 (02:49 +0000)]
[rpi] remove IRQ support for BCM233x RNG

Upstream DTBs don't provide IRQ lines for the RNG. Moreover, harvesting
bytes as often as the RNG interrupt is triggered (87 times per sec) is an
overkill.

For these reasons, get rid of the interrupt mode and make callout mode the
default, with random bits harvested every 4 seconds.

Submitted by: Sylvain Garrigues <sylgar@gmail.com>
Reviewed by: ian, imp, manu, mmel
Approved by: emaste
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D14541

6 years agoFix rebase mismerge in r330724.
Bryan Drewery [Sat, 10 Mar 2018 02:13:48 +0000 (02:13 +0000)]
Fix rebase mismerge in r330724.

X-MFC-With: r330724
MFC after: 2 weeks
Sponsored by: Dell EMC

6 years agoDon't skip reading depend for 'make obj' unless it is alone.
Bryan Drewery [Sat, 10 Mar 2018 02:10:26 +0000 (02:10 +0000)]
Don't skip reading depend for 'make obj' unless it is alone.

This was effectively done in bsd.dep.mk quite some time ago.

MFC after: 2 weeks
Sponsored by: Dell EMC

6 years agoSkip reading depend files with -V unless looking up a depend variable.
Bryan Drewery [Sat, 10 Mar 2018 02:10:19 +0000 (02:10 +0000)]
Skip reading depend files with -V unless looking up a depend variable.

This speeds up some simple -V lookups significantly.

Reported by: bde
MFC after: 2 weeks
Sponsored by: Dell EMC

6 years agoReduce overhead for simple 'make -V' lookups by avoiding 'find sys/'.
Bryan Drewery [Sat, 10 Mar 2018 02:09:36 +0000 (02:09 +0000)]
Reduce overhead for simple 'make -V' lookups by avoiding 'find sys/'.

Setting -DNO_SKIP_MPATH can be used for debugging.

Reported by: bde
MFC after: 2 weeks
Sponsored by: Dell EMC

6 years agosubr_gtaskqueue: Fix braino from r330715
Conrad Meyer [Sat, 10 Mar 2018 01:53:42 +0000 (01:53 +0000)]
subr_gtaskqueue: Fix braino from r330715

Submitted by: markj
Sponsored by: Dell EMC Isilon

6 years agotftpd: reject unknown opcodes
Alan Somers [Sat, 10 Mar 2018 01:50:43 +0000 (01:50 +0000)]
tftpd: reject unknown opcodes

If tftpd receives a command with an unknown opcode, it simply exits 1.  It
doesn't send an ERROR packet, and the client will hang waiting for one.  Fix
it.

PR: 226005
MFC after: 3 weeks

6 years agotftpd: Abort on an WRQ access violation
Alan Somers [Sat, 10 Mar 2018 01:43:55 +0000 (01:43 +0000)]
tftpd: Abort on an WRQ access violation

On a WRQ (write request) tftpd checks whether the client has access
permission for the file in question.  If not, then the write is prevented.
However, tftpd doesn't reply with an ERROR packet, nor does it abort.
Instead, it tries to receive the packet anyway.

The symptom is slightly different depending on the nature of the error.  If
the target file is nonexistent and tftpd lacks permission to create it, then
tftpd will willingly receive the file, but not write it anywhere.  If the
file exists but is not writable, then tftpd will fail to ACK to WRQ.

PR: 225996
MFC after: 3 weeks

6 years agotftpd: Verify world-writability for WRQ when using relative paths
Alan Somers [Sat, 10 Mar 2018 01:35:26 +0000 (01:35 +0000)]
tftpd: Verify world-writability for WRQ when using relative paths

tftpd(8) says that files may only be written if they already exist and are
publicly writable.  tftpd.c verifies that a file is publicly writable if it
uses an absolute pathname.  However, if the pathname is relative, that check
is skipped.  Fix it.

Note that this is not a security vulnerability, because the transfer
ultimately doesn't work unless the file already exists and is owned by user
nobody.  Also, this bug does not affect the default configuration, because
the default uses the "-s" option which makes all pathnames absolute.

PR: 226004
MFC after: 3 weeks

6 years agonvme_da: Fix minor memory leak in error case
Conrad Meyer [Sat, 10 Mar 2018 01:28:55 +0000 (01:28 +0000)]
nvme_da: Fix minor memory leak in error case

Reported by: cppcheck
Sponsored by: Dell EMC Isilon

6 years agoRemove obsolete dataacq.h.
Brooks Davis [Sat, 10 Mar 2018 01:07:30 +0000 (01:07 +0000)]
Remove obsolete dataacq.h.

Nothing includes this file, lists it in a Makefile, or uses any of the
ioctl definitions.

6 years agosubr_gtaskqueue: Fix minor leak of tq_name in error case
Conrad Meyer [Sat, 10 Mar 2018 01:01:01 +0000 (01:01 +0000)]
subr_gtaskqueue: Fix minor leak of tq_name in error case

Reported by: cppcheck
Sponsored by: Dell EMC Isilon

6 years agomlx5(4): Remove redundant declaration of mlx5_enter_error_state
Conrad Meyer [Sat, 10 Mar 2018 00:59:48 +0000 (00:59 +0000)]
mlx5(4): Remove redundant declaration of mlx5_enter_error_state

Broken in r330644.

Sponsored by: Dell EMC Isilon

6 years agoChange ps(1) output width to unlimited if not interactive
Mike Karels [Sat, 10 Mar 2018 00:10:47 +0000 (00:10 +0000)]
Change ps(1) output width to unlimited if not interactive

Apply patch submitted with PR 217159 to make ps use unlimited
width when not associated with a terminal (i.e., none of stdout, stdin,
or stderr is a tty). Update comments and man page correspondingly.
This change was requested to work around lack of -ww in scripts from
third-party packages, including Hadoop, and adds a small measure of
Linux compatibility. Hopefully few if any non-interactive scripts
depend on the old default of 79.

PR: 217159
Submitted by: n.deepak at gmail.com
Reviewed by: vangyzen jhb
Differential Revision: https://reviews.freebsd.org/D14614

6 years agoPermit sysctl(8) to set an array of numeric values for a single node.
John Baldwin [Fri, 9 Mar 2018 23:37:19 +0000 (23:37 +0000)]
Permit sysctl(8) to set an array of numeric values for a single node.

Most sysctl nodes only return a single value, but some nodes return an
array of values (e.g. kern.cp_time).  sysctl(8) understand how to display
the values of a node that returns multiple values (it prints out each
numeric value separated by spaces).  However, until now sysctl(8) has
only been able to set sysctl nodes to a single value.  This change
allows sysctl to accept a new value for a numeric sysctl node that contains
multiple values separated by either spaces or commas.  sysctl(8) parses
this list into an array of values and passes the array as the "new" value
to sysctl(2).

Reviewed by: rpokala
MFC after: 1 week
Sponsored by: Chelsio Communications
Differential Revision: https://reviews.freebsd.org/D14569

6 years agotftpd: Flush files as soon as they are fully received
Alan Somers [Fri, 9 Mar 2018 23:25:18 +0000 (23:25 +0000)]
tftpd: Flush files as soon as they are fully received

On an RRQ, tftpd doesn't exit as soon as it's finished receiving a file.
Instead, it waits five seconds just in case the client didn't receive the
server's last ACK and decides to resend the final DATA packet.
Unfortunately, this created a 5 second delay from when the client thinks
it's done sending the file, and when the file is available for other
processes.

Fix this bug by closing the file as soon as receipt is finished.

PR: 157700
Reported by: Barry Mishler <barry_mishler@yahoo.com>
MFC after: 3 weeks

6 years agoCommit missing file from r330696
Alan Somers [Fri, 9 Mar 2018 23:17:29 +0000 (23:17 +0000)]
Commit missing file from r330696

MFC after: 3 weeks
X-MFC-With: 330696

6 years agoUse the trapframe unwinder for "fast_syscall_common".
John Baldwin [Fri, 9 Mar 2018 22:58:05 +0000 (22:58 +0000)]
Use the trapframe unwinder for "fast_syscall_common".

MFC after: 3 days

6 years agoRemove decade's old whine about msdos vs msdosfs.
Warner Losh [Fri, 9 Mar 2018 21:32:07 +0000 (21:32 +0000)]
Remove decade's old whine about msdos vs msdosfs.

Retain the compatibility silently though.

Reviewed by: cem@, kevans@, emaste@ (and many others in the past)

6 years agolualoader: Cache kernel list
Kyle Evans [Fri, 9 Mar 2018 19:04:06 +0000 (19:04 +0000)]
lualoader: Cache kernel list

With autodetection turned on, hitting the filesystem everytime we need to
calculate choices for the kernel carousel is kind of slow. Cache once on the
first listing and reload it anytime the config is reloaded in case any of
the loader.conf(5) changes that affect this (kernel, kernels,
kernels_autodetect) have changed. This also picks up the case where we've
changed currdev and the autodetected kernels could change.

6 years agoLIB32: Avoid linking in unneeded (and invalid lib32) libz for libmagic build tool.
Bryan Drewery [Fri, 9 Mar 2018 18:51:24 +0000 (18:51 +0000)]
LIB32: Avoid linking in unneeded (and invalid lib32) libz for libmagic build tool.

Usually this is just ignored:
  /usr/bin/ld: skipping incompatible /scratch/obj/root/git/freebsd/amd64.amd64/obj-lib32/lib/libz/libz.so when searching for -lz
  /usr/bin/ld: skipping incompatible /scratch/obj/root/git/freebsd/amd64.amd64/obj-lib32/lib/libz/libz.a when searching for -lz

However some combination of newer toolchains simply fail here instead:
  /usr/bin/ld: error: /home/dstolfa/obj/home/dstolfa/cadets/amd64.amd64/obj-lib32/lib/libz/libz.so is incompatible with /usr/lib/crt1.o

Libz is not needed for mkmagic so just exclude it.

Reported by: Domagoj Stolfa <domagoj.stolfa@gmail.com>
MFC after: 2 weeks
Sponsored by: Dell EMC

6 years agolualoader: Don't redraw the autoboot message every .05s
Kyle Evans [Fri, 9 Mar 2018 18:45:13 +0000 (18:45 +0000)]
lualoader: Don't redraw the autoboot message every .05s

6 years agoRemove K&R stuff: never use it in new code.
Warner Losh [Fri, 9 Mar 2018 17:54:14 +0000 (17:54 +0000)]
Remove K&R stuff: never use it in new code.

Remove how to format K&R stuff. The project hasn't been using it in
new code for a long time. It's so obsolete, we don't need a statement
to never use it. Add a statement requesting that comments about
parameters be preserved when converting to ASNI style, per Kirk.

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