Author: blueswirl Date: 2009-01-07 16:57:07 +0100 (Wed, 07 Jan 2009) New Revision: 369
Modified: openbios-devel/drivers/pci.c openbios-devel/drivers/pci_database.c Log: Don't hang if we discover an unknown device (Laurent Vivier)
Modified: openbios-devel/drivers/pci.c =================================================================== --- openbios-devel/drivers/pci.c 2009-01-07 15:55:19 UTC (rev 368) +++ openbios-devel/drivers/pci.c 2009-01-07 15:57:07 UTC (rev 369) @@ -510,38 +510,43 @@ set_int_property(dev, "cache-line-size", pci_config_read16(addr, PCI_CACHE_LINE_SIZE));
- if (pci_dev->type) { - push_str(pci_dev->type); - fword("encode-string"); - push_str("device_type"); - fword("property"); + if (pci_dev) { + if (pci_dev->type) { + push_str(pci_dev->type); + fword("encode-string"); + push_str("device_type"); + fword("property"); + } + if (pci_dev->model) { + push_str(pci_dev->model); + fword("encode-string"); + push_str("model"); + fword("property"); + } + if (pci_dev->compat) + set_property(dev, "compatible", + pci_dev->compat, pci_compat_len(pci_dev)); + + if (pci_dev->acells) + set_int_property(dev, "#address-cells", + pci_dev->acells); + if (pci_dev->scells) + set_int_property(dev, "#size-cells", + pci_dev->scells); + if (pci_dev->icells) + set_int_property(dev, "#interrupt-cells", + pci_dev->icells); } - if (pci_dev->model) { - push_str(pci_dev->model); - fword("encode-string"); - push_str("model"); - fword("property"); - } - if (pci_dev->compat) - set_property(dev, "compatible", - pci_dev->compat, pci_compat_len(pci_dev));
pci_set_reg(config); pci_set_assigned_addresses(config); pci_set_interrupt_map(config);
- if (pci_dev->acells) - set_int_property(dev, "#address-cells", pci_dev->acells); - if (pci_dev->scells) - set_int_property(dev, "#size-cells", pci_dev->scells); - if (pci_dev->icells) - set_int_property(dev, "#interrupt-cells", pci_dev->icells); - #ifdef CONFIG_DEBUG_PCI printk("\n"); #endif
- if (pci_dev->config_cb) + if (pci_dev && pci_dev->config_cb) pci_dev->config_cb(config); }
Modified: openbios-devel/drivers/pci_database.c =================================================================== --- openbios-devel/drivers/pci_database.c 2009-01-07 15:55:19 UTC (rev 368) +++ openbios-devel/drivers/pci_database.c 2009-01-07 15:57:07 UTC (rev 369) @@ -1022,7 +1022,9 @@ break; } } - find_device: +find_device: + if (dev == NULL) + goto bad_device; for (;; dev++) { if (dev->vendor == 0xFFFF && dev->product == 0xFFFF) { goto bad_device; @@ -1055,7 +1057,7 @@ return new; } } - bad_device: +bad_device: printk("Cannot manage '%s' PCI device type '%s':\n %x %x (%x %x %x)\n", name, type, vendor, product, class, subclass, iface);