Revert "MdeModulePkg: Fix a PciBusDxe hot plug bug"
Leif suggested to split the big patch to smaller ones. This reverts commit 73b7f115c653c807b9d0be97bf516871d8aff7ba. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com> Reviewed-by: Feng Tian <feng.tian@intel.com> git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@18717 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
@@ -196,7 +196,6 @@ CalculateApertureIo16 (
|
||||
PCI_RESOURCE_NODE *Node;
|
||||
UINT64 Offset;
|
||||
EFI_PCI_PLATFORM_POLICY PciPolicy;
|
||||
UINT64 PaddingAperture;
|
||||
|
||||
if (!mPolicyDetermined) {
|
||||
//
|
||||
@@ -229,27 +228,21 @@ CalculateApertureIo16 (
|
||||
mPolicyDetermined = TRUE;
|
||||
}
|
||||
|
||||
Aperture = 0;
|
||||
PaddingAperture = 0;
|
||||
Aperture = 0;
|
||||
|
||||
if (Bridge == NULL) {
|
||||
return ;
|
||||
}
|
||||
|
||||
CurrentLink = Bridge->ChildList.ForwardLink;
|
||||
|
||||
//
|
||||
// Assume the bridge is aligned
|
||||
//
|
||||
for ( CurrentLink = GetFirstNode (&Bridge->ChildList)
|
||||
; !IsNull (&Bridge->ChildList, CurrentLink)
|
||||
; CurrentLink = GetNextNode (&Bridge->ChildList, CurrentLink)
|
||||
) {
|
||||
while (CurrentLink != &Bridge->ChildList) {
|
||||
|
||||
Node = RESOURCE_NODE_FROM_LINK (CurrentLink);
|
||||
if (Node->ResourceUsage == PciResUsagePadding) {
|
||||
ASSERT (PaddingAperture == 0);
|
||||
PaddingAperture = Node->Length;
|
||||
continue;
|
||||
}
|
||||
|
||||
//
|
||||
// Consider the aperture alignment
|
||||
//
|
||||
@@ -300,10 +293,13 @@ CalculateApertureIo16 (
|
||||
// Increment aperture by the length of node
|
||||
//
|
||||
Aperture += Node->Length;
|
||||
|
||||
CurrentLink = CurrentLink->ForwardLink;
|
||||
}
|
||||
|
||||
//
|
||||
// Adjust the aperture with the bridge's alignment
|
||||
// At last, adjust the aperture with the bridge's
|
||||
// alignment
|
||||
//
|
||||
Offset = Aperture & (Bridge->Alignment);
|
||||
|
||||
@@ -323,12 +319,6 @@ CalculateApertureIo16 (
|
||||
Bridge->Alignment = Node->Alignment;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Hotplug controller needs padding resources.
|
||||
// Use the larger one between the padding resource and actual occupied resource.
|
||||
//
|
||||
Bridge->Length = MAX (Bridge->Length, PaddingAperture);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -346,11 +336,10 @@ CalculateResourceAperture (
|
||||
UINT64 Aperture;
|
||||
LIST_ENTRY *CurrentLink;
|
||||
PCI_RESOURCE_NODE *Node;
|
||||
UINT64 PaddingAperture;
|
||||
|
||||
UINT64 Offset;
|
||||
|
||||
Aperture = 0;
|
||||
PaddingAperture = 0;
|
||||
Aperture = 0;
|
||||
|
||||
if (Bridge == NULL) {
|
||||
return ;
|
||||
@@ -362,20 +351,14 @@ CalculateResourceAperture (
|
||||
return ;
|
||||
}
|
||||
|
||||
CurrentLink = Bridge->ChildList.ForwardLink;
|
||||
|
||||
//
|
||||
// Assume the bridge is aligned
|
||||
//
|
||||
for ( CurrentLink = GetFirstNode (&Bridge->ChildList)
|
||||
; !IsNull (&Bridge->ChildList, CurrentLink)
|
||||
; CurrentLink = GetNextNode (&Bridge->ChildList, CurrentLink)
|
||||
) {
|
||||
while (CurrentLink != &Bridge->ChildList) {
|
||||
|
||||
Node = RESOURCE_NODE_FROM_LINK (CurrentLink);
|
||||
if (Node->ResourceUsage == PciResUsagePadding) {
|
||||
ASSERT (PaddingAperture == 0);
|
||||
PaddingAperture = Node->Length;
|
||||
continue;
|
||||
}
|
||||
|
||||
//
|
||||
// Apply padding resource if available
|
||||
@@ -398,6 +381,11 @@ CalculateResourceAperture (
|
||||
// Increment aperture by the length of node
|
||||
//
|
||||
Aperture += Node->Length;
|
||||
|
||||
//
|
||||
// Consider the aperture alignment
|
||||
//
|
||||
CurrentLink = CurrentLink->ForwardLink;
|
||||
}
|
||||
|
||||
//
|
||||
@@ -419,7 +407,7 @@ CalculateResourceAperture (
|
||||
}
|
||||
|
||||
//
|
||||
// Adjust the bridge's alignment to the first child's alignment
|
||||
// At last, adjust the bridge's alignment to the first child's alignment
|
||||
// if the bridge has at least one child
|
||||
//
|
||||
CurrentLink = Bridge->ChildList.ForwardLink;
|
||||
@@ -429,12 +417,6 @@ CalculateResourceAperture (
|
||||
Bridge->Alignment = Node->Alignment;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Hotplug controller needs padding resources.
|
||||
// Use the larger one between the padding resource and actual occupied resource.
|
||||
//
|
||||
Bridge->Length = MAX (Bridge->Length, PaddingAperture);
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user