{"id":811394,"url":"http://patchwork.ozlabs.org/api/patches/811394/?format=json","web_url":"http://patchwork.ozlabs.org/project/fwts/patch/1504861633-20512-2-git-send-email-alex.hung@canonical.com/","project":{"id":24,"url":"http://patchwork.ozlabs.org/api/projects/24/?format=json","name":"Firmware Test Suite development","link_name":"fwts","list_id":"fwts-devel.lists.ubuntu.com","list_email":"fwts-devel@lists.ubuntu.com","web_url":null,"scm_url":null,"webscm_url":null,"list_archive_url":"","list_archive_url_format":"","commit_url_format":""},"msgid":"<1504861633-20512-2-git-send-email-alex.hung@canonical.com>","list_archive_url":null,"date":"2017-09-08T09:07:12","name":"[2/3] acpi: replace checks for Flags by fwts_acpi_reserved_bits_check","commit_ref":null,"pull_url":null,"state":"accepted","archived":false,"hash":"63f252e4533d06a85d7c4d0cc6a5be9f614eae66","submitter":{"id":10593,"url":"http://patchwork.ozlabs.org/api/people/10593/?format=json","name":"Alex Hung","email":"alex.hung@canonical.com"},"delegate":null,"mbox":"http://patchwork.ozlabs.org/project/fwts/patch/1504861633-20512-2-git-send-email-alex.hung@canonical.com/mbox/","series":[{"id":2142,"url":"http://patchwork.ozlabs.org/api/series/2142/?format=json","web_url":"http://patchwork.ozlabs.org/project/fwts/list/?series=2142","date":"2017-09-08T09:07:11","name":"[1/3] lib: fwts_acpi_tables: add a new function to check reserved bits","version":1,"mbox":"http://patchwork.ozlabs.org/series/2142/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/patches/811394/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/811394/checks/","tags":{},"related":[],"headers":{"Return-Path":"<fwts-devel-bounces@lists.ubuntu.com>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming@bilbo.ozlabs.org","Authentication-Results":"ozlabs.org;\n\tspf=none (mailfrom) smtp.mailfrom=lists.ubuntu.com\n\t(client-ip=91.189.94.19; helo=huckleberry.canonical.com;\n\tenvelope-from=fwts-devel-bounces@lists.ubuntu.com;\n\treceiver=<UNKNOWN>)","Received":["from huckleberry.canonical.com (huckleberry.canonical.com\n\t[91.189.94.19])\n\tby ozlabs.org (Postfix) with ESMTP id 3xpWg81X3Wz9s0g;\n\tFri,  8 Sep 2017 19:07:32 +1000 (AEST)","from localhost ([127.0.0.1] helo=huckleberry.canonical.com)\n\tby huckleberry.canonical.com with esmtp (Exim 4.86_2)\n\t(envelope-from <fwts-devel-bounces@lists.ubuntu.com>)\n\tid 1dqFG6-0000qK-WD; Fri, 08 Sep 2017 09:07:31 +0000","from youngberry.canonical.com ([91.189.89.112])\n\tby huckleberry.canonical.com with esmtps\n\t(TLS1.0:DHE_RSA_AES_128_CBC_SHA1:128)\n\t(Exim 4.86_2) (envelope-from <alex.hung@canonical.com>)\n\tid 1dqFG4-0000q1-7Y\n\tfor fwts-devel@lists.ubuntu.com; Fri, 08 Sep 2017 09:07:28 +0000","from 1.general.alexhung.us.vpn ([10.172.65.254] helo=canonical.com)\n\tby youngberry.canonical.com with esmtpsa\n\t(TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.76)\n\t(envelope-from <alex.hung@canonical.com>)\n\tid 1dqFG3-00017O-Hu; Fri, 08 Sep 2017 09:07:28 +0000"],"From":"Alex Hung <alex.hung@canonical.com>","To":"fwts-devel@lists.ubuntu.com","Subject":"[PATCH 2/3] acpi: replace checks for Flags by\n\tfwts_acpi_reserved_bits_check","Date":"Fri,  8 Sep 2017 02:07:12 -0700","Message-Id":"<1504861633-20512-2-git-send-email-alex.hung@canonical.com>","X-Mailer":"git-send-email 2.7.4","In-Reply-To":"<1504861633-20512-1-git-send-email-alex.hung@canonical.com>","References":"<1504861633-20512-1-git-send-email-alex.hung@canonical.com>","X-BeenThere":"fwts-devel@lists.ubuntu.com","X-Mailman-Version":"2.1.20","Precedence":"list","List-Id":"Firmware Test Suite Development <fwts-devel.lists.ubuntu.com>","List-Unsubscribe":"<https://lists.ubuntu.com/mailman/options/fwts-devel>,\n\t<mailto:fwts-devel-request@lists.ubuntu.com?subject=unsubscribe>","List-Archive":"<https://lists.ubuntu.com/archives/fwts-devel>","List-Post":"<mailto:fwts-devel@lists.ubuntu.com>","List-Help":"<mailto:fwts-devel-request@lists.ubuntu.com?subject=help>","List-Subscribe":"<https://lists.ubuntu.com/mailman/listinfo/fwts-devel>,\n\t<mailto:fwts-devel-request@lists.ubuntu.com?subject=subscribe>","MIME-Version":"1.0","Content-Type":"text/plain; charset=\"utf-8\"","Content-Transfer-Encoding":"base64","Errors-To":"fwts-devel-bounces@lists.ubuntu.com","Sender":"\"fwts-devel\" <fwts-devel-bounces@lists.ubuntu.com>"},"content":"Signed-off-by: Alex Hung <alex.hung@canonical.com>\n---\n src/acpi/asf/asf.c   |  9 +--------\n src/acpi/drtm/drtm.c |  9 +--------\n src/acpi/einj/einj.c |  9 +--------\n src/acpi/facs/facs.c | 20 ++++----------------\n src/acpi/gtdt/gtdt.c |  8 +-------\n src/acpi/hest/hest.c | 33 +++------------------------------\n src/acpi/hmat/hmat.c | 19 ++-----------------\n src/acpi/iort/iort.c | 29 +++++------------------------\n src/acpi/mpst/mpst.c | 18 ++----------------\n src/acpi/nfit/nfit.c | 24 +++---------------------\n src/acpi/pcct/pcct.c | 34 ++++++++++------------------------\n src/acpi/pmtt/pmtt.c |  9 +--------\n src/acpi/pptt/pptt.c | 18 ++----------------\n src/acpi/spcr/spcr.c | 10 +---------\n src/acpi/srat/srat.c | 39 +++++++--------------------------------\n src/acpi/waet/waet.c | 10 ++--------\n src/acpi/wdat/wdat.c |  9 +--------\n src/acpi/wsmt/wsmt.c |  9 +--------\n src/acpi/xenv/xenv.c |  9 +--------\n 19 files changed, 49 insertions(+), 276 deletions(-)","diff":"diff --git a/src/acpi/asf/asf.c b/src/acpi/asf/asf.c\nindex a95c8de..70f5050 100644\n--- a/src/acpi/asf/asf.c\n+++ b/src/acpi/asf/asf.c\n@@ -95,15 +95,8 @@ static void asf_check_info(\n \t\t\t\" and must be in the range 0x02..0xff\",\n \t\t\tinfo->min_sensor_poll_wait_time);\n \t}\n-\tif (info->flags & ~0x01) {\n-\t\t*passed = false;\n-\t\tfwts_failed(fw, LOG_LEVEL_HIGH,\n-\t\t\t\"ASF!InfoFeatureFlagsReserved\",\n-\t\t\t\"ASF! ASF_INFO Feature Flags is 0x%\" PRIx8\n-\t\t\t\", however reserved bits [7:1] must be zero\",\n-\t\t\tinfo->flags);\n-\t}\n \n+\tfwts_acpi_reserved_bits_check(fw, \"ASF!\", \"ASF_INFO Feature Flags\", info->flags, sizeof(info->flags), 1, 7, passed);\n \tfwts_acpi_reserved_zero_check(fw, \"ASF!\", \"ASF_INFO Reserved1\", info->reserved1, sizeof(info->reserved1), passed);\n \tfwts_acpi_reserved_zero_check(fw, \"ASF!\", \"ASF_INFO Reserved2\", info->reserved2, sizeof(info->reserved2), passed);\n \tfwts_acpi_reserved_zero_check(fw, \"ASF!\", \"ASF_INFO Reserved3\", info->reserved3, sizeof(info->reserved3), passed);\ndiff --git a/src/acpi/drtm/drtm.c b/src/acpi/drtm/drtm.c\nindex 8149b27..6e46b1b 100644\n--- a/src/acpi/drtm/drtm.c\n+++ b/src/acpi/drtm/drtm.c\n@@ -66,14 +66,7 @@ static int drtm_test1(fwts_framework *fw)\n \tfwts_log_info_verbatim(fw, \"  Architecture_Dependent:   0x%16.16\" PRIx64, drtm->arch_dependent_address);\n \tfwts_log_info_verbatim(fw, \"  DRT_Flags:                0x%8.8\" PRIx32, drtm->flags);\n \n-\tif (drtm->flags & ~0x0F) {\n-\t\tpassed = false;\n-\t\tfwts_failed(fw, LOG_LEVEL_MEDIUM,\n-\t\t\t\"DRTMBadFlagReservedNonZero\",\n-\t\t\t\"DRTM DRT_Flags Bits [31:4] are reserved, got 0x%8.8\" PRIx32\n-\t\t\t\" instead\",\tdrtm->flags);\n-\t}\n-\n+\tfwts_acpi_reserved_bits_check(fw, \"DRTM\", \"DRT_Flags\", drtm->flags, sizeof(drtm->flags), 4, 31, &passed);\n \tfwts_log_nl(fw);\n \n \toffset = sizeof(fwts_acpi_table_drtm);\ndiff --git a/src/acpi/einj/einj.c b/src/acpi/einj/einj.c\nindex 4c2ff8b..1ef0e96 100644\n--- a/src/acpi/einj/einj.c\n+++ b/src/acpi/einj/einj.c\n@@ -63,14 +63,7 @@ static int einj_test1(fwts_framework *fw)\n \tfwts_log_info_verbatim(fw, \"  Injection Entry Count: 0x%8.8\" PRIx32,\n \t\t\teinj->count);\n \n-\tif (einj->flags) {\n-\t\tfwts_failed(fw, LOG_LEVEL_LOW,\n-\t\t\t    \"EINJFlagNonZero\",\n-\t\t\t    \"EINJ Injection Flags field must be zero, got 0x%\"\n-\t\t\t    PRIx8 \" instead\", einj->flags);\n-\t\tpassed = false;\n-\t}\n-\n+\tfwts_acpi_reserved_bits_check(fw, \"EINJ\", \"Injection Flags\", einj->flags, sizeof(einj->flags), 0, 31, &passed);\n \tfwts_acpi_reserved_zero_check(fw, \"EINJ\", \"Reserved\", reserved, sizeof(reserved), &passed);\n \n \tfwts_log_nl(fw);\ndiff --git a/src/acpi/facs/facs.c b/src/acpi/facs/facs.c\nindex c41b57c..714e473 100644\n--- a/src/acpi/facs/facs.c\n+++ b/src/acpi/facs/facs.c\n@@ -130,22 +130,10 @@ static int facs_test1(fwts_framework *fw)\n \t\t\t\"FACSInvalidReserved1\",\n \t\t\t\"FACS: 1st Reserved field is non-zero\");\n \t}\n-\tif (facs->flags & ~0x03) {\n-\t\tpassed = false;\n-\t\tfwts_failed(fw, LOG_LEVEL_MEDIUM,\n-\t\t\t\"FACSFlagsReservedBitsSet\",\n-\t\t\t\"FACS: Flags field is 0x%\" PRIx32\n-\t\t\t\" and some of the reserved bits [31:2] are set\",\n-\t\t\tfacs->flags);\n-\t}\n-\tif (facs->ospm_flags & ~0x01) {\n-\t\tpassed = false;\n-\t\tfwts_failed(fw, LOG_LEVEL_MEDIUM,\n-\t\t\t\"FACSFlagsReservedBitsSet\",\n-\t\t\t\"FACS: OSPM Flags field is 0x%\" PRIx32\n-\t\t\t\" and some of the reserved bits [31:1] are set\",\n-\t\t\tfacs->ospm_flags);\n-\t}\n+\n+\tfwts_acpi_reserved_bits_check(fw, \"FACS\", \"Flags\", facs->flags, sizeof(facs->flags), 2, 31, &passed);\n+\tfwts_acpi_reserved_bits_check(fw, \"FACS\", \"OSPM Flags\", facs->ospm_flags, sizeof(facs->ospm_flags), 1, 31, &passed);\n+\n \tfor (i = 0; i < 24; i++) {\n \t\tif (facs->reserved2[i]) {\n \t\t\tpassed = false;\ndiff --git a/src/acpi/gtdt/gtdt.c b/src/acpi/gtdt/gtdt.c\nindex f5a10e0..1559d31 100644\n--- a/src/acpi/gtdt/gtdt.c\n+++ b/src/acpi/gtdt/gtdt.c\n@@ -56,13 +56,7 @@ static int gtdt_test1(fwts_framework *fw)\n \tuint32_t i = 0, n;\n \tconst fwts_acpi_table_gtdt *gtdt = (const fwts_acpi_table_gtdt *)table->data;\n \n-\tif (gtdt->virtual_timer_flags & ~7) {\n-\t\tpassed = false;\n-\t\tfwts_failed(fw, LOG_LEVEL_LOW,\n-\t\t\t\"GTDTFlagReservedNonZero\",\n-\t\t\t\"GTDT flag reserved bits 3 to 31 are non-zero, \"\n-\t\t\t\"instead got 0x%\" PRIx32 \".\", gtdt->virtual_timer_flags);\n-\t}\n+\tfwts_acpi_reserved_bits_check(fw, \"GTDT\", \"Flags\", gtdt->virtual_timer_flags, sizeof(gtdt->virtual_timer_flags), 3, 31, &passed);\n \n \tptr = (uint8_t *)table->data + gtdt->platform_timer_offset;\n \tn = gtdt->platform_timer_count;\ndiff --git a/src/acpi/hest/hest.c b/src/acpi/hest/hest.c\nindex 6a1bfd2..86a5312 100644\n--- a/src/acpi/hest/hest.c\n+++ b/src/acpi/hest/hest.c\n@@ -399,16 +399,7 @@ static void hest_check_pci_express_root_port_aer(\n \tfwts_log_nl(fw);\n \n \tfwts_acpi_reserved_zero_check(fw, \"HEST\", \"PCI Express Root Port Reserved1\", aer->reserved1, sizeof(aer->reserved1), passed);\n-\n-\tif (aer->flags & ~0x3) {\n-\t\t*passed = false;\n-\t\tfwts_failed(fw, LOG_LEVEL_MEDIUM,\n-\t\t\t\"HESTPciExpressRootPortFlagsReserved\",\n-\t\t\t\"HEST PCI Express Root Port Flags Reserved bits \"\n-\t\t\t\"[2:7] must be zero, instead got 0x%\" PRIx8,\n-\t\t\taer->flags);\n-\t}\n-\n+\tfwts_acpi_reserved_bits_check(fw, \"HEST\", \"PCI Express Root Port Flags\", aer->flags, sizeof(aer->flags), 2, 7, passed);\n \tfwts_acpi_reserved_zero_check(fw, \"HEST\", \"PCI Express Root Port Reserved2\", aer->reserved2, sizeof(aer->reserved2), passed);\n \n \tif (aer->number_of_records_to_preallocate < 1) {\n@@ -476,16 +467,7 @@ static void hest_check_pci_express_device_aer(\n \tfwts_log_nl(fw);\n \n \tfwts_acpi_reserved_zero_check(fw, \"HEST\", \"PCI Express Device Reserved1\", aer->reserved1, sizeof(aer->reserved1), passed);\n-\n-\tif (aer->flags & ~0x3) {\n-\t\t*passed = false;\n-\t\tfwts_failed(fw, LOG_LEVEL_MEDIUM,\n-\t\t\t\"HESTPciExpressDeviceFlagsReserved\",\n-\t\t\t\"HEST PCI Express Device Flags Reserved bits \"\n-\t\t\t\"[2:7] must be zero, instead got 0x%\" PRIx8,\n-\t\t\taer->flags);\n-\t}\n-\n+\tfwts_acpi_reserved_bits_check(fw, \"HEST\", \"PCI Express Device Flags\", aer->flags, sizeof(aer->flags), 2, 7, passed);\n \tfwts_acpi_reserved_zero_check(fw, \"HEST\", \"PCI Express Device Reserved2\", aer->reserved2, sizeof(aer->reserved2), passed);\n \n \tif (aer->number_of_records_to_preallocate < 1) {\n@@ -557,16 +539,7 @@ static void hest_heck_pci_express_bridge_aer(\n \tfwts_log_nl(fw);\n \n \tfwts_acpi_reserved_zero_check(fw, \"HEST\", \"PCI Express Bridge Reserved1\", aer->reserved1, sizeof(aer->reserved1), passed);\n-\n-\tif (aer->flags & ~0x3) {\n-\t\t*passed = false;\n-\t\tfwts_failed(fw, LOG_LEVEL_MEDIUM,\n-\t\t\t\"HESTPciExpressBridgeFlagsReserved\",\n-\t\t\t\"HEST PCI Express Bridge Flags Reserved bits \"\n-\t\t\t\"[2:7] must be zero, instead got 0x%\" PRIx8,\n-\t\t\taer->flags);\n-\t}\n-\n+\tfwts_acpi_reserved_bits_check(fw, \"HEST\", \"PCI Express Bridge Flags\", aer->flags, sizeof(aer->flags), 2, 7, passed);\n \tfwts_acpi_reserved_zero_check(fw, \"HEST\", \"PCI Express Bridge Reserved2\", aer->reserved2, sizeof(aer->reserved2), passed);\n \n \tif (aer->number_of_records_to_preallocate < 1) {\ndiff --git a/src/acpi/hmat/hmat.c b/src/acpi/hmat/hmat.c\nindex 7b5c58c..4459f1b 100644\n--- a/src/acpi/hmat/hmat.c\n+++ b/src/acpi/hmat/hmat.c\n@@ -54,15 +54,7 @@ static void hmat_addr_range_test(fwts_framework *fw, const fwts_acpi_table_hmat_\n \tfwts_log_info_verbatim(fw, \"    System Phy Addr Range Length:   0x%16.16\" PRIx64, entry->phy_addr_length);\n \n \tfwts_acpi_reserved_zero_check(fw, \"HMAT\", \"Reserved\", entry->header.reserved, sizeof(entry->header.reserved), passed);\n-\n-\tif (entry->flags & ~0x07) {\n-\t\t*passed = false;\n-\t\tfwts_failed(fw, LOG_LEVEL_HIGH,\n-\t\t\t\"HMATBadFlags\",\n-\t\t\t\"HMAT Flags's Bits[15..3] must be zero, got \"\n-\t\t\t\"0x%4.4\" PRIx16 \" instead\", entry->flags);\n-\t}\n-\n+\tfwts_acpi_reserved_bits_check(fw, \"HMAT\", \"Flags\", entry->flags, sizeof(entry->flags), 3, 15, passed);\n \tfwts_acpi_reserved_zero_check(fw, \"HMAT\", \"Reserved\", entry->reserved1, sizeof(entry->reserved1), passed);\n \tfwts_acpi_reserved_zero_check(fw, \"HMAT\", \"Reserved\", entry->reserved2, sizeof(entry->reserved2), passed);\n }\n@@ -84,14 +76,7 @@ static void hmat_locality_test(fwts_framework *fw, const fwts_acpi_table_hmat_lo\n \tfwts_log_info_verbatim(fw, \"    Entry Base Unit:                0x%16.16\" PRIx64, entry->entry_base_unit);\n \n \tfwts_acpi_reserved_zero_check(fw, \"HMAT\", \"Reserved\", entry->header.reserved, sizeof(entry->header.reserved), passed);\n-\n-\tif (entry->flags & ~0x1f) {\n-\t\t*passed = false;\n-\t\tfwts_failed(fw, LOG_LEVEL_CRITICAL,\n-\t\t\t\"HMATBadFlags\",\n-\t\t\t\"HMAT Flags's Bits[7..5] must be zero, got \"\n-\t\t\t\"0x%2.2\" PRIx8 \" instead\", entry->flags);\n-\t}\n+\tfwts_acpi_reserved_bits_check(fw, \"HMAT\", \"Flags\", entry->flags, sizeof(entry->flags), 5, 7, passed);\n \n \tif (entry->data_type > 5) {\n \t\t*passed = false;\ndiff --git a/src/acpi/iort/iort.c b/src/acpi/iort/iort.c\nindex b131edd..b7046ea 100644\n--- a/src/acpi/iort/iort.c\n+++ b/src/acpi/iort/iort.c\n@@ -238,14 +238,7 @@ static void iort_smmu_interrupt_flags_check(\n \tuint32_t flags,\n \tbool *passed)\n {\n-\tif (flags & ~1) {\n-\t\t*passed = false;\n-\t\tfwts_failed(fw, LOG_LEVEL_MEDIUM,\n-\t\t\t\"IORTSMMUIntrFlagsReservedNonZero\",\n-\t\t\t\"IORT %s Flags field reserved \"\n-\t\t\t\"bits [31:1] should be all zero, got 0x%\" PRIx32,\n-\t\t\tname, flags);\n-\t}\n+\tfwts_acpi_reserved_bits_check(fw, \"IORT\", name, flags, sizeof(flags), 1, 31, passed);\n }\n \n /*\n@@ -588,14 +581,8 @@ static void iort_check_smmu(\n \t\t\t\"IORT SMMU Model is 0x%\" PRIx32 \" and was expecting \"\n \t\t\t\"a model value 0 to 3.\", node->model);\n \t}\n-\tif (node->flags & ~3) {\n-\t\t*passed = false;\n-\t\tfwts_failed(fw, LOG_LEVEL_HIGH,\n-\t\t\t\"IORTSmmuReservedFlags\",\n-\t\t\t\"IORT SMMU Reserved Flags is 0x%\" PRIx32 \" and has \"\n-\t\t\t\"some reserved bits [31:2] set when they should be zero.\",\n-\t\t\tnode->flags);\n-\t}\n+\n+\tfwts_acpi_reserved_bits_check(fw, \"IORT\", \"SMMU Reserved Flags\", node->flags, sizeof(node->flags), 2, 31, passed);\n \tfwts_log_nl(fw);\n }\n \n@@ -634,14 +621,8 @@ static void iort_check_smmuv3(\n \t\t\t\"IORT SMMUv3 Model is 0x%\" PRIx32 \" and was expecting \"\n \t\t\t\"a model value of 0.\", node->model);\n \t}\n-\tif (node->flags & ~3) {\n-\t\t*passed = false;\n-\t\tfwts_failed(fw, LOG_LEVEL_HIGH,\n-\t\t\t\"IORTSmmuv3ReservedFlags\",\n-\t\t\t\"IORT SMMUv3 Reserved Flags is 0x%\" PRIx32 \" and has \"\n-\t\t\t\"some reserved bits [31:2] set when they should be zero.\",\n-\t\t\tnode->flags);\n-\t}\n+\n+\tfwts_acpi_reserved_bits_check(fw, \"IORT\", \"SMMUv3 Reserved Flags\", node->flags, sizeof(node->flags), 2, 31, passed);\n \tfwts_log_nl(fw);\n }\n \ndiff --git a/src/acpi/mpst/mpst.c b/src/acpi/mpst/mpst.c\nindex 7a38f78..f5d9555 100644\n--- a/src/acpi/mpst/mpst.c\n+++ b/src/acpi/mpst/mpst.c\n@@ -87,14 +87,7 @@ static int mpst_test1(fwts_framework *fw)\n \t\tfwts_log_info_verbatim(fw, \"    Number of Power States:        0x%8.8\" PRIx32, power_node->num_states);\n \t\tfwts_log_info_verbatim(fw, \"    Number of Physical Components: 0x%8.8\" PRIx32, power_node->num_components);\n \n-\t\tif (power_node->flags & ~0x7) {\n-\t\t\tpassed = false;\n-\t\t\tfwts_failed(fw, LOG_LEVEL_HIGH,\n-\t\t\t\t\"MPSTBadPowerNodeFlags\",\n-\t\t\t\t\"MPST Power Node Flags Bit 3..7 be zero, got \"\n-\t\t\t\t\"0x%2.2\" PRIx8 \" instead\", power_node->flags);\n-\t\t}\n-\n+\t\tfwts_acpi_reserved_bits_check(fw, \"MPST\", \"Power Node Flags\", power_node->flags, sizeof(power_node->flags), 3, 7, &passed);\n \t\tfwts_acpi_reserved_zero_check(fw, \"MPST\", \"Reserved\", power_node->reserved, sizeof(power_node->reserved), &passed);\n \n \t\tnode_length = sizeof(fwts_acpi_table_mpst_power_node) +\n@@ -180,14 +173,7 @@ static int mpst_test1(fwts_framework *fw)\n \t\t\t\t\"0x%2.2\" PRIx8 \" instead\", (power_char->structure_id & 0xC0) >> 6);\n \t\t}\n \n-\t\tif (power_char->flags & ~0x7) {\n-\t\t\tpassed = false;\n-\t\t\tfwts_failed(fw, LOG_LEVEL_HIGH,\n-\t\t\t\t\"MPSTBadPowerCharacteristicsFlags\",\n-\t\t\t\t\"MPST Power Characteristics Flags Bit 3..7 be zero, got \"\n-\t\t\t\t\"0x%2.2\" PRIx8 \" instead\", power_char->flags);\n-\t\t}\n-\n+\t\tfwts_acpi_reserved_bits_check(fw, \"MPST\", \"Power Characteristics Flags\", power_char->flags, sizeof(power_char->flags), 3, 7, &passed);\n \t\tfwts_acpi_reserved_zero_check(fw, \"MPST\", \"Reserved1\", power_char->reserved1, sizeof(power_char->reserved1), &passed);\n \t\tfwts_acpi_reserved_zero_check(fw, \"MPST\", \"Reserved2\", power_char->reserved2, sizeof(power_char->reserved2), &passed);\n \ndiff --git a/src/acpi/nfit/nfit.c b/src/acpi/nfit/nfit.c\nindex c3b69db..fc69798 100644\n--- a/src/acpi/nfit/nfit.c\n+++ b/src/acpi/nfit/nfit.c\n@@ -162,13 +162,7 @@ static int nfit_test1(fwts_framework *fw)\n \t\t\t\t}\n \t\t\t}\n \n-\t\t\tif (nfit_struct->flags & ~0x03) {\n-\t\t\t\tpassed = false;\n-\t\t\t\tfwts_failed(fw, LOG_LEVEL_HIGH,\n-\t\t\t\t\t\"NFITBadFlags\",\n-\t\t\t\t\t\"NFIT Flags's Bits[15..2] must be zero, got \"\n-\t\t\t\t\t\"0x%8.8\" PRIx32 \" instead\", nfit_struct->flags);\n-\t\t\t}\n+\t\t\tfwts_acpi_reserved_bits_check(fw, \"NFIT\", \"Flags\", nfit_struct->flags, sizeof(nfit_struct->flags), 2, 15, &passed);\n \n \t\t\tif (nfit_struct->reserved != 0)\n \t\t\t\treserved_passed = nfit_struct->reserved;\n@@ -199,13 +193,7 @@ static int nfit_test1(fwts_framework *fw)\n \t\t\tfwts_log_info_verbatim(fw, \"    NVDIMM State Flags:                     0x%4.4\" PRIx16, nfit_struct->flags);\n \t\t\tfwts_log_info_verbatim(fw, \"    Reserved:                               0x%4.4\" PRIx16, nfit_struct->reserved);\n \n-\t\t\tif (nfit_struct->flags & ~0x7F) {\n-\t\t\t\tpassed = false;\n-\t\t\t\tfwts_failed(fw, LOG_LEVEL_HIGH,\n-\t\t\t\t\t\"NFITBadFlags\",\n-\t\t\t\t\t\"NFIT Flags's Bits[15..7] must be zero, got \"\n-\t\t\t\t\t\"0x%8.8\" PRIx32 \" instead\", nfit_struct->flags);\n-\t\t\t}\n+\t\t\tfwts_acpi_reserved_bits_check(fw, \"NFIT\", \"NVDIMM State Flags\", nfit_struct->flags, sizeof(nfit_struct->flags), 7, 15, &passed);\n \n \t\t\tif (nfit_struct->reserved != 0)\n \t\t\t\treserved_passed = nfit_struct->reserved;\n@@ -304,13 +292,7 @@ static int nfit_test1(fwts_framework *fw)\n \t\t\t\t\t\"0x%2.2\" PRIx8 \" instead\", nfit_struct->valid_fields);\n \t\t\t}\n \n-\t\t\tif (nfit_struct->flags & ~0x01) {\n-\t\t\t\tpassed = false;\n-\t\t\t\tfwts_failed(fw, LOG_LEVEL_HIGH,\n-\t\t\t\t\t\"NFITBadFlags\",\n-\t\t\t\t\t\"NFIT Flags's Bits[15..1] must be zero, got \"\n-\t\t\t\t\t\"0x%4.4\" PRIx16 \" instead\", nfit_struct->flags);\n-\t\t\t}\n+\t\t\tfwts_acpi_reserved_bits_check(fw, \"NFIT\", \"NVDIMM Control Region Flags\", nfit_struct->flags, sizeof(nfit_struct->flags), 1, 15, &passed);\n \n \t\t} else if (entry->type == FWTS_ACPI_NFIT_TYPE_DATA_REGION) {\n \t\t\tfwts_acpi_table_nfit_data_range *nfit_struct = (fwts_acpi_table_nfit_data_range *) entry;\ndiff --git a/src/acpi/pcct/pcct.c b/src/acpi/pcct/pcct.c\nindex 424cfc1..c6c18be 100644\n--- a/src/acpi/pcct/pcct.c\n+++ b/src/acpi/pcct/pcct.c\n@@ -52,19 +52,6 @@ static bool subspace_length_equal(fwts_framework *fw, uint8_t type, uint8_t type\n \treturn true;\n }\n \n-static void platform_interrupt_flags(fwts_framework *fw, uint8_t flags, bool *passed)\n-{\n-\tfwts_log_info_verbatim(fw, \"    Platform Interrupt Flags:    0x%2.2\"   PRIx8, flags);\n-\n-\tif (flags & ~0x3) {\n-\t\t*passed = false;\n-\t\tfwts_failed(fw, LOG_LEVEL_HIGH,\n-\t\t\t\"PCCTBadSubtypePlatformbInterruptlags\",\n-\t\t\t\"PCCT Subspace Platform Interrupt Flags's bit [7:2] be zero, got \"\n-\t\t\t\"0x%2.2\" PRIx8 \" instead\", flags);\n-\t}\n-}\n-\n static void gas_messages(fwts_framework *fw, uint8_t type, fwts_acpi_gas *gas, bool *passed)\n {\n \tfwts_log_info_verbatim(fw, \"      Address Space ID           0x%2.2\"   PRIx8, gas->address_space_id);\n@@ -148,7 +135,7 @@ static void generic_comm_test(fwts_framework *fw, fwts_acpi_table_pcct_subspace_\n static void hw_reduced_comm_test_type1(fwts_framework *fw, fwts_acpi_table_pcct_subspace_type_1 *entry, bool *passed)\n {\n \tfwts_log_info_verbatim(fw, \"    Platform Interrupt:          0x%8.8\"   PRIx32, entry->platform_interrupt);\n-\tplatform_interrupt_flags(fw, entry->platform_interrupt_flags, passed);\n+\tfwts_log_info_verbatim(fw, \"    Platform Interrupt Flags:    0x%2.2\"   PRIx8, entry->platform_interrupt_flags);\n \tfwts_log_info_verbatim(fw, \"    Reserved:                    0x%2.2\"   PRIx8, entry->reserved);\n \tfwts_log_info_verbatim(fw, \"    Base Address:                0x%16.16\" PRIx64, entry->base_address);\n \tmemory_length(fw, entry->header.type, entry->length, 8, passed);\n@@ -159,12 +146,14 @@ static void hw_reduced_comm_test_type1(fwts_framework *fw, fwts_acpi_table_pcct_\n \tfwts_log_info_verbatim(fw, \"    Nominal Latency:             0x%8.8\"   PRIx32, entry->nominal_latency);\n \tfwts_log_info_verbatim(fw, \"    Max Periodic Access Rate:    0x%8.8\"   PRIx32, entry->max_periodic_access_rate);\n \tfwts_log_info_verbatim(fw, \"    Min Request Turnaround Time: 0x%8.8\"   PRIx32, entry->min_request_turnaround_time);\n+\n+\tfwts_acpi_reserved_bits_check(fw, \"PCCT\", \"Platform Interrupt Flags\", entry->platform_interrupt_flags, sizeof(uint8_t), 2, 7, passed);\n }\n \n static void hw_reduced_comm_test_type2(fwts_framework *fw, fwts_acpi_table_pcct_subspace_type_2 *entry, bool *passed)\n {\n \tfwts_log_info_verbatim(fw, \"    Platform Interrupt:          0x%8.8\"   PRIx32, entry->platform_interrupt);\n-\tplatform_interrupt_flags(fw, entry->platform_interrupt_flags, passed);\n+\tfwts_log_info_verbatim(fw, \"    Platform Interrupt Flags:    0x%2.2\"   PRIx8, entry->platform_interrupt_flags);\n \tfwts_log_info_verbatim(fw, \"    Reserved:                    0x%2.2\"   PRIx8, entry->reserved);\n \tfwts_log_info_verbatim(fw, \"    Base Address:                0x%16.16\" PRIx64, entry->base_address);\n \tmemory_length(fw, entry->header.type, entry->length, 8, passed);\n@@ -179,12 +168,14 @@ static void hw_reduced_comm_test_type2(fwts_framework *fw, fwts_acpi_table_pcct_\n \tgas_messages(fw, entry->header.type, &entry->platform_ack_register, passed);\n \tfwts_log_info_verbatim(fw, \"    Platform Ack Preserve:       0x%16.16\" PRIx64, entry->platform_ack_preserve);\n \tfwts_log_info_verbatim(fw, \"    Platform Ack Write:          0x%16.16\" PRIx64, entry->platform_ack_write);\n+\n+\tfwts_acpi_reserved_bits_check(fw, \"PCCT\", \"Platform Interrupt Flags\", entry->platform_interrupt_flags, sizeof(uint8_t), 2, 7, passed);\n }\n \n static void extended_pcc_test(fwts_framework *fw, fwts_acpi_table_pcct_subspace_type_3_4 *entry, bool *passed)\n {\n \tfwts_log_info_verbatim(fw, \"    Platform Interrupt:          0x%8.8\"   PRIx32, entry->platform_interrupt);\n-\tplatform_interrupt_flags(fw, entry->platform_interrupt_flags, passed);\n+\tfwts_log_info_verbatim(fw, \"    Platform Interrupt Flags:    0x%2.2\"   PRIx8, entry->platform_interrupt_flags);\n \tfwts_log_info_verbatim(fw, \"    Reserved:                    0x%2.2\"   PRIx8, entry->reserved1);\n \tfwts_log_info_verbatim(fw, \"    Base Address:                0x%16.16\" PRIx64, entry->base_address);\n \tmemory_length(fw, entry->header.type, entry->length, 16, passed);\n@@ -210,6 +201,8 @@ static void extended_pcc_test(fwts_framework *fw, fwts_acpi_table_pcct_subspace_\n \tfwts_log_info_verbatim(fw, \"    Error Status Register:\");\n \tgas_messages(fw, entry->header.type, &entry->error_status_register, passed);\n \tfwts_log_info_verbatim(fw, \"    Error Status Mask:           0x%16.16\" PRIx64, entry->error_status_mask);\n+\n+\tfwts_acpi_reserved_bits_check(fw, \"PCCT\", \"Platform Interrupt Flags\", entry->platform_interrupt_flags, sizeof(uint8_t), 2, 7, passed);\n }\n \n static int pcct_test1(fwts_framework *fw)\n@@ -224,14 +217,7 @@ static int pcct_test1(fwts_framework *fw)\n \tfwts_log_info_verbatim(fw, \"  Reserved:  0x%16.16\"   PRIx64, pcct->reserved);\n \tfwts_log_nl(fw);\n \n-\tif ((pcct->flags & ~0x01) != 0) {\n-\t\tpassed = false;\n-\t\tfwts_failed(fw, LOG_LEVEL_HIGH,\n-\t\t\t\"PCCTBadFlags\",\n-\t\t\t\"PCCT flags field's bit 1..31 be zero, got \"\n-\t\t\t\"0x%8.8\" PRIx32 \" instead\", pcct->flags);\n-\t}\n-\n+\tfwts_acpi_reserved_bits_check(fw, \"PCCT\", \"Flags\", pcct->flags, sizeof(pcct->flags), 1, 31, &passed);\n \tfwts_acpi_reserved_zero_check(fw, \"PCCT\", \"Reserved\", pcct->reserved, sizeof(pcct->reserved), &passed);\n \n \toffset = sizeof(fwts_acpi_table_pcct);\ndiff --git a/src/acpi/pmtt/pmtt.c b/src/acpi/pmtt/pmtt.c\nindex 915b0c6..f7cdd61 100644\n--- a/src/acpi/pmtt/pmtt.c\n+++ b/src/acpi/pmtt/pmtt.c\n@@ -49,14 +49,7 @@ static void pmtt_subtable_header_test(fwts_framework *fw, fwts_acpi_table_pmtt_h\n \tfwts_log_info_verbatim(fw, \"    Reserved:                       0x%4.4\" PRIx16, entry->reserved2);\n \n \tfwts_acpi_reserved_zero_check(fw, \"PMTT\", \"Reserved1\", entry->reserved1, sizeof(entry->reserved1), passed);\n-\n-\tif (entry->flags & ~0x0F) {\n-\t\t*passed = false;\n-\t\tfwts_failed(fw, LOG_LEVEL_HIGH,\n-\t\t\t\"PMTTBadFlags\",\n-\t\t\t\"PMTT Flags's Bits[15..4] must be zero, got \"\n-\t\t\t\"0x%4.4\" PRIx16 \" instead\", entry->flags);\n-\t}\n+\tfwts_acpi_reserved_bits_check(fw, \"PMTT\", \"Flags\", entry->flags, sizeof(entry->flags), 4, 15, passed);\n \n \tif ((entry->flags & 0x0C) == 0x0C) {\n \t\t*passed = false;\ndiff --git a/src/acpi/pptt/pptt.c b/src/acpi/pptt/pptt.c\nindex c1d3cc0..50b7491 100644\n--- a/src/acpi/pptt/pptt.c\n+++ b/src/acpi/pptt/pptt.c\n@@ -65,14 +65,7 @@ static void pptt_processor_test(fwts_framework *fw, const fwts_acpi_table_pptt_p\n \t}\n \n \tfwts_acpi_reserved_zero_check(fw, \"PPTT\", \"Reserved\", entry->reserved, sizeof(entry->reserved), passed);\n-\n-\tif (entry->flags & ~0x03) {\n-\t\t*passed = false;\n-\t\tfwts_failed(fw, LOG_LEVEL_HIGH,\n-\t\t\t\"PPTTBadFlags\",\n-\t\t\t\"PPTT Flags's Bits[31..2] must be zero, got \"\n-\t\t\t\"0x%8.8\" PRIx32 \" instead\", entry->flags);\n-\t}\n+\tfwts_acpi_reserved_bits_check(fw, \"PPTT\", \"Flags\", entry->flags, sizeof(entry->flags), 2, 31, passed);\n }\n \n static void pptt_cache_test(fwts_framework *fw, const fwts_acpi_table_pptt_cache *entry, bool *passed)\n@@ -91,14 +84,7 @@ static void pptt_cache_test(fwts_framework *fw, const fwts_acpi_table_pptt_cache\n \tfwts_log_info_verbatim(fw, \"    Line size:                      0x%4.4\" PRIx16, entry->line_size);\n \n \tfwts_acpi_reserved_zero_check(fw, \"PPTT\", \"Reserved\", entry->reserved, sizeof(entry->reserved), passed);\n-\n-\tif (entry->flags & ~0x7f) {\n-\t\t*passed = false;\n-\t\tfwts_failed(fw, LOG_LEVEL_HIGH,\n-\t\t\t\"PPTTBadFlags\",\n-\t\t\t\"PPTT Flags's Bits[31..7] must be zero, got \"\n-\t\t\t\"0x%8.8\" PRIx32 \" instead\", entry->flags);\n-\t}\n+\tfwts_acpi_reserved_bits_check(fw, \"PPTT\", \"Flags\", entry->flags, sizeof(entry->flags), 7, 31, passed);\n \n \tif (entry->attributes & ~0x1f) {\n \t\t*passed = false;\ndiff --git a/src/acpi/spcr/spcr.c b/src/acpi/spcr/spcr.c\nindex 4f91ed6..7ac39d3 100644\n--- a/src/acpi/spcr/spcr.c\n+++ b/src/acpi/spcr/spcr.c\n@@ -290,15 +290,7 @@ static int spcr_test1(fwts_framework *fw)\n \t\t}\n \t}\n \n-\tif (spcr->pci_flags & 0xfffe) {\n-\t\tpassed = false;\n-\t\tfwts_failed(fw, LOG_LEVEL_HIGH,\n-\t\t\t\"SPCRPciFlags\",\n-\t\t\t\"SPCR PCI flags reserved bits 1-31 are %\" PRIx32\n-\t\t\t\", expecting 0\",\n-\t\t\tspcr->pci_flags);\n-\t}\n-\n+\tfwts_acpi_reserved_bits_check(fw, \"SPCR\", \"PCI Flags\", spcr->pci_flags, sizeof(spcr->pci_flags), 1, 31, &passed);\n \tfwts_acpi_reserved_zero_check(fw, \"SPCR\", \"Reserved3\", spcr->reserved3, sizeof(spcr->reserved3), &passed);\n \n \tif (passed)\ndiff --git a/src/acpi/srat/srat.c b/src/acpi/srat/srat.c\nindex 50df660..d7c9007 100644\n--- a/src/acpi/srat/srat.c\n+++ b/src/acpi/srat/srat.c\n@@ -85,14 +85,7 @@ static void srat_check_local_apic_sapic_affinity(\n \tfwts_log_info_verbatim(fw, \"  Clock Domain              0x%8.8\" PRIx32, affinity->clock_domain);\n \tfwts_log_nl(fw);\n \n-\tif (affinity->flags & ~0x1UL) {\n-\t\tfwts_failed(fw, LOG_LEVEL_MEDIUM,\n-\t\t\t\"SRATLocalApicSapicAffinityFlags\",\n-\t\t\t\"SRAT Local APIC/SPAIC Affinity Flags field reserved bits 1..31 should be zero, got \"\n-\t\t\t\"0x%\" PRIx32,\n-\t\t\taffinity->flags);\n-\t\t*passed = false;\n-\t}\n+\tfwts_acpi_reserved_bits_check(fw, \"SRAT\", \"Local APIC/SPAIC Affinity Flags\", affinity->flags, sizeof(affinity->flags), 1, 31, passed);\n \n \t/*\n \t * Not clear of bits 0..7 of Proximity Domain are reserved or not\n@@ -151,14 +144,8 @@ static void srat_check_memory_affinity(\n \tfwts_log_info_verbatim(fw, \"  Reserved:                 0x%16.16\" PRIx64, affinity->reserved3);\n \tfwts_log_nl(fw);\n \n-\tif (affinity->flags & ~0x7UL) {\n-\t\tfwts_failed(fw, LOG_LEVEL_MEDIUM,\n-\t\t\t\"SRATMemoryAffinityFlags\",\n-\t\t\t\"SRAT Memory Affinity Flags field reserved bits 3..31 should be zero, got \"\n-\t\t\t\"0x%\" PRIx32,\n-\t\t\taffinity->flags);\n-\t\t*passed = false;\n-\t}\n+\tfwts_acpi_reserved_bits_check(fw, \"SRAT\", \"Memory Affinity Flags\", affinity->flags, sizeof(affinity->flags), 3, 31, passed);\n+\n done:\n \t*length -= sizeof(fwts_acpi_table_memory_affinity);\n \t*data += sizeof(fwts_acpi_table_memory_affinity);\n@@ -214,14 +201,8 @@ static void srat_check_local_x2apic_affinity(\n \t\t*passed = false;\n \t}\n \n-\tif (affinity->flags & ~0x1UL) {\n-\t\tfwts_failed(fw, LOG_LEVEL_MEDIUM,\n-\t\t\t\"SRATLocalx2apicAffinityFlags\",\n-\t\t\t\"SRAT Local x2APIC Affinity Flags field reserved bits 1..31 should be zero, got \"\n-\t\t\t\"0x%\" PRIx32,\n-\t\t\taffinity->flags);\n-\t\t*passed = false;\n-\t}\n+\tfwts_acpi_reserved_bits_check(fw, \"SRAT\", \"Local x2APIC Affinity Flags\", affinity->flags, sizeof(affinity->flags), 1, 31, passed);\n+\n \t/*\n \t *  Clock domain probably needs deeper sanity checking, for now\n \t *  skip this.\n@@ -270,14 +251,8 @@ static void srat_check_gicc_affinity(\n \tfwts_log_info_verbatim(fw, \"  Clock Domain              0x%8.8\" PRIx32, affinity->clock_domain);\n \tfwts_log_nl(fw);\n \n-\tif (affinity->flags & ~0x1UL) {\n-\t\tfwts_failed(fw, LOG_LEVEL_MEDIUM,\n-\t\t\t\"SRATGICCAffinityFlags\",\n-\t\t\t\"SRAT GICC Affinity Flags field reserved bits 1..31 should be zero, got \"\n-\t\t\t\"0x%\" PRIx32,\n-\t\t\taffinity->flags);\n-\t\t*passed = false;\n-\t}\n+\tfwts_acpi_reserved_bits_check(fw, \"SRAT\", \"GICC Affinity Flags\", affinity->flags, sizeof(affinity->flags), 1, 31, passed);\n+\n \t/*\n \t *  Clock domain probably needs deeper sanity checking, for now\n \t *  skip this.\ndiff --git a/src/acpi/waet/waet.c b/src/acpi/waet/waet.c\nindex ae8cf4d..e6a42dc 100644\n--- a/src/acpi/waet/waet.c\n+++ b/src/acpi/waet/waet.c\n@@ -71,14 +71,8 @@ static int waet_test1(fwts_framework *fw)\n \tfwts_log_info_verbatim(fw, \"    Bit [1] PM Timer Good:  %1\" PRIu32, (waet->flags >> 1) & 1);\n \tfwts_log_nl(fw);\n \n-\tif (waet->flags & ~3) {\n-\t\tpassed = false;\n-\t\tfwts_failed(fw, LOG_LEVEL_HIGH,\n-\t\t\t\"WAETFlagReservedNotZero\",\n-\t\t\t\"WAET Emulated Device Flags was 0x%\" PRIx32\n-\t\t\t\" and so some of reserved bits [31:2] are not zero \"\n-\t\t\t\" as expected.\", waet->flags);\n-\t}\n+\tfwts_acpi_reserved_bits_check(fw, \"WAET\", \"Emulated Device Flags\", waet->flags, sizeof(waet->flags), 2, 31, &passed);\n+\n done:\n \tif (passed)\n \t\tfwts_passed(fw, \"No issues found in WAET table.\");\ndiff --git a/src/acpi/wdat/wdat.c b/src/acpi/wdat/wdat.c\nindex b2de651..3046e56 100644\n--- a/src/acpi/wdat/wdat.c\n+++ b/src/acpi/wdat/wdat.c\n@@ -116,14 +116,7 @@ static int wdat_test1(fwts_framework *fw)\n \t * this does sanity check that somebody has not set these\n \t * bits accidentally.  This is a LOW issue.\n \t */\n-\tif (wdat->watchdog_flags & ~0x81) {\n-\t\tpassed = false;\n-\t\tfwts_failed(fw, LOG_LEVEL_LOW,\n-\t\t\t\"WDATWatchdogFlagsUndefinedSet\",\n-\t\t\t\"WDAT Watchdog Flags bits [6:1] are not all 0. These bits \"\n-\t\t\t\"are not defined in the specification and should be \"\n-\t\t\t\"set to 0. Watchdog flags are: 0x%\" PRIx8, wdat->watchdog_flags);\n-\t}\n+\tfwts_acpi_reserved_bits_check(fw, \"WDAT\", \"Watchdog Flags\", wdat->watchdog_flags, sizeof(wdat->watchdog_flags), 1, 6, &passed);\n \n \ttotal_length = sizeof(fwts_acpi_table_wdat) +\n \t\t(wdat->number_of_entries * sizeof(fwts_acpi_table_wdat_instr_entries));\ndiff --git a/src/acpi/wsmt/wsmt.c b/src/acpi/wsmt/wsmt.c\nindex ad23fba..9405adc 100644\n--- a/src/acpi/wsmt/wsmt.c\n+++ b/src/acpi/wsmt/wsmt.c\n@@ -53,14 +53,7 @@ static int wsmt_test1(fwts_framework *fw)\n \tfwts_log_info_verbatim(fw, \"WSMT Windows SMM Security Mitigations Table:\");\n \tfwts_log_info_verbatim(fw, \"  Protection Flags:      0x%8.8\" PRIx32, wsmt->protection_flags);\n \n-\tif (wsmt->protection_flags & ~0x7) {\n-\t\tpassed = false;\n-\t\tfwts_failed(fw, LOG_LEVEL_MEDIUM,\n-\t\t\t\"WSMTFlagsReserved\",\n-\t\t\t\"WSMT Protection Flags reserved bits \"\n-\t\t\t\"[3:31] must be zero, instead got 0x%\" PRIx32,\n-\t\t\twsmt->protection_flags);\n-\t}\n+\tfwts_acpi_reserved_bits_check(fw, \"WSMT\", \"Protection Flags\", wsmt->protection_flags, sizeof(wsmt->protection_flags), 3, 31, &passed);\n \n \tif ((wsmt->protection_flags & 0x2) && !(wsmt->protection_flags & 0x1)) {\n \t\tpassed = false;\ndiff --git a/src/acpi/xenv/xenv.c b/src/acpi/xenv/xenv.c\nindex 09f8158..74bd428 100644\n--- a/src/acpi/xenv/xenv.c\n+++ b/src/acpi/xenv/xenv.c\n@@ -71,14 +71,7 @@ static int xenv_test1(fwts_framework *fw)\n \tfwts_log_info_verbatim(fw, \"  Evtchn Intr:                     0x%8.8\"   PRIx32, xenv->evtchn_intr);\n \tfwts_log_info_verbatim(fw, \"  Evtchn Intr Flags:               0x%2.2\"   PRIx8,  xenv->evtchn_intr_flags);\n \n-\tif (xenv->evtchn_intr_flags & ~3) {\n-\t\tpassed = false;\n-\t\tfwts_failed(fw, LOG_LEVEL_HIGH,\n-\t\t\t\"XENVBadEvtchnIntrFlags\",\n-\t\t\t\"XENV Evtchn Intr Flags was 0x%2.2\" PRIx8\n-\t\t\t\" and reserved bits [7:2] are not zero.\",\n-\t\t\txenv->evtchn_intr_flags);\n-\t}\n+\tfwts_acpi_reserved_bits_check(fw, \"XENV\", \"Evtchn Intr Flags\", xenv->evtchn_intr_flags, sizeof(xenv->evtchn_intr_flags), 2, 7, &passed);\n \n \tif (passed)\n \t\tfwts_passed(fw, \"No issues found in XENV table.\");\n","prefixes":["2/3"]}