Bug #4139: Fix a BAR remapping bug that could lead to IERR and system hang.

(Egbert Eich)
This commit is contained in:
Adam Jackson
2006-05-18 23:52:51 +00:00
parent 91239d83f4
commit deebf6bd51
8 changed files with 182 additions and 74 deletions

View File

@@ -201,12 +201,14 @@ xf86GetOSOffsetFromPCI(PCITAG tag, int space, unsigned long base)
fn = devfn & 0x7;
if (tag == pciTag(bus,dev,fn)) {
/* ok now look through all the BAR values of this device */
pciConfigPtr pDev = xf86GetPciConfigFromTag(tag);
for (ndx=0; ndx<7; ndx++) {
unsigned long savePtr, flagMask;
if (ndx == 6)
savePtr = pciReadLong(tag, PCI_CMD_BIOS_REG);
savePtr = pDev->pci_baserom;
else /* this the ROM bar */
savePtr = pciReadLong(tag, PCI_CMD_BASE_REG + (0x4 * ndx));
savePtr = (&pDev->pci_base0)[ndx];
/* Ignore unset base addresses. The kernel may
* have reported non-zero size and address even
* if they are disabled (e.g. disabled ROM BAR).