diff mbox series

acpi: Support CONFIG_ACPI without CONFIG_PCI

Message ID 20240613211011.413120-1-surajjs@amazon.com
State New
Headers show
Series acpi: Support CONFIG_ACPI without CONFIG_PCI | expand

Commit Message

Suraj Jitindar Singh June 13, 2024, 9:10 p.m. UTC
Make is possible to use ACPI without having CONFIG_PCI set.

When initialising ACPI the following call chain occurs:

  acpi_init() ->
    acpi_bus_init() ->
      acpi_load_tables() ->
        acpi_ev_install_region_handlers() ->

acpi_ev_install_region_handlers() calls acpi_ev_install_space_handler() on
each of the default address spaces defined as:

  u8 acpi_gbl_default_address_spaces[ACPI_NUM_DEFAULT_SPACES] = {
          ACPI_ADR_SPACE_SYSTEM_MEMORY,
          ACPI_ADR_SPACE_SYSTEM_IO,
          ACPI_ADR_SPACE_PCI_CONFIG,
          ACPI_ADR_SPACE_DATA_TABLE
  };

However in acpi_ev_install_space_handler() the case statement for
ACPI_ADR_SPACE_PCI_CONFIG is ifdef'd as:

  #ifdef ACPI_PCI_CONFIGURED
                  case ACPI_ADR_SPACE_PCI_CONFIG:

                          handler = acpi_ex_pci_config_space_handler;
                          setup = acpi_ev_pci_config_region_setup;
                          break;
  #endif

ACPI_PCI_CONFIGURED is not defined if CONFIG_PCI is not enabled, thus the
attempt to install the handler fails.

Fix this by ifdef'ing ACPI_ADR_SPACE_PCI_CONFIG in the list of default
address spaces.

Fixes: bd23fac3eaaa ("ACPICA: Remove PCI bits from ACPICA when CONFIG_PCI is unset")
CC: stable@vger.kernel.org # 5.0.x-
Signed-off-by: Suraj Jitindar Singh <surajjs@amazon.com>
---
 drivers/acpi/acpica/evhandler.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

Rafael J. Wysocki June 14, 2024, 11:08 a.m. UTC | #1
On Thu, Jun 13, 2024 at 11:10 PM Suraj Jitindar Singh
<surajjs@amazon.com> wrote:
>
> Make is possible to use ACPI without having CONFIG_PCI set.
>
> When initialising ACPI the following call chain occurs:
>
>   acpi_init() ->
>     acpi_bus_init() ->
>       acpi_load_tables() ->
>         acpi_ev_install_region_handlers() ->
>
> acpi_ev_install_region_handlers() calls acpi_ev_install_space_handler() on
> each of the default address spaces defined as:
>
>   u8 acpi_gbl_default_address_spaces[ACPI_NUM_DEFAULT_SPACES] = {
>           ACPI_ADR_SPACE_SYSTEM_MEMORY,
>           ACPI_ADR_SPACE_SYSTEM_IO,
>           ACPI_ADR_SPACE_PCI_CONFIG,
>           ACPI_ADR_SPACE_DATA_TABLE
>   };
>
> However in acpi_ev_install_space_handler() the case statement for
> ACPI_ADR_SPACE_PCI_CONFIG is ifdef'd as:
>
>   #ifdef ACPI_PCI_CONFIGURED
>                   case ACPI_ADR_SPACE_PCI_CONFIG:
>
>                           handler = acpi_ex_pci_config_space_handler;
>                           setup = acpi_ev_pci_config_region_setup;
>                           break;
>   #endif
>
> ACPI_PCI_CONFIGURED is not defined if CONFIG_PCI is not enabled, thus the
> attempt to install the handler fails.
>
> Fix this by ifdef'ing ACPI_ADR_SPACE_PCI_CONFIG in the list of default
> address spaces.

What if there are PCI operation regions in the AML on the platform?
How are they going to be handled?

> Fixes: bd23fac3eaaa ("ACPICA: Remove PCI bits from ACPICA when CONFIG_PCI is unset")
> CC: stable@vger.kernel.org # 5.0.x-
> Signed-off-by: Suraj Jitindar Singh <surajjs@amazon.com>
> ---
>  drivers/acpi/acpica/evhandler.c | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/drivers/acpi/acpica/evhandler.c b/drivers/acpi/acpica/evhandler.c
> index 1c8cb6d924df..371093acb362 100644
> --- a/drivers/acpi/acpica/evhandler.c
> +++ b/drivers/acpi/acpica/evhandler.c
> @@ -26,7 +26,9 @@ acpi_ev_install_handler(acpi_handle obj_handle,
>  u8 acpi_gbl_default_address_spaces[ACPI_NUM_DEFAULT_SPACES] = {
>         ACPI_ADR_SPACE_SYSTEM_MEMORY,
>         ACPI_ADR_SPACE_SYSTEM_IO,
> +#ifdef ACPI_PCI_CONFIGURED
>         ACPI_ADR_SPACE_PCI_CONFIG,
> +#endif
>         ACPI_ADR_SPACE_DATA_TABLE
>  };
>
> --
> 2.34.1
>
>
diff mbox series

Patch

diff --git a/drivers/acpi/acpica/evhandler.c b/drivers/acpi/acpica/evhandler.c
index 1c8cb6d924df..371093acb362 100644
--- a/drivers/acpi/acpica/evhandler.c
+++ b/drivers/acpi/acpica/evhandler.c
@@ -26,7 +26,9 @@  acpi_ev_install_handler(acpi_handle obj_handle,
 u8 acpi_gbl_default_address_spaces[ACPI_NUM_DEFAULT_SPACES] = {
 	ACPI_ADR_SPACE_SYSTEM_MEMORY,
 	ACPI_ADR_SPACE_SYSTEM_IO,
+#ifdef ACPI_PCI_CONFIGURED
 	ACPI_ADR_SPACE_PCI_CONFIG,
+#endif
 	ACPI_ADR_SPACE_DATA_TABLE
 };