Mask off the bar's value after the probe test write before testing

against 0 in pci_alloc_map, just like we do in pci_add_map.  Also,
make sure that we restore the value to the BAR that was there before
if the bar is 0.  Chances are that it was 0 before the write too and
that the restoration is a nop, but better safe than sorry.

Notice by: dwhite
This commit is contained in:
Warner Losh 2005-06-03 19:41:06 +00:00
parent 943af9df1b
commit f9937ed8f3

View File

@ -1626,8 +1626,8 @@ pci_alloc_map(device_t dev, device_t child, int type, int *rid,
map = pci_read_config(child, *rid, 4);
pci_write_config(child, *rid, 0xffffffff, 4);
testval = pci_read_config(child, *rid, 4);
if (testval == 0)
return (NULL);
if (pci_mapbase(testval) == 0)
goto out;
if (pci_maptype(testval) & PCI_MAPMEM) {
if (type != SYS_RES_MEMORY) {
if (bootverbose)