MFp4 bz_ipv6_fast:

  Optimize in6_cksum(), re-ordering work and limiting variable
  initialization, removing a bzero() for mostly re-initialized
  struct values, making use of the newly introduced in6_getscope(),
  as well as converting an if/panic to a KASSERT().

  Sponsored by:	The FreeBSD Foundation
  Sponsored by:	iXsystems

Reviewed by:	gnn (as part of the whole)
MFC After:	3 days


git-svn-id: svn+ssh://svn.freebsd.org/base/head@235921 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
Revert devfs part of r235911. I was unaware about old but unfinished
discussion between kib@ and gibbs@ about it.


git-svn-id: svn+ssh://svn.freebsd.org/base/head@235922 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
Revert r220768 for ng_ksocket. This node is special and
when it is cloning, its constructor method may be called
in a context that isn't allowed to sleep.

Noticed by:	Vadim Goncharov


git-svn-id: svn+ssh://svn.freebsd.org/base/head@235923 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
MFp4 bz_ipv6_fast:

  Introduce a (for now copied stripped down) in6_cksum_pseudo()
  function.  We should be able to use this from in6_cksum() but
  we should also ponder possible MD specific improvements.
  It takes an extra csum argument to allow for easy checks as
  will be done by the upper layer protocol input paths.

  Sponsored by:	The FreeBSD Foundation
  Sponsored by:	iXsystems

Reviewed by:	gnn (as part of the whole)
MFC After:	3 days


git-svn-id: svn+ssh://svn.freebsd.org/base/head@235924 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
Fix the following clang warning in drm2:

  sys/dev/drm2/i915/intel_display.c:8861:3: error: expression result unused [-Werror,-Wunused-value]
                  _intel_wait_for(dev,
                  ^~~~~~~~~~~~~~~~~~~~
  @/dev/drm2/i915/intel_drv.h:55:2: note: expanded from macro '_intel_wait_for'
          ret;                                                            \
          ^~~

Reviewed by:	kib
MFC after:	1 week


git-svn-id: svn+ssh://svn.freebsd.org/base/head@235925 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
Work better with how make/bmake works:
1.  Avoid a cd back into ${.CURDIR} to run mkbuiltins when we know make
    will first cd into ${.OBJDIR}. Keep the cwd to what make sets it to.
2.  Don't tell mkbuiltins where to write to (= ${.OBJDIR}), but where to
    get sources from (= ${.CURDIR}). This to compensate for point 1.

This fixes a problem with bmake's mk files that optimize ${.OBJDIR} to
expand to "." after changing cwd, not taking into account that the
target is pretty much undoing that and not getting the full path to the
object tree anymore.


git-svn-id: svn+ssh://svn.freebsd.org/base/head@235927 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
Fix an inconsistency I just ran into for LDADD and DPADD. The description
for both of them use different, and presumably wrong, variables in the
example. They set LDFILES and SRCLIB respectively. I guess that's what
DPADD and LDADD were called first ...


git-svn-id: svn+ssh://svn.freebsd.org/base/head@235928 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
Allow building for the PowerPC EABI by providing a dummy __eabi()
function. The purpose of the __eabi() function is to set up the
runtime and is called first thing by main(). The runtime is already
set up for us prior to caling main, so there's nothing to do for
us in the EABI case.


git-svn-id: svn+ssh://svn.freebsd.org/base/head@235929 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
Preset (clear) the ranges we're supposed to fill from the FDT. If a
particular range (either I/O memory or I/O port) is not defined in
the FDT, we're not handing uninitialized structures back to our caller.


git-svn-id: svn+ssh://svn.freebsd.org/base/head@235930 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
Fix the memory barriers for CPUs that do not like lwsync and wedge or cause
exceptions early enough during boot that the kernel will do ithe same.
Use lwsync only when compiling for LP64 and revert to the more proven isync
when compiling for ILP32. Note that in the end (i.e. between revision 222198
and this change) ILP32 changed from using sync to using isync. As per Nathan
the isync is needed to make sure I/O accesses are properly serialized with
locks and isync tends to be more effecient than sync.

While here, undefine __ATOMIC_ACQ and __ATOMIC_REL at the end of the file
so as not to leak their definitions.

Discussed with: nwhitehorn


git-svn-id: svn+ssh://svn.freebsd.org/base/head@235931 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
o   Rename kernload_ap to bp_kernelload. This to introduce a common prefix
    for variables that live in the boot page.
o   Add bp_trace (yes, it's in the boot page) that gets zeroed before we
    try to wake a core and to which the core being woken can write markers
    so that we know where the core was in case it doesn't wake up. The
    boot code does not yet write markers (too follow).
o   Disable the boot page translation to allow the last 4K page to be used
    for whatever we please. It would get mapped otherwise.
o   Fix kernstart in the case of SMP. The start argument is typically page
    aligned due to the alignment requirements that come with having a boot
    page. The point of using trunc_page is that we get the actual load
    address given that the entry point is immediately following the ELF
    headers. In the SMP case this ended up exactly 4K after the load
    address. Hence subtracting 1 from start.


git-svn-id: svn+ssh://svn.freebsd.org/base/head@235932 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
Either the I/O port range or the memory mapped I/O range may not be
defined in the FDT. The range will have a zero size in that case.


git-svn-id: svn+ssh://svn.freebsd.org/base/head@235933 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
Just return if the size of the window is 0. This can happen when the
FDT does not define all ranges possible for a particular node (e.g.
PCI).
While here, only update the trgt_mem and trgt_io pointers if there's
no error. This avoids that we knowingly write an invalid target (= -1).


git-svn-id: svn+ssh://svn.freebsd.org/base/head@235934 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
Remove Semihakf-ism. DEBUG is a kernel configuration option. It
should not be defined in source files.


git-svn-id: svn+ssh://svn.freebsd.org/base/head@235935 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
Fix physical address type to vm_paddr_t.


git-svn-id: svn+ssh://svn.freebsd.org/base/head@235936 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
A few improvements:
1.  Define all registers. These definitions are needed to support
    the FCM driver for direct-connect NAND.
2.  Repurpose lbc_read_reg() and lbc_write_reg() for use by localbus
    attached device drivers. Use bus_space functions directly in the
    lbc driver itself.
3.  Be smarter about programming LAWs and mapping memory. The ranges
    defined in the FDT are per bank (= chip select) and since we can
    have up to 8 banks, we could easily use more than 8 LAWs or TLB
    enrties when per-bank memory ranges need multiple LAWs or TLBs
    due to alignment or size constraints.
    We now combine all memory ranges into the fewest possible set of
    contiguous regions and program the hardware for that. Thus, a
    cleverly written FDT with 8 devices may still only need 1 LAW or
    1 TLB entry. Note that the memory ranges can be assigned randomly
    to the banks. We sort as we build to handle that.
4.  Support the FCM when programming the OR register. This is mostly
    for documention purposes as we do not have a way to define the
    mode for a bank.
5.  Remove Semihalf-ism: do not define DEBUG (only to undefine it
    again).


git-svn-id: svn+ssh://svn.freebsd.org/base/head@235937 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
Recognize version 3.1 of the SEC crypto engine.


git-svn-id: svn+ssh://svn.freebsd.org/base/head@235938 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
Consitently use "__LP64__".
[there are 33 __LP64__'s in the kernel (minus cddl/ and contrib/),
and 11 _LP64's]


git-svn-id: svn+ssh://svn.freebsd.org/base/head@235939 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
MFp4 bz_ipv6_fast:

  in_cksum.h required ip.h to be included for struct ip.  To be
  able to use some general checksum functions like in_addword()
  in a non-IPv4 context, limit the (also exported to user space)
  IPv4 specific functions to the times, when the ip.h header is
  present and IPVERSION is defined (to 4).

  We should consider more general checksum (updating) functions
  to also allow easier incremental checksum updates in the L3/4
  stack and firewalls, as well as ponder further requirements by
  certain NIC drivers needing slightly different pseudo values
  in offloading cases.  Thinking in terms of a better "library".

  Sponsored by:	The FreeBSD Foundation
  Sponsored by:	iXsystems

Reviewed by:	gnn (as part of the whole)
MFC After:	3 days


git-svn-id: svn+ssh://svn.freebsd.org/base/head@235941 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
Revert isync for ILP32 to sync as per my original change that I discussed
with Nathan. Leave __ATOMIC_ACQ as an isync as per Nathan.


git-svn-id: svn+ssh://svn.freebsd.org/base/head@235942 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f