linux/include/acpi
Erik Schmauss aa342261bd ACPICA: Remove legacy module-level code support
ACPICA commit 47f5607c204719d9239a12b889df725225098c8f

Module-level code refers to executable ASL code that runs during
table load. This is typically used in ASL to declare named objects
based on a condition evaluated during table load like so:

definition_block(...)
{
  opreation_region (OPR1, system_memory, ...)
  Field (OPR1)
  {
    FLD1, 8 /* Assume that FLD1's value is 0x1 */
  }

  /* The if statement below is referred to as module-level code */

  If (FLD1)
  {
    /* Declare DEV1 conditionally */
    Device (DEV1) {...}
  }

  Device (DEV2)
  {
    ...
  }
}

In legacy module-level code, the execution of the If statement
was deferred after other modules were loaded. The order of
code execution for the table above is the following:

1.) Load OPR1 to the ACPI Namespace
2.) Load FLD1 to the ACPI Namespace (not intended for drivers)
3.) Load DEV2 to the ACPI Namespace
4.) Execute If (FLD1) and load DEV1 if the condition is true

This legacy approach can be problematic for tables that look like the
following:

definition_block(...)
{
  opreation_region (OPR1, system_memory, ...)
  Field (OPR1)
  {
    FLD1, 8 /* Assume that FLD1's value is 0x1 */
  }

  /* The if statement below is referred to as module-level code */

  If (FLD1)
  {
    /* Declare DEV1 conditionally */
    Device (DEV1) {...}
  }

  Scope (DEV1)
  {
    /* Add objects DEV1's scope */
    Name (OBJ1, 0x1234)
  }
}

When loading this in the legacy approach, Scope DEV1 gets evaluated
before the If statement. The following is the order of execution:

1.) Load OPR1 to the ACPI Namespace
2.) Load FLD1 to the ACPI Namespace (not intended for drivers)
3.) Add OBJ1 under DEV1's scope -- ERROR. DEV1 does not exist
4.) Execute If (FLD1) and load DEV1 if the condition is true

The legacy approach can never succeed for tables like this due to the
deferral of the module-level code. Due to this limitation, a new
module-level code was developed. This new approach exeutes if
statements in the order that they appear in the definition block.
With this approach, the order of execution for the above defintion
block is as follows:

1.) Load OPR1 to the ACPI Namespace
2.) Load FLD1 to the ACPI Namespace (not intended for drivers)
3.) Execute If (FLD1) and load DEV1 because the condition is true
4.) Add OBJ1 under DEV1's scope.

Since DEV1 is loaded in the namespace in step 3, step 4 executes
successfully.

This change removes support for the legacy module-level code
execution. From this point onward, the new module-level code
execution will be the official approach.

Link: https://github.com/acpica/acpica/commit/47f5607c
Signed-off-by: Erik Schmauss <erik.schmauss@intel.com>
Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2019-02-18 11:21:10 +01:00
..
platform ACPICA: All acpica: Update copyrights to 2019 2019-01-15 18:04:02 +01:00
acbuffer.h ACPICA: All acpica: Update copyrights to 2019 2019-01-15 18:04:02 +01:00
acconfig.h ACPICA: All acpica: Update copyrights to 2019 2019-01-15 18:04:02 +01:00
acexcep.h ACPICA: All acpica: Update copyrights to 2019 2019-01-15 18:04:02 +01:00
acnames.h ACPICA: All acpica: Update copyrights to 2019 2019-01-15 18:04:02 +01:00
acoutput.h ACPICA: All acpica: Update copyrights to 2019 2019-01-15 18:04:02 +01:00
acpi.h ACPICA: All acpica: Update copyrights to 2019 2019-01-15 18:04:02 +01:00
acpi_bus.h pci-v4.20-changes 2018-10-25 06:50:48 -07:00
acpi_drivers.h PCI/ACPI: Allow ACPI to be built without CONFIG_PCI set 2018-12-20 10:19:49 +01:00
acpi_io.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
acpi_lpat.h ACPI / LPAT: Common table processing functions 2015-01-29 21:02:10 +08:00
acpi_numa.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
acpiosxf.h ACPICA: All acpica: Update copyrights to 2019 2019-01-15 18:04:02 +01:00
acpixf.h ACPICA: Remove legacy module-level code support 2019-02-18 11:21:10 +01:00
acrestyp.h ACPICA: All acpica: Update copyrights to 2019 2019-01-15 18:04:02 +01:00
actbl.h ACPICA: All acpica: Update copyrights to 2019 2019-01-15 18:04:02 +01:00
actbl1.h ACPICA: All acpica: Update copyrights to 2019 2019-01-15 18:04:02 +01:00
actbl2.h ACPICA: All acpica: Update copyrights to 2019 2019-01-15 18:04:02 +01:00
actbl3.h ACPICA: All acpica: Update copyrights to 2019 2019-01-15 18:04:02 +01:00
actypes.h ACPICA: Get rid of acpi_sleep_dispatch() 2019-02-07 12:21:33 +01:00
acuuid.h ACPICA: All acpica: Update copyrights to 2019 2019-01-15 18:04:02 +01:00
apei.h Merge branches 'acpi-pmic', 'acpi-apei' and 'acpi-x86' 2017-11-13 01:37:17 +01:00
battery.h battery: Add the battery hooking API 2018-02-21 23:27:13 +01:00
button.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
cppc_acpi.h x86/kernel: Fix more -Wmissing-prototypes warnings 2018-12-08 12:24:35 +01:00
ghes.h arm64 / ACPI: clean the additional checks before calling ghes_notify_sea() 2018-08-09 10:55:18 +02:00
hed.h ACPI Hardware Error Device (PNP0C33) support 2010-05-19 22:40:24 -04:00
nfit.h acpi, nfit: Add function to look up nvdimm device and provide SMBIOS handle 2018-03-14 12:43:50 +01:00
pcc.h mailbox: PCC: Move the MAX_PCC_SUBSPACES definition to header file 2017-11-09 00:39:53 +01:00
pdc_intel.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
processor.h ACPI / processor: Finish making acpi_processor_ppc_has_changed() void 2018-06-20 10:50:40 +02:00
reboot.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
video.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00