diff options
author | Warner Losh <imp@FreeBSD.org> | 2005-06-03 19:41:06 +0000 |
---|---|---|
committer | Warner Losh <imp@FreeBSD.org> | 2005-06-03 19:41:06 +0000 |
commit | f9937ed8f3fa040c39aba8ad433c978269ec3eec (patch) | |
tree | 1df46df2a39a9477585132e60932e65b4f210cfc /sys/dev/pci/pci.c | |
parent | 943af9df1b99688078cb654d9cbf1c4edb23ee9b (diff) | |
download | src-f9937ed8f3fa040c39aba8ad433c978269ec3eec.tar.gz src-f9937ed8f3fa040c39aba8ad433c978269ec3eec.zip |
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
Notes
Notes:
svn path=/head/; revision=146947
Diffstat (limited to 'sys/dev/pci/pci.c')
-rw-r--r-- | sys/dev/pci/pci.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/sys/dev/pci/pci.c b/sys/dev/pci/pci.c index 9d3223753d98..c0ed235812a7 100644 --- a/sys/dev/pci/pci.c +++ b/sys/dev/pci/pci.c @@ -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) |