OSDN Git Service

ACPICA: Allow address_space_handler Install and _REG execution as 2 separate steps
authorHans de Goede <hdegoede@redhat.com>
Thu, 8 Dec 2022 14:23:33 +0000 (15:23 +0100)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Thu, 8 Dec 2022 16:38:28 +0000 (17:38 +0100)
commit54c516aeb8b39eeae6450b7d8076d381568dca46
tree6d339cafd94841ec33f2a7a47c7b15ebc76a27f4
parent7a9d74e7e403cb2e60d4d00c05f2f3ab2a33d0c3
ACPICA: Allow address_space_handler Install and _REG execution as 2 separate steps

ACPI-2.0 says that the EC op_region handler must be available immediately
(like the standard default op_region handlers):

Quoting from the ACPI spec version 6.3: "6.5.4 _REG (Region) ...
2. OSPM must make Embedded Controller operation regions, accessed via
the Embedded Controllers described in ECDT, available before executing
any control method. These operation regions may become inaccessible
after OSPM runs _REG(EmbeddedControl, 0)."

So the OS must probe the ECDT described EC and install the OpRegion handler
before calling acpi_enable_subsystem() and acpi_initialize_objects().

This is a problem because calling acpi_install_address_space_handler()
does not just install the op_region handler, it also runs the EC's _REG
method. This _REG method may rely on initialization done by the _INI
methods of one of the PCI / _SB root devices.

For the other early/default op_region handlers the op_region handler
install and the _REG execution is split into 2 separate steps:
1. acpi_ev_install_region_handlers(), called early from acpi_load_tables()
2. acpi_ev_initialize_op_regions(), called from acpi_initialize_objects()

To fix the EC op_region issue, add 2 bew functions:
1. acpi_install_address_space_handler_no_reg()
2. acpi_execute_reg_methods()
to allow doing things in 2 steps for other op_region handlers,
like the EC handler, too.

Note that the comment describing acpi_ev_install_region_handlers() even has
an alinea describing this problem. Using the new methods allows users
to avoid this problem.

Link: https://github.com/acpica/acpica/pull/786
Link: https://bugzilla.kernel.org/show_bug.cgi?id=214899
Reported-and-tested-by: Johannes Penßel <johannespenssel@posteo.net>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
drivers/acpi/acpica/evxfregn.c
include/acpi/acpixf.h