From bfeb5d460cd129e037c87e9d90b02808d68c0147 Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Wed, 8 Apr 2020 16:57:39 -0600 Subject: acpi: Add support for DMAR The DMA Remapping Reporting (DMAR) table contains information about DMA remapping. Add a version simple version of this table with only the minimum fields filled out. i.e. no entries. Signed-off-by: Simon Glass Reviewed-by: Bin Meng Reviewed-by: Wolfgang Wallner --- lib/acpi/acpi_table.c | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) (limited to 'lib/acpi/acpi_table.c') diff --git a/lib/acpi/acpi_table.c b/lib/acpi/acpi_table.c index 3268430cd1..4633dcb948 100644 --- a/lib/acpi/acpi_table.c +++ b/lib/acpi/acpi_table.c @@ -7,6 +7,37 @@ #include #include +#include +#include + +/* Temporary change to ensure bisectability */ +#ifndef CONFIG_SANDBOX +int acpi_create_dmar(struct acpi_dmar *dmar, enum dmar_flags flags) +{ + struct acpi_table_header *header = &dmar->header; + struct cpu_info info; + struct udevice *cpu; + int ret; + + ret = uclass_first_device(UCLASS_CPU, &cpu); + if (ret) + return log_msg_ret("cpu", ret); + ret = cpu_get_info(cpu, &info); + if (ret) + return log_msg_ret("info", ret); + memset((void *)dmar, 0, sizeof(struct acpi_dmar)); + + /* Fill out header fields. */ + acpi_fill_header(&dmar->header, "DMAR"); + header->length = sizeof(struct acpi_dmar); + header->revision = acpi_get_table_revision(ACPITAB_DMAR); + + dmar->host_address_width = info.address_width - 1; + dmar->flags = flags; + + return 0; +} +#endif int acpi_get_table_revision(enum acpi_tables table) { -- cgit v1.2.3