[PATCH 000/108] RFC: dm: Add programatic generation of ACPI tables
Simon Glass
sjg at chromium.org
Mon Jan 27 06:05:07 CET 2020
At present on x86 U-Boot supports creating ACPI (Advanced Configuration
and Power Interface) tables using the Intel ACPI Source Language (ASL)
compiler.
This is good enough for basic operation but some devices need to add
their information dynamically at runtime. An example is a device that
needs to report its enable GPIO. This is described in the device tree,
so we want to add code in the driver to convert that device-tree
description into an ACPI description for use on Linux.
This series adds support for generation of ACPI tables and fragments by
devices. The core support is built into driver model.
Several files are brought over from coreboot to do the actual generation.
As an example of using this new feature, chromebook_coral is updated to
write out a wide array of ACPI tables including DSDT and SSDT.
This initial version of the series lays out the general approach. More
work is needed to figure out the difference between CONFIG_ACPIGEN and
CONFIG_GENERATE_ACPI_TABLE with respect to what is built.
Simon Glass (108):
cpu: Support querying the address width
spi: Add SPI mode enums
tpm: cr50: Release locality on exit
tpm: cr50: Tidy up various comments
tpm: cr50: Use the correct GPIO binding
tpm: Don't cleanup unless an error happens
dm: pci: Allow disabling auto-config for a device
x86: Correct wording of coreboot source code
x86: apl: Move p2sb ofdata reading to the correct method
pci: Adjust dm_pci_read_bar32() to return errors correctly
x86: apl: Add Global NVS table header
dm: core: Add basic ACPI support
acpi: Add a binding for ACPI settings in the device tree
acpi: Add a simple sandbox test
x86: Move acpi_table header to main include/ directory
acpi: Add an __ACPI__ preprocessor symbol
acpi: Add a central location for table version numbers
acpi: Add support for DMAR
acpi: Move acpi_fill_header() to generic code
acpi: Add a method to write tables for a device
acpi: Convert part of acpi_table to use acpi_ctx
x86: Allow devices to write ACPI tables
acpi: Drop code for missing XSDT from acpi_write_rsdp()
acpi: Move acpi_add_table() to generic code
acpi: Put table-setup code in its own function
acpi: Move the xsdt pointer to acpi_ctx
acpi: Add an acpi command
acpi: Add some tables required by the generation code
acpi: Add generation code for devices
acpi: Add functions to generate ACPI code
gpio: Add a method to convert a GPIO to ACPI
irq: Add a method to convert an interrupt to ACPI
acpi: Add support for SSDT generation
x86: acpi: Move MADT up a bit
acpi: Record the items added to SSDT
acpi: Support ordering SSDT data by device
x86: Allow devices to write an SSDT
acpi: Add support for DSDT generation
x86: Allow devices to write to DSDT
dm: core: Add an ACPI name for the root node
dm: acpi: Enhance acpi_get_name()
acpi: Add an acpi split command
acpi: Allow creating the GNVS to fail
dtoc: Support ACPI paths in of-platdata
acpi: mmc: Generate ACPI info for the PCI SD Card
sound: Add an ACPI driver for Dialog Semicondutor da7219
sound: Add an ACPI driver for Maxim MAX98357ac
x86: pinctrl: Add a way to get the pinctrl reg address
x86: pinctrl: Update comment for intel_pinctrl_get_pad()
x86: pinctrl: Add multi-ACPI control
x86: pinctrl: Set up itss in the probe() method
x86: pinctrl: Drop the acpi_name member
dm: core: Add a way of overriding the ACPI device path
x86: gpio: Add support for obtaining ACPI info for a GPIO
i2c: designware_i2c: Support ACPI table generation
i2c: Add a generic driver to generate ACPI info
p2sb: Add a method to hide the bus
x86: apl: Support set_hide() in p2sb driver
x86: apl: Hide the p2sb on exit from U-Boot
pmc: Move common registers to the header file
x86: irq: Support flags for acpi_gpe
x86: Add debugging to table writing
x86: Rename board_final_cleanup() to board_final_init()
acpi: Enable ACPI table generation by default on x86
acpi: Add cros_ec tables
x86: acpi: Add base asl files for common x86 devices
x86: acpi: apl: Add asl files for Apollo Lake
x86: acpi: Add DPTF asl files
x86: apl: Correct PCIE_ECAM_BASE
x86: coral: Add ACPI tables for coral
x86: acpi: Support external GNVS tables
x86: acpi: Expand the GNVS
x86: Add wake sources for the acpi_gpe driver
x86: Add a config for the systemagent PCIEX regions size
x86: apl: Support writing the IntelGraphicsMem table
x86: acpi: Add a common routine to write WiFi info
x86: Add some definitions for SMM
x86: apl: Add power-management definitions
x86: Add a common global NVS structure
cpu: Convert the methods to use a const udevice *
x86: apl: Update iomap for ACPI
x86: Add a few common Intel CPU functions
x86: acpi: Support generation of the HPET table
x86: acpi: Support generation of the DBG2 table
x86: acpi: Add common Intel ACPI tables
x86: Support Atom SoCs using SWSMISCI rather than the SWSCI
x86: apl: Add a check for reading the FSP-S config
x86: apl: Store FSP-S config for later use
p2sb: Add some definitions used for ACPI
x86: apl: Add support for hostbridge ACPI generation
x86: apl: Generate required ACPI tables
x86: acpi: Add support for additional DMAR tables
x86: apl: Generate CPU tables
x86: apl: Generate ACPI table for LPC
x86: apl: Drop unnecessary code in PMC driver
tpm: cr50: Add ACPI support
x86: fsp: Update the FSP API with the end-firmware method
x86: cpu: Report address width from cpu_get_info()
x86: Sort the MTRR table
x86: Add a way to add to the e820 memory table
x86: Notify the FSP of the 'end firmware' event
x86: Add a layout for Chrome OS verified boot
x86: Correct the assembly guard in e802.h
x86: Add a header guard to asm/acpi_table.h
x86: Correct handling of MADT table CPUs
acpi: tpm: Add a TPM2 table
acpi: tpm: Add a TPM1 table
x86: coral: Update config and device tree for ACPI
arch/Kconfig | 1 +
arch/nios2/cpu/cpu.c | 8 +-
arch/sandbox/dts/test.dts | 14 +
arch/sandbox/include/asm/acpi_table.h | 9 +
arch/sandbox/include/asm/global_data.h | 1 +
arch/x86/Kconfig | 47 +
arch/x86/cpu/acpi_gpe.c | 22 +
arch/x86/cpu/apollolake/Kconfig | 4 +
arch/x86/cpu/apollolake/Makefile | 1 +
arch/x86/cpu/apollolake/acpi.c | 437 +++++
arch/x86/cpu/apollolake/cpu.c | 27 +-
arch/x86/cpu/apollolake/fsp_s.c | 246 +--
arch/x86/cpu/apollolake/hostbridge.c | 104 +
arch/x86/cpu/apollolake/lpc.c | 16 +
arch/x86/cpu/apollolake/p2sb.c | 73 +-
arch/x86/cpu/apollolake/pmc.c | 8 +-
arch/x86/cpu/baytrail/acpi.c | 6 +-
arch/x86/cpu/baytrail/cpu.c | 4 +-
arch/x86/cpu/broadwell/cpu_full.c | 4 +-
arch/x86/cpu/coreboot/coreboot.c | 4 +-
arch/x86/cpu/coreboot/timestamp.c | 4 +-
arch/x86/cpu/cpu.c | 23 +-
arch/x86/cpu/cpu_x86.c | 6 +-
arch/x86/cpu/efi/app.c | 2 +-
arch/x86/cpu/i386/cpu.c | 23 +
arch/x86/cpu/intel_common/Makefile | 5 +
arch/x86/cpu/intel_common/acpi.c | 441 +++++
arch/x86/cpu/intel_common/cpu.c | 60 +
arch/x86/cpu/intel_common/generic_wifi.c | 119 ++
arch/x86/cpu/intel_common/intel_opregion.c | 168 ++
arch/x86/cpu/ivybridge/model_206ax.c | 5 +-
arch/x86/cpu/mtrr.c | 12 +
arch/x86/cpu/qemu/cpu.c | 4 +-
arch/x86/cpu/quark/acpi.c | 6 +-
arch/x86/cpu/quark/quark.c | 2 +-
arch/x86/cpu/tangier/acpi.c | 6 +-
arch/x86/dts/chromebook_coral.dts | 207 +-
arch/x86/include/asm/acpi/chromeos.asl | 110 ++
arch/x86/include/asm/acpi/cpu.asl | 25 +
arch/x86/include/asm/acpi/cros_ec/ac.asl | 22 +
arch/x86/include/asm/acpi/cros_ec/als.asl | 56 +
arch/x86/include/asm/acpi/cros_ec/battery.asl | 411 ++++
arch/x86/include/asm/acpi/cros_ec/cros_ec.asl | 57 +
arch/x86/include/asm/acpi/cros_ec/ec.asl | 557 ++++++
arch/x86/include/asm/acpi/cros_ec/emem.asl | 53 +
.../asm/acpi/cros_ec/keyboard_backlight.asl | 52 +
arch/x86/include/asm/acpi/cros_ec/pd.asl | 15 +
arch/x86/include/asm/acpi/cros_ec/superio.asl | 159 ++
arch/x86/include/asm/acpi/cros_ec/tbmc.asl | 23 +
arch/x86/include/asm/acpi/cros_gnvs.asl | 29 +
arch/x86/include/asm/acpi/dptf/charger.asl | 65 +
arch/x86/include/asm/acpi/dptf/cpu.asl | 186 ++
arch/x86/include/asm/acpi/dptf/dptf.asl | 121 ++
arch/x86/include/asm/acpi/dptf/fan.asl | 57 +
arch/x86/include/asm/acpi/dptf/thermal.asl | 521 +++++
arch/x86/include/asm/acpi/global_nvs.h | 5 +-
arch/x86/include/asm/acpi/lpc.asl | 141 ++
arch/x86/include/asm/acpi/pci_osc.asl | 21 +
arch/x86/include/asm/acpi/pcr.asl | 80 +
arch/x86/include/asm/acpi/ramoops.asl | 32 +
arch/x86/include/asm/acpi/sleepstates.asl | 12 +-
arch/x86/include/asm/acpi/vbnv_layout.h | 41 +
arch/x86/include/asm/acpi_table.h | 393 +---
arch/x86/include/asm/arch-apollolake/acpi.h | 13 +
.../include/asm/arch-apollolake/acpi/dptf.asl | 35 +
.../asm/arch-apollolake/acpi/globalnvs.asl | 41 +
.../include/asm/arch-apollolake/acpi/gpio.asl | 191 ++
.../asm/arch-apollolake/acpi/gpiolib.asl | 109 ++
.../include/asm/arch-apollolake/acpi/lpss.asl | 105 +
.../asm/arch-apollolake/acpi/northbridge.asl | 120 ++
.../asm/arch-apollolake/acpi/pch_hda.asl | 77 +
.../asm/arch-apollolake/acpi/pci_irqs.asl | 52 +
.../include/asm/arch-apollolake/acpi/pcie.asl | 22 +
.../asm/arch-apollolake/acpi/pcie_port.asl | 113 ++
.../asm/arch-apollolake/acpi/platform.asl | 10 +
.../asm/arch-apollolake/acpi/pmc_ipc.asl | 49 +
.../include/asm/arch-apollolake/acpi/scs.asl | 173 ++
.../asm/arch-apollolake/acpi/soc_int.asl | 50 +
.../asm/arch-apollolake/acpi/southbridge.asl | 34 +
.../include/asm/arch-apollolake/acpi/xhci.asl | 33 +
.../arch-apollolake/acpi/xhci_apl_ports.asl | 23 +
.../arch-apollolake/acpi/xhci_glk_ports.asl | 24 +
.../include/asm/arch-apollolake/global_nvs.h | 44 +
arch/x86/include/asm/arch-apollolake/gpe.h | 134 ++
arch/x86/include/asm/arch-apollolake/gpio.h | 3 +
arch/x86/include/asm/arch-apollolake/iomap.h | 17 +
arch/x86/include/asm/arch-apollolake/pm.h | 56 +-
.../include/asm/arch-apollolake/soc_config.h | 221 +++
.../include/asm/arch-apollolake/systemagent.h | 6 +
.../x86/include/asm/arch-coreboot/timestamp.h | 4 +-
arch/x86/include/asm/cpu.h | 9 +
arch/x86/include/asm/cpu_common.h | 32 +
arch/x86/include/asm/cpu_x86.h | 4 +-
arch/x86/include/asm/e820.h | 3 +-
arch/x86/include/asm/fsp/fsp_api.h | 15 +-
arch/x86/include/asm/global_data.h | 2 +
arch/x86/include/asm/intel_acpi.h | 25 +
arch/x86/include/asm/intel_gnvs.h | 43 +
arch/x86/include/asm/intel_opregion.h | 247 +++
arch/x86/include/asm/intel_pinctrl.h | 19 +-
arch/x86/include/asm/intel_pinctrl_defs.h | 2 -
arch/x86/include/asm/smm.h | 36 +
arch/x86/lib/acpi.c | 2 +-
arch/x86/lib/acpi_s3.c | 2 +-
arch/x86/lib/acpi_table.c | 723 +++++--
arch/x86/lib/fsp/fsp_common.c | 18 +-
arch/x86/lib/fsp/fsp_dram.c | 16 +
arch/x86/lib/fsp/fsp_graphics.c | 28 +
arch/x86/lib/tables.c | 37 +-
arch/x86/lib/zimage.c | 2 +-
board/google/chromebook_coral/Kconfig | 2 +-
board/google/chromebook_coral/Makefile | 1 +
.../chromebook_coral/baseboard_dptf.asl | 71 +
board/google/chromebook_coral/coral.c | 104 +
board/google/chromebook_coral/dsdt.asl | 60 +
.../google/chromebook_coral/variant_dptf.asl | 6 +
board/google/chromebook_coral/variant_ec.h | 75 +
board/google/chromebook_coral/variant_gpio.h | 63 +
cmd/Kconfig | 14 +
cmd/Makefile | 1 +
cmd/acpi.c | 190 ++
configs/chromebook_coral_defconfig | 17 +-
configs/sandbox_defconfig | 4 +
doc/device-tree-bindings/chosen.txt | 27 +
doc/device-tree-bindings/device.txt | 77 +
.../gpio/intel,apl-gpio.txt | 2 +-
doc/device-tree-bindings/i2c/generic-acpi.txt | 42 +
.../interrupt-controller/intel,acpi-gpe.txt | 2 +-
doc/device-tree-bindings/pci/x86-pci.txt | 24 +
doc/device-tree-bindings/sound/da7219.txt | 113 ++
doc/device-tree-bindings/sound/max98357a.txt | 22 +
drivers/core/Kconfig | 9 +
drivers/core/Makefile | 1 +
drivers/core/acpi.c | 328 ++++
drivers/core/root.c | 13 +
drivers/cpu/bmips_cpu.c | 8 +-
drivers/cpu/cpu-uclass.c | 8 +-
drivers/cpu/cpu_sandbox.c | 9 +-
drivers/cpu/imx8_cpu.c | 8 +-
drivers/cpu/mpc83xx_cpu.c | 17 +-
drivers/cpu/riscv_cpu.c | 6 +-
drivers/gpio/gpio-uclass.c | 21 +
drivers/gpio/intel_gpio.c | 46 +-
drivers/i2c/Makefile | 3 +
drivers/i2c/acpi_i2c.c | 228 +++
drivers/i2c/acpi_i2c.h | 15 +
drivers/i2c/designware_i2c.c | 25 +
drivers/i2c/designware_i2c.h | 15 +
drivers/i2c/designware_i2c_pci.c | 104 +-
drivers/i2c/i2c-uclass.c | 14 +
drivers/misc/irq-uclass.c | 18 +-
drivers/misc/p2sb-uclass.c | 26 +-
drivers/mmc/pci_mmc.c | 76 +-
drivers/pci/pci-uclass.c | 11 +-
drivers/pinctrl/intel/Kconfig | 4 +
drivers/pinctrl/intel/pinctrl.c | 21 +-
drivers/pinctrl/intel/pinctrl_apl.c | 4 -
drivers/power/acpi_pmc/acpi-pmc-uclass.c | 9 -
drivers/sound/Kconfig | 18 +
drivers/sound/Makefile | 2 +
drivers/sound/da7219.c | 115 ++
drivers/sound/max98357a.c | 109 ++
drivers/tpm/cr50_i2c.c | 83 +-
drivers/tpm/tpm-uclass.c | 13 +-
include/acpi_device.h | 746 ++++++++
include/acpi_s3.h | 4 +
include/acpi_table.h | 724 +++++++
include/acpigen.h | 482 +++++
include/asm-generic/gpio.h | 27 +
include/bloblist.h | 8 +
include/cpu.h | 18 +-
include/dm/acpi.h | 190 ++
include/dm/device.h | 7 +-
include/dm/uclass-id.h | 1 +
.../interrupt-controller/x86-irq.h | 14 +
include/i2c.h | 17 +
include/irq.h | 43 +
include/log.h | 2 +
include/p2sb.h | 42 +-
include/power/acpi_pmc.h | 14 +
include/spi.h | 33 +
lib/Makefile | 1 +
lib/acpi/Makefile | 6 +
lib/acpi/acpi_device.c | 1203 ++++++++++++
lib/acpi/acpi_table.c | 258 +++
lib/acpi/acpigen.c | 1683 +++++++++++++++++
lib/efi_loader/efi_acpi.c | 2 +-
scripts/Makefile.lib | 4 +-
test/dm/Makefile | 1 +
test/dm/acpi.c | 478 +++++
test/dm/cpu.c | 1 +
tools/dtoc/dtb_platdata.py | 4 +-
tools/dtoc/dtoc_test_simple.dts | 1 +
tools/dtoc/test_dtoc.py | 3 +
194 files changed, 15704 insertions(+), 1014 deletions(-)
create mode 100644 arch/sandbox/include/asm/acpi_table.h
create mode 100644 arch/x86/cpu/apollolake/acpi.c
create mode 100644 arch/x86/cpu/intel_common/acpi.c
create mode 100644 arch/x86/cpu/intel_common/generic_wifi.c
create mode 100644 arch/x86/cpu/intel_common/intel_opregion.c
create mode 100644 arch/x86/include/asm/acpi/chromeos.asl
create mode 100644 arch/x86/include/asm/acpi/cpu.asl
create mode 100644 arch/x86/include/asm/acpi/cros_ec/ac.asl
create mode 100644 arch/x86/include/asm/acpi/cros_ec/als.asl
create mode 100644 arch/x86/include/asm/acpi/cros_ec/battery.asl
create mode 100644 arch/x86/include/asm/acpi/cros_ec/cros_ec.asl
create mode 100644 arch/x86/include/asm/acpi/cros_ec/ec.asl
create mode 100644 arch/x86/include/asm/acpi/cros_ec/emem.asl
create mode 100644 arch/x86/include/asm/acpi/cros_ec/keyboard_backlight.asl
create mode 100644 arch/x86/include/asm/acpi/cros_ec/pd.asl
create mode 100644 arch/x86/include/asm/acpi/cros_ec/superio.asl
create mode 100644 arch/x86/include/asm/acpi/cros_ec/tbmc.asl
create mode 100644 arch/x86/include/asm/acpi/cros_gnvs.asl
create mode 100644 arch/x86/include/asm/acpi/dptf/charger.asl
create mode 100644 arch/x86/include/asm/acpi/dptf/cpu.asl
create mode 100644 arch/x86/include/asm/acpi/dptf/dptf.asl
create mode 100644 arch/x86/include/asm/acpi/dptf/fan.asl
create mode 100644 arch/x86/include/asm/acpi/dptf/thermal.asl
create mode 100644 arch/x86/include/asm/acpi/lpc.asl
create mode 100644 arch/x86/include/asm/acpi/pci_osc.asl
create mode 100644 arch/x86/include/asm/acpi/pcr.asl
create mode 100644 arch/x86/include/asm/acpi/ramoops.asl
create mode 100644 arch/x86/include/asm/acpi/vbnv_layout.h
create mode 100644 arch/x86/include/asm/arch-apollolake/acpi.h
create mode 100644 arch/x86/include/asm/arch-apollolake/acpi/dptf.asl
create mode 100644 arch/x86/include/asm/arch-apollolake/acpi/globalnvs.asl
create mode 100644 arch/x86/include/asm/arch-apollolake/acpi/gpio.asl
create mode 100644 arch/x86/include/asm/arch-apollolake/acpi/gpiolib.asl
create mode 100644 arch/x86/include/asm/arch-apollolake/acpi/lpss.asl
create mode 100644 arch/x86/include/asm/arch-apollolake/acpi/northbridge.asl
create mode 100644 arch/x86/include/asm/arch-apollolake/acpi/pch_hda.asl
create mode 100644 arch/x86/include/asm/arch-apollolake/acpi/pci_irqs.asl
create mode 100644 arch/x86/include/asm/arch-apollolake/acpi/pcie.asl
create mode 100644 arch/x86/include/asm/arch-apollolake/acpi/pcie_port.asl
create mode 100644 arch/x86/include/asm/arch-apollolake/acpi/platform.asl
create mode 100644 arch/x86/include/asm/arch-apollolake/acpi/pmc_ipc.asl
create mode 100644 arch/x86/include/asm/arch-apollolake/acpi/scs.asl
create mode 100644 arch/x86/include/asm/arch-apollolake/acpi/soc_int.asl
create mode 100644 arch/x86/include/asm/arch-apollolake/acpi/southbridge.asl
create mode 100644 arch/x86/include/asm/arch-apollolake/acpi/xhci.asl
create mode 100644 arch/x86/include/asm/arch-apollolake/acpi/xhci_apl_ports.asl
create mode 100644 arch/x86/include/asm/arch-apollolake/acpi/xhci_glk_ports.asl
create mode 100644 arch/x86/include/asm/arch-apollolake/global_nvs.h
create mode 100644 arch/x86/include/asm/arch-apollolake/gpe.h
create mode 100644 arch/x86/include/asm/arch-apollolake/soc_config.h
create mode 100644 arch/x86/include/asm/intel_acpi.h
create mode 100644 arch/x86/include/asm/intel_gnvs.h
create mode 100644 arch/x86/include/asm/intel_opregion.h
create mode 100644 arch/x86/include/asm/smm.h
create mode 100644 board/google/chromebook_coral/baseboard_dptf.asl
create mode 100644 board/google/chromebook_coral/dsdt.asl
create mode 100644 board/google/chromebook_coral/variant_dptf.asl
create mode 100644 board/google/chromebook_coral/variant_ec.h
create mode 100644 board/google/chromebook_coral/variant_gpio.h
create mode 100644 cmd/acpi.c
create mode 100644 doc/device-tree-bindings/device.txt
create mode 100644 doc/device-tree-bindings/i2c/generic-acpi.txt
create mode 100644 doc/device-tree-bindings/sound/da7219.txt
create mode 100644 doc/device-tree-bindings/sound/max98357a.txt
create mode 100644 drivers/core/acpi.c
create mode 100644 drivers/i2c/acpi_i2c.c
create mode 100644 drivers/i2c/acpi_i2c.h
create mode 100644 drivers/sound/da7219.c
create mode 100644 drivers/sound/max98357a.c
create mode 100644 include/acpi_device.h
create mode 100644 include/acpi_table.h
create mode 100644 include/acpigen.h
create mode 100644 include/dm/acpi.h
create mode 100644 include/dt-bindings/interrupt-controller/x86-irq.h
create mode 100644 lib/acpi/Makefile
create mode 100644 lib/acpi/acpi_device.c
create mode 100644 lib/acpi/acpi_table.c
create mode 100644 lib/acpi/acpigen.c
create mode 100644 test/dm/acpi.c
--
2.25.0.341.g760bfbb309-goog
More information about the U-Boot
mailing list