diff options
Diffstat (limited to 'drivers/acpi/processor_core.c')
-rw-r--r-- | drivers/acpi/processor_core.c | 56 |
1 files changed, 28 insertions, 28 deletions
diff --git a/drivers/acpi/processor_core.c b/drivers/acpi/processor_core.c index 342942f90a10..02e48394276c 100644 --- a/drivers/acpi/processor_core.c +++ b/drivers/acpi/processor_core.c | |||
@@ -69,7 +69,7 @@ static int map_madt_entry(int type, u32 acpi_id) | |||
69 | unsigned long madt_end, entry; | 69 | unsigned long madt_end, entry; |
70 | static struct acpi_table_madt *madt; | 70 | static struct acpi_table_madt *madt; |
71 | static int read_madt; | 71 | static int read_madt; |
72 | int apic_id = -1; | 72 | int phys_id = -1; /* CPU hardware ID */ |
73 | 73 | ||
74 | if (!read_madt) { | 74 | if (!read_madt) { |
75 | if (ACPI_FAILURE(acpi_get_table(ACPI_SIG_MADT, 0, | 75 | if (ACPI_FAILURE(acpi_get_table(ACPI_SIG_MADT, 0, |
@@ -79,7 +79,7 @@ static int map_madt_entry(int type, u32 acpi_id) | |||
79 | } | 79 | } |
80 | 80 | ||
81 | if (!madt) | 81 | if (!madt) |
82 | return apic_id; | 82 | return phys_id; |
83 | 83 | ||
84 | entry = (unsigned long)madt; | 84 | entry = (unsigned long)madt; |
85 | madt_end = entry + madt->header.length; | 85 | madt_end = entry + madt->header.length; |
@@ -91,18 +91,18 @@ static int map_madt_entry(int type, u32 acpi_id) | |||
91 | struct acpi_subtable_header *header = | 91 | struct acpi_subtable_header *header = |
92 | (struct acpi_subtable_header *)entry; | 92 | (struct acpi_subtable_header *)entry; |
93 | if (header->type == ACPI_MADT_TYPE_LOCAL_APIC) { | 93 | if (header->type == ACPI_MADT_TYPE_LOCAL_APIC) { |
94 | if (!map_lapic_id(header, acpi_id, &apic_id)) | 94 | if (!map_lapic_id(header, acpi_id, &phys_id)) |
95 | break; | 95 | break; |
96 | } else if (header->type == ACPI_MADT_TYPE_LOCAL_X2APIC) { | 96 | } else if (header->type == ACPI_MADT_TYPE_LOCAL_X2APIC) { |
97 | if (!map_x2apic_id(header, type, acpi_id, &apic_id)) | 97 | if (!map_x2apic_id(header, type, acpi_id, &phys_id)) |
98 | break; | 98 | break; |
99 | } else if (header->type == ACPI_MADT_TYPE_LOCAL_SAPIC) { | 99 | } else if (header->type == ACPI_MADT_TYPE_LOCAL_SAPIC) { |
100 | if (!map_lsapic_id(header, type, acpi_id, &apic_id)) | 100 | if (!map_lsapic_id(header, type, acpi_id, &phys_id)) |
101 | break; | 101 | break; |
102 | } | 102 | } |
103 | entry += header->length; | 103 | entry += header->length; |
104 | } | 104 | } |
105 | return apic_id; | 105 | return phys_id; |
106 | } | 106 | } |
107 | 107 | ||
108 | static int map_mat_entry(acpi_handle handle, int type, u32 acpi_id) | 108 | static int map_mat_entry(acpi_handle handle, int type, u32 acpi_id) |
@@ -110,7 +110,7 @@ static int map_mat_entry(acpi_handle handle, int type, u32 acpi_id) | |||
110 | struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL }; | 110 | struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL }; |
111 | union acpi_object *obj; | 111 | union acpi_object *obj; |
112 | struct acpi_subtable_header *header; | 112 | struct acpi_subtable_header *header; |
113 | int apic_id = -1; | 113 | int phys_id = -1; |
114 | 114 | ||
115 | if (ACPI_FAILURE(acpi_evaluate_object(handle, "_MAT", NULL, &buffer))) | 115 | if (ACPI_FAILURE(acpi_evaluate_object(handle, "_MAT", NULL, &buffer))) |
116 | goto exit; | 116 | goto exit; |
@@ -126,38 +126,38 @@ static int map_mat_entry(acpi_handle handle, int type, u32 acpi_id) | |||
126 | 126 | ||
127 | header = (struct acpi_subtable_header *)obj->buffer.pointer; | 127 | header = (struct acpi_subtable_header *)obj->buffer.pointer; |
128 | if (header->type == ACPI_MADT_TYPE_LOCAL_APIC) | 128 | if (header->type == ACPI_MADT_TYPE_LOCAL_APIC) |
129 | map_lapic_id(header, acpi_id, &apic_id); | 129 | map_lapic_id(header, acpi_id, &phys_id); |
130 | else if (header->type == ACPI_MADT_TYPE_LOCAL_SAPIC) | 130 | else if (header->type == ACPI_MADT_TYPE_LOCAL_SAPIC) |
131 | map_lsapic_id(header, type, acpi_id, &apic_id); | 131 | map_lsapic_id(header, type, acpi_id, &phys_id); |
132 | else if (header->type == ACPI_MADT_TYPE_LOCAL_X2APIC) | 132 | else if (header->type == ACPI_MADT_TYPE_LOCAL_X2APIC) |
133 | map_x2apic_id(header, type, acpi_id, &apic_id); | 133 | map_x2apic_id(header, type, acpi_id, &phys_id); |
134 | 134 | ||
135 | exit: | 135 | exit: |
136 | kfree(buffer.pointer); | 136 | kfree(buffer.pointer); |
137 | return apic_id; | 137 | return phys_id; |
138 | } | 138 | } |
139 | 139 | ||
140 | int acpi_get_apicid(acpi_handle handle, int type, u32 acpi_id) | 140 | int acpi_get_phys_id(acpi_handle handle, int type, u32 acpi_id) |
141 | { | 141 | { |
142 | int apic_id; | 142 | int phys_id; |
143 | 143 | ||
144 | apic_id = map_mat_entry(handle, type, acpi_id); | 144 | phys_id = map_mat_entry(handle, type, acpi_id); |
145 | if (apic_id == -1) | 145 | if (phys_id == -1) |
146 | apic_id = map_madt_entry(type, acpi_id); | 146 | phys_id = map_madt_entry(type, acpi_id); |
147 | 147 | ||
148 | return apic_id; | 148 | return phys_id; |
149 | } | 149 | } |
150 | 150 | ||
151 | int acpi_map_cpuid(int apic_id, u32 acpi_id) | 151 | int acpi_map_cpuid(int phys_id, u32 acpi_id) |
152 | { | 152 | { |
153 | #ifdef CONFIG_SMP | 153 | #ifdef CONFIG_SMP |
154 | int i; | 154 | int i; |
155 | #endif | 155 | #endif |
156 | 156 | ||
157 | if (apic_id == -1) { | 157 | if (phys_id == -1) { |
158 | /* | 158 | /* |
159 | * On UP processor, there is no _MAT or MADT table. | 159 | * On UP processor, there is no _MAT or MADT table. |
160 | * So above apic_id is always set to -1. | 160 | * So above phys_id is always set to -1. |
161 | * | 161 | * |
162 | * BIOS may define multiple CPU handles even for UP processor. | 162 | * BIOS may define multiple CPU handles even for UP processor. |
163 | * For example, | 163 | * For example, |
@@ -170,7 +170,7 @@ int acpi_map_cpuid(int apic_id, u32 acpi_id) | |||
170 | * Processor (CPU3, 0x03, 0x00000410, 0x06) {} | 170 | * Processor (CPU3, 0x03, 0x00000410, 0x06) {} |
171 | * } | 171 | * } |
172 | * | 172 | * |
173 | * Ignores apic_id and always returns 0 for the processor | 173 | * Ignores phys_id and always returns 0 for the processor |
174 | * handle with acpi id 0 if nr_cpu_ids is 1. | 174 | * handle with acpi id 0 if nr_cpu_ids is 1. |
175 | * This should be the case if SMP tables are not found. | 175 | * This should be the case if SMP tables are not found. |
176 | * Return -1 for other CPU's handle. | 176 | * Return -1 for other CPU's handle. |
@@ -178,28 +178,28 @@ int acpi_map_cpuid(int apic_id, u32 acpi_id) | |||
178 | if (nr_cpu_ids <= 1 && acpi_id == 0) | 178 | if (nr_cpu_ids <= 1 && acpi_id == 0) |
179 | return acpi_id; | 179 | return acpi_id; |
180 | else | 180 | else |
181 | return apic_id; | 181 | return phys_id; |
182 | } | 182 | } |
183 | 183 | ||
184 | #ifdef CONFIG_SMP | 184 | #ifdef CONFIG_SMP |
185 | for_each_possible_cpu(i) { | 185 | for_each_possible_cpu(i) { |
186 | if (cpu_physical_id(i) == apic_id) | 186 | if (cpu_physical_id(i) == phys_id) |
187 | return i; | 187 | return i; |
188 | } | 188 | } |
189 | #else | 189 | #else |
190 | /* In UP kernel, only processor 0 is valid */ | 190 | /* In UP kernel, only processor 0 is valid */ |
191 | if (apic_id == 0) | 191 | if (phys_id == 0) |
192 | return apic_id; | 192 | return phys_id; |
193 | #endif | 193 | #endif |
194 | return -1; | 194 | return -1; |
195 | } | 195 | } |
196 | 196 | ||
197 | int acpi_get_cpuid(acpi_handle handle, int type, u32 acpi_id) | 197 | int acpi_get_cpuid(acpi_handle handle, int type, u32 acpi_id) |
198 | { | 198 | { |
199 | int apic_id; | 199 | int phys_id; |
200 | 200 | ||
201 | apic_id = acpi_get_apicid(handle, type, acpi_id); | 201 | phys_id = acpi_get_phys_id(handle, type, acpi_id); |
202 | 202 | ||
203 | return acpi_map_cpuid(apic_id, acpi_id); | 203 | return acpi_map_cpuid(phys_id, acpi_id); |
204 | } | 204 | } |
205 | EXPORT_SYMBOL_GPL(acpi_get_cpuid); | 205 | EXPORT_SYMBOL_GPL(acpi_get_cpuid); |