diff options
author | Bob Moore <robert.moore@intel.com> | 2005-09-30 19:03:00 -0400 |
---|---|---|
committer | Len Brown <len.brown@intel.com> | 2005-12-10 00:20:25 -0500 |
commit | 50eca3eb89d73d9f0aa070b126c7ee6a616016ab (patch) | |
tree | b2d06d21b34b9bd17eea4c53cff1f3866fa1b21d /include/acpi/acmacros.h | |
parent | 3d5271f9883cba7b54762bc4fe027d4172f06db7 (diff) |
[ACPI] ACPICA 20050930
Completed a major overhaul of the Resource Manager code -
specifically, optimizations in the area of the AML/internal
resource conversion code. The code has been optimized to
simplify and eliminate duplicated code, CPU stack use has
been decreased by optimizing function parameters and local
variables, and naming conventions across the manager have
been standardized for clarity and ease of maintenance (this
includes function, parameter, variable, and struct/typedef
names.)
All Resource Manager dispatch and information tables have
been moved to a single location for clarity and ease of
maintenance. One new file was created, named "rsinfo.c".
The ACPI return macros (return_ACPI_STATUS, etc.) have
been modified to guarantee that the argument is
not evaluated twice, making them less prone to macro
side-effects. However, since there exists the possibility
of additional stack use if a particular compiler cannot
optimize them (such as in the debug generation case),
the original macros are optionally available. Note that
some invocations of the return_VALUE macro may now cause
size mismatch warnings; the return_UINT8 and return_UINT32
macros are provided to eliminate these. (From Randy Dunlap)
Implemented a new mechanism to enable debug tracing for
individual control methods. A new external interface,
acpi_debug_trace(), is provided to enable this mechanism. The
intent is to allow the host OS to easily enable and disable
tracing for problematic control methods. This interface
can be easily exposed to a user or debugger interface if
desired. See the file psxface.c for details.
acpi_ut_callocate() will now return a valid pointer if a
length of zero is specified - a length of one is used
and a warning is issued. This matches the behavior of
acpi_ut_allocate().
Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'include/acpi/acmacros.h')
-rw-r--r-- | include/acpi/acmacros.h | 58 |
1 files changed, 54 insertions, 4 deletions
diff --git a/include/acpi/acmacros.h b/include/acpi/acmacros.h index 702cc4e57f5f..258cfe5e2aac 100644 --- a/include/acpi/acmacros.h +++ b/include/acpi/acmacros.h | |||
@@ -525,6 +525,9 @@ | |||
525 | * bad form, but having a separate exit macro is very ugly and difficult to maintain. | 525 | * bad form, but having a separate exit macro is very ugly and difficult to maintain. |
526 | * One of the FUNCTION_TRACE macros above must be used in conjunction with these macros | 526 | * One of the FUNCTION_TRACE macros above must be used in conjunction with these macros |
527 | * so that "_acpi_function_name" is defined. | 527 | * so that "_acpi_function_name" is defined. |
528 | * | ||
529 | * Note: the DO_WHILE0 macro is used to prevent some compilers from complaining | ||
530 | * about these constructs. | ||
528 | */ | 531 | */ |
529 | #ifdef ACPI_USE_DO_WHILE_0 | 532 | #ifdef ACPI_USE_DO_WHILE_0 |
530 | #define ACPI_DO_WHILE0(a) do a while(0) | 533 | #define ACPI_DO_WHILE0(a) do a while(0) |
@@ -532,10 +535,55 @@ | |||
532 | #define ACPI_DO_WHILE0(a) a | 535 | #define ACPI_DO_WHILE0(a) a |
533 | #endif | 536 | #endif |
534 | 537 | ||
535 | #define return_VOID ACPI_DO_WHILE0 ({acpi_ut_exit(ACPI_DEBUG_PARAMETERS);return;}) | 538 | #define return_VOID ACPI_DO_WHILE0 ({ \ |
536 | #define return_ACPI_STATUS(s) ACPI_DO_WHILE0 ({acpi_ut_status_exit(ACPI_DEBUG_PARAMETERS,(s));return((s));}) | 539 | acpi_ut_exit (ACPI_DEBUG_PARAMETERS); \ |
537 | #define return_VALUE(s) ACPI_DO_WHILE0 ({acpi_ut_value_exit(ACPI_DEBUG_PARAMETERS,(acpi_integer)(s));return((s));}) | 540 | return;}) |
538 | #define return_PTR(s) ACPI_DO_WHILE0 ({acpi_ut_ptr_exit(ACPI_DEBUG_PARAMETERS,(u8 *)(s));return((s));}) | 541 | /* |
542 | * There are two versions of most of the return macros. The default version is | ||
543 | * safer, since it avoids side-effects by guaranteeing that the argument will | ||
544 | * not be evaluated twice. | ||
545 | * | ||
546 | * A less-safe version of the macros is provided for optional use if the | ||
547 | * compiler uses excessive CPU stack (for example, this may happen in the | ||
548 | * debug case if code optimzation is disabled.) | ||
549 | */ | ||
550 | #ifndef ACPI_SIMPLE_RETURN_MACROS | ||
551 | |||
552 | #define return_ACPI_STATUS(s) ACPI_DO_WHILE0 ({ \ | ||
553 | register acpi_status _s = (s); \ | ||
554 | acpi_ut_status_exit (ACPI_DEBUG_PARAMETERS, _s); \ | ||
555 | return (_s); }) | ||
556 | #define return_PTR(s) ACPI_DO_WHILE0 ({ \ | ||
557 | register void *_s = (void *) (s); \ | ||
558 | acpi_ut_ptr_exit (ACPI_DEBUG_PARAMETERS, (u8 *) _s); \ | ||
559 | return (_s); }) | ||
560 | #define return_VALUE(s) ACPI_DO_WHILE0 ({ \ | ||
561 | register acpi_integer _s = (s); \ | ||
562 | acpi_ut_value_exit (ACPI_DEBUG_PARAMETERS, _s); \ | ||
563 | return (_s); }) | ||
564 | #define return_UINT8(s) ACPI_DO_WHILE0 ({ \ | ||
565 | register u8 _s = (u8) (s); \ | ||
566 | acpi_ut_value_exit (ACPI_DEBUG_PARAMETERS, _s); \ | ||
567 | return (_s); }) | ||
568 | #define return_UINT32(s) ACPI_DO_WHILE0 ({ \ | ||
569 | register u32 _s = (u32) (s); \ | ||
570 | acpi_ut_value_exit (ACPI_DEBUG_PARAMETERS, _s); \ | ||
571 | return (_s); }) | ||
572 | #else /* Use original less-safe macros */ | ||
573 | |||
574 | #define return_ACPI_STATUS(s) ACPI_DO_WHILE0 ({ \ | ||
575 | acpi_ut_status_exit (ACPI_DEBUG_PARAMETERS, (s)); \ | ||
576 | return((s)); }) | ||
577 | #define return_PTR(s) ACPI_DO_WHILE0 ({ \ | ||
578 | acpi_ut_ptr_exit (ACPI_DEBUG_PARAMETERS, (u8 *) (s)); \ | ||
579 | return((s)); }) | ||
580 | #define return_VALUE(s) ACPI_DO_WHILE0 ({ \ | ||
581 | acpi_ut_value_exit (ACPI_DEBUG_PARAMETERS, (acpi_integer) (s)); \ | ||
582 | return((s)); }) | ||
583 | #define return_UINT8(s) return_VALUE(s) | ||
584 | #define return_UINT32(s) return_VALUE(s) | ||
585 | |||
586 | #endif /* ACPI_SIMPLE_RETURN_MACROS */ | ||
539 | 587 | ||
540 | /* Conditional execution */ | 588 | /* Conditional execution */ |
541 | 589 | ||
@@ -612,6 +660,8 @@ | |||
612 | #define return_VOID return | 660 | #define return_VOID return |
613 | #define return_ACPI_STATUS(s) return(s) | 661 | #define return_ACPI_STATUS(s) return(s) |
614 | #define return_VALUE(s) return(s) | 662 | #define return_VALUE(s) return(s) |
663 | #define return_UINT8(s) return(s) | ||
664 | #define return_UINT32(s) return(s) | ||
615 | #define return_PTR(s) return(s) | 665 | #define return_PTR(s) return(s) |
616 | 666 | ||
617 | #endif | 667 | #endif |