diff options
Diffstat (limited to 'usr/src/uts/intel/sys/acpi/acmacros.h')
-rw-r--r-- | usr/src/uts/intel/sys/acpi/acmacros.h | 67 |
1 files changed, 60 insertions, 7 deletions
diff --git a/usr/src/uts/intel/sys/acpi/acmacros.h b/usr/src/uts/intel/sys/acpi/acmacros.h index b088f7ce0b..50c9503c1e 100644 --- a/usr/src/uts/intel/sys/acpi/acmacros.h +++ b/usr/src/uts/intel/sys/acpi/acmacros.h @@ -1,7 +1,7 @@ /****************************************************************************** * * Name: acmacros.h - C macros for the entire subsystem. - * $Revision: 160 $ + * $Revision: 1.163 $ * *****************************************************************************/ @@ -569,7 +569,7 @@ /* * If ACPI_GET_FUNCTION_NAME was not defined in the compiler-dependent header, * define it now. This is the case where there the compiler does not support - * a __FUNCTION__ macro or equivalent. We save the function name on the + * a __FUNCTION__ macro or equivalent. We save the function name on the * local stack. */ #ifndef ACPI_GET_FUNCTION_NAME @@ -578,8 +578,10 @@ * The Name parameter should be the procedure name as a quoted string. * This is declared as a local string ("MyFunctionName") so that it can * be also used by the function exit macros below. + * Note: (const char) is used to be compatible with the debug interfaces + * and macros such as __FUNCTION__. */ -#define ACPI_FUNCTION_NAME(Name) char *_AcpiFunctionName = Name; +#define ACPI_FUNCTION_NAME(Name) const char *_AcpiFunctionName = Name; #else /* Compiler supports __FUNCTION__ (or equivalent) -- Ignore this macro */ @@ -604,6 +606,9 @@ * bad form, but having a separate exit macro is very ugly and difficult to maintain. * One of the FUNCTION_TRACE macros above must be used in conjunction with these macros * so that "_AcpiFunctionName" is defined. + * + * Note: the DO_WHILE0 macro is used to prevent some compilers from complaining + * about these constructs. */ #ifdef ACPI_USE_DO_WHILE_0 #define ACPI_DO_WHILE0(a) do a while(0) @@ -611,10 +616,56 @@ #define ACPI_DO_WHILE0(a) a #endif -#define return_VOID ACPI_DO_WHILE0 ({AcpiUtExit(ACPI_DEBUG_PARAMETERS);return;}) -#define return_ACPI_STATUS(s) ACPI_DO_WHILE0 ({AcpiUtStatusExit(ACPI_DEBUG_PARAMETERS,(s));return((s));}) -#define return_VALUE(s) ACPI_DO_WHILE0 ({AcpiUtValueExit(ACPI_DEBUG_PARAMETERS,(ACPI_INTEGER)(s));return((s));}) -#define return_PTR(s) ACPI_DO_WHILE0 ({AcpiUtPtrExit(ACPI_DEBUG_PARAMETERS,(UINT8 *)(s));return((s));}) +#define return_VOID ACPI_DO_WHILE0 ({ \ + AcpiUtExit (ACPI_DEBUG_PARAMETERS); \ + return;}) +/* + * There are two versions of most of the return macros. The default version is + * safer, since it avoids side-effects by guaranteeing that the argument will + * not be evaluated twice. + * + * A less-safe version of the macros is provided for optional use if the + * compiler uses excessive CPU stack (for example, this may happen in the + * debug case if code optimzation is disabled.) + */ +#ifndef ACPI_SIMPLE_RETURN_MACROS + +#define return_ACPI_STATUS(s) ACPI_DO_WHILE0 ({ \ + register ACPI_STATUS _s = (s); \ + AcpiUtStatusExit (ACPI_DEBUG_PARAMETERS, _s); \ + return (_s); }) +#define return_PTR(s) ACPI_DO_WHILE0 ({ \ + register void *_s = (void *) (s); \ + AcpiUtPtrExit (ACPI_DEBUG_PARAMETERS, (UINT8 *) _s); \ + return (_s); }) +#define return_VALUE(s) ACPI_DO_WHILE0 ({ \ + register ACPI_INTEGER _s = (s); \ + AcpiUtValueExit (ACPI_DEBUG_PARAMETERS, _s); \ + return (_s); }) +#define return_UINT8(s) ACPI_DO_WHILE0 ({ \ + register UINT8 _s = (UINT8) (s); \ + AcpiUtValueExit (ACPI_DEBUG_PARAMETERS, _s); \ + return (_s); }) +#define return_UINT32(s) ACPI_DO_WHILE0 ({ \ + register UINT32 _s = (UINT32) (s); \ + AcpiUtValueExit (ACPI_DEBUG_PARAMETERS, _s); \ + return (_s); }) +#else /* Use original less-safe macros */ + +#define return_ACPI_STATUS(s) ACPI_DO_WHILE0 ({ \ + AcpiUtStatusExit (ACPI_DEBUG_PARAMETERS, (s)); \ + return((s)); }) +#define return_PTR(s) ACPI_DO_WHILE0 ({ \ + AcpiUtPtrExit (ACPI_DEBUG_PARAMETERS, (UINT8 *) (s)); \ + return((s)); }) +#define return_VALUE(s) ACPI_DO_WHILE0 ({ \ + AcpiUtValueExit (ACPI_DEBUG_PARAMETERS, (ACPI_INTEGER) (s)); \ + return((s)); }) +#define return_UINT8(s) return_VALUE(s) +#define return_UINT32(s) return_VALUE(s) + +#endif /* ACPI_SIMPLE_RETURN_MACROS */ + /* Conditional execution */ @@ -696,6 +747,8 @@ #define return_VOID return #define return_ACPI_STATUS(s) return(s) #define return_VALUE(s) return(s) +#define return_UINT8(s) return(s) +#define return_UINT32(s) return(s) #define return_PTR(s) return(s) #endif |