Xilinx / embeddedsw

Xilinx Embedded Software (embeddedsw) Development
Other
885 stars 1.05k forks source link

pciepsu.c : Bus number erroneously carried over when re-initialising PCIe interface #275

Open StefanoPietrosanti opened 6 months ago

StefanoPietrosanti commented 6 months ago

In pciepsu.c line 795 :

static void XPciePsu_FetchDevicesInBus(XPciePsu *InstancePtr, u8 BusNum)
{
    u32 ConfigData = 0;
    static u8 LastBusNum;
[...]

LastBusNum is set to static, but there doesn't seem to be a real reason for it to be static. This causes problems when resetting and re-initialising the bus, as there is no way to reset the value of LastBusNum. I found that removing the static attribute makes it work without issues, particularly after re-initialising the bus after a warm reset.