diff options
author | Simon Glass <sjg@chromium.org> | 2020-04-26 09:19:46 -0600 |
---|---|---|
committer | Bin Meng <bmeng.cn@gmail.com> | 2020-04-30 17:16:12 +0800 |
commit | 93f7f82782cb3d2bd55215ce984887efc6cddfed (patch) | |
tree | 6dede3cc6b74da87d67b67cffd6675de6bf03b15 /include | |
parent | fa04cef6443eab008b99f6439ec8a3b9939253b4 (diff) | |
download | u-boot-93f7f82782cb3d2bd55215ce984887efc6cddfed.zip u-boot-93f7f82782cb3d2bd55215ce984887efc6cddfed.tar.gz u-boot-93f7f82782cb3d2bd55215ce984887efc6cddfed.tar.bz2 |
acpi: Add a method to write tables for a device
A device may want to write out ACPI tables to describe itself to Linux.
Add a method to permit this.
Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Wolfgang Wallner <wolfgang.wallner@br-automation.com>
Diffstat (limited to 'include')
-rw-r--r-- | include/acpi/acpi_table.h | 10 | ||||
-rw-r--r-- | include/dm/acpi.h | 30 |
2 files changed, 40 insertions, 0 deletions
diff --git a/include/acpi/acpi_table.h b/include/acpi/acpi_table.h index 194be9a..a2bd929 100644 --- a/include/acpi/acpi_table.h +++ b/include/acpi/acpi_table.h @@ -505,6 +505,16 @@ int acpi_get_table_revision(enum acpi_tables table); */ int acpi_create_dmar(struct acpi_dmar *dmar, enum dmar_flags flags); +/** + * acpi_fill_header() - Set up a new table header + * + * This sets all fields except length, revision, checksum and aslc_revision + * + * @header: ACPI header to update + * @signature: Table signature to use (4 characters) + */ +void acpi_fill_header(struct acpi_table_header *header, char *signature); + #endif /* !__ACPI__*/ #include <asm/acpi_table.h> diff --git a/include/dm/acpi.h b/include/dm/acpi.h index 4925791..69d69d7 100644 --- a/include/dm/acpi.h +++ b/include/dm/acpi.h @@ -25,6 +25,17 @@ #if !defined(__ACPI__) /** + * struct acpi_ctx - Context used for writing ACPI tables + * + * This contains a few useful pieces of information used when writing + * + * @current: Current address for writing + */ +struct acpi_ctx { + void *current; +}; + +/** * struct acpi_ops - ACPI operations supported by driver model */ struct acpi_ops { @@ -38,6 +49,15 @@ struct acpi_ops { * other error */ int (*get_name)(const struct udevice *dev, char *out_name); + + /** + * write_tables() - Write out any tables required by this device + * + * @dev: Device to write + * @ctx: ACPI context to use + * @return 0 if OK, -ve on error + */ + int (*write_tables)(const struct udevice *dev, struct acpi_ctx *ctx); }; #define device_get_acpi_ops(dev) ((dev)->driver->acpi_ops) @@ -72,6 +92,16 @@ int acpi_get_name(const struct udevice *dev, char *out_name); */ int acpi_copy_name(char *out_name, const char *name); +/** + * acpi_write_dev_tables() - Write ACPI tables required by devices + * + * This scans through all devices and tells them to write any tables they want + * to write. + * + * @return 0 if OK, -ve if any device returned an error + */ +int acpi_write_dev_tables(struct acpi_ctx *ctx); + #endif /* __ACPI__ */ #endif |