From patchwork Mon Mar 30 23:13:04 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1264394 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=lfEhOmZy; 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 48rpMw20byz9sPJ for ; Tue, 31 Mar 2020 10:20:12 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 8C34D819A1; Tue, 31 Mar 2020 01:16:16 +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="lfEhOmZy"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 9C66581904; Tue, 31 Mar 2020 01:15:08 +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.2 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,T_SPF_HELO_TEMPERROR autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-io1-xd43.google.com (mail-io1-xd43.google.com [IPv6:2607:f8b0:4864:20::d43]) (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 9522A818B2 for ; Tue, 31 Mar 2020 01:14:49 +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-io1-xd43.google.com with SMTP id y14so2621568iol.12 for ; Mon, 30 Mar 2020 16:14:49 -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=DQpA2c9Nz0WGZbS/KX2GcsBsgKZejriRlIOBLB6oEnI=; b=lfEhOmZyLS2ZT5YJxjR6Pwcw58g5Py2VgAWZCEe0kR1lBC0vTxIleoF74IG931/1NF VMYFb661lJXNDa6uszM/H/QXjUnWraLP+tGa0dReXIZa0pqC/jLfr0R+zqIsq84YY5ZR cmvQWKQrX+yHehYjoaw0LCxrIhL/gaBFIz1jI= 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=DQpA2c9Nz0WGZbS/KX2GcsBsgKZejriRlIOBLB6oEnI=; b=RotG6L/snCHO93o/1qLO33fezJnplB7tCPTWmr7+dc8IXJR8IW+vHYXAU3AM+bIBtp 4WwR21hUtL9gYhMBugkD9g113oo8xjPBV0yw/socKIR0Ht1z0LG3hkjJcQXdYlVVNHgY nC4G/ylyCFKer5sKDgQEjUBqymF/l7+ajrsisuk2RHBDU2GbMM5kt6LEgp5+EEuN3M6T V3r8/6N3PWMxq234Dq+tbeRoxNkAZ6ZHGfjYOJirbwzesDzV0SLzuMeWIc4HrHPxltFB g1JsMsUuBaYzvOIasVHBtpf3DuMfg9vDArg1+hbz89KQDLOD9khejv1mRWLgj5PVHNo9 9yig== X-Gm-Message-State: ANhLgQ2QF4fOQ8mNcVqYnSXzTCj0y8BuGvo+owisP5nPnnXBIJnumOSs aG8pA4UkT0mSxV9HgcCbO7etakOdEnghJQ== X-Google-Smtp-Source: ADFU+vsm5X8mG/E457RI8vuqxoVPwwV+dsaevuHjXDm7u7o/NhjjLzqFot/KwoHvQ3xO+7HeYzET5Q== X-Received: by 2002:a02:484:: with SMTP id 126mr12999106jab.118.1585610088171; Mon, 30 Mar 2020 16:14:48 -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 c28sm5357898ilf.26.2020.03.30.16.14.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 Mar 2020 16:14:47 -0700 (PDT) From: Simon Glass To: u-boot@lists.denx.de Cc: Andy Shevchenko , Wolfgang Wallner , Leif Lindholm , Simon Glass , Bin Meng Subject: [PATCH v3 28/29] acpi: Move the xsdt pointer to acpi_ctx Date: Mon, 30 Mar 2020 17:13:04 -0600 Message-Id: <20200330171226.v3.28.Ib392027f44b50a6cfdad4ce529b8479958cb302d@changeid> X-Mailer: git-send-email 2.26.0.rc2.310.g2932bb562d-goog In-Reply-To: <20200330231305.130488-1-sjg@chromium.org> References: <20200330231305.130488-1-sjg@chromium.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.30rc1 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.2 at phobos.denx.de X-Virus-Status: Clean Put this in the context along with the other important pointers. Signed-off-by: Simon Glass Reviewed-by: Wolfgang Wallner --- Changes in v3: None Changes in v2: None include/dm/acpi.h | 2 ++ lib/acpi/acpi_table.c | 10 ++++------ test/dm/acpi.c | 5 +++++ 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/include/dm/acpi.h b/include/dm/acpi.h index ee6f7a63e79..288310b5128 100644 --- a/include/dm/acpi.h +++ b/include/dm/acpi.h @@ -33,11 +33,13 @@ * @rsdp: Pointer to the Root System Description Pointer, typically used when * adding a new table. The RSDP holds pointers to the RSDT and XSDT. * @rsdt: Pointer to the Root System Description Table + * @xsdt: Pointer to the Extended System Description Table */ struct acpi_ctx { void *current; struct acpi_rsdp *rsdp; struct acpi_rsdt *rsdt; + struct acpi_xsdt *xsdt; }; /** diff --git a/lib/acpi/acpi_table.c b/lib/acpi/acpi_table.c index 70d29c53881..28003dc8f46 100644 --- a/lib/acpi/acpi_table.c +++ b/lib/acpi/acpi_table.c @@ -163,7 +163,7 @@ int acpi_add_table(struct acpi_ctx *ctx, void *table) * And now the same thing for the XSDT. We use the same index as for * now we want the XSDT and RSDT to always be in sync in U-Boot */ - xsdt = (struct acpi_xsdt *)((u32)rsdp->xsdt_address); + xsdt = ctx->xsdt; /* Add table to the XSDT */ xsdt->entry[i] = map_to_sysmem(table); @@ -234,8 +234,6 @@ static void acpi_write_xsdt(struct acpi_xsdt *xsdt) void acpi_setup_base_tables(struct acpi_ctx *ctx, void *start) { - struct acpi_xsdt *xsdt; - ctx->current = start; /* Align ACPI tables to 16 byte */ @@ -246,13 +244,13 @@ void acpi_setup_base_tables(struct acpi_ctx *ctx, void *start) acpi_inc_align(ctx, sizeof(struct acpi_rsdp)); ctx->rsdt = ctx->current; acpi_inc_align(ctx, sizeof(struct acpi_rsdt)); - xsdt = ctx->current; + ctx->xsdt = ctx->current; acpi_inc_align(ctx, sizeof(struct acpi_xsdt)); /* clear all table memory */ memset((void *)start, '\0', ctx->current - start); - acpi_write_rsdp(ctx->rsdp, ctx->rsdt, xsdt); + acpi_write_rsdp(ctx->rsdp, ctx->rsdt, ctx->xsdt); acpi_write_rsdt(ctx->rsdt); - acpi_write_xsdt(xsdt); + acpi_write_xsdt(ctx->xsdt); } diff --git a/test/dm/acpi.c b/test/dm/acpi.c index 5d5e46e2944..8e160d2cf4e 100644 --- a/test/dm/acpi.c +++ b/test/dm/acpi.c @@ -160,6 +160,10 @@ static int dm_test_acpi_write_tables(struct unit_test_state *uts) ut_asserteq(map_to_sysmem(dmar + 1), ctx.rsdt->entry[1]); ut_asserteq(0, ctx.rsdt->entry[2]); + ut_asserteq(map_to_sysmem(dmar), ctx.xsdt->entry[0]); + ut_asserteq(map_to_sysmem(dmar + 1), ctx.xsdt->entry[1]); + ut_asserteq(0, ctx.xsdt->entry[2]); + return 0; } DM_TEST(dm_test_acpi_write_tables, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT); @@ -223,6 +227,7 @@ static int dm_test_acpi_setup_base_tables(struct unit_test_state *uts) ut_assertok(table_compute_checksum(rsdt, sizeof(*rsdt))); xsdt = PTR_ALIGN((void *)rsdt + sizeof(*rsdt), 16); + ut_asserteq_ptr(xsdt, ctx.xsdt); ut_assertok(memcmp("XSDT", xsdt->header.signature, ACPI_NAME_LEN)); ut_asserteq(sizeof(*xsdt), xsdt->header.length); ut_assertok(table_compute_checksum(xsdt, sizeof(*xsdt)));