Fix a bug in DegradeResource().

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@9621 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
rsun3 2009-12-29 03:14:37 +00:00
parent bd1a4d1800
commit de028a62de
1 changed files with 16 additions and 15 deletions

View File

@ -1048,45 +1048,46 @@ DegradeResource (
) )
{ {
PCI_IO_DEVICE *Temp; PCI_IO_DEVICE *Temp;
LIST_ENTRY *CurrentLink; LIST_ENTRY *ChildDeviceLink;
LIST_ENTRY *ChildNodeLink;
PCI_RESOURCE_NODE *TempNode; PCI_RESOURCE_NODE *TempNode;
// //
// If any child device has both option ROM and 64-bit BAR, degrade its PMEM64/MEM64 // If any child device has both option ROM and 64-bit BAR, degrade its PMEM64/MEM64
// requests in case that if a legacy option ROM image can not access 64-bit resources. // requests in case that if a legacy option ROM image can not access 64-bit resources.
// //
CurrentLink = Bridge->ChildList.ForwardLink; ChildDeviceLink = Bridge->ChildList.ForwardLink;
while (CurrentLink != NULL && CurrentLink != &Bridge->ChildList) { while (ChildDeviceLink != NULL && ChildDeviceLink != &Bridge->ChildList) {
Temp = PCI_IO_DEVICE_FROM_LINK (CurrentLink); Temp = PCI_IO_DEVICE_FROM_LINK (ChildDeviceLink);
if (Temp->RomSize != 0) { if (Temp->RomSize != 0) {
if (!IsListEmpty (&Mem64Node->ChildList)) { if (!IsListEmpty (&Mem64Node->ChildList)) {
CurrentLink = Mem64Node->ChildList.ForwardLink; ChildNodeLink = Mem64Node->ChildList.ForwardLink;
while (CurrentLink != &Mem64Node->ChildList) { while (ChildNodeLink != &Mem64Node->ChildList) {
TempNode = RESOURCE_NODE_FROM_LINK (CurrentLink); TempNode = RESOURCE_NODE_FROM_LINK (ChildNodeLink);
if (TempNode->PciDev == Temp) { if (TempNode->PciDev == Temp) {
RemoveEntryList (CurrentLink); RemoveEntryList (ChildNodeLink);
InsertResourceNode (Mem32Node, TempNode); InsertResourceNode (Mem32Node, TempNode);
} }
CurrentLink = TempNode->Link.ForwardLink; ChildNodeLink = TempNode->Link.ForwardLink;
} }
} }
if (!IsListEmpty (&PMem64Node->ChildList)) { if (!IsListEmpty (&PMem64Node->ChildList)) {
CurrentLink = PMem64Node->ChildList.ForwardLink; ChildNodeLink = PMem64Node->ChildList.ForwardLink;
while (CurrentLink != &PMem64Node->ChildList) { while (ChildNodeLink != &PMem64Node->ChildList) {
TempNode = RESOURCE_NODE_FROM_LINK (CurrentLink); TempNode = RESOURCE_NODE_FROM_LINK (ChildNodeLink);
if (TempNode->PciDev == Temp) { if (TempNode->PciDev == Temp) {
RemoveEntryList (CurrentLink); RemoveEntryList (ChildNodeLink);
InsertResourceNode (PMem32Node, TempNode); InsertResourceNode (PMem32Node, TempNode);
} }
CurrentLink = TempNode->Link.ForwardLink; ChildNodeLink = TempNode->Link.ForwardLink;
} }
} }
} }
CurrentLink = CurrentLink->ForwardLink; ChildDeviceLink = ChildDeviceLink->ForwardLink;
} }
// //