patch-2.4.22 linux-2.4.22/drivers/sbus/sbus.c

Next file: linux-2.4.22/drivers/scsi/3w-xxxx.c
Previous file: linux-2.4.22/drivers/s390/s390mach.c
Back to the patch index
Back to the overall index

diff -urN linux-2.4.21/drivers/sbus/sbus.c linux-2.4.22/drivers/sbus/sbus.c
@@ -20,6 +20,13 @@
 struct sbus_bus *sbus_root = NULL;
 
 static struct linux_prom_irqs irqs[PROMINTR_MAX] __initdata = { { 0 } };
+#ifdef CONFIG_SPARC32
+static int interrupts[PROMINTR_MAX] __initdata = { 0 };
+#endif
+
+#ifdef CONFIG_PCI
+extern int pcic_present(void);
+#endif
 
 /* Perhaps when I figure out more about the iommu we'll put a
  * device registration routine here that probe_sbus() calls to
@@ -122,20 +129,37 @@
 #else
 	len = prom_getproperty(prom_node, "intr",
 			       (char *)irqs, sizeof(irqs));
-	if (len == -1)
-		len = 0;
-	sdev->num_irqs = len / 8;
-	if (sdev->num_irqs == 0) {
-		sdev->irqs[0] = 0;
-	} else if (sparc_cpu_model == sun4d) {
-		extern unsigned int sun4d_build_irq(struct sbus_dev *sdev, int irq);
+	if (len != -1) {
+		sdev->num_irqs = len / 8;
+		if (sdev->num_irqs == 0) {
+			sdev->irqs[0] = 0;
+		} else if (sparc_cpu_model == sun4d) {
+			extern unsigned int sun4d_build_irq(struct sbus_dev *sdev, int irq);
 
-		for (len = 0; len < sdev->num_irqs; len++)
-			sdev->irqs[len] = sun4d_build_irq(sdev, irqs[len].pri);
+			for (len = 0; len < sdev->num_irqs; len++)
+				sdev->irqs[len] = sun4d_build_irq(sdev, irqs[len].pri);
+		} else {
+			for (len = 0; len < sdev->num_irqs; len++)
+				sdev->irqs[len] = irqs[len].pri;
+		}
 	} else {
-		for (len = 0; len < sdev->num_irqs; len++)
-			sdev->irqs[len] = irqs[len].pri;
-	}
+		/* No "intr" node found-- check for "interrupts" node.
+		 * This node contains SBus interrupt levels, not IPLs
+		 * as in "intr", and no vector values.  We convert 
+		 * SBus interrupt levels to PILs (platform specific).
+		 */
+		len = prom_getproperty(prom_node, "interrupts", 
+					(char *)interrupts, sizeof(interrupts));
+		if (len == -1) {
+			sdev->irqs[0] = 0;
+			sdev->num_irqs = 0;
+		} else {
+			sdev->num_irqs = len / sizeof(int);
+			for (len = 0; len < sdev->num_irqs; len++) {
+				sdev->irqs[len] = sbint_to_irq(sdev, interrupts[len]);
+			}
+		}
+	} 
 #endif /* !__sparc_v9__ */
 }
 
@@ -308,7 +332,7 @@
 		nd = prom_searchsiblings(topnd, "sbus");
 		if(nd == 0) {
 #ifdef CONFIG_PCI
-			if (!pcibios_present()) {	
+			if (!pcic_present()) {	
 				prom_printf("Neither SBUS nor PCI found.\n");
 				prom_halt();
 			} else {
@@ -333,7 +357,7 @@
 		   (nd = prom_getchild(iommund)) == 0 ||
 		   (nd = prom_searchsiblings(nd, "sbus")) == 0) {
 #ifdef CONFIG_PCI
-                        if (!pcibios_present()) {       
+                        if (!pcic_present()) {       
                                 prom_printf("Neither SBUS nor PCI found.\n");
                                 prom_halt();
                         }

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)