MFC r253434:

  Add bus_dmamap_load_bio and bus_dmamap_load_ccb to bus_dma(9).

Approved by:	re (marius)
MFC 253433:

    In this GRN, Marcel Moolenaar overhauled the logic for mounting
    the root file system on bootup:

       |------------------------------------------------------------------------
       |r214006 | marcel | 2010-10-17 22:01:53 -0700 (Sun, 17 Oct 2010) | 20 lines
       |
       | Re-implement the root mount logic using a recursive approach, whereby each
       |root file system (starting with devfs and a synthesized configuration) can
       |contain directives for mounting another file system as root.
       |------------------------------------------------------------------------

    This commit adds a mount.conf(8) man page which documents
    the root mount logic.  mount.conf(8) also provides some examples
    for the /.mount.conf file, which can be used to change the root mount behavior.

    Reviewed by: marcel bjk

MFC: 253445:

    Minor mdoc fixes

Approved by: re (gjb)
1) POSIX requires rand(3) return values to be in the [0, RAND_MAX]
range, but ACM formula we use have internal state (and return value) in
the [1, 0x7ffffffe] range, so our RAND_MAX (0x7fffffff) is never reached
because it is off by one, zero is not reached too.

Correct both RAND_MAX and rand(3) return value, shifting last one
to the 0 by 1 subtracted, resulting POSIXed [0, 0x7ffffffd(=new
RAND_MAX)] range.

2) Add a checks for not overflowing on too big seeds. It may happens on
the machines, where sizeof(unsigned int) > 32 bits.

This change is binary compatible because range is reduced, not expanded,
so no bump is needed.

Reviewed by:    bde
Approved by:    re (glebius)
MFC: r253506
The NFSv4 server incorrectly assumed that the high order words of
the attribute bitmap argument would be non-zero. This caused an
interoperability problem for a recent patch to the Linux NFSv4 client.
The Linux folks have changed their patch to avoid this, but this
patch fixes the problem on the server.

Reported and tested by:	a.heider@gmail.com (Andre Heider)
Approved by:	re (Xin Li)
MFC r253380,253413: name passed into __setenv is not necessarily NUL-terminated

Approved by:	re (kib)
Modernize the package list for 9.2-RELEASE cycle:

 o Update the perl package version to 5.14.

 o Add devel/subversion and devel/subversion-static so we provide
   a package for source-based users to check out the various trees,
   both with and without extra dependencies.

This is a direct commit to stable/9.

Approved by:	kib (mentor)
Approved by:	re (glebius)
MFC:	r253439

Reload font when syscons(4) is resuming without switching mode.

Approved by:	re (delphij)
MFC:	r253455

Decode PCIe ASPM capability and status.

Approved by:	re (delphij)
MFC r253393:

  Do not throw an error if the user requests to activate the image from
  an empty firmware slot, as long as the user has specified a firmware
  image to download into the empty firmware slot.

Approved by:	re (kib)
Sponsored by:	Intel
MFC r253436, r253458:

  Simplify open_dev() by returning errno values rather than just 0 or 1.

  Also remove stat() call and just rely on errno from open() call to discern
  whether dev node exists or not.

Approved by:	re (kib)
Sponsored by:	Intel
MFC r253437:

  Define constants for the lengths of the serial number, model number
  and firmware revision in the controller's identify structure.

  Also modify consumers of these fields to ensure they only use the
  specified number of bytes for their respective fields.

Approved by:	re (kib)
Sponsored by:	Intel
MFC r253438:

  Use pause() instead of DELAY() when polling for completion of admin
  commands during controller initialization.

  DELAY() does not work here during config_intrhook context - we need to
  explicitly relinquish the CPU for the admin command completion to
  get processed.

Approved by:	re (kib)
Sponsored by:	Intel
MFC r253459:

  Use _PATH_DEV (from paths.h) for the "/dev/" string, rather than
  hard-coding it.

Approved by:	re (kib)
Sponsored by:	Intel
MFC r253473:

  Do not call disk_create() until we have completed all initialization of our
  internal disk structure.

Approved by:	re (kib)
Sponsored by:	Intel
MFC r253474:

  Fix nvme(4) and nvd(4) to support non 512-byte sector sizes.

  Recent testing with QEMU that has variable sector size support for
  NVMe uncovered some of these issues.  Chatham prototype boards supported
  only 512 byte sectors.

Approved by:	re (kib)
Sponsored by:	Intel
MFC r253476:

  Add message when nvd disks are attached and detached.

  As part of this commit, add an nvme_strvis() function which borrows
  heavily from cam_strvis().  This will allow stripping of
  leading/trailing whitespace and also handle unprintable characters
  in model/serial numbers.  This function goes into a new nvme_util.c
  file which is used by both the driver and nvmecontrol.

Approved by:	re (kib)
Sponsored by:	Intel
MFC r253513, r253542:

r253513:
 Create memstick images with the '.img' filename extension.

r253542:
 For consistency with previous releases, name the cdrom install
 cd 'disc1.iso'.

Approved by:	kib (mentor)
Approved by:	re (marius)
MFC r253541:
  Remove weirdly-named autofoo file.  This is not needed for the (FreeBSD)
  build, and freebsd-update chokes on it.

Approved by:	re (delphij)
protect acpi_battery_ioctl with Giant

This is a direct commit to stable/9.

There is a bug in the ACPICA version 20110527 that is used in stable/9.
The bug can lead to unprotected reference counting on ACPI objects
and eventually to a crash or a memory corruption.  The bug has been fixed
upstream and imported to head as of ACPICA version 20130328.
Unfortunately, ACPICA version in stable has not been updated,
so merging all past ACPICA versions or cherry-picking parts of 20130328
would be a big change with a risk of potential regressions.

During debugging it was determined that the most probable vector for the
bug was through concurrent calls to ACPI battery sysctls and ioctls.
The sysctls are already guarded by Giant (not MPSAFE), but ioctls could
execute in parallel to a sysctl call and to each other. All the calls
go through acpi_battery_ioctl function, which makes the actual calls
into ACPICA and those are the calls that lack necessary protection.
Thus preventing concurrency in acpi_battery_ioctl should prevent the
conditions that triggered the ACPICA bug.

Some additional details can be found in this thread:
http://thread.gmane.org/gmane.os.freebsd.devel.acpi/7707/focus=7774

Tested by:	kron24@gmail.com,
		David Demelier <demelier.david@gmail.com>
Approved by:	re (kib)
MFC r253404:
   o TxD ring requires 8 bytes alignment to work so change alignment
     constraint to 8. Previously it may have triggered watchdog
     timeouts.
   o Check whether interrupt is ours or not.
   o Enable interrupts before attemping to transmit queued packets.
     This will slightly improve TX performance.
   o No need to clear IFF_DRV_OACTIVE in a loop. AE_FLAG_TXAVAIL is
     used to know whether there are enough available TxD ring space.
   o Added missing bus_dmamap_sync(9) in ae_rx_intr() and rearranged
     code to avoid unncessary register access.
   o Make sure to clear TxD, TxS, RxD rings in driver initialization.
     Otherwise some data in these rings could be interpreted as
     'updated' which in turn will advance internally maintained
     pointers and can trigger watchdog timeouts.

  PR:	kern/180382
  Approved by:	re (hrs)