mbox series

[v3,00/29] dm: Add programmatic generation of ACPI tables (part A)

Message ID 20200330231305.130488-1-sjg@chromium.org
Headers show
Series dm: Add programmatic generation of ACPI tables (part A) | expand

Message

Simon Glass March 30, 2020, 11:12 p.m. UTC
This is split from the original series in an attempt to get things applied
in chunks.

This section includes patches up to and including the 'acpi' command.

Changes in v3:
- Add a pointer to information about acpi,compatible
- Add forward declarations for the functions
- Add missing error check in acpi_create_dmar()
- Add new patch to add hexdump.h to the unit test header
- Add new patch to move acpi_s3.h to include/acpi/
- Beef up the comment explaining how the unaligned address is used
- Change the example to ELAN
- Compute ACPI_NAME_MAX from ACPI_NAME_LEN
- Correct description of acpi,probed
- Drop 'Intel' from 'Intel ACPI'
- Drop acpi,name in example
- Drop duplicate assert
- Drop hid-descr-addr
- Drop mention of PRIC
- Fix 'RSDP' typo
- Fix 'XDST' typo
- Fix DMA_ typo
- Fix a few typos
- Fix file comment for acpi_table.c
- Fix indenting error mentioned by Andy Shevchenko
- Fix stray #endif
- Just add the device.txt binding file in this patch
- Make use of BIT()
- Move acpi_align_large() out of dm_test_acpi_setup_base_tables()
- Move acpi_table.h to include/acpi
- Rename acpi,desc to acpi,ddn
- Rename acpi_align_large() to acpi_align64()
- Rename acpi_return_name() to acpi_copy_name()
- Reword commit message to drop the bit about ACPI being complicated
- Split out hid-over-i2c into its own patch
- Update commit message to say that we move most of its contents
- Use strncpy() instead of strcpy() in acpi_copy_name()

Changes in v2:
- Add in the acpi_table.h header file to this patch
- Add the hid-over-i2c binding document
- Add trailing commas to enum
- Don't bracket the definitions with DM_SPI
- Drop definition of ACPI_TABLE_CREATOR
- Drop the Chrome OS pieces
- Drop the other comment change since it is already applied
- Drop two unnecessary __packed
- Fix definition of HID
- Generalise the ACPI function recursion with acpi_recurse_method()
- Infer hid-over-i2c CID value
- Make _acpi_write_dev_tables() static and switch argument order
- Move LOGC_ACPI definition to this patch
- Move __packed to after struct
- Move the sandbox acpi_table.h header file to an earlier patch
- Rename the 'coreboot' console to 'U-Boot'
- Use #defines for MADT and MCFG version numbers

Simon Glass (29):
  cpu: Support querying the address width
  spi: Add SPI mode enums
  tpm: cr50: Release locality on exit
  tpm: cr50: Add a comment for cr50_priv
  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
  dts: Add a binding for hid-over-i2c
  acpi: Add a binding for ACPI settings in the device tree
  acpi: Add a simple sandbox test
  x86: Move acpi_s3.h to include/acpi/
  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
  test: Add hexdump.h to the unit test header
  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

 arch/sandbox/dts/test.dts                     |   8 +
 arch/sandbox/include/asm/acpi_table.h         |   9 +
 arch/sandbox/include/asm/global_data.h        |   1 +
 arch/x86/cpu/apollolake/cpu_spl.c             |   2 +-
 arch/x86/cpu/apollolake/fsp_s.c               |   2 +-
 arch/x86/cpu/apollolake/pmc.c                 |   2 +-
 arch/x86/cpu/baytrail/acpi.c                  |   6 +-
 arch/x86/cpu/coreboot/timestamp.c             |   4 +-
 arch/x86/cpu/cpu.c                            |   4 +-
 arch/x86/cpu/intel_common/p2sb.c              |  33 +-
 arch/x86/cpu/quark/acpi.c                     |   2 +-
 arch/x86/cpu/tangier/acpi.c                   |   4 +-
 arch/x86/cpu/wakeup.S                         |   2 +-
 arch/x86/dts/chromebook_coral.dts             |   2 +-
 arch/x86/include/asm/acpi_table.h             | 381 +-----------
 .../include/asm/arch-apollolake/global_nvs.h  |  36 ++
 .../x86/include/asm/arch-coreboot/timestamp.h |   4 +-
 arch/x86/include/asm/global_data.h            |   1 +
 arch/x86/include/asm/intel_pinctrl_defs.h     |   2 -
 arch/x86/lib/acpi.c                           |   2 +-
 arch/x86/lib/acpi_s3.c                        |   4 +-
 arch/x86/lib/acpi_table.c                     | 240 ++------
 arch/x86/lib/coreboot_table.c                 |   2 +-
 arch/x86/lib/fsp/fsp_common.c                 |   2 +-
 arch/x86/lib/fsp1/fsp_common.c                |   2 +-
 arch/x86/lib/fsp2/fsp_dram.c                  |   2 +-
 arch/x86/lib/tables.c                         |   2 +-
 arch/x86/lib/zimage.c                         |   2 +-
 cmd/Kconfig                                   |  14 +
 cmd/Makefile                                  |   1 +
 cmd/acpi.c                                    | 179 ++++++
 doc/device-tree-bindings/device.txt           |  37 ++
 .../gpio/intel,apl-gpio.txt                   |   2 +-
 .../input/hid-over-i2c.txt                    |  44 ++
 .../interrupt-controller/intel,acpi-gpe.txt   |   2 +-
 doc/device-tree-bindings/pci/x86-pci.txt      |  23 +
 drivers/core/Kconfig                          |   9 +
 drivers/core/Makefile                         |   1 +
 drivers/core/acpi.c                           |  94 +++
 drivers/cpu/cpu_sandbox.c                     |   1 +
 drivers/pci/pci-uclass.c                      |  11 +-
 drivers/pci/pci_rom.c                         |   4 +-
 drivers/power/acpi_pmc/acpi-pmc-uclass.c      |   2 +-
 drivers/sysreset/sysreset_x86.c               |   2 +-
 drivers/tpm/cr50_i2c.c                        |  24 +-
 drivers/tpm/tpm-uclass.c                      |  13 +-
 include/{ => acpi}/acpi_s3.h                  |   0
 include/acpi/acpi_table.h                     | 581 ++++++++++++++++++
 include/cpu.h                                 |   2 +
 include/dm/acpi.h                             | 114 ++++
 include/dm/device.h                           |   5 +
 include/dm/uclass-id.h                        |   1 +
 include/log.h                                 |   2 +
 include/spi.h                                 |  33 +
 include/test/ut.h                             |   1 +
 lib/Makefile                                  |   1 +
 lib/acpi/Makefile                             |   4 +
 lib/acpi/acpi_table.c                         | 257 ++++++++
 lib/efi_loader/efi_acpi.c                     |   2 +-
 scripts/Makefile.lib                          |   4 +-
 test/dm/Makefile                              |   1 +
 test/dm/acpi.c                                | 317 ++++++++++
 test/dm/cpu.c                                 |   1 +
 63 files changed, 1915 insertions(+), 637 deletions(-)
 create mode 100644 arch/sandbox/include/asm/acpi_table.h
 create mode 100644 arch/x86/include/asm/arch-apollolake/global_nvs.h
 create mode 100644 cmd/acpi.c
 create mode 100644 doc/device-tree-bindings/device.txt
 create mode 100644 doc/device-tree-bindings/input/hid-over-i2c.txt
 create mode 100644 drivers/core/acpi.c
 rename include/{ => acpi}/acpi_s3.h (100%)
 create mode 100644 include/acpi/acpi_table.h
 create mode 100644 include/dm/acpi.h
 create mode 100644 lib/acpi/Makefile
 create mode 100644 lib/acpi/acpi_table.c
 create mode 100644 test/dm/acpi.c

Comments

Heinrich Schuchardt March 31, 2020, 6:31 a.m. UTC | #1
On 3/31/20 1:12 AM, Simon Glass wrote:
> This is split from the original series in an attempt to get things applied
> in chunks.
>
> This section includes patches up to and including the 'acpi' command.
>
> Changes in v3:
> - Add a pointer to information about acpi,compatible
> - Add forward declarations for the functions
> - Add missing error check in acpi_create_dmar()
> - Add new patch to add hexdump.h to the unit test header
> - Add new patch to move acpi_s3.h to include/acpi/
> - Beef up the comment explaining how the unaligned address is used
> - Change the example to ELAN
> - Compute ACPI_NAME_MAX from ACPI_NAME_LEN
> - Correct description of acpi,probed
> - Drop 'Intel' from 'Intel ACPI'


Hello Simon,

not only x86 but also ARM can use ACPI tables for booting. Below I see
all those files under arch/x86/lib/.

I think we should separate the x86 specific stuff from the general ACPI
coding.

This is not meant to stop this series but can be done afterwards.

Best regards

Heinrich

> - Drop acpi,name in example
> - Drop duplicate assert
> - Drop hid-descr-addr
> - Drop mention of PRIC
> - Fix 'RSDP' typo
> - Fix 'XDST' typo
> - Fix DMA_ typo
> - Fix a few typos
> - Fix file comment for acpi_table.c
> - Fix indenting error mentioned by Andy Shevchenko
> - Fix stray #endif
> - Just add the device.txt binding file in this patch
> - Make use of BIT()
> - Move acpi_align_large() out of dm_test_acpi_setup_base_tables()
> - Move acpi_table.h to include/acpi
> - Rename acpi,desc to acpi,ddn
> - Rename acpi_align_large() to acpi_align64()
> - Rename acpi_return_name() to acpi_copy_name()
> - Reword commit message to drop the bit about ACPI being complicated
> - Split out hid-over-i2c into its own patch
> - Update commit message to say that we move most of its contents
> - Use strncpy() instead of strcpy() in acpi_copy_name()
>
> Changes in v2:
> - Add in the acpi_table.h header file to this patch
> - Add the hid-over-i2c binding document
> - Add trailing commas to enum
> - Don't bracket the definitions with DM_SPI
> - Drop definition of ACPI_TABLE_CREATOR
> - Drop the Chrome OS pieces
> - Drop the other comment change since it is already applied
> - Drop two unnecessary __packed
> - Fix definition of HID
> - Generalise the ACPI function recursion with acpi_recurse_method()
> - Infer hid-over-i2c CID value
> - Make _acpi_write_dev_tables() static and switch argument order
> - Move LOGC_ACPI definition to this patch
> - Move __packed to after struct
> - Move the sandbox acpi_table.h header file to an earlier patch
> - Rename the 'coreboot' console to 'U-Boot'
> - Use #defines for MADT and MCFG version numbers
>
> Simon Glass (29):
>    cpu: Support querying the address width
>    spi: Add SPI mode enums
>    tpm: cr50: Release locality on exit
>    tpm: cr50: Add a comment for cr50_priv
>    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
>    dts: Add a binding for hid-over-i2c
>    acpi: Add a binding for ACPI settings in the device tree
>    acpi: Add a simple sandbox test
>    x86: Move acpi_s3.h to include/acpi/
>    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
>    test: Add hexdump.h to the unit test header
>    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
>
>   arch/sandbox/dts/test.dts                     |   8 +
>   arch/sandbox/include/asm/acpi_table.h         |   9 +
>   arch/sandbox/include/asm/global_data.h        |   1 +
>   arch/x86/cpu/apollolake/cpu_spl.c             |   2 +-
>   arch/x86/cpu/apollolake/fsp_s.c               |   2 +-
>   arch/x86/cpu/apollolake/pmc.c                 |   2 +-
>   arch/x86/cpu/baytrail/acpi.c                  |   6 +-
>   arch/x86/cpu/coreboot/timestamp.c             |   4 +-
>   arch/x86/cpu/cpu.c                            |   4 +-
>   arch/x86/cpu/intel_common/p2sb.c              |  33 +-
>   arch/x86/cpu/quark/acpi.c                     |   2 +-
>   arch/x86/cpu/tangier/acpi.c                   |   4 +-
>   arch/x86/cpu/wakeup.S                         |   2 +-
>   arch/x86/dts/chromebook_coral.dts             |   2 +-
>   arch/x86/include/asm/acpi_table.h             | 381 +-----------
>   .../include/asm/arch-apollolake/global_nvs.h  |  36 ++
>   .../x86/include/asm/arch-coreboot/timestamp.h |   4 +-
>   arch/x86/include/asm/global_data.h            |   1 +
>   arch/x86/include/asm/intel_pinctrl_defs.h     |   2 -
>   arch/x86/lib/acpi.c                           |   2 +-
>   arch/x86/lib/acpi_s3.c                        |   4 +-
>   arch/x86/lib/acpi_table.c                     | 240 ++------
>   arch/x86/lib/coreboot_table.c                 |   2 +-
>   arch/x86/lib/fsp/fsp_common.c                 |   2 +-
>   arch/x86/lib/fsp1/fsp_common.c                |   2 +-
>   arch/x86/lib/fsp2/fsp_dram.c                  |   2 +-
>   arch/x86/lib/tables.c                         |   2 +-
>   arch/x86/lib/zimage.c                         |   2 +-
>   cmd/Kconfig                                   |  14 +
>   cmd/Makefile                                  |   1 +
>   cmd/acpi.c                                    | 179 ++++++
>   doc/device-tree-bindings/device.txt           |  37 ++
>   .../gpio/intel,apl-gpio.txt                   |   2 +-
>   .../input/hid-over-i2c.txt                    |  44 ++
>   .../interrupt-controller/intel,acpi-gpe.txt   |   2 +-
>   doc/device-tree-bindings/pci/x86-pci.txt      |  23 +
>   drivers/core/Kconfig                          |   9 +
>   drivers/core/Makefile                         |   1 +
>   drivers/core/acpi.c                           |  94 +++
>   drivers/cpu/cpu_sandbox.c                     |   1 +
>   drivers/pci/pci-uclass.c                      |  11 +-
>   drivers/pci/pci_rom.c                         |   4 +-
>   drivers/power/acpi_pmc/acpi-pmc-uclass.c      |   2 +-
>   drivers/sysreset/sysreset_x86.c               |   2 +-
>   drivers/tpm/cr50_i2c.c                        |  24 +-
>   drivers/tpm/tpm-uclass.c                      |  13 +-
>   include/{ => acpi}/acpi_s3.h                  |   0
>   include/acpi/acpi_table.h                     | 581 ++++++++++++++++++
>   include/cpu.h                                 |   2 +
>   include/dm/acpi.h                             | 114 ++++
>   include/dm/device.h                           |   5 +
>   include/dm/uclass-id.h                        |   1 +
>   include/log.h                                 |   2 +
>   include/spi.h                                 |  33 +
>   include/test/ut.h                             |   1 +
>   lib/Makefile                                  |   1 +
>   lib/acpi/Makefile                             |   4 +
>   lib/acpi/acpi_table.c                         | 257 ++++++++
>   lib/efi_loader/efi_acpi.c                     |   2 +-
>   scripts/Makefile.lib                          |   4 +-
>   test/dm/Makefile                              |   1 +
>   test/dm/acpi.c                                | 317 ++++++++++
>   test/dm/cpu.c                                 |   1 +
>   63 files changed, 1915 insertions(+), 637 deletions(-)
>   create mode 100644 arch/sandbox/include/asm/acpi_table.h
>   create mode 100644 arch/x86/include/asm/arch-apollolake/global_nvs.h
>   create mode 100644 cmd/acpi.c
>   create mode 100644 doc/device-tree-bindings/device.txt
>   create mode 100644 doc/device-tree-bindings/input/hid-over-i2c.txt
>   create mode 100644 drivers/core/acpi.c
>   rename include/{ => acpi}/acpi_s3.h (100%)
>   create mode 100644 include/acpi/acpi_table.h
>   create mode 100644 include/dm/acpi.h
>   create mode 100644 lib/acpi/Makefile
>   create mode 100644 lib/acpi/acpi_table.c
>   create mode 100644 test/dm/acpi.c
>