patch-2.4.22 linux-2.4.22/arch/mips/gt64120/ev64120/fixup-ev64120.c

Next file: linux-2.4.22/arch/mips/gt64120/ev64120/int-handler.S
Previous file: linux-2.4.22/arch/mips/gt64120/ev64120/Makefile
Back to the patch index
Back to the overall index

diff -urN linux-2.4.21/arch/mips/gt64120/ev64120/fixup-ev64120.c linux-2.4.22/arch/mips/gt64120/ev64120/fixup-ev64120.c
@@ -0,0 +1,35 @@
+#include <linux/pci.h>
+#include <linux/init.h>
+
+int pci_range_ck(unsigned char bus, unsigned char dev)
+{
+	if (((bus == 0) || (bus == 1)) && (dev >= 6) && (dev <= 8))
+		return 0;
+
+	return -1;
+}
+
+/*
+ * After detecting all agents over the PCI , this function is called
+ * in order to give an interrupt number for each PCI device starting
+ * from IRQ 20. It does also enables master for each device.
+ */
+void __init gt64120_board_pcibios_fixup_bus(struct pci_bus *bus)
+{
+	unsigned int irq = 20;
+	struct pci_bus *current_bus = bus;
+	struct pci_dev *dev;
+	struct list_head *devices_link;
+
+	list_for_each(devices_link, &(current_bus->devices)) {
+		dev = pci_dev_b(devices_link);
+		if (dev != NULL) {
+			dev->irq = irq++;
+
+			/* Assign an interrupt number for the device */
+			pcibios_write_config_byte(bus, dev->devfn,
+			                          PCI_INTERRUPT_LINE, irq);
+			pcibios_set_master(dev);
+		}
+	}
+}

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