[PATCH v3 00/35] dm: Add programmatic generation of ACPI tables (part B)
Simon Glass
sjg at chromium.org
Sun Jun 14 04:54:48 CEST 2020
This is split from the original series in an attempt to get things applied
in chunks.
This part includes:
- writing basic ACPI code for integers, strings, names, packages
- writing descriptors for GPIO, I2C, interrupts, SPI
- writing code to enable/disable ACPI peripherals via GPIOs
- writing SSDT and DSDT tables
- additional ways to determine ACPI device names
Much of this code is taken from coreboot and I have tried to avoid
changing the original code for no reason. Changes include:
- splitting the acpi_dp functions into their own file
- adding tests
- adding (lots of) comments
- using a context pointer instead of global variables
- tidying up some code where couldn't resist (e.g. acpigen_emit_namestring())
Changes in v3:
- s/NUL/NULL/ for the NUL character, since that is in more common use
- Fix 'an GPIO is found' typo
- Update comment in acpi_device_set_i2c() to talk about scope parameter
- Make acpi_device_write_spi() static
- Add an extra comment about scope to acpi_device_set_spi()
- Use BIT() in a few places
- Resist the temptation to go to >80 characters
- Add a reference to the ACPI spec
- Add a define for the 0x80 constant
- Move the function comments into this patch
- Fix 'easy of testing' typo
- Move two function comments into the previous patch
- Allow the name parameter to be NULL
- Add error checking to acpi_dp_add_integer_array()
- Fix 'acpi_device.v' typo
- Drop unused ACPI_CPU_STRING
- Use an enum for the GPIO priority
- Add error checking
- Fix incorrect function names and arguments in commments
- Add error checking for acpi_dp_add...() functions
- Fix function name in comment for acpigen_write_not()
- Use #defines for the mask values
- Fix 'THe' typo
- Rename MAX_ITEMS to MAX_ACPI_ITEMS
- Make find_item() static and rename to find_acpi_item()
- Rename build_type() and add a comment
Drop coreboot_acpi_ids enum
- Fix 'THe' typo
- Rename build_type() to sort_acpi_item_type()
- Refactor the code to remove the extra memcpy()
- Recalculate the DSDT checksum only once
- Add a comment as to why the checksum byte is set to 0
- Fix 'of' typo
- Update acpi_dump_items() to take an enum
- Update commit message and subject for clarity
Changes in v2:
- Update to add a new 'base' field to struct acpi_ctx
- Free the memory allocated to the table and context
- Fix memset of I2C descriptor
- Fix memset of SPI descriptor
Changes in v1:
- Capitalise ACPI_OPS_PTR
- Split into more patches for review
- Add tests
- Rebase on top of common.h series
- Fix 'the an' typo
- Move header definitions into this patch
- Update sandbox driver slightly for testing
- Switch parameter order of _acpi_fill_ssdt() and make it static
- Fix 'sentinal' and 'METHOD_FILL_SDDT' typos
- Correct the commit subject
- Generalise the ACPI function recursion with acpi_recurse_method()
- Generalise the ACPI function recursion with acpi_recurse_method()
- Use OEM_TABLE_ID instead of ACPI_TABLE_CREATOR
- Update ACPI_DSTATUS enum
- Drop writing of coreboot tables
- Generalise the ACPI function recursion with acpi_recurse_method()
- Use acpi,ddn instead of acpi,desc
- Rename to acpi_device_infer_name()
- Update newly created sandbox tests
Simon Glass (35):
dm: core: Add an ACPI name for the root node
acpi: Add a function to get a device path and scope
acpi: Add a way to check device status
irq: Add a method to convert an interrupt to ACPI
acpi: Support generation of ACPI code
acpi: Support generation of interrupt descriptor
gpio: Add a method to convert a GPIO to ACPI
acpi: Support string output
acpi: Support generation of GPIO descriptor
acpi: Support generation of a GPIO/irq for a device
acpi: Support generation of I2C descriptor
acpi: Support generation of SPI descriptor
acpigen: Support writing a length
acpigen: Support writing a package
acpi: Support writing an integer
acpi: Support writing a string
acpi: Support writing a name
acpi: Support writing a UUID
acpi: Support writing Device Properties objects via _DSD
acpi: Support writing a GPIO
acpi: Support copying properties from device tree to ACPI
acpi: Add support for various misc ACPI opcodes
acpi: Add support for writing a Power Resource
acpi: Add support for writing a GPIO power sequence
acpi: Add support for a generic power sequence
acpi: Add support for SSDT generation
x86: acpi: Move MADT down 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
pci: Avoid a crash in device_is_on_pci_bus()
dm: acpi: Enhance acpi_get_name()
acpi: Add an acpi command to list/dump generated ACPI items
arch/sandbox/dts/test.dts | 14 +-
arch/x86/lib/acpi_table.c | 55 +-
cmd/acpi.c | 15 +-
doc/device-tree-bindings/chosen.txt | 9 +
doc/device-tree-bindings/device.txt | 13 +
drivers/core/acpi.c | 220 ++++++-
drivers/core/root.c | 13 +
drivers/gpio/gpio-uclass.c | 21 +
drivers/gpio/sandbox.c | 86 +++
drivers/i2c/sandbox_i2c.c | 1 +
drivers/misc/irq-uclass.c | 18 +-
drivers/misc/irq_sandbox.c | 16 +
drivers/rtc/sandbox_rtc.c | 13 +
drivers/spi/sandbox_spi.c | 1 +
include/acpi/acpi_device.h | 401 +++++++++++++
include/acpi/acpi_dp.h | 287 +++++++++
include/acpi/acpigen.h | 355 ++++++++++++
include/asm-generic/gpio.h | 27 +
include/dm/acpi.h | 71 +++
include/dm/device.h | 2 +-
include/irq.h | 43 ++
include/spi.h | 4 +-
include/test/ut.h | 17 +
lib/acpi/Makefile | 3 +
lib/acpi/acpi_device.c | 819 ++++++++++++++++++++++++++
lib/acpi/acpi_dp.c | 402 +++++++++++++
lib/acpi/acpi_table.c | 1 +
lib/acpi/acpigen.c | 474 +++++++++++++++
test/dm/Makefile | 2 +
test/dm/acpi.c | 277 ++++++++-
test/dm/acpi_dp.c | 512 ++++++++++++++++
test/dm/acpigen.c | 865 ++++++++++++++++++++++++++++
test/dm/gpio.c | 62 ++
test/dm/irq.c | 23 +
test/dm/pci.c | 14 +
35 files changed, 5123 insertions(+), 33 deletions(-)
create mode 100644 include/acpi/acpi_device.h
create mode 100644 include/acpi/acpi_dp.h
create mode 100644 include/acpi/acpigen.h
create mode 100644 lib/acpi/acpi_device.c
create mode 100644 lib/acpi/acpi_dp.c
create mode 100644 lib/acpi/acpigen.c
create mode 100644 test/dm/acpi_dp.c
create mode 100644 test/dm/acpigen.c
--
2.27.0.290.gba653c62da-goog
More information about the U-Boot
mailing list