* [PATCH v3 18/30] drivers/cpu: Add generic armv8 cpu driver
[not found] <20240911062511.494855-1-patrick.rudolph@9elements.com>
@ 2024-09-11 6:24 ` Patrick Rudolph
2024-09-11 9:41 ` Peter Robinson
2024-09-12 1:01 ` Simon Glass
2024-09-11 6:24 ` [PATCH v3 19/30] arm: gic-v3-its: Rename objects Patrick Rudolph
` (3 subsequent siblings)
4 siblings, 2 replies; 14+ messages in thread
From: Patrick Rudolph @ 2024-09-11 6:24 UTC (permalink / raw)
To: u-boot, linux-kernel; +Cc: Patrick Rudolph, Tom Rini, Simon Glass
Add a generic driver that binds to armv8 CPU nodes.
TEST: Booted on QEMU sbsa and verify the driver binds to CPU nodes.
Confirmed with FWTS that all ACPI processor devices are present.
Signed-off-by: Patrick Rudolph <patrick.rudolph@9elements.com>
Cc: Tom Rini <trini@konsulko.com>
Cc: Simon Glass <sjg@chromium.org>
---
drivers/cpu/Kconfig | 6 +++
drivers/cpu/Makefile | 2 +
drivers/cpu/armv8_cpu.c | 90 +++++++++++++++++++++++++++++++++++++++++
3 files changed, 98 insertions(+)
create mode 100644 drivers/cpu/armv8_cpu.c
diff --git a/drivers/cpu/Kconfig b/drivers/cpu/Kconfig
index 5c06cd9f60..9c0df331d7 100644
--- a/drivers/cpu/Kconfig
+++ b/drivers/cpu/Kconfig
@@ -26,6 +26,12 @@ config CPU_RISCV
help
Support CPU cores for RISC-V architecture.
+config CPU_ARMV8
+ bool "Enable generic ARMv8 CPU driver"
+ depends on CPU && ARM64
+ help
+ Support CPU cores for armv8 architecture.
+
config CPU_MICROBLAZE
bool "Enable Microblaze CPU driver"
depends on CPU && MICROBLAZE
diff --git a/drivers/cpu/Makefile b/drivers/cpu/Makefile
index bc75d9b974..773395693a 100644
--- a/drivers/cpu/Makefile
+++ b/drivers/cpu/Makefile
@@ -6,10 +6,12 @@
obj-$(CONFIG_CPU) += cpu-uclass.o
+
obj-$(CONFIG_ARCH_BMIPS) += bmips_cpu.o
obj-$(CONFIG_ARCH_IMX8) += imx8_cpu.o
obj-$(CONFIG_ARCH_AT91) += at91_cpu.o
obj-$(CONFIG_ARCH_MEDIATEK) += mtk_cpu.o
+obj-$(CONFIG_CPU_ARMV8) += armv8_cpu.o
obj-$(CONFIG_CPU_IMX) += imx8_cpu.o
obj-$(CONFIG_CPU_MPC83XX) += mpc83xx_cpu.o
obj-$(CONFIG_CPU_RISCV) += riscv_cpu.o
diff --git a/drivers/cpu/armv8_cpu.c b/drivers/cpu/armv8_cpu.c
new file mode 100644
index 0000000000..08b8d45f6f
--- /dev/null
+++ b/drivers/cpu/armv8_cpu.c
@@ -0,0 +1,90 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright 2019 Broadcom.
+ */
+#include <acpi/acpigen.h>
+#include <asm/armv8/cpu.h>
+#include <cpu.h>
+#include <dm.h>
+#include <dm/acpi.h>
+#include <asm/io.h>
+#include <linux/bitops.h>
+#include <linux/printk.h>
+#include <linux/sizes.h>
+
+static int armv8_cpu_get_desc(const struct udevice *dev, char *buf, int size)
+{
+ int cpuid;
+
+ cpuid = (read_midr() & MIDR_PARTNUM_MASK) >> MIDR_PARTNUM_SHIFT;
+
+ snprintf(buf, size, "CPU MIDR %04x", cpuid);
+
+ return 0;
+}
+
+static int armv8_cpu_get_info(const struct udevice *dev,
+ struct cpu_info *info)
+{
+ info->cpu_freq = 0;
+ info->features = BIT(CPU_FEAT_L1_CACHE) | BIT(CPU_FEAT_MMU);
+
+ return 0;
+}
+
+static int armv8_cpu_get_count(const struct udevice *dev)
+{
+ ofnode node;
+ int num = 0;
+
+ ofnode_for_each_subnode(node, dev_ofnode(dev->parent)) {
+ const char *device_type;
+
+ if (!ofnode_is_enabled(node))
+ continue;
+
+ device_type = ofnode_read_string(node, "device_type");
+ if (!device_type)
+ continue;
+
+ if (!strcmp(device_type, "cpu"))
+ num++;
+ }
+
+ return num;
+}
+
+#ifdef CONFIG_ACPIGEN
+static int acpi_cpu_fill_ssdt(const struct udevice *dev, struct acpi_ctx *ctx)
+{
+ uint core_id = dev_seq(dev);
+
+ acpigen_write_processor_device(ctx, core_id);
+
+ return 0;
+}
+
+struct acpi_ops armv8_cpu_acpi_ops = {
+ .fill_ssdt = acpi_cpu_fill_ssdt,
+};
+#endif
+
+static const struct cpu_ops cpu_ops = {
+ .get_count = armv8_cpu_get_count,
+ .get_desc = armv8_cpu_get_desc,
+ .get_info = armv8_cpu_get_info,
+};
+
+static const struct udevice_id cpu_ids[] = {
+ { .compatible = "arm,armv8" },
+ {}
+};
+
+U_BOOT_DRIVER(arm_cpu) = {
+ .name = "arm-cpu",
+ .id = UCLASS_CPU,
+ .of_match = cpu_ids,
+ .ops = &cpu_ops,
+ .flags = DM_FLAG_PRE_RELOC,
+ ACPI_OPS_PTR(&armv8_cpu_acpi_ops)
+};
--
2.46.0
^ permalink raw reply [flat|nested] 14+ messages in thread
* [PATCH v3 19/30] arm: gic-v3-its: Rename objects
[not found] <20240911062511.494855-1-patrick.rudolph@9elements.com>
2024-09-11 6:24 ` [PATCH v3 18/30] drivers/cpu: Add generic armv8 cpu driver Patrick Rudolph
@ 2024-09-11 6:24 ` Patrick Rudolph
2024-09-12 0:58 ` Simon Glass
2024-09-11 6:24 ` [PATCH v3 20/30] drivers/arm: Implement acpi_fill_madt Patrick Rudolph
` (2 subsequent siblings)
4 siblings, 1 reply; 14+ messages in thread
From: Patrick Rudolph @ 2024-09-11 6:24 UTC (permalink / raw)
To: u-boot, linux-kernel; +Cc: Patrick Rudolph, Tom Rini
The code accesses the gic-v3 node, but not the gic-v3-its node,
thus rename the objects to clarify which node it operates on.
The following commit will make use of the gic-v3-its node for real.
Signed-off-by: Patrick Rudolph <patrick.rudolph@9elements.com>
---
arch/arm/lib/gic-v3-its.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/arch/arm/lib/gic-v3-its.c b/arch/arm/lib/gic-v3-its.c
index 2cc0a32f9d..22fa46a341 100644
--- a/arch/arm/lib/gic-v3-its.c
+++ b/arch/arm/lib/gic-v3-its.c
@@ -35,10 +35,10 @@ static int gic_v3_its_get_gic_addr(struct gic_v3_its_priv *priv)
int ret;
ret = uclass_get_device_by_driver(UCLASS_IRQ,
- DM_DRIVER_GET(arm_gic_v3_its), &dev);
+ DM_DRIVER_GET(arm_gic_v3), &dev);
if (ret) {
pr_err("%s: failed to get %s irq device\n", __func__,
- DM_DRIVER_GET(arm_gic_v3_its)->name);
+ DM_DRIVER_GET(arm_gic_v3)->name);
return ret;
}
@@ -158,13 +158,13 @@ int gic_lpi_tables_init(u64 base, u32 num_redist)
return 0;
}
-static const struct udevice_id gic_v3_its_ids[] = {
+static const struct udevice_id gic_v3_ids[] = {
{ .compatible = "arm,gic-v3" },
{}
};
-U_BOOT_DRIVER(arm_gic_v3_its) = {
+U_BOOT_DRIVER(arm_gic_v3) = {
.name = "gic-v3",
.id = UCLASS_IRQ,
- .of_match = gic_v3_its_ids,
+ .of_match = gic_v3_ids,
};
--
2.46.0
^ permalink raw reply [flat|nested] 14+ messages in thread
* [PATCH v3 20/30] drivers/arm: Implement acpi_fill_madt
[not found] <20240911062511.494855-1-patrick.rudolph@9elements.com>
2024-09-11 6:24 ` [PATCH v3 18/30] drivers/cpu: Add generic armv8 cpu driver Patrick Rudolph
2024-09-11 6:24 ` [PATCH v3 19/30] arm: gic-v3-its: Rename objects Patrick Rudolph
@ 2024-09-11 6:24 ` Patrick Rudolph
2024-09-12 0:58 ` Simon Glass
2024-09-11 6:24 ` [PATCH v3 21/30] common: Enable BLOBLIST_TABLES on arm Patrick Rudolph
2024-09-11 6:24 ` [PATCH v3 24/30] arm: mach-bcm283x: Bring in some header files from tianocore Patrick Rudolph
4 siblings, 1 reply; 14+ messages in thread
From: Patrick Rudolph @ 2024-09-11 6:24 UTC (permalink / raw)
To: u-boot, linux-kernel; +Cc: Patrick Rudolph, Simon Glass, Tom Rini
Fill the MADT table in the GIC driver and armv8 CPU driver to
drop SoC specific code. While the GIC only needs devicetree
data, the CPU driver needs additional information stored in
the cpu_plat struct.
While on it update the only board making use of the existing
drivers and writing ACPI MADT in mainboard code.
TEST: Booted on QEMU sbsa using driver model generated MADT.
Signed-off-by: Patrick Rudolph <patrick.rudolph@9elements.com>
Cc: Simon Glass <sjg@chromium.org>
---
arch/arm/lib/acpi_table.c | 1 +
arch/arm/lib/gic-v3-its.c | 89 ++++++++++++++++++++++++++++++++++++++-
drivers/cpu/armv8_cpu.c | 27 ++++++++++++
include/cpu.h | 27 +++++++++++-
4 files changed, 141 insertions(+), 3 deletions(-)
diff --git a/arch/arm/lib/acpi_table.c b/arch/arm/lib/acpi_table.c
index 8c17e9eb36..75a0bc5b6e 100644
--- a/arch/arm/lib/acpi_table.c
+++ b/arch/arm/lib/acpi_table.c
@@ -10,6 +10,7 @@
#include <acpi/acpigen.h>
#include <acpi/acpi_device.h>
#include <acpi/acpi_table.h>
+#include <dm/acpi.h>
#include <string.h>
void acpi_write_madt_gicc(struct acpi_madt_gicc *gicc, uint cpu_num,
diff --git a/arch/arm/lib/gic-v3-its.c b/arch/arm/lib/gic-v3-its.c
index 22fa46a341..23769c46b5 100644
--- a/arch/arm/lib/gic-v3-its.c
+++ b/arch/arm/lib/gic-v3-its.c
@@ -7,6 +7,8 @@
#include <asm/gic.h>
#include <asm/gic-v3.h>
#include <asm/io.h>
+#include <asm/acpi_table.h>
+#include <dm/acpi.h>
#include <linux/bitops.h>
#include <linux/printk.h>
#include <linux/sizes.h>
@@ -26,12 +28,14 @@ static u32 lpi_id_bits;
struct gic_v3_its_priv {
ulong gicd_base;
ulong gicr_base;
+ ulong gicr_length;
};
static int gic_v3_its_get_gic_addr(struct gic_v3_its_priv *priv)
{
struct udevice *dev;
fdt_addr_t addr;
+ fdt_size_t size;
int ret;
ret = uclass_get_device_by_driver(UCLASS_IRQ,
@@ -49,12 +53,13 @@ static int gic_v3_its_get_gic_addr(struct gic_v3_its_priv *priv)
}
priv->gicd_base = addr;
- addr = dev_read_addr_index(dev, 1);
+ addr = dev_read_addr_size_index(dev, 1, &size);
if (addr == FDT_ADDR_T_NONE) {
pr_err("%s: failed to get GICR address\n", __func__);
return -EINVAL;
}
priv->gicr_base = addr;
+ priv->gicr_length = size;
return 0;
}
@@ -158,6 +163,42 @@ int gic_lpi_tables_init(u64 base, u32 num_redist)
return 0;
}
+#ifdef CONFIG_ACPIGEN
+/**
+ * acpi_gicv3_fill_madt() - Fill out the body of the MADT
+ *
+ * Write GICD and GICR tables based on collected devicetree data.
+ *
+ * @dev: Device to write ACPI tables for
+ * @ctx: ACPI context to write MADT sub-tables to
+ * Return: 0 if OK
+ */
+static int acpi_gicv3_fill_madt(const struct udevice *dev, struct acpi_ctx *ctx)
+{
+ struct acpi_madt_gicd *gicd;
+ struct acpi_madt_gicr *gicr;
+
+ struct gic_v3_its_priv priv;
+
+ if (gic_v3_its_get_gic_addr(&priv))
+ return -EINVAL;
+
+ gicd = ctx->current;
+ acpi_write_madt_gicd(gicd, dev_seq(dev), priv.gicd_base, 3);
+ acpi_inc(ctx, gicd->length);
+
+ gicr = ctx->current;
+ acpi_write_madt_gicr(gicr, priv.gicr_base, priv.gicr_length);
+ acpi_inc(ctx, gicr->length);
+
+ return 0;
+}
+
+struct acpi_ops gic_v3_acpi_ops = {
+ .fill_madt = acpi_gicv3_fill_madt,
+};
+#endif
+
static const struct udevice_id gic_v3_ids[] = {
{ .compatible = "arm,gic-v3" },
{}
@@ -167,4 +208,50 @@ U_BOOT_DRIVER(arm_gic_v3) = {
.name = "gic-v3",
.id = UCLASS_IRQ,
.of_match = gic_v3_ids,
+ ACPI_OPS_PTR(&gic_v3_acpi_ops)
+};
+
+#ifdef CONFIG_ACPIGEN
+/**
+ * acpi_gic_its_fill_madt() - Fill out the body of the MADT
+ *
+ * Write ITS tables based on collected devicetree data.
+ *
+ * @dev: Device to write ACPI tables for
+ * @ctx: ACPI context to write MADT sub-tables to
+ * Return: 0 if OK
+ */
+static int acpi_gic_its_fill_madt(const struct udevice *dev, struct acpi_ctx *ctx)
+{
+ struct acpi_madt_its *its;
+ fdt_addr_t addr;
+
+ addr = dev_read_addr_index(dev, 0);
+ if (addr == FDT_ADDR_T_NONE) {
+ pr_err("%s: failed to get GIC ITS address\n", __func__);
+ return -EINVAL;
+ }
+
+ its = ctx->current;
+ acpi_write_madt_its(its, dev_seq(dev), addr);
+ acpi_inc(ctx, its->length);
+
+ return 0;
+}
+
+struct acpi_ops gic_v3_its_acpi_ops = {
+ .fill_madt = acpi_gic_its_fill_madt,
+};
+#endif
+
+static const struct udevice_id gic_v3_its_ids[] = {
+ { .compatible = "arm,gic-v3-its" },
+ {}
+};
+
+U_BOOT_DRIVER(arm_gic_v3_its) = {
+ .name = "gic-v3-its",
+ .id = UCLASS_IRQ,
+ .of_match = gic_v3_its_ids,
+ ACPI_OPS_PTR(&gic_v3_its_acpi_ops)
};
diff --git a/drivers/cpu/armv8_cpu.c b/drivers/cpu/armv8_cpu.c
index 08b8d45f6f..6dcfc14751 100644
--- a/drivers/cpu/armv8_cpu.c
+++ b/drivers/cpu/armv8_cpu.c
@@ -64,8 +64,35 @@ static int acpi_cpu_fill_ssdt(const struct udevice *dev, struct acpi_ctx *ctx)
return 0;
}
+static int acpi_cpu_fill_madt(const struct udevice *dev, struct acpi_ctx *ctx)
+{
+ struct acpi_madt_gicc *gicc;
+ struct cpu_plat *cpu_plat;
+
+ cpu_plat = dev_get_parent_plat(dev);
+ if (!cpu_plat)
+ return 0;
+
+ gicc = ctx->current;
+ acpi_write_madt_gicc(gicc,
+ cpu_plat->gicc_cpu_if_num,
+ cpu_plat->gicc_perf_gsiv,
+ cpu_plat->gicc_phys_base,
+ cpu_plat->gicc_gicv,
+ cpu_plat->gicc_gich,
+ cpu_plat->gicc_vgic_maint_irq,
+ cpu_plat->gicc_gicr_base,
+ cpu_plat->gicc_mpidr,
+ cpu_plat->gicc_efficiency);
+
+ acpi_inc(ctx, gicc->length);
+
+ return 0;
+}
+
struct acpi_ops armv8_cpu_acpi_ops = {
.fill_ssdt = acpi_cpu_fill_ssdt,
+ .fill_madt = acpi_cpu_fill_madt,
};
#endif
diff --git a/include/cpu.h b/include/cpu.h
index 0018910d61..c2a4ca08fe 100644
--- a/include/cpu.h
+++ b/include/cpu.h
@@ -13,17 +13,29 @@ struct udevice;
/**
* struct cpu_plat - platform data for a CPU
- * @cpu_id: Platform-specific way of identifying the CPU.
+ * @cpu_id: Platform-specific way of identifying the CPU.
* @ucode_version: Microcode version, if CPU_FEAT_UCODE is set
* @device_id: Driver-defined device identifier
* @family: DMTF CPU Family identifier
* @id: DMTF CPU Processor identifier
* @timebase_freq: the current frequency at which the cpu timer timebase
- * registers are updated (in Hz)
+ * registers are updated (in Hz)
+ * @gicc_cpu_if_num: GIC's CPU Interface Number
+ * @gicc_perf_gsiv: The GSIV used for Performance Monitoring Interrupts
+ * @gicc_phys_base: Address at which the processor can access this
+ * GIC CPU Interface
+ * @gicc_gicv: Address of the GIC virtual CPU interface registers
+ * @gicc_gich: Address of the GIC virtual interface control block
+ * registers
+ * @gicc_vgic_maint_irq: GSIV for Virtual GIC maintenance interrupt
+ * @gicc_gicr_base: Physical address of the associated Redistributor
+ * @gicc_mpidr: MPIDR as defined by ARM architecture
+ * @gicc_efficiency: Describes the relative power efficiency
*
* This can be accessed with dev_get_parent_plat() for any UCLASS_CPU
* device.
*/
+
struct cpu_plat {
int cpu_id;
int ucode_version;
@@ -31,6 +43,17 @@ struct cpu_plat {
u16 family;
u32 id[2];
u32 timebase_freq;
+#if defined(CONFIG_GENERATE_ACPI_TABLE)
+ u32 gicc_cpu_if_num;
+ u32 gicc_perf_gsiv;
+ u64 gicc_phys_base;
+ u64 gicc_gicv;
+ u64 gicc_gich;
+ u32 gicc_vgic_maint_irq;
+ u64 gicc_gicr_base;
+ u64 gicc_mpidr;
+ u8 gicc_efficiency;
+#endif
};
/* CPU features - mostly just a placeholder for now */
--
2.46.0
^ permalink raw reply [flat|nested] 14+ messages in thread
* [PATCH v3 21/30] common: Enable BLOBLIST_TABLES on arm
[not found] <20240911062511.494855-1-patrick.rudolph@9elements.com>
` (2 preceding siblings ...)
2024-09-11 6:24 ` [PATCH v3 20/30] drivers/arm: Implement acpi_fill_madt Patrick Rudolph
@ 2024-09-11 6:24 ` Patrick Rudolph
2024-09-12 0:58 ` Simon Glass
2024-09-11 6:24 ` [PATCH v3 24/30] arm: mach-bcm283x: Bring in some header files from tianocore Patrick Rudolph
4 siblings, 1 reply; 14+ messages in thread
From: Patrick Rudolph @ 2024-09-11 6:24 UTC (permalink / raw)
To: u-boot, linux-kernel; +Cc: Patrick Rudolph, Tom Rini
Allow to use BLOBLIST_TABLES on arm to store ACPI or other tables.
Signed-off-by: Patrick Rudolph <patrick.rudolph@9elements.com>
Cc: Tom Rini <trini@konsulko.com>
---
common/Kconfig | 1 +
lib/Kconfig | 15 +++++++++------
2 files changed, 10 insertions(+), 6 deletions(-)
diff --git a/common/Kconfig b/common/Kconfig
index 83c81edac2..a864e24508 100644
--- a/common/Kconfig
+++ b/common/Kconfig
@@ -1075,6 +1075,7 @@ config BLOBLIST_SIZE_RELOC
hex "Size of bloblist after relocation"
default BLOBLIST_SIZE if BLOBLIST_FIXED || BLOBLIST_ALLOC
default 0x0 if BLOBLIST_PASSAGE
+ default 0x20000 if (ARM && EFI_LOADER && GENERATE_ACPI_TABLE)
help
Sets the size of the bloblist in bytes after relocation. Since U-Boot
has a lot more memory available then, it is possible to use a larger
diff --git a/lib/Kconfig b/lib/Kconfig
index 2059219a12..ea444354eb 100644
--- a/lib/Kconfig
+++ b/lib/Kconfig
@@ -983,12 +983,15 @@ menu "System tables"
config BLOBLIST_TABLES
bool "Put tables in a bloblist"
- depends on X86 && BLOBLIST
- help
- Normally tables are placed at address 0xf0000 and can be up to 64KB
- long. With this option, tables are instead placed in the bloblist
- with a pointer from 0xf0000. The size can then be larger and the
- tables can be placed high in memory.
+ depends on BLOBLIST
+ default y if (ARM && EFI_LOADER && GENERATE_ACPI_TABLE)
+ default n
+ help
+ On x86 normally tables are placed at address 0xf0000 and can be up
+ to 64KB long. With this option, tables are instead placed in the
+ bloblist with a pointer from 0xf0000. The size can then be larger
+ and the tables can be placed high in memory.
+ On other architectures the tables are always placed in high memory.
config GENERATE_SMBIOS_TABLE
bool "Generate an SMBIOS (System Management BIOS) table"
--
2.46.0
^ permalink raw reply [flat|nested] 14+ messages in thread
* [PATCH v3 24/30] arm: mach-bcm283x: Bring in some header files from tianocore
[not found] <20240911062511.494855-1-patrick.rudolph@9elements.com>
` (3 preceding siblings ...)
2024-09-11 6:24 ` [PATCH v3 21/30] common: Enable BLOBLIST_TABLES on arm Patrick Rudolph
@ 2024-09-11 6:24 ` Patrick Rudolph
2024-09-12 0:58 ` Simon Glass
4 siblings, 1 reply; 14+ messages in thread
From: Patrick Rudolph @ 2024-09-11 6:24 UTC (permalink / raw)
To: u-boot, linux-kernel
Cc: Simon Glass, Patrick Rudolph, Matthias Brugger, Peter Robinson, Tom Rini
From: Simon Glass <sjg@chromium.org>
These header files presumably duplicate things already in the U-Boot
devicetree. For now, bring them in to get the ASL code and ACPI table
code to compile.
Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Patrick Rudolph <patrick.rudolph@9elements.com>
Cc: Matthias Brugger <mbrugger@suse.com>
Cc: Peter Robinson <pbrobinson@gmail.com>
Cc: Tom Rini <trini@konsulko.com>
---
.../mach-bcm283x/include/mach/acpi/bcm2711.h | 152 ++++++++++++++++++
.../mach-bcm283x/include/mach/acpi/bcm2836.h | 127 +++++++++++++++
.../include/mach/acpi/bcm2836_gpio.h | 19 +++
.../include/mach/acpi/bcm2836_gpu.h | 47 ++++++
.../include/mach/acpi/bcm2836_pwm.h | 33 ++++
.../include/mach/acpi/bcm2836_sdhost.h | 18 +++
.../include/mach/acpi/bcm2836_sdio.h | 21 +++
drivers/pci/pcie_brcmstb.c | 101 ++----------
8 files changed, 427 insertions(+), 91 deletions(-)
create mode 100644 arch/arm/mach-bcm283x/include/mach/acpi/bcm2711.h
create mode 100644 arch/arm/mach-bcm283x/include/mach/acpi/bcm2836.h
create mode 100644 arch/arm/mach-bcm283x/include/mach/acpi/bcm2836_gpio.h
create mode 100644 arch/arm/mach-bcm283x/include/mach/acpi/bcm2836_gpu.h
create mode 100644 arch/arm/mach-bcm283x/include/mach/acpi/bcm2836_pwm.h
create mode 100644 arch/arm/mach-bcm283x/include/mach/acpi/bcm2836_sdhost.h
create mode 100644 arch/arm/mach-bcm283x/include/mach/acpi/bcm2836_sdio.h
diff --git a/arch/arm/mach-bcm283x/include/mach/acpi/bcm2711.h b/arch/arm/mach-bcm283x/include/mach/acpi/bcm2711.h
new file mode 100644
index 0000000000..a86875b183
--- /dev/null
+++ b/arch/arm/mach-bcm283x/include/mach/acpi/bcm2711.h
@@ -0,0 +1,152 @@
+/* SPDX-License-Identifier: BSD-2-Clause-Patent */
+/**
+ *
+ * Copyright (c) 2019, Jeremy Linton
+ * Copyright (c) 2019, Pete Batard <pete@akeo.ie>.
+ *
+ **/
+
+#ifndef BCM2711_H__
+#define BCM2711_H__
+
+#define BCM2711_SOC_REGISTERS 0xfc000000
+#define BCM2711_SOC_REGISTER_LENGTH 0x02000000
+
+#define BCM2711_ARM_LOCAL_REGISTERS 0xfe000000
+#define BCM2711_ARM_LOCAL_REGISTER_LENGTH 0x02000000
+
+/* arm local addresses */
+#define BCM2711_ARMC_OFFSET 0x0000b000
+#define BCM2711_ARMC_BASE_ADDRESS (BCM2711_ARM_LOCAL_REGISTERS + BCM2711_ARMC_OFFSET)
+#define BCM2711_ARMC_LENGTH 0x00000400
+
+#define BCM2711_ARM_LOCAL_OFFSET 0x01800000
+#define BCM2711_ARM_LOCAL_BASE_ADDRESS (BCM2711_ARM_LOCAL_REGISTERS + BCM2711_ARM_LOCAL_OFFSET)
+#define BCM2711_ARM_LOCAL_LENGTH 0x00000080
+
+#define BCM2711_GIC400_OFFSET 0x01840000
+#define BCM2711_GIC400_BASE_ADDRESS (BCM2711_ARM_LOCAL_REGISTERS + BCM2711_GIC400_OFFSET)
+#define BCM2711_GIC400_LENGTH 0x00008000
+
+/* Generic PCI addresses */
+#define PCIE_TOP_OF_MEM_WIN 0xf8000000
+#define PCIE_CPU_MMIO_WINDOW 0x600000000
+#define PCIE_BRIDGE_MMIO_LEN 0x3ffffff
+
+/* PCI root bridge control registers location */
+#define PCIE_REG_BASE 0xfd500000
+#define PCIE_REG_LIMIT 0x9310
+
+/* PCI root bridge control registers */
+#define BRCM_PCIE_CAP_REGS 0x00ac
+#define PCIE_RC_CFG_VENDOR_VENDOR_SPECIFIC_REG1 0x0188
+#define VENDOR_SPECIFIC_REG1_LITTLE_ENDIAN 0x0
+#define PCIE_RC_CFG_PRIV1_ID_VAL3 0x043c
+#define PCIE_RC_CFG_PRIV1_LINK_CAPABILITY 0x04dc
+#define LINK_CAPABILITY_ASPM_SUPPORT_MASK 0xc00
+
+#define PCIE_RC_DL_MDIO_ADDR 0x1100
+#define PCIE_RC_DL_MDIO_WR_DATA 0x1104
+#define PCIE_RC_DL_MDIO_RD_DATA 0x1108
+
+#define PCIE_MISC_MISC_CTRL 0x4008
+#define MISC_CTRL_SCB_ACCESS_EN_MASK 0x1000
+#define MISC_CTRL_CFG_READ_UR_MODE_MASK 0x2000
+#define MISC_CTRL_MAX_BURST_SIZE_MASK 0x300000
+#define MISC_CTRL_MAX_BURST_SIZE_128 0x0
+#define MISC_CTRL_SCB0_SIZE_MASK 0xf8000000
+
+#define PCIE_MISC_CPU_2_PCIE_MEM_WIN0_LO 0x400c
+#define PCIE_MISC_CPU_2_PCIE_MEM_WIN0_HI 0x4010
+#define PCIE_MEM_WIN0_LO(win) \
+ PCIE_MISC_CPU_2_PCIE_MEM_WIN0_LO + ((win) * 4)
+
+#define PCIE_MEM_WIN0_HI(win) \
+ PCIE_MISC_CPU_2_PCIE_MEM_WIN0_HI + ((win) * 4)
+#define PCIE_MISC_RC_BAR1_CONFIG_LO 0x402c
+#define RC_BAR1_CONFIG_LO_SIZE_MASK 0x1f
+#define PCIE_MISC_RC_BAR2_CONFIG_LO 0x4034
+#define RC_BAR2_CONFIG_LO_SIZE_MASK 0x1f
+#define PCIE_MISC_RC_BAR2_CONFIG_HI 0x4038
+#define PCIE_MISC_RC_BAR3_CONFIG_LO 0x403c
+#define RC_BAR3_CONFIG_LO_SIZE_MASK 0x1f
+#define PCIE_MISC_PCIE_STATUS 0x4068
+#define STATUS_PCIE_PORT_MASK 0x80
+#define STATUS_PCIE_PORT_SHIFT 7
+#define STATUS_PCIE_DL_ACTIVE_MASK 0x20
+#define STATUS_PCIE_DL_ACTIVE_SHIFT 5
+#define STATUS_PCIE_PHYLINKUP_MASK 0x10
+#define STATUS_PCIE_PHYLINKUP_SHIFT 4
+#define PCIE_MISC_REVISION 0x406c
+#define PCIE_MISC_CPU_2_PCIE_MEM_WIN0_BASE_LIMIT 0x4070
+#define MEM_WIN0_BASE_LIMIT_LIMIT_MASK 0xfff00000
+#define MEM_WIN0_BASE_LIMIT_BASE_MASK 0xfff0
+#define MEM_WIN0_BASE_LIMIT_BASE_HI_SHIFT 12
+#define PCIE_MEM_WIN0_BASE_LIMIT(win) \
+ PCIE_MISC_CPU_2_PCIE_MEM_WIN0_BASE_LIMIT + ((win) * 4)
+#define PCIE_MISC_CPU_2_PCIE_MEM_WIN0_BASE_HI 0x4080
+#define MEM_WIN0_BASE_HI_BASE_MASK 0xff
+#define PCIE_MEM_WIN0_BASE_HI(win) \
+ PCIE_MISC_CPU_2_PCIE_MEM_WIN0_BASE_HI + ((win) * 8)
+#define PCIE_MISC_CPU_2_PCIE_MEM_WIN0_LIMIT_HI 0x4084
+#define PCIE_MEM_WIN0_LIMIT_HI_LIMIT_MASK 0xff
+#define PCIE_MEM_WIN0_LIMIT_HI(win) \
+ PCIE_MISC_CPU_2_PCIE_MEM_WIN0_LIMIT_HI + ((win) * 8)
+
+#define PCIE_MISC_HARD_PCIE_HARD_DEBUG 0x4204
+#define PCIE_HARD_DEBUG_SERDES_IDDQ_MASK 0x08000000
+
+#define PCIE_INTR2_CPU_STATUS 0x4300
+#define PCIE_INTR2_CPU_SET 0x4304
+#define PCIE_INTR2_CPU_CLR 0x4308
+#define PCIE_INTR2_CPU_MASK_STATUS 0x430c
+#define PCIE_INTR2_CPU_MASK_SET 0x4310
+#define PCIE_INTR2_CPU_MASK_CLR 0x4314
+
+#define PCIE_MSI_INTR2_CLR 0x4508
+#define PCIE_MSI_INTR2_MASK_SET 0x4510
+
+#define PCIE_RGR1_SW_INIT_1 0x9210
+#define PCIE_EXT_CFG_INDEX 0x9000
+/* A small window pointing at the ECAM of the device selected by CFG_INDEX */
+#define PCIE_EXT_CFG_DATA 0x8000
+
+#define PCIE_RC_CFG_VENDOR_VENDOR_SPECIFIC_REG1_ENDIAN_MODE_BAR2_MASK 0xc
+#define PCIE_RC_CFG_PRIV1_ID_VAL3_CLASS_CODE_MASK 0xffffff
+
+#define PCIE_MISC_MISC_CTRL_SCB_ACCESS_EN_MASK 0x1000
+#define PCIE_MISC_MISC_CTRL_CFG_READ_UR_MODE_MASK 0x2000
+#define PCIE_MISC_MISC_CTRL_MAX_BURST_SIZE_MASK 0x300000
+#define PCIE_MISC_MISC_CTRL_SCB0_SIZE_MASK 0xf8000000
+#define PCIE_MISC_MISC_CTRL_SCB1_SIZE_MASK 0x7c00000
+#define PCIE_MISC_MISC_CTRL_SCB2_SIZE_MASK 0x1f
+#define PCIE_MISC_RC_BAR2_CONFIG_LO_SIZE_MASK 0x1f
+
+#define PCIE_RGR1_SW_INIT_1_INIT_MASK 0x2
+#define PCIE_RGR1_SW_INIT_1_PERST_MASK 0x1
+
+#define PCIE_MISC_HARD_PCIE_HARD_DEBUG_SERDES_IDDQ_MASK 0x08000000
+
+#define PCIE_MISC_HARD_PCIE_HARD_DEBUG_CLKREQ_DEBUG_ENABLE_MASK 0x2
+
+#define PCIE_MISC_CPU_2_PCIE_MEM_WIN0_BASE_LIMIT_LIMIT_MASK 0xfff00000
+#define PCIE_MISC_CPU_2_PCIE_MEM_WIN0_BASE_LIMIT_BASE_MASK 0xfff0
+#define PCIE_MISC_CPU_2_PCIE_MEM_WIN0_BASE_HI_BASE_MASK 0xff
+#define PCIE_MISC_CPU_2_PCIE_MEM_WIN0_LIMIT_HI_LIMIT_MASK 0xff
+#define PCIE_MISC_CPU_2_PCIE_MEM_WIN0_MASK_BITS 0xc
+
+#define PCIE_MISC_REVISION_MAJMIN_MASK 0xffff
+
+#define BURST_SIZE_128 0
+#define BURST_SIZE_256 1
+#define BURST_SIZE_512 2
+
+#define BCM2711_THERM_SENSOR_OFFSET 0x015d2200
+#define BCM2711_THERM_SENSOR_BASE_ADDRESS (BCM2711_SOC_REGISTERS + BCM2711_THERM_SENSOR_OFFSET)
+#define BCM2711_THERM_SENSOR_LENGTH 0x00000008
+
+#define BCM2711_GENET_BASE_OFFSET 0x01580000
+#define BCM2711_GENET_BASE_ADDRESS (BCM2711_SOC_REGISTERS + BCM2711_GENET_BASE_OFFSET)
+#define BCM2711_GENET_LENGTH 0x10000
+
+#endif /* BCM2711_H__ */
diff --git a/arch/arm/mach-bcm283x/include/mach/acpi/bcm2836.h b/arch/arm/mach-bcm283x/include/mach/acpi/bcm2836.h
new file mode 100644
index 0000000000..64cec36a94
--- /dev/null
+++ b/arch/arm/mach-bcm283x/include/mach/acpi/bcm2836.h
@@ -0,0 +1,127 @@
+/* SPDX-License-Identifier: BSD-2-Clause-Patent */
+/**
+ *
+ * Copyright (c) 2019, ARM Limited. All rights reserved.
+ * Copyright (c) 2017, Andrei Warkentin <andrey.warkentin@gmail.com>
+ * Copyright (c) 2016, Linaro Limited. All rights reserved.
+ *
+ **/
+
+#ifndef __BCM2836_H__
+#define __BCM2836_H__
+
+/*
+ * Both "core" and SoC perpherals (1M each).
+ */
+#define BCM2836_SOC_REGISTERS 0xfe000000
+#define BCM2836_SOC_REGISTER_LENGTH 0x02000000
+
+/*
+ * Offset between the CPU's view and the VC's view of system memory.
+ */
+#define BCM2836_DMA_DEVICE_OFFSET 0xc0000000
+
+/* watchdog constants */
+#define BCM2836_WDOG_OFFSET 0x00100000
+#define BCM2836_WDOG_BASE_ADDRESS (BCM2836_SOC_REGISTERS + BCM2836_WDOG_OFFSET)
+#define BCM2836_WDOG_PASSWORD 0x5a000000
+#define BCM2836_WDOG_RSTC_OFFSET 0x0000001c
+#define BCM2836_WDOG_WDOG_OFFSET 0x00000024
+#define BCM2836_WDOG_RSTC_WRCFG_MASK 0x00000030
+#define BCM2836_WDOG_RSTC_WRCFG_FULL_RESET 0x00000020
+
+/* clock manager constants */
+#define BCM2836_CM_OFFSET 0x00101000
+#define BCM2836_CM_BASE (BCM2836_SOC_REGISTERS + BCM2836_CM_OFFSET)
+#define BCM2836_CM_GEN_CLOCK_CONTROL 0x0000
+#define BCM2836_CM_GEN_CLOCK_DIVISOR 0x0004
+#define BCM2836_CM_VPU_CLOCK_CONTROL 0x0008
+#define BCM2836_CM_VPU_CLOCK_DIVISOR 0x000c
+#define BCM2836_CM_SYSTEM_CLOCK_CONTROL 0x0010
+#define BCM2836_CM_SYSTEM_CLOCK_DIVISOR 0x0014
+#define BCM2836_CM_H264_CLOCK_CONTROL 0x0028
+#define BCM2836_CM_H264_CLOCK_DIVISOR 0x002c
+#define BCM2836_CM_PWM_CLOCK_CONTROL 0x00a0
+#define BCM2836_CM_PWM_CLOCK_DIVISOR 0x00a4
+#define BCM2836_CM_UART_CLOCK_CONTROL 0x00f0
+#define BCM2836_CM_UART_CLOCK_DIVISOR 0x00f4
+#define BCM2836_CM_SDC_CLOCK_CONTROL 0x01a8
+#define BCM2836_CM_SDC_CLOCK_DIVISOR 0x01ac
+#define BCM2836_CM_ARM_CLOCK_CONTROL 0x01b0
+#define BCM2836_CM_ARM_CLOCK_DIVISOR 0x01b4
+#define BCM2836_CM_EMMC_CLOCK_CONTROL 0x01c0
+#define BCM2836_CM_EMMC_CLOCK_DIVISOR 0x01c4
+
+/* mailbox interface constants */
+#define BCM2836_MBOX_OFFSET 0x0000b880
+#define BCM2836_MBOX_BASE_ADDRESS (BCM2836_SOC_REGISTERS + BCM2836_MBOX_OFFSET)
+#define BCM2836_MBOX_LENGTH 0x00000024
+#define BCM2836_MBOX_READ_OFFSET 0x00000000
+#define BCM2836_MBOX_STATUS_OFFSET 0x00000018
+#define BCM2836_MBOX_CONFIG_OFFSET 0x0000001c
+#define BCM2836_MBOX_WRITE_OFFSET 0x00000020
+
+#define BCM2836_MBOX_STATUS_FULL 0x1f
+#define BCM2836_MBOX_STATUS_EMPTY 0x1e
+
+#define BCM2836_MBOX_NUM_CHANNELS 16
+
+/* interrupt controller constants */
+#define BCM2836_INTC_TIMER_CONTROL_OFFSET 0x00000040
+#define BCM2836_INTC_TIMER_PENDING_OFFSET 0x00000060
+
+/* usb constants */
+#define BCM2836_USB_OFFSET 0x00980000
+#define BCM2836_USB_BASE_ADDRESS (BCM2836_SOC_REGISTERS + BCM2836_USB_OFFSET)
+#define BCM2836_USB_LENGTH 0x00010000
+
+/* serial based protocol constants */
+#define BCM2836_PL011_UART_OFFSET 0x00201000
+#define BCM2836_PL011_UART_BASE_ADDRESS (BCM2836_SOC_REGISTERS + BCM2836_PL011_UART_OFFSET)
+#define BCM2836_PL011_UART_LENGTH 0x00001000
+
+#define BCM2836_MINI_UART_OFFSET 0x00215000
+#define BCM2836_MINI_UART_BASE_ADDRESS (BCM2836_SOC_REGISTERS + BCM2836_MINI_UART_OFFSET)
+#define BCM2836_MINI_UART_LENGTH 0x00000070
+
+#define BCM2836_I2C0_OFFSET 0x00205000
+#define BCM2836_I2C0_BASE_ADDRESS (BCM2836_SOC_REGISTERS + BCM2836_I2C0_OFFSET)
+#define BCM2836_I2C0_LENGTH 0x00000020
+
+#define BCM2836_I2C1_OFFSET 0x00804000
+#define BCM2836_I2C1_BASE_ADDRESS (BCM2836_SOC_REGISTERS + BCM2836_I2C1_OFFSET)
+#define BCM2836_I2C1_LENGTH 0x00000020
+
+#define BCM2836_I2C2_OFFSET 0x00805000
+#define BCM2836_I2C2_BASE_ADDRESS (BCM2836_SOC_REGISTERS + BCM2836_I2C2_OFFSET)
+#define BCM2836_I2C2_LENGTH 0x00000020
+
+#define BCM2836_SPI0_OFFSET 0x00204000
+#define BCM2836_SPI0_BASE_ADDRESS (BCM2836_SOC_REGISTERS + BCM2836_SPI0_OFFSET)
+#define BCM2836_SPI0_LENGTH 0x00000020
+
+#define BCM2836_SPI1_OFFSET 0x00215080
+#define BCM2836_SPI1_LENGTH 0x00000040
+#define BCM2836_SPI1_BASE_ADDRESS (BCM2836_SOC_REGISTERS + BCM2836_SPI1_OFFSET)
+
+#define BCM2836_SPI2_OFFSET 0x002150C0
+#define BCM2836_SPI2_LENGTH 0x00000040
+#define BCM2836_SPI2_BASE_ADDRESS (BCM2836_SOC_REGISTERS + BCM2836_SPI2_OFFSET)
+
+#define BCM2836_SYSTEM_TIMER_OFFSET 0x00003000
+#define BCM2836_SYSTEM_TIMER_LENGTH 0x00000020
+#define BCM2836_SYSTEM_TIMER_ADDRESS (BCM2836_SOC_REGISTERS + BCM2836_SYSTEM_TIMER_OFFSET)
+
+/* dma constants */
+#define BCM2836_DMA0_OFFSET 0x00007000
+#define BCM2836_DMA0_BASE_ADDRESS (BCM2836_SOC_REGISTERS + BCM2836_DMA0_OFFSET)
+
+#define BCM2836_DMA15_OFFSET 0x00E05000
+#define BCM2836_DMA15_BASE_ADDRESS (BCM2836_SOC_REGISTERS + BCM2836_DMA15_OFFSET)
+
+#define BCM2836_DMA_CTRL_OFFSET 0x00007FE0
+#define BCM2836_DMA_CTRL_BASE_ADDRESS (BCM2836_SOC_REGISTERS + BCM2836_DMA_CTRL_OFFSET)
+
+#define BCM2836_DMA_CHANNEL_LENGTH 0x00000100
+
+#endif /*__BCM2836_H__ */
diff --git a/arch/arm/mach-bcm283x/include/mach/acpi/bcm2836_gpio.h b/arch/arm/mach-bcm283x/include/mach/acpi/bcm2836_gpio.h
new file mode 100644
index 0000000000..c5b858b412
--- /dev/null
+++ b/arch/arm/mach-bcm283x/include/mach/acpi/bcm2836_gpio.h
@@ -0,0 +1,19 @@
+/* SPDX-License-Identifier: BSD-2-Clause-Patent */
+/**
+ *
+ * Copyright (c) 2020, Pete Batard <pete@akeo.ie>
+ * Copyright (c) 2018, Andrei Warkentin <andrey.warkentin@gmail.com>
+ * Copyright (c) Microsoft Corporation. All rights reserved.
+ *
+ **/
+
+#include <asm/arch/acpi/bcm2836.h>
+
+#ifndef __BCM2836_GPIO_H__
+#define __BCM2836_GPIO_H__
+
+#define GPIO_OFFSET 0x00200000
+#define GPIO_BASE_ADDRESS (BCM2836_SOC_REGISTERS + GPIO_OFFSET)
+#define GPIO_LENGTH 0x000000B4
+
+#endif /* __BCM2836_GPIO_H__ */
diff --git a/arch/arm/mach-bcm283x/include/mach/acpi/bcm2836_gpu.h b/arch/arm/mach-bcm283x/include/mach/acpi/bcm2836_gpu.h
new file mode 100644
index 0000000000..5857d7581a
--- /dev/null
+++ b/arch/arm/mach-bcm283x/include/mach/acpi/bcm2836_gpu.h
@@ -0,0 +1,47 @@
+/* SPDX-License-Identifier: BSD-2-Clause-Patent */
+/**
+ *
+ * Copyright (c) 2020, Pete Batard <pete@akeo.ie>
+ *
+ **/
+
+#include <asm/arch/acpi/bcm2836.h>
+
+#ifndef __BCM2836_GPU_H__
+#define __BCM2836_GPU_H__
+
+/* VideoCore constants */
+
+#define BCM2836_VCHIQ_OFFSET 0x0000B840
+#define BCM2836_VCHIQ_BASE_ADDRESS (BCM2836_SOC_REGISTERS + BCM2836_VCHIQ_OFFSET)
+#define BCM2836_VCHIQ_LENGTH 0x00000010
+
+#define BCM2836_V3D_BUS_OFFSET 0x00C00000
+#define BCM2836_V3D_BUS_BASE_ADDRESS (BCM2836_SOC_REGISTERS + BCM2836_V3D_BUS_OFFSET)
+#define BCM2836_V3D_BUS_LENGTH 0x00001000
+
+#define BCM2836_HVS_OFFSET 0x00400000
+#define BCM2836_HVS_BASE_ADDRESS (BCM2836_SOC_REGISTERS + BCM2836_HVS_OFFSET)
+#define BCM2836_HVS_LENGTH 0x00006000
+
+#define BCM2836_PV0_OFFSET 0x00206000
+#define BCM2836_PV0_BASE_ADDRESS (BCM2836_SOC_REGISTERS + BCM2836_PV0_OFFSET)
+#define BCM2836_PV0_LENGTH 0x00000100
+
+#define BCM2836_PV1_OFFSET 0x00207000
+#define BCM2836_PV1_BASE_ADDRESS (BCM2836_SOC_REGISTERS + BCM2836_PV1_OFFSET)
+#define BCM2836_PV1_LENGTH 0x00000100
+
+#define BCM2836_PV2_OFFSET 0x00807000
+#define BCM2836_PV2_BASE_ADDRESS (BCM2836_SOC_REGISTERS + BCM2836_PV2_OFFSET)
+#define BCM2836_PV2_LENGTH 0x00000100
+
+#define BCM2836_HDMI0_OFFSET 0x00902000
+#define BCM2836_HDMI0_BASE_ADDRESS (BCM2836_SOC_REGISTERS + BCM2836_HDMI0_OFFSET)
+#define BCM2836_HDMI0_LENGTH 0x00000600
+
+#define BCM2836_HDMI1_OFFSET 0x00808000
+#define BCM2836_HDMI1_BASE_ADDRESS (BCM2836_SOC_REGISTERS + BCM2836_HDMI1_OFFSET)
+#define BCM2836_HDMI1_LENGTH 0x00000100
+
+#endif /* __BCM2836_MISC_H__ */
diff --git a/arch/arm/mach-bcm283x/include/mach/acpi/bcm2836_pwm.h b/arch/arm/mach-bcm283x/include/mach/acpi/bcm2836_pwm.h
new file mode 100644
index 0000000000..78a8486673
--- /dev/null
+++ b/arch/arm/mach-bcm283x/include/mach/acpi/bcm2836_pwm.h
@@ -0,0 +1,33 @@
+/* SPDX-License-Identifier: BSD-2-Clause-Patent */
+/**
+ *
+ * Copyright (c) 2020, Pete Batard <pete@akeo.ie>
+ *
+ **/
+
+#include <asm/arch/acpi/bcm2836.h>
+
+#ifndef __BCM2836_PWM_H__
+#define __BCM2836_PWM_H__
+
+/* PWM controller constants */
+
+#define BCM2836_PWM_DMA_OFFSET 0x00007B00
+#define BCM2836_PWM_DMA_BASE_ADDRESS (BCM2836_SOC_REGISTERS + BCM2836_PWM_DMA_OFFSET)
+#define BCM2836_PWM_DMA_LENGTH 0x00000100
+
+#define BCM2836_PWM_CLK_OFFSET 0x001010A0
+#define BCM2836_PWM_CLK_BASE_ADDRESS (BCM2836_SOC_REGISTERS + BCM2836_PWM_CLK_OFFSET)
+#define BCM2836_PWM_CLK_LENGTH 0x00000008
+
+#define BCM2836_PWM_CTRL_OFFSET 0x0020C000
+#define BCM2836_PWM_CTRL_BASE_ADDRESS (BCM2836_SOC_REGISTERS + BCM2836_PWM_CTRL_OFFSET)
+#define BCM2836_PWM_CTRL_LENGTH 0x00000028
+
+#define BCM2836_PWM_BUS_BASE_ADDRESS 0x7E20C000
+#define BCM2836_PWM_BUS_LENGTH 0x00000028
+
+#define BCM2836_PWM_CTRL_UNCACHED_BASE_ADDRESS 0xFF20C000
+#define BCM2836_PWM_CTRL_UNCACHED_LENGTH 0x00000028
+
+#endif /* __BCM2836_PWM_H__ */
diff --git a/arch/arm/mach-bcm283x/include/mach/acpi/bcm2836_sdhost.h b/arch/arm/mach-bcm283x/include/mach/acpi/bcm2836_sdhost.h
new file mode 100644
index 0000000000..9b1afe8440
--- /dev/null
+++ b/arch/arm/mach-bcm283x/include/mach/acpi/bcm2836_sdhost.h
@@ -0,0 +1,18 @@
+/* SPDX-License-Identifier: BSD-2-Clause-Patent */
+/**
+ *
+ * Copyright (c) 2017, Andrei Warkentin <andrey.warkentin@gmail.com>
+ * Copyright (c) Microsoft Corporation. All rights reserved.
+ *
+ **/
+
+#include <asm/arch/acpi/bcm2836.h>
+
+#ifndef __BCM2836_SDHOST_H__
+#define __BCM2836_SDHOST_H__
+
+#define SDHOST_OFFSET 0x00202000
+#define SDHOST_BASE_ADDRESS (BCM2836_SOC_REGISTERS + SDHOST_OFFSET)
+#define SDHOST_LENGTH 0x00000100
+
+#endif /*__BCM2836_SDHOST_H__ */
diff --git a/arch/arm/mach-bcm283x/include/mach/acpi/bcm2836_sdio.h b/arch/arm/mach-bcm283x/include/mach/acpi/bcm2836_sdio.h
new file mode 100644
index 0000000000..48d073d434
--- /dev/null
+++ b/arch/arm/mach-bcm283x/include/mach/acpi/bcm2836_sdio.h
@@ -0,0 +1,21 @@
+/* SPDX-License-Identifier: BSD-2-Clause-Patent */
+/**
+ *
+ * Copyright (c) Microsoft Corporation. All rights reserved.
+ *
+ **/
+
+#include <asm/arch/acpi/bcm2836.h>
+
+#ifndef __BCM2836_SDIO_H__
+#define __BCM2836_SDIO_H__
+
+// MMC/SD/SDIO1 register definitions.
+#define MMCHS1_OFFSET 0x00300000
+#define MMCHS2_OFFSET 0x00340000
+#define MMCHS1_BASE (BCM2836_SOC_REGISTERS + MMCHS1_OFFSET)
+#define MMCHS2_BASE (BCM2836_SOC_REGISTERS + MMCHS2_OFFSET)
+#define MMCHS1_LENGTH 0x00000100
+#define MMCHS2_LENGTH 0x00000100
+
+#endif /* __BCM2836_SDIO_H__ */
diff --git a/drivers/pci/pcie_brcmstb.c b/drivers/pci/pcie_brcmstb.c
index f978c64365..f089c48f02 100644
--- a/drivers/pci/pcie_brcmstb.c
+++ b/drivers/pci/pcie_brcmstb.c
@@ -12,6 +12,7 @@
* Copyright (C) 2020 Nicolas Saenz Julienne <nsaenzjulienne@suse.de>
*/
+#include <asm/arch/acpi/bcm2711.h>
#include <errno.h>
#include <dm.h>
#include <dm/ofnode.h>
@@ -21,88 +22,6 @@
#include <linux/log2.h>
#include <linux/iopoll.h>
-/* Offset of the mandatory PCIe capability config registers */
-#define BRCM_PCIE_CAP_REGS 0x00ac
-
-/* The PCIe controller register offsets */
-#define PCIE_RC_CFG_VENDOR_SPECIFIC_REG1 0x0188
-#define VENDOR_SPECIFIC_REG1_ENDIAN_MODE_BAR2_MASK 0xc
-#define VENDOR_SPECIFIC_REG1_LITTLE_ENDIAN 0x0
-
-#define PCIE_RC_CFG_PRIV1_ID_VAL3 0x043c
-#define CFG_PRIV1_ID_VAL3_CLASS_CODE_MASK 0xffffff
-
-#define PCIE_RC_CFG_PRIV1_LINK_CAPABILITY 0x04dc
-#define PCIE_RC_CFG_PRIV1_LINK_CAPABILITY_ASPM_SUPPORT_MASK 0xc00
-
-#define PCIE_RC_DL_MDIO_ADDR 0x1100
-#define PCIE_RC_DL_MDIO_WR_DATA 0x1104
-#define PCIE_RC_DL_MDIO_RD_DATA 0x1108
-
-#define PCIE_MISC_MISC_CTRL 0x4008
-#define MISC_CTRL_SCB_ACCESS_EN_MASK 0x1000
-#define MISC_CTRL_CFG_READ_UR_MODE_MASK 0x2000
-#define MISC_CTRL_MAX_BURST_SIZE_MASK 0x300000
-#define MISC_CTRL_MAX_BURST_SIZE_128 0x0
-#define MISC_CTRL_SCB0_SIZE_MASK 0xf8000000
-
-#define PCIE_MISC_CPU_2_PCIE_MEM_WIN0_LO 0x400c
-#define PCIE_MEM_WIN0_LO(win) \
- PCIE_MISC_CPU_2_PCIE_MEM_WIN0_LO + ((win) * 4)
-
-#define PCIE_MISC_CPU_2_PCIE_MEM_WIN0_HI 0x4010
-#define PCIE_MEM_WIN0_HI(win) \
- PCIE_MISC_CPU_2_PCIE_MEM_WIN0_HI + ((win) * 4)
-
-#define PCIE_MISC_RC_BAR1_CONFIG_LO 0x402c
-#define RC_BAR1_CONFIG_LO_SIZE_MASK 0x1f
-
-#define PCIE_MISC_RC_BAR2_CONFIG_LO 0x4034
-#define RC_BAR2_CONFIG_LO_SIZE_MASK 0x1f
-#define PCIE_MISC_RC_BAR2_CONFIG_HI 0x4038
-
-#define PCIE_MISC_RC_BAR3_CONFIG_LO 0x403c
-#define RC_BAR3_CONFIG_LO_SIZE_MASK 0x1f
-
-#define PCIE_MISC_PCIE_STATUS 0x4068
-#define STATUS_PCIE_PORT_MASK 0x80
-#define STATUS_PCIE_PORT_SHIFT 7
-#define STATUS_PCIE_DL_ACTIVE_MASK 0x20
-#define STATUS_PCIE_DL_ACTIVE_SHIFT 5
-#define STATUS_PCIE_PHYLINKUP_MASK 0x10
-#define STATUS_PCIE_PHYLINKUP_SHIFT 4
-
-#define PCIE_MISC_CPU_2_PCIE_MEM_WIN0_BASE_LIMIT 0x4070
-#define MEM_WIN0_BASE_LIMIT_LIMIT_MASK 0xfff00000
-#define MEM_WIN0_BASE_LIMIT_BASE_MASK 0xfff0
-#define MEM_WIN0_BASE_LIMIT_BASE_HI_SHIFT 12
-#define PCIE_MEM_WIN0_BASE_LIMIT(win) \
- PCIE_MISC_CPU_2_PCIE_MEM_WIN0_BASE_LIMIT + ((win) * 4)
-
-#define PCIE_MISC_CPU_2_PCIE_MEM_WIN0_BASE_HI 0x4080
-#define MEM_WIN0_BASE_HI_BASE_MASK 0xff
-#define PCIE_MEM_WIN0_BASE_HI(win) \
- PCIE_MISC_CPU_2_PCIE_MEM_WIN0_BASE_HI + ((win) * 8)
-
-#define PCIE_MISC_CPU_2_PCIE_MEM_WIN0_LIMIT_HI 0x4084
-#define PCIE_MEM_WIN0_LIMIT_HI_LIMIT_MASK 0xff
-#define PCIE_MEM_WIN0_LIMIT_HI(win) \
- PCIE_MISC_CPU_2_PCIE_MEM_WIN0_LIMIT_HI + ((win) * 8)
-
-#define PCIE_MISC_HARD_PCIE_HARD_DEBUG 0x4204
-#define PCIE_HARD_DEBUG_SERDES_IDDQ_MASK 0x08000000
-
-#define PCIE_MSI_INTR2_CLR 0x4508
-#define PCIE_MSI_INTR2_MASK_SET 0x4510
-
-#define PCIE_EXT_CFG_DATA 0x8000
-
-#define PCIE_EXT_CFG_INDEX 0x9000
-
-#define PCIE_RGR1_SW_INIT_1 0x9210
-#define RGR1_SW_INIT_1_PERST_MASK 0x1
-#define RGR1_SW_INIT_1_INIT_MASK 0x2
-
/* PCIe parameters */
#define BRCM_NUM_PCIE_OUT_WINS 4
@@ -447,7 +366,7 @@ static int brcm_pcie_probe(struct udevice *dev)
* This will need to be changed when support for other SoCs is added.
*/
setbits_le32(base + PCIE_RGR1_SW_INIT_1,
- RGR1_SW_INIT_1_INIT_MASK | RGR1_SW_INIT_1_PERST_MASK);
+ PCIE_RGR1_SW_INIT_1_INIT_MASK | PCIE_RGR1_SW_INIT_1_PERST_MASK);
/*
* The delay is a safety precaution to preclude the reset signal
* from looking like a glitch.
@@ -455,7 +374,7 @@ static int brcm_pcie_probe(struct udevice *dev)
udelay(100);
/* Take the bridge out of reset */
- clrbits_le32(base + PCIE_RGR1_SW_INIT_1, RGR1_SW_INIT_1_INIT_MASK);
+ clrbits_le32(base + PCIE_RGR1_SW_INIT_1, PCIE_RGR1_SW_INIT_1_INIT_MASK);
clrbits_le32(base + PCIE_MISC_HARD_PCIE_HARD_DEBUG,
PCIE_HARD_DEBUG_SERDES_IDDQ_MASK);
@@ -508,7 +427,7 @@ static int brcm_pcie_probe(struct udevice *dev)
/* Unassert the fundamental reset */
clrbits_le32(pcie->base + PCIE_RGR1_SW_INIT_1,
- RGR1_SW_INIT_1_PERST_MASK);
+ PCIE_RGR1_SW_INIT_1_PERST_MASK);
/*
* Wait for 100ms after PERST# deassertion; see PCIe CEM specification
@@ -552,7 +471,7 @@ static int brcm_pcie_probe(struct udevice *dev)
* a PCIe-PCIe bridge (the default setting is to be EP mode).
*/
clrsetbits_le32(base + PCIE_RC_CFG_PRIV1_ID_VAL3,
- CFG_PRIV1_ID_VAL3_CLASS_CODE_MASK, 0x060400);
+ PCIE_RC_CFG_PRIV1_ID_VAL3_CLASS_CODE_MASK, 0x060400);
if (pcie->ssc) {
ret = brcm_pcie_set_ssc(pcie->base);
@@ -570,8 +489,8 @@ static int brcm_pcie_probe(struct udevice *dev)
nlw, ssc_good ? "(SSC)" : "(!SSC)");
/* PCIe->SCB endian mode for BAR */
- clrsetbits_le32(base + PCIE_RC_CFG_VENDOR_SPECIFIC_REG1,
- VENDOR_SPECIFIC_REG1_ENDIAN_MODE_BAR2_MASK,
+ clrsetbits_le32(base + PCIE_RC_CFG_VENDOR_VENDOR_SPECIFIC_REG1,
+ PCIE_RC_CFG_VENDOR_VENDOR_SPECIFIC_REG1_ENDIAN_MODE_BAR2_MASK,
VENDOR_SPECIFIC_REG1_LITTLE_ENDIAN);
/*
@@ -584,7 +503,7 @@ static int brcm_pcie_probe(struct udevice *dev)
* let's instead just unadvertise ASPM support.
*/
clrbits_le32(base + PCIE_RC_CFG_PRIV1_LINK_CAPABILITY,
- PCIE_RC_CFG_PRIV1_LINK_CAPABILITY_ASPM_SUPPORT_MASK);
+ LINK_CAPABILITY_ASPM_SUPPORT_MASK);
return 0;
}
@@ -595,14 +514,14 @@ static int brcm_pcie_remove(struct udevice *dev)
void __iomem *base = pcie->base;
/* Assert fundamental reset */
- setbits_le32(base + PCIE_RGR1_SW_INIT_1, RGR1_SW_INIT_1_PERST_MASK);
+ setbits_le32(base + PCIE_RGR1_SW_INIT_1, PCIE_RGR1_SW_INIT_1_PERST_MASK);
/* Turn off SerDes */
setbits_le32(base + PCIE_MISC_HARD_PCIE_HARD_DEBUG,
PCIE_HARD_DEBUG_SERDES_IDDQ_MASK);
/* Shutdown bridge */
- setbits_le32(base + PCIE_RGR1_SW_INIT_1, RGR1_SW_INIT_1_INIT_MASK);
+ setbits_le32(base + PCIE_RGR1_SW_INIT_1, PCIE_RGR1_SW_INIT_1_INIT_MASK);
return 0;
}
--
2.46.0
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH v3 18/30] drivers/cpu: Add generic armv8 cpu driver
2024-09-11 6:24 ` [PATCH v3 18/30] drivers/cpu: Add generic armv8 cpu driver Patrick Rudolph
@ 2024-09-11 9:41 ` Peter Robinson
2024-09-12 1:01 ` Simon Glass
1 sibling, 0 replies; 14+ messages in thread
From: Peter Robinson @ 2024-09-11 9:41 UTC (permalink / raw)
To: Patrick Rudolph; +Cc: u-boot, linux-kernel, Tom Rini, Simon Glass
Hi Patrick,
> Add a generic driver that binds to armv8 CPU nodes.
What is the purpose of this driver? Someone reading this should be
able to ascertain the point of this from the git log at some point in
the future, what does binding a generic driver to the cpu nodes
achieve?
> TEST: Booted on QEMU sbsa and verify the driver binds to CPU nodes.
> Confirmed with FWTS that all ACPI processor devices are present.
This comment I think should be below the -- bit
> Signed-off-by: Patrick Rudolph <patrick.rudolph@9elements.com>
> Cc: Tom Rini <trini@konsulko.com>
> Cc: Simon Glass <sjg@chromium.org>
> ---
> drivers/cpu/Kconfig | 6 +++
> drivers/cpu/Makefile | 2 +
> drivers/cpu/armv8_cpu.c | 90 +++++++++++++++++++++++++++++++++++++++++
> 3 files changed, 98 insertions(+)
> create mode 100644 drivers/cpu/armv8_cpu.c
>
> diff --git a/drivers/cpu/Kconfig b/drivers/cpu/Kconfig
> index 5c06cd9f60..9c0df331d7 100644
> --- a/drivers/cpu/Kconfig
> +++ b/drivers/cpu/Kconfig
> @@ -26,6 +26,12 @@ config CPU_RISCV
> help
> Support CPU cores for RISC-V architecture.
>
> +config CPU_ARMV8
> + bool "Enable generic ARMv8 CPU driver"
> + depends on CPU && ARM64
> + help
> + Support CPU cores for armv8 architecture.
> +
> config CPU_MICROBLAZE
> bool "Enable Microblaze CPU driver"
> depends on CPU && MICROBLAZE
> diff --git a/drivers/cpu/Makefile b/drivers/cpu/Makefile
> index bc75d9b974..773395693a 100644
> --- a/drivers/cpu/Makefile
> +++ b/drivers/cpu/Makefile
> @@ -6,10 +6,12 @@
>
> obj-$(CONFIG_CPU) += cpu-uclass.o
>
> +
> obj-$(CONFIG_ARCH_BMIPS) += bmips_cpu.o
> obj-$(CONFIG_ARCH_IMX8) += imx8_cpu.o
> obj-$(CONFIG_ARCH_AT91) += at91_cpu.o
> obj-$(CONFIG_ARCH_MEDIATEK) += mtk_cpu.o
> +obj-$(CONFIG_CPU_ARMV8) += armv8_cpu.o
> obj-$(CONFIG_CPU_IMX) += imx8_cpu.o
> obj-$(CONFIG_CPU_MPC83XX) += mpc83xx_cpu.o
> obj-$(CONFIG_CPU_RISCV) += riscv_cpu.o
> diff --git a/drivers/cpu/armv8_cpu.c b/drivers/cpu/armv8_cpu.c
> new file mode 100644
> index 0000000000..08b8d45f6f
> --- /dev/null
> +++ b/drivers/cpu/armv8_cpu.c
> @@ -0,0 +1,90 @@
> +// SPDX-License-Identifier: GPL-2.0+
> +/*
> + * Copyright 2019 Broadcom.
> + */
> +#include <acpi/acpigen.h>
> +#include <asm/armv8/cpu.h>
> +#include <cpu.h>
> +#include <dm.h>
> +#include <dm/acpi.h>
> +#include <asm/io.h>
> +#include <linux/bitops.h>
> +#include <linux/printk.h>
> +#include <linux/sizes.h>
> +
> +static int armv8_cpu_get_desc(const struct udevice *dev, char *buf, int size)
> +{
> + int cpuid;
> +
> + cpuid = (read_midr() & MIDR_PARTNUM_MASK) >> MIDR_PARTNUM_SHIFT;
> +
> + snprintf(buf, size, "CPU MIDR %04x", cpuid);
> +
> + return 0;
> +}
> +
> +static int armv8_cpu_get_info(const struct udevice *dev,
> + struct cpu_info *info)
> +{
> + info->cpu_freq = 0;
> + info->features = BIT(CPU_FEAT_L1_CACHE) | BIT(CPU_FEAT_MMU);
> +
> + return 0;
> +}
> +
> +static int armv8_cpu_get_count(const struct udevice *dev)
> +{
> + ofnode node;
> + int num = 0;
> +
> + ofnode_for_each_subnode(node, dev_ofnode(dev->parent)) {
> + const char *device_type;
> +
> + if (!ofnode_is_enabled(node))
> + continue;
> +
> + device_type = ofnode_read_string(node, "device_type");
> + if (!device_type)
> + continue;
> +
> + if (!strcmp(device_type, "cpu"))
> + num++;
> + }
> +
> + return num;
> +}
> +
> +#ifdef CONFIG_ACPIGEN
> +static int acpi_cpu_fill_ssdt(const struct udevice *dev, struct acpi_ctx *ctx)
> +{
> + uint core_id = dev_seq(dev);
> +
> + acpigen_write_processor_device(ctx, core_id);
> +
> + return 0;
> +}
> +
> +struct acpi_ops armv8_cpu_acpi_ops = {
> + .fill_ssdt = acpi_cpu_fill_ssdt,
> +};
> +#endif
> +
> +static const struct cpu_ops cpu_ops = {
> + .get_count = armv8_cpu_get_count,
> + .get_desc = armv8_cpu_get_desc,
> + .get_info = armv8_cpu_get_info,
> +};
> +
> +static const struct udevice_id cpu_ids[] = {
> + { .compatible = "arm,armv8" },
> + {}
> +};
> +
> +U_BOOT_DRIVER(arm_cpu) = {
> + .name = "arm-cpu",
> + .id = UCLASS_CPU,
> + .of_match = cpu_ids,
> + .ops = &cpu_ops,
> + .flags = DM_FLAG_PRE_RELOC,
> + ACPI_OPS_PTR(&armv8_cpu_acpi_ops)
> +};
> --
> 2.46.0
>
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH v3 20/30] drivers/arm: Implement acpi_fill_madt
2024-09-11 6:24 ` [PATCH v3 20/30] drivers/arm: Implement acpi_fill_madt Patrick Rudolph
@ 2024-09-12 0:58 ` Simon Glass
2024-09-12 6:31 ` Patrick Rudolph
0 siblings, 1 reply; 14+ messages in thread
From: Simon Glass @ 2024-09-12 0:58 UTC (permalink / raw)
To: Patrick Rudolph; +Cc: u-boot, linux-kernel, Tom Rini
Hi Patrick,
On Wed, 11 Sept 2024 at 00:25, Patrick Rudolph
<patrick.rudolph@9elements.com> wrote:
>
> Fill the MADT table in the GIC driver and armv8 CPU driver to
> drop SoC specific code. While the GIC only needs devicetree
> data, the CPU driver needs additional information stored in
> the cpu_plat struct.
>
> While on it update the only board making use of the existing
> drivers and writing ACPI MADT in mainboard code.
>
> TEST: Booted on QEMU sbsa using driver model generated MADT.
> Signed-off-by: Patrick Rudolph <patrick.rudolph@9elements.com>
> Cc: Simon Glass <sjg@chromium.org>
> ---
> arch/arm/lib/acpi_table.c | 1 +
> arch/arm/lib/gic-v3-its.c | 89 ++++++++++++++++++++++++++++++++++++++-
> drivers/cpu/armv8_cpu.c | 27 ++++++++++++
> include/cpu.h | 27 +++++++++++-
> 4 files changed, 141 insertions(+), 3 deletions(-)
Reviewed-by: Simon Glass <sjg@chromium.org>
Are the GIC values available by probing, or are they just 'known', and
dependent on the compatible string?
Regards,
Simon
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH v3 24/30] arm: mach-bcm283x: Bring in some header files from tianocore
2024-09-11 6:24 ` [PATCH v3 24/30] arm: mach-bcm283x: Bring in some header files from tianocore Patrick Rudolph
@ 2024-09-12 0:58 ` Simon Glass
0 siblings, 0 replies; 14+ messages in thread
From: Simon Glass @ 2024-09-12 0:58 UTC (permalink / raw)
To: Patrick Rudolph
Cc: u-boot, linux-kernel, Matthias Brugger, Peter Robinson, Tom Rini
On Wed, 11 Sept 2024 at 00:26, Patrick Rudolph
<patrick.rudolph@9elements.com> wrote:
>
> From: Simon Glass <sjg@chromium.org>
>
> These header files presumably duplicate things already in the U-Boot
> devicetree. For now, bring them in to get the ASL code and ACPI table
> code to compile.
>
> Signed-off-by: Simon Glass <sjg@chromium.org>
> Signed-off-by: Patrick Rudolph <patrick.rudolph@9elements.com>
> Cc: Matthias Brugger <mbrugger@suse.com>
> Cc: Peter Robinson <pbrobinson@gmail.com>
> Cc: Tom Rini <trini@konsulko.com>
> ---
> .../mach-bcm283x/include/mach/acpi/bcm2711.h | 152 ++++++++++++++++++
> .../mach-bcm283x/include/mach/acpi/bcm2836.h | 127 +++++++++++++++
> .../include/mach/acpi/bcm2836_gpio.h | 19 +++
> .../include/mach/acpi/bcm2836_gpu.h | 47 ++++++
> .../include/mach/acpi/bcm2836_pwm.h | 33 ++++
> .../include/mach/acpi/bcm2836_sdhost.h | 18 +++
> .../include/mach/acpi/bcm2836_sdio.h | 21 +++
> drivers/pci/pcie_brcmstb.c | 101 ++----------
> 8 files changed, 427 insertions(+), 91 deletions(-)
> create mode 100644 arch/arm/mach-bcm283x/include/mach/acpi/bcm2711.h
> create mode 100644 arch/arm/mach-bcm283x/include/mach/acpi/bcm2836.h
> create mode 100644 arch/arm/mach-bcm283x/include/mach/acpi/bcm2836_gpio.h
> create mode 100644 arch/arm/mach-bcm283x/include/mach/acpi/bcm2836_gpu.h
> create mode 100644 arch/arm/mach-bcm283x/include/mach/acpi/bcm2836_pwm.h
> create mode 100644 arch/arm/mach-bcm283x/include/mach/acpi/bcm2836_sdhost.h
> create mode 100644 arch/arm/mach-bcm283x/include/mach/acpi/bcm2836_sdio.h
>
Reviewed-by: Simon Glass <sjg@chromium.org>
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH v3 19/30] arm: gic-v3-its: Rename objects
2024-09-11 6:24 ` [PATCH v3 19/30] arm: gic-v3-its: Rename objects Patrick Rudolph
@ 2024-09-12 0:58 ` Simon Glass
2024-09-12 6:52 ` Patrick Rudolph
0 siblings, 1 reply; 14+ messages in thread
From: Simon Glass @ 2024-09-12 0:58 UTC (permalink / raw)
To: Patrick Rudolph; +Cc: u-boot, linux-kernel, Tom Rini
Hi Patrick,
On Wed, 11 Sept 2024 at 00:29, Patrick Rudolph
<patrick.rudolph@9elements.com> wrote:
>
> The code accesses the gic-v3 node, but not the gic-v3-its node,
> thus rename the objects to clarify which node it operates on.
>
> The following commit will make use of the gic-v3-its node for real.
>
> Signed-off-by: Patrick Rudolph <patrick.rudolph@9elements.com>
> ---
> arch/arm/lib/gic-v3-its.c | 10 +++++-----
> 1 file changed, 5 insertions(+), 5 deletions(-)
Reviewed-by: Simon Glass <sjg@chromium.org>
But how many interrupt controllers are there? Would
uclass_first_device_err(UCLASS_IRQ) work?
>
> diff --git a/arch/arm/lib/gic-v3-its.c b/arch/arm/lib/gic-v3-its.c
> index 2cc0a32f9d..22fa46a341 100644
> --- a/arch/arm/lib/gic-v3-its.c
> +++ b/arch/arm/lib/gic-v3-its.c
> @@ -35,10 +35,10 @@ static int gic_v3_its_get_gic_addr(struct gic_v3_its_priv *priv)
> int ret;
>
> ret = uclass_get_device_by_driver(UCLASS_IRQ,
> - DM_DRIVER_GET(arm_gic_v3_its), &dev);
> + DM_DRIVER_GET(arm_gic_v3), &dev);
> if (ret) {
> pr_err("%s: failed to get %s irq device\n", __func__,
> - DM_DRIVER_GET(arm_gic_v3_its)->name);
> + DM_DRIVER_GET(arm_gic_v3)->name);
> return ret;
> }
>
> @@ -158,13 +158,13 @@ int gic_lpi_tables_init(u64 base, u32 num_redist)
> return 0;
> }
>
> -static const struct udevice_id gic_v3_its_ids[] = {
> +static const struct udevice_id gic_v3_ids[] = {
> { .compatible = "arm,gic-v3" },
> {}
> };
>
> -U_BOOT_DRIVER(arm_gic_v3_its) = {
> +U_BOOT_DRIVER(arm_gic_v3) = {
> .name = "gic-v3",
> .id = UCLASS_IRQ,
> - .of_match = gic_v3_its_ids,
> + .of_match = gic_v3_ids,
> };
> --
> 2.46.0
>
Regards,
Simon
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH v3 21/30] common: Enable BLOBLIST_TABLES on arm
2024-09-11 6:24 ` [PATCH v3 21/30] common: Enable BLOBLIST_TABLES on arm Patrick Rudolph
@ 2024-09-12 0:58 ` Simon Glass
0 siblings, 0 replies; 14+ messages in thread
From: Simon Glass @ 2024-09-12 0:58 UTC (permalink / raw)
To: Patrick Rudolph; +Cc: u-boot, linux-kernel, Tom Rini
On Wed, 11 Sept 2024 at 00:29, Patrick Rudolph
<patrick.rudolph@9elements.com> wrote:
>
> Allow to use BLOBLIST_TABLES on arm to store ACPI or other tables.
>
> Signed-off-by: Patrick Rudolph <patrick.rudolph@9elements.com>
> Cc: Tom Rini <trini@konsulko.com>
> ---
> common/Kconfig | 1 +
> lib/Kconfig | 15 +++++++++------
> 2 files changed, 10 insertions(+), 6 deletions(-)
Reviewed-by: Simon Glass <sjg@chromium.org>
>
> diff --git a/common/Kconfig b/common/Kconfig
> index 83c81edac2..a864e24508 100644
> --- a/common/Kconfig
> +++ b/common/Kconfig
> @@ -1075,6 +1075,7 @@ config BLOBLIST_SIZE_RELOC
> hex "Size of bloblist after relocation"
> default BLOBLIST_SIZE if BLOBLIST_FIXED || BLOBLIST_ALLOC
> default 0x0 if BLOBLIST_PASSAGE
> + default 0x20000 if (ARM && EFI_LOADER && GENERATE_ACPI_TABLE)
> help
> Sets the size of the bloblist in bytes after relocation. Since U-Boot
> has a lot more memory available then, it is possible to use a larger
> diff --git a/lib/Kconfig b/lib/Kconfig
> index 2059219a12..ea444354eb 100644
> --- a/lib/Kconfig
> +++ b/lib/Kconfig
> @@ -983,12 +983,15 @@ menu "System tables"
>
> config BLOBLIST_TABLES
> bool "Put tables in a bloblist"
> - depends on X86 && BLOBLIST
> - help
> - Normally tables are placed at address 0xf0000 and can be up to 64KB
> - long. With this option, tables are instead placed in the bloblist
> - with a pointer from 0xf0000. The size can then be larger and the
> - tables can be placed high in memory.
> + depends on BLOBLIST
> + default y if (ARM && EFI_LOADER && GENERATE_ACPI_TABLE)
> + default n
> + help
> + On x86 normally tables are placed at address 0xf0000 and can be up
> + to 64KB long. With this option, tables are instead placed in the
> + bloblist with a pointer from 0xf0000. The size can then be larger
Since you are changing this, you might as well drop the 0x here as it
is implied in U-Boot.
> + and the tables can be placed high in memory.
> + On other architectures the tables are always placed in high memory.
>
> config GENERATE_SMBIOS_TABLE
> bool "Generate an SMBIOS (System Management BIOS) table"
> --
> 2.46.0
>
Regards,
Simon
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH v3 18/30] drivers/cpu: Add generic armv8 cpu driver
2024-09-11 6:24 ` [PATCH v3 18/30] drivers/cpu: Add generic armv8 cpu driver Patrick Rudolph
2024-09-11 9:41 ` Peter Robinson
@ 2024-09-12 1:01 ` Simon Glass
1 sibling, 0 replies; 14+ messages in thread
From: Simon Glass @ 2024-09-12 1:01 UTC (permalink / raw)
To: Patrick Rudolph; +Cc: u-boot, linux-kernel, Tom Rini
Hi Patrick,
On Wed, 11 Sept 2024 at 00:25, Patrick Rudolph
<patrick.rudolph@9elements.com> wrote:
>
> Add a generic driver that binds to armv8 CPU nodes.
>
> TEST: Booted on QEMU sbsa and verify the driver binds to CPU nodes.
> Confirmed with FWTS that all ACPI processor devices are present.
>
> Signed-off-by: Patrick Rudolph <patrick.rudolph@9elements.com>
> Cc: Tom Rini <trini@konsulko.com>
> Cc: Simon Glass <sjg@chromium.org>
> ---
> drivers/cpu/Kconfig | 6 +++
> drivers/cpu/Makefile | 2 +
> drivers/cpu/armv8_cpu.c | 90 +++++++++++++++++++++++++++++++++++++++++
> 3 files changed, 98 insertions(+)
> create mode 100644 drivers/cpu/armv8_cpu.c
>
> diff --git a/drivers/cpu/Kconfig b/drivers/cpu/Kconfig
> index 5c06cd9f60..9c0df331d7 100644
> --- a/drivers/cpu/Kconfig
> +++ b/drivers/cpu/Kconfig
> @@ -26,6 +26,12 @@ config CPU_RISCV
> help
> Support CPU cores for RISC-V architecture.
>
> +config CPU_ARMV8
> + bool "Enable generic ARMv8 CPU driver"
> + depends on CPU && ARM64
> + help
> + Support CPU cores for armv8 architecture.
add more detail (as per Peter's comments)
> +
> config CPU_MICROBLAZE
> bool "Enable Microblaze CPU driver"
> depends on CPU && MICROBLAZE
> diff --git a/drivers/cpu/Makefile b/drivers/cpu/Makefile
> index bc75d9b974..773395693a 100644
> --- a/drivers/cpu/Makefile
> +++ b/drivers/cpu/Makefile
> @@ -6,10 +6,12 @@
>
> obj-$(CONFIG_CPU) += cpu-uclass.o
>
> +
drop
> obj-$(CONFIG_ARCH_BMIPS) += bmips_cpu.o
> obj-$(CONFIG_ARCH_IMX8) += imx8_cpu.o
> obj-$(CONFIG_ARCH_AT91) += at91_cpu.o
> obj-$(CONFIG_ARCH_MEDIATEK) += mtk_cpu.o
> +obj-$(CONFIG_CPU_ARMV8) += armv8_cpu.o
> obj-$(CONFIG_CPU_IMX) += imx8_cpu.o
> obj-$(CONFIG_CPU_MPC83XX) += mpc83xx_cpu.o
> obj-$(CONFIG_CPU_RISCV) += riscv_cpu.o
> diff --git a/drivers/cpu/armv8_cpu.c b/drivers/cpu/armv8_cpu.c
> new file mode 100644
> index 0000000000..08b8d45f6f
> --- /dev/null
> +++ b/drivers/cpu/armv8_cpu.c
> @@ -0,0 +1,90 @@
> +// SPDX-License-Identifier: GPL-2.0+
> +/*
> + * Copyright 2019 Broadcom.
> + */
> +#include <acpi/acpigen.h>
> +#include <asm/armv8/cpu.h>
> +#include <cpu.h>
> +#include <dm.h>
> +#include <dm/acpi.h>
> +#include <asm/io.h>
> +#include <linux/bitops.h>
> +#include <linux/printk.h>
> +#include <linux/sizes.h>
> +
> +static int armv8_cpu_get_desc(const struct udevice *dev, char *buf, int size)
> +{
> + int cpuid;
> +
> + cpuid = (read_midr() & MIDR_PARTNUM_MASK) >> MIDR_PARTNUM_SHIFT;
> +
> + snprintf(buf, size, "CPU MIDR %04x", cpuid);
> +
> + return 0;
> +}
> +
> +static int armv8_cpu_get_info(const struct udevice *dev,
> + struct cpu_info *info)
> +{
> + info->cpu_freq = 0;
> + info->features = BIT(CPU_FEAT_L1_CACHE) | BIT(CPU_FEAT_MMU);
> +
> + return 0;
> +}
> +
> +static int armv8_cpu_get_count(const struct udevice *dev)
> +{
> + ofnode node;
> + int num = 0;
> +
> + ofnode_for_each_subnode(node, dev_ofnode(dev->parent)) {
> + const char *device_type;
> +
> + if (!ofnode_is_enabled(node))
> + continue;
> +
> + device_type = ofnode_read_string(node, "device_type");
> + if (!device_type)
> + continue;
> +
> + if (!strcmp(device_type, "cpu"))
> + num++;
> + }
> +
> + return num;
Isn't this uclass_id_count(UCLASS_CPU) ?
> +}
> +
> +#ifdef CONFIG_ACPIGEN
> +static int acpi_cpu_fill_ssdt(const struct udevice *dev, struct acpi_ctx *ctx)
> +{
> + uint core_id = dev_seq(dev);
> +
> + acpigen_write_processor_device(ctx, core_id);
error checking?
> +
> + return 0;
> +}
> +
> +struct acpi_ops armv8_cpu_acpi_ops = {
> + .fill_ssdt = acpi_cpu_fill_ssdt,
> +};
> +#endif
> +
> +static const struct cpu_ops cpu_ops = {
> + .get_count = armv8_cpu_get_count,
> + .get_desc = armv8_cpu_get_desc,
> + .get_info = armv8_cpu_get_info,
> +};
> +
> +static const struct udevice_id cpu_ids[] = {
> + { .compatible = "arm,armv8" },
> + {}
> +};
> +
> +U_BOOT_DRIVER(arm_cpu) = {
> + .name = "arm-cpu",
> + .id = UCLASS_CPU,
> + .of_match = cpu_ids,
> + .ops = &cpu_ops,
> + .flags = DM_FLAG_PRE_RELOC,
> + ACPI_OPS_PTR(&armv8_cpu_acpi_ops)
> +};
> --
> 2.46.0
>
Regards,
Simon
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH v3 20/30] drivers/arm: Implement acpi_fill_madt
2024-09-12 0:58 ` Simon Glass
@ 2024-09-12 6:31 ` Patrick Rudolph
2024-09-16 15:41 ` Simon Glass
0 siblings, 1 reply; 14+ messages in thread
From: Patrick Rudolph @ 2024-09-12 6:31 UTC (permalink / raw)
To: Simon Glass; +Cc: u-boot, linux-kernel, Tom Rini
On Thu, Sep 12, 2024 at 2:58 AM Simon Glass <sjg@chromium.org> wrote:
>
> Hi Patrick,
>
> On Wed, 11 Sept 2024 at 00:25, Patrick Rudolph
> <patrick.rudolph@9elements.com> wrote:
> >
> > Fill the MADT table in the GIC driver and armv8 CPU driver to
> > drop SoC specific code. While the GIC only needs devicetree
> > data, the CPU driver needs additional information stored in
> > the cpu_plat struct.
> >
> > While on it update the only board making use of the existing
> > drivers and writing ACPI MADT in mainboard code.
> >
> > TEST: Booted on QEMU sbsa using driver model generated MADT.
> > Signed-off-by: Patrick Rudolph <patrick.rudolph@9elements.com>
> > Cc: Simon Glass <sjg@chromium.org>
> > ---
> > arch/arm/lib/acpi_table.c | 1 +
> > arch/arm/lib/gic-v3-its.c | 89 ++++++++++++++++++++++++++++++++++++++-
> > drivers/cpu/armv8_cpu.c | 27 ++++++++++++
> > include/cpu.h | 27 +++++++++++-
> > 4 files changed, 141 insertions(+), 3 deletions(-)
>
> Reviewed-by: Simon Glass <sjg@chromium.org>
>
> Are the GIC values available by probing, or are they just 'known', and
> dependent on the compatible string?
Sorry I don't get that question.
The "arm_gic_v3_its" and "arm_gic_v3" driver uses existing DT
properties and should work with all existing boards.
The madt_gicc entries are board specific. Besides the mpidr all of
them can be 0.
Those entries currently do not have matching DT properties in the CPU
node that could be used.
Some of those entries are present in the GIC node, but there's no
direct association between CPU nodes and GIC nodes.
>
> Regards,
> Simon
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH v3 19/30] arm: gic-v3-its: Rename objects
2024-09-12 0:58 ` Simon Glass
@ 2024-09-12 6:52 ` Patrick Rudolph
0 siblings, 0 replies; 14+ messages in thread
From: Patrick Rudolph @ 2024-09-12 6:52 UTC (permalink / raw)
To: Simon Glass; +Cc: u-boot, linux-kernel, Tom Rini
On Thu, Sep 12, 2024 at 2:59 AM Simon Glass <sjg@chromium.org> wrote:
>
> Hi Patrick,
>
> On Wed, 11 Sept 2024 at 00:29, Patrick Rudolph
> <patrick.rudolph@9elements.com> wrote:
> >
> > The code accesses the gic-v3 node, but not the gic-v3-its node,
> > thus rename the objects to clarify which node it operates on.
> >
> > The following commit will make use of the gic-v3-its node for real.
> >
> > Signed-off-by: Patrick Rudolph <patrick.rudolph@9elements.com>
> > ---
> > arch/arm/lib/gic-v3-its.c | 10 +++++-----
> > 1 file changed, 5 insertions(+), 5 deletions(-)
>
> Reviewed-by: Simon Glass <sjg@chromium.org>
>
> But how many interrupt controllers are there? Would
> uclass_first_device_err(UCLASS_IRQ) work?
On most GICv2 compatible SBCs there's just one.
With GICv3+ you can have an additional GIC ITS as well, which would
also use class UCLASS_IRQ.
But on servers there even more than two...
I'd prefer the current code as it would work with the follow up commit
that adds another
UCLASS_IRQ driver.
>
> >
> > diff --git a/arch/arm/lib/gic-v3-its.c b/arch/arm/lib/gic-v3-its.c
> > index 2cc0a32f9d..22fa46a341 100644
> > --- a/arch/arm/lib/gic-v3-its.c
> > +++ b/arch/arm/lib/gic-v3-its.c
> > @@ -35,10 +35,10 @@ static int gic_v3_its_get_gic_addr(struct gic_v3_its_priv *priv)
> > int ret;
> >
> > ret = uclass_get_device_by_driver(UCLASS_IRQ,
> > - DM_DRIVER_GET(arm_gic_v3_its), &dev);
> > + DM_DRIVER_GET(arm_gic_v3), &dev);
> > if (ret) {
> > pr_err("%s: failed to get %s irq device\n", __func__,
> > - DM_DRIVER_GET(arm_gic_v3_its)->name);
> > + DM_DRIVER_GET(arm_gic_v3)->name);
> > return ret;
> > }
> >
> > @@ -158,13 +158,13 @@ int gic_lpi_tables_init(u64 base, u32 num_redist)
> > return 0;
> > }
> >
> > -static const struct udevice_id gic_v3_its_ids[] = {
> > +static const struct udevice_id gic_v3_ids[] = {
> > { .compatible = "arm,gic-v3" },
> > {}
> > };
> >
> > -U_BOOT_DRIVER(arm_gic_v3_its) = {
> > +U_BOOT_DRIVER(arm_gic_v3) = {
> > .name = "gic-v3",
> > .id = UCLASS_IRQ,
> > - .of_match = gic_v3_its_ids,
> > + .of_match = gic_v3_ids,
> > };
> > --
> > 2.46.0
> >
>
> Regards,
> Simon
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH v3 20/30] drivers/arm: Implement acpi_fill_madt
2024-09-12 6:31 ` Patrick Rudolph
@ 2024-09-16 15:41 ` Simon Glass
0 siblings, 0 replies; 14+ messages in thread
From: Simon Glass @ 2024-09-16 15:41 UTC (permalink / raw)
To: Patrick Rudolph; +Cc: u-boot, linux-kernel, Tom Rini
Hi Patrick,
On Thu, 12 Sept 2024 at 00:31, Patrick Rudolph
<patrick.rudolph@9elements.com> wrote:
>
> On Thu, Sep 12, 2024 at 2:58 AM Simon Glass <sjg@chromium.org> wrote:
> >
> > Hi Patrick,
> >
> > On Wed, 11 Sept 2024 at 00:25, Patrick Rudolph
> > <patrick.rudolph@9elements.com> wrote:
> > >
> > > Fill the MADT table in the GIC driver and armv8 CPU driver to
> > > drop SoC specific code. While the GIC only needs devicetree
> > > data, the CPU driver needs additional information stored in
> > > the cpu_plat struct.
> > >
> > > While on it update the only board making use of the existing
> > > drivers and writing ACPI MADT in mainboard code.
> > >
> > > TEST: Booted on QEMU sbsa using driver model generated MADT.
> > > Signed-off-by: Patrick Rudolph <patrick.rudolph@9elements.com>
> > > Cc: Simon Glass <sjg@chromium.org>
> > > ---
> > > arch/arm/lib/acpi_table.c | 1 +
> > > arch/arm/lib/gic-v3-its.c | 89 ++++++++++++++++++++++++++++++++++++++-
> > > drivers/cpu/armv8_cpu.c | 27 ++++++++++++
> > > include/cpu.h | 27 +++++++++++-
> > > 4 files changed, 141 insertions(+), 3 deletions(-)
> >
> > Reviewed-by: Simon Glass <sjg@chromium.org>
> >
> > Are the GIC values available by probing, or are they just 'known', and
> > dependent on the compatible string?
> Sorry I don't get that question.
>
> The "arm_gic_v3_its" and "arm_gic_v3" driver uses existing DT
> properties and should work with all existing boards.
>
> The madt_gicc entries are board specific. Besides the mpidr all of
> them can be 0.
> Those entries currently do not have matching DT properties in the CPU
> node that could be used.
> Some of those entries are present in the GIC node, but there's no
> direct association between CPU nodes and GIC nodes.
If they are board-specific then they should depend on the board
compatible-string, assuming they cannot be read from the devicetree.
The properties should be set in the driver, though.
This might be the sort of situation where the GIC binding leaves out
stuff and Linux fills it in from internal data? Or perhaps Linux just
doesn't care about these features of the GIC?
Regards,
Simon
^ permalink raw reply [flat|nested] 14+ messages in thread
end of thread, other threads:[~2024-09-16 15:41 UTC | newest]
Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <20240911062511.494855-1-patrick.rudolph@9elements.com>
2024-09-11 6:24 ` [PATCH v3 18/30] drivers/cpu: Add generic armv8 cpu driver Patrick Rudolph
2024-09-11 9:41 ` Peter Robinson
2024-09-12 1:01 ` Simon Glass
2024-09-11 6:24 ` [PATCH v3 19/30] arm: gic-v3-its: Rename objects Patrick Rudolph
2024-09-12 0:58 ` Simon Glass
2024-09-12 6:52 ` Patrick Rudolph
2024-09-11 6:24 ` [PATCH v3 20/30] drivers/arm: Implement acpi_fill_madt Patrick Rudolph
2024-09-12 0:58 ` Simon Glass
2024-09-12 6:31 ` Patrick Rudolph
2024-09-16 15:41 ` Simon Glass
2024-09-11 6:24 ` [PATCH v3 21/30] common: Enable BLOBLIST_TABLES on arm Patrick Rudolph
2024-09-12 0:58 ` Simon Glass
2024-09-11 6:24 ` [PATCH v3 24/30] arm: mach-bcm283x: Bring in some header files from tianocore Patrick Rudolph
2024-09-12 0:58 ` Simon Glass
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®