@@ -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);
@@ -24,6 +24,8 @@
#include <membuff.h>
#include <linux/list.h>
+struct acpi_ctx;
+
typedef struct global_data {
struct bd_info *bd;
unsigned long flags;
@@ -137,6 +139,9 @@ typedef struct global_data {
#if CONFIG_IS_ENABLED(WDT)
struct udevice *watchdog_dev;
#endif
+#ifdef CONFIG_GENERATE_ACPI_TABLE
+ struct acpi_ctx *acpi_ctx;
+#endif
} gd_t;
#endif