[PATCH 1/2] acpi: sdei: add ACPI SDEI test (mantis 1714)
Alex Hung
alex.hung at canonical.com
Fri Aug 4 22:49:55 UTC 2017
Signed-off-by: Alex Hung <alex.hung at canonical.com>
---
src/Makefile.am | 1 +
src/acpi/sdei/sdei.c | 88 +++++++++++++++++++++++++++++++++++++++++++++
src/lib/include/fwts_acpi.h | 8 +++++
3 files changed, 97 insertions(+)
create mode 100644 src/acpi/sdei/sdei.c
diff --git a/src/Makefile.am b/src/Makefile.am
index 916834c..43c398e 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -104,6 +104,7 @@ fwts_SOURCES = main.c \
acpi/s3power/s3power.c \
acpi/s4/s4.c \
acpi/sbst/sbst.c \
+ acpi/sdei/sdei.c \
acpi/slic/slic.c \
acpi/slit/slit.c \
acpi/spcr/spcr.c \
diff --git a/src/acpi/sdei/sdei.c b/src/acpi/sdei/sdei.c
new file mode 100644
index 0000000..c75300e
--- /dev/null
+++ b/src/acpi/sdei/sdei.c
@@ -0,0 +1,88 @@
+/*
+ * Copyright (C) 2017 Canonical
+ *
+ * Portions of this code original from the Linux-ready Firmware Developer Kit
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+#include "fwts.h"
+
+#if defined(FWTS_HAS_ACPI)
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <unistd.h>
+#include <inttypes.h>
+#include <string.h>
+
+static fwts_acpi_table_info *table;
+
+static int sdei_init(fwts_framework *fw)
+{
+ if (fwts_acpi_find_table(fw, "SDEI", 0, &table) != FWTS_OK) {
+ fwts_log_error(fw, "Cannot read ACPI tables");
+ return FWTS_ERROR;
+ }
+ if (table == NULL || (table && table->length == 0)) {
+ fwts_log_error(fw, "ACPI SDEI table does not exist, skipping test");
+ return FWTS_SKIP;
+ }
+
+ return FWTS_OK;
+}
+
+static int sdei_test1(fwts_framework *fw)
+{
+ fwts_acpi_table_sdei *sdei = (fwts_acpi_table_sdei *) table->data;
+ bool passed = true;
+
+ fwts_log_info_verbatim(fw, "SDEI (Software Delegated Exception Interface) Table:");
+
+ /* Current spec says:
+ * "The table consists only of a basic header with revision 1."
+ * "Later revisions of the SDEI table may define additional fields."
+ *
+ * More validation will be implemented for revision 2 and later.
+ */
+ switch (sdei->header.revision) {
+ case 1:
+ /* nothing to validate */
+ break;
+ default:
+ fwts_log_info(fw, "Unsupported SDEI Revision %" PRIu8, sdei->header.revision);
+ break;
+ }
+
+ if (passed)
+ fwts_passed(fw, "No issues found in SDEI table.");
+
+ return FWTS_OK;
+}
+
+static fwts_framework_minor_test sdei_tests[] = {
+ { sdei_test1, "Validate SDEI table." },
+ { NULL, NULL }
+};
+
+static fwts_framework_ops sdei_ops = {
+ .description = "SDEI Software Delegated Exception Interface Table test",
+ .init = sdei_init,
+ .minor_tests = sdei_tests
+};
+
+FWTS_REGISTER("sdei", &sdei_ops, FWTS_TEST_ANYTIME, FWTS_FLAG_BATCH | FWTS_FLAG_TEST_ACPI)
+
+#endif
diff --git a/src/lib/include/fwts_acpi.h b/src/lib/include/fwts_acpi.h
index 0742ef3..12d63aa 100644
--- a/src/lib/include/fwts_acpi.h
+++ b/src/lib/include/fwts_acpi.h
@@ -1770,6 +1770,14 @@ typedef struct {
} __attribute__ ((packed)) fwts_acpi_table_msdm;
/*
+ * ACPI SDEI (Software Delegated Exception Interface)
+ * http://infocenter.arm.com/help/topic/com.arm.doc.den0054a/ARM_DEN0054A_Software_Delegated_Exception_Interface.pdf
+ */
+typedef struct {
+ fwts_acpi_table_header header;
+} __attribute__ ((packed)) fwts_acpi_table_sdei;
+
+/*
* ACPI IORT (IO Remapping Table)
* http://infocenter.arm.com/help/topic/com.arm.doc.den0049a/DEN0049A_IO_Remapping_Table.pdf
*/
--
2.7.4
More information about the fwts-devel
mailing list