Lines Matching refs:dev
136 static int acpi_pci_irq_check_entry(acpi_handle handle, struct pci_dev *dev, in acpi_pci_irq_check_entry() argument
140 int segment = pci_domain_nr(dev->bus); in acpi_pci_irq_check_entry()
141 int bus = dev->bus->number; in acpi_pci_irq_check_entry()
142 int device = pci_ari_enabled(dev->bus) ? 0 : PCI_SLOT(dev->devfn); in acpi_pci_irq_check_entry()
199 static int acpi_pci_irq_find_prt_entry(struct pci_dev *dev, in acpi_pci_irq_find_prt_entry() argument
207 if (dev->bus->bridge) in acpi_pci_irq_find_prt_entry()
208 handle = ACPI_HANDLE(dev->bus->bridge); in acpi_pci_irq_find_prt_entry()
222 if (!acpi_pci_irq_check_entry(handle, dev, pin, in acpi_pci_irq_find_prt_entry()
260 static int acpi_reroute_boot_interrupt(struct pci_dev *dev, in acpi_reroute_boot_interrupt() argument
266 switch (bridge_has_boot_interrupt_variant(dev->bus)) { in acpi_reroute_boot_interrupt()
277 dev_info(&dev->dev, "PCI IRQ %d -> rerouted to legacy " in acpi_reroute_boot_interrupt()
283 dev_warn(&dev->dev, "Cannot reroute IRQ %d to legacy " in acpi_reroute_boot_interrupt()
291 static struct acpi_prt_entry *acpi_pci_irq_lookup(struct pci_dev *dev, int pin) in acpi_pci_irq_lookup() argument
298 ret = acpi_pci_irq_find_prt_entry(dev, pin, &entry); in acpi_pci_irq_lookup()
301 acpi_reroute_boot_interrupt(dev, entry); in acpi_pci_irq_lookup()
303 dev_dbg(&dev->dev, "Found [%c] _PRT entry\n", pin_name(pin)); in acpi_pci_irq_lookup()
311 bridge = dev->bus->self; in acpi_pci_irq_lookup()
313 pin = pci_swizzle_interrupt_pin(dev, pin); in acpi_pci_irq_lookup()
319 dev_dbg(&bridge->dev, "No interrupt pin configured\n"); in acpi_pci_irq_lookup()
327 dev_dbg(&dev->dev, "Derived GSI INT %c from %s\n", in acpi_pci_irq_lookup()
332 dev = bridge; in acpi_pci_irq_lookup()
333 bridge = dev->bus->self; in acpi_pci_irq_lookup()
336 dev_warn(&dev->dev, "can't derive routing for PCI INT %c\n", in acpi_pci_irq_lookup()
342 static int acpi_isa_register_gsi(struct pci_dev *dev) in acpi_isa_register_gsi() argument
347 if (dev->irq > 0 && (dev->irq <= 0xF) && in acpi_isa_register_gsi()
348 acpi_isa_irq_available(dev->irq) && in acpi_isa_register_gsi()
349 (acpi_isa_irq_to_gsi(dev->irq, &dev_gsi) == 0)) { in acpi_isa_register_gsi()
350 dev_warn(&dev->dev, "PCI INT %c: no GSI - using ISA IRQ %d\n", in acpi_isa_register_gsi()
351 pin_name(dev->pin), dev->irq); in acpi_isa_register_gsi()
352 acpi_register_gsi(&dev->dev, dev_gsi, in acpi_isa_register_gsi()
360 static inline int acpi_isa_register_gsi(struct pci_dev *dev) in acpi_isa_register_gsi() argument
366 static inline bool acpi_pci_irq_valid(struct pci_dev *dev, u8 pin) in acpi_pci_irq_valid() argument
373 if (dev->irq == 0xff) { in acpi_pci_irq_valid()
374 dev->irq = IRQ_NOTCONNECTED; in acpi_pci_irq_valid()
375 dev_warn(&dev->dev, "PCI INT %c: not connected\n", in acpi_pci_irq_valid()
383 int acpi_pci_irq_enable(struct pci_dev *dev) in acpi_pci_irq_enable() argument
404 pin = dev->pin; in acpi_pci_irq_enable()
406 dev_dbg(&dev->dev, "No interrupt pin configured\n"); in acpi_pci_irq_enable()
410 if (dev->irq_managed && dev->irq > 0) in acpi_pci_irq_enable()
413 entry = acpi_pci_irq_lookup(dev, pin); in acpi_pci_irq_enable()
419 if (dev->class >> 8 == PCI_CLASS_STORAGE_IDE && in acpi_pci_irq_enable()
420 (dev->class & 0x05) == 0) in acpi_pci_irq_enable()
440 if (!acpi_pci_irq_valid(dev, pin)) { in acpi_pci_irq_enable()
445 if (acpi_isa_register_gsi(dev)) in acpi_pci_irq_enable()
446 dev_warn(&dev->dev, "PCI INT %c: no GSI\n", in acpi_pci_irq_enable()
453 rc = acpi_register_gsi(&dev->dev, gsi, triggering, polarity); in acpi_pci_irq_enable()
455 dev_warn(&dev->dev, "PCI INT %c: failed to register GSI\n", in acpi_pci_irq_enable()
460 dev->irq = rc; in acpi_pci_irq_enable()
461 dev->irq_managed = 1; in acpi_pci_irq_enable()
468 dev_dbg(&dev->dev, "PCI INT %c%s -> GSI %u (%s, %s) -> IRQ %d\n", in acpi_pci_irq_enable()
471 (polarity == ACPI_ACTIVE_LOW) ? "low" : "high", dev->irq); in acpi_pci_irq_enable()
477 void acpi_pci_irq_disable(struct pci_dev *dev) in acpi_pci_irq_disable() argument
483 pin = dev->pin; in acpi_pci_irq_disable()
484 if (!pin || !dev->irq_managed || dev->irq <= 0) in acpi_pci_irq_disable()
488 if (dev->dev.power.is_prepared) in acpi_pci_irq_disable()
491 if (dev->dev.power.runtime_status == RPM_SUSPENDING) in acpi_pci_irq_disable()
495 entry = acpi_pci_irq_lookup(dev, pin); in acpi_pci_irq_disable()
511 dev_dbg(&dev->dev, "PCI INT %c disabled\n", pin_name(pin)); in acpi_pci_irq_disable()
514 dev->irq_managed = 0; in acpi_pci_irq_disable()