Commit f3e488ec authored by David S. Miller's avatar David S. Miller

SPARC: Implement pcic_present which walks OBP tree, use it always in sbus_init.

parent cafe8464
...@@ -114,6 +114,53 @@ static void pci_controller_init(char *model_name, int namelen, int node) ...@@ -114,6 +114,53 @@ static void pci_controller_init(char *model_name, int namelen, int node)
printk("PCI: Ignoring controller...\n"); 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 /* Find each controller in the system, attach and initialize
* software state structure for each and link into the * software state structure for each and link into the
* pci_controller_root. Setup the controller enough such * pci_controller_root. Setup the controller enough such
......
...@@ -16,14 +16,15 @@ ...@@ -16,14 +16,15 @@
#include <asm/oplib.h> #include <asm/oplib.h>
#include <asm/bpp.h> #include <asm/bpp.h>
#include <asm/irq.h> #include <asm/irq.h>
#ifdef CONFIG_SPARC32
#include <asm/pcic.h> /* pcic_present */
#endif
struct sbus_bus *sbus_root = NULL; struct sbus_bus *sbus_root = NULL;
static struct linux_prom_irqs irqs[PROMINTR_MAX] __initdata = { { 0 } }; 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 /* Perhaps when I figure out more about the iommu we'll put a
* device registration routine here that probe_sbus() calls to * device registration routine here that probe_sbus() calls to
* setup the iommu for each Sbus. * setup the iommu for each Sbus.
...@@ -336,17 +337,10 @@ static int __init sbus_init(void) ...@@ -336,17 +337,10 @@ static int __init sbus_init(void)
(nd = prom_getchild(iommund)) == 0 || (nd = prom_getchild(iommund)) == 0 ||
(nd = prom_searchsiblings(nd, "sbus")) == 0) { (nd = prom_searchsiblings(nd, "sbus")) == 0) {
#ifdef CONFIG_PCI #ifdef CONFIG_PCI
#ifdef CONFIG_SPARC32
if (!pcic_present()) { if (!pcic_present()) {
prom_printf("Neither SBUS nor PCI found.\n"); prom_printf("Neither SBUS nor PCI found.\n");
prom_halt(); prom_halt();
} }
#else
if (!pcibios_present()) {
prom_printf("Neither SBUS nor PCI found.\n");
prom_halt();
}
#endif
return 0; return 0;
#else #else
/* No reason to run further - the data access trap will occur. */ /* No reason to run further - the data access trap will occur. */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment