ACK: [PATCH 1/2] Remove complex disabling of ACPI for non-ACPI targets
ivanhu
ivan.hu at canonical.com
Mon Jun 21 03:54:46 UTC 2021
On 6/20/21 1:21 AM, Colin King wrote:
> From: Colin Ian King <colin.king at canonical.com>
>
> 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 <colin.king at canonical.com>
> ---
> 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 <stdlib.h>
> @@ -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 <stdint.h>
>
> -#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 <stdio.h>
> #include <stdlib.h>
> #include <stdint.h>
> @@ -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
>
Acked-by: Ivan Hu <ivan.hu at canonical.com>
More information about the fwts-devel
mailing list