]> git.hungrycats.org Git - linux/commitdiff
SPARC: Implement pcic_present which walks OBP tree, use it always in sbus_init.
authorDavid S. Miller <davem@nuts.ninka.net>
Sun, 11 Aug 2002 11:10:05 +0000 (04:10 -0700)
committerDavid S. Miller <davem@nuts.ninka.net>
Sun, 11 Aug 2002 11:10:05 +0000 (04:10 -0700)
arch/sparc64/kernel/pci.c
drivers/sbus/sbus.c

index a62117792d7c7898fb43da30c2ac2ba722aea005..6a727f998a4b3e9d3c7a1545f7dfc6a615d0265d 100644 (file)
@@ -114,6 +114,53 @@ static void pci_controller_init(char *model_name, int namelen, int node)
        printk("PCI: Ignoring controller...\n");
 }
 
+static int pci_is_controller(char *model_name, int namelen, int node)
+{
+       int i;
+
+       for (i = 0; i < PCI_NUM_CONTROLLER_TYPES; i++) {
+               if (!strncmp(model_name,
+                            pci_controller_table[i].model_name,
+                            namelen)) {
+                       return 1;
+               }
+       }
+       return 0;
+}
+
+/* Is there some PCI controller in the system?  */
+int pcic_present(void)
+{
+       char namebuf[16];
+       int node;
+
+       node = prom_getchild(prom_root_node);
+       while ((node = prom_searchsiblings(node, "pci")) != 0) {
+               int len, ret;
+
+               len = prom_getproperty(node, "model",
+                                      namebuf, sizeof(namebuf));
+
+               ret = 0;
+               if (len > 0) {
+                       ret = pci_is_controller(namebuf, len, node);
+               } else {
+                       len = prom_getproperty(node, "compatible",
+                                              namebuf, sizeof(namebuf));
+                       if (len > 0)
+                               ret = pci_controller_init(namebuf, len, node);
+               }
+               if (ret)
+                       return ret;
+
+               node = prom_getsibling(node);
+               if (!node)
+                       break;
+       }
+
+       return 0;
+}
+
 /* Find each controller in the system, attach and initialize
  * software state structure for each and link into the
  * pci_controller_root.  Setup the controller enough such
index 747978087a7ec6f3dc5ebbcca5e4770773016509..906c7966d00039c3925b31ffef97121952beaf0c 100644 (file)
 #include <asm/oplib.h>
 #include <asm/bpp.h>
 #include <asm/irq.h>
-#ifdef CONFIG_SPARC32
-#include <asm/pcic.h>          /* pcic_present */
-#endif
 
 struct sbus_bus *sbus_root = NULL;
 
 static struct linux_prom_irqs irqs[PROMINTR_MAX] __initdata = { { 0 } };
 
+#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
  * setup the iommu for each Sbus.
@@ -336,17 +337,10 @@ static int __init sbus_init(void)
                   (nd = prom_getchild(iommund)) == 0 ||
                   (nd = prom_searchsiblings(nd, "sbus")) == 0) {
 #ifdef CONFIG_PCI
-#ifdef CONFIG_SPARC32
                         if (!pcic_present()) {
                                 prom_printf("Neither SBUS nor PCI found.\n");
                                 prom_halt();
                         }
-#else
-                        if (!pcibios_present()) {
-                                prom_printf("Neither SBUS nor PCI found.\n");
-                                prom_halt();
-                        }
-#endif
                         return 0;
 #else
                        /* No reason to run further - the data access trap will occur. */