freebsd-dev/sys/dev/acpica
Andriy Gapon 0a15ff37d6 call AcpiLeaveSleepStatePrep after re-enabling interrupts
I want to do this change because this call (actually,
AcpiHwLegacyWakePrep) does a memory allocation and ACPI namespace
evaluation.  Although it is not very likely to run into any trouble, it
is still not safe to make those calls with interrupts disabled.
witness(4) and malloc(9) do not currently check for a context with
interrupts disabled via intr_disable and we lack a facility for doing
that.  So, those unsafe operations fly under the radar.  But if
intr_disable in acpi_EnterSleepState was replaced with spinlock_enter
(which it probably should be), then witness and malloc would immediately
complain.

Also, AcpiLeaveSleepStatePrep is documented as called when interrupts
are enabled.  It used to require disabled interrupts, but that
requirement was changed a long time ago when support for _BFS and _GTS
was removed from ACPICA.

The ACPI wakeup sequence is very sensitive to changes. I consider this
change to be correct, but there can be fallouts from it.

What AcpiHwLegacyWakePrep essentially does is writing a value
corresponding to S0 into SLP_TYPx bits of PM1 Control Register(s).
According to ACPI specifications that write should be a NOP as SLP_EN
bit is not set.  But I see in some chipset specifications that they
allow to ignore SLP_EN altogether and to act on a change of SLP_TYPx
alone.

Also, there are a couple of accesses to ACPI hardware before the new
location of the call to AcpiLeaveSleepStatePrep.  One is to clear the
power button status and the other is to enable SCI.  So, the move may
affect the interaction between then OS and ACPI platform.

I have not seen any regressions on my test system, but it's a desktop.

MFC after:	5 weeks
2018-06-01 09:44:23 +00:00
..
Osd Redo r332918 with the ACPICA API and remove debug.acpi.suspend_deep_bounce. 2018-05-03 19:00:50 +00:00
acpi_acad.c
acpi_battery.c
acpi_bus_if.m Add the start of INTRNG support for ACPI. 2018-01-11 17:09:12 +00:00
acpi_button.c
acpi_cmbat.c Fix startup race initialising ACPI CM battery structures on MacBookPro. 2017-02-27 08:36:51 +00:00
acpi_container.c hyperv/vmbus: Reorganize vmbus device tree 2017-05-10 05:28:14 +00:00
acpi_cpu.c Use device_quiet_children to silence verbose CPU probe messages. 2018-05-07 21:09:17 +00:00
acpi_dock.c
acpi_ec.c Fix for endless recursion in the ACPI GPE handler during boot. 2016-12-02 08:21:08 +00:00
acpi_hpet.c hpet: use macros instead of magic values for the timer mode 2018-05-03 13:14:31 +00:00
acpi_hpet.h Implement userspace gettimeofday(2) with HPET timecounter. 2016-08-17 09:52:09 +00:00
acpi_if.m
acpi_isab.c
acpi_lid.c Export the actual LID state via sysctl. This allows more complex 2017-03-12 18:00:02 +00:00
acpi_package.c acpica: remove a superfluous NULL check 2017-02-16 20:27:22 +00:00
acpi_pci_link.c
acpi_pci.c Add a new bus method to fetch device-specific CPU sets. 2016-05-09 20:50:21 +00:00
acpi_pcib_acpi.c Add support for NUMA domains to bus dma tags. This causes all memory 2018-01-12 23:34:16 +00:00
acpi_pcib_pci.c Implement a proper detach method for the PCI-PCI bridge driver. 2016-05-20 00:03:22 +00:00
acpi_pcib.c Add a new bus method to fetch device-specific CPU sets. 2016-05-09 20:50:21 +00:00
acpi_pcibvar.h Add a new bus method to fetch device-specific CPU sets. 2016-05-09 20:50:21 +00:00
acpi_pcivar.h Associate device_t objects with ACPI handles via PCI_CHILD_ADDED(). 2016-04-07 17:15:16 +00:00
acpi_perf.c Remove misc NULL checks after M_WAITOK allocations. 2016-05-10 10:26:07 +00:00
acpi_powerres.c
acpi_quirk.c
acpi_quirks
acpi_resource.c Workaround fixed I/O port resources encoded as I/O port ranges in _CRS. 2018-04-18 18:36:26 +00:00
acpi_smbat.c
acpi_smbus.h
acpi_thermal.c Attach a "thermal_zone" label to the ACPI thermal zone sysctls. 2016-12-14 13:00:27 +00:00
acpi_throttle.c
acpi_timer.c Use uintmax_t (typedef'd to rman_res_t type) for rman ranges. 2016-03-18 01:28:41 +00:00
acpi_video.c Silence PVS-Studio warning (V595). 2016-02-23 22:55:44 +00:00
acpi.c call AcpiLeaveSleepStatePrep after re-enabling interrupts 2018-06-01 09:44:23 +00:00
acpiio.h sys/dev: minor spelling fixes. 2016-05-03 03:41:25 +00:00
acpivar.h Remove local definitions for _STA method in favor of ACPICA. 2018-03-14 23:42:28 +00:00