Lines Matching +full:segment +full:- +full:no +full:- +full:remap

1 // SPDX-License-Identifier: GPL-2.0-or-later
3 * pci_irq.c - ACPI PCI Interrupt Routing ($Revision: 11 $)
8 * (c) Copyright 2008 Hewlett-Packard Development Company, L.P.
35 return 'A' + pin - 1; in pin_name()
38 /* --------------------------------------------------------------------------
40 -------------------------------------------------------------------------- */
45 .ident = "Medion MD9580-F laptop",
71 DMI_MATCH(DMI_SYS_VENDOR, "Hewlett-Packard"),
81 unsigned int segment; member
89 #define PCI_INTX_PIN(c) (c - 'A' + 1)
93 * interrupt at the listed segment/bus/device/pin is connected to the first
118 if (dmi_check_system(quirk->system) && in do_prt_fixups()
119 entry->id.segment == quirk->segment && in do_prt_fixups()
120 entry->id.bus == quirk->bus && in do_prt_fixups()
121 entry->id.device == quirk->device && in do_prt_fixups()
122 entry->pin == quirk->pin && in do_prt_fixups()
123 !strcmp(prt->source, quirk->source) && in do_prt_fixups()
124 strlen(prt->source) >= strlen(quirk->actual_source)) { in do_prt_fixups()
128 entry->id.segment, entry->id.bus, in do_prt_fixups()
129 entry->id.device, pin_name(entry->pin), in do_prt_fixups()
130 prt->source, quirk->actual_source); in do_prt_fixups()
131 strcpy(prt->source, quirk->actual_source); in do_prt_fixups()
140 int segment = pci_domain_nr(dev->bus); in acpi_pci_irq_check_entry() local
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()
145 if (((prt->address >> 16) & 0xffff) != device || in acpi_pci_irq_check_entry()
146 prt->pin + 1 != pin) in acpi_pci_irq_check_entry()
147 return -ENODEV; in acpi_pci_irq_check_entry()
151 return -ENOMEM; in acpi_pci_irq_check_entry()
158 entry->id.segment = segment; in acpi_pci_irq_check_entry()
159 entry->id.bus = bus; in acpi_pci_irq_check_entry()
160 entry->id.device = (prt->address >> 16) & 0xFFFF; in acpi_pci_irq_check_entry()
161 entry->pin = prt->pin + 1; in acpi_pci_irq_check_entry()
165 entry->index = prt->source_index; in acpi_pci_irq_check_entry()
169 * --------------- in acpi_pci_irq_check_entry()
180 if (prt->source[0]) in acpi_pci_irq_check_entry()
181 acpi_get_handle(handle, prt->source, &entry->link); in acpi_pci_irq_check_entry()
185 * -------------- in acpi_pci_irq_check_entry()
190 pr_debug("%04x:%02x:%02x[%c] -> %s[%d]\n", in acpi_pci_irq_check_entry()
191 entry->id.segment, entry->id.bus, entry->id.device, in acpi_pci_irq_check_entry()
192 pin_name(entry->pin), prt->source, entry->index); in acpi_pci_irq_check_entry()
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()
211 return -ENODEV; in acpi_pci_irq_find_prt_entry()
213 /* 'handle' is the _PRT's parent (root bridge or PCI-PCI bridge) */ in acpi_pci_irq_find_prt_entry()
217 return -ENODEV; in acpi_pci_irq_find_prt_entry()
221 while (entry && (entry->length > 0)) { in acpi_pci_irq_find_prt_entry()
226 ((unsigned long)entry + entry->length); in acpi_pci_irq_find_prt_entry()
233 /* --------------------------------------------------------------------------
235 -------------------------------------------------------------------------- */
244 for (bus_it = bus ; bus_it ; bus_it = bus_it->parent) { in bridge_has_boot_interrupt_variant()
245 if (!bus_it->self) in bridge_has_boot_interrupt_variant()
247 if (bus_it->self->irq_reroute_variant) in bridge_has_boot_interrupt_variant()
248 return bus_it->self->irq_reroute_variant; in bridge_has_boot_interrupt_variant()
255 * entry in the chipset's IO-APIC is masked (as, e.g. the RT kernel does
266 switch (bridge_has_boot_interrupt_variant(dev->bus)) { in acpi_reroute_boot_interrupt()
268 /* no rerouting necessary */ in acpi_reroute_boot_interrupt()
272 * Remap according to INTx routing table in 6700PXH in acpi_reroute_boot_interrupt()
273 * specs, intel order number 302628-002, section in acpi_reroute_boot_interrupt()
277 dev_info(&dev->dev, "PCI IRQ %d -> rerouted to legacy " in acpi_reroute_boot_interrupt()
278 "IRQ %d\n", entry->index, in acpi_reroute_boot_interrupt()
279 (entry->index % 4) + 16); in acpi_reroute_boot_interrupt()
280 entry->index = (entry->index % 4) + 16; in acpi_reroute_boot_interrupt()
283 dev_warn(&dev->dev, "Cannot reroute IRQ %d to legacy " in acpi_reroute_boot_interrupt()
284 "IRQ: unknown mapping\n", entry->index); in acpi_reroute_boot_interrupt()
285 return -1; in acpi_reroute_boot_interrupt()
303 dev_dbg(&dev->dev, "Found [%c] _PRT entry\n", pin_name(pin)); in acpi_pci_irq_lookup()
309 * PCI interrupt routing entry (eg. yenta bridge and add-in card bridge). in acpi_pci_irq_lookup()
311 bridge = dev->bus->self; in acpi_pci_irq_lookup()
315 if ((bridge->class >> 8) == PCI_CLASS_BRIDGE_CARDBUS) { in acpi_pci_irq_lookup()
317 bridge_pin = bridge->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()
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()
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()
357 return -EINVAL; in acpi_isa_register_gsi()
362 return -ENODEV; in acpi_isa_register_gsi()
370 * On x86 irq line 0xff means "unknown" or "no connection" in acpi_pci_irq_valid()
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()
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()
419 if (dev->class >> 8 == PCI_CLASS_STORAGE_IDE && in acpi_pci_irq_enable()
420 (dev->class & 0x05) == 0) in acpi_pci_irq_enable()
425 if (entry->link) in acpi_pci_irq_enable()
426 gsi = acpi_pci_link_allocate_irq(entry->link, in acpi_pci_irq_enable()
427 entry->index, in acpi_pci_irq_enable()
431 gsi = entry->index; in acpi_pci_irq_enable()
433 gsi = -1; in acpi_pci_irq_enable()
437 * No IRQ known to the ACPI subsystem - maybe the BIOS / 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()
464 snprintf(link_desc, sizeof(link_desc), " -> Link[%s]", link); 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()
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()
499 if (entry->link) in acpi_pci_irq_disable()
500 gsi = acpi_pci_link_free_irq(entry->link); in acpi_pci_irq_disable()
502 gsi = entry->index; in acpi_pci_irq_disable()
507 * TBD: It might be worth clearing dev->irq by magic constant 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()