From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v1 1/3] x86: acpi: Introduce a stub to generate CSRT
Date: Sun, 14 Jul 2019 19:20:45 +0300 [thread overview]
Message-ID: <20190714162047.56224-1-andriy.shevchenko@linux.intel.com> (raw)
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 <andriy.shevchenko@linux.intel.com>
---
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);
--
2.20.1
next reply other threads:[~2019-07-14 16:20 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-07-14 16:20 Andy Shevchenko [this message]
2019-07-14 16:20 ` [U-Boot] [PATCH v1 2/3] x86: acpi: Enable ACPI companion for Intel iDMA 32-bit Andy Shevchenko
2019-07-14 16:20 ` [U-Boot] [PATCH v1 3/3] x86: tangier: Populate CSRT for shared DMA controller Andy Shevchenko
2019-07-14 16:34 ` [U-Boot] [PATCH v1 1/3] x86: acpi: Introduce a stub to generate CSRT Andy Shevchenko
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190714162047.56224-1-andriy.shevchenko@linux.intel.com \
--to=andriy.shevchenko@linux.intel.com \
--cc=u-boot@lists.denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox