changeset 926:b35734c182ef

6311029 update pci interrupt line information after configuring pci interrupts
author myers
date Tue, 15 Nov 2005 14:03:50 -0800
parents f4f8625e078f
children 9d181bf77293
files usr/src/uts/i86pc/io/psm/uppc.c
diffstat 1 files changed, 19 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/usr/src/uts/i86pc/io/psm/uppc.c	Tue Nov 15 13:32:57 2005 -0800
+++ b/usr/src/uts/i86pc/io/psm/uppc.c	Tue Nov 15 14:03:50 2005 -0800
@@ -728,7 +728,7 @@
 	char dev_type[16];
 	int dev_len, pci_irq, devid, busid;
 	ddi_acc_handle_t cfg_handle;
-	uchar_t ipin;
+	uchar_t ipin, iline;
 	iflag_t intr_flag;
 
 	if (dip == NULL) {
@@ -762,7 +762,7 @@
 			return (irqno);
 
 		ipin = pci_config_get8(cfg_handle, PCI_CONF_IPIN) - PCI_INTA;
-		pci_config_teardown(&cfg_handle);
+		iline = pci_config_get8(cfg_handle, PCI_CONF_ILINE);
 		if (uppc_acpi_translate_pci_irq(dip, busid, devid,
 		    ipin, &pci_irq, &intr_flag) == ACPI_PSM_SUCCESS) {
 
@@ -774,9 +774,25 @@
 			 * Make sure pci_irq is within range.
 			 * Otherwise, fall through and return irqno.
 			 */
-			if (pci_irq <= MAX_ISA_IRQ)
+			if (pci_irq <= MAX_ISA_IRQ) {
+				if (iline != pci_irq) {
+					/*
+					 * Update the device's ILINE byte,
+					 * in case uppc_acpi_translate_pci_irq
+					 * has choosen a different pci_irq
+					 * than the BIOS has configured.
+					 * Some chipsets use the value in
+					 * ILINE to control interrupt routing,
+					 * in conflict with the PCI spec.
+					 */
+					pci_config_put8(cfg_handle,
+					    PCI_CONF_ILINE, pci_irq);
+				}
+				pci_config_teardown(&cfg_handle);
 				return (pci_irq);
+			}
 		}
+		pci_config_teardown(&cfg_handle);
 
 		/* FALLTHRU to common case - returning irqno */
 	} else {