When we tested if a PCI base address was unassigned we didn't take into

account that this bar could have been the upper part of a 64bit base
    address. This fix makes this code 64bit bar aware (Bugzilla #2382).
This commit is contained in:
Egbert Eich 2005-01-26 15:50:17 +00:00
parent 7c3dd0a5a7
commit 59c7005bb1

View File

@ -172,6 +172,17 @@ IsBaseUnassigned(CARD32 base)
return (!base || (base == mask)); return (!base || (base == mask));
} }
static Bool
IsBaseUnassigned64(CARD32 base0, CARD32 base1)
{
base0 &= ~PCI_MAP_MEMORY_ATTR_MASK;
base1 &= 0xffffffff;
return ((!base0 && !base1)
|| ((base0 == ~PCI_MAP_MEMORY_ATTR_MASK)
&& (base1 == 0xffffffff)));
}
static void static void
FindPCIVideoInfo(void) FindPCIVideoInfo(void)
{ {
@ -274,18 +285,28 @@ FindPCIVideoInfo(void)
} }
if (PCINONSYSTEMCLASSES(baseclass, subclass)) { if (PCINONSYSTEMCLASSES(baseclass, subclass)) {
if (info->size[0] && IsBaseUnassigned(pcrp->pci_base0)) /*
pcrp->pci_base0 = pciCheckForBrokenBase(pcrp->tag, 0); * Check of a PCI base is unassigned. If so
if (info->size[1] && IsBaseUnassigned(pcrp->pci_base1)) * attempt to fix it. Validation will determine
pcrp->pci_base1 = pciCheckForBrokenBase(pcrp->tag, 1); * if the value was correct later on.
if (info->size[2] && IsBaseUnassigned(pcrp->pci_base2)) */
pcrp->pci_base2 = pciCheckForBrokenBase(pcrp->tag, 2); CARD32 *base = &pcrp->pci_base0;
if (info->size[3] && IsBaseUnassigned(pcrp->pci_base3))
pcrp->pci_base3 = pciCheckForBrokenBase(pcrp->tag, 3); for (j = 0; j < 6; j++) {
if (info->size[4] && IsBaseUnassigned(pcrp->pci_base4)) if (!PCI_MAP_IS64BITMEM(base[j])) {
pcrp->pci_base4 = pciCheckForBrokenBase(pcrp->tag, 4); if (info->size[j] && IsBaseUnassigned(base[j]))
if (info->size[5] && IsBaseUnassigned(pcrp->pci_base5)) base[j] = pciCheckForBrokenBase(pcrp->tag, j);
pcrp->pci_base5 = pciCheckForBrokenBase(pcrp->tag, 5); } else {
if (j == 5) /* bail out */
break;
if (info->size[j]
&& IsBaseUnassigned64(base[j],base[j+1])) {
base[j] = pciCheckForBrokenBase(pcrp->tag, j);
j++;
base[j] = pciCheckForBrokenBase(pcrp->tag, j);
}
}
}
} }
/* /*