debuggers.hg

view xen/drivers/acpi/utilities/utglobal.c @ 21015:8cb6e7eff2ba

x86: Generalise BUGFRAME_dump mechanism to allow polled UART irq to
get proper regs argument.

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
author Keir Fraser <keir.fraser@citrix.com>
date Wed Feb 24 10:44:30 2010 +0000 (2010-02-24)
parents 9af7a535225f
children
line source
1 /******************************************************************************
2 *
3 * Module Name: utglobal - Global variables for the ACPI subsystem
4 *
5 *****************************************************************************/
7 /*
8 * Copyright (C) 2000 - 2008, Intel Corp.
9 * All rights reserved.
10 *
11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions
13 * are met:
14 * 1. Redistributions of source code must retain the above copyright
15 * notice, this list of conditions, and the following disclaimer,
16 * without modification.
17 * 2. Redistributions in binary form must reproduce at minimum a disclaimer
18 * substantially similar to the "NO WARRANTY" disclaimer below
19 * ("Disclaimer") and any redistribution must be conditioned upon
20 * including a substantially similar Disclaimer requirement for further
21 * binary redistribution.
22 * 3. Neither the names of the above-listed copyright holders nor the names
23 * of any contributors may be used to endorse or promote products derived
24 * from this software without specific prior written permission.
25 *
26 * Alternatively, this software may be distributed under the terms of the
27 * GNU General Public License ("GPL") version 2 as published by the Free
28 * Software Foundation.
29 *
30 * NO WARRANTY
31 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
32 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
33 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
34 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
35 * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
36 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
37 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
38 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
39 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
40 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
41 * POSSIBILITY OF SUCH DAMAGES.
42 */
44 #define DEFINE_ACPI_GLOBALS
46 #include <xen/config.h>
47 #include <xen/lib.h>
48 #include <asm/processor.h>
49 #include <acpi/acpi.h>
50 #include <acpi/acnamesp.h>
52 ACPI_EXPORT_SYMBOL(acpi_gbl_FADT)
53 #define _COMPONENT ACPI_UTILITIES
54 ACPI_MODULE_NAME("utglobal")
56 /*******************************************************************************
57 *
58 * Static global variable initialization.
59 *
60 ******************************************************************************/
61 /*
62 * We want the debug switches statically initialized so they
63 * are already set when the debugger is entered.
64 */
65 /* Debug switch - level and trace mask */
66 u32 acpi_dbg_level = ACPI_DEBUG_DEFAULT;
68 /* Debug switch - layer (component) mask */
70 u32 acpi_dbg_layer = ACPI_COMPONENT_DEFAULT | ACPI_ALL_DRIVERS;
71 u32 acpi_gbl_nesting_level = 0;
73 /* Debugger globals */
75 u8 acpi_gbl_db_terminate_threads = FALSE;
76 u8 acpi_gbl_abort_method = FALSE;
77 u8 acpi_gbl_method_executing = FALSE;
79 /* System flags */
81 u32 acpi_gbl_startup_flags = 0;
83 /* System starts uninitialized */
85 u8 acpi_gbl_shutdown = TRUE;
87 const char *acpi_gbl_sleep_state_names[ACPI_S_STATE_COUNT] = {
88 "\\_S0_",
89 "\\_S1_",
90 "\\_S2_",
91 "\\_S3_",
92 "\\_S4_",
93 "\\_S5_"
94 };
96 const char *acpi_gbl_highest_dstate_names[4] = {
97 "_S1D",
98 "_S2D",
99 "_S3D",
100 "_S4D"
101 };
103 /*******************************************************************************
104 *
105 * FUNCTION: acpi_format_exception
106 *
107 * PARAMETERS: Status - The acpi_status code to be formatted
108 *
109 * RETURN: A string containing the exception text. A valid pointer is
110 * always returned.
111 *
112 * DESCRIPTION: This function translates an ACPI exception into an ASCII string
113 * It is here instead of utxface.c so it is always present.
114 *
115 ******************************************************************************/
117 const char *acpi_format_exception(acpi_status status)
118 {
119 const char *exception = NULL;
121 ACPI_FUNCTION_ENTRY();
123 exception = acpi_ut_validate_exception(status);
124 if (!exception) {
126 /* Exception code was not recognized */
128 ACPI_ERROR((AE_INFO,
129 "Unknown exception code: 0x%8.8X", status));
131 exception = "UNKNOWN_STATUS_CODE";
132 dump_execution_state();
133 }
135 return (ACPI_CAST_PTR(const char, exception));
136 }
138 ACPI_EXPORT_SYMBOL(acpi_format_exception)
140 /*******************************************************************************
141 *
142 * Namespace globals
143 *
144 ******************************************************************************/
145 /*
146 * Predefined ACPI Names (Built-in to the Interpreter)
147 *
148 * NOTES:
149 * 1) _SB_ is defined to be a device to allow \_SB_._INI to be run
150 * during the initialization sequence.
151 * 2) _TZ_ is defined to be a thermal zone in order to allow ASL code to
152 * perform a Notify() operation on it.
153 */
154 const struct acpi_predefined_names acpi_gbl_pre_defined_names[] = {
155 {"_GPE", ACPI_TYPE_LOCAL_SCOPE, NULL},
156 {"_PR_", ACPI_TYPE_LOCAL_SCOPE, NULL},
157 {"_SB_", ACPI_TYPE_DEVICE, NULL},
158 {"_SI_", ACPI_TYPE_LOCAL_SCOPE, NULL},
159 {"_TZ_", ACPI_TYPE_THERMAL, NULL},
160 {"_REV", ACPI_TYPE_INTEGER, (char *)ACPI_CA_SUPPORT_LEVEL},
161 {"_OS_", ACPI_TYPE_STRING, ACPI_OS_NAME},
162 {"_GL_", ACPI_TYPE_MUTEX, (char *)1},
164 #if !defined (ACPI_NO_METHOD_EXECUTION) || defined (ACPI_CONSTANT_EVAL_ONLY)
165 {"_OSI", ACPI_TYPE_METHOD, (char *)1},
166 #endif
168 /* Table terminator */
170 {NULL, ACPI_TYPE_ANY, NULL}
171 };
173 /*
174 * Properties of the ACPI Object Types, both internal and external.
175 * The table is indexed by values of acpi_object_type
176 */
177 const u8 acpi_gbl_ns_properties[] = {
178 ACPI_NS_NORMAL, /* 00 Any */
179 ACPI_NS_NORMAL, /* 01 Number */
180 ACPI_NS_NORMAL, /* 02 String */
181 ACPI_NS_NORMAL, /* 03 Buffer */
182 ACPI_NS_NORMAL, /* 04 Package */
183 ACPI_NS_NORMAL, /* 05 field_unit */
184 ACPI_NS_NEWSCOPE, /* 06 Device */
185 ACPI_NS_NORMAL, /* 07 Event */
186 ACPI_NS_NEWSCOPE, /* 08 Method */
187 ACPI_NS_NORMAL, /* 09 Mutex */
188 ACPI_NS_NORMAL, /* 10 Region */
189 ACPI_NS_NEWSCOPE, /* 11 Power */
190 ACPI_NS_NEWSCOPE, /* 12 Processor */
191 ACPI_NS_NEWSCOPE, /* 13 Thermal */
192 ACPI_NS_NORMAL, /* 14 buffer_field */
193 ACPI_NS_NORMAL, /* 15 ddb_handle */
194 ACPI_NS_NORMAL, /* 16 Debug Object */
195 ACPI_NS_NORMAL, /* 17 def_field */
196 ACPI_NS_NORMAL, /* 18 bank_field */
197 ACPI_NS_NORMAL, /* 19 index_field */
198 ACPI_NS_NORMAL, /* 20 Reference */
199 ACPI_NS_NORMAL, /* 21 Alias */
200 ACPI_NS_NORMAL, /* 22 method_alias */
201 ACPI_NS_NORMAL, /* 23 Notify */
202 ACPI_NS_NORMAL, /* 24 Address Handler */
203 ACPI_NS_NEWSCOPE | ACPI_NS_LOCAL, /* 25 Resource Desc */
204 ACPI_NS_NEWSCOPE | ACPI_NS_LOCAL, /* 26 Resource Field */
205 ACPI_NS_NEWSCOPE, /* 27 Scope */
206 ACPI_NS_NORMAL, /* 28 Extra */
207 ACPI_NS_NORMAL, /* 29 Data */
208 ACPI_NS_NORMAL /* 30 Invalid */
209 };
211 /* Hex to ASCII conversion table */
213 static const char acpi_gbl_hex_to_ascii[] = {
214 '0', '1', '2', '3', '4', '5', '6', '7',
215 '8', '9', 'A', 'B', 'C', 'D', 'E', 'F'
216 };
218 /*******************************************************************************
219 *
220 * FUNCTION: acpi_ut_hex_to_ascii_char
221 *
222 * PARAMETERS: Integer - Contains the hex digit
223 * Position - bit position of the digit within the
224 * integer (multiple of 4)
225 *
226 * RETURN: The converted Ascii character
227 *
228 * DESCRIPTION: Convert a hex digit to an Ascii character
229 *
230 ******************************************************************************/
232 char acpi_ut_hex_to_ascii_char(acpi_integer integer, u32 position)
233 {
235 return (acpi_gbl_hex_to_ascii[(integer >> position) & 0xF]);
236 }
238 /******************************************************************************
239 *
240 * Event and Hardware globals
241 *
242 ******************************************************************************/
244 struct acpi_bit_register_info acpi_gbl_bit_register_info[ACPI_NUM_BITREG] = {
245 /* Name Parent Register Register Bit Position Register Bit Mask */
247 /* ACPI_BITREG_TIMER_STATUS */ {ACPI_REGISTER_PM1_STATUS,
248 ACPI_BITPOSITION_TIMER_STATUS,
249 ACPI_BITMASK_TIMER_STATUS},
250 /* ACPI_BITREG_BUS_MASTER_STATUS */ {ACPI_REGISTER_PM1_STATUS,
251 ACPI_BITPOSITION_BUS_MASTER_STATUS,
252 ACPI_BITMASK_BUS_MASTER_STATUS},
253 /* ACPI_BITREG_GLOBAL_LOCK_STATUS */ {ACPI_REGISTER_PM1_STATUS,
254 ACPI_BITPOSITION_GLOBAL_LOCK_STATUS,
255 ACPI_BITMASK_GLOBAL_LOCK_STATUS},
256 /* ACPI_BITREG_POWER_BUTTON_STATUS */ {ACPI_REGISTER_PM1_STATUS,
257 ACPI_BITPOSITION_POWER_BUTTON_STATUS,
258 ACPI_BITMASK_POWER_BUTTON_STATUS},
259 /* ACPI_BITREG_SLEEP_BUTTON_STATUS */ {ACPI_REGISTER_PM1_STATUS,
260 ACPI_BITPOSITION_SLEEP_BUTTON_STATUS,
261 ACPI_BITMASK_SLEEP_BUTTON_STATUS},
262 /* ACPI_BITREG_RT_CLOCK_STATUS */ {ACPI_REGISTER_PM1_STATUS,
263 ACPI_BITPOSITION_RT_CLOCK_STATUS,
264 ACPI_BITMASK_RT_CLOCK_STATUS},
265 /* ACPI_BITREG_WAKE_STATUS */ {ACPI_REGISTER_PM1_STATUS,
266 ACPI_BITPOSITION_WAKE_STATUS,
267 ACPI_BITMASK_WAKE_STATUS},
268 /* ACPI_BITREG_PCIEXP_WAKE_STATUS */ {ACPI_REGISTER_PM1_STATUS,
269 ACPI_BITPOSITION_PCIEXP_WAKE_STATUS,
270 ACPI_BITMASK_PCIEXP_WAKE_STATUS},
272 /* ACPI_BITREG_TIMER_ENABLE */ {ACPI_REGISTER_PM1_ENABLE,
273 ACPI_BITPOSITION_TIMER_ENABLE,
274 ACPI_BITMASK_TIMER_ENABLE},
275 /* ACPI_BITREG_GLOBAL_LOCK_ENABLE */ {ACPI_REGISTER_PM1_ENABLE,
276 ACPI_BITPOSITION_GLOBAL_LOCK_ENABLE,
277 ACPI_BITMASK_GLOBAL_LOCK_ENABLE},
278 /* ACPI_BITREG_POWER_BUTTON_ENABLE */ {ACPI_REGISTER_PM1_ENABLE,
279 ACPI_BITPOSITION_POWER_BUTTON_ENABLE,
280 ACPI_BITMASK_POWER_BUTTON_ENABLE},
281 /* ACPI_BITREG_SLEEP_BUTTON_ENABLE */ {ACPI_REGISTER_PM1_ENABLE,
282 ACPI_BITPOSITION_SLEEP_BUTTON_ENABLE,
283 ACPI_BITMASK_SLEEP_BUTTON_ENABLE},
284 /* ACPI_BITREG_RT_CLOCK_ENABLE */ {ACPI_REGISTER_PM1_ENABLE,
285 ACPI_BITPOSITION_RT_CLOCK_ENABLE,
286 ACPI_BITMASK_RT_CLOCK_ENABLE},
287 /* ACPI_BITREG_WAKE_ENABLE */ {ACPI_REGISTER_PM1_ENABLE, 0, 0},
288 /* ACPI_BITREG_PCIEXP_WAKE_DISABLE */ {ACPI_REGISTER_PM1_ENABLE,
289 ACPI_BITPOSITION_PCIEXP_WAKE_DISABLE,
290 ACPI_BITMASK_PCIEXP_WAKE_DISABLE},
292 /* ACPI_BITREG_SCI_ENABLE */ {ACPI_REGISTER_PM1_CONTROL,
293 ACPI_BITPOSITION_SCI_ENABLE,
294 ACPI_BITMASK_SCI_ENABLE},
295 /* ACPI_BITREG_BUS_MASTER_RLD */ {ACPI_REGISTER_PM1_CONTROL,
296 ACPI_BITPOSITION_BUS_MASTER_RLD,
297 ACPI_BITMASK_BUS_MASTER_RLD},
298 /* ACPI_BITREG_GLOBAL_LOCK_RELEASE */ {ACPI_REGISTER_PM1_CONTROL,
299 ACPI_BITPOSITION_GLOBAL_LOCK_RELEASE,
300 ACPI_BITMASK_GLOBAL_LOCK_RELEASE},
301 /* ACPI_BITREG_SLEEP_TYPE_A */ {ACPI_REGISTER_PM1_CONTROL,
302 ACPI_BITPOSITION_SLEEP_TYPE_X,
303 ACPI_BITMASK_SLEEP_TYPE_X},
304 /* ACPI_BITREG_SLEEP_TYPE_B */ {ACPI_REGISTER_PM1_CONTROL,
305 ACPI_BITPOSITION_SLEEP_TYPE_X,
306 ACPI_BITMASK_SLEEP_TYPE_X},
307 /* ACPI_BITREG_SLEEP_ENABLE */ {ACPI_REGISTER_PM1_CONTROL,
308 ACPI_BITPOSITION_SLEEP_ENABLE,
309 ACPI_BITMASK_SLEEP_ENABLE},
311 /* ACPI_BITREG_ARB_DIS */ {ACPI_REGISTER_PM2_CONTROL,
312 ACPI_BITPOSITION_ARB_DISABLE,
313 ACPI_BITMASK_ARB_DISABLE}
314 };
316 struct acpi_fixed_event_info acpi_gbl_fixed_event_info[ACPI_NUM_FIXED_EVENTS] = {
317 /* ACPI_EVENT_PMTIMER */ {ACPI_BITREG_TIMER_STATUS,
318 ACPI_BITREG_TIMER_ENABLE,
319 ACPI_BITMASK_TIMER_STATUS,
320 ACPI_BITMASK_TIMER_ENABLE},
321 /* ACPI_EVENT_GLOBAL */ {ACPI_BITREG_GLOBAL_LOCK_STATUS,
322 ACPI_BITREG_GLOBAL_LOCK_ENABLE,
323 ACPI_BITMASK_GLOBAL_LOCK_STATUS,
324 ACPI_BITMASK_GLOBAL_LOCK_ENABLE},
325 /* ACPI_EVENT_POWER_BUTTON */ {ACPI_BITREG_POWER_BUTTON_STATUS,
326 ACPI_BITREG_POWER_BUTTON_ENABLE,
327 ACPI_BITMASK_POWER_BUTTON_STATUS,
328 ACPI_BITMASK_POWER_BUTTON_ENABLE},
329 /* ACPI_EVENT_SLEEP_BUTTON */ {ACPI_BITREG_SLEEP_BUTTON_STATUS,
330 ACPI_BITREG_SLEEP_BUTTON_ENABLE,
331 ACPI_BITMASK_SLEEP_BUTTON_STATUS,
332 ACPI_BITMASK_SLEEP_BUTTON_ENABLE},
333 /* ACPI_EVENT_RTC */ {ACPI_BITREG_RT_CLOCK_STATUS,
334 ACPI_BITREG_RT_CLOCK_ENABLE,
335 ACPI_BITMASK_RT_CLOCK_STATUS,
336 ACPI_BITMASK_RT_CLOCK_ENABLE},
337 };
339 /*******************************************************************************
340 *
341 * FUNCTION: acpi_ut_get_region_name
342 *
343 * PARAMETERS: None.
344 *
345 * RETURN: Status
346 *
347 * DESCRIPTION: Translate a Space ID into a name string (Debug only)
348 *
349 ******************************************************************************/
351 /* Region type decoding */
353 const char *acpi_gbl_region_types[ACPI_NUM_PREDEFINED_REGIONS] = {
354 "SystemMemory",
355 "SystemIO",
356 "PCI_Config",
357 "EmbeddedControl",
358 "SMBus",
359 "CMOS",
360 "PCIBARTarget",
361 "DataTable"
362 };
364 char *acpi_ut_get_region_name(u8 space_id)
365 {
367 if (space_id >= ACPI_USER_REGION_BEGIN) {
368 return ("UserDefinedRegion");
369 } else if (space_id >= ACPI_NUM_PREDEFINED_REGIONS) {
370 return ("InvalidSpaceId");
371 }
373 return (ACPI_CAST_PTR(char, acpi_gbl_region_types[space_id]));
374 }
376 /*******************************************************************************
377 *
378 * FUNCTION: acpi_ut_get_event_name
379 *
380 * PARAMETERS: None.
381 *
382 * RETURN: Status
383 *
384 * DESCRIPTION: Translate a Event ID into a name string (Debug only)
385 *
386 ******************************************************************************/
388 /* Event type decoding */
390 static const char *acpi_gbl_event_types[ACPI_NUM_FIXED_EVENTS] = {
391 "PM_Timer",
392 "GlobalLock",
393 "PowerButton",
394 "SleepButton",
395 "RealTimeClock",
396 };
398 char *acpi_ut_get_event_name(u32 event_id)
399 {
401 if (event_id > ACPI_EVENT_MAX) {
402 return ("InvalidEventID");
403 }
405 return (ACPI_CAST_PTR(char, acpi_gbl_event_types[event_id]));
406 }
408 /*******************************************************************************
409 *
410 * FUNCTION: acpi_ut_get_type_name
411 *
412 * PARAMETERS: None.
413 *
414 * RETURN: Status
415 *
416 * DESCRIPTION: Translate a Type ID into a name string (Debug only)
417 *
418 ******************************************************************************/
420 /*
421 * Elements of acpi_gbl_ns_type_names below must match
422 * one-to-one with values of acpi_object_type
423 *
424 * The type ACPI_TYPE_ANY (Untyped) is used as a "don't care" when searching;
425 * when stored in a table it really means that we have thus far seen no
426 * evidence to indicate what type is actually going to be stored for this entry.
427 */
428 static const char acpi_gbl_bad_type[] = "UNDEFINED";
430 /* Printable names of the ACPI object types */
432 static const char *acpi_gbl_ns_type_names[] = {
433 /* 00 */ "Untyped",
434 /* 01 */ "Integer",
435 /* 02 */ "String",
436 /* 03 */ "Buffer",
437 /* 04 */ "Package",
438 /* 05 */ "FieldUnit",
439 /* 06 */ "Device",
440 /* 07 */ "Event",
441 /* 08 */ "Method",
442 /* 09 */ "Mutex",
443 /* 10 */ "Region",
444 /* 11 */ "Power",
445 /* 12 */ "Processor",
446 /* 13 */ "Thermal",
447 /* 14 */ "BufferField",
448 /* 15 */ "DdbHandle",
449 /* 16 */ "DebugObject",
450 /* 17 */ "RegionField",
451 /* 18 */ "BankField",
452 /* 19 */ "IndexField",
453 /* 20 */ "Reference",
454 /* 21 */ "Alias",
455 /* 22 */ "MethodAlias",
456 /* 23 */ "Notify",
457 /* 24 */ "AddrHandler",
458 /* 25 */ "ResourceDesc",
459 /* 26 */ "ResourceFld",
460 /* 27 */ "Scope",
461 /* 28 */ "Extra",
462 /* 29 */ "Data",
463 /* 30 */ "Invalid"
464 };
466 char *acpi_ut_get_type_name(acpi_object_type type)
467 {
469 if (type > ACPI_TYPE_INVALID) {
470 return (ACPI_CAST_PTR(char, acpi_gbl_bad_type));
471 }
473 return (ACPI_CAST_PTR(char, acpi_gbl_ns_type_names[type]));
474 }
476 char *acpi_ut_get_object_type_name(union acpi_operand_object *obj_desc)
477 {
479 if (!obj_desc) {
480 return ("[NULL Object Descriptor]");
481 }
483 return (acpi_ut_get_type_name(ACPI_GET_OBJECT_TYPE(obj_desc)));
484 }
486 /*******************************************************************************
487 *
488 * FUNCTION: acpi_ut_get_descriptor_name
489 *
490 * PARAMETERS: Object - An ACPI object
491 *
492 * RETURN: Pointer to a string
493 *
494 * DESCRIPTION: Validate object and return the descriptor type
495 *
496 ******************************************************************************/
498 /* Printable names of object descriptor types */
500 static const char *acpi_gbl_desc_type_names[] = {
501 /* 00 */ "Invalid",
502 /* 01 */ "Cached",
503 /* 02 */ "State-Generic",
504 /* 03 */ "State-Update",
505 /* 04 */ "State-Package",
506 /* 05 */ "State-Control",
507 /* 06 */ "State-RootParseScope",
508 /* 07 */ "State-ParseScope",
509 /* 08 */ "State-WalkScope",
510 /* 09 */ "State-Result",
511 /* 10 */ "State-Notify",
512 /* 11 */ "State-Thread",
513 /* 12 */ "Walk",
514 /* 13 */ "Parser",
515 /* 14 */ "Operand",
516 /* 15 */ "Node"
517 };
519 char *acpi_ut_get_descriptor_name(void *object)
520 {
522 if (!object) {
523 return ("NULL OBJECT");
524 }
526 if (ACPI_GET_DESCRIPTOR_TYPE(object) > ACPI_DESC_TYPE_MAX) {
527 return (ACPI_CAST_PTR(char, acpi_gbl_bad_type));
528 }
530 return (ACPI_CAST_PTR(char,
531 acpi_gbl_desc_type_names[ACPI_GET_DESCRIPTOR_TYPE
532 (object)]));
534 }
536 #if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER)
537 /*
538 * Strings and procedures used for debug only
539 */
541 /*******************************************************************************
542 *
543 * FUNCTION: acpi_ut_get_mutex_name
544 *
545 * PARAMETERS: mutex_id - The predefined ID for this mutex.
546 *
547 * RETURN: String containing the name of the mutex. Always returns a valid
548 * pointer.
549 *
550 * DESCRIPTION: Translate a mutex ID into a name string (Debug only)
551 *
552 ******************************************************************************/
554 char *acpi_ut_get_mutex_name(u32 mutex_id)
555 {
557 if (mutex_id > ACPI_MAX_MUTEX) {
558 return ("Invalid Mutex ID");
559 }
561 return (acpi_gbl_mutex_names[mutex_id]);
562 }
564 /*******************************************************************************
565 *
566 * FUNCTION: acpi_ut_get_notify_name
567 *
568 * PARAMETERS: notify_value - Value from the Notify() request
569 *
570 * RETURN: String corresponding to the Notify Value.
571 *
572 * DESCRIPTION: Translate a Notify Value to a notify namestring.
573 *
574 ******************************************************************************/
576 /* Names for Notify() values, used for debug output */
578 static const char *acpi_gbl_notify_value_names[] = {
579 "Bus Check",
580 "Device Check",
581 "Device Wake",
582 "Eject Request",
583 "Device Check Light",
584 "Frequency Mismatch",
585 "Bus Mode Mismatch",
586 "Power Fault",
587 "Capabilities Check",
588 "Device PLD Check",
589 "Reserved",
590 "System Locality Update"
591 };
593 const char *acpi_ut_get_notify_name(u32 notify_value)
594 {
596 if (notify_value <= ACPI_NOTIFY_MAX) {
597 return (acpi_gbl_notify_value_names[notify_value]);
598 } else if (notify_value <= ACPI_MAX_SYS_NOTIFY) {
599 return ("Reserved");
600 } else { /* Greater or equal to 0x80 */
602 return ("**Device Specific**");
603 }
604 }
605 #endif
607 /*******************************************************************************
608 *
609 * FUNCTION: acpi_ut_valid_object_type
610 *
611 * PARAMETERS: Type - Object type to be validated
612 *
613 * RETURN: TRUE if valid object type, FALSE otherwise
614 *
615 * DESCRIPTION: Validate an object type
616 *
617 ******************************************************************************/
619 u8 acpi_ut_valid_object_type(acpi_object_type type)
620 {
622 if (type > ACPI_TYPE_LOCAL_MAX) {
624 /* Note: Assumes all TYPEs are contiguous (external/local) */
626 return (FALSE);
627 }
629 return (TRUE);
630 }
632 /*******************************************************************************
633 *
634 * FUNCTION: acpi_ut_init_globals
635 *
636 * PARAMETERS: None
637 *
638 * RETURN: None
639 *
640 * DESCRIPTION: Init library globals. All globals that require specific
641 * initialization should be initialized here!
642 *
643 ******************************************************************************/
645 void acpi_ut_init_globals(void)
646 {
647 #if 0
648 acpi_status status;
649 #endif
650 u32 i;
652 ACPI_FUNCTION_TRACE(ut_init_globals);
654 #if 0
655 /* Create all memory caches */
657 status = acpi_ut_create_caches();
658 if (ACPI_FAILURE(status)) {
659 return;
660 }
661 #endif
663 /* Mutex locked flags */
665 for (i = 0; i < ACPI_NUM_MUTEX; i++) {
666 acpi_gbl_mutex_info[i].mutex = NULL;
667 acpi_gbl_mutex_info[i].thread_id = ACPI_MUTEX_NOT_ACQUIRED;
668 acpi_gbl_mutex_info[i].use_count = 0;
669 }
671 for (i = 0; i < ACPI_NUM_OWNERID_MASKS; i++) {
672 acpi_gbl_owner_id_mask[i] = 0;
673 }
674 acpi_gbl_owner_id_mask[ACPI_NUM_OWNERID_MASKS - 1] = 0x80000000; /* Last ID is never valid */
676 /* GPE support */
678 acpi_gbl_gpe_xrupt_list_head = NULL;
679 acpi_gbl_gpe_fadt_blocks[0] = NULL;
680 acpi_gbl_gpe_fadt_blocks[1] = NULL;
682 /* Global handlers */
684 acpi_gbl_system_notify.handler = NULL;
685 acpi_gbl_device_notify.handler = NULL;
686 acpi_gbl_exception_handler = NULL;
687 acpi_gbl_init_handler = NULL;
688 /*acpi_gbl_table_handler = NULL;*/
690 /* Global Lock support */
692 acpi_gbl_global_lock_semaphore = NULL;
693 acpi_gbl_global_lock_mutex = NULL;
694 acpi_gbl_global_lock_acquired = FALSE;
695 acpi_gbl_global_lock_handle = 0;
697 /* Miscellaneous variables */
699 acpi_gbl_cm_single_step = FALSE;
700 acpi_gbl_db_terminate_threads = FALSE;
701 acpi_gbl_shutdown = FALSE;
702 acpi_gbl_ns_lookup_count = 0;
703 acpi_gbl_ps_find_count = 0;
704 acpi_gbl_acpi_hardware_present = TRUE;
705 acpi_gbl_last_owner_id_index = 0;
706 acpi_gbl_next_owner_id_offset = 0;
707 acpi_gbl_trace_method_name = 0;
708 acpi_gbl_trace_dbg_level = 0;
709 acpi_gbl_trace_dbg_layer = 0;
710 acpi_gbl_debugger_configuration = DEBUGGER_THREADING;
711 acpi_gbl_db_output_flags = ACPI_DB_CONSOLE_OUTPUT;
713 /* Hardware oriented */
715 acpi_gbl_events_initialized = FALSE;
716 acpi_gbl_system_awake_and_running = TRUE;
718 /* Namespace */
720 acpi_gbl_root_node = NULL;
721 acpi_gbl_root_node_struct.name.integer = ACPI_ROOT_NAME;
722 acpi_gbl_root_node_struct.descriptor_type = ACPI_DESC_TYPE_NAMED;
723 acpi_gbl_root_node_struct.type = ACPI_TYPE_DEVICE;
724 acpi_gbl_root_node_struct.child = NULL;
725 acpi_gbl_root_node_struct.peer = NULL;
726 acpi_gbl_root_node_struct.object = NULL;
727 acpi_gbl_root_node_struct.flags = ANOBJ_END_OF_PEER_LIST;
729 #ifdef ACPI_DEBUG_OUTPUT
730 acpi_gbl_lowest_stack_pointer = ACPI_CAST_PTR(acpi_size, ACPI_SIZE_MAX);
731 #endif
733 #ifdef ACPI_DBG_TRACK_ALLOCATIONS
734 acpi_gbl_display_final_mem_stats = FALSE;
735 #endif
737 return_VOID;
738 }
740 ACPI_EXPORT_SYMBOL(acpi_dbg_level)
741 ACPI_EXPORT_SYMBOL(acpi_dbg_layer)