summaryrefslogtreecommitdiffstats
path: root/sys/sparc64/pci/ofw_pcibus.c
diff options
context:
space:
mode:
authormarius <marius@FreeBSD.org>2005-01-20 13:29:31 +0000
committermarius <marius@FreeBSD.org>2005-01-20 13:29:31 +0000
commit17423a01f382b11eb4f28f9187414ba0e74ff410 (patch)
tree6c484c7f51e417a0281f6e9a69e1c2da387d004e /sys/sparc64/pci/ofw_pcibus.c
parent2fa7cf8313c4e3636e511f67df4a3e1a80943a88 (diff)
downloadFreeBSD-src-17423a01f382b11eb4f28f9187414ba0e74ff410.zip
FreeBSD-src-17423a01f382b11eb4f28f9187414ba0e74ff410.tar.gz
At least on some U30 there's a spurious duplicate device node of an EBus
bridge in the device tree which lacks the mandatory (also by the OFW PCI bus binding spec) "reg" property. Change the code to just ignore nodes missing the "reg" property instead of panicing when encountering such a node. Also ignore nodes without a "name" property (guaranteed by the OFW PCI bus binding spec). This brings the behaviour of the MD OFW PCI code regarding such incomplete nodes in line with the EBus and the SBus code. Tested by: Cyril Tikhomiroff <tikho@anor.net> MFC after: 1 month
Diffstat (limited to 'sys/sparc64/pci/ofw_pcibus.c')
-rw-r--r--sys/sparc64/pci/ofw_pcibus.c17
1 files changed, 12 insertions, 5 deletions
diff --git a/sys/sparc64/pci/ofw_pcibus.c b/sys/sparc64/pci/ofw_pcibus.c
index c4cf9e5..d78c44b 100644
--- a/sys/sparc64/pci/ofw_pcibus.c
+++ b/sys/sparc64/pci/ofw_pcibus.c
@@ -209,6 +209,7 @@ ofw_pcibus_attach(device_t dev)
struct ofw_pci_register pcir;
struct ofw_pcibus_devinfo *dinfo;
phandle_t node, child;
+ char *cname;
u_int slot, busno, func;
/*
@@ -221,14 +222,21 @@ ofw_pcibus_attach(device_t dev)
node = ofw_bus_get_node(dev);
for (child = OF_child(node); child != 0; child = OF_peer(child)) {
- if (OF_getprop(child, "reg", &pcir, sizeof(pcir)) == -1)
- panic("ofw_pci_attach: OF_getprop failed");
+ if ((OF_getprop_alloc(child, "name", 1, (void **)&cname)) == -1)
+ continue;
+
+ if (OF_getprop(child, "reg", &pcir, sizeof(pcir)) == -1) {
+ device_printf(dev, "<%s>: incomplete\n", cname);
+ free(cname, M_OFWPROP);
+ continue;
+ }
slot = OFW_PCI_PHYS_HI_DEVICE(pcir.phys_hi);
func = OFW_PCI_PHYS_HI_FUNCTION(pcir.phys_hi);
ofw_pcibus_setup_device(pcib, busno, slot, func);
dinfo = (struct ofw_pcibus_devinfo *)pci_read_device(pcib,
busno, slot, func, sizeof(*dinfo));
if (dinfo != NULL) {
+ dinfo->opd_name = cname;
dinfo->opd_node = child;
OF_getprop_alloc(child, "compatible", 1,
(void **)&dinfo->opd_compat);
@@ -236,10 +244,9 @@ ofw_pcibus_attach(device_t dev)
(void **)&dinfo->opd_type);
OF_getprop_alloc(child, "model", 1,
(void **)&dinfo->opd_model);
- OF_getprop_alloc(child, "name", 1,
- (void **)&dinfo->opd_name);
pci_add_child(dev, (struct pci_devinfo *)dinfo);
- }
+ } else
+ free(cname, M_OFWPROP);
}
return (bus_generic_attach(dev));
OpenPOWER on IntegriCloud