[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAFLszTh+B=7Y8HyCX20+rX2rse-y7KCH14zLwk-wxUQFXBWHmw@mail.gmail.com>
Date: Mon, 29 Jul 2024 09:28:37 -0600
From: Simon Glass <sjg@...omium.org>
To: Patrick Rudolph <patrick.rudolph@...ements.com>
Cc: u-boot@...ts.denx.de, linux-kernel@...r.kernel.org, mbrugger@...e.com,
pbrobinson@...il.com, trini@...sulko.com, bmeng.cn@...il.com
Subject: Re: [PATCH 07/17] arm: acpi: Add generic ACPI methods
Hi Patrick,
On Sat, 27 Jul 2024 at 01:20, Patrick Rudolph
<patrick.rudolph@...ements.com> wrote:
>
> Add generic ACPI code to generate
> - MADT GICC
> - MADT GICD
>
> as commonly used on arm platforms.
>
> Signed-off-by: Patrick Rudolph <patrick.rudolph@...ements.com>
> Cc: Tom Rini <trini@...sulko.com>
> Cc: Simon Glass <sjg@...omium.org>
> ---
> arch/arm/include/asm/acpi_table.h | 18 +++++++++++++
> arch/arm/lib/Makefile | 1 +
> arch/arm/lib/acpi_table.c | 44 +++++++++++++++++++++++++++++++
> 3 files changed, 63 insertions(+)
> create mode 100644 arch/arm/lib/acpi_table.c
>
> diff --git a/arch/arm/include/asm/acpi_table.h b/arch/arm/include/asm/acpi_table.h
> index e69de29bb2..8a25e93847 100644
> --- a/arch/arm/include/asm/acpi_table.h
> +++ b/arch/arm/include/asm/acpi_table.h
> @@ -0,0 +1,18 @@
> +/* SPDX-License-Identifier: GPL-2.0-or-later */
> +
> +#ifndef __ASM_ACPI_TABLE_H__
> +#define __ASM_ACPI_TABLE_H__
> +
> +#ifndef __ACPI__
> +
> +void acpi_write_madt_gicc(struct acpi_madt_gicc *gicc, uint cpu_num,
> + uint perf_gsiv, ulong phys_base, ulong gicv,
> + ulong gich, uint vgic_maint_irq, ulong mpidr,
> + uint efficiency);
> +
> +void acpi_write_madt_gicd(struct acpi_madt_gicd *gicd, uint gic_id,
> + ulong phys_base, uint gic_version);
Exported function should have full comments.
> +
> +#endif /* !__ACPI__ */
> +
> +#endif /* __ASM_ACPI_TABLE_H__ */
> diff --git a/arch/arm/lib/Makefile b/arch/arm/lib/Makefile
> index 67275fba61..a7efed6771 100644
> --- a/arch/arm/lib/Makefile
> +++ b/arch/arm/lib/Makefile
> @@ -86,6 +86,7 @@ obj-y += psci-dt.o
> obj-$(CONFIG_DEBUG_LL) += debug.o
>
> obj-$(CONFIG_BLOBLIST) += xferlist.o
> +obj-$(CONFIG_GENERATE_ACPI_TABLE) += acpi_table.o
>
> # For EABI conformant tool chains, provide eabi_compat()
> ifneq (,$(findstring -mabi=aapcs-linux,$(PLATFORM_CPPFLAGS)))
> diff --git a/arch/arm/lib/acpi_table.c b/arch/arm/lib/acpi_table.c
> new file mode 100644
> index 0000000000..ea3a6343c9
> --- /dev/null
> +++ b/arch/arm/lib/acpi_table.c
> @@ -0,0 +1,44 @@
> +// SPDX-License-Identifier: GPL-2.0+
> +/*
> + * Based on acpi.c from coreboot
> + *
> + * Copyright (C) 2024 9elements GmbH
> + */
> +
> +#define LOG_CATEGORY LOGC_ACPI
> +
> +#include <acpi/acpigen.h>
> +#include <acpi/acpi_device.h>
> +#include <acpi/acpi_table.h>
> +#include <string.h>
> +
> +void acpi_write_madt_gicc(struct acpi_madt_gicc *gicc, uint cpu_num,
> + uint perf_gsiv, ulong phys_base, ulong gicv,
> + ulong gich, uint vgic_maint_irq, ulong mpidr,
> + uint efficiency)
> +{
> + memset(gicc, '\0', sizeof(struct acpi_madt_gicc));
> + gicc->type = ACPI_APIC_GICC;
> + gicc->length = sizeof(struct acpi_madt_gicc);
> + gicc->cpu_if_num = cpu_num;
> + gicc->processor_id = cpu_num;
> + gicc->flags = ACPI_MADTF_ENABLED;
> + gicc->perf_gsiv = perf_gsiv;
> + gicc->phys_base = phys_base;
> + gicc->gicv = gicv;
> + gicc->gich = gich;
> + gicc->vgic_maint_irq = vgic_maint_irq;
> + gicc->mpidr = mpidr;
> + gicc->efficiency = efficiency;
> +}
> +
> +void acpi_write_madt_gicd(struct acpi_madt_gicd *gicd, uint gic_id,
> + ulong phys_base, uint gic_version)
> +{
> + memset(gicd, '\0', sizeof(struct acpi_madt_gicd));
> + gicd->type = ACPI_APIC_GICD;
> + gicd->length = sizeof(struct acpi_madt_gicd);
> + gicd->gic_id = gic_id;
> + gicd->phys_base = phys_base;
> + gicd->gic_version = gic_version;
> +}
> --
> 2.45.2
>
REgards,
Simon
Powered by blists - more mailing lists