Lines Matching refs:link
87 struct acpi_pci_link *link = context; in acpi_pci_link_check_possible() local
88 acpi_handle handle = link->device->handle; in acpi_pci_link_check_possible()
112 link->irq.possible[i] = p->interrupts[i]; in acpi_pci_link_check_possible()
113 link->irq.possible_count++; in acpi_pci_link_check_possible()
115 link->irq.triggering = p->triggering; in acpi_pci_link_check_possible()
116 link->irq.polarity = p->polarity; in acpi_pci_link_check_possible()
117 link->irq.resource_type = ACPI_RESOURCE_TYPE_IRQ; in acpi_pci_link_check_possible()
138 link->irq.possible[i] = p->interrupts[i]; in acpi_pci_link_check_possible()
139 link->irq.possible_count++; in acpi_pci_link_check_possible()
141 link->irq.triggering = p->triggering; in acpi_pci_link_check_possible()
142 link->irq.polarity = p->polarity; in acpi_pci_link_check_possible()
143 link->irq.resource_type = ACPI_RESOURCE_TYPE_EXTENDED_IRQ; in acpi_pci_link_check_possible()
155 static int acpi_pci_link_get_possible(struct acpi_pci_link *link) in acpi_pci_link_get_possible() argument
157 acpi_handle handle = link->device->handle; in acpi_pci_link_get_possible()
161 acpi_pci_link_check_possible, link); in acpi_pci_link_get_possible()
168 link->irq.possible_count); in acpi_pci_link_get_possible()
228 static int acpi_pci_link_get_current(struct acpi_pci_link *link) in acpi_pci_link_get_current() argument
230 acpi_handle handle = link->device->handle; in acpi_pci_link_get_current()
235 link->irq.active = 0; in acpi_pci_link_get_current()
240 result = acpi_bus_get_status(link->device); in acpi_pci_link_get_current()
246 if (!link->device->status.enabled) { in acpi_pci_link_get_current()
269 link->irq.active = irq; in acpi_pci_link_get_current()
271 acpi_handle_debug(handle, "Link at IRQ %d \n", link->irq.active); in acpi_pci_link_get_current()
277 static int acpi_pci_link_set(struct acpi_pci_link *link, int irq) in acpi_pci_link_set() argument
284 acpi_handle handle = link->device->handle; in acpi_pci_link_set()
298 switch (link->irq.resource_type) { in acpi_pci_link_set()
302 resource->res.data.irq.triggering = link->irq.triggering; in acpi_pci_link_set()
304 link->irq.polarity; in acpi_pci_link_set()
305 if (link->irq.triggering == ACPI_EDGE_SENSITIVE) in acpi_pci_link_set()
320 link->irq.triggering; in acpi_pci_link_set()
322 link->irq.polarity; in acpi_pci_link_set()
323 if (link->irq.triggering == ACPI_EDGE_SENSITIVE) in acpi_pci_link_set()
334 link->irq.resource_type); in acpi_pci_link_set()
343 status = acpi_set_current_resources(link->device->handle, &buffer); in acpi_pci_link_set()
353 result = acpi_bus_get_status(link->device); in acpi_pci_link_set()
358 if (!link->device->status.enabled) in acpi_pci_link_set()
362 result = acpi_pci_link_get_current(link); in acpi_pci_link_set()
371 if (link->irq.active != irq) { in acpi_pci_link_set()
377 link->irq.active, irq); in acpi_pci_link_set()
378 link->irq.active = irq; in acpi_pci_link_set()
381 acpi_handle_debug(handle, "Set IRQ %d\n", link->irq.active); in acpi_pci_link_set()
453 struct acpi_pci_link *link; in acpi_irq_pci_sharing_penalty() local
457 list_for_each_entry(link, &acpi_link_list, list) { in acpi_irq_pci_sharing_penalty()
462 if (link->irq.active && link->irq.active == irq) in acpi_irq_pci_sharing_penalty()
468 for (i = 0; i < link->irq.possible_count; i++) in acpi_irq_pci_sharing_penalty()
469 if (link->irq.possible[i] == irq) in acpi_irq_pci_sharing_penalty()
471 link->irq.possible_count; in acpi_irq_pci_sharing_penalty()
492 struct acpi_pci_link *link; in acpi_irq_penalty_init() local
498 list_for_each_entry(link, &acpi_link_list, list) { in acpi_irq_penalty_init()
504 if (link->irq.possible_count) { in acpi_irq_penalty_init()
507 link->irq.possible_count; in acpi_irq_penalty_init()
509 for (i = 0; i < link->irq.possible_count; i++) { in acpi_irq_penalty_init()
510 if (link->irq.possible[i] < ACPI_MAX_ISA_IRQS) in acpi_irq_penalty_init()
511 acpi_isa_irq_penalty[link->irq. in acpi_irq_penalty_init()
516 } else if (link->irq.active && in acpi_irq_penalty_init()
517 (link->irq.active < ACPI_MAX_ISA_IRQS)) { in acpi_irq_penalty_init()
518 acpi_isa_irq_penalty[link->irq.active] += in acpi_irq_penalty_init()
528 static int acpi_pci_link_allocate(struct acpi_pci_link *link) in acpi_pci_link_allocate() argument
530 acpi_handle handle = link->device->handle; in acpi_pci_link_allocate()
534 if (link->irq.initialized) { in acpi_pci_link_allocate()
535 if (link->refcnt == 0) in acpi_pci_link_allocate()
537 acpi_pci_link_set(link, link->irq.active); in acpi_pci_link_allocate()
544 for (i = 0; i < link->irq.possible_count; ++i) { in acpi_pci_link_allocate()
545 if (link->irq.active == link->irq.possible[i]) in acpi_pci_link_allocate()
551 if (i == link->irq.possible_count) { in acpi_pci_link_allocate()
554 link->irq.active); in acpi_pci_link_allocate()
555 link->irq.active = 0; in acpi_pci_link_allocate()
561 if (link->irq.active) in acpi_pci_link_allocate()
562 irq = link->irq.active; in acpi_pci_link_allocate()
564 irq = link->irq.possible[link->irq.possible_count - 1]; in acpi_pci_link_allocate()
566 if (acpi_irq_balance || !link->irq.active) { in acpi_pci_link_allocate()
571 for (i = (link->irq.possible_count - 1); i >= 0; i--) { in acpi_pci_link_allocate()
573 acpi_irq_get_penalty(link->irq.possible[i])) in acpi_pci_link_allocate()
574 irq = link->irq.possible[i]; in acpi_pci_link_allocate()
584 if (acpi_pci_link_set(link, irq)) { in acpi_pci_link_allocate()
589 if (link->irq.active < ACPI_MAX_ISA_IRQS) in acpi_pci_link_allocate()
590 acpi_isa_irq_penalty[link->irq.active] += in acpi_pci_link_allocate()
594 link->irq.active); in acpi_pci_link_allocate()
597 link->irq.initialized = 1; in acpi_pci_link_allocate()
610 struct acpi_pci_link *link; in acpi_pci_link_allocate_irq() local
617 link = acpi_driver_data(device); in acpi_pci_link_allocate_irq()
618 if (!link) { in acpi_pci_link_allocate_irq()
630 if (acpi_pci_link_allocate(link)) { in acpi_pci_link_allocate_irq()
635 if (!link->irq.active) { in acpi_pci_link_allocate_irq()
640 link->refcnt++; in acpi_pci_link_allocate_irq()
644 *triggering = link->irq.triggering; in acpi_pci_link_allocate_irq()
646 *polarity = link->irq.polarity; in acpi_pci_link_allocate_irq()
648 *name = acpi_device_bid(link->device); in acpi_pci_link_allocate_irq()
650 return link->irq.active; in acpi_pci_link_allocate_irq()
660 struct acpi_pci_link *link; in acpi_pci_link_free_irq() local
667 link = acpi_driver_data(device); in acpi_pci_link_free_irq()
668 if (!link) { in acpi_pci_link_free_irq()
674 if (!link->irq.initialized) { in acpi_pci_link_free_irq()
689 link->refcnt--; in acpi_pci_link_free_irq()
693 if (link->refcnt == 0) in acpi_pci_link_free_irq()
694 acpi_evaluate_object(link->device->handle, "_DIS", NULL, NULL); in acpi_pci_link_free_irq()
697 return link->irq.active; in acpi_pci_link_free_irq()
708 struct acpi_pci_link *link; in acpi_pci_link_add() local
712 link = kzalloc(sizeof(struct acpi_pci_link), GFP_KERNEL); in acpi_pci_link_add()
713 if (!link) in acpi_pci_link_add()
716 link->device = device; in acpi_pci_link_add()
719 device->driver_data = link; in acpi_pci_link_add()
722 result = acpi_pci_link_get_possible(link); in acpi_pci_link_add()
727 acpi_pci_link_get_current(link); in acpi_pci_link_add()
730 acpi_device_bid(device), link->irq.active); in acpi_pci_link_add()
732 for (i = 0; i < link->irq.possible_count; i++) { in acpi_pci_link_add()
733 if (link->irq.active != link->irq.possible[i]) in acpi_pci_link_add()
735 link->irq.possible[i]); in acpi_pci_link_add()
738 if (!link->device->status.enabled) in acpi_pci_link_add()
741 list_add_tail(&link->list, &acpi_link_list); in acpi_pci_link_add()
749 kfree(link); in acpi_pci_link_add()
756 static int acpi_pci_link_resume(struct acpi_pci_link *link) in acpi_pci_link_resume() argument
758 if (link->refcnt && link->irq.active && link->irq.initialized) in acpi_pci_link_resume()
759 return (acpi_pci_link_set(link, link->irq.active)); in acpi_pci_link_resume()
766 struct acpi_pci_link *link; in irqrouter_resume() local
768 list_for_each_entry(link, &acpi_link_list, list) { in irqrouter_resume()
769 acpi_pci_link_resume(link); in irqrouter_resume()
775 struct acpi_pci_link *link; in acpi_pci_link_remove() local
777 link = acpi_driver_data(device); in acpi_pci_link_remove()
780 list_del(&link->list); in acpi_pci_link_remove()
783 kfree(link); in acpi_pci_link_remove()