diff --git a/sys/amd64/pci/pci_cfgreg.c b/sys/amd64/pci/pci_cfgreg.c index 8ac47ee40340..825d9b73e5f3 100644 --- a/sys/amd64/pci/pci_cfgreg.c +++ b/sys/amd64/pci/pci_cfgreg.c @@ -267,10 +267,10 @@ pci_cfgintr(int bus, int device, int pin) continue; irq = pci_cfgintr_linked(pe, pin); - if (irq != 255) - already = 1; if (irq == 255) irq = pci_cfgintr_unique(pe, pin); + if (irq != 255) + already = 1; if (irq == 255) irq = pci_cfgintr_virgin(pe, pin); if (irq == 255) @@ -282,7 +282,7 @@ pci_cfgintr(int bus, int device, int pin) args.eax = PCIBIOS_ROUTE_INTERRUPT; args.ebx = (bus << 8) | (device << 3); args.ecx = (irq << 8) | (0xa + pin - 1); /* pin value is 0xa - 0xd */ - if (bios32(&args, PCIbios.ventry, GSEL(GCODE_SEL, SEL_KPL)) && !already) { + if (!already && bios32(&args, PCIbios.ventry, GSEL(GCODE_SEL, SEL_KPL))) { /* * XXX if it fails, we should try to smack the router * hardware directly. diff --git a/sys/i386/pci/pci_cfgreg.c b/sys/i386/pci/pci_cfgreg.c index 8ac47ee40340..825d9b73e5f3 100644 --- a/sys/i386/pci/pci_cfgreg.c +++ b/sys/i386/pci/pci_cfgreg.c @@ -267,10 +267,10 @@ pci_cfgintr(int bus, int device, int pin) continue; irq = pci_cfgintr_linked(pe, pin); - if (irq != 255) - already = 1; if (irq == 255) irq = pci_cfgintr_unique(pe, pin); + if (irq != 255) + already = 1; if (irq == 255) irq = pci_cfgintr_virgin(pe, pin); if (irq == 255) @@ -282,7 +282,7 @@ pci_cfgintr(int bus, int device, int pin) args.eax = PCIBIOS_ROUTE_INTERRUPT; args.ebx = (bus << 8) | (device << 3); args.ecx = (irq << 8) | (0xa + pin - 1); /* pin value is 0xa - 0xd */ - if (bios32(&args, PCIbios.ventry, GSEL(GCODE_SEL, SEL_KPL)) && !already) { + if (!already && bios32(&args, PCIbios.ventry, GSEL(GCODE_SEL, SEL_KPL))) { /* * XXX if it fails, we should try to smack the router * hardware directly. diff --git a/sys/i386/pci/pci_pir.c b/sys/i386/pci/pci_pir.c index 8ac47ee40340..825d9b73e5f3 100644 --- a/sys/i386/pci/pci_pir.c +++ b/sys/i386/pci/pci_pir.c @@ -267,10 +267,10 @@ pci_cfgintr(int bus, int device, int pin) continue; irq = pci_cfgintr_linked(pe, pin); - if (irq != 255) - already = 1; if (irq == 255) irq = pci_cfgintr_unique(pe, pin); + if (irq != 255) + already = 1; if (irq == 255) irq = pci_cfgintr_virgin(pe, pin); if (irq == 255) @@ -282,7 +282,7 @@ pci_cfgintr(int bus, int device, int pin) args.eax = PCIBIOS_ROUTE_INTERRUPT; args.ebx = (bus << 8) | (device << 3); args.ecx = (irq << 8) | (0xa + pin - 1); /* pin value is 0xa - 0xd */ - if (bios32(&args, PCIbios.ventry, GSEL(GCODE_SEL, SEL_KPL)) && !already) { + if (!already && bios32(&args, PCIbios.ventry, GSEL(GCODE_SEL, SEL_KPL))) { /* * XXX if it fails, we should try to smack the router * hardware directly.