--- xc/programs/Xserver/hw/xfree86/os-support/bus/Pci.c~ Thu Jan 24 20:28:28 2002 +++ xc/programs/Xserver/hw/xfree86/os-support/bus/Pci.c Thu Jan 24 21:19:39 2002 @@ -1075,14 +1075,31 @@ for (i = ROM_BASE_PRESET; i <= ROM_BASE_FIND; i++) { memType savebase = 0, newbase, romaddr; - if (i == ROM_BASE_PRESET) { + switch (i) { + case ROM_BASE_PRESET: /* Does the driver have a preference? */ if (basereg > ROM_BASE_PRESET && basereg <= ROM_BASE_FIND) b_reg = basereg; else b_reg = ++i; - } else + + break; + case ROM_BASE_FIND: + /* + * If we have something that looks like a valid address + * in romsave, it's probably not going to help to try + * to guess a new address and reprogram it. + */ + if (PCIGETROM(romsave)) { + pciWriteLong(Tag, PCI_MAP_ROM_REG, PCI_MAP_ROM_ADDRESS_MASK); + if (romsave != pciReadLong(Tag, PCI_MAP_ROM_REG)) { + pciWriteLong(Tag, PCI_MAP_ROM_REG, romsave); + continue; + } + } + default: b_reg = i; + } if (!(newbase = getValidBIOSBase(Tag, b_reg))) continue; /* no valid address found */