Lines Matching refs:irq
69 struct acpi_pci_link_irq irq; member
97 struct acpi_resource_irq *p = &resource->data.irq; 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()
168 link->irq.possible_count); in acpi_pci_link_get_possible()
176 int *irq = context; in acpi_pci_link_check_current() local
184 struct acpi_resource_irq *p = &resource->data.irq; in acpi_pci_link_check_current()
193 *irq = p->interrupts[0]; in acpi_pci_link_check_current()
208 *irq = p->interrupts[0]; in acpi_pci_link_check_current()
233 int irq = 0; in acpi_pci_link_get_current() local
235 link->irq.active = 0; in acpi_pci_link_get_current()
257 acpi_pci_link_check_current, &irq); in acpi_pci_link_get_current()
264 if (acpi_strict && !irq) { 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
288 if (!irq) 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()
303 resource->res.data.irq.polarity = 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()
306 resource->res.data.irq.shareable = in acpi_pci_link_set()
309 resource->res.data.irq.shareable = ACPI_SHARED; in acpi_pci_link_set()
310 resource->res.data.irq.interrupt_count = 1; in acpi_pci_link_set()
311 resource->res.data.irq.interrupts[0] = irq; 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()
329 resource->res.data.extended_irq.interrupts[0] = irq; in acpi_pci_link_set()
334 link->irq.resource_type); 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()
451 static int acpi_irq_pci_sharing_penalty(int irq) in acpi_irq_pci_sharing_penalty() argument
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()
477 static int acpi_irq_get_penalty(int irq) in acpi_irq_get_penalty() argument
481 if (irq == sci_irq) in acpi_irq_get_penalty()
484 if (irq < ACPI_MAX_ISA_IRQS) in acpi_irq_get_penalty()
485 return penalty + acpi_isa_irq_penalty[irq]; in acpi_irq_get_penalty()
487 return penalty + acpi_irq_pci_sharing_penalty(irq); in acpi_irq_get_penalty()
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()
531 int irq; in acpi_pci_link_allocate() local
534 if (link->irq.initialized) { 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()
572 if (acpi_irq_get_penalty(irq) > 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()
577 if (acpi_irq_get_penalty(irq) >= PIRQ_PENALTY_ISA_ALWAYS) { 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()
635 if (!link->irq.active) { 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()
650 return link->irq.active; in acpi_pci_link_allocate_irq()
674 if (!link->irq.initialized) { in acpi_pci_link_free_irq()
697 return link->irq.active; in acpi_pci_link_free_irq()
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()
756 if (link->refcnt && link->irq.active && link->irq.initialized) in acpi_pci_link_resume()
757 return (acpi_pci_link_set(link, link->irq.active)); in acpi_pci_link_resume()
793 int irq; in acpi_irq_penalty_update() local
796 retval = get_option(&str, &irq); in acpi_irq_penalty_update()
802 if ((irq < 0) || (irq >= ACPI_MAX_ISA_IRQS)) in acpi_irq_penalty_update()
806 new_penalty = acpi_isa_irq_penalty[irq] + in acpi_irq_penalty_update()
811 acpi_isa_irq_penalty[irq] = new_penalty; in acpi_irq_penalty_update()
825 void acpi_penalize_isa_irq(int irq, int active) in acpi_penalize_isa_irq() argument
827 if ((irq >= 0) && (irq < ARRAY_SIZE(acpi_isa_irq_penalty))) in acpi_penalize_isa_irq()
828 acpi_isa_irq_penalty[irq] += in acpi_penalize_isa_irq()
832 bool acpi_isa_irq_available(int irq) in acpi_isa_irq_available() argument
834 return irq >= 0 && (irq >= ARRAY_SIZE(acpi_isa_irq_penalty) || in acpi_isa_irq_available()
835 acpi_irq_get_penalty(irq) < PIRQ_PENALTY_ISA_ALWAYS); in acpi_isa_irq_available()
838 void acpi_penalize_sci_irq(int irq, int trigger, int polarity) in acpi_penalize_sci_irq() argument
840 sci_irq = irq; in acpi_penalize_sci_irq()