mirror of
https://git.FreeBSD.org/src.git
synced 2024-12-30 12:04:07 +00:00
Clarify a misleading comment. The test in pci_reserve_map() was meant to
ignore BARs that are invalid due to having a size of zero, not to ignore BARs with an existing base of zero. While here, reorganize the code slightly to make the intent clearer. Reported by: avg MFC after: 1 week
This commit is contained in:
parent
3e36aa656e
commit
fb2439a6f6
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=214146
@ -3664,9 +3664,15 @@ pci_reserve_map(device_t dev, device_t child, int type, int *rid,
|
||||
res = NULL;
|
||||
pci_read_bar(child, *rid, &map, &testval);
|
||||
|
||||
/* Ignore a BAR with a base of 0. */
|
||||
if ((*rid == PCIR_BIOS && pci_rombase(testval) == 0) ||
|
||||
pci_mapbase(testval) == 0)
|
||||
/*
|
||||
* Determine the size of the BAR and ignore BARs with a size
|
||||
* of 0. Device ROM BARs use a different mask value.
|
||||
*/
|
||||
if (*rid == PCIR_BIOS)
|
||||
mapsize = pci_romsize(testval);
|
||||
else
|
||||
mapsize = pci_mapsize(testval);
|
||||
if (mapsize == 0)
|
||||
goto out;
|
||||
|
||||
if (PCI_BAR_MEM(testval) || *rid == PCIR_BIOS) {
|
||||
@ -3695,13 +3701,7 @@ pci_reserve_map(device_t dev, device_t child, int type, int *rid,
|
||||
* actually uses and we would otherwise have a
|
||||
* situation where we might allocate the excess to
|
||||
* another driver, which won't work.
|
||||
*
|
||||
* Device ROM BARs use a different mask value.
|
||||
*/
|
||||
if (*rid == PCIR_BIOS)
|
||||
mapsize = pci_romsize(testval);
|
||||
else
|
||||
mapsize = pci_mapsize(testval);
|
||||
count = 1UL << mapsize;
|
||||
if (RF_ALIGNMENT(flags) < mapsize)
|
||||
flags = (flags & ~RF_ALIGNMENT_MASK) | RF_ALIGNMENT_LOG2(mapsize);
|
||||
|
Loading…
Reference in New Issue
Block a user