{"id":811276,"url":"http://patchwork.ozlabs.org/api/patches/811276/?format=json","web_url":"http://patchwork.ozlabs.org/project/fwts/patch/1504831492-16508-1-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":"<1504831492-16508-1-git-send-email-alex.hung@canonical.com>","list_archive_url":null,"date":"2017-09-08T00:44:52","name":"[V2] lib: fwts_acpi_tables: add a new function to check Reserved field","commit_ref":null,"pull_url":null,"state":"accepted","archived":false,"hash":"c6be35162c9ba573e66ba6d695788b46990f53da","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/1504831492-16508-1-git-send-email-alex.hung@canonical.com/mbox/","series":[{"id":2081,"url":"http://patchwork.ozlabs.org/api/series/2081/?format=json","web_url":"http://patchwork.ozlabs.org/project/fwts/list/?series=2081","date":"2017-09-08T00:44:52","name":"[V2] lib: fwts_acpi_tables: add a new function to check Reserved field","version":2,"mbox":"http://patchwork.ozlabs.org/series/2081/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/patches/811276/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/811276/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 3xpJWM6MY1z9sBZ;\n\tFri,  8 Sep 2017 10:45:03 +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 1dq7Pp-0004OF-Ed; Fri, 08 Sep 2017 00:45:01 +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 1dq7Po-0004O6-0d\n\tfor fwts-devel@lists.ubuntu.com; Fri, 08 Sep 2017 00:45:00 +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 1dq7Pn-0003Ag-H2; Fri, 08 Sep 2017 00:44:59 +0000"],"From":"Alex Hung <alex.hung@canonical.com>","To":"fwts-devel@lists.ubuntu.com","Subject":"[PATCH][V2] lib: fwts_acpi_tables: add a new function to check\n\tReserved field","Date":"Thu,  7 Sep 2017 17:44:52 -0700","Message-Id":"<1504831492-16508-1-git-send-email-alex.hung@canonical.com>","X-Mailer":"git-send-email 2.7.4","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/lib/include/fwts_acpi_tables.h |  2 ++\n src/lib/src/fwts_acpi_tables.c     | 43 ++++++++++++++++++++++++++++++++++++++\n 2 files changed, 45 insertions(+)","diff":"diff --git a/src/lib/include/fwts_acpi_tables.h b/src/lib/include/fwts_acpi_tables.h\nindex 2527984..d478d99 100644\n--- a/src/lib/include/fwts_acpi_tables.h\n+++ b/src/lib/include/fwts_acpi_tables.h\n@@ -53,6 +53,8 @@ bool fwts_acpi_obj_find(fwts_framework *fw, const char *obj_name);\n \n fwts_bool fwts_acpi_is_reduced_hardware(const fwts_acpi_table_fadt *fadt);\n \n+void fwts_acpi_reserved_zero_check(fwts_framework *fw, const char *table, const char *field, uint64_t value, uint8_t size, bool *passed);\n+\n #endif\n \n #endif\ndiff --git a/src/lib/src/fwts_acpi_tables.c b/src/lib/src/fwts_acpi_tables.c\nindex 3c3a63a..4ac70f8 100644\n--- a/src/lib/src/fwts_acpi_tables.c\n+++ b/src/lib/src/fwts_acpi_tables.c\n@@ -1383,4 +1383,47 @@ bool fwts_acpi_obj_find(fwts_framework *fw, const char *obj_name)\n \treturn found;\n }\n \n+/*\n+ *  fwts_acpi_reserved_zero_check()\n+ *  verify whether the reserved field is zero\n+ */\n+void fwts_acpi_reserved_zero_check(\n+\tfwts_framework *fw,\n+\tconst char *table,\n+\tconst char *field,\n+\tuint64_t value,\n+\tuint8_t size,\n+\tbool *passed)\n+{\n+\tif (value != 0) {\n+\t\tchar label[20];\n+\t\tstrncpy(label, table, 4);\t/* ACPI table name is 4 char long */\n+\t\tstrncpy(label + 4, \"ReservedNonZero\", sizeof(label) - 4);\n+\n+\t\tswitch (size) {\n+\t\tcase sizeof(uint8_t):\n+\t\t\tfwts_failed(fw, LOG_LEVEL_MEDIUM, label,\n+\t\t\t\t\"%4.4s %s field must be zero, got \"\n+\t\t\t\t\"0x%2.2\" PRIx8 \" instead\", table, field, (uint8_t)value);\n+\t\t\tbreak;\n+\t\tcase sizeof(uint16_t):\n+\t\t\tfwts_failed(fw, LOG_LEVEL_MEDIUM, label,\n+\t\t\t\t\"%4.4s %s field must be zero, got \"\n+\t\t\t\t\"0x%4.4\" PRIx16 \" instead\", table, field, (uint16_t)value);\n+\t\t\tbreak;\n+\t\tcase sizeof(uint32_t):\n+\t\t\tfwts_failed(fw, LOG_LEVEL_MEDIUM, label,\n+\t\t\t\t\"%4.4s %s field must be zero, got \"\n+\t\t\t\t\"0x%8.8\" PRIx32 \" instead\", table, field, (uint32_t)value);\n+\t\t\tbreak;\n+\t\tcase sizeof(uint64_t):\n+\t\t\tfwts_failed(fw, LOG_LEVEL_MEDIUM, label,\n+\t\t\t\t\"%4.4s %s field must be zero, got \"\n+\t\t\t\t\"0x%16.16\" PRIx64 \" instead\", table, field, value);\n+\t\t\tbreak;\n+\t\t}\n+\t\t*passed = false;\n+\t}\n+}\n+\n #endif\n","prefixes":["V2"]}