aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi/utilities/utmisc.c
diff options
context:
space:
mode:
authorRobert Moore <robert.moore@intel.com>2005-05-26 00:00:00 -0400
committerLen Brown <len.brown@intel.com>2005-07-13 16:46:34 -0400
commit88ac00f5a841dcfc5c682000f4a6add0add8caac (patch)
tree80dcff8323c6c79e8706f42eb4b7c3884bc03152 /drivers/acpi/utilities/utmisc.c
parent6f42ccf2fc50ecee8ea170040627f268430c1648 (diff)
ACPICA 20050526 from Bob Moore <robert.moore@intel.com>
Implemented support to execute Type 1 and Type 2 AML opcodes appearing at the module level (not within a control method.) These opcodes are executed exactly once at the time the table is loaded. This type of code was legal up until the release of ACPI 2.0B (2002) and is now supported within ACPI CA in order to provide backwards compatibility with earlier BIOS implementations. This eliminates the "Encountered executable code at module level" warning that was previously generated upon detection of such code. Fixed a problem in the interpreter where an AE_NOT_FOUND exception could inadvertently be generated during the lookup of namespace objects in the second pass parse of ACPI tables and control methods. It appears that this problem could occur during the resolution of forward references to namespace objects. Added the ACPI_MUTEX_DEBUG #ifdef to the acpi_ut_release_mutex function, corresponding to the same the deadlock detection debug code to be compiled out in the normal case, improving mutex performance (and overall subsystem performance) considerably. As suggested by Alexey Starikovskiy. Implemented a handful of miscellaneous fixes for possible memory leaks on error conditions and error handling control paths. These fixes were suggested by FreeBSD and the Coverity Prevent source code analysis tool. Added a check for a null RSDT pointer in acpi_get_firmware_table (tbxfroot.c) to prevent a fault in this error case. Signed-off-by Len Brown <len.brown@intel.com>
Diffstat (limited to 'drivers/acpi/utilities/utmisc.c')
-rw-r--r--drivers/acpi/utilities/utmisc.c38
1 files changed, 22 insertions, 16 deletions
diff --git a/drivers/acpi/utilities/utmisc.c b/drivers/acpi/utilities/utmisc.c
index f6de4ed3d527..bb658777fa88 100644
--- a/drivers/acpi/utilities/utmisc.c
+++ b/drivers/acpi/utilities/utmisc.c
@@ -787,7 +787,6 @@ acpi_ut_release_mutex (
787 acpi_mutex_handle mutex_id) 787 acpi_mutex_handle mutex_id)
788{ 788{
789 acpi_status status; 789 acpi_status status;
790 u32 i;
791 u32 this_thread_id; 790 u32 this_thread_id;
792 791
793 792
@@ -814,25 +813,32 @@ acpi_ut_release_mutex (
814 return (AE_NOT_ACQUIRED); 813 return (AE_NOT_ACQUIRED);
815 } 814 }
816 815
817 /* 816#ifdef ACPI_MUTEX_DEBUG
818 * Deadlock prevention. Check if this thread owns any mutexes of value 817 {
819 * greater than this one. If so, the thread has violated the mutex 818 u32 i;
820 * ordering rule. This indicates a coding error somewhere in 819 /*
821 * the ACPI subsystem code. 820 * Mutex debug code, for internal debugging only.
822 */ 821 *
823 for (i = mutex_id; i < MAX_MUTEX; i++) { 822 * Deadlock prevention. Check if this thread owns any mutexes of value
824 if (acpi_gbl_mutex_info[i].owner_id == this_thread_id) { 823 * greater than this one. If so, the thread has violated the mutex
825 if (i == mutex_id) { 824 * ordering rule. This indicates a coding error somewhere in
826 continue; 825 * the ACPI subsystem code.
827 } 826 */
827 for (i = mutex_id; i < MAX_MUTEX; i++) {
828 if (acpi_gbl_mutex_info[i].owner_id == this_thread_id) {
829 if (i == mutex_id) {
830 continue;
831 }
828 832
829 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, 833 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
830 "Invalid release order: owns [%s], releasing [%s]\n", 834 "Invalid release order: owns [%s], releasing [%s]\n",
831 acpi_ut_get_mutex_name (i), acpi_ut_get_mutex_name (mutex_id))); 835 acpi_ut_get_mutex_name (i), acpi_ut_get_mutex_name (mutex_id)));
832 836
833 return (AE_RELEASE_DEADLOCK); 837 return (AE_RELEASE_DEADLOCK);
838 }
834 } 839 }
835 } 840 }
841#endif
836 842
837 /* Mark unlocked FIRST */ 843 /* Mark unlocked FIRST */
838 844