| Commit message (Collapse) | Author | Age | Files | Lines |
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This has been possible since ACPICA 20240827, and is actually
a requirement to get out of S3 on ACPI_REDUCED_HARDWARE (that said, we
don't implement S3 on arm64 yet).
Relevant ACPICA commit:
https://github.com/acpica/acpica/commit/79cd933e7b370e8d3fb490bf36ca5d111a12f96a.
Reviewed by: obiwac
MFC after: 2 weeks
MFC to: stable/15
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D54625
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
| |
Previously, we would first call AcpiEvaluateObject() to execute \_Sx
before calling AcpiGetSleepTypeData(). This was unnecessary, as
AcpiGetSleepTypeData() performs the same call itself. While doing so,
the latter function logs any other error than AE_NOT_FOUND (which
indicates that a particular sleep state is not supported), which most
probably is an added benefit of this change.
Reviewed by: obiwac
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D54624
|
| |
|
|
|
| |
Fixes: c5daa5a4c32c ("acpi_spmc: Add system power management controller driver")
Sponsored by: The FreeBSD Foundation
|
| |
|
|
|
|
| |
Reported by: des
Fixes: c5daa5a4c32c ("acpi_spmc: Add system power management controller driver")
Sponsored by: The FreeBSD Foundation
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Add SPMC (system power management controller) driver as acpi_spmc. This
is the device which provides the LPI device D-state constraints and
allows for OSPM to send S0ix/modern standby entry/exit notifications.
This supports the original Intel DSM
(https://uefi.org/sites/default/files/resources/Intel_ACPI_Low_Power_S0_Idle.pdf,
untested), the AMD DSM (tested), and the Microsoft DSM (tested).
Before entry, acpi_spmc_check_constraints is called to notify of any
violated power constraints. This will use acpi_pwr_get_state to get
current device D-states when that gets added back.
Reviewed by: olce
Tested by: jkim, Oleksandr Kryvulia, Matthias Lanter
Approved by: olce
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D48387
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
When resuming from ACPI suspend, the ACPI_SS_SLP_PREP bit in slp_state
was being checked and subsequently unset when calling resumeclock().
This bit was also being checked for the AcpiLeaveSleepState() call in
the non-s2idle path, but having just been unset, it was never actually
being called.
Change this so that resumeclock() is always being called (since we never
goto breakout between suspendclock() and resumeclock() anyway) and
ACPI_SS_SLP_PREP is purely used for AcpiEnterSleepStatePrep() and
AcpiLeaveSleepState() in the non-s2idle paths.
PR: 292568
Reported by: Marek Zarychta
Reviewed by: olce
Tested by: Marek Zarychta
Approved by: olce
Fixes: 7669cbd0f064 (“acpi: Suspend-to-idle support (s2idle)”)
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D54777
|
| |
|
|
|
|
|
|
| |
This simplifies detach/cleanup for drivers that add multiple ACPI ioctls.
Reviewed by: imp
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D54420
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Implement STYPE_SUSPEND_TO_IDLE sleep type added in c43473dc9b83
("sys/power: Generic sleep types").
This is a prerequisite for the firmware to enter the S0ix states. When
suspending to idle, the system stays in an ACPI S0 state, but the CPUs
are idled and devices are suspended/resumed before and after this as
they would be when entering any other sleep type (except for AWAKE and
POWEROFF).
Factor out do_standby, do_sleep, and add a new do_idle function for
idling the CPU (a future patch will make this an idle loop and not just
a simple cpu_idle() call). In do_idle, SCIs (interrupt 9) are enabled to
allow wake events to break the CPU out of idle.
Record all the steps made instead of just the last one in slp_state,
which allows for more flexible unwinding (will be useful to not have to
goto breakout if the SPMC entry call fails when that is committed).
A lot of this borrows from Ben Widawsky's patch: D17675. The main
functional difference with that patch is that suspend-to-idle is a
wholly separate sleep type in this one as opposed to being an
alternative implementation for s2mem (S3).
Reviewed by: emaste, olce
Approved by: olce
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D48734
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
| |
This is needed because when we add the suspend-to-idle loop, we only
want to break the BSP out of idle to process the taskqueue while keeping
all the others idled.
Currently assuming BSP to be CPU0, which may not always be the case on
non-x86.
Reviewed by: kib
Approved by: kib
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D54406
|
| |
|
|
|
|
| |
Reviewed by: imp
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D54313
|
| |
|
|
|
|
|
|
|
| |
This function is only called from device attach routines which can
sleep.
Reviewed by: imp
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D54312
|
| |
|
|
|
|
| |
Reviewed by: imp
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D54311
|
| |
|
|
|
|
|
|
|
|
| |
This is only used during attach and freed after use, so just use a
local variable in the attach routine instead to avoid leaving a
dangling pointer around in the softc.
Reviewed by: imp
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D54310
|
| |
|
|
|
|
| |
Reviewed by: imp
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D54309
|
| |
|
|
|
| |
Reviewed by: imp
Differential Revision: https://reviews.freebsd.org/D53406
|
| |
|
|
|
| |
Reviewed by: imp
Differential Revision: https://reviews.freebsd.org/D53405
|
| |
|
|
|
| |
Reviewed by: imp
Differential Revision: https://reviews.freebsd.org/D53403
|
| |
|
|
|
|
|
|
|
| |
The wrapper functions such as bus_alloc_resource_any() still support
passing the rid by value or pointer, but the underlying implementation
now passes by value.
Reviewed by: imp
Differential Revision: https://reviews.freebsd.org/D53402
|
| |
|
|
|
|
| |
Reviewed by: thj, emaste
Approved by: thj
Sponsored by: The FreeBSD Foundation
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
| |
This restores the functionality as it was pre-97d152698f48.
A stopgap was committed by glebius@ in 34dfccc64f47 ("acpi: in
acpi_stype_sysctl() use same logic as in acpi_sleep_state_sysctl()").
PR: 290651
Reviewed by: thj, emaste
Approved by: thj
Fixes: 97d152698f48 ("acpi: Use sleep types defined in sys/power.h")
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D53909
|
| |
|
|
|
|
|
| |
Add this so it can be consumed/graphed.
Differential Revision: https://reviews.freebsd.org/D53633
Reviewed by: gallatin, imp
|
| |
|
|
|
|
| |
- s/depenedent/dependent/
MFC after: 5 days
|
| |
|
|
|
|
|
|
|
|
|
|
| |
Otherwise we allow to trigger an MPASS() by a userland sysctl, e.g.
hw.acpi.power_button_state=NONE. This does not bring fully compatibility,
where as before 97d152698f483 setting to 'NONE' actually meant disabling
any action on a power or sleep button. Now sysctl will fail, but with
this change it won't at least panic.
Aymeric may come with a better fix.
Fixes: 97d152698f4831db5a94d55c15233330c188feda
|
| |
|
|
|
|
|
|
|
|
| |
Add enum sleep_type stype parameter in power_suspend/resume event
handlers, as with the introduction of s2idle there are more than one
type of suspend.
Reviewed by: bz
Approved by: bz
Sponsored by: The FreeBSD Foundation
|
| |
|
|
|
|
|
| |
swi_remove expects a void *, but we were passing void **.
MFC after: 1 week
Sponsored by: Dell Inc.
|
| |
|
|
|
|
|
|
| |
This reverts commit a13f28d57ecfd136ce73493659c28a47fa1a4b9f.
Reported by: phk
Tested by: phk
Sponsored by: The FreeBSD Foundation
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
| |
device"
Setting ACPI D-states is generally broken on FreeBSD and this change
surfaced an issue. So reverting for the time being whilst I write a
proper fix for this.
This reverts commit 02a8fadd2c4dc4b78d6d93d9d8b70e9348a6de6d.
Reported by: glebius, phk
Tested by: glebius
Sponsored by: The FreeBSD Foundation
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Allow PM backends to report supported sleep types when registering
through `power_pm_register`. Expose this information through
`kern.power.supported_stype` sysctl, and set defaults for
`power_standby/suspend/hibernate_stype` based on this.
Implement this in ACPI PM backend.
Reviewed by: cy
Approved by: cy
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D52727
Event: EuroBSDcon 2025 Devsummit
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
When writing an ACPI S-state to it it will set kern.power.suspend to the
appropriate sleep type, and when reading from it it will return the
corresponding ACPI S-state to the sleep type in kern.power.suspend.
This is deprecated and kern.power.suspend should be used directly
instead, but add this back because zzz(1) makes use of this and we can't
easily rewrite it just now.
PR: 289634
Reviewed by: cy, markj
Approved by: cy, markj
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D52600
Event: EuroBSDcon 2025 Devsummit
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This is as opposed to using ACPI sleep states directly
(`ACPI_STATE_S*`). We now use `POWER_STYPE_*` added in D52036.
This is in preparation for adding support for s2idle, which is not an
ACPI sleep state, but needs to be handled specially by
`acpi_EnterSleepState`.
Reviewed by: cy
Approved by: cy
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D52705
Event: EuroBSDcon 2025 Devsummit
|
| |
|
|
|
|
| |
This reverts commit ce5e22b28ef6caff3ffd228ac188114b08c0da02.
PR: 289634
|
| |
|
|
|
|
| |
This reverts commit e779891327b1d9b9ab10ba482e59f498790505a7.
PR: 289634
|
| |
|
|
|
|
| |
This reverts commit 4894f5ba394306a75dbed9ed4377ab0eae75aede.
PR: 289634
|
| |
|
|
|
|
|
| |
Reviewed by: olce
Fixes: ce5e22b28ef6 ("acpi: Use sleep types defined in sys/power.h")
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D52545
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
| |
Allow PM backends to report supported sleep types when registering
through `power_pm_register`. Expose this information through
`kern.power.supported_stype` sysctl, and set defaults for
`power_standby/suspend/hibernate_stype` based on this.
Implement this in ACPI PM backend.
Reviewed by: mckusick (mentor), markj
Approved by: mckusick (mentor), markj
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D52044
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This is as opposed to using ACPI sleep states (`ACPI_STATE_S*`). We now
use `POWER_STYPE_*` added in D52036.
This is in preparation for adding support for s2idle, which is not an
ACPI sleep state, but needs to be handled specially by
`acpi_EnterSleepState`.
Supersedes D48732.
Reviewed by: mckusick (mentor), markj
Approved by: mckusick (mentor), markj
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D52043
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Pull out the sleep types (stype) from ACPI, as was previously being
done in D48732, and pass this sleep type to `power_pm_fn` instead of
passing the existing sleep state. This is a little awkward because we
already kinda have generic sleep states (`POWER_SLEEP_STATE_*`), but
these are not precise enough to build upon.
This revision also adds generic equivalents to `hw.acpi.suspend_state`
etc sysctls, e.g. `kern.power.suspend`.
Reviewed by: markj, mckusick (mentor)
Approved by: markj, mckusick (mentor)
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D52036
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Add `acpi_pwr_get_state` as a prerequisite to LPI (low-power idle)
states. Since these states define minimum D-state constraints on other
devices to be able to enter them, it will be necessary to use this
function to check them before attempting to do so.
Aside from that, this function is used to get the initial D-state of a
power consumer when registering it (previously the `ac_state` value
would be set to `ACPI_STATE_UNKNOWN`). It uses the `_PSC` method if
available (older devices), or infers the D-state through the `_PRx`
objects (cached in `ac_prx`) with `acpi_pwr_infer_state` if not.
`acpi_pwr_switch_consumer` now uses this to verify that the D-state of
a power consumer was switched correctly.
Reviewed by: imp, markj, jrm (mentor)
Approved by: markj, jrm (mentor)
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D48386
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The power resource dependencies for each `_PRx` object are discovered
and cached in `ac_prx` on the power consumer struct
(`struct acpi_powerconsumer`) when a power consumer is registered. This
is done in `acpi_pwr_get_power_resources`. ACPI guarantees these `_PRx`
objects will evaluate to the same thing each time they are called.
This discovery process also registers those power resources, which were
previously only registered when they were referenced by the relevant
`_PRx` object for the target D-state when switching. This meant that
the first D-state switch for a power consumer would not turn off any
power resources as they wouldn't have been registered yet. This change
fixes this.
`ac_prx` will be used by subsequent patches.
Reviewed by: markj, imp, jrm (mentor)
Approved by: markj, jrm (mentor)
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D48385
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Commit 84bbfc32a3f4 introduced a dependency on ACPICA for non-ACPI
builds. This removes that unintended dependency.
While here, print "D3hot" for D3hot in ACPI code instead of just "D3",
as it was unclear whether that referred to D3hot or D3cold and was
inconsistent with the `PCI_POWERSTATE_D3` and `ACPI_D_STATE_D3` defines.
Reported by: jrtc27, freebsd@sysctl.cz
Reviewed by: jrtc27, des, jrm (mentor)
Approved by: jrtc27, jrm (mentor)
Fixes: 84bbfc32a3f4 ("acpi_powerres: D3cold support")
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D51823
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Cherry-pick commit 0b76c0a from ACPICA (actypes: Distinguish between
D3hot/cold, and default `ACPI_STATE_D3` to D3cold).
The same distinction is made between `PCI_POWERSTATE_D3_HOT` and
`PCI_POWERSTATE_D3_COLD`, as they're defined by ACPI (and are asserted
to be the same).
D3cold is essentially the same as D3hot except the power resources are
turned off. Add support for D3cold to `acpi_pwr_switch_consumer`.
`acpi_d_state_to_str` replaces the `printf("D%d", d_state)` pattern,
allowing for "D3hot" and "D3cold" strings to be printed instead of just
"D3".
Reviewed by: markj, ziaee, mckusick (mentor)
Approved by: markj, mckusick (mentor)
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D48384
|
| |
|
|
|
|
| |
Reviewed by: imp, jhb
Approved by: imp (mentor)
Differential Revision: https://reviews.freebsd.org/D50913
|
| |
|
|
|
|
|
|
|
|
| |
Some systems provide two PCI root complex devices in the ACPI tables.
Allow us to skip known pci-like devices even if they aren't detected
as a PCI root complex.
Reviewed by: cognet, jhb
Co-authored-by: cognet
Differential Revision: https://reviews.freebsd.org/D49709
|
| |
|
|
|
|
|
|
|
|
| |
On arm64 we use the iommu base address as an xref. This fails when
the address has the lower 32-bits in common with another iommu as
they will share an xref.
Reviewed by: kib
Sponsored by: Arm Ltd
Differential Revision: https://reviews.freebsd.org/D48726
|
| |
|
|
| |
Differential Revision: https://reviews.freebsd.org/D49266
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
On some EC2 instances, there is a race between removing a device from
the system and making the PCI bus stop reporting the presence of the
device. As a result, a PCI BUS_RESCAN performed immediately after
the _EJ0 method returns "sees" the device which is being ejected, which
then causes problems later (e.g. we won't recognize a new device being
plugged into that slot because we never knew it was vacant).
On other operating systems the bus is synchronously marked as needing
to be rescanned but the rescan does not occur until O(1) seconds later.
Create a new ACPI_Q_DELAY_BEFORE_EJECT_RESCAN quirk and set it in EC2
AMIs, and add a 10 ms DELAY between _EJ0 and BUS_RESCAN when tht quirk
is set.
Reviewed by: jhb
MFC after: 1 month
Sponsored by: Amazon
Differential Revision: https://reviews.freebsd.org/D49252
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
In order to signal to Graviton [123] systems that a device is ready
to be "ejected" (after a detach request is made via the EC2 API) we
need to set PCIM_PSTAT_PME to 1 and PCIM_PSTAT_PMEENABLE to 0. We are
not aware of any rationale for this requirement beyond "another OS
kernel happens to do this", i.e. this is effectively bug-for-bug
compatibility.
Arguably this should be done by the ACPI _EJ0 method on these systems,
but it is not.
Create a new ACPI_Q_CLEAR_PME_ON_DETACH quirk and set it in EC2 AMIs,
and add the PCI register write to acpi_pci_device_notify_handler when
that quirk is set.
Reviewed by: jhb
MFC after: 1 month
Sponsored by: Amazon
Differential Revision: https://reviews.freebsd.org/D49146
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
We need to complete calling the ACPI method before marking the interrupt
as complete. If two threads are inspecting the ACPI tables at the same
time they may both try to lock the ACPI mutex causing one to sleep. If
this is the ithread it will panic the kernel as this is not allowed.
Update the ged ithread to allow sleeping as it is expected this lock
will be uncommon enough any sleep will be short.
PR: 283103
Reviewed by: markj (earlier version)
Sponsored by: Arm Ltd
Differential Revision: https://reviews.freebsd.org/D48284
|
| |
|
|
|
|
|
|
|
|
|
| |
Fix a copy-and-paste error in acpi_pcib_request_feature where the
child device was passed into acpi_pcib_osc rather than the pcib
device.
Reviewed by: garga, jhb
Fixes: ba1904937d9a ("acpica: Extract _OSC parsing to a common file")
Sponsored by: Arm Ltd
Differential Revision: https://reviews.freebsd.org/D48285
|
| |
|
|
|
|
|
|
|
| |
This will be used by pci_host_generic_acpi.c so needs to be in a
common location.
Reviewed by: imp, jhb
Sponsored by: Arm Ltd
Differential Revision: https://reviews.freebsd.org/D48044
|