[PATCH v1 00/54] dm: Add programatic generation of ACPI tables (part D)

Simon Glass sjg at chromium.org
Mon Jul 27 05:44:32 CEST 2020


Note: This is part D of this effort. With this, Coral includes all
required ACPI tables.

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.

Changes in v1:
- Add NHLT audio support
- Add NHLT information
- Add comments
- Add more comments and rename cpu_get_bus_clock to cpu_get_bus_clock_khz()
- Add new patch with coral audio descriptor files
- Add support for NHLT table
- Adjust implementation to match new ACPI GPIO generation
- Capitalise ACPI_OPS_PTR
- Don't build for SPL
- Drop unnecessary callbacks
- Fix i2c PCI addresses
- Handle table generation without callbacks
- Move ASL_REVISION define into this patch
- Move acpi_create_dbg2() into generic code
- Move the acpi.h header file to this commit
- Move this code into an x86-specific file
- Put this code in an x86-specific place and update commit message
- Rename acpi-probed to linux,probed
- Rename cpi,hid-desc-reg-offset to hid-desc-addr
- Split PCT and PTC tables into a separate patch
- Support hid-over-i2c separately as well
- UIse hid-over-i2 compatible string
- Update ACPI ordering to include multiple CPUs
- Update commit message
- Update commit message with a comma
- Update for acpi_device_write_i2c_dev() return-value change
- Use OEM_TABLE_ID instead of ACPI_TABLE_CREATOR
- Use SHIFT and MASK for defines
- Use acpi,ddn instead of acpi,desc
- Use this file in APL
- Use updated acpi_device_write_dsm_i2c_hid() function

Simon Glass (54):
  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: Add a config for the systemagent PCIEX regions size
  x86: Add a common global NVS structure
  x86: acpi: Support external GNVS tables
  x86: acpi: Expand the GNVS
  x86: coral: Add ACPI tables for coral
  acpi: Add support for writing a _PRW
  acpi: Add support for conditions and return values
  acpi: Support generating a multi-function _DSM for devices
  i2c: Add a generic driver to generate ACPI info
  x86: Add wake sources for the acpi_gpe driver
  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: 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
  acpi: Add support for generating processor tables
  x86: acpi: Add PCT and PTC tables
  acpi: Add more support for generating processor tables
  x86: acpi: Add common Intel ACPI tables
  x86: Support Atom SoCs using SWSMISCI rather than the SWSCI
  x86: acpi: Add support for additional Intel tables
  x86: apl: Allow reading hostbridge base addresses
  p2sb: Add some definitions used for ACPI
  x86: apl: Generate required ACPI tables
  x86: apl: Add support for hostbridge ACPI generation
  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: Notify the FSP of the 'end firmware' event
  x86: Correct the assembly guard in e820.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: acpi: Set the log category for x86 table generation
  x86: coral: Add audio descriptor files
  x86: apl: Check low-level init in FSP-S pre-init
  x86: fsp: Add more debugging for silicon init
  x86: fsp: Show FSP-S or FSP-M address in fsp_get_header()
  acpi: Use defines for field lengths
  x86: Add a way to add to the e820 memory table
  x86: coral: Update config and device tree for ACPI

 arch/x86/Kconfig                              |  47 ++
 arch/x86/cpu/apollolake/Kconfig               |   4 +
 arch/x86/cpu/apollolake/Makefile              |   1 +
 arch/x86/cpu/apollolake/acpi.c                | 211 ++++++
 arch/x86/cpu/apollolake/cpu.c                 |  77 +++
 arch/x86/cpu/apollolake/fsp_s.c               |   2 +
 arch/x86/cpu/apollolake/hostbridge.c          | 244 ++++++-
 arch/x86/cpu/apollolake/lpc.c                 |  18 +
 arch/x86/cpu/apollolake/pmc.c                 |   8 +-
 arch/x86/cpu/cpu.c                            |  15 +
 arch/x86/cpu/i386/cpu.c                       |  23 +
 arch/x86/cpu/intel_common/Makefile            |   7 +
 arch/x86/cpu/intel_common/acpi.c              | 377 ++++++++++
 arch/x86/cpu/intel_common/cpu.c               |  79 +++
 arch/x86/cpu/intel_common/generic_wifi.c      | 120 ++++
 arch/x86/cpu/intel_common/intel_opregion.c    | 168 +++++
 arch/x86/cpu/mtrr.c                           |  12 +
 arch/x86/cpu/x86_64/cpu.c                     |   5 +
 arch/x86/dts/chromebook_coral.dts             | 224 +++++-
 arch/x86/include/asm/acpi/chromeos.asl        | 108 +++
 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_table.h             | 162 +++++
 arch/x86/include/asm/acpigen.h                |  35 +
 arch/x86/include/asm/arch-apollolake/acpi.h   |  18 +
 .../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  |  23 +-
 arch/x86/include/asm/arch-apollolake/gpe.h    | 135 ++++
 arch/x86/include/asm/arch-apollolake/gpio.h   |   3 +
 arch/x86/include/asm/arch-apollolake/iomap.h  |  16 +
 arch/x86/include/asm/arch-apollolake/pm.h     |  40 +-
 .../include/asm/arch-apollolake/systemagent.h |  31 +
 arch/x86/include/asm/cpu.h                    |   9 +
 arch/x86/include/asm/cpu_common.h             |  56 ++
 arch/x86/include/asm/e820.h                   |   3 +-
 arch/x86/include/asm/fsp/fsp_api.h            |  15 +-
 arch/x86/include/asm/intel_acpi.h             |  52 ++
 arch/x86/include/asm/intel_gnvs.h             |  44 ++
 arch/x86/include/asm/intel_opregion.h         | 247 +++++++
 arch/x86/include/asm/smm.h                    |  27 +
 arch/x86/lib/Makefile                         |   1 +
 arch/x86/lib/acpi_table.c                     | 390 ++++++++++-
 arch/x86/lib/acpigen.c                        |  96 +++
 arch/x86/lib/fsp/fsp_common.c                 |  16 +
 arch/x86/lib/fsp/fsp_dram.c                   |  17 +
 arch/x86/lib/fsp/fsp_graphics.c               |  32 +
 arch/x86/lib/fsp2/fsp_silicon_init.c          |   4 +-
 arch/x86/lib/fsp2/fsp_support.c               |  22 +-
 board/google/chromebook_coral/Kconfig         |   2 +-
 board/google/chromebook_coral/Makefile        |   1 +
 .../chromebook_coral/baseboard_dptf.asl       |  71 ++
 board/google/chromebook_coral/coral.c         | 135 ++++
 .../chromebook_coral/dialog-2ch-48khz-24b.dat | Bin 0 -> 100 bytes
 .../chromebook_coral/dmic-1ch-48khz-16b.dat   | Bin 0 -> 3048 bytes
 .../chromebook_coral/dmic-2ch-48khz-16b.dat   | Bin 0 -> 3048 bytes
 .../chromebook_coral/dmic-4ch-48khz-16b.dat   | Bin 0 -> 3048 bytes
 board/google/chromebook_coral/dsdt.asl        |  60 ++
 .../max98357-render-2ch-48khz-24b.dat         | Bin 0 -> 116 bytes
 .../google/chromebook_coral/variant_dptf.asl  |   6 +
 board/google/chromebook_coral/variant_ec.h    |  75 ++
 board/google/chromebook_coral/variant_gpio.h  |  63 ++
 configs/chromebook_coral_defconfig            |  13 +-
 doc/device-tree-bindings/chosen.txt           |  18 +
 doc/device-tree-bindings/device.txt           |   3 +
 doc/device-tree-bindings/i2c/generic-acpi.txt |  42 ++
 drivers/core/Kconfig                          |   9 +
 drivers/i2c/Makefile                          |   3 +
 drivers/i2c/acpi_i2c.c                        | 226 ++++++
 drivers/i2c/acpi_i2c.h                        |  15 +
 drivers/i2c/i2c-uclass.c                      |  17 +
 drivers/tpm/cr50_i2c.c                        |  55 ++
 include/acpi/acpi_device.h                    |  69 ++
 include/acpi/acpi_s3.h                        |   4 +
 include/acpi/acpi_table.h                     | 137 +++-
 include/acpi/acpigen.h                        | 415 +++++++++++
 include/bloblist.h                            |   8 +
 include/i2c.h                                 |  23 +
 include/p2sb.h                                |   8 +
 include/power/acpi_pmc.h                      |   4 +-
 lib/acpi/acpi_device.c                        |  43 ++
 lib/acpi/acpi_table.c                         |  64 ++
 lib/acpi/acpigen.c                            | 354 ++++++++++
 test/dm/acpigen.c                             | 647 ++++++++++++++++++
 121 files changed, 9687 insertions(+), 108 deletions(-)
 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/acpigen.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/gpe.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 arch/x86/lib/acpigen.c
 create mode 100644 board/google/chromebook_coral/baseboard_dptf.asl
 create mode 100644 board/google/chromebook_coral/dialog-2ch-48khz-24b.dat
 create mode 100644 board/google/chromebook_coral/dmic-1ch-48khz-16b.dat
 create mode 100644 board/google/chromebook_coral/dmic-2ch-48khz-16b.dat
 create mode 100644 board/google/chromebook_coral/dmic-4ch-48khz-16b.dat
 create mode 100644 board/google/chromebook_coral/dsdt.asl
 create mode 100644 board/google/chromebook_coral/max98357-render-2ch-48khz-24b.dat
 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 doc/device-tree-bindings/i2c/generic-acpi.txt
 create mode 100644 drivers/i2c/acpi_i2c.c
 create mode 100644 drivers/i2c/acpi_i2c.h

-- 
2.28.0.rc0.142.g3c755180ce-goog



More information about the U-Boot mailing list