From patchwork Sun Jul 14 16:23:57 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 1131749 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=none (mailfrom) smtp.mailfrom=lists.denx.de (client-ip=81.169.180.215; helo=lists.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=linux.intel.com Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 45msRx2JhPz9sDB for ; Mon, 15 Jul 2019 02:24:13 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id 0289EC21E57; Sun, 14 Jul 2019 16:24:08 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=none autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id 523A4C21C29; Sun, 14 Jul 2019 16:24:06 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id DA349C21D56; Sun, 14 Jul 2019 16:24:04 +0000 (UTC) Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by lists.denx.de (Postfix) with ESMTPS id 1806FC21BE5 for ; Sun, 14 Jul 2019 16:24:03 +0000 (UTC) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga008.jf.intel.com ([10.7.209.65]) by orsmga103.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 14 Jul 2019 09:24:02 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.63,491,1557212400"; d="scan'208";a="160876183" Received: from black.fi.intel.com ([10.237.72.28]) by orsmga008.jf.intel.com with ESMTP; 14 Jul 2019 09:24:01 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id 5EBF047; Sun, 14 Jul 2019 19:24:00 +0300 (EEST) From: Andy Shevchenko To: Simon Glass , Bin Meng , u-boot@lists.denx.de Date: Sun, 14 Jul 2019 19:23:57 +0300 Message-Id: <20190714162359.56390-2-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190714162359.56390-1-andriy.shevchenko@linux.intel.com> References: <20190714162359.56390-1-andriy.shevchenko@linux.intel.com> MIME-Version: 1.0 Cc: Andy Shevchenko Subject: [U-Boot] [PATCH v2 2/4] x86: acpi: Introduce a stub to generate CSRT X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 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" Here is a stub function that generates an empty CSRT. If the target platform provides acpi_fill_csrt() function, it will be used to populate the table. Signed-off-by: Andy Shevchenko Reviewed-by: Bin Meng --- arch/x86/include/asm/acpi_table.h | 1 + arch/x86/lib/acpi_table.c | 32 +++++++++++++++++++++++++++++++ 2 files changed, 33 insertions(+) diff --git a/arch/x86/include/asm/acpi_table.h b/arch/x86/include/asm/acpi_table.h index a70abd5d75..02aea127c1 100644 --- a/arch/x86/include/asm/acpi_table.h +++ b/arch/x86/include/asm/acpi_table.h @@ -401,6 +401,7 @@ u32 acpi_fill_madt(u32 current); int acpi_create_mcfg_mmconfig(struct acpi_mcfg_mmconfig *mmconfig, u32 base, u16 seg_nr, u8 start, u8 end); u32 acpi_fill_mcfg(u32 current); +u32 acpi_fill_csrt(u32 current); void acpi_create_gnvs(struct acpi_global_nvs *gnvs); ulong write_acpi_tables(ulong start); diff --git a/arch/x86/lib/acpi_table.c b/arch/x86/lib/acpi_table.c index e80e968b50..efc4edf801 100644 --- a/arch/x86/lib/acpi_table.c +++ b/arch/x86/lib/acpi_table.c @@ -337,6 +337,30 @@ static void acpi_create_mcfg(struct acpi_mcfg *mcfg) header->checksum = table_compute_checksum((void *)mcfg, header->length); } +__weak u32 acpi_fill_csrt(u32 current) +{ + return current; +} + +static void acpi_create_csrt(struct acpi_csrt *csrt) +{ + struct acpi_table_header *header = &(csrt->header); + u32 current = (u32)csrt + sizeof(struct acpi_csrt); + + memset((void *)csrt, 0, sizeof(struct acpi_csrt)); + + /* Fill out header fields */ + acpi_fill_header(header, "CSRT"); + header->length = sizeof(struct acpi_csrt); + header->revision = 0; + + current = acpi_fill_csrt(current); + + /* (Re)calculate length and checksum */ + header->length = current - (u32)csrt; + header->checksum = table_compute_checksum((void *)csrt, header->length); +} + static void acpi_create_spcr(struct acpi_spcr *spcr) { struct acpi_table_header *header = &(spcr->header); @@ -440,6 +464,7 @@ ulong write_acpi_tables(ulong start) struct acpi_fadt *fadt; struct acpi_mcfg *mcfg; struct acpi_madt *madt; + struct acpi_csrt *csrt; struct acpi_spcr *spcr; int i; @@ -529,6 +554,13 @@ ulong write_acpi_tables(ulong start) acpi_add_table(rsdp, mcfg); current = ALIGN(current, 16); + debug("ACPI: * CSRT\n"); + csrt = (struct acpi_csrt *)current; + acpi_create_csrt(csrt); + current += csrt->header.length; + acpi_add_table(rsdp, csrt); + current = ALIGN(current, 16); + debug("ACPI: * SPCR\n"); spcr = (struct acpi_spcr *)current; acpi_create_spcr(spcr);