Commit ba8bec7e authored by Jan Beulich's avatar Jan Beulich

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: default avatarJan Beulich <jbeulich@novell.com>
parent 074b9800
......@@ -165,8 +165,6 @@ int platform_intr_list[ACPI_MAX_PLATFORM_INTERRUPTS] = {
[0 ... ACPI_MAX_PLATFORM_INTERRUPTS - 1] = -1
};
enum acpi_irq_model_id acpi_irq_model = ACPI_IRQ_MODEL_IOSAPIC;
/*
* Interrupt routing API for device drivers. Provides interrupt vector for
* a generic platform event. Currently only CPEI is implemented.
......
......@@ -28,7 +28,6 @@
#include <linux/types.h>
#include <linux/errno.h>
#include <linux/acpi.h>
#include <acpi/acpi_bus.h>
#include <acpi/acmacros.h>
#ifndef XEN
......
......@@ -43,7 +43,6 @@
#include <mach_apic.h>
#include <mach_mpparse.h>
int sbf_port;
#define CONFIG_ACPI_PCI
#define BAD_MADT_ENTRY(entry, end) ( \
......@@ -64,35 +63,23 @@ bool_t __initdata acpi_ht = 1; /* enable HT */
bool_t __initdata acpi_lapic;
bool_t __initdata acpi_ioapic;
u8 acpi_sci_flags __initdata;
int acpi_sci_override_gsi __initdata;
bool_t acpi_skip_timer_override __initdata;
#ifdef CONFIG_X86_LOCAL_APIC
static u64 acpi_lapic_addr __initdata = APIC_DEFAULT_PHYS_BASE;
#endif
u32 acpi_smi_cmd;
u8 acpi_enable_value, acpi_disable_value;
u32 __read_mostly acpi_smi_cmd;
u8 __read_mostly acpi_enable_value;
u8 __read_mostly acpi_disable_value;
#ifndef __HAVE_ARCH_CMPXCHG
#warning ACPI uses CMPXCHG, i486 and later hardware
#endif
u32 x86_acpiid_to_apicid[MAX_MADT_ENTRIES] =
u32 __read_mostly x86_acpiid_to_apicid[MAX_MADT_ENTRIES] =
{[0 ... MAX_MADT_ENTRIES - 1] = BAD_APICID };
EXPORT_SYMBOL(x86_acpiid_to_apicid);
/* --------------------------------------------------------------------------
Boot-time Configuration
-------------------------------------------------------------------------- */
/*
* The default interrupt routing model is PIC (8259). This gets
* overriden if IOAPICs are enumerated (below).
*/
enum acpi_irq_model_id acpi_irq_model = ACPI_IRQ_MODEL_PIC;
/*
* Temporarily use the virtual area starting from FIX_IO_APIC_BASE_END,
* to map the target physical address. The problem is that set_fixmap()
......@@ -333,21 +320,6 @@ acpi_parse_nmi_src(struct acpi_subtable_header * header, const unsigned long end
#endif /* CONFIG_X86_IO_APIC */
static int __init acpi_parse_sbf(struct acpi_table_header *table)
{
struct acpi_table_boot *sb;
sb = (struct acpi_table_boot *)table;
if (!sb) {
printk(KERN_WARNING PREFIX "Unable to map SBF\n");
return -ENODEV;
}
sbf_port = sb->cmos_index; /* Save CMOS port */
return 0;
}
#ifdef CONFIG_HPET_TIMER
static int __init acpi_parse_hpet(struct acpi_table_header *table)
......@@ -360,18 +332,9 @@ static int __init acpi_parse_hpet(struct acpi_table_header *table)
return -1;
}
#if 0/*def CONFIG_X86_64*/
vxtime.hpet_address = hpet_tbl->address.address;
hpet_address = hpet_tbl->address.address;
printk(KERN_INFO PREFIX "HPET id: %#x base: %#lx\n",
hpet_tbl->id, vxtime.hpet_address);
#else /* X86 */
{
hpet_address = hpet_tbl->address.address;
printk(KERN_INFO PREFIX "HPET id: %#x base: %#lx\n",
hpet_tbl->id, hpet_address);
}
#endif /* X86 */
hpet_tbl->id, hpet_address);
return 0;
}
......@@ -563,7 +526,7 @@ static int __init acpi_parse_madt_lapic_entries(void)
}
#endif /* CONFIG_X86_LOCAL_APIC */
#if defined(CONFIG_X86_IO_APIC) /*&& defined(CONFIG_ACPI_INTERPRETER)*/
#ifdef CONFIG_X86_IO_APIC
/*
* Parse IOAPIC related entries in MADT
* returns 0 on success, < 0 on error
......@@ -615,15 +578,6 @@ static int __init acpi_parse_madt_ioapic_entries(void)
return count;
}
#ifdef CONFIG_ACPI_INTERPRETER
/*
* If BIOS did not supply an INT_SRC_OVR for the SCI
* pretend we got one so we can set the SCI flags.
*/
if (!acpi_sci_override_gsi)
acpi_sci_ioapic_setup(acpi_fadt.sci_int, 0, 0);
#endif
/* Fill in identity legacy mapings where no override */
mp_config_acpi_legacy_irqs();
......@@ -643,7 +597,7 @@ static inline int acpi_parse_madt_ioapic_entries(void)
{
return -1;
}
#endif /* !(CONFIG_X86_IO_APIC && CONFIG_ACPI_INTERPRETER) */
#endif /* !CONFIG_X86_IO_APIC */
static void __init acpi_process_madt(void)
......@@ -666,7 +620,6 @@ static void __init acpi_process_madt(void)
*/
error = acpi_parse_madt_ioapic_entries();
if (!error) {
acpi_irq_model = ACPI_IRQ_MODEL_IOAPIC;
acpi_irq_balance_set(NULL);
acpi_ioapic = 1;
......@@ -911,8 +864,6 @@ static struct dmi_system_id __initdata acpi_dmi_table[] = {
* acpi_lapic = 1 if LAPIC found
* acpi_ioapic = 1 if IOAPIC found
* if (acpi_lapic && acpi_ioapic) smp_found_config = 1;
* if acpi_blacklisted() acpi_disabled = 1;
* acpi_irq_model=...
* ...
*
* return value: (currently ignored)
......@@ -944,22 +895,6 @@ int __init acpi_boot_table_init(void)
return error;
}
acpi_table_parse(ACPI_SIG_BOOT, acpi_parse_sbf);
/*
* blacklist may disable ACPI entirely
*/
error = acpi_blacklisted();
if (error) {
if (acpi_force) {
printk(KERN_WARNING PREFIX "acpi=force override\n");
} else {
printk(KERN_WARNING PREFIX "Disabling ACPI support\n");
disable_acpi();
return error;
}
}
return 0;
}
......@@ -972,8 +907,6 @@ int __init acpi_boot_init(void)
if (acpi_disabled && !acpi_ht)
return 1;
acpi_table_parse(ACPI_SIG_BOOT, acpi_parse_sbf);
/*
* set sci_int and PM timer address
*/
......
......@@ -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 =
......
......@@ -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
......
......@@ -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);
}
......@@ -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;
......
......@@ -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;
......
......@@ -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;
......@@ -113,29 +109,6 @@ acpi_tb_check_xsdt(acpi_physical_address address)
return AE_OK;
}
/*******************************************************************************
*
* 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
......@@ -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)
{
......
......@@ -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)
......@@ -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();
......
This diff is collapsed.
......@@ -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;
......@@ -120,40 +120,6 @@ const char *acpi_ut_validate_exception(acpi_status status)
return (ACPI_CAST_PTR(const char, exception));
}
/*******************************************************************************
*
* 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
......@@ -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;
......
......@@ -46,6 +46,7 @@ LIST_HEAD_READ_MOSTLY(acpi_rmrr_units);
static LIST_HEAD_READ_MOSTLY(acpi_atsr_units);
static LIST_HEAD_READ_MOSTLY(acpi_rhsa_units);
static struct acpi_table_header *__read_mostly dmar_table;
static u64 __read_mostly igd_drhd_address;
static void __init dmar_scope_add_buses(struct dmar_scope *scope, u16 sec_bus,
......@@ -672,6 +673,7 @@ static int __init acpi_parse_dmar(struct acpi_table_header *table)
u8 dmar_host_address_width;
int ret = 0;
dmar_table = table;
dmar = (struct acpi_table_dmar *)table;
if ( !iommu_enabled )
......@@ -763,22 +765,8 @@ int __init acpi_dmar_init(void)
return parse_dmar_table(acpi_parse_dmar);
}
static struct acpi_table_header *get_dmar(void)
{
struct acpi_table_header *dmar_table = NULL;
unsigned long flags;
/* Disabling IRQs avoids cross-CPU TLB flush in map_pages_to_xen(). */
local_irq_save(flags);
acpi_get_table(ACPI_SIG_DMAR, 0, &dmar_table);
local_irq_restore(flags);
return dmar_table;
}
void acpi_dmar_reinstate(void)
{
struct acpi_table_header *dmar_table = get_dmar();
if ( dmar_table == NULL )
return;
dmar_table->signature[0