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.h100
1 files changed, 60 insertions, 40 deletions
diff --git a/include/acpi/acmacros.h b/include/acpi/acmacros.h
index 09be937d2c39..5b100cef8dfc 100644
--- a/include/acpi/acmacros.h
+++ b/include/acpi/acmacros.h
@@ -437,21 +437,22 @@
437#define ACPI_PARAM_LIST(pl) pl 437#define ACPI_PARAM_LIST(pl) pl
438 438
439/* 439/*
440 * Error reporting. These versions add callers module and line#. Since 440 * Error reporting. These versions add callers module and line#.
441 * _THIS_MODULE gets compiled out when ACPI_DEBUG_OUTPUT isn't defined, only 441 *
442 * use it in debug mode. 442 * Since _acpi_module_name gets compiled out when ACPI_DEBUG_OUTPUT
443 * isn't defined, only use it in debug mode.
443 */ 444 */
444#ifdef ACPI_DEBUG_OUTPUT 445#ifdef ACPI_DEBUG_OUTPUT
445 446
446#define ACPI_REPORT_INFO(fp) {acpi_ut_report_info(_THIS_MODULE,__LINE__,_COMPONENT); \ 447#define ACPI_REPORT_INFO(fp) {acpi_ut_report_info(_acpi_module_name,__LINE__,_COMPONENT); \
447 acpi_os_printf ACPI_PARAM_LIST(fp);} 448 acpi_os_printf ACPI_PARAM_LIST(fp);}
448#define ACPI_REPORT_ERROR(fp) {acpi_ut_report_error(_THIS_MODULE,__LINE__,_COMPONENT); \ 449#define ACPI_REPORT_ERROR(fp) {acpi_ut_report_error(_acpi_module_name,__LINE__,_COMPONENT); \
449 acpi_os_printf ACPI_PARAM_LIST(fp);} 450 acpi_os_printf ACPI_PARAM_LIST(fp);}
450#define ACPI_REPORT_WARNING(fp) {acpi_ut_report_warning(_THIS_MODULE,__LINE__,_COMPONENT); \ 451#define ACPI_REPORT_WARNING(fp) {acpi_ut_report_warning(_acpi_module_name,__LINE__,_COMPONENT); \
451 acpi_os_printf ACPI_PARAM_LIST(fp);} 452 acpi_os_printf ACPI_PARAM_LIST(fp);}
452#define ACPI_REPORT_NSERROR(s,e) acpi_ns_report_error(_THIS_MODULE,__LINE__,_COMPONENT, s, e); 453#define ACPI_REPORT_NSERROR(s,e) acpi_ns_report_error(_acpi_module_name,__LINE__,_COMPONENT, s, e);
453 454
454#define ACPI_REPORT_METHOD_ERROR(s,n,p,e) acpi_ns_report_method_error(_THIS_MODULE,__LINE__,_COMPONENT, s, n, p, e); 455#define ACPI_REPORT_METHOD_ERROR(s,n,p,e) acpi_ns_report_method_error(_acpi_module_name,__LINE__,_COMPONENT, s, n, p, e);
455 456
456#else 457#else
457 458
@@ -480,36 +481,56 @@
480 * Debug macros that are conditionally compiled 481 * Debug macros that are conditionally compiled
481 */ 482 */
482#ifdef ACPI_DEBUG_OUTPUT 483#ifdef ACPI_DEBUG_OUTPUT
484#define ACPI_MODULE_NAME(name) static char ACPI_UNUSED_VAR *_acpi_module_name = name;
483 485
484#define ACPI_MODULE_NAME(name) static char ACPI_UNUSED_VAR *_THIS_MODULE = name; 486/*
487 * Common parameters used for debug output functions:
488 * line number, function name, module(file) name, component ID
489 */
490#define ACPI_DEBUG_PARAMETERS __LINE__, ACPI_GET_FUNCTION_NAME, _acpi_module_name, _COMPONENT
485 491
486/* 492/*
487 * Function entry tracing. 493 * Function entry tracing
488 * The first parameter should be the procedure name as a quoted string. This is declared
489 * as a local string ("_proc_name) so that it can be also used by the function exit macros below.
490 */ 494 */
491#define ACPI_FUNCTION_NAME(a) struct acpi_debug_print_info _debug_info; \ 495
492 _debug_info.component_id = _COMPONENT; \ 496/*
493 _debug_info.proc_name = a; \ 497 * If ACPI_GET_FUNCTION_NAME was not defined in the compiler-dependent header,
494 _debug_info.module_name = _THIS_MODULE; 498 * define it now. This is the case where there the compiler does not support
495 499 * a __FUNCTION__ macro or equivalent. We save the function name on the
496#define ACPI_FUNCTION_TRACE(a) ACPI_FUNCTION_NAME(a) \ 500 * local stack.
497 acpi_ut_trace(__LINE__,&_debug_info) 501 */
498#define ACPI_FUNCTION_TRACE_PTR(a,b) ACPI_FUNCTION_NAME(a) \ 502#ifndef ACPI_GET_FUNCTION_NAME
499 acpi_ut_trace_ptr(__LINE__,&_debug_info,(void *)b) 503#define ACPI_GET_FUNCTION_NAME _acpi_function_name
500#define ACPI_FUNCTION_TRACE_U32(a,b) ACPI_FUNCTION_NAME(a) \ 504/*
501 acpi_ut_trace_u32(__LINE__,&_debug_info,(u32)b) 505 * The Name parameter should be the procedure name as a quoted string.
502#define ACPI_FUNCTION_TRACE_STR(a,b) ACPI_FUNCTION_NAME(a) \ 506 * This is declared as a local string ("my_function_name") so that it can
503 acpi_ut_trace_str(__LINE__,&_debug_info,(char *)b) 507 * be also used by the function exit macros below.
504 508 */
505#define ACPI_FUNCTION_ENTRY() acpi_ut_track_stack_ptr() 509#define ACPI_FUNCTION_NAME(name) char *_acpi_function_name = name;
510
511#else
512/* Compiler supports __FUNCTION__ (or equivalent) -- Ignore this macro */
513
514#define ACPI_FUNCTION_NAME(name)
515#endif
516
517#define ACPI_FUNCTION_TRACE(a) ACPI_FUNCTION_NAME(a) \
518 acpi_ut_trace(ACPI_DEBUG_PARAMETERS)
519#define ACPI_FUNCTION_TRACE_PTR(a,b) ACPI_FUNCTION_NAME(a) \
520 acpi_ut_trace_ptr(ACPI_DEBUG_PARAMETERS,(void *)b)
521#define ACPI_FUNCTION_TRACE_U32(a,b) ACPI_FUNCTION_NAME(a) \
522 acpi_ut_trace_u32(ACPI_DEBUG_PARAMETERS,(u32)b)
523#define ACPI_FUNCTION_TRACE_STR(a,b) ACPI_FUNCTION_NAME(a) \
524 acpi_ut_trace_str(ACPI_DEBUG_PARAMETERS,(char *)b)
525
526#define ACPI_FUNCTION_ENTRY() acpi_ut_track_stack_ptr()
506 527
507/* 528/*
508 * Function exit tracing. 529 * Function exit tracing.
509 * WARNING: These macros include a return statement. This is usually considered 530 * WARNING: These macros include a return statement. This is usually considered
510 * bad form, but having a separate exit macro is very ugly and difficult to maintain. 531 * bad form, but having a separate exit macro is very ugly and difficult to maintain.
511 * One of the FUNCTION_TRACE macros above must be used in conjunction with these macros 532 * One of the FUNCTION_TRACE macros above must be used in conjunction with these macros
512 * so that "_proc_name" is defined. 533 * so that "_acpi_function_name" is defined.
513 */ 534 */
514#ifdef ACPI_USE_DO_WHILE_0 535#ifdef ACPI_USE_DO_WHILE_0
515#define ACPI_DO_WHILE0(a) do a while(0) 536#define ACPI_DO_WHILE0(a) do a while(0)
@@ -517,10 +538,10 @@
517#define ACPI_DO_WHILE0(a) a 538#define ACPI_DO_WHILE0(a) a
518#endif 539#endif
519 540
520#define return_VOID ACPI_DO_WHILE0 ({acpi_ut_exit(__LINE__,&_debug_info);return;}) 541#define return_VOID ACPI_DO_WHILE0 ({acpi_ut_exit(ACPI_DEBUG_PARAMETERS);return;})
521#define return_ACPI_STATUS(s) ACPI_DO_WHILE0 ({acpi_ut_status_exit(__LINE__,&_debug_info,(s));return((s));}) 542#define return_ACPI_STATUS(s) ACPI_DO_WHILE0 ({acpi_ut_status_exit(ACPI_DEBUG_PARAMETERS,(s));return((s));})
522#define return_VALUE(s) ACPI_DO_WHILE0 ({acpi_ut_value_exit(__LINE__,&_debug_info,(acpi_integer)(s));return((s));}) 543#define return_VALUE(s) ACPI_DO_WHILE0 ({acpi_ut_value_exit(ACPI_DEBUG_PARAMETERS,(acpi_integer)(s));return((s));})
523#define return_PTR(s) ACPI_DO_WHILE0 ({acpi_ut_ptr_exit(__LINE__,&_debug_info,(u8 *)(s));return((s));}) 544#define return_PTR(s) ACPI_DO_WHILE0 ({acpi_ut_ptr_exit(ACPI_DEBUG_PARAMETERS,(u8 *)(s));return((s));})
524 545
525/* Conditional execution */ 546/* Conditional execution */
526 547
@@ -535,7 +556,7 @@
535/* Stack and buffer dumping */ 556/* Stack and buffer dumping */
536 557
537#define ACPI_DUMP_STACK_ENTRY(a) acpi_ex_dump_operand((a),0) 558#define ACPI_DUMP_STACK_ENTRY(a) acpi_ex_dump_operand((a),0)
538#define ACPI_DUMP_OPERANDS(a,b,c,d,e) acpi_ex_dump_operands(a,b,c,d,e,_THIS_MODULE,__LINE__) 559#define ACPI_DUMP_OPERANDS(a,b,c,d,e) acpi_ex_dump_operands(a,b,c,d,e,_acpi_module_name,__LINE__)
539 560
540 561
541#define ACPI_DUMP_ENTRY(a,b) acpi_ns_dump_entry (a,b) 562#define ACPI_DUMP_ENTRY(a,b) acpi_ns_dump_entry (a,b)
@@ -572,7 +593,7 @@
572 * leaving no executable debug code! 593 * leaving no executable debug code!
573 */ 594 */
574#define ACPI_MODULE_NAME(name) 595#define ACPI_MODULE_NAME(name)
575#define _THIS_MODULE "" 596#define _acpi_module_name ""
576 597
577#define ACPI_DEBUG_EXEC(a) 598#define ACPI_DEBUG_EXEC(a)
578#define ACPI_NORMAL_EXEC(a) a; 599#define ACPI_NORMAL_EXEC(a) a;
@@ -648,19 +669,18 @@
648 669
649/* Memory allocation */ 670/* Memory allocation */
650 671
651#define ACPI_MEM_ALLOCATE(a) acpi_ut_allocate((acpi_size)(a),_COMPONENT,_THIS_MODULE,__LINE__) 672#define ACPI_MEM_ALLOCATE(a) acpi_ut_allocate((acpi_size)(a),_COMPONENT,_acpi_module_name,__LINE__)
652#define ACPI_MEM_CALLOCATE(a) acpi_ut_callocate((acpi_size)(a), _COMPONENT,_THIS_MODULE,__LINE__) 673#define ACPI_MEM_CALLOCATE(a) acpi_ut_callocate((acpi_size)(a), _COMPONENT,_acpi_module_name,__LINE__)
653#define ACPI_MEM_FREE(a) acpi_os_free(a) 674#define ACPI_MEM_FREE(a) acpi_os_free(a)
654#define ACPI_MEM_TRACKING(a) 675#define ACPI_MEM_TRACKING(a)
655 676
656
657#else 677#else
658 678
659/* Memory allocation */ 679/* Memory allocation */
660 680
661#define ACPI_MEM_ALLOCATE(a) acpi_ut_allocate_and_track((acpi_size)(a),_COMPONENT,_THIS_MODULE,__LINE__) 681#define ACPI_MEM_ALLOCATE(a) acpi_ut_allocate_and_track((acpi_size)(a),_COMPONENT,_acpi_module_name,__LINE__)
662#define ACPI_MEM_CALLOCATE(a) acpi_ut_callocate_and_track((acpi_size)(a), _COMPONENT,_THIS_MODULE,__LINE__) 682#define ACPI_MEM_CALLOCATE(a) acpi_ut_callocate_and_track((acpi_size)(a), _COMPONENT,_acpi_module_name,__LINE__)
663#define ACPI_MEM_FREE(a) acpi_ut_free_and_track(a,_COMPONENT,_THIS_MODULE,__LINE__) 683#define ACPI_MEM_FREE(a) acpi_ut_free_and_track(a,_COMPONENT,_acpi_module_name,__LINE__)
664#define ACPI_MEM_TRACKING(a) a 684#define ACPI_MEM_TRACKING(a) a
665 685
666#endif /* ACPI_DBG_TRACK_ALLOCATIONS */ 686#endif /* ACPI_DBG_TRACK_ALLOCATIONS */