changeset 2980:58e8c2989931

6418018 x64: bus_type not set for PCIe devices that use interrupts
author rs90106
date Wed, 25 Oct 2006 02:41:04 -0700
parents 6d134878cca1
children b80f5da0b8ed
files usr/src/cmd/mdb/i86pc/modules/pcplusmp/apic.c usr/src/uts/i86pc/io/pcplusmp/apic.c usr/src/uts/intel/sys/acpica.h
diffstat 3 files changed, 23 insertions(+), 17 deletions(-) [+]
line wrap: on
line diff
--- a/usr/src/cmd/mdb/i86pc/modules/pcplusmp/apic.c	Tue Oct 24 12:56:47 2006 -0700
+++ b/usr/src/cmd/mdb/i86pc/modules/pcplusmp/apic.c	Wed Oct 25 02:41:04 2006 -0700
@@ -40,7 +40,7 @@
 	"ISA",
 	"MBI",
 	"MBII",
-	" ",
+	"PCIe",
 	"MPI",
 	"MPSA",
 	"NUBUS",
--- a/usr/src/uts/i86pc/io/pcplusmp/apic.c	Tue Oct 24 12:56:47 2006 -0700
+++ b/usr/src/uts/i86pc/io/pcplusmp/apic.c	Wed Oct 25 02:41:04 2006 -0700
@@ -3103,14 +3103,27 @@
 	APIC_HEADER	*hp;
 	MADT_INTERRUPT_OVERRIDE	*isop;
 	apic_irq_t *airqp;
+	int is_pciex = 0;
+	int is_pci = 0;
 
 	DDI_INTR_IMPLDBG((CE_CONT, "apic_introp_xlate: dip=0x%p name=%s "
 	    "type=%d irqno=0x%x\n", (void *)dip, ddi_get_name(dip), type,
 	    irqno));
 
+	dev_len = sizeof (dev_type);
+	if (ddi_getlongprop_buf(DDI_DEV_T_ANY, ddi_get_parent(dip),
+	    DDI_PROP_DONTPASS, "device_type", (caddr_t)dev_type,
+	    &dev_len) == DDI_PROP_SUCCESS) {
+		is_pci = (strcmp(dev_type, "pci") == 0);
+		is_pciex = (strcmp(dev_type, "pciex") == 0);
+	}
+
 	if (DDI_INTR_IS_MSI_OR_MSIX(type)) {
-		if ((airqp = apic_find_irq(dip, ispec, type)) != NULL)
+		if ((airqp = apic_find_irq(dip, ispec, type)) != NULL) {
+			airqp->airq_iflag.bustype =
+			    is_pciex ? BUS_PCIE : BUS_PCI;
 			return (apic_vector_to_irq[airqp->airq_vector]);
+		}
 		return (apic_setup_irq_table(dip, irqno, NULL, ispec,
 		    NULL, type));
 	}
@@ -3141,15 +3154,7 @@
 	if ((dip == NULL) || (!apic_irq_translate && !apic_enable_acpi))
 		goto nonpci;
 
-	dev_len = sizeof (dev_type);
-	if (ddi_getlongprop_buf(DDI_DEV_T_ANY, ddi_get_parent(dip),
-	    DDI_PROP_DONTPASS, "device_type", (caddr_t)dev_type,
-	    &dev_len) != DDI_PROP_SUCCESS) {
-		goto nonpci;
-	}
-
-	if ((strcmp(dev_type, "pci") == 0) ||
-	    (strcmp(dev_type, "pciex") == 0)) {
+	if (is_pci || is_pciex) {
 		/* pci device */
 		if (acpica_get_bdf(dip, &busid, &devid, NULL) != 0)
 			goto nonpci;
@@ -3165,7 +3170,7 @@
 			    ipin, &pci_irq, &intr_flag) != ACPI_PSM_SUCCESS)
 				goto nonpci;
 
-			intr_flag.bustype = BUS_PCI;
+			intr_flag.bustype = is_pciex ? BUS_PCIE : BUS_PCI;
 			if ((newirq = apic_setup_irq_table(dip, pci_irq, NULL,
 			    ispec, &intr_flag, type)) == -1)
 				goto nonpci;
@@ -3800,7 +3805,8 @@
 	"MPSA ", BUS_MPSA,
 	"NUBUS ", BUS_NUBUS,
 	"TC ", BUS_TC,
-	"VME ", BUS_VME
+	"VME ", BUS_VME,
+	"PCI-E ", BUS_PCIE
 };
 
 static int
--- a/usr/src/uts/intel/sys/acpica.h	Tue Oct 24 12:56:47 2006 -0700
+++ b/usr/src/uts/intel/sys/acpica.h	Wed Oct 25 02:41:04 2006 -0700
@@ -2,9 +2,8 @@
  * CDDL HEADER START
  *
  * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License").  You may not use this file except in compliance
- * with the License.
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
  *
  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
  * or http://www.opensolaris.org/os/licensing.
@@ -20,7 +19,7 @@
  * CDDL HEADER END
  */
 /*
- * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  */
 
@@ -98,6 +97,7 @@
 #define	BUS_ISA		6
 #define	BUS_MBI		7
 #define	BUS_MBII	8
+#define	BUS_PCIE	9
 #define	BUS_MPI		10
 #define	BUS_MPSA	11
 #define	BUS_NUBUS	12