aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi/acpica/utglobal.c
diff options
context:
space:
mode:
authorGlenn Elliott <gelliott@cs.unc.edu>2012-03-04 19:47:13 -0500
committerGlenn Elliott <gelliott@cs.unc.edu>2012-03-04 19:47:13 -0500
commitc71c03bda1e86c9d5198c5d83f712e695c4f2a1e (patch)
treeecb166cb3e2b7e2adb3b5e292245fefd23381ac8 /drivers/acpi/acpica/utglobal.c
parentea53c912f8a86a8567697115b6a0d8152beee5c8 (diff)
parent6a00f206debf8a5c8899055726ad127dbeeed098 (diff)
Merge branch 'mpi-master' into wip-k-fmlpwip-k-fmlp
Conflicts: litmus/sched_cedf.c
Diffstat (limited to 'drivers/acpi/acpica/utglobal.c')
-rw-r--r--drivers/acpi/acpica/utglobal.c496
1 files changed, 10 insertions, 486 deletions
diff --git a/drivers/acpi/acpica/utglobal.c b/drivers/acpi/acpica/utglobal.c
index 0558747579ef..833a38a9c905 100644
--- a/drivers/acpi/acpica/utglobal.c
+++ b/drivers/acpi/acpica/utglobal.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2010, Intel Corp. 8 * Copyright (C) 2000 - 2011, Intel Corp.
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
@@ -45,7 +45,6 @@
45 45
46#include <acpi/acpi.h> 46#include <acpi/acpi.h>
47#include "accommon.h" 47#include "accommon.h"
48#include "acnamesp.h"
49 48
50#define _COMPONENT ACPI_UTILITIES 49#define _COMPONENT ACPI_UTILITIES
51ACPI_MODULE_NAME("utglobal") 50ACPI_MODULE_NAME("utglobal")
@@ -107,43 +106,6 @@ const char *acpi_gbl_highest_dstate_names[ACPI_NUM_sx_d_METHODS] = {
107 106
108/******************************************************************************* 107/*******************************************************************************
109 * 108 *
110 * FUNCTION: acpi_format_exception
111 *
112 * PARAMETERS: Status - The acpi_status code to be formatted
113 *
114 * RETURN: A string containing the exception text. A valid pointer is
115 * always returned.
116 *
117 * DESCRIPTION: This function translates an ACPI exception into an ASCII string
118 * It is here instead of utxface.c so it is always present.
119 *
120 ******************************************************************************/
121
122const char *acpi_format_exception(acpi_status status)
123{
124 const char *exception = NULL;
125
126 ACPI_FUNCTION_ENTRY();
127
128 exception = acpi_ut_validate_exception(status);
129 if (!exception) {
130
131 /* Exception code was not recognized */
132
133 ACPI_ERROR((AE_INFO,
134 "Unknown exception code: 0x%8.8X", status));
135
136 exception = "UNKNOWN_STATUS_CODE";
137 dump_stack();
138 }
139
140 return (ACPI_CAST_PTR(const char, exception));
141}
142
143ACPI_EXPORT_SYMBOL(acpi_format_exception)
144
145/*******************************************************************************
146 *
147 * Namespace globals 109 * Namespace globals
148 * 110 *
149 ******************************************************************************/ 111 ******************************************************************************/
@@ -154,14 +116,16 @@ ACPI_EXPORT_SYMBOL(acpi_format_exception)
154 * 1) _SB_ is defined to be a device to allow \_SB_._INI to be run 116 * 1) _SB_ is defined to be a device to allow \_SB_._INI to be run
155 * during the initialization sequence. 117 * during the initialization sequence.
156 * 2) _TZ_ is defined to be a thermal zone in order to allow ASL code to 118 * 2) _TZ_ is defined to be a thermal zone in order to allow ASL code to
157 * perform a Notify() operation on it. 119 * perform a Notify() operation on it. 09/2010: Changed to type Device.
120 * This still allows notifies, but does not confuse host code that
121 * searches for valid thermal_zone objects.
158 */ 122 */
159const struct acpi_predefined_names acpi_gbl_pre_defined_names[] = { 123const struct acpi_predefined_names acpi_gbl_pre_defined_names[] = {
160 {"_GPE", ACPI_TYPE_LOCAL_SCOPE, NULL}, 124 {"_GPE", ACPI_TYPE_LOCAL_SCOPE, NULL},
161 {"_PR_", ACPI_TYPE_LOCAL_SCOPE, NULL}, 125 {"_PR_", ACPI_TYPE_LOCAL_SCOPE, NULL},
162 {"_SB_", ACPI_TYPE_DEVICE, NULL}, 126 {"_SB_", ACPI_TYPE_DEVICE, NULL},
163 {"_SI_", ACPI_TYPE_LOCAL_SCOPE, NULL}, 127 {"_SI_", ACPI_TYPE_LOCAL_SCOPE, NULL},
164 {"_TZ_", ACPI_TYPE_THERMAL, NULL}, 128 {"_TZ_", ACPI_TYPE_DEVICE, NULL},
165 {"_REV", ACPI_TYPE_INTEGER, (char *)ACPI_CA_SUPPORT_LEVEL}, 129 {"_REV", ACPI_TYPE_INTEGER, (char *)ACPI_CA_SUPPORT_LEVEL},
166 {"_OS_", ACPI_TYPE_STRING, ACPI_OS_NAME}, 130 {"_OS_", ACPI_TYPE_STRING, ACPI_OS_NAME},
167 {"_GL_", ACPI_TYPE_MUTEX, (char *)1}, 131 {"_GL_", ACPI_TYPE_MUTEX, (char *)1},
@@ -175,71 +139,6 @@ const struct acpi_predefined_names acpi_gbl_pre_defined_names[] = {
175 {NULL, ACPI_TYPE_ANY, NULL} 139 {NULL, ACPI_TYPE_ANY, NULL}
176}; 140};
177 141
178/*
179 * Properties of the ACPI Object Types, both internal and external.
180 * The table is indexed by values of acpi_object_type
181 */
182const u8 acpi_gbl_ns_properties[] = {
183 ACPI_NS_NORMAL, /* 00 Any */
184 ACPI_NS_NORMAL, /* 01 Number */
185 ACPI_NS_NORMAL, /* 02 String */
186 ACPI_NS_NORMAL, /* 03 Buffer */
187 ACPI_NS_NORMAL, /* 04 Package */
188 ACPI_NS_NORMAL, /* 05 field_unit */
189 ACPI_NS_NEWSCOPE, /* 06 Device */
190 ACPI_NS_NORMAL, /* 07 Event */
191 ACPI_NS_NEWSCOPE, /* 08 Method */
192 ACPI_NS_NORMAL, /* 09 Mutex */
193 ACPI_NS_NORMAL, /* 10 Region */
194 ACPI_NS_NEWSCOPE, /* 11 Power */
195 ACPI_NS_NEWSCOPE, /* 12 Processor */
196 ACPI_NS_NEWSCOPE, /* 13 Thermal */
197 ACPI_NS_NORMAL, /* 14 buffer_field */
198 ACPI_NS_NORMAL, /* 15 ddb_handle */
199 ACPI_NS_NORMAL, /* 16 Debug Object */
200 ACPI_NS_NORMAL, /* 17 def_field */
201 ACPI_NS_NORMAL, /* 18 bank_field */
202 ACPI_NS_NORMAL, /* 19 index_field */
203 ACPI_NS_NORMAL, /* 20 Reference */
204 ACPI_NS_NORMAL, /* 21 Alias */
205 ACPI_NS_NORMAL, /* 22 method_alias */
206 ACPI_NS_NORMAL, /* 23 Notify */
207 ACPI_NS_NORMAL, /* 24 Address Handler */
208 ACPI_NS_NEWSCOPE | ACPI_NS_LOCAL, /* 25 Resource Desc */
209 ACPI_NS_NEWSCOPE | ACPI_NS_LOCAL, /* 26 Resource Field */
210 ACPI_NS_NEWSCOPE, /* 27 Scope */
211 ACPI_NS_NORMAL, /* 28 Extra */
212 ACPI_NS_NORMAL, /* 29 Data */
213 ACPI_NS_NORMAL /* 30 Invalid */
214};
215
216/* Hex to ASCII conversion table */
217
218static const char acpi_gbl_hex_to_ascii[] = {
219 '0', '1', '2', '3', '4', '5', '6', '7',
220 '8', '9', 'A', 'B', 'C', 'D', 'E', 'F'
221};
222
223/*******************************************************************************
224 *
225 * FUNCTION: acpi_ut_hex_to_ascii_char
226 *
227 * PARAMETERS: Integer - Contains the hex digit
228 * Position - bit position of the digit within the
229 * integer (multiple of 4)
230 *
231 * RETURN: The converted Ascii character
232 *
233 * DESCRIPTION: Convert a hex digit to an Ascii character
234 *
235 ******************************************************************************/
236
237char acpi_ut_hex_to_ascii_char(u64 integer, u32 position)
238{
239
240 return (acpi_gbl_hex_to_ascii[(integer >> position) & 0xF]);
241}
242
243/****************************************************************************** 142/******************************************************************************
244 * 143 *
245 * Event and Hardware globals 144 * Event and Hardware globals
@@ -339,386 +238,6 @@ struct acpi_fixed_event_info acpi_gbl_fixed_event_info[ACPI_NUM_FIXED_EVENTS] =
339 238
340/******************************************************************************* 239/*******************************************************************************
341 * 240 *
342 * FUNCTION: acpi_ut_get_region_name
343 *
344 * PARAMETERS: None.
345 *
346 * RETURN: Status
347 *
348 * DESCRIPTION: Translate a Space ID into a name string (Debug only)
349 *
350 ******************************************************************************/
351
352/* Region type decoding */
353
354const char *acpi_gbl_region_types[ACPI_NUM_PREDEFINED_REGIONS] = {
355 "SystemMemory",
356 "SystemIO",
357 "PCI_Config",
358 "EmbeddedControl",
359 "SMBus",
360 "SystemCMOS",
361 "PCIBARTarget",
362 "IPMI",
363 "DataTable"
364};
365
366char *acpi_ut_get_region_name(u8 space_id)
367{
368
369 if (space_id >= ACPI_USER_REGION_BEGIN) {
370 return ("UserDefinedRegion");
371 } else if (space_id >= ACPI_NUM_PREDEFINED_REGIONS) {
372 return ("InvalidSpaceId");
373 }
374
375 return (ACPI_CAST_PTR(char, acpi_gbl_region_types[space_id]));
376}
377
378/*******************************************************************************
379 *
380 * FUNCTION: acpi_ut_get_event_name
381 *
382 * PARAMETERS: None.
383 *
384 * RETURN: Status
385 *
386 * DESCRIPTION: Translate a Event ID into a name string (Debug only)
387 *
388 ******************************************************************************/
389
390/* Event type decoding */
391
392static const char *acpi_gbl_event_types[ACPI_NUM_FIXED_EVENTS] = {
393 "PM_Timer",
394 "GlobalLock",
395 "PowerButton",
396 "SleepButton",
397 "RealTimeClock",
398};
399
400char *acpi_ut_get_event_name(u32 event_id)
401{
402
403 if (event_id > ACPI_EVENT_MAX) {
404 return ("InvalidEventID");
405 }
406
407 return (ACPI_CAST_PTR(char, acpi_gbl_event_types[event_id]));
408}
409
410/*******************************************************************************
411 *
412 * FUNCTION: acpi_ut_get_type_name
413 *
414 * PARAMETERS: None.
415 *
416 * RETURN: Status
417 *
418 * DESCRIPTION: Translate a Type ID into a name string (Debug only)
419 *
420 ******************************************************************************/
421
422/*
423 * Elements of acpi_gbl_ns_type_names below must match
424 * one-to-one with values of acpi_object_type
425 *
426 * The type ACPI_TYPE_ANY (Untyped) is used as a "don't care" when searching;
427 * when stored in a table it really means that we have thus far seen no
428 * evidence to indicate what type is actually going to be stored for this entry.
429 */
430static const char acpi_gbl_bad_type[] = "UNDEFINED";
431
432/* Printable names of the ACPI object types */
433
434static const char *acpi_gbl_ns_type_names[] = {
435 /* 00 */ "Untyped",
436 /* 01 */ "Integer",
437 /* 02 */ "String",
438 /* 03 */ "Buffer",
439 /* 04 */ "Package",
440 /* 05 */ "FieldUnit",
441 /* 06 */ "Device",
442 /* 07 */ "Event",
443 /* 08 */ "Method",
444 /* 09 */ "Mutex",
445 /* 10 */ "Region",
446 /* 11 */ "Power",
447 /* 12 */ "Processor",
448 /* 13 */ "Thermal",
449 /* 14 */ "BufferField",
450 /* 15 */ "DdbHandle",
451 /* 16 */ "DebugObject",
452 /* 17 */ "RegionField",
453 /* 18 */ "BankField",
454 /* 19 */ "IndexField",
455 /* 20 */ "Reference",
456 /* 21 */ "Alias",
457 /* 22 */ "MethodAlias",
458 /* 23 */ "Notify",
459 /* 24 */ "AddrHandler",
460 /* 25 */ "ResourceDesc",
461 /* 26 */ "ResourceFld",
462 /* 27 */ "Scope",
463 /* 28 */ "Extra",
464 /* 29 */ "Data",
465 /* 30 */ "Invalid"
466};
467
468char *acpi_ut_get_type_name(acpi_object_type type)
469{
470
471 if (type > ACPI_TYPE_INVALID) {
472 return (ACPI_CAST_PTR(char, acpi_gbl_bad_type));
473 }
474
475 return (ACPI_CAST_PTR(char, acpi_gbl_ns_type_names[type]));
476}
477
478char *acpi_ut_get_object_type_name(union acpi_operand_object *obj_desc)
479{
480
481 if (!obj_desc) {
482 return ("[NULL Object Descriptor]");
483 }
484
485 return (acpi_ut_get_type_name(obj_desc->common.type));
486}
487
488/*******************************************************************************
489 *
490 * FUNCTION: acpi_ut_get_node_name
491 *
492 * PARAMETERS: Object - A namespace node
493 *
494 * RETURN: Pointer to a string
495 *
496 * DESCRIPTION: Validate the node and return the node's ACPI name.
497 *
498 ******************************************************************************/
499
500char *acpi_ut_get_node_name(void *object)
501{
502 struct acpi_namespace_node *node = (struct acpi_namespace_node *)object;
503
504 /* Must return a string of exactly 4 characters == ACPI_NAME_SIZE */
505
506 if (!object) {
507 return ("NULL");
508 }
509
510 /* Check for Root node */
511
512 if ((object == ACPI_ROOT_OBJECT) || (object == acpi_gbl_root_node)) {
513 return ("\"\\\" ");
514 }
515
516 /* Descriptor must be a namespace node */
517
518 if (ACPI_GET_DESCRIPTOR_TYPE(node) != ACPI_DESC_TYPE_NAMED) {
519 return ("####");
520 }
521
522 /* Name must be a valid ACPI name */
523
524 if (!acpi_ut_valid_acpi_name(node->name.integer)) {
525 node->name.integer = acpi_ut_repair_name(node->name.ascii);
526 }
527
528 /* Return the name */
529
530 return (node->name.ascii);
531}
532
533/*******************************************************************************
534 *
535 * FUNCTION: acpi_ut_get_descriptor_name
536 *
537 * PARAMETERS: Object - An ACPI object
538 *
539 * RETURN: Pointer to a string
540 *
541 * DESCRIPTION: Validate object and return the descriptor type
542 *
543 ******************************************************************************/
544
545/* Printable names of object descriptor types */
546
547static const char *acpi_gbl_desc_type_names[] = {
548 /* 00 */ "Invalid",
549 /* 01 */ "Cached",
550 /* 02 */ "State-Generic",
551 /* 03 */ "State-Update",
552 /* 04 */ "State-Package",
553 /* 05 */ "State-Control",
554 /* 06 */ "State-RootParseScope",
555 /* 07 */ "State-ParseScope",
556 /* 08 */ "State-WalkScope",
557 /* 09 */ "State-Result",
558 /* 10 */ "State-Notify",
559 /* 11 */ "State-Thread",
560 /* 12 */ "Walk",
561 /* 13 */ "Parser",
562 /* 14 */ "Operand",
563 /* 15 */ "Node"
564};
565
566char *acpi_ut_get_descriptor_name(void *object)
567{
568
569 if (!object) {
570 return ("NULL OBJECT");
571 }
572
573 if (ACPI_GET_DESCRIPTOR_TYPE(object) > ACPI_DESC_TYPE_MAX) {
574 return (ACPI_CAST_PTR(char, acpi_gbl_bad_type));
575 }
576
577 return (ACPI_CAST_PTR(char,
578 acpi_gbl_desc_type_names[ACPI_GET_DESCRIPTOR_TYPE
579 (object)]));
580
581}
582
583/*******************************************************************************
584 *
585 * FUNCTION: acpi_ut_get_reference_name
586 *
587 * PARAMETERS: Object - An ACPI reference object
588 *
589 * RETURN: Pointer to a string
590 *
591 * DESCRIPTION: Decode a reference object sub-type to a string.
592 *
593 ******************************************************************************/
594
595/* Printable names of reference object sub-types */
596
597static const char *acpi_gbl_ref_class_names[] = {
598 /* 00 */ "Local",
599 /* 01 */ "Argument",
600 /* 02 */ "RefOf",
601 /* 03 */ "Index",
602 /* 04 */ "DdbHandle",
603 /* 05 */ "Named Object",
604 /* 06 */ "Debug"
605};
606
607const char *acpi_ut_get_reference_name(union acpi_operand_object *object)
608{
609 if (!object)
610 return "NULL Object";
611
612 if (ACPI_GET_DESCRIPTOR_TYPE(object) != ACPI_DESC_TYPE_OPERAND)
613 return "Not an Operand object";
614
615 if (object->common.type != ACPI_TYPE_LOCAL_REFERENCE)
616 return "Not a Reference object";
617
618 if (object->reference.class > ACPI_REFCLASS_MAX)
619 return "Unknown Reference class";
620
621 return acpi_gbl_ref_class_names[object->reference.class];
622}
623
624#if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER)
625/*
626 * Strings and procedures used for debug only
627 */
628
629/*******************************************************************************
630 *
631 * FUNCTION: acpi_ut_get_mutex_name
632 *
633 * PARAMETERS: mutex_id - The predefined ID for this mutex.
634 *
635 * RETURN: String containing the name of the mutex. Always returns a valid
636 * pointer.
637 *
638 * DESCRIPTION: Translate a mutex ID into a name string (Debug only)
639 *
640 ******************************************************************************/
641
642char *acpi_ut_get_mutex_name(u32 mutex_id)
643{
644
645 if (mutex_id > ACPI_MAX_MUTEX) {
646 return ("Invalid Mutex ID");
647 }
648
649 return (acpi_gbl_mutex_names[mutex_id]);
650}
651
652/*******************************************************************************
653 *
654 * FUNCTION: acpi_ut_get_notify_name
655 *
656 * PARAMETERS: notify_value - Value from the Notify() request
657 *
658 * RETURN: String corresponding to the Notify Value.
659 *
660 * DESCRIPTION: Translate a Notify Value to a notify namestring.
661 *
662 ******************************************************************************/
663
664/* Names for Notify() values, used for debug output */
665
666static const char *acpi_gbl_notify_value_names[] = {
667 "Bus Check",
668 "Device Check",
669 "Device Wake",
670 "Eject Request",
671 "Device Check Light",
672 "Frequency Mismatch",
673 "Bus Mode Mismatch",
674 "Power Fault",
675 "Capabilities Check",
676 "Device PLD Check",
677 "Reserved",
678 "System Locality Update"
679};
680
681const char *acpi_ut_get_notify_name(u32 notify_value)
682{
683
684 if (notify_value <= ACPI_NOTIFY_MAX) {
685 return (acpi_gbl_notify_value_names[notify_value]);
686 } else if (notify_value <= ACPI_MAX_SYS_NOTIFY) {
687 return ("Reserved");
688 } else { /* Greater or equal to 0x80 */
689
690 return ("**Device Specific**");
691 }
692}
693#endif
694
695/*******************************************************************************
696 *
697 * FUNCTION: acpi_ut_valid_object_type
698 *
699 * PARAMETERS: Type - Object type to be validated
700 *
701 * RETURN: TRUE if valid object type, FALSE otherwise
702 *
703 * DESCRIPTION: Validate an object type
704 *
705 ******************************************************************************/
706
707u8 acpi_ut_valid_object_type(acpi_object_type type)
708{
709
710 if (type > ACPI_TYPE_LOCAL_MAX) {
711
712 /* Note: Assumes all TYPEs are contiguous (external/local) */
713
714 return (FALSE);
715 }
716
717 return (TRUE);
718}
719
720/*******************************************************************************
721 *
722 * FUNCTION: acpi_ut_init_globals 241 * FUNCTION: acpi_ut_init_globals
723 * 242 *
724 * PARAMETERS: None 243 * PARAMETERS: None
@@ -766,6 +285,7 @@ acpi_status acpi_ut_init_globals(void)
766 acpi_gbl_gpe_fadt_blocks[0] = NULL; 285 acpi_gbl_gpe_fadt_blocks[0] = NULL;
767 acpi_gbl_gpe_fadt_blocks[1] = NULL; 286 acpi_gbl_gpe_fadt_blocks[1] = NULL;
768 acpi_current_gpe_count = 0; 287 acpi_current_gpe_count = 0;
288 acpi_gbl_all_gpes_initialized = FALSE;
769 289
770 /* Global handlers */ 290 /* Global handlers */
771 291
@@ -774,6 +294,8 @@ acpi_status acpi_ut_init_globals(void)
774 acpi_gbl_exception_handler = NULL; 294 acpi_gbl_exception_handler = NULL;
775 acpi_gbl_init_handler = NULL; 295 acpi_gbl_init_handler = NULL;
776 acpi_gbl_table_handler = NULL; 296 acpi_gbl_table_handler = NULL;
297 acpi_gbl_interface_handler = NULL;
298 acpi_gbl_global_event_handler = NULL;
777 299
778 /* Global Lock support */ 300 /* Global Lock support */
779 301
@@ -800,6 +322,8 @@ acpi_status acpi_ut_init_globals(void)
800 acpi_gbl_debugger_configuration = DEBUGGER_THREADING; 322 acpi_gbl_debugger_configuration = DEBUGGER_THREADING;
801 acpi_gbl_db_output_flags = ACPI_DB_CONSOLE_OUTPUT; 323 acpi_gbl_db_output_flags = ACPI_DB_CONSOLE_OUTPUT;
802 acpi_gbl_osi_data = 0; 324 acpi_gbl_osi_data = 0;
325 acpi_gbl_osi_mutex = NULL;
326 acpi_gbl_reg_methods_executed = FALSE;
803 327
804 /* Hardware oriented */ 328 /* Hardware oriented */
805 329