From patchwork Sun Jun 14 02:55:18 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1308823 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=85.214.62.61; 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=hKbHNtGg; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (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 49kzlt5NT0z9sQx for ; Sun, 14 Jun 2020 13:02:34 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 5A39381E09; Sun, 14 Jun 2020 04:57:28 +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="hKbHNtGg"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 3995881D83; Sun, 14 Jun 2020 04:56:20 +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.0 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-il1-x143.google.com (mail-il1-x143.google.com [IPv6:2607:f8b0:4864:20::143]) (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 20DEA81D48 for ; Sun, 14 Jun 2020 04:55:55 +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-il1-x143.google.com with SMTP id b5so12292208iln.5 for ; Sat, 13 Jun 2020 19:55:55 -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=vCYWlbofbR31BU87XFOc2YRq+PJFsBp2Ela34vWJgsU=; b=hKbHNtGgrXahXJL9YNWxatMWLGp88S7FT7O9Q8GHMIhK9TYlHIDeAGRQo8/AGNY4qy bcex++mUD2M45lYylLxdO2vUs2vIvbxdcdsg8X4IyANHH1pNAue/yc72EiX5hg/M7f29 ubX4Y0bl+vCX1KpqtNfAWWZFSvohaiM7MTPaM= 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=vCYWlbofbR31BU87XFOc2YRq+PJFsBp2Ela34vWJgsU=; b=nTjf5OF1hZBoQfdbCFLi/4S0aF2ViyNTArnIMXUP1bkfozwTrB6MLB2uT8KcessGUk l/yYUq8wEIdHqv4f4VKG7bA0azN3vWYYPn8DpEy64wyGiRz5/yilrSvr1JgA37pDnp94 0TpUyInizeXq/DXS0efhsV/EciWVc4VULLefOOx3ksRuhsddVDrZsBry2A3V4i7/zFtZ hXvk2mhpD2yHwAePQhMdfuvLHqa9p2k/3xkfaegS5HPhl2qNmAp2OUFWtZDNLnvitgSg hOWLfAYc5z7BE+8UIs/kl8Ot6CGpKJy3yAnHMoSSgbn75tYVLBETZ9R/pwOGY7pEvRWc kALw== X-Gm-Message-State: AOAM532Es1ZNtGZq+1/nRgDDhGS54XnxGYa+xGOfxZURiJR+F/5tdjXC zPK0DSIc/jKRyDC1r450dbbW8MfpI6nHDA== X-Google-Smtp-Source: ABdhPJxuWIJGPZchBZ4qliakfBW3Wlh/sHIuS7vyzFw+P/t81IarsY2u53Ko0yT4WS/hsdR7HsdRWg== X-Received: by 2002:a92:cc0c:: with SMTP id s12mr20781016ilp.192.1592103353654; Sat, 13 Jun 2020 19:55:53 -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 4sm5722288ilc.34.2020.06.13.19.55.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 13 Jun 2020 19:55:53 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Bin Meng , Wolfgang Wallner , Andy Shevchenko , Simon Glass Subject: [PATCH v3 30/35] x86: Allow devices to write an SSDT Date: Sat, 13 Jun 2020 20:55:18 -0600 Message-Id: <20200613205459.v3.30.Id6fc7367886ec2e2d9f2ddf423ad32720e14e5e5@changeid> X-Mailer: git-send-email 2.27.0.290.gba653c62da-goog In-Reply-To: <20200614025523.40183-1-sjg@chromium.org> References: <20200614025523.40183-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 Call the new core function to write the SSDT. This is made up of fragments generated by devices that have the fill_ssdt() method. Signed-off-by: Simon Glass Reviewed-by: Wolfgang Wallner Reviewed-by: Bin Meng --- Changes in v3: Drop coreboot_acpi_ids enum Changes in v1: - Use OEM_TABLE_ID instead of ACPI_TABLE_CREATOR - Update ACPI_DSTATUS enum - Drop writing of coreboot tables arch/x86/lib/acpi_table.c | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/arch/x86/lib/acpi_table.c b/arch/x86/lib/acpi_table.c index e96acf08d4..4658d88351 100644 --- a/arch/x86/lib/acpi_table.c +++ b/arch/x86/lib/acpi_table.c @@ -14,6 +14,7 @@ #include #include #include +#include #include #include #include @@ -354,6 +355,25 @@ static void acpi_create_spcr(struct acpi_spcr *spcr) header->checksum = table_compute_checksum((void *)spcr, header->length); } +void acpi_create_ssdt(struct acpi_ctx *ctx, struct acpi_table_header *ssdt, + const char *oem_table_id) +{ + memset((void *)ssdt, '\0', sizeof(struct acpi_table_header)); + + acpi_fill_header(ssdt, "SSDT"); + ssdt->revision = acpi_get_table_revision(ACPITAB_SSDT); + ssdt->aslc_revision = 1; + ssdt->length = sizeof(struct acpi_table_header); + + acpi_inc(ctx, sizeof(struct acpi_table_header)); + + acpi_fill_ssdt(ctx); + + /* (Re)calculate length and checksum. */ + ssdt->length = ctx->current - (void *)ssdt; + ssdt->checksum = table_compute_checksum((void *)ssdt, ssdt->length); +} + /* * QEMU's version of write_acpi_tables is defined in drivers/misc/qfw.c */ @@ -363,6 +383,7 @@ ulong write_acpi_tables(ulong start_addr) struct acpi_facs *facs; struct acpi_table_header *dsdt; struct acpi_fadt *fadt; + struct acpi_table_header *ssdt; struct acpi_mcfg *mcfg; struct acpi_madt *madt; struct acpi_csrt *csrt; @@ -418,6 +439,14 @@ ulong write_acpi_tables(ulong start_addr) acpi_create_fadt(fadt, facs, dsdt); acpi_add_table(ctx, fadt); + debug("ACPI: * SSDT\n"); + ssdt = (struct acpi_table_header *)ctx->current; + acpi_create_ssdt(ctx, ssdt, OEM_TABLE_ID); + if (ssdt->length > sizeof(struct acpi_table_header)) { + acpi_inc_align(ctx, ssdt->length); + acpi_add_table(ctx, ssdt); + } + debug("ACPI: * MCFG\n"); mcfg = ctx->current; acpi_create_mcfg(mcfg);