Rework controller reset procedure. Previously driver saved
BGE_PCI_PCISTATE register before issuing global reset. After
issuing reset, it reads BGE_PCI_PCISTATE register again and
compares the saved register value and current value. It was used to
know whether the global reset operation was completed or not.
Unfortunately, this logic caused several issues on recent BCM5717/
5718/5719 and BCM5720 controllers. It seems APE firmware accesses
some registers while global reset is in progress such that reading
BGE_PCI_PCISTATE register after reset does not yield old pre-reset
state value. This resulted in consuming too much time in global
reset and sometimes it couldn't successfully complete reset.

The BGE_MISCCFG_RESET_CORE_CLOCKS of BGE_MISC_CFG register is
self-clearing bit so driver is able to know the reset completion.
But the core-lock reset will disable indirect/flat/standard access
modes such that driver cannot poll BGE_MISCCFG_RESET_CORE_CLOCKS
bit of BGE_MISC_CFG register. So just wait enough time for
core-clock reset to complete.
Data sheet says driver should wait 100us for PCI/PCI-X devices and
100ms for PCIe devices. I chose 1ms for PCI/PCI-X since this value
was used for many years in bge(4). For PCIe devices, use 100ms as
recommended by data sheet.

bge_chipinit() also cleared BGE_MAC_MODE register which shall clear
firmware configured mode information. I think this will result in
losing ASF/IPMI link in device attachment. Let bge_reset() honor
firmware configured BGE_MAC_MODE register and don't announce driver
is UP in bge_reset(). Firmware should have control over driver until
it's fully initialized by driver.

While I'm here, enable workaround for PCI-X BCM5704 A0 in
bge_reset(). This will prevent internal arbitration logic from
switching to the other DMA engine after a retry cycle.


git-svn-id: svn://svn.freebsd.org/base/head@241436 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
For 5717C/5719C/5720C and 57765 PHYs, do not perform any special
handling(jumbo, wire speed etc) in brgphy_reset().  Touching
BRGPHY_MII_AUXCTL register seems to confuse APE firmware such that
it couldn't establish a link.


git-svn-id: svn://svn.freebsd.org/base/head@241437 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
Add APE firmware support and improve firmware handshake procedure.
This change will enable IPMI access on 5717/5718/5719/5720 and 5761
controllers. Because ASF is not available when APE firmware is
present, bge_allow_asf tunable is ignored when driver detects APE
firmware.  Also bge(4) no longer performs two resets(one blind
reset and the other reset with firmware in mind) in device attach.
Now bge(4) performs a reset with enough information in bge_reset().
The APE firmware also needs special handling to make suspend/resume
work but it was not implemented yet.

With this change, bge(4) should work on any 5717/5718/5719/5720
controllers. Special thanks to Mike Hibler at Emulab who setup
remote debugging on Dell R820. Without his help I couldn't be able
to address several issues happened on Dell Rx20 systems. And many
thanks to Broadcom for continuing to support FreeBSD!

Submitted by:	davidch (initial version)
H/W donated by:	Broadcom
Tested by:	many
Tested on:	Del R820/R720/R620/R420/R320 and HP Proliant DL 360 G8


git-svn-id: svn://svn.freebsd.org/base/head@241438 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
Apply some style. Checked with md5.


git-svn-id: svn://svn.freebsd.org/base/head@241439 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
Decode the first two fstab fields with strunvis(3). This allows having spaces
in devices and mount paths, encoded as \s or \040.

PR:		bin/117687
Submitted by:	Martin Kammerhofer
Discussed on:	arch


git-svn-id: svn://svn.freebsd.org/base/head@241440 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
Fix my last commit.  Only call strunvis after properly checking the argument is
not NULL.


git-svn-id: svn://svn.freebsd.org/base/head@241441 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
Increase device CCB queue array size by CAM_RL_VALUES - 1 (4) elements.
It is required to store extra recovery requests in case of bus resets.
On ATA/SATA this fixes assertion panics on HEAD with INVARIANTS enabled or
possible memory corruptions otherwise if timeout/reset happens when device
CCB queue is already full.

Reported by:	gibbs@
MFC after:	1 week


git-svn-id: svn://svn.freebsd.org/base/head@241444 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
Add NG_NETFLOW_V9INFO_TYPE command to be able to request netflowv9-specific
data.

Submitted by:	Dmitry Luhtionov <dmitryluhtionov at gmail.com>
MFC after:	2 weeks


git-svn-id: svn://svn.freebsd.org/base/head@241446 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
Exclude potential circular symlink when creating src tarball.

Normal release builds are not affected by this but it can happen if using
these release bits against a work tree.

Sponsored by: ADARA Networks


git-svn-id: svn://svn.freebsd.org/base/head@241451 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
Don't duplicate path/ccb allocation code, use existing functions.


git-svn-id: svn://svn.freebsd.org/base/head@241455 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
Use separate malloc buckets for CAM devices, CCBs and paths. This will
make it easier to track down the source of any use after free problems.

Submitted by:	ken@


git-svn-id: svn://svn.freebsd.org/base/head@241456 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
Point freebsd.org cluster machines to mx1 for their smarthost.


git-svn-id: svn://svn.freebsd.org/base/head@241457 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
Fix tiypo.

Submitted by:	Luiz Otavio O Souza
Approved by:	adrian (mentor)


git-svn-id: svn://svn.freebsd.org/base/head@241463 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
Make local function static.


git-svn-id: svn://svn.freebsd.org/base/head@241464 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
Patch from Bryan to fix a virtqueue issue:

    virtqueue: Fix non-indirect virtqueues

    We really must walk the entire descriptor chain in order
    to append the to be free'd chain to the existing free
    chain.

Submitted by:	Bryan Venteicher (bryanv@daemoninthecloset.org)
Reported by:	cognet


git-svn-id: svn://svn.freebsd.org/base/head@241469 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
Virtio SCSI driver

Submitted by:	Bryan Venteicher  bryanv at daemoninthecloset dot org
Reviewed by:	grehan


git-svn-id: svn://svn.freebsd.org/base/head@241470 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
Since the moduledata structure member priv is a void pointer, using
NULL instead of 0 when dealing with pointers.


git-svn-id: svn://svn.freebsd.org/base/head@241471 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
Merge remote-tracking branch 'upstream/master'