aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi/acpica/acmacros.h
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/acpi/acpica/acmacros.h')
-rw-r--r--drivers/acpi/acpica/acmacros.h163
1 files changed, 58 insertions, 105 deletions
diff --git a/drivers/acpi/acpica/acmacros.h b/drivers/acpi/acpica/acmacros.h
index a7f68c47f517..5efad99f2169 100644
--- a/drivers/acpi/acpica/acmacros.h
+++ b/drivers/acpi/acpica/acmacros.h
@@ -84,29 +84,29 @@
84 84
85/* These macros reverse the bytes during the move, converting little-endian to big endian */ 85/* These macros reverse the bytes during the move, converting little-endian to big endian */
86 86
87 /* Big Endian <== Little Endian */ 87 /* Big Endian <== Little Endian */
88 /* Hi...Lo Lo...Hi */ 88 /* Hi...Lo Lo...Hi */
89/* 16-bit source, 16/32/64 destination */ 89/* 16-bit source, 16/32/64 destination */
90 90
91#define ACPI_MOVE_16_TO_16(d, s) {(( u8 *)(void *)(d))[0] = ((u8 *)(void *)(s))[1];\ 91#define ACPI_MOVE_16_TO_16(d, s) {(( u8 *)(void *)(d))[0] = ((u8 *)(void *)(s))[1];\
92 (( u8 *)(void *)(d))[1] = ((u8 *)(void *)(s))[0];} 92 (( u8 *)(void *)(d))[1] = ((u8 *)(void *)(s))[0];}
93 93
94#define ACPI_MOVE_16_TO_32(d, s) {(*(u32 *)(void *)(d))=0;\ 94#define ACPI_MOVE_16_TO_32(d, s) {(*(u32 *)(void *)(d))=0;\
95 ((u8 *)(void *)(d))[2] = ((u8 *)(void *)(s))[1];\ 95 ((u8 *)(void *)(d))[2] = ((u8 *)(void *)(s))[1];\
96 ((u8 *)(void *)(d))[3] = ((u8 *)(void *)(s))[0];} 96 ((u8 *)(void *)(d))[3] = ((u8 *)(void *)(s))[0];}
97 97
98#define ACPI_MOVE_16_TO_64(d, s) {(*(u64 *)(void *)(d))=0;\ 98#define ACPI_MOVE_16_TO_64(d, s) {(*(u64 *)(void *)(d))=0;\
99 ((u8 *)(void *)(d))[6] = ((u8 *)(void *)(s))[1];\ 99 ((u8 *)(void *)(d))[6] = ((u8 *)(void *)(s))[1];\
100 ((u8 *)(void *)(d))[7] = ((u8 *)(void *)(s))[0];} 100 ((u8 *)(void *)(d))[7] = ((u8 *)(void *)(s))[0];}
101 101
102/* 32-bit source, 16/32/64 destination */ 102/* 32-bit source, 16/32/64 destination */
103 103
104#define ACPI_MOVE_32_TO_16(d, s) ACPI_MOVE_16_TO_16(d, s) /* Truncate to 16 */ 104#define ACPI_MOVE_32_TO_16(d, s) ACPI_MOVE_16_TO_16(d, s) /* Truncate to 16 */
105 105
106#define ACPI_MOVE_32_TO_32(d, s) {(( u8 *)(void *)(d))[0] = ((u8 *)(void *)(s))[3];\ 106#define ACPI_MOVE_32_TO_32(d, s) {(( u8 *)(void *)(d))[0] = ((u8 *)(void *)(s))[3];\
107 (( u8 *)(void *)(d))[1] = ((u8 *)(void *)(s))[2];\ 107 (( u8 *)(void *)(d))[1] = ((u8 *)(void *)(s))[2];\
108 (( u8 *)(void *)(d))[2] = ((u8 *)(void *)(s))[1];\ 108 (( u8 *)(void *)(d))[2] = ((u8 *)(void *)(s))[1];\
109 (( u8 *)(void *)(d))[3] = ((u8 *)(void *)(s))[0];} 109 (( u8 *)(void *)(d))[3] = ((u8 *)(void *)(s))[0];}
110 110
111#define ACPI_MOVE_32_TO_64(d, s) {(*(u64 *)(void *)(d))=0;\ 111#define ACPI_MOVE_32_TO_64(d, s) {(*(u64 *)(void *)(d))=0;\
112 ((u8 *)(void *)(d))[4] = ((u8 *)(void *)(s))[3];\ 112 ((u8 *)(void *)(d))[4] = ((u8 *)(void *)(s))[3];\
@@ -196,24 +196,12 @@
196#endif 196#endif
197#endif 197#endif
198 198
199/* Macros based on machine integer width */
200
201#if ACPI_MACHINE_WIDTH == 32
202#define ACPI_MOVE_SIZE_TO_16(d, s) ACPI_MOVE_32_TO_16(d, s)
203
204#elif ACPI_MACHINE_WIDTH == 64
205#define ACPI_MOVE_SIZE_TO_16(d, s) ACPI_MOVE_64_TO_16(d, s)
206
207#else
208#error unknown ACPI_MACHINE_WIDTH
209#endif
210
211/* 199/*
212 * Fast power-of-two math macros for non-optimized compilers 200 * Fast power-of-two math macros for non-optimized compilers
213 */ 201 */
214#define _ACPI_DIV(value, power_of2) ((u32) ((value) >> (power_of2))) 202#define _ACPI_DIV(value, power_of2) ((u32) ((value) >> (power_of2)))
215#define _ACPI_MUL(value, power_of2) ((u32) ((value) << (power_of2))) 203#define _ACPI_MUL(value, power_of2) ((u32) ((value) << (power_of2)))
216#define _ACPI_MOD(value, divisor) ((u32) ((value) & ((divisor) -1))) 204#define _ACPI_MOD(value, divisor) ((u32) ((value) & ((divisor) -1)))
217 205
218#define ACPI_DIV_2(a) _ACPI_DIV(a, 1) 206#define ACPI_DIV_2(a) _ACPI_DIV(a, 1)
219#define ACPI_MUL_2(a) _ACPI_MUL(a, 1) 207#define ACPI_MUL_2(a) _ACPI_MUL(a, 1)
@@ -238,12 +226,12 @@
238/* 226/*
239 * Rounding macros (Power of two boundaries only) 227 * Rounding macros (Power of two boundaries only)
240 */ 228 */
241#define ACPI_ROUND_DOWN(value, boundary) (((acpi_size)(value)) & \ 229#define ACPI_ROUND_DOWN(value, boundary) (((acpi_size)(value)) & \
242 (~(((acpi_size) boundary)-1))) 230 (~(((acpi_size) boundary)-1)))
243 231
244#define ACPI_ROUND_UP(value, boundary) ((((acpi_size)(value)) + \ 232#define ACPI_ROUND_UP(value, boundary) ((((acpi_size)(value)) + \
245 (((acpi_size) boundary)-1)) & \ 233 (((acpi_size) boundary)-1)) & \
246 (~(((acpi_size) boundary)-1))) 234 (~(((acpi_size) boundary)-1)))
247 235
248/* Note: sizeof(acpi_size) evaluates to either 4 or 8 (32- vs 64-bit mode) */ 236/* Note: sizeof(acpi_size) evaluates to either 4 or 8 (32- vs 64-bit mode) */
249 237
@@ -264,7 +252,7 @@
264 252
265#define ACPI_ROUND_UP_TO(value, boundary) (((value) + ((boundary)-1)) / (boundary)) 253#define ACPI_ROUND_UP_TO(value, boundary) (((value) + ((boundary)-1)) / (boundary))
266 254
267#define ACPI_IS_MISALIGNED(value) (((acpi_size) value) & (sizeof(acpi_size)-1)) 255#define ACPI_IS_MISALIGNED(value) (((acpi_size) value) & (sizeof(acpi_size)-1))
268 256
269/* 257/*
270 * Bitmask creation 258 * Bitmask creation
@@ -355,7 +343,6 @@
355 * Ascii error messages can be configured out 343 * Ascii error messages can be configured out
356 */ 344 */
357#ifndef ACPI_NO_ERROR_MESSAGES 345#ifndef ACPI_NO_ERROR_MESSAGES
358
359/* 346/*
360 * Error reporting. Callers module and line number are inserted by AE_INFO, 347 * Error reporting. Callers module and line number are inserted by AE_INFO,
361 * the plist contains a set of parens to allow variable-length lists. 348 * the plist contains a set of parens to allow variable-length lists.
@@ -375,18 +362,15 @@
375#define ACPI_WARN_PREDEFINED(plist) 362#define ACPI_WARN_PREDEFINED(plist)
376#define ACPI_INFO_PREDEFINED(plist) 363#define ACPI_INFO_PREDEFINED(plist)
377 364
378#endif /* ACPI_NO_ERROR_MESSAGES */ 365#endif /* ACPI_NO_ERROR_MESSAGES */
379 366
380/* 367/*
381 * Debug macros that are conditionally compiled 368 * Debug macros that are conditionally compiled
382 */ 369 */
383#ifdef ACPI_DEBUG_OUTPUT 370#ifdef ACPI_DEBUG_OUTPUT
384
385/* 371/*
386 * Function entry tracing 372 * Function entry tracing
387 */ 373 */
388#ifdef CONFIG_ACPI_DEBUG_FUNC_TRACE
389
390#define ACPI_FUNCTION_TRACE(a) ACPI_FUNCTION_NAME(a) \ 374#define ACPI_FUNCTION_TRACE(a) ACPI_FUNCTION_NAME(a) \
391 acpi_ut_trace(ACPI_DEBUG_PARAMETERS) 375 acpi_ut_trace(ACPI_DEBUG_PARAMETERS)
392#define ACPI_FUNCTION_TRACE_PTR(a, b) ACPI_FUNCTION_NAME(a) \ 376#define ACPI_FUNCTION_TRACE_PTR(a, b) ACPI_FUNCTION_NAME(a) \
@@ -464,45 +448,19 @@
464 448
465#endif /* ACPI_SIMPLE_RETURN_MACROS */ 449#endif /* ACPI_SIMPLE_RETURN_MACROS */
466 450
467#else /* !CONFIG_ACPI_DEBUG_FUNC_TRACE */
468
469#define ACPI_FUNCTION_TRACE(a)
470#define ACPI_FUNCTION_TRACE_PTR(a,b)
471#define ACPI_FUNCTION_TRACE_U32(a,b)
472#define ACPI_FUNCTION_TRACE_STR(a,b)
473#define ACPI_FUNCTION_EXIT
474#define ACPI_FUNCTION_STATUS_EXIT(s)
475#define ACPI_FUNCTION_VALUE_EXIT(s)
476#define ACPI_FUNCTION_TRACE(a)
477#define ACPI_FUNCTION_ENTRY()
478
479#define return_VOID return
480#define return_ACPI_STATUS(s) return(s)
481#define return_VALUE(s) return(s)
482#define return_UINT8(s) return(s)
483#define return_UINT32(s) return(s)
484#define return_PTR(s) return(s)
485
486#endif /* CONFIG_ACPI_DEBUG_FUNC_TRACE */
487
488/* Conditional execution */ 451/* Conditional execution */
489 452
490#define ACPI_DEBUG_EXEC(a) a 453#define ACPI_DEBUG_EXEC(a) a
491#define ACPI_NORMAL_EXEC(a)
492
493#define ACPI_DEBUG_DEFINE(a) a;
494#define ACPI_DEBUG_ONLY_MEMBERS(a) a; 454#define ACPI_DEBUG_ONLY_MEMBERS(a) a;
495#define _VERBOSE_STRUCTURES 455#define _VERBOSE_STRUCTURES
496 456
497/* Stack and buffer dumping */ 457/* Various object display routines for debug */
498 458
499#define ACPI_DUMP_STACK_ENTRY(a) acpi_ex_dump_operand((a), 0) 459#define ACPI_DUMP_STACK_ENTRY(a) acpi_ex_dump_operand((a), 0)
500#define ACPI_DUMP_OPERANDS(a, b, c) acpi_ex_dump_operands(a, b, c) 460#define ACPI_DUMP_OPERANDS(a, b ,c) acpi_ex_dump_operands(a, b, c)
501
502#define ACPI_DUMP_ENTRY(a, b) acpi_ns_dump_entry (a, b) 461#define ACPI_DUMP_ENTRY(a, b) acpi_ns_dump_entry (a, b)
503#define ACPI_DUMP_PATHNAME(a, b, c, d) acpi_ns_dump_pathname(a, b, c, d) 462#define ACPI_DUMP_PATHNAME(a, b, c, d) acpi_ns_dump_pathname(a, b, c, d)
504#define ACPI_DUMP_RESOURCE_LIST(a) acpi_rs_dump_resource_list(a) 463#define ACPI_DUMP_BUFFER(a, b) acpi_ut_debug_dump_buffer((u8 *) a, b, DB_BYTE_DISPLAY, _COMPONENT)
505#define ACPI_DUMP_BUFFER(a, b) acpi_ut_dump_buffer((u8 *) a, b, DB_BYTE_DISPLAY, _COMPONENT)
506 464
507#else 465#else
508/* 466/*
@@ -510,25 +468,23 @@
510 * leaving no executable debug code! 468 * leaving no executable debug code!
511 */ 469 */
512#define ACPI_DEBUG_EXEC(a) 470#define ACPI_DEBUG_EXEC(a)
513#define ACPI_NORMAL_EXEC(a) a; 471#define ACPI_DEBUG_ONLY_MEMBERS(a)
514 472#define ACPI_FUNCTION_TRACE(a)
515#define ACPI_DEBUG_DEFINE(a) do { } while(0) 473#define ACPI_FUNCTION_TRACE_PTR(a, b)
516#define ACPI_DEBUG_ONLY_MEMBERS(a) do { } while(0) 474#define ACPI_FUNCTION_TRACE_U32(a, b)
517#define ACPI_FUNCTION_TRACE(a) do { } while(0) 475#define ACPI_FUNCTION_TRACE_STR(a, b)
518#define ACPI_FUNCTION_TRACE_PTR(a, b) do { } while(0) 476#define ACPI_FUNCTION_EXIT
519#define ACPI_FUNCTION_TRACE_U32(a, b) do { } while(0) 477#define ACPI_FUNCTION_STATUS_EXIT(s)
520#define ACPI_FUNCTION_TRACE_STR(a, b) do { } while(0) 478#define ACPI_FUNCTION_VALUE_EXIT(s)
521#define ACPI_FUNCTION_EXIT do { } while(0) 479#define ACPI_FUNCTION_ENTRY()
522#define ACPI_FUNCTION_STATUS_EXIT(s) do { } while(0) 480#define ACPI_DUMP_STACK_ENTRY(a)
523#define ACPI_FUNCTION_VALUE_EXIT(s) do { } while(0) 481#define ACPI_DUMP_OPERANDS(a, b, c)
524#define ACPI_FUNCTION_ENTRY() do { } while(0) 482#define ACPI_DUMP_ENTRY(a, b)
525#define ACPI_DUMP_STACK_ENTRY(a) do { } while(0) 483#define ACPI_DUMP_TABLES(a, b)
526#define ACPI_DUMP_OPERANDS(a, b, c) do { } while(0) 484#define ACPI_DUMP_PATHNAME(a, b, c, d)
527#define ACPI_DUMP_ENTRY(a, b) do { } while(0) 485#define ACPI_DUMP_BUFFER(a, b)
528#define ACPI_DUMP_TABLES(a, b) do { } while(0) 486#define ACPI_DEBUG_PRINT(pl)
529#define ACPI_DUMP_PATHNAME(a, b, c, d) do { } while(0) 487#define ACPI_DEBUG_PRINT_RAW(pl)
530#define ACPI_DUMP_RESOURCE_LIST(a) do { } while(0)
531#define ACPI_DUMP_BUFFER(a, b) do { } while(0)
532 488
533#define return_VOID return 489#define return_VOID return
534#define return_ACPI_STATUS(s) return(s) 490#define return_ACPI_STATUS(s) return(s)
@@ -556,18 +512,6 @@
556#define ACPI_DEBUGGER_EXEC(a) 512#define ACPI_DEBUGGER_EXEC(a)
557#endif 513#endif
558 514
559#ifdef ACPI_DEBUG_OUTPUT
560/*
561 * 1) Set name to blanks
562 * 2) Copy the object name
563 */
564#define ACPI_ADD_OBJECT_NAME(a,b) ACPI_MEMSET (a->common.name, ' ', sizeof (a->common.name));\
565 ACPI_STRNCPY (a->common.name, acpi_gbl_ns_type_names[b], sizeof (a->common.name))
566#else
567
568#define ACPI_ADD_OBJECT_NAME(a,b)
569#endif
570
571/* 515/*
572 * Memory allocation tracking (DEBUG ONLY) 516 * Memory allocation tracking (DEBUG ONLY)
573 */ 517 */
@@ -578,13 +522,13 @@
578/* Memory allocation */ 522/* Memory allocation */
579 523
580#ifndef ACPI_ALLOCATE 524#ifndef ACPI_ALLOCATE
581#define ACPI_ALLOCATE(a) acpi_ut_allocate((acpi_size)(a), ACPI_MEM_PARAMETERS) 525#define ACPI_ALLOCATE(a) acpi_ut_allocate((acpi_size) (a), ACPI_MEM_PARAMETERS)
582#endif 526#endif
583#ifndef ACPI_ALLOCATE_ZEROED 527#ifndef ACPI_ALLOCATE_ZEROED
584#define ACPI_ALLOCATE_ZEROED(a) acpi_ut_allocate_zeroed((acpi_size)(a), ACPI_MEM_PARAMETERS) 528#define ACPI_ALLOCATE_ZEROED(a) acpi_ut_allocate_zeroed((acpi_size) (a), ACPI_MEM_PARAMETERS)
585#endif 529#endif
586#ifndef ACPI_FREE 530#ifndef ACPI_FREE
587#define ACPI_FREE(a) acpio_os_free(a) 531#define ACPI_FREE(a) acpi_os_free(a)
588#endif 532#endif
589#define ACPI_MEM_TRACKING(a) 533#define ACPI_MEM_TRACKING(a)
590 534
@@ -592,16 +536,25 @@
592 536
593/* Memory allocation */ 537/* Memory allocation */
594 538
595#define ACPI_ALLOCATE(a) acpi_ut_allocate_and_track((acpi_size)(a), ACPI_MEM_PARAMETERS) 539#define ACPI_ALLOCATE(a) acpi_ut_allocate_and_track((acpi_size) (a), ACPI_MEM_PARAMETERS)
596#define ACPI_ALLOCATE_ZEROED(a) acpi_ut_allocate_zeroed_and_track((acpi_size)(a), ACPI_MEM_PARAMETERS) 540#define ACPI_ALLOCATE_ZEROED(a) acpi_ut_allocate_zeroed_and_track((acpi_size) (a), ACPI_MEM_PARAMETERS)
597#define ACPI_FREE(a) acpi_ut_free_and_track(a, ACPI_MEM_PARAMETERS) 541#define ACPI_FREE(a) acpi_ut_free_and_track(a, ACPI_MEM_PARAMETERS)
598#define ACPI_MEM_TRACKING(a) a 542#define ACPI_MEM_TRACKING(a) a
599 543
600#endif /* ACPI_DBG_TRACK_ALLOCATIONS */ 544#endif /* ACPI_DBG_TRACK_ALLOCATIONS */
601 545
602/* Preemption point */ 546/*
603#ifndef ACPI_PREEMPTION_POINT 547 * Macros used for ACPICA utilities only
604#define ACPI_PREEMPTION_POINT() /* no preemption */ 548 */
605#endif 549
550/* Generate a UUID */
551
552#define ACPI_INIT_UUID(a, b, c, d0, d1, d2, d3, d4, d5, d6, d7) \
553 (a) & 0xFF, ((a) >> 8) & 0xFF, ((a) >> 16) & 0xFF, ((a) >> 24) & 0xFF, \
554 (b) & 0xFF, ((b) >> 8) & 0xFF, \
555 (c) & 0xFF, ((c) >> 8) & 0xFF, \
556 (d0), (d1), (d2), (d3), (d4), (d5), (d6), (d7)
557
558#define ACPI_IS_OCTAL_DIGIT(d) (((char)(d) >= '0') && ((char)(d) <= '7'))
606 559
607#endif /* ACMACROS_H */ 560#endif /* ACMACROS_H */