summaryrefslogtreecommitdiff
path: root/drivers/acpi/processor_driver.c
diff options
context:
space:
mode:
authorAlex Chiang <achiang@hp.com>2010-02-22 22:11:24 +0300
committerLen Brown <len.brown@intel.com>2010-03-15 04:17:19 +0300
commit78ed8bd2944b6400f742306e5fe9d1b9b6bf18ba (patch)
tree1dee7eaa89340e8ee03517da5589d033537e836d /drivers/acpi/processor_driver.c
parent2e9d5e4efa0beeca03ad550bda28027826e83e42 (diff)
downloadlinux-78ed8bd2944b6400f742306e5fe9d1b9b6bf18ba.tar.xz
ACPI: processor: move acpi_get_cpuid into processor_core.c
Enumerating processors (via MADT/_MAT) belongs in the processor core, which is always built-in, rather than living in the processor driver which may not be built. Acked-by: Venkatesh Pallipadi <venkatesh.pallipadi@intel.com> Signed-off-by: Alex Chiang <achiang@hp.com> Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'drivers/acpi/processor_driver.c')
-rw-r--r--drivers/acpi/processor_driver.c159
1 files changed, 0 insertions, 159 deletions
diff --git a/drivers/acpi/processor_driver.c b/drivers/acpi/processor_driver.c
index 98358251ce23..7eedf7475f4e 100644
--- a/drivers/acpi/processor_driver.c
+++ b/drivers/acpi/processor_driver.c
@@ -359,160 +359,6 @@ static inline int acpi_processor_remove_fs(struct acpi_device *device)
}
#endif
-/* Use the acpiid in MADT to map cpus in case of SMP */
-
-#ifdef CONFIG_SMP
-static struct acpi_table_madt *madt;
-
-static int map_lapic_id(struct acpi_subtable_header *entry,
- u32 acpi_id, int *apic_id)
-{
- struct acpi_madt_local_apic *lapic =
- (struct acpi_madt_local_apic *)entry;
- if ((lapic->lapic_flags & ACPI_MADT_ENABLED) &&
- lapic->processor_id == acpi_id) {
- *apic_id = lapic->id;
- return 1;
- }
- return 0;
-}
-
-static int map_x2apic_id(struct acpi_subtable_header *entry,
- int device_declaration, u32 acpi_id, int *apic_id)
-{
- struct acpi_madt_local_x2apic *apic =
- (struct acpi_madt_local_x2apic *)entry;
- u32 tmp = apic->local_apic_id;
-
- /* Only check enabled APICs*/
- if (!(apic->lapic_flags & ACPI_MADT_ENABLED))
- return 0;
-
- /* Device statement declaration type */
- if (device_declaration) {
- if (apic->uid == acpi_id)
- goto found;
- }
-
- return 0;
-found:
- *apic_id = tmp;
- return 1;
-}
-
-static int map_lsapic_id(struct acpi_subtable_header *entry,
- int device_declaration, u32 acpi_id, int *apic_id)
-{
- struct acpi_madt_local_sapic *lsapic =
- (struct acpi_madt_local_sapic *)entry;
- u32 tmp = (lsapic->id << 8) | lsapic->eid;
-
- /* Only check enabled APICs*/
- if (!(lsapic->lapic_flags & ACPI_MADT_ENABLED))
- return 0;
-
- /* Device statement declaration type */
- if (device_declaration) {
- if (entry->length < 16)
- printk(KERN_ERR PREFIX
- "Invalid LSAPIC with Device type processor (SAPIC ID %#x)\n",
- tmp);
- else if (lsapic->uid == acpi_id)
- goto found;
- /* Processor statement declaration type */
- } else if (lsapic->processor_id == acpi_id)
- goto found;
-
- return 0;
-found:
- *apic_id = tmp;
- return 1;
-}
-
-static int map_madt_entry(int type, u32 acpi_id)
-{
- unsigned long madt_end, entry;
- int apic_id = -1;
-
- if (!madt)
- return apic_id;
-
- entry = (unsigned long)madt;
- madt_end = entry + madt->header.length;
-
- /* Parse all entries looking for a match. */
-
- entry += sizeof(struct acpi_table_madt);
- while (entry + sizeof(struct acpi_subtable_header) < madt_end) {
- struct acpi_subtable_header *header =
- (struct acpi_subtable_header *)entry;
- if (header->type == ACPI_MADT_TYPE_LOCAL_APIC) {
- if (map_lapic_id(header, acpi_id, &apic_id))
- break;
- } else if (header->type == ACPI_MADT_TYPE_LOCAL_X2APIC) {
- if (map_x2apic_id(header, type, acpi_id, &apic_id))
- break;
- } else if (header->type == ACPI_MADT_TYPE_LOCAL_SAPIC) {
- if (map_lsapic_id(header, type, acpi_id, &apic_id))
- break;
- }
- entry += header->length;
- }
- return apic_id;
-}
-
-static int map_mat_entry(acpi_handle handle, int type, u32 acpi_id)
-{
- struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL };
- union acpi_object *obj;
- struct acpi_subtable_header *header;
- int apic_id = -1;
-
- if (ACPI_FAILURE(acpi_evaluate_object(handle, "_MAT", NULL, &buffer)))
- goto exit;
-
- if (!buffer.length || !buffer.pointer)
- goto exit;
-
- obj = buffer.pointer;
- if (obj->type != ACPI_TYPE_BUFFER ||
- obj->buffer.length < sizeof(struct acpi_subtable_header)) {
- goto exit;
- }
-
- header = (struct acpi_subtable_header *)obj->buffer.pointer;
- if (header->type == ACPI_MADT_TYPE_LOCAL_APIC) {
- map_lapic_id(header, acpi_id, &apic_id);
- } else if (header->type == ACPI_MADT_TYPE_LOCAL_SAPIC) {
- map_lsapic_id(header, type, acpi_id, &apic_id);
- }
-
-exit:
- if (buffer.pointer)
- kfree(buffer.pointer);
- return apic_id;
-}
-
-int acpi_get_cpuid(acpi_handle handle, int type, u32 acpi_id)
-{
- int i;
- int apic_id = -1;
-
- apic_id = map_mat_entry(handle, type, acpi_id);
- if (apic_id == -1)
- apic_id = map_madt_entry(type, acpi_id);
- if (apic_id == -1)
- return apic_id;
-
- for_each_possible_cpu(i) {
- if (cpu_physical_id(i) == apic_id)
- return i;
- }
- return -1;
-}
-EXPORT_SYMBOL_GPL(acpi_get_cpuid);
-#endif
-
/* --------------------------------------------------------------------------
Driver Interface
-------------------------------------------------------------------------- */
@@ -1071,11 +917,6 @@ static int __init acpi_processor_init(void)
memset(&errata, 0, sizeof(errata));
-#ifdef CONFIG_SMP
- if (ACPI_FAILURE(acpi_get_table(ACPI_SIG_MADT, 0,
- (struct acpi_table_header **)&madt)))
- madt = NULL;
-#endif
#ifdef CONFIG_ACPI_PROCFS
acpi_processor_dir = proc_mkdir(ACPI_PROCESSOR_CLASS, acpi_root_dir);
if (!acpi_processor_dir)