MFC r233688-233689:
r233688:
  Remove task queue based link state change handler. Driver no longer
  needs to defer link state handling.
  While I'm here, mark IFF_DRV_RUNNING before changing media.  If
  link is established without any delay, that link state change
  handling could be lost.

r233689:
  Do not report current link status if driver is not running.
  This change also workarounds dhclient's link state handling bug by
  not giving current link status.

  Unlike other controllers, ale(4)'s PHY hibernation perfectly works
  such that driver does not see a valid link if the controller is not
  brought up.  If dhclient(8) runs on ale(4) it will blindly waits
  until link UP and then gives up after 10 seconds.  Because
  dhclient(8) still thinks interface got a valid link when IFM_AVALID
  is not set for selected media,  this change makes dhclient initiate
  DHCP without waiting for link UP.


git-svn-id: svn://svn.freebsd.org/base/stable/9@234126 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
MFC 232742:
MFamd64:
- Return failure for a suspend attempt if we have no wake address.
- Use intr_disable()/intr_restore() instead of ACPI_DISABLE_IRQS().
- Invoke intr_suspend() earlier and call intr_resume() if suspend
  fails.
- Use pause in the loop waiting for CPU to suspend.
- Restore PAT MSR, switchtime, switchticks, and MTRRs on resume.


git-svn-id: svn://svn.freebsd.org/base/stable/9@234141 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
MFC 232744,232747,233031:
- Allow a native i386 kernel to be built with 'nodevice atpic'.  Just as on
  amd64, if 'device isa' is present quiesce the 8259A's during boot and
  resume from suspend.
- Move i386's intr_machdep.c to the x86 tree and share it with amd64.
- Merge r232744 changes to pc98.
  (Allow a kernel to be built with 'nodevice atpic'.)
- Move ICU related defines from x86/isa/atpic.c to x86/isa/icu.h and
  use them in x86/x86/intr_machdep.c.

Note, I normally would have merged 232747 separately, but 233031 assumed
232747 was already merged and 232744 needs to be merged with 233031.


git-svn-id: svn://svn.freebsd.org/base/stable/9@234144 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
MFC 232228,233613:
Move the DTrace return IDT vector back up from 0x20 to 0x92.  The 0x20
vector is currently dedicated to servicing IRQ 0 from the 8259A's, so
it shouldn't be overloaded for DTrace.


git-svn-id: svn://svn.freebsd.org/base/stable/9@234145 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
MFC 233305,233623:
- Mark the 'lapics' and 'ioapics' arrays here static since they are
  private to this file.  The 'lapics' array was actually shadowing a
  completely different 'lapics' array that is private to local_apic.c.
- Allocate the ioapics[] array dynamically since it is only needed for the
  duration of madt_setup_io().  This avoids having the array take up
  permanent space in the BSS.


git-svn-id: svn://svn.freebsd.org/base/stable/9@234147 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
MFC 233893:
Disable INET6 support in modules when building the LINT-NOINET6 kernel.


git-svn-id: svn://svn.freebsd.org/base/stable/9@234148 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
MFC 233676:
Use a more proper fix for enabling HT MSI mapping windows on Host-PCI
bridges.  Rather than blindly enabling the windows on all of them, only
enable the window when an MSI interrupt is enabled for a device behind
the bridge, similar to what already happens for HT PCI-PCI bridges.


git-svn-id: svn://svn.freebsd.org/base/stable/9@234150 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
MFC r233018:
Make ofw_bus_get_node() consistently return -1 when there is no associated
OF node, instead of a random mixture of 0 and -1. Update all checks for 0
to check for -1 instead.


git-svn-id: svn://svn.freebsd.org/base/stable/9@234160 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
MFC r232917:
Rewrite thread CPU usage percentage math to not depend on periodic calls
with HZ rate through the sched_tick() calls from hardclock().

Potentially it can be used to improve precision, but now it is just minus
one more reason to call hardclock() for every HZ tick on every active CPU.
SCHED_4BSD never used sched_tick(), but keep it in place for now, as at
least SCHED_FBFS existing in patches out of the tree depends on it.


git-svn-id: svn://svn.freebsd.org/base/stable/9@234166 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
MFC 232919:
Add kern.eventtimer.activetick tunable/sysctl, specifying whether each
hardclock() tick should be run on every active CPU, or on only one.

On my tests, avoiding extra interrupts because of this on 8-CPU Core i7
system with HZ=10000 saves about 2% of performance. At this moment option
implemented only for global timers, as reprogramming per-CPU timers is
too expensive now to be compensated by this benefit, especially since we
still have to regularly run hardclock() on at least one active CPU to
update system uptime. For global timer it is quite trivial: timer runs
always, but we just skip IPIs to other CPUs when possible.

Option is enabled by default now, keeping previous behavior, as periodic
hardclock() calls are still used at least to implement setitimer(2) with
ITIMER_VIRTUAL and ITIMER_PROF arguments. But since default schedulers don't
depend on it since r232917, we are much more free to experiment with it.


git-svn-id: svn://svn.freebsd.org/base/stable/9@234167 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
Merge remote-tracking branch 'upstream/svn_stable_9' into svn_stable_9