[PATCH v2 5/7] riscv: qemu: copy ACPI tables from QEMU

Simon Glass sjg at chromium.org
Sat Dec 2 19:23:19 CET 2023


On Tue, 21 Nov 2023 at 08:28, Heinrich Schuchardt
<heinrich.schuchardt at canonical.com> wrote:
>
> If CONFIG_GENERATE_ACPI_TABLES=y, read the ACPI tables provided by QEMU
> and make them available to U-Boot.
>
> Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt at canonical.com>
> ---
> v2:
>         no change
> ---
>  board/emulation/qemu-riscv/qemu-riscv.c | 17 +++++++++++++++++
>  1 file changed, 17 insertions(+)

Reviewed-by: Simon Glass <sjg at chromium.org>

Can we not use common code to do this? What is different about ARM and x86?


>
> diff --git a/board/emulation/qemu-riscv/qemu-riscv.c b/board/emulation/qemu-riscv/qemu-riscv.c
> index 181abbbf97..2cebce2128 100644
> --- a/board/emulation/qemu-riscv/qemu-riscv.c
> +++ b/board/emulation/qemu-riscv/qemu-riscv.c
> @@ -4,17 +4,20 @@
>   */
>
>  #include <common.h>
> +#include <acpi/acpi_table.h>
>  #include <dm.h>
>  #include <dm/ofnode.h>
>  #include <env.h>
>  #include <fdtdec.h>
>  #include <image.h>
>  #include <log.h>
> +#include <malloc.h>
>  #include <spl.h>
>  #include <init.h>
>  #include <usb.h>
>  #include <virtio_types.h>
>  #include <virtio.h>
> +#include <linux/sizes.h>
>
>  DECLARE_GLOBAL_DATA_PTR;
>
> @@ -46,6 +49,20 @@ int board_late_init(void)
>         if (CONFIG_IS_ENABLED(USB_KEYBOARD))
>                 usb_init();
>
> +       if (IS_ENABLED(CONFIG_GENERATE_ACPI_TABLE)) {
> +               uintptr_t addr;
> +               void *ptr;
> +
> +               /* Reserve 64K for ACPI tables, aligned to a 4K boundary */
> +               ptr = memalign(SZ_4K, SZ_64K);
> +               addr = (uintptr_t)ptr;
> +
> +               /* Generate ACPI tables */
> +               write_acpi_tables(addr);
> +               gd->arch.table_start = addr;
> +               gd->arch.table_end = addr;
> +       }
> +
>         return 0;
>  }
>
> --
> 2.40.1
>


More information about the U-Boot mailing list