[PATCH 1/2] acpi: remove SBBR mandatory tests in various tables
Alex Hung
alex.hung at canonical.com
Fri Jun 4 19:47:42 UTC 2021
The SBBR table mandatory requirement is tested in "acpi_sbbr" test.
Signed-off-by: Alex Hung <alex.hung at canonical.com>
---
src/acpi/dbg2/dbg2.c | 24 ++----------------------
src/acpi/gtdt/gtdt.c | 21 ++-------------------
src/acpi/spcr/spcr.c | 9 ++-------
src/acpi/xsdt/xsdt.c | 21 ++-------------------
4 files changed, 8 insertions(+), 67 deletions(-)
diff --git a/src/acpi/dbg2/dbg2.c b/src/acpi/dbg2/dbg2.c
index 3c8105a1..6004dc61 100644
--- a/src/acpi/dbg2/dbg2.c
+++ b/src/acpi/dbg2/dbg2.c
@@ -33,27 +33,7 @@
#define SBBR_DBG2_ARM_PL011_UART 0x0003
static fwts_acpi_table_info *table;
-
-static int dbg2_init(fwts_framework *fw)
-{
- if (fwts_acpi_find_table(fw, "DBG2", 0, &table) != FWTS_OK) {
- fwts_log_error(fw, "Cannot read ACPI tables.");
- return FWTS_ERROR;
- }
- if (table == NULL || (table && table->length == 0)) {
- if (fw->flags & FWTS_FLAG_SBBR) {
- fwts_log_error(fw,
- "ACPI DBG2 table does not exist");
- return FWTS_ERROR;
- } else {
- fwts_log_error(fw,
- "ACPI DBG2 table does not exist, skipping test");
- return FWTS_SKIP;
- }
- }
-
- return FWTS_OK;
-}
+acpi_table_init(DBG2, &table)
static int dbg2_test2(fwts_framework *fw)
{
@@ -385,7 +365,7 @@ static fwts_framework_minor_test dbg2_tests[] = {
static fwts_framework_ops dbg2_ops = {
.description = "DBG2 (Debug Port Table 2) test.",
- .init = dbg2_init,
+ .init = DBG2_init,
.minor_tests = dbg2_tests
};
diff --git a/src/acpi/gtdt/gtdt.c b/src/acpi/gtdt/gtdt.c
index 8cd41632..f7fcaa54 100644
--- a/src/acpi/gtdt/gtdt.c
+++ b/src/acpi/gtdt/gtdt.c
@@ -27,24 +27,7 @@
#include <string.h>
static fwts_acpi_table_info *table;
-
-static int gtdt_init(fwts_framework *fw)
-{
- if (fwts_acpi_find_table(fw, "GTDT", 0, &table) != FWTS_OK) {
- fwts_log_error(fw, "Cannot read ACPI tables.");
- return FWTS_ERROR;
- }
- if (table == NULL || (table && table->length == 0)) {
- if (fw->flags & FWTS_FLAG_SBBR) {
- fwts_log_error(fw, "ACPI GTDT table does not exist");
- return FWTS_ERROR;
- } else {
- fwts_log_error(fw, "ACPI GTDT table does not exist, skipping test");
- return FWTS_SKIP;
- }
- }
- return FWTS_OK;
-}
+acpi_table_init(GTDT, &table)
/*
* GTDT Generic Timer Description Table
@@ -272,7 +255,7 @@ static fwts_framework_minor_test gtdt_tests[] = {
static fwts_framework_ops gtdt_ops = {
.description = "GTDT Generic Timer Description Table test.",
- .init = gtdt_init,
+ .init = GTDT_init,
.minor_tests = gtdt_tests
};
diff --git a/src/acpi/spcr/spcr.c b/src/acpi/spcr/spcr.c
index a1318f02..9e3b5cbe 100644
--- a/src/acpi/spcr/spcr.c
+++ b/src/acpi/spcr/spcr.c
@@ -37,13 +37,8 @@ static int spcr_init(fwts_framework *fw)
return FWTS_ERROR;
}
if (table == NULL || (table && table->length == 0)) {
- if (fw->flags & FWTS_FLAG_SBBR) {
- fwts_log_error(fw, "ACPI SPCR table does not exist");
- return FWTS_ERROR;
- } else {
- fwts_log_error(fw, "ACPI SPCR table does not exist, skipping test");
- return FWTS_SKIP;
- }
+ fwts_log_error(fw, "ACPI SPCR table does not exist, skipping test");
+ return FWTS_SKIP;
}
spcr = (const fwts_acpi_table_spcr*)table->data;
diff --git a/src/acpi/xsdt/xsdt.c b/src/acpi/xsdt/xsdt.c
index 31ede781..17c06eb0 100644
--- a/src/acpi/xsdt/xsdt.c
+++ b/src/acpi/xsdt/xsdt.c
@@ -27,24 +27,7 @@
#include <string.h>
static fwts_acpi_table_info *table;
-
-static int xsdt_init(fwts_framework *fw)
-{
- if (fwts_acpi_find_table(fw, "XSDT", 0, &table) != FWTS_OK) {
- fwts_log_error(fw, "Cannot read ACPI tables.");
- return FWTS_ERROR;
- }
- if (table == NULL || (table && table->length == 0)) {
- if (fw->flags & FWTS_FLAG_SBBR) {
- fwts_log_error(fw, "ACPI XSDT table does not exist");
- return FWTS_ERROR;
- } else {
- fwts_log_error(fw, "ACPI XSDT table does not exist, skipping test");
- return FWTS_SKIP;
- }
- }
- return FWTS_OK;
-}
+acpi_table_init(XSDT, &table)
/*
* XSDT Extended System Description Table
@@ -96,7 +79,7 @@ static fwts_framework_minor_test xsdt_tests[] = {
static fwts_framework_ops xsdt_ops = {
.description = "XSDT Extended System Description Table test.",
- .init = xsdt_init,
+ .init = XSDT_init,
.minor_tests = xsdt_tests
};
--
2.31.1
More information about the fwts-devel
mailing list