]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
6 years agoMinor (mostly) wording changes.
ian [Sat, 3 Mar 2018 22:10:16 +0000 (22:10 +0000)]
Minor (mostly) wording changes.

6 years agosys/linux: Fix a few potential infoleaks in cloudabi
eadler [Sat, 3 Mar 2018 21:50:55 +0000 (21:50 +0000)]
sys/linux: Fix a few potential infoleaks in cloudabi

Submitted by: Domagoj Stolfa <domagoj.stolfa@gmail.com>
MFC After: 1 month
Sponsored by: DARPA/AFRL

6 years agoMinor changes to wording.
ian [Sat, 3 Mar 2018 21:41:16 +0000 (21:41 +0000)]
Minor changes to wording.

6 years agosys/linux: Fix a few potential infoleaks in Linux IPC
eadler [Sat, 3 Mar 2018 21:14:55 +0000 (21:14 +0000)]
sys/linux: Fix a few potential infoleaks in Linux IPC

Submitted by: Domagoj Stolfa <domagoj.stolfa@gmail.com>
MFC After: 1 month

6 years agosys/fuse: fix off by one error
eadler [Sat, 3 Mar 2018 20:42:39 +0000 (20:42 +0000)]
sys/fuse: fix off by one error

Reported by: Ilja Van Sprundel <ivansprundel@ioactive.com>
Reported by: Domagoj Stolfa <domagoj.stolfa@gmail.com>

6 years agoUse mstosbt() instead of SBT_1MS in the LinuxKPI to get the last few bits
hselasky [Sat, 3 Mar 2018 19:26:40 +0000 (19:26 +0000)]
Use mstosbt() instead of SBT_1MS in the LinuxKPI to get the last few bits
of precision.

MFC after: 1 week
Suggested by: ian@
Sponsored by: Mellanox Technologies

6 years agoImplement msleep_interruptible() in the LinuxKPI. While at it use pause_sbt()
hselasky [Sat, 3 Mar 2018 18:54:16 +0000 (18:54 +0000)]
Implement msleep_interruptible() in the LinuxKPI. While at it use pause_sbt()
instead of pause() in the msleep() function to avoid rounding errors when
converting delay values forth and back. Add a guard for a delay value
of zero milliseconds which is undefined.

MFC after: 1 week
Requested by: Johannes Lundberg <johalun0@gmail.com>
Sponsored by: Mellanox Technologies

6 years agoMove imx6_usbphy to SUPPORTDEV, massage associated comment
kevans [Sat, 3 Mar 2018 18:52:19 +0000 (18:52 +0000)]
Move imx6_usbphy to SUPPORTDEV, massage associated comment

No objections from: ian

6 years agoaw_syscon(4): Move to BUS_PASS_SUPPORTDEV
kevans [Sat, 3 Mar 2018 18:40:46 +0000 (18:40 +0000)]
aw_syscon(4): Move to BUS_PASS_SUPPORTDEV

It would have been on an actual named pass before, but none were really
appropriate in name. Move it to the recently created SUPPORTDEV pass, which
perfectly describes it and keeps it in the right order.

6 years agoAllow pause_sbt() to catch signals during sleep by passing C_CATCH flag.
hselasky [Sat, 3 Mar 2018 18:36:38 +0000 (18:36 +0000)]
Allow pause_sbt() to catch signals during sleep by passing C_CATCH flag.
Define pause_sig() function macro helper similarly to other kernel functions
which catch signals. Update outdated function description.

Discussed with: kib@
MFC after: 1 week
Sponsored by: Mellanox Technologies

6 years agoaw_mmc: Regulator improvement
manu [Sat, 3 Mar 2018 18:30:31 +0000 (18:30 +0000)]
aw_mmc: Regulator improvement

Getting regulator is good, enabling them is better.
When the mmc stack decide to change the voltage for IO, don't
change the main vcc of the sd/mmc, only the io vcc.

6 years agoaxp81x: Add support for AXP803
manu [Sat, 3 Mar 2018 18:28:19 +0000 (18:28 +0000)]
axp81x: Add support for AXP803

AXP803 and AXP813/818 are very similar, only two regulators differs.
AXP803 is the companion chip for A64/R18
AXP813 is the companion chip for A83T
AXP818 is the companion chip for H8 (~A83T)
Add support for all regulators found in both of them.

6 years agolualoader: Shift menu+brand even for logo=none with customized pos
kevans [Sat, 3 Mar 2018 18:25:50 +0000 (18:25 +0000)]
lualoader: Shift menu+brand even for logo=none with customized pos

6 years agolualoader: Tweak positioning and fix an off-by-one
kevans [Sat, 3 Mar 2018 18:13:14 +0000 (18:13 +0000)]
lualoader: Tweak positioning and fix an off-by-one

- All of our default positions were offset from forth
- Our menu frame size was smaller than in forth
- Logo/brand drawing had an off-by-one, drawing one column lower on the
  screen than they should have been.
- While here, switch a print() to printc() as it's expected that logos may
  contain color and other escpae sequences that we'll need to honor.

6 years agoCorrect the return code from pause() during cold startup from zero to
hselasky [Sat, 3 Mar 2018 18:12:21 +0000 (18:12 +0000)]
Correct the return code from pause() during cold startup from zero to
EWOULDBLOCK. This also matches the description in pause(9).

Discussed with: kib@
MFC after: 1 week
Sponsored by: Mellanox Technologies

6 years agolualoader: Respect loader_menu_title_align
kevans [Sat, 3 Mar 2018 17:38:25 +0000 (17:38 +0000)]
lualoader: Respect loader_menu_title_align

It may be set to "left" or "right" -- any other value will cause the title
to be centered.

I've chosen to position these things just inside the vertical borders,
rather than overlapping the corners. This is an arbitrary choice and easily
amendable if this looks terrible.

6 years agolualoader: Respect loader_menu_title, prepare for align
kevans [Sat, 3 Mar 2018 17:25:49 +0000 (17:25 +0000)]
lualoader: Respect loader_menu_title, prepare for align

6 years agolualoader: Execute menu_timeout_command at the end of menu autoboot
kevans [Sat, 3 Mar 2018 17:18:40 +0000 (17:18 +0000)]
lualoader: Execute menu_timeout_command at the end of menu autoboot

Instead of hardcoding "boot", respect menu_timeout_command from Forth. It
still defaults to 'boot', so this will not be a functional change for most.

6 years agoliblua: Add loader.interpret
kevans [Sat, 3 Mar 2018 17:13:12 +0000 (17:13 +0000)]
liblua: Add loader.interpret

This allows lua to pass back a command string to be executed as if it were
typed at the loader prompt- loader tries to execute the string first as pure
lua, then parses it and gives lua a chance to intercept before it tries to
execute it itself.

This will be used to implement menu_timeout_command, among other things,
which *should* be used to execute basic loader commands independent of the
chosen interpreter.

6 years agodb_nextframe/amd64: catch up with r328083 to recognize fast_syscall_common
avg [Sat, 3 Mar 2018 15:10:37 +0000 (15:10 +0000)]
db_nextframe/amd64: catch up with r328083 to recognize fast_syscall_common

Since that change the system call stack traces look like this:
  ...
  sys___sysctl() at sys___sysctl+0x5f/frame 0xfffffe0028e13ac0
  amd64_syscall() at amd64_syscall+0x79b/frame 0xfffffe0028e13bf0
  fast_syscall_common() at fast_syscall_common+0x101/frame 0xfffffe0028e13bf0
So, db_nextframe() stopped recognizing the system call frame.
This commit should fix that.

Reviewed by: kib
MFC after: 4 days

6 years agoMove setting the IRQ base and length into the common GICv3 ITS attach
andrew [Sat, 3 Mar 2018 13:20:44 +0000 (13:20 +0000)]
Move setting the IRQ base and length into the common GICv3 ITS attach
function. This is common across both ACPI and FDT.

Sponsored by: ABT Systems Ltd
Sponsored by: Cavium (Hardware)

6 years agoAdd the missing GICv3 dev info struct to the ACPI dev info.Previously we
andrew [Sat, 3 Mar 2018 13:19:08 +0000 (13:19 +0000)]
Add the missing GICv3 dev info struct to the ACPI dev info.Previously we
would read from the resource list when querying from this.

Sponsored by: ABT Systems Ltd
Sponsored by: Cavium (Hardware)

6 years agoIntroduce BUS_PASS_SUPPORTDEV
manu [Sat, 3 Mar 2018 12:43:11 +0000 (12:43 +0000)]
Introduce BUS_PASS_SUPPORTDEV

The reason for this new pass is :

The earlier pass names are really specific (interrupt, timer, scheduler etc ..)
and making a driver that other device driver (that attach at DEFAULT pass)
needs probe at earlier pass can be confiusing. We can live with GPIO driver
at INTERRUPT pass because they are often an interrupt controller too but having
a usb phy driver probed at RESOURCES (or SCHEDULER for example) is silly.
The number was choosen to have a lot of margin if we want to introduce other
pass in the futur.

Reviewed by: ian, imp, kevans
Differential Revision: https://reviews.freebsd.org/D14568

6 years ago[fdt_pinctrl] Add man pages for fdt_pinctrl driver
gonzo [Sat, 3 Mar 2018 02:49:49 +0000 (02:49 +0000)]
[fdt_pinctrl] Add man pages for fdt_pinctrl driver

- Add fdt_pinctrl(4) with general information for the driver
- Add fdt_pinctrl(9) with fdt_pinctrl KPI description

Reviewed by: ian, manu, wblock
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D14235

6 years agoHonor physical memory regions marked unavailable in the FDT, when present.
nwhitehorn [Sat, 3 Mar 2018 02:06:48 +0000 (02:06 +0000)]
Honor physical memory regions marked unavailable in the FDT, when present.
The most notable of these is the FDT itself, which it is a bad idea to
overwrite.

6 years agoRemove assumption that all physical memory is available to the kernel and
nwhitehorn [Sat, 3 Mar 2018 02:04:40 +0000 (02:04 +0000)]
Remove assumption that all physical memory is available to the kernel and
that the physical and available memory arrays are interchangeable.

6 years agoimcsmb(4): Intel integrated Memory Controller (iMC) SMBus controller driver
rpokala [Sat, 3 Mar 2018 01:53:51 +0000 (01:53 +0000)]
imcsmb(4): Intel integrated Memory Controller (iMC) SMBus controller driver

imcsmb(4) provides smbus(4) support for the SMBus controller functionality
in the integrated Memory Controllers (iMCs) embedded in Intel Sandybridge-
Xeon, Ivybridge-Xeon, Haswell-Xeon, and Broadwell-Xeon CPUs. Each CPU
implements one or more iMCs, depending on the number of cores; each iMC
implements two SMBus controllers (iMC-SMBs).

*** IMPORTANT NOTE ***
Because motherboard firmware or the BMC might try to use the iMC-SMBs for
monitoring DIMM temperatures and/or managing an NVDIMM, the driver might
need to temporarily disable those functions, or take a hardware interlock,
before using the iMC-SMBs. Details on how to do this may vary from board to
board, and the procedure may be proprietary. It is strongly suggested that
anyone wishing to use this driver contact their motherboard vendor, and
modify the driver as described in the manual page and in the driver itself.
(For what it's worth, the driver as-is has been tested on various SuperMicro
motherboards.)

Reviewed by: avg, jhb
MFC after: 1 week
Relnotes: yes
Sponsored by: Panasas
Differential Revision: https://reviews.freebsd.org/D14447
Discussed with: avg, ian, jhb
Tested by: allanjude (previous version), Panasas

6 years agoFix build post r330299
brooks [Fri, 2 Mar 2018 23:31:55 +0000 (23:31 +0000)]
Fix build post r330299

6 years agoDon't declare union semun in userspace unless _WANT_SEMUN is defined.
brooks [Fri, 2 Mar 2018 22:32:53 +0000 (22:32 +0000)]
Don't declare union semun in userspace unless _WANT_SEMUN is defined.

POSIX explicitly states that the application must declare union semun.
This makes no sense, but it is what it is.  This brings us into line
with Linux, MacOS/Darwin, and NetBSD.

In a ports exp-run a moderate number of ports fail due to a lack of
approprate autotools-like discovery mechanisms or local patches.  A
commit to address them will follow shortly.

PR: 224300, 224443 (exp-run)
Reviewed by: emaste, jhb, kib
Exp-run by: antoine
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D14492

6 years agoDon't define struct mymsg.
brooks [Fri, 2 Mar 2018 22:13:29 +0000 (22:13 +0000)]
Don't define struct mymsg.

PR: 224299, 224443 (exp-run)
Reviewed by: kib, jhb
Exp-run by: antoine
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D14491

6 years agoRename kernel-only members of semid_ds and msgid_ds.
brooks [Fri, 2 Mar 2018 22:10:48 +0000 (22:10 +0000)]
Rename kernel-only members of semid_ds and msgid_ds.

This deliberately breaks the API in preperation for future syscall
revisions which will remove these nonstandard members.

In an exp-run a single port (devel/qemu-user-static) was found to
use them which it did becuase it emulates system calls.  This has
been fixed in the ports tree.

PR: 224443 (exp-run)
Reviewed by: kib, jhb (previous version)
Exp-run by: antoine
Sponsored by: DARPA, AFRP
Differential Revision: https://reviews.freebsd.org/D14490

6 years agoZFS: fix adding vdevs to very large pools
asomers [Fri, 2 Mar 2018 21:26:48 +0000 (21:26 +0000)]
ZFS: fix adding vdevs to very large pools

r323791 changed the return value of zpool_read_label.  Error paths that
previously returned 0 began to return -1 instead.  However, not all error
paths initialized errno.  When adding vdevs to a very large pool, errno could
be prepopulated with ENOMEM, causing the operation to fail.  Fix the bug by
setting errno=ENOENT in the case that no ZFS label is found.

PR: 226096
Submitted by: Nikita Kozlov
Reviewed by: avg
MFC after: 3 weeks
Differential Revision: https://reviews.freebsd.org/D13088

6 years agosx: fix adaptive spinning broken in r327397
mjg [Fri, 2 Mar 2018 21:26:27 +0000 (21:26 +0000)]
sx: fix adaptive spinning broken in r327397

The condition was flipped.

In particular heavy multithreaded kernel builds on zfs started suffering
due to nested sx locks.

For instance make -s -j 128 buildkernel:

before: 3326.67s user 1269.62s system 6981% cpu 1:05.84 total
after: 3365.55s user 911.27s system 6871% cpu 1:02.24 total

ps.
      .-'---`-.       .-'---`-.
    ,'          `.     ,'          `.
    |             \     |             \
    |              \     |              \
    \           _  \     \           _  \
    ,\  _    ,'-,/-)\     ,\  _    ,'-,/-)\
    ( * \ \,' ,' ,'-)     ( * \ \,' ,' ,'-)
     `._,)     -',-')      `._,)     -',-')
       \/         ''/        \/         ''/
        )        / /         )        / /
       /       ,'-'        /       ,'-'

6 years agodtb/allwinner: Build sun8i-h3-nanopi-m1-plus.dts
manu [Fri, 2 Mar 2018 20:59:36 +0000 (20:59 +0000)]
dtb/allwinner: Build sun8i-h3-nanopi-m1-plus.dts

We have a u-boot port for this board so add the dtb to the build.

6 years agoUpdate QLogic ISP 24xx/25xx chips firmware to 8.07.00.
mav [Fri, 2 Mar 2018 19:50:41 +0000 (19:50 +0000)]
Update QLogic ISP 24xx/25xx chips firmware to 8.07.00.

MFC after: 1 month

6 years agoClarify and clean up some language, and add an explicit example.
wblock [Fri, 2 Mar 2018 19:07:32 +0000 (19:07 +0000)]
Clarify and clean up some language, and add an explicit example.

Sponsored by: iXsystems
Differential Revision: https://reviews.freebsd.org/D12336

6 years agoClarity and style fixes.
wblock [Fri, 2 Mar 2018 18:57:00 +0000 (18:57 +0000)]
Clarity and style fixes.

Sponsored by: iXsystems

6 years agoiflib: stop timer callout when stopping
shurd [Fri, 2 Mar 2018 18:48:07 +0000 (18:48 +0000)]
iflib: stop timer callout when stopping

iflib_timer has been seen running after the interface had been removed.
This change prevents that.

Submitted by: matt.macy@joyent.com

6 years agolualoader: Reset the cursor position after the menu is drawn
kevans [Fri, 2 Mar 2018 17:07:08 +0000 (17:07 +0000)]
lualoader: Reset the cursor position after the menu is drawn

Rather than before the menu is drawn. The drawer is going to reset the
crusor position as soon as it draws anything anyways, so doing it before
serves no purpose. Setting it after is needed so we don't clobber the menu
when we start booting.

6 years agoAdd --globals printc to lua-lint
kevans [Fri, 2 Mar 2018 16:51:43 +0000 (16:51 +0000)]
Add --globals printc to lua-lint

We provide a global 'printc' as of r330282; make luacheck aware of this fact
so that we can use it without complaints.

6 years agoRemove _Nonnull attributes from user addresses arguments for
kib [Fri, 2 Mar 2018 16:47:02 +0000 (16:47 +0000)]
Remove _Nonnull attributes from user addresses arguments for
copyout(9) family.

The addresses are user-controllable, and if the process ABI allows
mapping at zero, then the zero address is meaningful, contradicting
the definition of _Nonnull.  In any case, it does not require any
special code to handle NULL udaddr.

It is not clear if __restrict makes sense as well, since kaddr and
udaddr point to different address spaces, so equal numeric values of
the pointers do not imply aliasing and a legitimate.  But leave it for
later.

copyinstr(9) does not have its user address argument annotated.

Sponsored by: The FreeBSD Foundation
MFC after: 1 week

6 years agoliblua: Use putc instead of printf for printc
kevans [Fri, 2 Mar 2018 16:31:23 +0000 (16:31 +0000)]
liblua: Use putc instead of printf for printc

printc does not need the features or the overhead of printf. It does not
take formatting strings, and it pipes the single string argument through an
"%s" format.

Instead, use putc directly. This pipes the string through in its entirety as
a series of 'unsigned char's, generally straight to the console emulator.

Discussed with: tsoome

6 years agolualoader: Use global printc instead of loader.printc
kevans [Fri, 2 Mar 2018 16:06:20 +0000 (16:06 +0000)]
lualoader: Use global printc instead of loader.printc

r330282 registered loader.printc as printc, so use it instead. This makes
sense for a couple reasons, the major point being that it reads a little bit
easier and pairs nicely with the global 'print'.

Similar cases can not really be made for other loader.* functions as most of
them are either highly specific to our use-case or usually available in
other modules, such as `os`. printc does not have a standard implementation
in the Lua world(*), so we have a little more leeway with it, and it's kind
of a special case of the globally available 'print'.

(*) I've been in the Lua world for all of two weeks, so this could be wrong.

6 years agolualoader: Register loader.printc as global printc
kevans [Fri, 2 Mar 2018 15:46:22 +0000 (15:46 +0000)]
lualoader: Register loader.printc as global printc

6 years agolualoader: Steamroll the box-drawing
kevans [Fri, 2 Mar 2018 15:28:08 +0000 (15:28 +0000)]
lualoader: Steamroll the box-drawing

- Add drawer.frame_styles to map out the kinds of characters we need for the
  different loader_menu_frame values
- Respect loader_menu_frame, default to double[*]
- (imp) Use loader.printc instead of print- print adds a newline to the
  output, which is not the right thing we want to be doing.
- (imp) Draw horizontal frames a little more efficiently- setting the cursor
  after every line segment is horribly inefficient, especially on serial
  consoles. Halve the number of characters written at the expense of an
  additional loop to draw the bottom frame, which is likely more efficient
  in the long run for some of less ideal scenarios.

[*] menu.4th(8) claims that the default here was single, but unset
loader_menu_frame yielded double and we didn't have any overrides in the
default loader.conf(5), so double it is.

6 years agolibefivar: use standard 2-Clause FreeBSD license
emaste [Fri, 2 Mar 2018 15:12:18 +0000 (15:12 +0000)]
libefivar: use standard 2-Clause FreeBSD license

Approved by: imp
Sponsored by: The FreeBSD Foundation

6 years agoFix README.md formatting.
trasz [Fri, 2 Mar 2018 14:42:08 +0000 (14:42 +0000)]
Fix README.md formatting.

MFC after: 2 weeks
Sponsored by: DARPA, AFRL

6 years ago.Xr pstat(8), so that people have a chance to learn how to get a list
trasz [Fri, 2 Mar 2018 14:16:19 +0000 (14:16 +0000)]
.Xr pstat(8), so that people have a chance to learn how to get a list
of terminal devices using "pstat -t".

MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation

6 years agoCount the number of children in the GICv3 ACPI attachment. This is needed
andrew [Fri, 2 Mar 2018 13:04:21 +0000 (13:04 +0000)]
Count the number of children in the GICv3 ACPI attachment. This is needed
later for assigning IRQ vector space.

Sponsored by: DARPA, AFRL
Sponsored by: Cavium (Hardware)

6 years agoImplement more lockdep stubs in the LinuxKPI.
hselasky [Fri, 2 Mar 2018 08:59:53 +0000 (08:59 +0000)]
Implement more lockdep stubs in the LinuxKPI.

MFC after: 1 week
Submitted by: Johannes Lundberg <johalun0@gmail.com>
Sponsored by: Mellanox Technologies
Sponsored by: Limelight Networks

6 years agoImplement ktime_get_raw() function in the LinuxKPI.
hselasky [Fri, 2 Mar 2018 08:58:32 +0000 (08:58 +0000)]
Implement ktime_get_raw() function in the LinuxKPI.

MFC after: 1 week
Submitted by: Johannes Lundberg <johalun0@gmail.com>
Sponsored by: Mellanox Technologies
Sponsored by: Limelight Networks

6 years agoImplement wait_on_bit() function macro in the LinuxKPI.
hselasky [Fri, 2 Mar 2018 08:56:15 +0000 (08:56 +0000)]
Implement wait_on_bit() function macro in the LinuxKPI.

MFC after: 1 week
Submitted by: Johannes Lundberg <johalun0@gmail.com>
Sponsored by: Mellanox Technologies
Sponsored by: Limelight Networks

6 years agoRename callout member in struct timer_list to match the one in struct
hselasky [Fri, 2 Mar 2018 08:52:27 +0000 (08:52 +0000)]
Rename callout member in struct timer_list to match the one in struct
delayed_work in the LinuxKPI. This allows the timer_pending() function
macro to be used with delayed work structures.

No functional nor structural change.

MFC after: 1 week
Submitted by: Johannes Lundberg <johalun0@gmail.com>
Sponsored by: Mellanox Technologies
Sponsored by: Limelight Networks

6 years agog_label_ufs: Fix typo from r330264
cem [Fri, 2 Mar 2018 06:02:54 +0000 (06:02 +0000)]
g_label_ufs: Fix typo from r330264

Reported by: O. Hartmann <o.hartmann AT walstatt.org>
Sponsored by: Dell EMC Isilon

6 years agocore.lua(8): Add missing note about core.KEYSTR_CSI
kevans [Fri, 2 Mar 2018 05:38:08 +0000 (05:38 +0000)]
core.lua(8): Add missing note about core.KEYSTR_CSI

6 years agoAdd menu.lua(8), but do not add to distribution
kevans [Fri, 2 Mar 2018 05:36:04 +0000 (05:36 +0000)]
Add menu.lua(8), but do not add to distribution

Distribution will be done after all of the lualoader manpages are created.

Reviewed by: rpokala
Differential Revision: https://reviews.freebsd.org/D14480

6 years agoAdd core.lua(8), but do not add to distribution
kevans [Fri, 2 Mar 2018 05:35:14 +0000 (05:35 +0000)]
Add core.lua(8), but do not add to distribution

Distribution will be done after all of the lualoader manpages are created.

Reviewed by: rpokala
Differential Revision: https://reviews.freebsd.org/D14479

6 years agoThis change is some refactoring of Mark Johnston's changes in r329375
mckusick [Fri, 2 Mar 2018 04:34:53 +0000 (04:34 +0000)]
This change is some refactoring of Mark Johnston's changes in r329375
to fix the memory leak that I introduced in r328426. Instead of
trying to clear up the possible memory leak in all the clients, I
ensure that it gets cleaned up in the source (e.g., ffs_sbget ensures
that memory is always freed if it returns an error).

The original change in r328426 was a bit sparse in its description.
So I am expanding on its description here (thanks cem@ and rgrimes@
for your encouragement for my longer commit messages).

In preparation for adding check hashing to superblocks, r328426 is
a refactoring of the code to get the reading/writing of the superblock
into one place. Unlike the cylinder group reading/writing which
ends up in two places (ffs_getcg/ffs_geom_strategy in the kernel
and cgget/cgput in libufs), I have the core superblock functions
just in the kernel (ffs_sbfetch/ffs_sbput in ffs_subr.c which is
already imported into utilities like fsck_ffs as well as libufs to
implement sbget/sbput). The ffs_sbfetch and ffs_sbput functions
take a function pointer to do the actual I/O for which there are
four variants:

    ffs_use_bread / ffs_use_bwrite for the in-kernel filesystem

    g_use_g_read_data / g_use_g_write_data for kernel geom clients

    ufs_use_sa_read for the standalone code (stand/libsa/ufs.c
but not stand/libsa/ufsread.c which is size constrained)

    use_pread / use_pwrite for libufs

Uses of these interfaces are in the UFS filesystem, geoms journal &
label, libsa changes, and libufs. They also permeate out into the
filesystem utilities fsck_ffs, newfs, growfs, clri, dump, quotacheck,
fsirand, fstyp, and quot. Some of these utilities should probably be
converted to directly use libufs (like dumpfs was for example), but
there does not seem to be much win in doing so.

Tested by: Peter Holm (pho@)

6 years agolualoader: Use string literal \xNN instead of string.char()
kevans [Fri, 2 Mar 2018 03:05:36 +0000 (03:05 +0000)]
lualoader: Use string literal \xNN instead of string.char()

6 years agolualoader: Use #str instead of tracking length with 'n'
kevans [Fri, 2 Mar 2018 02:39:41 +0000 (02:39 +0000)]
lualoader: Use #str instead of tracking length with 'n'

We really gain almost nothing by tracking length separately, especially when
it's as easy as "#str", so reduce complexity.

6 years agolualoader: Fix some lint-mentioned errors
kevans [Fri, 2 Mar 2018 02:39:16 +0000 (02:39 +0000)]
lualoader: Fix some lint-mentioned errors

- nextbootfile is not a variable, but nextboot_file is
- pstatus was explicitly initialized but later clobbered, so don't
  initialize it.

6 years agoUpdate to bmake-201802222
sjg [Fri, 2 Mar 2018 01:53:50 +0000 (01:53 +0000)]
Update to bmake-201802222

Fixes segfault in Var_Set if val is NULL
Don't treat .info as warning with -W

6 years agotag bmake-20180222
sjg [Thu, 1 Mar 2018 23:46:02 +0000 (23:46 +0000)]
tag bmake-20180222

6 years agoImport bmake-20180222
sjg [Thu, 1 Mar 2018 23:45:44 +0000 (23:45 +0000)]
Import bmake-20180222

From ChangeLog

* VERSION: 20180222
  Merge with NetBSD make, pick up
  o parse.c: avoid calling sysconf for every call to loadfile

* VERSION: 20180218
  Merge with NetBSD make, pick up
  o var.c: Var_Set handle NULL value anytime.

* VERSION: 20180212
  Merge with NetBSD make, pick up
  o parse.c: do not treat .info as warning with -W

* VERSION: 20171207
  Merge with NetBSD make, pick up
  o var.c: Var_Append use Var_Set if var not previously set
    so that VAR_CMD is handled correctly.
    Add a suitable unit-test.

* VERSION: 20171126

* aclocal.m4: use AC_LINK_IFELSE for AC_C___ATTRIBUTE__
  since AC_TRY_COMPILE puts input inside main()
  which upsets modern compilers.

* VERSION: 20171118
  Merge with NetBSD make, pick up
  o var.c: do not append to variable set on command line
    add unit-test to catch this.

6 years agoAdd a function to retrieve the EFI realtime clock capabilities.
ian [Thu, 1 Mar 2018 22:57:14 +0000 (22:57 +0000)]
Add a function to retrieve the EFI realtime clock capabilities.

6 years agosys/sys: Use a more common spelling of 'dirent'
eadler [Thu, 1 Mar 2018 22:38:21 +0000 (22:38 +0000)]
sys/sys: Use a more common spelling of 'dirent'

Submitted by: Domagoj Stolfa <domagoj.stolfa@gmail.com>
MFC After: 3 days

6 years agoRegenerate src.conf(5) after r330254
kevans [Thu, 1 Mar 2018 22:04:51 +0000 (22:04 +0000)]
Regenerate src.conf(5) after r330254

6 years agoAdd descriptions for recently added loader options
kevans [Thu, 1 Mar 2018 22:00:38 +0000 (22:00 +0000)]
Add descriptions for recently added loader options

6 years agoBack out r330252; will reapply with an actual commit message
kevans [Thu, 1 Mar 2018 21:59:30 +0000 (21:59 +0000)]
Back out r330252; will reapply with an actual commit message

6 years agoMFC after: 1 week
kevans [Thu, 1 Mar 2018 21:57:08 +0000 (21:57 +0000)]
MFC after: 1 week

6 years agoRemove LOADER_EFI description files
kevans [Thu, 1 Mar 2018 21:51:20 +0000 (21:51 +0000)]
Remove LOADER_EFI description files

LOADER_EFI functionality got folded into EFI as of r330248.

6 years agostand: Fix build after r330249
kevans [Thu, 1 Mar 2018 21:46:01 +0000 (21:46 +0000)]
stand: Fix build after r330249

One does not simply convert to SUBDIR.yes in stand without making everything
else in the affected files SUBDIR.yes -- there are better ways to do this.

6 years agostand: Makefile SUBDIR cleanup
kevans [Thu, 1 Mar 2018 19:59:49 +0000 (19:59 +0000)]
stand: Makefile SUBDIR cleanup

Use SUBDIR.${MK_*} where appropriate. r330248 eliminated most of the
offenders, sweep the rest under the rug.

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

6 years agoCreate LOADER_UBOOT, and LOADER_OFW. Move these options out of
imp [Thu, 1 Mar 2018 19:50:55 +0000 (19:50 +0000)]
Create LOADER_UBOOT, and LOADER_OFW. Move these options out of
Makefile.${MACHINE_ARCH} and remove the now-empty files. Generate the
*32 directories on the necessary architectures (well, currently only
amd64) on the fly. Remove LOADER_EFI variable and co-locate it with
EFI.

Differential Review: https://reviews.freebsd.org/D14546

6 years agoAllow the "@" and "!" characters in passwd file GECOS fields.
dab [Thu, 1 Mar 2018 17:47:28 +0000 (17:47 +0000)]
Allow the "@" and "!" characters in passwd file GECOS fields.

Two PRs (152084 & 210187) request allowing the "@" and/or "!"
characters in the passwd file GECOS field. The man page for pw does
not mention that those characters are disallowed, Linux supports those
characters in this field, and the "@" character in particular would be
useful for storing email addresses in that field.

PR: 152084, 210187
Submitted by: jschauma@netmeister.org, Dave Cottlehuber <dch@freebsd.org>
Reported by: jschauma@netmeister.org, Dave Cottlehuber <dch@freebsd.org>
Reviewed by: delphij (secteam), vangyzen
MFC after: 1 week
Sponsored by: Dell EMC
Differential Revision: https://reviews.freebsd.org/D14519

6 years agoPowerNV: Initial support for OPAL I2C transfers
wma [Thu, 1 Mar 2018 14:11:07 +0000 (14:11 +0000)]
PowerNV: Initial support for OPAL I2C transfers

Add I2C OPAL driver and a set of dummy-ones to allow
all I2C things on Power8 to attach.

TODO: better async token management

Submitted by:          Wojciech Macek <wma@semihalf.com>
Obtained from:         Semihalf
Sponsored by:          IBM, QCM Technologies

6 years agoRationalize license text on Linuxolator files
emaste [Thu, 1 Mar 2018 13:52:18 +0000 (13:52 +0000)]
Rationalize license text on Linuxolator files

Many licenses on Linuxolator files contained small variations from the
standard FreeBSD license text.  To avoid license proliferation switch to
the standard 2-clause FreeBSD license for those files where I have
permission from each of the listed copyright holders.  Additional files
still waiting on permission from others are listed in review D14210.

Approved by:    dchagin, rdivacky, sos
MFC after: 1 week
MFC with: r329370
Sponsored by: The FreeBSD Foundation

6 years agoCorrect the return value from flush_work() and flush_delayed_work() in the
hselasky [Thu, 1 Mar 2018 10:31:51 +0000 (10:31 +0000)]
Correct the return value from flush_work() and flush_delayed_work() in the
LinuxKPI to comply more with Linux. This fixes an issue when these functions
are used in waiting loops.

MFC after: 1 week
Sponsored by: Mellanox Technologies

6 years agoFix the psl_userset32 definition.
jhibbits [Thu, 1 Mar 2018 04:44:17 +0000 (04:44 +0000)]
Fix the psl_userset32 definition.

It should be based on psl_userset, not psl_kernset.  As kernset, it would
inherit kernel config, including privilege level.

6 years agolualoader: config: Pull some messages out into constants
kevans [Thu, 1 Mar 2018 02:31:28 +0000 (02:31 +0000)]
lualoader: config: Pull some messages out into constants

Rather than hardcoding these things. This could lead to some form of loader
localization later, but the main goal at the moment is to get a clear view
of the strings we're outputting and strive to use more string.format() and
less wild concatenation all over the place.

6 years agolualoader: Dedup these "Return to main menu" entries
kevans [Thu, 1 Mar 2018 02:04:26 +0000 (02:04 +0000)]
lualoader: Dedup these "Return to main menu" entries

6 years agopci_ioctl: Avoid returning uninitialized error value if user provided empty buffer
cem [Thu, 1 Mar 2018 01:49:36 +0000 (01:49 +0000)]
pci_ioctl: Avoid returning uninitialized error value if user provided empty buffer

In the weird case where the user-provided buffer was zero bytes, we could break
out of PCIOCGETCONF and return without initializing error.  In this case,
initialize error to zero -- we successfully did nothing, as requested.

Reported by: Coverity
Sponsored by: Dell EMC Isilon

6 years agopsm(4): Always initialize used values in debug print
cem [Thu, 1 Mar 2018 00:58:59 +0000 (00:58 +0000)]
psm(4): Always initialize used values in debug print

'status' array passed to get_mouse_status() is usually uninitialized by
callers.

Fully populating it with values in get_mouse_status() can fail due to
read_aux_data().

Additionally, nothing in API constrains 'len' to be >= 3.  In practice,
every caller passes three, so perhaps that argument should just be removed.
Refactoring is a larger change, though.

Remove use of potentially uninitialized values by:
1. Only printing 3 debug statuses if the passed array was at least
   'len' >= 3;
2. Populating 'status' array up to first three elements, if read_aux_data()
   failed.

No functional change intended.

Reported by: Coverity
Sponsored by: Dell EMC Isilon

6 years agoffs: softdep_disk_write_complete: Quiesce spurious Coverity warning
cem [Thu, 1 Mar 2018 00:29:52 +0000 (00:29 +0000)]
ffs: softdep_disk_write_complete: Quiesce spurious Coverity warning

Coverity cannot determine that handle_written_indirdep() does not access
uninitialized 'sbp' when flags argument is zero.

So, simply move the initialization slightly sooner to silence the warning.

No functional change.

Reported by: Coverity
Sponsored by: Dell EMC Isilon

6 years agoFix module loading on arm after the metadata.c unification in r329190.
ian [Wed, 28 Feb 2018 21:51:51 +0000 (21:51 +0000)]
Fix module loading on arm after the metadata.c unification in r329190.
Arm modules need an additional address fixup not needed by other platforms.

6 years agoRevert r328964: if_awg: Skip emac reset if configured for internal PHY
kevans [Wed, 28 Feb 2018 20:51:21 +0000 (20:51 +0000)]
Revert r328964: if_awg: Skip emac reset if configured for internal PHY

This broke EFI boots consistently, and emac reset is sometimes needed if
things get into a bad state -- this won't be done without a full powercycle.

6 years agoAllow overriding .MAKE.MAKEFILE_PREFERENCE.
bdrewery [Wed, 28 Feb 2018 20:06:03 +0000 (20:06 +0000)]
Allow overriding .MAKE.MAKEFILE_PREFERENCE.

This will be utilized by Ports tools to avoid some extra
stat(2) calls.

MFC after: 3 days

6 years agoRK3188: Mark it NO_UNIVERSE
manu [Wed, 28 Feb 2018 19:08:52 +0000 (19:08 +0000)]
RK3188: Mark it NO_UNIVERSE

This is an old kernel so mark it as NO_UNIVERSE so it's not built by
the universe rule or tinderbox.

6 years agodwmmc_rockchip: Add ifdefs on EXT_RESOURCES
manu [Wed, 28 Feb 2018 19:05:25 +0000 (19:05 +0000)]
dwmmc_rockchip: Add ifdefs on EXT_RESOURCES

The old RK3188 kernel config uses dwmmc but isn't compiled with EXT_RESOURCES.
Add ifdefs around code using EXT_RESOURCES code.

Reported by: rpokala

6 years agorc.d/jail: avoid misinterpreting expr arguments
emaste [Wed, 28 Feb 2018 17:20:10 +0000 (17:20 +0000)]
rc.d/jail: avoid misinterpreting expr arguments

(Due to some misconfiguration) I ended up with _mask set to
"-v<something>", and /etc/rc.d/jail then failed with
"expr: illegal option -- v".

Use "expr --" so that variable content is never interpreted as an
option.

Reviewed by: jamie
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D14535

6 years agoAdd support for Enhanced Gen 5 (16Gb) and Gen 6 (32Gb) QLogic FC HBAs.
mav [Wed, 28 Feb 2018 16:24:32 +0000 (16:24 +0000)]
Add support for Enhanced Gen 5 (16Gb) and Gen 6 (32Gb) QLogic FC HBAs.

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

6 years agoAllow releasing APs to take more time, as long as we are making progress.
andrew [Wed, 28 Feb 2018 16:03:40 +0000 (16:03 +0000)]
Allow releasing APs to take more time, as long as we are making progress.
On large core count machines this can be slow while all the CPUs update
the online counter.

Sponsored by: DARPA, AFRL
Sponsored by: Cavium (Hardware)

6 years agoRegenerate src.conf(5) after r330118
kevans [Wed, 28 Feb 2018 15:48:08 +0000 (15:48 +0000)]
Regenerate src.conf(5) after r330118

6 years agoAdd missing punctuation to *_LOADER_EFI descriptions...
kevans [Wed, 28 Feb 2018 15:47:24 +0000 (15:47 +0000)]
Add missing punctuation to *_LOADER_EFI descriptions...

6 years agoRegenerate src.conf(5) after r330115 and r330116
kevans [Wed, 28 Feb 2018 15:45:14 +0000 (15:45 +0000)]
Regenerate src.conf(5) after r330115 and r330116

6 years agoSome missing LOADER_EFI build option descriptions
kevans [Wed, 28 Feb 2018 15:28:04 +0000 (15:28 +0000)]
Some missing LOADER_EFI build option descriptions

6 years agoAdd missing WITH_BSD_GREP_FASTMATCH description
kevans [Wed, 28 Feb 2018 15:27:36 +0000 (15:27 +0000)]
Add missing WITH_BSD_GREP_FASTMATCH description

MFC after: 3 days

6 years agoCount the number of GIC redistributors in the ACPI tables. The GICv3 driver
andrew [Wed, 28 Feb 2018 15:25:47 +0000 (15:25 +0000)]
Count the number of GIC redistributors in the ACPI tables. The GICv3 driver
needs this to allocate memory, and connect the CPUs to the interrupt
controller.

Sponsored by: DARPA, AFRL
Sponsored by: Cavium (Hardware)

6 years agoOnly check the ProducerConsumer flag on extended memory. As per the ACPI
andrew [Wed, 28 Feb 2018 15:18:31 +0000 (15:18 +0000)]
Only check the ProducerConsumer flag on extended memory. As per the ACPI
6.0 spec 6.4.3.5 bit 0 is ignored on QWord, DWord, and Word Address Space
Descriptors, but not Extended Address Space Descriptors.

Reviewed by: jhb
Sponsored by: DARPA, AFRL
Sponsored by: Cavium (Hardware)
Differential Revision: https://reviews.freebsd.org/D14516

6 years agoRegen src.conf.5 after r330110 (WITH_KERNEL_RETPOLINE)
emaste [Wed, 28 Feb 2018 15:03:53 +0000 (15:03 +0000)]
Regen src.conf.5 after r330110 (WITH_KERNEL_RETPOLINE)

As a bonus also includes the LUA loader description.