--- /home/dwhite/stable/src/sys/dev/pci/pci.c Fri Apr 1 22:53:42 2005 +++ pci.c Fri Jun 3 01:46:08 2005 @@ -1624,9 +1624,11 @@ */ res = NULL; map = pci_read_config(child, *rid, 4); + if (pci_mapbase(map) == 0) + return (NULL); pci_write_config(child, *rid, 0xffffffff, 4); testval = pci_read_config(child, *rid, 4); - if (testval == 0) + if (pci_mapbase(testval) == 0) return (NULL); if (pci_maptype(testval) & PCI_MAPMEM) { if (type != SYS_RES_MEMORY) { @@ -1659,7 +1661,7 @@ * Allocate enough resource, and then write back the * appropriate bar for that resource. */ - res = BUS_ALLOC_RESOURCE(device_get_parent(dev), child, type, rid, + res = BUS_ALLOC_RESOURCE(dev, child, type, rid, start, end, count, flags); if (res == NULL) { device_printf(child, "%#lx bytes of rid %#x res %d failed.\n",