aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi/pci_irq.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/acpi/pci_irq.c')
-rw-r--r--drivers/acpi/pci_irq.c52
1 files changed, 12 insertions, 40 deletions
diff --git a/drivers/acpi/pci_irq.c b/drivers/acpi/pci_irq.c
index 6c04060d063b..6a9f3ddb322e 100644
--- a/drivers/acpi/pci_irq.c
+++ b/drivers/acpi/pci_irq.c
@@ -243,55 +243,29 @@ acpi_pci_irq_del_entry(int segment, int bus, struct acpi_prt_entry *entry)
243 243
244int acpi_pci_irq_add_prt(acpi_handle handle, int segment, int bus) 244int acpi_pci_irq_add_prt(acpi_handle handle, int segment, int bus)
245{ 245{
246 acpi_status status = AE_OK; 246 acpi_status status;
247 char *pathname = NULL; 247 struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL };
248 struct acpi_buffer buffer = { 0, NULL }; 248 struct acpi_pci_routing_table *entry;
249 struct acpi_pci_routing_table *prt = NULL;
250 struct acpi_pci_routing_table *entry = NULL;
251 static int first_time = 1; 249 static int first_time = 1;
252 250
253
254 pathname = kzalloc(ACPI_PATHNAME_MAX, GFP_KERNEL);
255 if (!pathname)
256 return -ENOMEM;
257
258 if (first_time) { 251 if (first_time) {
259 acpi_prt.count = 0; 252 acpi_prt.count = 0;
260 INIT_LIST_HEAD(&acpi_prt.entries); 253 INIT_LIST_HEAD(&acpi_prt.entries);
261 first_time = 0; 254 first_time = 0;
262 } 255 }
263 256
264 /* 257 /* 'handle' is the _PRT's parent (root bridge or PCI-PCI bridge) */
265 * NOTE: We're given a 'handle' to the _PRT object's parent device 258 status = acpi_get_name(handle, ACPI_FULL_PATHNAME, &buffer);
266 * (either a PCI root bridge or PCI-PCI bridge). 259 if (ACPI_FAILURE(status))
267 */ 260 return -ENODEV;
268
269 buffer.length = ACPI_PATHNAME_MAX;
270 buffer.pointer = pathname;
271 acpi_get_name(handle, ACPI_FULL_PATHNAME, &buffer);
272 261
273 printk(KERN_DEBUG "ACPI: PCI Interrupt Routing Table [%s._PRT]\n", 262 printk(KERN_DEBUG "ACPI: PCI Interrupt Routing Table [%s._PRT]\n",
274 pathname); 263 (char *) buffer.pointer);
275 264
276 /* 265 kfree(buffer.pointer);
277 * Evaluate this _PRT and add its entries to our global list (acpi_prt).
278 */
279 266
280 buffer.length = 0; 267 buffer.length = ACPI_ALLOCATE_BUFFER;
281 buffer.pointer = NULL; 268 buffer.pointer = NULL;
282 kfree(pathname);
283 status = acpi_get_irq_routing_table(handle, &buffer);
284 if (status != AE_BUFFER_OVERFLOW) {
285 ACPI_EXCEPTION((AE_INFO, status, "Evaluating _PRT [%s]",
286 acpi_format_exception(status)));
287 return -ENODEV;
288 }
289
290 prt = kzalloc(buffer.length, GFP_KERNEL);
291 if (!prt) {
292 return -ENOMEM;
293 }
294 buffer.pointer = prt;
295 269
296 status = acpi_get_irq_routing_table(handle, &buffer); 270 status = acpi_get_irq_routing_table(handle, &buffer);
297 if (ACPI_FAILURE(status)) { 271 if (ACPI_FAILURE(status)) {
@@ -301,16 +275,14 @@ int acpi_pci_irq_add_prt(acpi_handle handle, int segment, int bus)
301 return -ENODEV; 275 return -ENODEV;
302 } 276 }
303 277
304 entry = prt; 278 entry = buffer.pointer;
305
306 while (entry && (entry->length > 0)) { 279 while (entry && (entry->length > 0)) {
307 acpi_pci_irq_add_entry(handle, segment, bus, entry); 280 acpi_pci_irq_add_entry(handle, segment, bus, entry);
308 entry = (struct acpi_pci_routing_table *) 281 entry = (struct acpi_pci_routing_table *)
309 ((unsigned long)entry + entry->length); 282 ((unsigned long)entry + entry->length);
310 } 283 }
311 284
312 kfree(prt); 285 kfree(buffer.pointer);
313
314 return 0; 286 return 0;
315} 287}
316 288