This was something I found a while back but I am not a developer directly here.
Even if most of the users of this code won't care at his point going forward it
should be fixed, and perhaps someone should look around in other pieces of code
to see if someone did the same thing elsewhere.
The problem is in LegacyPci.c
There is the function CreateBridgeTable,
In this function there is a sort:
for (Index = 0; Index < NumberOfBridges - 1; Index++) {
for (Index1 = Index + 1; Index1 < NumberOfBridges; Index1++) {
if (Bridges[Index].SecondaryBus > Bridges[Index1].SecondaryBus) {
SortedBridgeIndex[Index] = Index1;
SortedBridgeIndex[Index1] = Index;
}
if ((Bridges[Index].SecondaryBus == Bridges[Index1].SecondaryBus) &&
(Bridges[Index].SubordinateBus > Bridges[Index1].SubordinateBus)
) {
SortedBridgeIndex[Index] = Index1;
SortedBridgeIndex[Index1] = Index;
}
}
}
For a significantly mixed up table of bridges , this will actually destroy
records in the lists. It should be
for (Index = 0; Index < NumberOfBridges - 1; Index++) {
for (Index1 = Index + 1; Index1 < NumberOfBridges; Index1++) {
if (Bridges[SortedBridgeIndex [Index]].SecondaryBus >
Bridges[SortedBridgeIndex [Index1]].SecondaryBus) {
save = SortedBridgeIndex[Index1];
SortedBridgeIndex[Index1] = SortedBridgeIndex[Index];
SortedBridgeIndex[Index] = save;
}
#if 0
if ((Bridges[Index].SecondaryBus == Bridges[Index1].SecondaryBus) &&
(Bridges[Index].SubordinateBus > Bridges[Index1].SubordinateBus)
) {
SortedBridgeIndex[Index] = Index1;
SortedBridgeIndex[Index1] = Index;
}
#endif
}
}
I am pretty sure the second part is unneeded, if a bridge has a secondary bus
equal to another bridge then it must be the same bridge, you can't have two
busses without unique bus numbers. If the bridges are the same bridge then
they have the same subordinate bus number as well.
Sincerely,
Tony Marchini
------------------------------------------------------------------------------
Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server
from Actuate! Instantly Supercharge Your Business Reports and Dashboards
with Interactivity, Sharing, Native Excel Exports, App Integration & more
Get technology previously reserved for billion-dollar corporations, FREE
http://pubads.g.doubleclick.net/gampad/clk?id=164703151&iu=/4140/ostg.clktrk
_______________________________________________
edk2-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/edk2-devel