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>
This commit is contained in:
Marek Maslanka
2023-12-07 13:21:35 +00:00
committed by Felix Held
parent d9c347fb8b
commit 017003cbd0
3 changed files with 124 additions and 0 deletions

View File

@@ -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).

View File

@@ -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;
}