aboutsummaryrefslogtreecommitdiffstats
path: root/include/acpi/acmacros.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/acpi/acmacros.h')
-rw-r--r--include/acpi/acmacros.h38
1 files changed, 18 insertions, 20 deletions
diff --git a/include/acpi/acmacros.h b/include/acpi/acmacros.h
index fb41a3b802fc..57ab9e9d7593 100644
--- a/include/acpi/acmacros.h
+++ b/include/acpi/acmacros.h
@@ -80,12 +80,12 @@
80 */ 80 */
81#define ACPI_CAST_PTR(t, p) ((t *) (acpi_uintptr_t) (p)) 81#define ACPI_CAST_PTR(t, p) ((t *) (acpi_uintptr_t) (p))
82#define ACPI_CAST_INDIRECT_PTR(t, p) ((t **) (acpi_uintptr_t) (p)) 82#define ACPI_CAST_INDIRECT_PTR(t, p) ((t **) (acpi_uintptr_t) (p))
83#define ACPI_ADD_PTR(t,a,b) ACPI_CAST_PTR (t, (ACPI_CAST_PTR (u8,(a)) + (acpi_native_uint)(b))) 83#define ACPI_ADD_PTR(t, a, b) ACPI_CAST_PTR (t, (ACPI_CAST_PTR (u8,(a)) + (acpi_size)(b)))
84#define ACPI_PTR_DIFF(a,b) (acpi_native_uint) (ACPI_CAST_PTR (u8,(a)) - ACPI_CAST_PTR (u8,(b))) 84#define ACPI_PTR_DIFF(a, b) (acpi_size) (ACPI_CAST_PTR (u8,(a)) - ACPI_CAST_PTR (u8,(b)))
85 85
86/* Pointer/Integer type conversions */ 86/* Pointer/Integer type conversions */
87 87
88#define ACPI_TO_POINTER(i) ACPI_ADD_PTR (void,(void *) NULL,(acpi_native_uint) i) 88#define ACPI_TO_POINTER(i) ACPI_ADD_PTR (void, (void *) NULL, (acpi_size) i)
89#define ACPI_TO_INTEGER(p) ACPI_PTR_DIFF (p,(void *) NULL) 89#define ACPI_TO_INTEGER(p) ACPI_PTR_DIFF (p,(void *) NULL)
90#define ACPI_OFFSET(d,f) (acpi_size) ACPI_PTR_DIFF (&(((d *)0)->f),(void *) NULL) 90#define ACPI_OFFSET(d,f) (acpi_size) ACPI_PTR_DIFF (&(((d *)0)->f),(void *) NULL)
91#define ACPI_PHYSADDR_TO_PTR(i) ACPI_TO_POINTER(i) 91#define ACPI_PHYSADDR_TO_PTR(i) ACPI_TO_POINTER(i)
@@ -296,22 +296,22 @@ struct acpi_integer_overlay {
296/* 296/*
297 * Rounding macros (Power of two boundaries only) 297 * Rounding macros (Power of two boundaries only)
298 */ 298 */
299#define ACPI_ROUND_DOWN(value,boundary) (((acpi_native_uint)(value)) & \ 299#define ACPI_ROUND_DOWN(value, boundary) (((acpi_size)(value)) & \
300 (~(((acpi_native_uint) boundary)-1))) 300 (~(((acpi_size) boundary)-1)))
301 301
302#define ACPI_ROUND_UP(value,boundary) ((((acpi_native_uint)(value)) + \ 302#define ACPI_ROUND_UP(value, boundary) ((((acpi_size)(value)) + \
303 (((acpi_native_uint) boundary)-1)) & \ 303 (((acpi_size) boundary)-1)) & \
304 (~(((acpi_native_uint) boundary)-1))) 304 (~(((acpi_size) boundary)-1)))
305 305
306/* Note: sizeof(acpi_native_uint) evaluates to either 2, 4, or 8 */ 306/* Note: sizeof(acpi_size) evaluates to either 4 or 8 (32- vs 64-bit mode) */
307 307
308#define ACPI_ROUND_DOWN_TO_32BIT(a) ACPI_ROUND_DOWN(a,4) 308#define ACPI_ROUND_DOWN_TO_32BIT(a) ACPI_ROUND_DOWN(a,4)
309#define ACPI_ROUND_DOWN_TO_64BIT(a) ACPI_ROUND_DOWN(a,8) 309#define ACPI_ROUND_DOWN_TO_64BIT(a) ACPI_ROUND_DOWN(a,8)
310#define ACPI_ROUND_DOWN_TO_NATIVE_WORD(a) ACPI_ROUND_DOWN(a,sizeof(acpi_native_uint)) 310#define ACPI_ROUND_DOWN_TO_NATIVE_WORD(a) ACPI_ROUND_DOWN(a,sizeof(acpi_size))
311 311
312#define ACPI_ROUND_UP_TO_32BIT(a) ACPI_ROUND_UP(a,4) 312#define ACPI_ROUND_UP_TO_32BIT(a) ACPI_ROUND_UP(a,4)
313#define ACPI_ROUND_UP_TO_64BIT(a) ACPI_ROUND_UP(a,8) 313#define ACPI_ROUND_UP_TO_64BIT(a) ACPI_ROUND_UP(a,8)
314#define ACPI_ROUND_UP_TO_NATIVE_WORD(a) ACPI_ROUND_UP(a,sizeof(acpi_native_uint)) 314#define ACPI_ROUND_UP_TO_NATIVE_WORD(a) ACPI_ROUND_UP(a,sizeof(acpi_size))
315 315
316#define ACPI_ROUND_BITS_UP_TO_BYTES(a) ACPI_DIV_8((a) + 7) 316#define ACPI_ROUND_BITS_UP_TO_BYTES(a) ACPI_DIV_8((a) + 7)
317#define ACPI_ROUND_BITS_DOWN_TO_BYTES(a) ACPI_DIV_8((a)) 317#define ACPI_ROUND_BITS_DOWN_TO_BYTES(a) ACPI_DIV_8((a))
@@ -322,7 +322,7 @@ struct acpi_integer_overlay {
322 322
323#define ACPI_ROUND_UP_TO(value,boundary) (((value) + ((boundary)-1)) / (boundary)) 323#define ACPI_ROUND_UP_TO(value,boundary) (((value) + ((boundary)-1)) / (boundary))
324 324
325#define ACPI_IS_MISALIGNED(value) (((acpi_native_uint)value) & (sizeof(acpi_native_uint)-1)) 325#define ACPI_IS_MISALIGNED(value) (((acpi_size)value) & (sizeof(acpi_size)-1))
326 326
327/* 327/*
328 * Bitmask creation 328 * Bitmask creation
@@ -414,7 +414,7 @@ struct acpi_integer_overlay {
414 * error messages. The __FILE__ macro is not very useful for this, because it 414 * error messages. The __FILE__ macro is not very useful for this, because it
415 * often includes the entire pathname to the module 415 * often includes the entire pathname to the module
416 */ 416 */
417#define ACPI_MODULE_NAME(name) static char ACPI_UNUSED_VAR *_acpi_module_name = name; 417#define ACPI_MODULE_NAME(name) static const char ACPI_UNUSED_VAR _acpi_module_name[] = name;
418#else 418#else
419#define ACPI_MODULE_NAME(name) 419#define ACPI_MODULE_NAME(name)
420#endif 420#endif
@@ -467,19 +467,17 @@ struct acpi_integer_overlay {
467/* 467/*
468 * If ACPI_GET_FUNCTION_NAME was not defined in the compiler-dependent header, 468 * If ACPI_GET_FUNCTION_NAME was not defined in the compiler-dependent header,
469 * define it now. This is the case where there the compiler does not support 469 * define it now. This is the case where there the compiler does not support
470 * a __FUNCTION__ macro or equivalent. We save the function name on the 470 * a __FUNCTION__ macro or equivalent.
471 * local stack.
472 */ 471 */
473#ifndef ACPI_GET_FUNCTION_NAME 472#ifndef ACPI_GET_FUNCTION_NAME
474#define ACPI_GET_FUNCTION_NAME _acpi_function_name 473#define ACPI_GET_FUNCTION_NAME _acpi_function_name
475/* 474/*
476 * The Name parameter should be the procedure name as a quoted string. 475 * The Name parameter should be the procedure name as a quoted string.
477 * This is declared as a local string ("MyFunctionName") so that it can 476 * The function name is also used by the function exit macros below.
478 * be also used by the function exit macros below.
479 * Note: (const char) is used to be compatible with the debug interfaces 477 * Note: (const char) is used to be compatible with the debug interfaces
480 * and macros such as __FUNCTION__. 478 * and macros such as __FUNCTION__.
481 */ 479 */
482#define ACPI_FUNCTION_NAME(name) const char *_acpi_function_name = #name; 480#define ACPI_FUNCTION_NAME(name) static const char _acpi_function_name[] = #name;
483 481
484#else 482#else
485/* Compiler supports __FUNCTION__ (or equivalent) -- Ignore this macro */ 483/* Compiler supports __FUNCTION__ (or equivalent) -- Ignore this macro */
@@ -599,7 +597,7 @@ struct acpi_integer_overlay {
599/* Stack and buffer dumping */ 597/* Stack and buffer dumping */
600 598
601#define ACPI_DUMP_STACK_ENTRY(a) acpi_ex_dump_operand((a),0) 599#define ACPI_DUMP_STACK_ENTRY(a) acpi_ex_dump_operand((a),0)
602#define ACPI_DUMP_OPERANDS(a,b,c,d,e) acpi_ex_dump_operands(a,b,c,d,e,_acpi_module_name,__LINE__) 600#define ACPI_DUMP_OPERANDS(a,b,c) acpi_ex_dump_operands(a,b,c)
603 601
604#define ACPI_DUMP_ENTRY(a,b) acpi_ns_dump_entry (a,b) 602#define ACPI_DUMP_ENTRY(a,b) acpi_ns_dump_entry (a,b)
605#define ACPI_DUMP_PATHNAME(a,b,c,d) acpi_ns_dump_pathname(a,b,c,d) 603#define ACPI_DUMP_PATHNAME(a,b,c,d) acpi_ns_dump_pathname(a,b,c,d)
@@ -635,7 +633,7 @@ struct acpi_integer_overlay {
635#define ACPI_FUNCTION_VALUE_EXIT(s) do { } while(0) 633#define ACPI_FUNCTION_VALUE_EXIT(s) do { } while(0)
636#define ACPI_FUNCTION_ENTRY() do { } while(0) 634#define ACPI_FUNCTION_ENTRY() do { } while(0)
637#define ACPI_DUMP_STACK_ENTRY(a) do { } while(0) 635#define ACPI_DUMP_STACK_ENTRY(a) do { } while(0)
638#define ACPI_DUMP_OPERANDS(a,b,c,d,e) do { } while(0) 636#define ACPI_DUMP_OPERANDS(a,b,c) do { } while(0)
639#define ACPI_DUMP_ENTRY(a,b) do { } while(0) 637#define ACPI_DUMP_ENTRY(a,b) do { } while(0)
640#define ACPI_DUMP_TABLES(a,b) do { } while(0) 638#define ACPI_DUMP_TABLES(a,b) do { } while(0)
641#define ACPI_DUMP_PATHNAME(a,b,c,d) do { } while(0) 639#define ACPI_DUMP_PATHNAME(a,b,c,d) do { } while(0)