embeddedsw icon indicating copy to clipboard operation
embeddedsw copied to clipboard

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

Open StefanoPietrosanti opened this issue 1 year ago • 1 comments

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.

StefanoPietrosanti avatar Dec 04 '23 16:12 StefanoPietrosanti

@StefanoPietrosanti ,

The static keyword allows the LastBusNum to retain the secondary bus number across multiple function calls, enabling full PCIe bridge enumeration. Without the static keyword, the bus number is not retained, leading to only a Bus 0 enumeration.

Based on our understanding, a PCIe warm reset only affects the link's physical layer and does not impact bus enumeration. can you explain what does warm reset here?

BhavanaJupalli1997 avatar Sep 26 '24 12:09 BhavanaJupalli1997