]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
6 years agoUse a workaround to compile the crt init functions correctly with clang.
jhb [Tue, 6 Feb 2018 17:01:10 +0000 (17:01 +0000)]
Use a workaround to compile the crt init functions correctly with clang.

The MIPS assembly parser treats forward-declared local symbols as global
symbols.  This results in CALL16 relocations being used against local
(private) symbols which then fail to resolve when linking binaries.
Add .local to force the init and fini functions to be treated as local as
a workaround.

Submitted by: sbruno
Sponsored by: DARPA / AFRL

6 years agoSimplify synchronization read error handling.
markj [Tue, 6 Feb 2018 16:02:33 +0000 (16:02 +0000)]
Simplify synchronization read error handling.

Since synchronization reads are performed by submitting a request to
the external mirror provider, we know that the request returns with an
error only when gmirror was unable to read a copy of the block from any
mirror. Thus, there is no need to retry the request from the
synchronization error handler.

Tested by: pho
MFC after: 2 weeks
Sponsored by: Dell EMC Isilon

6 years agoFix queue length reporting in mps(4) and mpr(4).
mav [Tue, 6 Feb 2018 16:02:25 +0000 (16:02 +0000)]
Fix queue length reporting in mps(4) and mpr(4).

Both drivers were found to report CAM bigger queue depth then they really
can handle.  It made them later under high load with many disks return
some of submitted requests back with CAM_REQUEUE_REQ status for later
resubmission.

Reviewed by: scottl
MFC after: 1 week
Sponsored by: iXsystems, Inc.
Differential Revision: https://reviews.freebsd.org/D14215

6 years agoDiagnostic buffer fixes for the mps(4) and mpr(4) drivers.
ken [Tue, 6 Feb 2018 15:58:22 +0000 (15:58 +0000)]
Diagnostic buffer fixes for the mps(4) and mpr(4) drivers.

In mp{r,s}_diag_register(), which is used to register diagnostic
buffers with the mp{r,s}(4) firmware, we allocate DMAable memory.

There were several issues here:
 o No checking of the bus_dmamap_load() return value.  If the load
   failed or got deferred, mp{r,s}_diag_register() continued on as if
   nothing had happened.  We now check the return value and bail
   out if it fails.

 o No waiting for a deferred load callback.  bus_dmamap_load()
   calls a supplied callback when the mapping is done.  This is
   generally done immediately, but it can be deferred.
   mp{r,s}_diag_register() did not check to see whether the callback
   was already done before proceeding on.  We now sleep until the
   callback is done if it is deferred.

 o No call to bus_dmamap_sync(... BUS_DMASYNC_PREREAD) after the
   memory is allocated and loaded.  This is necessary on some
   platforms to synchronize host memory that is going to be updated
   by a device.

Both drivers would also panic if the firmware was reinitialized while
a diagnostic buffer operation was in progress.  This fixes that problem
as well.  (The driver will reinitialize the firmware in various
circumstances, but the problem I ran into was that the firmware would
generate an IOC Fault due to a PCIe error.)

mp{r,s}var.h:
Add a new structure, struct mpr_busdma_context, that is
used for deferred busdma load callbacks.

Add a prototype for mp{r,s}_memaddr_wait_cb().
mp{r,s}.c:
Add a new busdma callback function, mp{r,s}_memaddr_wait_cb().
This provides synchronization for callers that want to
wait on a deferred bus_dmamap_load() callback.

mp{r,s}_user.c:
In bus_dmamap_register(), add a call to bus_dmamap_sync()
with the BUS_DMASYNC_PREREAD flag set after an allocation
is loaded.

Also, check the return value of bus_dmamap_load().  If it
fails, bail out.  If it is EINPROGRESS, wait for the
callback to happen.  We use an interruptible sleep (msleep
with PCATCH) and let the callback clean things up if we get
interrupted.

In mpr_diag_read_buffer() and mps_diag_read_buffer(), call
bus_dmamap_sync(..., BUS_DMASYNC_POSTREAD) before copying
the data out to make sure the data is in stable storage.

In mp{r,s}_post_fw_diag_buffer() and
mp{r,s}_release_fw_diag_buffer(), check the reply to see
whether it is NULL.  It can be NULL (and the command non-NULL)
if the controller gets reinitialized while we're waiting for
the command to complete but the driver structures aren't
reallocated.  The driver structures generally won't be
reallocated unless there is a firmware upgrade that changes
one of the IOCFacts.

When freeing diagnostic buffers in mp{r,s}_diag_register()
and mp{r,s}_diag_unregister(), zero/NULL out the buffer after
freeing it.  This will prevent a duplicate free in some
situations.

Sponsored by: Spectra Logic
Reviewed by: mav, scottl
MFC after: 1 week
Differential Revision: D13453

6 years agocrossbuild: Make the CHECK_TIME variable work on Linux
arichardson [Tue, 6 Feb 2018 15:41:45 +0000 (15:41 +0000)]
crossbuild: Make the CHECK_TIME variable work on Linux

Linux /usr/bin/find doesn't understand the -mtime -0s flag.
Instead create a temporary file and compare that file's mtime to
sys/sys/param.h to check whether the clock is correct.

Reviewed By: jhb, imp
Approved By: jhb (mentor)
Differential Revision: https://reviews.freebsd.org/D14157

6 years agoDon't hardcode /usr/bin as the path for mktemp in build tools
arichardson [Tue, 6 Feb 2018 15:41:35 +0000 (15:41 +0000)]
Don't hardcode /usr/bin as the path for mktemp in build tools

It won't work e.g. when crossbuilding from Ubuntu Linux as mktemp is in
/bin there.

Reviewed By: bdrewery
Approved By: jhb (mentor)
Differential Revision: https://reviews.freebsd.org/D13937

6 years agoAllow compiling usr.bin/find on Linux and Mac
arichardson [Tue, 6 Feb 2018 15:41:26 +0000 (15:41 +0000)]
Allow compiling usr.bin/find on Linux and Mac

When building FreeBSD the makefiles invoke find with various flags such as
`-s` that aren't supported in the native /usr/bin/find. To fix this I
build the FreeBSD version of find and use that when crossbuilding.

Inserting lots if #ifdefs in the code is rather ugly but I don't see a
better solution.

Reviewed By: brooks (mentor)
Approved By: jhb (mentor)
Differential Revision: https://reviews.freebsd.org/D13306

6 years agoMake mips_postboot_fixup work when building the kernel with clang+lld
arichardson [Tue, 6 Feb 2018 15:41:15 +0000 (15:41 +0000)]
Make mips_postboot_fixup work when building the kernel with clang+lld

The compiler/linker can align fake_preload anyway it would like. When
building the kernel with gcc+bfd this always happened to be a multiple of 8.
When I built the kernel with clang and linked with lld fake_preload
happened to only be aligned to 4 bytes which caused a an ADDRS trap because
the compiler will emit sd instructions to store to this buffer.

Reviewed By: jhb, imp
Approved By: jhb (mentor)
Differential Revision: https://reviews.freebsd.org/D14018

6 years ago- Document new ${name}_limits rc.conf option
amdmi3 [Tue, 6 Feb 2018 15:30:17 +0000 (15:30 +0000)]
- Document new ${name}_limits rc.conf option

Approved by: cy
MFC after: 2 weeks (along with 328331 which introduced this option)
Differential Revision: https://reviews.freebsd.org/D14028

6 years agodtb/allwinner: Add sun7i-a20-lamobo-r1.dts (Banana Pi R1)
kevans [Tue, 6 Feb 2018 14:57:03 +0000 (14:57 +0000)]
dtb/allwinner: Add sun7i-a20-lamobo-r1.dts (Banana Pi R1)

FreeBSD boots on this board, but the ethernet switch is not currently
supported, resulting in no ethernet.

A U-Boot port will be added once the ethernet switch is at least basically
supported, but we add its DTS to the build here to lower the barrier-to-boot
while work is underway.

6 years agoRemove libreadline from the source tree, all consumers but gdb
bapt [Tue, 6 Feb 2018 12:22:42 +0000 (12:22 +0000)]
Remove libreadline from the source tree, all consumers but gdb
has been switched to libedit long ago, libreadline was built as an
internallib for a while and kept only for gdbtui which was broken using
libreadline.

Since gdb has been mostly deorbitted in all arches, gdbtui was only installed
on arm and sparc64, given it has been removed, gdb has been switched to use
libedit, no consumers are left for libreadline. Thus this removal

6 years agoCommit forgotten change in gdb allowing to use libedit
bapt [Tue, 6 Feb 2018 12:17:03 +0000 (12:17 +0000)]
Commit forgotten change in gdb allowing to use libedit

6 years agoSwitch to use libedit instead of readline
bapt [Tue, 6 Feb 2018 12:12:44 +0000 (12:12 +0000)]
Switch to use libedit instead of readline

6 years agoRemove gdbtui, it was already not installed on every arches
bapt [Tue, 6 Feb 2018 11:54:20 +0000 (11:54 +0000)]
Remove gdbtui, it was already not installed on every arches
only installed on arm and sparc64.
It is the only bits that keeps us having libreadline in base
The rest of gdb can be switched to libedit and will be in another
commit

6 years ago[arswitch] Implement the switch MAC address fetch API.
adrian [Tue, 6 Feb 2018 08:35:49 +0000 (08:35 +0000)]
[arswitch] Implement the switch MAC address fetch API.

The placeholders are here for some future "set" MAC address API.

Tested:

* AR9340 switch
* AR8327 switch

6 years ago[etherswitchcfg] print the switch MAC address if provided.
adrian [Tue, 6 Feb 2018 08:35:09 +0000 (08:35 +0000)]
[etherswitchcfg] print the switch MAC address if provided.

6 years ago[etherswitch] add initial support for potentially configuring and fetching the switch...
adrian [Tue, 6 Feb 2018 08:34:50 +0000 (08:34 +0000)]
[etherswitch] add initial support for potentially configuring and fetching the switch MAC address.

Switches that originate their own frames (eg obvious ones like Pause frames)
need a MAC address to use to send those frames from.

This API will hopefully begin to allow that to be configurable.

6 years agoFix a case where a request frame can be composed that requires 2 or more
scottl [Tue, 6 Feb 2018 06:55:55 +0000 (06:55 +0000)]
Fix a case where a request frame can be composed that requires 2 or more
SGList elements, but there's only enough space in the request frame for
either 1 element or a chain frame pointer.  Previously, the code would
hit the wrong case, add the SGList element, but then fail to add the
chain frame due to lack of space.  Re-arrange the code to catch this case
earlier and handle it.

Sponsored by: Netflix

6 years agoReturn a C errno for cam_periph_acquire().
scottl [Tue, 6 Feb 2018 06:42:25 +0000 (06:42 +0000)]
Return a C errno for cam_periph_acquire().

There's no compelling reason to return a cam_status type for this
function and doing so only creates confusion with normal C
coding practices. It's technically an API change, but the periph API
isn't widely used. No efffective change to operation.

Reviewed by: imp, mav, ken
Sponsored by: Netflix
Differential Revision: D14063

6 years agoCorrect structure name used in bus_map_resource(9) example
bryanv [Tue, 6 Feb 2018 04:28:21 +0000 (04:28 +0000)]
Correct structure name used in bus_map_resource(9) example

Reviewed by: jhb
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D14188

6 years agoFollowup on r302393 by cperciva, improving calculation of boot pages required
glebius [Tue, 6 Feb 2018 04:16:00 +0000 (04:16 +0000)]
Followup on r302393 by cperciva, improving calculation of boot pages required
for UMA startup.

o Introduce another stage of UMA startup, which is entered after
  vm_page_startup() finishes. After this stage we don't yet enable buckets,
  but we can ask VM for pages. Rename stages to meaningful names while here.
  New list of stages: BOOT_COLD, BOOT_STRAPPED, BOOT_PAGEALLOC, BOOT_BUCKETS,
  BOOT_RUNNING.
  Enabling page alloc earlier allows us to dramatically reduce number of
  boot pages required. What is more important number of zones becomes
  consistent across different machines, as no MD allocations are done before
  the BOOT_PAGEALLOC stage. Now only UMA internal zones actually need to use
  startup_alloc(), however that may change, so vm_page_startup() provides
  its need for early zones as argument.
o Introduce uma_startup_count() function, to avoid code duplication. The
  functions calculates sizes of zones zone and kegs zone, and calculates how
  many pages UMA will need to bootstrap.
  It counts not only of zone structures, but also of kegs, slabs and hashes.
o Hide uma_startup_foo() declarations from public file.
o Provide several DIAGNOSTIC printfs on boot_pages usage.
o Bugfix: when calculating zone of zones size use (mp_maxid + 1) instead of
  mp_ncpus. Use resulting number not only in the size argument to zone_ctor()
  but also as args.size.

Reviewed by: imp, gallatin (earlier version)
Differential Revision: https://reviews.freebsd.org/D14054

6 years agoOccasional cylinder-group check-hash errors were being reported on
mckusick [Tue, 6 Feb 2018 00:19:46 +0000 (00:19 +0000)]
Occasional cylinder-group check-hash errors were being reported on
systems running with a heavy filesystem load. Tracking down this
bug was elusive because there were actually two problems. Sometimes
the in-memory check hash was wrong and sometimes the check hash
computed when doing the read was wrong. The occurrence of either
error caused a check-hash mismatch to be reported.

The first error was that the check hash in the in-memory cylinder
group was incorrect. This error was caused by the following
sequence of events:

- We read a cylinder-group buffer and the check hash is valid.
- We update its cg_time and cg_old_time which makes the in-memory
  check-hash value invalid but we do not mark the cylinder group dirty.
- We do not make any other changes to the cylinder group, so we
  never mark it dirty, thus do not write it out, and hence never
  update the incorrect check hash for the in-memory buffer.
- Later, the buffer gets freed, but the page with the old incorrect
  check hash is still in the VM cache.
- Later, we read the cylinder group again, and the first page with
  the old check hash is still in the VM cache, but some other pages
  are not, so we have to do a read.
- The read does not actually get the first page from disk, but rather
  from the VM cache, resulting in the old check hash in the buffer.
- The value computed after doing the read does not match causing the
  error to be printed.

The fix for this problem is to only set cg_time and cg_old_time as
the cylinder group is being written to disk. This keeps the in-memory
check-hash valid unless the cylinder group has had other modifications
which will require it to be written with a new check hash calculated.
It also requires that the check hash be recalculated in the in-memory
cylinder group when it is marked clean after doing a background write.

The second problem was that the check hash computed at the end of the
read was incorrect because the calculation of the check hash on
completion of the read was being done too soon.

- When a read completes we had the following sequence:

  - bufdone()
  -- b_ckhashcalc (calculates check hash)
  -- bufdone_finish()
  --- vfs_vmio_iodone() (replaces bogus pages with the cached ones)

- When we are reading a buffer where one or more pages are already
  in memory (but not all pages, or we wouldn't be doing the read),
  the I/O is done with bogus_page mapped in for the pages that exist
  in the VM cache. This mapping is done to avoid corrupting the
  cached pages if there is any I/O overrun. The vfs_vmio_iodone()
  function is responsible for replacing the bogus_page(s) with the
  cached ones. But we were calculating the check hash before the
  bogus_page(s) were replaced. Hence, when we were calculating the
  check hash, we were partly reading from bogus_page, which means
  we calculated a bad check hash (e.g., because multiple pages have
  been mapped to bogus_page, so its contents are indeterminate).

The second fix is to move the check-hash calculation from bufdone()
to bufdone_finish() after the call to vfs_vmio_iodone() so that it
computes the check hash over the correct set of pages.

With these two changes, the occasional cylinder-group check-hash
errors are gone.

Submitted by: David Pfitzner <dpfitzner@netflix.com>
Reviewed by: kib
Tested by: David Pfitzner

6 years agoMove signal trampolines out of locore.s into separate source file.
kib [Tue, 6 Feb 2018 00:02:30 +0000 (00:02 +0000)]
Move signal trampolines out of locore.s into separate source file.

Similar to other arches, the move makes the subject of locore.s only
the kernel startup.

Sponsored by: The FreeBSD Foundation
MFC after: 1 week

6 years agobwn(4): migrate bwn(4) to the native bhnd(9) interface, and drop siba_bwn.
landonf [Mon, 5 Feb 2018 23:38:15 +0000 (23:38 +0000)]
bwn(4): migrate bwn(4) to the native bhnd(9) interface, and drop siba_bwn.

- Remove the shim interface that allowed bwn(4) to use either siba_bwn or
  bhnd(4), replacing all siba_bwn calls with their bhnd(4) bus equivalents.
- Drop the legay, now-unused siba_bwn bus driver.
- Clean up bhnd(4) board flag defines referenced by bwn(4).

Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D13518

6 years agoIgnore relocation tables for non-memory-resident sections.
jhb [Mon, 5 Feb 2018 23:35:33 +0000 (23:35 +0000)]
Ignore relocation tables for non-memory-resident sections.

As a followup to r328101, ignore relocation tables for ELF object
sections that are not memory resident.  For modules loaded by the
loader, ignore relocation tables whose associated section was not
loaded by the loader (sh_addr is zero).  For modules loaded at runtime
via kldload(2), ignore relocation tables whose associated section is
not marked with SHF_ALLOC.

Reported by: Mori Hiroki <yamori813@yahoo.co.jp>, adrian
Tested on: mips, mips64
MFC after: 1 month
Sponsored by: DARPA / AFRL

6 years agoFix a typo.
jhb [Mon, 5 Feb 2018 23:29:50 +0000 (23:29 +0000)]
Fix a typo.

6 years agoAlways give ELF brands a chance to veto a match.
jhb [Mon, 5 Feb 2018 23:27:42 +0000 (23:27 +0000)]
Always give ELF brands a chance to veto a match.

If a brand provides a header_supported hook, check it when trying to
find a brand based on a matching interpreter as well as in the final
loop for the fallback brand. Previously a brand might reject a binary
via a header_supported hook in one of the earlier loops, but still be
chosen by one of these later loops.

Reviewed by: kib
Obtained from: CheriBSD
MFC after: 2 weeks
Sponsored by: DARPA / AFRL
Differential Revision: https://reviews.freebsd.org/D13945

6 years ago[arswitch] disable ARP copy-to-CPU port for AR9340 for now.
adrian [Mon, 5 Feb 2018 20:37:29 +0000 (20:37 +0000)]
[arswitch] disable ARP copy-to-CPU port for AR9340 for now.

I'll have to go double check to see if it does indeed pass ARP frames between
switch ports with this disabled, but it seems required for the CPU port to see
ARP traffic.

I'll dig into this some more.

6 years ago[arswitch] fix build breakage.
adrian [Mon, 5 Feb 2018 20:30:53 +0000 (20:30 +0000)]
[arswitch] fix build breakage.

Apparently the last time I checked building this it didn't pick up that the
header had changed.

6 years agoReduce duplication in extattr_*_(file|link) syscalls.
brooks [Mon, 5 Feb 2018 19:06:34 +0000 (19:06 +0000)]
Reduce duplication in extattr_*_(file|link) syscalls.

Reviewed by: rwatson
Obtained from: CheriBSD
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D14173

6 years agoANSIfy syscall implementations.
brooks [Mon, 5 Feb 2018 18:58:55 +0000 (18:58 +0000)]
ANSIfy syscall implementations.

Reviewed by: rwatson
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D14172

6 years agoFix and enable SysV IPC tests.
brooks [Mon, 5 Feb 2018 18:48:00 +0000 (18:48 +0000)]
Fix and enable SysV IPC tests.

Don't declare some types that FreeBSD incorrectly declares.

Fix an incorrect call to open() (missing mode).

ANSIfy prototypes.

Enable SysV message queue, semaphore, and shared memory tests.

With exception of the workaround for union semun, these fixes have been
committed to NetBSD.

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

6 years agoCorrect Russia spelling in regdomain.xml
emaste [Mon, 5 Feb 2018 18:45:21 +0000 (18:45 +0000)]
Correct Russia spelling in regdomain.xml

PR: 225658
MFC after: 1 week

6 years agoAdditional linuxolator whitespace cleanup, missed in r328890
emaste [Mon, 5 Feb 2018 18:39:06 +0000 (18:39 +0000)]
Additional linuxolator whitespace cleanup, missed in r328890

6 years agoFix makecontext() on MIPS O32.
jhb [Mon, 5 Feb 2018 18:10:28 +0000 (18:10 +0000)]
Fix makecontext() on MIPS O32.

The GP register can be clobbered by the callback, so save it in S1
while invoking the callback function.

While here, add a comment expounding on the treatment of GP for the
various ABIs and the assumptions made.

Reviewed by: jmallett (earlier version)
Sponsored by: DARPA / AFRL
Differential Revision: https://reviews.freebsd.org/D14179

6 years agoGarbage collect trailing whitespace.
brooks [Mon, 5 Feb 2018 18:06:54 +0000 (18:06 +0000)]
Garbage collect trailing whitespace.

Sponsored by: DARPA, AFRL

6 years agoDocument the need for WITH_CASPER.
markj [Mon, 5 Feb 2018 17:33:16 +0000 (17:33 +0000)]
Document the need for WITH_CASPER.

After r325062, consumers need to define WITH_CASPER for libcasper to
function as expected.

6 years agoLinuxolator whitespace cleanup
emaste [Mon, 5 Feb 2018 17:29:12 +0000 (17:29 +0000)]
Linuxolator whitespace cleanup

A version of each of the MD files by necessity exists for each CPU
architecture supported by the Linuxolator.  Clean these up so that new
architectures do not inherit whitespace issues.

Clean up shared Linuxolator files while here.

Sponsored by: Turing Robotic Industries Inc.

6 years agoext2fs: remove EXT4F_RO_INCOMPAT_SUPP
pfg [Mon, 5 Feb 2018 15:14:01 +0000 (15:14 +0000)]
ext2fs: remove EXT4F_RO_INCOMPAT_SUPP

This was a hack to be able to mount ext4 filesystems read-only while not
supporting all the features. We now support all those features so it
doesn't make sense to keep the undocumented hack.

Discussed with: fsu

6 years agoMove assym.s to DPSRCS in linux modules
emaste [Mon, 5 Feb 2018 14:53:18 +0000 (14:53 +0000)]
Move assym.s to DPSRCS in linux modules

assym.s exists only to be included by other .s files, and should not
actually be assembled by itself.

Sponsored by: Turing Robotic Industries Inc.

6 years agoext2fs: Cleanup variable assignments for extents.
pfg [Mon, 5 Feb 2018 14:30:27 +0000 (14:30 +0000)]
ext2fs: Cleanup variable assignments for extents.

Delay the initialization of variables until the are needed.

In the case of ext4_ext_rm_leaf(), make sure 'error' value is not
undefined.

Reported by: Clang's static analyzer
Differential Revision: https://reviews.freebsd.org/D14193

6 years agozfs: move a utility function, ioflags, closer to its consumers
avg [Mon, 5 Feb 2018 14:19:36 +0000 (14:19 +0000)]
zfs: move a utility function, ioflags, closer to its consumers

No functional change.

MFC after: 1 week

6 years agoOn munlock(), unwire correct page.
kib [Mon, 5 Feb 2018 12:49:20 +0000 (12:49 +0000)]
On munlock(), unwire correct page.

It is possible, for complex fork()/collapse situations, to have
sibling address spaces to partially share shadow chains. If one
sibling performs wiring, it can happen that a transient page, invalid
and busy, is installed into a shadow object which is visible to other
sibling for the duration of vm_fault_hold().  When the backing object
contains the valid page, and the wiring is performed on read-only
entry, the transient page is eventually removed.

But the sibling which observed the transient page might perform the
unwire, executing vm_object_unwire().  There, the first page found in
the shadow chain is considered as the page that was wired for the
mapping.  It is really the page below it which is wired.  So we unwire
the wrong page, either triggering the asserts of breaking the page'
wire counter.

As the fix, wait for the busy state to finish if we find such page
during unwire, and restart the shadow chain walk after the sleep.

Reported and tested by: pho
Reviewed by: markj
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D14184

6 years agoModify ip6_get_prevhdr() to be able use it safely.
ae [Mon, 5 Feb 2018 09:22:07 +0000 (09:22 +0000)]
Modify ip6_get_prevhdr() to be able use it safely.

Instead of returning pointer to the previous header, return its offset.
In frag6_input() use m_copyback() and determined offset to store next
header instead of accessing to it by pointer and assuming that the memory
is contiguous.

In rip6_input() use offset returned by ip6_get_prevhdr() instead of
calculating it from pointers arithmetic, because IP header can belong
to another mbuf in the chain.

Reported by: Maxime Villard <max at m00nbsd dot net>
Reviewed by: kp
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D14158

6 years ago[arswitch] Enable ATU dump support for the AR9340.
adrian [Mon, 5 Feb 2018 07:05:28 +0000 (07:05 +0000)]
[arswitch] Enable ATU dump support for the AR9340.

This indeed uses the same registers as the AR8216 and later chips.

There seems to be an issue with ARP requests being sent out from the CPU
through this switch here, so figuring that out is next.  Learning works fine on
the AR8327 ethernet switch on the /other/ gigabit ethernet port, so I don't
think it's the network stack or ethernet driver.

Tested:

* DB120 - AR9340 SOC + ethernet switch (and other bits.)

6 years ago[arswitch] fix mac address field definition.
adrian [Mon, 5 Feb 2018 07:03:45 +0000 (07:03 +0000)]
[arswitch] fix mac address field definition.

Whilst here, add some further fields for future experimenting.

Tested:

* AR9340 switch
* AR9330 switch
* AR7240 switch

6 years ago[arswitch] Break out of the loop upon any error, not just -1.
adrian [Mon, 5 Feb 2018 05:51:37 +0000 (05:51 +0000)]
[arswitch] Break out of the loop upon any error, not just -1.

This fixes the AR9340 "unimplemented" thingy for now.

6 years ago[ar71xx] Fix DB120 AHB device hints in the new world order.
adrian [Mon, 5 Feb 2018 04:48:41 +0000 (04:48 +0000)]
[ar71xx] Fix DB120 AHB device hints in the new world order.

This allows the on-chip (AHB bus) device to attach correctly as a module.

Tested:

* DB120, AR9344 (SoC + 2x2 2G wifi) + QCA9580 PCI 3x3 5G wifi

6 years ago[ar71xx] AR934x is a MIPS74k board - use the right hwpmc module
adrian [Mon, 5 Feb 2018 04:47:13 +0000 (04:47 +0000)]
[ar71xx] AR934x is a MIPS74k board - use the right hwpmc module

6 years ago[ar71xx] New world order - don't reference ath_pci here, it's a module now
adrian [Mon, 5 Feb 2018 04:46:36 +0000 (04:46 +0000)]
[ar71xx] New world order - don't reference ath_pci here, it's a module now

6 years agoFlesh out the creation of sparc64 UFS images. This has only been verified
marius [Mon, 5 Feb 2018 00:18:21 +0000 (00:18 +0000)]
Flesh out the creation of sparc64 UFS images. This has only been verified
to yield working images in a native build as rootgen.sh generally doesn't
support cross-testing so far.

6 years agopsm(4): Fix panic occuring soon after PS/2 packet has been rejected by
wulf [Sun, 4 Feb 2018 23:01:48 +0000 (23:01 +0000)]
psm(4): Fix panic occuring soon after PS/2 packet has been rejected by
synaptics or elantech sanity checker.

After packet has been rejected contents of packet buffer is not cleared
with setting of inputbytes counter to 0. So when this packet buffer is
filled again being an element of circular queue, new data appends to old
data rather than overwrites it. This leads to packet buffer overflow
after 10 rounds.

Fix it with setting of packet's inputbytes counter to 0 after rejection.

While here add extra logging of rejected packets.

PR: 222667 (for reference)
Reported by: Neel Chauhan <neel@neelc.org>
Tested by: Neel Chauhan <neel@neelc.org>
MFC after: 1 week

6 years agoBump clang's __FreeBSD_cc_version, to cope with r328816, which removed
dim [Sun, 4 Feb 2018 20:33:47 +0000 (20:33 +0000)]
Bump clang's __FreeBSD_cc_version, to cope with r328816, which removed
-Wno-error=tautological-constant-compare again (this flag is now out of
-Wextra after upstream https://reviews.llvm.org/rL322901).  Otherwise
the MK_SYSTEM_COMPILER logic will not build a cross-tools compiler.

Reported by: jpaetzel, tuexen, Stefan Hagen

6 years agoOnly look for L2 cache controllers for mpc85xx_cache
jhibbits [Sun, 4 Feb 2018 20:07:08 +0000 (20:07 +0000)]
Only look for L2 cache controllers for mpc85xx_cache

The L3 cache controller (Corenet Platform Cache) is listed with one of its
compatible strings as "cache", which this driver can't attach to.  Restrict
to a known list of primary cache controller strings, as found in the l2cache
devicetree binding.

6 years agoUpdate blacklist-helper to not emit messages from pf during operation.
lidl [Sun, 4 Feb 2018 19:43:51 +0000 (19:43 +0000)]
Update blacklist-helper to not emit messages from pf during operation.

Use 'pfctl -k' when blocking a site to kill active tcp connections
from the blocked address.

Fix 'purge' operation for pf, which must dynamically determine which
filters have been created, so the filters can be flushed by name.

MFC after: 2 weeks

6 years agoSprinkle static; avoid nested externs.
trasz [Sun, 4 Feb 2018 19:05:13 +0000 (19:05 +0000)]
Sprinkle static; avoid nested externs.

MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation

6 years agoAdd missing initializer.
trasz [Sun, 4 Feb 2018 18:40:36 +0000 (18:40 +0000)]
Add missing initializer.

MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation

6 years agoRename getty's getline() to get_line(), to avoid clash with getline(3).
trasz [Sun, 4 Feb 2018 18:39:58 +0000 (18:39 +0000)]
Rename getty's getline() to get_line(), to avoid clash with getline(3).

Obtained from: DragonFlyBSD
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation

6 years agoDon't cast away the const, it's not been needed since r92925.
trasz [Sun, 4 Feb 2018 18:36:24 +0000 (18:36 +0000)]
Don't cast away the const, it's not been needed since r92925.

MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation

6 years agoRemove now-unused variable after r328809
kevans [Sun, 4 Feb 2018 17:31:50 +0000 (17:31 +0000)]
Remove now-unused variable after r328809

Fixed already in stable/11 by r328836 (emaste); remove now-unused variable.

6 years agoStart building modules for MPC85XX and MPC85XXSPE
jhibbits [Sun, 4 Feb 2018 15:40:48 +0000 (15:40 +0000)]
Start building modules for MPC85XX and MPC85XXSPE

These kernels aren't restricted to development boards anymore, they are
closer in behavior to GENERIC, so build modules.

6 years agoAdd sdhci to MPC85XX build
jhibbits [Sun, 4 Feb 2018 15:39:15 +0000 (15:39 +0000)]
Add sdhci to MPC85XX build

6 years agoMinimal changes for MPR to build on architectures with physical addresses larger...
jhibbits [Sun, 4 Feb 2018 15:37:58 +0000 (15:37 +0000)]
Minimal changes for MPR to build on architectures with physical addresses larger than virtual

Summary:
Some architectures use large (36-bit) physical addresses, with smaller
virtual addresses.  Casting between vm_paddr_t (or bus_addr_t) and void * is
considered illegal, so cast through uintptr_t.  No functional change on existing
platforms.

Reviewed By: scottl
Differential Revision: https://reviews.freebsd.org/D14042

6 years agogeom: don't write stack garbage in disk labels
asomers [Sun, 4 Feb 2018 14:49:55 +0000 (14:49 +0000)]
geom: don't write stack garbage in disk labels

Most consumers of g_metadata_store were passing in partially unallocated
memory, resulting in stack garbage being written to disk labels. Fix them by
zeroing the memory first.

gvirstor repeated the same mistake, but in the kernel.

Also, glabel's label contained a fixed-size string that wasn't
initialized to zero.

PR: 222077
Reported by: Maxim Khitrov <max@mxcrypt.com>
Reviewed by: cem
MFC after: 3 weeks
X-MFC-With: 323314
X-MFC-With: 323338
Differential Revision: https://reviews.freebsd.org/D14164

6 years agoCreate GENERIC64-NODEBUG for powerpc64
swills [Sun, 4 Feb 2018 14:27:12 +0000 (14:27 +0000)]
Create GENERIC64-NODEBUG for powerpc64

Approved by: jhibbits
Differential Revision: https://reviews.freebsd.org/D14192

6 years agoInitialize all the fields. This is one of the steps required to bump WARNS.
trasz [Sun, 4 Feb 2018 13:58:31 +0000 (13:58 +0000)]
Initialize all the fields.  This is one of the steps required to bump WARNS.

MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation

6 years agoReduce code duplication; no functional changes.
trasz [Sun, 4 Feb 2018 13:55:20 +0000 (13:55 +0000)]
Reduce code duplication; no functional changes.

Obtained from: NetBSD
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation

6 years agoRemove unused variable.
trasz [Sun, 4 Feb 2018 13:54:05 +0000 (13:54 +0000)]
Remove unused variable.

MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation

6 years agoAdd the ThinkPad X1 (sandybridge) to the bsdinstall blacklist
allanjude [Sun, 4 Feb 2018 12:16:36 +0000 (12:16 +0000)]
Add the ThinkPad X1 (sandybridge) to the bsdinstall blacklist

MFC after: 2 weeks
Sponsored by: FOSDEM IllumOS Table

6 years ago[arswitch] fix up issues on the AR8327.
adrian [Sun, 4 Feb 2018 08:22:11 +0000 (08:22 +0000)]
[arswitch] fix up issues on the AR8327.

This correctly dumps the ethernet bridge contents on an AR8327 switch.

Tested:

* AP135 - QCA9550 + AR8327 ethernet switch:

# etherswitchcfg atu dump
 [0] c0:3f:d5:7e:6f:45: portmask 0x00000004
 [1] f6:b6:03:96:1e:ba: portmask 0x00000004
 [2] 00:03:7f:11:38:4f: portmask 0x00000040
# arp -na
? (192.168.3.170) at 00:03:7f:11:38:4f on arge0 permanent [ethernet]
? (192.168.3.12) at c0:3f:d5:7e:6f:45 on arge0 expires in 1188 seconds [ethernet]
? (192.168.3.1) at f6:b6:03:96:1e:ba on arge0 expires in 1186 seconds [ethernet]

6 years agoFix regression introduced in r328806, preventing boot at least on all
nwhitehorn [Sat, 3 Feb 2018 23:49:21 +0000 (23:49 +0000)]
Fix regression introduced in r328806, preventing boot at least on all
PowerPC Apple hardware, and likely all Open Firmware systems.

The loader would allocate memory for its heap at whatever address Open
Firmware gave it, which would in general be the lowest unallocated address,
usually starting a page or two above 0. As the kernel is linked at 1 MB,
and loader insists on running the kernel at its link address, any heap
larger than 1 MB would overlap the kernel, causing loader memory allocations
to corrupt the kernel and vice versa.

Although r328806 made this problem much worse by increasing the heap size
to 8 MB, causing 88% of the loader heap to overlap with the kernel, the
problem has always existed. The old heap size was 1 MB and, unless that
started exactly at zero, which would cause other problems, some number of
pages of the loader heap still overlapped with the kernel.

This patch solves the issue in two ways and cleans up some related code:
- Moves the loader heap inside of the loader. This guarantees that the
  heap will be contiguous with the loader and simplifies the heap
  allocation code at no cost, since the heap lives in BSS.
- Moves the loader, previously at 28 MB and dangerously close to the kernel
  it loads, a bit higher to 44 MB. This has the effect of breaking loader
  on non-embedded PPC machines with < 48 MB of RAM, but we did not support
  those anyway.

The fundamental problem is that the way loader loads ELF files is
incredibly fragile, but that can't be fixed without fundamental
architectural changes.

MFC after: 10 days

6 years agoo Let rtld(1) set up psABI user trap handlers prior to executing the
marius [Sat, 3 Feb 2018 23:14:11 +0000 (23:14 +0000)]
o Let rtld(1) set up psABI user trap handlers prior to executing the
  objects' init functions instead of doing the setup via a constructor
  in libc as the init functions may already depend on these handlers
  to be in place. This gets us rid of:
  - the undefined order in which libc constructors as __guard_setup()
    and jemalloc_constructor() are executed WRT __sparc_utrap_setup(),
  - the requirement to link libc last so __sparc_utrap_setup() gets
    called prior to constructors in other libraries (see r122883).
  For static binaries, crt1.o still sets up the user trap handlers.
o Move misplaced prototypes for MD functions in to the MD prototype
  section of rtld.h.
o Sprinkle nitems().

6 years agoFix backward conditional.
imp [Sat, 3 Feb 2018 21:56:38 +0000 (21:56 +0000)]
Fix backward conditional.

Pointed out by: david boyer

6 years agonewsyslog: fix typeo for 'zstd'
eadler [Sat, 3 Feb 2018 20:53:21 +0000 (20:53 +0000)]
newsyslog: fix typeo for 'zstd'

Reported by: swildner@DragonFlyBSD.org
MFC After: 1 week

6 years agopthread: adding missing header to man page
eadler [Sat, 3 Feb 2018 20:50:46 +0000 (20:50 +0000)]
pthread: adding missing header to man page

Reported by: swildner@DragonFlyBSD.org

6 years agoAdd new USB ID.
hselasky [Sat, 3 Feb 2018 09:43:32 +0000 (09:43 +0000)]
Add new USB ID.

PR: 225641
Submitted by: Ryan <ryanwinter@outlook.com>
MFC after: 1 week
Sponsored by: Mellanox Technologies

6 years agoAfter r328426, g_label depends on UFS (option FFS) code to read UFS
delphij [Sat, 3 Feb 2018 09:15:13 +0000 (09:15 +0000)]
After r328426, g_label depends on UFS (option FFS) code to read UFS
superblock, and the kernel will fail to link when UFS is not built
in.  This commit makes it depend on a small portion of FFS bits and
thereby fixes build for this situation.

This is intended as an interim bandaid, and the actual superblock
reading code should probably be made independent of UFS, so we do
not need to depend on it (see kib@'s comment in the review for
details), and we will revisit this once the superblock check hashes
are all in place.

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

6 years agoMake cross-endian loader changes apply only to powerpc
emaste [Sat, 3 Feb 2018 01:23:48 +0000 (01:23 +0000)]
Make cross-endian loader changes apply only to powerpc

The cross-endian loader change in r328536 (review D12422) broke symbol
loading on (at least) amd64 kernels.  Temporarily paper over the issue
by restricting the cross-endian support to only powerpc, until a proper
fix arrives.

Submitted by: royger

6 years ago[arswitch] add initial functionality for AR8327 ATU management.
adrian [Sat, 3 Feb 2018 00:59:08 +0000 (00:59 +0000)]
[arswitch] add initial functionality for AR8327 ATU management.

* Add the bulk of the ATU table read function
* Correct how the ATU function and WAIT bits work

TODO:

* more testing, figure out how the multi-vlan table stuff works and push that
  up to userspace

6 years agoCheck for cd9660 support before attempting to mount created images
brooks [Fri, 2 Feb 2018 23:34:33 +0000 (23:34 +0000)]
Check for cd9660 support before attempting to mount created images

This extends the set in r316028 to allow all tests to pass or be skipped
on a system without cd9660 support.

A better approach using tar is possible, but this works today.

Obtained from: CheriBSD
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D10516

6 years agoCheck and report error returns from sbput(3) calls.
mckusick [Fri, 2 Feb 2018 23:26:52 +0000 (23:26 +0000)]
Check and report error returns from sbput(3) calls.
Convert to using cgput(3) for writing cylinder groups.
Check and report error returns from cgput(3).

Submitted by: Bruce Evans <bde@freebsd.org>

6 years agosh: Refactor job status printing, preparing for -o pipefail and similar
jilles [Fri, 2 Feb 2018 22:53:58 +0000 (22:53 +0000)]
sh: Refactor job status printing, preparing for -o pipefail and similar

No functional change is intended.

6 years agoUpgrade our copies of clang, llvm, lld, lldb, compiler-rt and libc++ to
dim [Fri, 2 Feb 2018 22:28:12 +0000 (22:28 +0000)]
Upgrade our copies of clang, llvm, lld, lldb, compiler-rt and libc++ to
6.0.0 (branches/release_60 r324090).

This introduces retpoline support, with the -mretpoline flag.  The
upstream initial commit message (r323155 by Chandler Carruth) contains
quite a bit of explanation.  Quoting:

  Introduce the "retpoline" x86 mitigation technique for variant #2 of
  the speculative execution vulnerabilities disclosed today,
  specifically identified by CVE-2017-5715, "Branch Target Injection",
  and is one of the two halves to Spectre.

  Summary:
  First, we need to explain the core of the vulnerability. Note that
  this is a very incomplete description, please see the Project Zero
  blog post for details:
  https://googleprojectzero.blogspot.com/2018/01/reading-privileged-memory-with-side.html

  The basis for branch target injection is to direct speculative
  execution of the processor to some "gadget" of executable code by
  poisoning the prediction of indirect branches with the address of
  that gadget. The gadget in turn contains an operation that provides a
  side channel for reading data. Most commonly, this will look like a
  load of secret data followed by a branch on the loaded value and then
  a load of some predictable cache line. The attacker then uses timing
  of the processors cache to determine which direction the branch took
  *in the speculative execution*, and in turn what one bit of the
  loaded value was. Due to the nature of these timing side channels and
  the branch predictor on Intel processors, this allows an attacker to
  leak data only accessible to a privileged domain (like the kernel)
  back into an unprivileged domain.

  The goal is simple: avoid generating code which contains an indirect
  branch that could have its prediction poisoned by an attacker. In
  many cases, the compiler can simply use directed conditional branches
  and a small search tree. LLVM already has support for lowering
  switches in this way and the first step of this patch is to disable
  jump-table lowering of switches and introduce a pass to rewrite
  explicit indirectbr sequences into a switch over integers.

  However, there is no fully general alternative to indirect calls. We
  introduce a new construct we call a "retpoline" to implement indirect
  calls in a non-speculatable way. It can be thought of loosely as a
  trampoline for indirect calls which uses the RET instruction on x86.
  Further, we arrange for a specific call->ret sequence which ensures
  the processor predicts the return to go to a controlled, known
  location. The retpoline then "smashes" the return address pushed onto
  the stack by the call with the desired target of the original
  indirect call. The result is a predicted return to the next
  instruction after a call (which can be used to trap speculative
  execution within an infinite loop) and an actual indirect branch to
  an arbitrary address.

  On 64-bit x86 ABIs, this is especially easily done in the compiler by
  using a guaranteed scratch register to pass the target into this
  device.  For 32-bit ABIs there isn't a guaranteed scratch register
  and so several different retpoline variants are introduced to use a
  scratch register if one is available in the calling convention and to
  otherwise use direct stack push/pop sequences to pass the target
  address.

  This "retpoline" mitigation is fully described in the following blog
  post: https://support.google.com/faqs/answer/7625886

  We also support a target feature that disables emission of the
  retpoline thunk by the compiler to allow for custom thunks if users
  want them.  These are particularly useful in environments like
  kernels that routinely do hot-patching on boot and want to hot-patch
  their thunk to different code sequences. They can write this custom
  thunk and use `-mretpoline-external-thunk` *in addition* to
  `-mretpoline`. In this case, on x86-64 thu thunk names must be:
  ```
    __llvm_external_retpoline_r11
  ```
  or on 32-bit:
  ```
    __llvm_external_retpoline_eax
    __llvm_external_retpoline_ecx
    __llvm_external_retpoline_edx
    __llvm_external_retpoline_push
  ```
  And the target of the retpoline is passed in the named register, or in
  the case of the `push` suffix on the top of the stack via a `pushl`
  instruction.

  There is one other important source of indirect branches in x86 ELF
  binaries: the PLT. These patches also include support for LLD to
  generate PLT entries that perform a retpoline-style indirection.

  The only other indirect branches remaining that we are aware of are
  from precompiled runtimes (such as crt0.o and similar). The ones we
  have found are not really attackable, and so we have not focused on
  them here, but eventually these runtimes should also be replicated for
  retpoline-ed configurations for completeness.

  For kernels or other freestanding or fully static executables, the
  compiler switch `-mretpoline` is sufficient to fully mitigate this
  particular attack. For dynamic executables, you must compile *all*
  libraries with `-mretpoline` and additionally link the dynamic
  executable and all shared libraries with LLD and pass `-z
  retpolineplt` (or use similar functionality from some other linker).
  We strongly recommend also using `-z now` as non-lazy binding allows
  the retpoline-mitigated PLT to be substantially smaller.

  When manually apply similar transformations to `-mretpoline` to the
  Linux kernel we observed very small performance hits to applications
  running typic al workloads, and relatively minor hits (approximately
  2%) even for extremely syscall-heavy applications. This is largely
  due to the small number of indirect branches that occur in
  performance sensitive paths of the kernel.

  When using these patches on statically linked applications,
  especially C++ applications, you should expect to see a much more
  dramatic performance hit. For microbenchmarks that are switch,
  indirect-, or virtual-call heavy we have seen overheads ranging from
  10% to 50%.

  However, real-world workloads exhibit substantially lower performance
  impact. Notably, techniques such as PGO and ThinLTO dramatically
  reduce the impact of hot indirect calls (by speculatively promoting
  them to direct calls) and allow optimized search trees to be used to
  lower switches. If you need to deploy these techniques in C++
  applications, we *strongly* recommend that you ensure all hot call
  targets are statically linked (avoiding PLT indirection) and use both
  PGO and ThinLTO. Well tuned servers using all of these techniques saw
  5% - 10% overhead from the use of retpoline.

  We will add detailed documentation covering these components in
  subsequent patches, but wanted to make the core functionality
  available as soon as possible. Happy for more code review, but we'd
  really like to get these patches landed and backported ASAP for
  obvious reasons. We're planning to backport this to both 6.0 and 5.0
  release streams and get a 5.0 release with just this cherry picked
  ASAP for distros and vendors.

  This patch is the work of a number of people over the past month:
  Eric, Reid, Rui, and myself. I'm mailing it out as a single commit
  due to the time sensitive nature of landing this and the need to
  backport it. Huge thanks to everyone who helped out here, and
  everyone at Intel who helped out in discussions about how to craft
  this. Also, credit goes to Paul Turner (at Google, but not an LLVM
  contributor) for much of the underlying retpoline design.

  Reviewers: echristo, rnk, ruiu, craig.topper, DavidKreitzer

  Subscribers: sanjoy, emaste, mcrosier, mgorny, mehdi_amini, hiraditya, llvm-commits

  Differential Revision: https://reviews.llvm.org/D41723

MFC after: 3 months
X-MFC-With: r327952
PR: 224669

6 years agoRevert r326375 since the warning has been turned off by default in clang
arichardson [Fri, 2 Feb 2018 22:09:36 +0000 (22:09 +0000)]
Revert r326375 since the warning has been turned off by default in clang

See https://reviews.llvm.org/D41512 and https://reviews.llvm.org/rL322901

Approved By: brooks (mentor)

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

6 years ago[etherswitchcfg] add atu flush and atu dump commands.
adrian [Fri, 2 Feb 2018 22:08:35 +0000 (22:08 +0000)]
[etherswitchcfg] add atu flush and atu dump commands.

Extend the argc/argv handling to include variable length commands (like flush all,
flush port X).

6 years ago[arswitch] Stub out the ATU table dump in AR9340 switches until I implement
adrian [Fri, 2 Feb 2018 22:08:03 +0000 (22:08 +0000)]
[arswitch] Stub out the ATU table dump in AR9340 switches until I implement
this.

6 years agoIn the sbwrite(3) function, ensure that the file descriptor has been
mckusick [Fri, 2 Feb 2018 22:06:15 +0000 (22:06 +0000)]
In the sbwrite(3) function, ensure that the file descriptor has been
upgraded to writable.

Reported by: Kyle Evans <kevans@freebsd.org>

6 years ago[arswitch] begin tidying up the learning and ATU management, introduce ATU APIs.
adrian [Fri, 2 Feb 2018 22:05:36 +0000 (22:05 +0000)]
[arswitch] begin tidying up the learning and ATU management, introduce ATU APIs.

* Refactor the initial learning configuration (port learning, address expiry,
  handling address moving between ports, etc, etc) into a separate HAL routine
* and ensure that it's consistent between switch chips - the AR8216,8316,724x,9331
  SoCs all share the same switch code.
* .. the AR8327 needs doing - the defaults seem OK for now
* .. the AR9340 is different but it's also programmed now.

* Add support for flushing a single port worth of ATU entries
* Add support for fetching the ATU table from AR8216 and derived chips

Tested:

* AR9344, Carambola 2

TODO:

* Further testing on other chips
* Add AR9340 support
* Add AR8327 support

6 years agold.lld.1: miscellaneous style improvements
emaste [Fri, 2 Feb 2018 21:52:00 +0000 (21:52 +0000)]
ld.lld.1: miscellaneous style improvements

Submitted by: wblock in review D13813

6 years agoImplement strcoll as strcmp.
imp [Fri, 2 Feb 2018 21:18:32 +0000 (21:18 +0000)]
Implement strcoll as strcmp.

6 years agoWe need more heap space to properly load newer powerpc kernels.
imp [Fri, 2 Feb 2018 19:42:02 +0000 (19:42 +0000)]
We need more heap space to properly load newer powerpc kernels.

PR: 225323

6 years agoUse daemonfd(3) in the dhclient(8).
oshogbo [Fri, 2 Feb 2018 18:11:56 +0000 (18:11 +0000)]
Use daemonfd(3) in the dhclient(8).

Reviewed by: brooks@
Differential Revision: https://reviews.freebsd.org/D13603

6 years agoAdd kern.ipc.{msqids,semsegs,sema} sysctls for FreeBSD32.
brooks [Fri, 2 Feb 2018 18:03:12 +0000 (18:03 +0000)]
Add kern.ipc.{msqids,semsegs,sema} sysctls for FreeBSD32.

Stop leaking kernel pointers though theses sysctls and make sure that the
padding in the structures is zeroed on allocation to avoid other leaks.

Reviewed by: gordon, kib
Obtained from: CheriBSD
MFC after: 1 week
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D13459

6 years agoFold constants and unify vnc variable names.
rgrimes [Fri, 2 Feb 2018 17:52:09 +0000 (17:52 +0000)]
Fold constants and unify vnc variable names.

Approved by: grehan (mentor)
MFC after: 3 days

6 years agoVendor import of llvm release_60 branch r324090:
dim [Fri, 2 Feb 2018 17:07:53 +0000 (17:07 +0000)]
Vendor import of llvm release_60 branch r324090:
https://llvm.org/svn/llvm-project/llvm/branches/release_60@324090

6 years agoUse standard 2-clause license where copyright is held by the FreeBSD Foundation
emaste [Fri, 2 Feb 2018 16:47:32 +0000 (16:47 +0000)]
Use standard 2-clause license where copyright is held by the FreeBSD Foundation

6 years agoClean up long lines.
rgrimes [Fri, 2 Feb 2018 16:35:17 +0000 (16:35 +0000)]
Clean up long lines.
Approved by: grehan (mentor)
MFC after: 3 days

6 years agoInvent new LDR_INTERP for the loader interpreter to use. Use this in
imp [Fri, 2 Feb 2018 15:40:49 +0000 (15:40 +0000)]
Invent new LDR_INTERP for the loader interpreter to use. Use this in
preference to LIBFICL{,32}. LIBFICL{,32} are now always defined, but
LDR_INTERP{,32} is defined empty when building w/o forth (aka the
simple interpreter) and defined to LIBFICL{,32} when we are building
forth.

6 years agoNow that we no longer conditionally compile some files outside of ficl
imp [Fri, 2 Feb 2018 15:01:54 +0000 (15:01 +0000)]
Now that we no longer conditionally compile some files outside of ficl
with BOOT_FORTH, retire it from here.

6 years agoRemove pcibios forth support.
imp [Fri, 2 Feb 2018 15:01:49 +0000 (15:01 +0000)]
Remove pcibios forth support.

I had thought that this would be useful. However it was committed too
late, and wound up being unused. It's in the way of future work now,
so retire it rather than bring it forward.