aboutsummaryrefslogtreecommitdiff
path: root/arch
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2020-11-04 09:57:19 -0700
committerBin Meng <bmeng.cn@gmail.com>2020-11-05 14:58:45 +0800
commit5019e201ccaee4bd54ba707dfc4eece885857629 (patch)
tree64a6812ad48def169d89b6694fd7dbaee60aeb76 /arch
parent38e498c3a2b5b52e7935516cba0927e0d90c365c (diff)
downloadu-boot-5019e201ccaee4bd54ba707dfc4eece885857629.zip
u-boot-5019e201ccaee4bd54ba707dfc4eece885857629.tar.gz
u-boot-5019e201ccaee4bd54ba707dfc4eece885857629.tar.bz2
x86: acpi: Store the ACPI context in global_data
At present we create the ACPI context but then drop it after generation of tables is complete. This is annoying because we have to then search for tables later. To fix this, allocate the context and store it in global_data. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Diffstat (limited to 'arch')
-rw-r--r--arch/x86/lib/acpi_table.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/arch/x86/lib/acpi_table.c b/arch/x86/lib/acpi_table.c
index 6d405b0..f0f342d 100644
--- a/arch/x86/lib/acpi_table.c
+++ b/arch/x86/lib/acpi_table.c
@@ -494,7 +494,7 @@ void acpi_create_ssdt(struct acpi_ctx *ctx, struct acpi_table_header *ssdt,
*/
ulong write_acpi_tables(ulong start_addr)
{
- struct acpi_ctx sctx, *ctx = &sctx;
+ struct acpi_ctx *ctx;
struct acpi_facs *facs;
struct acpi_table_header *dsdt;
struct acpi_fadt *fadt;
@@ -509,6 +509,11 @@ ulong write_acpi_tables(ulong start_addr)
int ret;
int i;
+ ctx = calloc(1, sizeof(*ctx));
+ if (!ctx)
+ return log_msg_ret("mem", -ENOMEM);
+ gd->acpi_ctx = ctx;
+
start = map_sysmem(start_addr, 0);
debug("ACPI: Writing ACPI tables at %lx\n", start_addr);