From patchwork Sat Jun 19 17:21:49 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Colin Ian King X-Patchwork-Id: 1494638 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.ubuntu.com (client-ip=91.189.94.19; helo=huckleberry.canonical.com; envelope-from=fwts-devel-bounces@lists.ubuntu.com; receiver=) Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4G6jJl5htGz9sVm for ; Sun, 20 Jun 2021 03:21:58 +1000 (AEST) Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.86_2) (envelope-from ) id 1luefJ-0002vd-9D; Sat, 19 Jun 2021 17:21:53 +0000 Received: from youngberry.canonical.com ([91.189.89.112]) by huckleberry.canonical.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1luefH-0002vG-D9 for fwts-devel@lists.ubuntu.com; Sat, 19 Jun 2021 17:21:51 +0000 Received: from 1.general.cking.uk.vpn ([10.172.193.212] helo=localhost) by youngberry.canonical.com with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.93) (envelope-from ) id 1luefH-0002eT-3J; Sat, 19 Jun 2021 17:21:51 +0000 From: Colin King To: fwts-devel@lists.ubuntu.com Subject: [PATCH 1/2] Remove complex disabling of ACPI for non-ACPI targets Date: Sat, 19 Jun 2021 18:21:49 +0100 Message-Id: <20210619172150.1294172-2-colin.king@canonical.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210619172150.1294172-1-colin.king@canonical.com> References: <20210619172150.1294172-1-colin.king@canonical.com> MIME-Version: 1.0 X-BeenThere: fwts-devel@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Firmware Test Suite Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: fwts-devel-bounces@lists.ubuntu.com Sender: "fwts-devel" From: Colin Ian King The disabling of ACPI for non-ACPI targets is rather too complex and leads to linking issues because of the workarounds to define objects that get referenced in the link stage but are never used. Simplfy the build by building in the APCICA core but never calling it for non-ACPI targets. This removes the need for the VOID_FUNC workaround stubs in src/libfwtsacpica/fwts_acpica.c Signed-off-by: Colin Ian King Acked-by: Alex Hung Acked-by: Ivan Hu --- src/Makefile.am | 4 +- src/acpi/brightness/brightness-helper.c | 4 -- src/lib/include/fwts_acpi.h | 4 -- src/lib/include/fwts_acpi_tables.h | 4 -- src/lib/include/fwts_iasl.h | 4 -- src/lib/src/fwts_acpi.c | 4 -- src/lib/src/fwts_acpi_object_eval.c | 4 -- src/lib/src/fwts_acpi_tables.c | 4 -- src/lib/src/fwts_iasl.c | 4 -- src/libfwtsacpica/fwts_acpica.c | 49 ------------------------- 10 files changed, 2 insertions(+), 83 deletions(-) diff --git a/src/Makefile.am b/src/Makefile.am index cdabb386..f8066aff 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -208,13 +208,13 @@ fwts_SOURCES = main.c \ fwts_LDFLAGS = -lm -lbsd `pkg-config --libs glib-2.0 gio-2.0` fwts_LDADD = \ + -lfwts \ -L$(top_builddir)/src \ -L$(top_builddir)/src/acpica \ -L$(top_builddir)/src/libfwtsiasl \ -L$(top_builddir)/src/libfwtsacpica \ -L$(top_builddir)/src/lib/src \ - -lfwtsacpica \ - -lfwts + -lfwtsacpica man_MANS = ../doc/fwts.1 ../doc/fwts-collect.1 ../doc/fwts-frontend-text.1 diff --git a/src/acpi/brightness/brightness-helper.c b/src/acpi/brightness/brightness-helper.c index ec7c6502..b8299b5b 100644 --- a/src/acpi/brightness/brightness-helper.c +++ b/src/acpi/brightness/brightness-helper.c @@ -18,8 +18,6 @@ */ #include "fwts.h" -#if defined(FWTS_HAS_ACPI) - #include "brightness-helper.h" #include @@ -145,5 +143,3 @@ int brightness_set_setting(const char *entry_name, const char *setting, const in return FWTS_OK; } - -#endif diff --git a/src/lib/include/fwts_acpi.h b/src/lib/include/fwts_acpi.h index 0781f08a..b317b50b 100644 --- a/src/lib/include/fwts_acpi.h +++ b/src/lib/include/fwts_acpi.h @@ -22,8 +22,6 @@ #include "fwts.h" -#if defined(FWTS_HAS_ACPI) - #define FWTS_ACPI_TABLES_PATH "/sys/firmware/acpi/tables" #define FWTS_FACP_UNSPECIFIED (0x00) @@ -2216,5 +2214,3 @@ typedef struct { } __attribute__ ((packed)) fwts_acpi_table_aspt; #endif - -#endif diff --git a/src/lib/include/fwts_acpi_tables.h b/src/lib/include/fwts_acpi_tables.h index 11670ae0..2ac649bb 100644 --- a/src/lib/include/fwts_acpi_tables.h +++ b/src/lib/include/fwts_acpi_tables.h @@ -22,8 +22,6 @@ #include "fwts.h" -#if defined(FWTS_HAS_ACPI) - #define ACPI_MAX_TABLES (128) #define fwts_acpi_revision_check(table, actual, must_be, passed) \ @@ -96,5 +94,3 @@ void fwts_acpi_space_id(fwts_framework *fw, const char *table, const char *field uint32_t fwts_get_acpi_version(fwts_framework *fw); #endif - -#endif diff --git a/src/lib/include/fwts_iasl.h b/src/lib/include/fwts_iasl.h index 05e78e18..daabbb57 100644 --- a/src/lib/include/fwts_iasl.h +++ b/src/lib/include/fwts_iasl.h @@ -23,8 +23,6 @@ #include "fwts.h" #include -#if defined(FWTS_HAS_ACPI) - int fwts_iasl_init(fwts_framework *fw); void fwts_iasl_deinit(void); @@ -45,5 +43,3 @@ int fwts_iasl_reassemble(fwts_framework *fw, const char *fwts_iasl_exception_level(uint8_t level); #endif - -#endif diff --git a/src/lib/src/fwts_acpi.c b/src/lib/src/fwts_acpi.c index 2e95bc77..9916b3fb 100644 --- a/src/lib/src/fwts_acpi.c +++ b/src/lib/src/fwts_acpi.c @@ -28,8 +28,6 @@ #include "fwts.h" -#if defined(FWTS_HAS_ACPI) - const char *fwts_acpi_fadt_preferred_pm_profile(const int profile) { static const char *pm_profiles[] = { @@ -70,5 +68,3 @@ bool fwts_acpi_data_zero(const void *data, const size_t len) return true; } - -#endif diff --git a/src/lib/src/fwts_acpi_object_eval.c b/src/lib/src/fwts_acpi_object_eval.c index 4923748c..94956896 100644 --- a/src/lib/src/fwts_acpi_object_eval.c +++ b/src/lib/src/fwts_acpi_object_eval.c @@ -18,8 +18,6 @@ */ #include "fwts.h" -#if defined(FWTS_HAS_ACPI) - #include #include #include @@ -3135,5 +3133,3 @@ void fwts_method_test_BPS_return( else fwts_method_passed_sane(fw, name, "package"); } - -#endif diff --git a/src/lib/src/fwts_acpi_tables.c b/src/lib/src/fwts_acpi_tables.c index 58732201..42285f99 100644 --- a/src/lib/src/fwts_acpi_tables.c +++ b/src/lib/src/fwts_acpi_tables.c @@ -37,8 +37,6 @@ #include "fwts_acpi_object_eval.h" -#if defined(FWTS_HAS_ACPI) - #define BIOS_START (0x000e0000) /* Start of BIOS memory */ #define BIOS_END (0x000fffff) /* End of BIOS memory */ #define BIOS_LENGTH (BIOS_END - BIOS_START) /* Length of BIOS memory */ @@ -1828,5 +1826,3 @@ uint32_t fwts_get_acpi_version(fwts_framework *fw) return acpi_version; } - -#endif diff --git a/src/lib/src/fwts_iasl.c b/src/lib/src/fwts_iasl.c index b5dfc24c..c7ccb0bc 100644 --- a/src/lib/src/fwts_iasl.c +++ b/src/lib/src/fwts_iasl.c @@ -29,8 +29,6 @@ #include "fwts.h" -#if defined(FWTS_HAS_ACPI) - #include "fwts_iasl_interface.h" #include "fwts_acpica.h" @@ -319,5 +317,3 @@ const char *fwts_iasl_exception_level(uint8_t level) { return fwts_iasl_exception_level__(level); } - -#endif diff --git a/src/libfwtsacpica/fwts_acpica.c b/src/libfwtsacpica/fwts_acpica.c index 6fb3e984..a0ef1c21 100644 --- a/src/libfwtsacpica/fwts_acpica.c +++ b/src/libfwtsacpica/fwts_acpica.c @@ -35,8 +35,6 @@ #include "fwts.h" -#if defined(FWTS_HAS_ACPI) - /* ACPICA specific headers */ #include "acpi.h" #include "accommon.h" @@ -1331,50 +1329,3 @@ fwts_list *fwts_acpica_get_object_names(const int type) return list; } - -#else - -static void __void_func(const char *funcname) -{ - fprintf(stderr, "fwts ACPICA library: unexpected call to %s()\n", funcname); - exit(EXIT_FAILURE); -} - -#define VOID_FUNC(name) void name(void) { __void_func(#name); } - -/* - * With ACPI disabled, these functions should never - * be called. We should defined this otherwise we will - * get linker errors with some autotools/linker combos - */ -VOID_FUNC(AcpiGbl_IgnoreErrors) -VOID_FUNC(AcpiGbl_RegionFillValue) - -VOID_FUNC(AcpiOsCreateSemaphore) -VOID_FUNC(AcpiOsDeleteSemaphore) -VOID_FUNC(AcpiOsExecute) -VOID_FUNC(AcpiOsGetRootPointer) -VOID_FUNC(AcpiOsPrintf) -VOID_FUNC(AcpiOsReadPciConfiguration) -VOID_FUNC(AcpiOsReadPort) -VOID_FUNC(AcpiOsSignal) -VOID_FUNC(AcpiOsSignalSemaphore) -VOID_FUNC(AcpiOsSleep) -VOID_FUNC(AcpiOsVprintf) -VOID_FUNC(AcpiOsWaitSemaphore) - -VOID_FUNC(AeTableOverride) - -VOID_FUNC(MpSaveGpioInfo) -VOID_FUNC(MpSaveSerialInfo) - -/* - * We need this otherwise gcc 4.5 ends up with a linker failure - * when building with ACPI disabled and I have no idea why. - */ -unsigned char AcpiGbl_AbortLoopOnTimeout = FALSE; -unsigned char AcpiGbl_VerboseHandlers = FALSE; -void *AcpiGbl_InitEntries = NULL; -uint32_t AcpiGbl_InitFileLineCount = 0; - -#endif From patchwork Sat Jun 19 17:21:50 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Colin Ian King X-Patchwork-Id: 1494640 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.ubuntu.com (client-ip=91.189.94.19; helo=huckleberry.canonical.com; envelope-from=fwts-devel-bounces@lists.ubuntu.com; receiver=) Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4G6jJl61FKz9sW6 for ; Sun, 20 Jun 2021 03:21:58 +1000 (AEST) Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.86_2) (envelope-from ) id 1luefK-0002w1-Cy; Sat, 19 Jun 2021 17:21:54 +0000 Received: from youngberry.canonical.com ([91.189.89.112]) by huckleberry.canonical.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1luefH-0002vM-Q3 for fwts-devel@lists.ubuntu.com; Sat, 19 Jun 2021 17:21:51 +0000 Received: from 1.general.cking.uk.vpn ([10.172.193.212] helo=localhost) by youngberry.canonical.com with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.93) (envelope-from ) id 1luefH-0002ec-Hg; Sat, 19 Jun 2021 17:21:51 +0000 From: Colin King To: fwts-devel@lists.ubuntu.com Subject: [PATCH 2/2] fwts_acpi_tables: memcpy 4 char ACPI table name Date: Sat, 19 Jun 2021 18:21:50 +0100 Message-Id: <20210619172150.1294172-3-colin.king@canonical.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210619172150.1294172-1-colin.king@canonical.com> References: <20210619172150.1294172-1-colin.king@canonical.com> MIME-Version: 1.0 X-BeenThere: fwts-devel@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Firmware Test Suite Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: fwts-devel-bounces@lists.ubuntu.com Sender: "fwts-devel" From: Colin Ian King Don't use strncpy, use memcpy of the raw 4 char table name. Signed-off-by: Colin Ian King Acked-by: Alex Hung Acked-by: Ivan Hu --- src/lib/src/fwts_acpi_tables.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib/src/fwts_acpi_tables.c b/src/lib/src/fwts_acpi_tables.c index 42285f99..b8b710bc 100644 --- a/src/lib/src/fwts_acpi_tables.c +++ b/src/lib/src/fwts_acpi_tables.c @@ -261,7 +261,7 @@ static void fwts_acpi_add_table( if (strncmp(tables[i].name, name, 4) == 0) which++; if (tables[i].data == NULL) { - strncpy(tables[i].name, name, 4); + memcpy(tables[i].name, name, 4); tables[i].name[4] = 0; tables[i].data = table; tables[i].addr = addr;