summaryrefslogtreecommitdiff
path: root/src/arch/x86/acpi.c
diff options
context:
space:
mode:
authorTimothy Pearson <tpearson@raptorengineeringinc.com>2015-08-11 17:48:32 -0500
committerMartin Roth <martinroth@google.com>2015-11-23 23:00:30 +0100
commitff8ccf05b04714ae86ed947841de718699a09d2c (patch)
tree55ed41df89a7b044b5279725f0c6e561e3c3044e /src/arch/x86/acpi.c
parenta52d5d1269bdf82af76de78e0e27f9c6acce1fab (diff)
downloadcoreboot-ff8ccf05b04714ae86ed947841de718699a09d2c.tar.xz
arch/x86/acpi: Add IVRS table generation routines
Change-Id: Ia5d97d01dc9ddc45f81d998d126d592a915b4a75 Signed-off-by: Timothy Pearson <tpearson@raptorengineeringinc.com> Reviewed-on: http://review.coreboot.org/12043 Tested-by: build bot (Jenkins) Reviewed-by: Patrick Georgi <pgeorgi@google.com>
Diffstat (limited to 'src/arch/x86/acpi.c')
-rw-r--r--src/arch/x86/acpi.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/src/arch/x86/acpi.c b/src/arch/x86/acpi.c
index c540b5ce4c..ccaab9ef74 100644
--- a/src/arch/x86/acpi.c
+++ b/src/arch/x86/acpi.c
@@ -6,6 +6,7 @@
*
* Copyright (C) 2004 SUSE LINUX AG
* Copyright (C) 2005-2009 coresystems GmbH
+ * Copyright (C) 2015 Timothy Pearson <tpearson@raptorengineeringinc.com>, Raptor Engineering
*
* ACPI FADT, FACS, and DSDT table support added by
* Nick Barker <nick.barker9@btinternet.com>, and those portions
@@ -531,6 +532,30 @@ void acpi_create_hpet(acpi_hpet_t *hpet)
header->checksum = acpi_checksum((void *)hpet, sizeof(acpi_hpet_t));
}
+void acpi_create_ivrs(acpi_ivrs_t *ivrs,
+ unsigned long (*acpi_fill_ivrs)(acpi_ivrs_t* ivrs_struct, unsigned long current))
+{
+ acpi_header_t *header = &(ivrs->header);
+ unsigned long current = (unsigned long)ivrs + sizeof(acpi_ivrs_t);
+
+ memset((void *)ivrs, 0, sizeof(acpi_ivrs_t));
+
+ /* Fill out header fields. */
+ memcpy(header->signature, "IVRS", 4);
+ memcpy(header->oem_id, OEM_ID, 6);
+ memcpy(header->oem_table_id, ACPI_TABLE_CREATOR, 8);
+ memcpy(header->asl_compiler_id, ASLC, 4);
+
+ header->length = sizeof(acpi_ivrs_t);
+ header->revision = 1; /* ACPI 1.0: N/A, ACPI 2.0/3.0/4.0: 1 */
+
+ current = acpi_fill_ivrs(ivrs, current);
+
+ /* (Re)calculate length and checksum. */
+ header->length = current - (unsigned long)ivrs;
+ header->checksum = acpi_checksum((void *)ivrs, header->length);
+}
+
unsigned long acpi_write_hpet(device_t device, unsigned long current, acpi_rsdp_t *rsdp)
{
acpi_hpet_t *hpet;