• Home
  • Raw
  • Download

Lines Matching full:irq

10  *	1. Support more than one IRQ resource entry per link device (index).
12 * for IRQ management (e.g. start()->_SRS).
26 #include <linux/irq.h>
53 * later even the link is disable. Instead, we just repick the active irq
56 u32 active; /* Current IRQ */
69 struct acpi_pci_link_irq irq; member
96 struct acpi_resource_irq *p = &resource->data.irq; in acpi_pci_link_check_possible()
99 "Blank _PRS IRQ resource\n")); in acpi_pci_link_check_possible()
107 "Invalid _PRS IRQ %d\n", in acpi_pci_link_check_possible()
111 link->irq.possible[i] = p->interrupts[i]; in acpi_pci_link_check_possible()
112 link->irq.possible_count++; in acpi_pci_link_check_possible()
114 link->irq.triggering = p->triggering; in acpi_pci_link_check_possible()
115 link->irq.polarity = p->polarity; in acpi_pci_link_check_possible()
116 link->irq.resource_type = ACPI_RESOURCE_TYPE_IRQ; in acpi_pci_link_check_possible()
125 "Blank _PRS EXT IRQ resource\n"); in acpi_pci_link_check_possible()
133 "Invalid _PRS IRQ %d\n", in acpi_pci_link_check_possible()
137 link->irq.possible[i] = p->interrupts[i]; in acpi_pci_link_check_possible()
138 link->irq.possible_count++; in acpi_pci_link_check_possible()
140 link->irq.triggering = p->triggering; in acpi_pci_link_check_possible()
141 link->irq.polarity = p->polarity; in acpi_pci_link_check_possible()
142 link->irq.resource_type = ACPI_RESOURCE_TYPE_EXTENDED_IRQ; in acpi_pci_link_check_possible()
146 printk(KERN_ERR PREFIX "_PRS resource type 0x%x isn't an IRQ\n", in acpi_pci_link_check_possible()
167 link->irq.possible_count)); in acpi_pci_link_get_possible()
175 int *irq = context; in acpi_pci_link_check_current() local
183 struct acpi_resource_irq *p = &resource->data.irq; in acpi_pci_link_check_current()
186 * IRQ descriptors may have no IRQ# bits set, in acpi_pci_link_check_current()
190 "Blank _CRS IRQ resource\n")); in acpi_pci_link_check_current()
193 *irq = p->interrupts[0]; in acpi_pci_link_check_current()
202 * extended IRQ descriptors must in acpi_pci_link_check_current()
203 * return at least 1 IRQ in acpi_pci_link_check_current()
206 "Blank _CRS EXT IRQ resource\n"); in acpi_pci_link_check_current()
209 *irq = p->interrupts[0]; in acpi_pci_link_check_current()
214 printk(KERN_ERR PREFIX "_CRS resource type 0x%x isn't an IRQ\n", in acpi_pci_link_check_current()
223 * Run _CRS and set link->irq.active
233 int irq = 0; in acpi_pci_link_get_current() local
235 link->irq.active = 0; in acpi_pci_link_get_current()
253 * Query and parse _CRS to get the current IRQ assignment. 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_DEBUG_PRINT((ACPI_DB_INFO, "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
287 if (!irq) in acpi_pci_link_set()
297 switch (link->irq.resource_type) { in acpi_pci_link_set()
301 resource->res.data.irq.triggering = link->irq.triggering; in acpi_pci_link_set()
302 resource->res.data.irq.polarity = in acpi_pci_link_set()
303 link->irq.polarity; in acpi_pci_link_set()
304 if (link->irq.triggering == ACPI_EDGE_SENSITIVE) in acpi_pci_link_set()
305 resource->res.data.irq.shareable = in acpi_pci_link_set()
308 resource->res.data.irq.shareable = ACPI_SHARED; in acpi_pci_link_set()
309 resource->res.data.irq.interrupt_count = 1; in acpi_pci_link_set()
310 resource->res.data.irq.interrupts[0] = irq; in acpi_pci_link_set()
319 link->irq.triggering; in acpi_pci_link_set()
321 link->irq.polarity; in acpi_pci_link_set()
322 if (link->irq.triggering == ACPI_EDGE_SENSITIVE) in acpi_pci_link_set()
328 resource->res.data.extended_irq.interrupts[0] = irq; in acpi_pci_link_set()
332 printk(KERN_ERR PREFIX "Invalid Resource_type %d\n", link->irq.resource_type); in acpi_pci_link_set()
363 /* Query _CRS, set link->irq.active */ in acpi_pci_link_set()
371 * set link->irq.active in acpi_pci_link_set()
373 if (link->irq.active != irq) { in acpi_pci_link_set()
379 "%s [%s] BIOS reported IRQ %d, using IRQ %d\n", in acpi_pci_link_set()
381 acpi_device_bid(link->device), link->irq.active, irq); in acpi_pci_link_set()
382 link->irq.active = irq; in acpi_pci_link_set()
385 ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Set IRQ %d\n", link->irq.active)); in acpi_pci_link_set()
393 PCI Link IRQ Management
415 * Note that PCI IRQ routers have a list of possible IRQs,
455 static int acpi_irq_pci_sharing_penalty(int irq) in acpi_irq_pci_sharing_penalty() argument
463 * If a link is active, penalize its IRQ heavily in acpi_irq_pci_sharing_penalty()
464 * so we try to choose a different IRQ. in acpi_irq_pci_sharing_penalty()
466 if (link->irq.active && link->irq.active == irq) in acpi_irq_pci_sharing_penalty()
472 for (i = 0; i < link->irq.possible_count; i++) in acpi_irq_pci_sharing_penalty()
473 if (link->irq.possible[i] == irq) in acpi_irq_pci_sharing_penalty()
475 link->irq.possible_count; in acpi_irq_pci_sharing_penalty()
481 static int acpi_irq_get_penalty(int irq) in acpi_irq_get_penalty() argument
485 if (irq == sci_irq) in acpi_irq_get_penalty()
488 if (irq < ACPI_MAX_ISA_IRQS) in acpi_irq_get_penalty()
489 return penalty + acpi_isa_irq_penalty[irq]; in acpi_irq_get_penalty()
491 return penalty + acpi_irq_pci_sharing_penalty(irq); in acpi_irq_get_penalty()
500 * Update penalties to facilitate IRQ balancing. in acpi_irq_penalty_init()
508 if (link->irq.possible_count) { in acpi_irq_penalty_init()
511 link->irq.possible_count; in acpi_irq_penalty_init()
513 for (i = 0; i < link->irq.possible_count; i++) { in acpi_irq_penalty_init()
514 if (link->irq.possible[i] < ACPI_MAX_ISA_IRQS) in acpi_irq_penalty_init()
515 acpi_isa_irq_penalty[link->irq. in acpi_irq_penalty_init()
520 } else if (link->irq.active && in acpi_irq_penalty_init()
521 (link->irq.active < ACPI_MAX_ISA_IRQS)) { in acpi_irq_penalty_init()
522 acpi_isa_irq_penalty[link->irq.active] += in acpi_irq_penalty_init()
534 int irq; in acpi_pci_link_allocate() local
537 if (link->irq.initialized) { in acpi_pci_link_allocate()
540 acpi_pci_link_set(link, link->irq.active); in acpi_pci_link_allocate()
545 * search for active IRQ in list of possible IRQs. in acpi_pci_link_allocate()
547 for (i = 0; i < link->irq.possible_count; ++i) { in acpi_pci_link_allocate()
548 if (link->irq.active == link->irq.possible[i]) in acpi_pci_link_allocate()
552 * forget active IRQ that is not in possible list in acpi_pci_link_allocate()
554 if (i == link->irq.possible_count) { in acpi_pci_link_allocate()
557 " in _PRS\n", link->irq.active); in acpi_pci_link_allocate()
558 link->irq.active = 0; in acpi_pci_link_allocate()
564 if (link->irq.active) in acpi_pci_link_allocate()
565 irq = link->irq.active; in acpi_pci_link_allocate()
567 irq = link->irq.possible[link->irq.possible_count - 1]; in acpi_pci_link_allocate()
569 if (acpi_irq_balance || !link->irq.active) { in acpi_pci_link_allocate()
571 * Select the best IRQ. This is done in reverse to promote in acpi_pci_link_allocate()
574 for (i = (link->irq.possible_count - 1); i >= 0; i--) { in acpi_pci_link_allocate()
575 if (acpi_irq_get_penalty(irq) > in acpi_pci_link_allocate()
576 acpi_irq_get_penalty(link->irq.possible[i])) in acpi_pci_link_allocate()
577 irq = link->irq.possible[i]; in acpi_pci_link_allocate()
580 if (acpi_irq_get_penalty(irq) >= PIRQ_PENALTY_ISA_ALWAYS) { in acpi_pci_link_allocate()
581 printk(KERN_ERR PREFIX "No IRQ available for %s [%s]. " in acpi_pci_link_allocate()
588 /* Attempt to enable the link device at this IRQ. */ in acpi_pci_link_allocate()
589 if (acpi_pci_link_set(link, irq)) { in acpi_pci_link_allocate()
590 printk(KERN_ERR PREFIX "Unable to set IRQ for %s [%s]. " in acpi_pci_link_allocate()
596 if (link->irq.active < ACPI_MAX_ISA_IRQS) in acpi_pci_link_allocate()
597 acpi_isa_irq_penalty[link->irq.active] += in acpi_pci_link_allocate()
600 pr_info("%s [%s] enabled at IRQ %d\n", in acpi_pci_link_allocate()
602 acpi_device_bid(link->device), link->irq.active); in acpi_pci_link_allocate()
605 link->irq.initialized = 1; in acpi_pci_link_allocate()
611 * success: return IRQ >= 0
633 /* TBD: Support multiple index (IRQ) entries per Link Device */ in acpi_pci_link_allocate_irq()
645 if (!link->irq.active) { in acpi_pci_link_allocate_irq()
647 printk(KERN_ERR PREFIX "Link active IRQ is 0!\n"); in acpi_pci_link_allocate_irq()
654 *triggering = link->irq.triggering; in acpi_pci_link_allocate_irq()
656 *polarity = link->irq.polarity; in acpi_pci_link_allocate_irq()
662 return link->irq.active; in acpi_pci_link_allocate_irq()
666 * We don't change link's irq information here. After it is reenabled, we
688 if (!link->irq.initialized) { in acpi_pci_link_free_irq()
713 return link->irq.active; in acpi_pci_link_free_irq()
742 /* query and set link->irq.active */ in acpi_pci_link_add()
747 for (i = 0; i < link->irq.possible_count; i++) { in acpi_pci_link_add()
748 if (link->irq.active == link->irq.possible[i]) { in acpi_pci_link_add()
749 printk(KERN_CONT " *%d", link->irq.possible[i]); in acpi_pci_link_add()
752 printk(KERN_CONT " %d", link->irq.possible[i]); in acpi_pci_link_add()
758 printk(KERN_CONT " *%d", link->irq.active); in acpi_pci_link_add()
780 if (link->refcnt && link->irq.active && link->irq.initialized) in acpi_pci_link_resume()
781 return (acpi_pci_link_set(link, link->irq.active)); in acpi_pci_link_resume()
817 int irq; in acpi_irq_penalty_update() local
820 retval = get_option(&str, &irq); in acpi_irq_penalty_update()
825 /* see if this is a ISA IRQ */ in acpi_irq_penalty_update()
826 if ((irq < 0) || (irq >= ACPI_MAX_ISA_IRQS)) in acpi_irq_penalty_update()
830 new_penalty = acpi_isa_irq_penalty[irq] + in acpi_irq_penalty_update()
835 acpi_isa_irq_penalty[irq] = new_penalty; in acpi_irq_penalty_update()
849 void acpi_penalize_isa_irq(int irq, int active) in acpi_penalize_isa_irq() argument
851 if ((irq >= 0) && (irq < ARRAY_SIZE(acpi_isa_irq_penalty))) in acpi_penalize_isa_irq()
852 acpi_isa_irq_penalty[irq] += in acpi_penalize_isa_irq()
856 bool acpi_isa_irq_available(int irq) in acpi_isa_irq_available() argument
858 return irq >= 0 && (irq >= ARRAY_SIZE(acpi_isa_irq_penalty) || in acpi_isa_irq_available()
859 acpi_irq_get_penalty(irq) < PIRQ_PENALTY_ISA_ALWAYS); in acpi_isa_irq_available()
862 void acpi_penalize_sci_irq(int irq, int trigger, int polarity) in acpi_penalize_sci_irq() argument
864 sci_irq = irq; in acpi_penalize_sci_irq()
888 * Used for acpi_irq_balance to free up IRQs to reduce PCI IRQ sharing.