diff options
| -rw-r--r-- | drivers/acpi/processor_core.c | 60 |
1 files changed, 22 insertions, 38 deletions
diff --git a/drivers/acpi/processor_core.c b/drivers/acpi/processor_core.c index a84386204659..b933061b6b60 100644 --- a/drivers/acpi/processor_core.c +++ b/drivers/acpi/processor_core.c | |||
| @@ -32,12 +32,12 @@ static struct acpi_table_madt *get_madt_table(void) | |||
| 32 | } | 32 | } |
| 33 | 33 | ||
| 34 | static int map_lapic_id(struct acpi_subtable_header *entry, | 34 | static int map_lapic_id(struct acpi_subtable_header *entry, |
| 35 | u32 acpi_id, phys_cpuid_t *apic_id, bool ignore_disabled) | 35 | u32 acpi_id, phys_cpuid_t *apic_id) |
| 36 | { | 36 | { |
| 37 | struct acpi_madt_local_apic *lapic = | 37 | struct acpi_madt_local_apic *lapic = |
| 38 | container_of(entry, struct acpi_madt_local_apic, header); | 38 | container_of(entry, struct acpi_madt_local_apic, header); |
| 39 | 39 | ||
| 40 | if (ignore_disabled && !(lapic->lapic_flags & ACPI_MADT_ENABLED)) | 40 | if (!(lapic->lapic_flags & ACPI_MADT_ENABLED)) |
| 41 | return -ENODEV; | 41 | return -ENODEV; |
| 42 | 42 | ||
| 43 | if (lapic->processor_id != acpi_id) | 43 | if (lapic->processor_id != acpi_id) |
| @@ -48,13 +48,12 @@ static int map_lapic_id(struct acpi_subtable_header *entry, | |||
| 48 | } | 48 | } |
| 49 | 49 | ||
| 50 | static int map_x2apic_id(struct acpi_subtable_header *entry, | 50 | static int map_x2apic_id(struct acpi_subtable_header *entry, |
| 51 | int device_declaration, u32 acpi_id, phys_cpuid_t *apic_id, | 51 | int device_declaration, u32 acpi_id, phys_cpuid_t *apic_id) |
| 52 | bool ignore_disabled) | ||
| 53 | { | 52 | { |
| 54 | struct acpi_madt_local_x2apic *apic = | 53 | struct acpi_madt_local_x2apic *apic = |
| 55 | container_of(entry, struct acpi_madt_local_x2apic, header); | 54 | container_of(entry, struct acpi_madt_local_x2apic, header); |
| 56 | 55 | ||
| 57 | if (ignore_disabled && !(apic->lapic_flags & ACPI_MADT_ENABLED)) | 56 | if (!(apic->lapic_flags & ACPI_MADT_ENABLED)) |
| 58 | return -ENODEV; | 57 | return -ENODEV; |
| 59 | 58 | ||
| 60 | if (device_declaration && (apic->uid == acpi_id)) { | 59 | if (device_declaration && (apic->uid == acpi_id)) { |
| @@ -66,13 +65,12 @@ static int map_x2apic_id(struct acpi_subtable_header *entry, | |||
| 66 | } | 65 | } |
| 67 | 66 | ||
| 68 | static int map_lsapic_id(struct acpi_subtable_header *entry, | 67 | static int map_lsapic_id(struct acpi_subtable_header *entry, |
| 69 | int device_declaration, u32 acpi_id, phys_cpuid_t *apic_id, | 68 | int device_declaration, u32 acpi_id, phys_cpuid_t *apic_id) |
| 70 | bool ignore_disabled) | ||
| 71 | { | 69 | { |
| 72 | struct acpi_madt_local_sapic *lsapic = | 70 | struct acpi_madt_local_sapic *lsapic = |
| 73 | container_of(entry, struct acpi_madt_local_sapic, header); | 71 | container_of(entry, struct acpi_madt_local_sapic, header); |
| 74 | 72 | ||
| 75 | if (ignore_disabled && !(lsapic->lapic_flags & ACPI_MADT_ENABLED)) | 73 | if (!(lsapic->lapic_flags & ACPI_MADT_ENABLED)) |
| 76 | return -ENODEV; | 74 | return -ENODEV; |
| 77 | 75 | ||
| 78 | if (device_declaration) { | 76 | if (device_declaration) { |
| @@ -89,13 +87,12 @@ static int map_lsapic_id(struct acpi_subtable_header *entry, | |||
| 89 | * Retrieve the ARM CPU physical identifier (MPIDR) | 87 | * Retrieve the ARM CPU physical identifier (MPIDR) |
| 90 | */ | 88 | */ |
| 91 | static int map_gicc_mpidr(struct acpi_subtable_header *entry, | 89 | static int map_gicc_mpidr(struct acpi_subtable_header *entry, |
| 92 | int device_declaration, u32 acpi_id, phys_cpuid_t *mpidr, | 90 | int device_declaration, u32 acpi_id, phys_cpuid_t *mpidr) |
| 93 | bool ignore_disabled) | ||
| 94 | { | 91 | { |
| 95 | struct acpi_madt_generic_interrupt *gicc = | 92 | struct acpi_madt_generic_interrupt *gicc = |
| 96 | container_of(entry, struct acpi_madt_generic_interrupt, header); | 93 | container_of(entry, struct acpi_madt_generic_interrupt, header); |
| 97 | 94 | ||
| 98 | if (ignore_disabled && !(gicc->flags & ACPI_MADT_ENABLED)) | 95 | if (!(gicc->flags & ACPI_MADT_ENABLED)) |
| 99 | return -ENODEV; | 96 | return -ENODEV; |
| 100 | 97 | ||
| 101 | /* device_declaration means Device object in DSDT, in the | 98 | /* device_declaration means Device object in DSDT, in the |
| @@ -112,7 +109,7 @@ static int map_gicc_mpidr(struct acpi_subtable_header *entry, | |||
| 112 | } | 109 | } |
| 113 | 110 | ||
| 114 | static phys_cpuid_t map_madt_entry(struct acpi_table_madt *madt, | 111 | static phys_cpuid_t map_madt_entry(struct acpi_table_madt *madt, |
| 115 | int type, u32 acpi_id, bool ignore_disabled) | 112 | int type, u32 acpi_id) |
| 116 | { | 113 | { |
| 117 | unsigned long madt_end, entry; | 114 | unsigned long madt_end, entry; |
| 118 | phys_cpuid_t phys_id = PHYS_CPUID_INVALID; /* CPU hardware ID */ | 115 | phys_cpuid_t phys_id = PHYS_CPUID_INVALID; /* CPU hardware ID */ |
| @@ -130,20 +127,16 @@ static phys_cpuid_t map_madt_entry(struct acpi_table_madt *madt, | |||
| 130 | struct acpi_subtable_header *header = | 127 | struct acpi_subtable_header *header = |
| 131 | (struct acpi_subtable_header *)entry; | 128 | (struct acpi_subtable_header *)entry; |
| 132 | if (header->type == ACPI_MADT_TYPE_LOCAL_APIC) { | 129 | if (header->type == ACPI_MADT_TYPE_LOCAL_APIC) { |
| 133 | if (!map_lapic_id(header, acpi_id, &phys_id, | 130 | if (!map_lapic_id(header, acpi_id, &phys_id)) |
| 134 | ignore_disabled)) | ||
| 135 | break; | 131 | break; |
| 136 | } else if (header->type == ACPI_MADT_TYPE_LOCAL_X2APIC) { | 132 | } else if (header->type == ACPI_MADT_TYPE_LOCAL_X2APIC) { |
| 137 | if (!map_x2apic_id(header, type, acpi_id, &phys_id, | 133 | if (!map_x2apic_id(header, type, acpi_id, &phys_id)) |
| 138 | ignore_disabled)) | ||
| 139 | break; | 134 | break; |
| 140 | } else if (header->type == ACPI_MADT_TYPE_LOCAL_SAPIC) { | 135 | } else if (header->type == ACPI_MADT_TYPE_LOCAL_SAPIC) { |
| 141 | if (!map_lsapic_id(header, type, acpi_id, &phys_id, | 136 | if (!map_lsapic_id(header, type, acpi_id, &phys_id)) |
| 142 | ignore_disabled)) | ||
| 143 | break; | 137 | break; |
| 144 | } else if (header->type == ACPI_MADT_TYPE_GENERIC_INTERRUPT) { | 138 | } else if (header->type == ACPI_MADT_TYPE_GENERIC_INTERRUPT) { |
| 145 | if (!map_gicc_mpidr(header, type, acpi_id, &phys_id, | 139 | if (!map_gicc_mpidr(header, type, acpi_id, &phys_id)) |
| 146 | ignore_disabled)) | ||
| 147 | break; | 140 | break; |
| 148 | } | 141 | } |
| 149 | entry += header->length; | 142 | entry += header->length; |
| @@ -161,15 +154,14 @@ phys_cpuid_t __init acpi_map_madt_entry(u32 acpi_id) | |||
| 161 | if (!madt) | 154 | if (!madt) |
| 162 | return PHYS_CPUID_INVALID; | 155 | return PHYS_CPUID_INVALID; |
| 163 | 156 | ||
| 164 | rv = map_madt_entry(madt, 1, acpi_id, true); | 157 | rv = map_madt_entry(madt, 1, acpi_id); |
| 165 | 158 | ||
| 166 | acpi_put_table((struct acpi_table_header *)madt); | 159 | acpi_put_table((struct acpi_table_header *)madt); |
| 167 | 160 | ||
| 168 | return rv; | 161 | return rv; |
| 169 | } | 162 | } |
| 170 | 163 | ||
| 171 | static phys_cpuid_t map_mat_entry(acpi_handle handle, int type, u32 acpi_id, | 164 | static phys_cpuid_t map_mat_entry(acpi_handle handle, int type, u32 acpi_id) |
| 172 | bool ignore_disabled) | ||
| 173 | { | 165 | { |
| 174 | struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL }; | 166 | struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL }; |
| 175 | union acpi_object *obj; | 167 | union acpi_object *obj; |
| @@ -190,38 +182,30 @@ static phys_cpuid_t map_mat_entry(acpi_handle handle, int type, u32 acpi_id, | |||
| 190 | 182 | ||
| 191 | header = (struct acpi_subtable_header *)obj->buffer.pointer; | 183 | header = (struct acpi_subtable_header *)obj->buffer.pointer; |
| 192 | if (header->type == ACPI_MADT_TYPE_LOCAL_APIC) | 184 | if (header->type == ACPI_MADT_TYPE_LOCAL_APIC) |
| 193 | map_lapic_id(header, acpi_id, &phys_id, ignore_disabled); | 185 | map_lapic_id(header, acpi_id, &phys_id); |
| 194 | else if (header->type == ACPI_MADT_TYPE_LOCAL_SAPIC) | 186 | else if (header->type == ACPI_MADT_TYPE_LOCAL_SAPIC) |
| 195 | map_lsapic_id(header, type, acpi_id, &phys_id, ignore_disabled); | 187 | map_lsapic_id(header, type, acpi_id, &phys_id); |
| 196 | else if (header->type == ACPI_MADT_TYPE_LOCAL_X2APIC) | 188 | else if (header->type == ACPI_MADT_TYPE_LOCAL_X2APIC) |
| 197 | map_x2apic_id(header, type, acpi_id, &phys_id, ignore_disabled); | 189 | map_x2apic_id(header, type, acpi_id, &phys_id); |
| 198 | else if (header->type == ACPI_MADT_TYPE_GENERIC_INTERRUPT) | 190 | else if (header->type == ACPI_MADT_TYPE_GENERIC_INTERRUPT) |
| 199 | map_gicc_mpidr(header, type, acpi_id, &phys_id, | 191 | map_gicc_mpidr(header, type, acpi_id, &phys_id); |
| 200 | ignore_disabled); | ||
| 201 | 192 | ||
| 202 | exit: | 193 | exit: |
| 203 | kfree(buffer.pointer); | 194 | kfree(buffer.pointer); |
| 204 | return phys_id; | 195 | return phys_id; |
| 205 | } | 196 | } |
| 206 | 197 | ||
| 207 | static phys_cpuid_t __acpi_get_phys_id(acpi_handle handle, int type, | 198 | phys_cpuid_t acpi_get_phys_id(acpi_handle handle, int type, u32 acpi_id) |
| 208 | u32 acpi_id, bool ignore_disabled) | ||
| 209 | { | 199 | { |
| 210 | phys_cpuid_t phys_id; | 200 | phys_cpuid_t phys_id; |
| 211 | 201 | ||
| 212 | phys_id = map_mat_entry(handle, type, acpi_id, ignore_disabled); | 202 | phys_id = map_mat_entry(handle, type, acpi_id); |
| 213 | if (invalid_phys_cpuid(phys_id)) | 203 | if (invalid_phys_cpuid(phys_id)) |
| 214 | phys_id = map_madt_entry(get_madt_table(), type, acpi_id, | 204 | phys_id = map_madt_entry(get_madt_table(), type, acpi_id); |
| 215 | ignore_disabled); | ||
| 216 | 205 | ||
| 217 | return phys_id; | 206 | return phys_id; |
| 218 | } | 207 | } |
| 219 | 208 | ||
| 220 | phys_cpuid_t acpi_get_phys_id(acpi_handle handle, int type, u32 acpi_id) | ||
| 221 | { | ||
| 222 | return __acpi_get_phys_id(handle, type, acpi_id, true); | ||
| 223 | } | ||
| 224 | |||
| 225 | int acpi_map_cpuid(phys_cpuid_t phys_id, u32 acpi_id) | 209 | int acpi_map_cpuid(phys_cpuid_t phys_id, u32 acpi_id) |
| 226 | { | 210 | { |
| 227 | #ifdef CONFIG_SMP | 211 | #ifdef CONFIG_SMP |
