Page MenuHomeFreeBSD

acpi: Move supported states arrays into the softc
ClosedPublic

Authored by olce on Jun 3 2026, 4:54 PM.
Tags
None
Referenced Files
Unknown Object (File)
Sun, Jul 5, 4:57 AM
Unknown Object (File)
Fri, Jul 3, 2:10 PM
Unknown Object (File)
Mon, Jun 22, 8:16 PM
Unknown Object (File)
Mon, Jun 22, 8:10 PM
Unknown Object (File)
Mon, Jun 22, 6:07 PM
Unknown Object (File)
Sun, Jun 21, 5:13 AM
Unknown Object (File)
Sun, Jun 21, 5:09 AM
Unknown Object (File)
Fri, Jun 19, 3:27 PM
Subscribers

Details

Summary

This is done in preparation of having some machine-dependent code access
these arrays through the softc.

Before this change, these arrays were static. We chose to make them
part of the softc, instead of just exporting them ('acpi_quirks' remains
a known offender; some better way forward is to declare the whole ACPI
softc as static).

Some sysctl handlers now need to be passed the softc to access the
arrays, and some already needed to be passed a pointer to a field in the
softc. As sysctl handlers are provided with a single pointer (arg1) and
a single integer (arg2), and now that the softc has to be passed into
the pointer argument (arg1), point indirectly to the wanted softc's
field by passing its offset in the integer argument (arg2).

To preserve the statically sized array in the signature of
power_pm_register(), and consequently avoid constructing such a dummy
array in early initialization (after this change, we can't pass
acpi_supported_stypes[] anymore as there is no existing ACPI softc at
this point), just remove the early ACPI registration via
power_pm_register(). This existed in the past as a hack to ensure ACPI
would be registered in priority, but for a long time now ACPI has been
the only subsystem that registers itself to the generic power
infrastructure, so this early registration has not been needed.

Sponsored by: The FreeBSD Foundation

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable