summaryrefslogtreecommitdiff
path: root/src/acpi
diff options
context:
space:
mode:
authorJason Glenesk <jason.glenesk@amd.corp-partner.google.com>2020-11-02 20:06:23 -0800
committerFelix Held <felix-coreboot@felixheld.de>2021-01-02 22:50:56 +0000
commit61624b2d2de9e57d8fef1e1a1a923c8b00c21247 (patch)
tree88bc1c563074e5c7b75bf94632abd9c5fe5711eb /src/acpi
parent9d233ba9a99b943878904d885770b9133827e9f3 (diff)
acpi: Add cb support to publish CRAT ACPI object
Add cb support to publish CRAT ACPI object in native coreboot. BUG=b:155307433 BRANCH=Zork Change-Id: I5fb7c15b11414f6d807645921c0ff1ab927e6e0f Signed-off-by: Jason Glenesk <jason.glenesk@amd.corp-partner.google.com> Reviewed-on: https://review.coreboot.org/c/coreboot/+/48532 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Marshall Dawson <marshalldawson3rd@gmail.com>
Diffstat (limited to 'src/acpi')
-rw-r--r--src/acpi/acpi.c31
1 files changed, 31 insertions, 0 deletions
diff --git a/src/acpi/acpi.c b/src/acpi/acpi.c
index c319a73aa7..a16800b025 100644
--- a/src/acpi/acpi.c
+++ b/src/acpi/acpi.c
@@ -878,6 +878,35 @@ void acpi_create_ivrs(acpi_ivrs_t *ivrs,
header->checksum = acpi_checksum((void *)ivrs, header->length);
}
+void acpi_create_crat(struct acpi_crat_header *crat,
+ unsigned long (*acpi_fill_crat)(struct acpi_crat_header *crat_struct,
+ unsigned long current))
+{
+ acpi_header_t *header = &(crat->header);
+ unsigned long current = (unsigned long)crat + sizeof(struct acpi_crat_header);
+
+ memset((void *)crat, 0, sizeof(struct acpi_crat_header));
+
+ if (!header)
+ return;
+
+ /* Fill out header fields. */
+ memcpy(header->signature, "CRAT", 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->asl_compiler_revision = asl_revision;
+ header->length = sizeof(struct acpi_crat_header);
+ header->revision = get_acpi_table_revision(CRAT);
+
+ current = acpi_fill_crat(crat, current);
+
+ /* (Re)calculate length and checksum. */
+ header->length = current - (unsigned long)crat;
+ header->checksum = acpi_checksum((void *)crat, header->length);
+}
+
unsigned long acpi_write_hpet(const struct device *device, unsigned long current,
acpi_rsdp_t *rsdp)
{
@@ -1634,6 +1663,8 @@ int get_acpi_table_revision(enum acpi_tables table)
return 5;
case BERT:
return 1;
+ case CRAT:
+ return 1;
default:
return -1;
}