mirror of
https://github.com/AsahiLinux/u-boot
synced 2024-12-01 08:59:33 +00:00
x86: Use the ACPI table writer
Use the new ACPI writer to write the ACPI tables. At present this is all done in one monolithic function. Future work will split this out. Unfortunately the QFW write_acpi_tables() function conflicts with the 'writer' version, so disable that for sandbox. Signed-off-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
parent
cc1f8c3988
commit
31c27eb830
4 changed files with 11 additions and 22 deletions
|
@ -503,10 +503,10 @@ static int acpi_create_ssdt(struct acpi_ctx *ctx,
|
|||
/*
|
||||
* QEMU's version of write_acpi_tables is defined in drivers/misc/qfw.c
|
||||
*/
|
||||
ulong write_acpi_tables(ulong start_addr)
|
||||
static int write_acpi_tables_x86(struct acpi_ctx *ctx,
|
||||
const struct acpi_writer *entry)
|
||||
{
|
||||
const int thl = sizeof(struct acpi_table_header);
|
||||
struct acpi_ctx *ctx;
|
||||
struct acpi_facs *facs;
|
||||
struct acpi_table_header *dsdt;
|
||||
struct acpi_fadt *fadt;
|
||||
|
@ -516,22 +516,11 @@ ulong write_acpi_tables(ulong start_addr)
|
|||
struct acpi_madt *madt;
|
||||
struct acpi_csrt *csrt;
|
||||
struct acpi_spcr *spcr;
|
||||
void *start;
|
||||
int aml_len;
|
||||
ulong addr;
|
||||
int ret;
|
||||
int i;
|
||||
|
||||
ctx = malloc(sizeof(*ctx));
|
||||
if (!ctx)
|
||||
return log_msg_ret("mem", -ENOMEM);
|
||||
|
||||
start = map_sysmem(start_addr, 0);
|
||||
|
||||
debug("ACPI: Writing ACPI tables at %lx\n", start_addr);
|
||||
|
||||
acpi_reset_items();
|
||||
acpi_setup_ctx(ctx, start);
|
||||
acpi_setup_base_tables(ctx);
|
||||
|
||||
debug("ACPI: * FACS\n");
|
||||
|
@ -674,14 +663,12 @@ ulong write_acpi_tables(ulong start_addr)
|
|||
|
||||
acpi_write_dev_tables(ctx);
|
||||
|
||||
addr = map_to_sysmem(ctx->current);
|
||||
debug("current = %lx\n", addr);
|
||||
|
||||
acpi_rsdp_addr = (unsigned long)ctx->rsdp;
|
||||
debug("ACPI: done\n");
|
||||
|
||||
return addr;
|
||||
return 0;
|
||||
}
|
||||
ACPI_WRITER(x86, NULL, write_acpi_tables_x86, 0);
|
||||
|
||||
ulong acpi_get_rsdp_addr(void)
|
||||
{
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
#include <asm/tables.h>
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_GENERATE_ACPI_TABLE
|
||||
#if defined(CONFIG_GENERATE_ACPI_TABLE) && !defined(CONFIG_SANDBOX)
|
||||
/*
|
||||
* This function allocates memory for ACPI tables
|
||||
*
|
||||
|
|
|
@ -40,6 +40,7 @@ int acpi_write_one(struct acpi_ctx *ctx, const struct acpi_writer *entry)
|
|||
return 0;
|
||||
}
|
||||
|
||||
#ifndef CONFIG_QEMU
|
||||
static int acpi_write_all(struct acpi_ctx *ctx)
|
||||
{
|
||||
const struct acpi_writer *writer =
|
||||
|
@ -60,7 +61,7 @@ static int acpi_write_all(struct acpi_ctx *ctx)
|
|||
/*
|
||||
* QEMU's version of write_acpi_tables is defined in drivers/misc/qfw.c
|
||||
*/
|
||||
ulong new_write_acpi_tables(ulong start_addr)
|
||||
ulong write_acpi_tables(ulong start_addr)
|
||||
{
|
||||
struct acpi_ctx *ctx;
|
||||
ulong addr;
|
||||
|
@ -86,6 +87,7 @@ ulong new_write_acpi_tables(ulong start_addr)
|
|||
|
||||
return addr;
|
||||
}
|
||||
#endif /* QEMU */
|
||||
|
||||
void acpi_setup_ctx(struct acpi_ctx *ctx, ulong start)
|
||||
{
|
||||
|
|
|
@ -322,8 +322,8 @@ static int dm_test_acpi_basic(struct unit_test_state *uts)
|
|||
}
|
||||
DM_TEST(dm_test_acpi_basic, UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT);
|
||||
|
||||
/* Test acpi_setup_base_tables */
|
||||
static int dm_test_acpi_setup_base_tables(struct unit_test_state *uts)
|
||||
/* Test setup_ctx_and_base_tables */
|
||||
static int dm_test_setup_ctx_and_base_tables(struct unit_test_state *uts)
|
||||
{
|
||||
struct acpi_rsdp *rsdp;
|
||||
struct acpi_rsdt *rsdt;
|
||||
|
@ -369,7 +369,7 @@ static int dm_test_acpi_setup_base_tables(struct unit_test_state *uts)
|
|||
|
||||
return 0;
|
||||
}
|
||||
DM_TEST(dm_test_acpi_setup_base_tables,
|
||||
DM_TEST(dm_test_setup_ctx_and_base_tables,
|
||||
UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT);
|
||||
|
||||
/* Test 'acpi list' command */
|
||||
|
|
Loading…
Reference in a new issue