From patchwork Mon Sep 28 04:25:45 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1372327 X-Patchwork-Delegate: bmeng.cn@gmail.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.a=rsa-sha256 header.s=google header.b=VXl3cOwf; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4C08d54Y2Sz9sSs for ; Mon, 28 Sep 2020 14:27:37 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id E634E8237B; Mon, 28 Sep 2020 06:26:45 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="VXl3cOwf"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id B0E8E8239C; Mon, 28 Sep 2020 06:26:28 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,SPF_HELO_NONE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-ot1-x341.google.com (mail-ot1-x341.google.com [IPv6:2607:f8b0:4864:20::341]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 24D9482359 for ; Mon, 28 Sep 2020 06:26:25 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sjg@chromium.org Received: by mail-ot1-x341.google.com with SMTP id s66so8407603otb.2 for ; Sun, 27 Sep 2020 21:26:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=bWQ+5XIY5sHxxjJIS9wBd9B0gxdRLGal9vPKPjNrADs=; b=VXl3cOwfp8afb09Fpaelwi7nRplPyUoKHK4Wv7zfUrUkOqyFJafDTkA/jiC1zXHa0r QD/AGS4So80eifHcE+7LfuQAVY4aKHiKN0PYZHEzXYXX3aW+ulaIWjWEjiJkaH5nN7Xh 9Di/5huHVJV/lhD0sHR9MCjsRtxFQxinJ0GE4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=bWQ+5XIY5sHxxjJIS9wBd9B0gxdRLGal9vPKPjNrADs=; b=LDtiTjIN6jfY2J25RNaCcGHaayyb7rw92tiJMUYyC2u51pvdKJgLFF6Fs1apClbuiG RBzPf6pVpHqSJ648OeCixrXVqptAC2yQXpokb2eSHPiJI8G0dIjyXRPb2v+Ljmqg8/51 6or7MgX6qZemDxHsuztRYFWNRLTMkv/jYAEIzQG8aEt4F1IQJ53tjes39HqQdw4SKsAH E3vJ0k2yzeDBC0AkCFeHgeffdB2jxLTWIKFRwk7bCHsWCnSBzGrONrN7WR4aH5dcLxhl l516fVGRfphw5bBpqmSMOpdypRT9K2X15YDquWb0Qw8b4eNS1WmZ+CumC2bTZKei9lgG l4Zw== X-Gm-Message-State: AOAM531ie9h6OGhbmbPE7VkSSqCXF40YyYtvfPTh8RbaOzgwgalYT0Zh oT5qHXXQcuP0xAZ8NWF2W5liWDJZ9AMDYzEx X-Google-Smtp-Source: ABdhPJzc9bobFhGS6z/jmPPze2ZdCRK7jFMBG+fQAjV7EsEmcrxfZJV4gd4ZcUAgPFfk0lVOfTaciw== X-Received: by 2002:a9d:3407:: with SMTP id v7mr7541224otb.117.1601267183876; Sun, 27 Sep 2020 21:26:23 -0700 (PDT) Received: from localhost.localdomain (c-73-14-175-90.hsd1.co.comcast.net. [73.14.175.90]) by smtp.gmail.com with ESMTPSA id k51sm2620579otc.46.2020.09.27.21.26.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 27 Sep 2020 21:26:23 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Andy Shevchenko , Heinrich Schuchardt , Bernhard Messerklinger , Wolfgang Wallner , Walter Lozano , Simon Glass , Baruch Siach , Bin Meng , Masahiro Yamada , Peng Fan Subject: [PATCH 06/32] x86: acpi: Store the ACPI context in global_data Date: Sun, 27 Sep 2020 22:25:45 -0600 Message-Id: <20200928042611.1696178-5-sjg@chromium.org> X-Mailer: git-send-email 2.28.0.681.g6f77f65b4e-goog In-Reply-To: <20200928042611.1696178-1-sjg@chromium.org> References: <20200928042611.1696178-1-sjg@chromium.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.102.3 at phobos.denx.de X-Virus-Status: Clean At present we create the ACPI context but then drop it after generation of tables is complete. This is annoying because we have to then search for tables later. To fix this, allocate the context and store it in global_data. Signed-off-by: Simon Glass Reviewed-by: Bin Meng --- arch/x86/lib/acpi_table.c | 7 ++++++- include/asm-generic/global_data.h | 5 +++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/arch/x86/lib/acpi_table.c b/arch/x86/lib/acpi_table.c index 6d405b09fde..f0f342d8935 100644 --- a/arch/x86/lib/acpi_table.c +++ b/arch/x86/lib/acpi_table.c @@ -494,7 +494,7 @@ void acpi_create_ssdt(struct acpi_ctx *ctx, struct acpi_table_header *ssdt, */ ulong write_acpi_tables(ulong start_addr) { - struct acpi_ctx sctx, *ctx = &sctx; + struct acpi_ctx *ctx; struct acpi_facs *facs; struct acpi_table_header *dsdt; struct acpi_fadt *fadt; @@ -509,6 +509,11 @@ ulong write_acpi_tables(ulong start_addr) int ret; int i; + ctx = calloc(1, sizeof(*ctx)); + if (!ctx) + return log_msg_ret("mem", -ENOMEM); + gd->acpi_ctx = ctx; + start = map_sysmem(start_addr, 0); debug("ACPI: Writing ACPI tables at %lx\n", start_addr); diff --git a/include/asm-generic/global_data.h b/include/asm-generic/global_data.h index d4a4e2215dc..c10033a8692 100644 --- a/include/asm-generic/global_data.h +++ b/include/asm-generic/global_data.h @@ -24,6 +24,8 @@ #include #include +struct acpi_ctx; + typedef struct global_data { struct bd_info *bd; unsigned long flags; @@ -137,6 +139,9 @@ typedef struct global_data { #if CONFIG_IS_ENABLED(WDT) struct udevice *watchdog_dev; #endif +#ifdef CONFIG_GENERATE_ACPI_TABLE + struct acpi_ctx *acpi_ctx; +#endif } gd_t; #endif