summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2021-12-01 19:02:37 +0300
committerSimon Glass <sjg@chromium.org>2022-01-25 21:44:36 +0300
commit233f0e35a3536102e13bed924a1c4aa33726f244 (patch)
tree0008b8280127b9d3f6c8c2addc1146cffa296bb2
parente1722fcb7d3fcb62b41f0feda4ac2c7d27d7c1f1 (diff)
downloadu-boot-233f0e35a3536102e13bed924a1c4aa33726f244.tar.xz
x86: Move the acpi table to generic global_data
Allow this to be used on any arch. Also convert to using macros so that we can check the CONFIG option in C code. Signed-off-by: Simon Glass <sjg@chromium.org>
-rw-r--r--arch/sandbox/include/asm/global_data.h1
-rw-r--r--arch/x86/include/asm/global_data.h1
-rw-r--r--cmd/acpi.c6
-rw-r--r--include/asm-generic/global_data.h8
-rw-r--r--lib/acpi/acpi_table.c2
-rw-r--r--test/dm/acpi.c2
6 files changed, 13 insertions, 7 deletions
diff --git a/arch/sandbox/include/asm/global_data.h b/arch/sandbox/include/asm/global_data.h
index f95ddb058a..f4ce72d566 100644
--- a/arch/sandbox/include/asm/global_data.h
+++ b/arch/sandbox/include/asm/global_data.h
@@ -13,7 +13,6 @@
struct arch_global_data {
uint8_t *ram_buf; /* emulated RAM buffer */
void *text_base; /* pointer to base of text region */
- ulong acpi_start; /* Start address of ACPI tables */
};
#include <asm-generic/global_data.h>
diff --git a/arch/x86/include/asm/global_data.h b/arch/x86/include/asm/global_data.h
index 3e4044593c..23693f85a7 100644
--- a/arch/x86/include/asm/global_data.h
+++ b/arch/x86/include/asm/global_data.h
@@ -122,7 +122,6 @@ struct arch_global_data {
struct fsp_header *fsp_s_hdr; /* Pointer to FSP-S header */
#endif
void *itss_priv; /* Private ITSS data pointer */
- ulong acpi_start; /* Start address of ACPI tables */
ulong coreboot_table; /* Address of coreboot table */
};
diff --git a/cmd/acpi.c b/cmd/acpi.c
index 9c3462b411..1d302994b8 100644
--- a/cmd/acpi.c
+++ b/cmd/acpi.c
@@ -47,7 +47,7 @@ struct acpi_table_header *find_table(const char *sig)
struct acpi_rsdt *rsdt;
int len, i, count;
- rsdp = map_sysmem(gd->arch.acpi_start, 0);
+ rsdp = map_sysmem(gd_acpi_start(), 0);
if (!rsdp)
return NULL;
rsdt = map_sysmem(rsdp->rsdt_address, 0);
@@ -143,12 +143,12 @@ static int do_acpi_list(struct cmd_tbl *cmdtp, int flag, int argc,
{
struct acpi_rsdp *rsdp;
- rsdp = map_sysmem(gd->arch.acpi_start, 0);
+ rsdp = map_sysmem(gd_acpi_start(), 0);
if (!rsdp) {
printf("No ACPI tables present\n");
return 0;
}
- printf("ACPI tables start at %lx\n", gd->arch.acpi_start);
+ printf("ACPI tables start at %lx\n", gd_acpi_start());
list_rsdp(rsdp);
return 0;
diff --git a/include/asm-generic/global_data.h b/include/asm-generic/global_data.h
index 104282bd47..c2f8fad1cb 100644
--- a/include/asm-generic/global_data.h
+++ b/include/asm-generic/global_data.h
@@ -456,6 +456,10 @@ struct global_data {
* @acpi_ctx: ACPI context pointer
*/
struct acpi_ctx *acpi_ctx;
+ /**
+ * @acpi_start: Start address of ACPI tables
+ */
+ ulong acpi_start;
#endif
#if CONFIG_IS_ENABLED(GENERATE_SMBIOS_TABLE)
/**
@@ -512,8 +516,12 @@ static_assert(sizeof(struct global_data) == GD_SIZE);
#ifdef CONFIG_GENERATE_ACPI_TABLE
#define gd_acpi_ctx() gd->acpi_ctx
+#define gd_acpi_start() gd->acpi_start
+#define gd_set_acpi_start(addr) gd->acpi_start = addr
#else
#define gd_acpi_ctx() NULL
+#define gd_acpi_start() 0UL
+#define gd_set_acpi_start(addr)
#endif
#if CONFIG_IS_ENABLED(MULTI_DTB_FIT)
diff --git a/lib/acpi/acpi_table.c b/lib/acpi/acpi_table.c
index d1685404c2..3a72718df8 100644
--- a/lib/acpi/acpi_table.c
+++ b/lib/acpi/acpi_table.c
@@ -260,7 +260,7 @@ void acpi_setup_base_tables(struct acpi_ctx *ctx, void *start)
/* Align ACPI tables to 16 byte */
acpi_align(ctx);
- gd->arch.acpi_start = map_to_sysmem(ctx->current);
+ gd_set_acpi_start(map_to_sysmem(ctx->current));
/* We need at least an RSDP and an RSDT Table */
ctx->rsdp = ctx->current;
diff --git a/test/dm/acpi.c b/test/dm/acpi.c
index c51073c9a6..804124df9e 100644
--- a/test/dm/acpi.c
+++ b/test/dm/acpi.c
@@ -320,7 +320,7 @@ static int dm_test_acpi_setup_base_tables(struct unit_test_state *uts)
buf = memalign(64, BUF_SIZE);
ut_assertnonnull(buf);
acpi_setup_base_tables(&ctx, buf + 4);
- ut_asserteq(map_to_sysmem(PTR_ALIGN(buf + 4, 16)), gd->arch.acpi_start);
+ ut_asserteq(map_to_sysmem(PTR_ALIGN(buf + 4, 16)), gd_acpi_start());
rsdp = buf + 16;
ut_asserteq_ptr(rsdp, ctx.rsdp);