utglobal.c
来自「是关于linux2.5.1的完全源码」· C语言 代码 · 共 812 行 · 第 1/2 页
C
812 行
/* Event type decoding */const NATIVE_CHAR *acpi_gbl_event_types[ACPI_NUM_FIXED_EVENTS] ={ "PM_Timer", "Global_lock", "Power_button", "Sleep_button", "Real_time_clock",};NATIVE_CHAR *acpi_ut_get_event_name ( u32 event_id){ if (event_id > ACPI_EVENT_MAX) { return ("Invalid_event_iD"); } return ((NATIVE_CHAR *) acpi_gbl_event_types[event_id]);}#ifdef ACPI_DEBUG/* * Strings and procedures used for debug only * *//***************************************************************************** * * FUNCTION: Acpi_ut_get_mutex_name * * PARAMETERS: None. * * RETURN: Status * * DESCRIPTION: Translate a mutex ID into a name string (Debug only) * ****************************************************************************/NATIVE_CHAR *acpi_ut_get_mutex_name ( u32 mutex_id){ if (mutex_id > MAX_MTX) { return ("Invalid Mutex ID"); } return (acpi_gbl_mutex_names[mutex_id]);}/***************************************************************************** * * FUNCTION: Acpi_ut_get_type_name * * PARAMETERS: None. * * RETURN: Status * * DESCRIPTION: Translate a Type ID into a name string (Debug only) * ****************************************************************************//* * Elements of Acpi_gbl_Ns_type_names below must match * one-to-one with values of acpi_object_type * * The type ACPI_TYPE_ANY (Untyped) is used as a "don't care" when searching; when * stored in a table it really means that we have thus far seen no evidence to * indicatewhat type is actually going to be stored for this entry. */static const NATIVE_CHAR acpi_gbl_bad_type[] = "UNDEFINED";#define TYPE_NAME_LENGTH 12 /* Maximum length of each string */static const NATIVE_CHAR *acpi_gbl_ns_type_names[] = /* printable names of ACPI types */{ /* 00 */ "Untyped", /* 01 */ "Integer", /* 02 */ "String", /* 03 */ "Buffer", /* 04 */ "Package", /* 05 */ "Field_unit", /* 06 */ "Device", /* 07 */ "Event", /* 08 */ "Method", /* 09 */ "Mutex", /* 10 */ "Region", /* 11 */ "Power", /* 12 */ "Processor", /* 13 */ "Thermal", /* 14 */ "Buffer_field", /* 15 */ "Ddb_handle", /* 16 */ "Debug_object", /* 17 */ "Region_field", /* 18 */ "Bank_field", /* 19 */ "Index_field", /* 20 */ "Reference", /* 21 */ "Alias", /* 22 */ "Notify", /* 23 */ "Addr_handler", /* 24 */ "Resource_desc", /* 25 */ "Resource_fld", /* 26 */ "Region_fld_dfn", /* 27 */ "Bank_fld_dfn", /* 28 */ "Index_fld_dfn", /* 29 */ "If", /* 30 */ "Else", /* 31 */ "While", /* 32 */ "Scope", /* 33 */ "Def_any", /* 34 */ "Extra", /* 35 */ "Data", /* 36 */ "Invalid"};NATIVE_CHAR *acpi_ut_get_type_name ( acpi_object_type type){ if (type > INTERNAL_TYPE_INVALID) { return ((NATIVE_CHAR *) acpi_gbl_bad_type); } return ((NATIVE_CHAR *) acpi_gbl_ns_type_names[type]);}/* Data used in keeping track of fields */const NATIVE_CHAR *acpi_gbl_FEnames[NUM_FIELD_NAMES] ={ "skip", "?access?"}; /* FE = Field Element */const NATIVE_CHAR *acpi_gbl_match_ops[NUM_MATCH_OPS] ={ "Error", "MTR", "MEQ", "MLE", "MLT", "MGE", "MGT"};/* Access type decoding */const NATIVE_CHAR *acpi_gbl_access_types[NUM_ACCESS_TYPES] ={ "Any_acc", "Byte_acc", "Word_acc", "DWord_acc", "QWord_acc", "Buffer_acc",};/* Update rule decoding */const NATIVE_CHAR *acpi_gbl_update_rules[NUM_UPDATE_RULES] ={ "Preserve", "Write_as_ones", "Write_as_zeros"};#endif/***************************************************************************** * * FUNCTION: Acpi_ut_valid_object_type * * PARAMETERS: None. * * RETURN: TRUE if valid object type * * DESCRIPTION: Validate an object type * ****************************************************************************/u8acpi_ut_valid_object_type ( acpi_object_type type){ if (type > ACPI_TYPE_MAX) { if ((type < INTERNAL_TYPE_BEGIN) || (type > INTERNAL_TYPE_MAX)) { return (FALSE); } } return (TRUE);}/**************************************************************************** * * FUNCTION: Acpi_ut_allocate_owner_id * * PARAMETERS: Id_type - Type of ID (method or table) * * DESCRIPTION: Allocate a table or method owner id * ***************************************************************************/acpi_owner_idacpi_ut_allocate_owner_id ( u32 id_type){ acpi_owner_id owner_id = 0xFFFF; ACPI_FUNCTION_TRACE ("Ut_allocate_owner_id"); if (ACPI_FAILURE (acpi_ut_acquire_mutex (ACPI_MTX_CACHES))) { return (0); } switch (id_type) { case ACPI_OWNER_TYPE_TABLE: owner_id = acpi_gbl_next_table_owner_id; acpi_gbl_next_table_owner_id++; if (acpi_gbl_next_table_owner_id == ACPI_FIRST_METHOD_ID) { acpi_gbl_next_table_owner_id = ACPI_FIRST_TABLE_ID; } break; case ACPI_OWNER_TYPE_METHOD: owner_id = acpi_gbl_next_method_owner_id; acpi_gbl_next_method_owner_id++; if (acpi_gbl_next_method_owner_id == ACPI_FIRST_TABLE_ID) { acpi_gbl_next_method_owner_id = ACPI_FIRST_METHOD_ID; } break; } (void) acpi_ut_release_mutex (ACPI_MTX_CACHES); return_VALUE (owner_id);}/**************************************************************************** * * FUNCTION: Acpi_ut_init_globals * * PARAMETERS: none * * DESCRIPTION: Init library globals. All globals that require specific * initialization should be initialized here! * ***************************************************************************/voidacpi_ut_init_globals ( void){ u32 i; ACPI_FUNCTION_TRACE ("Ut_init_globals"); /* Memory allocation and cache lists */ ACPI_MEMSET (acpi_gbl_memory_lists, 0, sizeof (ACPI_MEMORY_LIST) * ACPI_NUM_MEM_LISTS); acpi_gbl_memory_lists[ACPI_MEM_LIST_STATE].link_offset = (u16) ACPI_PTR_DIFF (&(((acpi_generic_state *) NULL)->common.next), NULL); acpi_gbl_memory_lists[ACPI_MEM_LIST_PSNODE].link_offset = (u16) ACPI_PTR_DIFF (&(((acpi_parse_object *) NULL)->next), NULL); acpi_gbl_memory_lists[ACPI_MEM_LIST_PSNODE_EXT].link_offset = (u16) ACPI_PTR_DIFF (&(((acpi_parse2_object *) NULL)->next), NULL); acpi_gbl_memory_lists[ACPI_MEM_LIST_OPERAND].link_offset = (u16) ACPI_PTR_DIFF (&(((acpi_operand_object *) NULL)->cache.next), NULL); acpi_gbl_memory_lists[ACPI_MEM_LIST_WALK].link_offset = (u16) ACPI_PTR_DIFF (&(((acpi_walk_state *) NULL)->next), NULL); acpi_gbl_memory_lists[ACPI_MEM_LIST_NSNODE].object_size = sizeof (acpi_namespace_node); acpi_gbl_memory_lists[ACPI_MEM_LIST_STATE].object_size = sizeof (acpi_generic_state); acpi_gbl_memory_lists[ACPI_MEM_LIST_PSNODE].object_size = sizeof (acpi_parse_object); acpi_gbl_memory_lists[ACPI_MEM_LIST_PSNODE_EXT].object_size = sizeof (acpi_parse2_object); acpi_gbl_memory_lists[ACPI_MEM_LIST_OPERAND].object_size = sizeof (acpi_operand_object); acpi_gbl_memory_lists[ACPI_MEM_LIST_WALK].object_size = sizeof (acpi_walk_state); acpi_gbl_memory_lists[ACPI_MEM_LIST_STATE].max_cache_depth = MAX_STATE_CACHE_DEPTH; acpi_gbl_memory_lists[ACPI_MEM_LIST_PSNODE].max_cache_depth = MAX_PARSE_CACHE_DEPTH; acpi_gbl_memory_lists[ACPI_MEM_LIST_PSNODE_EXT].max_cache_depth = MAX_EXTPARSE_CACHE_DEPTH; acpi_gbl_memory_lists[ACPI_MEM_LIST_OPERAND].max_cache_depth = MAX_OBJECT_CACHE_DEPTH; acpi_gbl_memory_lists[ACPI_MEM_LIST_WALK].max_cache_depth = MAX_WALK_CACHE_DEPTH; ACPI_MEM_TRACKING (acpi_gbl_memory_lists[ACPI_MEM_LIST_GLOBAL].list_name = "Global Memory Allocation"); ACPI_MEM_TRACKING (acpi_gbl_memory_lists[ACPI_MEM_LIST_NSNODE].list_name = "Namespace Nodes"); ACPI_MEM_TRACKING (acpi_gbl_memory_lists[ACPI_MEM_LIST_STATE].list_name = "State Object Cache"); ACPI_MEM_TRACKING (acpi_gbl_memory_lists[ACPI_MEM_LIST_PSNODE].list_name = "Parse Node Cache"); ACPI_MEM_TRACKING (acpi_gbl_memory_lists[ACPI_MEM_LIST_PSNODE_EXT].list_name = "Extended Parse Node Cache"); ACPI_MEM_TRACKING (acpi_gbl_memory_lists[ACPI_MEM_LIST_OPERAND].list_name = "Operand Object Cache"); ACPI_MEM_TRACKING (acpi_gbl_memory_lists[ACPI_MEM_LIST_WALK].list_name = "Tree Walk Node Cache"); /* ACPI table structure */ for (i = 0; i < NUM_ACPI_TABLES; i++) { acpi_gbl_acpi_tables[i].prev = &acpi_gbl_acpi_tables[i]; acpi_gbl_acpi_tables[i].next = &acpi_gbl_acpi_tables[i]; acpi_gbl_acpi_tables[i].pointer = NULL; acpi_gbl_acpi_tables[i].length = 0; acpi_gbl_acpi_tables[i].allocation = ACPI_MEM_NOT_ALLOCATED; acpi_gbl_acpi_tables[i].count = 0; } /* Mutex locked flags */ for (i = 0; i < NUM_MTX; i++) { acpi_gbl_acpi_mutex_info[i].mutex = NULL; acpi_gbl_acpi_mutex_info[i].owner_id = ACPI_MUTEX_NOT_ACQUIRED; acpi_gbl_acpi_mutex_info[i].use_count = 0; } /* Global notify handlers */ acpi_gbl_sys_notify.handler = NULL; acpi_gbl_drv_notify.handler = NULL; /* Global "typed" ACPI table pointers */ acpi_gbl_RSDP = NULL; acpi_gbl_XSDT = NULL; acpi_gbl_FACS = NULL; acpi_gbl_FADT = NULL; acpi_gbl_DSDT = NULL; /* Global Lock support */ acpi_gbl_global_lock_acquired = FALSE; acpi_gbl_global_lock_thread_count = 0; acpi_gbl_global_lock_handle = 0; /* Miscellaneous variables */ acpi_gbl_table_flags = ACPI_PHYSICAL_POINTER; acpi_gbl_rsdp_original_location = 0; acpi_gbl_cm_single_step = FALSE; acpi_gbl_db_terminate_threads = FALSE; acpi_gbl_shutdown = FALSE; acpi_gbl_ns_lookup_count = 0; acpi_gbl_ps_find_count = 0; acpi_gbl_acpi_hardware_present = TRUE; acpi_gbl_next_table_owner_id = ACPI_FIRST_TABLE_ID; acpi_gbl_next_method_owner_id = ACPI_FIRST_METHOD_ID; acpi_gbl_debugger_configuration = DEBUGGER_THREADING; acpi_gbl_db_output_flags = ACPI_DB_CONSOLE_OUTPUT; /* Hardware oriented */ acpi_gbl_gpe_register_info = NULL; acpi_gbl_gpe_number_info = NULL; /* Namespace */ acpi_gbl_root_node = NULL; acpi_gbl_root_node_struct.name.integer = ACPI_ROOT_NAME; acpi_gbl_root_node_struct.descriptor = ACPI_DESC_TYPE_NAMED; acpi_gbl_root_node_struct.type = ACPI_TYPE_ANY; acpi_gbl_root_node_struct.child = NULL; acpi_gbl_root_node_struct.peer = NULL; acpi_gbl_root_node_struct.object = NULL; acpi_gbl_root_node_struct.flags = ANOBJ_END_OF_PEER_LIST;#ifdef ACPI_DEBUG acpi_gbl_lowest_stack_pointer = ACPI_UINT32_MAX;#endif return_VOID;}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?