aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi/utilities/utglobal.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/acpi/utilities/utglobal.c')
-rw-r--r--drivers/acpi/utilities/utglobal.c108
1 files changed, 63 insertions, 45 deletions
diff --git a/drivers/acpi/utilities/utglobal.c b/drivers/acpi/utilities/utglobal.c
index 399e64b51886..ffd13383a325 100644
--- a/drivers/acpi/utilities/utglobal.c
+++ b/drivers/acpi/utilities/utglobal.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2005, R. Byron Moore 8 * Copyright (C) 2000 - 2006, R. Byron Moore
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
@@ -67,8 +67,11 @@ const char *acpi_format_exception(acpi_status status)
67 acpi_status sub_status; 67 acpi_status sub_status;
68 const char *exception = NULL; 68 const char *exception = NULL;
69 69
70 ACPI_FUNCTION_NAME("format_exception"); 70 ACPI_FUNCTION_ENTRY();
71 71
72 /*
73 * Status is composed of two parts, a "type" and an actual code
74 */
72 sub_status = (status & ~AE_CODE_MASK); 75 sub_status = (status & ~AE_CODE_MASK);
73 76
74 switch (status & AE_CODE_MASK) { 77 switch (status & AE_CODE_MASK) {
@@ -118,13 +121,13 @@ const char *acpi_format_exception(acpi_status status)
118 if (!exception) { 121 if (!exception) {
119 /* Exception code was not recognized */ 122 /* Exception code was not recognized */
120 123
121 ACPI_DEBUG_PRINT((ACPI_DB_ERROR, 124 ACPI_ERROR((AE_INFO,
122 "Unknown exception code: 0x%8.8X\n", status)); 125 "Unknown exception code: 0x%8.8X", status));
123 126
124 return ((const char *)"UNKNOWN_STATUS_CODE"); 127 exception = "UNKNOWN_STATUS_CODE";
125 } 128 }
126 129
127 return ((const char *)exception); 130 return (ACPI_CAST_PTR(const char, exception));
128} 131}
129 132
130/******************************************************************************* 133/*******************************************************************************
@@ -217,23 +220,23 @@ const char *acpi_gbl_valid_osi_strings[ACPI_NUM_OSI_STRINGS] = {
217 * 2) _TZ_ is defined to be a thermal zone in order to allow ASL code to 220 * 2) _TZ_ is defined to be a thermal zone in order to allow ASL code to
218 * perform a Notify() operation on it. 221 * perform a Notify() operation on it.
219 */ 222 */
220const struct acpi_predefined_names acpi_gbl_pre_defined_names[] = 223const struct acpi_predefined_names acpi_gbl_pre_defined_names[] = {
221 { {"_GPE", ACPI_TYPE_LOCAL_SCOPE, NULL}, 224 {"_GPE", ACPI_TYPE_LOCAL_SCOPE, NULL},
222{"_PR_", ACPI_TYPE_LOCAL_SCOPE, NULL}, 225 {"_PR_", ACPI_TYPE_LOCAL_SCOPE, NULL},
223{"_SB_", ACPI_TYPE_DEVICE, NULL}, 226 {"_SB_", ACPI_TYPE_DEVICE, NULL},
224{"_SI_", ACPI_TYPE_LOCAL_SCOPE, NULL}, 227 {"_SI_", ACPI_TYPE_LOCAL_SCOPE, NULL},
225{"_TZ_", ACPI_TYPE_THERMAL, NULL}, 228 {"_TZ_", ACPI_TYPE_THERMAL, NULL},
226{"_REV", ACPI_TYPE_INTEGER, (char *)ACPI_CA_SUPPORT_LEVEL}, 229 {"_REV", ACPI_TYPE_INTEGER, (char *)ACPI_CA_SUPPORT_LEVEL},
227{"_OS_", ACPI_TYPE_STRING, ACPI_OS_NAME}, 230 {"_OS_", ACPI_TYPE_STRING, ACPI_OS_NAME},
228{"_GL_", ACPI_TYPE_MUTEX, (char *)1}, 231 {"_GL_", ACPI_TYPE_MUTEX, (char *)1},
229 232
230#if !defined (ACPI_NO_METHOD_EXECUTION) || defined (ACPI_CONSTANT_EVAL_ONLY) 233#if !defined (ACPI_NO_METHOD_EXECUTION) || defined (ACPI_CONSTANT_EVAL_ONLY)
231{"_OSI", ACPI_TYPE_METHOD, (char *)1}, 234 {"_OSI", ACPI_TYPE_METHOD, (char *)1},
232#endif 235#endif
233 236
234 /* Table terminator */ 237 /* Table terminator */
235 238
236{NULL, ACPI_TYPE_ANY, NULL} 239 {NULL, ACPI_TYPE_ANY, NULL}
237}; 240};
238 241
239/* 242/*
@@ -485,7 +488,7 @@ char *acpi_ut_get_region_name(u8 space_id)
485 return ("invalid_space_id"); 488 return ("invalid_space_id");
486 } 489 }
487 490
488 return ((char *)acpi_gbl_region_types[space_id]); 491 return (ACPI_CAST_PTR(char, acpi_gbl_region_types[space_id]));
489} 492}
490 493
491/******************************************************************************* 494/*******************************************************************************
@@ -503,11 +506,13 @@ char *acpi_ut_get_region_name(u8 space_id)
503/* Event type decoding */ 506/* Event type decoding */
504 507
505static const char *acpi_gbl_event_types[ACPI_NUM_FIXED_EVENTS] = { 508static const char *acpi_gbl_event_types[ACPI_NUM_FIXED_EVENTS] = {
509/*! [Begin] no source code translation (keep these strings as-is) */
506 "PM_Timer", 510 "PM_Timer",
507 "global_lock", 511 "GlobalLock",
508 "power_button", 512 "PowerButton",
509 "sleep_button", 513 "SleepButton",
510 "real_time_clock", 514 "RealTimeClock",
515/*! [End] no source code translation !*/
511}; 516};
512 517
513char *acpi_ut_get_event_name(u32 event_id) 518char *acpi_ut_get_event_name(u32 event_id)
@@ -517,7 +522,7 @@ char *acpi_ut_get_event_name(u32 event_id)
517 return ("invalid_event_iD"); 522 return ("invalid_event_iD");
518 } 523 }
519 524
520 return ((char *)acpi_gbl_event_types[event_id]); 525 return (ACPI_CAST_PTR(char, acpi_gbl_event_types[event_id]));
521} 526}
522 527
523/******************************************************************************* 528/*******************************************************************************
@@ -545,12 +550,13 @@ static const char acpi_gbl_bad_type[] = "UNDEFINED";
545/* Printable names of the ACPI object types */ 550/* Printable names of the ACPI object types */
546 551
547static const char *acpi_gbl_ns_type_names[] = { 552static const char *acpi_gbl_ns_type_names[] = {
553/*! [Begin] no source code translation (keep these strings as-is) */
548 /* 00 */ "Untyped", 554 /* 00 */ "Untyped",
549 /* 01 */ "Integer", 555 /* 01 */ "Integer",
550 /* 02 */ "String", 556 /* 02 */ "String",
551 /* 03 */ "Buffer", 557 /* 03 */ "Buffer",
552 /* 04 */ "Package", 558 /* 04 */ "Package",
553 /* 05 */ "field_unit", 559 /* 05 */ "FieldUnit",
554 /* 06 */ "Device", 560 /* 06 */ "Device",
555 /* 07 */ "Event", 561 /* 07 */ "Event",
556 /* 08 */ "Method", 562 /* 08 */ "Method",
@@ -559,33 +565,34 @@ static const char *acpi_gbl_ns_type_names[] = {
559 /* 11 */ "Power", 565 /* 11 */ "Power",
560 /* 12 */ "Processor", 566 /* 12 */ "Processor",
561 /* 13 */ "Thermal", 567 /* 13 */ "Thermal",
562 /* 14 */ "buffer_field", 568 /* 14 */ "BufferField",
563 /* 15 */ "ddb_handle", 569 /* 15 */ "DdbHandle",
564 /* 16 */ "debug_object", 570 /* 16 */ "DebugObject",
565 /* 17 */ "region_field", 571 /* 17 */ "RegionField",
566 /* 18 */ "bank_field", 572 /* 18 */ "BankField",
567 /* 19 */ "index_field", 573 /* 19 */ "IndexField",
568 /* 20 */ "Reference", 574 /* 20 */ "Reference",
569 /* 21 */ "Alias", 575 /* 21 */ "Alias",
570 /* 22 */ "method_alias", 576 /* 22 */ "MethodAlias",
571 /* 23 */ "Notify", 577 /* 23 */ "Notify",
572 /* 24 */ "addr_handler", 578 /* 24 */ "AddrHandler",
573 /* 25 */ "resource_desc", 579 /* 25 */ "ResourceDesc",
574 /* 26 */ "resource_fld", 580 /* 26 */ "ResourceFld",
575 /* 27 */ "Scope", 581 /* 27 */ "Scope",
576 /* 28 */ "Extra", 582 /* 28 */ "Extra",
577 /* 29 */ "Data", 583 /* 29 */ "Data",
578 /* 30 */ "Invalid" 584 /* 30 */ "Invalid"
585/*! [End] no source code translation !*/
579}; 586};
580 587
581char *acpi_ut_get_type_name(acpi_object_type type) 588char *acpi_ut_get_type_name(acpi_object_type type)
582{ 589{
583 590
584 if (type > ACPI_TYPE_INVALID) { 591 if (type > ACPI_TYPE_INVALID) {
585 return ((char *)acpi_gbl_bad_type); 592 return (ACPI_CAST_PTR(char, acpi_gbl_bad_type));
586 } 593 }
587 594
588 return ((char *)acpi_gbl_ns_type_names[type]); 595 return (ACPI_CAST_PTR(char, acpi_gbl_ns_type_names[type]));
589} 596}
590 597
591char *acpi_ut_get_object_type_name(union acpi_operand_object *obj_desc) 598char *acpi_ut_get_object_type_name(union acpi_operand_object *obj_desc)
@@ -634,7 +641,7 @@ char *acpi_ut_get_node_name(void *object)
634 641
635 /* Name must be a valid ACPI name */ 642 /* Name must be a valid ACPI name */
636 643
637 if (!acpi_ut_valid_acpi_name(*(u32 *) node->name.ascii)) { 644 if (!acpi_ut_valid_acpi_name(node->name.integer)) {
638 return ("????"); 645 return ("????");
639 } 646 }
640 647
@@ -658,15 +665,16 @@ char *acpi_ut_get_node_name(void *object)
658/* Printable names of object descriptor types */ 665/* Printable names of object descriptor types */
659 666
660static const char *acpi_gbl_desc_type_names[] = { 667static const char *acpi_gbl_desc_type_names[] = {
668/*! [Begin] no source code translation (keep these ASL Keywords as-is) */
661 /* 00 */ "Invalid", 669 /* 00 */ "Invalid",
662 /* 01 */ "Cached", 670 /* 01 */ "Cached",
663 /* 02 */ "State-Generic", 671 /* 02 */ "State-Generic",
664 /* 03 */ "State-Update", 672 /* 03 */ "State-Update",
665 /* 04 */ "State-Package", 673 /* 04 */ "State-Package",
666 /* 05 */ "State-Control", 674 /* 05 */ "State-Control",
667 /* 06 */ "State-root_parse_scope", 675 /* 06 */ "State-RootParseScope",
668 /* 07 */ "State-parse_scope", 676 /* 07 */ "State-ParseScope",
669 /* 08 */ "State-walk_scope", 677 /* 08 */ "State-WalkScope",
670 /* 09 */ "State-Result", 678 /* 09 */ "State-Result",
671 /* 10 */ "State-Notify", 679 /* 10 */ "State-Notify",
672 /* 11 */ "State-Thread", 680 /* 11 */ "State-Thread",
@@ -674,6 +682,7 @@ static const char *acpi_gbl_desc_type_names[] = {
674 /* 13 */ "Parser", 682 /* 13 */ "Parser",
675 /* 14 */ "Operand", 683 /* 14 */ "Operand",
676 /* 15 */ "Node" 684 /* 15 */ "Node"
685/*! [End] no source code translation !*/
677}; 686};
678 687
679char *acpi_ut_get_descriptor_name(void *object) 688char *acpi_ut_get_descriptor_name(void *object)
@@ -684,11 +693,12 @@ char *acpi_ut_get_descriptor_name(void *object)
684 } 693 }
685 694
686 if (ACPI_GET_DESCRIPTOR_TYPE(object) > ACPI_DESC_TYPE_MAX) { 695 if (ACPI_GET_DESCRIPTOR_TYPE(object) > ACPI_DESC_TYPE_MAX) {
687 return ((char *)acpi_gbl_bad_type); 696 return (ACPI_CAST_PTR(char, acpi_gbl_bad_type));
688 } 697 }
689 698
690 return ((char *) 699 return (ACPI_CAST_PTR(char,
691 acpi_gbl_desc_type_names[ACPI_GET_DESCRIPTOR_TYPE(object)]); 700 acpi_gbl_desc_type_names[ACPI_GET_DESCRIPTOR_TYPE
701 (object)]));
692 702
693} 703}
694 704
@@ -787,6 +797,11 @@ void acpi_ut_init_globals(void)
787 acpi_gbl_mutex_info[i].use_count = 0; 797 acpi_gbl_mutex_info[i].use_count = 0;
788 } 798 }
789 799
800 for (i = 0; i < ACPI_NUM_OWNERID_MASKS; i++) {
801 acpi_gbl_owner_id_mask[i] = 0;
802 }
803 acpi_gbl_owner_id_mask[ACPI_NUM_OWNERID_MASKS - 1] = 0x80000000; /* Last ID is never valid */
804
790 /* GPE support */ 805 /* GPE support */
791 806
792 acpi_gbl_gpe_xrupt_list_head = NULL; 807 acpi_gbl_gpe_xrupt_list_head = NULL;
@@ -824,7 +839,11 @@ void acpi_ut_init_globals(void)
824 acpi_gbl_ns_lookup_count = 0; 839 acpi_gbl_ns_lookup_count = 0;
825 acpi_gbl_ps_find_count = 0; 840 acpi_gbl_ps_find_count = 0;
826 acpi_gbl_acpi_hardware_present = TRUE; 841 acpi_gbl_acpi_hardware_present = TRUE;
827 acpi_gbl_owner_id_mask = 0; 842 acpi_gbl_last_owner_id_index = 0;
843 acpi_gbl_next_owner_id_offset = 0;
844 acpi_gbl_trace_method_name = 0;
845 acpi_gbl_trace_dbg_level = 0;
846 acpi_gbl_trace_dbg_layer = 0;
828 acpi_gbl_debugger_configuration = DEBUGGER_THREADING; 847 acpi_gbl_debugger_configuration = DEBUGGER_THREADING;
829 acpi_gbl_db_output_flags = ACPI_DB_CONSOLE_OUTPUT; 848 acpi_gbl_db_output_flags = ACPI_DB_CONSOLE_OUTPUT;
830 849
@@ -836,7 +855,6 @@ void acpi_ut_init_globals(void)
836 /* Namespace */ 855 /* Namespace */
837 856
838 acpi_gbl_root_node = NULL; 857 acpi_gbl_root_node = NULL;
839
840 acpi_gbl_root_node_struct.name.integer = ACPI_ROOT_NAME; 858 acpi_gbl_root_node_struct.name.integer = ACPI_ROOT_NAME;
841 acpi_gbl_root_node_struct.descriptor = ACPI_DESC_TYPE_NAMED; 859 acpi_gbl_root_node_struct.descriptor = ACPI_DESC_TYPE_NAMED;
842 acpi_gbl_root_node_struct.type = ACPI_TYPE_DEVICE; 860 acpi_gbl_root_node_struct.type = ACPI_TYPE_DEVICE;