Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/1965618/?format=api
{ "id": 1965618, "url": "http://patchwork.ozlabs.org/api/patches/1965618/?format=api", "web_url": "http://patchwork.ozlabs.org/project/uboot/patch/20240727071742.1735703-13-patrick.rudolph@9elements.com/", "project": { "id": 18, "url": "http://patchwork.ozlabs.org/api/projects/18/?format=api", "name": "U-Boot", "link_name": "uboot", "list_id": "u-boot.lists.denx.de", "list_email": "u-boot@lists.denx.de", "web_url": null, "scm_url": null, "webscm_url": null, "list_archive_url": "", "list_archive_url_format": "", "commit_url_format": "" }, "msgid": "<20240727071742.1735703-13-patrick.rudolph@9elements.com>", "list_archive_url": null, "date": "2024-07-27T07:17:13", "name": "[12/17] arm: bcm283x: Write ACPI tables", "commit_ref": null, "pull_url": null, "state": "changes-requested", "archived": false, "hash": "4e41ebfaca7d0f407e752f1572b2acca674cf7f3", "submitter": { "id": 83069, "url": "http://patchwork.ozlabs.org/api/people/83069/?format=api", "name": "Patrick Rudolph", "email": "patrick.rudolph@9elements.com" }, "delegate": { "id": 3184, "url": "http://patchwork.ozlabs.org/api/users/3184/?format=api", "username": "sjg", "first_name": "Simon", "last_name": "Glass", "email": "sjg@chromium.org" }, "mbox": "http://patchwork.ozlabs.org/project/uboot/patch/20240727071742.1735703-13-patrick.rudolph@9elements.com/mbox/", "series": [ { "id": 416851, "url": "http://patchwork.ozlabs.org/api/series/416851/?format=api", "web_url": "http://patchwork.ozlabs.org/project/uboot/list/?series=416851", "date": "2024-07-27T07:17:01", "name": "Implement ACPI on aarch64", "version": 1, "mbox": "http://patchwork.ozlabs.org/series/416851/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/1965618/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/1965618/checks/", "tags": {}, "related": [], "headers": { "Return-Path": "<u-boot-bounces@lists.denx.de>", "X-Original-To": "incoming@patchwork.ozlabs.org", "Delivered-To": "patchwork-incoming@legolas.ozlabs.org", "Authentication-Results": [ "legolas.ozlabs.org;\n\tdkim=pass (2048-bit key;\n secure) header.d=9elements.com header.i=@9elements.com header.a=rsa-sha256\n header.s=google header.b=evyI4qHW;\n\tdkim-atps=neutral", "legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de\n (client-ip=85.214.62.61; helo=phobos.denx.de;\n envelope-from=u-boot-bounces@lists.denx.de; receiver=patchwork.ozlabs.org)", "phobos.denx.de;\n dmarc=pass (p=quarantine dis=none) header.from=9elements.com", "phobos.denx.de;\n spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de", "phobos.denx.de;\n\tdkim=pass (2048-bit key;\n secure) header.d=9elements.com header.i=@9elements.com header.b=\"evyI4qHW\";\n\tdkim-atps=neutral", "phobos.denx.de; dmarc=pass (p=quarantine dis=none)\n header.from=9elements.com", "phobos.denx.de;\n spf=pass smtp.mailfrom=patrick.rudolph@9elements.com" ], "Received": [ "from phobos.denx.de (phobos.denx.de [85.214.62.61])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange X25519 server-signature ECDSA (secp384r1))\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4WWGKW32N6z1yY3\n\tfor <incoming@patchwork.ozlabs.org>; Sat, 27 Jul 2024 17:22:22 +1000 (AEST)", "from h2850616.stratoserver.net (localhost [IPv6:::1])\n\tby phobos.denx.de (Postfix) with ESMTP id B69308875B;\n\tSat, 27 Jul 2024 09:20:32 +0200 (CEST)", "by phobos.denx.de (Postfix, from userid 109)\n id 4AE23885AE; Sat, 27 Jul 2024 09:20:31 +0200 (CEST)", "from mail-ej1-x62e.google.com (mail-ej1-x62e.google.com\n [IPv6:2a00:1450:4864:20::62e])\n (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits))\n (No client certificate requested)\n by phobos.denx.de (Postfix) with ESMTPS id EABBF8877E\n for <u-boot@lists.denx.de>; Sat, 27 Jul 2024 09:20:28 +0200 (CEST)", "by mail-ej1-x62e.google.com with SMTP id\n a640c23a62f3a-a7a8553db90so312944966b.2\n for <u-boot@lists.denx.de>; Sat, 27 Jul 2024 00:20:28 -0700 (PDT)", "from fedora.sec.9e.network\n (ip-037-049-067-221.um09.pools.vodafone-ip.de. [37.49.67.221])\n by smtp.gmail.com with ESMTPSA id\n a640c23a62f3a-a7acab231f2sm253102866b.7.2024.07.27.00.20.27\n (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n Sat, 27 Jul 2024 00:20:28 -0700 (PDT)" ], "X-Spam-Checker-Version": "SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de", "X-Spam-Level": "", "X-Spam-Status": "No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED,\n DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS\n autolearn=ham autolearn_force=no version=3.4.2", "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=9elements.com; s=google; t=1722064828; x=1722669628; darn=lists.denx.de;\n h=content-transfer-encoding:mime-version:references:in-reply-to\n :message-id:date:subject:cc:to:from:from:to:cc:subject:date\n :message-id:reply-to;\n bh=jJ/lnjHbJa+yt3TgX9MW8pErewLjb7MhOxHgeEMHXZI=;\n b=evyI4qHWr+PsVaIxwtCXaQOuWZJiCDSjgLA1B7xy/TrXMX8dbWRfEOcdBJWr97VNYC\n Arz+TyGWXak1gzaRUOYrY53wBqwmxyYZPlKUiQ0XCUSpHKo8dNH+Qo1OcpsHl5OAgwDh\n v2OmCQQiKpkAOvV97kFWb2kfgSy8uqKcc/uGHrvRcOBqFnIha4kc+IWsG6NZAVzPaRDE\n YTniZ0FxxvtsIbhoS/YIRE605H1ITbf3J7pdhufY1jyjBubtoqB2hIDcWkrkVM0wKrqz\n 4Tn1pLt8DEPeQ5oMNvM/ZKL8Cb7qejdktdATu+PumGEStYNwpVhdMy/GZq7hSqVIz9FT\n dynQ==", "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=1e100.net; s=20230601; t=1722064828; x=1722669628;\n h=content-transfer-encoding:mime-version:references:in-reply-to\n :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc\n :subject:date:message-id:reply-to;\n bh=jJ/lnjHbJa+yt3TgX9MW8pErewLjb7MhOxHgeEMHXZI=;\n b=TdbtZKisnyywqZsmIJR30BoSrf9D01CU9toyWE/lgvNTl0Pi4N6DkQVjUKL8hW7m7c\n HIsIrq+awhDqAaI9MLG17CyaBilpUlL2bewn3Jf6XMqJi6sX+QRnoJ4e+xfkc8ztWaSq\n 6MkdS6mCJUKtKqPETZcd6m8CVBv5p2si+Q4zMksqN2V146SFu0jZqT2IyIxBGWhO4kLn\n iZ7pglZTnTM1JftmLQippASOsm1vIQHLtChFAO7nJSRXRMmxN8AYq7Mfs7xx8RT3Foyf\n RCU3erdPVJTIiBJvqU2krwZRd3PD1nB49kCvpq/Vq9B7PgMAG5dPSoOkuWWpnvaN6k+a\n iTBA==", "X-Gm-Message-State": "AOJu0YwwI6zbrEkh2YyoY66PGiDZTWPUWQ/rpxxcsDVjDbaVLDSZYzjF\n dUdICgrhuADCpOnt+z+nEZe0o6Ng4CCk44zXvYmyh3z7zw7zDKTxBOo5e6dVTTSdf4PutkCFQfb\n z2ew=", "X-Google-Smtp-Source": "\n AGHT+IHffVqFPdMS+Yonn9nXQQ+2GN1T5Fg/j1eqm+Fq+AeZQ5RclWI7u/sv0x945ZdM+FXMcCNCaQ==", "X-Received": "by 2002:a17:907:868b:b0:a77:d0a0:ea6d with SMTP id\n a640c23a62f3a-a7d3ffa1f51mr117339266b.24.1722064828486;\n Sat, 27 Jul 2024 00:20:28 -0700 (PDT)", "From": "Patrick Rudolph <patrick.rudolph@9elements.com>", "To": "u-boot@lists.denx.de, Matthias Brugger <mbrugger@suse.com>,\n Peter Robinson <pbrobinson@gmail.com>", "Cc": "trini@konsulko.com, sjg@chromium.org, bmeng.cn@gmail.com,\n Patrick Rudolph <patrick.rudolph@9elements.com>", "Subject": "[PATCH 12/17] arm: bcm283x: Write ACPI tables", "Date": "Sat, 27 Jul 2024 09:17:13 +0200", "Message-ID": "<20240727071742.1735703-13-patrick.rudolph@9elements.com>", "X-Mailer": "git-send-email 2.45.2", "In-Reply-To": "<20240727071742.1735703-1-patrick.rudolph@9elements.com>", "References": "<20240727071742.1735703-1-patrick.rudolph@9elements.com>", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "X-BeenThere": "u-boot@lists.denx.de", "X-Mailman-Version": "2.1.39", "Precedence": "list", "List-Id": "U-Boot discussion <u-boot.lists.denx.de>", "List-Unsubscribe": "<https://lists.denx.de/options/u-boot>,\n <mailto:u-boot-request@lists.denx.de?subject=unsubscribe>", "List-Archive": "<https://lists.denx.de/pipermail/u-boot/>", "List-Post": "<mailto:u-boot@lists.denx.de>", "List-Help": "<mailto:u-boot-request@lists.denx.de?subject=help>", "List-Subscribe": "<https://lists.denx.de/listinfo/u-boot>,\n <mailto:u-boot-request@lists.denx.de?subject=subscribe>", "Errors-To": "u-boot-bounces@lists.denx.de", "Sender": "\"U-Boot\" <u-boot-bounces@lists.denx.de>", "X-Virus-Scanned": "clamav-milter 0.103.8 at phobos.denx.de", "X-Virus-Status": "Clean" }, "content": "Allocate a 64KiB buffer for ACPI tables and provide SoC specific tables\nfor BCM2711:\n- MADT\n- FADT\n- PPTT\n- GTDT\n- SPCR\n\nBoard specific tables like DSDT and SSDT are added in a separate patch.\n\nWhen ACPI is enabled for a different SoC compliation will fail by\ndesign, indicating the required functions that needs to be implemented.\nWhen ACPI is not enabled the added code does nothing, keeping existing\nbehaviour.\n\nTEST: Booted on RPi4 with only ACPI enabled, providing no FDT to the OS.\n\nSigned-off-by: Patrick Rudolph <patrick.rudolph@9elements.com>\nCc: Simon Glass <sjg@chromium.org>\nCc: Matthias Brugger <mbrugger@suse.com>\nCc: Peter Robinson <pbrobinson@gmail.com>\nCc: Tom Rini <trini@konsulko.com>\n---\n arch/arm/mach-bcm283x/Makefile | 4 +\n arch/arm/mach-bcm283x/bcm2711_acpi.c | 172 +++++++++++++++++++++++++++\n arch/arm/mach-bcm283x/init.c | 30 +++++\n 3 files changed, 206 insertions(+)\n create mode 100644 arch/arm/mach-bcm283x/bcm2711_acpi.c", "diff": "diff --git a/arch/arm/mach-bcm283x/Makefile b/arch/arm/mach-bcm283x/Makefile\nindex 7cd068832f..38e320307d 100644\n--- a/arch/arm/mach-bcm283x/Makefile\n+++ b/arch/arm/mach-bcm283x/Makefile\n@@ -4,3 +4,7 @@\n \n obj-$(CONFIG_BCM2835) += lowlevel_init.o\n obj-y\t+= init.o reset.o mbox.o msg.o phys2bus.o\n+\n+ifeq ($(CONFIG_GENERATE_ACPI_TABLE),y)\n+obj-$(CONFIG_BCM2711) += bcm2711_acpi.o\n+endif\n\\ No newline at end of file\ndiff --git a/arch/arm/mach-bcm283x/bcm2711_acpi.c b/arch/arm/mach-bcm283x/bcm2711_acpi.c\nnew file mode 100644\nindex 0000000000..ab0f77c245\n--- /dev/null\n+++ b/arch/arm/mach-bcm283x/bcm2711_acpi.c\n@@ -0,0 +1,172 @@\n+// SPDX-License-Identifier: GPL-2.0\n+/*\n+ * (C) Copyright 2024 9elements GmbH\n+ *\n+ * See file CREDITS for list of people who contributed to this\n+ * project.\n+ */\n+\n+#include <acpi/acpi_table.h>\n+#include <asm/acpi_table.h>\n+#include <asm/armv8/sec_firmware.h>\n+#include <asm/arch/acpi/bcm2711.h>\n+#include <tables_csum.h>\n+#include <string.h>\n+\n+void acpi_fill_fadt(struct acpi_fadt *fadt)\n+{\n+\tfadt->flags = ACPI_FADT_HW_REDUCED_ACPI | ACPI_FADT_LOW_PWR_IDLE_S0;\n+\n+\tif (CONFIG_IS_ENABLED(SEC_FIRMWARE_ARMV8_PSCI) &&\n+\t sec_firmware_support_psci_version() != PSCI_INVALID_VER)\n+\t\tfadt->arm_boot_arch = ACPI_ARM_PSCI_COMPLIANT;\n+}\n+\n+void *acpi_fill_madt(struct acpi_madt *madt, void *current)\n+{\n+\tstruct acpi_madt_gicc *gicc;\n+\tstruct acpi_madt_gicd *gicd;\n+\n+\tmadt->lapic_addr = 0;\n+\tmadt->flags = 0;\n+\n+\tgicc = current;\n+\tfor (int i = 0; i < 4; i++) {\n+\t\tacpi_write_madt_gicc(gicc++, i, 0x30 + i, BCM2711_GIC400_BASE_ADDRESS + 0x2000,\n+\t\t\t\t BCM2711_GIC400_BASE_ADDRESS + 0x6000,\n+\t\t\t\t BCM2711_GIC400_BASE_ADDRESS + 0x4000,\n+\t\t\t\t 0x19, i, 1);\n+\t}\n+\n+\tgicd = (struct acpi_madt_gicd *)gicc;\n+\tacpi_write_madt_gicd(gicd++, 0, BCM2711_GIC400_BASE_ADDRESS + 0x1000, 2);\n+\treturn gicd;\n+}\n+\n+static u32 *add_proc(struct acpi_ctx *ctx, int flags, int parent, int proc_id,\n+\t\t int num_resources)\n+{\n+\tstruct acpi_pptt_proc *proc = ctx->current;\n+\tu32 *resource_list;\n+\n+\tproc->hdr.type = ACPI_PPTT_TYPE_PROC;\n+\tproc->flags = flags;\n+\tproc->parent = parent;\n+\tproc->proc_id = proc_id;\n+\tproc->num_resources = num_resources;\n+\tproc->hdr.length = sizeof(struct acpi_pptt_proc) +\n+\t\tsizeof(u32) * num_resources;\n+\tresource_list = ctx->current + sizeof(struct acpi_pptt_proc);\n+\tacpi_inc(ctx, proc->hdr.length);\n+\n+\treturn resource_list;\n+}\n+\n+static int add_cache(struct acpi_ctx *ctx, int flags, int size, int sets,\n+\t\t int assoc, int attributes, int line_size)\n+{\n+\tstruct acpi_pptt_cache *cache = ctx->current;\n+\tint ofs;\n+\n+\tofs = ctx->current - ctx->tab_start;\n+\tcache->hdr.type = ACPI_PPTT_TYPE_CACHE;\n+\tcache->hdr.length = sizeof(struct acpi_pptt_cache);\n+\tcache->flags = flags;\n+\tcache->next_cache_level = 0;\n+\tcache->size = size;\n+\tcache->sets = sets;\n+\tcache->assoc = assoc;\n+\tcache->attributes = attributes;\n+\tcache->line_size = line_size;\n+\tacpi_inc(ctx, cache->hdr.length);\n+\n+\treturn ofs;\n+}\n+\n+static int acpi_write_pptt(struct acpi_ctx *ctx, const struct acpi_writer *entry)\n+{\n+\tstruct acpi_table_header *header;\n+\tint proc_ofs;\n+\tu32 *proc_ptr;\n+\tint ofs, ofs0, ofs1, i;\n+\n+\theader = ctx->current;\n+\tctx->tab_start = ctx->current;\n+\n+\tmemset(header, '\\0', sizeof(struct acpi_table_header));\n+\n+\tacpi_fill_header(header, \"PPTT\");\n+\theader->revision = acpi_get_table_revision(ACPITAB_PPTT);\n+\tacpi_inc(ctx, sizeof(*header));\n+\n+\tproc_ofs = ctx->current - ctx->tab_start;\n+\tproc_ptr = add_proc(ctx, ACPI_PPTT_PHYSICAL_PACKAGE |\n+\t\t\t ACPI_PPTT_CHILDREN_IDENTICAL, 0, 0, 1);\n+\n+\tofs = add_cache(ctx, ACPI_PPTT_ALL_VALID, 0x100000, 0x400, 0x10,\n+\t\t\tACPI_PPTT_WRITE_ALLOC |\n+\t\t\t(ACPI_PPTT_CACHE_TYPE_UNIFIED <<\n+\t\t\t ACPI_PPTT_CACHE_TYPE_SHIFT), 0x40);\n+\t*proc_ptr = ofs;\n+\n+\tfor (i = 0; i < 4; i++) {\n+\t\tproc_ptr = add_proc(ctx, ACPI_PPTT_CHILDREN_IDENTICAL |\n+\t\t\t\t ACPI_PPTT_NODE_IS_LEAF | ACPI_PPTT_PROC_ID_VALID,\n+\t\t\t\t proc_ofs, i, 2);\n+\n+\t\tofs0 = add_cache(ctx, ACPI_PPTT_ALL_VALID, 0x8000, 0x100, 2,\n+\t\t\t\t ACPI_PPTT_WRITE_ALLOC, 0x40);\n+\n+\t\tofs1 = add_cache(ctx, ACPI_PPTT_ALL_BUT_WRITE_POL, 0xc000, 0x100, 3,\n+\t\t\t\t ACPI_PPTT_CACHE_TYPE_INSTR <<\n+\t\t\t\t ACPI_PPTT_CACHE_TYPE_SHIFT, 0x40);\n+\t\tproc_ptr[0] = ofs0;\n+\t\tproc_ptr[1] = ofs1;\n+\t}\n+\n+\theader->length = ctx->current - ctx->tab_start;\n+\theader->checksum = table_compute_checksum(header, header->length);\n+\n+\tacpi_inc(ctx, header->length);\n+\tacpi_add_table(ctx, header);\n+\n+\treturn 0;\n+};\n+\n+ACPI_WRITER(5pptt, \"PPTT\", acpi_write_pptt, 0);\n+\n+static int rpi_write_gtdt(struct acpi_ctx *ctx, const struct acpi_writer *entry)\n+{\n+\tstruct acpi_table_header *header;\n+\tstruct acpi_gtdt *gtdt;\n+\n+\tgtdt = ctx->current;\n+\theader = >dt->header;\n+\n+\tmemset(gtdt, '\\0', sizeof(struct acpi_gtdt));\n+\n+\tacpi_fill_header(header, \"GTDT\");\n+\theader->length = sizeof(struct acpi_gtdt);\n+\theader->revision = acpi_get_table_revision(ACPITAB_GTDT);\n+\n+\tgtdt->cnt_ctrl_base = BCM2711_ARM_LOCAL_BASE_ADDRESS + 0x1c;\n+\tgtdt->sec_el1_gsiv = 29;\n+\tgtdt->sec_el1_flags = GTDT_FLAG_INT_ACTIVE_LOW;\n+\tgtdt->el1_gsiv = 30;\n+\tgtdt->el1_flags = GTDT_FLAG_INT_ACTIVE_LOW;\n+\tgtdt->virt_el1_gsiv = 27;\n+\tgtdt->virt_el1_flags = GTDT_FLAG_INT_ACTIVE_LOW;\n+\tgtdt->el2_gsiv = 26;\n+\tgtdt->el2_flags = GTDT_FLAG_INT_ACTIVE_LOW;\n+\tgtdt->cnt_read_base = 0xffffffffffffffff;\n+\n+\theader->checksum = table_compute_checksum(header, header->length);\n+\n+\tacpi_add_table(ctx, gtdt);\n+\n+\tacpi_inc(ctx, sizeof(struct acpi_gtdt));\n+\n+\treturn 0;\n+};\n+\n+ACPI_WRITER(5gtdt, \"GTDT\", rpi_write_gtdt, 0);\n\\ No newline at end of file\ndiff --git a/arch/arm/mach-bcm283x/init.c b/arch/arm/mach-bcm283x/init.c\nindex 7a1de22e0a..80a10f2212 100644\n--- a/arch/arm/mach-bcm283x/init.c\n+++ b/arch/arm/mach-bcm283x/init.c\n@@ -6,11 +6,13 @@\n * project.\n */\n \n+#include <acpi/acpi_table.h>\n #include <cpu_func.h>\n #include <init.h>\n #include <dm/device.h>\n #include <fdt_support.h>\n #include <asm/global_data.h>\n+#include <malloc.h>\n \n #define BCM2711_RPI4_PCIE_XHCI_MMIO_PHYS\t0x600000000UL\n #define BCM2711_RPI4_PCIE_XHCI_MMIO_SIZE\t0x400000UL\n@@ -240,3 +242,31 @@ void enable_caches(void)\n \tdcache_enable();\n }\n #endif\n+\n+#ifdef CONFIG_GENERATE_ACPI_TABLE\n+static int last_stage_init(void)\n+{\n+\tulong end;\n+\tvoid *ptr;\n+\n+\t/* Reserve 64K for ACPI tables, aligned to a 4K boundary */\n+\tptr = memalign(SZ_4K, SZ_64K);\n+\n+\t/* Generate ACPI tables */\n+\tend = write_acpi_tables((uintptr_t)ptr);\n+\tif (end < 0) {\n+\t\tlog_err(\"Failed to write tables\\n\");\n+\t\treturn log_msg_ret(\"table\", end);\n+\t}\n+\tif (end > ((ulong)ptr + SZ_64K)) {\n+\t\tlog_err(\"ACPI tables overflowed\\n\");\n+\t\treturn 0;\n+\t}\n+\n+\tgd->arch.table_start = (uintptr_t)ptr;\n+\tgd->arch.table_end = end;\n+\n+\treturn 0;\n+}\n+EVENT_SPY_SIMPLE(EVT_LAST_STAGE_INIT, last_stage_init);\n+#endif\n\\ No newline at end of file\n", "prefixes": [ "12/17" ] }