diff mbox series

acpi: iort: update IORT node revision check

Message ID 20220401060728.6222-1-ivan.hu@canonical.com
State Accepted
Headers show
Series acpi: iort: update IORT node revision check | expand

Commit Message

Ivan Hu April 1, 2022, 6:07 a.m. UTC
BugLink: https://bugs.launchpad.net/fwts/+bug/1963841

Signed-off-by: Ivan Hu <ivan.hu@canonical.com>
---
 src/acpi/iort/iort.c | 34 ++++++++++++++++++++++++++++++----
 1 file changed, 30 insertions(+), 4 deletions(-)

Comments

Sunny Wang April 1, 2022, 6:39 a.m. UTC | #1
Looks good to me! Thanks for fixing the issue, Ivan.

Reviewed-by: Sunny Wang <sunny.wang@arm.com>

-----Original Message-----
From: fwts-devel <fwts-devel-bounces@lists.ubuntu.com> On Behalf Of Ivan Hu
Sent: 01 April 2022 07:07
To: fwts-devel@lists.ubuntu.com
Subject: [PATCH] acpi: iort: update IORT node revision check

BugLink: https://bugs.launchpad.net/fwts/+bug/1963841

Signed-off-by: Ivan Hu <ivan.hu@canonical.com>
---
 src/acpi/iort/iort.c | 34 ++++++++++++++++++++++++++++++----
 1 file changed, 30 insertions(+), 4 deletions(-)

diff --git a/src/acpi/iort/iort.c b/src/acpi/iort/iort.c
index f2a8a062..dfd9c074 100644
--- a/src/acpi/iort/iort.c
+++ b/src/acpi/iort/iort.c
@@ -60,7 +60,35 @@ static void iort_node_check(
 {
        fwts_acpi_table_iort_node *node = (fwts_acpi_table_iort_node *)data;

-       if (node->type == 1 || node->type == 3 || node->type == 4) {
+       if (node->type == 1 || node->type == 2 || node->type == 4) {
+               if (node->revision > 4) {
+                       *passed = false;
+                       fwts_failed(fw, LOG_LEVEL_LOW,
+                               "IORTNodeRevisionInvalid",
+                               "IORT Node Revision field is 0x%2.2" PRIx8
+                               " and should be less than 5.",
+                               node->revision);
+               }
+       } else if (node->type == 3 || node->type == 6) {
+               if (node->revision > 3) {
+                       *passed = false;
+                       fwts_failed(fw, LOG_LEVEL_LOW,
+                               "IORTNodeRevisionInvalid",
+                               "IORT Node Revision field is 0x%2.2" PRIx8
+                               " and should be less than 4.",
+                               node->revision);
+               }
+       } else if (node->type == 5) {
+               if (node->revision > 2) {
+                       *passed = false;
+                       fwts_failed(fw, LOG_LEVEL_LOW,
+                               "IORTNodeRevisionInvalid",
+                               "IORT Node Revision field is 0x%2.2" PRIx8
+                               " and should be less than 3.",
+                               node->revision);
+               }
+       } else {
+               /* type 0 */
                if (node->revision > 1) {
                        *passed = false;
                        fwts_failed(fw, LOG_LEVEL_LOW,
@@ -69,9 +97,7 @@ static void iort_node_check(
                                " and should be zero or one.",
                                node->revision);
                }
-
-       } else
-               fwts_acpi_fixed_value(fw, LOG_LEVEL_MEDIUM, "IORT", "IORT Node Revision", node->revision, 0, passed);
+       }

        fwts_acpi_reserved_zero("IORT", "Node Reserved", node->reserved, passed);

--
2.17.1


--
fwts-devel mailing list
fwts-devel@lists.ubuntu.com
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/fwts-devel
IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.
diff mbox series

Patch

diff --git a/src/acpi/iort/iort.c b/src/acpi/iort/iort.c
index f2a8a062..dfd9c074 100644
--- a/src/acpi/iort/iort.c
+++ b/src/acpi/iort/iort.c
@@ -60,7 +60,35 @@  static void iort_node_check(
 {
 	fwts_acpi_table_iort_node *node = (fwts_acpi_table_iort_node *)data;
 
-	if (node->type == 1 || node->type == 3 || node->type == 4) {
+	if (node->type == 1 || node->type == 2 || node->type == 4) {
+		if (node->revision > 4) {
+			*passed = false;
+			fwts_failed(fw, LOG_LEVEL_LOW,
+				"IORTNodeRevisionInvalid",
+				"IORT Node Revision field is 0x%2.2" PRIx8
+				" and should be less than 5.",
+				node->revision);
+		}
+	} else if (node->type == 3 || node->type == 6) {
+		if (node->revision > 3) {
+			*passed = false;
+			fwts_failed(fw, LOG_LEVEL_LOW,
+				"IORTNodeRevisionInvalid",
+				"IORT Node Revision field is 0x%2.2" PRIx8
+				" and should be less than 4.",
+				node->revision);
+		}
+	} else if (node->type == 5) {
+		if (node->revision > 2) {
+			*passed = false;
+			fwts_failed(fw, LOG_LEVEL_LOW,
+				"IORTNodeRevisionInvalid",
+				"IORT Node Revision field is 0x%2.2" PRIx8
+				" and should be less than 3.",
+				node->revision);
+		}
+	} else {
+		/* type 0 */
 		if (node->revision > 1) {
 			*passed = false;
 			fwts_failed(fw, LOG_LEVEL_LOW,
@@ -69,9 +97,7 @@  static void iort_node_check(
 				" and should be zero or one.",
 				node->revision);
 		}
-
-	} else
-		fwts_acpi_fixed_value(fw, LOG_LEVEL_MEDIUM, "IORT", "IORT Node Revision", node->revision, 0, passed);
+	}
 
 	fwts_acpi_reserved_zero("IORT", "Node Reserved", node->reserved, passed);