diff options
author | Simon Glass <sjg@chromium.org> | 2020-07-07 22:12:08 +0300 |
---|---|---|
committer | Bin Meng <bmeng.cn@gmail.com> | 2020-07-17 09:32:24 +0300 |
commit | 01694589af589212d6f2a6241821896ef9e334d3 (patch) | |
tree | 54085627056cd2bc0c8e89adcf7361af5bd80870 /drivers/core/acpi.c | |
parent | 351fef5c579b4cabbd2976e61d1f8a9ef7c06b53 (diff) | |
download | u-boot-01694589af589212d6f2a6241821896ef9e334d3.tar.xz |
acpi: Add support for DSDT generation
Some devices need to inject extra code into the Differentiated System
Descriptor Table (DSDT). Add a method to handle this.
Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Wolfgang Wallner <wolfgang.wallner@br-automation.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
[bmeng: correct one typo in inject_dsdt() comments]
Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Diffstat (limited to 'drivers/core/acpi.c')
-rw-r--r-- | drivers/core/acpi.c | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/drivers/core/acpi.c b/drivers/core/acpi.c index a9b7fc1d9a..7b32694ad4 100644 --- a/drivers/core/acpi.c +++ b/drivers/core/acpi.c @@ -22,12 +22,14 @@ enum gen_type_t { TYPE_NONE, TYPE_SSDT, + TYPE_DSDT, }; /* Type of method to call */ enum method_t { METHOD_WRITE_TABLES, METHOD_FILL_SSDT, + METHOD_INJECT_DSDT, }; /* Prototype for all methods */ @@ -144,7 +146,9 @@ static int sort_acpi_item_type(struct acpi_ctx *ctx, void *start, void *end = ctx->current; ptr = start; - order = ofnode_read_chosen_prop("u-boot,acpi-ssdt-order", &size); + order = ofnode_read_chosen_prop(type == TYPE_DSDT ? + "u-boot,acpi-dsdt-order" : + "u-boot,acpi-ssdt-order", &size); if (!order) { log_warning("Failed to find ordering, leaving as is\n"); return 0; @@ -198,6 +202,8 @@ acpi_method acpi_get_method(struct udevice *dev, enum method_t method) return aops->write_tables; case METHOD_FILL_SSDT: return aops->fill_ssdt; + case METHOD_INJECT_DSDT: + return aops->inject_dsdt; } } @@ -256,6 +262,23 @@ int acpi_fill_ssdt(struct acpi_ctx *ctx) return ret; } +int acpi_inject_dsdt(struct acpi_ctx *ctx) +{ + void *start = ctx->current; + int ret; + + log_debug("Writing DSDT tables\n"); + item_count = 0; + ret = acpi_recurse_method(ctx, dm_root(), METHOD_INJECT_DSDT, + TYPE_DSDT); + log_debug("Writing DSDT finished, err=%d\n", ret); + ret = sort_acpi_item_type(ctx, start, TYPE_DSDT); + if (ret) + return log_msg_ret("build", ret); + + return ret; +} + int acpi_write_dev_tables(struct acpi_ctx *ctx) { int ret; |