diff options
author | Jan Beulich <jbeulich@novell.com> | 2011-03-09 16:32:04 +0000 |
---|---|---|
committer | Jan Beulich <jbeulich@novell.com> | 2011-03-09 16:32:04 +0000 |
commit | 54f4cfa3d8c60fa81dbb28fc83bf5f2272ed4222 (patch) | |
tree | 83463e3b381aab6a90a9483808ed802d9f690aab /xen/drivers/acpi | |
parent | 67d84b65a1fe6362ed6172c0f7bbb75cedb8346d (diff) | |
download | xen-54f4cfa3d8c60fa81dbb28fc83bf5f2272ed4222.tar.gz xen-54f4cfa3d8c60fa81dbb28fc83bf5f2272ed4222.tar.bz2 xen-54f4cfa3d8c60fa81dbb28fc83bf5f2272ed4222.zip |
ACPI: large cleanup
In some cases, entire files turned out unnecessary. Of what remains,
move whatever possible into .init.*, and some data items into
.data.read_mostly.
Signed-off-by: Jan Beulich <jbeulich@novell.com>
Diffstat (limited to 'xen/drivers/acpi')
-rw-r--r-- | xen/drivers/acpi/hwregs.c | 20 | ||||
-rw-r--r-- | xen/drivers/acpi/numa.c | 1 | ||||
-rw-r--r-- | xen/drivers/acpi/osl.c | 53 | ||||
-rw-r--r-- | xen/drivers/acpi/tables.c | 3 | ||||
-rw-r--r-- | xen/drivers/acpi/tables/tbinstal.c | 3 | ||||
-rw-r--r-- | xen/drivers/acpi/tables/tbutils.c | 41 | ||||
-rw-r--r-- | xen/drivers/acpi/tables/tbxface.c | 9 | ||||
-rw-r--r-- | xen/drivers/acpi/tables/tbxfroot.c | 4 | ||||
-rw-r--r-- | xen/drivers/acpi/utilities/utglobal.c | 543 | ||||
-rw-r--r-- | xen/drivers/acpi/utilities/utmisc.c | 58 |
10 files changed, 25 insertions, 710 deletions
diff --git a/xen/drivers/acpi/hwregs.c b/xen/drivers/acpi/hwregs.c index 38423bc394..67a3c51624 100644 --- a/xen/drivers/acpi/hwregs.c +++ b/xen/drivers/acpi/hwregs.c @@ -64,7 +64,8 @@ ACPI_MODULE_NAME("hwregs") * DESCRIPTION: Map register_id into a register bitmask. * ******************************************************************************/ -struct acpi_bit_register_info *acpi_hw_get_bit_register_info(u32 register_id) +static struct acpi_bit_register_info * +acpi_hw_get_bit_register_info(u32 register_id) { ACPI_FUNCTION_ENTRY(); @@ -91,7 +92,7 @@ struct acpi_bit_register_info *acpi_hw_get_bit_register_info(u32 register_id) * ******************************************************************************/ -acpi_status acpi_get_register_unlocked(u32 register_id, u32 * return_value) +acpi_status acpi_get_register(u32 register_id, u32 * return_value) { u32 register_value = 0; struct acpi_bit_register_info *bit_reg_info; @@ -129,16 +130,6 @@ acpi_status acpi_get_register_unlocked(u32 register_id, u32 * return_value) return_ACPI_STATUS(status); } -acpi_status acpi_get_register(u32 register_id, u32 * return_value) -{ - acpi_status status; - //acpi_cpu_flags flags; - //flags = acpi_os_acquire_lock(acpi_gbl_hardware_lock); - status = acpi_get_register_unlocked(register_id, return_value); - //acpi_os_release_lock(acpi_gbl_hardware_lock, flags); - return status; -} - /******************************************************************************* * * FUNCTION: acpi_set_register @@ -157,7 +148,6 @@ acpi_status acpi_set_register(u32 register_id, u32 value) u32 register_value = 0; struct acpi_bit_register_info *bit_reg_info; acpi_status status; - //acpi_cpu_flags lock_flags; ACPI_FUNCTION_TRACE_U32(acpi_set_register, register_id); @@ -170,8 +160,6 @@ acpi_status acpi_set_register(u32 register_id, u32 value) return_ACPI_STATUS(AE_BAD_PARAMETER); } - //lock_flags = acpi_os_acquire_lock(acpi_gbl_hardware_lock); - /* Always do a register read first so we can insert the new bits */ status = acpi_hw_register_read(bit_reg_info->parent_register, @@ -276,8 +264,6 @@ acpi_status acpi_set_register(u32 register_id, u32 value) unlock_and_exit: - //acpi_os_release_lock(acpi_gbl_hardware_lock, lock_flags); - /* Normalize the value that was read */ ACPI_DEBUG_EXEC(register_value = diff --git a/xen/drivers/acpi/numa.c b/xen/drivers/acpi/numa.c index 451773c1c4..818e0a8b18 100644 --- a/xen/drivers/acpi/numa.c +++ b/xen/drivers/acpi/numa.c @@ -28,7 +28,6 @@ #include <xen/errno.h> #include <xen/acpi.h> #include <xen/numa.h> -#include <acpi/acpi_bus.h> #include <acpi/acmacros.h> #define ACPI_NUMA 0x80000000 diff --git a/xen/drivers/acpi/osl.c b/xen/drivers/acpi/osl.c index a86b0e3c0c..acee045512 100644 --- a/xen/drivers/acpi/osl.c +++ b/xen/drivers/acpi/osl.c @@ -31,7 +31,6 @@ #include <xen/errno.h> #include <xen/acpi.h> #include <xen/numa.h> -#include <acpi/acpi_bus.h> #include <acpi/acmacros.h> #include <acpi/acpiosxf.h> #include <acpi/platform/aclinux.h> @@ -43,27 +42,12 @@ #define _COMPONENT ACPI_OS_SERVICES ACPI_MODULE_NAME("osl") -#define PREFIX "ACPI: " -struct acpi_os_dpc { - acpi_osd_exec_callback function; - void *context; -}; #ifdef CONFIG_ACPI_CUSTOM_DSDT #include CONFIG_ACPI_CUSTOM_DSDT_FILE #endif -#ifdef ENABLE_DEBUGGER -#include <linux/kdb.h> - -/* stuff for debugger support */ -int acpi_in_debugger; -EXPORT_SYMBOL(acpi_in_debugger); - -extern char line_buf[80]; -#endif /*ENABLE_DEBUGGER */ - -void acpi_os_printf(const char *fmt, ...) +void __init acpi_os_printf(const char *fmt, ...) { va_list args; va_start(args, fmt); @@ -71,7 +55,7 @@ void acpi_os_printf(const char *fmt, ...) va_end(args); } -void acpi_os_vprintf(const char *fmt, va_list args) +void __init acpi_os_vprintf(const char *fmt, va_list args) { static char buffer[512]; @@ -103,17 +87,15 @@ acpi_physical_address __init acpi_os_get_root_pointer(void) } } -void __iomem * +void __iomem *__init acpi_os_map_memory(acpi_physical_address phys, acpi_size size) { return __acpi_map_table((unsigned long)phys, size); } -EXPORT_SYMBOL_GPL(acpi_os_map_memory); -void acpi_os_unmap_memory(void __iomem * virt, acpi_size size) +void __init acpi_os_unmap_memory(void __iomem * virt, acpi_size size) { } -EXPORT_SYMBOL_GPL(acpi_os_unmap_memory); acpi_status acpi_os_read_port(acpi_io_address port, u32 * value, u32 width) { @@ -136,8 +118,6 @@ acpi_status acpi_os_read_port(acpi_io_address port, u32 * value, u32 width) return AE_OK; } -EXPORT_SYMBOL(acpi_os_read_port); - acpi_status acpi_os_write_port(acpi_io_address port, u32 value, u32 width) { if (width <= 8) { @@ -153,8 +133,6 @@ acpi_status acpi_os_write_port(acpi_io_address port, u32 value, u32 width) return AE_OK; } -EXPORT_SYMBOL(acpi_os_write_port); - acpi_status acpi_os_read_memory(acpi_physical_address phys_addr, u32 * value, u32 width) { @@ -209,26 +187,3 @@ acpi_os_write_memory(acpi_physical_address phys_addr, u32 value, u32 width) return AE_OK; } - -/* - * Acquire a spinlock. - * - * handle is a pointer to the spinlock_t. - */ - -acpi_cpu_flags acpi_os_acquire_lock(acpi_spinlock lockp) -{ - acpi_cpu_flags flags; - spin_lock_irqsave(lockp, flags); - return flags; -} - -/* - * Release a spinlock. See above. - */ - -void acpi_os_release_lock(acpi_spinlock lockp, acpi_cpu_flags flags) -{ - spin_unlock_irqrestore(lockp, flags); -} - diff --git a/xen/drivers/acpi/tables.c b/xen/drivers/acpi/tables.c index 60df53aab2..d1136a8f80 100644 --- a/xen/drivers/acpi/tables.c +++ b/xen/drivers/acpi/tables.c @@ -269,7 +269,7 @@ acpi_table_parse_madt(enum acpi_madt_type id, * Scan the ACPI System Descriptor Table (STD) for a table matching @id, * run @handler on it. Return 0 if table found, return on if not. */ -int acpi_table_parse(char *id, acpi_table_handler handler) +int __init acpi_table_parse(char *id, acpi_table_handler handler) { struct acpi_table_header *table = NULL; @@ -324,7 +324,6 @@ static void __init check_multiple_madt(void) int __init acpi_table_init(void) { - acpi_ut_init_globals(); acpi_initialize_tables(initial_tables, ACPI_MAX_TABLES, 0); check_multiple_madt(); return 0; diff --git a/xen/drivers/acpi/tables/tbinstal.c b/xen/drivers/acpi/tables/tbinstal.c index 38a8a2c427..9ff62921b9 100644 --- a/xen/drivers/acpi/tables/tbinstal.c +++ b/xen/drivers/acpi/tables/tbinstal.c @@ -43,7 +43,6 @@ #include <xen/init.h> #include <acpi/acpi.h> -#include <acpi/acnamesp.h> #include <acpi/actables.h> #define _COMPONENT ACPI_TABLES @@ -60,7 +59,7 @@ ACPI_MODULE_NAME("tbinstal") * DESCRIPTION: this function is called to verify and map table * *****************************************************************************/ -acpi_status acpi_tb_verify_table(struct acpi_table_desc *table_desc) +acpi_status __init acpi_tb_verify_table(struct acpi_table_desc *table_desc) { acpi_status status = AE_OK; diff --git a/xen/drivers/acpi/tables/tbutils.c b/xen/drivers/acpi/tables/tbutils.c index 914f1f47ba..38581b785e 100644 --- a/xen/drivers/acpi/tables/tbutils.c +++ b/xen/drivers/acpi/tables/tbutils.c @@ -49,10 +49,6 @@ #define _COMPONENT ACPI_TABLES ACPI_MODULE_NAME("tbutils") -/* Local prototypes */ -static acpi_physical_address -acpi_tb_get_root_table_entry(u8 * table_entry, - acpi_native_uint table_entry_size); /******************************************************************************* * * FUNCTION: acpi_tb_check_xsdt @@ -68,7 +64,7 @@ acpi_tb_get_root_table_entry(u8 * table_entry, * DESCRIPTION: validate XSDT ******************************************************************************/ -static acpi_status +static acpi_status __init acpi_tb_check_xsdt(acpi_physical_address address) { struct acpi_table_header *table; @@ -115,29 +111,6 @@ acpi_tb_check_xsdt(acpi_physical_address address) /******************************************************************************* * - * FUNCTION: acpi_tb_tables_loaded - * - * PARAMETERS: None - * - * RETURN: TRUE if required ACPI tables are loaded - * - * DESCRIPTION: Determine if the minimum required ACPI tables are present - * (FADT, FACS, DSDT) - * - ******************************************************************************/ - -u8 acpi_tb_tables_loaded(void) -{ - - if (acpi_gbl_root_table_list.count >= 3) { - return (TRUE); - } - - return (FALSE); -} - -/******************************************************************************* - * * FUNCTION: acpi_tb_print_table_header * * PARAMETERS: Address - Table physical address @@ -202,7 +175,8 @@ acpi_tb_print_table_header(acpi_physical_address address, * ******************************************************************************/ -acpi_status acpi_tb_verify_checksum(struct acpi_table_header *table, u32 length) +acpi_status __init +acpi_tb_verify_checksum(struct acpi_table_header *table, u32 length) { u8 checksum; @@ -309,13 +283,6 @@ acpi_tb_install_table(acpi_physical_address address, acpi_tb_print_table_header(address, table); - if (table_index == ACPI_TABLE_INDEX_DSDT) { - - /* Global integer width is based upon revision of the DSDT */ - - acpi_ut_set_integer_width(table->revision); - } - unmap_and_exit: acpi_os_unmap_memory(table, sizeof(struct acpi_table_header)); } @@ -337,7 +304,7 @@ acpi_tb_install_table(acpi_physical_address address, * ******************************************************************************/ -static acpi_physical_address +static acpi_physical_address __init acpi_tb_get_root_table_entry(u8 * table_entry, acpi_native_uint table_entry_size) { diff --git a/xen/drivers/acpi/tables/tbxface.c b/xen/drivers/acpi/tables/tbxface.c index 64eb1acc35..929ac50642 100644 --- a/xen/drivers/acpi/tables/tbxface.c +++ b/xen/drivers/acpi/tables/tbxface.c @@ -45,7 +45,6 @@ #include <xen/config.h> #include <xen/init.h> #include <acpi/acpi.h> -#include <acpi/acnamesp.h> #include <acpi/actables.h> #define _COMPONENT ACPI_TABLES @@ -164,7 +163,7 @@ acpi_initialize_tables(struct acpi_table_desc * initial_table_array, * DESCRIPTION: Finds and verifies an ACPI table. * *****************************************************************************/ -acpi_status +acpi_status __init acpi_get_table(char *signature, acpi_native_uint instance, struct acpi_table_header **out_table) { @@ -198,14 +197,10 @@ acpi_get_table(char *signature, *out_table = acpi_gbl_root_table_list.tables[i].pointer; } - /*if (!acpi_gbl_permanent_mmap)*/ { - acpi_gbl_root_table_list.tables[i].pointer = NULL; - } + acpi_gbl_root_table_list.tables[i].pointer = NULL; return (status); } return (AE_NOT_FOUND); } - -ACPI_EXPORT_SYMBOL(acpi_get_table) diff --git a/xen/drivers/acpi/tables/tbxfroot.c b/xen/drivers/acpi/tables/tbxfroot.c index ba03bcf04a..0efb603ca8 100644 --- a/xen/drivers/acpi/tables/tbxfroot.c +++ b/xen/drivers/acpi/tables/tbxfroot.c @@ -52,8 +52,6 @@ ACPI_MODULE_NAME("tbxfroot") /* Local prototypes */ static u8 *acpi_tb_scan_memory_for_rsdp(u8 * start_address, u32 length); -static acpi_status acpi_tb_validate_rsdp(struct acpi_table_rsdp *rsdp); - /******************************************************************************* * * FUNCTION: acpi_tb_validate_rsdp @@ -66,7 +64,7 @@ static acpi_status acpi_tb_validate_rsdp(struct acpi_table_rsdp *rsdp); * ******************************************************************************/ -static acpi_status acpi_tb_validate_rsdp(struct acpi_table_rsdp *rsdp) +static acpi_status __init acpi_tb_validate_rsdp(struct acpi_table_rsdp *rsdp) { ACPI_FUNCTION_ENTRY(); diff --git a/xen/drivers/acpi/utilities/utglobal.c b/xen/drivers/acpi/utilities/utglobal.c index 2f792000ff..c5517e9298 100644 --- a/xen/drivers/acpi/utilities/utglobal.c +++ b/xen/drivers/acpi/utilities/utglobal.c @@ -44,10 +44,10 @@ #define DEFINE_ACPI_GLOBALS #include <xen/config.h> +#include <xen/init.h> #include <xen/lib.h> #include <asm/processor.h> #include <acpi/acpi.h> -#include <acpi/acnamesp.h> ACPI_EXPORT_SYMBOL(acpi_gbl_FADT) #define _COMPONENT ACPI_UTILITIES @@ -55,53 +55,6 @@ ACPI_EXPORT_SYMBOL(acpi_gbl_FADT) /******************************************************************************* * - * Static global variable initialization. - * - ******************************************************************************/ -/* - * We want the debug switches statically initialized so they - * are already set when the debugger is entered. - */ -/* Debug switch - level and trace mask */ -u32 acpi_dbg_level = ACPI_DEBUG_DEFAULT; - -/* Debug switch - layer (component) mask */ - -u32 acpi_dbg_layer = ACPI_COMPONENT_DEFAULT | ACPI_ALL_DRIVERS; -u32 acpi_gbl_nesting_level = 0; - -/* Debugger globals */ - -u8 acpi_gbl_db_terminate_threads = FALSE; -u8 acpi_gbl_abort_method = FALSE; -u8 acpi_gbl_method_executing = FALSE; - -/* System flags */ - -u32 acpi_gbl_startup_flags = 0; - -/* System starts uninitialized */ - -u8 acpi_gbl_shutdown = TRUE; - -const char *acpi_gbl_sleep_state_names[ACPI_S_STATE_COUNT] = { - "\\_S0_", - "\\_S1_", - "\\_S2_", - "\\_S3_", - "\\_S4_", - "\\_S5_" -}; - -const char *acpi_gbl_highest_dstate_names[4] = { - "_S1D", - "_S2D", - "_S3D", - "_S4D" -}; - -/******************************************************************************* - * * FUNCTION: acpi_format_exception * * PARAMETERS: Status - The acpi_status code to be formatted @@ -114,7 +67,7 @@ const char *acpi_gbl_highest_dstate_names[4] = { * ******************************************************************************/ -const char *acpi_format_exception(acpi_status status) +const char *__init acpi_format_exception(acpi_status status) { const char *exception = NULL; @@ -135,106 +88,6 @@ const char *acpi_format_exception(acpi_status status) return (ACPI_CAST_PTR(const char, exception)); } -ACPI_EXPORT_SYMBOL(acpi_format_exception) - -/******************************************************************************* - * - * Namespace globals - * - ******************************************************************************/ -/* - * Predefined ACPI Names (Built-in to the Interpreter) - * - * NOTES: - * 1) _SB_ is defined to be a device to allow \_SB_._INI to be run - * during the initialization sequence. - * 2) _TZ_ is defined to be a thermal zone in order to allow ASL code to - * perform a Notify() operation on it. - */ -const struct acpi_predefined_names acpi_gbl_pre_defined_names[] = { - {"_GPE", ACPI_TYPE_LOCAL_SCOPE, NULL}, - {"_PR_", ACPI_TYPE_LOCAL_SCOPE, NULL}, - {"_SB_", ACPI_TYPE_DEVICE, NULL}, - {"_SI_", ACPI_TYPE_LOCAL_SCOPE, NULL}, - {"_TZ_", ACPI_TYPE_THERMAL, NULL}, - {"_REV", ACPI_TYPE_INTEGER, (char *)ACPI_CA_SUPPORT_LEVEL}, - {"_OS_", ACPI_TYPE_STRING, ACPI_OS_NAME}, - {"_GL_", ACPI_TYPE_MUTEX, (char *)1}, - -#if !defined (ACPI_NO_METHOD_EXECUTION) || defined (ACPI_CONSTANT_EVAL_ONLY) - {"_OSI", ACPI_TYPE_METHOD, (char *)1}, -#endif - - /* Table terminator */ - - {NULL, ACPI_TYPE_ANY, NULL} -}; - -/* - * Properties of the ACPI Object Types, both internal and external. - * The table is indexed by values of acpi_object_type - */ -const u8 acpi_gbl_ns_properties[] = { - ACPI_NS_NORMAL, /* 00 Any */ - ACPI_NS_NORMAL, /* 01 Number */ - ACPI_NS_NORMAL, /* 02 String */ - ACPI_NS_NORMAL, /* 03 Buffer */ - ACPI_NS_NORMAL, /* 04 Package */ - ACPI_NS_NORMAL, /* 05 field_unit */ - ACPI_NS_NEWSCOPE, /* 06 Device */ - ACPI_NS_NORMAL, /* 07 Event */ - ACPI_NS_NEWSCOPE, /* 08 Method */ - ACPI_NS_NORMAL, /* 09 Mutex */ - ACPI_NS_NORMAL, /* 10 Region */ - ACPI_NS_NEWSCOPE, /* 11 Power */ - ACPI_NS_NEWSCOPE, /* 12 Processor */ - ACPI_NS_NEWSCOPE, /* 13 Thermal */ - ACPI_NS_NORMAL, /* 14 buffer_field */ - ACPI_NS_NORMAL, /* 15 ddb_handle */ - ACPI_NS_NORMAL, /* 16 Debug Object */ - ACPI_NS_NORMAL, /* 17 def_field */ - ACPI_NS_NORMAL, /* 18 bank_field */ - ACPI_NS_NORMAL, /* 19 index_field */ - ACPI_NS_NORMAL, /* 20 Reference */ - ACPI_NS_NORMAL, /* 21 Alias */ - ACPI_NS_NORMAL, /* 22 method_alias */ - ACPI_NS_NORMAL, /* 23 Notify */ - ACPI_NS_NORMAL, /* 24 Address Handler */ - ACPI_NS_NEWSCOPE | ACPI_NS_LOCAL, /* 25 Resource Desc */ - ACPI_NS_NEWSCOPE | ACPI_NS_LOCAL, /* 26 Resource Field */ - ACPI_NS_NEWSCOPE, /* 27 Scope */ - ACPI_NS_NORMAL, /* 28 Extra */ - ACPI_NS_NORMAL, /* 29 Data */ - ACPI_NS_NORMAL /* 30 Invalid */ -}; - -/* Hex to ASCII conversion table */ - -static const char acpi_gbl_hex_to_ascii[] = { - '0', '1', '2', '3', '4', '5', '6', '7', - '8', '9', 'A', 'B', 'C', 'D', 'E', 'F' -}; - -/******************************************************************************* - * - * FUNCTION: acpi_ut_hex_to_ascii_char - * - * PARAMETERS: Integer - Contains the hex digit - * Position - bit position of the digit within the - * integer (multiple of 4) - * - * RETURN: The converted Ascii character - * - * DESCRIPTION: Convert a hex digit to an Ascii character - * - ******************************************************************************/ - -char acpi_ut_hex_to_ascii_char(acpi_integer integer, u32 position) -{ - - return (acpi_gbl_hex_to_ascii[(integer >> position) & 0xF]); -} - /****************************************************************************** * * Event and Hardware globals @@ -313,28 +166,7 @@ struct acpi_bit_register_info acpi_gbl_bit_register_info[ACPI_NUM_BITREG] = { ACPI_BITMASK_ARB_DISABLE} }; -struct acpi_fixed_event_info acpi_gbl_fixed_event_info[ACPI_NUM_FIXED_EVENTS] = { - /* ACPI_EVENT_PMTIMER */ {ACPI_BITREG_TIMER_STATUS, - ACPI_BITREG_TIMER_ENABLE, - ACPI_BITMASK_TIMER_STATUS, - ACPI_BITMASK_TIMER_ENABLE}, - /* ACPI_EVENT_GLOBAL */ {ACPI_BITREG_GLOBAL_LOCK_STATUS, - ACPI_BITREG_GLOBAL_LOCK_ENABLE, - ACPI_BITMASK_GLOBAL_LOCK_STATUS, - ACPI_BITMASK_GLOBAL_LOCK_ENABLE}, - /* ACPI_EVENT_POWER_BUTTON */ {ACPI_BITREG_POWER_BUTTON_STATUS, - ACPI_BITREG_POWER_BUTTON_ENABLE, - ACPI_BITMASK_POWER_BUTTON_STATUS, - ACPI_BITMASK_POWER_BUTTON_ENABLE}, - /* ACPI_EVENT_SLEEP_BUTTON */ {ACPI_BITREG_SLEEP_BUTTON_STATUS, - ACPI_BITREG_SLEEP_BUTTON_ENABLE, - ACPI_BITMASK_SLEEP_BUTTON_STATUS, - ACPI_BITMASK_SLEEP_BUTTON_ENABLE}, - /* ACPI_EVENT_RTC */ {ACPI_BITREG_RT_CLOCK_STATUS, - ACPI_BITREG_RT_CLOCK_ENABLE, - ACPI_BITMASK_RT_CLOCK_STATUS, - ACPI_BITMASK_RT_CLOCK_ENABLE}, -}; +#ifdef ACPI_DEBUG_OUTPUT /******************************************************************************* * @@ -350,7 +182,7 @@ struct acpi_fixed_event_info acpi_gbl_fixed_event_info[ACPI_NUM_FIXED_EVENTS] = /* Region type decoding */ -const char *acpi_gbl_region_types[ACPI_NUM_PREDEFINED_REGIONS] = { +static const char *const acpi_gbl_region_types[ACPI_NUM_PREDEFINED_REGIONS] = { "SystemMemory", "SystemIO", "PCI_Config", @@ -361,7 +193,7 @@ const char *acpi_gbl_region_types[ACPI_NUM_PREDEFINED_REGIONS] = { "DataTable" }; -char *acpi_ut_get_region_name(u8 space_id) +const char *acpi_ut_get_region_name(u8 space_id) { if (space_id >= ACPI_USER_REGION_BEGIN) { @@ -373,369 +205,4 @@ char *acpi_ut_get_region_name(u8 space_id) return (ACPI_CAST_PTR(char, acpi_gbl_region_types[space_id])); } -/******************************************************************************* - * - * FUNCTION: acpi_ut_get_event_name - * - * PARAMETERS: None. - * - * RETURN: Status - * - * DESCRIPTION: Translate a Event ID into a name string (Debug only) - * - ******************************************************************************/ - -/* Event type decoding */ - -static const char *acpi_gbl_event_types[ACPI_NUM_FIXED_EVENTS] = { - "PM_Timer", - "GlobalLock", - "PowerButton", - "SleepButton", - "RealTimeClock", -}; - -char *acpi_ut_get_event_name(u32 event_id) -{ - - if (event_id > ACPI_EVENT_MAX) { - return ("InvalidEventID"); - } - - return (ACPI_CAST_PTR(char, acpi_gbl_event_types[event_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 indicate what type is actually going to be stored for this entry. - */ -static const char acpi_gbl_bad_type[] = "UNDEFINED"; - -/* Printable names of the ACPI object types */ - -static const char *acpi_gbl_ns_type_names[] = { - /* 00 */ "Untyped", - /* 01 */ "Integer", - /* 02 */ "String", - /* 03 */ "Buffer", - /* 04 */ "Package", - /* 05 */ "FieldUnit", - /* 06 */ "Device", - /* 07 */ "Event", - /* 08 */ "Method", - /* 09 */ "Mutex", - /* 10 */ "Region", - /* 11 */ "Power", - /* 12 */ "Processor", - /* 13 */ "Thermal", - /* 14 */ "BufferField", - /* 15 */ "DdbHandle", - /* 16 */ "DebugObject", - /* 17 */ "RegionField", - /* 18 */ "BankField", - /* 19 */ "IndexField", - /* 20 */ "Reference", - /* 21 */ "Alias", - /* 22 */ "MethodAlias", - /* 23 */ "Notify", - /* 24 */ "AddrHandler", - /* 25 */ "ResourceDesc", - /* 26 */ "ResourceFld", - /* 27 */ "Scope", - /* 28 */ "Extra", - /* 29 */ "Data", - /* 30 */ "Invalid" -}; - -char *acpi_ut_get_type_name(acpi_object_type type) -{ - - if (type > ACPI_TYPE_INVALID) { - return (ACPI_CAST_PTR(char, acpi_gbl_bad_type)); - } - - return (ACPI_CAST_PTR(char, acpi_gbl_ns_type_names[type])); -} - -char *acpi_ut_get_object_type_name(union acpi_operand_object *obj_desc) -{ - - if (!obj_desc) { - return ("[NULL Object Descriptor]"); - } - - return (acpi_ut_get_type_name(ACPI_GET_OBJECT_TYPE(obj_desc))); -} - -/******************************************************************************* - * - * FUNCTION: acpi_ut_get_descriptor_name - * - * PARAMETERS: Object - An ACPI object - * - * RETURN: Pointer to a string - * - * DESCRIPTION: Validate object and return the descriptor type - * - ******************************************************************************/ - -/* Printable names of object descriptor types */ - -static const char *acpi_gbl_desc_type_names[] = { - /* 00 */ "Invalid", - /* 01 */ "Cached", - /* 02 */ "State-Generic", - /* 03 */ "State-Update", - /* 04 */ "State-Package", - /* 05 */ "State-Control", - /* 06 */ "State-RootParseScope", - /* 07 */ "State-ParseScope", - /* 08 */ "State-WalkScope", - /* 09 */ "State-Result", - /* 10 */ "State-Notify", - /* 11 */ "State-Thread", - /* 12 */ "Walk", - /* 13 */ "Parser", - /* 14 */ "Operand", - /* 15 */ "Node" -}; - -char *acpi_ut_get_descriptor_name(void *object) -{ - - if (!object) { - return ("NULL OBJECT"); - } - - if (ACPI_GET_DESCRIPTOR_TYPE(object) > ACPI_DESC_TYPE_MAX) { - return (ACPI_CAST_PTR(char, acpi_gbl_bad_type)); - } - - return (ACPI_CAST_PTR(char, - acpi_gbl_desc_type_names[ACPI_GET_DESCRIPTOR_TYPE - (object)])); - -} - -#if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER) -/* - * Strings and procedures used for debug only - */ - -/******************************************************************************* - * - * FUNCTION: acpi_ut_get_mutex_name - * - * PARAMETERS: mutex_id - The predefined ID for this mutex. - * - * RETURN: String containing the name of the mutex. Always returns a valid - * pointer. - * - * DESCRIPTION: Translate a mutex ID into a name string (Debug only) - * - ******************************************************************************/ - -char *acpi_ut_get_mutex_name(u32 mutex_id) -{ - - if (mutex_id > ACPI_MAX_MUTEX) { - return ("Invalid Mutex ID"); - } - - return (acpi_gbl_mutex_names[mutex_id]); -} - -/******************************************************************************* - * - * FUNCTION: acpi_ut_get_notify_name - * - * PARAMETERS: notify_value - Value from the Notify() request - * - * RETURN: String corresponding to the Notify Value. - * - * DESCRIPTION: Translate a Notify Value to a notify namestring. - * - ******************************************************************************/ - -/* Names for Notify() values, used for debug output */ - -static const char *acpi_gbl_notify_value_names[] = { - "Bus Check", - "Device Check", - "Device Wake", - "Eject Request", - "Device Check Light", - "Frequency Mismatch", - "Bus Mode Mismatch", - "Power Fault", - "Capabilities Check", - "Device PLD Check", - "Reserved", - "System Locality Update" -}; - -const char *acpi_ut_get_notify_name(u32 notify_value) -{ - - if (notify_value <= ACPI_NOTIFY_MAX) { - return (acpi_gbl_notify_value_names[notify_value]); - } else if (notify_value <= ACPI_MAX_SYS_NOTIFY) { - return ("Reserved"); - } else { /* Greater or equal to 0x80 */ - - return ("**Device Specific**"); - } -} -#endif - -/******************************************************************************* - * - * FUNCTION: acpi_ut_valid_object_type - * - * PARAMETERS: Type - Object type to be validated - * - * RETURN: TRUE if valid object type, FALSE otherwise - * - * DESCRIPTION: Validate an object type - * - ******************************************************************************/ - -u8 acpi_ut_valid_object_type(acpi_object_type type) -{ - - if (type > ACPI_TYPE_LOCAL_MAX) { - - /* Note: Assumes all TYPEs are contiguous (external/local) */ - - return (FALSE); - } - - return (TRUE); -} - -/******************************************************************************* - * - * FUNCTION: acpi_ut_init_globals - * - * PARAMETERS: None - * - * RETURN: None - * - * DESCRIPTION: Init library globals. All globals that require specific - * initialization should be initialized here! - * - ******************************************************************************/ - -void acpi_ut_init_globals(void) -{ -#if 0 - acpi_status status; #endif - u32 i; - - ACPI_FUNCTION_TRACE(ut_init_globals); - -#if 0 - /* Create all memory caches */ - - status = acpi_ut_create_caches(); - if (ACPI_FAILURE(status)) { - return; - } -#endif - - /* Mutex locked flags */ - - for (i = 0; i < ACPI_NUM_MUTEX; i++) { - acpi_gbl_mutex_info[i].mutex = NULL; - acpi_gbl_mutex_info[i].thread_id = ACPI_MUTEX_NOT_ACQUIRED; - acpi_gbl_mutex_info[i].use_count = 0; - } - - for (i = 0; i < ACPI_NUM_OWNERID_MASKS; i++) { - acpi_gbl_owner_id_mask[i] = 0; - } - acpi_gbl_owner_id_mask[ACPI_NUM_OWNERID_MASKS - 1] = 0x80000000; /* Last ID is never valid */ - - /* GPE support */ - - acpi_gbl_gpe_xrupt_list_head = NULL; - acpi_gbl_gpe_fadt_blocks[0] = NULL; - acpi_gbl_gpe_fadt_blocks[1] = NULL; - - /* Global handlers */ - - acpi_gbl_system_notify.handler = NULL; - acpi_gbl_device_notify.handler = NULL; - acpi_gbl_exception_handler = NULL; - acpi_gbl_init_handler = NULL; - /*acpi_gbl_table_handler = NULL;*/ - - /* Global Lock support */ - - acpi_gbl_global_lock_semaphore = NULL; - acpi_gbl_global_lock_mutex = NULL; - acpi_gbl_global_lock_acquired = FALSE; - acpi_gbl_global_lock_handle = 0; - - /* Miscellaneous variables */ - - 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_last_owner_id_index = 0; - acpi_gbl_next_owner_id_offset = 0; - acpi_gbl_trace_method_name = 0; - acpi_gbl_trace_dbg_level = 0; - acpi_gbl_trace_dbg_layer = 0; - acpi_gbl_debugger_configuration = DEBUGGER_THREADING; - acpi_gbl_db_output_flags = ACPI_DB_CONSOLE_OUTPUT; - - /* Hardware oriented */ - - acpi_gbl_events_initialized = FALSE; - acpi_gbl_system_awake_and_running = TRUE; - - /* Namespace */ - - acpi_gbl_root_node = NULL; - acpi_gbl_root_node_struct.name.integer = ACPI_ROOT_NAME; - acpi_gbl_root_node_struct.descriptor_type = ACPI_DESC_TYPE_NAMED; - acpi_gbl_root_node_struct.type = ACPI_TYPE_DEVICE; - 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_OUTPUT - acpi_gbl_lowest_stack_pointer = ACPI_CAST_PTR(acpi_size, ACPI_SIZE_MAX); -#endif - -#ifdef ACPI_DBG_TRACK_ALLOCATIONS - acpi_gbl_display_final_mem_stats = FALSE; -#endif - - return_VOID; -} - -ACPI_EXPORT_SYMBOL(acpi_dbg_level) - ACPI_EXPORT_SYMBOL(acpi_dbg_layer) diff --git a/xen/drivers/acpi/utilities/utmisc.c b/xen/drivers/acpi/utilities/utmisc.c index ae65d27be6..96d1486dd1 100644 --- a/xen/drivers/acpi/utilities/utmisc.c +++ b/xen/drivers/acpi/utilities/utmisc.c @@ -61,7 +61,7 @@ ACPI_MODULE_NAME("utmisc") * an ASCII string. * ******************************************************************************/ -const char *acpi_ut_validate_exception(acpi_status status) +const char *__init acpi_ut_validate_exception(acpi_status status) { acpi_status sub_status; const char *exception = NULL; @@ -122,40 +122,6 @@ const char *acpi_ut_validate_exception(acpi_status status) /******************************************************************************* * - * FUNCTION: acpi_ut_set_integer_width - * - * PARAMETERS: Revision From DSDT header - * - * RETURN: None - * - * DESCRIPTION: Set the global integer bit width based upon the revision - * of the DSDT. For Revision 1 and 0, Integers are 32 bits. - * For Revision 2 and above, Integers are 64 bits. Yes, this - * makes a difference. - * - ******************************************************************************/ - -void acpi_ut_set_integer_width(u8 revision) -{ - - if (revision < 2) { - - /* 32-bit case */ - - acpi_gbl_integer_bit_width = 32; - acpi_gbl_integer_nybble_width = 8; - acpi_gbl_integer_byte_width = 4; - } else { - /* 64-bit case (ACPI 2.0+) */ - - acpi_gbl_integer_bit_width = 64; - acpi_gbl_integer_nybble_width = 16; - acpi_gbl_integer_byte_width = 8; - } -} - -/******************************************************************************* - * * FUNCTION: acpi_ut_error, acpi_ut_warning, acpi_ut_info * * PARAMETERS: module_name - Caller's module name (for error output) @@ -168,7 +134,7 @@ void acpi_ut_set_integer_width(u8 revision) * ******************************************************************************/ -void ACPI_INTERNAL_VAR_XFACE +void ACPI_INTERNAL_VAR_XFACE __init acpi_ut_error(char *module_name, u32 line_number, char *format, ...) { va_list args; @@ -181,23 +147,7 @@ acpi_ut_error(char *module_name, u32 line_number, char *format, ...) va_end(args); } -void ACPI_INTERNAL_VAR_XFACE -acpi_ut_exception(char *module_name, - u32 line_number, acpi_status status, char *format, ...) -{ - va_list args; - - acpi_os_printf("ACPI Exception (%s-%04d): %s, ", module_name, - line_number, acpi_format_exception(status)); - - va_start(args, format); - acpi_os_vprintf(format, args); - acpi_os_printf(" [%X]\n", ACPI_CA_VERSION); -} - -EXPORT_SYMBOL(acpi_ut_exception); - -void ACPI_INTERNAL_VAR_XFACE +void ACPI_INTERNAL_VAR_XFACE __init acpi_ut_warning(char *module_name, u32 line_number, char *format, ...) { va_list args; @@ -211,7 +161,7 @@ acpi_ut_warning(char *module_name, u32 line_number, char *format, ...) va_end(args); } -void ACPI_INTERNAL_VAR_XFACE +void ACPI_INTERNAL_VAR_XFACE __init acpi_ut_info(char *module_name, u32 line_number, char *format, ...) { va_list args; |