summaryrefslogtreecommitdiff
path: root/src/acpi
diff options
context:
space:
mode:
authorMarek Maslanka <mmaslanka@google.com>2023-12-07 13:21:35 +0000
committerFelix Held <felix-coreboot@felixheld.de>2023-12-15 19:08:45 +0000
commit017003cbd0b75119cd1ee6ff52236f8a18182c3c (patch)
treeaece1d47e5ea203970f12b163e956759f368477a /src/acpi
parentd9c347fb8bf5815567ca5fe94f1cf2d0b4cd3c87 (diff)
acpi: Add support for WDAT table
This commit lays the groundwork for implementing the ACPI WDAT (Watchdog Action Table) table specification. The WDAT is a special ACPI table introduced by Microsoft that describes the watchdog for the OS. Platforms that need to implement the WDAT table must describe the hardware watchdog management operations as described in the specification. See “Links to ACPI-Related Documents” (http://uefi.org/acpi) under the heading “Watchdog Action Table”. BUG=b:314260167 TEST=Mock the acpi_soc_fill_wdat function for a specific platform/soc and enable ACPI_WDAT_WDT in the kconfig. Check if the build passes successfully. Change-Id: Ieb82d1f69b2b7fffacfd2928bc71f8ff10498074 Signed-off-by: Marek Maslanka <mmaslanka@google.com> Reviewed-on: https://review.coreboot.org/c/coreboot/+/79380 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Jakub Czapiga <czapiga@google.com>
Diffstat (limited to 'src/acpi')
-rw-r--r--src/acpi/Kconfig8
-rw-r--r--src/acpi/acpi.c22
2 files changed, 30 insertions, 0 deletions
diff --git a/src/acpi/Kconfig b/src/acpi/Kconfig
index 83d18bf62f..417ff60abb 100644
--- a/src/acpi/Kconfig
+++ b/src/acpi/Kconfig
@@ -111,3 +111,11 @@ config ACPI_PPTT_MAX_CACHES
help
This variable sets the maximum number of distinct caches per
topology level. Increasing this option also increases stack usage.
+
+config ACPI_WDAT_WDT
+ bool
+ default n
+ depends on HAVE_ACPI_TABLES
+ help
+ Selected by platforms that support and fill ACPI Watchdog Action Table
+ (WDAT).
diff --git a/src/acpi/acpi.c b/src/acpi/acpi.c
index beba5fdb3a..5e769163b7 100644
--- a/src/acpi/acpi.c
+++ b/src/acpi/acpi.c
@@ -1218,6 +1218,25 @@ static void acpi_create_iort(acpi_header_t *header, void *unused)
header->length = current - (unsigned long)iort;
}
+static void acpi_create_wdat(acpi_header_t *header, void *unused)
+{
+ if (!CONFIG(ACPI_WDAT_WDT))
+ return;
+
+ acpi_wdat_t *wdat = (acpi_wdat_t *)header;
+ unsigned long current = (unsigned long)wdat + sizeof(acpi_wdat_t);
+
+ memset((void *)wdat, 0, sizeof(acpi_wdat_t));
+
+ if (acpi_fill_header(header, "WDAT", WDAT, sizeof(acpi_wdat_t)) != CB_SUCCESS)
+ return;
+
+ current = acpi_soc_fill_wdat(wdat, current);
+
+ /* (Re)calculate length. */
+ header->length = current - (unsigned long)wdat;
+}
+
unsigned long acpi_create_lpi_desc_ncst(acpi_lpi_desc_ncst_t *lpi_desc, uint16_t uid)
{
memset(lpi_desc, 0, sizeof(acpi_lpi_desc_ncst_t));
@@ -1434,6 +1453,7 @@ unsigned long write_acpi_tables(const unsigned long start)
{ acpi_create_gtdt, NULL, sizeof(acpi_gtdt_t) },
{ acpi_create_pptt, NULL, sizeof(acpi_pptt_t) },
{ acpi_create_iort, NULL, sizeof(acpi_iort_t) },
+ { acpi_create_wdat, NULL, sizeof(acpi_wdat_t) },
};
current = start;
@@ -1787,6 +1807,8 @@ int get_acpi_table_revision(enum acpi_tables table)
return 3;
case IORT: /* IO Remapping Table E.e */
return 6;
+ case WDAT:
+ return 1;
default:
return -1;
}