Home | History | Annotate | only in /src/sys/arch/i386/acpi
History log of /src/sys/arch/i386/acpi
RevisionDateAuthorComments
 1.6 11-Dec-2007  jmcneill No longer required after jmcneill-pm merge.
 1.5 09-Dec-2007  jmcneill branches: 1.5.2;
Merge jmcneill-pm branch.
 1.4 11-Dec-2005  christos branches: 1.4.48; 1.4.50; 1.4.56; 1.4.60; 1.4.62;
merge ktrace-lwp.
 1.3 26-Oct-2003  lukem branches: 1.3.16;
Use ${HOST_SH} instead of `sh'.

If necessary, pull in <bsd.sys.mk> to get the definition of HOST_SH;
Makefiles that pull in one of (most of) <bsd.*.mk> will get this anyway.
 1.2 18-Jun-2002  christos branches: 1.2.2; 1.2.4; 1.2.6; 1.2.8; 1.2.14;
${CC}
 1.1 18-Jun-2002  tshiozak ACPI wake-up code for i386. but, we have no interface to use it efficiently.
 1.2.14.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.2.14.2 18-Sep-2004  skrll Sync with HEAD.
 1.2.14.1 03-Aug-2004  skrll Sync with HEAD
 1.2.8.2 18-Oct-2002  nathanw New files in merge.
 1.2.8.1 18-Jun-2002  nathanw file Makefile.wakecode was added on branch nathanw_sa on 2002-10-18 03:13:05 +0000
 1.2.6.2 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.2.6.1 18-Jun-2002  jdolecek file Makefile.wakecode was added on branch kqueue on 2002-09-06 08:35:52 +0000
 1.2.4.2 16-Jul-2002  gehenna catch up with -current.
 1.2.4.1 18-Jun-2002  gehenna file Makefile.wakecode was added on branch gehenna-devsw on 2002-07-16 08:28:57 +0000
 1.2.2.2 18-Jun-2002  christos ${CC}
 1.2.2.1 18-Jun-2002  christos file Makefile.wakecode was added on branch sommerfeld_i386mp_1 on 2002-06-18 17:21:54 +0000
 1.3.16.1 21-Jan-2008  yamt sync with head
 1.4.62.2 13-Dec-2007  yamt sync with head.
 1.4.62.1 11-Dec-2007  yamt sync with head.
 1.4.60.1 26-Dec-2007  ad Sync with head.
 1.4.56.1 27-Dec-2007  mjf Sync with HEAD.
 1.4.50.1 23-Mar-2008  matt sync with HEAD
 1.4.48.3 24-Sep-2007  joerg Generate the ACPI wakecode image dynamically at build time.
 1.4.48.2 07-Sep-2007  jmcneill Share ACPI wakecode generation between i386 and amd64, and convert amd64
to use joerg's new build scripts for generating wakecode.
 1.4.48.1 07-Sep-2007  joerg Rewrite wakeup code generation to actually use the linker and
prefix all exported symbols with WAKEUP_ to make them easily
distinguishable in acpi_wakeup.c.
 1.5.2.1 13-Dec-2007  bouyer Sync with HEAD
 1.18 24-Jul-2016  maxv The MSR EFER state is not saved and restored when sleeping on i386. On PAE,
the CPU crashes right after waking up, since it needs to access NOX-ed
pages, which are to be enabled in an MSR.

Fix this by properly saving and restoring the EFER MSR. It's a little
tricky since the wakeup code uses %edx, but rdmsr overwrites it. We just
save it in %esi.

Now, the CPU sleeps properly on PAE kernels.
 1.17 24-Jul-2016  maxv KNF, and reduce the diff between amd64 and i386.
 1.16 02-Feb-2014  dsl branches: 1.16.6; 1.16.10;
Minor fpu initialisation cleanups:
Set default CR) so that the FPU is enabled (unset CR0_EM) and initialise
i386_fpu_present to 1.
No need to call the npx trap indirectly, rename to fpunda() to match amd64.
Remove the i386_fpu_exception variable and sysctl (It used to indicate
which irq was used for fpu exceptions, but we only support 'internal'
now). Hopefully no one cares.
fpuinit() now only needs to clear TS before the fninit(). Apart from the
checks for 486SX and the 'fdiv bug' this matches the amd64 version.
Exclude fpuinit() from XEN kernels, they don't call it - which rather begs
the question as to whether it is needed at all!
 1.15 19-Apr-2012  jym branches: 1.15.2; 1.15.4;
Set the CR0_AM bit so processes can enable alignment check errors under
x86 through PSL_AC bit.

ATF test incoming shortly.
 1.14 24-Aug-2009  jmcneill branches: 1.14.12; 1.14.16; 1.14.18;
Ensure that the VBE mode is only restored when machdep.acpi_vbios_reset=1
 1.13 24-Aug-2009  jmcneill Pass the VBE mode number from the bootloader to the kernel, and then
make the ACPI wakecode aware of it. Restore the desired VBE mode on resume
when acpi_vbios_reset=1, so suspend/resume with genfb console will work.
 1.12 28-Apr-2008  martin branches: 1.12.14;
Remove clause 3 and 4 from TNF licenses
 1.11 18-Dec-2007  joerg branches: 1.11.6; 1.11.8; 1.11.10;
Add new IPI for saving CPU state explicitly, share high-level part of
ACPI wakeup code and teach it how to start the APs again. As a side
effect the CPU_START interface allows choosing between different
bootstrap codes more easily now.
 1.10 09-Dec-2007  jmcneill branches: 1.10.2;
Merge jmcneill-pm branch.
 1.9 28-Apr-2007  joerg branches: 1.9.10; 1.9.12; 1.9.20; 1.9.22;
Make the beep on resume optional. It gets controlled by
machdep.acpi_beep_on_reset.
 1.8 20-Jun-2006  jmcneill branches: 1.8.10; 1.8.14; 1.8.16;
Make resetting the video BIOS in the ACPI wakecode optional. It can be
configured via sysctl machdep.acpi_vbios_reset. Defaults to 1 -- reset vbios
on resume.
 1.7 17-Jun-2006  jmcneill More ACPI wakecode changes:
* Enable VBIOS hack by default
* Beep while calling VBIOS, for debugging.
* Fix a DIAGNOSTIC error in the sleep path.
* Remove the erroneous mutex not locked error message.
 1.6 15-Jun-2006  jmcneill Do not restore task registers in wakecode.
 1.5 11-Dec-2005  christos branches: 1.5.4; 1.5.8; 1.5.14; 1.5.16;
merge ktrace-lwp.
 1.4 26-Jan-2005  jmcneill branches: 1.4.6;
Fixup ACPI wakecode on i386. This (along with some PCI power management
hooks) allows my Latitude D600 to recover from S3 sleep.

acpi_wakeup.c changes from lha@:
http://people.su.se/~lha/patches/netbsd/acpi-wakeup-1
 1.3 10-Apr-2004  kochi branches: 1.3.4; 1.3.6;
whitespace nit
 1.2 20-Nov-2003  junyoung Use predefined macro rather than hardcoded value.
 1.1 18-Jun-2002  tshiozak branches: 1.1.2; 1.1.4; 1.1.6; 1.1.8; 1.1.14;
ACPI wake-up code for i386. but, we have no interface to use it efficiently.
 1.1.14.4 04-Feb-2005  skrll Sync with HEAD.
 1.1.14.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.1.14.2 18-Sep-2004  skrll Sync with HEAD.
 1.1.14.1 03-Aug-2004  skrll Sync with HEAD
 1.1.8.2 18-Oct-2002  nathanw New files in merge.
 1.1.8.1 18-Jun-2002  nathanw file acpi_wakecode.S was added on branch nathanw_sa on 2002-10-18 03:13:05 +0000
 1.1.6.2 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.1.6.1 18-Jun-2002  jdolecek file acpi_wakecode.S was added on branch kqueue on 2002-09-06 08:35:52 +0000
 1.1.4.2 16-Jul-2002  gehenna catch up with -current.
 1.1.4.1 18-Jun-2002  gehenna file acpi_wakecode.S was added on branch gehenna-devsw on 2002-07-16 08:28:58 +0000
 1.1.2.2 18-Jun-2002  tshiozak ACPI wake-up code for i386. but, we have no interface to use it efficiently.
 1.1.2.1 18-Jun-2002  tshiozak file acpi_wakecode.S was added on branch sommerfeld_i386mp_1 on 2002-06-18 07:25:14 +0000
 1.3.6.1 12-Feb-2005  yamt sync with head.
 1.3.4.1 29-Apr-2005  kent sync with -current
 1.4.6.3 21-Jan-2008  yamt sync with head
 1.4.6.2 03-Sep-2007  yamt sync with head.
 1.4.6.1 21-Jun-2006  yamt sync with head.
 1.5.16.1 13-Jul-2006  gdamore Merge from HEAD.
 1.5.14.1 19-Jun-2006  chap Sync with head.
 1.5.8.1 26-Jun-2006  yamt sync with head.
 1.5.4.1 09-Sep-2006  rpaulo sync with head
 1.8.16.1 11-Jul-2007  mjf Sync with head.
 1.8.14.1 27-May-2007  ad Sync with head.
 1.8.10.1 07-May-2007  yamt sync with head.
 1.9.22.1 11-Dec-2007  yamt sync with head.
 1.9.20.1 26-Dec-2007  ad Sync with head.
 1.9.12.1 09-Jan-2008  matt sync with HEAD
 1.9.10.8 26-Oct-2007  joerg Sync with HEAD.

Follow the merge of pmap.c on i386 and amd64 and move
pmap_init_tmp_pgtbl into arch/x86/x86/pmap.c. Modify the ACPI wakeup
code to restore CR4 before jumping back into kernel space as the large
page option might cover that.
 1.9.10.7 24-Sep-2007  joerg %esi is not needed any more, remove initialisation.
 1.9.10.6 24-Sep-2007  joerg Remove a comment that doesn't reflect reality any longer.
 1.9.10.5 24-Sep-2007  joerg Now that the start page for the ACPI wakeup code is fixated, use it
and kill the self-modifying code.
 1.9.10.4 08-Sep-2007  joerg Fix a commit that bothered Jared and me.
 1.9.10.3 08-Sep-2007  joerg Start to revamp the ACPI wake code (i386 only, amd64 gets minimal fixes
to keep being compilable):

- In init386 and the amd64 equivalent, just reserve the low-level code.
Do not map and don't copy the wakecode yet. This avoids the conflicts
with the MP tramp code as well. The wakecode is expected to be less
than one page long, which is way too much space.
acpi_md_get_npages_of_wakecode and acpi_md_install_wakecode are
dropped, acpi_wakeup_paddr is set instead of the reserved address.
- Split the wakecode into the essential low-level part to setup
protected mode with paging and valid CS and DS (which stays as
wakecode) and the rest. Inline beepon and beepoff as they are used
exactly once.
- Split the acpi_restorecpu and acpi_savecpu assembly from apci_wakeup.c
and merge acpi_restorecpu with the second half dropped from wakecode.
Most registers are not exported, just those needed to be patched into
wakecode. Don't bother to save or restore %eax, it is overriden
anyway.
- Don't bother to save and restore eflags in acpi_md_sleep, they are
handled correctly by the assembly. Don't play games with cr3 either,
we modify the pmap of the running processes. Copy the wakecode
directly before patching it, after the identity mapping has been
setup.
- Drop clear_reg and acpi_printcpu.
- Add an commented out broadcast IPI to halt the other CPUs explicitly.
 1.9.10.2 07-Sep-2007  joerg Rewrite wakeup code generation to actually use the linker and
prefix all exported symbols with WAKEUP_ to make them easily
distinguishable in acpi_wakeup.c.
 1.9.10.1 03-Aug-2007  jmcneill Pull in power management changes from private branch.
 1.10.2.1 02-Jan-2008  bouyer Sync with HEAD
 1.11.10.2 16-Sep-2009  yamt sync with head
 1.11.10.1 16-May-2008  yamt sync with head.
 1.11.8.1 18-May-2008  yamt sync with head.
 1.11.6.1 02-Jun-2008  mjf Sync with HEAD.
 1.12.14.1 01-Nov-2009  jym Sync with HEAD.
 1.14.18.1 20-Apr-2012  riz Pull up following revision(s) (requested by jym in ticket #189):
sys/arch/x86/include/psl.h: revision 1.7
sys/arch/i386/i386/locore.S: revision 1.98
sys/arch/amd64/acpi/acpi_wakecode.S: revision 1.11
sys/arch/amd64/amd64/mptramp.S: revision 1.13
sys/arch/i386/acpi/acpi_wakecode.S: revision 1.15
sys/arch/i386/i386/mptramp.S: revision 1.23
sys/arch/amd64/amd64/locore.S: revision 1.68
Set the CR0_AM bit so processes can enable alignment check errors under
x86 through PSL_AC bit.
ATF test incoming shortly.
PSL_AC is user-settable.
 1.14.16.1 29-Apr-2012  mrg sync to latest -current.
 1.14.12.2 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.14.12.1 23-May-2012  yamt sync with head.
 1.15.4.1 18-May-2014  rmind sync with head
 1.15.2.2 03-Dec-2017  jdolecek update from HEAD
 1.15.2.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.16.10.1 26-Jul-2016  pgoyette Sync with HEAD
 1.16.6.1 05-Oct-2016  skrll Sync with HEAD
 1.9 09-Dec-2007  jmcneill Merge jmcneill-pm branch.
 1.8 28-Apr-2007  joerg branches: 1.8.10; 1.8.12; 1.8.18; 1.8.20; 1.8.22;
Make the beep on resume optional. It gets controlled by
machdep.acpi_beep_on_reset.
 1.7 20-Jun-2006  jmcneill branches: 1.7.10; 1.7.14; 1.7.16;
Regen.
 1.6 17-Jun-2006  jmcneill More ACPI wakecode changes:
* Enable VBIOS hack by default
* Beep while calling VBIOS, for debugging.
* Fix a DIAGNOSTIC error in the sleep path.
* Remove the erroneous mutex not locked error message.
 1.5 15-Jun-2006  jmcneill Regen.
 1.4 11-Dec-2005  christos branches: 1.4.4; 1.4.8; 1.4.14; 1.4.16;
merge ktrace-lwp.
 1.3 26-Jan-2005  jmcneill branches: 1.3.6;
Fixup ACPI wakecode on i386. This (along with some PCI power management
hooks) allows my Latitude D600 to recover from S3 sleep.

acpi_wakeup.c changes from lha@:
http://people.su.se/~lha/patches/netbsd/acpi-wakeup-1
 1.2 18-Jun-2002  christos branches: 1.2.2; 1.2.4; 1.2.6; 1.2.8; 1.2.14; 1.2.22; 1.2.24;
Regen.
 1.1 18-Jun-2002  tshiozak auto-generated code from acpi_wakecode.S.
standard update process of this file :
1. fix acpi_wakecode.S .
2. commit acpi_wakecode.S .
3. make -f Makefile.wakecode
4. commit acpi_wakecode.h .
 1.2.24.1 12-Feb-2005  yamt sync with head.
 1.2.22.1 29-Apr-2005  kent sync with -current
 1.2.14.1 04-Feb-2005  skrll Sync with HEAD.
 1.2.8.2 18-Oct-2002  nathanw New files in merge.
 1.2.8.1 18-Jun-2002  nathanw file acpi_wakecode.h was added on branch nathanw_sa on 2002-10-18 03:13:06 +0000
 1.2.6.2 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.2.6.1 18-Jun-2002  jdolecek file acpi_wakecode.h was added on branch kqueue on 2002-09-06 08:35:53 +0000
 1.2.4.2 16-Jul-2002  gehenna catch up with -current.
 1.2.4.1 18-Jun-2002  gehenna file acpi_wakecode.h was added on branch gehenna-devsw on 2002-07-16 08:28:59 +0000
 1.2.2.2 18-Jun-2002  christos Regen.
 1.2.2.1 18-Jun-2002  christos file acpi_wakecode.h was added on branch sommerfeld_i386mp_1 on 2002-06-18 17:22:11 +0000
 1.3.6.3 21-Jan-2008  yamt sync with head
 1.3.6.2 03-Sep-2007  yamt sync with head.
 1.3.6.1 21-Jun-2006  yamt sync with head.
 1.4.16.1 13-Jul-2006  gdamore Merge from HEAD.
 1.4.14.1 19-Jun-2006  chap Sync with head.
 1.4.8.1 26-Jun-2006  yamt sync with head.
 1.4.4.1 09-Sep-2006  rpaulo sync with head
 1.7.16.1 11-Jul-2007  mjf Sync with head.
 1.7.14.1 27-May-2007  ad Sync with head.
 1.7.10.1 07-May-2007  yamt sync with head.
 1.8.22.1 11-Dec-2007  yamt sync with head.
 1.8.20.1 26-Dec-2007  ad Sync with head.
 1.8.18.1 27-Dec-2007  mjf Sync with HEAD.
 1.8.12.1 23-Mar-2008  matt sync with HEAD
 1.8.10.5 24-Sep-2007  joerg Generate the ACPI wakecode image dynamically at build time.
 1.8.10.4 24-Sep-2007  joerg Now that the start page for the ACPI wakeup code is fixated, use it
and kill the self-modifying code.
 1.8.10.3 08-Sep-2007  joerg Start to revamp the ACPI wake code (i386 only, amd64 gets minimal fixes
to keep being compilable):

- In init386 and the amd64 equivalent, just reserve the low-level code.
Do not map and don't copy the wakecode yet. This avoids the conflicts
with the MP tramp code as well. The wakecode is expected to be less
than one page long, which is way too much space.
acpi_md_get_npages_of_wakecode and acpi_md_install_wakecode are
dropped, acpi_wakeup_paddr is set instead of the reserved address.
- Split the wakecode into the essential low-level part to setup
protected mode with paging and valid CS and DS (which stays as
wakecode) and the rest. Inline beepon and beepoff as they are used
exactly once.
- Split the acpi_restorecpu and acpi_savecpu assembly from apci_wakeup.c
and merge acpi_restorecpu with the second half dropped from wakecode.
Most registers are not exported, just those needed to be patched into
wakecode. Don't bother to save or restore %eax, it is overriden
anyway.
- Don't bother to save and restore eflags in acpi_md_sleep, they are
handled correctly by the assembly. Don't play games with cr3 either,
we modify the pmap of the running processes. Copy the wakecode
directly before patching it, after the identity mapping has been
setup.
- Drop clear_reg and acpi_printcpu.
- Add an commented out broadcast IPI to halt the other CPUs explicitly.
 1.8.10.2 07-Sep-2007  joerg Rewrite wakeup code generation to actually use the linker and
prefix all exported symbols with WAKEUP_ to make them easily
distinguishable in acpi_wakeup.c.
 1.8.10.1 03-Aug-2007  jmcneill Pull in power management changes from private branch.
 1.45 18-Dec-2007  joerg Add new IPI for saving CPU state explicitly, share high-level part of
ACPI wakeup code and teach it how to start the APs again. As a side
effect the CPU_START interface allows choosing between different
bootstrap codes more easily now.
 1.44 15-Dec-2007  joerg Move mapping of the real mode location for the ACPI wakeup code into a
separate function called from acpi_md_callback.
 1.43 15-Dec-2007  joerg Steal some rope from innocent users and disallow ACPI suspend if more
than one CPU was found.
 1.42 10-Dec-2007  dogcow branches: 1.42.2;
sometimes we don't have MTRR. (thanks, taca!)
 1.41 09-Dec-2007  jmcneill Merge jmcneill-pm branch.
 1.40 17-Oct-2007  garbled branches: 1.40.2; 1.40.4; 1.40.6;
Merge the ppcoea-renovation branch to HEAD.

This branch was a major cleanup and rototill of many of the various OEA
cpu based PPC ports that focused on sharing as much code as possible
between the various ports to eliminate near-identical copies of files in
every tree. Additionally there is a new PIC system that unifies the
interface to interrupt code for all different OEA ppc arches. The work
for this branch was done by a variety of people, too long to list here.

TODO:
bebox still needs work to complete the transition to -renovation.
ofppc still needs a bunch of work, which I will be looking at.
ev64260 still needs to be renovated
amigappc was not attempted.

NOTES:
pmppc was removed as an arch, and moved to a evbppc target.
 1.39 26-Sep-2007  ad x86 changes for pcc and LKMs.

- Replace most inline assembly with proper functions. As a side effect
this reduces the size of amd64 GENERIC by about 120kB, and i386 by a
smaller amount. Nearly all of the inlines did something slow, or something
that does not need to be fast.
- Make curcpu() and curlwp functions proper, unless __GNUC__ && _KERNEL.
In that case make them inlines. Makes curlwp LKM and preemption safe.
- Make bus_space and bus_dma more LKM friendly.
- Share a few more files between the ports.
- Other minor changes.
 1.38 02-Aug-2007  jmcneill branches: 1.38.2; 1.38.4; 1.38.6;
Pull in i82489var.h in the NLAPIC > 0 case, from Geoff Wing.
 1.37 01-Aug-2007  jmcneill Explicitly reinitialize lapic on resume; gets the clock ticking on the
Lenovo T60 and probably many others.
 1.36 28-Apr-2007  joerg branches: 1.36.2; 1.36.4; 1.36.6;
Make the beep on resume optional. It gets controlled by
machdep.acpi_beep_on_reset.
 1.35 04-Mar-2007  christos branches: 1.35.2; 1.35.4;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.34 09-Feb-2007  ad branches: 1.34.2;
Merge newlock2 to head.
 1.33 24-Jan-2007  tshiozak In acpi_restorecpu, "pushl ret_addr" was wrong.
this decrease esp unsuitably. this may crash the kernel while leaving
acpi_md_sleep(). (rely on the code generation options passed to cc)
 1.32 29-Sep-2006  christos branches: 1.32.2;
Coverity CID 4027: Initialize oldphys (from Arnaud Lacombe)
 1.31 01-Jul-2006  christos branches: 1.31.4; 1.31.6;
If we the current process is a kernel proc, then we don't need to play with
the pmap, because the wakecode is already mapped. Makes the acpi based apm
shim work.
 1.30 22-Jun-2006  jmcneill Add an 'uninit' callback to PCI ICU drivers. This allows (for example) the
PIIX support to release its mapping on the edge/level control registers.

Now that these are guaranteed to be unmapped, capture and restore the
registers in piixpcib(4)'s powerhook. The same will need to be done on a
per-chipset basis.

Concerns were raised about calling pci_intr_fixup on resume WRT hotplug
devices, so this has been removed.

Ok cube@.
 1.29 22-Jun-2006  jmcneill Only call pci_intr_fixup if both PCI_INTR_FIXUP and PCIBIOS options are
defined.
 1.28 21-Jun-2006  jmcneill Call pci_intr_fixup on resume if options PCI_INTR_FIXUP is enabled. Solves
interrupt sharing issues on my Vaio PCG-Z505LEK after a suspend/resume
cycle.
 1.27 20-Jun-2006  jmcneill Make resetting the video BIOS in the ACPI wakecode optional. It can be
configured via sysctl machdep.acpi_vbios_reset. Defaults to 1 -- reset vbios
on resume.
 1.26 19-Jun-2006  jmcneill Enable interrupts in the error path also.
 1.25 17-Jun-2006  christos Don't dick with cr3. It pisses pmap.c off.
 1.24 17-Jun-2006  jmcneill More ACPI wakecode changes:
* Enable VBIOS hack by default
* Beep while calling VBIOS, for debugging.
* Fix a DIAGNOSTIC error in the sleep path.
* Remove the erroneous mutex not locked error message.
 1.23 07-Jun-2006  kardel branches: 1.23.2;
convert to timecounters (from branch simonb-timecounters)
 1.22 16-Feb-2006  kochi branches: 1.22.2; 1.22.8;
define phys_wakeup as static
 1.21 29-Jan-2006  kochi branches: 1.21.2; 1.21.4;
adapt for ACPI-CA 20060113
 1.20 26-Dec-2005  perry branches: 1.20.2;
u_intN_t -> uintN_t
 1.19 24-Dec-2005  perry __asm__ -> __asm
__const__ -> const
__inline__ -> inline
__volatile__ -> volatile
 1.18 24-Dec-2005  perry Remove leading __ from __(const|inline|signed|volatile) -- it is obsolete.
 1.17 11-Dec-2005  christos merge ktrace-lwp.
 1.16 02-May-2005  kochi branches: 1.16.2;
Merge changes for ACPI-CA 20050408.
 1.15 21-Apr-2005  yamt sprinkle __used so that variables referenced from asm code don't get
optimized out.
 1.14 26-Jan-2005  jmcneill Fixup ACPI wakecode on i386. This (along with some PCI power management
hooks) allows my Latitude D600 to recover from S3 sleep.

acpi_wakeup.c changes from lha@:
http://people.su.se/~lha/patches/netbsd/acpi-wakeup-1
 1.13 27-Aug-2004  thorpej branches: 1.13.4; 1.13.6;
PTDpaddr -> PDPpaddr
 1.12 14-Jun-2004  tshiozak Make sure to restore curproc's PTD before calling AcpiEnterSleepState().
Leaving the PTD inconsistent may crash the kernel.
 1.11 11-Jun-2004  tshiozak - make sure to use proc0's PTD for the ACPI wakecode.
- add re-initialization for npx while resuming.
 1.10 03-Nov-2003  mycroft More cleanup:
* Use ACPI_FAILURE() and ACPI_SUCCESS().
* Output exception strings in a few more places.
 1.9 03-Nov-2003  mycroft Clean up some messages:
* Use AcpiFormatException() in a bunch of places.
* acpi_resource_parse() already prints an error, so don't do it in the callers.
 1.8 28-Oct-2003  junyoung Fix indent level.
 1.7 13-Jun-2003  abs branches: 1.7.2;
Correctly escape newlines in a string - now can be compiled under gcc3
 1.6 22-Nov-2002  fvdl Get this to compile again in the ioapic case.
 1.5 22-Nov-2002  fvdl New interrupt code. The basic idea behind it is to hide the differences
in interrupt controllers in struct pic, and try to keep as much
common code as possible. At the lowest (asm) level, this is done
with CPP macros.

The main structure is now struct intrsource, describing an established
interrupt line, of any kind (soft/hard local apic/legacy apic/IO apic).
For quick masking, there may be a maximum of 32 sources per CPU.
Sources can be assigned to any CPU in the MP case, though currently they
all go to the boot CPU.
 1.4 12-Oct-2002  tshiozak branches: 1.4.2;
fix wrong uses of ACPI CA API in the last commit, and a bit cosmetic change.
 1.3 18-Jun-2002  drochner branches: 1.3.2; 1.3.4; 1.3.6;
make it compile with ACPI_DEBUG
(removing the half-done debugging support, sorry)
 1.2 18-Jun-2002  tshiozak use AcpiHwRegister{Read,Write} functions instead of (obsoleted)
AcpiHwBitRegister{Read,Write}.
 1.1 18-Jun-2002  tshiozak ACPI wake-up code for i386. but, we have no interface to use it efficiently.
 1.3.6.2 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.3.6.1 18-Jun-2002  jdolecek file acpi_wakeup.c was added on branch kqueue on 2002-09-06 08:35:53 +0000
 1.3.4.2 16-Jul-2002  gehenna catch up with -current.
 1.3.4.1 18-Jun-2002  gehenna file acpi_wakeup.c was added on branch gehenna-devsw on 2002-07-16 08:29:00 +0000
 1.3.2.2 18-Jun-2002  drochner make it compile with ACPI_DEBUG
(removing the half-done debugging support, sorry)
 1.3.2.1 18-Jun-2002  drochner file acpi_wakeup.c was added on branch sommerfeld_i386mp_1 on 2002-06-18 10:32:03 +0000
 1.4.2.3 11-Dec-2002  thorpej Sync with HEAD.
 1.4.2.2 18-Oct-2002  nathanw New files in merge.
 1.4.2.1 12-Oct-2002  nathanw file acpi_wakeup.c was added on branch nathanw_sa on 2002-10-18 03:13:06 +0000
 1.7.2.6 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.7.2.5 04-Feb-2005  skrll Sync with HEAD.
 1.7.2.4 21-Sep-2004  skrll Fix the sync with head I botched.
 1.7.2.3 18-Sep-2004  skrll Sync with HEAD.
 1.7.2.2 03-Sep-2004  skrll Sync with HEAD
 1.7.2.1 03-Aug-2004  skrll Sync with HEAD
 1.13.6.1 12-Feb-2005  yamt sync with head.
 1.13.4.1 29-Apr-2005  kent sync with -current
 1.16.2.6 21-Jan-2008  yamt sync with head
 1.16.2.5 27-Oct-2007  yamt sync with head.
 1.16.2.4 03-Sep-2007  yamt sync with head.
 1.16.2.3 26-Feb-2007  yamt sync with head.
 1.16.2.2 30-Dec-2006  yamt sync with head.
 1.16.2.1 21-Jun-2006  yamt sync with head.
 1.20.2.2 18-Feb-2006  yamt sync with head.
 1.20.2.1 01-Feb-2006  yamt sync with head.
 1.21.4.2 22-Apr-2006  simonb Sync with head.
 1.21.4.1 04-Feb-2006  simonb Adapt for timecounters: mostly use get*time() and use "time_second"
instead of "time.tv_sec".
 1.21.2.1 09-Sep-2006  rpaulo sync with head
 1.22.8.2 22-Jun-2006  chap Complete a sync sys/ with head.
 1.22.8.1 19-Jun-2006  chap Sync with head.
 1.22.2.2 11-Aug-2006  yamt sync with head
 1.22.2.1 26-Jun-2006  yamt sync with head.
 1.23.2.1 13-Jul-2006  gdamore Merge from HEAD.
 1.31.6.1 22-Oct-2006  yamt sync with head
 1.31.4.3 06-Feb-2007  ad Quieten noisy boot messages.
 1.31.4.2 01-Feb-2007  ad Sync with head.
 1.31.4.1 18-Nov-2006  ad Sync with head.
 1.32.2.1 22-Mar-2007  jdc Pull up revision 1.33 (requested by mlelstv in ticket #511).

In acpi_restorecpu, "pushl ret_addr" was wrong.
this decrease esp unsuitably. this may crash the kernel while leaving
acpi_md_sleep(). (rely on the code generation options passed to cc)
 1.34.2.2 07-May-2007  yamt sync with head.
 1.34.2.1 12-Mar-2007  rmind Sync with HEAD.
 1.35.4.1 11-Jul-2007  mjf Sync with head.
 1.35.2.3 09-Oct-2007  ad Sync with head.
 1.35.2.2 20-Aug-2007  ad Sync with HEAD.
 1.35.2.1 27-May-2007  ad Sync with head.
 1.36.6.1 15-Aug-2007  skrll Sync with HEAD.
 1.36.4.1 07-Aug-2007  matt Sync with HEAD.
 1.36.2.1 03-Oct-2007  garbled Sync with HEAD
 1.38.6.1 06-Oct-2007  yamt sync with head.
 1.38.4.2 23-Mar-2008  matt sync with HEAD
 1.38.4.1 06-Nov-2007  matt sync with HEAD
 1.38.2.21 14-Nov-2007  joerg Fix resume order for LAPIC, following ad@ changes to cpu_hatch.
 1.38.2.20 12-Nov-2007  joerg Reorder acpi_md_sleep similiar to amd64, e.g. stop double-return
from acpi_savecpu and call back into C to enter ACPI sleep state
instead.
 1.38.2.19 28-Oct-2007  joerg Force FPU context to be saved on suspend.

XXX not sure if the splipi is really needed, but other callers do that.
 1.38.2.18 26-Oct-2007  joerg Sync with HEAD.

Follow the merge of pmap.c on i386 and amd64 and move
pmap_init_tmp_pgtbl into arch/x86/x86/pmap.c. Modify the ACPI wakeup
code to restore CR4 before jumping back into kernel space as the large
page option might cover that.
 1.38.2.17 13-Oct-2007  joerg Explicitly commit MTRR settings again on resume. This fixes abysmal
performance of Xorg e.g. during video playback.
 1.38.2.16 13-Oct-2007  joerg Move ACPI_EVENT_POWER_BUTTON reset into acpi_md_sleep. Add splhigh
guards around the x86_disable_intr/x86_enable_intr calls for the moment
until it is clear where the interrupts are incorrectly reenabled.
 1.38.2.15 02-Oct-2007  jmcneill Update to ACPI-CA 20070320
 1.38.2.14 02-Oct-2007  joerg Sync with HEAD.
 1.38.2.13 30-Sep-2007  joerg Add a second function ioapic_reenable that restores all vectors.
 1.38.2.12 25-Sep-2007  joerg Actually update the pmap after entering the ACPI wakecode page.
 1.38.2.11 24-Sep-2007  joerg Now that the start page for the ACPI wakeup code is fixated, use it
and kill the self-modifying code.
 1.38.2.10 24-Sep-2007  joerg Restore default value for BIOS reset to 1.
 1.38.2.9 10-Sep-2007  joerg Remove unused cr3 label. Make optimiser less aggressive by telling it
that acpi_savecpu can return more than once...
 1.38.2.8 10-Sep-2007  joerg Introduce pmap_init_tmp_pgtbl to build a temporary copy of the kernel
side page mapping and an identity mapping low page for use in real mode.
Switch MP bootstrap and i386 ACPI wakeup code to use it.
 1.38.2.7 08-Sep-2007  joerg Now that the real mode pages are statically allocated, make
acpi_wakeup_paddr static and local to acpi_wakeup.c.
 1.38.2.6 08-Sep-2007  joerg Explicitly shutdown other CPUs now.
 1.38.2.5 08-Sep-2007  joerg Refactor init386 by splitting off the msgbuf allocation, the pte0
setup and the ksym init. Wire down real mode allocations -- no point
in worrying about a few pages. Add a comment about why init386_pte0
is needed and what for. Start to remove the dependency on the identity
mapping in acpi wakeup by mapping the wakecode page to normal kernel
mapping and using that for the setup.
 1.38.2.4 08-Sep-2007  joerg Explicitly require that acpi_md_sleep runs on the primary CPU.
 1.38.2.3 08-Sep-2007  joerg Start to revamp the ACPI wake code (i386 only, amd64 gets minimal fixes
to keep being compilable):

- In init386 and the amd64 equivalent, just reserve the low-level code.
Do not map and don't copy the wakecode yet. This avoids the conflicts
with the MP tramp code as well. The wakecode is expected to be less
than one page long, which is way too much space.
acpi_md_get_npages_of_wakecode and acpi_md_install_wakecode are
dropped, acpi_wakeup_paddr is set instead of the reserved address.
- Split the wakecode into the essential low-level part to setup
protected mode with paging and valid CS and DS (which stays as
wakecode) and the rest. Inline beepon and beepoff as they are used
exactly once.
- Split the acpi_restorecpu and acpi_savecpu assembly from apci_wakeup.c
and merge acpi_restorecpu with the second half dropped from wakecode.
Most registers are not exported, just those needed to be patched into
wakecode. Don't bother to save or restore %eax, it is overriden
anyway.
- Don't bother to save and restore eflags in acpi_md_sleep, they are
handled correctly by the assembly. Don't play games with cr3 either,
we modify the pmap of the running processes. Copy the wakecode
directly before patching it, after the identity mapping has been
setup.
- Drop clear_reg and acpi_printcpu.
- Add an commented out broadcast IPI to halt the other CPUs explicitly.
 1.38.2.2 07-Sep-2007  joerg Rewrite wakeup code generation to actually use the linker and
prefix all exported symbols with WAKEUP_ to make them easily
distinguishable in acpi_wakeup.c.
 1.38.2.1 03-Aug-2007  jmcneill Pull in power management changes from private branch.
 1.40.6.1 11-Dec-2007  yamt sync with head.
 1.40.4.1 26-Dec-2007  ad Sync with head.
 1.40.2.1 27-Dec-2007  mjf Sync with HEAD.
 1.42.2.1 02-Jan-2008  bouyer Sync with HEAD
 1.8 06-Aug-2016  maxv Use the stack to save %edx.
 1.7 24-Jul-2016  maxv The MSR EFER state is not saved and restored when sleeping on i386. On PAE,
the CPU crashes right after waking up, since it needs to access NOX-ed
pages, which are to be enabled in an MSR.

Fix this by properly saving and restoring the EFER MSR. It's a little
tricky since the wakeup code uses %edx, but rdmsr overwrites it. We just
save it in %esi.

Now, the CPU sleeps properly on PAE kernels.
 1.6 24-Jul-2016  maxv KNF, and reduce the diff between amd64 and i386.
 1.5 11-May-2008  ad branches: 1.5.42; 1.5.62; 1.5.66;
Share cpu.h between the x86 ports.
 1.4 18-Dec-2007  joerg branches: 1.4.2; 1.4.4; 1.4.10; 1.4.12; 1.4.14; 1.4.16;
Add new IPI for saving CPU state explicitly, share high-level part of
ACPI wakeup code and teach it how to start the APs again. As a side
effect the CPU_START interface allows choosing between different
bootstrap codes more easily now.
 1.3 11-Dec-2007  lukem Use __KERNEL_RCSID(). For these .S files, the following style was
adopted, a la .C files and <sys/cdefs.h>:
* move <machine/asm.h> to the top
* use __KERNEL_RCSID() immediately after it
 1.2 09-Dec-2007  jmcneill branches: 1.2.2;
Merge jmcneill-pm branch.
 1.1 08-Sep-2007  joerg branches: 1.1.2; 1.1.8; 1.1.10; 1.1.12;
file acpi_wakeup_low.S was initially added on branch jmcneill-pm.
 1.1.12.2 13-Dec-2007  yamt sync with head.
 1.1.12.1 11-Dec-2007  yamt sync with head.
 1.1.10.1 26-Dec-2007  ad Sync with head.
 1.1.8.1 27-Dec-2007  mjf Sync with HEAD.
 1.1.2.4 12-Nov-2007  joerg Reorder acpi_md_sleep similiar to amd64, e.g. stop double-return
from acpi_savecpu and call back into C to enter ACPI sleep state
instead.
 1.1.2.3 26-Oct-2007  joerg Sync with HEAD.

Follow the merge of pmap.c on i386 and amd64 and move
pmap_init_tmp_pgtbl into arch/x86/x86/pmap.c. Modify the ACPI wakeup
code to restore CR4 before jumping back into kernel space as the large
page option might cover that.
 1.1.2.2 24-Sep-2007  joerg Be explicit about the width of the mov instruction.
 1.1.2.1 08-Sep-2007  joerg Start to revamp the ACPI wake code (i386 only, amd64 gets minimal fixes
to keep being compilable):

- In init386 and the amd64 equivalent, just reserve the low-level code.
Do not map and don't copy the wakecode yet. This avoids the conflicts
with the MP tramp code as well. The wakecode is expected to be less
than one page long, which is way too much space.
acpi_md_get_npages_of_wakecode and acpi_md_install_wakecode are
dropped, acpi_wakeup_paddr is set instead of the reserved address.
- Split the wakecode into the essential low-level part to setup
protected mode with paging and valid CS and DS (which stays as
wakecode) and the rest. Inline beepon and beepoff as they are used
exactly once.
- Split the acpi_restorecpu and acpi_savecpu assembly from apci_wakeup.c
and merge acpi_restorecpu with the second half dropped from wakecode.
Most registers are not exported, just those needed to be patched into
wakecode. Don't bother to save or restore %eax, it is overriden
anyway.
- Don't bother to save and restore eflags in acpi_md_sleep, they are
handled correctly by the assembly. Don't play games with cr3 either,
we modify the pmap of the running processes. Copy the wakecode
directly before patching it, after the identity mapping has been
setup.
- Drop clear_reg and acpi_printcpu.
- Add an commented out broadcast IPI to halt the other CPUs explicitly.
 1.2.2.2 02-Jan-2008  bouyer Sync with HEAD
 1.2.2.1 13-Dec-2007  bouyer Sync with HEAD
 1.4.16.1 23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.4.14.1 16-May-2008  yamt sync with head.
 1.4.12.1 18-May-2008  yamt sync with head.
 1.4.10.1 02-Jun-2008  mjf Sync with HEAD.
 1.4.4.2 21-Jan-2008  yamt sync with head
 1.4.4.1 18-Dec-2007  yamt file acpi_wakeup_low.S was added on branch yamt-lazymbuf on 2008-01-21 09:36:48 +0000
 1.4.2.2 09-Jan-2008  matt sync with HEAD
 1.4.2.1 18-Dec-2007  matt file acpi_wakeup_low.S was added on branch matt-armv6 on 2008-01-09 01:46:25 +0000
 1.5.66.1 26-Jul-2016  pgoyette Sync with HEAD
 1.5.62.1 05-Oct-2016  skrll Sync with HEAD
 1.5.42.1 03-Dec-2017  jdolecek update from HEAD
 1.6 11-Dec-2007  jmcneill No longer required after jmcneill-pm merge.
 1.5 09-Dec-2007  jmcneill branches: 1.5.2;
Merge jmcneill-pm branch.
 1.4 11-Mar-2006  jmcneill branches: 1.4.38; 1.4.40; 1.4.46; 1.4.50; 1.4.52;
We shouldn't have to manually edit acpi_wakecode.h after it has been
regenerated. Pad wakecode with "0x00" rather than "0x ".
 1.3 18-Jun-2002  christos branches: 1.3.2; 1.3.4; 1.3.6; 1.3.8; 1.3.30; 1.3.44; 1.3.46; 1.3.48; 1.3.50;
simplify: use hexdump to produce the output in the desired form instead
of massaging it with sed.
 1.2 18-Jun-2002  tshiozak add a code to embed RCS tag of acpi_wakecode.S in acpi_wakecode.h .
 1.1 18-Jun-2002  tshiozak ACPI wake-up code for i386. but, we have no interface to use it efficiently.
 1.3.50.1 19-Apr-2006  elad sync with head - hopefully this will work
 1.3.48.1 13-Mar-2006  yamt sync with head.
 1.3.46.1 22-Apr-2006  simonb Sync with head.
 1.3.44.1 09-Sep-2006  rpaulo sync with head
 1.3.30.2 21-Jan-2008  yamt sync with head
 1.3.30.1 21-Jun-2006  yamt sync with head.
 1.3.8.2 18-Oct-2002  nathanw New files in merge.
 1.3.8.1 18-Jun-2002  nathanw file genwakecode.sh was added on branch nathanw_sa on 2002-10-18 03:13:06 +0000
 1.3.6.2 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.3.6.1 18-Jun-2002  jdolecek file genwakecode.sh was added on branch kqueue on 2002-09-06 08:35:54 +0000
 1.3.4.2 16-Jul-2002  gehenna catch up with -current.
 1.3.4.1 18-Jun-2002  gehenna file genwakecode.sh was added on branch gehenna-devsw on 2002-07-16 08:29:01 +0000
 1.3.2.2 18-Jun-2002  christos simplify: use hexdump to produce the output in the desired form instead
of massaging it with sed.
 1.3.2.1 18-Jun-2002  christos file genwakecode.sh was added on branch sommerfeld_i386mp_1 on 2002-06-18 17:21:34 +0000
 1.4.52.2 13-Dec-2007  yamt sync with head.
 1.4.52.1 11-Dec-2007  yamt sync with head.
 1.4.50.1 26-Dec-2007  ad Sync with head.
 1.4.46.1 27-Dec-2007  mjf Sync with HEAD.
 1.4.40.1 23-Mar-2008  matt sync with HEAD
 1.4.38.3 24-Sep-2007  joerg Generate the ACPI wakecode image dynamically at build time.
 1.4.38.2 07-Sep-2007  jmcneill Share ACPI wakecode generation between i386 and amd64, and convert amd64
to use joerg's new build scripts for generating wakecode.
 1.4.38.1 07-Sep-2007  joerg Rewrite wakeup code generation to actually use the linker and
prefix all exported symbols with WAKEUP_ to make them easily
distinguishable in acpi_wakeup.c.
 1.5.2.1 13-Dec-2007  bouyer Sync with HEAD
 1.20 26-Jan-2014  dsl Remove support for 'external' floating point units and the MS-DOS
compatible method of handling floating point exceptions.
Make kernel support for teh fpu non-optional (486SX should still work).
Only 386 cpus support external fpu, and i386 support was removed years ago.
This means that the npx code no longer uses port 0xf0 or interupt 13.
All the "npx at isa" lines go from the configs, arch/i386/isa/npx.c
is now mandatory for all i386 kernels.
I've renamed npxinit() to fpuinit() and npxinit_cpu() to fpuinit_cpu()
to match the very similar amd64 functions.
The fpu of the boot cpu is now initialised by a direct call from
cpu_configure(), this enables FP emulation for a 486SX.
(for amd64 the cr0 values are set in locore.S and similar).
This fixes a long-standing bug in linux_setregs() - which did not
save the fpu regsiters if they were active.
I've test booted a single cpu i386 kernel (using anita).
amd64 builds - none of teh changes should affect it.
The i386 XEN kernels build, but I'm not sure where they set cr0, and
it might have got lost!
 1.19 01-Jul-2011  dyoung branches: 1.19.2; 1.19.12; 1.19.16;
#include <sys/bus.h> instead of <machine/bus.h>.
 1.18 21-Feb-2009  jmcneill Adjust for acpi_resource_parse aprint changes, noted by Jukka Salmi
 1.17 04-Mar-2008  cube branches: 1.17.4; 1.17.12; 1.17.14; 1.17.18; 1.17.22;
Split device_t and softc for npx(4).
 1.16 16-Nov-2006  christos branches: 1.16.8; 1.16.28; 1.16.48; 1.16.52;
__unused removal on arguments; approved by core.
 1.15 29-Oct-2006  christos fix print formatting.
 1.14 29-Oct-2006  christos handle NPX_CPUID. reported by Takahiro Kambe
 1.13 29-Oct-2006  dogcow cargo-cult copy changes from npx_isa.c so that GENERIC.MPACPI builds again.
(hi, christos!)
 1.12 12-Oct-2006  christos - sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386
 1.11 19-Feb-2006  thorpej branches: 1.11.14; 1.11.16;
Use aprint_*().
 1.10 11-Dec-2005  christos branches: 1.10.2; 1.10.4; 1.10.6;
merge ktrace-lwp.
 1.9 01-May-2004  kochi branches: 1.9.10; 1.9.12;
specify static where appropriate.
 1.8 11-Apr-2004  kochi Clean up memory allocated during autoconfiguration
 1.7 11-Apr-2004  kochi change acpi_resource_parse API to support _PRS parsing as well as _CRS
 1.6 10-Apr-2004  kochi whitespace nit
 1.5 03-Nov-2003  mycroft More cleanup:
* Use ACPI_FAILURE() and ACPI_SUCCESS().
* Output exception strings in a few more places.
 1.4 03-Nov-2003  mycroft Clean up some messages:
* Use AcpiFormatException() in a bunch of places.
* acpi_resource_parse() already prints an error, so don't do it in the callers.
 1.3 03-Nov-2003  kochi * now the size of ACPI_DEVICE_INFO is variable:
it can now accomodate multiple _CIDs
sizeof(ACPI_DEVICE_INFO) should not be used
* make ad_devinfo member in acpi_devnode a pointer
* implement acpi_match_hid() to simplify matching devices;
_CIDs are also taken into account now as well as _HID
 1.2 31-Oct-2003  mycroft Update for structure changes.
 1.1 28-Dec-2002  jmcneill branches: 1.1.2; 1.1.4;
Add an npx at acpi(4) attachment
 1.1.4.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.1.4.2 18-Sep-2004  skrll Sync with HEAD.
 1.1.4.1 03-Aug-2004  skrll Sync with HEAD
 1.1.2.2 29-Dec-2002  thorpej Sync with HEAD.
 1.1.2.1 28-Dec-2002  thorpej file npx_acpi.c was added on branch nathanw_sa on 2002-12-29 19:29:06 +0000
 1.9.12.3 17-Mar-2008  yamt sync with head.
 1.9.12.2 30-Dec-2006  yamt sync with head.
 1.9.12.1 21-Jun-2006  yamt sync with head.
 1.9.10.1 30-May-2007  bouyer Pull up following revision(s) (requested by christos in ticket #1580):
sys/arch/i386/pnpbios/npx_pnpbios.c: revision 1.8 - 1.9
sys/arch/i386/acpi/npx_acpi.c: revision 1.14 - 1.15
sys/arch/i386/isa/npx_isa.c: revision 1.13 - 1.14
sys/arch/i386/isa/npx.c: revision 1.114
sys/arch/i386/isa/npxvar.h: revision 1.5
fix print formatting.
handle NPX_CPUID
Make npx work on the AMD Geode LX-800 processor by short-circuiting
the npx detection code. Since exception reporting is broken, check the
CPUID_FPU feature. This is what FreeBSD does.
 1.10.6.1 22-Apr-2006  simonb Sync with head.
 1.10.4.1 09-Sep-2006  rpaulo sync with head
 1.10.2.1 01-Mar-2006  yamt sync with head.
 1.11.16.2 10-Dec-2006  yamt sync with head.
 1.11.16.1 22-Oct-2006  yamt sync with head
 1.11.14.1 18-Nov-2006  ad Sync with head.
 1.16.52.1 03-Apr-2008  mjf Sync with HEAD.
 1.16.48.1 24-Mar-2008  keiichi sync with head.
 1.16.28.1 23-Mar-2008  matt sync with HEAD
 1.16.8.2 03-Dec-2007  ad Sync with HEAD.
 1.16.8.1 29-Jul-2007  ad Hardware interrupts musn't occur 'under' soft interrupts.
 1.17.22.1 21-Apr-2010  matt sync to netbsd-5
 1.17.18.3 27-Aug-2011  jym Sync with HEAD. Most notably: uvm/pmap work done by rmind@, and MP Xen
work of cherry@.

No regression observed on suspend/restore.
 1.17.18.2 01-Nov-2009  jym Sync with HEAD.
 1.17.18.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.17.14.1 01-May-2009  snj Pull up following revision(s) (requested by jmcneill in ticket #498):
sys/arch/i386/acpi/npx_acpi.c: revision 1.18
sys/arch/i386/acpi/spic_acpi.c: revision 1.21
Adjust for acpi_resource_parse aprint changes, noted by Jukka Salmi
 1.17.12.1 03-Mar-2009  skrll Sync with HEAD.
 1.17.4.1 04-May-2009  yamt sync with head.
 1.19.16.1 18-May-2014  rmind sync with head
 1.19.12.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.19.2.1 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.9 23-Dec-2007  jmcneill Move Sony Notebook Controller (sony(4)) driver from MD to MI directory,
as it can be used on amd64 as well.
 1.8 23-Dec-2007  jmcneill Remove wskbd attachment, it never worked right anyway. Instead, deliver
hotkey events to powerd.
 1.7 09-Dec-2007  smb branches: 1.7.2;
Change pnp_get_platform to pmf_get_platform
 1.6 09-Dec-2007  jmcneill Merge jmcneill-pm branch.
 1.5 16-Nov-2006  christos branches: 1.5.26; 1.5.28; 1.5.34; 1.5.38; 1.5.40;
__unused removal on arguments; approved by core.
 1.4 12-Oct-2006  christos - sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386
 1.3 19-Feb-2006  thorpej branches: 1.3.12; 1.3.16; 1.3.18;
Use aprint_*().
 1.2 13-Dec-2005  christos branches: 1.2.2; 1.2.4; 1.2.6;
always set the value, don't shortcut when val == oval.
From Sami Kantoluoto
 1.1 11-Dec-2005  christos branches: 1.1.2;
PR/32276: Sami Kantoluoto: Add driver to handle brightness control on Sony
VAIO.
 1.1.2.2 11-Dec-2005  christos Sync with head.
 1.1.2.1 11-Dec-2005  christos file sony_acpi.c was added on branch ktrace-lwp on 2005-12-11 10:28:18 +0000
 1.2.6.1 22-Apr-2006  simonb Sync with head.
 1.2.4.1 09-Sep-2006  rpaulo sync with head
 1.2.2.1 01-Mar-2006  yamt sync with head.
 1.3.18.2 10-Dec-2006  yamt sync with head.
 1.3.18.1 22-Oct-2006  yamt sync with head
 1.3.16.1 18-Nov-2006  ad Sync with head.
 1.3.12.4 21-Jan-2008  yamt sync with head
 1.3.12.3 30-Dec-2006  yamt sync with head.
 1.3.12.2 21-Jun-2006  yamt sync with head.
 1.3.12.1 19-Feb-2006  yamt file sony_acpi.c was added on branch yamt-lazymbuf on 2006-06-21 14:52:09 +0000
 1.5.40.1 11-Dec-2007  yamt sync with head.
 1.5.38.1 26-Dec-2007  ad Sync with head.
 1.5.34.1 27-Dec-2007  mjf Sync with HEAD.
 1.5.28.1 23-Mar-2008  matt sync with HEAD
 1.5.26.7 08-Dec-2007  jmcneill Rename pnp(9) -> pmf(9), as requested by many.
 1.5.26.6 06-Nov-2007  joerg Refactor PNP API:
- Make suspend/resume directly a device functionality. It consists of
three layers (class logic, device logic, bus logic), all of them being
optional. This replaces D0/D3 transitions.
- device_is_active returns true if the device was not disabled and was
not suspended (even partially), device_is_enabled returns true if the
device was enabled.
- Change pnp_global_transition into pnp_system_suspend and
pnp_system_resume. Before running any suspend/resume handlers, check
that all currently attached devices support power management and bail
out otherwise. The latter is not done for the shutdown/panic case.
- Make the former bus-specific generic network handlers a class handler.
- Make PNP message like volume up/down/toogle PNP events. Each device
can register what events they are interested in and whether the handler
should be global or not.
- Introduce device_active API for devices to mark themselve in use from
either the system or the device. Use this to implement the idle handling
for audio and input devices. This is intended to replace most ad-hoc
watchdogs as well.
- Fix somes situations in which audio resume would lose mixer settings.
- Make USB host controllers better deal with suspend in the light of
shared interrupts.
- Flush filesystem cache on suspend.
- Flush disk caches on suspend. Put ATA disks into standby on suspend as
well.
- Adopt drivers to use the new PNP API.
- Fix a critical bug in the generic cardbus layer that made D0->D3
break.
- Fix ral(4) to set if_stop.
- Convert cbb(4) to the new PNP API.
- Apply the PCI Express SCI fix on resume again.
 1.5.26.5 09-Sep-2007  christos Patch from jmcneill to make the brightness buttons work on my sony vgn-t250p.
 1.5.26.4 10-Aug-2007  jmcneill Sony VAIO sleep buttons aren't standard ACPI buttons, so tie the sleep
button found on VAIO keyboards into sysmon to deliver a pswitch event
when pressed.
 1.5.26.3 10-Aug-2007  jmcneill Allow brightness keys to work when a wskbd device isn't attached.
 1.5.26.2 05-Aug-2007  jmcneill Capture and restore display brightness state.
 1.5.26.1 03-Aug-2007  jmcneill Pull in power management changes from private branch.
 1.7.2.1 02-Jan-2008  bouyer Sync with HEAD
 1.22 09-Aug-2009  christos spic is moving
 1.21 21-Feb-2009  jmcneill Adjust for acpi_resource_parse aprint changes, noted by Jukka Salmi
 1.20 04-May-2008  xtraeme branches: 1.20.8; 1.20.10; 1.20.14; 1.20.18;
device_t/softc split for spic(4) and other related cosmetic changes.
 1.19 28-Apr-2008  martin Remove clause 3 and 4 from TNF licenses
 1.18 04-Apr-2008  cegger branches: 1.18.2; 1.18.4;
use aprint_*_dev and device_xname
OK joerg
 1.17 17-Dec-2007  christos branches: 1.17.6;
from jmcneill: suspend and resume handlers for spic.
 1.16 16-Nov-2006  christos branches: 1.16.28; 1.16.38; 1.16.42;
__unused removal on arguments; approved by core.
 1.15 12-Oct-2006  christos - sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386
 1.14 19-Feb-2006  thorpej branches: 1.14.14; 1.14.16;
Use aprint_*().
 1.13 11-Dec-2005  christos branches: 1.13.2; 1.13.4; 1.13.6;
merge ktrace-lwp.
 1.12 01-May-2004  kochi branches: 1.12.12;
specify static where appropriate.
 1.11 11-Apr-2004  kochi Clean up memory allocated during autoconfiguration
 1.10 11-Apr-2004  kochi change acpi_resource_parse API to support _PRS parsing as well as _CRS
 1.9 03-Nov-2003  mycroft More cleanup:
* Use ACPI_FAILURE() and ACPI_SUCCESS().
* Output exception strings in a few more places.
 1.8 03-Nov-2003  mycroft Clean up some messages:
* Use AcpiFormatException() in a bunch of places.
* acpi_resource_parse() already prints an error, so don't do it in the callers.
 1.7 03-Nov-2003  kochi * now the size of ACPI_DEVICE_INFO is variable:
it can now accomodate multiple _CIDs
sizeof(ACPI_DEVICE_INFO) should not be used
* make ad_devinfo member in acpi_devnode a pointer
* implement acpi_match_hid() to simplify matching devices;
_CIDs are also taken into account now as well as _HID
 1.6 31-Oct-2003  mycroft Update for structure changes.
 1.5 28-Dec-2002  christos branches: 1.5.2;
remove redundant declaration
 1.4 02-Oct-2002  thorpej branches: 1.4.2;
Tidy up CFATTACH_DECL() formatting.
 1.3 01-Oct-2002  fvdl Merge Bill Sommerfeld's i386 MP branch. This code has some known
caveats, but works quite well in a lot of MP cases, and all
UP cases that I have tested. Parts of this will hopefully be
reworked in the not-too-distant future.
 1.2 27-Sep-2002  thorpej Declare all cfattach structures const.
 1.1 17-Jun-2002  christos branches: 1.1.2; 1.1.4; 1.1.6;
Move MI drivers here. Approved by thorpej
 1.1.6.3 10-Oct-2002  jdolecek sync kqueue with -current; this includes merge of gehenna-devsw branch,
merge of i386 MP branch, and part of autoconf rototil work
 1.1.6.2 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.1.6.1 17-Jun-2002  jdolecek file spic_acpi.c was added on branch kqueue on 2002-09-06 08:35:54 +0000
 1.1.4.2 16-Jul-2002  gehenna catch up with -current.
 1.1.4.1 17-Jun-2002  gehenna file spic_acpi.c was added on branch gehenna-devsw on 2002-07-16 08:29:01 +0000
 1.1.2.2 17-Jun-2002  christos Move MI drivers here. Approved by thorpej
 1.1.2.1 17-Jun-2002  christos file spic_acpi.c was added on branch sommerfeld_i386mp_1 on 2002-06-17 22:38:04 +0000
 1.4.2.3 29-Dec-2002  thorpej Sync with HEAD.
 1.4.2.2 18-Oct-2002  nathanw New files in merge.
 1.4.2.1 02-Oct-2002  nathanw file spic_acpi.c was added on branch nathanw_sa on 2002-10-18 03:13:06 +0000
 1.5.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.5.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.5.2.1 03-Aug-2004  skrll Sync with HEAD
 1.12.12.3 21-Jan-2008  yamt sync with head
 1.12.12.2 30-Dec-2006  yamt sync with head.
 1.12.12.1 21-Jun-2006  yamt sync with head.
 1.13.6.1 22-Apr-2006  simonb Sync with head.
 1.13.4.1 09-Sep-2006  rpaulo sync with head
 1.13.2.1 01-Mar-2006  yamt sync with head.
 1.14.16.2 10-Dec-2006  yamt sync with head.
 1.14.16.1 22-Oct-2006  yamt sync with head
 1.14.14.1 18-Nov-2006  ad Sync with head.
 1.16.42.1 02-Jan-2008  bouyer Sync with HEAD
 1.16.38.1 26-Dec-2007  ad Sync with head.
 1.16.28.1 09-Jan-2008  matt sync with HEAD
 1.17.6.1 02-Jun-2008  mjf Sync with HEAD.
 1.18.4.3 19-Aug-2009  yamt sync with head.
 1.18.4.2 04-May-2009  yamt sync with head.
 1.18.4.1 16-May-2008  yamt sync with head.
 1.18.2.1 18-May-2008  yamt sync with head.
 1.20.18.1 21-Apr-2010  matt sync to netbsd-5
 1.20.14.2 01-Nov-2009  jym Sync with HEAD.
 1.20.14.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.20.10.1 01-May-2009  snj Pull up following revision(s) (requested by jmcneill in ticket #498):
sys/arch/i386/acpi/npx_acpi.c: revision 1.18
sys/arch/i386/acpi/spic_acpi.c: revision 1.21
Adjust for acpi_resource_parse aprint changes, noted by Jukka Salmi
 1.20.8.1 03-Mar-2009  skrll Sync with HEAD.
 1.34 10-Apr-2010  jruoho Move vald(4) to sys/dev/acpi. This is MI and should work also on amd64.

ok jmcneill@

XXX: This is broken: it calls methods with absolute pathnames (almost
guaranteed not to be portable across models), it accesses methods
that are in the domain of other drivers, it walks the namespace on
its own, it contains plenty of magic constants, it does not
integrate with existing KPIs, etc. Summa summarum: this should be
rewritten as a more generic toshiba_acpi(4).
 1.33 08-Apr-2010  jruoho ACPICA 20091112:

Implemented a post-order callback to AcpiWalkNamespace. The existing
interface only has a pre-order callback. This change adds an
additional parameter for a post-order callback which will be more
useful for bus scans. ACPICA BZ 779. Lin Ming. Updated the ACPICA
Programmer Reference.

We will use the old "pre-order callback" for the time being.
 1.32 04-Mar-2010  jruoho branches: 1.32.2;
Remove VALD_ACPI_DEBUG and AVALD_F_VERBOSE. No functional change.
 1.31 05-Jan-2010  jruoho branches: 1.31.2;
Use acpi_eval_set_integer() to simplify code. No functional change intended.

ok pgoyette@, jmcneill@
 1.30 16-Sep-2009  mlelstv Allow for 'options ACPI_DEBUG' by providing module declarations
and using memory allocation macros instead of calling AcpiOs* stubs
directly.
 1.29 04-May-2008  xtraeme branches: 1.29.14;
device_t/softc split and other related cosmetic changes.
 1.28 28-Apr-2008  martin Remove clause 3 and 4 from TNF licenses
 1.27 04-Apr-2008  cegger branches: 1.27.2; 1.27.4;
use aprint_*_dev and device_xname
OK joerg
 1.26 09-Dec-2007  jmcneill branches: 1.26.10;
Merge jmcneill-pm branch.
 1.25 04-Apr-2007  rmind branches: 1.25.12; 1.25.14; 1.25.22; 1.25.24;
vald_acpi_libright_get_bus: Plug a possible memory leak.
CID: 4358
 1.24 16-Nov-2006  christos branches: 1.24.4; 1.24.8; 1.24.10;
__unused removal on arguments; approved by core.
 1.23 12-Oct-2006  christos - sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386
 1.22 19-Feb-2006  thorpej branches: 1.22.14; 1.22.16;
Use aprint_*().
 1.21 11-Dec-2005  christos branches: 1.21.2; 1.21.4; 1.21.6;
merge ktrace-lwp.
 1.20 01-May-2004  kochi branches: 1.20.12;
specify static where appropriate.
 1.19 10-Apr-2004  kochi whitespace nit
 1.18 24-Mar-2004  kanaoka Make it compile (int -> ACPI_INTEGER)
 1.17 03-Nov-2003  mycroft More cleanup:
* Use ACPI_FAILURE() and ACPI_SUCCESS().
* Output exception strings in a few more places.
 1.16 03-Nov-2003  mycroft Clean up some messages:
* Use AcpiFormatException() in a bunch of places.
* acpi_resource_parse() already prints an error, so don't do it in the callers.
 1.15 03-Nov-2003  kochi * now the size of ACPI_DEVICE_INFO is variable:
it can now accomodate multiple _CIDs
sizeof(ACPI_DEVICE_INFO) should not be used
* make ad_devinfo member in acpi_devnode a pointer
* implement acpi_match_hid() to simplify matching devices;
_CIDs are also taken into account now as well as _HID
 1.14 31-Oct-2003  mycroft Update for structure changes.
 1.13 05-Aug-2003  kanaoka - Use local variable instead of sc_Arg in softc.
- Use ACPI_ALLOCATE_BUFFER/AcpiOsFree combination instead of sc_Ret in softc.

Pointed out by kochi.
 1.12 02-Jul-2003  kanaoka - Cleanup usage of ACPI_ALLOCATE_BUFFER/AcpiOsFree combination.
Patch from kochi.
 1.11 01-Jul-2003  kanaoka branches: 1.11.2;
- Remove unneed include file.
 1.10 19-Jun-2003  kanaoka - Remove the unused polling code.
- Clean up the code a bit.
 1.9 20-May-2003  kanaoka Fix a typo in a comment.
 1.8 20-May-2003  wiz Fix typo in debug message.
 1.7 20-May-2003  kanaoka - Use AcpiOsQueueForExecution instead of calling vald_acpi_event() directly
in Notify handler.
 1.6 23-Apr-2003  yamt use acpi notify mechanism if possible.
XXX i'm not sure if there're PCs that actually need to fall back to polling.
 1.5 02-Oct-2002  thorpej branches: 1.5.2;
Tidy up CFATTACH_DECL() formatting.
 1.4 01-Oct-2002  fvdl Merge Bill Sommerfeld's i386 MP branch. This code has some known
caveats, but works quite well in a lot of MP cases, and all
UP cases that I have tested. Parts of this will hopefully be
reworked in the not-too-distant future.
 1.3 27-Sep-2002  thorpej Declare all cfattach structures const.
 1.2 18-Jun-2002  christos branches: 1.2.2; 1.2.4; 1.2.6;
Copyright and comment clarification from Masanori-san.
 1.1 17-Jun-2002  christos Move MI drivers here. Approved by thorpej
 1.2.6.3 10-Oct-2002  jdolecek sync kqueue with -current; this includes merge of gehenna-devsw branch,
merge of i386 MP branch, and part of autoconf rototil work
 1.2.6.2 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.2.6.1 18-Jun-2002  jdolecek file vald_acpi.c was added on branch kqueue on 2002-09-06 08:35:56 +0000
 1.2.4.2 16-Jul-2002  gehenna catch up with -current.
 1.2.4.1 18-Jun-2002  gehenna file vald_acpi.c was added on branch gehenna-devsw on 2002-07-16 08:29:02 +0000
 1.2.2.2 18-Jun-2002  christos Copyright and comment clarification from Masanori-san.
 1.2.2.1 18-Jun-2002  christos file vald_acpi.c was added on branch sommerfeld_i386mp_1 on 2002-06-18 02:42:17 +0000
 1.5.2.2 18-Oct-2002  nathanw New files in merge.
 1.5.2.1 02-Oct-2002  nathanw file vald_acpi.c was added on branch nathanw_sa on 2002-10-18 03:13:07 +0000
 1.11.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.11.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.11.2.1 03-Aug-2004  skrll Sync with HEAD
 1.20.12.4 21-Jan-2008  yamt sync with head
 1.20.12.3 03-Sep-2007  yamt sync with head.
 1.20.12.2 30-Dec-2006  yamt sync with head.
 1.20.12.1 21-Jun-2006  yamt sync with head.
 1.21.6.1 22-Apr-2006  simonb Sync with head.
 1.21.4.1 09-Sep-2006  rpaulo sync with head
 1.21.2.1 01-Mar-2006  yamt sync with head.
 1.22.16.2 10-Dec-2006  yamt sync with head.
 1.22.16.1 22-Oct-2006  yamt sync with head
 1.22.14.1 18-Nov-2006  ad Sync with head.
 1.24.10.1 11-Jul-2007  mjf Sync with head.
 1.24.8.1 10-Apr-2007  ad Sync with head.
 1.24.4.1 15-Apr-2007  yamt sync with head.
 1.25.24.1 11-Dec-2007  yamt sync with head.
 1.25.22.1 26-Dec-2007  ad Sync with head.
 1.25.14.1 09-Jan-2008  matt sync with HEAD
 1.25.12.1 03-Oct-2007  jmcneill Update to new ACPICA APIs.
 1.26.10.1 02-Jun-2008  mjf Sync with HEAD.
 1.27.4.3 11-Aug-2010  yamt sync with head.
 1.27.4.2 11-Mar-2010  yamt sync with head
 1.27.4.1 16-May-2008  yamt sync with head.
 1.27.2.1 18-May-2008  yamt sync with head.
 1.29.14.2 24-Oct-2010  jym Sync with HEAD
 1.29.14.1 01-Nov-2009  jym Sync with HEAD.
 1.31.2.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.32.2.1 30-May-2010  rmind sync with head

RSS XML Feed