mirror of
https://github.com/acpica/acpica/
synced 2025-02-25 18:04:08 +03:00
Utilities: Add ACPI_DO_ONCE macros
This patch implements ACPI_DO_ONCE macros to avoid log floodings. There could be OSPM gaps causing some ACPICA functionalities continously reporting errors, filling up users' filesystem. Reported by Aaron Franke, Fixed by Lv Zheng. Link: https://bugzilla.kernel.org/show_bug.cgi?id=188331 Reported-by: Aaron Franke <arnfranke@yahoo.com> Signed-off-by: Lv Zheng <lv.zheng@intel.com>
This commit is contained in:
parent
528528feeb
commit
93d652bbfc
@ -531,8 +531,13 @@
|
||||
* the plist contains a set of parens to allow variable-length lists.
|
||||
* These macros are used for both the debug and non-debug versions of the code.
|
||||
*/
|
||||
#if defined (ACPI_USE_DO_ONCE_MACRO) && defined (ACPI_DO_ONCE)
|
||||
#define ACPI_ERROR_NAMESPACE(s, e) ACPI_DO_ONCE(AcpiUtNamespaceError (AE_INFO, s, e));
|
||||
#define ACPI_ERROR_METHOD(s, n, p, e) ACPI_DO_ONCE(AcpiUtMethodError (AE_INFO, s, n, p, e));
|
||||
#else
|
||||
#define ACPI_ERROR_NAMESPACE(s, e) AcpiUtNamespaceError (AE_INFO, s, e);
|
||||
#define ACPI_ERROR_METHOD(s, n, p, e) AcpiUtMethodError (AE_INFO, s, n, p, e);
|
||||
#endif
|
||||
#define ACPI_WARN_PREDEFINED(plist) AcpiUtPredefinedWarning plist
|
||||
#define ACPI_INFO_PREDEFINED(plist) AcpiUtPredefinedInfo plist
|
||||
#define ACPI_BIOS_ERROR_PREDEFINED(plist) AcpiUtPredefinedBiosError plist
|
||||
|
@ -302,10 +302,17 @@
|
||||
* the plist contains a set of parens to allow variable-length lists.
|
||||
* These macros are used for both the debug and non-debug versions of the code.
|
||||
*/
|
||||
#if defined (ACPI_USE_DO_ONCE_MACRO) && defined (ACPI_DO_ONCE)
|
||||
#define ACPI_INFO(plist) ACPI_DO_ONCE(AcpiInfo plist)
|
||||
#define ACPI_WARNING(plist) ACPI_DO_ONCE(AcpiWarning plist)
|
||||
#define ACPI_EXCEPTION(plist) ACPI_DO_ONCE(AcpiException plist)
|
||||
#define ACPI_ERROR(plist) ACPI_DO_ONCE(AcpiError plist)
|
||||
#else
|
||||
#define ACPI_INFO(plist) AcpiInfo plist
|
||||
#define ACPI_WARNING(plist) AcpiWarning plist
|
||||
#define ACPI_EXCEPTION(plist) AcpiException plist
|
||||
#define ACPI_ERROR(plist) AcpiError plist
|
||||
#endif
|
||||
#define ACPI_BIOS_WARNING(plist) AcpiBiosWarning plist
|
||||
#define ACPI_BIOS_ERROR(plist) AcpiBiosError plist
|
||||
#define ACPI_DEBUG_OBJECT(obj,l,i) AcpiExDoDebugObject(obj,l,i)
|
||||
|
@ -247,6 +247,14 @@ ACPI_INIT_GLOBAL (UINT8, AcpiGbl_VerifyTableChecksum, TRUE);
|
||||
*/
|
||||
ACPI_INIT_GLOBAL (UINT8, AcpiGbl_EnableAmlDebugObject, FALSE);
|
||||
|
||||
/*
|
||||
* Optionally enable ACPI_DO_ONCE to avoid log flodding. Default is TRUE
|
||||
* so that when ACPI_USE_DO_ONCE_MACRO is enabled, log flooding can be
|
||||
* avoided by default. And this option is provided so that OSPMs can
|
||||
* disable it during runtime.
|
||||
*/
|
||||
ACPI_INIT_GLOBAL (UINT8, AcpiGbl_EnableDoOnceMacro, TRUE);
|
||||
|
||||
/*
|
||||
* Optionally copy the entire DSDT to local memory (instead of simply
|
||||
* mapping it.) There are some BIOSs that corrupt or replace the original
|
||||
|
@ -146,4 +146,19 @@
|
||||
|
||||
#define COMPILER_VA_MACRO 1
|
||||
|
||||
/* GCC supports _ONCE macros */
|
||||
|
||||
#define ACPI_DO_ONCE(plist) \
|
||||
({ \
|
||||
static BOOLEAN __AcpiErrorOnce__ = FALSE; \
|
||||
if (!__AcpiErrorOnce__) \
|
||||
{ \
|
||||
if (AcpiGbl_EnableDoOnceMacro) \
|
||||
{ \
|
||||
__AcpiErrorOnce__ = TRUE; \
|
||||
} \
|
||||
plist; \
|
||||
} \
|
||||
})
|
||||
|
||||
#endif /* __ACGCC_H__ */
|
||||
|
@ -146,6 +146,10 @@
|
||||
#define ACPI_DEBUGGER
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_ACPI_MESSAGE_ONCE
|
||||
#define ACPI_USE_DO_ONCE_MACRO 1
|
||||
#endif
|
||||
|
||||
#include <linux/string.h>
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/ctype.h>
|
||||
|
Loading…
x
Reference in New Issue
Block a user